Package org.openstreetmap.josm.gui
Class MapViewState.MapViewPoint
java.lang.Object
org.openstreetmap.josm.gui.MapViewState.MapViewPoint
- Direct Known Subclasses:
MapViewState.MapViewEastNorthPoint,MapViewState.MapViewViewPoint
- Enclosing class:
- MapViewState
A class representing a point in the map view. It allows to convert between the different coordinate systems.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdd the given offset to this pointdoubleGets the distance between this point and an other point.doubleGets the squared distance between this point and an other point.Gets theEastNorthcoordinate of this point.Get this point in view coordinates.abstract doubleGet the x coordinate in view space without creating an intermediate object.abstract doubleGet the y coordinate in view space without creating an intermediate object.Convert this point to window coordinates.Gets the current position in LatLon coordinates according to the current projection.Gets the latlon coordinate clamped to the current world area.Gets the map view state this path is used for.Convert this point to screen coordinates.intGets the direction in which this point is outside of the given view rectangle.private Point2D.DoublegetUsingCorner(Point corner) private booleaninRange(double val, int min, double max) interpolate(MapViewState.MapViewPoint p1, double i) Do a linear interpolation to the other pointbooleanisInView()Check if this point is inside the view bounds.doubleGets the sum of the x/y view distances between the points.rectTo(MapViewState.MapViewPoint other) Create a rectangle from this to the other point.
-
Constructor Details
-
MapViewPoint
public MapViewPoint()
-
-
Method Details
-
getMapViewState
Gets the map view state this path is used for.- Returns:
- The state.
- Since:
- 12505
-
getInView
Get this point in view coordinates.- Returns:
- The point in view coordinates.
-
getInViewX
Get the x coordinate in view space without creating an intermediate object.- Returns:
- The x coordinate
- Since:
- 10827
-
getInViewY
Get the y coordinate in view space without creating an intermediate object.- Returns:
- The y coordinate
- Since:
- 10827
-
getInWindow
Convert this point to window coordinates.- Returns:
- The point in window coordinates.
-
getOnScreen
Convert this point to screen coordinates.- Returns:
- The point in screen coordinates.
-
getUsingCorner
-
getEastNorth
Gets theEastNorthcoordinate 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 sameMapViewState- Returns:
- A rectangle.
-
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
Check if this point is inside the view bounds. This is the case iffgetOutsideRectangleFlags(getViewArea())returns no flags- Returns:
- true if it is.
- Since:
- 10827
-
inRange
-
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 pointi- The interpolation factor. 0 is at the current point, 1 at the other point.- Returns:
- The new point
- Since:
- 10874
-