@Override public double calcWeight(EdgeIteratorState edgeState, boolean reverse, int prevOrNextEdgeId) { CHEdgeIteratorState tmp = (CHEdgeIteratorState) edgeState; if (tmp.isShortcut()) // if a shortcut is in both directions the weight is identical => no need for 'reverse' return tmp.getWeight(); return userWeighting.calcWeight(edgeState, reverse, prevOrNextEdgeId); }
boolean prepareEdges() { // In CH the setProperties (speed) are ignored as calculating the new setProperties for a // shortcut is often not possible. // Also several shortcuts would be necessary with the different modes (e.g. fastest and // shortest) // So calculate the weight and store this as weight, then use only weight instead of calcWeight EdgeIterator iter = g.getAllEdges(); int c = 0; while (iter.next()) { c++; iter.setDistance(prepareWeighting.calcWeight(iter)); setOrigEdgeCount(iter.getEdge(), 1); } return c > 0; }
@Override public String toString() { return "PREPARE+" + userWeighting.toString(); }
@Override public FlagEncoder getFlagEncoder() { return userWeighting.getFlagEncoder(); }
@Override public final double getMinWeight(double distance) { return userWeighting.getMinWeight(distance); }