Package com.bc.ceres.grender.support
Class DefaultViewport
java.lang.Object
com.bc.ceres.grender.support.DefaultViewport
- 
Constructor SummaryConstructorsConstructorDescriptionDefaultViewport(boolean modelYAxisDown) DefaultViewport(Rectangle viewBounds) DefaultViewport(Rectangle viewBounds, boolean modelYAxisDown) 
- 
Method SummaryModifier and TypeMethodDescriptionvoidaddListener(ViewportListener listener) Adds a change listener to this viewport.clone()Creates a clone of this viewport.protected voidfireViewportChanged(boolean orientationChanged) Gets all listeners added to this viewport.doubledoubledoubledoubleGets the zoom factor.booleanvoidmoveViewDelta(double deltaX, double deltaY) 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 other) Modifies this viewport so that it matches the given one.voidsetViewBounds(Rectangle viewBounds) 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.toString()voidzoom(Rectangle2D modelBounds) Zooms to the given area given in model coordinates.
- 
Constructor Details- 
DefaultViewportpublic DefaultViewport()
- 
DefaultViewport
- 
DefaultViewportpublic DefaultViewport(boolean modelYAxisDown) 
- 
DefaultViewport
 
- 
- 
Method Details- 
isModelYAxisDownpublic boolean isModelYAxisDown()- Specified by:
- isModelYAxisDownin interface- Viewport
- Returns:
- If true, the model coordinate's Y-axis points downwards. Returnsfalseby default.
 
- 
setModelYAxisDownpublic void setModelYAxisDown(boolean modelYAxisDown) - Specified by:
- setModelYAxisDownin interface- Viewport
- Parameters:
- modelYAxisDown- If- true, the model coordinate's Y-axis points downwards.
 
- 
getViewBounds- Specified by:
- getViewBoundsin interface- Viewport
- Returns:
- The bounds in view coordinates.
 
- 
setViewBounds- Specified by:
- setViewBoundsin interface- Viewport
- Parameters:
- viewBounds- The bounds in view coordinates.
 
- 
getViewToModelTransform- Specified by:
- getViewToModelTransformin interface- Viewport
- Returns:
- The affine transformation from view to model coordinates.
 
- 
getModelToViewTransform- Specified by:
- getModelToViewTransformin interface- Viewport
- Returns:
- The affine transformation from model to view coordinates.
 
- 
getOrientationpublic double getOrientation()- Specified by:
- getOrientationin interface- Viewport
- Returns:
- The rotation angle in radians.
 
- 
setOrientationpublic void setOrientation(double orientation) Description copied from interface:ViewportSets the orientation angle relative to the viewport bound's center point.- Specified by:
- setOrientationin interface- Viewport
- Parameters:
- orientation- the new orientation angle in radians
 
- 
getOffsetXpublic double getOffsetX()- Specified by:
- getOffsetXin interface- Viewport
- Returns:
- The viewport's absolute X-offset in model coordinates.
 
- 
getOffsetYpublic double getOffsetY()- Specified by:
- getOffsetYin interface- Viewport
- Returns:
- The viewport's absolute Y-offset in model coordinates.
 
- 
setOffsetpublic void setOffset(double offsetX, double offsetY) Description copied from interface:ViewportSets the viewport's absolute offset in model coordinates.
- 
moveViewDeltapublic void moveViewDelta(double deltaX, double deltaY) Description copied from interface:ViewportMoves the model CS by translating it into the opposite direction of the given vector in view coordinates.- Specified by:
- moveViewDeltain interface- Viewport
- Parameters:
- deltaX- the X delta in view coordinates
- deltaY- the Y delta in view coordinates
 
- 
getZoomFactorpublic double getZoomFactor()Description copied from interface:ViewportGets the zoom factor. The zoom factor is equal to the number of model units per view unit.- Specified by:
- getZoomFactorin interface- Viewport
- Returns:
- The zoom factor.
 
- 
setZoomFactorpublic void setZoomFactor(double zoomFactor) Description copied from interface:ViewportSets the zoom factor relative to the viewport bound's center point.- Specified by:
- setZoomFactorin interface- Viewport
- Parameters:
- zoomFactor- The new zoom factor, must be greater than zero.
- See Also:
 
- 
zoomDescription copied from interface:ViewportZooms to the given area given in model coordinates.
- 
setZoomFactorpublic void setZoomFactor(double zoomFactor, double modelCenterX, double modelCenterY) Description copied from interface:ViewportZooms to the given point given in model coordinates.- Specified by:
- setZoomFactorin interface- Viewport
- 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.
 
- 
addListenerDescription copied from interface:ViewportAdds a change listener to this viewport.- Specified by:
- addListenerin interface- Viewport
- Parameters:
- listener- The listener.
 
- 
removeListenerDescription copied from interface:ViewportRemoves a change listener from this viewport.- Specified by:
- removeListenerin interface- Viewport
- Parameters:
- listener- The listener.
 
- 
getListenersDescription copied from interface:ViewportGets all listeners added to this viewport.- Specified by:
- getListenersin interface- Viewport
- Returns:
- The listeners.
 
- 
setTransformDescription copied from interface:ViewportModifies this viewport so that it matches the given one.- Specified by:
- setTransformin interface- Viewport
- Parameters:
- other- The view port to synchronize with.
 
- 
fireViewportChangedprotected void fireViewportChanged(boolean orientationChanged) 
- 
toString
- 
cloneDescription copied from interface:ViewportCreates a clone of this viewport. The clone is a deep copy of this viewport but doesn't copy its listeners.
 
-