Changeset 3095 in josm for trunk/src/org/openstreetmap/josm/data/osm/visitor
- Timestamp:
- 2010-03-08T09:24:03+01:00 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/relations/Multipolygon.java
r3083 r3095 7 7 import java.util.ArrayList; 8 8 import java.util.Collection; 9 import java.util.LinkedList;10 9 import java.util.List; 11 10 … … 19 18 public class Multipolygon { 20 19 20 public static class JoinedWay { 21 private final List<Node> nodes; 22 private final boolean selected; 23 24 public JoinedWay(List<Node> nodes, boolean selected) { 25 this.nodes = nodes; 26 this.selected = selected; 27 } 28 29 public List<Node> getNodes() { 30 return nodes; 31 } 32 33 public boolean isSelected() { 34 return selected; 35 } 36 37 public boolean isClosed() { 38 return nodes.isEmpty() || nodes.get(nodes.size() - 1).equals(nodes.get(0)); 39 } 40 } 41 21 42 public static class PolyData { 22 43 public enum Intersection {INSIDE, OUTSIDE, CROSSING} … … 26 47 private Point lastP; 27 48 private Rectangle bounds; 49 50 public PolyData(NavigatableComponent nc, JoinedWay joinedWay) { 51 this(nc, joinedWay.getNodes(), joinedWay.isSelected()); 52 } 28 53 29 54 public PolyData(NavigatableComponent nc, List<Node> nodes, boolean selected) { … … 92 117 private final List<PolyData> outerPolygons = new ArrayList<PolyData>(); 93 118 private final List<PolyData> combinedPolygons = new ArrayList<PolyData>(); 94 private boolean hasNonClosedWays;95 119 96 120 public Multipolygon(NavigatableComponent nc) { … … 137 161 } 138 162 139 result.addAll(joinWays(waysToJoin)); 140 } 141 142 public Collection<PolyData> joinWays(Collection<Way> join) 163 for (JoinedWay jw: joinWays(waysToJoin)) { 164 result.add(new PolyData(nc, jw)); 165 } 166 } 167 168 public static Collection<JoinedWay> joinWays(Collection<Way> join) 143 169 { 144 Collection< PolyData> res = newLinkedList<PolyData>();170 Collection<JoinedWay> res = new ArrayList<JoinedWay>(); 145 171 Way[] joinArray = join.toArray(new Way[join.size()]); 146 172 int left = join.size(); … … 230 256 } 231 257 232 if(!n.isEmpty() && !n.get(n.size() - 1).equals(n.get(0))) { 233 hasNonClosedWays = true; 234 } 235 PolyData pd = new PolyData(nc, n, selected); 236 res.add(pd); 258 res.add(new JoinedWay(n, selected)); 237 259 } /* while(left != 0) */ 238 260 … … 323 345 } 324 346 325 public boolean hasNonClosedWays() {326 return hasNonClosedWays;327 }328 329 347 }
Note:
See TracChangeset
for help on using the changeset viewer.