Changeset 11376 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2016-12-10T06:47:17+01:00 (8 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/JoinAreasAction.java
r11374 r11376 67 67 public static class JoinAreasResult { 68 68 69 public boolean hasChanges; 70 71 public List<Multipolygon> polygons; 69 private final boolean hasChanges; 70 private final List<Multipolygon> polygons; 71 72 /** 73 * Constructs a new {@code JoinAreasResult}. 74 * @param hasChanges whether the result has changes 75 * @param polygons the result polygons, can be null 76 */ 77 public JoinAreasResult(boolean hasChanges, List<Multipolygon> polygons) { 78 this.hasChanges = hasChanges; 79 this.polygons = polygons; 80 } 81 82 /** 83 * Determines if the result has changes. 84 * @return {@code true} if the result has changes 85 */ 86 public final boolean hasChanges() { 87 return hasChanges; 88 } 89 90 /** 91 * Returns the result polygons, can be null. 92 * @return the result polygons, can be null 93 */ 94 public final List<Multipolygon> getPolygons() { 95 return polygons; 96 } 72 97 } 73 98 … … 545 570 public JoinAreasResult joinAreas(List<Multipolygon> areas) throws UserCancelException { 546 571 547 JoinAreasResult result = new JoinAreasResult(); 548 result.hasChanges = false; 572 boolean hasChanges = false; 549 573 550 574 List<Way> allStartingWays = new ArrayList<>(); … … 565 589 566 590 if (removedDuplicates) { 567 result.hasChanges = true;591 hasChanges = true; 568 592 commitCommands(marktr("Removed duplicate nodes")); 569 593 } … … 574 598 //no intersections, return. 575 599 if (nodes.isEmpty()) 576 return result;600 return new JoinAreasResult(hasChanges, null); 577 601 commitCommands(marktr("Added node on all intersections")); 578 602 … … 655 679 } 656 680 657 result.hasChanges = true; 658 result.polygons = polygons; 659 return result; 681 return new JoinAreasResult(true, polygons); 660 682 } 661 683 -
trunk/src/org/openstreetmap/josm/tools/RightAndLefthandTraffic.java
r11374 r11376 111 111 try { 112 112 JoinAreasResult result = new JoinAreasAction().joinAreas(areas); 113 if (result.hasChanges ) {114 for (Multipolygon mp : result. polygons) {113 if (result.hasChanges()) { 114 for (Multipolygon mp : result.getPolygons()) { 115 115 optimizedWays.add(mp.outerWay); 116 116 }
Note:
See TracChangeset
for help on using the changeset viewer.