logo separator

[mkgmap-dev] New code for splitting polygon

From Ticker Berkin rwb-mkgmap at jagit.co.uk on Thu Jan 12 13:24:37 GMT 2017

Hi Gerd

[responses to both posts]

I also got very slightly different results (ie different final img file
sizes) with the patch. I think this is due to 2 factors:

1/ Changes in some of the very small areas that are generated - these
can effect ShapeMergeFilter and, if not merged, will probably be
chucked.

2/ Behaviour making Coords that are highPrecEqual the same object -
again effecting ShapeMergeFilter. 

The order of Coords in shapes will also have changed. 

To reduce the number of small shapes, I added a little bit of logic to
allow shapes to extend slightly outside their correct subDivision, but
only by a few mapUnits - These shouldn't disrupt the concept of order
-by-decreasing area.
 
Common Coord mapping should give the same results unless a shape has a
highPrecEqual but not same object coord within itself.

The old logic make a local hash of all the points before splitting,
then looked up every point of the output shapes in the local shape
pool. If not there it tried the global pool and added to this. The idea
being that if a shape had been cut earlier (by MultiPolygon processing
or Polygon*SplitterFilter), the new coord wouldn't inhibit ShapeMerge.

The new logic doesn't change existing Coords in a shape, so only needs
to deal with ones created by the cut, so uses the global pool. What do
you mean when you say you see points "moving"? Utils.coord2Long() looks
correct for highPrecision.

Regarding unconnected holes - The old (Java2DConverter) and new code
only deal with single path polygons - no way to express an unconnected
hole. However the new code can handle cutting across a cut to a
connected hole. I think you comment on this in
ShapeMergeFilter:addWithConnectedHoles 

Ticker


On Thu, 2017-01-12 at 11:24 +0000, Gerd Petermann wrote:
> Hi Ticker,
> 
> please check:
> I think the areasHashMap should be a field in splitIntoAreas() and it
> should be empty for each shape.
> Without this change I see points "moving" when comparing the origial
> and the split shapes.
> 
> Gerd
> 
> ________________________________________
> Von: mkgmap-dev <mkgmap-dev-bounces at lists.mkgmap.org.uk> im Auftrag
> von Gerd Petermann <GPetermann_muenchen at hotmail.com>
> Gesendet: Donnerstag, 12. Januar 2017 10:30:50
> An: Development list for mkgmap
> Betreff: Re: [mkgmap-dev] New code for splitting polygon
> 
> Hi Ticker,
> 
> will have a closer look today.  I found some cases where the patched
> version produces different results,
> not yet sure which is better. I did not find a test case with an
> unconnected hole. Is the algo prepared for that, too?
> 
> Gerd
> 
> 
> ________________________________________
> Von: mkgmap-dev <mkgmap-dev-bounces at lists.mkgmap.org.uk> im Auftrag
> von Ticker Berkin <rwb-mkgmap at jagit.co.uk>
> Gesendet: Mittwoch, 11. Januar 2017 12:07:55
> An: mkgmap-dev at lists.mkgmap.org.uk
> Betreff: Re: [mkgmap-dev] New code for splitting polygon
> 
> Hi Gerd
> 
> Here is a unit test for polygon splitting. To go in
> {trunk}/test/uk/me/parabola/util/ShapeSplitterTest.java
> 
> Regards
> Ticker
> 
> On Sun, 2017-01-08 at 10:30 +0000, Gerd Petermann wrote:
> > Hi Ticker,
> > 
> > I think you can take the tests in uk.me.parabola.util  in
> > mkgmap/test
> > as an example.
> > And sorry, I should already have coded one for
> > clipSinglePathWithSutherlandHodgman().
> > 
> > Gerd
> > 
> > 
> > ________________________________________
> > Von: mkgmap-dev <mkgmap-dev-bounces at lists.mkgmap.org.uk> im Auftrag
> > von Ticker Berkin <rwb-mkgmap at jagit.co.uk>
> > Gesendet: Sonntag, 8. Januar 2017 11:20:19
> > An: mkgmap-dev at lists.mkgmap.org.uk
> > Betreff: Re: [mkgmap-dev] New code for splitting polygon
> > 
> > Hi Gerd
> > 
> > Will do. Can you point me to an example of the preferred style for
> > a
> > unit test.
> > 
> > Thanks
> > Ticker
> > 
> > On Sat, 2017-01-07 at 18:14 +0000, Gerd Petermann wrote:
> > > Hi Ticker,
> > > 
> > > sounds great. Please can you add some unit tests to show what it
> > > does
> > > with holes, points on the split line
> > > and one or more line segments  on the split line?
> > > 
> > > Gerd
> > > ________________________________________
> > > Von: mkgmap-dev <mkgmap-dev-bounces at lists.mkgmap.org.uk> im
> > > Auftrag
> > > von Ticker Berkin <rwb-mkgmap at jagit.co.uk>
> > > Gesendet: Samstag, 7. Januar 2017 18:36:31
> > > An: mkgmap development
> > > Betreff: [mkgmap-dev] New code for splitting polygon
> > > 
> > > Hi Gerd
> > > 
> > > I've written some new code for splitting polygons in an efficient
> > > manner. The main interface takes a shape and line of latitude or
> > > longitude and returns 2 lists of shapes on either side of the
> > > line.
> > > There is also a function to clip to rectangle.
> > > 
> > > I've put the code in util/ShapeSplitter but it could go elsewhere
> > > if
> > > you prefer.
> > > 
> > > So far I've only converted build/MapArea to use it, but I think
> > > it
> > > can
> > > be used throughout eventually. For the moment I've commented out
> > > the
> > > old code in MapArea, but this can be deleted in a while.
> > > 
> > > Regards
> > > Ticker
> > > _______________________________________________
> > > mkgmap-dev mailing list
> > > mkgmap-dev at lists.mkgmap.org.uk
> > > http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
> > _______________________________________________
> > mkgmap-dev mailing list
> > mkgmap-dev at lists.mkgmap.org.uk
> > http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
> > _______________________________________________
> > mkgmap-dev mailing list
> > mkgmap-dev at lists.mkgmap.org.uk
> > http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
> _______________________________________________
> mkgmap-dev mailing list
> mkgmap-dev at lists.mkgmap.org.uk
> http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
> _______________________________________________
> mkgmap-dev mailing list
> mkgmap-dev at lists.mkgmap.org.uk
> http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev


More information about the mkgmap-dev mailing list