Class QuadTreeCompositeFigure
- java.lang.Object
-
- org.jhotdraw.beans.AbstractBean
-
- org.jhotdraw.draw.AbstractFigure
-
- org.jhotdraw.draw.AbstractCompositeFigure
-
- org.jhotdraw.draw.QuadTreeCompositeFigure
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, CompositeFigure, Figure, DOMStorable
public abstract class QuadTreeCompositeFigure extends AbstractCompositeFigure
QuadTreeCompositeFigure.- See Also:
- Serialized Form
-
-
Field Summary
-
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
Constructors Constructor and Description QuadTreeCompositeFigure()Creates a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidbasicAdd(int index, Figure figure)Adds a child to the figure at the specified index without firing events.FigurebasicRemoveChild(int index)Removes the child at the specified index without firing events.voidbringToFront(Figure figure)Brings a figure to the front of the drawing.booleancontains(Figure f)Returns true if this composite figure contains the specified figure.voiddraw(java.awt.Graphics2D g)Draws the figure.voiddraw(java.awt.Graphics2D g, java.util.Collection<Figure> c)FigurefindFigure(java.awt.geom.Point2D.Double p)FigurefindFigureBehind(java.awt.geom.Point2D.Double p, java.util.Collection<Figure> figures)FigurefindFigureBehind(java.awt.geom.Point2D.Double p, Figure figure)FigurefindFigureExcept(java.awt.geom.Point2D.Double p, java.util.Collection ignore)FigurefindFigureExcept(java.awt.geom.Point2D.Double p, Figure ignore)FigurefindFigureInside(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)Dimension2DDoublegetCanvasSize()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.intindexOf(Figure figure)Returns the index of the specified child.voidsendToBack(Figure figure)Sends a figure to the back of the composite figure.voidsetCanvasSize(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.draw.AbstractCompositeFigure
add, add, addAll, addAll, addCompositeFigureListener, addNotify, basicAdd, basicAddAll, basicRemove, basicRemoveAll, basicRemoveAllChildren, changed, clone, contains, createHandles, findChild, findChildIndex, get, getAttributes, getAttributesRestoreData, getBounds, getChild, getChildCount, getChildrenFrontToBack, getDecomposition, getDrawingArea, getLayouter, getPreferredSize, getTransformRestoreData, layout, read, remove, removeAll, removeAllChildren, removeChild, removeCompositeFigureListener, removeNotify, restoreAttributesTo, restoreTransformTo, set, setBounds, setLayouter, transform, willChange, write
-
Methods inherited from class org.jhotdraw.draw.AbstractFigure
addFigureListener, findCompatibleConnector, findConnector, fireAreaInvalidated, fireFigureChanged, getActions, getConnectors, getCursor, getEndPoint, getLayer, getStartPoint, getTool, getToolTipText, handleDrop, handleMouseClick, includes, isConnectable, isRemovable, isSelectable, isTransformable, isVisible, remap, removeFigureListener, requestRemove, setBounds, setConnectable, setRemovable, setSelectable, setTransformable, setVisible, toString
-
Methods inherited from class org.jhotdraw.beans.AbstractBean
addPropertyChangeListener, addPropertyChangeListener, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener
-
Methods inherited from class java.lang.Object
equals, 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
-
-
-
-
Method Detail
-
indexOf
public int indexOf(Figure figure)
Description copied from interface:CompositeFigureReturns the index of the specified child.This is a convenience method for calling
getChildren().indexOf(index);.- Specified by:
indexOfin interfaceCompositeFigure- Overrides:
indexOfin classAbstractCompositeFigure- Returns:
- The index of the child, or -1 if the specified figure is not a child of this CompositeFigure.
-
basicAdd
public void basicAdd(int index, Figure figure)Description copied from interface:CompositeFigureAdds a child to the figure at the specified index without firing events.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.- Specified by:
basicAddin interfaceCompositeFigure- Overrides:
basicAddin classAbstractCompositeFigure
-
basicRemoveChild
public Figure basicRemoveChild(int index)
Description copied from interface:CompositeFigureRemoves the child at the specified index without firing events.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.
- Specified by:
basicRemoveChildin interfaceCompositeFigure- Overrides:
basicRemoveChildin classAbstractCompositeFigure
-
draw
public void draw(java.awt.Graphics2D g)
Description copied from interface:FigureDraws the figure.- Specified by:
drawin interfaceFigure- Overrides:
drawin classAbstractCompositeFigure- Parameters:
g- The Graphics2D to draw to.
-
sort
public java.util.List<Figure> sort(java.util.Collection<Figure> c)
Implementation note: Sorting can not be done for orphaned children.
-
draw
public void draw(java.awt.Graphics2D g, java.util.Collection<Figure> c)
-
getFigures
public java.util.List<Figure> getFigures(java.awt.geom.Rectangle2D.Double bounds)
-
getChildren
public java.util.List<Figure> getChildren()
Description copied from interface:CompositeFigureReturns an unchangeable list view on the children.- Specified by:
getChildrenin interfaceCompositeFigure- Overrides:
getChildrenin classAbstractCompositeFigure
-
findFigureInside
public Figure findFigureInside(java.awt.geom.Point2D.Double p)
Description copied from interface:FigureFinds the innermost figure at the specified location.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.
- Specified by:
findFigureInsidein interfaceFigure- Overrides:
findFigureInsidein classAbstractCompositeFigure- Parameters:
p- A location on the drawing.- Returns:
- Returns the innermost figure at the location, or null if the location is not contained in a figure.
-
getFiguresFrontToBack
public java.util.List<Figure> getFiguresFrontToBack()
Returns an iterator to iterate in Z-order front to back over the children.
-
findFigureExcept
@Nullable public Figure findFigureExcept(java.awt.geom.Point2D.Double p, Figure ignore)
-
findFigureExcept
@Nullable public Figure findFigureExcept(java.awt.geom.Point2D.Double p, java.util.Collection ignore)
-
findFigureBehind
@Nullable public Figure findFigureBehind(java.awt.geom.Point2D.Double p, Figure figure)
-
findFigureBehind
@Nullable public Figure findFigureBehind(java.awt.geom.Point2D.Double p, java.util.Collection<Figure> figures)
-
findFigures
public java.util.List<Figure> findFigures(java.awt.geom.Rectangle2D.Double r)
-
findFiguresWithin
public java.util.List<Figure> findFiguresWithin(java.awt.geom.Rectangle2D.Double bounds)
-
bringToFront
public void bringToFront(Figure figure)
Description copied from class:AbstractCompositeFigureBrings a figure to the front of the drawing.- Overrides:
bringToFrontin classAbstractCompositeFigure- Parameters:
figure- that is part of the drawing
-
sendToBack
public void sendToBack(Figure figure)
Description copied from class:AbstractCompositeFigureSends a figure to the back of the composite figure.- Overrides:
sendToBackin classAbstractCompositeFigure- Parameters:
figure- that is part of this composite figure
-
contains
public boolean contains(Figure f)
Description copied from interface:CompositeFigureReturns true if this composite figure contains the specified figure.This is a convenience method for calling
getChildren().contains(f);.- Specified by:
containsin interfaceCompositeFigure- Overrides:
containsin classAbstractCompositeFigure
-
setCanvasSize
public void setCanvasSize(Dimension2DDouble newValue)
-
getCanvasSize
public Dimension2DDouble getCanvasSize()
-
-
DataMelt 3.0 © DataMelt by jWork.ORG