Changeset 2437 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2009-11-11T08:34:56+01:00 (15 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/data/osm
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/osm/DataSet.java
r2419 r2437 768 768 } 769 769 770 void reindexNode(Node node) {770 private void reindexNode(Node node) { 771 771 nodes.remove(node); 772 772 nodes.add(node); 773 773 for (Way way:OsmPrimitive.getFilteredList(node.getReferrers(), Way.class)) { 774 774 ways.remove(way); 775 way.updatePosition(); 775 776 ways.add(way); 776 777 } 777 778 } 778 779 779 void reindexWay(Way way) {780 private void reindexWay(Way way) { 780 781 ways.remove(way); 781 782 ways.add(way); 783 } 784 785 public void fireNodeMoved(Node node) { 786 // TODO Fire event 787 reindexNode(node); 788 } 789 790 public void fireWayNodesChanged(Way way) { 791 // TODO Fire event 792 reindexWay(way); 782 793 } 783 794 -
trunk/src/org/openstreetmap/josm/data/osm/Node.java
r2427 r2437 25 25 } 26 26 if (getDataSet() != null) { 27 getDataSet(). reindexNode(this);27 getDataSet().fireNodeMoved(this); 28 28 } 29 29 } … … 43 43 } 44 44 if (getDataSet() != null) { 45 getDataSet(). reindexNode(this);45 getDataSet().fireNodeMoved(this); 46 46 } 47 47 } … … 177 177 } 178 178 179 @Override 179 180 public BBox getBBox() { 180 181 if (coor == null) … … 183 184 return new BBox(coor, coor); 184 185 } 186 187 @Override 188 public void updatePosition() { 189 // Do nothing for now, but in future replace CachedLatLon with simple doubles and update precalculated EastNorth value here 190 } 185 191 } -
trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java
r2427 r2437 1010 1010 public abstract BBox getBBox(); 1011 1011 1012 /** 1013 * Called by Dataset to update cached position information of primitive (bbox, cached EarthNorth, ...) 1014 */ 1015 public abstract void updatePosition(); 1016 1012 1017 } 1013 1018 -
trunk/src/org/openstreetmap/josm/data/osm/QuadBuckets.java
r2430 r2437 206 206 { 207 207 init(parent); 208 }209 String quads(T o)210 {211 if (o instanceof Node) {212 LatLon coor = ((Node)o).getCoor();213 if (coor == null)214 return "null node coordinates";215 return Long.toHexString(QuadTiling.quadTile(coor));216 }217 return "Way??";218 208 } 219 209 synchronized boolean remove_content(T o) … … 302 292 QBLevel child = children[new_index]; 303 293 if (debug) { 304 out("putting "+o+"(q:"+ quads(o)+") into ["+new_index+"] " + child.bbox());294 out("putting "+o+"(q:"+Long.toHexString(QuadTiling.quadTile(o.getBBox().points().get(0)))+") into ["+new_index+"] " + child.bbox()); 305 295 } 306 296 child.add(o); -
trunk/src/org/openstreetmap/josm/data/osm/Relation.java
r2427 r2437 330 330 return new BBox(0, 0, 0, 0); 331 331 } 332 333 @Override 334 public void updatePosition() { 335 // Do nothing for now 336 } 332 337 } -
trunk/src/org/openstreetmap/josm/data/osm/Way.java
r2427 r2437 26 26 */ 27 27 private Node[] nodes = new Node[0]; 28 private BBox bbox; 28 29 29 30 /** … … 60 61 61 62 clearCached(); 62 reindex();63 fireNodesChanged(); 63 64 } 64 65 … … 289 290 newNodes[nodes.length] = n; 290 291 nodes = newNodes; 291 reindex();292 fireNodesChanged(); 292 293 } 293 294 … … 312 313 newNodes[offs] = n; 313 314 nodes = newNodes; 314 reindex();315 fireNodesChanged(); 315 316 } 316 317 … … 324 325 } 325 326 } 326 reindex();327 fireNodesChanged(); 327 328 super.setDeleted(deleted); 328 329 } … … 358 359 } 359 360 360 private void reindex() {361 private void fireNodesChanged() { 361 362 if (getDataSet() != null) { 362 getDataSet(). reindexWay(this);363 getDataSet().fireWayNodesChanged(this); 363 364 } 364 365 } … … 366 367 @Override 367 368 public BBox getBBox() { 368 // TODO Precalculate way bbox (and update it every time nodes are moved or edited) 369 return new BBox(this); 369 if (getDataSet() == null) 370 return new BBox(this); 371 if (bbox == null) { 372 bbox = new BBox(this); 373 } 374 return bbox; 375 } 376 377 @Override 378 public void updatePosition() { 379 bbox = new BBox(this); 370 380 } 371 381 }
Note:
See TracChangeset
for help on using the changeset viewer.