logo separator

[mkgmap-dev] [mp: PATCH] Multipolygons: inner and nested polygons supported now

From WanMil wmgcnfg at web.de on Sat Jan 2 11:36:03 GMT 2010

Am 02.01.2010 12:17, schrieb Felix Hartmann:
> Ups, there must be some bug, or the code is very inefficient.
>
> Austria compiled fine, but when I compiled Italy using this patch versus
> standard trunk. Usually the 16 tiles of italy compile in 8 minutes. Now
> it has compiled 6 tiles in 20 minutes only. However while 5 tiles
> compiled in normal speed, 1 took 10 minutes and currently it is stuck again.
> It seems to get stuck on single tiles and max-jobs is then not
> continuing until the file it is stuck on finishes (only one instead of 2
> cpu cores used for a long time).
>
> The one tile it took 10 minutes instead of 1 minute to compile, was also
> the only one with quite substantial size increase (5.07 to 5.20 MB).
>
> I'll break the rendering now and delete the following line from my
> relations file, maybe this is causing it to go slow?
> landuse=forest                         { apply { add landuse=forest; add
> name = '${name}'; add ref = '${ref}'    } }
> _______________________________________________
> mkgmap-dev mailing list
> mkgmap-dev at lists.mkgmap.org.uk
> http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
>

The code is not optimized (and not well tested...) yet.
I expect two possible problems:
* an endless loop?
* the bugfixed findCpa method is much more complex

findCpa now checks if the line that is created between the outer and the 
inner polygon intersects the outer polygon. I am using a very rough (and 
probably very unoptimized) solution. And it will get worse because the 
current implementation is not complete.
The if statement in line 698
if (intersects(l1,
                l1.get(newDistance.index1),
                l2.get(newDistance.index2)) == false) {

must be replaced with

if (intersects(l1,
                l1.get(newDistance.index1),
                l2.get(newDistance.index2)) == false
  && intersects(l2,
                l1.get(newDistance.index1),
                l2.get(newDistance.index2)) == false) {

You could try to increase the maxEntries variable in findCpa. The 
current value 500000 seems to be too low. Set it much higher might 
reduce the number of intersects calls. But this also depends on the 
geometry of the polygons.

WanMil



More information about the mkgmap-dev mailing list