Class MapViewState.MapViewPoint

java.lang.Object
org.openstreetmap.josm.gui.MapViewState.MapViewPoint
Direct Known Subclasses:
MapViewState.MapViewEastNorthPoint, MapViewState.MapViewViewPoint
Enclosing class:
MapViewState

public abstract class MapViewState.MapViewPoint extends Object
A class representing a point in the map view. It allows to convert between the different coordinate systems.
  • Constructor Details

  • Method Details

    • getMapViewState

      Gets the map view state this path is used for.
      Returns:
      The state.
      Since:
      12505
    • getInView

      public Point2D getInView()
      Get this point in view coordinates.
      Returns:
      The point in view coordinates.
    • getInViewX

      public abstract double getInViewX()
      Get the x coordinate in view space without creating an intermediate object.
      Returns:
      The x coordinate
      Since:
      10827
    • getInViewY

      public abstract double getInViewY()
      Get the y coordinate in view space without creating an intermediate object.
      Returns:
      The y coordinate
      Since:
      10827
    • getInWindow

      public Point2D getInWindow()
      Convert this point to window coordinates.
      Returns:
      The point in window coordinates.
    • getOnScreen

      public Point2D getOnScreen()
      Convert this point to screen coordinates.
      Returns:
      The point in screen coordinates.
    • getUsingCorner

    • getEastNorth

      Gets the EastNorth coordinate of this point.
      Returns:
      The east/north coordinate.
    • rectTo

      Create a rectangle from this to the other point.
      Parameters:
      other - The other point. Needs to be of the same MapViewState
      Returns:
      A rectangle.
    • getLatLon

      public LatLon getLatLon()
      Gets the current position in LatLon coordinates according to the current projection.
      Returns:
      The position as LatLon.
      See Also:
    • getLatLonClamped

      Gets the latlon coordinate clamped to the current world area.
      Returns:
      The lat/lon coordinate
      Since:
      10805
    • add

      Add the given offset to this point
      Parameters:
      en - The offset in east/north space.
      Returns:
      The new point
      Since:
      10651
    • isInView

      public boolean isInView()
      Check if this point is inside the view bounds. This is the case iff getOutsideRectangleFlags(getViewArea()) returns no flags
      Returns:
      true if it is.
      Since:
      10827
    • inRange

      private boolean inRange(double val, int min, double max)
    • getOutsideRectangleFlags

      Gets the direction in which this point is outside of the given view rectangle.
      Parameters:
      rect - The rectangle to check against.
      Returns:
      The direction in which it is outside of the view, as OUTSIDE_... flags.
      Since:
      10827
    • oneNormInView

      Gets the sum of the x/y view distances between the points. |x1 - x2| + |y1 - y2|
      Parameters:
      p2 - The other point
      Returns:
      The norm
      Since:
      10827
    • distanceToInViewSq

      Gets the squared distance between this point and an other point.
      Parameters:
      p2 - The other point
      Returns:
      The squared distance.
      Since:
      10827
    • distanceToInView

      Gets the distance between this point and an other point.
      Parameters:
      p2 - The other point
      Returns:
      The distance.
      Since:
      10827
    • interpolate

      Do a linear interpolation to the other point
      Parameters:
      p1 - The other point
      i - The interpolation factor. 0 is at the current point, 1 at the other point.
      Returns:
      The new point
      Since:
      10874