drawables
Class DrawableObjectsWithSearchTree

java.lang.Object
  |
  +--drawables.DrawableObjects
        |
        +--drawables.DrawableObjectsWithSearchTree

public class DrawableObjectsWithSearchTree
extends DrawableObjects

Container class for drawable objects.


Field Summary
 
Fields inherited from class drawables.DrawableObjects
hashtable, lastInLayer, layer, maxId, mode, numOfLayers, numOfModes, searchObject, selectedObject, STDMODE, visibleDrawable
 
Constructor Summary
DrawableObjectsWithSearchTree(int numOfLayers, SpatialSearchTree tree)
          Constructor.
 
Method Summary
 void addDrawable(Drawable prim)
          Add a drawable into the container.
 void drawAllObjectsOfLayer(int l, java.awt.Graphics g, java.awt.Rectangle r, int scale)
          Zeichnet alle Drawable-Objekte im angegebenen Graphic Context, vorausgesetzt der aktuelle Maßstab wird vom Drawable-Objekt überschritten und es liegt im übergebenen Rechteck.
 Drawable findNearestDrawable(int x, int y, Drawable prim, SpatialSearchTreeObject typeObject)
          Finds the nearest drawable to a given position.
 java.awt.Rectangle getDataspace()
          Returns the data space of all objects.
 Drawable getNextDrawable(Drawable prevPrim)
          Returns the next drawable primitive.
 DrawableObject getNextVisibleIntersectingObject(int px, int py, int scale, boolean selectable)
          Gibt das nächste benannte, sichtbare und ggf. selektierbare Drawable-Objekt zurück, welches sich an der angegebenen Position befindet und den Maßstab einhält.
 int getNumberOfObjects()
          Returns the number of all objects.
 void remove(DrawableObject obj)
          Löscht das Drawable-Objekt aus dem Container und löst die Beziehung zum Grafik-Primitiv auf.
 void removeAll()
          Removes all objects from the container.
 void removeAllObjectsOfLayer(int l)
          Removes all objects of a given layer from the container.
 
Methods inherited from class drawables.DrawableObjects
deselect, drawAllObjects, elements, findNearestDrawable, getMode, getNextFreeId, getNumberOfModes, getObjectById, getSelectedObject, getVisibleObjectById, newDrawableObject, newDrawableObject, newDrawableObject, readDrawableObject, readDrawableObject, readDrawableObject, select, setMode, setNumberOfModes
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DrawableObjectsWithSearchTree

public DrawableObjectsWithSearchTree(int numOfLayers,
                                     SpatialSearchTree tree)
Constructor.

Parameters:
numOfLayers - number of layers
tree - spatial searchtree used (may be null)
Method Detail

addDrawable

public void addDrawable(Drawable prim)
Add a drawable into the container.

Overrides:
addDrawable in class DrawableObjects
Parameters:
prim - the drawable

drawAllObjectsOfLayer

public void drawAllObjectsOfLayer(int l,
                                  java.awt.Graphics g,
                                  java.awt.Rectangle r,
                                  int scale)
Zeichnet alle Drawable-Objekte im angegebenen Graphic Context, vorausgesetzt der aktuelle Maßstab wird vom Drawable-Objekt überschritten und es liegt im übergebenen Rechteck. Es werden nur die Objekte des angegebenen Layers gezeichnet.

Overrides:
drawAllObjectsOfLayer in class DrawableObjects
Parameters:
l - Layer
g - aktueller Graphic Context
r - Clipping-Rechteck
scale - aktueller Maßstab

findNearestDrawable

public Drawable findNearestDrawable(int x,
                                    int y,
                                    Drawable prim,
                                    SpatialSearchTreeObject typeObject)
Finds the nearest drawable to a given position.

Parameters:
x - x-coordinate of the position
y - y-coordinate of the position
prim - the excluded drawable (may be null)
typeObject - an object specifying the type that is searched (may be null)
Returns:
the nearest drawable

getDataspace

public java.awt.Rectangle getDataspace()
Returns the data space of all objects.

Overrides:
getDataspace in class DrawableObjects
Returns:
mbr of the data space

getNextDrawable

public Drawable getNextDrawable(Drawable prevPrim)
Returns the next drawable primitive.

Overrides:
getNextDrawable in class DrawableObjects
Parameters:
prevPrim - previous drawable; null => look for first drawable
Returns:
the primitive (or null)

getNextVisibleIntersectingObject

public DrawableObject getNextVisibleIntersectingObject(int px,
                                                       int py,
                                                       int scale,
                                                       boolean selectable)
Gibt das nächste benannte, sichtbare und ggf. selektierbare Drawable-Objekt zurück, welches sich an der angegebenen Position befindet und den Maßstab einhält. Falls es kein solches Objekt gibt, wird null zurückgegeben.

Overrides:
getNextVisibleIntersectingObject in class DrawableObjects
Parameters:
px - x-Koordinate der gesuchten Position (in Basis-Koordinaten)
py - y-Koordinate der gesuchten Position (in Basis-Koordinaten)
selectable - muß das Objekt selektierbar sein?
Returns:
gefundenes Drawable-Objekt

getNumberOfObjects

public int getNumberOfObjects()
Returns the number of all objects.

Overrides:
getNumberOfObjects in class DrawableObjects
Returns:
number of all objects

remove

public void remove(DrawableObject obj)
Löscht das Drawable-Objekt aus dem Container und löst die Beziehung zum Grafik-Primitiv auf.

Overrides:
remove in class DrawableObjects
Parameters:
obj - zu löschendes Drawable-Objekt

removeAll

public void removeAll()
Removes all objects from the container.

Overrides:
removeAll in class DrawableObjects

removeAllObjectsOfLayer

public void removeAllObjectsOfLayer(int l)
Removes all objects of a given layer from the container.

Overrides:
removeAllObjectsOfLayer in class DrawableObjects
Parameters:
l - the layer