Changeset 17388 in osm for applications/editors/josm/plugins/terracer/src
- Timestamp:
- 2009-08-30T18:36:20+02:00 (15 years ago)
- Location:
- applications/editors/josm/plugins/terracer/src/terracer
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/terracer/src/terracer/ReverseTerraceAction.java
r16626 r17388 82 82 // visit all the nodes in the way, adding the building's they're members of 83 83 // to the front. 84 for (Node n : w. nodes) {84 for (Node n : w.getNodes()) { 85 85 if (!visitedNodes.contains(n)) { 86 86 CollectBackReferencesVisitor v = new CollectBackReferencesVisitor(Main.main.getCurrentDataSet()); -
applications/editors/josm/plugins/terracer/src/terracer/TerracerAction.java
r16626 r17388 90 90 Way way = (Way)prim; 91 91 92 if ((way. nodes.size() >= 5) &&92 if ((way.getNodesCount() >= 5) && 93 93 way.isClosed()) { 94 94 // first ask the user how many buildings to terrace into … … 180 180 // Using Way.nodes.add rather than Way.addNode because the latter doesn't 181 181 // exist in older versions of JOSM. 182 terr. nodes.add(new_nodes[0][i]);183 terr. nodes.add(new_nodes[0][i+1]);184 terr. nodes.add(new_nodes[1][i+1]);185 terr. nodes.add(new_nodes[1][i]);186 terr. nodes.add(new_nodes[0][i]);182 terr.addNode(new_nodes[0][i]); 183 terr.addNode(new_nodes[0][i+1]); 184 terr.addNode(new_nodes[1][i+1]); 185 terr.addNode(new_nodes[1][i]); 186 terr.addNode(new_nodes[0][i]); 187 187 terr.put("addr:housenumber", "" + (from + i * step)); 188 188 terr.put("building", "yes"); … … 227 227 // sometimes there is a small overshoot due to numerical roundoff, so we just 228 228 // set these cases to be equal to the last node. its not pretty, but it works ;-) 229 n = w. nodes.get(w.nodes.size() - 1);229 n = w.getNode(w.getNodesCount() - 1); 230 230 } 231 231 return n; … … 281 281 Math.abs(sideness[side1] - sideness[side1 + 1]) < 0.001) { 282 282 side1 = side1 + 1; 283 side2 = (side2 + 1) % (w. nodes.size() - 1);283 side2 = (side2 + 1) % (w.getNodesCount() - 1); 284 284 } 285 285 … … 295 295 Way front = new Way(); 296 296 Way back = new Way(); 297 for (int i = side2 + 1; i < w. nodes.size() - 1; ++i) {298 front. nodes.add(w.nodes.get(i));297 for (int i = side2 + 1; i < w.getNodesCount() - 1; ++i) { 298 front.addNode(w.getNode(i)); 299 299 } 300 300 for (int i = 0; i <= side1; ++i) { 301 front. nodes.add(w.nodes.get(i));301 front.addNode(w.getNode(i)); 302 302 } 303 303 // add the back in reverse order so that the front and back ways point 304 304 // in the same direction. 305 305 for (int i = side2; i > side1; --i) { 306 back. nodes.add(w.nodes.get(i));306 back.addNode(w.getNode(i)); 307 307 } 308 308 … … 315 315 */ 316 316 private double sideLength(Way w, int i) { 317 Node a = w. nodes.get(i);318 Node b = w. nodes.get((i+1) % (w.nodes.size() - 1));317 Node a = w.getNode(i); 318 Node b = w.getNode((i+1) % (w.getNodesCount() - 1)); 319 319 return a.getCoor().greatCircleDistance(b.getCoor()); 320 320 } … … 363 363 */ 364 364 private double[] calculateSideness(Way w) { 365 final int length = w. nodes.size() - 1;365 final int length = w.getNodesCount() - 1; 366 366 double[] sideness = new double[length]; 367 367 368 368 sideness[0] = calculateSideness( 369 w. nodes.get(length - 1), w.nodes.get(0),370 w. nodes.get(1), w.nodes.get(2));369 w.getNode(length - 1), w.getNode(0), 370 w.getNode(1), w.getNode(2)); 371 371 for (int i = 1; i < length - 1; ++i) { 372 372 sideness[i] = calculateSideness( 373 w. nodes.get(i-1), w.nodes.get(i),374 w. nodes.get(i+1), w.nodes.get(i+2));373 w.getNode(i-1), w.getNode(i), 374 w.getNode(i+1), w.getNode(i+2)); 375 375 } 376 376 sideness[length-1] = calculateSideness( 377 w. nodes.get(length - 2), w.nodes.get(length - 1),378 w. nodes.get(length), w.nodes.get(1));377 w.getNode(length - 2), w.getNode(length - 1), 378 w.getNode(length), w.getNode(1)); 379 379 380 380 return sideness; … … 517 517 final TreeSet<String> names = new TreeSet<String>(); 518 518 for (OsmPrimitive osm : Main.main.getCurrentDataSet().allNonDeletedPrimitives()) { 519 if (osm. keys!= null &&520 osm.key s.containsKey("highway") &&521 osm.key s.containsKey("name")) {522 names.add(osm. keys.get("name"));519 if (osm.getKeys() != null && 520 osm.keySet().contains("highway") && 521 osm.keySet().contains("name")) { 522 names.add(osm.get("name")); 523 523 } 524 524 }
Note:
See TracChangeset
for help on using the changeset viewer.