diff --git a/OsmAnd-java/src/net/osmand/router/BinaryRoutePlanner.java b/OsmAnd-java/src/net/osmand/router/BinaryRoutePlanner.java index 5805c6d1ce..44512c4a0e 100644 --- a/OsmAnd-java/src/net/osmand/router/BinaryRoutePlanner.java +++ b/OsmAnd-java/src/net/osmand/router/BinaryRoutePlanner.java @@ -136,11 +136,11 @@ public class BinaryRoutePlanner { } if (ctx.planRouteIn2Directions()) { forwardSearch = (nonHeuristicSegmentsComparator.compare(graphDirectSegments.peek(), graphReverseSegments.peek()) < 0); - if (graphDirectSegments.size() * 2 > graphReverseSegments.size()) { - forwardSearch = false; - } else if (graphDirectSegments.size() < 2 * graphReverseSegments.size()) { - forwardSearch = true; - } +// if (graphDirectSegments.size() * 2 > graphReverseSegments.size()) { +// forwardSearch = false; +// } else if (graphDirectSegments.size() < 2 * graphReverseSegments.size()) { +// forwardSearch = true; +// } } else { // different strategy : use onedirectional graph forwardSearch = onlyForward; diff --git a/OsmAnd-java/src/net/osmand/router/GeneralRouter.java b/OsmAnd-java/src/net/osmand/router/GeneralRouter.java index 84e9e192bc..b1bb749950 100644 --- a/OsmAnd-java/src/net/osmand/router/GeneralRouter.java +++ b/OsmAnd-java/src/net/osmand/router/GeneralRouter.java @@ -57,7 +57,8 @@ public class GeneralRouter implements VehicleRouter { ACCESS("access"), OBSTACLES("obstacle_time"), ROUTING_OBSTACLES("obstacle"), - ONEWAY("oneway"); + ONEWAY("oneway"), + PENALTY_TRANSITION("penalty_transition"); public final String nm; RouteDataObjectAttribute(String name) { nm = name; @@ -272,6 +273,11 @@ public class GeneralRouter implements VehicleRouter { public int isOneWay(RouteDataObject road) { return getObjContext(RouteDataObjectAttribute.ONEWAY).evaluateInt(road, 0); } + + @Override + public float getPenaltyTransition(RouteDataObject road) { + return getObjContext(RouteDataObjectAttribute.PENALTY_TRANSITION).evaluateInt(road, 0); + } @Override public float defineRoutingSpeed(RouteDataObject road) { @@ -323,6 +329,12 @@ public class GeneralRouter implements VehicleRouter { } } + float ts = getPenaltyTransition(segment.getRoad()); + float prevTs = getPenaltyTransition(prev.getRoad()); + if(prevTs != ts) { + if(ts > prevTs) return (ts - prevTs); + } + if(segment.getRoad().roundabout() && !prev.getRoad().roundabout()) { double rt = getRoundaboutTurn(); if(rt > 0) { diff --git a/OsmAnd-java/src/net/osmand/router/VehicleRouter.java b/OsmAnd-java/src/net/osmand/router/VehicleRouter.java index fcd10bc5b9..3d565b039b 100644 --- a/OsmAnd-java/src/net/osmand/router/VehicleRouter.java +++ b/OsmAnd-java/src/net/osmand/router/VehicleRouter.java @@ -22,6 +22,11 @@ public interface VehicleRouter { */ public int isOneWay(RouteDataObject road); + /** + * return penalty transition in seconds + */ + public float getPenaltyTransition(RouteDataObject road); + /** * return delay in seconds (0 no obstacles) */