Changeset 36132 in osm for applications/editors/josm/plugins/reltoolbox
- Timestamp:
- 2023-09-07T16:52:05+02:00 (15 months ago)
- Location:
- applications/editors/josm/plugins/reltoolbox/src/relcontext/actions
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/ReconstructPolygonAction.java
r36102 r36132 174 174 candidateWay = tmp; 175 175 } 176 commands.add( new DeleteCommand(w));176 commands.add(DeleteCommand.delete(Collections.singleton(w))); 177 177 } 178 178 } … … 204 204 } 205 205 206 private boolean isSuitableRelation(Relation newRelation) {206 private static boolean isSuitableRelation(Relation newRelation) { 207 207 return newRelation != null && "multipolygon".equals(newRelation.get("type")) && newRelation.getMembersCount() != 0; 208 208 } -
applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/TheRing.java
r36102 r36132 6 6 import java.util.ArrayList; 7 7 import java.util.Collection; 8 import java.util.Collections; 8 9 import java.util.HashMap; 9 10 import java.util.List; … … 39 40 private final Way source; 40 41 private final List<RingSegment> segments; 41 private Relation relation = null;42 private Relation relation; 42 43 43 44 public TheRing(Way source) { … … 212 213 } 213 214 214 private boolean areSegmentsEqual(RingSegment seg1, RingSegment seg2) {215 private static boolean areSegmentsEqual(RingSegment seg1, RingSegment seg2) { 215 216 List<Node> nodes1 = seg1.getNodes(); 216 217 List<Node> nodes2 = seg2.getNodes(); … … 262 263 * Tries to arrange segments in order for each ring to have at least one. 263 264 * Also, sets source way for all rings. 264 * 265 * <p> 265 266 * If this method is not called, do not forget to call {@link #putSourceWayFirst()} for all rings. 266 267 */ … … 338 339 continue; 339 340 } 340 if ( key.equals("natural") && sourceCopy.get("natural").equals("coastline")) {341 if ("natural".equals(key) && "coastline".equals(sourceCopy.get("natural"))) { 341 342 continue; 342 343 } … … 387 388 foundOwnWay = true; 388 389 } else { 389 for (Relation rel : referencingRelations.keySet()) { 390 int relIndex = referencingRelations.get(rel); 390 for (Map.Entry<Relation, Integer> entry : referencingRelations.entrySet()) { 391 Relation rel = entry.getKey(); 392 int relIndex = entry.getValue(); 391 393 rel.addMember(new RelationMember(rel.getMember(relIndex).getRole(), w)); 392 394 } … … 397 399 } 398 400 if (!foundOwnWay) { 399 commands.add( new DeleteCommand(source));401 commands.add(DeleteCommand.delete(Collections.singleton(source))); 400 402 } 401 403 commands.addAll(relationCommands); … … 407 409 408 410 public static void updateCommandsWithRelations(List<Command> commands, Map<Relation, Relation> relationCache) { 409 for ( Relation src : relationCache.keySet()) {410 commands.add(new ChangeCommand( src, relationCache.get(src)));411 for (Map.Entry<Relation, Relation> entry : relationCache.entrySet()) { 412 commands.add(new ChangeCommand(entry.getKey(), entry.getValue())); 411 413 } 412 414 } … … 441 443 private List<Node> nodes; 442 444 private RingSegment references; 443 private Way resultingWay = null;444 private boolean wasTemplateApplied = false;445 private Way resultingWay; 446 private boolean wasTemplateApplied; 445 447 private boolean isRing; 446 448
Note:
See TracChangeset
for help on using the changeset viewer.