Class ColorScale


public class ColorScale extends DisplayableData
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
  • Field Details

  • Constructor Details

    • ColorScale

      public ColorScale(String name) throws VisADException, RemoteException
      Construct a new ColorScale with the given name and default orientation.
      Parameters:
      name - name for this color scale object.
      Throws:
      RemoteException - Java RMI error
      VisADException - problem creating VisAD object
    • ColorScale

      public ColorScale(String name, int orient) throws VisADException, RemoteException
      Construct a new ColorScale with the given name and orientation.
      Parameters:
      name - name for this color scale object.
      orient - orientation for this ColorScale
      Throws:
      RemoteException - Java RMI error
      VisADException - problem creating VisAD object
    • ColorScale

      public ColorScale(String name, int orient, float[][] table) throws VisADException, RemoteException
      Construct a new ColorScale with the given name and orientation and color table.
      Parameters:
      name - name for this color scale object.
      orient - orientation for this ColorScale
      table - color table that defines the image
      Throws:
      RemoteException - Java RMI error
      VisADException - problem creating VisAD object
    • ColorScale

      public ColorScale(String name, int orient, double x, double y) throws VisADException, RemoteException
      Construct a new ColorScale with the given name and orientation and position.
      Parameters:
      name - name for this color scale object.
      orient - orientation for this ColorScale
      x - X position on the screen, % away from upper left corner
      y - Y position on the screen, % away from upper left corner
      Throws:
      RemoteException - Java RMI error
      VisADException - problem creating VisAD object
    • ColorScale

      public ColorScale(String name, int orient, double x, double y, float[][] table) throws VisADException, RemoteException
      Construct a new ColorScale with the given name and orientation and position, using the color table.
      Parameters:
      name - name for this color scale object.
      orient - orientation for this ColorScale
      x - X position on the screen, % away from upper left corner
      y - Y position on the screen, % away from upper left corner
      table - color table that defines the image
      Throws:
      RemoteException - Java RMI error
      VisADException - problem creating VisAD object
    • ColorScale

      public ColorScale(ColorScaleInfo info) throws VisADException, RemoteException
      Construct a new ColorScale from the ColorScaleInfo
      Parameters:
      info - color scale info
      Throws:
      RemoteException - Java RMI error
      VisADException - problem creating VisAD object
  • Method Details

    • setRangeForColor

      public void setRangeForColor(double low, double hi) throws VisADException, RemoteException
      Set the range of values for the color table.
      Overrides:
      setRangeForColor in class Displayable
      Parameters:
      low - minimum value
      hi - maximum value
      Throws:
      RemoteException - Java RMI error
      VisADException - problem creating VisAD object
    • getOrientation

      public int getOrientation()
      Get the orientation of the ColorScale.
      Returns:
      orientation (HORIZONTAL_ORIENT, VERTICAL_ORIENT)
    • setOrientation

      public void setOrientation(int orient) throws RemoteException, VisADException
      Set the orientation of the ColorScale.
      Parameters:
      orient - orientation (HORIZONTAL_ORIENT, VERTICAL_ORIENT)
      Throws:
      RemoteException - Java RMI error
      VisADException - problem creating VisAD object
    • setColorScaleInfo

      public void setColorScaleInfo(ColorScaleInfo info) throws RemoteException, VisADException
      Set the parameters for this scale
      Parameters:
      info - ColorScaleInfo
      Throws:
      RemoteException - Java RMI error
      VisADException - problem creating VisAD object
    • setLabelColor

      public void setLabelColor(Color color) throws RemoteException, VisADException
      Set the color of the labels.
      Parameters:
      color - color for labels
      Throws:
      RemoteException - Java RMI error
      VisADException - problem creating VisAD object
    • getLabelColor

      public Color getLabelColor()
      Get the color of the labels
      Returns:
      label color (may be null)
    • setLabelVisible

      public void setLabelVisible(boolean visible) throws RemoteException, VisADException
      Set the visibility of the labels
      Parameters:
      visible - true to show labels
      Throws:
      RemoteException - Java RMI error
      VisADException - 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

      public void setUseAlpha(boolean useAlpha) throws RemoteException, VisADException
      Sets the useAlpha property
      Parameters:
      useAlpha - the useAlpha to set
      Throws:
      RemoteException - Java RMI error
      VisADException - problem creating VisAD object
    • setLabelSide

      public void setLabelSide(int side) throws RemoteException, VisADException
      Set the labeling side.
      Parameters:
      side - labeling side (PRIMARY, SECONDARY);
      Throws:
      RemoteException - Java RMI error
      VisADException - problem creating VisAD object
    • getLabelSide

      public int getLabelSide()
      Get the color of the labels
      Returns:
      label color
    • setColorPalette

      public void setColorPalette(float[][] colorPalette) throws RemoteException, VisADException
      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 class Displayable
      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

      public Displayable cloneForDisplay() throws RemoteException, VisADException
      Returns a clone of this instance suitable for another VisAD display. Underlying data objects are not cloned.
      Overrides:
      cloneForDisplay in class DisplayableData
      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

      protected DataRenderer getDataRenderer() throws VisADException
      Get the renderer for this ColorScale
      Overrides:
      getDataRenderer in class DisplayableData
      Returns:
      renderer
      Throws:
      VisADException - problem creating renderer
    • setFont

      public void setFont(Font font)
      Set the font used for rendering the labels
      Parameters:
      font - new font to use
    • setFont

      public void setFont(HersheyFont font)
      Set the font used for rendering the labels
      Parameters:
      font - new font to use
    • getFont

      public Font getFont()
      Get the font used for rendering the labels
      Returns:
      font use or null if using default text plot
    • setUseFastRendering

      public void setUseFastRendering(boolean fastRender) throws VisADException, RemoteException
      Set the flags for whether the Displayable uses it's methods to render quickly (eg, not account for projection seams).
      Overrides:
      setUseFastRendering in class DisplayableData
      Parameters:
      fastRender - Should the rendering be quick (and possibly inaccurate)
      Throws:
      VisADException - VisAD failure.
      RemoteException - Java RMI failure.
    • getDefaultPlace

      public static String getDefaultPlace(int orient)
      Get the default place for the given orientation
      Parameters:
      orient - orientation
      Returns:
      the default place for the orientation
    • getDefaultOrient

      public static int getDefaultOrient(String place)
      Get the default orientation for the given placement
      Parameters:
      place - placement
      Returns:
      the default orientation for place
    • getX

      public static float getX(int orient, String placement)
      Get the X position
      Parameters:
      orient - orientation
      placement - placement
      Returns:
      corresponding X position
    • getY

      public static float getY(int orient, String placement)
      Get the Y position
      Parameters:
      orient - orientation
      placement - placement
      Returns:
      corresponding Y position