Changeset 312 in josm for src/org/openstreetmap/josm
- Timestamp:
- 2007-08-23T15:59:32+02:00 (17 years ago)
- Location:
- src/org/openstreetmap/josm
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
src/org/openstreetmap/josm/actions/mapmode/MoveAction.java
r311 r312 15 15 import org.openstreetmap.josm.Main; 16 16 import org.openstreetmap.josm.actions.GroupAction; 17 import org.openstreetmap.josm.actions.mapmode.AddNodeAction.Mode;18 17 import org.openstreetmap.josm.command.Command; 19 18 import org.openstreetmap.josm.command.MoveCommand; … … 120 119 121 120 // when rotating, having only one node makes no sense - quit silently 122 if (affectedNodes.size() < 2 && mode == Mode.move)121 if (mode == Mode.rotate && affectedNodes.size() < 2) 123 122 return; 124 123 -
src/org/openstreetmap/josm/command/MoveCommand.java
r307 r312 5 5 import static org.openstreetmap.josm.tools.I18n.trn; 6 6 7 import java.util.Arrays;8 7 import java.util.Collection; 9 8 import java.util.Collections; … … 47 46 * Small helper for holding the interesting part of the old data state of the 48 47 * objects. 49 * @author imi50 48 */ 51 class OldState 52 {53 double x,y,lat,lon;49 public static class OldState { 50 LatLon latlon; 51 EastNorth eastNorth; 54 52 boolean modified; 55 53 } 54 56 55 /** 57 56 * List of all old states of the objects. … … 72 71 for (Node n : this.objects) { 73 72 OldState os = new OldState(); 74 os.x = n.eastNorth.east(); 75 os.y = n.eastNorth.north(); 76 os.lat = n.coor.lat(); 77 os.lon = n.coor.lon(); 73 os.eastNorth = n.eastNorth; 74 os.latlon = n.coor; 78 75 os.modified = n.modified; 79 76 oldState.add(os); … … 110 107 for (Node n : objects) { 111 108 OldState os = it.next(); 112 n.eastNorth = new EastNorth(os.x, os.y);113 n.coor = new LatLon(os.lat, os.lon);109 n.eastNorth = os.eastNorth; 110 n.coor = os.latlon; 114 111 n.modified = os.modified; 115 112 } -
src/org/openstreetmap/josm/command/RotateCommand.java
r311 r312 4 4 import static org.openstreetmap.josm.tools.I18n.trn; 5 5 6 import java.util.Arrays;7 6 import java.util.Collection; 8 7 import java.util.HashMap; 9 import java.util.Iterator;10 8 import java.util.LinkedList; 11 import java.util.List;12 9 import java.util.Map; 13 10 … … 17 14 18 15 import org.openstreetmap.josm.Main; 19 import org.openstreetmap.josm.command.MoveCommand.OldState;20 16 import org.openstreetmap.josm.data.coor.EastNorth; 21 17 import org.openstreetmap.josm.data.coor.LatLon; … … 53 49 54 50 /** 55 * Small helper for holding the interesting part of the old data state of the56 * objects.57 */58 class OldState59 {60 double x,y,lat,lon;61 boolean modified;62 Node originalNode;63 }64 65 /**66 51 * List of all old states of the objects. 67 52 */ 68 private Map<Node, OldState> oldState = new HashMap<Node, OldState>(); 53 private Map<Node, MoveCommand.OldState> oldState = new HashMap<Node, MoveCommand.OldState>(); 69 54 70 55 /** … … 80 65 81 66 for (Node n : this.objects) { 82 OldState os = new OldState(); 83 os.x = n.eastNorth.east(); 84 os.y = n.eastNorth.north(); 85 os.lat = n.coor.lat(); 86 os.lon = n.coor.lon(); 67 MoveCommand.OldState os = new MoveCommand.OldState(); 68 os.eastNorth = n.eastNorth; 69 os.latlon = n.coor; 87 70 os.modified = n.modified; 88 71 oldState.put(n, os); 89 pivot.eastNorth = new EastNorth(pivot.eastNorth.east()+os. x, pivot.eastNorth.north()+os.y);72 pivot.eastNorth = new EastNorth(pivot.eastNorth.east()+os.eastNorth.east(), pivot.eastNorth.north()+os.eastNorth.north()); 90 73 pivot.coor = Main.proj.eastNorth2latlon(pivot.eastNorth); 91 74 } … … 118 101 double cosPhi = Math.cos(rotationAngle); 119 102 double sinPhi = Math.sin(rotationAngle); 120 double x = oldState.get(n).x - pivot.eastNorth.east(); 121 double y = oldState.get(n).y - pivot.eastNorth.north(); 103 EastNorth oldEastNorth = oldState.get(n).eastNorth; 104 double x = oldEastNorth.east() - pivot.eastNorth.east(); 105 double y = oldEastNorth.north() - pivot.eastNorth.north(); 122 106 double nx = sinPhi * x + cosPhi * y + pivot.eastNorth.east(); 123 107 double ny = -cosPhi * x + sinPhi * y + pivot.eastNorth.north(); 124 108 n.eastNorth = new EastNorth(nx, ny); 125 109 n.coor = Main.proj.eastNorth2latlon(n.eastNorth); 126 if (setModified) n.modified = true; 110 if (setModified) 111 n.modified = true; 127 112 } 128 113 } … … 134 119 @Override public void undoCommand() { 135 120 for (Node n : objects) { 136 OldState os = oldState.get(n); 137 n.eastNorth = new EastNorth(os.x, os.y);138 n.coor = new LatLon(os.lat, os.lon);121 MoveCommand.OldState os = oldState.get(n); 122 n.eastNorth = os.eastNorth; 123 n.coor = os.latlon; 139 124 n.modified = os.modified; 140 125 } -
src/org/openstreetmap/josm/gui/GettingStarted.java
r298 r312 48 48 panel = new JPanel(new GridBagLayout()); 49 49 50 panel.add(new JLabel("<html><h2>You are running a beta version with a brand new feature <i>multiple data layers</i>.</h2>" +51 "<h3>This is a major change, so expect some bugs, especally with undo/redo and the merging code.<br>" +52 "If you can't work, downgrade to josm-1.5.jar, available at http://josm.openstreetmap.org/download/josm-1.5.jar<br><br>" +53 "Imi.</h3>"), GBC.eol());54 55 50 addGettingStarted(); 56 51 addGettingHelp(); -
src/org/openstreetmap/josm/gui/MapFrame.java
r311 r312 18 18 import org.openstreetmap.josm.actions.mapmode.DeleteAction; 19 19 import org.openstreetmap.josm.actions.mapmode.MapMode; 20 import org.openstreetmap.josm.actions.mapmode.MoveAction;21 20 import org.openstreetmap.josm.actions.mapmode.SelectionAction; 22 21 import org.openstreetmap.josm.actions.mapmode.ZoomAction; -
src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java
r303 r312 108 108 */ 109 109 public boolean uploadedModified = false; 110 /**111 * Whether the data (or pieces of the data) was loaded from disk rather than from112 * the server directly. This affects the modified state.113 */114 private boolean fromDisk = false;115 110 116 111 public final LinkedList<ModifiedChangedListener> listenerModified = new LinkedList<ModifiedChangedListener>(); … … 124 119 super(name); 125 120 this.data = data; 126 this.fromDisk = associatedFile != null;127 121 this.associatedFile = associatedFile; 128 122 } … … 235 229 236 230 // update the modified flag 237 if ( fromDisk&& processed != null && !dataAdded)231 if (associatedFile != null && processed != null && !dataAdded) 238 232 return; // do nothing when uploading non-harmful changes. 239 233 240 234 // modified if server changed the data (esp. the id). 241 uploadedModified = fromDisk&& processed != null && dataAdded;235 uploadedModified = associatedFile != null && processed != null && dataAdded; 242 236 setModified(uploadedModified); 243 237 }
Note:
See TracChangeset
for help on using the changeset viewer.