diff --git a/brouter-core/src/main/java/btools/router/RoutingEngine.java b/brouter-core/src/main/java/btools/router/RoutingEngine.java index 895b97c..09fd29f 100644 --- a/brouter-core/src/main/java/btools/router/RoutingEngine.java +++ b/brouter-core/src/main/java/btools/router/RoutingEngine.java @@ -32,6 +32,8 @@ public class RoutingEngine extends Thread protected List matchedWaypoints; private int linksProcessed = 0; + private int nodeLimit; // used for target island search + protected OsmTrack foundTrack = new OsmTrack(); private OsmTrack foundRawTrack = null; private int alternativeIndex = 0; @@ -325,6 +327,22 @@ public class RoutingEngine extends Thread matchedWaypoints.add( mwp ); } matchWaypointsToNodes( matchedWaypoints ); + + // detect target islands: restricted search in inverse direction + routingContext.inverseDirection = true; + airDistanceCostFactor = 0.; + for( int i=0; i 0 ) + { + throw new IllegalArgumentException( "target island detected for section " + i ); + } + } + routingContext.inverseDirection = false; + nodeLimit = 0; + if ( nearbyTrack != null ) { matchedWaypoints.add( nearbyTrack.endPoint ); @@ -785,6 +803,14 @@ public class RoutingEngine extends Thread throw new IllegalArgumentException( "early exit for a close recalc" ); } + if ( nodeLimit > 0 ) // check node-limit for target island search + { + if ( --nodeLimit == 0 ) + { + return null; + } + } + nodesVisited++; linksProcessed++; diff --git a/brouter-mapaccess/src/main/java/btools/mapaccess/OsmNode.java b/brouter-mapaccess/src/main/java/btools/mapaccess/OsmNode.java index 04bc83e..3a0b982 100644 --- a/brouter-mapaccess/src/main/java/btools/mapaccess/OsmNode.java +++ b/brouter-mapaccess/src/main/java/btools/mapaccess/OsmNode.java @@ -238,10 +238,7 @@ public class OsmNode implements OsmPos } } - if ( dc == null ) - { - hollowNodes.remove( this ); - } + hollowNodes.remove( this ); } public void parseNodeBody1( MicroCache1 is, OsmNodesMap hollowNodes, DistanceChecker dc )