Try to fix navigation (could not be released in 2.4 cause requires testing), the change is correct, though could affect slightly longer calculation.

This commit is contained in:
Victor Shcherb 2016-08-13 14:42:33 +02:00
parent 98a3d38026
commit ef97af1985
2 changed files with 4 additions and 5 deletions

View file

@ -4,7 +4,6 @@ import gnu.trove.map.hash.TLongObjectHashMap;
import java.io.IOException; import java.io.IOException;
import java.text.MessageFormat; import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Comparator; import java.util.Comparator;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
@ -19,7 +18,7 @@ import org.apache.commons.logging.Log;
public class BinaryRoutePlanner { public class BinaryRoutePlanner {
private static final int TEST_ID = 31370645; private static final int TEST_ID = 77031244;
private static final boolean TEST_SPECIFIC = false; private static final boolean TEST_SPECIFIC = false;
private static final int REVERSE_WAY_RESTRICTION_ONLY = 1024; private static final int REVERSE_WAY_RESTRICTION_ONLY = 1024;
@ -394,7 +393,7 @@ public class BinaryRoutePlanner {
RouteSegment segment, TLongObjectHashMap<RouteSegment> oppositeSegments, boolean doNotAddIntersections) throws IOException { RouteSegment segment, TLongObjectHashMap<RouteSegment> oppositeSegments, boolean doNotAddIntersections) throws IOException {
final RouteDataObject road = segment.road; final RouteDataObject road = segment.road;
boolean initDirectionAllowed = checkIfInitialMovementAllowedOnSegment(ctx, reverseWaySearch, visitedSegments, segment, road); boolean initDirectionAllowed = checkIfInitialMovementAllowedOnSegment(ctx, reverseWaySearch, visitedSegments, segment, road);
if (TEST_SPECIFIC && road.getId() == TEST_ID) { if (TEST_SPECIFIC && road.getId() >> 6 == TEST_ID) {
printRoad(" ! " + +segment.distanceFromStart + " ", segment, reverseWaySearch); printRoad(" ! " + +segment.distanceFromStart + " ", segment, reverseWaySearch);
} }
boolean directionAllowed = initDirectionAllowed; boolean directionAllowed = initDirectionAllowed;
@ -777,7 +776,7 @@ public class BinaryRoutePlanner {
next.getRoad().getPointsLength() - 1 : 0, next.getRoad().getPointsLength() - 1 : 0,
segment, segmentPoint); segment, segmentPoint);
distFromStart += obstaclesTime; distFromStart += obstaclesTime;
if (TEST_SPECIFIC && next.road.getId() == TEST_ID) { if (TEST_SPECIFIC && next.road.getId() >> 6 == TEST_ID) {
printRoad(" !? distFromStart=" + +distFromStart + " from " + segment.getRoad().getId() + printRoad(" !? distFromStart=" + +distFromStart + " from " + segment.getRoad().getId() +
" dir=" + segment.getDirectionAssigned() + " dir=" + segment.getDirectionAssigned() +
" distToEnd=" + distanceToEnd + " distToEnd=" + distanceToEnd +

View file

@ -334,7 +334,7 @@ public class GeneralRouter implements VehicleRouter {
float ts = getPenaltyTransition(segment.getRoad()); float ts = getPenaltyTransition(segment.getRoad());
float prevTs = getPenaltyTransition(prev.getRoad()); float prevTs = getPenaltyTransition(prev.getRoad());
if(prevTs != ts) { if(prevTs != ts) {
if(ts > prevTs) return (ts - prevTs); return Math.abs(ts - prevTs) / 2;
} }
// int[] pt = prev.getRoad().getPointTypes(prevSegmentEnd); // int[] pt = prev.getRoad().getPointTypes(prevSegmentEnd);
// if(pt != null) { // if(pt != null) {