logo separator

[mkgmap-dev] Commit: r1367: Rewrite pickArea() to avoid a problem with unequally sized areas.

From svn commit svn at mkgmap.org.uk on Wed Nov 11 11:21:31 GMT 2009

Version 1367 was commited by markb on 2009-11-11 11:21:31 +0000 (Wed, 11 Nov 2009) 

Rewrite pickArea() to avoid a problem with unequally sized areas.

The original pickArea() assumed that all the areas to choose from had
the same widths and the same heights. Unfortunately, that is not true and
so it was occasionally putting elements in the wrong area.

This new version simply iterates through the areas testing to see if the
element is contained within one. It may be slower for large numbers of
areas but at least it should get the answer right. Mind you, I don't think
the number of areas is ever that large because the subdivision process
just divides areas by something small like 2 or 4. So probably not really
slower at all.

Also, it now throws away elements that are outside of the whole area and
emits an error message.


More information about the mkgmap-dev mailing list