logo separator

[mkgmap-dev] MultiPolygon code optimisation

From Ticker Berkin rwb-mkgmap at jagit.co.uk on Wed Aug 15 13:59:55 BST 2018

Hi Gerd

A while ago, when I was trying to understand the multi-polygon code,
one of the first things to strike me was that it seems to make things
more complicated that they should be by not keeping the inner and outer
ways parts separate during the initial processing in
MultiPolygonRelation done by getSourceWays() and joinWays().

Instead, could have two instances (inner & outer) of a class that code
like getSourceWays() can add() a way to, after choosing the correct
class based on role/r_e.getKey().

The class holds unclosedWays, closedWays and the add() method will:
1/ test if already closed and add to closedWays & return
2/ test if either end joins to one or two elements in unclosedWays. if
so, join in appropriate direction, remove second unclosedWay if joined
both ends to different unclosedWays. if now closed, remove from
unclosedWays and add to closedWays & return
3/ add to unclosedWays

Another method to call at end to flag error for each unclosedWay

Now the logic can proceed with working out which outers contain inners
and start cutting...

Feel free to ignore all of this.

Regards
Ticker



More information about the mkgmap-dev mailing list