Changeset 36102 in osm for applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/ReconstructPolygonAction.java
- Timestamp:
- 2023-07-24T15:55:23+02:00 (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/ReconstructPolygonAction.java
r35829 r36102 10 10 import java.util.Collections; 11 11 import java.util.HashSet; 12 import java.util.Iterator;13 12 import java.util.List; 14 13 import java.util.Map; … … 44 43 */ 45 44 public class ReconstructPolygonAction extends JosmAction implements ChosenRelationListener { 46 private ChosenRelation rel; 47 48 private static final List<String> IRRELEVANT_KEYS = Arrays.asList(new String[] { 49 "source", "created_by", "note"}); 45 private final ChosenRelation rel; 46 47 private static final List<String> IRRELEVANT_KEYS = Arrays.asList("source", "created_by", "note"); 50 48 51 49 public ReconstructPolygonAction(ChosenRelation rel) { … … 109 107 // this ring has inner rings, so we leave a multipolygon in 110 108 // place and don't reconstruct the rings. 111 Relation n = null;109 Relation n; 112 110 if (relationReused) { 113 111 n = new Relation(); … … 153 151 } 154 152 List<OsmPrimitive> referrers = w.getReferrers(); 155 for (Iterator<OsmPrimitive> ref1 = relations.iterator(); ref1.hasNext();) { 156 if (!referrers.contains(ref1.next())) { 157 ref1.remove(); 158 } 159 } 153 relations.removeIf(osmPrimitive -> !referrers.contains(osmPrimitive)); 160 154 } 161 155 tags.putAll(r.getKeys()); … … 169 163 Set<String> keys = new HashSet<>(w.keySet()); 170 164 keys.removeAll(tags.keySet()); 171 keys.removeAll(IRRELEVANT_KEYS);165 IRRELEVANT_KEYS.forEach(keys::remove); 172 166 if (keys.isEmpty()) { 173 167 if (candidateWay == null) { … … 211 205 212 206 private boolean isSuitableRelation(Relation newRelation) { 213 if (newRelation == null || !"multipolygon".equals(newRelation.get("type")) || newRelation.getMembersCount() == 0) 214 return false; 215 else 216 return true; 207 return newRelation != null && "multipolygon".equals(newRelation.get("type")) && newRelation.getMembersCount() != 0; 217 208 } 218 209 }
Note:
See TracChangeset
for help on using the changeset viewer.