private static Response.ResponseBuilder gpxSuccessResponseBuilder(GHResponse ghRsp, String timeString, String trackName, boolean enableElevation, boolean withRoute, boolean withTrack, boolean withWayPoints, String version) { if (ghRsp.getAll().size() > 1) { throw new IllegalArgumentException("Alternatives are currently not yet supported for GPX"); } long time = timeString != null ? Long.parseLong(timeString) : System.currentTimeMillis(); return Response.ok(ghRsp.getBest().getInstructions().createGPX(trackName, time, enableElevation, withRoute, withTrack, withWayPoints, version), "application/gpx+xml"). header("Content-Disposition", "attachment;filename=" + "GraphHopper.gpx"); }
public PathSimplification(PathWrapper pathWrapper, DouglasPeucker douglasPeucker, boolean enableInstructions) { this.pointList = pathWrapper.getPoints(); listsToSimplify = new ArrayList<>(); if (enableInstructions) listsToSimplify.add(pathWrapper.getInstructions()); this.pathDetails = pathWrapper.getPathDetails(); for (String name : pathDetails.keySet()) { List<PathDetail> pathDetailList = pathDetails.get(name); // If the pointList only contains one point, PathDetails have to be empty because 1 point => 0 edges if (pathDetailList.isEmpty() && pointList.size() > 1) throw new IllegalStateException("PathDetails " + name + " must not be empty"); listsToSimplify.add(pathDetailList); } this.douglasPeucker = douglasPeucker; }
jsonPath.putPOJO("instructions", ar.getInstructions());
public PathSimplification(PathWrapper pathWrapper, DouglasPeucker douglasPeucker, boolean enableInstructions) { this.pointList = pathWrapper.getPoints(); listsToSimplify = new ArrayList<>(); if (enableInstructions) listsToSimplify.add(pathWrapper.getInstructions()); this.pathDetails = pathWrapper.getPathDetails(); for (String name : pathDetails.keySet()) { List<PathDetail> pathDetailList = pathDetails.get(name); // If the pointList only contains one point, PathDetails have to be empty because 1 point => 0 edges if (pathDetailList.isEmpty() && pointList.size() > 1) throw new IllegalStateException("PathDetails " + name + " must not be empty"); listsToSimplify.add(pathDetailList); } this.douglasPeucker = douglasPeucker; }
time = measurements.get(0).getTime(); return Response.ok(rsp.getBest().getInstructions().createGPX(gpx.trk.get(0).name != null ? gpx.trk.get(0).name : "", time, enableElevation, withRoute, withTrack, false, Constants.VERSION), "application/gpx+xml"). header("X-GH-Took", "" + Math.round(took * 1000)). build();
jsonPath.putPOJO("instructions", ar.getInstructions());
time = measurements.get(0).getTime(); writer.append(pathWrapper.getInstructions().createGPX(gpx.trk.get(0).name != null ? gpx.trk.get(0).name : "", time, hopper.hasElevation(), withRoute, true, false, Constants.VERSION));
Path path = mapMatching.calcPath(mr); new PathMerger().doWork(matchGHRsp, Collections.singletonList(path), tr); il = matchGHRsp.getInstructions();