Package com.bc.ceres.grender
Interface Viewport
- 
- All Superinterfaces:
- Cloneable
 - All Known Implementing Classes:
- DefaultViewport
 
 public interface Viewport extends Cloneable AViewportallows to view a certain part of graphical data representations given in coordinates defined in some model coordinate system. TheViewportassumes 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().
- 
- 
Method SummaryAll Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddListener(ViewportListener listener)Adds a change listener to this viewport.Viewportclone()Creates a clone of this viewport.ViewportListener[]getListeners()Gets all listeners added to this viewport.AffineTransformgetModelToViewTransform()doublegetOffsetX()doublegetOffsetY()doublegetOrientation()RectanglegetViewBounds()AffineTransformgetViewToModelTransform()doublegetZoomFactor()Gets the zoom factor.booleanisModelYAxisDown()voidmoveViewDelta(double viewDeltaX, double viewDeltaY)Moves the model CS by translating it into the opposite direction of the given vector in view coordinates.voidremoveListener(ViewportListener listener)Removes a change listener from this viewport.voidsetModelYAxisDown(boolean modelYAxisDown)voidsetOffset(double offsetX, double offsetY)Sets the viewport's absolute offset in model coordinates.voidsetOrientation(double orientation)Sets the orientation angle relative to the viewport bound's center point.voidsetTransform(Viewport otherViewport)Modifies this viewport so that it matches the given one.voidsetViewBounds(Rectangle bounds)voidsetZoomFactor(double zoomFactor)Sets the zoom factor relative to the viewport bound's center point.voidsetZoomFactor(double zoomFactor, double modelCenterX, double modelCenterY)Zooms to the given point given in model coordinates.voidzoom(Rectangle2D modelArea)Zooms to the given area given in model coordinates.
 
- 
- 
- 
Method Detail- 
isModelYAxisDownboolean isModelYAxisDown() - Returns:
- If true, the model coordinate's Y-axis points downwards. Returnsfalseby default.
 
 - 
setModelYAxisDownvoid setModelYAxisDown(boolean modelYAxisDown) - Parameters:
- modelYAxisDown- If- true, the model coordinate's Y-axis points downwards.
 
 - 
getViewBoundsRectangle getViewBounds() - Returns:
- The bounds in view coordinates.
 
 - 
setViewBoundsvoid setViewBounds(Rectangle bounds) - Parameters:
- bounds- The bounds in view coordinates.
 
 - 
getViewToModelTransformAffineTransform getViewToModelTransform() - Returns:
- The affine transformation from view to model coordinates.
 
 - 
getModelToViewTransformAffineTransform getModelToViewTransform() - Returns:
- The affine transformation from model to view coordinates.
 
 - 
getOffsetXdouble getOffsetX() - Returns:
- The viewport's absolute X-offset in model coordinates.
 
 - 
getOffsetYdouble getOffsetY() - Returns:
- The viewport's absolute Y-offset in model coordinates.
 
 - 
setOffsetvoid setOffset(double offsetX, double offsetY)Sets the viewport's absolute offset in model coordinates.- Parameters:
- offsetX- The X-offset in model coordinates.
- offsetY- The Y-offset in model coordinates.
 
 - 
moveViewDeltavoid moveViewDelta(double viewDeltaX, double viewDeltaY)Moves the model CS by translating it into the opposite direction of the given vector in view coordinates.- Parameters:
- viewDeltaX- the X delta in view coordinates
- viewDeltaY- the Y delta in view coordinates
 
 - 
getZoomFactordouble getZoomFactor() Gets the zoom factor. The zoom factor is equal to the number of model units per view unit.- Returns:
- The zoom factor.
 
 - 
setZoomFactorvoid setZoomFactor(double zoomFactor) Sets the zoom factor relative to the viewport bound's center point.- Parameters:
- zoomFactor- The new zoom factor, must be greater than zero.
- Throws:
- IllegalArgumentException- if zoomFactor is less than or equal to zero
- See Also:
- getZoomFactor()
 
 - 
setZoomFactorvoid setZoomFactor(double zoomFactor, double modelCenterX, double modelCenterY)Zooms to the given point given in model coordinates.- Parameters:
- 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.
- Throws:
- IllegalArgumentException- if zoomFactor is less than or equal to zero
 
 - 
zoomvoid zoom(Rectangle2D modelArea) Zooms to the given area given in model coordinates.- Parameters:
- modelArea- the area in model coordinates
 
 - 
getOrientationdouble getOrientation() - Returns:
- The rotation angle in radians.
 
 - 
setOrientationvoid setOrientation(double orientation) Sets the orientation angle relative to the viewport bound's center point.- Parameters:
- orientation- the new orientation angle in radians
 
 - 
setTransformvoid setTransform(Viewport otherViewport) Modifies this viewport so that it matches the given one.- Parameters:
- otherViewport- The view port to synchronize with.
 
 - 
addListenervoid addListener(ViewportListener listener) Adds a change listener to this viewport.- Parameters:
- listener- The listener.
 
 - 
removeListenervoid removeListener(ViewportListener listener) Removes a change listener from this viewport.- Parameters:
- listener- The listener.
 
 - 
getListenersViewportListener[] getListeners() Gets all listeners added to this viewport.- Returns:
- The listeners.
 
 - 
cloneViewport clone() Creates a clone of this viewport. The clone is a deep copy of this viewport but doesn't copy its listeners.- Returns:
- The clone.
 
 
- 
 
-