Ignore:
Timestamp:
2008-09-22T03:53:47+02:00 (15 years ago)
Author:
framm
Message:
  • display a confirmation request if user tries to delete data outside downloaded area (can be don't-show-again'd). Note this feature is not a hard measure but needs to be actively requested by the component making the deletion, so it is possible that plugins deleting data do not honour this. Also, this currently only affects deleting, not otherwise modifying stuff outside of the box.
File:
1 edited

Legend:

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

    r655 r1004  
    22package org.openstreetmap.josm.data.coor;
    33
    4 import java.io.Serializable;
     4import java.awt.geom.Point2D;
    55
    66/**
     
    1515 * @author imi
    1616 */
    17 abstract class Coordinate implements Serializable {
     17abstract class Coordinate extends Point2D {
    1818
    19         /**
    20          * Either easting or latitude
    21          */
    22         final double x;
    23         /**
    24          * Either northing or longitude
    25          */
    26         final double y;
    27 
     19    protected double x;
     20    protected double y;
     21   
    2822        /**
    2923         * Construct the point with latitude / longitude values.
    30          * The x/y values are left uninitialized.
    3124         *
    3225         * @param x X coordinate of the point.
     
    3427         */
    3528        Coordinate(double x, double y) {
    36                 this.x = x;
    37                 this.y = y;
     29        this.x = x; this.y = y;
    3830        }
     31   
     32    public double getX() {
     33        return x;
     34    }
     35   
     36    public double getY() {
     37        return y;
     38    }
     39   
     40    public void setLocation (double x, double y) {
     41        this.x = x;
     42        this.y = y;
     43    }
    3944
    40         /**
    41          * Return the squared distance of the northing/easting values between
    42          * this and the argument.
    43          *
    44          * This method does NOT compute a great circle distance between two
    45          * locations!
    46          *
    47          * @param other The other point to calculate the distance to.
    48          * @return The square of the distance between this and the other point,
    49          *              regarding to the x/y values.
    50          */
    51         public double distanceSq(Coordinate other) {
    52                 return (x-other.x)*(x-other.x)+(y-other.y)*(y-other.y);
    53         }
    54        
    55         /**
    56          * Return the distance of the northing/easting values between this and
    57          * the argument.
    58          *
    59          * This method does NOT compute a great circle distance between two
    60          * locations!
    61          *
    62          * @param other The other point to calculate the distance to.
    63          * @return The square of the distance between this and the other point,
    64          *              regarding to the x/y values.
    65          */
    66         public double distance(Coordinate other) {
    67                 return Math.sqrt(distanceSq(other));
    68         }
    69 
    70         @Override public boolean equals(Object obj) {
    71                 return obj instanceof Coordinate ? x == ((Coordinate)obj).x && ((Coordinate)obj).y == y : false;
    72         }
    73 
    74         @Override public int hashCode() {
    75                 return (int)(x*65536+y*4096);
    76         }
    7745}
Note: See TracChangeset for help on using the changeset viewer.