Class AbstractViewport
- java.lang.Object
- 
- jadex.extension.envsupport.observer.graphics.AbstractViewport
 
- 
- All Implemented Interfaces:
- IViewport
 - Direct Known Subclasses:
- ViewportJ2D
 
 public abstract class AbstractViewport extends java.lang.Object implements IViewport 
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description protected classAbstractViewport.MouseController
 - 
Field SummaryFields Modifier and Type Field Description protected Vector2DoubleareaSize_Maximum displayable areaprotected java.awt.ColorbgColor_The background color.protected java.awt.Canvascanvas_Canvas for graphical output.protected java.util.SetdrawObjects_Known drawable Objects.protected IVector2inversionFlag_Axis inversion flagprotected java.util.SortedSetobjectLayers_Registered object layers.protected java.util.ListobjectList_List of objects that should be drawn.protected floatobjShiftX_Object shift x-coordinate.protected floatobjShiftY_Object shift y-coordinate.protected Vector2DoublepaddedSize_Real size of the viewport including padding.protected IPerspectiveperspectiveIPropertyObject holding properties for layers.protected IVector2pixPosition_Pixel-corrected viewport position.protected IVector2position_Virtual Viewport position.protected Layer[]postLayers_Layers applied after drawable renderingprotected Layer[]preLayers_Layers applied before drawable renderingprotected booleanpreserveAR_Flag aspect ratio preservation.protected booleanrenderingFlag to indicate that rendering is in progress.protected Vector2Doublesize_Size of the viewport without padding.protected ISpaceControllerspacecontrollerThe Space Controller
 - 
Constructor SummaryConstructors Constructor Description AbstractViewport(IPerspective perspective)
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddViewportListener(IViewportListener listener)Adds a IViewportListenerIVector2getAreaSize()Gets the maximum displayable size.java.awt.CanvasgetCanvas()Returns the canvas that is used for displaying the objects.IVector2getCanvasSize()Returns the size of the canvas as a vector.java.awt.RectanglegetClippingBox()Returns the clipping box.booleangetInvertX()Returns true if the x-axis is inverted (right-left instead of left-right).booleangetInvertY()Returns true if the y-axis is inverted (top-down instead of bottom-up).IVector2getObjectShift()Gets the shift of all objects.IVector2getPaddedSize()Returns the padded sizeIPerspectivegetPerspective()Get the perspective.IVector2getPixelSize()Returns the size of a pixel.IVector2getPosition()Gets the position of the viewport.IVector2getSize()Gets the size of the display area.ISpaceControllergetSpaceController()voidgetSpaceController(ISpaceController spacecontroller)IVector2getWorldCoordinates(int pixelX, int pixelY)Converts pixel coordinates into world coordinatesbooleanisShowing()Checks if this IViewport is showing on screen.voidrefreshCanvasSize()Refreshes the size of the canvas.voidremoveViewportListener(IViewportListener listener)Removes a IViewportListenervoidsetAreaSize(IVector2 areaSize)Sets the maximum displayable size.voidsetBackground(java.awt.Color bgColor)Sets the background color.voidsetInvertX(boolean b)If set to true, inverts the x-axis (right-left instead of left-right).voidsetInvertY(boolean b)If set to true, inverts the y-axis (top-down instead of bottom-up).voidsetObjectList(java.util.List objectList)Sets the current objects to draw.voidsetObjectShift(IVector2 objectShift)Sets the shift of all objects.voidsetPosition(IVector2 pos)Sets the position of the viewport.voidsetPostLayers(Layer[] layers)Sets the post-layers for the viewport.voidsetPreLayers(Layer[] layers)Sets the pre-layers for the viewport.voidsetPreserveAspectRation(boolean preserveAR)Sets whether the viewport should preserve the aspect ratio of the size by padding.voidsetSize(IVector2 size)Sets the size of the display area.voidsetZoomLimit(double zoomlimit)Sets the maximum zoom.- 
Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 - 
Methods inherited from interface jadex.extension.envsupport.observer.graphics.IViewportdispose, drawPrimitive, refresh
 
- 
 
- 
- 
- 
Field Detail- 
spacecontrollerprotected ISpaceController spacecontroller The Space Controller
 - 
inversionFlag_protected IVector2 inversionFlag_ Axis inversion flag
 - 
canvas_protected java.awt.Canvas canvas_ Canvas for graphical output.
 - 
bgColor_protected java.awt.Color bgColor_ The background color.
 - 
position_protected IVector2 position_ Virtual Viewport position.
 - 
pixPosition_protected IVector2 pixPosition_ Pixel-corrected viewport position.
 - 
objShiftX_protected float objShiftX_ Object shift x-coordinate.
 - 
objShiftY_protected float objShiftY_ Object shift y-coordinate.
 - 
preserveAR_protected boolean preserveAR_ Flag aspect ratio preservation.
 - 
size_protected Vector2Double size_ Size of the viewport without padding.
 - 
areaSize_protected Vector2Double areaSize_ Maximum displayable area
 - 
paddedSize_protected Vector2Double paddedSize_ Real size of the viewport including padding.
 - 
drawObjects_protected java.util.Set drawObjects_ Known drawable Objects.
 - 
objectLayers_protected java.util.SortedSet objectLayers_ Registered object layers.
 - 
objectList_protected java.util.List objectList_ List of objects that should be drawn.
 - 
preLayers_protected Layer[] preLayers_ Layers applied before drawable rendering
 - 
postLayers_protected Layer[] postLayers_ Layers applied after drawable rendering
 - 
perspectiveprotected IPerspective perspective IPropertyObject holding properties for layers.
 - 
renderingprotected volatile boolean rendering Flag to indicate that rendering is in progress.
 
- 
 - 
Constructor Detail- 
AbstractViewportpublic AbstractViewport(IPerspective perspective) 
 
- 
 - 
Method Detail- 
setBackgroundpublic void setBackground(java.awt.Color bgColor) Sets the background color.- Specified by:
- setBackgroundin interface- IViewport
- Parameters:
- bgColor- the background color
 
 - 
setObjectListpublic void setObjectList(java.util.List objectList) Sets the current objects to draw.- Specified by:
- setObjectListin interface- IViewport
- Parameters:
- objectList- objects that should be drawn
 
 - 
getCanvaspublic java.awt.Canvas getCanvas() Returns the canvas that is used for displaying the objects.
 - 
setPreLayerspublic void setPreLayers(Layer[] layers) Sets the pre-layers for the viewport.- Specified by:
- setPreLayersin interface- IViewport
- Parameters:
- layers- the pre-layers
 
 - 
setPostLayerspublic void setPostLayers(Layer[] layers) Sets the post-layers for the viewport.- Specified by:
- setPostLayersin interface- IViewport
- Parameters:
- layers- the post-layers
 
 - 
getSizepublic IVector2 getSize() Gets the size of the display area.
 - 
setSizepublic void setSize(IVector2 size) Sets the size of the display area.
 - 
getAreaSizepublic IVector2 getAreaSize() Gets the maximum displayable size.- Specified by:
- getAreaSizein interface- IViewport
- Returns:
- maximum area size.
 
 - 
setAreaSizepublic void setAreaSize(IVector2 areaSize) Sets the maximum displayable size.- Specified by:
- setAreaSizein interface- IViewport
- Parameters:
- areaSize- maximum area size.
 
 - 
getPaddedSizepublic IVector2 getPaddedSize() Returns the padded size- Returns:
- padded size
 
 - 
getClippingBoxpublic java.awt.Rectangle getClippingBox() Returns the clipping box.- Returns:
- clipping box
 
 - 
getPixelSizepublic IVector2 getPixelSize() Returns the size of a pixel.
 - 
getCanvasSizepublic IVector2 getCanvasSize() Returns the size of the canvas as a vector.- Returns:
- size of the canvas in pixel
 
 - 
refreshCanvasSizepublic void refreshCanvasSize() Refreshes the size of the canvas.- Specified by:
- refreshCanvasSizein interface- IViewport
 
 - 
getPositionpublic IVector2 getPosition() Gets the position of the viewport.- Specified by:
- getPositionin interface- IViewport
 
 - 
setPositionpublic void setPosition(IVector2 pos) Sets the position of the viewport.- Specified by:
- setPositionin interface- IViewport
 
 - 
setPreserveAspectRationpublic void setPreserveAspectRation(boolean preserveAR) Description copied from interface:IViewportSets whether the viewport should preserve the aspect ratio of the size by padding.- Specified by:
- setPreserveAspectRationin interface- IViewport
- Parameters:
- preserveAR- true to preserve aspect ratio, false otherwise
 
 - 
getInvertXpublic boolean getInvertX() Returns true if the x-axis is inverted (right-left instead of left-right).- Specified by:
- getInvertXin interface- IViewport
- Returns:
- true, if the x-axis is inverted
 
 - 
getInvertYpublic boolean getInvertY() Returns true if the y-axis is inverted (top-down instead of bottom-up).- Specified by:
- getInvertYin interface- IViewport
- Returns:
- true, if the y-axis is inverted
 
 - 
setInvertXpublic void setInvertX(boolean b) If set to true, inverts the x-axis (right-left instead of left-right).- Specified by:
- setInvertXin interface- IViewport
- Parameters:
- b- if true, inverts the x-axis
 
 - 
setInvertYpublic void setInvertY(boolean b) If set to true, inverts the y-axis (top-down instead of bottom-up).- Specified by:
- setInvertYin interface- IViewport
- Parameters:
- b- if true, inverts the y-axis
 
 - 
getObjectShiftpublic IVector2 getObjectShift() Gets the shift of all objects.
 - 
setObjectShiftpublic void setObjectShift(IVector2 objectShift) Sets the shift of all objects.- Specified by:
- setObjectShiftin interface- IViewport
 
 - 
setZoomLimitpublic void setZoomLimit(double zoomlimit) Sets the maximum zoom.- Specified by:
- setZoomLimitin interface- IViewport
- Parameters:
- zoomlimit- the zoom limit
 
 - 
isShowingpublic boolean isShowing() Checks if this IViewport is showing on screen.
 - 
addViewportListenerpublic void addViewportListener(IViewportListener listener) Adds a IViewportListener- Specified by:
- addViewportListenerin interface- IViewport
- Parameters:
- listener- new listener
 
 - 
removeViewportListenerpublic void removeViewportListener(IViewportListener listener) Removes a IViewportListener- Specified by:
- removeViewportListenerin interface- IViewport
- Parameters:
- listener- the listener
 
 - 
getPerspectivepublic IPerspective getPerspective() Get the perspective.- Specified by:
- getPerspectivein interface- IViewport
- Returns:
- The perspective.
 
 - 
getWorldCoordinatespublic IVector2 getWorldCoordinates(int pixelX, int pixelY) Converts pixel coordinates into world coordinates- Specified by:
- getWorldCoordinatesin interface- IViewport
- Parameters:
- pixelX- pixel x-coordinate
- pixelY- pixel y-coordinate
- Returns:
- world coordinates
 
 - 
getSpaceControllerpublic ISpaceController getSpaceController() - Specified by:
- getSpaceControllerin interface- IViewport
- Returns:
- the spacecontroller
 
 - 
getSpaceControllerpublic void getSpaceController(ISpaceController spacecontroller) 
 
- 
 
-