public class ViewDoodle<DoodleType extends Doodle> extends DoodleDecorator<DoodleType>
Details:
ViewDoodle
allows you to fix the scale and/Doodle
within a view, so that it appears at the same scale or angle in the view, regardless of the view's actual transform.
This is a good class to use in conjunction with TextDoodle
, when the TextDoodle
s are used as labels that should be rendered at a constant physical size and orientation, regardless of the view's transform.
Modifier and Type | Field and Description |
---|---|
protected Point2D |
mOrigin |
protected boolean |
mRotationFixed |
protected boolean |
mScaleFixed |
mDoodle
mParent
Constructor and Description |
---|
ViewDoodle(DoodleType iDoodle) |
Modifier and Type | Method and Description |
---|---|
protected void |
adjustTransform(AffineTransform ioTransform) |
protected void |
clearTransients() |
boolean |
contains(AffineTransform iTransform,
Point2D iPoint)
Tests point for contact with doodle.
|
boolean |
draw(FigGraphics iG)
Renders doodle.
|
Rectangle2D |
getBounds(AffineTransform iTransform,
Rectangle2D oBounds)
Returns rectangular extent.
|
Point2D |
getOrigin() |
boolean |
getRotationFixed() |
boolean |
getScaleFixed() |
void |
sendDoodleChanged(Doodle iShape)
Advises container to react to changes in contained doodle.
|
void |
setOrigin(Point2D iOrigin) |
void |
setRotationFixed(boolean iRotationFixed) |
void |
setScaleFixed(boolean iScaleFixed) |
getDoodle, getZOrder, hasDescendant
getDefaultOrigin, getParent, redraw, setParent
protected boolean mRotationFixed
protected boolean mScaleFixed
protected Point2D mOrigin
public ViewDoodle(DoodleType iDoodle)
public boolean getRotationFixed()
public void setRotationFixed(boolean iRotationFixed)
public boolean getScaleFixed()
public void setScaleFixed(boolean iScaleFixed)
public Point2D getOrigin()
public void setOrigin(Point2D iOrigin)
protected void adjustTransform(AffineTransform ioTransform)
public 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.
draw
in interface Doodle
draw
in class DoodleDecorator<DoodleType extends Doodle>
iG
- the graphics contextpublic void sendDoodleChanged(Doodle iShape)
ParentDoodle
Details:
ParentDoodle.sendDoodleChanged(Doodle)
notifies this container that a doodle contained by this container has changed.
This message propagates up the containment hierarchy, and generally causes all of the views to refresh themselves.
sendDoodleChanged
in interface ParentDoodle
sendDoodleChanged
in class DoodleDecorator<DoodleType extends Doodle>
iShape
- doodle that changedprotected void clearTransients()
public boolean contains(AffineTransform iTransform, Point2D iPoint)
Doodle
Details:
Doodle.contains(AffineTransform, Point2D)
returns true
if the given point lies on this doodle, false
otherwise.
A provided AffineTransform
reveals the characteristics of the view where containment is being tested.
This is useful only for Doodle
s that alter their logical form in order to accommodate the view.
Most implementations will simply ignore this transform, and in some cases, this transform may be null
, indicating that the transform is not to be considered.
In any case, the point being tested is already in figure coordinates.
contains
in interface Doodle
contains
in class DoodleDecorator<DoodleType extends Doodle>
iTransform
- current viewing transformiPoint
- point to testpublic Rectangle2D getBounds(AffineTransform iTransform, Rectangle2D oBounds)
Doodle
Details:
This method returns the rectangular extent of this Doodle
.
The rectangle returned is in logical (i.e. figure) units, not display units.
A provided AffineTransform
reveals the characteristics of the viewing context in which the bounds will be considered.
This information is meaningful only in Doodle
s that alter their logical form to accommodate the view, such as ViewDoodle
.
Most implementations will simply ignore this transform, and in some cases, this transform may be null
, indicating that the transform is a "don't-
Optionally, the caller may pass in a pre-null
, a new rectangle will be instantiated, initialized with the result, and returned.
In either case, the rectangle containing the result is returned.
getBounds
in interface Doodle
getBounds
in class DoodleDecorator<DoodleType extends Doodle>
iTransform
- the current viewing transformoBounds
- destination for resultCopyright © 2013. All Rights Reserved.