com.bbn.openmap.tools.icon
Class IconPartList

java.lang.Object
  extended by com.bbn.openmap.tools.icon.IconPartList
All Implemented Interfaces:
IconPart, java.lang.Cloneable, java.lang.Iterable<IconPart>

public class IconPartList
extends java.lang.Object
implements IconPart, java.lang.Iterable<IconPart>, java.lang.Cloneable

An IconPartList is a group of IconParts that can be rendered together. If you ask an IconPartList for it's geometry, it will combine all its parts into one geometry, and use its DrawingAttributes to render that combined shape. The IconPartList is itself an IconPart, so the recursive possibilities are endless.


Field Summary
protected  java.awt.Shape clip
           
protected  java.util.List<IconPart> parts
           
protected  DrawingAttributes renderingAttributes
           
 
Constructor Summary
IconPartList()
           
 
Method Summary
 void add(IconPart part)
          First in drawn on bottom.
 void clear()
           
 java.lang.Object clone()
           
 java.awt.Shape getClip()
          Get a clip area for the IconPart.
 java.awt.Shape getGeometry()
          If you ask a IconPartList for its geometry, it will combine all its parts to make one Shape object.
protected  java.util.List<IconPart> getList()
           
 DrawingAttributes getRenderingAttributes()
          Get the rendering attributes for this IconPart.
 java.util.Iterator<IconPart> iterator()
           
 boolean remove(IconPart part)
           
 void render(java.awt.Graphics g, int width, int height)
          Have the IconPart render itself into the Graphic object for a given height and width.
 void render(java.awt.Graphics g, int width, int height, DrawingAttributes appDA)
          Have the IconPart render itself into the Graphic object for a given height and width.
 void setClip(java.awt.Shape clipArea)
          Set a clip area for the IconPart to draw only certain parts of the geometry.
 void setGeometry(java.awt.Shape shape)
          Set the geometry for this IconPart.
 void setRenderingAttributes(DrawingAttributes da)
          Set the rendering attributes for this IconPart.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

parts

protected java.util.List<IconPart> parts

renderingAttributes

protected DrawingAttributes renderingAttributes

clip

protected java.awt.Shape clip
Constructor Detail

IconPartList

public IconPartList()
Method Detail

getList

protected java.util.List<IconPart> getList()

iterator

public java.util.Iterator<IconPart> iterator()
Specified by:
iterator in interface java.lang.Iterable<IconPart>

add

public void add(IconPart part)
First in drawn on bottom. Last in on top.


remove

public boolean remove(IconPart part)

clear

public void clear()

render

public void render(java.awt.Graphics g,
                   int width,
                   int height)
Description copied from interface: IconPart
Have the IconPart render itself into the Graphic object for a given height and width.

Specified by:
render in interface IconPart

render

public void render(java.awt.Graphics g,
                   int width,
                   int height,
                   DrawingAttributes appDA)
Description copied from interface: IconPart
Have the IconPart render itself into the Graphic object for a given height and width. The DrawingAttributes will dictate how the geometries can be drawn, of the IconPart may react to a System setting or last-minute attributes. The IconPart may decide to ignore this provided DrawingAttributes and just use what it has. appDA may be null, in which case the internal DrawingAttributes will be used.

Specified by:
render in interface IconPart
Parameters:
appDA - drawing attributes to use under certain conditions. Certain IconParts on this list may use these drawing attributes if they want/should. May be null.

setClip

public void setClip(java.awt.Shape clipArea)
Description copied from interface: IconPart
Set a clip area for the IconPart to draw only certain parts of the geometry.

Specified by:
setClip in interface IconPart

getClip

public java.awt.Shape getClip()
Description copied from interface: IconPart
Get a clip area for the IconPart.

Specified by:
getClip in interface IconPart

setGeometry

public void setGeometry(java.awt.Shape shape)
Description copied from interface: IconPart
Set the geometry for this IconPart.

Specified by:
setGeometry in interface IconPart

getGeometry

public java.awt.Shape getGeometry()
If you ask a IconPartList for its geometry, it will combine all its parts to make one Shape object. All the rendering attributes from the individual parts will be ignored. The contributions will be kept geometrically separate (disconnected) and their clipping areas will be ignored.

Specified by:
getGeometry in interface IconPart

setRenderingAttributes

public void setRenderingAttributes(DrawingAttributes da)
Description copied from interface: IconPart
Set the rendering attributes for this IconPart.

Specified by:
setRenderingAttributes in interface IconPart

getRenderingAttributes

public DrawingAttributes getRenderingAttributes()
Description copied from interface: IconPart
Get the rendering attributes for this IconPart.

Specified by:
getRenderingAttributes in interface IconPart

clone

public java.lang.Object clone()
Specified by:
clone in interface IconPart
Overrides:
clone in class java.lang.Object
Returns:
copy of itself, IconParts need to be Cloneable


Copyright (C) BBNT Solutions LLC; See http://openmap.bbn.com/ for details