[josm-dev] Request to apply a small patch about the alignment in circle and rotate objects functions
Pieren
pieren3 at gmail.com
Tue Aug 5 18:51:23 BST 2008
Dear Josm-dev,
Could someone commit the following two changes regarding the features "align
nodes in circle" and "rotate objects" ?
As I said in a previous email, a node initialized with LatLon(0,0) may have
completely wrong EastNorth values (at least for the Lambert projection).
Here is the change in AlignInCircleAction.java (thank you Matthew):
Index: D:/
svn.openstreetmap.org/applications/editors/josm/core/src/org/openstreetmap/josm/actions/AlignInCircleAction.java
===================================================================
--- D:/
svn.openstreetmap.org/applications/editors/josm/core/src/org/openstreetmap/josm/actions/AlignInCircleAction.java
(revision 746)
+++ D:/
svn.openstreetmap.org/applications/editors/josm/core/src/org/openstreetmap/josm/actions/AlignInCircleAction.java
(working copy)
@@ -53,9 +53,9 @@
// Get average position of all nodes
Node avn = new Node(new LatLon(0,0));
+ avn.eastNorth = new EastNorth(0,0); // to be independent of the
projection system
for (Node n : nodes) {
avn.eastNorth = new
EastNorth(avn.eastNorth.east()+n.eastNorth.east(),
avn.eastNorth.north()+n.eastNorth.north());
- avn.coor = Main.proj.eastNorth2latlon(avn.eastNorth);
}
avn.eastNorth = new EastNorth(avn.eastNorth.east()/nodes.size(),
avn.eastNorth.north()/nodes.size());
avn.coor = Main.proj.eastNorth2latlon(avn.eastNorth);
And here is the change in RotateCommand.java (same cause with the same side
effect) :
Index: D:/
svn.openstreetmap.org/applications/editors/josm/core/src/org/openstreetmap/josm/command/RotateCommand.java
===================================================================
--- D:/
svn.openstreetmap.org/applications/editors/josm/core/src/org/openstreetmap/josm/command/RotateCommand.java
(revision 746)
+++ D:/
svn.openstreetmap.org/applications/editors/josm/core/src/org/openstreetmap/josm/command/RotateCommand.java
(working copy)
@@ -62,7 +62,7 @@
this.objects = AllNodesVisitor.getAllNodes(objects);
pivot = new Node(new LatLon(0,0));
-
+ pivot.eastNorth = new EastNorth(0,0); // to be independent of the
projection system
for (Node n : this.objects) {
MoveCommand.OldState os = new MoveCommand.OldState();
os.eastNorth = n.eastNorth;
@@ -70,7 +70,6 @@
os.modified = n.modified;
oldState.put(n, os);
pivot.eastNorth = new
EastNorth(pivot.eastNorth.east()+os.eastNorth.east(),
pivot.eastNorth.north()+os.eastNorth.north());
- pivot.coor = Main.proj.eastNorth2latlon(pivot.eastNorth);
}
pivot.eastNorth = new
EastNorth(pivot.eastNorth.east()/this.objects.size(),
pivot.eastNorth.north()/this.objects.size());
pivot.coor = Main.proj.eastNorth2latlon(pivot.eastNorth);
Thanks,
Pieren
More information about the josm-dev
mailing list