The multipolygon processing makes heavy use of the java.awt.Area class. Calling

List<Area> allAreas = .....;
List<Area> toRemoveAreas = .....;
allAreas.removeAll(toRemoveAreas);

sometimes does not remove the areas in toRemoveAreas but some more. The patch does not longer use removeAll but checks for identity before removing an area. (I hope I found all places...)

As a result sometimes some inner polygons were not cut out from the outer polygon.

WanMil
Index: src/uk/me/parabola/mkgmap/reader/osm/MultiPolygonRelation.java
===================================================================
--- src/uk/me/parabola/mkgmap/reader/osm/MultiPolygonRelation.java	(revision 1904)
+++ src/uk/me/parabola/mkgmap/reader/osm/MultiPolygonRelation.java	(working copy)
@@ -1159,7 +1159,18 @@
 			
 			// the inner areas of the cut point have been processed
 			// they are no longer needed
-			areaCutData.innerAreas.removeAll(cutPoint.getAreas());
+			for (Area cutArea : cutPoint.getAreas()) {
+				ListIterator<Area> areaIter = areaCutData.innerAreas.listIterator();
+				while (areaIter.hasNext()) {
+					Area a = areaIter.next();
+					if (a == cutArea) {
+						areaIter.remove();
+						break;
+					}
+				}
+			}
+			// remove all does not seem to work. It removes more than the identical areas.
+//			areaCutData.innerAreas.removeAll(cutPoint.getAreas());
 
 			if (areaCutData.outerArea.isSingular()) {
 				// the area is singular
_______________________________________________
mkgmap-dev mailing list
[email protected]
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

Reply via email to