Package ucar.visad.display
Class ColorScale
java.lang.Object
ucar.visad.display.Displayable
ucar.visad.display.DisplayableData
ucar.visad.display.ColorScale
Displayable for a color scale in a display. The scale can be
horizontal or vertical and can have labels.
- Version:
- $Revision: 1.20 $
- Author:
- IDV Development Team
-
Nested Class Summary
Nested classes/interfaces inherited from class ucar.visad.display.DisplayableData
DisplayableData.DragAdapter
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
Bottom Placementstatic final Color
default colorstatic final int
Key for displaying the scale horizonatallystatic final String
Left Placementstatic final int
Key for primary labeling sidestatic final String
Right Placementstatic final int
Key for secondary labeling sidestatic final String
Top Placementstatic final int
Key for displaying the scale verticallyFields inherited from class ucar.visad.display.DisplayableData
LINE_WIDTH, MANIPULABLE, renderer, VISIBLE
Fields inherited from class ucar.visad.display.Displayable
DISPLAY, parent, SCALAR_MAP_SET
-
Constructor Summary
ConstructorsConstructorDescriptionColorScale
(String name) Construct a newColorScale
with the given name and default orientation.ColorScale
(String name, int orient) Construct a newColorScale
with the given name and orientation.ColorScale
(String name, int orient, double x, double y) Construct a newColorScale
with the given name and orientation and position.ColorScale
(String name, int orient, double x, double y, float[][] table) Construct a newColorScale
with the given name and orientation and position, using the color table.ColorScale
(String name, int orient, float[][] table) Construct a newColorScale
with the given name and orientation and color table.ColorScale
(ColorScaleInfo info) Construct a newColorScale
from the ColorScaleInfo -
Method Summary
Modifier and TypeMethodDescriptionReturns a clone of this instance suitable for another VisAD display.protected DataRenderer
Get the renderer for this ColorScalestatic int
getDefaultOrient
(String place) Get the default orientation for the given placementstatic String
getDefaultPlace
(int orient) Get the default place for the given orientationgetFont()
Get the font used for rendering the labelsGet the color of the labelsint
Get the color of the labelsboolean
Get the label visbilityint
Get the orientation of the ColorScale.boolean
Gets the useAlpha propertystatic float
Get the X positionstatic float
Get the Y positionboolean
Checks if is unit visible.void
Redisplay the colorbar using the defaultsvoid
setColorPalette
(float[][] colorPalette) This method sets the color palette according to the color table in argument; pair this method with setRange(low,high) to get a fixed association of color table and range of values.void
Set the parameters for this scalevoid
Set the font used for rendering the labelsvoid
setFont
(HersheyFont font) Set the font used for rendering the labelsvoid
setLabelColor
(Color color) Set the color of the labels.void
setLabelSide
(int side) Set the labeling side.void
setLabelVisible
(boolean visible) Set the visibility of the labelsvoid
setOrientation
(int orient) Set the orientation of the ColorScale.void
setRangeForColor
(double low, double hi) Set the range of values for the color table.void
setUnitVisible
(boolean unitVisible) Sets the unit visible.void
setUseAlpha
(boolean useAlpha) Sets the useAlpha propertyvoid
setUseFastRendering
(boolean fastRender) Set the flags for whether the Displayable uses it's methods to render quickly (eg, not account for projection seams).Methods inherited from class ucar.visad.display.DisplayableData
addAction, dataChange, destroy, getActive, getAnimationSet, getData, getLineWidth, getName, getPointSize, hasData, hasDataObject, isManipulable, isPickable, myAddConstantMaps, myAddDataReferences, myRemoveDataReferences, removeAction, setActive, setData, setDataReference, setDragAdapter, setLineWidth, setManipulable, setPickable, setPointMode, setPointSize, setVisible, showme, toString
Methods inherited from class ucar.visad.display.Displayable
addConstantMap, addConstantMaps, addDataReferences, addPropertyChangeListener, addPropertyChangeListener, addRefsInvoked, addScalarMap, addScalarMaps, applyColorUnit, applyDisplayUnit, checkUnit, combineConstantMaps, destroyDisplayable, firePropertyChange, firePropertyChange, fireScalarMapSetChange, getColorUnit, getConstantMaps, getDestroyed, getDisplay, getDisplayMaster, getDisplayUnit, getPointMode, getScalarMap, getScalarMap, getScalarMap, getScalarMapSet, getUseFastRendering, getUseTimesInAnimation, getVisible, isActive, isUnitCompatible, isVisible, logException, removeConstantMap, removeDataReferences, removePropertyChangeListener, removePropertyChangeListener, removeScalarMap, replaceScalarMap, setAdjustFlow, setColor, setColorPalette, setColorUnit, setConstantPosition, setContourInfo, setDisplay, setDisplayActive, setDisplayInactive, setDisplayMaster, setDisplayUnit, setOverrideAnimationSet, setOverrideAnimationSet, setParent, setRangeForColor, setScalarMapSet, setSelectedRange, setSelectedRange, setUseTimesInAnimation, toFront
-
Field Details
-
VERTICAL_ORIENT
public static final int VERTICAL_ORIENTKey for displaying the scale vertically- See Also:
-
HORIZONTAL_ORIENT
public static final int HORIZONTAL_ORIENTKey for displaying the scale horizonatally- See Also:
-
PRIMARY
public static final int PRIMARYKey for primary labeling side- See Also:
-
SECONDARY
public static final int SECONDARYKey for secondary labeling side- See Also:
-
TOP
Top Placement- See Also:
-
BOTTOM
Bottom Placement- See Also:
-
LEFT
Left Placement- See Also:
-
RIGHT
Right Placement- See Also:
-
DEFAULT_LABEL_COLOR
default color
-
-
Constructor Details
-
ColorScale
Construct a newColorScale
with the given name and default orientation.- Parameters:
name
- name for this color scale object.- Throws:
RemoteException
- Java RMI errorVisADException
- problem creating VisAD object
-
ColorScale
Construct a newColorScale
with the given name and orientation.- Parameters:
name
- name for this color scale object.orient
- orientation for thisColorScale
- Throws:
RemoteException
- Java RMI errorVisADException
- problem creating VisAD object
-
ColorScale
Construct a newColorScale
with the given name and orientation and color table.- Parameters:
name
- name for this color scale object.orient
- orientation for thisColorScale
table
- color table that defines the image- Throws:
RemoteException
- Java RMI errorVisADException
- problem creating VisAD object
-
ColorScale
public ColorScale(String name, int orient, double x, double y) throws VisADException, RemoteException Construct a newColorScale
with the given name and orientation and position.- Parameters:
name
- name for this color scale object.orient
- orientation for thisColorScale
x
- X position on the screen, % away from upper left cornery
- Y position on the screen, % away from upper left corner- Throws:
RemoteException
- Java RMI errorVisADException
- problem creating VisAD object
-
ColorScale
public ColorScale(String name, int orient, double x, double y, float[][] table) throws VisADException, RemoteException Construct a newColorScale
with the given name and orientation and position, using the color table.- Parameters:
name
- name for this color scale object.orient
- orientation for thisColorScale
x
- X position on the screen, % away from upper left cornery
- Y position on the screen, % away from upper left cornertable
- color table that defines the image- Throws:
RemoteException
- Java RMI errorVisADException
- problem creating VisAD object
-
ColorScale
Construct a newColorScale
from the ColorScaleInfo- Parameters:
info
- color scale info- Throws:
RemoteException
- Java RMI errorVisADException
- problem creating VisAD object
-
-
Method Details
-
setRangeForColor
Set the range of values for the color table.- Overrides:
setRangeForColor
in classDisplayable
- Parameters:
low
- minimum valuehi
- maximum value- Throws:
RemoteException
- Java RMI errorVisADException
- problem creating VisAD object
-
getOrientation
public int getOrientation()Get the orientation of the ColorScale.- Returns:
- orientation (HORIZONTAL_ORIENT, VERTICAL_ORIENT)
-
setOrientation
Set the orientation of the ColorScale.- Parameters:
orient
- orientation (HORIZONTAL_ORIENT, VERTICAL_ORIENT)- Throws:
RemoteException
- Java RMI errorVisADException
- problem creating VisAD object
-
setColorScaleInfo
Set the parameters for this scale- Parameters:
info
- ColorScaleInfo- Throws:
RemoteException
- Java RMI errorVisADException
- problem creating VisAD object
-
setLabelColor
Set the color of the labels.- Parameters:
color
- color for labels- Throws:
RemoteException
- Java RMI errorVisADException
- problem creating VisAD object
-
getLabelColor
Get the color of the labels- Returns:
- label color (may be null)
-
setLabelVisible
Set the visibility of the labels- Parameters:
visible
- true to show labels- Throws:
RemoteException
- Java RMI errorVisADException
- problem creating VisAD object
-
getLabelVisble
public boolean getLabelVisble()Get the label visbility- Returns:
- the label visibility
-
isUnitVisible
public boolean isUnitVisible()Checks if is unit visible.- Returns:
- true, if is unit visible
-
setUnitVisible
public void setUnitVisible(boolean unitVisible) Sets the unit visible.- Parameters:
unitVisible
- the new unit visible
-
getUseAlpha
public boolean getUseAlpha()Gets the useAlpha property- Returns:
- the useAlpha
-
setUseAlpha
Sets the useAlpha property- Parameters:
useAlpha
- the useAlpha to set- Throws:
RemoteException
- Java RMI errorVisADException
- problem creating VisAD object
-
setLabelSide
Set the labeling side.- Parameters:
side
- labeling side (PRIMARY, SECONDARY);- Throws:
RemoteException
- Java RMI errorVisADException
- problem creating VisAD object
-
getLabelSide
public int getLabelSide()Get the color of the labels- Returns:
- label color
-
setColorPalette
This method sets the color palette according to the color table in argument; pair this method with setRange(low,high) to get a fixed association of color table and range of values.- Overrides:
setColorPalette
in classDisplayable
- Parameters:
colorPalette
- the color table or color-alpha table desired- Throws:
VisADException
- if a core VisAD failure occurs.RemoteException
- if a Java RMI failure occurs.
-
cloneForDisplay
Returns a clone of this instance suitable for another VisAD display. Underlying data objects are not cloned.- Overrides:
cloneForDisplay
in classDisplayableData
- Returns:
- A semi-deep clone of this instance.
- Throws:
VisADException
- VisAD failure.RemoteException
- Java RMI failure.
-
reDisplay
public void reDisplay()Redisplay the colorbar using the defaults -
getDataRenderer
Get the renderer for this ColorScale- Overrides:
getDataRenderer
in classDisplayableData
- Returns:
- renderer
- Throws:
VisADException
- problem creating renderer
-
setFont
Set the font used for rendering the labels- Parameters:
font
- new font to use
-
setFont
Set the font used for rendering the labels- Parameters:
font
- new font to use
-
getFont
Get the font used for rendering the labels- Returns:
- font use or null if using default text plot
-
setUseFastRendering
Set the flags for whether the Displayable uses it's methods to render quickly (eg, not account for projection seams).- Overrides:
setUseFastRendering
in classDisplayableData
- Parameters:
fastRender
- Should the rendering be quick (and possibly inaccurate)- Throws:
VisADException
- VisAD failure.RemoteException
- Java RMI failure.
-
getDefaultPlace
Get the default place for the given orientation- Parameters:
orient
- orientation- Returns:
- the default place for the orientation
-
getDefaultOrient
Get the default orientation for the given placement- Parameters:
place
- placement- Returns:
- the default orientation for place
-
getX
Get the X position- Parameters:
orient
- orientationplacement
- placement- Returns:
- corresponding X position
-
getY
Get the Y position- Parameters:
orient
- orientationplacement
- placement- Returns:
- corresponding Y position
-