public class CompoundDoodle extends FlatDoodle implements ParentDoodle
Details:
A CompoundDoodle
is a collection of Doodle
s that can be manipulated as if the entire collection were a single shape.
Modifier and Type | Field and Description |
---|---|
protected List<Doodle> |
mDoodles
Doodles in figure.
|
protected boolean |
mDoodlesSorted
True iff doodle list has been sorted.
|
mToolTip, mZOrder
mParent
Constructor and Description |
---|
CompoundDoodle() |
Modifier and Type | Method and Description |
---|---|
void |
add(Doodle iDoodle)
Adds doodle.
|
boolean |
contains(AffineTransform iTransform,
Point2D iP)
Determines whether point is contained in compound.
|
boolean |
draw(FigGraphics iG)
Renders doodle.
|
Rectangle2D |
getBounds(AffineTransform iTransform,
Rectangle2D oBounds)
Computes bounds of entire compound.
|
List<Doodle> |
getDoodles()
Returns all
Doodle s in this CompoundDoodle . |
List<Doodle> |
getDoodlesAt(AffineTransform iTransform,
Point2D iPoint)
Lists doodles at point.
|
float |
getZOrder()
Returns Z-order property.
|
boolean |
hasDescendant(Doodle iDoodle) |
Doodle |
identifyDoodle(AffineTransform iTransform,
Point2D iPoint)
Indentifies doodle under point.
|
void |
remove(Doodle iDoodle)
Removes
Doodle . |
void |
sendDoodleChanged(Doodle iDoodle)
Repaints views.
|
void |
setZOrder(float iZ)
Updates Z-order property.
|
getToolTip, setToolTip
getDefaultOrigin, getParent, redraw, setParent
protected final List<Doodle> mDoodles
Details:
mDoodles
is the list of Doodle
s contained in this compound.
The Doodle
s in this list are generally sorted by Z-order, from least to greatest, though occasionally the list requires resorting.
mDoodlesSorted
protected boolean mDoodlesSorted
Details:
mDoodlesSorted
is true
if the Doodle
s stored in mDoodles
are believed to be sorted by Z-order, false
otherwise.
public void add(Doodle iDoodle)
Details:
add(Doodle)
adds the given Doodle
to this compound.
The parent is notified that this doodle has changed.
iDoodle
- doodle to addremove(Doodle)
public void remove(Doodle iDoodle)
Doodle
.
Details:
This method removes the given Doodle
from this CompoundDoodle
.
iDoodle
- the Doodle
to removepublic List<Doodle> getDoodles()
Doodle
s in this CompoundDoodle
.
Details: b>
This method returns a List
containing all of the Doodle
s in this CompoundDoodle
.
The List
is a copy and can be modified by the caller.
However, the Doodle
s in the List
are not copies, so care should be exercised when manipulating them.
List
public Doodle identifyDoodle(AffineTransform iTransform, Point2D iPoint)
Details:
identifyDoodle(AffineTransform, Point2D)
determines which Doodle
is under the given point.
If multiple Doodle
s are under the point, the highest Doodle
is chosen.
If no Doodle
is found, this method returns null
.
iPoint
- the pointpublic List<Doodle> getDoodlesAt(AffineTransform iTransform, Point2D iPoint)
Details:
getDoodlesAt(AffineTransform, Point2D)
returns a list of all doodles that contain the given point.
The list is sorted by Z-
Since the area covered by some doodles may vary by the view's orientation, the supplied transform may be used to figure a doodle's area.
A null
transform is treated the same as the identity transform.
iTransform
- transform for view being testediPoint
- point to find doodles atpublic void sendDoodleChanged(Doodle iDoodle)
Details:
sendDoodleChanged(Doodle)
sends a ParentDoodle.sendDoodleChanged(Doodle)
event to the parent doodle, using the given doodle.
This generally causes all views to repaint the area covered by the Doodle
.
sendDoodleChanged
in interface ParentDoodle
iDoodle
- doodle that changedpublic Rectangle2D getBounds(AffineTransform iTransform, Rectangle2D oBounds)
Details:
getBounds(AffineTransform, Rectangle2D)
returns a rectangle that completely contains every sub-doodle in this compound.
public boolean contains(AffineTransform iTransform, Point2D iP)
Details:
contains(AffineTransform, Point2D)
returns true
if the given point lies within this compound doodle, false
otherwise.
Containment is determined by testing the point for containment in each individual sub-doodle.
If any of the sub-doodles' contains(AffineTransform, Point2D)
methods reports that the sub-doodle contains the point, then the entire compound is reported to contain the point.
public float getZOrder()
FlatDoodle
Details:
FlatDoodle.getZOrder()
returns the current Z-
getZOrder
in interface Doodle
getZOrder
in class FlatDoodle
public void setZOrder(float iZ)
FlatDoodle
Details:
FlatDoodle.setZOrder(float)
updates the Z-Doodle
and instructs views to redraw.
setZOrder
in class FlatDoodle
iZ
- new property valuepublic boolean draw(FigGraphics iG)
Doodle
Details:
Doodle.draw(FigGraphics)
renders this doodle using the supplied graphics environment.
When the host FigureView
is repainting itself, it will probably call this method, albeit indirectly, to redraw its figure's components.
This method returns true
if drawing was successful, false
otherwise.
public boolean hasDescendant(Doodle iDoodle)
hasDescendant
in interface ParentDoodle
Copyright © 2013. All Rights Reserved.