Changeset 3382 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2010-07-23T21:27:18+02:00 (14 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/data/osm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/osm/DataSet.java
r3378 r3382 21 21 22 22 import org.openstreetmap.josm.data.SelectionChangedListener; 23 import org.openstreetmap.josm.data.coor.EastNorth; 23 24 import org.openstreetmap.josm.data.coor.LatLon; 24 25 import org.openstreetmap.josm.data.osm.event.AbstractDatasetChangedEvent; … … 804 805 } 805 806 806 private void reindexNode(Node node, LatLon newCoor ) {807 private void reindexNode(Node node, LatLon newCoor, EastNorth eastNorth) { 807 808 nodes.remove(node); 808 node.setCoorInternal(newCoor );809 node.setCoorInternal(newCoor, eastNorth); 809 810 nodes.add(node); 810 811 for (OsmPrimitive primitive: node.getReferrers()) { … … 932 933 } 933 934 934 void fireNodeMoved(Node node, LatLon newCoor ) {935 reindexNode(node, newCoor );935 void fireNodeMoved(Node node, LatLon newCoor, EastNorth eastNorth) { 936 reindexNode(node, newCoor, eastNorth); 936 937 fireEvent(new NodeMovedEvent(this, node)); 937 938 } -
trunk/src/org/openstreetmap/josm/data/osm/Node.java
r3348 r3382 2 2 package org.openstreetmap.josm.data.osm; 3 3 4 import org.openstreetmap.josm.Main;5 4 import org.openstreetmap.josm.data.coor.CachedLatLon; 6 5 import org.openstreetmap.josm.data.coor.EastNorth; … … 19 18 public final void setCoor(LatLon coor) { 20 19 if(coor != null){ 21 if (getDataSet() != null) { 22 boolean locked = writeLock(); 23 try { 24 getDataSet().fireNodeMoved(this, coor); 25 } finally { 26 writeUnlock(locked); 27 } 28 } else { 29 setCoorInternal(coor); 30 } 20 updateCoor(coor, null); 21 } 22 } 23 24 public final void setEastNorth(EastNorth eastNorth) { 25 if(eastNorth != null) { 26 updateCoor(null, eastNorth); 27 } 28 } 29 30 private void updateCoor(LatLon coor, EastNorth eastNorth) { 31 if (getDataSet() != null) { 32 boolean locked = writeLock(); 33 try { 34 getDataSet().fireNodeMoved(this, coor, eastNorth); 35 } finally { 36 writeUnlock(locked); 37 } 38 } else { 39 setCoorInternal(coor, eastNorth); 31 40 } 32 41 } … … 36 45 } 37 46 38 public final void setEastNorth(EastNorth eastNorth) {39 if(eastNorth != null) {40 setCoor(Main.proj.eastNorth2latlon(eastNorth));41 }42 }43 44 47 public final EastNorth getEastNorth() { 45 48 return coor != null ? coor.getEastNorth() : null; … … 49 52 * To be used only by Dataset.reindexNode 50 53 */ 51 protected void setCoorInternal(LatLon coor ) {54 protected void setCoorInternal(LatLon coor, EastNorth eastNorth) { 52 55 if(this.coor == null) { 53 this.coor = new CachedLatLon(coor); 56 if (eastNorth == null) { 57 this.coor = new CachedLatLon(coor); 58 } else { 59 this.coor = new CachedLatLon(eastNorth); 60 } 54 61 } else { 55 this.coor.setCoor(coor); 62 if (eastNorth == null) { 63 this.coor.setCoor(coor); 64 } else { 65 this.coor.setEastNorth(eastNorth); 66 } 56 67 } 57 68 }
Note:
See TracChangeset
for help on using the changeset viewer.