public class ShapeDoodle extends FlatDoodle
Shape
into Doodle
.
Details:
Package java.awt.geom
defines a rich assortment of Shape
s, but these implementations are not directly compatible with Fig.
This is because Fig works with Doodle
s, not Shape
s.
To rectify this problem and to make it easy to use all Shape
s with Fig, this class retrofits Shape
s into Doodle
s.
To use this adaptor, simply obtain a Shape
and pass it to the constructor of ShapeDoodle
.
Then, configure the new Doodle
s properties using the available methods.
Finally, add the new Doodle
to the Figure
.
Modifier and Type | Field and Description |
---|---|
protected Paint |
mEdgeCold |
protected Paint |
mFillCold |
protected Shape |
mShape
Represented
Shape . |
mToolTip, mZOrder
mParent
Constructor and Description |
---|
ShapeDoodle(Shape iShape)
Sets shape.
|
ShapeDoodle(Shape iShape,
float iZOrder)
Sets shape, Z-order.
|
Modifier and Type | Method and Description |
---|---|
boolean |
contains(AffineTransform iTransform,
Point2D iPoint)
Tests point for contact with doodle.
|
boolean |
draw(FigGraphics iGraphics)
Renders doodle.
|
protected boolean |
draw(FigGraphics iGraphics,
Paint iFill,
Paint iEdge) |
Rectangle2D |
getBounds(AffineTransform iTransform,
Rectangle2D oBounds)
Returns rectangular extent.
|
Paint |
getEdgePaint() |
Paint |
getFillPaint() |
void |
setEdgePaint(Paint iPaint) |
void |
setFillPaint(Paint iPaint) |
getToolTip, getZOrder, setToolTip, setZOrder
getDefaultOrigin, getParent, redraw, setParent
protected Shape mShape
protected Paint mFillCold
protected Paint mEdgeCold
public ShapeDoodle(Shape iShape)
Details:
This constructor adapts the given Shape
and sets its Z-
iShape
- the Shape
to adaptpublic Paint getFillPaint()
public void setFillPaint(Paint iPaint)
public Paint getEdgePaint()
public void setEdgePaint(Paint iPaint)
public boolean draw(FigGraphics iGraphics)
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.
iGraphics
- the graphics contextprotected boolean draw(FigGraphics iGraphics, Paint iFill, Paint iEdge)
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.
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.
iTransform
- the current viewing transformoBounds
- destination for resultCopyright © 2013. All Rights Reserved.