use of com.graphhopper.routing.util.spatialrules.countries.DefaultSpatialRule in project graphhopper by graphhopper.
the class LandmarkStorageTest method testWithBorderBlocking.
@Test
public void testWithBorderBlocking() {
AbstractRoutingAlgorithmTester.initBiGraph(ghStorage);
LandmarkStorage storage = new LandmarkStorage(ghStorage, new RAMDirectory(), 2, new FastestWeighting(encoder), TraversalMode.NODE_BASED);
final SpatialRule ruleRight = new DefaultSpatialRule() {
@Override
public String getId() {
return "right";
}
};
final SpatialRule ruleLeft = new DefaultSpatialRule() {
@Override
public String getId() {
return "left";
}
};
final SpatialRuleLookup lookup = new SpatialRuleLookup() {
@Override
public SpatialRule lookupRule(double lat, double lon) {
if (lon > 0.00105)
return ruleRight;
return ruleLeft;
}
@Override
public SpatialRule lookupRule(GHPoint point) {
return lookupRule(point.lat, point.lon);
}
@Override
public void addRule(SpatialRule rule) {
}
@Override
public int getSpatialId(SpatialRule rule) {
throw new IllegalStateException();
}
@Override
public BBox getBounds() {
throw new IllegalStateException();
}
@Override
public int size() {
return 2;
}
};
storage.setSpatialRuleLookup(lookup);
storage.setMinimumNodes(2);
storage.createLandmarks();
assertEquals(3, storage.getSubnetworksWithLandmarks());
}
Aggregations