Changeset 16048 in josm for trunk


Ignore:
Timestamp:
2020-03-06T10:37:17+01:00 (4 years ago)
Author:
GerdP
Message:

fix #18744: "Join Overlapping Areas" shows confusing dialogs when merging inner and outer ways of a multipolygon
Refuse to join ways when one is an outer way and at least one is an inner way of the same multipolygon relation

Location:
trunk
Files:
2 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/JoinAreasAction.java

    r15890 r16048  
    15341534            innerWays.retainAll(selectedWays);
    15351535
     1536            if (!innerWays.isEmpty() && selectedWays.contains(outerWay)) {
     1537                // see #18744
     1538                new Notification(tr("Cannot join inner and outer ways of a multipolygon"))
     1539                        .setIcon(JOptionPane.INFORMATION_MESSAGE)
     1540                        .show();
     1541                return null;
     1542            }
     1543
    15361544            if (processedOuterWays.contains(outerWay)) {
    15371545                new Notification(
  • trunk/test/unit/org/openstreetmap/josm/actions/JoinAreasActionTest.java

    r16006 r16048  
    146146
    147147    /**
     148     * Non-regression test for bug #18744.
     149     * @throws IOException if any I/O error occurs
     150     * @throws IllegalDataException if OSM parsing fails
     151     */
     152    @Test
     153    public void testTicket18744() throws IOException, IllegalDataException {
     154        try (InputStream is = TestUtils.getRegressionDataStream(18744, "18744-sample.osm")) {
     155            DataSet ds = OsmReader.parseDataSet(is, null);
     156            Layer layer = new OsmDataLayer(ds, null, null);
     157            MainApplication.getLayerManager().addLayer(layer);
     158            try {
     159                assertEquals(3, ds.getWays().size());
     160                new JoinAreasAction(false).join(ds.getWays());
     161                // join should not have changed anything
     162                assertEquals(3, ds.getWays().size());
     163            } finally {
     164                // Ensure we clean the place before leaving, even if test fails.
     165                MainApplication.getLayerManager().removeLayer(layer);
     166            }
     167        }
     168    }
     169
     170
     171    /**
    148172     * Non-regression test which checks example files in nodist/data
    149173     * @throws Exception if an error occurs
Note: See TracChangeset for help on using the changeset viewer.