Changeset 1636 in josm for trunk/src/org/openstreetmap/josm/actions
- Timestamp:
- 2009-06-06T13:38:32+02:00 (15 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/actions
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/AlignInCircleAction.java
r1415 r1636 16 16 import org.openstreetmap.josm.command.SequenceCommand; 17 17 import org.openstreetmap.josm.data.coor.EastNorth; 18 import org.openstreetmap.josm.data.coor.LatLon;19 18 import org.openstreetmap.josm.data.osm.Node; 20 19 import org.openstreetmap.josm.data.osm.OsmPrimitive; … … 135 134 Collection<Node> nodes = new LinkedList<Node>(); 136 135 Collection<Way> ways = new LinkedList<Way>(); 137 Nodecenter = null;136 EastNorth center = null; 138 137 double radius = 0; 139 138 boolean regular = false; … … 164 163 } else { 165 164 166 center = ( Node) nodes.toArray()[way.nodes.contains(nodes.toArray()[0]) ? 1 : 0];165 center = ((Node) nodes.toArray()[way.nodes.contains(nodes.toArray()[0]) ? 1 : 0]).eastNorth; 167 166 if (nodes.size() == 2) 168 167 radius = distance(((Node) nodes.toArray()[0]).eastNorth, ((Node) nodes.toArray()[1]).eastNorth); … … 184 183 // Get average position of circumcircles of the triangles of all triplets of neighbour nodes 185 184 if (center == null) { 186 center = new Node(new LatLon(0, 0)); 187 center.eastNorth = new EastNorth(0, 0); // to be independent of projection 185 center = new EastNorth(0, 0); 188 186 Node n0 = (Node) nodes.toArray()[nodes.size() - 1]; 189 187 Node n1 = (Node) nodes.toArray()[nodes.size() - 2]; … … 196 194 if (cc == null) 197 195 return; 198 center .eastNorth = new EastNorth(center.eastNorth.east() + cc.east(), center.eastNorth.north()196 center = new EastNorth(center.east() + cc.east(), center.north() 199 197 + cc.north()); 200 198 } 201 199 202 center .eastNorth = new EastNorth(center.eastNorth.east() / nodes.size(), center.eastNorth.north()200 center = new EastNorth(center.east() / nodes.size(), center.north() 203 201 / nodes.size()); 204 center.coor = Main.proj.eastNorth2latlon(center.eastNorth);205 202 } 206 203 … … 212 209 if (radius == 0) { 213 210 for (Node n : nodes) { 214 radius += distance(center .eastNorth, n.eastNorth);211 radius += distance(center, n.eastNorth); 215 212 } 216 213 radius = radius / nodes.size(); … … 223 220 if (regular) { // Make a regular polygon 224 221 double angle = Math.PI * 2 / nodes.size(); 225 pc = new PolarCoor(((Node) nodes.toArray()[0]).eastNorth, center .eastNorth, 0);226 227 if (pc.angle > (new PolarCoor(((Node) nodes.toArray()[1]).eastNorth, center .eastNorth, 0).angle))222 pc = new PolarCoor(((Node) nodes.toArray()[0]).eastNorth, center, 0); 223 224 if (pc.angle > (new PolarCoor(((Node) nodes.toArray()[1]).eastNorth, center, 0).angle)) 228 225 angle *= -1; 229 226 … … 236 233 } else { // Move each node to that distance from the centre. 237 234 for (Node n : nodes) { 238 pc = new PolarCoor(n.eastNorth, center .eastNorth, 0);235 pc = new PolarCoor(n.eastNorth, center, 0); 239 236 pc.radius = radius; 240 237 EastNorth no = pc.toEastNorth(); -
trunk/src/org/openstreetmap/josm/actions/PasteAction.java
r1592 r1636 17 17 import org.openstreetmap.josm.command.Command; 18 18 import org.openstreetmap.josm.command.SequenceCommand; 19 import org.openstreetmap.josm.data.coor.EastNorth; 19 20 import org.openstreetmap.josm.data.osm.DataSet; 20 import org.openstreetmap.josm.data.osm.Relation;21 21 import org.openstreetmap.josm.data.osm.Node; 22 22 import org.openstreetmap.josm.data.osm.OsmPrimitive; 23 import org.openstreetmap.josm.data.osm.Relation; 23 24 import org.openstreetmap.josm.data.osm.RelationMember; 24 25 import org.openstreetmap.josm.data.osm.Way; 25 import org.openstreetmap.josm.data.coor.EastNorth;26 26 import org.openstreetmap.josm.gui.layer.Layer; 27 27 import org.openstreetmap.josm.tools.Shortcut; … … 70 70 nnew.id = 0; 71 71 if (Main.main.editLayer() == source) { 72 nnew.eastNorth = new EastNorth(nnew.eastNorth.east() + offsetEast, nnew.eastNorth.north() + offsetNorth); 73 nnew.coor = Main.proj.eastNorth2latlon(nnew.eastNorth); 72 nnew.setEastNorth(nnew.eastNorth.add(offsetEast, offsetNorth)); 74 73 } 75 74 map.put(n, nnew); -
trunk/src/org/openstreetmap/josm/actions/UnGlueAction.java
r1499 r1636 21 21 import org.openstreetmap.josm.command.Command; 22 22 import org.openstreetmap.josm.command.SequenceCommand; 23 import org.openstreetmap.josm.data.coor.EastNorth;24 23 import org.openstreetmap.josm.data.osm.Node; 25 24 import org.openstreetmap.josm.data.osm.OsmPrimitive; … … 149 148 if(e.getSource() instanceof JPanel) { 150 149 MapView mv = Main.map.mapView; 151 n.eastNorth = mv.getEastNorth(mv.lastMEvent.getX(), mv.lastMEvent.getY()); 152 n.coor = Main.proj.eastNorth2latlon(n.eastNorth); 150 n.setEastNorth(mv.getEastNorth(mv.lastMEvent.getX(), mv.lastMEvent.getY())); 153 151 } 154 152 -
trunk/src/org/openstreetmap/josm/actions/mapmode/DrawAction.java
r1545 r1636 801 801 // (for semi-parallel lines, intersection might be miles away!) 802 802 if (Main.map.mapView.getPoint(n.eastNorth).distance(Main.map.mapView.getPoint(intersection)) < snapToIntersectionThreshold) { 803 n. eastNorth = intersection;803 n.setEastNorth(intersection); 804 804 return; 805 805 } … … 814 814 double c = A.distanceSq(B); 815 815 q = (a - b + c) / (2*c); 816 n.eastNorth = new EastNorth( 817 B.east() + q * (A.east() - B.east()), 818 B.north() + q * (A.north() - B.north())); 816 n.setEastNorth(B.east() + q * (A.east() - B.east()), B.north() + q * (A.north() - B.north())); 819 817 } 820 818 }
Note:
See TracChangeset
for help on using the changeset viewer.