logo separator

[mkgmap-dev] refactoring

From Gerd Petermann gpetermann_muenchen at hotmail.com on Mon Apr 21 10:29:02 BST 2014

Hi all,

please test / review the changes in the branch.

Users: You should find no differences in map output between trunk r3215 and branch r3214,
but maybe the log is different.

Programmers: please have a closer look at the source.

The intended changes :
1) Create new class AccessTagsAndBits which contains code 
to map tags which are relevant for routing to bit masks.

I prefer to have  to bit 1 for "access allowed" to avoid
double negations like in "if (!noAccess[i]) ..."
I hope that is okay for you as well.

All routines which read data are now using the same
bit constants regarding CAR,FOOT,BICYCLE,TRUCK, etc.
to fill a bit mask field.
The write routines convert the internal representatio to
that used in the img format.

@WanMil: 
Special case: Code in  StyledConverter near roadLog.isInfoEnabled()
formats the content of the TabAAcesss field in RoadDef which
contains the img format. I think this is okay because the intention
of the log is to show exactly the content of this field.

2) Create class ConvertedWay which combines an
OSM Way instance with a reference to a GType instance.
Instead of copying and modifying fields (roadClass, roadSpeed) 
in GType instances this is now done in ConvertedWay. 
Many tags which are relevant for routing are evaluated once
when the ConvertedWay instance is created.
The results are kept in bit masks, this allows a quick
compare.
Also, RoadMerger uses this class instead of creating new 
Road instances.

@WanMil: The new code produces a different log on debug
level because some comparisons are done in different order.
I've changed the code to compare the bit mask fields instead of the
tags, but the code still lists (most of) the compared tags 
to be able to produce debug info. 
Let me know if that is okay for you. Another solution could be to
implement the debugging in ConvertedWay e.g. something
like 
public String compareAccess(ConvertedWay other)
could return a String like 
"mkgmap:truck is different 'no' <> 'null' "

3)
With r3214 I've renamed a few methods. Please check if 
you find better names:
http://www.mkgmap.org.uk/websvn/revision.php?repname=mkgmap&rev=3214


 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.mkgmap.org.uk/pipermail/mkgmap-dev/attachments/20140421/36644cd0/attachment-0001.html>


More information about the mkgmap-dev mailing list