Ignore:
Timestamp:
2009-06-06T14:30:21+02:00 (17 years ago)
Author:
stoecker
Message:

little bit more refactoring of coordinate access - patch by jttt

Location:
trunk/src/org/openstreetmap/josm/data
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/conflict/PositionConflict.java

    r1636 r1640  
    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
     
    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
  • trunk/src/org/openstreetmap/josm/data/osm/Node.java

    r1636 r1640  
    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
     
    107115        return name;
    108116    }
     117
    109118}
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/BoundingXYVisitor.java

    r1523 r1640  
    2222
    2323    public void visit(Node n) {
    24         visit(n.eastNorth);
     24        visit(n.getEastNorth());
    2525    }
    2626
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/MapPaintVisitor.java

    r1635 r1640  
    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;
     
    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
     
    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) {
     
    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                        }
     
    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                    }
     
    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        }
     
    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
     
    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)) {
     
    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()))
     
    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    }
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/MergeVisitor.java

    r1567 r1640  
    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
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/SimplePaintVisitor.java

    r1523 r1640  
    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                {
     
    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);
     
    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;
     
    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);
     
    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()))
Note: See TracChangeset for help on using the changeset viewer.