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 StringBottom Placementstatic final Colordefault colorstatic final intKey for displaying the scale horizonatallystatic final StringLeft Placementstatic final intKey for primary labeling sidestatic final StringRight Placementstatic final intKey for secondary labeling sidestatic final StringTop Placementstatic final intKey for displaying the scale verticallyFields inherited from class ucar.visad.display.DisplayableData
LINE_WIDTH, MANIPULABLE, renderer, VISIBLEFields inherited from class ucar.visad.display.Displayable
DISPLAY, parent, SCALAR_MAP_SET -
Constructor Summary
ConstructorsConstructorDescriptionColorScale(String name) Construct a newColorScalewith the given name and default orientation.ColorScale(String name, int orient) Construct a newColorScalewith the given name and orientation.ColorScale(String name, int orient, double x, double y) Construct a newColorScalewith the given name and orientation and position.ColorScale(String name, int orient, double x, double y, float[][] table) Construct a newColorScalewith the given name and orientation and position, using the color table.ColorScale(String name, int orient, float[][] table) Construct a newColorScalewith the given name and orientation and color table.ColorScale(ColorScaleInfo info) Construct a newColorScalefrom the ColorScaleInfo -
Method Summary
Modifier and TypeMethodDescriptionReturns a clone of this instance suitable for another VisAD display.protected DataRendererGet the renderer for this ColorScalestatic intgetDefaultOrient(String place) Get the default orientation for the given placementstatic StringgetDefaultPlace(int orient) Get the default place for the given orientationgetFont()Get the font used for rendering the labelsGet the color of the labelsintGet the color of the labelsbooleanGet the label visbilityintGet the orientation of the ColorScale.booleanGets the useAlpha propertystatic floatGet the X positionstatic floatGet the Y positionbooleanChecks if is unit visible.voidRedisplay the colorbar using the defaultsvoidsetColorPalette(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.voidSet the parameters for this scalevoidSet the font used for rendering the labelsvoidsetFont(HersheyFont font) Set the font used for rendering the labelsvoidsetLabelColor(Color color) Set the color of the labels.voidsetLabelSide(int side) Set the labeling side.voidsetLabelVisible(boolean visible) Set the visibility of the labelsvoidsetOrientation(int orient) Set the orientation of the ColorScale.voidsetRangeForColor(double low, double hi) Set the range of values for the color table.voidsetUnitVisible(boolean unitVisible) Sets the unit visible.voidsetUseAlpha(boolean useAlpha) Sets the useAlpha propertyvoidsetUseFastRendering(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, toStringMethods 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 newColorScalewith 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 newColorScalewith 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 newColorScalewith the given name and orientation and color table.- Parameters:
name- name for this color scale object.orient- orientation for thisColorScaletable- 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 newColorScalewith the given name and orientation and position.- Parameters:
name- name for this color scale object.orient- orientation for thisColorScalex- 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 newColorScalewith the given name and orientation and position, using the color table.- Parameters:
name- name for this color scale object.orient- orientation for thisColorScalex- 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 newColorScalefrom 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:
setRangeForColorin 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:
setColorPalettein 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:
cloneForDisplayin 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:
getDataRendererin 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:
setUseFastRenderingin 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
-