Changeset 1910 in josm
- Timestamp:
- 2009-08-05T08:19:02+02:00 (15 years ago)
- Location:
- trunk
- Files:
-
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/CreateCircleAction.java
r1862 r1910 6 6 import java.awt.event.ActionEvent; 7 7 import java.awt.event.KeyEvent; 8 import java.util.ArrayList; 8 9 import java.util.Collection; 9 10 import java.util.LinkedList; … … 134 135 135 136 // build a way for the circle 136 Way wayToAdd; 137 if (existingWay == null) { 138 wayToAdd = new Way(); 139 } else { 140 // re-use existing way if it was selected 141 wayToAdd = new Way(existingWay); 142 wayToAdd.nodes.clear(); 143 } 137 List<Node> wayToAdd = new ArrayList<Node>(); 144 138 145 139 for (int i = 1; i <= numberOfNodesInCircle; i++) { … … 148 142 // insert existing nodes if they fit before this new node (999 means "already added this node") 149 143 if ((a1 < 999) && (a1 > a - 1E-9) && (a1 < a + 1E-9)) { 150 wayToAdd. nodes.add(n1);144 wayToAdd.add(n1); 151 145 a1 = 999; 152 146 } 153 147 else if ((a2 < 999) && (a2 > a - 1E-9) && (a2 < a + 1E-9)) { 154 wayToAdd. nodes.add(n2);148 wayToAdd.add(n2); 155 149 a2 = 999; 156 150 } … … 160 154 double y = yc + r*Math.sin(a); 161 155 Node n = new Node(Main.proj.eastNorth2latlon(new EastNorth(x,y))); 162 wayToAdd. nodes.add(n);156 wayToAdd.add(n); 163 157 cmds.add(new AddCommand(n)); 164 158 } 165 159 } 166 wayToAdd. nodes.add(wayToAdd.nodes.get(0)); // close the circle160 wayToAdd.add(wayToAdd.get(0)); // close the circle 167 161 if (existingWay == null) { 168 cmds.add(new AddCommand(wayToAdd)); 162 Way newWay = new Way(); 163 newWay.setNodes(wayToAdd); 164 cmds.add(new AddCommand(newWay)); 169 165 } else { 170 cmds.add(new ChangeCommand(existingWay, wayToAdd)); 166 Way newWay = new Way(existingWay); 167 newWay.setNodes(wayToAdd); 168 cmds.add(new ChangeCommand(existingWay, newWay)); 171 169 } 172 170 … … 229 227 230 228 // build a way for the circle 231 Way wayToAdd; 232 if (existingWay == null) { 233 wayToAdd = new Way(); 234 } else { 235 // re-use existing way if it was selected 236 wayToAdd = new Way(existingWay); 237 wayToAdd.nodes.clear(); 238 } 229 List<Node> wayToAdd = new ArrayList<Node>(); 239 230 for (int i = 1; i <= numberOfNodesInCircle; i++) { 240 231 double a = 2*Math.PI*(1.0 - i/(double)numberOfNodesInCircle); // "1-" to get it clock-wise 241 232 // insert existing nodes if they fit before this new node (999 means "already added this node") 242 233 if (a1 < 999 && a1 > a) { 243 wayToAdd. nodes.add(n1);234 wayToAdd.add(n1); 244 235 a1 = 999; 245 236 } 246 237 if (a2 < 999 && a2 > a) { 247 wayToAdd. nodes.add(n2);238 wayToAdd.add(n2); 248 239 a2 = 999; 249 240 } 250 241 if (a3 < 999 && a3 > a) { 251 wayToAdd. nodes.add(n3);242 wayToAdd.add(n3); 252 243 a3 = 999; 253 244 } … … 256 247 double y = yc + r*Math.sin(a); 257 248 Node n = new Node(Main.proj.eastNorth2latlon(new EastNorth(x,y))); 258 wayToAdd. nodes.add(n);249 wayToAdd.add(n); 259 250 cmds.add(new AddCommand(n)); 260 251 } 261 wayToAdd. nodes.add(wayToAdd.nodes.get(0)); // close the circle252 wayToAdd.add(wayToAdd.get(0)); // close the circle 262 253 if (existingWay == null) { 263 cmds.add(new AddCommand(wayToAdd)); 254 Way newWay = new Way(); 255 newWay.setNodes(wayToAdd); 256 cmds.add(new AddCommand(newWay)); 264 257 } else { 265 cmds.add(new ChangeCommand(existingWay, wayToAdd)); 258 Way newWay = new Way(existingWay); 259 newWay.setNodes(wayToAdd); 260 cmds.add(new ChangeCommand(existingWay, newWay)); 266 261 } 267 262 -
trunk/src/org/openstreetmap/josm/actions/JoinNodeWayAction.java
r1862 r1910 59 59 for (Map.Entry<Way, List<Integer>> insertPoint : insertPoints.entrySet()) { 60 60 Way w = insertPoint.getKey(); 61 Way wnew = new Way(w);61 List<Node> nodesToAdd = new ArrayList<Node>(); 62 62 List<Integer> is = insertPoint.getValue(); 63 63 pruneSuccsAndReverse(is); 64 64 for (int i : is) { 65 wnew.nodes.add(i+1, node);65 nodesToAdd.add(i+1, node); 66 66 } 67 Way wnew = new Way(w); 68 wnew.setNodes(nodesToAdd); 67 69 cmds.add(new ChangeCommand(w, wnew)); 68 70 } -
trunk/src/org/openstreetmap/josm/command/PurgePrimitivesCommand.java
r1898 r1910 186 186 Way w = (Way)pair.getParent(); 187 187 System.out.println(tr("removing reference from way {0}",w.id)); 188 w.nodes.remove(primitive); 188 List<Node> wayNodes = w.getNodes(); 189 wayNodes.remove(primitive); 190 w.setNodes(wayNodes); 189 191 // if a way ends up with less than two node we 190 192 // remember it on the "hive" -
trunk/src/org/openstreetmap/josm/command/WayNodesConflictResolverCommand.java
r1766 r1910 37 37 38 38 /** 39 * 39 * 40 40 * @param my my may 41 41 * @param their their way … … 68 68 // nodes 69 69 // 70 conflict.getMy().nodes.clear(); 71 for (int i=0; i<mergedNodeList.size();i++) { 72 Node n = mergedNodeList.get(i); 73 conflict.getMy().nodes.add(n); 70 for (Node n:mergedNodeList) { 74 71 if (! getLayer().data.nodes.contains(n)) { 75 72 logger.warning(tr("Main dataset does not include node {0}", n.toString())); 76 73 } 77 74 } 75 conflict.getMy().setNodes(mergedNodeList); 78 76 rememberConflict(conflict); 79 77 return true; -
trunk/src/org/openstreetmap/josm/data/osm/DataSet.java
r1899 r1910 372 372 373 373 protected void deleteWay(Way way) { 374 way. nodes.clear();374 way.setNodes(null); 375 375 way.delete(true); 376 376 } … … 383 383 public void unlinkNodeFromWays(Node node) { 384 384 for (Way way: ways) { 385 if (way.nodes.contains(node)) {386 way.nodes.remove(node);387 if ( way.nodes.size() < 2) {385 List<Node> nodes = way.getNodes(); 386 if (nodes.remove(node)) { 387 if (nodes.size() < 2) { 388 388 deleteWay(way); 389 } else { 390 way.setNodes(nodes); 389 391 } 390 392 } -
trunk/src/org/openstreetmap/josm/data/osm/Way.java
r1900 r1910 24 24 /** 25 25 * All way nodes in this way 26 * 26 * 27 27 * @deprecated This public field will become private or protected in the future. 28 28 * Use the new public API instead. … … 43 43 44 44 /** 45 * @param nodes 45 * @param nodes New way nodes. Can be null, in that case all way nodes are removed 46 46 * @since 1862 47 47 */ 48 48 public void setNodes(List<Node> nodes) { 49 49 this.nodes.clear(); 50 this.nodes.addAll(nodes); 50 if (nodes != null) { 51 this.nodes.addAll(nodes); 52 } 53 clearCached(); 51 54 } 52 55 -
trunk/src/org/openstreetmap/josm/data/osm/visitor/MergeSourceBuildingVisitor.java
r1898 r1910 136 136 return; 137 137 Way clone = new Way(w); 138 clone. nodes.clear();138 clone.setNodes(null); 139 139 clone.incomplete = true; 140 140 mappedPrimitives.put(w, clone); -
trunk/src/org/openstreetmap/josm/gui/SelectionManager.java
r1898 r1910 289 289 continue; 290 290 if (alt) { 291 for (Node n : w. nodes) {291 for (Node n : w.getNodes()) { 292 292 if (!n.incomplete && r.contains(nc.getPoint(n))) { 293 293 selection.add(w); … … 297 297 } else { 298 298 boolean allIn = true; 299 for (Node n : w. nodes) {299 for (Node n : w.getNodes()) { 300 300 if (!n.incomplete && !r.contains(nc.getPoint(n))) { 301 301 allIn = false; -
trunk/src/org/openstreetmap/josm/gui/layer/GpxLayer.java
r1890 r1910 710 710 for (GpxTrack trk : data.tracks) { 711 711 for (Collection<WayPoint> segment : trk.trackSegs) { 712 Way w = new Way();712 List<Node> nodes = new ArrayList<Node>(); 713 713 for (WayPoint p : segment) { 714 714 Node n = new Node(p.getCoor()); … … 718 718 } 719 719 ds.nodes.add(n); 720 w.nodes.add(n); 721 } 720 nodes.add(n); 721 } 722 Way w = new Way(); 723 w.setNodes(nodes); 722 724 ds.ways.add(w); 723 725 } … … 741 743 /** 742 744 * Action that issues a series of download requests to the API, following the GPX track. 743 * 745 * 744 746 * @author fred 745 747 */ … … 842 844 * can only download rectangles, so the following is an attempt at finding a number of 843 845 * rectangles to download. 844 * 846 * 845 847 * The idea is simply: Start out with the full bounding box. If it is too large, then 846 848 * split it in half and repeat recursively for each half until you arrive at something … … 1141 1143 * Makes a WayPoint at the projection of point P onto the track providing P is less than 1142 1144 * tolerance away from the track 1143 * 1145 * 1144 1146 * @param P : the point to determine the projection for 1145 1147 * @param tolerance : must be no further than this from the track … … 1151 1153 * assume the coordinates of P are xp,yp, and those of a section of track between two 1152 1154 * trackpoints are R=xr,yr and S=xs,ys. Let N be the projected point. 1153 * 1155 * 1154 1156 * The equation of RS is Ax + By + C = 0 where A = ys - yr B = xr - xs C = - Axr - Byr 1155 * 1157 * 1156 1158 * Also, note that the distance RS^2 is A^2 + B^2 1157 * 1159 * 1158 1160 * If RS^2 == 0.0 ignore the degenerate section of track 1159 * 1161 * 1160 1162 * PN^2 = (Axp + Byp + C)^2 / RS^2 that is the distance from P to the line 1161 * 1163 * 1162 1164 * so if PN^2 is less than PNmin^2 (initialized to tolerance) we can reject the line; 1163 1165 * otherwise... determine if the projected poijnt lies within the bounds of the line: PR^2 - 1164 1166 * PN^2 <= RS^2 and PS^2 - PN^2 <= RS^2 1165 * 1167 * 1166 1168 * where PR^2 = (xp - xr)^2 + (yp-yr)^2 and PS^2 = (xp - xs)^2 + (yp-ys)^2 1167 * 1169 * 1168 1170 * If so, calculate N as xn = xr + (RN/RS) B yn = y1 + (RN/RS) A 1169 * 1171 * 1170 1172 * where RN = sqrt(PR^2 - PN^2) 1171 1173 */ -
trunk/src/org/openstreetmap/josm/gui/layer/RawGpsLayer.java
r1890 r1910 14 14 import java.awt.event.ActionListener; 15 15 import java.io.File; 16 import java.util.ArrayList; 16 17 import java.util.Collection; 18 import java.util.List; 17 19 18 20 import javax.swing.AbstractAction; … … 73 75 DataSet ds = new DataSet(); 74 76 for (Collection<GpsPoint> c : data) { 75 Way w = new Way();77 List<Node> nodes = new ArrayList<Node>(); 76 78 for (GpsPoint p : c) { 77 79 Node n = new Node(p.latlon); 78 80 ds.nodes.add(n); 79 w.nodes.add(n); 80 } 81 nodes.add(n); 82 } 83 Way w = new Way(); 84 w.setNodes(nodes); 81 85 ds.ways.add(w); 82 86 } -
trunk/src/org/openstreetmap/josm/io/OsmReader.java
r1899 r1910 12 12 import java.util.HashMap; 13 13 import java.util.LinkedList; 14 import java.util.List; 14 15 import java.util.Map; 15 16 import java.util.Map.Entry; … … 330 331 Way w = new Way(e.getKey().id); 331 332 boolean incomplete = false; 333 List<Node> wayNodes = new ArrayList<Node>(); 332 334 for (long id : e.getValue()) { 333 335 Node n = findNode(id); … … 337 339 incomplete = true; 338 340 } 339 w.nodes.add(n); 340 } 341 wayNodes.add(n); 342 } 343 w.setNodes(wayNodes); 341 344 if (incomplete) { 342 logger.warning(tr("marked way {0} with {1} nodes incomplete because at least one node was missing in the loaded data and is therefore incomplete too", e.getKey().id, w.nodes.size())); 345 logger.warning(tr("marked way {0} with {1} nodes incomplete because at least one node was missing in the " + 346 "loaded data and is therefore incomplete too", e.getKey().id, w.getNodesCount())); 343 347 e.getKey().copyTo(w); 344 348 w.incomplete = true; -
trunk/test/functional/org/openstreetmap/josm/gui/conflict/nodes/NodeListMergerTest.java
r1707 r1910 17 17 Way w1 = new Way(); 18 18 Node n1; 19 w1. nodes.add(n1 = new Node(1));19 w1.addNode(n1 = new Node(1)); 20 20 for (int i=0; i < 20; i++) { 21 21 n1.put("key" + i, "value" + i); … … 26 26 } 27 27 n1.put("note", note); 28 w1. nodes.add(new Node(2));29 w1. nodes.add(new Node(3));28 w1.addNode(new Node(2)); 29 w1.addNode(new Node(3)); 30 30 31 31 Way w2 = new Way(); 32 w2. nodes.add(new Node(4));33 w2. nodes.add(new Node(5));34 w2. nodes.add(new Node(6));32 w2.addNode(new Node(4)); 33 w2.addNode(new Node(5)); 34 w2.addNode(new Node(6)); 35 35 36 36 nodeListMerger.populate(w1, w2); … … 41 41 Way w1 = new Way(); 42 42 for (int i = 0; i < 100; i++) { 43 w1. nodes.add(new Node(i));43 w1.addNode(new Node(i)); 44 44 } 45 45 46 46 Way w2 = new Way(); 47 47 for (int i = 1; i < 200; i+=2) { 48 w2. nodes.add(new Node(i));48 w2.addNode(new Node(i)); 49 49 } 50 50 nodeListMerger.populate(w1, w2); -
trunk/test/functional/org/openstreetmap/josm/gui/dialogs/ConflictResolutionDialogTest.java
r1707 r1910 10 10 11 11 private ConflictResolutionDialog dialog; 12 12 13 13 protected void build() { 14 14 setSize(100,100); 15 15 dialog = new ConflictResolutionDialog(this); 16 16 dialog.setSize(600,600); 17 18 17 18 19 19 } 20 20 protected void populate() { 21 21 Way w1 = new Way(1); 22 w1. nodes.add(new Node(10));23 w1. nodes.add(new Node(11));24 22 w1.addNode(new Node(10)); 23 w1.addNode(new Node(11)); 24 25 25 Way w2 = new Way(1); 26 w2. nodes.add(new Node(10));27 w2. nodes.add(new Node(11));28 26 w2.addNode(new Node(10)); 27 w2.addNode(new Node(11)); 28 29 29 dialog.getConflictResolver().populate(w1, w2); 30 30 } 31 31 32 32 public void showDialog() { 33 33 dialog.setVisible(true); 34 34 } 35 35 36 36 public ConflictResolutionDialogTest() { 37 37 build(); 38 38 } 39 39 40 40 static public void main(String args[]) { 41 41 ConflictResolutionDialogTest test = new ConflictResolutionDialogTest(); -
trunk/test/functional/org/openstreetmap/josm/io/MultiFetchServerObjectReaderTest.java
r1898 r1910 76 76 int idx = (start + j) % numNodes; 77 77 Node n = nodes.get(idx); 78 w. nodes.add(n);78 w.addNode(n); 79 79 } 80 80 w.put("name", "way-"+i); -
trunk/test/functional/org/openstreetmap/josm/io/OsmServerBackreferenceReaderTest.java
r1898 r1910 74 74 w.incomplete = false; 75 75 for (int j = 0; j < 10;j++) { 76 w. nodes.add(lookupNode(ds, i+j));76 w.addNode(lookupNode(ds, i+j)); 77 77 } 78 78 w.put("name", "way-"+i); -
trunk/test/unit/org/openstreetmap/josm/data/osm/visitor/MergeSourceBuildingVisitorTest.java
r1890 r1910 2 2 package org.openstreetmap.josm.data.osm.visitor; 3 3 4 import static org.junit.Assert.assertEquals; 5 import static org.junit.Assert.assertNotNull; 6 import static org.junit.Assert.assertNull; 7 import static org.junit.Assert.assertTrue; 8 4 9 import java.util.Collection; 5 10 6 import org.junit.Ignore;7 11 import org.junit.Test; 8 12 import org.openstreetmap.josm.data.coor.LatLon; … … 13 17 import org.openstreetmap.josm.data.osm.RelationMember; 14 18 import org.openstreetmap.josm.data.osm.Way; 15 16 import static org.junit.Assert.*;17 19 18 20 public class MergeSourceBuildingVisitorTest { … … 69 71 Node n2 = new Node(2); 70 72 Way w1 = new Way(3); 71 w1. nodes.add(n1);72 w1. nodes.add(n2);73 w1.addNode(n1); 74 w1.addNode(n2); 73 75 source.nodes.add(n1); 74 76 source.nodes.add(n2); … … 101 103 Node n2 = new Node(2); 102 104 Way w1 = new Way(3); 103 w1. nodes.add(n1);104 w1. nodes.add(n2);105 w1.addNode(n1); 106 w1.addNode(n2); 105 107 source.nodes.add(n1); 106 108 source.nodes.add(n2); … … 154 156 Way w30 = new Way(30); 155 157 Node n21; 156 w30. nodes.add(n21 = new Node(21));158 w30.addNode(n21 = new Node(21)); 157 159 Node n22; 158 w30. nodes.add(n22 = new Node(22));160 w30.addNode(n22 = new Node(22)); 159 161 r1.members.add(new RelationMember("way-30",w30)); 160 162 Relation r40 = new Relation(40); … … 181 183 Way w = (Way)hull.getPrimitiveById(30); 182 184 assertNotNull(w); 183 assertEquals(2, w. nodes.size());185 assertEquals(2, w.getNodesCount()); 184 186 Node n = (Node)hull.getPrimitiveById(21); 185 187 assertNotNull(n); 186 assertTrue(w. nodes.contains(n));188 assertTrue(w.getNodes().contains(n)); 187 189 188 190 n = (Node)hull.getPrimitiveById(22); 189 191 assertNotNull(n); 190 assertTrue(w. nodes.contains(n));192 assertTrue(w.getNodes().contains(n)); 191 193 192 194 Relation r = (Relation)hull.getPrimitiveById(40); … … 212 214 Way w30 = new Way(30); 213 215 Node n21; 214 w30. nodes.add(n21 = new Node(21));216 w30.addNode(n21 = new Node(21)); 215 217 Node n22; 216 w30. nodes.add(n22 = new Node(22));218 w30.addNode(n22 = new Node(22)); 217 219 r1.members.add(new RelationMember("way-30",w30)); 218 220 Relation r40 = new Relation(40); … … 274 276 w30.put("name", "w30"); 275 277 Node n21; 276 w30. nodes.add(n21 = new Node(new LatLon(21.0,21.0)));278 w30.addNode(n21 = new Node(new LatLon(21.0,21.0))); 277 279 n21.put("name","n21"); 278 280 Node n22; 279 w30. nodes.add(n22 = new Node(new LatLon(22.0,22.0)));281 w30.addNode(n22 = new Node(new LatLon(22.0,22.0))); 280 282 n22.put("name","n22"); 281 283 r1.members.add(new RelationMember("way-30",w30)); … … 304 306 Way w = (Way)lookupByName(hull.ways, "w30"); 305 307 assertNotNull(w); 306 assertEquals(2, w. nodes.size());308 assertEquals(2, w.getNodesCount()); 307 309 308 310 Node n = (Node)lookupByName(hull.nodes, "n21"); 309 311 assertNotNull(n); 310 assertTrue(w. nodes.contains(n));312 assertTrue(w.getNodes().contains(n)); 311 313 312 314 n = (Node)lookupByName(hull.nodes, "n22"); 313 315 assertNotNull(n); 314 assertTrue(w. nodes.contains(n));316 assertTrue(w.getNodes().contains(n)); 315 317 316 318 Relation r = (Relation)lookupByName(hull.relations, "r40"); -
trunk/test/unit/org/openstreetmap/josm/data/osm/visitor/MergeVisitorTest.java
r1813 r1910 489 489 myWay.version = 1; 490 490 myWay.put("key1", "value1"); 491 myWay. nodes.add(n1);492 myWay. nodes.add(n2);491 myWay.addNode(n1); 492 myWay.addNode(n2); 493 493 my.addPrimitive(myWay); 494 494 … … 511 511 theirWay.put("key1", "value1"); 512 512 theirWay.put("key2", "value2"); 513 theirWay. nodes.add(n3);514 theirWay. nodes.add(n4);513 theirWay.addNode(n3); 514 theirWay.addNode(n4); 515 515 their.addPrimitive(theirWay); 516 516 … … 525 525 assertEquals(3,merged.id); 526 526 assertEquals(2,merged.version); 527 assertEquals(2,merged. nodes.size());528 assertEquals(1,merged. nodes.get(0).id);529 assertEquals(2,merged. nodes.get(1).id);527 assertEquals(2,merged.getNodesCount()); 528 assertEquals(1,merged.getNode(0).id); 529 assertEquals(2,merged.getNode(1).id); 530 530 531 531 } … … 557 557 myWay.id = 3; 558 558 myWay.version = 1; 559 myWay. nodes.add(n1);560 myWay. nodes.add(n2);559 myWay.addNode(n1); 560 myWay.addNode(n2); 561 561 my.addPrimitive(myWay); 562 562 … … 586 586 theirWay.id = 3; 587 587 theirWay.version = 2; 588 theirWay. nodes.add(n3);589 theirWay. nodes.add(n5); // insert a node590 theirWay. nodes.add(n4); // this one is updated588 theirWay.addNode(n3); 589 theirWay.addNode(n5); // insert a node 590 theirWay.addNode(n4); // this one is updated 591 591 their.addPrimitive(theirWay); 592 592 … … 599 599 assertEquals(3,merged.id); 600 600 assertEquals(2,merged.version); 601 assertEquals(3,merged. nodes.size());602 assertEquals(1,merged. nodes.get(0).id);603 assertEquals(4,merged. nodes.get(1).id);604 assertEquals(2,merged. nodes.get(2).id);605 assertEquals("value1",merged. nodes.get(2).get("key1"));601 assertEquals(3,merged.getNodesCount()); 602 assertEquals(1,merged.getNode(0).id); 603 assertEquals(4,merged.getNode(1).id); 604 assertEquals(2,merged.getNode(2).id); 605 assertEquals("value1",merged.getNode(2).get("key1")); 606 606 } 607 607 … … 631 631 myWay.id = 3; 632 632 myWay.version = 1; 633 myWay. nodes.add(n1);634 myWay. nodes.add(n2);633 myWay.addNode(n1); 634 myWay.addNode(n2); 635 635 myWay.modified = true; 636 636 myWay.put("key1", "value1"); … … 662 662 theirWay.id = 3; 663 663 theirWay.version = 2; 664 theirWay. nodes.add(n3);665 theirWay. nodes.add(n5); // insert a node666 theirWay. nodes.add(n4); // this one is updated664 theirWay.addNode(n3); 665 theirWay.addNode(n5); // insert a node 666 theirWay.addNode(n4); // this one is updated 667 667 their.addPrimitive(theirWay); 668 668 … … 675 675 assertEquals(3,merged.id); 676 676 assertEquals(1,merged.version); 677 assertEquals(2,merged. nodes.size());678 assertEquals(1,merged. nodes.get(0).id);679 assertEquals(2,merged. nodes.get(1).id);677 assertEquals(2,merged.getNodesCount()); 678 assertEquals(1,merged.getNode(0).id); 679 assertEquals(2,merged.getNode(1).id); 680 680 assertEquals("value1",merged.get("key1")); 681 681 } … … 707 707 myWay.id = 3; 708 708 myWay.version = 1; 709 myWay. nodes.add(n1);710 myWay. nodes.add(n2);709 myWay.addNode(n1); 710 myWay.addNode(n2); 711 711 my.addPrimitive(myWay); 712 712 … … 757 757 myWay.id = 0; 758 758 myWay.version = -1; 759 myWay. nodes.add(n1);760 myWay. nodes.add(n2);759 myWay.addNode(n1); 760 myWay.addNode(n2); 761 761 my.addPrimitive(myWay); 762 762 … … 777 777 theirWay.id = 0; 778 778 theirWay.version = -1; 779 theirWay. nodes.add(n3);780 theirWay. nodes.add(n4);779 theirWay.addNode(n3); 780 theirWay.addNode(n4); 781 781 theirWay.user = User.get("their"); 782 782 theirWay.user.uid = "1111"; … … 819 819 myWay.id = 0; 820 820 myWay.version = -1; 821 myWay. nodes.add(n1);822 myWay. nodes.add(n2);821 myWay.addNode(n1); 822 myWay.addNode(n2); 823 823 my.addPrimitive(myWay); 824 824 … … 839 839 theirWay.id = 0; 840 840 theirWay.version = -1; 841 theirWay. nodes.add(n3);842 theirWay. nodes.add(n4);841 theirWay.addNode(n3); 842 theirWay.addNode(n4); 843 843 theirWay.user = User.get("their"); 844 844 theirWay.user.uid = "1111"; … … 899 899 theirWay.id = 4; 900 900 theirWay.version = 1; 901 theirWay. nodes.add(n3);902 theirWay. nodes.add(n4);903 theirWay. nodes.add(n5);901 theirWay.addNode(n3); 902 theirWay.addNode(n4); 903 theirWay.addNode(n5); 904 904 theirWay.user = User.get("their"); 905 905 theirWay.user.uid = "1111"; … … 913 913 914 914 Way myWay = (Way)my.getPrimitiveById(4); 915 assertEquals(2, myWay. nodes.size());915 assertEquals(2, myWay.getNodesCount()); 916 916 917 917 Node n = (Node)my.getPrimitiveById(1); -
trunk/test/unit/org/openstreetmap/josm/gui/conflict/nodes/NodeListMergeModelTest.java
r1650 r1910 64 64 65 65 Way myWay = new Way(1); 66 myWay. nodes.add(new Node(2));67 myWay. nodes.add(new Node(3));66 myWay.addNode(new Node(2)); 67 myWay.addNode(new Node(3)); 68 68 Way theirWay = new Way(1); 69 69 … … 88 88 89 89 Way myWay = new Way(1); 90 myWay. nodes.add(new Node(2));91 myWay. nodes.add(new Node(3));90 myWay.addNode(new Node(2)); 91 myWay.addNode(new Node(3)); 92 92 Way theirWay = new Way(1); 93 93 … … 119 119 120 120 Way myWay = new Way(1); 121 myWay. nodes.add(new Node(2));122 myWay. nodes.add(new Node(3));121 myWay.addNode(new Node(2)); 122 myWay.addNode(new Node(3)); 123 123 Way theirWay = new Way(1); 124 124 … … 145 145 146 146 Way myWay = new Way(1); 147 myWay. nodes.add(new Node(2));148 myWay. nodes.add(new Node(3));149 myWay. nodes.add(new Node(4));147 myWay.addNode(new Node(2)); 148 myWay.addNode(new Node(3)); 149 myWay.addNode(new Node(4)); 150 150 Way theirWay = new Way(1); 151 151 … … 173 173 174 174 Way myWay = new Way(1); 175 myWay. nodes.add(new Node(2));176 myWay. nodes.add(new Node(3));175 myWay.addNode(new Node(2)); 176 myWay.addNode(new Node(3)); 177 177 Way theirWay = new Way(1); 178 178 … … 194 194 195 195 Way myWay = new Way(1); 196 myWay. nodes.add(new Node(2));197 myWay. nodes.add(new Node(3));196 myWay.addNode(new Node(2)); 197 myWay.addNode(new Node(3)); 198 198 Way theirWay = new Way(1); 199 199 … … 220 220 221 221 Way myWay = new Way(1); 222 myWay. nodes.add(new Node(2));223 myWay. nodes.add(new Node(3));222 myWay.addNode(new Node(2)); 223 myWay.addNode(new Node(3)); 224 224 Way theirWay = new Way(1); 225 225 … … 247 247 248 248 Way myWay = new Way(1); 249 myWay. nodes.add(new Node(2));250 myWay. nodes.add(new Node(3));251 myWay. nodes.add(new Node(4));249 myWay.addNode(new Node(2)); 250 myWay.addNode(new Node(3)); 251 myWay.addNode(new Node(4)); 252 252 Way theirWay = new Way(1); 253 253 … … 279 279 280 280 Way myWay = new Way(1); 281 myWay. nodes.add(new Node(1));282 myWay. nodes.add(new Node(2));281 myWay.addNode(new Node(1)); 282 myWay.addNode(new Node(2)); 283 283 Way theirWay = new Way(1); 284 284 … … 307 307 308 308 Way myWay = new Way(1); 309 myWay. nodes.add(new Node(1));310 myWay. nodes.add(new Node(2));309 myWay.addNode(new Node(1)); 310 myWay.addNode(new Node(2)); 311 311 Way theirWay = new Way(1); 312 312 … … 335 335 336 336 Way myWay = new Way(1); 337 myWay. nodes.add(new Node(1));338 myWay. nodes.add(new Node(2));337 myWay.addNode(new Node(1)); 338 myWay.addNode(new Node(2)); 339 339 Way theirWay = new Way(1); 340 340 … … 368 368 369 369 Way myWay = new Way(1); 370 myWay. nodes.add(new Node(1));371 myWay. nodes.add(new Node(2));370 myWay.addNode(new Node(1)); 371 myWay.addNode(new Node(2)); 372 372 Way theirWay = new Way(1); 373 373 … … 396 396 397 397 Way myWay = new Way(1); 398 myWay. nodes.add(new Node(1));399 myWay. nodes.add(new Node(2));400 myWay. nodes.add(new Node(3));398 myWay.addNode(new Node(1)); 399 myWay.addNode(new Node(2)); 400 myWay.addNode(new Node(3)); 401 401 Way theirWay = new Way(1); 402 402 … … 426 426 427 427 Way myWay = new Way(1); 428 myWay. nodes.add(new Node(1));429 myWay. nodes.add(new Node(2));430 myWay. nodes.add(new Node(3));428 myWay.addNode(new Node(1)); 429 myWay.addNode(new Node(2)); 430 myWay.addNode(new Node(3)); 431 431 Way theirWay = new Way(1); 432 432 … … 455 455 456 456 Way myWay = new Way(1); 457 myWay. nodes.add(new Node(1));458 myWay. nodes.add(new Node(2));457 myWay.addNode(new Node(1)); 458 myWay.addNode(new Node(2)); 459 459 Way theirWay = new Way(1); 460 460 … … 488 488 489 489 Way myWay = new Way(1); 490 myWay. nodes.add(new Node(1));491 myWay. nodes.add(new Node(2));490 myWay.addNode(new Node(1)); 491 myWay.addNode(new Node(2)); 492 492 Way theirWay = new Way(1); 493 493 … … 514 514 515 515 Way myWay = new Way(1); 516 myWay. nodes.add(new Node(1));517 myWay. nodes.add(new Node(2));516 myWay.addNode(new Node(1)); 517 myWay.addNode(new Node(2)); 518 518 Way theirWay = new Way(1); 519 519 … … 544 544 545 545 Way myWay = new Way(1); 546 myWay. nodes.add(new Node(1));547 myWay. nodes.add(new Node(2));546 myWay.addNode(new Node(1)); 547 myWay.addNode(new Node(2)); 548 548 Way theirWay = new Way(1); 549 549 … … 577 577 578 578 Way myWay = new Way(1); 579 myWay. nodes.add(new Node(1));580 myWay. nodes.add(new Node(2));579 myWay.addNode(new Node(1)); 580 myWay.addNode(new Node(2)); 581 581 Way theirWay = new Way(1); 582 582 … … 603 603 604 604 Way myWay = new Way(1); 605 myWay. nodes.add(new Node(1));606 myWay. nodes.add(new Node(2));605 myWay.addNode(new Node(1)); 606 myWay.addNode(new Node(2)); 607 607 Way theirWay = new Way(1); 608 608 … … 633 633 634 634 Way myWay = new Way(1); 635 myWay. nodes.add(new Node(1));636 myWay. nodes.add(new Node(2));635 myWay.addNode(new Node(1)); 636 myWay.addNode(new Node(2)); 637 637 Way theirWay = new Way(1); 638 638
Note:
See TracChangeset
for help on using the changeset viewer.