visad
Class DisplayRenderer
- java.lang.Object
-
- visad.DisplayRenderer
-
- All Implemented Interfaces:
- java.util.EventListener, ControlListener
- Direct Known Subclasses:
- DisplayRendererJ2D, DisplayRendererJ3D
public abstract class DisplayRenderer extends java.lang.Object implements ControlListener
DisplayRendereris the VisAD abstract super-class for background and metadata rendering algorithms. These complement depictions ofDataobjects created byDataRendererobjects.DisplayRendereralso manages the overall relation ofDataRendereroutput to the graphics library.DisplayRendereris notSerializableand should not be copied between JVMs.
-
-
Constructor Summary
Constructors Constructor and Description DisplayRenderer()Construct a newDisplayRenderer.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method and Description abstract booleananyDirects()abstract voidclearScale(AxisScale axisScale)Remove a particular scale being rendered.abstract voidclearScales()Remove all the scales being rendered.abstract voiddepth_cursor(VisADRay ray)set a VisADRay along which to drag cursor in depth (in and out of screen)abstract voiddrag_cursor(VisADRay ray, boolean first)drag cursor parallel to plane of screenabstract voiddrag_depth(float diff)drag cursor in depth (in and out of screen)abstract DataRendererfindDirect(VisADRay ray, int mouseModifiers)Returns a direct manipulation renderer if one is close to the specified ray (within pick threshold).java.lang.String[]getAnimationString()Return Array ofStrings describing the animation sequencebooleangetAnimationStringVisible()Return whether the animation info should be visible in the display or not.booleangetBoxOn()Get the box visibility.abstract double[]getCursor()Return an array giving the cursor location as (XAxis, YAxis, ZAxis) coordinatesfloat[]getCursorColor()Get the cursor color.java.util.VectorgetCursorStringVector()ReturnVectorofStrings describing the cursor location, if cursor location display is enabled.java.util.VectorgetCursorStringVectorUnconditional()ReturnVectorofStrings describing the cursor location, regardless of whether cursor location display is enabled.doublegetDirectAxisValue(RealType type)get the value of a RealType if it is included in the cursor locationdoublegetDirectAxisValue(java.lang.String name)get the value of a named RealType if it is included in the cursor locationDisplayImplgetDisplay()Get theDisplayassociated with this renderer.abstract java.awt.image.BufferedImagegetImage()Get a snapshot of the displayed image.booleangetMode2D()Returntrueif this is a 2-DDisplayRenderer.abstract MouseBehaviorgetMouseBehavior()floatgetPickThreshhold()RendererControlgetRendererControl()Get theControlwhich holds the "shared" data for this renderer.booleangetRotateAboutCenter()Get the RotateAboutCenter property.booleangetScaleRotation()Get the ScaleRotation property.abstract intgetTextureHeightMax()abstract intgetTextureWidthMax()booleangetWaitFlag()Get the wait flag state.booleangetWaitMessageVisible()Return whether the please wait info should be visible in the display or not.abstract voidinitControl(RendererControl ctl)Internal method used to initialize newly createdRendererControlwith current renderer settings before it is actually connected to the renderer.abstract booleanlegalDataRenderer(DataRenderer renderer)determine whether a DataRenderer is legal for this DisplayRendererbooleanlegalDisplayScalar(DisplayRealType type)Returntrueiftypeis legal for thisDisplayRenderer; for example, 2-DDisplayRenderers use this to disallow mappings to ZAxis and Latitude.abstract ControlmakeControl(ScalarMap map)Factory for constructing a subclass ofControlappropriate for the graphics API and for thisDisplayRenderer; invoked byScalarMapwhen it isaddMap()ed to aDisplay.abstract DataRenderermakeDefaultRenderer()Factory for constructing the default subclass ofDataRendererfor thisDisplayRenderer.voidprepareAction(java.util.Vector temp, java.util.Vector tmap, boolean go, boolean initialize)prepare for transforming Data into scene graph depictions, including possible auto-scaling of ScalarMapsvoidrender_trigger()trigger the graphics API to render the scene graph to the screen; intended to be over-ridden by graphics-API-specific extensions of DisplayRenderervoidsetAnimationString(java.lang.String[] animation)Set Array ofStrings describing the animation sequencevoidsetAnimationStringVisible(boolean visible)Set whether the animation info should be visible in the display or not.voidsetBackgroundColor(java.awt.Color color)Set the background color.voidsetBackgroundColor(float r, float g, float b)Set the background color.abstract voidsetBoxAspect(double[] aspect)set the aspect for the containing box aspect double[3] array used to scale x, y and z box sizesvoidsetBoxColor(java.awt.Color color)Set the box color.voidsetBoxColor(float r, float g, float b)Set the box color.voidsetBoxOn(boolean on)Set the box visibility.voidsetCursorColor(java.awt.Color color)Set the cursor color.voidsetCursorColor(float r, float g, float b)Set the cursor color.abstract voidsetCursorOn(boolean on)set flag indicating whether the cursor should be displayed.voidsetCursorStringOn(boolean on)set flag indicating whether the cursor location String should be displayed.voidsetCursorStringVector()SetVectorofStrings describing the cursor location from the cursor location; this is invoked when the cursor location changes or the cursor display status changesvoidsetCursorStringVector(java.util.Vector vect)SetVectorofStrings describing the cursor location by copy; this is invoked by direct manipulation renderers.abstract voidsetDirectOn(boolean on)set flag indicating whether direct manipulation is activevoidsetDisplay(DisplayImpl d)SpecifyDisplayImplto be rendered.voidsetForegroundColor(java.awt.Color color)Set the foreground color (box, cursor and scales).voidsetForegroundColor(float r, float g, float b)Set the foreground color (box, cursor and scales).voidsetPickThreshhold(float pt)set the distance threshhold for picking in direct manipulationvoidsetRotateAboutCenter(boolean value)Set the RotateAboutCenter property.abstract voidsetScale(AxisScale axisScale)Set an axis scale.abstract voidsetScale(int axis, int axis_ordinal, VisADLineArray array, float[] scale_color)Set an axis scale.abstract voidsetScale(int axis, int axis_ordinal, VisADLineArray array, VisADTriangleArray labels, float[] scale_color)Set an axis scale.abstract voidsetScaleOn(boolean on)Enable scales to be displayed if they are set.voidsetScaleRotation(boolean value)Set the ScaleRotation property.voidsetWaitFlag(boolean b)Set the wait flag to the specified value.voidsetWaitMessageVisible(boolean visible)Set whether the "please wait" info should be visible in the display or not.-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface visad.ControlListener
controlChanged
-
-
-
-
Method Detail
-
getPickThreshhold
public float getPickThreshhold()
- Returns:
- the distance threshhold for picking in direct manipulation (distance in XAxis, YAxis, ZAxis coordinates)
-
setPickThreshhold
public void setPickThreshhold(float pt)
set the distance threshhold for picking in direct manipulation- Parameters:
pt- distance (in XAxis, YAxis, ZAxis coordinates)
-
setBoxAspect
public abstract void setBoxAspect(double[] aspect)
set the aspect for the containing box aspect double[3] array used to scale x, y and z box sizes
-
setDisplay
public void setDisplay(DisplayImpl d) throws VisADException
SpecifyDisplayImplto be rendered.- Parameters:
d-Displayto render.- Throws:
VisADException- If aDisplayImplhas already been specified.
-
initControl
public abstract 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.- Parameters:
ctl- RendererControl to initialize
-
getDisplay
public DisplayImpl getDisplay()
Get theDisplayassociated with this renderer.- Returns:
- The Display being rendered.
-
getRendererControl
public RendererControl getRendererControl()
Get theControlwhich holds the "shared" data for this renderer.- Returns:
- The renderer
Control.
-
setWaitFlag
public void setWaitFlag(boolean b)
Set 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.- Parameters:
b- Boolean value to which wait flag is set.
-
getWaitFlag
public boolean getWaitFlag()
Get the wait flag state.- Returns:
trueif the wait flag is enabled.
-
getImage
public abstract java.awt.image.BufferedImage getImage()
Get a snapshot of the displayed image.- Returns:
- The current image being displayed.
-
setScale
public abstract void setScale(AxisScale axisScale) throws VisADException
Set an axis scale.- Parameters:
axisScale- AxisScale to set (it knows what axis it is for)- Throws:
VisADException- couldn't set the scale
-
setScale
public abstract void setScale(int axis, int axis_ordinal, VisADLineArray array, float[] scale_color) throws VisADExceptionSet an axis scale.- Parameters:
axis- axis for this scale (0 = XAxis, 1 = YAxis, 2 = ZAxis)axis_ordinal- position along the axisarray-VisADLineArrayrepresenting the scale plotscale_color- float[3] array representing the red, green and blue color values.- Throws:
VisADException- couldn't set the scale
-
setScale
public abstract void setScale(int axis, int axis_ordinal, VisADLineArray array, VisADTriangleArray labels, float[] scale_color) throws VisADExceptionSet an axis scale.- 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- float[3] array representing the red, green and blue color values.- Throws:
VisADException- couldn't set the scale
-
clearScales
public abstract void clearScales()
Remove all the scales being rendered.
-
clearScale
public abstract void clearScale(AxisScale axisScale)
Remove a particular scale being rendered.- Parameters:
axisScale- scale to remove
-
setScaleOn
public abstract void setScaleOn(boolean on)
Enable scales to be displayed if they are set. This should not be called programmatically, since it does not update collaborative displays. Applications should useGraphicsModeControl.setScaleEnableinstead of this method.- Parameters:
on- true to turn them on, false to set them invisible
-
getMode2D
public boolean getMode2D()
Returntrueif this is a 2-DDisplayRenderer.- Returns:
trueif this is a 2-D renderer.
-
setBackgroundColor
public void setBackgroundColor(java.awt.Color color) throws java.rmi.RemoteException, VisADExceptionSet the background color.- Parameters:
color- background color- Throws:
java.rmi.RemoteException- If there was a problem making this change in a remote collaborativeDisplayRenderer.VisADException- If this renderer as not yet been assigned to aDisplay.
-
setBackgroundColor
public void setBackgroundColor(float r, float g, float b) throws java.rmi.RemoteException, VisADExceptionSet the background color. All specified values should be in the range[0.0f - 1.0f].- Parameters:
r- Red value.g- Green value.b- Blue value.- Throws:
java.rmi.RemoteException- If there was a problem making this change in a remote collaborativeDisplayRenderer.VisADException- If this renderer as not yet been assigned to aDisplay.
-
setForegroundColor
public void setForegroundColor(java.awt.Color color) throws java.rmi.RemoteException, VisADExceptionSet the foreground color (box, cursor and scales).- Parameters:
color- foreground color- Throws:
java.rmi.RemoteException- If there was a problem making this change in a remote collaborativeDisplayRenderer.VisADException- If this renderer as not yet been assigned to aDisplay.
-
setForegroundColor
public void setForegroundColor(float r, float g, float b) throws java.rmi.RemoteException, VisADExceptionSet the foreground color (box, cursor and scales). All specified values should be in the range[0.0f - 1.0f].- Parameters:
r- Red value.g- Green value.b- Blue value.- Throws:
java.rmi.RemoteException- If there was a problem making this change in a remote collaborativeDisplayRenderer.VisADException- If this renderer as not yet been assigned to aDisplay.
-
getBoxOn
public boolean getBoxOn() throws java.rmi.RemoteException, VisADExceptionGet the box visibility.- Returns:
trueif the box is visible.- Throws:
java.rmi.RemoteExceptionVisADException
-
setBoxColor
public void setBoxColor(java.awt.Color color) throws java.rmi.RemoteException, VisADExceptionSet the box color.- Parameters:
color- box color- Throws:
java.rmi.RemoteException- If there was a problem making this change in a remote collaborativeDisplayRenderer.VisADException- If this renderer as not yet been assigned to aDisplay.
-
setBoxColor
public void setBoxColor(float r, float g, float b) throws java.rmi.RemoteException, VisADExceptionSet the box color. All specified values should be in the range[0.0f - 1.0f].- Parameters:
r- Red value.g- Green value.b- Blue value.- Throws:
java.rmi.RemoteException- If there was a problem making this change in a remote collaborativeDisplayRenderer.VisADException- If this renderer as not yet been assigned to aDisplay.
-
setBoxOn
public void setBoxOn(boolean on) throws java.rmi.RemoteException, VisADExceptionSet the box visibility.- Parameters:
on-trueif the box should be visible.- Throws:
java.rmi.RemoteException- If there was a problem making this change in a remote collaborativeDisplayRenderer.VisADException- If this renderer as not yet been assigned to aDisplay.
-
getCursorColor
public float[] getCursorColor() throws java.rmi.RemoteException, VisADExceptionGet the cursor color.- Returns:
- A 3 element array of
floatvalues in the range[0.0f - 1.0f]in the order (Red, Green, Blue). - Throws:
java.rmi.RemoteException- If there was a problem making this change in a remote collaborativeDisplayRenderer.VisADException- If this renderer as not yet been assigned to aDisplay.
-
setCursorColor
public void setCursorColor(java.awt.Color color) throws java.rmi.RemoteException, VisADExceptionSet the cursor color.- Parameters:
color- cursor color- Throws:
java.rmi.RemoteException- If there was a problem making this change in a remote collaborativeDisplayRenderer.VisADException- If this renderer as not yet been assigned to aDisplay.
-
setCursorColor
public void setCursorColor(float r, float g, float b) throws java.rmi.RemoteException, VisADExceptionSet the cursor color. All specified values should be in the range[0.0f - 1.0f].- Parameters:
r- Red value.g- Green value.b- Blue value.- Throws:
java.rmi.RemoteException- If there was a problem making this change in a remote collaborativeDisplayRenderer.VisADException- If this renderer as not yet been assigned to aDisplay.
-
makeControl
public abstract Control makeControl(ScalarMap map)
Factory for constructing a subclass ofControlappropriate for the graphics API and for thisDisplayRenderer; invoked byScalarMapwhen it isaddMap()ed to aDisplay.- Parameters:
map- TheScalarMapfor which aControlshould be built.- Returns:
- The appropriate
Control.
-
makeDefaultRenderer
public abstract DataRenderer makeDefaultRenderer()
Factory for constructing the default subclass ofDataRendererfor thisDisplayRenderer.- Returns:
- The default
DataRenderer.
-
legalDataRenderer
public abstract boolean legalDataRenderer(DataRenderer renderer)
determine whether a DataRenderer is legal for this DisplayRenderer- Parameters:
renderer- DisplayRenderer to test for legality- Returns:
- true if renderer is legal
-
setAnimationStringVisible
public void setAnimationStringVisible(boolean visible)
Set whether the animation info should be visible in the display or not.- Parameters:
visible- true to show the animation info
-
getAnimationStringVisible
public boolean getAnimationStringVisible()
Return whether the animation info should be visible in the display or not.- Returns:
- true if the animation info should be shown
-
setWaitMessageVisible
public void setWaitMessageVisible(boolean visible)
Set whether the "please wait" info should be visible in the display or not.- Parameters:
visible- true to show the please wait info
-
getWaitMessageVisible
public boolean getWaitMessageVisible()
Return whether the please wait info should be visible in the display or not.- Returns:
- true if the "please wait" info should be shown
-
getAnimationString
public java.lang.String[] getAnimationString()
Return Array ofStrings describing the animation sequence- Returns:
- The animation description
-
setAnimationString
public void setAnimationString(java.lang.String[] animation)
Set Array ofStrings describing the animation sequence- Parameters:
animation- a String[2] array describing the animation sequence
-
getCursor
public abstract double[] getCursor()
Return an array giving the cursor location as (XAxis, YAxis, ZAxis) coordinates- Returns:
- 3 element
doublearray of cursor coordinates.
-
setCursorOn
public abstract void setCursorOn(boolean on)
set flag indicating whether the cursor should be displayed.- Parameters:
on- value of flag to set
-
depth_cursor
public abstract void depth_cursor(VisADRay ray)
set a VisADRay along which to drag cursor in depth (in and out of screen)- Parameters:
ray- VisADRay to set
-
drag_cursor
public abstract void drag_cursor(VisADRay ray, boolean first)
drag cursor parallel to plane of screen- Parameters:
ray- VisADRay that goes through new cursor locationfirst- true to indicate this is first call to drag_cursor() for this drag
-
setDirectOn
public abstract void setDirectOn(boolean on)
set flag indicating whether direct manipulation is active- Parameters:
on- value of flag to set
-
drag_depth
public abstract void drag_depth(float diff)
drag cursor in depth (in and out of screen)- Parameters:
diff- amount to move cursor in depth (0.0 corresponds to no movement)
-
anyDirects
public abstract boolean anyDirects()
- Returns:
- flag indicating whether there are any direct manipulation DataRenderers linked to Display
-
getMouseBehavior
public abstract MouseBehavior getMouseBehavior()
- Returns:
- the MouseBehavior for this display
-
findDirect
public abstract DataRenderer findDirect(VisADRay ray, int mouseModifiers)
Returns a direct manipulation renderer if one is close to the specified ray (within pick threshold).- Parameters:
ray- The ray used to look for a nearby direct manipulation renderer.mouseModifiers- Value of InputEvent.getModifiers().- Returns:
- DataRenderer or
null.
-
setCursorStringOn
public void setCursorStringOn(boolean on)
set flag indicating whether the cursor location String should be displayed.- Parameters:
on- value of flag to set
-
getCursorStringVector
public java.util.Vector getCursorStringVector()
ReturnVectorofStrings describing the cursor location, if cursor location display is enabled.- Returns:
- The cursor location description as a Vector of Strings (an empty Vector if cursor location display is disabled).
-
getCursorStringVectorUnconditional
public java.util.Vector getCursorStringVectorUnconditional()
ReturnVectorofStrings describing the cursor location, regardless of whether cursor location display is enabled.- Returns:
- The cursor location description as a Vector of Strings.
-
getDirectAxisValue
public double getDirectAxisValue(RealType type)
get the value of a RealType if it is included in the cursor location- Parameters:
type- RealType whose value to get- Returns:
- value of type, or NaN if it is not included in the cursor location
-
getDirectAxisValue
public double getDirectAxisValue(java.lang.String name)
get the value of a named RealType if it is included in the cursor location- Parameters:
name- String name of RealType whose value to get- Returns:
- value of named RealType, or NaN if it is not included in the cursor location
-
setCursorStringVector
public void setCursorStringVector(java.util.Vector vect)
SetVectorofStrings describing the cursor location by copy; this is invoked by direct manipulation renderers.- Parameters:
vect- String descriptions of cursor location.
-
setCursorStringVector
public void setCursorStringVector()
SetVectorofStrings describing the cursor location from the cursor location; this is invoked when the cursor location changes or the cursor display status changes
-
render_trigger
public void render_trigger()
trigger the graphics API to render the scene graph to the screen; intended to be over-ridden by graphics-API-specific extensions of DisplayRenderer
-
legalDisplayScalar
public boolean legalDisplayScalar(DisplayRealType type)
Returntrueiftypeis legal for thisDisplayRenderer; for example, 2-DDisplayRenderers use this to disallow mappings to ZAxis and Latitude.- Parameters:
type- The mapping type to check.- Returns:
trueiftypeis legal.
-
prepareAction
public void prepareAction(java.util.Vector temp, java.util.Vector tmap, boolean go, boolean initialize) throws VisADException, java.rmi.RemoteExceptionprepare for transforming Data into scene graph depictions, including possible auto-scaling of ScalarMaps- Parameters:
temp- Vector of DataRendererstmap- Vector of ScalarMapsgo- flag indicating whether Data transforms are requestedinitialize- flag indicating whether auto-scaling is requested- Throws:
VisADException- a VisAD error occurredjava.rmi.RemoteException- an RMI error occurred
-
getTextureWidthMax
public abstract int getTextureWidthMax() throws VisADException- Throws:
VisADException
-
getTextureHeightMax
public abstract int getTextureHeightMax() throws VisADException- Throws:
VisADException
-
setScaleRotation
public void setScaleRotation(boolean value)
Set the ScaleRotation property.- Parameters:
value- The new value for ScaleRotation
-
getScaleRotation
public boolean getScaleRotation()
Get the ScaleRotation property.- Returns:
- The ScaleRotation
-
setRotateAboutCenter
public void setRotateAboutCenter(boolean value)
Set the RotateAboutCenter property.- Parameters:
value- The new value for RotateAboutCenter
-
getRotateAboutCenter
public boolean getRotateAboutCenter()
Get the RotateAboutCenter property.- Returns:
- The RotateAboutCenter
-
-
DMelt 3.0 © DataMelt by jWork.ORG