
Some notes: I don't understand why you calculate the distance between a point and a segment and not between two points? In the sea generator, the outer polygon is a big bbox. If I connect the points all inner shapes are connected to the corners of the bbox (if I don't care about visibility). My idea is that if I create the connection with the shortest line it is impossible that another shape is crossed.
Yes, that should work - good.
WanMil wrote
Of course you can create your own distance calculation without the spherical part. It is required in the Quadtree because it checks if the checked point is more far away than a given gap. Another reason is that one Garmin map unit does not have a constant length. Was that your problem with Line2D.ptSegDistSq()?
I really don't know. I find completely different nodes for the connections when I use the simple calculation. I'll sleep again about this ;-)
WanMil wrote
Your cut procedure still requires that all parts of mkgmap that use the resulting ways do not use the java.awt.geom.Area class. So another hard second part of the implementation is to find an adequate replacement for this.
Yes, I have to find a way to split the resulting polygon into parts with less than 250 nodes. I don't yet have a good idea how to do this.
I think it is not a good idea to focus on the 250 nodes limit. This creates an implicit rule about the further processing after the multipolygon has been calculated. And that will fail at some time in future. (e.g. the java Area object is also used in the AreaClipper) Without changing the splitting with the java Area object you might also change the cutting procedure a little bit. Instead of completely surrounding the inner polygons you might create singular polygons without holes by partly surrounding the inner polygons. The algorithm should not too complex if you have the information about the shortest distances. I have implemented a similar algorithm a long time ago when I tried a similar approach. But I abandoned because the calculations of the shortest distances took much too long (I used a visibility graph calculated by an external library). This change makes it possible to keep the java Area calculations until we find a good replacement. WanMil
Ciao, Gerd