com.graphhopper.util.Helper.round6()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(9.6k)|赞(0)|评价(0)|浏览(171)

本文整理了Java中com.graphhopper.util.Helper.round6()方法的一些代码示例,展示了Helper.round6()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Helper.round6()方法的具体详情如下:
包路径:com.graphhopper.util.Helper
类名称:Helper
方法名:round6

Helper.round6介绍

暂无

代码示例

代码示例来源:origin: graphhopper/graphhopper

  1. private String createGoogleQuery(List<GHPoint> list, String pointName) {
  2. String pointsStr = "";
  3. for (GHPoint p : list) {
  4. if (!pointsStr.isEmpty()) {
  5. pointsStr += "|";
  6. }
  7. pointsStr += encode(Helper.round6(p.lat) + "," + Helper.round6(p.lon));
  8. }
  9. return pointName + "=" + pointsStr;
  10. }

代码示例来源:origin: graphhopper/graphhopper

  1. private String createPointQuery(List<GHPoint> list, String pointName) {
  2. StringBuilder pointsStr = new StringBuilder();
  3. for (GHPoint p : list) {
  4. if (pointsStr.length() > 0)
  5. pointsStr.append("&");
  6. pointsStr.append(pointName).append('=').append(encode(Helper.round6(p.lat) + "," + Helper.round6(p.lon)));
  7. }
  8. return pointsStr.toString();
  9. }
  10. }

代码示例来源:origin: graphhopper/graphhopper

  1. /**
  2. * @return array containing this bounding box. Attention: GeoJson is lon,lat! If 3D is gets even
  3. * worse: lon,lat,ele
  4. */
  5. public List<Double> toGeoJson() {
  6. List<Double> list = new ArrayList<>(4);
  7. list.add(Helper.round6(minLon));
  8. list.add(Helper.round6(minLat));
  9. // hmh
  10. if (elevation)
  11. list.add(Helper.round2(minEle));
  12. list.add(Helper.round6(maxLon));
  13. list.add(Helper.round6(maxLat));
  14. if (elevation)
  15. list.add(Helper.round2(maxEle));
  16. return list;
  17. }

代码示例来源:origin: graphhopper/graphhopper

  1. places += "point=" + round6(p.lat) + "," + round6(p.lon) + "&";

代码示例来源:origin: graphhopper/graphhopper

  1. ObjectNode jsonPath = jsonPathList.addObject();
  2. jsonPath.put("distance", Helper.round(ar.getDistance(), 3));
  3. jsonPath.put("weight", Helper.round6(ar.getRouteWeight()));
  4. jsonPath.put("time", ar.getTime());
  5. jsonPath.put("transfers", ar.getNumChanges());

代码示例来源:origin: com.rgi-corp/graphhopper

  1. /**
  2. * @return array containing this bounding box. Attention: GeoJson is lon,lat! If 3D is gets even
  3. * worse: lon,lat,ele
  4. */
  5. public List<Double> toGeoJson() {
  6. List<Double> list = new ArrayList<Double>(4);
  7. list.add(Helper.round6(minLon));
  8. list.add(Helper.round6(minLat));
  9. // hmh
  10. if (elevation)
  11. list.add(Helper.round2(minEle));
  12. list.add(Helper.round6(maxLon));
  13. list.add(Helper.round6(maxLat));
  14. if (elevation)
  15. list.add(Helper.round2(maxEle));
  16. return list;
  17. }

代码示例来源:origin: com.graphhopper/graphhopper-api

  1. /**
  2. * @return array containing this bounding box. Attention: GeoJson is lon,lat! If 3D is gets even
  3. * worse: lon,lat,ele
  4. */
  5. public List<Double> toGeoJson() {
  6. List<Double> list = new ArrayList<>(4);
  7. list.add(Helper.round6(minLon));
  8. list.add(Helper.round6(minLat));
  9. // hmh
  10. if (elevation)
  11. list.add(Helper.round2(minEle));
  12. list.add(Helper.round6(maxLon));
  13. list.add(Helper.round6(maxLat));
  14. if (elevation)
  15. list.add(Helper.round2(maxEle));
  16. return list;
  17. }

代码示例来源:origin: com.graphhopper/graphhopper

  1. /**
  2. * @return array containing this bounding box. Attention: GeoJson is lon,lat! If 3D is gets even
  3. * worse: lon,lat,ele
  4. */
  5. public List<Double> toGeoJson()
  6. {
  7. List<Double> list = new ArrayList<Double>(4);
  8. list.add(Helper.round6(minLon));
  9. list.add(Helper.round6(minLat));
  10. // hmh
  11. if (elevation)
  12. list.add(Helper.round2(minEle));
  13. list.add(Helper.round6(maxLon));
  14. list.add(Helper.round6(maxLat));
  15. if (elevation)
  16. list.add(Helper.round2(maxEle));
  17. return list;
  18. }
  19. }

代码示例来源:origin: com.rgi-corp/graphhopper

  1. private void createWayPointBlock(StringBuilder output, Instruction instruction) {
  2. output.append("\n<wpt ");
  3. output.append("lat=\"").append(Helper.round6(instruction.getFirstLat()));
  4. output.append("\" lon=\"").append(Helper.round6(instruction.getFirstLon())).append("\">");
  5. String name;
  6. if (instruction.getName().isEmpty())
  7. name = instruction.getTurnDescription(tr);
  8. else
  9. name = instruction.getName();
  10. output.append(" <name>").append(simpleXMLEscape(name)).append("</name>");
  11. output.append("</wpt>");
  12. }

代码示例来源:origin: com.rgi-corp/graphhopper

  1. public List<Double[]> toGeoJson(boolean includeElevation) {
  2. ArrayList<Double[]> points = new ArrayList<Double[]>(size);
  3. for (int i = 0; i < size; i++) {
  4. if (includeElevation)
  5. points.add(new Double[]{
  6. Helper.round6(getLongitude(i)), Helper.round6(getLatitude(i)),
  7. Helper.round2(getElevation(i))
  8. });
  9. else
  10. points.add(new Double[]{
  11. Helper.round6(getLongitude(i)), Helper.round6(getLatitude(i))
  12. });
  13. }
  14. return points;
  15. }

代码示例来源:origin: com.graphhopper/graphhopper

  1. private void createWayPointBlock( StringBuilder output, Instruction instruction )
  2. {
  3. output.append("\n<wpt ");
  4. output.append("lat=\"").append(Helper.round6(instruction.getFirstLat()));
  5. output.append("\" lon=\"").append(Helper.round6(instruction.getFirstLon())).append("\">");
  6. String name;
  7. if (instruction.getName().isEmpty())
  8. name = instruction.getTurnDescription(tr);
  9. else
  10. name = instruction.getName();
  11. output.append(" <name>").append(simpleXMLEscape(name)).append("</name>");
  12. output.append("</wpt>");
  13. }

代码示例来源:origin: com.graphhopper/graphhopper

  1. public List<Double[]> toGeoJson( boolean includeElevation )
  2. {
  3. ArrayList<Double[]> points = new ArrayList<Double[]>(size);
  4. for (int i = 0; i < size; i++)
  5. {
  6. if (includeElevation)
  7. points.add(new Double[]
  8. {
  9. Helper.round6(getLongitude(i)), Helper.round6(getLatitude(i)),
  10. Helper.round2(getElevation(i))
  11. });
  12. else
  13. points.add(new Double[]
  14. {
  15. Helper.round6(getLongitude(i)), Helper.round6(getLatitude(i))
  16. });
  17. }
  18. return points;
  19. }

代码示例来源:origin: com.rgi-corp/graphhopper

  1. public void createRteptBlock(StringBuilder output, Instruction instruction, Instruction nextI) {
  2. output.append("\n<rtept lat=\"").append(Helper.round6(instruction.getFirstLat())).
  3. append("\" lon=\"").append(Helper.round6(instruction.getFirstLon())).append("\">");
  4. if (!instruction.getName().isEmpty())
  5. output.append("<desc>").append(simpleXMLEscape(instruction.getTurnDescription(tr))).append("</desc>");
  6. output.append("<extensions>");
  7. output.append("<gh:distance>").append(Helper.round(instruction.getDistance(), 1)).append("</gh:distance>");
  8. output.append("<gh:time>").append(instruction.getTime()).append("</gh:time>");
  9. String direction = instruction.calcDirection(nextI);
  10. if (!direction.isEmpty())
  11. output.append("<gh:direction>").append(direction).append("</gh:direction>");
  12. double azimuth = instruction.calcAzimuth(nextI);
  13. if (!Double.isNaN(azimuth))
  14. output.append("<gh:azimuth>").append(Helper.round2(azimuth)).append("</gh:azimuth>");
  15. output.append("<gh:sign>").append(instruction.getSign()).append("</gh:sign>");
  16. output.append("</extensions>");
  17. output.append("</rtept>");
  18. }

代码示例来源:origin: com.graphhopper/graphhopper

  1. public void createRteptBlock( StringBuilder output, Instruction instruction, Instruction nextI )
  2. {
  3. output.append("\n<rtept lat=\"").append(Helper.round6(instruction.getFirstLat())).
  4. append("\" lon=\"").append(Helper.round6(instruction.getFirstLon())).append("\">");
  5. if (!instruction.getName().isEmpty())
  6. output.append("<desc>").append(simpleXMLEscape(instruction.getTurnDescription(tr))).append("</desc>");
  7. output.append("<extensions>");
  8. output.append("<gh:distance>").append(Helper.round(instruction.getDistance(), 1)).append("</gh:distance>");
  9. output.append("<gh:time>").append(instruction.getTime()).append("</gh:time>");
  10. String direction = instruction.calcDirection(nextI);
  11. if (!direction.isEmpty())
  12. output.append("<gh:direction>").append(direction).append("</gh:direction>");
  13. double azimuth = instruction.calcAzimuth(nextI);
  14. if (!Double.isNaN(azimuth))
  15. output.append("<gh:azimuth>").append(Helper.round2(azimuth)).append("</gh:azimuth>");
  16. output.append("<gh:sign>").append(instruction.getSign()).append("</gh:sign>");
  17. output.append("</extensions>");
  18. output.append("</rtept>");
  19. }

代码示例来源:origin: com.graphhopper/map-matching

  1. gpxOutput.append("\n<trkpt lat='").append(Helper.round6(entry.getLat()));
  2. gpxOutput.append("' lon='").append(Helper.round6(entry.getLon())).append("'>");
  3. if (includeElevation) {
  4. gpxOutput.append("<ele>").append(Helper.round2(entry.getEle())).append("</ele>");

代码示例来源:origin: com.rgi-corp/graphhopper

  1. gpxOutput.append("\n<trkpt lat=\"").append(Helper.round6(entry.getLat()));
  2. gpxOutput.append("\" lon=\"").append(Helper.round6(entry.getLon())).append("\">");
  3. if (includeElevation)
  4. gpxOutput.append("<ele>").append(Helper.round2(entry.getEle())).append("</ele>");

代码示例来源:origin: com.graphhopper/graphhopper

  1. for (GPXEntry entry : createGPXList())
  2. gpxOutput.append("\n<trkpt lat=\"").append(Helper.round6(entry.getLat()));
  3. gpxOutput.append("\" lon=\"").append(Helper.round6(entry.getLon())).append("\">");
  4. if (includeElevation)
  5. gpxOutput.append("<ele>").append(Helper.round2(entry.getEle())).append("</ele>");

代码示例来源:origin: com.graphhopper/graphhopper-web-api

  1. ObjectNode jsonPath = jsonPathList.addObject();
  2. jsonPath.put("distance", Helper.round(ar.getDistance(), 3));
  3. jsonPath.put("weight", Helper.round6(ar.getRouteWeight()));
  4. jsonPath.put("time", ar.getTime());
  5. jsonPath.put("transfers", ar.getNumChanges());

相关文章