use of com.graphhopper.reader.ReaderNode in project graphhopper by graphhopper.
the class WheelchairFlagEncoderTest method testBlockByDefault.
@Test
public void testBlockByDefault() {
WheelchairFlagEncoder tmpWheelchairEncoder = new WheelchairFlagEncoder();
EncodingManager.create(tmpWheelchairEncoder);
ReaderNode node = new ReaderNode(1, -1, -1);
node.setTag("barrier", "gate");
// passByDefaultBarriers are no barrier by default
assertFalse(tmpWheelchairEncoder.isBarrier(node));
node.setTag("access", "no");
assertTrue(tmpWheelchairEncoder.isBarrier(node));
// these barriers block
node = new ReaderNode(1, -1, -1);
node.setTag("barrier", "fence");
assertTrue(tmpWheelchairEncoder.isBarrier(node));
node.setTag("barrier", "wall");
assertTrue(tmpWheelchairEncoder.isBarrier(node));
node.setTag("barrier", "handrail");
assertTrue(tmpWheelchairEncoder.isBarrier(node));
node.setTag("barrier", "turnstile");
assertTrue(tmpWheelchairEncoder.isBarrier(node));
// Explictly allowed access is allowed
node.setTag("barrier", "fence");
node.setTag("access", "yes");
assertFalse(tmpWheelchairEncoder.isBarrier(node));
node = new ReaderNode(1, -1, -1);
node.setTag("barrier", "gate");
node.setTag("access", "yes");
assertFalse(tmpWheelchairEncoder.isBarrier(node));
node = new ReaderNode(1, -1, -1);
node.setTag("barrier", "kerb");
assertFalse(tmpWheelchairEncoder.isBarrier(node));
node.setTag("wheelchair", "yes");
assertFalse(tmpWheelchairEncoder.isBarrier(node));
node = new ReaderNode(1, -1, -1);
node.setTag("barrier", "fence");
assertTrue(tmpWheelchairEncoder.isBarrier(node));
}
use of com.graphhopper.reader.ReaderNode in project graphhopper by graphhopper.
the class OSMReaderTest method testReadEleFromCustomOSM.
@Test
public void testReadEleFromCustomOSM() {
GraphHopper hopper = new GraphHopperFacade("custom-osm-ele.xml") {
@Override
protected DataReader createReader(GraphHopperStorage tmpGraph) {
return initDataReader(new OSMReader(tmpGraph) {
@Override
protected double getElevation(ReaderNode node) {
return node.getEle();
}
});
}
}.setElevation(true).importOrLoad();
Graph graph = hopper.getGraphHopperStorage();
int n20 = AbstractGraphStorageTester.getIdOf(graph, 52);
int n50 = AbstractGraphStorageTester.getIdOf(graph, 49);
EdgeIteratorState edge = GHUtility.getEdge(graph, n20, n50);
assertEquals(Helper.createPointList3D(52, 9, -10, 51.25, 9.43, 100, 49, 10, -30), edge.fetchWayGeometry(3));
}
use of com.graphhopper.reader.ReaderNode in project graphhopper by graphhopper.
the class EncodingManager method handleNodeTags.
/**
* Updates the given edge flags based on node tags
*/
public IntsRef handleNodeTags(Map<String, Object> nodeTags, IntsRef edgeFlags) {
for (AbstractFlagEncoder encoder : edgeEncoders) {
// for now we just create a dummy reader node, because our encoders do not make use of the coordinates anyway
ReaderNode readerNode = new ReaderNode(0, 0, 0, nodeTags);
// block access for all encoders that treat this node as a barrier
if (encoder.isBarrier(readerNode)) {
BooleanEncodedValue accessEnc = encoder.getAccessEnc();
accessEnc.setBool(false, edgeFlags, false);
accessEnc.setBool(true, edgeFlags, false);
}
}
return edgeFlags;
}
use of com.graphhopper.reader.ReaderNode in project graphhopper by graphhopper.
the class BikeFlagEncoderTest method testBarrierAccess.
// Issue 407 : Always block kissing_gate execpt for mountainbikes
@Test
@Override
public void testBarrierAccess() {
// kissing_gate without bicycle tag
ReaderNode node = new ReaderNode(1, -1, -1);
node.setTag("barrier", "kissing_gate");
// barrier!
assertTrue(encoder.isBarrier(node));
// kissing_gate with bicycle tag
node = new ReaderNode(1, -1, -1);
node.setTag("barrier", "kissing_gate");
node.setTag("bicycle", "yes");
// no barrier!
assertFalse(encoder.isBarrier(node));
// Test if cattle_grid is non blocking
node = new ReaderNode(1, -1, -1);
node.setTag("barrier", "cattle_grid");
assertFalse(encoder.isBarrier(node));
}
use of com.graphhopper.reader.ReaderNode in project graphhopper by graphhopper.
the class AbstractBikeFlagEncoderTester method testBarrierAccessFord.
@Test
public void testBarrierAccessFord() {
ReaderNode node = new ReaderNode(1, -1, -1);
node.setTag("ford", "yes");
// barrier!
assertTrue(encoder.isBarrier(node));
node.setTag("bicycle", "yes");
// no barrier!
assertFalse(encoder.isBarrier(node));
}
Aggregations