logo separator

[mkgmap-dev] Enhance PartFilter.java to return last parts of a value list

From Enrico Liboni eliboni at gmail.com on Wed Aug 7 00:06:15 BST 2013

It might be useful to be able to get the last part of a value list but the
current implementation of PartFilter does not allow this, i.e. you can get
the 1st, 2nd, 3rd and so on but you can't get the last, the one before the
last and so on.

The change is trivial,  in doFilter replace:

        if (temp.length >= partnumber)
            return temp[partnumber-1].trim();
        if (temp.length >= Math.abs(partnumber) ) {
            if (partnumber > 0) {
                return temp[partnumber-1].trim();
            } else {
                return temp[temp.length+partnumber].trim();

attached the new class which I compiled, plugged in r2661 and works as

This could be useful for example, emh...,  when adding a rule like:

highway=* { set street:name='${name|part: :-1}, ${name}'}
street:name=* {set name='${street:name}'}

so that the most meaningful part of a street name in some countries appears
at the beginning of the name thus facilitating the address search ;)

Let me know if you believe this is useful and if you prefer a patch.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.mkgmap.org.uk/pipermail/mkgmap-dev/attachments/20130807/4f0744f6/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PartFilter.java
Type: application/octet-stream
Size: 1951 bytes
Desc: not available
Url : http://lists.mkgmap.org.uk/pipermail/mkgmap-dev/attachments/20130807/4f0744f6/attachment.obj 

More information about the mkgmap-dev mailing list