Hi Marko,

Here's another cut at a fix for the warning you were getting. If you
have time, please try this patch without the other patch I posted
earlier today (the one that got rid of the warning by allowing the
merge to be done).

If successful, I intend to commit both this patch and the one that does
the merge because they are both useful.

Mark

diff --git a/src/uk/me/parabola/mkgmap/reader/osm/Way.java b/src/uk/me/parabola/mkgmap/reader/osm/Way.java
index a8812bf..5fb2ee8 100644
--- a/src/uk/me/parabola/mkgmap/reader/osm/Way.java
+++ b/src/uk/me/parabola/mkgmap/reader/osm/Way.java
@@ -89,6 +89,11 @@ public class Way extends Element {
 		points.add(co);
 	}
 
+	public void addPointIfNotEqualToLastPoint(Coord co) {
+		if(points.size() == 0 || !co.equals(points.get(points.size() - 1)))
+			points.add(co);
+	}
+
 	public void reverse() {
 		int numPoints = points.size();
 		for(int i = 0; i < numPoints/2; ++i) {
diff --git a/src/uk/me/parabola/mkgmap/reader/osm/xml/Osm5XmlHandler.java b/src/uk/me/parabola/mkgmap/reader/osm/xml/Osm5XmlHandler.java
index 67e8a28..ef90a1d 100644
--- a/src/uk/me/parabola/mkgmap/reader/osm/xml/Osm5XmlHandler.java
+++ b/src/uk/me/parabola/mkgmap/reader/osm/xml/Osm5XmlHandler.java
@@ -1342,7 +1342,7 @@ class Osm5XmlHandler extends DefaultHandler {
 					hNext = getEdgeHit(seaBounds, segment.getPoints().get(segment.getPoints().size()-1));
 				}
 				else {
-					w.addPoint(hit.getPoint(seaBounds));
+					w.addPointIfNotEqualToLastPoint(hit.getPoint(seaBounds));
 					hNext = hits.higher(hit);
 					if (hNext == null)
 						hNext = hFirst;
@@ -1354,7 +1354,7 @@ class Osm5XmlHandler extends DefaultHandler {
 							EdgeHit corner = new EdgeHit(i, 1.0);
 							p = corner.getPoint(seaBounds);
 							log.debug("way: ", corner, p);
-							w.addPoint(p);
+							w.addPointIfNotEqualToLastPoint(p);
 						}
 					}
 					else if (hit.compareTo(hNext) > 0) {
@@ -1363,16 +1363,16 @@ class Osm5XmlHandler extends DefaultHandler {
 							EdgeHit corner = new EdgeHit(i, 1.0);
 							p = corner.getPoint(seaBounds);
 							log.debug("way: ", corner, p);
-							w.addPoint(p);
+							w.addPointIfNotEqualToLastPoint(p);
 						}
 						for (int i=0; i<hNext.edge; i++) {
 							EdgeHit corner = new EdgeHit(i, 1.0);
 							p = corner.getPoint(seaBounds);
 							log.debug("way: ", corner, p);
-							w.addPoint(p);
+							w.addPointIfNotEqualToLastPoint(p);
 						}
 					}
-					w.addPoint(hNext.getPoint(seaBounds));
+					w.addPointIfNotEqualToLastPoint(hNext.getPoint(seaBounds));
 				}
 				hits.remove(hit);
 				hit = hNext;
_______________________________________________
mkgmap-dev mailing list
[email protected]
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

Reply via email to