public final class MapViewState extends java.lang.Object implements java.io.Serializable
MapView
.Modifier and Type | Class and Description |
---|---|
private class |
MapViewState.MapViewEastNorthPoint |
class |
MapViewState.MapViewPoint
A class representing a point in the map view.
|
class |
MapViewState.MapViewRectangle
A rectangle on the MapView.
|
private class |
MapViewState.MapViewViewPoint |
Modifier and Type | Field and Description |
---|---|
private static int |
CLIP_BOUNDS
Additional pixels outside the view for where to start clipping.
|
static int |
OUTSIDE_BOTTOM
A flag indicating that the point is outside to the bottom of the map view.
|
static int |
OUTSIDE_LEFT
A flag indicating that the point is outside to the left of the map view.
|
static int |
OUTSIDE_RIGHT
A flag indicating that the point is outside to the right of the map view.
|
static int |
OUTSIDE_TOP
A flag indicating that the point is outside to the top of the map view.
|
private Projecting |
projecting |
private double |
scale |
private static long |
serialVersionUID |
private EastNorth |
topLeft
Top left
EastNorth coordinate of the view. |
private java.awt.Point |
topLeftInWindow |
private java.awt.Point |
topLeftOnScreen |
private int |
viewHeight |
private int |
viewWidth |
Modifier | Constructor and Description |
---|---|
private |
MapViewState(double scale,
MapViewState mvs) |
private |
MapViewState(EastNorth topLeft,
MapViewState mvs) |
private |
MapViewState(javax.swing.JComponent position,
MapViewState mvs) |
private |
MapViewState(Projecting projection,
int viewWidth,
int viewHeight,
double scale,
EastNorth topLeft) |
private |
MapViewState(Projecting projection,
int viewWidth,
int viewHeight,
double scale,
EastNorth topLeft,
java.awt.Point topLeftInWindow,
java.awt.Point topLeftOnScreen)
Create a new
MapViewState |
private |
MapViewState(Projecting projecting,
MapViewState mvs) |
Modifier and Type | Method and Description |
---|---|
private static EastNorth |
calculateDefaultCenter() |
static MapViewState |
createDefaultState(int width,
int height)
Create the default
MapViewState object for the given map view. |
private static java.awt.Point |
findTopLeftInWindow(javax.swing.JComponent position) |
private static java.awt.Point |
findTopLeftOnScreen(javax.swing.JComponent position) |
java.awt.geom.AffineTransform |
getAffineTransform()
Creates an affine transform that is used to convert the east/north coordinates to view coordinates.
|
java.awt.geom.Area |
getArea(Bounds bounds)
Returns the area for the given bounds.
|
MapViewState.MapViewPoint |
getCenter()
Gets the center of the view.
|
MapViewState.MapViewPoint |
getCenterAtPixel()
Gets the center of the view, rounded to a pixel coordinate
|
MapViewState.MapViewPoint |
getForView(double x,
double y)
Gets the MapViewPoint representation for a position in view coordinates.
|
MapViewState.MapViewPoint |
getPointFor(EastNorth eastNorth)
Gets the
MapViewState.MapViewPoint for the given EastNorth coordinate. |
MapViewState.MapViewPoint |
getPointFor(LatLon latlon)
Gets the
MapViewState.MapViewPoint for the given LatLon coordinate. |
MapViewState.MapViewPoint |
getPointFor(Node node)
Gets the
MapViewState.MapViewPoint for the given node. |
Projection |
getProjection()
Gets the current projection used for the MapView.
|
double |
getScale()
The scale in east/north units per pixel.
|
MapViewState.MapViewRectangle |
getViewArea()
Gets a rectangle representing the whole view area.
|
MapViewState.MapViewRectangle |
getViewArea(java.awt.geom.Rectangle2D rectangle)
Gets a rectangle of the view as map view area.
|
MapViewState.MapViewRectangle |
getViewClipRectangle()
Gets a rectangle that is several pixel bigger than the view.
|
double |
getViewHeight()
Gets the height of the view on the Screen;
|
double |
getViewWidth()
Gets the width of the view on the Screen;
|
MapViewState |
movedTo(MapViewState.MapViewPoint mapViewPoint,
EastNorth newEastNorthThere) |
MapViewState |
usingCenter(EastNorth newCenter)
Creates a new state that is the same as the current state except for that it is using a new center.
|
MapViewState |
usingLocation(javax.swing.JComponent positon)
Creates a new state that is the same as the current state except for that it is using the location of the given component.
|
MapViewState |
usingProjection(Projection projection)
Creates a state that uses the projection.
|
MapViewState |
usingScale(double newScale)
Creates a new state that is the same as the current state except for that it is using a new scale.
|
private static final long serialVersionUID
public static final int OUTSIDE_TOP
public static final int OUTSIDE_BOTTOM
public static final int OUTSIDE_LEFT
public static final int OUTSIDE_RIGHT
private static final int CLIP_BOUNDS
private final transient Projecting projecting
private final int viewWidth
private final int viewHeight
private final double scale
private final java.awt.Point topLeftOnScreen
private final java.awt.Point topLeftInWindow
private MapViewState(Projecting projection, int viewWidth, int viewHeight, double scale, EastNorth topLeft, java.awt.Point topLeftInWindow, java.awt.Point topLeftOnScreen)
MapViewState
projection
- The projection to use.viewWidth
- The view widthviewHeight
- The view heightscale
- The scale to usetopLeft
- The top left corner in east/north space.topLeftInWindow
- The top left point in windowtopLeftOnScreen
- The top left point on screenprivate MapViewState(Projecting projection, int viewWidth, int viewHeight, double scale, EastNorth topLeft)
private MapViewState(EastNorth topLeft, MapViewState mvs)
private MapViewState(double scale, MapViewState mvs)
private MapViewState(javax.swing.JComponent position, MapViewState mvs)
private MapViewState(Projecting projecting, MapViewState mvs)
private static java.awt.Point findTopLeftInWindow(javax.swing.JComponent position)
private static java.awt.Point findTopLeftOnScreen(javax.swing.JComponent position)
public double getScale()
public MapViewState.MapViewPoint getForView(double x, double y)
x
- The x coordinate inside the view.y
- The y coordinate inside the view.public MapViewState.MapViewPoint getPointFor(EastNorth eastNorth)
MapViewState.MapViewPoint
for the given EastNorth
coordinate.eastNorth
- the position.public MapViewState.MapViewPoint getPointFor(LatLon latlon)
MapViewState.MapViewPoint
for the given LatLon
coordinate.latlon
- the positionpublic MapViewState.MapViewPoint getPointFor(Node node)
MapViewState.MapViewPoint
for the given node. This is faster than getPointFor(LatLon)
because it uses the node east/north
cache.node
- The nodepublic MapViewState.MapViewRectangle getViewArea()
public MapViewState.MapViewRectangle getViewArea(java.awt.geom.Rectangle2D rectangle)
rectangle
- The rectangle to get.public MapViewState.MapViewPoint getCenter()
public MapViewState.MapViewPoint getCenterAtPixel()
public double getViewWidth()
public double getViewHeight()
public Projection getProjection()
public java.awt.geom.AffineTransform getAffineTransform()
public MapViewState.MapViewRectangle getViewClipRectangle()
public java.awt.geom.Area getArea(Bounds bounds)
bounds
- boundspublic MapViewState usingCenter(EastNorth newCenter)
newCenter
- The new center coordinate.public MapViewState movedTo(MapViewState.MapViewPoint mapViewPoint, EastNorth newEastNorthThere)
mapViewPoint
- The reference point.newEastNorthThere
- The east/north coordinate that should be there.public MapViewState usingScale(double newScale)
newScale
- The new scale to use.public MapViewState usingLocation(javax.swing.JComponent positon)
The view is moved so that the center is the same as the old center.
positon
- The new location to use.public MapViewState usingProjection(Projection projection)
projection
- The projection to use.public static MapViewState createDefaultState(int width, int height)
MapViewState
object for the given map view. The screen position won't be set so that this method can be used
before the view was added to the hirarchy.width
- The view widthheight
- The view heightprivate static EastNorth calculateDefaultCenter()