Changeset 1862 in josm
- Timestamp:
- 2009-07-27T21:09:44+02:00 (15 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 1 added
- 24 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/AlignInCircleAction.java
r1847 r1862 113 113 // distance between two nodes. 114 114 if (nodes.size() > 0) { 115 if (nodes.size() == 1 && way. nodes.contains(nodes.get(0))) {115 if (nodes.size() == 1 && way.getNodes().contains(nodes.get(0))) { 116 116 regular = true; 117 117 } else { 118 118 119 center = nodes.get(way. nodes.contains(nodes.get(0)) ? 1 : 0).getEastNorth();119 center = nodes.get(way.getNodes().contains(nodes.get(0)) ? 1 : 0).getEastNorth(); 120 120 if (nodes.size() == 2) { 121 121 radius = distance(nodes.get(0).getEastNorth(), nodes.get(1).getEastNorth()); … … 125 125 } 126 126 127 for (Node n : way. nodes) {127 for (Node n : way.getNodes()) { 128 128 if (!nodes.contains(n)) { 129 129 nodes.add(n); -
trunk/src/org/openstreetmap/josm/actions/AlignInLineAction.java
r1847 r1862 56 56 for (OsmPrimitive osm : sel) 57 57 if (osm instanceof Way) { 58 nodes.addAll(((Way)osm). nodes);59 itnodes.addAll(((Way)osm). nodes);58 nodes.addAll(((Way)osm).getNodes()); 59 itnodes.addAll(((Way)osm).getNodes()); 60 60 } 61 61 } -
trunk/src/org/openstreetmap/josm/actions/ApiPreconditionChecker.java
r1847 r1862 104 104 105 105 if (osmPrimitive instanceof Way && 106 ((Way)osmPrimitive). nodes.size() > maxNodes) {106 ((Way)osmPrimitive).getNodesCount() > maxNodes) { 107 107 OptionPaneUtil.showMessageDialog( 108 108 Main.parent, 109 109 tr("{0} nodes in way {1} exceed the max. allowed number of nodes {2}", 110 ((Way)osmPrimitive). nodes.size(),110 ((Way)osmPrimitive).getNodesCount(), 111 111 Long.toString(osmPrimitive.id), 112 112 maxNodes -
trunk/src/org/openstreetmap/josm/actions/CombineWayAction.java
r1847 r1862 144 144 List<Node> nodeList = null; 145 145 Object firstTry = actuallyCombineWays(selectedWays, false); 146 if (firstTry instanceof List ) {146 if (firstTry instanceof List<?>) { 147 147 nodeList = (List<Node>) firstTry; 148 148 } else { 149 149 Object secondTry = actuallyCombineWays(selectedWays, true); 150 if (secondTry instanceof List ) {150 if (secondTry instanceof List<?>) { 151 151 int option = new ExtendedDialog(Main.parent, 152 152 tr("Change directions?"), … … 182 182 Way newWay = new Way(modifyWay); 183 183 184 newWay.nodes.clear(); 185 newWay.nodes.addAll(nodeList); 184 newWay.setNodes(nodeList); 186 185 187 186 // display conflict dialog -
trunk/src/org/openstreetmap/josm/actions/CopyAction.java
r1847 r1862 81 81 Way wnew = new Way(); 82 82 wnew.cloneFrom(w); 83 wnew.nodes.clear();84 83 List<Node> nodes = new ArrayList<Node>(); 85 for (Node n : w. nodes) {84 for (Node n : w.getNodes()) { 86 85 if (! map.containsKey(n)) { 87 86 n.visit(this); … … 89 88 nodes.add((Node)map.get(n)); 90 89 } 91 wnew. nodes.addAll(nodes);90 wnew.setNodes(nodes); 92 91 pasteBuffer.addPrimitive(wnew); 93 92 } -
trunk/src/org/openstreetmap/josm/actions/CreateCircleAction.java
r1847 r1862 99 99 if (osm instanceof Way) { 100 100 existingWay = ((Way)osm); 101 for (Node n : ((Way)osm). nodes)101 for (Node n : ((Way)osm).getNodes()) 102 102 { 103 103 if(!nodes.contains(n)) { -
trunk/src/org/openstreetmap/josm/actions/DistributeAction.java
r1847 r1862 54 54 for (OsmPrimitive osm : sel) 55 55 if (osm instanceof Way) { 56 nodes.addAll(((Way)osm). nodes);57 itnodes.addAll(((Way)osm). nodes);56 nodes.addAll(((Way)osm).getNodes()); 57 itnodes.addAll(((Way)osm).getNodes()); 58 58 } 59 59 } -
trunk/src/org/openstreetmap/josm/actions/JoinNodeWayAction.java
r1820 r1862 50 50 } 51 51 52 if (ws.way. nodes.get(ws.lowerIndex) != node53 && ws.way. nodes.get(ws.lowerIndex+1) != node) {52 if (ws.way.getNode(ws.lowerIndex) != node 53 && ws.way.getNode(ws.lowerIndex+1) != node) { 54 54 is.add(ws.lowerIndex); 55 55 } -
trunk/src/org/openstreetmap/josm/actions/MergeNodesAction.java
r1857 r1862 217 217 218 218 for (Way w : getCurrentDataSet().ways) { 219 if (w.deleted || w.incomplete || w. nodes.size() < 1) {219 if (w.deleted || w.incomplete || w.getNodesCount() < 1) { 220 220 continue; 221 221 } … … 225 225 continue; 226 226 } 227 if (w. nodes.contains(sn)) {227 if (w.getNodes().contains(sn)) { 228 228 modify = true; 229 229 } … … 235 235 ArrayList<Node> nn = new ArrayList<Node>(); 236 236 Node lastNode = null; 237 for (int i = 0; i < w.nodes.size(); i++) { 238 Node pushNode = w.nodes.get(i); 237 for (Node pushNode: w.getNodes()) { 239 238 if (allNodes.contains(pushNode)) { 240 239 pushNode = dest; … … 262 261 } else { 263 262 Way newWay = new Way(w); 264 newWay.nodes.clear(); 265 newWay.nodes.addAll(nn); 263 newWay.setNodes(nn); 266 264 cmds.add(new ChangeCommand(w, newWay)); 267 265 } -
trunk/src/org/openstreetmap/josm/actions/MirrorAction.java
r1857 r1862 45 45 nodes.add((Node)osm); 46 46 } else if (osm instanceof Way) { 47 nodes.addAll(((Way)osm). nodes);47 nodes.addAll(((Way)osm).getNodes()); 48 48 } 49 49 } -
trunk/src/org/openstreetmap/josm/actions/OrthogonalizeAction.java
r1857 r1862 83 83 // Check if every way is made of at least four segments and closed 84 84 Way way = (Way)osm; 85 if ((way. nodes.size() < 5) || (!way.nodes.get(0).equals(way.nodes.get(way.nodes.size() - 1)))) {85 if ((way.getNodesCount() < 5) || !way.isClosed()) { 86 86 OptionPaneUtil.showMessageDialog( 87 87 Main.parent, -
trunk/src/org/openstreetmap/josm/actions/PasteAction.java
r1844 r1862 81 81 /* make sure we reference the new nodes corresponding to the old ones */ 82 82 List<Node> nodes = new ArrayList<Node>(); 83 for (Node n : w. nodes) {83 for (Node n : w.getNodes()) { 84 84 nodes.add((Node)map.get(n)); 85 85 } 86 wnew.nodes.clear(); 87 wnew.nodes.addAll(nodes); 86 wnew.setNodes(nodes); 88 87 map.put(w, wnew); 89 88 } -
trunk/src/org/openstreetmap/josm/actions/ReverseWayAction.java
r1847 r1862 9 9 import java.util.Collections; 10 10 import java.util.LinkedList; 11 import java.util.List; 11 12 12 13 import javax.swing.JOptionPane; … … 19 20 import org.openstreetmap.josm.corrector.UserCancelException; 20 21 import org.openstreetmap.josm.data.osm.DataSet; 22 import org.openstreetmap.josm.data.osm.Node; 21 23 import org.openstreetmap.josm.data.osm.OsmPrimitive; 22 24 import org.openstreetmap.josm.data.osm.Way; … … 58 60 for (Way w : sel) { 59 61 Way wnew = new Way(w); 60 Collections.reverse(wnew.nodes); 62 List<Node> nodesCopy = wnew.getNodes(); 63 Collections.reverse(nodesCopy); 64 wnew.setNodes(nodesCopy); 61 65 if (Main.pref.getBoolean("tag-correction.reverse-way", true)) { 62 66 try -
trunk/src/org/openstreetmap/josm/actions/SplitWayAction.java
r1857 r1862 106 106 continue; 107 107 } 108 int last = w. nodes.size()-1;108 int last = w.getNodesCount()-1; 109 109 if(last <= 0) { 110 110 continue; // zero or one node ways 111 111 } 112 Boolean circular = w.nodes.get(0).equals(w.nodes.get(last));112 boolean circular = w.isClosed(); 113 113 int i = 0; 114 for (Node wn : w. nodes) {114 for (Node wn : w.getNodes()) { 115 115 if ((circular || (i > 0 && i < last)) && n.equals(wn)) { 116 116 Integer old = wayOccurenceCounter.get(w); … … 159 159 160 160 HashSet<Node> nds = new HashSet<Node>(selectedNodes); 161 for (Node n : selectedWay. nodes) {161 for (Node n : selectedWay.getNodes()) { 162 162 nds.remove(n); 163 163 } … … 211 211 wayChunks.add(currentWayChunk); 212 212 213 Iterator<Node> it = selectedWay. nodes.iterator();213 Iterator<Node> it = selectedWay.getNodes().iterator(); 214 214 while (it.hasNext()) { 215 215 Node currentNode = it.next(); … … 273 273 // First, change the original way 274 274 Way changedWay = new Way(selectedWay); 275 changedWay.nodes.clear(); 276 changedWay.nodes.addAll(chunkIt.next()); 275 changedWay.setNodes(chunkIt.next()); 277 276 commandList.add(new ChangeCommand(selectedWay, changedWay)); 278 277 newSelection.add(selectedWay); -
trunk/src/org/openstreetmap/josm/actions/UnGlueAction.java
r1857 r1862 67 67 int count = 0; 68 68 for (Way w : getCurrentDataSet().ways) { 69 if (w.deleted || w.incomplete || w. nodes.size() < 1) {69 if (w.deleted || w.incomplete || w.getNodesCount() < 1) { 70 70 continue; 71 71 } 72 if (!w. nodes.contains(selectedNode)) {72 if (!w.getNodes().contains(selectedNode)) { 73 73 continue; 74 74 } … … 92 92 int count = 0; 93 93 for (Way w : getCurrentDataSet().ways) { 94 if (w.deleted || w.incomplete || w. nodes.size() < 1) {94 if (w.deleted || w.incomplete || w.getNodesCount() < 1) { 95 95 continue; 96 96 } 97 if (!w. nodes.contains(n)) {97 if (!w.getNodes().contains(n)) { 98 98 continue; 99 99 } … … 191 191 boolean isPartOfWay = false; 192 192 for(Way w : getCurrentDataSet().ways) { 193 if(w. nodes.contains(n)) {193 if(w.getNodes().contains(n)) { 194 194 isPartOfWay = true; 195 195 break; … … 232 232 selectedNode = (Node) p; 233 233 if (size == 1 || selectedWay != null) 234 return size == 1 || selectedWay. nodes.contains(selectedNode);234 return size == 1 || selectedWay.getNodes().contains(selectedNode); 235 235 } else if (p instanceof Way) { 236 236 selectedWay = (Way) p; 237 237 if (size == 2 && selectedNode != null) 238 return selectedWay. nodes.contains(selectedNode);238 return selectedWay.getNodes().contains(selectedNode); 239 239 } 240 240 } … … 276 276 if (p instanceof Node) { 277 277 Node n = (Node) p; 278 if (!selectedWay. nodes.contains(n))278 if (!selectedWay.getNodes().contains(n)) 279 279 return false; 280 280 selectedNodes.add(n); … … 283 283 284 284 if (selectedNodes.size() < 1) { 285 selectedNodes.addAll(selectedWay. nodes);285 selectedNodes.addAll(selectedWay.getNodes()); 286 286 } 287 287 … … 298 298 private Way modifyWay(Node originalNode, Way w, List<Command> cmds, List<Node> newNodes) { 299 299 ArrayList<Node> nn = new ArrayList<Node>(); 300 for (Node pushNode : w. nodes) {300 for (Node pushNode : w.getNodes()) { 301 301 if (originalNode == pushNode) { 302 302 // clone the node for all other ways … … 309 309 } 310 310 Way newWay = new Way(w); 311 newWay.nodes.clear(); 312 newWay.nodes.addAll(nn); 311 newWay.setNodes(nn); 313 312 314 313 return newWay; … … 370 369 // modify all ways containing the nodes 371 370 for (Way w : getCurrentDataSet().ways) { 372 if (w.deleted || w.incomplete || w. nodes.size() < 1) {371 if (w.deleted || w.incomplete || w.getNodesCount() < 1) { 373 372 continue; 374 373 } 375 if (!w. nodes.contains(selectedNode)) {374 if (!w.getNodes().contains(selectedNode)) { 376 375 continue; 377 376 } -
trunk/src/org/openstreetmap/josm/actions/mapmode/SelectAction.java
r1847 r1862 65 65 /** 66 66 * Replies true if we are currently running on OSX 67 * 67 * 68 68 * @return true if we are currently running on OSX 69 69 */ … … 306 306 { 307 307 Way w = (Way)osm; 308 Point p1 = c.getPoint(w. nodes.get(nearestWS.lowerIndex));309 Point p2 = c.getPoint(w. nodes.get(nearestWS.lowerIndex+1));308 Point p1 = c.getPoint(w.getNode(nearestWS.lowerIndex)); 309 Point p2 = c.getPoint(w.getNode(nearestWS.lowerIndex+1)); 310 310 if(SimplePaintVisitor.isLargeSegment(p1, p2, Main.pref.getInteger("mappaint.node.virtual-space", 70))) 311 311 { … … 317 317 // virtual node at the same spot will be joined which is likely unwanted 318 318 if(virtualWayNode != null) { 319 if( !w. nodes.get(nearestWS.lowerIndex+1).equals(virtualWayNode)320 && !w. nodes.get(nearestWS.lowerIndex).equals(virtualWayNode)) {319 if( !w.getNode(nearestWS.lowerIndex+1).equals(virtualWayNode) 320 && !w.getNode(nearestWS.lowerIndex).equals(virtualWayNode)) { 321 321 continue; 322 322 } 323 323 } else { 324 virtualWayNode = w. nodes.get(nearestWS.lowerIndex+1);324 virtualWayNode = w.getNode(nearestWS.lowerIndex+1); 325 325 } 326 326 … … 459 459 { 460 460 s.add(osm); 461 s.addAll(((Way)osm). nodes);461 s.addAll(((Way)osm).getNodes()); 462 462 } 463 463 if(s.size() > max) -
trunk/src/org/openstreetmap/josm/actions/search/SearchCompiler.java
r1843 r1862 375 375 public NodeCount(int count) {this.count = count;} 376 376 @Override public boolean match(OsmPrimitive osm) { 377 return osm instanceof Way && ((Way) osm). nodes.size() == count;377 return osm instanceof Way && ((Way) osm).getNodesCount() == count; 378 378 } 379 379 @Override public String toString() {return "nodes="+count;} … … 394 394 @Override public boolean match(OsmPrimitive osm) { 395 395 if(!(osm instanceof Way)) return false; 396 int size = ((Way)osm). nodes.size();396 int size = ((Way)osm).getNodesCount(); 397 397 return (size >= minCount) && (size <= maxCount); 398 398 } … … 441 441 442 442 if (osm instanceof Way) { 443 for (Node n : ((Way)osm). nodes) {443 for (Node n : ((Way)osm).getNodes()) { 444 444 isParent |= child.match(n); 445 445 } -
trunk/src/org/openstreetmap/josm/command/PurgePrimitivesCommand.java
r1814 r1862 21 21 import org.openstreetmap.josm.data.osm.RelationMember; 22 22 import org.openstreetmap.josm.data.osm.Way; 23 import org.openstreetmap.josm.gui.layer.OsmDataLayer;24 23 import org.openstreetmap.josm.tools.ImageProvider; 25 24 … … 28 27 * layer and disconnects any references from {@see Way}s or {@see Relation}s 29 28 * to this primitive. 30 * 29 * 31 30 * This command is necessary if a local {@see OsmPrimitive} has been deleted on 32 31 * the server by another user and if the local user decides to delete his version 33 32 * too. If he only deleted it "logically" JOSM would try to delete it on the server 34 33 * which would result in an non resolvable conflict. 35 * 34 * 36 35 */ 37 36 public class PurgePrimitivesCommand extends ConflictResolveCommand{ … … 44 43 * because a {@see Relation} refers to any other {@see OsmPrimitive} 45 44 * via a relation member. 46 * 45 * 47 46 */ 48 47 static class OsmParentChildPair { … … 100 99 * as child and given set of parents. We don't use {@see CollectBackReferencesVisitor} 101 100 * because it seems quite inefficient. 102 * 101 * 103 102 * @param parents the set of potential parents 104 103 * @param child the child … … 110 109 if (parent instanceof Way) { 111 110 Way w = (Way)parent; 112 for (OsmPrimitive node : w. nodes) {111 for (OsmPrimitive node : w.getNodes()) { 113 112 if (node == child) { 114 113 OsmParentChildPair pair = new OsmParentChildPair(parent, node); … … 170 169 /** 171 170 * Purges an {@see OsmPrimitive} <code>toPurge</code> from a {@see DataSet}. 172 * 171 * 173 172 * @param toPurge the primitive to purge 174 173 * @param ds the dataset to purge from 175 174 * @param hive the hive of {@see OsmPrimitive}s we remember other {@see OsmPrimitive} 176 175 * we have to purge because we purge <code>toPurge</code>. 177 * 176 * 178 177 */ 179 178 protected void purge(OsmPrimitive toPurge, DataSet ds, ArrayList<OsmPrimitive> hive) { -
trunk/src/org/openstreetmap/josm/corrector/ReverseWayTagCorrector.java
r1814 r1862 76 76 ArrayList<OsmPrimitive> primitives = new ArrayList<OsmPrimitive>(); 77 77 primitives.add(way); 78 primitives.addAll(way. nodes);78 primitives.addAll(way.getNodes()); 79 79 80 80 for (OsmPrimitive primitive : primitives) { -
trunk/src/org/openstreetmap/josm/data/osm/Way.java
r1762 r1862 4 4 import static org.openstreetmap.josm.tools.I18n.tr; 5 5 import static org.openstreetmap.josm.tools.I18n.trn; 6 7 import java.util.HashSet;8 6 9 7 import java.util.ArrayList; 10 8 import java.util.Arrays; 11 9 import java.util.Collection; 10 import java.util.HashSet; 12 11 import java.util.List; 13 12 14 13 import org.openstreetmap.josm.data.osm.visitor.Visitor; 14 import org.openstreetmap.josm.tools.CopyList; 15 15 import org.openstreetmap.josm.tools.Pair; 16 16 … … 26 26 */ 27 27 public final List<Node> nodes = new ArrayList<Node>(); 28 29 /** 30 * 31 * You can modify returned list but changes will not be propagated back 32 * to the Way. Use {@link #setNodes(List)} to update this way 33 * @return Nodes composing the way 34 * @since 1862 35 */ 36 public List<Node> getNodes() { 37 return new CopyList<Node>(nodes.toArray(new Node[nodes.size()])); 38 } 39 40 /** 41 * @param nodes 42 * @since 1862 43 */ 44 public void setNodes(List<Node> nodes) { 45 this.nodes.clear(); 46 this.nodes.addAll(nodes); 47 } 48 49 /** 50 * 51 * @return 52 * @since 1862 53 */ 54 public int getNodesCount() { 55 return nodes.size(); 56 } 57 58 /** 59 * 60 * @param index 61 * @return 62 * @since 1862 63 */ 64 public Node getNode(int index) { 65 return nodes.get(index); 66 } 28 67 29 68 /* mappaint data */ -
trunk/src/org/openstreetmap/josm/data/osm/visitor/CollectBackReferencesVisitor.java
r1523 r1862 6 6 7 7 import org.openstreetmap.josm.data.osm.DataSet; 8 import org.openstreetmap.josm.data.osm.Node; 9 import org.openstreetmap.josm.data.osm.OsmPrimitive; 8 10 import org.openstreetmap.josm.data.osm.Relation; 9 11 import org.openstreetmap.josm.data.osm.RelationMember; 10 import org.openstreetmap.josm.data.osm.Node;11 import org.openstreetmap.josm.data.osm.OsmPrimitive;12 12 import org.openstreetmap.josm.data.osm.Way; 13 13 … … 47 47 for (Way w : ds.ways) { 48 48 if (w.deleted || w.incomplete) continue; 49 for (Node n2 : w. nodes) {49 for (Node n2 : w.getNodes()) { 50 50 if (n == n2) { 51 51 data.add(w); -
trunk/src/org/openstreetmap/josm/data/osm/visitor/MapPaintVisitor.java
r1843 r1862 21 21 import java.util.Iterator; 22 22 import java.util.LinkedList; 23 import java.util.List; 23 24 24 25 import javax.swing.ImageIcon; … … 162 163 */ 163 164 public void visit(Way w) { 164 if(w. nodes.size() < 2)165 if(w.getNodesCount() < 2) 165 166 { 166 167 w.mappaintVisibleCode = viewid; … … 174 175 double maxy = -10000; 175 176 176 for (Node n : w. nodes)177 for (Node n : w.getNodes()) 177 178 { 178 179 if(n.getEastNorth().east() > maxx) maxx = n.getEastNorth().east(); … … 293 294 { 294 295 lastN = null; 295 for(Node n : w. nodes)296 for(Node n : w.getNodes()) 296 297 { 297 298 if(lastN != null) … … 308 309 /* draw the way */ 309 310 lastN = null; 310 Iterator<Node> it = w. nodes.iterator();311 Iterator<Node> it = w.getNodes().iterator(); 311 312 while (it.hasNext()) 312 313 { … … 326 327 { 327 328 lastN = null; 328 for(Node n : w. nodes)329 for(Node n : w.getNodes()) 329 330 { 330 331 if(lastN != null) … … 365 366 Way w = null; 366 367 Boolean selected = false; 367 ArrayList<Node> n = null;368 List<Node> n = null; 368 369 Boolean joined = true; 369 370 while(joined && left != 0) … … 380 381 { 381 382 int mode = 0; 382 int cl = c. nodes.size()-1;383 int cl = c.getNodesCount()-1; 383 384 int nl; 384 385 if(n == null) 385 386 { 386 nl = w. nodes.size()-1;387 if(w. nodes.get(nl) == c.nodes.get(0)) mode = 21;388 else if(w. nodes.get(nl) == c.nodes.get(cl)) mode = 22;389 else if(w. nodes.get(0) == c.nodes.get(0)) mode = 11;390 else if(w. nodes.get(0) == c.nodes.get(cl)) mode = 12;387 nl = w.getNodesCount()-1; 388 if(w.getNode(nl) == c.getNode(0)) mode = 21; 389 else if(w.getNode(nl) == c.getNode(cl)) mode = 22; 390 else if(w.getNode(0) == c.getNode(0)) mode = 11; 391 else if(w.getNode(0) == c.getNode(cl)) mode = 12; 391 392 } 392 393 else 393 394 { 394 395 nl = n.size()-1; 395 if(n.get(nl) == c. nodes.get(0)) mode = 21;396 else if(n.get(0) == c. nodes.get(cl)) mode = 12;397 else if(n.get(0) == c. nodes.get(0)) mode = 11;398 else if(n.get(nl) == c. nodes.get(cl)) mode = 22;396 if(n.get(nl) == c.getNode(0)) mode = 21; 397 else if(n.get(0) == c.getNode(cl)) mode = 12; 398 else if(n.get(0) == c.getNode(0)) mode = 11; 399 else if(n.get(nl) == c.getNode(cl)) mode = 22; 399 400 } 400 401 if(mode != 0) … … 404 405 if(c.selected) selected = true; 405 406 --left; 406 if(n == null) n = new ArrayList<Node>(w.nodes);407 if(n == null) n = w.getNodes(); 407 408 n.remove((mode == 21 || mode == 22) ? nl : 0); 408 409 if(mode == 21) 409 n.addAll(c. nodes);410 n.addAll(c.getNodes()); 410 411 else if(mode == 12) 411 n.addAll(0, c. nodes);412 n.addAll(0, c.getNodes()); 412 413 else if(mode == 22) 413 414 { 414 for(Node node : c. nodes)415 for(Node node : c.getNodes()) 415 416 n.add(nl, node); 416 417 } 417 418 else /* mode == 11 */ 418 419 { 419 for(Node node : c. nodes)420 for(Node node : c.getNodes()) 420 421 n.add(0, node); 421 422 } … … 551 552 { 552 553 Way w = (Way) m.member; 553 if(w. nodes.size() < 2)554 if(w.getNodesCount() < 2) 554 555 { 555 556 r.putError(tr("Way ''{0}'' with less than two points.", … … 640 641 if(fromWay.firstNode() == via) { 641 642 //System.out.println("From way heading away from via"); 642 fromNode = fromWay. nodes.get(1);643 fromNode = fromWay.getNode(1); 643 644 } else { 644 645 //System.out.println("From way heading towards via"); 645 fromNode = fromWay. nodes.get(fromWay.nodes.size()-2);646 fromNode = fromWay.getNode(fromWay.nodes.size()-2); 646 647 } 647 648 … … 796 797 { 797 798 Way w = (Way) m.member; 798 if(w. nodes.size() < 2)799 if(w.getNodesCount() < 2) 799 800 { 800 801 r.putError(tr("Way ''{0}'' with less than two points.", … … 881 882 { 882 883 way = w; 883 for (Node n : w. nodes)884 for (Node n : w.getNodes()) 884 885 { 885 886 p = nc.getPoint(n); … … 1059 1060 Polygon polygon = new Polygon(); 1060 1061 1061 for (Node n : w. nodes)1062 for (Node n : w.getNodes()) 1062 1063 { 1063 1064 Point p = nc.getPoint(n); -
trunk/src/org/openstreetmap/josm/data/osm/visitor/MergeVisitor.java
r1753 r1862 7 7 import java.util.HashMap; 8 8 import java.util.LinkedList; 9 import java.util.List; 9 10 import java.util.Map; 10 11 import java.util.logging.Logger; … … 51 52 /** 52 53 * constructor 53 * 54 * 54 55 * The visitor will merge <code>theirDataSet</code> onto <code>myDataSet</code> 55 * 56 * 56 57 * @param myDataSet dataset with my primitives 57 58 * @param theirDataSet dataset with their primitives. … … 76 77 /** 77 78 * Merges a primitive <code>other</code> of type <P> onto my primitives. 78 * 79 * 79 80 * If other.id != 0 it tries to merge it with an corresponding primitive from 80 81 * my dataset with the same id. If this is not possible a conflict is remembered 81 82 * in {@see #conflicts}. 82 * 83 * 83 84 * If other.id == 0 it tries to find a primitive in my dataset with id == 0 which 84 85 * is semantically equal. If it finds one it merges its technical attributes onto 85 86 * my primitive. 86 * 87 * 87 88 * @param <P> the type of the other primitive 88 89 * @param other the other primitive … … 171 172 private void fixWay(Way w) { 172 173 boolean replacedSomething = false; 173 Li nkedList<Node> newNodes = new LinkedList<Node>();174 for (Node myNode : w. nodes) {174 List<Node> newNodes = new LinkedList<Node>(); 175 for (Node myNode : w.getNodes()) { 175 176 Node mergedNode = (Node) merged.get(myNode); 176 177 if (mergedNode != null) { … … 184 185 } 185 186 if (replacedSomething) { 186 w.nodes.clear(); 187 w.nodes.addAll(newNodes); 187 w.setNodes(newNodes); 188 188 } 189 189 } … … 310 310 * Runs the merge operation. Successfully merged {@see OsmPrimitive}s are in 311 311 * {@see #getMyDataSet()}. 312 * 312 * 313 313 * See {@see #getConflicts()} for a map of conflicts after the merge operation. 314 314 */ … … 322 322 /** 323 323 * replies my dataset 324 * 324 * 325 325 * @return 326 326 */ … … 332 332 /** 333 333 * replies the map of conflicts 334 * 334 * 335 335 * @return the map of conflicts 336 336 */ -
trunk/src/org/openstreetmap/josm/data/osm/visitor/SimplePaintVisitor.java
r1725 r1862 20 20 import org.openstreetmap.josm.Main; 21 21 import org.openstreetmap.josm.data.osm.DataSet; 22 import org.openstreetmap.josm.data.osm.RelationMember;23 22 import org.openstreetmap.josm.data.osm.Node; 24 23 import org.openstreetmap.josm.data.osm.OsmPrimitive; 25 24 import org.openstreetmap.josm.data.osm.Relation; 25 import org.openstreetmap.josm.data.osm.RelationMember; 26 26 import org.openstreetmap.josm.data.osm.Way; 27 27 import org.openstreetmap.josm.gui.NavigatableComponent; … … 269 269 270 270 public void visitVirtual(Way w) { 271 Iterator<Node> it = w. nodes.iterator();271 Iterator<Node> it = w.getNodes().iterator(); 272 272 if (it.hasNext()) { 273 273 Point lastP = nc.getPoint(it.next()); … … 294 294 */ 295 295 public void visit(Way w) { 296 if (w.incomplete || w. nodes.size() < 2)296 if (w.incomplete || w.getNodesCount() < 2) 297 297 return; 298 298 … … 361 361 362 362 boolean first = true; 363 for (Node n : ((Way) m.member). nodes) {363 for (Node n : ((Way) m.member).getNodes()) { 364 364 if (n.incomplete || n.deleted) continue; 365 365 Point p = nc.getPoint(n);
Note:
See TracChangeset
for help on using the changeset viewer.