visad.java3d
Class DisplayRendererJ3D
- java.lang.Object
-
- visad.DisplayRenderer
-
- visad.java3d.DisplayRendererJ3D
-
- All Implemented Interfaces:
- java.util.EventListener, ControlListener, RendererSourceListener
- Direct Known Subclasses:
- DefaultDisplayRendererJ3D, ImmersaDeskDisplayRendererJ3D, TransformOnlyDisplayRendererJ3D, TwoDDisplayRendererJ3D
public abstract class DisplayRendererJ3D extends DisplayRenderer implements RendererSourceListener
DisplayRendererJ3Dis the VisAD abstract super-class for background and metadata rendering algorithms. These complement depictions ofDataobjects created byDataRendererobjects.DisplayRendererJ3Dalso manages the overall relation ofDataRendereroutput to Java3D and manages the scene graph.It creates the binding between
Controlobjects and scene graphBehaviorobjects for direct manipulation ofControlobjects.DisplayRendererJ3Dis notSerializableand should not be copied between JVMs.
-
-
Constructor Summary
Constructors Constructor and Description DisplayRendererJ3D()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method and Description voidaddDirectManipulationSceneGraphComponent(javax.media.j3d.Group group, DirectManipulationRendererJ3D renderer)voidaddKeyboardBehavior(KeyboardBehaviorJ3D behavior)Add aKeyboardBehaviorfor keyboard control of rotation, translation and zoom.voidaddLockedSceneGraphComponent(javax.media.j3d.Group group)voidaddLockedSceneGraphComponent(javax.media.j3d.Group group, boolean initWithProj)voidaddSceneGraphComponent(javax.media.j3d.Group group)booleananyDirects()Check to see if there are anyDirectManipulationRenderers in this display.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.javax.media.j3d.BranchGroupcreateBasicSceneGraph(javax.media.j3d.View v, javax.media.j3d.TransformGroup vpt, VisADCanvasJ3D c, MouseBehaviorJ3D m)Deprecated.use createBasicSceneGraph(View v, TransformGroup vpt, VisADCanvasJ3D c, MouseBehaviorJ3D m, ColoringAttributes bc, ColoringAttributes cc) insteadjavax.media.j3d.BranchGroupcreateBasicSceneGraph(javax.media.j3d.View v, javax.media.j3d.TransformGroup vpt, VisADCanvasJ3D c, MouseBehaviorJ3D m, javax.media.j3d.ColoringAttributes bc, javax.media.j3d.ColoringAttributes cc)Create scene graph root, if none exists, with Transform and direct manipulation root.abstract javax.media.j3d.BranchGroupcreateSceneGraph(javax.media.j3d.View v, javax.media.j3d.TransformGroup vpt, VisADCanvasJ3D c)Create scene graph root, if none exists, with Transform and 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)voiddestroy()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(VisADCanvasJ3D canvas)WhenevercursorOnordirectOnis true, display Strings in cursorStringVector.DataRendererfindDirect(VisADRay ray, int mouseModifiers)Find theDataRendererthat is closest to the ray and uses the specified mouse modifiers for direct manipulation.javax.media.j3d.BranchGroupgetBoxOnBranch()VisADCanvasJ3DgetCanvas()Get the canvas for this rendererdouble[]getCursor()Get the cusor location.javax.media.j3d.BranchGroupgetCursorOnBranch()java.awt.image.BufferedImagegetImage()Capture the display rendition as an image.KeyboardBehaviorgetKeyboardBehavior()Get theKeyboardBehaviorassociated with this renderer.MouseBehaviorgetMouseBehavior()Get theMouseBehaviorassociated with this renderer.javax.media.j3d.BranchGroupgetRoot()intgetTextureHeightMax()intgetTextureWidthMax()javax.media.j3d.TransformGroupgetTrans()javax.media.j3d.ViewgetView()javax.media.j3d.TransformGroupgetViewTrans()voidinitControl(RendererControl ctl)Internal method used to initialize newly createdRendererControlwith current renderer settings before it is actually connected to the renderer.booleanlegalDataRenderer(DataRenderer renderer)Check if theDataRendererin question is legal for thisDisplayRendererControlmakeControl(ScalarMap map)Factory for constructing a subclass ofControlappropriate for the graphics API and for thisDisplayRenderer; invoked byScalarMapwhen it isaddMap()ed to aDisplay.DataRenderermakeDefaultRenderer()Create the defaultDataRendererfor this type ofDisplayRenderervoidrender_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(int plane, boolean enable, float a, float b, float c, float d)Define a clipping plane in (XAxis, YAxis, ZAxis) space.voidsetCursorLoc(float x, float y, float z)Set the cursor locationvoidsetCursorOn(boolean on)Toggle the cursor in the displayvoidsetDirectOn(boolean on)Set the flag for direct manipulationvoidsetDisplay(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)Set the scales on.static voidsetSceneGraphObjectName(javax.media.j3d.SceneGraphObject obj, java.lang.String name)Set the name of aSceneGraphObject.voidsetTransform3D(javax.media.j3d.Transform3D t)voidsetWaitFlag(boolean b)Set the wait flag to the specified value.voidupdateLockedTrans(double[] matrix)-
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
-
setSceneGraphObjectName
public static void setSceneGraphObjectName(javax.media.j3d.SceneGraphObject obj, java.lang.String name)Set the name of aSceneGraphObject. IfSceneGraphObjectdoes not have asetName(J3D pre v1.4) this is a no-op.- Parameters:
name-
-
destroy
public void destroy()
-
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.
-
getView
public javax.media.j3d.View getView()
-
getViewTrans
public javax.media.j3d.TransformGroup getViewTrans()
-
getCanvas
public VisADCanvasJ3D getCanvas()
Get the canvas for this renderer- Returns:
VisADCanvasJ3Dthat this renderer uses.
-
getImage
public java.awt.image.BufferedImage getImage()
Capture the display rendition as an image.- Specified by:
getImagein classDisplayRenderer- Returns:
- image of the display.
-
getRoot
public javax.media.j3d.BranchGroup getRoot()
-
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)
Update internal values from those in theRendererControl.- Specified by:
controlChangedin interfaceControlListener- Parameters:
evt-ControlEventgenerated by a change to theRendererControl
-
getTrans
public javax.media.j3d.TransformGroup getTrans()
-
getCursorOnBranch
public javax.media.j3d.BranchGroup getCursorOnBranch()
-
getBoxOnBranch
public javax.media.j3d.BranchGroup getBoxOnBranch()
-
setCursorOn
public void setCursorOn(boolean on)
Toggle the cursor in the display- Specified by:
setCursorOnin classDisplayRenderer- Parameters:
on- true to display the cursor, false to hide it.
-
setDirectOn
public void setDirectOn(boolean on)
Set the flag for direct manipulation- Specified by:
setDirectOnin classDisplayRenderer- Parameters:
on- true for enabling direct manipulation, false to disable
-
createSceneGraph
public abstract javax.media.j3d.BranchGroup createSceneGraph(javax.media.j3d.View v, javax.media.j3d.TransformGroup vpt, VisADCanvasJ3D c)Create scene graph root, if none exists, with Transform and direct manipulation root; create special graphics (e.g., 3-D box, SkewT background), any lights, any user interface embedded in scene.- Parameters:
v-vpt-c-- Returns:
- Scene graph root.
-
createBasicSceneGraph
public javax.media.j3d.BranchGroup createBasicSceneGraph(javax.media.j3d.View v, javax.media.j3d.TransformGroup vpt, VisADCanvasJ3D c, MouseBehaviorJ3D m)Deprecated. use createBasicSceneGraph(View v, TransformGroup vpt, VisADCanvasJ3D c, MouseBehaviorJ3D m, ColoringAttributes bc, ColoringAttributes cc) instead
-
createBasicSceneGraph
public javax.media.j3d.BranchGroup createBasicSceneGraph(javax.media.j3d.View v, javax.media.j3d.TransformGroup vpt, VisADCanvasJ3D c, MouseBehaviorJ3D m, javax.media.j3d.ColoringAttributes bc, javax.media.j3d.ColoringAttributes cc)Create scene graph root, if none exists, with Transform and direct manipulation root.- Parameters:
v-vpt-c-m-- Returns:
- Scene graph root.
-
setClip
public void setClip(int plane, boolean enable, float a, float b, float c, float d) throws VisADExceptionDefine a clipping plane in (XAxis, YAxis, ZAxis) space. Allows up to 6 arbitrary planes. Each clip plane is defined by the equation:aX + bY + cZ + d <= 0Example useage:
To clip to the usual VisAD cube (i.e., x, y and z values in the range -1.0 to +1.0) (see Test35.java), call:DisplayRendererJ3D dr = (DisplayRendererJ3D) display.getDisplayRenderer(); dr.setClip(0, true, 1.0f, 0.0f, 0.0f, -1.01f); // X_POS face dr.setClip(1, true, -1.0f, 0.0f, 0.0f, -1.01f); // X_NEG face dr.setClip(2, true, 0.0f, 1.0f, 0.0f, -1.01f); // Y_POS face dr.setClip(3, true, 0.0f, -1.0f, 0.0f, -1.01f); // Y_NEG face dr.setClip(4, true, 0.0f, 0.0f, 1.0f, -1.01f); // Z_POS face dr.setClip(5, true, 0.0f, 0.0f, -1.0f, -1.01f); // Z_NEG faceNote: d value is slightly less than -1.0 so items in the plane are not clipped.- Parameters:
plane- plane number must be in (0, ..., 5)).enable- true to enable clipping on this plane, false to disablea- x coefficentb- y coefficentc- z coefficentd- constant- Throws:
VisADException- illegal plane argument or unsupported (< 1.2) version of Java 3D
-
getMouseBehavior
public MouseBehavior getMouseBehavior()
Get theMouseBehaviorassociated with this renderer.- Specified by:
getMouseBehaviorin classDisplayRenderer- Returns:
- the
MouseBehaviorused by this renderer to handle mouse events.
-
getKeyboardBehavior
public KeyboardBehavior getKeyboardBehavior()
Get theKeyboardBehaviorassociated with this renderer.- Returns:
- the
KeyboardBehaviorused by this renderer to handle mouse events.
-
addSceneGraphComponent
public void addSceneGraphComponent(javax.media.j3d.Group group)
-
addLockedSceneGraphComponent
public void addLockedSceneGraphComponent(javax.media.j3d.Group group)
-
addLockedSceneGraphComponent
public void addLockedSceneGraphComponent(javax.media.j3d.Group group, boolean initWithProj)
-
updateLockedTrans
public void updateLockedTrans(double[] matrix)
-
addDirectManipulationSceneGraphComponent
public void addDirectManipulationSceneGraphComponent(javax.media.j3d.Group group, DirectManipulationRendererJ3D renderer)
-
clearScene
public void clearScene(DataRenderer renderer)
-
getCursor
public double[] getCursor()
Get the cusor location.- Specified by:
getCursorin classDisplayRenderer- Returns:
- cursor location as an array of x, y, and z values
-
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
-
setCursorLoc
public void setCursorLoc(float x, float y, float z)Set the cursor location- Parameters:
x- x locationy- y locationz- z location
-
drawCursorStringVector
public void drawCursorStringVector(VisADCanvasJ3D canvas)
WhenevercursorOnordirectOnis true, display Strings in cursorStringVector.- Parameters:
canvas-
-
findDirect
public DataRenderer findDirect(VisADRay ray, int mouseModifiers)
Find theDataRendererthat is closest to the ray and uses the specified mouse modifiers for direct manipulation.- Specified by:
findDirectin classDisplayRenderer- Parameters:
ray- position to checkmouseModifiers- modifiers for mouse clicks- Returns:
- closest DataRenderer that uses the specified mouse click modifiers for direct manipulation or null if there is none.
-
anyDirects
public boolean anyDirects()
Check to see if there are anyDirectManipulationRenderers in this display.- Specified by:
anyDirectsin classDisplayRenderer- Returns:
- true if there are any
-
setScaleOn
public void setScaleOn(boolean on)
Set the scales on.- Specified by:
setScaleOnin classDisplayRenderer- Parameters:
on- turn on if true, otherwise turn them off
-
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- AxisScale to remove
-
setTransform3D
public void setTransform3D(javax.media.j3d.Transform3D 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()
Create the defaultDataRendererfor this type ofDisplayRenderer- Specified by:
makeDefaultRendererin classDisplayRenderer- Returns:
- new default renderer
-
legalDataRenderer
public boolean legalDataRenderer(DataRenderer renderer)
Check if theDataRendererin question is legal for thisDisplayRenderer- Specified by:
legalDataRendererin classDisplayRenderer- Parameters:
renderer-DataRendererto check- Returns:
- true if renderer is a subclass of
RendererJ3D
-
rendererDeleted
public void rendererDeleted(DataRenderer renderer)
- Specified by:
rendererDeletedin interfaceRendererSourceListener
-
setLineWidth
public void setLineWidth(float width)
-
addKeyboardBehavior
public void addKeyboardBehavior(KeyboardBehaviorJ3D behavior)
Add aKeyboardBehaviorfor keyboard control of rotation, translation and zoom.- Parameters:
behavior- keyboard behavior to add
-
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
-
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