public void add(PointAccess nodeAccess, int index) { if (is3D) add(nodeAccess.getLatitude(index), nodeAccess.getLongitude(index), nodeAccess.getElevation(index)); else add(nodeAccess.getLatitude(index), nodeAccess.getLongitude(index)); }
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()); }
@Override public void finish() { if (prevInRoundabout) { // calc angle between roundabout entrance and finish double orientation = Helper.ANGLE_CALC.calcOrientation(doublePrevLat, doublePrevLon, prevLat, prevLon); orientation = Helper.ANGLE_CALC.alignOrientation(prevOrientation, orientation); double delta = (orientation - prevOrientation); ((RoundaboutInstruction) prevInstruction).setRadian(delta); } Instruction finishInstruction = new FinishInstruction(nodeAccess, prevEdge.getAdjNode()); // This is the heading how the edge ended finishInstruction.setExtraInfo("last_heading", Helper.ANGLE_CALC.calcAzimuth(doublePrevLat, doublePrevLon, prevLat, prevLon)); ways.add(finishInstruction); }
@Override public void next(EdgeIteratorState eb, int index, int prevEdgeId) { PointList pl = eb.fetchWayGeometry(2); for (int j = 0; j < pl.getSize(); j++) { points.add(pl, j); } }
public ViaInstruction(Instruction instr) { this(instr.getName(), instr.getAnnotation(), instr.getPoints()); setDistance(instr.getDistance()); setTime(instr.getTime()); this.extraInfo = instr.extraInfo; }
@Override public String toString() { String str = ""; if (!Helper.isEmpty(name)) { str += name + " "; } return str + "time:" + getSeconds(); }
@Override public boolean accept(EdgeIteratorState iter) { return iter.getBaseNode() == 2 || iter.getAdjNode() == 2; } }).getClosestNode());
/** * Longitude of the location where this instruction should take place. */ double getFirstLon() { return points.getLongitude(0); }
public DouglasPeucker() { setApproximation(true); // 1m setMaxDistance(1); }
public String downloadAsString(String url, boolean readErrorStreamNoException) throws IOException { return Helper.isToString(fetch((HttpURLConnection) createConnection(url), readErrorStreamNoException)); } }
public void unzip(String from, boolean remove) throws IOException { String to = Helper.pruneFileEnd(from); unzip(from, to, remove); }
public String getVehicle() { return toLowerCase(super.get("vehicle", "")); }
@Override public boolean accept(EdgeIteratorState iter) { return iter.getAdjNode() != 5; } });
/** * @return mean time per call, in ms */ public double getMean() { return getSum() / counts; }
/** * Create a shallow copy of this Pointlist from from to end, excluding end. * * @param makeImmutable makes this PointList immutable. If you don't ensure the consistency it might happen that due to changes of this * object, the shallow copy might contain incorrect or corrupt data. */ public PointList shallowCopy(final int from, final int end, boolean makeImmutable) { if (makeImmutable) this.makeImmutable(); return new ShallowImmutablePointList(from, end, this); }