use of com.graphhopper.reader.ReaderWay in project graphhopper by graphhopper.
the class DataFlagEncoderTest method testCircularJunction.
@Test
public void testCircularJunction() {
ReaderWay osmWay = new ReaderWay(0);
osmWay.setTag("highway", "unclassified");
osmWay.setTag("junction", "circular");
long flags = encoder.handleWayTags(osmWay, 1, 0);
EdgeIteratorState edge = GHUtility.createMockedEdgeIteratorState(0, flags);
assertTrue(encoder.isRoundabout(edge));
}
use of com.graphhopper.reader.ReaderWay in project graphhopper by graphhopper.
the class GenericWeightingTest method setUp.
@Before
public void setUp() {
ReaderWay way = new ReaderWay(27l);
way.setTag("highway", "primary");
way.setTag("maxspeed", "10");
way.setTag("maxheight", "4.4");
graph = new GraphBuilder(em).create();
// 0-1
graph.edge(0, 1, 1, true);
AbstractRoutingAlgorithmTester.updateDistancesFor(graph, 0, 0.00, 0.00);
AbstractRoutingAlgorithmTester.updateDistancesFor(graph, 1, 0.01, 0.01);
graph.getEdgeIteratorState(0, 1).setFlags(encoder.handleWayTags(way, 1, 0));
}
use of com.graphhopper.reader.ReaderWay in project graphhopper by graphhopper.
the class PathTest method testCalcInstructionsForDataFlagEncoder.
@Test
public void testCalcInstructionsForDataFlagEncoder() {
final Graph g = new GraphBuilder(dataFlagManager).create();
final NodeAccess na = g.getNodeAccess();
na.setNode(1, 48.982618, 13.122021);
na.setNode(2, 48.982565, 13.121597);
na.setNode(3, 48.982611, 13.121012);
na.setNode(4, 48.982336, 13.121002);
ReaderWay w = new ReaderWay(1);
w.setTag("highway", "tertiary");
g.edge(1, 2, 5, true).setFlags(dataFlagEncoder.handleWayTags(w, 1, 0));
g.edge(2, 4, 5, true).setFlags(dataFlagEncoder.handleWayTags(w, 1, 0));
g.edge(2, 3, 5, true).setFlags(dataFlagEncoder.handleWayTags(w, 1, 0));
Path p = new Dijkstra(g, new GenericWeighting(dataFlagEncoder, new HintsMap()), TraversalMode.NODE_BASED).calcPath(1, 3);
assertTrue(p.isFound());
InstructionList wayList = p.calcInstructions(tr);
assertEquals(3, wayList.size());
}
use of com.graphhopper.reader.ReaderWay in project graphhopper by graphhopper.
the class OSMXMLHelper method createWay.
public static ReaderWay createWay(long id, XMLStreamReader parser) throws XMLStreamException {
ReaderWay way = new ReaderWay(id);
parser.nextTag();
readNodes(way, parser);
readTags(way, parser);
return way;
}
use of com.graphhopper.reader.ReaderWay in project graphhopper by graphhopper.
the class PbfBlobDecoder method processWays.
private void processWays(List<Osmformat.Way> ways, PbfFieldDecoder fieldDecoder) {
for (Osmformat.Way way : ways) {
Map<String, String> tags = buildTags(way.getKeysList(), way.getValsList(), fieldDecoder);
ReaderWay osmWay = new ReaderWay(way.getId());
osmWay.setTags(tags);
// Build up the list of way nodes for the way. The node ids are
// delta encoded meaning that each id is stored as a delta against
// the previous one.
long nodeId = 0;
LongIndexedContainer wayNodes = osmWay.getNodes();
for (long nodeIdOffset : way.getRefsList()) {
nodeId += nodeIdOffset;
wayNodes.add(nodeId);
}
decodedEntities.add(osmWay);
}
}
Aggregations