Ticket #5706: 5706.ignore-spaces.patch

File 5706.ignore-spaces.patch, 3.9 KB (added by simon04, 10 years ago)

same as attachment:5706.patch, but ignoring whitespace for easier reviewing

  • data/defaultpresets.xml

    diff --git a/data/defaultpresets.xml b/data/defaultpresets.xml
    index db9d63a..51ad2fc 100755
    a b check: checkbox 
    7878  value_off: the value to set when unchecked (default is 'no')
    7979
    8080role: type to specify possible roles in relations
    81   key: the role name used in relation
     81  key: comma separated list of role names used in relation
    8282  text: fixed label to display
    8383  requisite: "optional" or "required" (default is optional)
    8484  count: how often can the role occur (if not given unlimited number is assumed)
    are supplied, then "values" will be treated as "display_values" and translated i 
    41604160            </optional>
    41614161            <roles>
    41624162                <role key="" text="route segment" requisite="optional" type="way" />
    4163                 <role key="forward" text="forward segment" requisite="optional" type="way" />
    4164                 <role key="backward" text="backward segment" requisite="optional" type="way" />
     4163                <role key="forward,backward" text="forward/backward segment" requisite="optional" type="way" />
    41654164                <role key="stop" text="halt point" requisite="optional" type="node" />
    4166                 <role key="forward_stop" text="forward halt point" requisite="optional" type="node" />
    4167                 <role key="backward_stop" text="backward halt point" requisite="optional" type="node" />
     4165                <role key="forward_stop,backward_stop" text="forward/backward_stop halt point" requisite="optional" type="node" />
     4166                <role key="north,south,east,west" text="(for North America)" requisite="optional" type="way" />
    41684167            </roles>
    41694168        </item>
    41704169        <item name="Route network" icon="presets/path.png" type="relation">
  • src/org/openstreetmap/josm/data/validation/tests/RelationChecker.java

    diff --git a/src/org/openstreetmap/josm/data/validation/tests/RelationChecker.java b/src/org/openstreetmap/josm/data/validation/tests/RelationChecker.java
    index 7279e34..a7fc790 100644
    a b public class RelationChecker extends Test { 
    109109                RoleInfo ri = map.get(s);
    110110                if (ri == null) {
    111111                    ri = new RoleInfo();
     112                    map.put(s, ri);
    112113                }
    113114                ri.total++;
    114115                if (m.isRelation()) {
    public class RelationChecker extends Test { 
    124125                else if (m.isNode()) {
    125126                    ri.nodes++;
    126127                }
    127                 map.put(s, ri);
    128128            }
    129129            if(map.isEmpty()) {
    130130                errors.add( new TestError(this, Severity.ERROR, tr("Relation is empty"),
    public class RelationChecker extends Test { 
    132132            } else {
    133133                LinkedList<String> done = new LinkedList<String>();
    134134                for (TaggingPreset.Role r : allroles) {
    135                     done.add(r.key);
    136                     String keyname = r.key;
     135                    for (String keyname : r.key.split(",")) {
     136                        keyname = keyname.trim();
     137                        done.add(keyname);
     138                        RoleInfo ri = map.get(keyname);
    137139                    if ("".equals(keyname)) {
    138140                        keyname = tr("<empty>");
    139141                    }
    140                     RoleInfo ri = map.get(r.key);
    141142                    long count = (ri == null) ? 0 : ri.total;
    142143                    long vc = r.getValidCount(count);
    143144                    if (count != vc) {
    public class RelationChecker extends Test { 
    164165                                tr(s, keyname), MessageFormat.format(s, keyname), WRONG_TYPE, n) );
    165166                    }
    166167                }
     168                }
    167169                for (String key : map.keySet()) {
    168170                    if (!done.contains(key)) {
    169171                        if (key.length() > 0) {