use of com.graphhopper.reader.ReaderNode in project graphhopper by graphhopper.
the class CarFlagEncoderTest method testBarrierAccess.
@Test
public void testBarrierAccess() {
ReaderNode node = new ReaderNode(1, -1, -1);
node.setTag("barrier", "lift_gate");
node.setTag("access", "yes");
// no barrier!
assertFalse(encoder.isBarrier(node));
node = new ReaderNode(1, -1, -1);
node.setTag("barrier", "lift_gate");
node.setTag("bicycle", "yes");
// no barrier!
assertFalse(encoder.isBarrier(node));
node = new ReaderNode(1, -1, -1);
node.setTag("barrier", "lift_gate");
node.setTag("access", "yes");
node.setTag("bicycle", "yes");
// should this be a barrier for motorcars too?
// assertTrue(encoder.handleNodeTags(node) == true);
node = new ReaderNode(1, -1, -1);
node.setTag("barrier", "lift_gate");
node.setTag("access", "no");
node.setTag("motorcar", "yes");
// no barrier!
assertFalse(encoder.isBarrier(node));
node = new ReaderNode(1, -1, -1);
node.setTag("barrier", "bollard");
// barrier!
assertTrue(encoder.isBarrier(node));
CarFlagEncoder tmpEncoder = new CarFlagEncoder();
EncodingManager.create(tmpEncoder);
// Test if cattle_grid is not blocking
node = new ReaderNode(1, -1, -1);
node.setTag("barrier", "cattle_grid");
assertFalse(tmpEncoder.isBarrier(node));
}
use of com.graphhopper.reader.ReaderNode in project graphhopper by graphhopper.
the class CarFlagEncoderTest method testFordAccess.
@Test
public void testFordAccess() {
ReaderNode node = new ReaderNode(0, 0.0, 0.0);
node.setTag("ford", "yes");
ReaderWay way = new ReaderWay(1);
way.setTag("highway", "unclassified");
way.setTag("ford", "yes");
// Node and way are initially blocking
assertTrue(encoder.isBlockFords());
assertTrue(encoder.getAccess(way).canSkip());
assertTrue(encoder.isBarrier(node));
CarFlagEncoder tmpEncoder = new CarFlagEncoder(new PMap("block_fords=false"));
EncodingManager.create(tmpEncoder);
assertTrue(tmpEncoder.getAccess(way).isWay());
assertFalse(tmpEncoder.isBarrier(node));
}
use of com.graphhopper.reader.ReaderNode in project graphhopper by graphhopper.
the class FootFlagEncoderTest method testChainBarrier.
@Test
public void testChainBarrier() {
// by default allow access through the gate for bike & foot!
ReaderNode node = new ReaderNode(1, -1, -1);
node.setTag("barrier", "chain");
assertFalse(footEncoder.isBarrier(node));
node.setTag("foot", "no");
assertTrue(footEncoder.isBarrier(node));
}
use of com.graphhopper.reader.ReaderNode in project graphhopper by graphhopper.
the class FootFlagEncoderTest method testFord.
@Test
public void testFord() {
// by default do not block access due to fords!
ReaderNode node = new ReaderNode(1, -1, -1);
node.setTag("ford", "no");
assertFalse(footEncoder.isBarrier(node));
node = new ReaderNode(1, -1, -1);
node.setTag("ford", "yes");
// no barrier!
assertFalse(footEncoder.isBarrier(node));
// barrier!
node.setTag("foot", "no");
assertTrue(footEncoder.isBarrier(node));
FootFlagEncoder tmpEncoder = new FootFlagEncoder(new PMap("block_fords=true"));
EncodingManager.create(tmpEncoder);
node = new ReaderNode(1, -1, -1);
node.setTag("ford", "no");
assertFalse(tmpEncoder.isBarrier(node));
node = new ReaderNode(1, -1, -1);
node.setTag("ford", "yes");
assertTrue(tmpEncoder.isBarrier(node));
}
use of com.graphhopper.reader.ReaderNode in project graphhopper by graphhopper.
the class WheelchairFlagEncoderTest method testBarrierAccess.
@Test
public void testBarrierAccess() {
// by default allow access through the gate for bike & foot!
ReaderNode node = new ReaderNode(1, -1, -1);
node.setTag("barrier", "gate");
// no barrier!
assertFalse(wheelchairEncoder.isBarrier(node));
node = new ReaderNode(1, -1, -1);
node.setTag("barrier", "gate");
node.setTag("access", "yes");
// no barrier!
assertFalse(wheelchairEncoder.isBarrier(node));
node = new ReaderNode(1, -1, -1);
node.setTag("barrier", "gate");
node.setTag("access", "no");
// barrier!
assertTrue(wheelchairEncoder.isBarrier(node));
node.setTag("bicycle", "yes");
// no barrier!?
// assertTrue(wheelchairEncoder.handleNodeTags(node) == false);
node = new ReaderNode(1, -1, -1);
node.setTag("barrier", "gate");
node.setTag("access", "no");
node.setTag("foot", "yes");
// no barrier!
assertFalse(wheelchairEncoder.isBarrier(node));
node.setTag("locked", "yes");
// barrier!
assertTrue(wheelchairEncoder.isBarrier(node));
}
Aggregations