Ticket #5467: 5467.patch

File 5467.patch, 2.1 KB (added by simon04, 13 years ago)
  • src/org/openstreetmap/josm/data/validation/tests/MultipolygonTest.java

     
    55
    66import java.awt.geom.GeneralPath;
    77import java.util.ArrayList;
     8import java.util.Arrays;
    89import java.util.Collection;
    910import java.util.Collections;
    1011import java.util.List;
     
    2526import org.openstreetmap.josm.gui.mappaint.ElemStyle;
    2627import org.openstreetmap.josm.gui.mappaint.ElemStyles;
    2728import org.openstreetmap.josm.gui.mappaint.MapPaintStyles;
    28 import org.openstreetmap.josm.gui.mappaint.xml.AreaPrototype;
    2929
    3030public class MultipolygonTest extends Test {
    3131
     
    117117        if (styles != null && !w.isClosed()) {
    118118            for (ElemStyle s : styles.generateStyles(w, SCALE, null, false).a) {
    119119                if (s instanceof AreaElemStyle) {
    120                     errors.add( new TestError(this, Severity.WARNING, tr("Area style way is not closed"), NOT_CLOSED,  w));
     120                    List<Node> nodes = w.getNodes();
     121                    errors.add(new TestError(this, Severity.WARNING, tr("Area style way is not closed"), NOT_CLOSED,
     122                            Collections.singletonList(w), Arrays.asList(nodes.get(0), nodes.get(nodes.size() - 1))));
    121123                    break;
    122124                }
    123125            }
     
    215217                }
    216218            }
    217219
    218             if (!nonClosedWays.isEmpty()) {
    219                 errors.add(new TestError(this, Severity.WARNING, tr("Multipolygon is not closed"), NON_CLOSED_WAY,  Collections.singletonList(r), nonClosedWays));
     220            for (List<Node> w : nonClosedWays) {
     221                errors.add(new TestError(this, Severity.WARNING, tr("Multipolygon is not closed"), NON_CLOSED_WAY,
     222                        w, Arrays.asList(w.get(0), w.get(w.size() - 1))));
    220223            }
    221224
    222225            // For painting is used Polygon class which works with ints only. For validation we need more precision