public interface Viewport extends Cloneable
Viewport
allows to view a certain part of graphical data representations
given in coordinates defined in some model coordinate system. The Viewport
assumes
that there is an affine similiarity transformation
(translation, rotation, scaling) from the view to the model coordiate system.
Shearing transformations are not supported, but the coordinate system's
Y-axes may point in different directions.
The view coordinate system is a cartesian coordinate system with the X-axis pointing to the right and the Y-axis pointing downwards.
The model coordinate system is assumed to be cartesian coordinate system with the X-axis pointing
to the right and the Y-axis pointing either upwards or downwards.
See method isModelYAxisDown()
.
Modifier and Type | Method and Description |
---|---|
void |
addListener(ViewportListener listener)
Adds a change listener to this viewport.
|
Viewport |
clone()
Creates a clone of this viewport.
|
ViewportListener[] |
getListeners()
Gets all listeners added to this viewport.
|
AffineTransform |
getModelToViewTransform() |
double |
getOffsetX() |
double |
getOffsetY() |
double |
getOrientation() |
Rectangle |
getViewBounds() |
AffineTransform |
getViewToModelTransform() |
double |
getZoomFactor()
Gets the zoom factor.
|
boolean |
isModelYAxisDown() |
void |
moveViewDelta(double viewDeltaX,
double viewDeltaY)
Moves the model CS by translating it into the opposite direction of the given
vector in view coordinates.
|
void |
removeListener(ViewportListener listener)
Removes a change listener from this viewport.
|
void |
setModelYAxisDown(boolean modelYAxisDown) |
void |
setOffset(double offsetX,
double offsetY)
Sets the viewport's absolute offset in model coordinates.
|
void |
setOrientation(double orientation)
Sets the orientation angle relative to the viewport bound's center point.
|
void |
setTransform(Viewport otherViewport)
Modifies this viewport so that it matches the given one.
|
void |
setViewBounds(Rectangle bounds) |
void |
setZoomFactor(double zoomFactor)
Sets the zoom factor relative to the viewport bound's center point.
|
void |
setZoomFactor(double zoomFactor,
double modelCenterX,
double modelCenterY)
Zooms to the given point given in model coordinates.
|
void |
zoom(Rectangle2D modelArea)
Zooms to the given area given in model coordinates.
|
boolean isModelYAxisDown()
true
, the model coordinate's Y-axis points downwards. Returns false
by default.void setModelYAxisDown(boolean modelYAxisDown)
modelYAxisDown
- If true
, the model coordinate's Y-axis points downwards.Rectangle getViewBounds()
void setViewBounds(Rectangle bounds)
bounds
- The bounds in view coordinates.AffineTransform getViewToModelTransform()
AffineTransform getModelToViewTransform()
double getOffsetX()
double getOffsetY()
void setOffset(double offsetX, double offsetY)
offsetX
- The X-offset in model coordinates.offsetY
- The Y-offset in model coordinates.void moveViewDelta(double viewDeltaX, double viewDeltaY)
viewDeltaX
- the X delta in view coordinatesviewDeltaY
- the Y delta in view coordinatesdouble getZoomFactor()
void setZoomFactor(double zoomFactor)
zoomFactor
- The new zoom factor, must be greater than zero.IllegalArgumentException
- if zoomFactor is less than or equal to zerogetZoomFactor()
void setZoomFactor(double zoomFactor, double modelCenterX, double modelCenterY)
zoomFactor
- The new zoom factor, must be greater than zero.modelCenterX
- New X of the view's center point in model coordinates.modelCenterY
- New Y of the view's center point in model coordinates.IllegalArgumentException
- if zoomFactor is less than or equal to zerovoid zoom(Rectangle2D modelArea)
modelArea
- the area in model coordinatesdouble getOrientation()
void setOrientation(double orientation)
orientation
- the new orientation angle in radiansvoid setTransform(Viewport otherViewport)
otherViewport
- The view port to synchronize with.void addListener(ViewportListener listener)
listener
- The listener.void removeListener(ViewportListener listener)
listener
- The listener.ViewportListener[] getListeners()
Viewport clone()
Copyright © 2014–2017 European Space Agency (ESA). All rights reserved.