public GHPoint3D toGHPoint(int index) { return new GHPoint3D(getLatitude(index), getLongitude(index), getElevation(index)); }
@Override public boolean equals(Object obj) { if (obj == null) return false; final GPXEntry other = (GPXEntry) obj; return time == other.time && super.equals(obj); }
@Override public int hashCode() { return 59 * super.hashCode() + (int) (time ^ (time >>> 32)); }
@Override public String toString() { return "GPXExtension{" + "closest node=" + queryResult.getClosestNode() + " at " + queryResult.getSnappedPoint().getLat() + "," + queryResult.getSnappedPoint().getLon() + ", incomingEdge=" + incomingVirtualEdge + ", outgoingEdge=" + outgoingVirtualEdge + '}'; } }
@Override public String toString() { return super.toString() + ", " + time; } }
@Test public void testUseMeanElevation() { g.close(); g = new GraphHopperStorage(new RAMDirectory(), encodingManager, true, new GraphExtension.NoOpExtension()).create(100); NodeAccess na = g.getNodeAccess(); na.setNode(0, 0, 0, 0); na.setNode(1, 0, 0.0001, 20); EdgeIteratorState edge = g.edge(0, 1); EdgeIteratorState edgeReverse = edge.detach(true); DistanceCalc2D distCalc = new DistanceCalc2D(); QueryResult qr = new QueryResult(0, 0.00005); qr.setClosestEdge(edge); qr.setWayIndex(0); qr.setSnappedPosition(EDGE); qr.calcSnappedPoint(distCalc); assertEquals(10, qr.getSnappedPoint().getEle(), 1e-1); qr = new QueryResult(0, 0.00005); qr.setClosestEdge(edgeReverse); qr.setWayIndex(0); qr.setSnappedPosition(EDGE); qr.calcSnappedPoint(distCalc); assertEquals(10, qr.getSnappedPoint().getEle(), 1e-1); }
@Override public String toString() { return "GPXExtension{" + "closest node=" + queryResult.getClosestNode() + " at " + queryResult.getSnappedPoint().getLat() + "," + queryResult.getSnappedPoint().getLon() + ", incomingEdge=" + incomingVirtualEdge + ", outgoingEdge=" + outgoingVirtualEdge + '}'; } }
@Override public String toString() { return super.toString() + ", " + time; } }
/** * 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 (prevPoint.equals(currSnapped)) { res.setClosestNode(prevNodeId); continue;
@Override public String toString() { return super.toString() + ", " + time; } }
@Override public int hashCode() { return 59 * super.hashCode() + (int) (time ^ (time >>> 32)); }
public GHPoint3D toGHPoint( int index ) { return new GHPoint3D(getLatitude(index), getLongitude(index), getElevation(index)); }
@Override public boolean equals( Object obj ) { if (obj == null) return false; final GPXEntry other = (GPXEntry) obj; return time == other.time && super.equals(obj); }
@Override public String toString() { return super.toString() + ", " + time; } }
@Override public int hashCode() { return 59 * super.hashCode() + (int) (time ^ (time >>> 32)); }
public GHPoint3D toGHPoint(int index) { return new GHPoint3D(getLatitude(index), getLongitude(index), getElevation(index)); }
@Override public boolean equals(Object obj) { if (obj == null) return false; final GPXEntry other = (GPXEntry) obj; return time == other.time && super.equals(obj); }