Package ucar.unidata.ui.symbol
Class MetSymbol
java.lang.Object
ucar.unidata.ui.drawing.Glyph
ucar.unidata.ui.drawing.RectangleGlyph
ucar.unidata.ui.symbol.MetSymbol
- All Implemented Interfaces:
Cloneable
- Direct Known Subclasses:
CloudCoverageSymbol,ShapeSymbol,TextSymbol,ThreeDCrossSymbol,WeatherSymbol,WindBarbSymbol
Class MetSymbol
- Version:
- $Revision: 1.60 $
- Author:
- Unidata development team
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringSymbol type attributeprotected StationModelCanvasThe canvas we are inprotected PropertiesDialogsymbol properties dialogFields inherited from class ucar.unidata.ui.drawing.RectangleGlyph
ATTR_RECTTYPE, bounds, CIRCLE, FCIRCLE, FRECTANGLE, FROUNDRECT, RECTANGLE, ROUNDRECT, TYPE_CIRCLE, TYPE_RECT, TYPE_RRECTFields inherited from class ucar.unidata.ui.drawing.Glyph
ATTR_BGCOLOR, ATTR_CHILDREN, ATTR_CLASS, ATTR_COLOR, ATTR_FILL, ATTR_HEIGHT, ATTR_IMAGE, ATTR_LINEWIDTH, ATTR_PARENT, ATTR_PTS, ATTR_STRETCHY, ATTR_TEXT, ATTR_TYPE, ATTR_WIDTH, baseline, H_SEL_WIDTH, highlightColor, idToGlyph, MIN_DISTANCE_TO_STRETCH, PT_CENTER, PT_H_LEFT, PT_H_MIDDLE, PT_H_RIGHT, PT_LL, PT_LM, PT_LR, PT_ML, PT_MM, PT_MR, PT_P1, PT_P2, PT_PREFIX, PT_UL, PT_UM, PT_UR, PT_V_LOWER, PT_V_MIDDLE, PT_V_UPPER, RECTPOINTNAMES, RECTPOINTS, SEL_WIDTH, TAG_GLYPH, underline, url -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddPropertyTabs(JTabbedPane tabbedPane) Add extra components to the property tabprotected voidCalled by the PropertiesDialog to apply any special propertiesprotected Objectclone()Clone this objectcloneMe()Return a clone of this object.voidClose the properties dialog if it is open.voiddecrSize()Increase the size of thisMetSymbol.booleanDetermine whether thisMetSymbolshould show an alignment menu in an editor.booleandoAllObs()Called by the StationModelDisplayable to determine if the shapes should be created with a call to makeShapes(PointOb).abstract voiddraw(Graphics2D g, int x, int y, int width, int height) Draw the symbol, offset from the given location, using "normalized device" coordinates.voiddraw(Graphics2D g, Point2D loc) This is called to paint when we are managed by other objects (e.g., StationLocationRenderer)booleanGet whether thisMetSymbolis active or not.Get the bounds for thisMetSymbolrelative to the point specified.Get the ColorMappings property.Get the ColorParam property.Get the ColorTable property.Get the ColorTableParam property.Get the ColorTableRange property.Get the the colorTable unit.Get the name of the colorTable unit.getDesc()Get the description of thisMetSymbol.Get the the display unit.Get the name of the display unit.getLabel()Get the label to show the user what I am in the propertiesbooleanGet whether thisMetSymbolis missing or not.getName()Get the name of thisMetSymbol.getParam(int index) Get the parameter at the index specified.String[]Get the parameter descriptions for thisMetSymbol.String[]Get the parameter ids for thisMetSymbol.getParamValue(int index) Get the parameter value at the index specified.Get the point at which this object is alligned.getRotateInfo(int type) Get the rotate info object for the given type.Get the RotateXInfo property.Get the RotateYInfo property.Get the RotateZInfo property.doublegetScale()Get the Scale property.Get the ScaleRange property.Get the ScaleParam property.Get the ScaleRange property.Get the the scale unit.Get the name of the scale unit.intGet the x value of the offset.intGet the y value of the offset.voidincrSize()Increase the size of thisMetSymbol.voidinitialize(Element symbolNode) Initialize this symbol from the xml that defined it.protected voidinitPropertyComponents(List comps) Add to the list any widgets that should be added to the basic properties dialog tab.makeShapes(PointOb ob) If doAllObs returns true then this method is called to create the shapes.makeShapes(Data[] dataArray, PointOb ob) If this symbol is not one of the 'known' symbols then this method is called to create the shapes.voidpaint(Graphics g, DisplayCanvas c) This is called to paint within the EditCanvasvoidPaint the selectionbooleanCan we rotate this symbol when the display rotatesvoidsetActive(boolean active) Set whether thisMetSymbolis active or not.voidSet the attribute with the value supplied.voidsetColorMappings(List value) Set the ColorMappings property.voidsetColorParam(String value) Set the ColorParam property.voidsetColorTable(ColorTable value) Set the ColorTable property.voidsetColorTableParam(String value) Set the ColorTableParam property.voidsetColorTableRange(Range value) Set the ColorTableRange property.voidsetColorTableUnitName(String name) Set the name of the ColorTable unit.voidsetDisplayUnitName(String name) Set the name of the display unit.voidsetMissing(boolean missing) Set whether thisMetSymbolis missing or not.voidsetOffset(int x, int y) Set the offset from the center for thisMetSymbol.voidsetParamDescs(String[] value) Set the parameter descriptions for thisMetSymbol.voidsetParamIds(String[] value) Set the parameter ids for thisMetSymbol.voidsetParamValue(int index, Object v) Set the parameter value at the index specified.voidsetRectPoint(String rp) Set the point at which this object is alligned.voidsetRotateDataRange(Range value) Set the RotateRange property.voidsetRotateParam(String value) Set the RotateParam property.voidsetRotateRange(Range value) Set the RotateRange property.voidsetRotateUnitName(String name) Set the name of the Rotate unit.voidsetRotateXInfo(RotateInfo value) Set the RotateXInfo property.voidsetRotateYInfo(RotateInfo value) Set the RotateYInfo property.voidsetRotateZInfo(RotateInfo value) Set the RotateZInfo property.voidsetScale(double value) Set the Scale property.voidsetScaleDataRange(Range value) Set the ScaleRange property.voidsetScaleParam(String value) Set the ScaleParam property.voidsetScaleRange(Range value) Set the ScaleRange property.voidsetScaleUnitName(String name) Set the name of the Scale unit.voidSet the the display unit.booleanIs used by the StationModelDisplayable to determine if the color of the shapes should be set.booleanIs used by the StationModelDisplayable to determine if the shapes should be moved in accordance to the position of this symbol.booleanIs used by the StationModelDisplayable to determine if the shapes should be scaled.protected booleanShould the 'Color by' properties dialog tab be shown.protected booleanShould the 'Rotate by' properties dialog tab be shown.protected booleanShould the 'Scale by' properties dialog tab be shown.protected booleanShould we show the display unit widget in the properties dialogvoidCreate, if needed, and show the properties dialog.toString()Get theStringthat represents thisMetSymbol.Methods inherited from class ucar.unidata.ui.drawing.RectangleGlyph
distance, getBottom, getBounds, getEqualSides, getLeft, getPoint, getPositionAttr, getStretchPoint, getSymetricReshape, getTop, moveBy, moveTo, setPoints, setSize, setType, stretchToMethods inherited from class ucar.unidata.ui.drawing.Glyph
boundsChanged, canStretch, distance, doRemove, flipY, getAttrs, getBackground, getBackground, getBeingCreated, getCreateCommand, getCursor, getFilled, getForeground, getId, getLineWidth, getMoveCommand, getPersistent, getPointOnRect, getPointOnRect, getRectPointName, getRepaintBounds, getStretchPoint, getStretchy, getXml, initDone, makeAttr, notifyChange, paintHighlight, paintSelectionPoints, pickable, processAttrs, setBackground, setBeingCreated, setFilled, setForeground, setId, setLineWidth, setParent, setStretchy, stretchTo, stretchTo, toRect, transformOutput, transformOutput, transformOutputX, transformOutputY
-
Field Details
-
ATTR_PARAMID
Symbol type attribute- See Also:
-
canvas
The canvas we are in -
propertiesDialog
symbol properties dialog
-
-
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
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-DisplayCanvasto 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 idsparamDescs- array of parameter descriptions (long names)
-
-
Method Details
-
initialize
Initialize this symbol from the xml that defined it.- Parameters:
symbolNode- The xml node that defines this symbol.
-
showPropertiesDialog
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
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
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
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
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 thisMetSymbolshould show an alignment menu in an editor. Subclasses should override if not.- Returns:
- true
-
setParamIds
Set the parameter ids for thisMetSymbol.- Parameters:
value- array of parameter ids
-
getParamIds
Get the parameter ids for thisMetSymbol.- Returns:
- array of parameter ids
-
setParamDescs
Set the parameter descriptions for thisMetSymbol. Descriptions are used for UI widgets (labels, combo boxes, etc)- Parameters:
value- array of parameter descriptions
-
getParamDescs
Get the parameter descriptions for thisMetSymbol. 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 thisMetSymbol.- Parameters:
x- x offsety- y offset
-
getXOffset
public int getXOffset()Get the x value of the offset.- Returns:
- x offset from center value.
-
getRectPoint
Get the point at which this object is alligned.- Returns:
- allignment point (e.g. Glyph.PT_MM, PT_LL)
-
setRectPoint
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 thisMetSymbol. Subclasses should implement this if they support such a thing. -
decrSize
public void decrSize()Increase the size of thisMetSymbol. Subclasses should implement this if they support such a thing. -
toString
Get theStringthat represents thisMetSymbol. -
getLabel
Get the label to show the user what I am in the properties- Returns:
- label
-
clone
Clone this object- Overrides:
clonein classRectangleGlyph- Returns:
- a clone
- Throws:
CloneNotSupportedException- if cloning cannot be done
-
cloneMe
Return a clone of this object.- Returns:
- clone
-
getName
Get the name of thisMetSymbol.- Returns:
- name of first
paramId
-
getDesc
Get the description of thisMetSymbol.- Returns:
- description of first
paramId
-
getParamValue
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
Set the parameter value at the index specified. Subclasses need to override this.- Parameters:
index- index into param arrayv- value to set at that index.
-
getParam
Get the parameter at the index specified.- Parameters:
index- index into param array- Returns:
- parameter at index.
-
paint
This is called to paint within the EditCanvas- Overrides:
paintin classRectangleGlyph- Parameters:
g- Graphicsc- DisplayCanvas to paint on.
-
paintSelection
Paint the selection- Overrides:
paintSelectionin classGlyph- Parameters:
g- Graphics to use for paintingc- DisplayCanvas to paint on
-
getBounds
Get the bounds for thisMetSymbolrelative 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
This is called to paint when we are managed by other objects (e.g., StationLocationRenderer)- Parameters:
g- graphics to draw onloc- location to draw at. Used to normalize the bounds.- See Also:
-
draw
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 tox- x locationy- y locationwidth- width to drawheight- height to draw
-
setActive
public void setActive(boolean active) Set whether thisMetSymbolis active or not.- Parameters:
active- true to be active (i.e., visible)
-
getActive
public boolean getActive()Get whether thisMetSymbolis active or not.- Returns:
- true if active (i.e., visible)
-
setMissing
public void setMissing(boolean missing) Set whether thisMetSymbolis missing or not. (i.e., no parameters or values have been set.- Parameters:
missing- true if missing.
-
getMissing
public boolean getMissing()Get whether thisMetSymbolis missing or not. (i.e., no parameters or values have been set.- Returns:
- true if missing.
-
setAttr
Set the attribute with the value supplied.- Overrides:
setAttrin classRectangleGlyph- Parameters:
name- name of attribute.value- value of attribute.
-
setColorTable
Set the ColorTable property.- Parameters:
value- The new value for ColorTable
-
getColorTable
Get the ColorTable property.- Returns:
- The ColorTable
-
setColorTableParam
Set the ColorTableParam property.- Parameters:
value- The new value for ColorTableParam
-
getColorTableParam
Get the ColorTableParam property.- Returns:
- The ColorTableParam
-
setColorTableUnitName
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
Get the name of the colorTable unit.- Returns:
- String representation of the unit name.
May be
null.
-
getColorTableUnit
Get the the colorTable unit.- Returns:
- Unit used for colorTableing values. May be
null.
-
setColorTableRange
Set the ColorTableRange property.- Parameters:
value- The new value for ColorTableRange
-
getColorTableRange
Get the ColorTableRange property.- Returns:
- The ColorTableRange
-
setScaleUnitName
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
Get the name of the scale unit.- Returns:
- String representation of the unit name.
May be
null.
-
getScaleUnit
Get the the scale unit.- Returns:
- Unit used for scaleing values. May be
null.
-
setScaleRange
Set the ScaleRange property.- Parameters:
value- The new value for ScaleRange
-
getScaleRange
Get the ScaleRange property.- Returns:
- The ScaleRange
-
setScaleDataRange
Set the ScaleRange property.- Parameters:
value- The new value for ScaleRange
-
getScaleDataRange
Get the ScaleRange property.- Returns:
- The ScaleRange
-
setScaleParam
Set the ScaleParam property.- Parameters:
value- The new value for ScaleParam
-
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
Set the RotateParam property.- Parameters:
value- The new value for RotateParam
-
setRotateUnitName
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
Set the RotateRange property.- Parameters:
value- The new value for RotateRange
-
setRotateDataRange
Set the RotateRange property.- Parameters:
value- The new value for RotateRange
-
setRotateXInfo
Set the RotateXInfo property.- Parameters:
value- The new value for RotateXInfo
-
getRotateXInfo
Get the RotateXInfo property.- Returns:
- The RotateXInfo
-
setRotateYInfo
Set the RotateYInfo property.- Parameters:
value- The new value for RotateYInfo
-
getRotateYInfo
Get the RotateYInfo property.- Returns:
- The RotateYInfo
-
setRotateZInfo
Set the RotateZInfo property.- Parameters:
value- The new value for RotateZInfo
-
getRotateZInfo
Get the RotateZInfo property.- Returns:
- The RotateZInfo
-
getRotateInfo
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
Set the ColorParam property.- Parameters:
value- The new value for ColorParam
-
getColorParam
Get the ColorParam property.- Returns:
- The ColorParam
-
setColorMappings
Set the ColorMappings property.- Parameters:
value- The new value for ColorMappings
-
getColorMappings
Get the ColorMappings property.- Returns:
- The ColorMappings
-
setDisplayUnitName
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
Get the name of the display unit.- Returns:
- String representation of the unit name.
May be
null.
-
setTheDisplayUnit
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
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
-