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();
with:
        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
expected.

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.

Enrico

Attachment: PartFilter.java
Description: Binary data

_______________________________________________
mkgmap-dev mailing list
[email protected]
http://lists.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

Reply via email to