Repository navigation
Closed
Labels
Description
This stuff:
graphhopper/web-bundle/src/main/java/com/graphhopper/resources/RouteResource.java
Lines 106 to 132 in 7bee0e4
| if (requestPoints.isEmpty()) | |
| throw new IllegalArgumentException("You have to pass at least one point"); | |
| if (enableElevation && !hasElevation) | |
| throw new IllegalArgumentException("Elevation not supported!"); | |
| if (favoredHeadings.size() > 1 && favoredHeadings.size() != requestPoints.size()) | |
| throw new IllegalArgumentException("The number of 'heading' parameters must be <= 1 " | |
| + "or equal to the number of points (" + requestPoints.size() + ")"); | |
| // TODO these checks should be only necessary once in the core, e.g. pointHints problems are currently ignored for POST requests | |
| if (pointHints.size() > 0 && pointHints.size() != requestPoints.size()) | |
| throw new IllegalArgumentException("If you pass " + POINT_HINT + ", you need to pass exactly one hint for every point, empty hints will be ignored"); | |
| if (curbsides.size() > 0 && curbsides.size() != requestPoints.size()) | |
| throw new IllegalArgumentException("If you pass " + CURBSIDE + ", you need to pass exactly one curbside for every point, empty curbsides will be ignored"); | |
| GHRequest request; | |
| if (favoredHeadings.size() > 0) { | |
| // if only one favored heading is specified take as start heading | |
| if (favoredHeadings.size() == 1) { | |
| List<Double> paddedHeadings = new ArrayList<>(Collections.nCopies(requestPoints.size(), Double.NaN)); | |
| paddedHeadings.set(0, favoredHeadings.get(0)); | |
| request = new GHRequest(requestPoints, paddedHeadings); | |
| } else { | |
| request = new GHRequest(requestPoints, favoredHeadings); | |
| } | |
| } else { | |
| request = new GHRequest(requestPoints); | |
| } |
should probably also be done for POST requests, so we should rather move it into GraphHopper#calcPaths.
c.f. #1934 (comment)
Activity