public double calculateElevationBasedOnTwoPoints(double lat, double lon, double lat0, double lon0, double ele0, double lat1, double lon1, double ele1) { double dlat0 = lat0 - lat; double dlon0 = lon0 - lon; double dlat1 = lat1 - lat; double dlon1 = lon1 - lon; double l0 = Math.sqrt(dlon0 * dlon0 + dlat0 * dlat0); double l1 = Math.sqrt(dlon1 * dlon1 + dlat1 * dlat1); double l = l0 + l1; if (l < EPSILON) { // If points are too close to each other, return elevation of the // point which is closer; return l0 <= l1 ? ele0 : ele1; } else { // Otherwise do linear interpolation return round2(ele0 + (ele1 - ele0) * l0 / l); } }
/** * @return array containing this bounding box. Attention: GeoJson is lon,lat! If 3D is gets even * worse: lon,lat,ele */ public List<Double> toGeoJson() { List<Double> list = new ArrayList<>(4); list.add(Helper.round6(minLon)); list.add(Helper.round6(minLat)); // hmh if (elevation) list.add(Helper.round2(minEle)); list.add(Helper.round6(maxLon)); list.add(Helper.round6(maxLat)); if (elevation) list.add(Helper.round2(maxEle)); return list; }
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>"); }
gpxOutput.append("\" lon=\"").append(decimalFormat.format(entry.getLon())).append("\">"); if (includeElevation) gpxOutput.append("<ele>").append(Helper.round2(entry.getEle())).append("</ele>"); gpxOutput.append("<time>").append(formatter.format(startTimeMillis + entry.getTime())).append("</time>"); gpxOutput.append("</trkpt>");
double d = a * lat0 + b * lon0 + c * ele0; double ele = (d - a * lat - b * lon) / c; return round2(ele);
" weight:" + noSodRsp.getBest().getRouteWeight() + ", original: " + sodRsp.getBest().getRouteWeight() + " distance:" + noSodRsp.getBest().getDistance() + ", original: " + sodRsp.getBest().getDistance() + " time:" + round2(noSodRsp.getBest().getTime() / 1000) + ", original: " + round2(sodRsp.getBest().getTime() / 1000) + " points:" + noSodRsp.getBest().getPoints().size() + ", original: " + sodRsp.getBest().getPoints().size();
ele += eles[index] * vs[index] / v; return round2(ele);
public double calculateElevationBasedOnTwoPoints(double lat, double lon, double lat0, double lon0, double ele0, double lat1, double lon1, double ele1) { double dlat0 = lat0 - lat; double dlon0 = lon0 - lon; double dlat1 = lat1 - lat; double dlon1 = lon1 - lon; double l0 = Math.sqrt(dlon0 * dlon0 + dlat0 * dlat0); double l1 = Math.sqrt(dlon1 * dlon1 + dlat1 * dlat1); double l = l0 + l1; if (l < EPSILON) { // If points are too close to each other, return elevation of the // point which is closer; return l0 <= l1 ? ele0 : ele1; } else { // Otherwise do linear interpolation return round2(ele0 + (ele1 - ele0) * l0 / l); } }
public double calculateElevationBasedOnTwoPoints(double lat, double lon, double lat0, double lon0, double ele0, double lat1, double lon1, double ele1) { double dlat0 = lat0 - lat; double dlon0 = lon0 - lon; double dlat1 = lat1 - lat; double dlon1 = lon1 - lon; double l0 = Math.sqrt(dlon0 * dlon0 + dlat0 * dlat0); double l1 = Math.sqrt(dlon1 * dlon1 + dlat1 * dlat1); double l = l0 + l1; if (l < EPSILON) { // If points are too close to each other, return elevation of the // point which is closer; return l0 <= l1 ? ele0 : ele1; } else { // Otherwise do linear interpolation return round2(ele0 + (ele1 - ele0) * l0 / l); } }
/** * @return array containing this bounding box. Attention: GeoJson is lon,lat! If 3D is gets even * worse: lon,lat,ele */ public List<Double> toGeoJson() { List<Double> list = new ArrayList<>(4); list.add(Helper.round6(minLon)); list.add(Helper.round6(minLat)); // hmh if (elevation) list.add(Helper.round2(minEle)); list.add(Helper.round6(maxLon)); list.add(Helper.round6(maxLat)); if (elevation) list.add(Helper.round2(maxEle)); return list; }
/** * @return array containing this bounding box. Attention: GeoJson is lon,lat! If 3D is gets even * worse: lon,lat,ele */ public List<Double> toGeoJson() { List<Double> list = new ArrayList<Double>(4); list.add(Helper.round6(minLon)); list.add(Helper.round6(minLat)); // hmh if (elevation) list.add(Helper.round2(minEle)); list.add(Helper.round6(maxLon)); list.add(Helper.round6(maxLat)); if (elevation) list.add(Helper.round2(maxEle)); return list; }
/** * @return array containing this bounding box. Attention: GeoJson is lon,lat! If 3D is gets even * worse: lon,lat,ele */ public List<Double> toGeoJson() { List<Double> list = new ArrayList<Double>(4); list.add(Helper.round6(minLon)); list.add(Helper.round6(minLat)); // hmh if (elevation) list.add(Helper.round2(minEle)); list.add(Helper.round6(maxLon)); list.add(Helper.round6(maxLat)); if (elevation) list.add(Helper.round2(maxEle)); return list; } }
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 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 List<Double[]> toGeoJson(boolean includeElevation) { ArrayList<Double[]> points = new ArrayList<Double[]>(size); for (int i = 0; i < size; i++) { if (includeElevation) points.add(new Double[]{ Helper.round6(getLongitude(i)), Helper.round6(getLatitude(i)), Helper.round2(getElevation(i)) }); else points.add(new Double[]{ Helper.round6(getLongitude(i)), Helper.round6(getLatitude(i)) }); } return points; }
public List<Double[]> toGeoJson( boolean includeElevation ) { ArrayList<Double[]> points = new ArrayList<Double[]>(size); for (int i = 0; i < size; i++) { if (includeElevation) points.add(new Double[] { Helper.round6(getLongitude(i)), Helper.round6(getLatitude(i)), Helper.round2(getElevation(i)) }); else points.add(new Double[] { Helper.round6(getLongitude(i)), Helper.round6(getLatitude(i)) }); } return points; }