Ignore:
Timestamp:
2013-08-22T00:33:32+02:00 (6 years ago)
Author:
Don-vip
Message:

fix #8987 - immutable coordinates (patch by shinigami)

Location:
trunk/src/org/openstreetmap/josm/data/coor
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/coor/EastNorth.java

    r6169 r6173  
    99 * @author Imi
    1010 */
    11 public class EastNorth extends Coordinate implements Cloneable {
     11public class EastNorth extends Coordinate {
    1212
    1313    public EastNorth(double east, double north) {
     
    3737    public EastNorth interpolate(EastNorth en2, double proportion) {
    3838        return new EastNorth(this.x + proportion * (en2.x - this.x),
    39             this.y + proportion * (en2.y - this.y));
     39                this.y + proportion * (en2.y - this.y));
    4040    }
    4141
     
    5454        return super.distance(en);
    5555    }
    56    
     56
    5757    /**
    5858     * Returns the square of the euclidean distance from this {@code EastNorth} to a specified {@code EastNorth}.
     
    7474        return Math.sqrt(x*x + y*y);
    7575    }
    76    
     76
    7777    /**
    7878     * Returns the heading, in radians, that you have to use to get from
     
    8484    public double heading(EastNorth other) {
    8585        double hd = Math.atan2(other.east() - east(), other.north() - north());
    86         if(hd < 0) hd = 2 * Math.PI + hd;
     86        if(hd < 0) {
     87            hd = 2 * Math.PI + hd;
     88        }
    8789        return hd;
    8890    }
     
    130132        return (Math.abs(x - other.x) < e && Math.abs(y - other.y) < e);
    131133    }
    132 
    133     @Override
    134     public EastNorth clone() throws CloneNotSupportedException {
    135         return (EastNorth) super.clone();
    136     }
    137134}
  • trunk/src/org/openstreetmap/josm/data/coor/LatLon.java

    r6169 r6173  
    2626 * @author Imi
    2727 */
    28 public class LatLon extends Coordinate implements Cloneable {
     28public class LatLon extends Coordinate {
    2929
    3030    /**
     
    158158    }
    159159
    160     public LatLon(LatLon coor) {
     160    protected LatLon(LatLon coor) {
    161161        super(coor.lon(), coor.lat());
    162162    }
     
    222222
    223223    /**
    224      * Check if this is contained in given area or area is null. 
     224     * Check if this is contained in given area or area is null.
    225225     *
    226226     * @param a Area
    227      * @return <code>true</code> if this is contained in given area or area is null. 
     227     * @return <code>true</code> if this is contained in given area or area is null.
    228228     */
    229229    public boolean isIn(Area a) {
     
    306306        return super.distance(ll);
    307307    }
    308    
     308
    309309    /**
    310310     * Returns the square of the euclidean distance from this {@code LatLon} to a specified {@code LatLon}.
     
    317317        return super.distanceSq(ll);
    318318    }
    319    
     319
    320320    @Override public String toString() {
    321321        return "LatLon[lat="+lat()+",lon="+lon()+"]";
     
    395395        return true;
    396396    }
    397 
    398     @Override
    399     public LatLon clone() throws CloneNotSupportedException {
    400         return (LatLon) super.clone();
    401     }
    402397}
Note: See TracChangeset for help on using the changeset viewer.