use of com.graphhopper.storage.IntsRef in project graphhopper by graphhopper.
the class OSMHazmatTunnelParserTest method testIgnoreNonTunnelSubtags.
@Test
public void testIgnoreNonTunnelSubtags() {
IntsRef intsRef = em.createEdgeFlags();
ReaderWay readerWay = new ReaderWay(1);
readerWay.setTag("hazmat:B", "no");
parser.handleWayTags(intsRef, readerWay, relFlags);
assertEquals(HazmatTunnel.A, hazTunnelEnc.getEnum(false, intsRef));
}
use of com.graphhopper.storage.IntsRef in project graphhopper by graphhopper.
the class OSMHazmatTunnelParserTest method testTunnelCat.
@Test
public void testTunnelCat() {
IntsRef intsRef = em.createEdgeFlags();
ReaderWay readerWay = new ReaderWay(1);
readerWay.setTag("hazmat:tunnel_cat", "A");
parser.handleWayTags(intsRef, readerWay, relFlags);
assertEquals(HazmatTunnel.A, hazTunnelEnc.getEnum(false, intsRef));
intsRef = em.createEdgeFlags();
readerWay = new ReaderWay(1);
readerWay.setTag("hazmat:tunnel_cat", "B");
parser.handleWayTags(intsRef, readerWay, relFlags);
assertEquals(HazmatTunnel.B, hazTunnelEnc.getEnum(false, intsRef));
intsRef = em.createEdgeFlags();
readerWay = new ReaderWay(1);
readerWay.setTag("hazmat:tunnel_cat", "C");
parser.handleWayTags(intsRef, readerWay, relFlags);
assertEquals(HazmatTunnel.C, hazTunnelEnc.getEnum(false, intsRef));
intsRef = em.createEdgeFlags();
readerWay = new ReaderWay(1);
readerWay.setTag("hazmat:tunnel_cat", "D");
parser.handleWayTags(intsRef, readerWay, relFlags);
assertEquals(HazmatTunnel.D, hazTunnelEnc.getEnum(false, intsRef));
intsRef = em.createEdgeFlags();
readerWay = new ReaderWay(1);
readerWay.setTag("hazmat:tunnel_cat", "E");
parser.handleWayTags(intsRef, readerWay, relFlags);
assertEquals(HazmatTunnel.E, hazTunnelEnc.getEnum(false, intsRef));
}
use of com.graphhopper.storage.IntsRef in project graphhopper by graphhopper.
the class OSMHazmatTunnelParserTest method testHazmatSubtags.
@Test
public void testHazmatSubtags() {
IntsRef intsRef = em.createEdgeFlags();
ReaderWay readerWay = new ReaderWay(1);
readerWay.setTag("tunnel", "yes");
readerWay.setTag("hazmat:A", "no");
parser.handleWayTags(intsRef, readerWay, relFlags);
assertEquals(HazmatTunnel.A, hazTunnelEnc.getEnum(false, intsRef));
intsRef = em.createEdgeFlags();
readerWay = new ReaderWay(1);
readerWay.setTag("tunnel", "yes");
readerWay.setTag("hazmat:B", "no");
parser.handleWayTags(intsRef, readerWay, relFlags);
assertEquals(HazmatTunnel.B, hazTunnelEnc.getEnum(false, intsRef));
intsRef = em.createEdgeFlags();
readerWay = new ReaderWay(1);
readerWay.setTag("tunnel", "yes");
readerWay.setTag("hazmat:C", "no");
parser.handleWayTags(intsRef, readerWay, relFlags);
assertEquals(HazmatTunnel.C, hazTunnelEnc.getEnum(false, intsRef));
intsRef = em.createEdgeFlags();
readerWay = new ReaderWay(1);
readerWay.setTag("tunnel", "yes");
readerWay.setTag("hazmat:D", "no");
parser.handleWayTags(intsRef, readerWay, relFlags);
assertEquals(HazmatTunnel.D, hazTunnelEnc.getEnum(false, intsRef));
intsRef = em.createEdgeFlags();
readerWay = new ReaderWay(1);
readerWay.setTag("tunnel", "yes");
readerWay.setTag("hazmat:E", "no");
parser.handleWayTags(intsRef, readerWay, relFlags);
assertEquals(HazmatTunnel.E, hazTunnelEnc.getEnum(false, intsRef));
}
use of com.graphhopper.storage.IntsRef in project graphhopper by graphhopper.
the class ExpressionVisitorTest method before.
@BeforeEach
public void before() {
StringEncodedValue sev = new StringEncodedValue("country", 10);
lookup = new GraphBuilder(new EncodingManager.Builder().add(sev).build()).create().getEncodingManager();
sev.setString(false, new IntsRef(1), "DEU");
}
use of com.graphhopper.storage.IntsRef in project graphhopper by graphhopper.
the class SnapPreventionEdgeFilterTest method accept.
@Test
public void accept() {
EdgeFilter trueFilter = edgeState -> true;
EncodingManager em = new EncodingManager.Builder().build();
EnumEncodedValue<RoadClass> rcEnc = em.getEnumEncodedValue(RoadClass.KEY, RoadClass.class);
EnumEncodedValue<RoadEnvironment> reEnc = em.getEnumEncodedValue(RoadEnvironment.KEY, RoadEnvironment.class);
SnapPreventionEdgeFilter filter = new SnapPreventionEdgeFilter(trueFilter, rcEnc, reEnc, Arrays.asList("motorway", "ferry"));
IntsRef intsRef = em.createEdgeFlags();
assertTrue(filter.accept(GHUtility.createMockedEdgeIteratorState(1, intsRef)));
reEnc.setEnum(false, intsRef, RoadEnvironment.FERRY);
assertFalse(filter.accept(GHUtility.createMockedEdgeIteratorState(1, intsRef)));
reEnc.setEnum(false, intsRef, RoadEnvironment.FORD);
assertTrue(filter.accept(GHUtility.createMockedEdgeIteratorState(1, intsRef)));
rcEnc.setEnum(false, intsRef, RoadClass.RESIDENTIAL);
assertTrue(filter.accept(GHUtility.createMockedEdgeIteratorState(1, intsRef)));
rcEnc.setEnum(false, intsRef, RoadClass.MOTORWAY);
assertFalse(filter.accept(GHUtility.createMockedEdgeIteratorState(1, intsRef)));
}
Aggregations