use of com.graphhopper.reader.ReaderWay in project graphhopper by graphhopper.
the class ConditionalOSMTagInspectorTest method testConditionalSingleDay.
@Test
public void testConditionalSingleDay() {
Calendar cal = getCalendar(2015, Calendar.DECEMBER, 27);
ConditionalTagInspector acceptor = new ConditionalOSMTagInspector(cal, getSampleConditionalTags(), getSampleRestrictedValues(), getSamplePermissiveValues());
ReaderWay way = new ReaderWay(1);
way.setTag("vehicle:conditional", "no @ (Su)");
assertTrue(acceptor.isPermittedWayConditionallyRestricted(way));
}
use of com.graphhopper.reader.ReaderWay in project graphhopper by graphhopper.
the class EdgeElevationInterpolatorTest method setUp.
@SuppressWarnings("resource")
@BeforeEach
public void setUp() {
graph = new GraphBuilder(encodingManager = new EncodingManager.Builder().add(new CarFlagEncoder()).add(new FootFlagEncoder()).build()).set3D(true).create();
roadEnvEnc = encodingManager.getEnumEncodedValue(RoadEnvironment.KEY, RoadEnvironment.class);
edgeElevationInterpolator = createEdgeElevationInterpolator();
relFlags = encodingManager.createRelationFlags();
interpolatableWay = createInterpolatableWay();
normalWay = new ReaderWay(0);
normalWay.setTag("highway", "primary");
}
use of com.graphhopper.reader.ReaderWay in project graphhopper by graphhopper.
the class PathTest method generatePathDetailsGraph.
private Graph generatePathDetailsGraph() {
final Graph graph = new GraphBuilder(carManager).create();
final NodeAccess na = graph.getNodeAccess();
na.setNode(1, 52.514, 13.348);
na.setNode(2, 52.514, 13.349);
na.setNode(3, 52.514, 13.350);
na.setNode(4, 52.515, 13.349);
na.setNode(5, 52.516, 13.3452);
na.setNode(6, 52.516, 13.344);
ReaderWay w = new ReaderWay(1);
w.setTag("highway", "tertiary");
w.setTag("maxspeed", "50");
EdgeIteratorState tmpEdge;
tmpEdge = GHUtility.setSpeed(60, true, true, encoder, graph.edge(1, 2).setDistance(5)).setName("1-2");
assertNotEquals(EncodingManager.Access.CAN_SKIP, ((AbstractFlagEncoder) encoder).getAccess(w));
IntsRef relFlags = carManager.createRelationFlags();
tmpEdge.setFlags(carManager.handleWayTags(w, relFlags));
tmpEdge = GHUtility.setSpeed(60, true, true, encoder, graph.edge(4, 5).setDistance(5)).setName("4-5");
tmpEdge.setFlags(carManager.handleWayTags(w, relFlags));
w.setTag("maxspeed", "100");
tmpEdge = GHUtility.setSpeed(60, true, true, encoder, graph.edge(2, 3).setDistance(5)).setName("2-3");
tmpEdge.setFlags(carManager.handleWayTags(w, relFlags));
w.setTag("maxspeed", "10");
tmpEdge = GHUtility.setSpeed(60, true, true, encoder, graph.edge(3, 4).setDistance(10)).setName("3-4");
tmpEdge.setFlags(carManager.handleWayTags(w, relFlags));
tmpEdge = GHUtility.setSpeed(60, true, true, encoder, graph.edge(5, 6).setDistance(0.01)).setName("3-4");
tmpEdge.setFlags(carManager.handleWayTags(w, relFlags));
return graph;
}
use of com.graphhopper.reader.ReaderWay in project graphhopper by graphhopper.
the class AbstractBikeFlagEncoderTester method testAvoidMotorway.
@Test
public void testAvoidMotorway() {
ReaderWay osmWay = new ReaderWay(1);
osmWay.setTag("highway", "motorway");
osmWay.setTag("bicycle", "yes");
assertPriority(AVOID.getValue(), osmWay);
}
use of com.graphhopper.reader.ReaderWay in project graphhopper by graphhopper.
the class AbstractBikeFlagEncoderTester method testRelation.
@Test
public void testRelation() {
ReaderWay way = new ReaderWay(1);
way.setTag("highway", "track");
way.setTag("bicycle", "yes");
way.setTag("foot", "yes");
way.setTag("motor_vehicle", "agricultural");
way.setTag("surface", "gravel");
way.setTag("tracktype", "grade3");
ReaderRelation rel = new ReaderRelation(0);
rel.setTag("type", "route");
rel.setTag("network", "rcn");
rel.setTag("route", "bicycle");
ReaderRelation rel2 = new ReaderRelation(1);
rel2.setTag("type", "route");
rel2.setTag("network", "lcn");
rel2.setTag("route", "bicycle");
// two relation tags => we currently cannot store a list, so pick the lower ordinal 'regional'
// Example https://www.openstreetmap.org/way/213492914 => two hike 84544, 2768803 and two bike relations 3162932, 5254650
IntsRef relFlags = encodingManager.handleRelationTags(rel2, encodingManager.handleRelationTags(rel, encodingManager.createRelationFlags()));
IntsRef edgeFlags = encodingManager.handleWayTags(way, relFlags);
EnumEncodedValue<RouteNetwork> enc = encodingManager.getEnumEncodedValue(RouteNetwork.key("bike"), RouteNetwork.class);
assertEquals(RouteNetwork.REGIONAL, enc.getEnum(false, edgeFlags));
}
Aggregations