gov.noaa.pmel.sgt.dm
Class Annotation

java.lang.Object
  extended by gov.noaa.pmel.sgt.dm.Annotation
All Implemented Interfaces:
SGTData, java.beans.PropertyChangeListener, java.util.EventListener

public class Annotation
extends java.lang.Object
implements SGTData, java.beans.PropertyChangeListener

A container to hold Annote objects.

Since:
3.0
Version:
$Revision$
Author:
Donald Denbo

Constructor Summary
Annotation()
           
Annotation(java.lang.String title)
           
Annotation(java.lang.String title, boolean xTime, boolean yTime)
           
 
Method Summary
 void add(Annote ann)
           
 Annote addLine(java.lang.String id, SGTLine line, LineAttribute attr)
           
 Annote addOval(java.lang.String id, SoTPoint pt1, SoTPoint pt2, LineAttribute attr, java.awt.Color color)
          Add an oval to the Annotation.
 Annote addPoint(java.lang.String id, SGTPoint point, PointAttribute attr)
           
 void addPropertyChangeListener(java.beans.PropertyChangeListener l)
          Add a PropertyChangeListener to the listener list.
 Annote addRect(java.lang.String id, SoTPoint pt1, SoTPoint pt2, LineAttribute attr, java.awt.Color color)
          Add an rectangle to the Annotation.
 Annote addText(java.lang.String id, SoTPoint loc, SGLabel text)
           
 SGTData copy()
          Create a shallow copy.
 Annote findAnnote(java.lang.String id)
           
 java.lang.String getId()
          Get the unique identifier.
 SGLabel getKeyTitle()
          Get a title formatted for a Key.
 java.util.Iterator getLineIterator()
           
 java.util.Iterator getOvalIterator()
           
 java.util.Iterator getPointIterator()
           
 java.util.Iterator getRectIterator()
           
 java.util.Iterator getTextIterator()
           
 java.lang.String getTitle()
          Get the title.
 SGTMetaData getXMetaData()
          Returns the X SGTMetaData.
 SoTRange getXRange()
          Returns the range of the X coordinates.
 SGTMetaData getYMetaData()
          Returns the Y SGTMetaData.
 SoTRange getYRange()
          Returns the range of the Y coordinates.
 boolean hasLine()
           
 boolean hasOval()
           
 boolean hasPoint()
           
 boolean hasRect()
           
 boolean hasText()
           
 boolean isXTime()
          Returns true if the X coordinate is Time.
 boolean isYTime()
          Returns true if the Y coordinate is Time.
 void propertyChange(java.beans.PropertyChangeEvent evt)
           
 boolean remove(Annote ann)
           
 boolean remove(java.lang.String id)
           
 void removePropertyChangeListener(java.beans.PropertyChangeListener l)
          Remove a PropertyChangeListener from the listener list.
 void setId(java.lang.String id)
           
 void setTitle(java.lang.String title)
           
 void setXMetaData(SGTMetaData meta)
           
 void setYMetaData(SGTMetaData meta)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Annotation

public Annotation()

Annotation

public Annotation(java.lang.String title)

Annotation

public Annotation(java.lang.String title,
                  boolean xTime,
                  boolean yTime)
Method Detail

remove

public boolean remove(java.lang.String id)

remove

public boolean remove(Annote ann)

add

public void add(Annote ann)
         throws SGException
Throws:
SGException

addLine

public Annote addLine(java.lang.String id,
                      SGTLine line,
                      LineAttribute attr)
               throws SGException
Throws:
SGException

getLineIterator

public java.util.Iterator getLineIterator()

hasLine

public boolean hasLine()

addPoint

public Annote addPoint(java.lang.String id,
                       SGTPoint point,
                       PointAttribute attr)
                throws SGException
Throws:
SGException

getPointIterator

public java.util.Iterator getPointIterator()

hasPoint

public boolean hasPoint()

addText

public Annote addText(java.lang.String id,
                      SoTPoint loc,
                      SGLabel text)
               throws SGException
Throws:
SGException

getTextIterator

public java.util.Iterator getTextIterator()

hasText

public boolean hasText()

addOval

public Annote addOval(java.lang.String id,
                      SoTPoint pt1,
                      SoTPoint pt2,
                      LineAttribute attr,
                      java.awt.Color color)
               throws SGException
Add an oval to the Annotation. If attr is non-null an oval outline will be drawn, if color is non-null it will be filled.

Throws:
SGException

getOvalIterator

public java.util.Iterator getOvalIterator()

hasOval

public boolean hasOval()

addRect

public Annote addRect(java.lang.String id,
                      SoTPoint pt1,
                      SoTPoint pt2,
                      LineAttribute attr,
                      java.awt.Color color)
               throws SGException
Add an rectangle to the Annotation. If attr is non-null an rectangle outline will be drawn, if color is non-null it will be filled.

Throws:
SGException

getRectIterator

public java.util.Iterator getRectIterator()

hasRect

public boolean hasRect()

findAnnote

public Annote findAnnote(java.lang.String id)

setTitle

public void setTitle(java.lang.String title)

getTitle

public java.lang.String getTitle()
Description copied from interface: SGTData
Get the title.

Specified by:
getTitle in interface SGTData

getKeyTitle

public SGLabel getKeyTitle()
Description copied from interface: SGTData
Get a title formatted for a Key. JPlotLayout will use this if an explicit Key title is not given in the addData method.

Specified by:
getKeyTitle in interface SGTData
See Also:
SGLabel, ColorKey, LineKey, PointCollectionKey, VectorKey

setId

public void setId(java.lang.String id)

getId

public java.lang.String getId()
Description copied from interface: SGTData
Get the unique identifier. The presence of the identifier is optional, but if it is present it should be unique. This field is used to search for the layer that contains the data.

Specified by:
getId in interface SGTData
Returns:
unique identifier
See Also:
Pane, Layer

copy

public SGTData copy()
Description copied from interface: SGTData
Create a shallow copy. User should implement using the clone() method, which requires the Cloneable interface be inherited. If clone() is used, then references to objects are copied NOT the object itself.

For example,

 public SGTData copy() {
   SGTData newData;
   try {
     newData = (SGTData)clone();
   } catch (CloneNotSupportedException e) {
     newData = null;
   }
   return newData;
 }
 

Specified by:
copy in interface SGTData
Returns:
shallow copy
See Also:
Object

isXTime

public boolean isXTime()
Description copied from interface: SGTData
Returns true if the X coordinate is Time.

Specified by:
isXTime in interface SGTData

isYTime

public boolean isYTime()
Description copied from interface: SGTData
Returns true if the Y coordinate is Time.

Specified by:
isYTime in interface SGTData

setXMetaData

public void setXMetaData(SGTMetaData meta)

getXMetaData

public SGTMetaData getXMetaData()
Description copied from interface: SGTData
Returns the X SGTMetaData.

Specified by:
getXMetaData in interface SGTData

setYMetaData

public void setYMetaData(SGTMetaData meta)

getYMetaData

public SGTMetaData getYMetaData()
Description copied from interface: SGTData
Returns the Y SGTMetaData.

Specified by:
getYMetaData in interface SGTData

getXRange

public SoTRange getXRange()
Description copied from interface: SGTData
Returns the range of the X coordinates. If all the data in the array is missing, this method will return Double.NaN as the start and end values for data of type double and return GeoDate(Long.MIN_VALUE) for data of type GeoDate.

Specified by:
getXRange in interface SGTData
See Also:
GeoDate.isMissing()

getYRange

public SoTRange getYRange()
Description copied from interface: SGTData
Returns the range of the Y coordinates.

Specified by:
getYRange in interface SGTData
See Also:
SGTData.getXRange()

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener l)
Description copied from interface: SGTData
Add a PropertyChangeListener to the listener list.

Specified by:
addPropertyChangeListener in interface SGTData

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener l)
Description copied from interface: SGTData
Remove a PropertyChangeListener from the listener list.

Specified by:
removePropertyChangeListener in interface SGTData

propertyChange

public void propertyChange(java.beans.PropertyChangeEvent evt)
Specified by:
propertyChange in interface java.beans.PropertyChangeListener