This commit is contained in:
Victor Shcherb 2018-10-17 02:03:44 +02:00
parent ab68c74370
commit a114ba97f6
2 changed files with 18 additions and 10 deletions

View file

@ -396,7 +396,7 @@ public class BinaryRoutePlanner {
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() >> 6 == 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;
if (!directionAllowed) { if (!directionAllowed) {
@ -514,9 +514,11 @@ public class BinaryRoutePlanner {
directionAllowed = oneway >= 0; directionAllowed = oneway >= 0;
} }
} }
RouteSegment visitedSegment = visitedSegments.get(calculateRoutePointId(segment, segment.isPositive()));
if (directionAllowed && visitedSegments.containsKey(calculateRoutePointId(segment, segment.isPositive()))) { if (directionAllowed && visitedSegment != null) {
directionAllowed = false; if (visitedSegment.distanceFromStart <= segment.distanceFromStart) {
directionAllowed = false;
}
} }
return directionAllowed; return directionAllowed;
} }

View file

@ -464,12 +464,18 @@ public class RouteResultPreparation {
double startLon = start.getLongitude(); double startLon = start.getLongitude();
double endLat = end.getLatitude(); double endLat = end.getLatitude();
double endLon = end.getLongitude(); double endLon = end.getLongitude();
String msg = MessageFormat.format("<test regions=\"\" description=\"\" best_percent=\"\" vehicle=\"{4}\" \n"
+ " start_lat=\"{0}\" start_lon=\"{1}\" target_lat=\"{2}\" target_lon=\"{3}\" {5} >", String msg = String.format("<test regions=\"\" description=\"\" best_percent=\"\" vehicle=\"%s\" \n"
startLat + "", startLon + "", endLat + "", endLon + "", ctx.config.routerName, + " start_lat=\"%.5f\" start_lon=\"%.5f\" target_lat=\"%.5f\" target_lon=\"%.5f\" "
"loadedTiles = \"" + ctx.loadedTiles + "\" " + "visitedSegments = \"" + ctx.visitedSegments + "\" " + + " routing_time=\"%.2f\" loadedTiles=\"%d\" visitedSegments=\"%d\" complete_distance=\"%.2f\" complete_time=\"%.2f\" >",
"complete_distance = \"" + completeDistance + "\" " + "complete_time = \"" + completeTime + "\" " + ctx.config.routerName, startLat, startLon, endLat, endLon, ctx.routingTime, ctx.loadedTiles,
"routing_time = \"" + ctx.routingTime + "\" "); ctx.visitedSegments, completeDistance, completeTime);
// String msg = MessageFormat.format("<test regions=\"\" description=\"\" best_percent=\"\" vehicle=\"{4}\" \n"
// + " start_lat=\"{0}\" start_lon=\"{1}\" target_lat=\"{2}\" target_lon=\"{3}\" {5} >",
// startLat + "", startLon + "", endLat + "", endLon + "", ctx.config.routerName,
// "loadedTiles = \"" + ctx.loadedTiles + "\" " + "visitedSegments = \"" + ctx.visitedSegments + "\" " +
// "complete_distance = \"" + completeDistance + "\" " + "complete_time = \"" + completeTime + "\" " +
// "routing_time = \"" + ctx.routingTime + "\" ");
log.info(msg); log.info(msg);
println(msg); println(msg);
if (PRINT_TO_CONSOLE_ROUTE_INFORMATION_TO_TEST) { if (PRINT_TO_CONSOLE_ROUTE_INFORMATION_TO_TEST) {