Sorry - excess stuff in patch, correct one now.

Ticker

On Tue, 2021-05-25 at 17:46 +0100, Ticker Berkin wrote:
> Hi Gerd
> 
> Patch attached that I hope fixes the splitting problem.
> 
> I haven't looked at your change yet, but your split-failed.osm test
> had, and needed, lots of points visited twice and I don't see how
> this
> can, or should, be avoided.
> 
> Ticker
> 
> On Tue, 2021-05-25 at 15:56 +0000, Gerd Petermann wrote:
> > Hi Ticker,
> > 
> > with the attached patch ShapeMerger avoids to produce shapes where
> > more than the start point is visited twice.
> > This produces much larger img files (even larger than trunk) but
> > PolygonSplitter doesn't complain.
> > 
> > I have to find out what GpsMapEdit means with "has a jitter". Maybe
> > only those are problematic.
> > 
> > Gerd
> > 
> > 
> > ________________________________________
> > Von: mkgmap-dev <mkgmap-dev-boun...@lists.mkgmap.org.uk> im Auftrag
> > von Ticker Berkin <rwb-mkg...@jagit.co.uk>
> > Gesendet: Dienstag, 25. Mai 2021 14:00
> > An: Development list for mkgmap
> > Betreff: Re: [mkgmap-dev] special case where splitting fails
> > without
> > a log message
> > 
> > Sorry - sea.zip!
> > 
> > On Tue, 2021-05-25 at 12:36 +0100, Ticker Berkin wrote:
> > > Hi Gerd
> > > 
> > > I'm getting very confused by this. When I build with my trunk
> > > (some
> > > filter order changes + a few others), I see a whole lot more that
> > > JOSM
> > > shows. It and your 6324001.img just show a central bit. Looking
> > > with
> > > GPSMapEdit with "Highlight Polygon Contours". I also see areas
> > > where
> > > all islands are inverted.
> > > 
> > > I'll undo my trunk changes and look again.
> > > 
> > > Does JOSM have self-intersection checking?
> > > 
> > > Was the gpx trace hi-res (30bit) and then this kept when
> > > generating
> > > the
> > > osm. If not, then I'd expect problems.
> > > 
> > > Ticker
> > > 
> > > 
> > > On Tue, 2021-05-25 at 11:18 +0000, Gerd Petermann wrote:
> > > > Hi Ticker,
> > > > 
> > > > I didn't investigate the details. I've created the osm data by
> > > > converting a gpx back to osm. I guess in the original input
> > > > duplicate
> > > > points are identical. I found more such cases where parts are
> > > > removed.
> > > > 
> > > > Gerd
> > > > 
> > > > 
> > > > ________________________________________
> > > > Von: mkgmap-dev <mkgmap-dev-boun...@lists.mkgmap.org.uk> im
> > > > Auftrag
> > > > von Ticker Berkin <rwb-mkg...@jagit.co.uk>
> > > > Gesendet: Dienstag, 25. Mai 2021 12:51
> > > > An: Development list for mkgmap
> > > > Betreff: Re: [mkgmap-dev] special case where splitting fails
> > > > without
> > > > a log message
> > > > 
> > > > Hi Gerd
> > > > 
> > > > OK - I've reproduced this. Is split-failed.osm self
> > > > -intersecting?
> > > > I'm
> > > > not sure how to tell from Josm, but it looks like it isn't. I
> > > > get
> > > > the
> > > > messages from shapeSplitter because it thinks it is and then
> > > > the
> > > > result
> > > > is not good - as expected.
> > > > 
> > > > I'll investigate more.
> > > > 
> > > > Ticker
> > > > 
> > > > 
> > > > On Tue, 2021-05-25 at 10:04 +0000, Gerd Petermann wrote:
> > > > > Hi Ticker,
> > > > > 
> > > > > while looking at the problems with sea I found this case
> > > > > where
> > > > > ShapeSplitter removes a small part of an island from a self
> > > > > -intersecting polygon in res 24.
> > > > > Compiled with mkgmap from trunk, default style and no
> > > > > options.
> > > > > 
> > > > > Look at 67.6742611, 14.6783525
> > > > > 
> > > > > Found this with some check code that compares the area of the
> > > > > original polygon with that of sum of the parts.
> > > > > 
> > > > > Gerd
> > > > > _______________________________________________
> > > > > mkgmap-dev mailing list
> > > > > mkgmap-dev@lists.mkgmap.org.uk
> > > > > https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
> > > > _______________________________________________
> > > > mkgmap-dev mailing list
> > > > mkgmap-dev@lists.mkgmap.org.uk
> > > > https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
> > > > _______________________________________________
> > > > mkgmap-dev mailing list
> > > > mkgmap-dev@lists.mkgmap.org.uk
> > > > https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
> > > _______________________________________________
> > > mkgmap-dev mailing list
> > > mkgmap-dev@lists.mkgmap.org.uk
> > > https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
> > _______________________________________________
> > mkgmap-dev mailing list
> > mkgmap-dev@lists.mkgmap.org.uk
> > https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
> > _______________________________________________
> > mkgmap-dev mailing list
> > mkgmap-dev@lists.mkgmap.org.uk
> _______________________________________________
> mkgmap-dev mailing list
> mkgmap-dev@lists.mkgmap.org.uk
> https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Index: src/uk/me/parabola/util/ShapeSplitter.java
x===================================================================
--- src/uk/me/parabola/util/ShapeSplitter.java	(revision 4740)
+++ src/uk/me/parabola/util/ShapeSplitter.java	(working copy)
@@ -471,7 +471,9 @@
 				return cmp;
 			// case where when have same start & end
 			// return the shape as lower than the hole, to handle first
-			cmp = other.areaOrHole - this.areaOrHole;
+//			cmp = other.areaOrHole - this.areaOrHole;
+			// Above is not reliable, there might be an earlier shape. try doing larger area first
+			cmp = Long.compare(this.areaToLine * this.areaOrHole, other.areaToLine * other.areaOrHole);
 			if (cmp != 0)
 				return cmp;
 			log.warn("Lines hit divider at same points and have same area sign", "this:", this, "other:", other);
@@ -644,6 +646,9 @@
 			trailAlong = leadAlong;
 			trailRel = leadRel;
 		} // for leadCoord
+		if (log.isDebugEnabled()) {
+			log.debug("initSplit #points", coords.size(), "on", dividingLine, isLongitude, "Area", runningArea, "#newLess", newLess.size(), "#newMore", newMore.size());
+		}
 		processLineList(newLess, lessList, runningArea);
 		processLineList(newMore, moreList, runningArea);
 	} // splitShape
_______________________________________________
mkgmap-dev mailing list
mkgmap-dev@lists.mkgmap.org.uk
https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

Reply via email to