/** * Calculates the closet point on the edge from the query point. */ public void calcSnappedPoint(DistanceCalc distCalc) { if (closestEdge == null) throw new IllegalStateException("No closest edge?"); if (snappedPoint != null) throw new IllegalStateException("Calculate snapped point only once"); PointList fullPL = getClosestEdge().fetchWayGeometry(3); double tmpLat = fullPL.getLatitude(wayIndex); double tmpLon = fullPL.getLongitude(wayIndex); double tmpEle = fullPL.getElevation(wayIndex); if (snappedPosition != Position.EDGE) { snappedPoint = new GHPoint3D(tmpLat, tmpLon, tmpEle); return; } double queryLat = getQueryPoint().lat, queryLon = getQueryPoint().lon; double adjLat = fullPL.getLatitude(wayIndex + 1), adjLon = fullPL.getLongitude(wayIndex + 1); if (distCalc.validEdgeDistance(queryLat, queryLon, tmpLat, tmpLon, adjLat, adjLon)) { GHPoint tmpPoint = distCalc.calcCrossingPointToEdge(queryLat, queryLon, tmpLat, tmpLon, adjLat, adjLon); double adjEle = fullPL.getElevation(wayIndex + 1); snappedPoint = new GHPoint3D(tmpPoint.lat, tmpPoint.lon, (tmpEle + adjEle) / 2); } else // outside of edge boundaries snappedPoint = new GHPoint3D(tmpLat, tmpLon, tmpEle); }
if (distCalc.validEdgeDistance(queryLat, queryLon, tmpLat, tmpLon, wayLat, wayLon)) { tmpNormedDist = distCalc.calcNormalizedEdgeDistance(queryLat, queryLon, tmpLat, tmpLon, wayLat, wayLon);
double toLon = nodeAccess.getLongitude(toNode); if (calc.validEdgeDistance(queryLat, queryLon, fromLat, fromLon, toLat, toLon)) { double distEdge = calc.calcDenormalizedDist(calc.calcNormalizedEdgeDistance(queryLat, queryLon,
if (distCalc.validEdgeDistance(lat, lon, currLat, currLon, prevLat, prevLon)) { distance = distCalc.calcNormalizedEdgeDistance(lat, lon, currLat, currLon, prevLat, prevLon); if (pointIndex > 0)
/** * Calculates the closet point on the edge from the query point. */ public void calcSnappedPoint(DistanceCalc distCalc) { if (closestEdge == null) throw new IllegalStateException("No closest edge?"); if (snappedPoint != null) throw new IllegalStateException("Calculate snapped point only once"); PointList fullPL = getClosestEdge().fetchWayGeometry(3); double tmpLat = fullPL.getLatitude(wayIndex); double tmpLon = fullPL.getLongitude(wayIndex); double tmpEle = fullPL.getElevation(wayIndex); if (snappedPosition != Position.EDGE) { snappedPoint = new GHPoint3D(tmpLat, tmpLon, tmpEle); return; } double queryLat = getQueryPoint().lat, queryLon = getQueryPoint().lon; double adjLat = fullPL.getLatitude(wayIndex + 1), adjLon = fullPL.getLongitude(wayIndex + 1); if (distCalc.validEdgeDistance(queryLat, queryLon, tmpLat, tmpLon, adjLat, adjLon)) { GHPoint tmpPoint = distCalc.calcCrossingPointToEdge(queryLat, queryLon, tmpLat, tmpLon, adjLat, adjLon); double adjEle = fullPL.getElevation(wayIndex + 1); snappedPoint = new GHPoint3D(tmpPoint.lat, tmpPoint.lon, (tmpEle + adjEle) / 2); } else // outside of edge boundaries snappedPoint = new GHPoint3D(tmpLat, tmpLon, tmpEle); }
/** * Calculates the closet point on the edge from the query point. */ public void calcSnappedPoint(DistanceCalc distCalc) { if (closestEdge == null) throw new IllegalStateException("No closest edge?"); if (snappedPoint != null) throw new IllegalStateException("Calculate snapped point only once"); PointList fullPL = getClosestEdge().fetchWayGeometry(3); double tmpLat = fullPL.getLatitude(wayIndex); double tmpLon = fullPL.getLongitude(wayIndex); double tmpEle = fullPL.getElevation(wayIndex); if (snappedPosition != Position.EDGE) { snappedPoint = new GHPoint3D(tmpLat, tmpLon, tmpEle); return; } double queryLat = getQueryPoint().lat, queryLon = getQueryPoint().lon; double adjLat = fullPL.getLatitude(wayIndex + 1), adjLon = fullPL.getLongitude(wayIndex + 1); if (distCalc.validEdgeDistance(queryLat, queryLon, tmpLat, tmpLon, adjLat, adjLon)) { GHPoint tmpPoint = distCalc.calcCrossingPointToEdge(queryLat, queryLon, tmpLat, tmpLon, adjLat, adjLon); double adjEle = fullPL.getElevation(wayIndex + 1); snappedPoint = new GHPoint3D(tmpPoint.lat, tmpPoint.lon, (tmpEle + adjEle) / 2); } else // outside of edge boundaries snappedPoint = new GHPoint3D(tmpLat, tmpLon, tmpEle); }
/** * Calculates the closet point on the edge from the query point. */ public void calcSnappedPoint( DistanceCalc distCalc ) { if (closestEdge == null) throw new IllegalStateException("No closest edge?"); if (snappedPoint != null) throw new IllegalStateException("Calculate snapped point only once"); PointList fullPL = getClosestEdge().fetchWayGeometry(3); double tmpLat = fullPL.getLatitude(wayIndex); double tmpLon = fullPL.getLongitude(wayIndex); double tmpEle = fullPL.getElevation(wayIndex); if (snappedPosition != Position.EDGE) { snappedPoint = new GHPoint3D(tmpLat, tmpLon, tmpEle); return; } double queryLat = getQueryPoint().lat, queryLon = getQueryPoint().lon; double adjLat = fullPL.getLatitude(wayIndex + 1), adjLon = fullPL.getLongitude(wayIndex + 1); if (distCalc.validEdgeDistance(queryLat, queryLon, tmpLat, tmpLon, adjLat, adjLon)) { GHPoint tmpPoint = distCalc.calcCrossingPointToEdge(queryLat, queryLon, tmpLat, tmpLon, adjLat, adjLon); double adjEle = fullPL.getElevation(wayIndex + 1); snappedPoint = new GHPoint3D(tmpPoint.lat, tmpPoint.lon, (tmpEle + adjEle) / 2); } else // outside of edge boundaries snappedPoint = new GHPoint3D(tmpLat, tmpLon, tmpEle); }
double toLon = nodeAccess.getLongitude(toNode); if (calc.validEdgeDistance(queryLat, queryLon, fromLat, fromLon, toLat, toLon)) { double distEdge = calc.calcDenormalizedDist(calc.calcNormalizedEdgeDistance(queryLat, queryLon,
if (distCalc.validEdgeDistance(queryLat, queryLon, tmpLat, tmpLon, wayLat, wayLon)) { tmpNormedDist = distCalc.calcNormalizedEdgeDistance(queryLat, queryLon, tmpLat, tmpLon, wayLat, wayLon);
if (distCalc.validEdgeDistance(queryLat, queryLon, tmpLat, tmpLon, wayLat, wayLon))
double toLon = nodeAccess.getLongitude(toNode); if (calc.validEdgeDistance(queryLat, queryLon, fromLat, fromLon, toLat, toLon)) { double distEdge = calc.calcDenormalizedDist(calc.calcNormalizedEdgeDistance(queryLat, queryLon,
if (distCalc.validEdgeDistance(queryLat, queryLon, tmpLat, tmpLon, wayLat, wayLon)) { tmpNormedDist = distCalc.calcNormalizedEdgeDistance(queryLat, queryLon, tmpLat, tmpLon, wayLat, wayLon);
double toLon = nodeAccess.getLongitude(toNode); if (calc.validEdgeDistance(queryLat, queryLon, fromLat, fromLon, toLat, toLon))
if (distCalc.validEdgeDistance(lat, lon, currLat, currLon, prevLat, prevLon)) { distance = distCalc.calcNormalizedEdgeDistance(lat, lon, currLat, currLon, prevLat, prevLon); if (pointIndex > 0)
if (distCalc.validEdgeDistance(lat, lon, currLat, currLon, prevLat, prevLon)) { distance = distCalc.calcNormalizedEdgeDistance(lat, lon, currLat, currLon, prevLat, prevLon); if (pointIndex > 0)
if (distCalc.validEdgeDistance(lat, lon, currLat, currLon, prevLat, prevLon))