Ticket #23641: 23641.patch
File 23641.patch, 4.1 KB (added by , 2 weeks ago) |
---|
-
src/org/openstreetmap/josm/actions/CreateMultipolygonAction.java
464 464 for (Entry<String, String> entry : values.entrySet()) { 465 465 String key = entry.getKey(); 466 466 String value = entry.getValue(); 467 List<OsmPrimitive> affectedWays = innerWays.stream().filter(way -> value.equals(way.get(key))).collect(Collectors.toList()); 467 List<OsmPrimitive> affectedWays; 468 if ("area".equals(key)) { 469 affectedWays = innerWays.stream().filter(way -> value.equals(way.get(key))).collect(Collectors.toList()); 470 } else { 471 affectedWays = new ArrayList<>(); 472 } 468 473 469 474 if (moveTags) { 470 475 // remove duplicated tags from outer ways -
test/data/regress/23641/data.osm
1 <?xml version='1.0' encoding='UTF-8'?> 2 <osm version='0.6' upload='never' generator='JOSM'> 3 <node id='-25355' action='modify' visible='true' lat='52.70525056802' lon='8.2863900479' /> 4 <node id='-25357' action='modify' visible='true' lat='52.70663875771' lon='8.28933646476' /> 5 <node id='-25358' action='modify' visible='true' lat='52.70450084767' lon='8.29294054842' /> 6 <node id='-25362' action='modify' visible='true' lat='52.70563846997' lon='8.28878800161' /> 7 <node id='-25363' action='modify' visible='true' lat='52.70628725805' lon='8.28924416778' /> 8 <node id='-25364' action='modify' visible='true' lat='52.70512022866' lon='8.29068470374' /> 9 <way id='-579' action='modify' visible='true'> 10 <nd ref='-25355' /> 11 <nd ref='-25357' /> 12 <nd ref='-25358' /> 13 <nd ref='-25355' /> 14 <tag k='landuse' v='forest' /> 15 <tag k='leaf_type' v='needleleaved' /> 16 </way> 17 <way id='-585' action='modify' visible='true'> 18 <nd ref='-25362' /> 19 <nd ref='-25363' /> 20 <nd ref='-25364' /> 21 <nd ref='-25362' /> 22 <tag k='landuse' v='forest' /> 23 <tag k='leaf_type' v='broadleaved' /> 24 </way> 25 </osm> -
test/unit/org/openstreetmap/josm/actions/CreateMultipolygonActionTest.java
290 290 assertNull(cmd); 291 291 } 292 292 293 /** 294 * Non-regression test for <a href="https://josm.openstreetmap.de/ticket/23641">Bug #23641</a>. 295 * @throws Exception if an error occurs 296 */ 297 @Test 298 void testTicket23642() throws Exception { 299 DataSet ds = OsmReader.parseDataSet(TestUtils.getRegressionDataStream(23641, "data.osm"), null); 300 assertEquals(0, ds.getRelations().size()); 301 Pair<SequenceCommand, Relation> cmd = CreateMultipolygonAction.createMultipolygonCommand(ds.getWays(), null); 302 assertNotNull(cmd); 303 cmd.a.executeCommand(); 304 assertEquals(1, ds.getRelations().size()); 305 Relation mp = ds.getRelations().iterator().next(); 306 assertTrue(mp.hasTag("landuse", "forest")); 307 assertTrue(mp.hasTag("leaf_type", "needleleaved")); 308 assertEquals(0, ds.getWays().stream().filter(w -> w.hasTag("leaf_type", "needleleaved")).count()); 309 assertEquals(1, ds.getWays().stream().filter(w -> w.hasTag("leaf_type", "broadleaved")).count()); 310 assertEquals(1, mp.getMembers().stream() 311 .filter(m -> "inner".equals(m.getRole()) && m.getMember().hasTag("landuse", "forest")).count()); 312 Pair<SequenceCommand, Relation> updateCmd = CreateMultipolygonAction.createMultipolygonCommand(ds.getWays(), mp); 313 assertNull(updateCmd); 314 } 315 293 316 }