Search in sources :

Example 31 with NodeAccess

use of com.graphhopper.storage.NodeAccess in project graphhopper by graphhopper.

the class NodeElevationInterpolator method interpolateElevationsOfInnerNodesForThreeOuterNodes.

private void interpolateElevationsOfInnerNodesForThreeOuterNodes(int firstOuterNodeId, int secondOuterNodeId, int thirdOuterNodeId, int[] innerNodeIds) {
    NodeAccess nodeAccess = storage.getNodeAccess();
    double lat0 = nodeAccess.getLat(firstOuterNodeId);
    double lon0 = nodeAccess.getLon(firstOuterNodeId);
    double ele0 = nodeAccess.getEle(firstOuterNodeId);
    double lat1 = nodeAccess.getLat(secondOuterNodeId);
    double lon1 = nodeAccess.getLon(secondOuterNodeId);
    double ele1 = nodeAccess.getEle(secondOuterNodeId);
    double lat2 = nodeAccess.getLat(thirdOuterNodeId);
    double lon2 = nodeAccess.getLon(thirdOuterNodeId);
    double ele2 = nodeAccess.getEle(thirdOuterNodeId);
    for (int innerNodeId : innerNodeIds) {
        double lat = nodeAccess.getLat(innerNodeId);
        double lon = nodeAccess.getLon(innerNodeId);
        double ele = elevationInterpolator.calculateElevationBasedOnThreePoints(lat, lon, lat0, lon0, ele0, lat1, lon1, ele1, lat2, lon2, ele2);
        nodeAccess.setNode(innerNodeId, lat, lon, ele);
    }
}
Also used : NodeAccess(com.graphhopper.storage.NodeAccess)

Aggregations

NodeAccess (com.graphhopper.storage.NodeAccess)31 Graph (com.graphhopper.storage.Graph)18 Test (org.junit.Test)18 GraphBuilder (com.graphhopper.storage.GraphBuilder)7 EdgeIteratorState (com.graphhopper.util.EdgeIteratorState)7 GHIntHashSet (com.graphhopper.coll.GHIntHashSet)6 Dijkstra (com.graphhopper.routing.Dijkstra)6 Path (com.graphhopper.routing.Path)6 ShortestWeighting (com.graphhopper.routing.weighting.ShortestWeighting)6 RAMDirectory (com.graphhopper.storage.RAMDirectory)5 PointList (com.graphhopper.util.PointList)5 GHRequest (com.graphhopper.GHRequest)3 GHResponse (com.graphhopper.GHResponse)3 CHGraph (com.graphhopper.storage.CHGraph)3 PathWrapper (com.graphhopper.PathWrapper)2 GHPoint (com.graphhopper.util.shapes.GHPoint)2 ArrayList (java.util.ArrayList)2 IntHashSet (com.carrotsearch.hppc.IntHashSet)1 IntIntHashMap (com.carrotsearch.hppc.IntIntHashMap)1 IntLongHashMap (com.carrotsearch.hppc.IntLongHashMap)1