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

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/NavigatableComponent.java

    r12636 r12725  
    516516     * @return The point on screen where "point" would be drawn, relative to the own top/left.
    517517     */
    518     public Point2D getPoint2D(LatLon latlon) {
     518    public Point2D getPoint2D(ILatLon latlon) {
    519519        if (latlon == null) {
    520520            return new Point();
    521521        } else {
    522             return getPoint2D(latlon.getEastNorth());
    523         }
     522            return getPoint2D(latlon.getEastNorth(Main.getProjection()));
     523        }
     524    }
     525
     526    /**
     527     * Return the point on the screen where this Coordinate would be.
     528     *
     529     * Alternative: {@link #getState()}, then {@link MapViewState#getPointFor(ILatLon)}
     530     * @param latlon The point, where this geopoint would be drawn.
     531     * @return The point on screen where "point" would be drawn, relative to the own top/left.
     532     */
     533    public Point2D getPoint2D(LatLon latlon) {
     534        return getPoint2D((ILatLon) latlon);
    524535    }
    525536
     
    551562     * @return point
    552563     * @see #getPoint2D(LatLon)
    553      */
    554     public Point getPoint(LatLon latlon) {
     564     * @since 12725
     565     */
     566    public Point getPoint(ILatLon latlon) {
    555567        Point2D d = getPoint2D(latlon);
    556568        return new Point((int) d.getX(), (int) d.getY());
     569    }
     570
     571    /**
     572     * looses precision, may overflow (depends on p and current scale)
     573     * @param latlon lat/lon
     574     * @return point
     575     * @see #getPoint2D(LatLon)
     576     */
     577    public Point getPoint(LatLon latlon) {
     578        return getPoint((ILatLon) latlon);
    557579    }
    558580
     
    690712     * Zoom to given lat/lon.
    691713     * @param newCenter new center coordinates
     714     * @since 12725
     715     */
     716    public void zoomTo(ILatLon newCenter) {
     717        zoomTo(Projections.project(newCenter));
     718    }
     719
     720    /**
     721     * Zoom to given lat/lon.
     722     * @param newCenter new center coordinates
    692723     */
    693724    public void zoomTo(LatLon newCenter) {
    694         zoomTo(Projections.project(newCenter));
     725        zoomTo((ILatLon) newCenter);
    695726    }
    696727
Note: See TracChangeset for help on using the changeset viewer.