jadex.application.space.envsupport.observer.graphics
Interface IViewport

All Known Implementing Classes:
AbstractViewport, ViewportJ2D

public interface IViewport

This class manages the GUI and all user interaction.


Method Summary
 void addViewportListener(IViewportListener listener)
          Adds a IViewportListener
 void dispose()
          Disposes the Viewport.
 void drawPrimitive(DrawableCombiner dc, Primitive primitive, Object obj)
          Draws a primitive
 IVector2 getAreaSize()
          Gets the maximum displayable size.
 Canvas getCanvas()
          Returns the canvas that is used for displaying the objects.
 boolean getInvertX()
          Returns true if the x-axis is inverted (right-left instead of left-right).
 boolean getInvertY()
          Returns true if the y-axis is inverted (top-down instead of bottom-up).
 IPerspective getPerspective()
          Get the perspective.
 IVector2 getPosition()
          Gets the position of the viewport.
 IVector2 getSize()
          Gets the size of the display area.
 IVector2 getWorldCoordinates(int pixelX, int pixelY)
          Converts pixel coordinates into world coordinates
 boolean isShowing()
          Checks if this IViewport is showing on screen.
 void refresh()
          Refreshes the viewport.
 void refreshCanvasSize()
          Refreshes the size of the canvas.
 void removeViewportListener(IViewportListener listener)
          Removes a IViewportListener
 void setAreaSize(IVector2 areaSize)
          Sets the maximum displayable size.
 void setBackground(Color bgColor)
          Sets the background color.
 void setInvertX(boolean b)
          If set to true, inverts the x-axis (right-left instead of left-right).
 void setInvertY(boolean b)
          If set to true, inverts the y-axis (top-down instead of bottom-up).
 void setObjectList(List objectList)
          Sets the current objects to draw.
 void setObjectShift(IVector2 objectShift)
          Sets the shift of all objects.
 void setPosition(IVector2 pos)
          Sets the position of the bottom left corner of the viewport.
 void setPostLayers(Layer[] layer)
          Sets the layers that are applied after the drawables are drawn.
 void setPreLayers(Layer[] layer)
          Sets the layers that are applied before the drawables are drawn.
 void setPreserveAspectRation(boolean preserveAR)
          Sets whether the viewport should preserve the aspect ratio of the size by padding.
 void setSize(IVector2 size)
          Sets the viewport size.
 void setZoomLimit(double zoomlimit)
          Sets the maximum zoom.
 

Method Detail

getPosition

IVector2 getPosition()
Gets the position of the viewport.


setPosition

void setPosition(IVector2 pos)
Sets the position of the bottom left corner of the viewport.


setBackground

void setBackground(Color bgColor)
Sets the background color.

Parameters:
bgColor - the background color

getAreaSize

IVector2 getAreaSize()
Gets the maximum displayable size.

Returns:
maximum area size.

getSize

IVector2 getSize()
Gets the size of the display area.

Returns:
size of the display area, may be padded to preserve aspect ratio

setSize

void setSize(IVector2 size)
Sets the viewport size.

Parameters:
size - new viewport size

setAreaSize

void setAreaSize(IVector2 areaSize)
Sets the maximum displayable size.

Parameters:
areaSize - maximum area size.

refreshCanvasSize

void refreshCanvasSize()
Refreshes the size of the canvas.


setPreserveAspectRation

void setPreserveAspectRation(boolean preserveAR)
Sets whether the viewport should preserve the aspect ratio of the size by padding.

Parameters:
preserveAR - true to preserve aspect ratio, false otherwise

setObjectShift

void setObjectShift(IVector2 objectShift)
Sets the shift of all objects.


getInvertX

boolean getInvertX()
Returns true if the x-axis is inverted (right-left instead of left-right).

Returns:
true, if the x-axis is inverted

getInvertY

boolean getInvertY()
Returns true if the y-axis is inverted (top-down instead of bottom-up).

Returns:
true, if the y-axis is inverted

setInvertX

void setInvertX(boolean b)
If set to true, inverts the x-axis (right-left instead of left-right).

Parameters:
b - if true, inverts the x-axis

setInvertY

void setInvertY(boolean b)
If set to true, inverts the y-axis (top-down instead of bottom-up).

Parameters:
b - if true, inverts the y-axis

setPreLayers

void setPreLayers(Layer[] layer)
Sets the layers that are applied before the drawables are drawn.

Parameters:
layers - new layers

setPostLayers

void setPostLayers(Layer[] layer)
Sets the layers that are applied after the drawables are drawn.

Parameters:
layers - new layers

setObjectList

void setObjectList(List objectList)
Sets the current objects to draw.

Parameters:
objectList - objects that should be drawn

setZoomLimit

void setZoomLimit(double zoomlimit)
Sets the maximum zoom.

Parameters:
zoomlimit - the zoom limit

getCanvas

Canvas getCanvas()
Returns the canvas that is used for displaying the objects.


refresh

void refresh()
Refreshes the viewport.


isShowing

boolean isShowing()
Checks if this IViewport is showing on screen.

Returns:
true if the IViewport is showing, false otherwise

getWorldCoordinates

IVector2 getWorldCoordinates(int pixelX,
                             int pixelY)
Converts pixel coordinates into world coordinates

Parameters:
pixelX - pixel x-coordinate
pixelY - pixel y-coordinate
Returns:
world coordinates

addViewportListener

void addViewportListener(IViewportListener listener)
Adds a IViewportListener

Parameters:
listener - new listener

removeViewportListener

void removeViewportListener(IViewportListener listener)
Removes a IViewportListener

Parameters:
listener - the listener

getPerspective

IPerspective getPerspective()
Get the perspective.

Returns:
The perspective.

drawPrimitive

void drawPrimitive(DrawableCombiner dc,
                   Primitive primitive,
                   Object obj)
Draws a primitive

Parameters:
dc - The combiner.
primitive - The primitive.
obj - The object being drawn.

dispose

void dispose()
Disposes the Viewport.



Copyright © 2010. All Rights Reserved.