Changeset 12163 in josm for trunk/src/org/openstreetmap/josm


Ignore:
Timestamp:
2017-05-15T15:57:36+02:00 (7 years ago)
Author:
michael2402
Message:

Make use of ILatLon#getEastNorth

Location:
trunk/src/org/openstreetmap/josm
Files:
5 edited

Legend:

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

    r12161 r12163  
    282282        case DEGREES_MINUTES_SECONDS: return dms(y) + ((y < 0) ? SOUTH : NORTH);
    283283        case NAUTICAL: return dm(y) + ((y < 0) ? SOUTH : NORTH);
    284         case EAST_NORTH: return cDdFormatter.format(Main.getProjection().latlon2eastNorth(this).north());
     284        case EAST_NORTH: return cDdFormatter.format(this.getEastNorth().north());
    285285        default: return "ERR";
    286286        }
     
    302302        case DEGREES_MINUTES_SECONDS: return dms(x) + ((x < 0) ? WEST : EAST);
    303303        case NAUTICAL: return dm(x) + ((x < 0) ? WEST : EAST);
    304         case EAST_NORTH: return cDdFormatter.format(Main.getProjection().latlon2eastNorth(this).east());
     304        case EAST_NORTH: return cDdFormatter.format(this.getEastNorth().east());
    305305        default: return "ERR";
    306306        }
  • trunk/src/org/openstreetmap/josm/data/imagery/OffsetBookmark.java

    r12139 r12163  
    118118        LatLon center = getCenter();
    119119        Projection offsetProj = Projections.getProjectionByCode(projection_code);
    120         EastNorth centerEN = offsetProj.latlon2eastNorth(center);
     120        EastNorth centerEN = center.getEastNorth(offsetProj);
    121121        EastNorth shiftedEN = centerEN.add(getDisplacement());
    122122        LatLon shifted = offsetProj.eastNorth2latlon(shiftedEN);
    123         EastNorth centerEN2 = proj.latlon2eastNorth(center);
    124         EastNorth shiftedEN2 = proj.latlon2eastNorth(shifted);
     123        EastNorth centerEN2 = center.getEastNorth(proj);
     124        EastNorth shiftedEN2 = shifted.getEastNorth(proj);
    125125        return shiftedEN2.subtract(centerEN2);
    126126    }
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/BoundingXYVisitor.java

    r10806 r12163  
    77import org.openstreetmap.josm.data.Bounds;
    88import org.openstreetmap.josm.data.ProjectionBounds;
    9 import org.openstreetmap.josm.data.coor.CachedLatLon;
    109import org.openstreetmap.josm.data.coor.EastNorth;
     10import org.openstreetmap.josm.data.coor.ILatLon;
    1111import org.openstreetmap.josm.data.coor.LatLon;
    1212import org.openstreetmap.josm.data.osm.Node;
     
    2727    @Override
    2828    public void visit(Node n) {
    29         visit(n.getEastNorth());
     29        visit((ILatLon) n);
    3030    }
    3131
     
    7575    public void visit(LatLon latlon) {
    7676        if (latlon != null) {
    77             if (latlon instanceof CachedLatLon) {
    78                 visit(((CachedLatLon) latlon).getEastNorth());
    79             } else {
    80                 visit(Main.getProjection().latlon2eastNorth(latlon));
    81             }
    82         }
     77            visit((ILatLon) latlon);
     78        }
     79    }
     80
     81    private void visit(ILatLon latlon) {
     82        visit(latlon.getEastNorth());
    8383    }
    8484
     
    134134        LatLon minLatlon = Main.getProjection().eastNorth2latlon(bounds.getMin());
    135135        LatLon maxLatlon = Main.getProjection().eastNorth2latlon(bounds.getMax());
    136         bounds = new ProjectionBounds(
    137                 Main.getProjection().latlon2eastNorth(new LatLon(
     136        bounds = new ProjectionBounds(new LatLon(
    138137                        Math.max(-90, minLatlon.lat() - enlargeDegree),
    139                         Math.max(-180, minLatlon.lon() - enlargeDegree))),
    140                 Main.getProjection().latlon2eastNorth(new LatLon(
     138                        Math.max(-180, minLatlon.lon() - enlargeDegree)).getEastNorth(),
     139                new LatLon(
    141140                        Math.min(90, maxLatlon.lat() + enlargeDegree),
    142                         Math.min(180, maxLatlon.lon() + enlargeDegree))));
     141                        Math.min(180, maxLatlon.lon() + enlargeDegree)).getEastNorth());
    143142    }
    144143
  • trunk/src/org/openstreetmap/josm/data/projection/Projecting.java

    r12162 r12163  
    2525     * @param ll the geographical point to convert (in WGS84 lat/lon)
    2626     * @return the corresponding east/north coordinates
     27     * @see ILatLon#getEastNorth(Projecting)
    2728     */
    2829    default EastNorth latlon2eastNorth(LatLon ll) {
     
    3637     * @return the corresponding east/north coordinates
    3738     * @since 12161
     39     * @see ILatLon#getEastNorth(Projecting)
    3840     */
    3941    EastNorth latlon2eastNorth(ILatLon ll);
  • trunk/src/org/openstreetmap/josm/gui/NavigatableComponent.java

    r12119 r12163  
    3737import org.openstreetmap.josm.data.SystemOfMeasurement;
    3838import org.openstreetmap.josm.data.ViewportData;
    39 import org.openstreetmap.josm.data.coor.CachedLatLon;
    4039import org.openstreetmap.josm.data.coor.EastNorth;
     40import org.openstreetmap.josm.data.coor.ILatLon;
    4141import org.openstreetmap.josm.data.coor.LatLon;
    4242import org.openstreetmap.josm.data.osm.BBox;
     
    510510    /**
    511511     * Return the point on the screen where this Coordinate would be.
     512     *
     513     * Alternative: {@link #getState()}, then {@link MapViewState#getPointFor(ILatLon)}
    512514     * @param latlon The point, where this geopoint would be drawn.
    513515     * @return The point on screen where "point" would be drawn, relative to the own top/left.
    514516     */
    515517    public Point2D getPoint2D(LatLon latlon) {
    516         if (latlon == null)
     518        if (latlon == null) {
    517519            return new Point();
    518         else if (latlon instanceof CachedLatLon)
    519             return getPoint2D(((CachedLatLon) latlon).getEastNorth());
    520         else
    521             return getPoint2D(getProjection().latlon2eastNorth(latlon));
     520        } else {
     521            return getPoint2D(latlon.getEastNorth());
     522        }
    522523    }
    523524
    524525    /**
    525526     * Return the point on the screen where this Node would be.
     527     *
     528     * Alternative: {@link #getState()}, then {@link MapViewState#getPointFor(ILatLon)}
    526529     * @param n The node, where this geopoint would be drawn.
    527530     * @return The point on screen where "node" would be drawn, relative to the own top/left.
Note: See TracChangeset for help on using the changeset viewer.