ucar.unidata.view.station
Class StationModelView

java.lang.Object
  extended by ucar.unidata.view.station.StationModelView
All Implemented Interfaces:
Serializable, Cloneable

public class StationModelView
extends Object
implements Cloneable, Serializable

Encapsolates how a station observation should be displayed. A StationModelView is essentially a collection of MetSymbols.

Version:
$Revision: 1.8 $ $Date: 2005/08/11 22:26:12 $
Author:
MetApps Development Team
See Also:
Serialized Form

Constructor Summary
StationModelView(String name)
          constructor
 
Method Summary
 void addSymbol(MetSymbol ms)
          Add a symbol to the collection.
 void changeTextSize(boolean incr)
          increment or decrement all MetSymbols that are TextSymbols
 Object clone()
          Clone this object
 void draw(Graphics2D g, Point2D loc)
          Draw the entire StationModel at the given location.
 MetSymbol findSymbolByIndex(int idx)
          Find the MetSymbol at the specified index
 MetSymbol findSymbolByName(String name)
          find the MetSymbol with this name
 Rectangle getBounds()
          Get the bounds
 Rectangle getBounds(Point2D loc)
          Return union of bounding box of all the symbols
 String getName()
          Get the name
 MetSymbol getSelected()
          Get the selected MetSymbol, or null if none.
 Iterator iterator()
          Get an iterator over MetSymbol objects
 void removeSymbol(MetSymbol ms)
          Remove a symbol from the collection.
 void setAllMissing(boolean missing)
          Set all values to missing if true.
 void setColor(Color c)
          Set the color of all the MetSymbols
 void setName(String name)
          Set the name
 void setSelected(MetSymbol ms)
          Set the selected MetSymbol.
 void setSize(int size)
          Set the size
 String toString()
          Get a String representation of this object
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

StationModelView

public StationModelView(String name)
constructor

Parameters:
name - name of this object
Method Detail

addSymbol

public void addSymbol(MetSymbol ms)
Add a symbol to the collection.

Parameters:
ms - symbol to add

removeSymbol

public void removeSymbol(MetSymbol ms)
Remove a symbol from the collection.

Parameters:
ms - symbol to add

changeTextSize

public void changeTextSize(boolean incr)
increment or decrement all MetSymbols that are TextSymbols

Parameters:
incr - : true = increase, false = decrease

iterator

public Iterator iterator()
Get an iterator over MetSymbol objects

Returns:
the iterator for the collection

findSymbolByName

public MetSymbol findSymbolByName(String name)
find the MetSymbol with this name

Parameters:
name - the name to match
Returns:
the found MetSybpol or null if no match

findSymbolByIndex

public MetSymbol findSymbolByIndex(int idx)
Find the MetSymbol at the specified index

Parameters:
idx - the symbol index
Returns:
the found MetSymbol
Throws:
ArrayIndexOutOfBoundsException - if idx is larger than life

setSize

public void setSize(int size)
Set the size

Parameters:
size - the new size

getName

public String getName()
Get the name

Returns:
the name

setName

public void setName(String name)
Set the name

Parameters:
name - the new name

setAllMissing

public void setAllMissing(boolean missing)
Set all values to missing if true.

Parameters:
missing - true to set all missing

draw

public void draw(Graphics2D g,
                 Point2D loc)
Draw the entire StationModel at the given location. Note that all MetSymbols expect to use "normalized device" coordinates.

Parameters:
g -
loc -

getSelected

public MetSymbol getSelected()
Get the selected MetSymbol, or null if none. (Used for editing)

Returns:
the selected MetSymbol

setSelected

public void setSelected(MetSymbol ms)
Set the selected MetSymbol. (Used for editing)

Parameters:
ms -

setColor

public void setColor(Color c)
Set the color of all the MetSymbols

Parameters:
c -

getBounds

public Rectangle getBounds()
Get the bounds

Returns:
the bounds

getBounds

public Rectangle getBounds(Point2D loc)
Return union of bounding box of all the symbols

Parameters:
loc -
Returns:
the union of bounding box of all the symbols

toString

public String toString()
Get a String representation of this object

Overrides:
toString in class Object
Returns:
a String representation of this object

clone

public Object clone()
Clone this object

Overrides:
clone in class Object
Returns:
a clone