Class MetSymbol

All Implemented Interfaces:
Cloneable
Direct Known Subclasses:
CloudCoverageSymbol, ShapeSymbol, TextSymbol, ThreeDCrossSymbol, WeatherSymbol, WindBarbSymbol

public abstract class MetSymbol extends RectangleGlyph
Class MetSymbol
Version:
$Revision: 1.60 $
Author:
Unidata development team
  • Field Details

  • Constructor Details

    • MetSymbol

      protected MetSymbol()
      Default constructor.
    • MetSymbol

      public MetSymbol(int x, int y)
      Constructor
      Parameters:
      x - Initial x position.
      y - Initial y position.
    • MetSymbol

      protected MetSymbol(DisplayCanvas canvas, int x, int y, String[] paramIds, String[] paramDescs)
      The MetSymbol can be created in two ways. If the canvas is null, it is assumed that x and y are the offsets from the center point. Otherwise, they are relative to the canvas?
      Parameters:
      canvas - DisplayCanvas to draw on. May be null.
      x - x position (either offset or canvas relative)
      y - y position (either offset or canvas relative)
      paramIds - array of parameter ids
      paramDescs - array of parameter descriptions (long names)
  • Method Details

    • initialize

      public void initialize(Element symbolNode)
      Initialize this symbol from the xml that defined it.
      Parameters:
      symbolNode - The xml node that defines this symbol.
    • showPropertiesDialog

      public void showPropertiesDialog(StationModelCanvas canvas)
      Create, if needed, and show the properties dialog.
      Parameters:
      canvas - The canvas we are in.
    • closePropertiesDialog

      public void closePropertiesDialog()
      Close the properties dialog if it is open.
    • initPropertyComponents

      protected void initPropertyComponents(List comps)
      Add to the list any widgets that should be added to the basic properties dialog tab.
      Parameters:
      comps - List containing labels and widgets for the basic properties tab.
    • applyProperties

      protected void applyProperties()
      Called by the PropertiesDialog to apply any special properties
    • addPropertyTabs

      public void addPropertyTabs(JTabbedPane tabbedPane)
      Add extra components to the property tab
      Parameters:
      tabbedPane - Tabbed pane to add to
    • shouldShowColorTableGui

      protected boolean shouldShowColorTableGui()
      Should the 'Color by' properties dialog tab be shown. Subclasses that don't want this done (i.e., ones that create specific color schemes) should override to return false.
      Returns:
      Show the color by gui (true).
    • shouldShowRotateGui

      protected boolean shouldShowRotateGui()
      Should the 'Rotate by' properties dialog tab be shown. Subclasses should override to return false if need be.
      Returns:
      Show the rotate by gui (true).
    • shouldShowScaleGui

      protected boolean shouldShowScaleGui()
      Should the 'Scale by' properties dialog tab be shown. Subclasses should override to return false if need be.
      Returns:
      Show the scale by gui (true).
    • shouldScaleShape

      public boolean shouldScaleShape()
      Is used by the StationModelDisplayable to determine if the shapes should be scaled. Subclasses should override to return false if need be.
      Returns:
      Should the shapes be scaled (true).
    • shouldBeColored

      public boolean shouldBeColored()
      Is used by the StationModelDisplayable to determine if the color of the shapes should be set. Subclasses should override this if they create their own color schemes.
      Returns:
      Should the shapes be colored
    • shouldOffsetShape

      public boolean shouldOffsetShape()
      Is used by the StationModelDisplayable to determine if the shapes should be moved in accordance to the position of this symbol. Subclasses should override to return false if need be.
      Returns:
      Should the shapes be offset
    • doAllObs

      public boolean doAllObs()
      Called by the StationModelDisplayable to determine if the shapes should be created with a call to makeShapes(PointOb).
      Returns:
      Should this symbol take the whole PointOb when making its own shapes.
    • makeShapes

      public VisADGeometryArray[] makeShapes(PointOb ob) throws Exception
      If doAllObs returns true then this method is called to create the shapes.
      Parameters:
      ob - The observation
      Returns:
      The shapes
      Throws:
      Exception - On badness
    • makeShapes

      public VisADGeometryArray[] makeShapes(Data[] dataArray, PointOb ob) throws Exception
      If this symbol is not one of the 'known' symbols then this method is called to create the shapes.
      Parameters:
      dataArray - The array of data objects. May have 0 or more data depending on the paramids.
      ob - The observation
      Returns:
      The shapes
      Throws:
      Exception - On badness
    • doAlignmentMenu

      public boolean doAlignmentMenu()
      Determine whether this MetSymbol should show an alignment menu in an editor. Subclasses should override if not.
      Returns:
      true
    • setParamIds

      public void setParamIds(String[] value)
      Set the parameter ids for this MetSymbol.
      Parameters:
      value - array of parameter ids
    • getParamIds

      public String[] getParamIds()
      Get the parameter ids for this MetSymbol.
      Returns:
      array of parameter ids
    • setParamDescs

      public void setParamDescs(String[] value)
      Set the parameter descriptions for this MetSymbol. Descriptions are used for UI widgets (labels, combo boxes, etc)
      Parameters:
      value - array of parameter descriptions
    • getParamDescs

      public String[] getParamDescs()
      Get the parameter descriptions for this MetSymbol. Descriptions are used for UI widgets (labels, combo boxes, etc)
      Returns:
      copy of the array of parameter descriptions
    • setOffset

      public void setOffset(int x, int y)
      Set the offset from the center for this MetSymbol.
      Parameters:
      x - x offset
      y - y offset
    • getXOffset

      public int getXOffset()
      Get the x value of the offset.
      Returns:
      x offset from center value.
    • getRectPoint

      public String getRectPoint()
      Get the point at which this object is alligned.
      Returns:
      allignment point (e.g. Glyph.PT_MM, PT_LL)
    • setRectPoint

      public void setRectPoint(String rp)
      Set the point at which this object is alligned.
      Parameters:
      rp - allignment point (e.g. Glyph.PT_MM, Glyph.PT_LL)
    • getYOffset

      public int getYOffset()
      Get the y value of the offset.
      Returns:
      y offset from center value.
    • incrSize

      public void incrSize()
      Increase the size of this MetSymbol. Subclasses should implement this if they support such a thing.
    • decrSize

      public void decrSize()
      Increase the size of this MetSymbol. Subclasses should implement this if they support such a thing.
    • toString

      public String toString()
      Get the String that represents this MetSymbol.
      Overrides:
      toString in class Object
      Returns:
      String representation.
    • getLabel

      public String getLabel()
      Get the label to show the user what I am in the properties
      Returns:
      label
    • clone

      protected Object clone() throws CloneNotSupportedException
      Clone this object
      Overrides:
      clone in class RectangleGlyph
      Returns:
      a clone
      Throws:
      CloneNotSupportedException - if cloning cannot be done
    • cloneMe

      public Object cloneMe()
      Return a clone of this object.
      Returns:
      clone
    • getName

      public String getName()
      Get the name of this MetSymbol.
      Returns:
      name of first paramId
    • getDesc

      public String getDesc()
      Get the description of this MetSymbol.
      Returns:
      description of first paramId
    • getParamValue

      public Object getParamValue(int index)
      Get the parameter value at the index specified. Subclasses need to override this.
      Parameters:
      index - index into param array
      Returns:
      null since this is the super class
    • setParamValue

      public void setParamValue(int index, Object v)
      Set the parameter value at the index specified. Subclasses need to override this.
      Parameters:
      index - index into param array
      v - value to set at that index.
    • getParam

      public String getParam(int index)
      Get the parameter at the index specified.
      Parameters:
      index - index into param array
      Returns:
      parameter at index.
    • paint

      public void paint(Graphics g, DisplayCanvas c)
      This is called to paint within the EditCanvas
      Overrides:
      paint in class RectangleGlyph
      Parameters:
      g - Graphics
      c - DisplayCanvas to paint on.
    • paintSelection

      public void paintSelection(Graphics g, DisplayCanvas c)
      Paint the selection
      Overrides:
      paintSelection in class Glyph
      Parameters:
      g - Graphics to use for painting
      c - DisplayCanvas to paint on
    • getBounds

      public Rectangle getBounds(Point2D loc)
      Get the bounds for this MetSymbol relative to the point specified.
      Parameters:
      loc - Java coordinates to draw at
      Returns:
      Rectangle based on that point, the offset and the width and height of the symbol.
    • draw

      public void draw(Graphics2D g, Point2D loc)
      This is called to paint when we are managed by other objects (e.g., StationLocationRenderer)
      Parameters:
      g - graphics to draw on
      loc - location to draw at. Used to normalize the bounds.
      See Also:
    • draw

      public abstract void draw(Graphics2D g, int x, int y, int width, int height)
      Draw the symbol, offset from the given location, using "normalized device" coordinates. Subclasses implement this based on the behavior of their own instance.
      Parameters:
      g - Graphics to draw to
      x - x location
      y - y location
      width - width to draw
      height - height to draw
    • setActive

      public void setActive(boolean active)
      Set whether this MetSymbol is active or not.
      Parameters:
      active - true to be active (i.e., visible)
    • getActive

      public boolean getActive()
      Get whether this MetSymbol is active or not.
      Returns:
      true if active (i.e., visible)
    • setMissing

      public void setMissing(boolean missing)
      Set whether this MetSymbol is missing or not. (i.e., no parameters or values have been set.
      Parameters:
      missing - true if missing.
    • getMissing

      public boolean getMissing()
      Get whether this MetSymbol is missing or not. (i.e., no parameters or values have been set.
      Returns:
      true if missing.
    • setAttr

      public void setAttr(String name, String value)
      Set the attribute with the value supplied.
      Overrides:
      setAttr in class RectangleGlyph
      Parameters:
      name - name of attribute.
      value - value of attribute.
    • setColorTable

      public void setColorTable(ColorTable value)
      Set the ColorTable property.
      Parameters:
      value - The new value for ColorTable
    • getColorTable

      public ColorTable getColorTable()
      Get the ColorTable property.
      Returns:
      The ColorTable
    • setColorTableParam

      public void setColorTableParam(String value)
      Set the ColorTableParam property.
      Parameters:
      value - The new value for ColorTableParam
    • getColorTableParam

      public String getColorTableParam()
      Get the ColorTableParam property.
      Returns:
      The ColorTableParam
    • setColorTableUnitName

      public void setColorTableUnitName(String name)
      Set the name of the ColorTable unit. Used by subclasses which have values that can be ColorTableed in different units.
      Parameters:
      name - name of unit
    • getColorTableUnitName

      public String getColorTableUnitName()
      Get the name of the colorTable unit.
      Returns:
      String representation of the unit name. May be null.
    • getColorTableUnit

      public Unit getColorTableUnit()
      Get the the colorTable unit.
      Returns:
      Unit used for colorTableing values. May be null.
    • setColorTableRange

      public void setColorTableRange(Range value)
      Set the ColorTableRange property.
      Parameters:
      value - The new value for ColorTableRange
    • getColorTableRange

      public Range getColorTableRange()
      Get the ColorTableRange property.
      Returns:
      The ColorTableRange
    • setScaleUnitName

      public void setScaleUnitName(String name)
      Set the name of the Scale unit. Used by subclasses which have values that can be Scaleed in different units.
      Parameters:
      name - name of unit
    • getScaleUnitName

      public String getScaleUnitName()
      Get the name of the scale unit.
      Returns:
      String representation of the unit name. May be null.
    • getScaleUnit

      public Unit getScaleUnit()
      Get the the scale unit.
      Returns:
      Unit used for scaleing values. May be null.
    • setScaleRange

      public void setScaleRange(Range value)
      Set the ScaleRange property.
      Parameters:
      value - The new value for ScaleRange
    • getScaleRange

      public Range getScaleRange()
      Get the ScaleRange property.
      Returns:
      The ScaleRange
    • setScaleDataRange

      public void setScaleDataRange(Range value)
      Set the ScaleRange property.
      Parameters:
      value - The new value for ScaleRange
    • getScaleDataRange

      public Range getScaleDataRange()
      Get the ScaleRange property.
      Returns:
      The ScaleRange
    • setScaleParam

      public void setScaleParam(String value)
      Set the ScaleParam property.
      Parameters:
      value - The new value for ScaleParam
    • getScaleParam

      public String getScaleParam()
      Get the ScaleParam property.
      Returns:
      The ScaleParam
    • setScale

      public void setScale(double value)
      Set the Scale property.
      Parameters:
      value - The new value for Scale
    • getScale

      public double getScale()
      Get the Scale property.
      Returns:
      The Scale
    • setRotateParam

      public void setRotateParam(String value)
      Set the RotateParam property.
      Parameters:
      value - The new value for RotateParam
    • setRotateUnitName

      public void setRotateUnitName(String name)
      Set the name of the Rotate unit. Used by subclasses which have values that can be Rotateed in different units.
      Parameters:
      name - name of unit
    • setRotateRange

      public void setRotateRange(Range value)
      Set the RotateRange property.
      Parameters:
      value - The new value for RotateRange
    • setRotateDataRange

      public void setRotateDataRange(Range value)
      Set the RotateRange property.
      Parameters:
      value - The new value for RotateRange
    • setRotateXInfo

      public void setRotateXInfo(RotateInfo value)
      Set the RotateXInfo property.
      Parameters:
      value - The new value for RotateXInfo
    • getRotateXInfo

      public RotateInfo getRotateXInfo()
      Get the RotateXInfo property.
      Returns:
      The RotateXInfo
    • setRotateYInfo

      public void setRotateYInfo(RotateInfo value)
      Set the RotateYInfo property.
      Parameters:
      value - The new value for RotateYInfo
    • getRotateYInfo

      public RotateInfo getRotateYInfo()
      Get the RotateYInfo property.
      Returns:
      The RotateYInfo
    • setRotateZInfo

      public void setRotateZInfo(RotateInfo value)
      Set the RotateZInfo property.
      Parameters:
      value - The new value for RotateZInfo
    • getRotateZInfo

      public RotateInfo getRotateZInfo()
      Get the RotateZInfo property.
      Returns:
      The RotateZInfo
    • getRotateInfo

      public RotateInfo getRotateInfo(int type)
      Get the rotate info object for the given type. Type is TYPE_X, TYPE_Y or TYPE_Z
      Parameters:
      type - type
      Returns:
      The corresponding rotate info object
    • setColorParam

      public void setColorParam(String value)
      Set the ColorParam property.
      Parameters:
      value - The new value for ColorParam
    • getColorParam

      public String getColorParam()
      Get the ColorParam property.
      Returns:
      The ColorParam
    • setColorMappings

      public void setColorMappings(List value)
      Set the ColorMappings property.
      Parameters:
      value - The new value for ColorMappings
    • getColorMappings

      public List getColorMappings()
      Get the ColorMappings property.
      Returns:
      The ColorMappings
    • setDisplayUnitName

      public void setDisplayUnitName(String name)
      Set the name of the display unit. Used by subclasses which have values that can be displayed in different units.
      Parameters:
      name - name of unit
    • showDisplayUnitInProperties

      protected boolean showDisplayUnitInProperties()
      Should we show the display unit widget in the properties dialog
      Returns:
      true
    • getDisplayUnitName

      public String getDisplayUnitName()
      Get the name of the display unit.
      Returns:
      String representation of the unit name. May be null.
    • setTheDisplayUnit

      public void setTheDisplayUnit(Unit u)
      Set the the display unit. Used by subclasses which have values that can be displayed in different units.
      Parameters:
      u - unit to display values in
    • getDisplayUnit

      public Unit getDisplayUnit()
      Get the the display unit.
      Returns:
      Unit used for displaying values. May be null.
    • rotateOnEarth

      public boolean rotateOnEarth()
      Can we rotate this symbol when the display rotates