diff --git a/brouter-core/src/main/java/btools/router/OsmPath.java b/brouter-core/src/main/java/btools/router/OsmPath.java index e50bf24..500600c 100644 --- a/brouter-core/src/main/java/btools/router/OsmPath.java +++ b/brouter-core/src/main/java/btools/router/OsmPath.java @@ -481,7 +481,7 @@ System.out.println( "bad TR candidate: " + id ); double targetCost = processTargetNode( rc ); if ( targetCost < 0. || targetCost + cost >= 2000000000. ) { - if ( rc.suspectNodes != null && priorityclassifier > 20 && !rc.inverseDirection ) + if ( rc.suspectNodes != null && priorityclassifier > 20 && rc.inverseDirection == rc.inverseRouting ) { rc.foundNodeBlock = true; Long id = Long.valueOf( targetNode.getIdFromPos() ); diff --git a/brouter-core/src/main/java/btools/router/RoutingContext.java b/brouter-core/src/main/java/btools/router/RoutingContext.java index c6d32a2..8d23886 100644 --- a/brouter-core/src/main/java/btools/router/RoutingContext.java +++ b/brouter-core/src/main/java/btools/router/RoutingContext.java @@ -169,7 +169,7 @@ public final class RoutingContext trafficSourceMinDist = expctxGlobal.getVariableValue( "trafficSourceMinDist", 3000.f ); showspeed = 0.f != expctxGlobal.getVariableValue( "showspeed", 0.f ); - inverseRouting = 0.f != expctxGlobal.getVariableValue( "inverseRouting", 0.f ); + inverseRouting = 0.f != expctxGlobal.getVariableValue( "inverseRouting", inverseRouting ? 1.f : 0.f ); int tiMode = (int)expctxGlobal.getVariableValue( "turnInstructionMode", 0.f ); if ( tiMode != 1 ) // automatic selection from coordinate source diff --git a/brouter-core/src/main/java/btools/router/RoutingEngine.java b/brouter-core/src/main/java/btools/router/RoutingEngine.java index bb2ad9e..3c38cc2 100644 --- a/brouter-core/src/main/java/btools/router/RoutingEngine.java +++ b/brouter-core/src/main/java/btools/router/RoutingEngine.java @@ -1017,6 +1017,7 @@ public class RoutingEngine extends Thread if ( ! nodesCache.obtainNonHollowNode( nextNode ) ) { + nPathPossible++; continue; // border node? } if ( nextNode == sourceNode ) @@ -1034,6 +1035,7 @@ public class RoutingEngine extends Thread int gidx = path.treedepth + 1; if ( gidx >= guideTrack.nodes.size() ) { + nPathPossible++; continue; } OsmPathElement guideNode = guideTrack.nodes.get( routingContext.inverseRouting ? guideTrack.nodes.size() - 1 - gidx : gidx ); @@ -1130,7 +1132,7 @@ public class RoutingEngine extends Thread } // report oneway dead-ends as suspects - if ( routingContext.suspectNodes != null && path.priorityclassifier > 20 && currentNode.virgin && path.cost > 2000 && !routingContext.inverseDirection ) + if ( routingContext.suspectNodes != null && path.priorityclassifier > 20 && currentNode.virgin && path.cost > 2000 && routingContext.inverseDirection == routingContext.inverseRouting && guideTrack == null ) { int suspectPrio = 0; if ( nPathPossible == 0 && (!routingContext.foundNodeBlock) ) diff --git a/brouter-server/src/main/java/btools/server/BadTRDetector.java b/brouter-server/src/main/java/btools/server/BadTRDetector.java index ea28021..599dda5 100644 --- a/brouter-server/src/main/java/btools/server/BadTRDetector.java +++ b/brouter-server/src/main/java/btools/server/BadTRDetector.java @@ -71,6 +71,7 @@ public class BadTRDetector else { rc.suspectNodes = suspectTRs; + rc.inverseRouting = rand.nextBoolean(); } RoutingEngine re = new RoutingEngine( "mytrack", "mylog", args[0], wplist, rc ); diff --git a/brouter-server/src/main/java/btools/server/IssueArchiver.java b/brouter-server/src/main/java/btools/server/IssueArchiver.java new file mode 100644 index 0000000..8560c73 --- /dev/null +++ b/brouter-server/src/main/java/btools/server/IssueArchiver.java @@ -0,0 +1,61 @@ +package btools.server; + +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileReader; +import java.io.FileWriter; +import java.util.HashSet; +import java.util.Set; +import java.util.StringTokenizer; +import java.util.TreeMap; +import java.util.TreeSet; + + +public class IssueArchiver +{ + public static void main(String[] args) throws Exception + { + if ( args.length < 2 ) + { + System.out.println( "usage : IssueArchiver " ); + System.exit(1); + } + + File suspectDir = new File( args[0] ); + if ( !suspectDir.isDirectory() ) + { + throw new IllegalArgumentException( "not a directory: " + suspectDir ); + } + File suspectArchive = new File( args[1] ); + if ( !suspectArchive.isDirectory() ) + { + throw new IllegalArgumentException( "not a directory: " + suspectArchive ); + } + + File[] files = suspectDir.listFiles(); + for ( File f : files ) + { + String name = f.getName(); + if ( name.startsWith( "suspects_" ) && name.endsWith( ".txt" ) ) + { + BufferedReader br = new BufferedReader( new FileReader( f ) ); + for(;;) + { + String line = br.readLine(); + if ( line == null ) break; + StringTokenizer tk = new StringTokenizer( line ); + long id = Long.parseLong( tk.nextToken() ); + int prio = Integer.parseInt( tk.nextToken() ); + + File archiveEntry = new File( suspectArchive, "" + id ); + if ( !archiveEntry.exists() ) + { + archiveEntry.createNewFile(); + } + } + br.close(); + } + } + } +}