visad.java2d
Class DisplayRendererJ2D
- java.lang.Object
-
- visad.DisplayRenderer
-
- visad.java2d.DisplayRendererJ2D
-
- All Implemented Interfaces:
- java.util.EventListener, ControlListener, RendererSourceListener
- Direct Known Subclasses:
- DefaultDisplayRendererJ2D
public abstract class DisplayRendererJ2D extends DisplayRenderer implements RendererSourceListener
DisplayRendererJ2Dis the VisAD abstract super-class for background and metadata rendering algorithms. These complement depictions ofDataobjects created byDataRendererobjects.DisplayRendererJ2Dalso manages the overall relation ofDataRendereroutput to Java2D and manages the VisAD scene graph.It creates the binding between
Controlobjects and scene graphBehaviorobjects for direct manipulation ofControlobjects.DisplayRendererJ2Dis notSerializableand should not be copied between JVMs.
-
-
Constructor Summary
Constructors Constructor and Description DisplayRendererJ2D()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method and Description voidaddDirectManipulationSceneGraphComponent(VisADGroup group, DirectManipulationRendererJ2D renderer)voidaddKeyboardBehavior(KeyboardBehaviorJ2D behavior)Add aKeyboardBehaviorfor keyboard control of translation and zoom.voidaddSceneGraphComponent(VisADGroup group)booleananyCursorStringVector()booleananyDirects()voidclearScale(AxisScale axisScale)Remove a particular scale being rendered.voidclearScales()Remove all the scales being rendered.voidclearScene(DataRenderer renderer)voidcontrolChanged(ControlEvent evt)Update internal values from those in theRendererControl.VisADGroupcreateBasicSceneGraph(VisADCanvasJ2D c, MouseBehaviorJ2D m)Deprecated.use createBasicSceneGraph(VisADCanvasJ2D c, MouseBehaviorJ2D m, VisADAppearance bx, VisADAppearance cr) insteadVisADGroupcreateBasicSceneGraph(VisADCanvasJ2D c, MouseBehaviorJ2D m, VisADAppearance bx, VisADAppearance cr)Create scene graph root, if none exists, with Transform and direct manipulation root.abstract VisADGroupcreateSceneGraph(VisADCanvasJ2D c)Create scene graph root, if none exists, with Transform, direct manipulation root, and non-direct-manipulation root; create special graphics (e.g., 3-D box, SkewT background), any lights, any user interface embedded in scene.voiddepth_cursor(VisADRay ray)set a VisADRay along which to drag cursor in depth (in and out of screen)voiddrag_cursor(VisADRay ray, boolean first)drag cursor parallel to plane of screenvoiddrag_depth(float diff)drag cursor in depth (in and out of screen)voiddrawCursorStringVector(java.awt.Graphics graphics, java.awt.geom.AffineTransform tgeometry, int width, int height)WhenevercursorOnordirectOnistrue, display Strings in cursorStringVector.DataRendererfindDirect(VisADRay ray, int mouseModifiers)Returns a direct manipulation renderer if one is close to the specified ray (within pick threshold).VisADGroupgetBoxOnBranch()VisADCanvasJ2DgetCanvas()double[]getCursor()Returns the location of the last unmodified, middle mouse button press.VisADGroupgetCursorOnBranch()VisADGroupgetDirect()java.awt.image.BufferedImagegetImage()Get a snapshot of the displayed image.MouseBehaviorgetMouseBehavior()VisADGroupgetNonDirect()VisADGroupgetRoot()intgetTextureHeightMax()intgetTextureWidthMax()java.awt.geom.AffineTransformgetTrans()voidinitControl(RendererControl ctl)Internal method used to initialize newly createdRendererControlwith current renderer settings before it is actually connected to the renderer.booleanlegalDataRenderer(DataRenderer renderer)determine whether a DataRenderer is legal for this DisplayRendererControlmakeControl(ScalarMap map)Factory for constructing a subclass ofControlappropriate for the graphics API and for thisDisplayRenderer; invoked byScalarMapwhen it isaddMap()ed to aDisplay.DataRenderermakeDefaultRenderer()Factory for constructing the default subclass ofDataRendererfor thisDisplayRenderer.voidrender_trigger()trigger the graphics API to render the scene graph to the screen; intended to be over-ridden by graphics-API-specific extensions of DisplayRenderervoidrendererDeleted(DataRenderer renderer)voidsetClip(float xlow, float xhi, float ylow, float yhi)voidsetCursorOn(boolean on)set flag indicating whether the cursor should be displayed.voidsetDirectOn(boolean on)set flag indicating whether direct manipulation is activevoidsetDisplay(DisplayImpl dpy)SpecifyDisplayImplto be rendered.voidsetLineWidth(float width)voidsetScale(AxisScale axisScale)Set the scale for the appropriate axis.voidsetScale(int axis, int axis_ordinal, VisADLineArray array, float[] scale_color)Set the scale for the appropriate axis.voidsetScale(int axis, int axis_ordinal, VisADLineArray array, VisADTriangleArray labels, float[] scale_color)Set the scale for the appropriate axis.voidsetScaleOn(boolean on)Allow scales to be displayed if they are set on.voidsetTransform2D(java.awt.geom.AffineTransform t)voidsetWaitFlag(boolean b)Set the wait flag to the specified value.voidunsetClip()-
Methods inherited from class visad.DisplayRenderer
getAnimationString, getAnimationStringVisible, getBoxOn, getCursorColor, getCursorStringVector, getCursorStringVectorUnconditional, getDirectAxisValue, getDirectAxisValue, getDisplay, getMode2D, getPickThreshhold, getRendererControl, getRotateAboutCenter, getScaleRotation, getWaitFlag, getWaitMessageVisible, legalDisplayScalar, prepareAction, setAnimationString, setAnimationStringVisible, setBackgroundColor, setBackgroundColor, setBoxAspect, setBoxColor, setBoxColor, setBoxOn, setCursorColor, setCursorColor, setCursorStringOn, setCursorStringVector, setCursorStringVector, setForegroundColor, setForegroundColor, setPickThreshhold, setRotateAboutCenter, setScaleRotation, setWaitMessageVisible
-
-
-
-
Method Detail
-
setDisplay
public void setDisplay(DisplayImpl dpy) throws VisADException
SpecifyDisplayImplto be rendered.- Overrides:
setDisplayin classDisplayRenderer- Parameters:
dpy-Displayto render.- Throws:
VisADException- If aDisplayImplhas already been specified.
-
getRoot
public VisADGroup getRoot()
-
setClip
public void setClip(float xlow, float xhi, float ylow, float yhi)
-
unsetClip
public void unsetClip()
-
initControl
public void initControl(RendererControl ctl)
Internal method used to initialize newly createdRendererControlwith current renderer settings before it is actually connected to the renderer. This means that changes will not generateMonitorEvents.- Specified by:
initControlin classDisplayRenderer- Parameters:
ctl- RendererControl to initialize
-
controlChanged
public void controlChanged(ControlEvent evt) throws VisADException, java.rmi.RemoteException
Update internal values from those in theRendererControl.- Specified by:
controlChangedin interfaceControlListener- Parameters:
evt-ControlEventgenerated by a change to theRendererControl- Throws:
VisADExceptionjava.rmi.RemoteException
-
getTrans
public java.awt.geom.AffineTransform getTrans()
-
getCanvas
public VisADCanvasJ2D getCanvas()
-
getImage
public java.awt.image.BufferedImage getImage()
Description copied from class:DisplayRendererGet a snapshot of the displayed image.- Specified by:
getImagein classDisplayRenderer- Returns:
- The current image being displayed.
-
getCursorOnBranch
public VisADGroup getCursorOnBranch()
-
getBoxOnBranch
public VisADGroup getBoxOnBranch()
-
setCursorOn
public void setCursorOn(boolean on)
Description copied from class:DisplayRendererset flag indicating whether the cursor should be displayed.- Specified by:
setCursorOnin classDisplayRenderer- Parameters:
on- value of flag to set
-
setDirectOn
public void setDirectOn(boolean on)
Description copied from class:DisplayRendererset flag indicating whether direct manipulation is active- Specified by:
setDirectOnin classDisplayRenderer- Parameters:
on- value of flag to set
-
getDirect
public VisADGroup getDirect()
-
getNonDirect
public VisADGroup getNonDirect()
-
createSceneGraph
public abstract VisADGroup createSceneGraph(VisADCanvasJ2D c) throws DisplayException
Create scene graph root, if none exists, with Transform, direct manipulation root, and non-direct-manipulation root; create special graphics (e.g., 3-D box, SkewT background), any lights, any user interface embedded in scene.- Parameters:
c-- Returns:
- Scene graph root.
- Throws:
DisplayException
-
createBasicSceneGraph
public VisADGroup createBasicSceneGraph(VisADCanvasJ2D c, MouseBehaviorJ2D m) throws DisplayException
Deprecated. use createBasicSceneGraph(VisADCanvasJ2D c, MouseBehaviorJ2D m, VisADAppearance bx, VisADAppearance cr) instead- Throws:
DisplayException
-
createBasicSceneGraph
public VisADGroup createBasicSceneGraph(VisADCanvasJ2D c, MouseBehaviorJ2D m, VisADAppearance bx, VisADAppearance cr) throws DisplayException
Create scene graph root, if none exists, with Transform and direct manipulation root.- Parameters:
c-m-- Returns:
- Scene graph root.
- Throws:
DisplayException
-
getMouseBehavior
public MouseBehavior getMouseBehavior()
- Specified by:
getMouseBehaviorin classDisplayRenderer- Returns:
- the MouseBehavior for this display
-
addSceneGraphComponent
public void addSceneGraphComponent(VisADGroup group) throws DisplayException
- Throws:
DisplayException
-
addDirectManipulationSceneGraphComponent
public void addDirectManipulationSceneGraphComponent(VisADGroup group, DirectManipulationRendererJ2D renderer) throws DisplayException
- Throws:
DisplayException
-
clearScene
public void clearScene(DataRenderer renderer)
-
getCursor
public double[] getCursor()
Returns the location of the last unmodified, middle mouse button press.- Specified by:
getCursorin classDisplayRenderer- Returns:
- The location of the last unmodified, middle mouse button press as (Display.XAxis, Display.YAxis, 0.0).
-
depth_cursor
public void depth_cursor(VisADRay ray)
Description copied from class:DisplayRendererset a VisADRay along which to drag cursor in depth (in and out of screen)- Specified by:
depth_cursorin classDisplayRenderer- Parameters:
ray- VisADRay to set
-
drag_depth
public void drag_depth(float diff)
Description copied from class:DisplayRendererdrag cursor in depth (in and out of screen)- Specified by:
drag_depthin classDisplayRenderer- Parameters:
diff- amount to move cursor in depth (0.0 corresponds to no movement)
-
drag_cursor
public void drag_cursor(VisADRay ray, boolean first)
Description copied from class:DisplayRendererdrag cursor parallel to plane of screen- Specified by:
drag_cursorin classDisplayRenderer- Parameters:
ray- VisADRay that goes through new cursor locationfirst- true to indicate this is first call to drag_cursor() for this drag
-
render_trigger
public void render_trigger()
Description copied from class:DisplayRenderertrigger the graphics API to render the scene graph to the screen; intended to be over-ridden by graphics-API-specific extensions of DisplayRenderer- Overrides:
render_triggerin classDisplayRenderer
-
anyCursorStringVector
public boolean anyCursorStringVector()
-
drawCursorStringVector
public void drawCursorStringVector(java.awt.Graphics graphics, java.awt.geom.AffineTransform tgeometry, int width, int height)WhenevercursorOnordirectOnistrue, display Strings in cursorStringVector.- Parameters:
graphics-tgeometry-width-height-
-
findDirect
public DataRenderer findDirect(VisADRay ray, int mouseModifiers)
Description copied from class:DisplayRendererReturns a direct manipulation renderer if one is close to the specified ray (within pick threshold).- Specified by:
findDirectin classDisplayRenderer- Parameters:
ray- The ray used to look for a nearby direct manipulation renderer.mouseModifiers- Value of InputEvent.getModifiers().- Returns:
- DataRenderer or
null.
-
anyDirects
public boolean anyDirects()
- Specified by:
anyDirectsin classDisplayRenderer- Returns:
- flag indicating whether there are any direct manipulation DataRenderers linked to Display
-
setScaleOn
public void setScaleOn(boolean on)
Allow scales to be displayed if they are set on.- Specified by:
setScaleOnin classDisplayRenderer- Parameters:
on- true to turn them on, false to set them invisible
-
setScale
public void setScale(AxisScale axisScale) throws VisADException
Set the scale for the appropriate axis.- Specified by:
setScalein classDisplayRenderer- Parameters:
axisScale- AxisScale for this scale- Throws:
VisADException- couldn't set the scale
-
setScale
public void setScale(int axis, int axis_ordinal, VisADLineArray array, float[] scale_color) throws VisADExceptionSet the scale for the appropriate axis.- Specified by:
setScalein classDisplayRenderer- Parameters:
axis- axis for this scale (0 = XAxis, 1 = YAxis, 2 = ZAxis)axis_ordinal- position along the axisarray-VisADLineArrayrepresenting the scale plotscale_color- array (dim 3) representing the red, green and blue color values.- Throws:
VisADException- couldn't set the scale
-
setScale
public void setScale(int axis, int axis_ordinal, VisADLineArray array, VisADTriangleArray labels, float[] scale_color) throws VisADExceptionSet the scale for the appropriate axis.- Specified by:
setScalein classDisplayRenderer- Parameters:
axis- axis for this scale (0 = XAxis, 1 = YAxis, 2 = ZAxis)axis_ordinal- position along the axisarray-VisADLineArrayrepresenting the scale plotlabels-VisADTriangleArrayrepresenting the labels created using a font (can be null)scale_color- array (dim 3) representing the red, green and blue color values.- Throws:
VisADException- couldn't set the scale
-
clearScales
public void clearScales()
Remove all the scales being rendered.- Specified by:
clearScalesin classDisplayRenderer
-
clearScale
public void clearScale(AxisScale axisScale)
Remove a particular scale being rendered.- Specified by:
clearScalein classDisplayRenderer- Parameters:
axisScale- scale to be removed
-
setTransform2D
public void setTransform2D(java.awt.geom.AffineTransform t)
-
makeControl
public Control makeControl(ScalarMap map)
Factory for constructing a subclass ofControlappropriate for the graphics API and for thisDisplayRenderer; invoked byScalarMapwhen it isaddMap()ed to aDisplay.- Specified by:
makeControlin classDisplayRenderer- Parameters:
map- TheScalarMapfor which aControlshould be built.- Returns:
- The appropriate
Control.
-
makeDefaultRenderer
public DataRenderer makeDefaultRenderer()
Description copied from class:DisplayRendererFactory for constructing the default subclass ofDataRendererfor thisDisplayRenderer.- Specified by:
makeDefaultRendererin classDisplayRenderer- Returns:
- The default
DataRenderer.
-
legalDataRenderer
public boolean legalDataRenderer(DataRenderer renderer)
Description copied from class:DisplayRendererdetermine whether a DataRenderer is legal for this DisplayRenderer- Specified by:
legalDataRendererin classDisplayRenderer- Parameters:
renderer- DisplayRenderer to test for legality- Returns:
- true if renderer is legal
-
rendererDeleted
public void rendererDeleted(DataRenderer renderer)
- Specified by:
rendererDeletedin interfaceRendererSourceListener
-
setLineWidth
public void setLineWidth(float width)
-
addKeyboardBehavior
public void addKeyboardBehavior(KeyboardBehaviorJ2D behavior)
Add aKeyboardBehaviorfor keyboard control of translation and zoom. This adds aKeyListenerto the VisADCanvasJ2D to handle the behaviors for the arrow keys. Do not use this in conjunction with otherKeyListeners that handle events for the arrow keys.- Parameters:
behavior- keyboard behavior to add
-
setWaitFlag
public void setWaitFlag(boolean b)
Description copied from class:DisplayRendererSet the wait flag to the specified value. (When the wait flag is enabled, the user is informed that the application is busy, typically by displaying a Please wait . . . message at the bottom of theDisplay.) DisplayEvent.WAIT_ON and DisplayEvent.WAIT_OFF events are fired based on value of b.- Overrides:
setWaitFlagin classDisplayRenderer- Parameters:
b- Boolean value to which wait flag is set.
-
getTextureWidthMax
public int getTextureWidthMax()
- Specified by:
getTextureWidthMaxin classDisplayRenderer
-
getTextureHeightMax
public int getTextureHeightMax()
- Specified by:
getTextureHeightMaxin classDisplayRenderer
-
-
DMelt 3.0 © DataMelt by jWork.ORG