use of com.graphhopper.routing.util.spatialrules.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(), new FastestWeighting(encoder), 2);
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 int getSpatialId(SpatialRule rule) {
throw new IllegalStateException();
}
@Override
public int size() {
return 2;
}
@Override
public BBox getBounds() {
return new BBox(-180, 180, -90, 90);
}
};
storage.setSpatialRuleLookup(lookup);
storage.setMinimumNodes(2);
storage.createLandmarks();
assertEquals(3, storage.getSubnetworksWithLandmarks());
}
Aggregations