Request to apply a small patch about the alignment in circle and rotate objects functions

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Request to apply a small patch about the alignment in circle and rotate objects functions

Pieren
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
_______________________________________________
josm-dev mailing list
[hidden email]
http://lists.openstreetmap.org/listinfo/josm-dev
Reply | Threaded
Open this post in threaded view
|

Re: Request to apply a small patch about the alignment in circle and rotate objects functions

Dirk Stöcker
On Tue, 5 Aug 2008, Pieren wrote:

> Could someone commit the following two changes regarding the features "align
> nodes in circle" and "rotate objects" ?

Applied.

Please do never attach plain text in normal mail body. The patch will not
succeed due to changes the mail program does to the text.

Ciao
--
http://www.dstoecker.eu/ (PGP key available)

_______________________________________________
josm-dev mailing list
[hidden email]
http://lists.openstreetmap.org/listinfo/josm-dev