Ignore:
Timestamp:
2017-09-04T20:19:23+02:00 (2 years ago)
Author:
bastiK
Message:

see #15229 - deprecate ILatLon#getEastNorth() so ILatLon has no dependency on Main.proj

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

Legend:

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

    r12171 r12725  
    4444     *
    4545     * @return the east north coordinates or {@code null} if #is
     46     * @deprecated use {@link #getEastNorth(org.openstreetmap.josm.data.projection.Projecting)}
    4647     */
     48    @Deprecated
    4749    default EastNorth getEastNorth() {
    4850        return getEastNorth(Main.getProjection());
  • trunk/src/org/openstreetmap/josm/data/coor/LatLon.java

    r12669 r12725  
    308308        case DEGREES_MINUTES_SECONDS: return degreesMinutesSeconds(y) + ((y < 0) ? SOUTH : NORTH);
    309309        case NAUTICAL: return degreesMinutes(y) + ((y < 0) ? SOUTH : NORTH);
    310         case EAST_NORTH: return cDdFormatter.format(this.getEastNorth().north());
     310        case EAST_NORTH: return cDdFormatter.format(this.getEastNorth(Main.getProjection()).north());
    311311        default: return "ERR";
    312312        }
     
    328328        case DEGREES_MINUTES_SECONDS: return degreesMinutesSeconds(x) + ((x < 0) ? WEST : EAST);
    329329        case NAUTICAL: return degreesMinutes(x) + ((x < 0) ? WEST : EAST);
    330         case EAST_NORTH: return cDdFormatter.format(this.getEastNorth().east());
     330        case EAST_NORTH: return cDdFormatter.format(this.getEastNorth(Main.getProjection()).east());
    331331        default: return "ERR";
    332332        }
  • trunk/src/org/openstreetmap/josm/data/gpx/GpxData.java

    r12275 r12725  
    417417            for (GpxTrackSegment seg : track.getSegments()) {
    418418                WayPoint r = null;
    419                 for (WayPoint S : seg.getWayPoints()) {
    420                     EastNorth en = S.getEastNorth();
     419                for (WayPoint wpSeg : seg.getWayPoints()) {
     420                    EastNorth en = wpSeg.getEastNorth(Main.getProjection());
    421421                    if (r == null) {
    422                         r = S;
     422                        r = wpSeg;
    423423                        rx = en.east();
    424424                        ry = en.north();
     
    455455                                double ny = ry + rnoverRS * a;
    456456                                bestEN = new EastNorth(nx, ny);
    457                                 bestTime = r.time + rnoverRS * (S.time - r.time);
     457                                bestTime = r.time + rnoverRS * (wpSeg.time - r.time);
    458458                                pnminsq = pnsq;
    459459                            }
    460460                        }
    461                         r = S;
     461                        r = wpSeg;
    462462                        rx = sx;
    463463                        ry = sy;
     
    465465                }
    466466                if (r != null) {
    467                     EastNorth c = r.getEastNorth();
     467                    EastNorth c = r.getEastNorth(Main.getProjection());
    468468                    /* if there is only one point in the seg, it will do this twice, but no matter */
    469469                    rx = c.east();
  • trunk/src/org/openstreetmap/josm/data/osm/Node.java

    r12167 r12725  
    9898    public double lon() {
    9999        return lon;
     100    }
     101
     102    /**
     103     * Replies the projected east/north coordinates.
     104     * <p>
     105     * Uses the {@link Main#getProjection() global projection} to project the lan/lon-coordinates.
     106     * @return the east north coordinates or {@code null} if #is
     107     */
     108    public EastNorth getEastNorth() {
     109        return getEastNorth(Main.getProjection());
    100110    }
    101111
  • trunk/src/org/openstreetmap/josm/data/osm/NodeData.java

    r12190 r12725  
    7676
    7777    @Override
     78    @Deprecated
    7879    public EastNorth getEastNorth() {
    7980        // No internal caching of projected coordinates needed. In contrast to getEastNorth()
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/BoundingXYVisitor.java

    r12630 r12725  
    7474     * Visiting call for lat/lon.
    7575     * @param latlon lat/lon
     76     * @since 12725 (public for ILatLon parameter)
     77     */
     78    public void visit(ILatLon latlon) {
     79        if (latlon != null) {
     80            visit(latlon.getEastNorth(Main.getProjection()));
     81        }
     82    }
     83
     84    /**
     85     * Visiting call for lat/lon.
     86     * @param latlon lat/lon
    7687     */
    7788    public void visit(LatLon latlon) {
    78         if (latlon != null) {
    79             visit((ILatLon) latlon);
    80         }
    81     }
    82 
    83     private void visit(ILatLon latlon) {
    84         visit(latlon.getEastNorth());
     89        visit((ILatLon) latlon);
    8590    }
    8691
     
    138143        bounds = new ProjectionBounds(new LatLon(
    139144                        Math.max(-90, minLatlon.lat() - enlargeDegree),
    140                         Math.max(-180, minLatlon.lon() - enlargeDegree)).getEastNorth(),
     145                        Math.max(-180, minLatlon.lon() - enlargeDegree)).getEastNorth(Main.getProjection()),
    141146                new LatLon(
    142147                        Math.min(90, maxLatlon.lat() + enlargeDegree),
    143                         Math.min(180, maxLatlon.lon() + enlargeDegree)).getEastNorth());
     148                        Math.min(180, maxLatlon.lon() + enlargeDegree)).getEastNorth(Main.getProjection()));
    144149    }
    145150
  • trunk/src/org/openstreetmap/josm/data/projection/Projections.java

    r12620 r12725  
    1919import org.openstreetmap.josm.Main;
    2020import org.openstreetmap.josm.data.coor.EastNorth;
     21import org.openstreetmap.josm.data.coor.ILatLon;
    2122import org.openstreetmap.josm.data.coor.LatLon;
    2223import org.openstreetmap.josm.data.projection.datum.Datum;
     
    192193     * @param ll the geographical point to convert (in WGS84 lat/lon)
    193194     * @return the corresponding east/north coordinates
    194      */
    195     public static EastNorth project(LatLon ll) {
     195     * @since 12725
     196     */
     197    public static EastNorth project(ILatLon ll) {
    196198        if (ll == null) return null;
    197199        return Main.getProjection().latlon2eastNorth(ll);
     200    }
     201
     202    /**
     203     * Convert from lat/lon to easting/northing using the current projection.
     204     *
     205     * @param ll the geographical point to convert (in WGS84 lat/lon)
     206     * @return the corresponding east/north coordinates
     207     */
     208    public static EastNorth project(LatLon ll) {
     209        return project((ILatLon) ll);
    198210    }
    199211
Note: See TracChangeset for help on using the changeset viewer.