ucar.unidata.idv.control.drawing
Class ShapeGlyph

java.lang.Object
  extended by ucar.unidata.idv.control.drawing.DrawingGlyph
      extended by ucar.unidata.idv.control.drawing.LineGlyph
          extended by ucar.unidata.idv.control.drawing.ShapeGlyph
Direct Known Subclasses:
TransectGlyph

public class ShapeGlyph
extends LineGlyph

Class ShapeGlyph. Displays a shape.

Version:
$Revision: 1.33 $
Author:
IDV Development Team

Field Summary
static String ATTR_SHAPETYPE
          Xml attribute name
static int SHAPE_DIAMOND
          Shape type
static int SHAPE_HARROW
          Shape type
static int SHAPE_LINE
          Shape type
static String[] SHAPE_NAMES
          Shape type names
static int SHAPE_OVAL
          Shape type
static int SHAPE_RECTANGLE
          Shape type
static int SHAPE_VARROW
          Shape type
static int[] SHAPES
          Shape types
 
Fields inherited from class ucar.unidata.idv.control.drawing.DrawingGlyph
actualPoints, ATTR_COLOR, ATTR_COORDTYPE, ATTR_FILLED, ATTR_FULLLATLON, ATTR_LINEWIDTH, ATTR_NAME, ATTR_PICKABLE, ATTR_POINTS, ATTR_TEXT, ATTR_TIMES, ATTR_ZPOSITION, control, COORD_LABELS, COORD_LATLON, COORD_LATLONALT, COORD_NONE, COORD_TYPENAMES, COORD_TYPES, COORD_XY, COORD_XYZ, coordType, firstMoveEarthLocation, firstMoveLocation, IDX_ALT, IDX_LAT, IDX_LON, IDX_X, IDX_Y, IDX_Z, parentDisplayable, points, propDialog, propertiesUp, PT_X, PT_Y, PT_Z, selectionDisplayable, stretchIndex, tabbedPane, TAG_ARROW, TAG_FRONT, TAG_HIGH, TAG_IMAGE, TAG_LOW, TAG_MOVIE, TAG_POLYGON, TAG_SHAPE, TAG_SYMBOL, TAG_TEXT, uniqueCnt, zPosition
 
Constructor Summary
ShapeGlyph()
          Ctor
ShapeGlyph(DrawingControl control, DisplayEvent event)
          The ctor
ShapeGlyph(DrawingControl control, DisplayEvent event, int shapeType)
          The ctor
 
Method Summary
protected  void addAttributes(Element e)
          Populate the xml node with attrs
 boolean canShowArea()
          Can we display area
 boolean canShowDistance()
          Can we display distance
protected  boolean constrainedTo2D()
          Is glyph constrained to 2d
 String getDescription()
          Get the description of this glyph
protected  int getNumInterpolationPoints()
          By default we don't interpolate
 int getShapeType()
          Get the shape type
 String getTagName()
          Get xml tag name to use
 String getTypeName()
          Name to use for this glyph
 DrawingGlyph handleMouseDragged(DisplayEvent event)
          Handle event
 DrawingGlyph handleMousePressed(DisplayEvent event)
          Handle event
 void initFromXml(DrawingControl control, Element node)
          Init from xml
static float[][] interpolate(int cnt, float[] startXYZ, float[] endXYZ)
          Utility to interpolate cnt number of times between the start and end points
 boolean isValid()
          Do we have a valid number of points
static float[][] makeRectangle(float[][] lineVals)
          Utility to make a rectangle from 2 points
 void setShapeType(int s)
          Set the shapea
 void updateLocation()
          The glyph moved.
 
Methods inherited from class ucar.unidata.idv.control.drawing.LineGlyph
applyProperties, createDisplayable, getLineWidth, getPropertiesComponents, initFinalInner, initFromUser, setLineWidth
 
Methods inherited from class ucar.unidata.idv.control.drawing.DrawingGlyph
addDisplayable, addTime, checkTimeVisibility, checkVisibility, closestPoint, distance, distanceBetween, distanceBetween, doInterpolatedStretch, doMove, doneBeingCreated, doStretch, evaluateJython, getArea, getBeenRemoved, getBeingCreated, getBoundingBox, getBoxPoint, getBoxPoint, getBoxPoint, getColor, getCoordType, getCreatedByUser, getDefaultZPosition, getDisplayable, getDistance, getEditable, getElement, getExtraDescription, getFilled, getFixedAltitude, getFullLatLon, getLatLons, getName, getParent, getPickable, getPoint, getPoints, getPointValues, getPointValues, getPointValuesDouble, getPointValuesDouble, getSelectionPoints, getTimeField, getTimePropertiesComponents, getTimeValues, getVisibleFlag, getZPosition, handleCreation, handleKeyPressed, handleMouseMoved, handleMouseReleased, hide, initFinal, initFromBundle, initMove, initStretch, isInFlatSpace, isInLatLonSpace, isInXYSpace, isSelectable, isVisible, makePoint, mousePressed, moveTo, processPointStrings, projectionChanged, removeDisplayable, setActualPoints, setBeenRemoved, setColor, setColor, setCoordType, setCreatedByUser, setEditable, setFilled, setFullLatLon, setName, setPickable, setPoints, setProperties, setSelected, setTimeValues, setVisible, setVisibleFlag, setZPosition, shouldShowColorSelector, show, smoothCurve, squared, swap, swap, toLatLonAlt, toString, tryToFill, viewpointChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ATTR_SHAPETYPE

public static final String ATTR_SHAPETYPE
Xml attribute name

See Also:
Constant Field Values

SHAPE_RECTANGLE

public static final int SHAPE_RECTANGLE
Shape type

See Also:
Constant Field Values

SHAPE_OVAL

public static final int SHAPE_OVAL
Shape type

See Also:
Constant Field Values

SHAPE_LINE

public static final int SHAPE_LINE
Shape type

See Also:
Constant Field Values

SHAPE_DIAMOND

public static final int SHAPE_DIAMOND
Shape type

See Also:
Constant Field Values

SHAPE_HARROW

public static final int SHAPE_HARROW
Shape type

See Also:
Constant Field Values

SHAPE_VARROW

public static final int SHAPE_VARROW
Shape type

See Also:
Constant Field Values

SHAPES

public static final int[] SHAPES
Shape types


SHAPE_NAMES

public static final String[] SHAPE_NAMES
Shape type names

Constructor Detail

ShapeGlyph

public ShapeGlyph()
Ctor


ShapeGlyph

public ShapeGlyph(DrawingControl control,
                  DisplayEvent event)
           throws VisADException,
                  RemoteException
The ctor

Parameters:
control - The control I'm in.
event - The display event.
Throws:
RemoteException - When bad things happen
VisADException - When bad things happen

ShapeGlyph

public ShapeGlyph(DrawingControl control,
                  DisplayEvent event,
                  int shapeType)
           throws VisADException,
                  RemoteException
The ctor

Parameters:
control - The control I'm in.
event - The display event.
shapeType - The shape type
Throws:
RemoteException - When bad things happen
VisADException - When bad things happen
Method Detail

canShowDistance

public boolean canShowDistance()
Can we display distance

Overrides:
canShowDistance in class DrawingGlyph
Returns:
can do distance

canShowArea

public boolean canShowArea()
Can we display area

Overrides:
canShowArea in class DrawingGlyph
Returns:
can do area

isValid

public boolean isValid()
Do we have a valid number of points

Overrides:
isValid in class DrawingGlyph
Returns:
Is this glyph valid

handleMouseDragged

public DrawingGlyph handleMouseDragged(DisplayEvent event)
                                throws VisADException,
                                       RemoteException
Handle event

Overrides:
handleMouseDragged in class DrawingGlyph
Parameters:
event - The display event.
Returns:
This or null
Throws:
RemoteException - When bad things happen
VisADException - When bad things happen

initFromXml

public void initFromXml(DrawingControl control,
                        Element node)
                 throws VisADException,
                        RemoteException
Init from xml

Overrides:
initFromXml in class LineGlyph
Parameters:
control - The control I'm in.
node - The xml node
Throws:
RemoteException - On badness
VisADException - On badness

constrainedTo2D

protected boolean constrainedTo2D()
Is glyph constrained to 2d

Overrides:
constrainedTo2D in class DrawingGlyph
Returns:
Constrained to 2d

addAttributes

protected void addAttributes(Element e)
Populate the xml node with attrs

Overrides:
addAttributes in class LineGlyph
Parameters:
e - Xml node

getTagName

public String getTagName()
Get xml tag name to use

Specified by:
getTagName in class DrawingGlyph
Returns:
Xml tag name

getNumInterpolationPoints

protected int getNumInterpolationPoints()
By default we don't interpolate

Returns:
0

interpolate

public static float[][] interpolate(int cnt,
                                    float[] startXYZ,
                                    float[] endXYZ)
Utility to interpolate cnt number of times between the start and end points

Parameters:
cnt - Number of interpolation points inculding start and end point
startXYZ - Start point
endXYZ - End point
Returns:
Interpolated points

updateLocation

public void updateLocation()
                    throws VisADException,
                           RemoteException
The glyph moved. Update location.

Overrides:
updateLocation in class DrawingGlyph
Throws:
RemoteException - On badness
VisADException - On badness

makeRectangle

public static float[][] makeRectangle(float[][] lineVals)
Utility to make a rectangle from 2 points

Parameters:
lineVals - The 2 points
Returns:
5 points

handleMousePressed

public DrawingGlyph handleMousePressed(DisplayEvent event)
                                throws VisADException,
                                       RemoteException
Handle event

Overrides:
handleMousePressed in class DrawingGlyph
Parameters:
event - The display event.
Returns:
This or null
Throws:
RemoteException - When bad things happen
VisADException - When bad things happen

getTypeName

public String getTypeName()
Name to use for this glyph

Specified by:
getTypeName in class DrawingGlyph
Returns:
The glyph type name

getDescription

public String getDescription()
Get the description of this glyph

Overrides:
getDescription in class DrawingGlyph
Returns:
The description

getShapeType

public int getShapeType()
Get the shape type

Returns:
Shape type

setShapeType

public void setShapeType(int s)
Set the shapea

Parameters:
s - Shape type