public boolean isLeavingCurrentStreet ( String prevName , String name ) { if ( InstructionsHelper . isNameSimilar ( name , prevName ) ) { return false ; } // If flags are changing, there might be a chance we find these flags on a different edge boolean checkFlag = currentEdge . getFlags ( ) != prevEdge . getFlags ( ) ; for ( EdgeIteratorState edge : allowedOutgoingEdges ) { String edgeName = edge . getName ( ) ; IntsRef edgeFlag = edge . getFlags ( ) ; // leave the current street || enter a different street if ( isTheSameStreet ( prevName , prevEdge . getFlags ( ) , edgeName , edgeFlag , checkFlag ) || isTheSameStreet ( name , currentEdge . getFlags ( ) , edgeName , edgeFlag , checkFlag ) ) { return true ; } } return false ; }
If the name and prevName changes this method checks if either the current street is continued on a different edge or if the edge we are turning onto is continued on a different edge . If either of these properties is true we can be quite certain that a turn instruction should be provided .