org.jzy3d.plot3d.rendering.canvas
Class CanvasAWT

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Canvas
          extended by javax.media.opengl.awt.GLCanvas
              extended by org.jzy3d.plot3d.rendering.canvas.CanvasAWT
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, javax.media.nativewindow.OffscreenLayerOption, javax.media.nativewindow.WindowClosingProtocol, javax.media.opengl.awt.AWTGLAutoDrawable, javax.media.opengl.awt.ComponentEvents, javax.media.opengl.GLAutoDrawable, javax.media.opengl.GLDrawable, ICanvas, IScreenCanvas

public class CanvasAWT
extends javax.media.opengl.awt.GLCanvas
implements IScreenCanvas

CanvasAWT is a base implementation that primarily allows to integrate a Jzy3d chart in an AWT application. Relying on JOGL's GLPanel, this canvas can actually be used in AWT, Swing, as well as SWT through org.jzy3d.bridge.swt.Bridge.adapt(swt,awt).

Author:
Martin Pernollet
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.awt.Canvas
Canvas.AccessibleAWTCanvas
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Nested classes/interfaces inherited from interface javax.media.nativewindow.WindowClosingProtocol
javax.media.nativewindow.WindowClosingProtocol.WindowClosingMode
 
Field Summary
protected  com.jogamp.opengl.util.Animator animator
           
protected  Renderer3d renderer
           
protected  View view
           
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface javax.media.opengl.GLAutoDrawable
SCREEN_CHANGE_ACTION_ENABLED
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
CanvasAWT(IChartComponentFactory factory, Scene scene, Quality quality)
           
CanvasAWT(IChartComponentFactory factory, Scene scene, Quality quality, javax.media.opengl.GLCapabilitiesImmutable glci)
           
CanvasAWT(IChartComponentFactory factory, Scene scene, Quality quality, javax.media.opengl.GLCapabilitiesImmutable glci, boolean traceGL, boolean debugGL)
          Initialize a CanvasAWT attached to a Scene, with a given rendering Quality.
 
Method Summary
 void addKeyController(Object o)
          A generic interface for mouse listener to remain Windowing toolkit independant. * Implementation of this method should simply cast the input assuming it will correspond to canvas-compatible mouse listener.
 void addMouseController(Object o)
          A generic interface for mouse listener to remain Windowing toolkit independant. * Implementation of this method should simply cast the input assuming it will correspond to canvas-compatible mouse listener.
 void dispose()
          Performs all required cleanup when destroying a Canvas.
 void forceRepaint()
          Invoked when a user requires the Canvas to be repainted (e.g. a non 3d layer has changed).
 String getDebugInfo()
           
 javax.media.opengl.GLDrawable getDrawable()
          Returns the GLDrawable associated with the canvas
 Renderer3d getRenderer()
           
 int getRendererHeight()
          Provide the actual renderer height for the open gl camera settings, which is obtained after a resize event.
 int getRendererWidth()
          Provide the actual renderer width for the open gl camera settings, which is obtained after a resize event.
 View getView()
          Provide a reference to the View that renders into this canvas.
 void removeKeyController(Object o)
          A generic interface for key listener to remain Windowing toolkit independant. * Implementation of this method should simply cast the input assuming it will correspond to canvas-compatible key listener.
 void removeMouseController(Object o)
          A generic interface for key listener to remain Windowing toolkit independant. * Implementation of this method should simply cast the input assuming it will correspond to canvas-compatible key listener.
 com.jogamp.opengl.util.texture.TextureData screenshot()
          Returns an image with the current renderer's size
 com.jogamp.opengl.util.texture.TextureData screenshot(File file)
           
 void triggerMouseEvent(MouseEvent e)
           
 void triggerMouseMotionEvent(MouseEvent e)
           
 void triggerMouseWheelEvent(MouseWheelEvent e)
           
 
Methods inherited from class javax.media.opengl.awt.GLCanvas
addGLEventListener, addGLEventListener, addNotify, createContext, destroy, display, getAnimator, getAutoSwapBufferMode, getChosenGLCapabilities, getContext, getContextCreationFlags, getDefaultCloseOperation, getDelegatedDrawable, getFactory, getGL, getGLProfile, getGraphicsConfiguration, getHandle, getNativeSurface, getRequestedGLCapabilities, getShallUseOffscreenLayer, getThreadName, getUpstreamWidget, invoke, isOffscreenLayerSurfaceEnabled, isRealized, main, paint, removeGLEventListener, removeGLEventListener, removeNotify, reshape, setAnimator, setAutoSwapBufferMode, setContext, setContextCreationFlags, setDefaultCloseOperation, setGL, setRealized, setShallUseOffscreenLayer, swapBuffers, toString, update
 
Methods inherited from class java.awt.Canvas
createBufferStrategy, createBufferStrategy, getAccessibleContext, getBufferStrategy
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, deliverEvent, disable, disableEvents, dispatchEvent, doLayout, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAlignmentX, getAlignmentY, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeys, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusCycleRoot, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, paramString, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, processComponentEvent, processEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFont, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, transferFocus, transferFocusBackward, transferFocusUpCycle, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.jzy3d.plot3d.rendering.canvas.IScreenCanvas
display, getAnimator
 
Methods inherited from interface javax.media.opengl.awt.AWTGLAutoDrawable
repaint, setSize
 
Methods inherited from interface javax.media.opengl.GLDrawable
getHeight, getWidth
 
Methods inherited from interface javax.media.opengl.awt.ComponentEvents
addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addPropertyChangeListener, addPropertyChangeListener, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener
 

Field Detail

view

protected View view

renderer

protected Renderer3d renderer

animator

protected com.jogamp.opengl.util.Animator animator
Constructor Detail

CanvasAWT

public CanvasAWT(IChartComponentFactory factory,
                 Scene scene,
                 Quality quality)

CanvasAWT

public CanvasAWT(IChartComponentFactory factory,
                 Scene scene,
                 Quality quality,
                 javax.media.opengl.GLCapabilitiesImmutable glci)

CanvasAWT

public CanvasAWT(IChartComponentFactory factory,
                 Scene scene,
                 Quality quality,
                 javax.media.opengl.GLCapabilitiesImmutable glci,
                 boolean traceGL,
                 boolean debugGL)
Initialize a CanvasAWT attached to a Scene, with a given rendering Quality.

Method Detail

dispose

public void dispose()
Description copied from interface: ICanvas
Performs all required cleanup when destroying a Canvas.

Specified by:
dispose in interface ICanvas

getDebugInfo

public String getDebugInfo()
Specified by:
getDebugInfo in interface ICanvas

forceRepaint

public void forceRepaint()
Description copied from interface: ICanvas
Invoked when a user requires the Canvas to be repainted (e.g. a non 3d layer has changed).

Specified by:
forceRepaint in interface ICanvas

screenshot

public com.jogamp.opengl.util.texture.TextureData screenshot(File file)
                                                      throws IOException
Specified by:
screenshot in interface ICanvas
Throws:
IOException

screenshot

public com.jogamp.opengl.util.texture.TextureData screenshot()
Description copied from interface: ICanvas
Returns an image with the current renderer's size

Specified by:
screenshot in interface ICanvas

triggerMouseEvent

public void triggerMouseEvent(MouseEvent e)

triggerMouseMotionEvent

public void triggerMouseMotionEvent(MouseEvent e)

triggerMouseWheelEvent

public void triggerMouseWheelEvent(MouseWheelEvent e)

addMouseController

public void addMouseController(Object o)
Description copied from interface: ICanvas
A generic interface for mouse listener to remain Windowing toolkit independant. * Implementation of this method should simply cast the input assuming it will correspond to canvas-compatible mouse listener.

Specified by:
addMouseController in interface ICanvas

addKeyController

public void addKeyController(Object o)
Description copied from interface: ICanvas
A generic interface for mouse listener to remain Windowing toolkit independant. * Implementation of this method should simply cast the input assuming it will correspond to canvas-compatible mouse listener.

Specified by:
addKeyController in interface ICanvas

removeMouseController

public void removeMouseController(Object o)
Description copied from interface: ICanvas
A generic interface for key listener to remain Windowing toolkit independant. * Implementation of this method should simply cast the input assuming it will correspond to canvas-compatible key listener.

Specified by:
removeMouseController in interface ICanvas

removeKeyController

public void removeKeyController(Object o)
Description copied from interface: ICanvas
A generic interface for key listener to remain Windowing toolkit independant. * Implementation of this method should simply cast the input assuming it will correspond to canvas-compatible key listener.

Specified by:
removeKeyController in interface ICanvas

getDrawable

public javax.media.opengl.GLDrawable getDrawable()
Description copied from interface: ICanvas
Returns the GLDrawable associated with the canvas

Specified by:
getDrawable in interface ICanvas

getRenderer

public Renderer3d getRenderer()
Specified by:
getRenderer in interface ICanvas

getView

public View getView()
Provide a reference to the View that renders into this canvas.

Specified by:
getView in interface ICanvas

getRendererWidth

public int getRendererWidth()
Provide the actual renderer width for the open gl camera settings, which is obtained after a resize event.

Specified by:
getRendererWidth in interface ICanvas

getRendererHeight

public int getRendererHeight()
Provide the actual renderer height for the open gl camera settings, which is obtained after a resize event.

Specified by:
getRendererHeight in interface ICanvas


Copyright © 2013. All rights reserved.