Changeset 4447 in josm for trunk/src/org/openstreetmap


Ignore:
Timestamp:
2011-09-18T21:07:26+02:00 (13 years ago)
Author:
simon04
Message:

fix #6799 - MultipolygonTest: wrong objects in unclosed relation

Location:
trunk/src/org/openstreetmap/josm/data/validation/tests
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/validation/tests/MultipolygonTest.java

    r4368 r4447  
    99import java.util.Collection;
    1010import java.util.Collections;
     11import java.util.LinkedList;
    1112import java.util.List;
    1213
     
    225226            }
    226227
     228            List<Node> openNodes = new LinkedList<Node>();
    227229            for (List<Node> w : nonClosedWays) {
    228                 errors.add(new TestError(this, Severity.WARNING, tr("Multipolygon is not closed"), NON_CLOSED_WAY,
    229                         w, Arrays.asList(w.get(0), w.get(w.size() - 1))));
     230                openNodes.add(w.get(0));
     231                openNodes.add(w.get(w.size() - 1));
     232            }
     233            if (!openNodes.isEmpty()) {
     234                List<OsmPrimitive> primitives = new LinkedList<OsmPrimitive>();
     235                primitives.add(r);
     236                primitives.addAll(openNodes);
     237                Arrays.asList(openNodes, r);
     238                errors.add(new TestError(this, Severity.WARNING, tr("Multipolygon is not closed"), NON_CLOSED_WAY,
     239                        primitives, openNodes));
    230240            }
    231241
  • trunk/src/org/openstreetmap/josm/data/validation/tests/UnclosedWays.java

    r4294 r4447  
    66
    77import java.text.MessageFormat;
    8 import java.util.ArrayList;
    9 import java.util.List;
     8import java.util.Arrays;
    109
    11 import org.openstreetmap.josm.data.osm.Node;
    1210import org.openstreetmap.josm.data.osm.OsmPrimitive;
    1311import org.openstreetmap.josm.data.osm.OsmUtils;
     
    114112                    return;
    115113            }
    116             Node f = w.firstNode();
    117             Node l = w.lastNode();
    118 
    119             List<OsmPrimitive> primitives = new ArrayList<OsmPrimitive>();
    120             List<OsmPrimitive> highlight = new ArrayList<OsmPrimitive>();
    121             primitives.add(w);
    122 
    123             // The important parts of an unclosed way are the first and
    124             // the last node which should be connected, therefore we highlight them
    125             highlight.add(f);
    126             highlight.add(l);
    127114
    128115            errors.add(new TestError(this, Severity.WARNING, tr("Unclosed way"),
    129                             type, etype, mode, primitives, highlight));
     116                    type, etype, mode,
     117                    Arrays.asList(w),
     118                    // The important parts of an unclosed way are the first and
     119                    // the last node which should be connected, therefore we highlight them
     120                    Arrays.asList(w.firstNode(), w.lastNode())));
    130121        }
    131122    }
Note: See TracChangeset for help on using the changeset viewer.