[PATCH v1] preserve edges introduced by clipping and splitting

This patch stops the DP filter from discarding points at either end of a horizontal or vertical line segment (such segments are created by the clipper and also by the polygon splitter and, of course, could occur naturally in the OSM data but I'd guess they are relatively rare). The benefit is that polygons lose those ugly artifacts (e.g. weird thin triangles) that sometimes occur at tile boundaries or where they have been split (when zooming out in mapsource). For me, mapsource still displays the odd spurious horizontal or vertical line but as it goes away when the screen is scrolled, I am assuming it is a mapsource bug rather than ours. Please try it out and report. Mark

Hi Mark, I have not tested this patch. I expect it to work, but I think it is a suboptimal solution. You set the preserve bit on all lines which are exactly horizontal or vertical. Wouldn't it be cleaner way, to set the preserved bit at the place, where the new nodes are generated, i.e. in the clipping code? This bit may be set in the multipolygon code too at the newly introduced cuts. (which are not vertical btw.) This may be a little more work, but a clean design will always pay out. Regards, Johann Mark Burton schrieb:
This patch stops the DP filter from discarding points at either end of a horizontal or vertical line segment (such segments are created by the clipper and also by the polygon splitter and, of course, could occur naturally in the OSM data but I'd guess they are relatively rare).
The benefit is that polygons lose those ugly artifacts (e.g. weird thin triangles) that sometimes occur at tile boundaries or where they have been split (when zooming out in mapsource).
For me, mapsource still displays the odd spurious horizontal or vertical line but as it goes away when the screen is scrolled, I am assuming it is a mapsource bug rather than ours.
Please try it out and report.
Mark
------------------------------------------------------------------------
_______________________________________________ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

Hello Johann,
I have not tested this patch. I expect it to work, but I think it is a suboptimal solution.
I make no claims that it is optimal. Merely, that it's "cheap and cheerful". It achieves the desired aim with very little computational overhead.
You set the preserve bit on all lines which are exactly horizontal or vertical. Wouldn't it be cleaner way, to set the preserved bit at the place, where the new nodes are generated, i.e. in the clipping code?
Yes, that can be done when clipping and my first attempt at writing this patch did exactly that. Unfortunately, that doesn't work for split polygons because in the splitter, you don't know which points are on the boundary and which are not (although that probably could be determined at some cost).
This bit may be set in the multipolygon code too at the newly introduced cuts. (which are not vertical btw.)
I believe they are vertical/horizontal in the new MP code but that's irrelevant anyway as the preserve bit could easily be set on the points by the MP engine.
This may be a little more work, but a clean design will always pay out.
Cleanliness is in the eye of the beholder. Mark
participants (2)
-
Johann Gail
-
Mark Burton