public class FigGraphicsImpl extends Object implements FigGraphics
Details:
FigGraphics
encapsulates a Graphics2D
graphics context, drawing parameters, and view configuration for rendering a figure.
This is the drawing context provided to the main Doodle
drawing method.
Modifier and Type | Field and Description |
---|---|
protected Graphics2D |
mGraphics
Graphics context for rendering.
|
Modifier | Constructor and Description |
---|---|
protected |
FigGraphicsImpl(Graphics2D iGraphics,
FigureView iView)
Sets Java 2D graphics context and destination view.
|
Modifier and Type | Method and Description |
---|---|
void |
drawOnTop(Doodle iDoodle,
AffineTransform iTransform)
Schedules deferred drawing.
|
DetailLevel |
getDetailLevel()
Retrieves DetailLevel property.
|
Graphics2D |
getGraphics()
Retrieves Graphics property.
|
double |
getRotation()
Computes rendering angle.
|
double |
getScale()
Computes rendering scale.
|
FigureView |
getView()
Retrieves View property.
|
void |
setDetailLevel(DetailLevel iDetailLevel)
Updates DetailLevel property.
|
void |
setGraphics(Graphics2D iGraphics)
Updates Graphics property.
|
protected Graphics2D mGraphics
Details:
Read-Graphics
is the Java 2D graphics context that will be used to render the figure.
protected FigGraphicsImpl(Graphics2D iGraphics, FigureView iView)
Details: This constructor sets the Java 2D graphics context that will be used to render the figure and the view where the rendered figure will be shown.
iGraphics
- graphics context used to render figureiView
- view where rendered figure will be displayedpublic Graphics2D getGraphics()
getGraphics
in interface FigGraphics
public void setGraphics(Graphics2D iGraphics)
Details:
This method sets the Graphics
property to the supplied value.
Extreme care should be taken when using this method, because other Doodle
s may subsequently use this FigGraphics
instance.
setGraphics
in interface FigGraphics
iGraphics
- public FigureView getView()
getView
in interface FigGraphics
public DetailLevel getDetailLevel()
getDetailLevel
in interface FigGraphics
public void setDetailLevel(DetailLevel iDetailLevel)
iDetailLevel
- new property valuepublic double getScale()
Details: This method computes and returns the magnification at which the figure will be rendered when using this drawing context.
Sophisticated Doodle
implementations may use this property to adjust the level of detail at which they are rendered, or perhaps even to decide whether they should be rendered at all.
For example, a text Doodle
may choose not to draw itself if it will be too small to read.
getScale
in interface FigGraphics
public double getRotation()
Details: This method computes and returns the rotation angle at which the figure will be rendered, when using this drawing context.
Sophisticated Doodle
implementations may use this property to adjust their own drawing angle, so that the Doodle
can be viewed at the same angle regardless of the view.
For example, text Doodle
s may be rendered horizontally regardless of the view's rotation.
getRotation
in interface FigGraphics
public void drawOnTop(Doodle iDoodle, AffineTransform iTransform)
FigGraphics
Details:
This method schedules the given Doodle
to be drawn after all of the other Doodle
s in the Figure
.
The Doodle
will be drawn using the supplied transform.
Drawing is scheduled on a first-queued, first-drawn basis.
The Z-Doodle
s scheduled for drawing are ignored.
drawOnTop
in interface FigGraphics
iDoodle
- Doodle to drawiTransform
- graphics transform for drawing DoodleCopyright © 2013. All Rights Reserved.