Ticket #2302: getcoor.patch

File getcoor.patch, 43.9 KB (added by jttt, 15 years ago)
  • src/org/openstreetmap/josm/io/OsmWriter.java

     
    9797    public void visit(Node n) {
    9898        if (n.incomplete) return;
    9999        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()+"'");
    101101        if (!withBody) {
    102102            out.println("/>"); 
    103103        } else {
  • src/org/openstreetmap/josm/actions/DistributeAction.java

     
    6969        for (Node n : nodes) {
    7070            itnodes.remove(n);
    7171            for (Node m : itnodes) {
    72                 double dist = Math.sqrt(n.eastNorth.distance(m.eastNorth));
     72                double dist = Math.sqrt(n.getEastNorth().distance(m.getEastNorth()));
    7373                if (dist > distance) {
    7474                    nodea = n;
    7575                    nodeb = m;
     
    8383        nodes.remove(nodeb);
    8484
    8585        // 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();
    9090
    9191        // A list of commands to do
    9292        Collection<Command> cmds = new LinkedList<Command>();
     
    103103            // Find the node that is furthest from B (i.e. closest to A)
    104104            distance = 0.0;
    105105            for (Node n : nodes) {
    106                 double dist = Math.sqrt(nodeb.eastNorth.distance(n.eastNorth));
     106                double dist = Math.sqrt(nodeb.getEastNorth().distance(n.getEastNorth()));
    107107                if (dist > distance) {
    108108                    s = n;
    109109                    distance = dist;
     
    111111            }
    112112
    113113            // 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;
    116116
    117117            cmds.add(new MoveCommand(s, dx, dy));
    118118
  • src/org/openstreetmap/josm/actions/OrthogonalizeAction.java

     
    8080            for (int i1=0; i1 < way.nodes.size()-1; i1++) {
    8181                int i2 = (i1+1) % (way.nodes.size()-1);
    8282                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()));
    8585                double delta = Math.abs(angle2 - angle1);
    8686                while(delta > Math.PI) delta -= Math.PI;
    8787                if(delta < Math.PI/4) {
     
    116116        if (dirnodes.size() == 2) {
    117117            // When selection contains two nodes, use the nodes to compute a direction
    118118            // 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()));
    120120            use_dirnodes = true;
    121121        }
    122122
     
    130130            // Copy necessary data into a more suitable data structure
    131131            EastNorth en[] = new EastNorth[sides];
    132132            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());
    134134            }
    135135
    136136            if (! use_dirnodes) {
     
    141141                double headings[] = new double[sides];
    142142                double weights[] = new double[sides];
    143143                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());
    146146                }
    147147
    148148                // CAVEAT: for orientations near -PI/4 or PI/4 the mapping into ONE orientation fails
     
    231231                Node n = way.nodes.get(i2);
    232232
    233233                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();
    237237                    cmds.add(new MoveCommand(n, dx, dy));
    238238                }
    239239            }
  • src/org/openstreetmap/josm/actions/mapmode/DrawAction.java

     
    331331        } else {
    332332            // no node found in clicked area
    333333            n = new Node(Main.map.mapView.getLatLon(e.getX(), e.getY()));
    334             if (n.coor.isOutSideWorld()) {
     334            if (n.getCoor().isOutSideWorld()) {
    335335                JOptionPane.showMessageDialog(Main.parent,
    336336                    tr("Cannot add a node outside of the world."));
    337337                return;
     
    646646        if (currentMouseNode != null) {
    647647            // user clicked on node
    648648            if (selection.isEmpty()) return;
    649             currentMouseEastNorth = currentMouseNode.eastNorth;
     649            currentMouseEastNorth = currentMouseNode.getEastNorth();
    650650            mouseOnExistingNode = currentMouseNode;
    651651        } else {
    652652            // no node found in clicked area
     
    689689
    690690        // find out the distance, in metres, between the base point and the mouse cursor
    691691        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));
    694694        if (previousNode != null) {
    695             angle = hdg - Math.toDegrees(previousNode.coor.heading(currentBaseNode.coor));
     695            angle = hdg - Math.toDegrees(previousNode.getCoor().heading(currentBaseNode.getCoor()));
    696696            if (angle < 0) angle += 360;
    697697        }
    698698        Main.map.statusLine.setAngle(angle);
     
    771771            // the two segments and adjusts the node position.
    772772            Iterator<Pair<Node,Node>> i = segs.iterator();
    773773            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();
    776776            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();
    779779
    780780            double u=det(B.east() - A.east(), B.north() - A.north(), C.east() - D.east(), C.north() - D.north());
    781781
     
    799799            // only adjust to intersection if within snapToIntersectionThreshold pixel of mouse click; otherwise
    800800            // fall through to default action.
    801801            // (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) {
    803803                n.setEastNorth(intersection);
    804804                return;
    805805            }
    806806
    807807        default:
    808             EastNorth P = n.eastNorth;
     808            EastNorth P = n.getEastNorth();
    809809            seg = segs.iterator().next();
    810             A = seg.a.eastNorth;
    811             B = seg.b.eastNorth;
     810            A = seg.a.getEastNorth();
     811            B = seg.b.getEastNorth();
    812812            double a = P.distanceSq(B);
    813813            double b = P.distanceSq(A);
    814814            double c = A.distanceSq(B);
     
    839839        g2.setColor(selectedColor);
    840840        g2.setStroke(new BasicStroke(3, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND));
    841841        GeneralPath b = new GeneralPath();
    842         Point p1=mv.getPoint(currentBaseNode.eastNorth);
     842        Point p1=mv.getPoint(currentBaseNode.getEastNorth());
    843843        Point p2=mv.getPoint(currentMouseEastNorth);
    844844
    845845        double t = Math.atan2(p2.y-p1.y, p2.x-p1.x) + Math.PI;
  • src/org/openstreetmap/josm/actions/mapmode/ExtrudeAction.java

     
    154154            Node n1 = selectedSegment.way.nodes.get(selectedSegment.lowerIndex);
    155155            Node n2 = selectedSegment.way.nodes.get(selectedSegment.lowerIndex + 1);
    156156
    157             EastNorth en1 = n1.eastNorth;
    158             EastNorth en2 = n2.eastNorth;
     157            EastNorth en1 = n1.getEastNorth();
     158            EastNorth en2 = n2.getEastNorth();
    159159            EastNorth en3 = mv.getEastNorth(mousePos.x, mousePos.y);
    160160
    161161            double u = ((en3.east() - en1.east()) * (en2.east() - en1.east()) +
     
    233233        if (mousePos.distance(initialMousePos) > 10) {
    234234            Node n1 = selectedSegment.way.nodes.get(selectedSegment.lowerIndex);
    235235            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);
    237237            Node n3 = new Node(Main.proj.eastNorth2latlon(en3));
    238             EastNorth en4 = n1.eastNorth.add(xoff, yoff);
     238            EastNorth en4 = n1.getEastNorth().add(xoff, yoff);
    239239            Node n4 = new Node(Main.proj.eastNorth2latlon(en4));
    240240            Way wnew = new Way(selectedSegment.way);
    241241            wnew.addNode(selectedSegment.lowerIndex+1, n3);
  • src/org/openstreetmap/josm/actions/mapmode/SelectAction.java

     
    223223                        c = new MoveCommand(selection, dx, dy));
    224224
    225225                for (Node n : affectedNodes) {
    226                     if (n.coor.isOutSideWorld()) {
     226                    if (n.getCoor().isOutSideWorld()) {
    227227                        // Revert move
    228228                        ((MoveCommand) c).moveAgain(-dx, -dy);
    229229
     
    279279                if(Main.pref.getInteger("mappaint.node.virtual-size", 8) > 0)
    280280                {
    281281                    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());
    284284                    if(SimplePaintVisitor.isLargeSegment(p1, p2, Main.pref.getInteger("mappaint.node.virtual-space", 70)))
    285285                    {
    286286                        Point pc = new Point((p1.x+p2.x)/2, (p1.y+p2.y)/2);
  • src/org/openstreetmap/josm/actions/PasteAction.java

     
    4242        /* Find the middle of the pasteBuffer area */
    4343        double maxEast = -1E100, minEast = 1E100, maxNorth = -1E100, minNorth = 1E100;
    4444        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();
    4747            if (east > maxEast) { maxEast = east; }
    4848            if (east < minEast) { minEast = east; }
    4949            if (north > maxNorth) { maxNorth = north; }
     
    6969            Node nnew = new Node(n);
    7070            nnew.id = 0;
    7171            if (Main.main.editLayer() == source) {
    72                 nnew.setEastNorth(nnew.eastNorth.add(offsetEast, offsetNorth));
     72                nnew.setEastNorth(nnew.getEastNorth().add(offsetEast, offsetNorth));
    7373            }
    7474            map.put(n, nnew);
    7575        }
  • src/org/openstreetmap/josm/actions/JoinNodeWayAction.java

     
    3636        Node node = (Node) sel.iterator().next();
    3737
    3838        List<WaySegment> wss = Main.map.mapView.getNearestWaySegments(
    39             Main.map.mapView.getPoint(node.eastNorth));
     39            Main.map.mapView.getPoint(node.getEastNorth()));
    4040        HashMap<Way, List<Integer>> insertPoints = new HashMap<Way, List<Integer>>();
    4141        for (WaySegment ws : wss) {
    4242            List<Integer> is;
  • src/org/openstreetmap/josm/actions/MoveAction.java

     
    9898                    c = new MoveCommand(selection, distx, disty));
    9999
    100100        for (Node n : affectedNodes) {
    101             if (n.coor.isOutSideWorld()) {
     101            if (n.getCoor().isOutSideWorld()) {
    102102                // Revert move
    103103                ((MoveCommand) c).moveAgain(-distx, -disty);
    104104                JOptionPane.showMessageDialog(Main.parent,
  • src/org/openstreetmap/josm/actions/AlignInCircleAction.java

     
    8888        EastNorth result = new EastNorth(bx / (2 * a) + i.east(), -by / (2 * a) + i.north());
    8989
    9090        Node n = new Node(Main.proj.eastNorth2latlon(result));
    91         if (n.coor.isOutSideWorld()) {
     91        if (n.getCoor().isOutSideWorld()) {
    9292            JOptionPane.showMessageDialog(Main.parent, tr("Some of the nodes are (almost) in the line"));
    9393            return null;
    9494        }
     
    162162                    regular = true;
    163163                } else {
    164164
    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();
    166166                    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());
    168168                }
    169169                nodes = new LinkedList<Node>();
    170170            }
     
    190190                n2 = n1;
    191191                n1 = n0;
    192192                n0 = n;
    193                 EastNorth cc = circumcenter(n0.eastNorth, n1.eastNorth, n2.eastNorth);
     193                EastNorth cc = circumcenter(n0.getEastNorth(), n1.getEastNorth(), n2.getEastNorth());
    194194                if (cc == null)
    195195                    return;
    196196                center = new EastNorth(center.east() + cc.east(), center.north()
     
    208208        // relative to the distance from the N or S poles.
    209209        if (radius == 0) {
    210210            for (Node n : nodes) {
    211                 radius += distance(center, n.eastNorth);
     211                radius += distance(center, n.getEastNorth());
    212212            }
    213213            radius = radius / nodes.size();
    214214        }
     
    219219
    220220        if (regular) { // Make a regular polygon
    221221            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);
    223223
    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))
    225225                angle *= -1;
    226226
    227227            pc.radius = radius;
    228228            for (Node n : nodes) {
    229229                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()));
    231231                pc.angle += angle;
    232232            }
    233233        } else { // Move each node to that distance from the centre.
    234234            for (Node n : nodes) {
    235                 pc = new PolarCoor(n.eastNorth, center, 0);
     235                pc = new PolarCoor(n.getEastNorth(), center, 0);
    236236                pc.radius = radius;
    237237                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()));
    239239            }
    240240        }
    241241
  • src/org/openstreetmap/josm/actions/AlignInLineAction.java

     
    7070        for (Node n : nodes) {
    7171            itnodes.remove(n);
    7272            for (Node m : itnodes) {
    73                 double dist = Math.sqrt(n.eastNorth.distance(m.eastNorth));
     73                double dist = Math.sqrt(n.getEastNorth().distance(m.getEastNorth()));
    7474                if (dist > distance) {
    7575                    nodea = n;
    7676                    nodeb = m;
     
    8484        nodes.remove(nodeb);
    8585
    8686        // 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();
    9191
    9292        // A list of commands to do
    9393        Collection<Command> cmds = new LinkedList<Command>();
     
    9595        // OK, for each node to move, work out where to move it!
    9696        for (Node n : nodes) {
    9797            // 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();
    100100
    101101            if (ax == bx) {
    102102                // Special case if AB is vertical...
     
    109109                double m1 = (by - ay) / (bx - ax);
    110110                double c1 = ay - (ax * m1);
    111111                double m2 = (-1) / m1;
    112                 double c2 = n.eastNorth.north() - (n.eastNorth.east() * m2);
     112                double c2 = n.getEastNorth().north() - (n.getEastNorth().east() * m2);
    113113
    114114                nx = (c2 - c1) / (m1 - m2);
    115115                ny = (m1 * nx) + c1;
    116116            }
    117117
    118118            // 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() ));
    120120        }
    121121
    122122        // Do it!
  • src/org/openstreetmap/josm/actions/CreateCircleAction.java

     
    104104
    105105        // let's get some shorter names
    106106        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();
    109109        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();
    112112        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();
    115115
    116116        // calculate the center (xc/yc)
    117117        double s = 0.5*((x2 - x3)*(x1 - x3) - (y2 - y3)*(y3 - y1));
  • src/org/openstreetmap/josm/command/RotateCommand.java

     
    6363
    6464        for (Node n : this.objects) {
    6565            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();
    6868            os.modified = n.modified;
    6969            oldState.put(n, os);
    7070            pivot = pivot.add(os.eastNorth.east(), os.eastNorth.north());
  • src/org/openstreetmap/josm/command/MoveCommand.java

     
    6969        this.objects = AllNodesVisitor.getAllNodes(objects);
    7070        for (Node n : this.objects) {
    7171            OldState os = new OldState();
    72             os.eastNorth = n.eastNorth;
    73             os.latlon = n.coor;
     72            os.eastNorth = n.getEastNorth();
     73            os.latlon = n.getCoor();
    7474            os.modified = n.modified;
    7575            oldState.add(os);
    7676        }
     
    8686     */
    8787    public void moveAgain(double x, double y) {
    8888        for (Node n : objects) {
    89             n.setEastNorth(n.eastNorth.add(x, y));
     89            n.setEastNorth(n.getEastNorth().add(x, y));
    9090        }
    9191        this.x += x;
    9292        this.y += y;
     
    9494
    9595    @Override public boolean executeCommand() {
    9696        for (Node n : objects) {
    97             n.setEastNorth(n.eastNorth.add(x, y));
     97            n.setEastNorth(n.getEastNorth().add(x, y));
    9898            n.modified = true;
    9999        }
    100100        return true;
  • src/org/openstreetmap/josm/command/DeleteCommand.java

     
    339339            for (OsmPrimitive osm : del) {
    340340                if (osm instanceof Node && osm.id != 0) {
    341341                    Node n = (Node) osm;
    342                     if (!a.contains(n.coor)) {
     342                    if (!a.contains(n.getCoor())) {
    343343                        JPanel msg = new JPanel(new GridBagLayout());
    344344                        msg.add(new JLabel(
    345345                            "<html>" +
  • src/org/openstreetmap/josm/data/osm/visitor/MergeVisitor.java

     
    162162    }
    163163
    164164    private static boolean realMatch(Node n1, Node n2) {
    165         return n1.coor.equalsEpsilon(n2.coor);
     165        return n1.getCoor().equalsEpsilon(n2.getCoor());
    166166    }
    167167
    168168    private static boolean realMatch(Way w1, Way w2) {
  • src/org/openstreetmap/josm/data/osm/visitor/SimplePaintVisitor.java

     
    270270    public void visitVirtual(Way w) {
    271271        Iterator<Node> it = w.nodes.iterator();
    272272        if (it.hasNext()) {
    273             Point lastP = nc.getPoint(it.next().eastNorth);
     273            Point lastP = nc.getPoint(it.next().getEastNorth());
    274274            while(it.hasNext())
    275275            {
    276                 Point p = nc.getPoint(it.next().eastNorth);
     276                Point p = nc.getPoint(it.next().getEastNorth());
    277277                if(isSegmentVisible(lastP, p) && isLargeSegment(lastP, p, virtualNodeSpace))
    278278                {
    279279                    int x = (p.x+lastP.x)/2;
     
    320320
    321321        Iterator<Node> it = w.nodes.iterator();
    322322        if (it.hasNext()) {
    323             Point lastP = nc.getPoint(it.next().eastNorth);
     323            Point lastP = nc.getPoint(it.next().getEastNorth());
    324324            for (int orderNumber = 1; it.hasNext(); orderNumber++) {
    325                 Point p = nc.getPoint(it.next().eastNorth);
     325                Point p = nc.getPoint(it.next().getEastNorth());
    326326                drawSegment(lastP, p, wayColor,
    327327                    showOnlyHeadArrowOnly ? !it.hasNext() : showThisDirectionArrow);
    328328                if (showOrderNumber)
     
    351351            if (m.member.incomplete || m.member.deleted) continue;
    352352
    353353            if (m.member instanceof Node) {
    354                 Point p = nc.getPoint(((Node) m.member).eastNorth);
     354                Point p = nc.getPoint(((Node) m.member).getEastNorth());
    355355                if (p.x < 0 || p.y < 0
    356356                    || p.x > nc.getWidth() || p.y > nc.getHeight()) continue;
    357357
     
    362362                boolean first = true;
    363363                for (Node n : ((Way) m.member).nodes) {
    364364                    if (n.incomplete || n.deleted) continue;
    365                     Point p = nc.getPoint(n.eastNorth);
     365                    Point p = nc.getPoint(n.getEastNorth());
    366366                    if (first) {
    367367                        path.moveTo(p.x, p.y);
    368368                        first = false;
     
    409409     */
    410410    public void drawNode(Node n, Color color, int size, int radius, boolean fill) {
    411411        if (size > 1) {
    412             Point p = nc.getPoint(n.eastNorth);
     412            Point p = nc.getPoint(n.getEastNorth());
    413413            if ((p.x < 0) || (p.y < 0) || (p.x > nc.getWidth())
    414414                    || (p.y > nc.getHeight()))
    415415                return;
  • src/org/openstreetmap/josm/data/osm/visitor/BoundingXYVisitor.java

     
    2121    public EastNorth min, max;
    2222
    2323    public void visit(Node n) {
    24         visit(n.eastNorth);
     24        visit(n.getEastNorth());
    2525    }
    2626
    2727    public void visit(Way w) {
  • src/org/openstreetmap/josm/data/osm/visitor/MapPaintVisitor.java

     
    133133     */
    134134    public void visit(Node n) {
    135135        /* 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()))
    140140        {
    141141            n.mappaintVisibleCode = viewid;
    142142            return;
     
    179179
    180180        for (Node n : w.nodes)
    181181        {
    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();
    186186        }
    187187
    188188        if ((minx > maxEN.east()) ||
     
    649649            fromNode = fromWay.nodes.get(fromWay.nodes.size()-2);
    650650        }
    651651
    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());
    654654
    655655        //if(restrictionDebug) {
    656656        /* find the "direct" node after the via node */
     
    886886                        way = w;
    887887                        for (Node n : w.nodes)
    888888                        {
    889                             p = nc.getPoint(n.eastNorth);
     889                            p = nc.getPoint(n.getEastNorth());
    890890                            poly.addPoint(p.x,p.y);
    891891                        }
    892892                    }
     
    940940
    941941                    for (Node n : wInner.nodes)
    942942                    {
    943                         Point pInner = nc.getPoint(n.eastNorth);
     943                        Point pInner = nc.getPoint(n.getEastNorth());
    944944                        polygon.addPoint(pInner.x,pInner.y);
    945945                    }
    946946                    if(!wInner.isClosed())
    947947                    {
    948                         Point pInner = nc.getPoint(wInner.nodes.get(0).eastNorth);
     948                        Point pInner = nc.getPoint(wInner.nodes.get(0).getEastNorth());
    949949                        polygon.addPoint(pInner.x,pInner.y);
    950950                    }
    951951                    PolyData o = null;
     
    10641064
    10651065        for (Node n : w.nodes)
    10661066        {
    1067             Point p = nc.getPoint(n.eastNorth);
     1067            Point p = nc.getPoint(n.getEastNorth());
    10681068            polygon.addPoint(p.x,p.y);
    10691069        }
    10701070        return polygon;
     
    10871087    }
    10881088
    10891089    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());
    10911091        if ((p.x < 0) || (p.y < 0) || (p.x > nc.getWidth()) || (p.y > nc.getHeight())) return;
    10921092
    10931093        //profilerVisibleNodes++;
     
    11291129        if (col != currentColor || width != currentWidth || !Arrays.equals(dashed,currentDashed) || dashedColor != currentDashedColor) {
    11301130            displaySegments(col, width, dashed, dashedColor);
    11311131        }
    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());
    11341134
    11351135        if (!isSegmentVisible(p1, p2)) {
    11361136            return;
     
    12081208     */
    12091209    public void drawNode(Node n, Color color, int size, int radius, boolean fill) {
    12101210        if (isZoomOk(null) && size > 1) {
    1211             Point p = nc.getPoint(n.eastNorth);
     1211            Point p = nc.getPoint(n.getEastNorth());
    12121212            if ((p.x < 0) || (p.y < 0) || (p.x > nc.getWidth())
    12131213                    || (p.y > nc.getHeight()))
    12141214                return;
     
    14551455     * parents way
    14561456     */
    14571457    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());
    14601460        drawOrderNumber(p1, p2, orderNumber);
    14611461    }
    14621462}
  • src/org/openstreetmap/josm/data/osm/Node.java

     
    1919
    2020    public LatLon coor;
    2121    public volatile EastNorth eastNorth;
    22        
    23     public void setCoor(LatLon coor) {
     22
     23    public final void setCoor(LatLon coor) {
    2424        this.coor = coor;
    25         this.eastNorth = Main.proj.latlon2eastNorth(coor); 
     25        this.eastNorth = Main.proj.latlon2eastNorth(coor);
    2626    }
    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) {
    2933       this.eastNorth = eastNorth;
    3034       this.coor = Main.proj.eastNorth2latlon(eastNorth);
    3135    }
    32    
    33     public void setEastNorth(double east, double north) {
     36
     37    public final void setEastNorth(double east, double north) {
    3438        this.setEastNorth(new EastNorth(east, north));
    3539    }
    36    
     40
     41    public final EastNorth getEastNorth() {
     42        return eastNorth;
     43    }
     44
    3745    private static CoordinateFormat mCord;
    3846
    3947    static {
     
    106114        }
    107115        return name;
    108116    }
     117
    109118}
  • src/org/openstreetmap/josm/data/conflict/PositionConflict.java

     
    99public class PositionConflict extends ConflictItem {
    1010
    1111    @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());
    1313    }
    1414
    1515    @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;
    1717    }
    1818
    1919    @Override public String key() {
     
    2222
    2323    @Override public void apply(OsmPrimitive target, OsmPrimitive other) {
    2424        if (target instanceof Node) {
    25             ((Node)target).setEastNorth(((Node)other).eastNorth);
     25            ((Node)target).setEastNorth(((Node)other).getEastNorth());
    2626            int newversion = Math.max(target.version, other.version);
    2727            // set version on "other" as well in case user decides to keep local
    2828            target.version = newversion;
  • src/org/openstreetmap/josm/gui/SelectionManager.java

     
    279279        } else {
    280280            // nodes
    281281            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())))
    283283                    selection.add(n);
    284284            }
    285285
     
    289289                        continue;
    290290                if (alt) {
    291291                    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()))) {
    293293                            selection.add(w);
    294294                            break;
    295295                        }
     
    297297                } else {
    298298                    boolean allIn = true;
    299299                    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()))) {
    301301                            allIn = false;
    302302                            break;
    303303                        }
  • src/org/openstreetmap/josm/gui/conflict/relation/RelationMemberTableCellRenderer.java

     
    8181        if (primitive instanceof Node) {
    8282            Node n = (Node)primitive;
    8383            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()));
    8686                sb.append(",");
    87                 sb.append(COORD_FORMATTER.format(n.coor.lon()));
     87                sb.append(COORD_FORMATTER.format(n.getCoor().lon()));
    8888            } else {
    8989                sb.append("?,?");
    9090            }
  • src/org/openstreetmap/josm/gui/conflict/nodes/NodeListTableCellRenderer.java

     
    6464        }
    6565        sb.append(" (");
    6666
    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()));
    6969            sb.append(",");
    70             sb.append(COORD_FORMATTER.format(node.coor.lon()));
     70            sb.append(COORD_FORMATTER.format(node.getCoor().lon()));
    7171        } else {
    7272            sb.append("?,?");
    7373        }
  • src/org/openstreetmap/josm/gui/NavigatableComponent.java

     
    157157        for (Node n : getData().nodes) {
    158158            if (n.deleted || n.incomplete)
    159159                continue;
    160             Point sp = getPoint(n.eastNorth);
     160            Point sp = getPoint(n.getEastNorth());
    161161            double dist = p.distanceSq(sp);
    162162            if (dist < minDistanceSq) {
    163163                minDistanceSq = dist;
     
    192192                    continue;
    193193                }
    194194
    195                 Point A = getPoint(lastN.eastNorth);
    196                 Point B = getPoint(n.eastNorth);
     195                Point A = getPoint(lastN.getEastNorth());
     196                Point B = getPoint(n.getEastNorth());
    197197                double c = A.distanceSq(B);
    198198                double a = p.distanceSq(B);
    199199                double b = p.distanceSq(A);
     
    301301                    lastN = n;
    302302                    continue;
    303303                }
    304                 Point A = getPoint(lastN.eastNorth);
    305                 Point B = getPoint(n.eastNorth);
     304                Point A = getPoint(lastN.getEastNorth());
     305                Point B = getPoint(n.getEastNorth());
    306306                double c = A.distanceSq(B);
    307307                double a = p.distanceSq(B);
    308308                double b = p.distanceSq(A);
     
    316316            }
    317317        for (Node n : getData().nodes) {
    318318            if (!n.deleted && !n.incomplete
    319                     && getPoint(n.eastNorth).distanceSq(p) < snapDistance) {
     319                    && getPoint(n.getEastNorth()).distanceSq(p) < snapDistance) {
    320320                nearest.add(n);
    321321            }
    322322        }
     
    335335        Collection<Node> nearest = new HashSet<Node>();
    336336        for (Node n : getData().nodes) {
    337337            if (!n.deleted && !n.incomplete
    338                     && getPoint(n.eastNorth).distanceSq(p) < snapDistance) {
     338                    && getPoint(n.getEastNorth()).distanceSq(p) < snapDistance) {
    339339                nearest.add(n);
    340340            }
    341341        }
  • src/org/openstreetmap/josm/gui/dialogs/ConflictDialog.java

     
    201201        g.setColor(preferencesColor);
    202202        Visitor conflictPainter = new AbstractVisitor(){
    203203            public void visit(Node n) {
    204                 Point p = nc.getPoint(n.eastNorth);
     204                Point p = nc.getPoint(n.getEastNorth());
    205205                g.drawRect(p.x-1, p.y-1, 2, 2);
    206206            }
    207207            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());
    210210                g.drawLine(p1.x, p1.y, p2.x, p2.y);
    211211            }
    212212            public void visit(Way w) {
  • src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java

     
    426426                if (!n.isTagged()) {
    427427                    doneNodes.add(n);
    428428                }
    429                 WayPoint wpt = new WayPoint(n.coor);               
     429                WayPoint wpt = new WayPoint(n.getCoor());               
    430430                if (!n.isTimestampEmpty())
    431431                {
    432432                    wpt.attr.put("time", DateUtils.fromDate(n.getTimestamp()));
     
    440440        // records them?
    441441        for (Node n : data.nodes) {
    442442            if (n.incomplete || n.deleted || doneNodes.contains(n)) continue;
    443             WayPoint wpt = new WayPoint(n.coor);
     443            WayPoint wpt = new WayPoint(n.getCoor());
    444444            if (!n.isTimestampEmpty()) {
    445445                wpt.attr.put("time", DateUtils.fromDate(n.getTimestamp()));
    446446                wpt.setTime();