Ticket #13307: improve_zoom_on_error.patch

File improve_zoom_on_error.patch, 1.5 KB (added by GerdP, 8 years ago)
  • src/org/openstreetmap/josm/data/validation/tests/MultipolygonTest.java

     
    338338        if (intersection == Intersection.CROSSING) {
    339339            PolyData pdOther = polygons.get(idx);
    340340            if (pdOther != null) {
     341                // tty to find out which nodes to highlight
     342                double bboxSize1 = pdOther.getBounds().getHeight() * pdOther.getBounds().getWidth();
     343                double bboxSize2 = pd.getBounds().getHeight() * pd.getBounds().getWidth();
     344                List<?> hilighted = null;
     345                if (bboxSize1 > 10 * bboxSize2)
     346                    hilighted = Arrays.asList(pd.getNodes());
     347                else if (bboxSize2 > 10 * bboxSize1)
     348                    hilighted = Arrays.asList(pdOther.getNodes());
     349                else
     350                    hilighted = Arrays.asList(pd.getNodes(), pdOther.getNodes());
     351
    341352                addError(r, new TestError(this, Severity.WARNING, tr("Intersection between multipolygon ways"),
    342                         CROSSING_WAYS, Collections.singletonList(r), Arrays.asList(pd.getNodes(), pdOther.getNodes())));
     353                        CROSSING_WAYS, Collections.singletonList(r), hilighted ));
    343354            }
    344355        }
    345356        return intersection;