Ways become autoconnected only if they have the same role.

WanMil
Index: src/uk/me/parabola/mkgmap/reader/osm/MultiPolygonRelation.java
===================================================================
--- src/uk/me/parabola/mkgmap/reader/osm/MultiPolygonRelation.java      
(revision 1954)
+++ src/uk/me/parabola/mkgmap/reader/osm/MultiPolygonRelation.java      
(working copy)
@@ -409,7 +409,7 @@
                        }
                }
                // try to connect ways lying outside or on the bbox
-               if (unclosed.size() >= 2) {
+               if (unclosed.isEmpty()== false) {
                        log.debug("Checking",unclosed.size(),"unclosed ways for 
connections outside the bbox");
                        Map<Coord, JoinedWay> outOfBboxPoints = new 
HashMap<Coord, JoinedWay>();
                        
@@ -443,6 +443,16 @@
                                        cd.w1 = outOfBboxPoints.get(cd.c1);     
                                
                                        cd.w2 = outOfBboxPoints.get(cd.c2);     
                                
                                        
+                                       // do not connect ways with different 
role
+                                       if (cd.w1 != cd.w2) {
+                                               String role1 = getRole(cd.w1);
+                                               String role2 = getRole(cd.w2);
+                                               if (role1 != null && 
role1.equals(role2)==false) {
+                                                       log.debug("Do not 
connect way",cd.w1,"with",cd.w2,". The roles are different:",role1,"!=",role2);
+                                                       continue;
+                                               }
+                                       }
+                                       
                                        if (lineCutsBbox(cd.c1, cd.c2 )) {
                                                // Check if the way can be 
closed with one additional point
                                                // outside the bounding box.
@@ -493,6 +503,7 @@
                                        if (minCon.imC != null)
                                                
minCon.w1.getPoints().add(minCon.imC);
                                        minCon.w1.closeWayArtificially();
+                                       return true;
                                } else {
                                        log.debug("Connect", minCon.w1, "with", 
minCon.w2);
 
_______________________________________________
mkgmap-dev mailing list
[email protected]
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

Reply via email to