Class ViewportJ2D
- java.lang.Object
-
- jadex.extension.envsupport.observer.graphics.AbstractViewport
-
- jadex.extension.envsupport.observer.graphics.java2d.ViewportJ2D
-
- All Implemented Interfaces:
IViewport
,java.awt.event.ComponentListener
,java.util.EventListener
public class ViewportJ2D extends AbstractViewport implements java.awt.event.ComponentListener
This class manages the GUI and all user interaction.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class jadex.extension.envsupport.observer.graphics.AbstractViewport
AbstractViewport.MouseController
-
-
Field Summary
-
Fields inherited from class jadex.extension.envsupport.observer.graphics.AbstractViewport
areaSize_, bgColor_, canvas_, drawObjects_, inversionFlag_, objectLayers_, objectList_, objShiftX_, objShiftY_, paddedSize_, perspective, pixPosition_, position_, postLayers_, preLayers_, preserveAR_, rendering, size_, spacecontroller
-
-
Constructor Summary
Constructors Constructor Description ViewportJ2D(IPerspective persp, java.lang.ClassLoader classloader)
Creates a new Viewport.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
componentHidden(java.awt.event.ComponentEvent e)
void
componentMoved(java.awt.event.ComponentEvent e)
void
componentResized(java.awt.event.ComponentEvent e)
void
componentShown(java.awt.event.ComponentEvent e)
void
dispose()
Disposes the Viewport.void
drawPrimitive(DrawableCombiner dc, Primitive primitive, java.lang.Object obj)
Draws a primitivejava.awt.Graphics2D
getContext()
java.awt.geom.AffineTransform
getDefaultTransform()
Returns the default transform.java.awt.image.BufferedImage
getImage(java.lang.String path)
Returns an image for texturingjava.awt.geom.AffineTransform
getImageTransform(int sizeX, int sizeY)
Sets up the image transform.void
refresh()
Refreshes the viewport.-
Methods inherited from class jadex.extension.envsupport.observer.graphics.AbstractViewport
addViewportListener, getAreaSize, getCanvas, getCanvasSize, getClippingBox, getInvertX, getInvertY, getObjectShift, getPaddedSize, getPerspective, getPixelSize, getPosition, getSize, getSpaceController, getSpaceController, getWorldCoordinates, isShowing, refreshCanvasSize, removeViewportListener, setAreaSize, setBackground, setInvertX, setInvertY, setObjectList, setObjectShift, setPosition, setPostLayers, setPreLayers, setPreserveAspectRation, setSize, setZoomLimit
-
-
-
-
Constructor Detail
-
ViewportJ2D
public ViewportJ2D(IPerspective persp, java.lang.ClassLoader classloader)
Creates a new Viewport.- Parameters:
layerObject
- object holding properties for pre/postlayerslibService
- the library service
-
-
Method Detail
-
getImage
public java.awt.image.BufferedImage getImage(java.lang.String path)
Returns an image for texturing- Parameters:
path
- resource path of the image
-
refresh
public void refresh()
Description copied from interface:IViewport
Refreshes the viewport.
-
getContext
public java.awt.Graphics2D getContext()
-
getDefaultTransform
public java.awt.geom.AffineTransform getDefaultTransform()
Returns the default transform.- Returns:
- the default transform
-
getImageTransform
public java.awt.geom.AffineTransform getImageTransform(int sizeX, int sizeY)
Sets up the image transform.- Parameters:
sizeX
- image x-sizesizeY
- image y-size- Returns:
- the transform
-
drawPrimitive
public void drawPrimitive(DrawableCombiner dc, Primitive primitive, java.lang.Object obj)
Draws a primitive- Specified by:
drawPrimitive
in interfaceIViewport
- Parameters:
dc
- The combiner.primitive
- The primitive.obj
- The object being drawn.
-
componentHidden
public void componentHidden(java.awt.event.ComponentEvent e)
- Specified by:
componentHidden
in interfacejava.awt.event.ComponentListener
-
componentMoved
public void componentMoved(java.awt.event.ComponentEvent e)
- Specified by:
componentMoved
in interfacejava.awt.event.ComponentListener
-
componentResized
public void componentResized(java.awt.event.ComponentEvent e)
- Specified by:
componentResized
in interfacejava.awt.event.ComponentListener
-
componentShown
public void componentShown(java.awt.event.ComponentEvent e)
- Specified by:
componentShown
in interfacejava.awt.event.ComponentListener
-
-