|
JHotDraw 7.5.1 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jhotdraw.beans.AbstractBean
org.jhotdraw.draw.AbstractFigure
org.jhotdraw.draw.AbstractCompositeFigure
org.jhotdraw.draw.QuadTreeCompositeFigure
public abstract class QuadTreeCompositeFigure
QuadTreeCompositeFigure.
Nested Class Summary | |
---|---|
protected class |
QuadTreeCompositeFigure.FigureHandler
Handles all figure events fired by Figures contained in the Drawing. |
Nested classes/interfaces inherited from class org.jhotdraw.draw.AbstractCompositeFigure |
---|
AbstractCompositeFigure.EventHandler |
Field Summary |
---|
Fields inherited from class org.jhotdraw.draw.AbstractCompositeFigure |
---|
cachedBounds, cachedDrawingArea, children, eventHandler, layouter |
Fields inherited from class org.jhotdraw.draw.AbstractFigure |
---|
changingDepth, listenerList |
Fields inherited from class org.jhotdraw.beans.AbstractBean |
---|
propertySupport |
Fields inherited from interface org.jhotdraw.draw.CompositeFigure |
---|
LAYOUT_INSETS |
Fields inherited from interface org.jhotdraw.draw.Figure |
---|
CONNECTABLE_PROPERTY, REMOVABLE_PROPERTY, SELECTABLE_PROPERTY, TRANSFORMABLE_PROPERTY |
Constructor Summary | |
---|---|
QuadTreeCompositeFigure()
Creates a new instance. |
Method Summary | |
---|---|
void |
basicAdd(int index,
Figure figure)
Adds a child to the figure at the specified index without firing events. |
Figure |
basicRemoveChild(int index)
Removes the child at the specified index without firing events. |
void |
bringToFront(Figure figure)
Brings a figure to the front of the drawing. |
boolean |
contains(Figure f)
Returns true if this composite figure contains the specified figure. |
protected QuadTreeCompositeFigure.FigureHandler |
createFigureHandler()
|
void |
draw(java.awt.Graphics2D g)
Draws the figure. |
void |
draw(java.awt.Graphics2D g,
java.util.Collection<Figure> c)
|
Figure |
findFigure(java.awt.geom.Point2D.Double p)
|
Figure |
findFigureBehind(java.awt.geom.Point2D.Double p,
java.util.Collection<Figure> figures)
|
Figure |
findFigureBehind(java.awt.geom.Point2D.Double p,
Figure figure)
|
Figure |
findFigureExcept(java.awt.geom.Point2D.Double p,
java.util.Collection ignore)
|
Figure |
findFigureExcept(java.awt.geom.Point2D.Double p,
Figure ignore)
|
Figure |
findFigureInside(java.awt.geom.Point2D.Double p)
Finds the innermost figure at the specified location. |
java.util.List<Figure> |
findFigures(java.awt.geom.Rectangle2D.Double r)
|
java.util.List<Figure> |
findFiguresWithin(java.awt.geom.Rectangle2D.Double bounds)
|
Dimension2DDouble |
getCanvasSize()
|
java.util.List<Figure> |
getChildren()
Returns an unchangeable list view on the children. |
java.util.List<Figure> |
getFigures(java.awt.geom.Rectangle2D.Double bounds)
|
java.util.List<Figure> |
getFiguresFrontToBack()
Returns an iterator to iterate in Z-order front to back over the children. |
int |
indexOf(Figure figure)
Returns the index of the specified child. |
void |
sendToBack(Figure figure)
Sends a figure to the back of the composite figure. |
void |
setCanvasSize(Dimension2DDouble newValue)
|
java.util.List<Figure> |
sort(java.util.Collection<Figure> c)
Implementation note: Sorting can not be done for orphaned children. |
Methods inherited from class org.jhotdraw.beans.AbstractBean |
---|
addPropertyChangeListener, addPropertyChangeListener, firePropertyChange, firePropertyChange, firePropertyChange, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.jhotdraw.draw.Figure |
---|
addFigureListener, addPropertyChangeListener, findCompatibleConnector, findConnector, getActions, getConnectors, getCursor, getEndPoint, getLayer, getStartPoint, getTool, getToolTipText, handleDrop, handleMouseClick, includes, isConnectable, isRemovable, isSelectable, isTransformable, isVisible, remap, removeFigureListener, removePropertyChangeListener, requestRemove |
Constructor Detail |
---|
public QuadTreeCompositeFigure()
Method Detail |
---|
protected QuadTreeCompositeFigure.FigureHandler createFigureHandler()
public int indexOf(Figure figure)
CompositeFigure
This is a convenience method for calling
getChildren().indexOf(index);
.
indexOf
in interface CompositeFigure
indexOf
in class AbstractCompositeFigure
public void basicAdd(int index, Figure figure)
CompositeFigure
This method can be used to reinsert a child figure which has been
temporarily removed from this CompositeFigure (for example to reorder
the sequence of the children) and to efficiently build a drawing from
an InputFormat
.
basicAdd
in interface CompositeFigure
basicAdd
in class AbstractCompositeFigure
public Figure basicRemoveChild(int index)
CompositeFigure
This method can be used to temporarily remove a child from this CompositeFigure (for example to reorder the sequence of the children).
Returns the removed child figure.
basicRemoveChild
in interface CompositeFigure
basicRemoveChild
in class AbstractCompositeFigure
public void draw(java.awt.Graphics2D g)
Figure
draw
in interface Figure
draw
in class AbstractCompositeFigure
g
- The Graphics2D to draw to.public java.util.List<Figure> sort(java.util.Collection<Figure> c)
public void draw(java.awt.Graphics2D g, java.util.Collection<Figure> c)
public java.util.List<Figure> getFigures(java.awt.geom.Rectangle2D.Double bounds)
public java.util.List<Figure> getChildren()
CompositeFigure
getChildren
in interface CompositeFigure
getChildren
in class AbstractCompositeFigure
public Figure findFigureInside(java.awt.geom.Point2D.Double p)
Figure
In case of a CompositeFigure
, this method descends into its
children and into its children's children until the innermost figure is
found.
This functionality is implemented using the Chain of Responsibility design pattern. A figure which is not composed of other figures returns itself if the point is contained by the figure. Composed figures pass the method call down to their children.
findFigureInside
in interface Figure
findFigureInside
in class AbstractCompositeFigure
p
- A location on the drawing.
public java.util.List<Figure> getFiguresFrontToBack()
public Figure findFigure(java.awt.geom.Point2D.Double p)
public Figure findFigureExcept(java.awt.geom.Point2D.Double p, Figure ignore)
public Figure findFigureExcept(java.awt.geom.Point2D.Double p, java.util.Collection ignore)
public Figure findFigureBehind(java.awt.geom.Point2D.Double p, Figure figure)
public Figure findFigureBehind(java.awt.geom.Point2D.Double p, java.util.Collection<Figure> figures)
public java.util.List<Figure> findFigures(java.awt.geom.Rectangle2D.Double r)
public java.util.List<Figure> findFiguresWithin(java.awt.geom.Rectangle2D.Double bounds)
public void bringToFront(Figure figure)
AbstractCompositeFigure
bringToFront
in class AbstractCompositeFigure
figure
- that is part of the drawingpublic void sendToBack(Figure figure)
AbstractCompositeFigure
sendToBack
in class AbstractCompositeFigure
figure
- that is part of this composite figurepublic boolean contains(Figure f)
CompositeFigure
This is a convenience method for calling
getChildren().contains(f);
.
contains
in interface CompositeFigure
contains
in class AbstractCompositeFigure
public void setCanvasSize(Dimension2DDouble newValue)
public Dimension2DDouble getCanvasSize()
|
Copyright 1996-2010 (c) by the authors and contributors of the JHotDraw project. Some rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |