use of com.graphhopper.routing.util.DataFlagEncoder in project graphhopper by graphhopper.
the class AbstractEdgeElevationInterpolatorTest method setUp.
@SuppressWarnings("resource")
@Before
public void setUp() {
dataFlagEncoder = new DataFlagEncoder();
graph = new GraphHopperStorage(new RAMDirectory(), new EncodingManager(Arrays.asList(dataFlagEncoder, new FootFlagEncoder()), 8), true, new GraphExtension.NoOpExtension()).create(100);
edgeElevationInterpolator = createEdgeElevationInterpolator();
interpolatableWay = createInterpolatableWay();
normalWay = new ReaderWay(0);
normalWay.setTag("highway", "primary");
}
use of com.graphhopper.routing.util.DataFlagEncoder in project graphhopper by graphhopper.
the class GraphHopperStorageForDataFlagEncoderTest method testStorageProperties.
@Test
public void testStorageProperties() {
graph = new GraphBuilder(encodingManager).setStore(true).setLocation(defaultGraphLoc).create();
// 0-1
ReaderWay way_0_1 = new ReaderWay(27l);
way_0_1.setTag("highway", "primary");
way_0_1.setTag("maxheight", "4.4");
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_0_1, 1, 0));
// 1-2
ReaderWay way_1_2 = new ReaderWay(28l);
way_1_2.setTag("highway", "primary");
way_1_2.setTag("maxweight", "45");
graph.edge(1, 2, 1, true);
AbstractRoutingAlgorithmTester.updateDistancesFor(graph, 2, 0.02, 0.02);
graph.getEdgeIteratorState(1, 2).setFlags(encoder.handleWayTags(way_1_2, 1, 0));
// 2-0
ReaderWay way_2_0 = new ReaderWay(29l);
way_2_0.setTag("highway", "primary");
way_2_0.setTag("maxwidth", "5");
graph.edge(2, 0, 1, true);
graph.getEdgeIteratorState(2, 0).setFlags(encoder.handleWayTags(way_2_0, 1, 0));
graph.flush();
graph.close();
GraphHopper hopper = new GraphHopper().setGraphHopperLocation(defaultGraphLoc).setCHEnabled(false).importOrLoad();
EncodingManager em = hopper.getEncodingManager();
assertNotNull(em);
assertEquals(1, em.fetchEdgeEncoders().size());
FlagEncoder flagEncoder = em.fetchEdgeEncoders().get(0);
assertTrue(flagEncoder instanceof DataFlagEncoder);
DataFlagEncoder dataFlagEncoder = (DataFlagEncoder) flagEncoder;
assertTrue(dataFlagEncoder.isStoreHeight());
assertTrue(dataFlagEncoder.isStoreWeight());
assertFalse(dataFlagEncoder.isStoreWidth());
}
Aggregations