logo separator

[mkgmap-dev] custom background polygon in overview map

From Kolesár András mkgmap at kolesar.hu on Sun Mar 6 12:02:39 GMT 2011


I have noticed that mkgmap creates rectangles in overview map even if maps contain regions with irregular shapes. These are defined as 0x4b background polygons in .mp files. Background polygons were compiled correctly into individual (numbered) .img files, but 0x4a definition areas in overview map did not follow background shapes.

I have checked documentation for a setting that enables custom overview shapes, not found. Then I have examined source code, found the algorithm in TdbBuilder.addToOverviewMap() method that creates simple rectangles for overview map. FileInfo reads map bounds from .img file and this gives the rectangle. FileInfo can't read background shape from .img file. I had to find a way for transferring background polygons from MapMaker to TdbBuilder.

Modified several (7) files for handling custom background shapes:

general/MapDetails.java stores background polygon in a new class variable MapShape background
reader/MapperBasedMapDataSource.java returns mapper.getBackground()
general/LoadableMapDataSource.java abstract method getBackground(), implemented in MapperBasedMapDataSource
main/Main.java holds background shapes for each .img files in HashArray backgrounds
main/MapMaker.java fills array Main.backgrounds after finishing file
combiners/TdbBuilder.java adds custom background shape to overview map if available
reader/overview/OverviewMapDataSource.java assigns more detailed levels for overview map

Attached patch file, paths now start with src/ as WanMil asked last time. Patch based on r1846, compiles without errors, works for .mp files. I did not test it for OSM data.

András Kolesár
-------------- next part --------------
A non-text attachment was scrubbed...
Name: background.patch
Type: text/x-patch
Size: 7241 bytes
Desc: not available
Url : http://lists.mkgmap.org.uk/pipermail/mkgmap-dev/attachments/20110306/f8186a11/attachment.bin 

More information about the mkgmap-dev mailing list