public void createRteptBlock(StringBuilder output, Instruction instruction, Instruction nextI, DecimalFormat decimalFormat) { output.append("\n<rtept lat=\"").append(decimalFormat.format(instruction.getFirstLat())). append("\" lon=\"").append(decimalFormat.format(instruction.getFirstLon())).append("\">"); if (!instruction.getName().isEmpty()) output.append("<desc>").append(simpleXMLEscape(instruction.getTurnDescription(tr))).append("</desc>"); output.append("<extensions>"); output.append("<gh:distance>").append(Helper.round(instruction.getDistance(), 1)).append("</gh:distance>"); output.append("<gh:time>").append(instruction.getTime()).append("</gh:time>"); String direction = instruction.calcDirection(nextI); if (!direction.isEmpty()) output.append("<gh:direction>").append(direction).append("</gh:direction>"); double azimuth = instruction.calcAzimuth(nextI); if (!Double.isNaN(azimuth)) output.append("<gh:azimuth>").append(Helper.round2(azimuth)).append("</gh:azimuth>"); if (instruction instanceof RoundaboutInstruction) { RoundaboutInstruction ri = (RoundaboutInstruction) instruction; output.append("<gh:exit_number>").append(ri.getExitNumber()).append("</gh:exit_number>"); } output.append("<gh:sign>").append(instruction.getSign()).append("</gh:sign>"); output.append("</extensions>"); output.append("</rtept>"); }
public List<Map<String, Object>> createJson() { List<Map<String, Object>> instrList = new ArrayList<>(instructions.size()); int pointsIndex = 0; int counter = 0; for (Instruction instruction : instructions) { Map<String, Object> instrJson = new HashMap<>(); instrList.add(instrJson); InstructionAnnotation ia = instruction.getAnnotation(); String text = instruction.getTurnDescription(tr); if (Helper.isEmpty(text)) text = ia.getMessage(); instrJson.put("text", Helper.firstBig(text)); if (!ia.isEmpty()) { instrJson.put("annotation_text", ia.getMessage()); instrJson.put("annotation_importance", ia.getImportance()); } instrJson.put("street_name", instruction.getName()); instrJson.put("time", instruction.getTime()); instrJson.put("distance", Helper.round(instruction.getDistance(), 3)); instrJson.put("sign", instruction.getSign()); instrJson.putAll(instruction.getExtraInfoJSON()); int tmpIndex = pointsIndex + instruction.getLength(); instrJson.put("interval", Arrays.asList(pointsIndex, tmpIndex)); pointsIndex = tmpIndex; counter++; } return instrList; }
public ViaInstruction(Instruction instr) { this(instr.getName(), instr.getAnnotation(), instr.getPoints()); setDistance(instr.getDistance()); setTime(instr.getTime()); this.extraInfo = instr.extraInfo; }
private void updatePointsAndInstruction(EdgeIteratorState edge, PointList pl) { // skip adjNode int len = pl.size() - 1; for (int i = 0; i < len; i++) { prevInstruction.getPoints().add(pl, i); } double newDist = edge.getDistance(); prevInstruction.setDistance(newDist + prevInstruction.getDistance()); prevInstruction.setTime(weighting.calcMillis(edge, false, EdgeIterator.NO_EDGE) + prevInstruction.getTime()); }
public void createRteptBlock(StringBuilder output, Instruction instruction, Instruction nextI) { output.append("\n<rtept lat=\"").append(Helper.round6(instruction.getFirstLat())). append("\" lon=\"").append(Helper.round6(instruction.getFirstLon())).append("\">"); if (!instruction.getName().isEmpty()) output.append("<desc>").append(simpleXMLEscape(instruction.getTurnDescription(tr))).append("</desc>"); output.append("<extensions>"); output.append("<gh:distance>").append(Helper.round(instruction.getDistance(), 1)).append("</gh:distance>"); output.append("<gh:time>").append(instruction.getTime()).append("</gh:time>"); String direction = instruction.calcDirection(nextI); if (!direction.isEmpty()) output.append("<gh:direction>").append(direction).append("</gh:direction>"); double azimuth = instruction.calcAzimuth(nextI); if (!Double.isNaN(azimuth)) output.append("<gh:azimuth>").append(Helper.round2(azimuth)).append("</gh:azimuth>"); output.append("<gh:sign>").append(instruction.getSign()).append("</gh:sign>"); output.append("</extensions>"); output.append("</rtept>"); }
public void createRteptBlock( StringBuilder output, Instruction instruction, Instruction nextI ) { output.append("\n<rtept lat=\"").append(Helper.round6(instruction.getFirstLat())). append("\" lon=\"").append(Helper.round6(instruction.getFirstLon())).append("\">"); if (!instruction.getName().isEmpty()) output.append("<desc>").append(simpleXMLEscape(instruction.getTurnDescription(tr))).append("</desc>"); output.append("<extensions>"); output.append("<gh:distance>").append(Helper.round(instruction.getDistance(), 1)).append("</gh:distance>"); output.append("<gh:time>").append(instruction.getTime()).append("</gh:time>"); String direction = instruction.calcDirection(nextI); if (!direction.isEmpty()) output.append("<gh:direction>").append(direction).append("</gh:direction>"); double azimuth = instruction.calcAzimuth(nextI); if (!Double.isNaN(azimuth)) output.append("<gh:azimuth>").append(Helper.round2(azimuth)).append("</gh:azimuth>"); output.append("<gh:sign>").append(instruction.getSign()).append("</gh:sign>"); output.append("</extensions>"); output.append("</rtept>"); }
public void createRteptBlock(StringBuilder output, Instruction instruction, Instruction nextI, DecimalFormat decimalFormat) { output.append("\n<rtept lat=\"").append(decimalFormat.format(instruction.getFirstLat())). append("\" lon=\"").append(decimalFormat.format(instruction.getFirstLon())).append("\">"); if (!instruction.getName().isEmpty()) output.append("<desc>").append(simpleXMLEscape(instruction.getTurnDescription(tr))).append("</desc>"); output.append("<extensions>"); output.append("<gh:distance>").append(Helper.round(instruction.getDistance(), 1)).append("</gh:distance>"); output.append("<gh:time>").append(instruction.getTime()).append("</gh:time>"); String direction = instruction.calcDirection(nextI); if (!direction.isEmpty()) output.append("<gh:direction>").append(direction).append("</gh:direction>"); double azimuth = instruction.calcAzimuth(nextI); if (!Double.isNaN(azimuth)) output.append("<gh:azimuth>").append(Helper.round2(azimuth)).append("</gh:azimuth>"); if (instruction instanceof RoundaboutInstruction) { RoundaboutInstruction ri = (RoundaboutInstruction) instruction; output.append("<gh:exit_number>").append(ri.getExitNumber()).append("</gh:exit_number>"); } output.append("<gh:sign>").append(instruction.getSign()).append("</gh:sign>"); output.append("</extensions>"); output.append("</rtept>"); }
public List<Map<String, Object>> createJson() { List<Map<String, Object>> instrList = new ArrayList<>(instructions.size()); int pointsIndex = 0; int counter = 0; for (Instruction instruction : instructions) { Map<String, Object> instrJson = new HashMap<>(); instrList.add(instrJson); InstructionAnnotation ia = instruction.getAnnotation(); String text = instruction.getTurnDescription(tr); if (Helper.isEmpty(text)) text = ia.getMessage(); instrJson.put("text", Helper.firstBig(text)); if (!ia.isEmpty()) { instrJson.put("annotation_text", ia.getMessage()); instrJson.put("annotation_importance", ia.getImportance()); } instrJson.put("street_name", instruction.getName()); instrJson.put("time", instruction.getTime()); instrJson.put("distance", Helper.round(instruction.getDistance(), 3)); instrJson.put("sign", instruction.getSign()); instrJson.putAll(instruction.getExtraInfoJSON()); int tmpIndex = pointsIndex + instruction.getLength(); instrJson.put("interval", Arrays.asList(pointsIndex, tmpIndex)); pointsIndex = tmpIndex; counter++; } return instrList; }
instrJson.put("time", instruction.getTime()); instrJson.put("distance", Helper.round(instruction.getDistance(), 3)); instrJson.put("sign", instruction.getSign());
instrJson.put("time", instruction.getTime()); instrJson.put("distance", Helper.round(instruction.getDistance(), 3)); instrJson.put("sign", instruction.getSign());
public ViaInstruction(Instruction instr) { this(instr.getName(), instr.getAnnotation(), instr.getPoints()); setDistance(instr.getDistance()); setTime(instr.getTime()); }
public ViaInstruction( Instruction instr ) { this(instr.getName(), instr.getAnnotation(), instr.getPoints()); setDistance(instr.getDistance()); setTime(instr.getTime()); }
public ViaInstruction(Instruction instr) { this(instr.getName(), instr.getAnnotation(), instr.getPoints()); setDistance(instr.getDistance()); setTime(instr.getTime()); this.extraInfo = instr.extraInfo; }
private void updatePointsAndInstruction(EdgeIteratorState edge, PointList pl) { // skip adjNode int len = pl.size() - 1; for (int i = 0; i < len; i++) { prevInstruction.getPoints().add(pl, i); } double newDist = edge.getDistance(); prevInstruction.setDistance(newDist + prevInstruction.getDistance()); prevInstruction.setTime(weighting.calcMillis(edge, false, EdgeIterator.NO_EDGE) + prevInstruction.getTime()); }
private void updatePointsAndInstruction(EdgeIteratorState edge, PointList pl) { // skip adjNode int len = pl.size() - 1; for (int i = 0; i < len; i++) { prevInstruction.getPoints().add(pl, i); } double newDist = edge.getDistance(); prevInstruction.setDistance(newDist + prevInstruction.getDistance()); prevInstruction.setTime(weighting.calcMillis(edge, false, EdgeIterator.NO_EDGE) + prevInstruction.getTime()); } });
private void updatePointsAndInstruction( EdgeIteratorState edge, PointList pl ) { // skip adjNode int len = pl.size() - 1; for (int i = 0; i < len; i++) { prevInstruction.getPoints().add(pl, i); } double newDist = edge.getDistance(); prevInstruction.setDistance(newDist + prevInstruction.getDistance()); long flags = edge.getFlags(); prevInstruction.setTime(calcMillis(newDist, flags, false) + prevInstruction.getTime()); } });