jdraw
Class GraphicalObjectManager

java.lang.Object
  |
  +--jdraw.GraphicalObjectManager

public class GraphicalObjectManager
extends Object

A repository for graphical objects.


Field Summary
private  int iDistanceSquareThresold
          The squared distance thresold, used to find closest object.
private  ArrayList lstObjects
          The collection containing the graphical objects.
private  ArrayList lstPropertyChangeListeners
           
private  PropertyChangeListener pplPropertyChangeListener
          The shared listener for bounding box events.
private  Rectangle rectInitialBoundingBox
           
 
Constructor Summary
GraphicalObjectManager()
          Creates a new empty GraphicalObjectManager object.
GraphicalObjectManager(GraphicalObject[] graphical_objects)
          Creates a new GraphicalObjectManager object, with the specified GraphicalObjects.
 
Method Summary
 void add(GraphicalObject grobjObject)
          Adds the specified graphical object to the list of managed objects.
 void addPropertyChangeListener(PropertyChangeListener pplListener)
          Adds a BoudingBoxListener to this graphical object.
protected  void fireBoudingBoxChange(PropertyChangeEvent ppe)
          Fires the specified PropertyChangedEvent.
 GraphicalObject getClosestObject(Point ptPoint)
          Returns the closest object to the specified point, with respect to distance thresold.
 int getDistanceThresold()
          Returns the distance thresold used to find closest objects.
 Iterator iterator()
          Returns an iterator over the graphical objects managed.
 boolean remove(GraphicalObject grobjObject)
          Removes the specified graphical object to the list of managed objects.
 void removePropertyChangeListener(PropertyChangeListener pplListener)
          Removes a BoudingBoxListener from this graphical object.
 void setDistanceThresold(int iNewDistanceThresold)
          Sets the distance thresold used to find closest objects.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

iDistanceSquareThresold

private int iDistanceSquareThresold
The squared distance thresold, used to find closest object.

lstObjects

private final ArrayList lstObjects
The collection containing the graphical objects.

pplPropertyChangeListener

private final PropertyChangeListener pplPropertyChangeListener
The shared listener for bounding box events.

lstPropertyChangeListeners

private final ArrayList lstPropertyChangeListeners

rectInitialBoundingBox

private Rectangle rectInitialBoundingBox
Constructor Detail

GraphicalObjectManager

public GraphicalObjectManager()
Creates a new empty GraphicalObjectManager object.

GraphicalObjectManager

public GraphicalObjectManager(GraphicalObject[] graphical_objects)
Creates a new GraphicalObjectManager object, with the specified GraphicalObjects.
Method Detail

add

public void add(GraphicalObject grobjObject)
Adds the specified graphical object to the list of managed objects.

getClosestObject

public GraphicalObject getClosestObject(Point ptPoint)
Returns the closest object to the specified point, with respect to distance thresold.

getDistanceThresold

public int getDistanceThresold()
Returns the distance thresold used to find closest objects.

iterator

public Iterator iterator()
Returns an iterator over the graphical objects managed.

remove

public boolean remove(GraphicalObject grobjObject)
Removes the specified graphical object to the list of managed objects.

setDistanceThresold

public void setDistanceThresold(int iNewDistanceThresold)
Sets the distance thresold used to find closest objects.

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener pplListener)
Adds a BoudingBoxListener to this graphical object.

removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener pplListener)
Removes a BoudingBoxListener from this graphical object.

fireBoudingBoxChange

protected void fireBoudingBoxChange(PropertyChangeEvent ppe)
Fires the specified PropertyChangedEvent.