Ticket #2302: getcoor.patch
File getcoor.patch, 43.9 KB (added by , 15 years ago) |
---|
-
src/org/openstreetmap/josm/io/OsmWriter.java
97 97 public void visit(Node n) { 98 98 if (n.incomplete) return; 99 99 addCommon(n, "node"); 100 out.print(" lat='"+n. coor.lat()+"' lon='"+n.coor.lon()+"'");100 out.print(" lat='"+n.getCoor().lat()+"' lon='"+n.getCoor().lon()+"'"); 101 101 if (!withBody) { 102 102 out.println("/>"); 103 103 } else { -
src/org/openstreetmap/josm/actions/DistributeAction.java
69 69 for (Node n : nodes) { 70 70 itnodes.remove(n); 71 71 for (Node m : itnodes) { 72 double dist = Math.sqrt(n. eastNorth.distance(m.eastNorth));72 double dist = Math.sqrt(n.getEastNorth().distance(m.getEastNorth())); 73 73 if (dist > distance) { 74 74 nodea = n; 75 75 nodeb = m; … … 83 83 nodes.remove(nodeb); 84 84 85 85 // Find out co-ords of A and B 86 double ax = nodea. eastNorth.east();87 double ay = nodea. eastNorth.north();88 double bx = nodeb. eastNorth.east();89 double by = nodeb. eastNorth.north();86 double ax = nodea.getEastNorth().east(); 87 double ay = nodea.getEastNorth().north(); 88 double bx = nodeb.getEastNorth().east(); 89 double by = nodeb.getEastNorth().north(); 90 90 91 91 // A list of commands to do 92 92 Collection<Command> cmds = new LinkedList<Command>(); … … 103 103 // Find the node that is furthest from B (i.e. closest to A) 104 104 distance = 0.0; 105 105 for (Node n : nodes) { 106 double dist = Math.sqrt(nodeb. eastNorth.distance(n.eastNorth));106 double dist = Math.sqrt(nodeb.getEastNorth().distance(n.getEastNorth())); 107 107 if (dist > distance) { 108 108 s = n; 109 109 distance = dist; … … 111 111 } 112 112 113 113 // First move the node to A's position, then move it towards B 114 double dx = ax - s. eastNorth.east() + (bx-ax)*pos/num;115 double dy = ay - s. eastNorth.north() + (by-ay)*pos/num;114 double dx = ax - s.getEastNorth().east() + (bx-ax)*pos/num; 115 double dy = ay - s.getEastNorth().north() + (by-ay)*pos/num; 116 116 117 117 cmds.add(new MoveCommand(s, dx, dy)); 118 118 -
src/org/openstreetmap/josm/actions/OrthogonalizeAction.java
80 80 for (int i1=0; i1 < way.nodes.size()-1; i1++) { 81 81 int i2 = (i1+1) % (way.nodes.size()-1); 82 82 int i3 = (i1+2) % (way.nodes.size()-1); 83 double angle1 =Math.abs(way.nodes.get(i1). eastNorth.heading(way.nodes.get(i2).eastNorth));84 double angle2 = Math.abs(way.nodes.get(i2). eastNorth.heading(way.nodes.get(i3).eastNorth));83 double angle1 =Math.abs(way.nodes.get(i1).getEastNorth().heading(way.nodes.get(i2).getEastNorth())); 84 double angle2 = Math.abs(way.nodes.get(i2).getEastNorth().heading(way.nodes.get(i3).getEastNorth())); 85 85 double delta = Math.abs(angle2 - angle1); 86 86 while(delta > Math.PI) delta -= Math.PI; 87 87 if(delta < Math.PI/4) { … … 116 116 if (dirnodes.size() == 2) { 117 117 // When selection contains two nodes, use the nodes to compute a direction 118 118 // to align all ways to 119 align_to_heading = normalize_angle(dirnodes.get(0). eastNorth.heading(dirnodes.get(1).eastNorth));119 align_to_heading = normalize_angle(dirnodes.get(0).getEastNorth().heading(dirnodes.get(1).getEastNorth())); 120 120 use_dirnodes = true; 121 121 } 122 122 … … 130 130 // Copy necessary data into a more suitable data structure 131 131 EastNorth en[] = new EastNorth[sides]; 132 132 for (int i=0; i < sides; i++) { 133 en[i] = new EastNorth(way.nodes.get(i). eastNorth.east(), way.nodes.get(i).eastNorth.north());133 en[i] = new EastNorth(way.nodes.get(i).getEastNorth().east(), way.nodes.get(i).getEastNorth().north()); 134 134 } 135 135 136 136 if (! use_dirnodes) { … … 141 141 double headings[] = new double[sides]; 142 142 double weights[] = new double[sides]; 143 143 for (int i=0; i < sides; i++) { 144 headings[i] = normalize_angle(way.nodes.get(i). eastNorth.heading(way.nodes.get(i+1).eastNorth));145 weights[i] = way.nodes.get(i). eastNorth.distance(way.nodes.get(i+1).eastNorth);144 headings[i] = normalize_angle(way.nodes.get(i).getEastNorth().heading(way.nodes.get(i+1).getEastNorth())); 145 weights[i] = way.nodes.get(i).getEastNorth().distance(way.nodes.get(i+1).getEastNorth()); 146 146 } 147 147 148 148 // CAVEAT: for orientations near -PI/4 or PI/4 the mapping into ONE orientation fails … … 231 231 Node n = way.nodes.get(i2); 232 232 233 233 LatLon ill = Main.proj.eastNorth2latlon(intersection); 234 if (!ill.equalsEpsilon(n. coor)) {235 double dx = intersection.east()-n. eastNorth.east();236 double dy = intersection.north()-n. eastNorth.north();234 if (!ill.equalsEpsilon(n.getCoor())) { 235 double dx = intersection.east()-n.getEastNorth().east(); 236 double dy = intersection.north()-n.getEastNorth().north(); 237 237 cmds.add(new MoveCommand(n, dx, dy)); 238 238 } 239 239 } -
src/org/openstreetmap/josm/actions/mapmode/DrawAction.java
331 331 } else { 332 332 // no node found in clicked area 333 333 n = new Node(Main.map.mapView.getLatLon(e.getX(), e.getY())); 334 if (n. coor.isOutSideWorld()) {334 if (n.getCoor().isOutSideWorld()) { 335 335 JOptionPane.showMessageDialog(Main.parent, 336 336 tr("Cannot add a node outside of the world.")); 337 337 return; … … 646 646 if (currentMouseNode != null) { 647 647 // user clicked on node 648 648 if (selection.isEmpty()) return; 649 currentMouseEastNorth = currentMouseNode. eastNorth;649 currentMouseEastNorth = currentMouseNode.getEastNorth(); 650 650 mouseOnExistingNode = currentMouseNode; 651 651 } else { 652 652 // no node found in clicked area … … 689 689 690 690 // find out the distance, in metres, between the base point and the mouse cursor 691 691 LatLon mouseLatLon = Main.proj.eastNorth2latlon(currentMouseEastNorth); 692 distance = currentBaseNode. coor.greatCircleDistance(mouseLatLon);693 double hdg = Math.toDegrees(currentBaseNode. coor.heading(mouseLatLon));692 distance = currentBaseNode.getCoor().greatCircleDistance(mouseLatLon); 693 double hdg = Math.toDegrees(currentBaseNode.getCoor().heading(mouseLatLon)); 694 694 if (previousNode != null) { 695 angle = hdg - Math.toDegrees(previousNode. coor.heading(currentBaseNode.coor));695 angle = hdg - Math.toDegrees(previousNode.getCoor().heading(currentBaseNode.getCoor())); 696 696 if (angle < 0) angle += 360; 697 697 } 698 698 Main.map.statusLine.setAngle(angle); … … 771 771 // the two segments and adjusts the node position. 772 772 Iterator<Pair<Node,Node>> i = segs.iterator(); 773 773 Pair<Node,Node> seg = i.next(); 774 EastNorth A = seg.a. eastNorth;775 EastNorth B = seg.b. eastNorth;774 EastNorth A = seg.a.getEastNorth(); 775 EastNorth B = seg.b.getEastNorth(); 776 776 seg = i.next(); 777 EastNorth C = seg.a. eastNorth;778 EastNorth D = seg.b. eastNorth;777 EastNorth C = seg.a.getEastNorth(); 778 EastNorth D = seg.b.getEastNorth(); 779 779 780 780 double u=det(B.east() - A.east(), B.north() - A.north(), C.east() - D.east(), C.north() - D.north()); 781 781 … … 799 799 // only adjust to intersection if within snapToIntersectionThreshold pixel of mouse click; otherwise 800 800 // fall through to default action. 801 801 // (for semi-parallel lines, intersection might be miles away!) 802 if (Main.map.mapView.getPoint(n. eastNorth).distance(Main.map.mapView.getPoint(intersection)) < snapToIntersectionThreshold) {802 if (Main.map.mapView.getPoint(n.getEastNorth()).distance(Main.map.mapView.getPoint(intersection)) < snapToIntersectionThreshold) { 803 803 n.setEastNorth(intersection); 804 804 return; 805 805 } 806 806 807 807 default: 808 EastNorth P = n. eastNorth;808 EastNorth P = n.getEastNorth(); 809 809 seg = segs.iterator().next(); 810 A = seg.a. eastNorth;811 B = seg.b. eastNorth;810 A = seg.a.getEastNorth(); 811 B = seg.b.getEastNorth(); 812 812 double a = P.distanceSq(B); 813 813 double b = P.distanceSq(A); 814 814 double c = A.distanceSq(B); … … 839 839 g2.setColor(selectedColor); 840 840 g2.setStroke(new BasicStroke(3, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND)); 841 841 GeneralPath b = new GeneralPath(); 842 Point p1=mv.getPoint(currentBaseNode. eastNorth);842 Point p1=mv.getPoint(currentBaseNode.getEastNorth()); 843 843 Point p2=mv.getPoint(currentMouseEastNorth); 844 844 845 845 double t = Math.atan2(p2.y-p1.y, p2.x-p1.x) + Math.PI; -
src/org/openstreetmap/josm/actions/mapmode/ExtrudeAction.java
154 154 Node n1 = selectedSegment.way.nodes.get(selectedSegment.lowerIndex); 155 155 Node n2 = selectedSegment.way.nodes.get(selectedSegment.lowerIndex + 1); 156 156 157 EastNorth en1 = n1. eastNorth;158 EastNorth en2 = n2. eastNorth;157 EastNorth en1 = n1.getEastNorth(); 158 EastNorth en2 = n2.getEastNorth(); 159 159 EastNorth en3 = mv.getEastNorth(mousePos.x, mousePos.y); 160 160 161 161 double u = ((en3.east() - en1.east()) * (en2.east() - en1.east()) + … … 233 233 if (mousePos.distance(initialMousePos) > 10) { 234 234 Node n1 = selectedSegment.way.nodes.get(selectedSegment.lowerIndex); 235 235 Node n2 = selectedSegment.way.nodes.get(selectedSegment.lowerIndex+1); 236 EastNorth en3 = n2. eastNorth.add(xoff, yoff);236 EastNorth en3 = n2.getEastNorth().add(xoff, yoff); 237 237 Node n3 = new Node(Main.proj.eastNorth2latlon(en3)); 238 EastNorth en4 = n1. eastNorth.add(xoff, yoff);238 EastNorth en4 = n1.getEastNorth().add(xoff, yoff); 239 239 Node n4 = new Node(Main.proj.eastNorth2latlon(en4)); 240 240 Way wnew = new Way(selectedSegment.way); 241 241 wnew.addNode(selectedSegment.lowerIndex+1, n3); -
src/org/openstreetmap/josm/actions/mapmode/SelectAction.java
223 223 c = new MoveCommand(selection, dx, dy)); 224 224 225 225 for (Node n : affectedNodes) { 226 if (n. coor.isOutSideWorld()) {226 if (n.getCoor().isOutSideWorld()) { 227 227 // Revert move 228 228 ((MoveCommand) c).moveAgain(-dx, -dy); 229 229 … … 279 279 if(Main.pref.getInteger("mappaint.node.virtual-size", 8) > 0) 280 280 { 281 281 Way w = (Way)osm; 282 Point p1 = c.getPoint(w.nodes.get(nearestWS.lowerIndex). eastNorth);283 Point p2 = c.getPoint(w.nodes.get(nearestWS.lowerIndex+1). eastNorth);282 Point p1 = c.getPoint(w.nodes.get(nearestWS.lowerIndex).getEastNorth()); 283 Point p2 = c.getPoint(w.nodes.get(nearestWS.lowerIndex+1).getEastNorth()); 284 284 if(SimplePaintVisitor.isLargeSegment(p1, p2, Main.pref.getInteger("mappaint.node.virtual-space", 70))) 285 285 { 286 286 Point pc = new Point((p1.x+p2.x)/2, (p1.y+p2.y)/2); -
src/org/openstreetmap/josm/actions/PasteAction.java
42 42 /* Find the middle of the pasteBuffer area */ 43 43 double maxEast = -1E100, minEast = 1E100, maxNorth = -1E100, minNorth = 1E100; 44 44 for (Node n : pasteBuffer.nodes) { 45 double east = n. eastNorth.east();46 double north = n. eastNorth.north();45 double east = n.getEastNorth().east(); 46 double north = n.getEastNorth().north(); 47 47 if (east > maxEast) { maxEast = east; } 48 48 if (east < minEast) { minEast = east; } 49 49 if (north > maxNorth) { maxNorth = north; } … … 69 69 Node nnew = new Node(n); 70 70 nnew.id = 0; 71 71 if (Main.main.editLayer() == source) { 72 nnew.setEastNorth(nnew. eastNorth.add(offsetEast, offsetNorth));72 nnew.setEastNorth(nnew.getEastNorth().add(offsetEast, offsetNorth)); 73 73 } 74 74 map.put(n, nnew); 75 75 } -
src/org/openstreetmap/josm/actions/JoinNodeWayAction.java
36 36 Node node = (Node) sel.iterator().next(); 37 37 38 38 List<WaySegment> wss = Main.map.mapView.getNearestWaySegments( 39 Main.map.mapView.getPoint(node. eastNorth));39 Main.map.mapView.getPoint(node.getEastNorth())); 40 40 HashMap<Way, List<Integer>> insertPoints = new HashMap<Way, List<Integer>>(); 41 41 for (WaySegment ws : wss) { 42 42 List<Integer> is; -
src/org/openstreetmap/josm/actions/MoveAction.java
98 98 c = new MoveCommand(selection, distx, disty)); 99 99 100 100 for (Node n : affectedNodes) { 101 if (n. coor.isOutSideWorld()) {101 if (n.getCoor().isOutSideWorld()) { 102 102 // Revert move 103 103 ((MoveCommand) c).moveAgain(-distx, -disty); 104 104 JOptionPane.showMessageDialog(Main.parent, -
src/org/openstreetmap/josm/actions/AlignInCircleAction.java
88 88 EastNorth result = new EastNorth(bx / (2 * a) + i.east(), -by / (2 * a) + i.north()); 89 89 90 90 Node n = new Node(Main.proj.eastNorth2latlon(result)); 91 if (n. coor.isOutSideWorld()) {91 if (n.getCoor().isOutSideWorld()) { 92 92 JOptionPane.showMessageDialog(Main.parent, tr("Some of the nodes are (almost) in the line")); 93 93 return null; 94 94 } … … 162 162 regular = true; 163 163 } else { 164 164 165 center = ((Node) nodes.toArray()[way.nodes.contains(nodes.toArray()[0]) ? 1 : 0]). eastNorth;165 center = ((Node) nodes.toArray()[way.nodes.contains(nodes.toArray()[0]) ? 1 : 0]).getEastNorth(); 166 166 if (nodes.size() == 2) 167 radius = distance(((Node) nodes.toArray()[0]). eastNorth, ((Node) nodes.toArray()[1]).eastNorth);167 radius = distance(((Node) nodes.toArray()[0]).getEastNorth(), ((Node) nodes.toArray()[1]).getEastNorth()); 168 168 } 169 169 nodes = new LinkedList<Node>(); 170 170 } … … 190 190 n2 = n1; 191 191 n1 = n0; 192 192 n0 = n; 193 EastNorth cc = circumcenter(n0. eastNorth, n1.eastNorth, n2.eastNorth);193 EastNorth cc = circumcenter(n0.getEastNorth(), n1.getEastNorth(), n2.getEastNorth()); 194 194 if (cc == null) 195 195 return; 196 196 center = new EastNorth(center.east() + cc.east(), center.north() … … 208 208 // relative to the distance from the N or S poles. 209 209 if (radius == 0) { 210 210 for (Node n : nodes) { 211 radius += distance(center, n. eastNorth);211 radius += distance(center, n.getEastNorth()); 212 212 } 213 213 radius = radius / nodes.size(); 214 214 } … … 219 219 220 220 if (regular) { // Make a regular polygon 221 221 double angle = Math.PI * 2 / nodes.size(); 222 pc = new PolarCoor(((Node) nodes.toArray()[0]). eastNorth, center, 0);222 pc = new PolarCoor(((Node) nodes.toArray()[0]).getEastNorth(), center, 0); 223 223 224 if (pc.angle > (new PolarCoor(((Node) nodes.toArray()[1]). eastNorth, center, 0).angle))224 if (pc.angle > (new PolarCoor(((Node) nodes.toArray()[1]).getEastNorth(), center, 0).angle)) 225 225 angle *= -1; 226 226 227 227 pc.radius = radius; 228 228 for (Node n : nodes) { 229 229 EastNorth no = pc.toEastNorth(); 230 cmds.add(new MoveCommand(n, no.east() - n. eastNorth.east(), no.north() - n.eastNorth.north()));230 cmds.add(new MoveCommand(n, no.east() - n.getEastNorth().east(), no.north() - n.getEastNorth().north())); 231 231 pc.angle += angle; 232 232 } 233 233 } else { // Move each node to that distance from the centre. 234 234 for (Node n : nodes) { 235 pc = new PolarCoor(n. eastNorth, center, 0);235 pc = new PolarCoor(n.getEastNorth(), center, 0); 236 236 pc.radius = radius; 237 237 EastNorth no = pc.toEastNorth(); 238 cmds.add(new MoveCommand(n, no.east() - n. eastNorth.east(), no.north() - n.eastNorth.north()));238 cmds.add(new MoveCommand(n, no.east() - n.getEastNorth().east(), no.north() - n.getEastNorth().north())); 239 239 } 240 240 } 241 241 -
src/org/openstreetmap/josm/actions/AlignInLineAction.java
70 70 for (Node n : nodes) { 71 71 itnodes.remove(n); 72 72 for (Node m : itnodes) { 73 double dist = Math.sqrt(n. eastNorth.distance(m.eastNorth));73 double dist = Math.sqrt(n.getEastNorth().distance(m.getEastNorth())); 74 74 if (dist > distance) { 75 75 nodea = n; 76 76 nodeb = m; … … 84 84 nodes.remove(nodeb); 85 85 86 86 // Find out co-ords of A and B 87 double ax = nodea. eastNorth.east();88 double ay = nodea. eastNorth.north();89 double bx = nodeb. eastNorth.east();90 double by = nodeb. eastNorth.north();87 double ax = nodea.getEastNorth().east(); 88 double ay = nodea.getEastNorth().north(); 89 double bx = nodeb.getEastNorth().east(); 90 double by = nodeb.getEastNorth().north(); 91 91 92 92 // A list of commands to do 93 93 Collection<Command> cmds = new LinkedList<Command>(); … … 95 95 // OK, for each node to move, work out where to move it! 96 96 for (Node n : nodes) { 97 97 // Get existing co-ords of node to move 98 double nx = n. eastNorth.east();99 double ny = n. eastNorth.north();98 double nx = n.getEastNorth().east(); 99 double ny = n.getEastNorth().north(); 100 100 101 101 if (ax == bx) { 102 102 // Special case if AB is vertical... … … 109 109 double m1 = (by - ay) / (bx - ax); 110 110 double c1 = ay - (ax * m1); 111 111 double m2 = (-1) / m1; 112 double c2 = n. eastNorth.north() - (n.eastNorth.east() * m2);112 double c2 = n.getEastNorth().north() - (n.getEastNorth().east() * m2); 113 113 114 114 nx = (c2 - c1) / (m1 - m2); 115 115 ny = (m1 * nx) + c1; 116 116 } 117 117 118 118 // Add the command to move the node to its new position. 119 cmds.add(new MoveCommand(n, nx - n. eastNorth.east(), ny - n.eastNorth.north() ));119 cmds.add(new MoveCommand(n, nx - n.getEastNorth().east(), ny - n.getEastNorth().north() )); 120 120 } 121 121 122 122 // Do it! -
src/org/openstreetmap/josm/actions/CreateCircleAction.java
104 104 105 105 // let's get some shorter names 106 106 Node n1 = ((Node)nodes.toArray()[0]); 107 double x1 = n1. eastNorth.east();108 double y1 = n1. eastNorth.north();107 double x1 = n1.getEastNorth().east(); 108 double y1 = n1.getEastNorth().north(); 109 109 Node n2 = ((Node)nodes.toArray()[1]); 110 double x2 = n2. eastNorth.east();111 double y2 = n2. eastNorth.north();110 double x2 = n2.getEastNorth().east(); 111 double y2 = n2.getEastNorth().north(); 112 112 Node n3 = ((Node)nodes.toArray()[2]); 113 double x3 = n3. eastNorth.east();114 double y3 = n3. eastNorth.north();113 double x3 = n3.getEastNorth().east(); 114 double y3 = n3.getEastNorth().north(); 115 115 116 116 // calculate the center (xc/yc) 117 117 double s = 0.5*((x2 - x3)*(x1 - x3) - (y2 - y3)*(y3 - y1)); -
src/org/openstreetmap/josm/command/RotateCommand.java
63 63 64 64 for (Node n : this.objects) { 65 65 MoveCommand.OldState os = new MoveCommand.OldState(); 66 os.eastNorth = n. eastNorth;67 os.latlon = n. coor;66 os.eastNorth = n.getEastNorth(); 67 os.latlon = n.getCoor(); 68 68 os.modified = n.modified; 69 69 oldState.put(n, os); 70 70 pivot = pivot.add(os.eastNorth.east(), os.eastNorth.north()); -
src/org/openstreetmap/josm/command/MoveCommand.java
69 69 this.objects = AllNodesVisitor.getAllNodes(objects); 70 70 for (Node n : this.objects) { 71 71 OldState os = new OldState(); 72 os.eastNorth = n. eastNorth;73 os.latlon = n. coor;72 os.eastNorth = n.getEastNorth(); 73 os.latlon = n.getCoor(); 74 74 os.modified = n.modified; 75 75 oldState.add(os); 76 76 } … … 86 86 */ 87 87 public void moveAgain(double x, double y) { 88 88 for (Node n : objects) { 89 n.setEastNorth(n. eastNorth.add(x, y));89 n.setEastNorth(n.getEastNorth().add(x, y)); 90 90 } 91 91 this.x += x; 92 92 this.y += y; … … 94 94 95 95 @Override public boolean executeCommand() { 96 96 for (Node n : objects) { 97 n.setEastNorth(n. eastNorth.add(x, y));97 n.setEastNorth(n.getEastNorth().add(x, y)); 98 98 n.modified = true; 99 99 } 100 100 return true; -
src/org/openstreetmap/josm/command/DeleteCommand.java
339 339 for (OsmPrimitive osm : del) { 340 340 if (osm instanceof Node && osm.id != 0) { 341 341 Node n = (Node) osm; 342 if (!a.contains(n. coor)) {342 if (!a.contains(n.getCoor())) { 343 343 JPanel msg = new JPanel(new GridBagLayout()); 344 344 msg.add(new JLabel( 345 345 "<html>" + -
src/org/openstreetmap/josm/data/osm/visitor/MergeVisitor.java
162 162 } 163 163 164 164 private static boolean realMatch(Node n1, Node n2) { 165 return n1. coor.equalsEpsilon(n2.coor);165 return n1.getCoor().equalsEpsilon(n2.getCoor()); 166 166 } 167 167 168 168 private static boolean realMatch(Way w1, Way w2) { -
src/org/openstreetmap/josm/data/osm/visitor/SimplePaintVisitor.java
270 270 public void visitVirtual(Way w) { 271 271 Iterator<Node> it = w.nodes.iterator(); 272 272 if (it.hasNext()) { 273 Point lastP = nc.getPoint(it.next(). eastNorth);273 Point lastP = nc.getPoint(it.next().getEastNorth()); 274 274 while(it.hasNext()) 275 275 { 276 Point p = nc.getPoint(it.next(). eastNorth);276 Point p = nc.getPoint(it.next().getEastNorth()); 277 277 if(isSegmentVisible(lastP, p) && isLargeSegment(lastP, p, virtualNodeSpace)) 278 278 { 279 279 int x = (p.x+lastP.x)/2; … … 320 320 321 321 Iterator<Node> it = w.nodes.iterator(); 322 322 if (it.hasNext()) { 323 Point lastP = nc.getPoint(it.next(). eastNorth);323 Point lastP = nc.getPoint(it.next().getEastNorth()); 324 324 for (int orderNumber = 1; it.hasNext(); orderNumber++) { 325 Point p = nc.getPoint(it.next(). eastNorth);325 Point p = nc.getPoint(it.next().getEastNorth()); 326 326 drawSegment(lastP, p, wayColor, 327 327 showOnlyHeadArrowOnly ? !it.hasNext() : showThisDirectionArrow); 328 328 if (showOrderNumber) … … 351 351 if (m.member.incomplete || m.member.deleted) continue; 352 352 353 353 if (m.member instanceof Node) { 354 Point p = nc.getPoint(((Node) m.member). eastNorth);354 Point p = nc.getPoint(((Node) m.member).getEastNorth()); 355 355 if (p.x < 0 || p.y < 0 356 356 || p.x > nc.getWidth() || p.y > nc.getHeight()) continue; 357 357 … … 362 362 boolean first = true; 363 363 for (Node n : ((Way) m.member).nodes) { 364 364 if (n.incomplete || n.deleted) continue; 365 Point p = nc.getPoint(n. eastNorth);365 Point p = nc.getPoint(n.getEastNorth()); 366 366 if (first) { 367 367 path.moveTo(p.x, p.y); 368 368 first = false; … … 409 409 */ 410 410 public void drawNode(Node n, Color color, int size, int radius, boolean fill) { 411 411 if (size > 1) { 412 Point p = nc.getPoint(n. eastNorth);412 Point p = nc.getPoint(n.getEastNorth()); 413 413 if ((p.x < 0) || (p.y < 0) || (p.x > nc.getWidth()) 414 414 || (p.y > nc.getHeight())) 415 415 return; -
src/org/openstreetmap/josm/data/osm/visitor/BoundingXYVisitor.java
21 21 public EastNorth min, max; 22 22 23 23 public void visit(Node n) { 24 visit(n. eastNorth);24 visit(n.getEastNorth()); 25 25 } 26 26 27 27 public void visit(Way w) { -
src/org/openstreetmap/josm/data/osm/visitor/MapPaintVisitor.java
133 133 */ 134 134 public void visit(Node n) { 135 135 /* check, if the node is visible at all */ 136 if((n. eastNorth.east() > maxEN.east() ) ||137 (n. eastNorth.north() > maxEN.north()) ||138 (n. eastNorth.east() < minEN.east() ) ||139 (n. eastNorth.north() < minEN.north()))136 if((n.getEastNorth().east() > maxEN.east() ) || 137 (n.getEastNorth().north() > maxEN.north()) || 138 (n.getEastNorth().east() < minEN.east() ) || 139 (n.getEastNorth().north() < minEN.north())) 140 140 { 141 141 n.mappaintVisibleCode = viewid; 142 142 return; … … 179 179 180 180 for (Node n : w.nodes) 181 181 { 182 if(n. eastNorth.east() > maxx) maxx = n.eastNorth.east();183 if(n. eastNorth.north() > maxy) maxy = n.eastNorth.north();184 if(n. eastNorth.east() < minx) minx = n.eastNorth.east();185 if(n. eastNorth.north() < miny) miny = n.eastNorth.north();182 if(n.getEastNorth().east() > maxx) maxx = n.getEastNorth().east(); 183 if(n.getEastNorth().north() > maxy) maxy = n.getEastNorth().north(); 184 if(n.getEastNorth().east() < minx) minx = n.getEastNorth().east(); 185 if(n.getEastNorth().north() < miny) miny = n.getEastNorth().north(); 186 186 } 187 187 188 188 if ((minx > maxEN.east()) || … … 649 649 fromNode = fromWay.nodes.get(fromWay.nodes.size()-2); 650 650 } 651 651 652 Point pFrom = nc.getPoint(fromNode. eastNorth);653 Point pVia = nc.getPoint(viaNode. eastNorth);652 Point pFrom = nc.getPoint(fromNode.getEastNorth()); 653 Point pVia = nc.getPoint(viaNode.getEastNorth()); 654 654 655 655 //if(restrictionDebug) { 656 656 /* find the "direct" node after the via node */ … … 886 886 way = w; 887 887 for (Node n : w.nodes) 888 888 { 889 p = nc.getPoint(n. eastNorth);889 p = nc.getPoint(n.getEastNorth()); 890 890 poly.addPoint(p.x,p.y); 891 891 } 892 892 } … … 940 940 941 941 for (Node n : wInner.nodes) 942 942 { 943 Point pInner = nc.getPoint(n. eastNorth);943 Point pInner = nc.getPoint(n.getEastNorth()); 944 944 polygon.addPoint(pInner.x,pInner.y); 945 945 } 946 946 if(!wInner.isClosed()) 947 947 { 948 Point pInner = nc.getPoint(wInner.nodes.get(0). eastNorth);948 Point pInner = nc.getPoint(wInner.nodes.get(0).getEastNorth()); 949 949 polygon.addPoint(pInner.x,pInner.y); 950 950 } 951 951 PolyData o = null; … … 1064 1064 1065 1065 for (Node n : w.nodes) 1066 1066 { 1067 Point p = nc.getPoint(n. eastNorth);1067 Point p = nc.getPoint(n.getEastNorth()); 1068 1068 polygon.addPoint(p.x,p.y); 1069 1069 } 1070 1070 return polygon; … … 1087 1087 } 1088 1088 1089 1089 protected void drawNode(Node n, ImageIcon icon, boolean annotate, Boolean selected) { 1090 Point p = nc.getPoint(n. eastNorth);1090 Point p = nc.getPoint(n.getEastNorth()); 1091 1091 if ((p.x < 0) || (p.y < 0) || (p.x > nc.getWidth()) || (p.y > nc.getHeight())) return; 1092 1092 1093 1093 //profilerVisibleNodes++; … … 1129 1129 if (col != currentColor || width != currentWidth || !Arrays.equals(dashed,currentDashed) || dashedColor != currentDashedColor) { 1130 1130 displaySegments(col, width, dashed, dashedColor); 1131 1131 } 1132 Point p1 = nc.getPoint(n1. eastNorth);1133 Point p2 = nc.getPoint(n2. eastNorth);1132 Point p1 = nc.getPoint(n1.getEastNorth()); 1133 Point p2 = nc.getPoint(n2.getEastNorth()); 1134 1134 1135 1135 if (!isSegmentVisible(p1, p2)) { 1136 1136 return; … … 1208 1208 */ 1209 1209 public void drawNode(Node n, Color color, int size, int radius, boolean fill) { 1210 1210 if (isZoomOk(null) && size > 1) { 1211 Point p = nc.getPoint(n. eastNorth);1211 Point p = nc.getPoint(n.getEastNorth()); 1212 1212 if ((p.x < 0) || (p.y < 0) || (p.x > nc.getWidth()) 1213 1213 || (p.y > nc.getHeight())) 1214 1214 return; … … 1455 1455 * parents way 1456 1456 */ 1457 1457 protected void drawOrderNumber(Node n1, Node n2, int orderNumber) { 1458 Point p1 = nc.getPoint(n1. eastNorth);1459 Point p2 = nc.getPoint(n2. eastNorth);1458 Point p1 = nc.getPoint(n1.getEastNorth()); 1459 Point p2 = nc.getPoint(n2.getEastNorth()); 1460 1460 drawOrderNumber(p1, p2, orderNumber); 1461 1461 } 1462 1462 } -
src/org/openstreetmap/josm/data/osm/Node.java
19 19 20 20 public LatLon coor; 21 21 public volatile EastNorth eastNorth; 22 23 public void setCoor(LatLon coor) {22 23 public final void setCoor(LatLon coor) { 24 24 this.coor = coor; 25 this.eastNorth = Main.proj.latlon2eastNorth(coor); 25 this.eastNorth = Main.proj.latlon2eastNorth(coor); 26 26 } 27 28 public void setEastNorth(EastNorth eastNorth) { 27 28 public final LatLon getCoor() { 29 return coor; 30 } 31 32 public final void setEastNorth(EastNorth eastNorth) { 29 33 this.eastNorth = eastNorth; 30 34 this.coor = Main.proj.eastNorth2latlon(eastNorth); 31 35 } 32 33 public void setEastNorth(double east, double north) {36 37 public final void setEastNorth(double east, double north) { 34 38 this.setEastNorth(new EastNorth(east, north)); 35 39 } 36 40 41 public final EastNorth getEastNorth() { 42 return eastNorth; 43 } 44 37 45 private static CoordinateFormat mCord; 38 46 39 47 static { … … 106 114 } 107 115 return name; 108 116 } 117 109 118 } -
src/org/openstreetmap/josm/data/conflict/PositionConflict.java
9 9 public class PositionConflict extends ConflictItem { 10 10 11 11 @Override public boolean hasConflict(OsmPrimitive key, OsmPrimitive value) { 12 return key instanceof Node && !((Node)key). coor.equals(((Node)value).coor);12 return key instanceof Node && !((Node)key).getCoor().equals(((Node)value).getCoor()); 13 13 } 14 14 15 15 @Override protected String str(OsmPrimitive osm) { 16 return osm instanceof Node ? ((Node)osm). coor.lat()+", "+((Node)osm).coor.lon() : null;16 return osm instanceof Node ? ((Node)osm).getCoor().lat()+", "+((Node)osm).getCoor().lon() : null; 17 17 } 18 18 19 19 @Override public String key() { … … 22 22 23 23 @Override public void apply(OsmPrimitive target, OsmPrimitive other) { 24 24 if (target instanceof Node) { 25 ((Node)target).setEastNorth(((Node)other). eastNorth);25 ((Node)target).setEastNorth(((Node)other).getEastNorth()); 26 26 int newversion = Math.max(target.version, other.version); 27 27 // set version on "other" as well in case user decides to keep local 28 28 target.version = newversion; -
src/org/openstreetmap/josm/gui/SelectionManager.java
279 279 } else { 280 280 // nodes 281 281 for (Node n : nc.getData().nodes) { 282 if (!n.deleted && !n.incomplete && r.contains(nc.getPoint(n. eastNorth)))282 if (!n.deleted && !n.incomplete && r.contains(nc.getPoint(n.getEastNorth()))) 283 283 selection.add(n); 284 284 } 285 285 … … 289 289 continue; 290 290 if (alt) { 291 291 for (Node n : w.nodes) { 292 if (!n.incomplete && r.contains(nc.getPoint(n. eastNorth))) {292 if (!n.incomplete && r.contains(nc.getPoint(n.getEastNorth()))) { 293 293 selection.add(w); 294 294 break; 295 295 } … … 297 297 } else { 298 298 boolean allIn = true; 299 299 for (Node n : w.nodes) { 300 if (!n.incomplete && !r.contains(nc.getPoint(n. eastNorth))) {300 if (!n.incomplete && !r.contains(nc.getPoint(n.getEastNorth()))) { 301 301 allIn = false; 302 302 break; 303 303 } -
src/org/openstreetmap/josm/gui/conflict/relation/RelationMemberTableCellRenderer.java
81 81 if (primitive instanceof Node) { 82 82 Node n = (Node)primitive; 83 83 sb.append(" ("); 84 if (n. coor!= null) {85 sb.append(COORD_FORMATTER.format(n. coor.lat()));84 if (n.getCoor() != null) { 85 sb.append(COORD_FORMATTER.format(n.getCoor().lat())); 86 86 sb.append(","); 87 sb.append(COORD_FORMATTER.format(n. coor.lon()));87 sb.append(COORD_FORMATTER.format(n.getCoor().lon())); 88 88 } else { 89 89 sb.append("?,?"); 90 90 } -
src/org/openstreetmap/josm/gui/conflict/nodes/NodeListTableCellRenderer.java
64 64 } 65 65 sb.append(" ("); 66 66 67 if (node. coor!= null) {68 sb.append(COORD_FORMATTER.format(node. coor.lat()));67 if (node.getCoor() != null) { 68 sb.append(COORD_FORMATTER.format(node.getCoor().lat())); 69 69 sb.append(","); 70 sb.append(COORD_FORMATTER.format(node. coor.lon()));70 sb.append(COORD_FORMATTER.format(node.getCoor().lon())); 71 71 } else { 72 72 sb.append("?,?"); 73 73 } -
src/org/openstreetmap/josm/gui/NavigatableComponent.java
157 157 for (Node n : getData().nodes) { 158 158 if (n.deleted || n.incomplete) 159 159 continue; 160 Point sp = getPoint(n. eastNorth);160 Point sp = getPoint(n.getEastNorth()); 161 161 double dist = p.distanceSq(sp); 162 162 if (dist < minDistanceSq) { 163 163 minDistanceSq = dist; … … 192 192 continue; 193 193 } 194 194 195 Point A = getPoint(lastN. eastNorth);196 Point B = getPoint(n. eastNorth);195 Point A = getPoint(lastN.getEastNorth()); 196 Point B = getPoint(n.getEastNorth()); 197 197 double c = A.distanceSq(B); 198 198 double a = p.distanceSq(B); 199 199 double b = p.distanceSq(A); … … 301 301 lastN = n; 302 302 continue; 303 303 } 304 Point A = getPoint(lastN. eastNorth);305 Point B = getPoint(n. eastNorth);304 Point A = getPoint(lastN.getEastNorth()); 305 Point B = getPoint(n.getEastNorth()); 306 306 double c = A.distanceSq(B); 307 307 double a = p.distanceSq(B); 308 308 double b = p.distanceSq(A); … … 316 316 } 317 317 for (Node n : getData().nodes) { 318 318 if (!n.deleted && !n.incomplete 319 && getPoint(n. eastNorth).distanceSq(p) < snapDistance) {319 && getPoint(n.getEastNorth()).distanceSq(p) < snapDistance) { 320 320 nearest.add(n); 321 321 } 322 322 } … … 335 335 Collection<Node> nearest = new HashSet<Node>(); 336 336 for (Node n : getData().nodes) { 337 337 if (!n.deleted && !n.incomplete 338 && getPoint(n. eastNorth).distanceSq(p) < snapDistance) {338 && getPoint(n.getEastNorth()).distanceSq(p) < snapDistance) { 339 339 nearest.add(n); 340 340 } 341 341 } -
src/org/openstreetmap/josm/gui/dialogs/ConflictDialog.java
201 201 g.setColor(preferencesColor); 202 202 Visitor conflictPainter = new AbstractVisitor(){ 203 203 public void visit(Node n) { 204 Point p = nc.getPoint(n. eastNorth);204 Point p = nc.getPoint(n.getEastNorth()); 205 205 g.drawRect(p.x-1, p.y-1, 2, 2); 206 206 } 207 207 public void visit(Node n1, Node n2) { 208 Point p1 = nc.getPoint(n1. eastNorth);209 Point p2 = nc.getPoint(n2. eastNorth);208 Point p1 = nc.getPoint(n1.getEastNorth()); 209 Point p2 = nc.getPoint(n2.getEastNorth()); 210 210 g.drawLine(p1.x, p1.y, p2.x, p2.y); 211 211 } 212 212 public void visit(Way w) { -
src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java
426 426 if (!n.isTagged()) { 427 427 doneNodes.add(n); 428 428 } 429 WayPoint wpt = new WayPoint(n. coor);429 WayPoint wpt = new WayPoint(n.getCoor()); 430 430 if (!n.isTimestampEmpty()) 431 431 { 432 432 wpt.attr.put("time", DateUtils.fromDate(n.getTimestamp())); … … 440 440 // records them? 441 441 for (Node n : data.nodes) { 442 442 if (n.incomplete || n.deleted || doneNodes.contains(n)) continue; 443 WayPoint wpt = new WayPoint(n. coor);443 WayPoint wpt = new WayPoint(n.getCoor()); 444 444 if (!n.isTimestampEmpty()) { 445 445 wpt.attr.put("time", DateUtils.fromDate(n.getTimestamp())); 446 446 wpt.setTime();