use of com.graphhopper.routing.util.CarTagParser in project graphhopper by graphhopper.
the class DecimalEncodedValueTest method testMaxValue.
@Test
public void testMaxValue() {
FlagEncoder carEncoder = FlagEncoders.createCar(new PMap("speed_bits=10|speed_factor=0.5"));
EncodingManager em = EncodingManager.create(carEncoder);
DecimalEncodedValue carAverageSpeedEnc = em.getDecimalEncodedValue(EncodingManager.getKey(carEncoder, "average_speed"));
CarTagParser carTagParser = new CarTagParser(em, new PMap());
carTagParser.init(new DateRangeParser());
ReaderWay way = new ReaderWay(1);
way.setTag("highway", "motorway_link");
way.setTag("maxspeed", "70 mph");
IntsRef flags = carTagParser.handleWayTags(em.createEdgeFlags(), way);
assertEquals(101.5, carAverageSpeedEnc.getDecimal(true, flags), 1e-1);
DecimalEncodedValue instance1 = new DecimalEncodedValueImpl("test1", 8, 0.5, false);
instance1.init(new EncodedValue.InitializerConfig());
flags = em.createEdgeFlags();
instance1.setDecimal(false, flags, 100d);
assertEquals(100, instance1.getDecimal(false, flags), 1e-1);
}
Aggregations