instr = new FinishInstruction(text, instPL, 0); } else { instr = new Instruction(sign, text, ia, instPL); if (sign == Instruction.CONTINUE_ON_STREET) { if (jsonObj.has("heading")) {
if (!ptLeg.isInSameVehicleAsPrevious) { pl = new PointList(); final Instruction departureInstruction = new Instruction(Instruction.PT_START_TRIP, ptLeg.trip_headsign, InstructionAnnotation.EMPTY, pl); departureInstruction.setDistance(leg.getDistance()); departureInstruction.setTime(ptLeg.travelTime); final Trip.Stop arrivalStop = ptLeg.stops.get(ptLeg.stops.size() - 1); arrivalPointList.add(arrivalStop.geometry.getY(), arrivalStop.geometry.getX()); Instruction arrivalInstruction = new Instruction(Instruction.PT_END_TRIP, arrivalStop.stop_name, InstructionAnnotation.EMPTY, arrivalPointList); if (ptLeg.isInSameVehicleAsPrevious) { instructions.replaceLast(arrivalInstruction);
@Test public void testCreateGPXCorrectFormattingSmallNumbers() { InstructionList instructions = new InstructionList(usTR); PointList pl = new PointList(); pl.add(0.000001, 0.000001); pl.add(-0.000123, -0.000125); Instruction instruction = new Instruction(0, "do it", null, pl); instructions.add(instruction); instructions.add(new FinishInstruction(0.000852, 0.000852, 0)); String gpxStr = instructions.createGPX("test", 0, true, true, true, true, Constants.VERSION); assertFalse(gpxStr, gpxStr.contains("E-")); assertTrue(gpxStr, gpxStr.contains("0.000001")); assertTrue(gpxStr, gpxStr.contains("-0.000125")); verifyGPX(gpxStr); }
@Test public void testCreateGPX() { InstructionAnnotation ea = InstructionAnnotation.EMPTY; InstructionList instructions = new InstructionList(usTR); PointList pl = new PointList(); pl.add(49.942576, 11.580384); pl.add(49.941858, 11.582422); instructions.add(new Instruction(Instruction.CONTINUE_ON_STREET, "temp", ea, pl).setDistance(240).setTime(15000)); pl = new PointList(); pl.add(49.941575, 11.583501); instructions.add(new Instruction(Instruction.TURN_LEFT, "temp2", ea, pl).setDistance(25).setTime(4000)); pl = new PointList(); pl.add(49.941389, 11.584311); instructions.add(new Instruction(Instruction.TURN_LEFT, "temp2", ea, pl).setDistance(25).setTime(3000)); instructions.add(new FinishInstruction(49.941029, 11.584514, 0)); List<GPXEntry> result = instructions.createGPXList(); assertEquals(5, result.size()); assertEquals(0, result.get(0).getTime()); assertEquals(10391, result.get(1).getTime()); assertEquals(15000, result.get(2).getTime()); assertEquals(19000, result.get(3).getTime()); assertEquals(22000, result.get(4).getTime()); verifyGPX(instructions.createGPX(Constants.VERSION)); }
prevInstruction = new Instruction(sign, name, annotation, new PointList(10, nodeAccess.is3D())); double startLat = nodeAccess.getLat(baseNode); double startLon = nodeAccess.getLon(baseNode); prevInstruction.setName(name); } else { prevInstruction = new Instruction(sign, name, annotation, new PointList(10, nodeAccess.is3D()));
prevInstruction = new Instruction(sign, name, annotation, new PointList(10, nodeAccess.is3D())); double startLat = nodeAccess.getLat(baseNode); double startLon = nodeAccess.getLon(baseNode); prevInstruction.setName(name); } else { prevInstruction = new Instruction(sign, name, annotation, new PointList(10, nodeAccess.is3D()));
prevInstruction = new Instruction(sign, name, annotation, new PointList(10, nodeAccess.is3D())); ways.add(prevInstruction); prevName = name; else sign = Instruction.TURN_SHARP_RIGHT; prevInstruction = new Instruction(sign, name, annotation, new PointList(10, nodeAccess.is3D())); ways.add(prevInstruction); prevName = name;
prevInstruction = new Instruction(sign, name, annotation, new PointList(10, nodeAccess.is3D())); ways.add(prevInstruction); prevName = name; else sign = Instruction.TURN_SHARP_RIGHT; prevInstruction = new Instruction(sign, name, annotation, new PointList(10, nodeAccess.is3D())); ways.add(prevInstruction); prevName = name;