Changeset 17406 in josm
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/CreateMultipolygonAction.java
r17358 r17406 26 26 import org.openstreetmap.josm.actions.relation.DownloadSelectedIncompleteMembersAction; 27 27 import org.openstreetmap.josm.command.AddCommand; 28 import org.openstreetmap.josm.command.ChangeCommand; 28 29 import org.openstreetmap.josm.command.ChangeMembersCommand; 29 30 import org.openstreetmap.josm.command.ChangePropertyCommand; … … 112 113 return; 113 114 } 114 final Command command = commandAndRelation.a;115 115 116 116 // to avoid EDT violations 117 117 SwingUtilities.invokeLater(() -> { 118 if (multipolygonRelation != null) {119 // rather ugly: update generated a ChangeMembersCommand with a copy of the member list, so clear the list now120 commandAndRelation.b.setMembers(null); // #see 19885121 }122 UndoRedoHandler.getInstance().add(command);118 UndoRedoHandler.getInstance().add(commandAndRelation.a); 119 Relation calculatedRel = commandAndRelation.b; 120 if (calculatedRel.getDataSet() == null) { 121 calculatedRel.setMembers(null); // see #19885 122 } 123 123 final Relation relation = (Relation) MainApplication.getLayerManager().getEditDataSet() 124 .getPrimitiveById(c ommandAndRelation.b);124 .getPrimitiveById(calculatedRel); 125 125 if (relation == null || relation.getDataSet() == null) 126 126 return; // should not happen … … 350 350 } else { 351 351 if (!unchanged) { 352 list.add(new ChangeMembersCommand(existingRelation, new ArrayList<>(relation.getMembers()))); 352 if (relation.getKeys().equals(existingRelation.getKeys())) 353 list.add(new ChangeMembersCommand(existingRelation, new ArrayList<>(relation.getMembers()))); 354 else 355 list.add(new ChangeCommand(existingRelation, relation)); 353 356 } 354 357 if (list.isEmpty()) { -
trunk/test/unit/org/openstreetmap/josm/actions/CreateMultipolygonActionTest.java
r17343 r17406 174 174 assertEquals(numCoastlineWays, ds.getWays().stream().filter(w -> "coastline".equals(w.get("natural"))).count()); 175 175 } 176 177 /** 178 * Non-regression test for <a href="https://josm.openstreetmap.de/ticket/20230">Bug #20230</a>. 179 * @throws Exception if an error occurs 180 */ 181 @Test 182 void testTicket20230() throws Exception { 183 DataSet ds = OsmReader.parseDataSet(TestUtils.getRegressionDataStream(20230, "data.osm"), null); 184 assertEquals(1, ds.getRelations().size()); 185 Relation mp = ds.getRelations().iterator().next(); 186 Relation modMp = createMultipolygon(ds.getWays(), "type:way", mp, true); 187 assertNotNull(modMp); 188 assertEquals(1, ds.getRelations().size()); 189 modMp = ds.getRelations().iterator().next(); 190 assertTrue(modMp.hasTag("building", "yes")); 191 assertEquals(0, ds.getWays().stream().filter(w -> w.hasTag("building", "yes")).count()); 192 } 176 193 }
Note:
See TracChangeset
for help on using the changeset viewer.