|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object vmm.core.Decoration vmm.conformalmap.ConformalMapFigure
public class ConformalMapFigure
Represents a figure in the complex plane, and the image of that figure under a
ConformalMap
. The figure in the domain can be either a line segment, a line, or a
circle. In any case, the figure is determined by two points; for a circle,
the two points are the center of the circle and a point on the circumference.
Field Summary | |
---|---|
static int |
CIRCLE
|
static int |
DEFAULT_POINTS_ON_CIRCLE
|
static int |
DEFAULT_POINTS_ON_LINE
|
static int |
DEFAULT_POINTS_ON_SEGMENT
|
static int |
LINE
|
static int |
LINE_SEGMENT
|
Fields inherited from class vmm.core.Decoration |
---|
decorationNeedsRedraw |
Constructor Summary | |
---|---|
ConformalMapFigure()
Creates a ConformalMapFigure which represents a line segment in the domain, but for which both the points that determine the figure are null. |
|
ConformalMapFigure(java.awt.geom.Point2D p1,
java.awt.geom.Point2D p2,
int shape)
Create a figure defined by two given points in the domain, using the constructor ConformalMapFigure(Point2D, Point2D, int, int)
with the fourth parameter set equal to zero (giving the default number
of points on the figure). |
|
ConformalMapFigure(java.awt.geom.Point2D p1,
java.awt.geom.Point2D p2,
int shape,
int pointCount)
Create a figure defined by two given points in the domain. |
Method Summary | |
---|---|
void |
computeDrawData(View view,
boolean exhibitNeedsRedraw,
Transform previousTransform,
Transform newTransform)
This method is called by the render method in the Exhibit class before it calls
this Decoration's doDraw method, in order to give the Decoration
a chance to recalculate any cached data that it needs in order to draw itself. |
void |
doDraw(java.awt.Graphics2D g,
View view,
Transform transform)
This method is called by the render method of the Exhbit class to draw the Decoration. |
java.awt.Color |
getColor()
Gets the color of the figure. |
java.awt.geom.Point2D |
getP1()
Gets the first of the two points that determine the figure. |
java.awt.geom.Point2D |
getP2()
Gets the second of the two points that determine the figure. |
int |
getPointCount()
Returns the number of points that are used for drawing this figure. |
int |
getShape()
Gets the code number for the shape that is drawn. |
void |
setColor(java.awt.Color color)
Sets the color to be used for drawing the figure. |
void |
setP1(java.awt.geom.Point2D p1)
Sets the first of the two points that determine the figure. |
void |
setP2(java.awt.geom.Point2D p2)
Sets the second of the two points that detrmine the figure. |
void |
setPointCount(int pointCount)
Sets the number of points that are used for drawing the figure. |
void |
setShape(int shape)
Sets the figure that is to be drawn. |
Methods inherited from class vmm.core.Decoration |
---|
addChangeListener, addExtraXML, fireDecorationChangeEvent, forceRedraw, getLayer, readExtraXML, removeChangeListener, setLayer |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int LINE_SEGMENT
public static final int LINE
public static final int CIRCLE
public static final int DEFAULT_POINTS_ON_CIRCLE
public static final int DEFAULT_POINTS_ON_SEGMENT
public static final int DEFAULT_POINTS_ON_LINE
Constructor Detail |
---|
public ConformalMapFigure()
public ConformalMapFigure(java.awt.geom.Point2D p1, java.awt.geom.Point2D p2, int shape)
ConformalMapFigure(Point2D, Point2D, int, int)
with the fourth parameter set equal to zero (giving the default number
of points on the figure).
public ConformalMapFigure(java.awt.geom.Point2D p1, java.awt.geom.Point2D p2, int shape, int pointCount)
shape
- the code number for the type of figure to draw. This should be one
of the constants ConformalMapFigure.LINE_SEGMENT, ConformalMapFigure.LINE, or
ConformalMapFigure.CIRCLE. Any other value is treated as equivalent to line segment.p1
- one of the two points that define the shape. For a circle, p1 is the center
of the circle. For a line segement, it is one of the endpoints. For a line, it is
a point on the line.p2
- one of the two points that define the shape. For a circle, p2 is a point
on the circle. For a line segement, it is one of the endpoints. For a line, it is
a point on the line.pointCount
- the number of points to use when drawing the figure. For lines
and line segments, this refers only to the image of the figure. If the specified
value is less than 2, then the default number of points is used. The default
value depends on the type of figure.Method Detail |
---|
public java.awt.Color getColor()
setColor(Color)
public void setColor(java.awt.Color color)
color
- the color to be used; if null, then the foreground color of the View
is used.public java.awt.geom.Point2D getP1()
public void setP1(java.awt.geom.Point2D p1)
p1
- the point; if null, no figure is drawn.public java.awt.geom.Point2D getP2()
public void setP2(java.awt.geom.Point2D p2)
p2
- the point; if null, no figure is drawn.public int getShape()
getShape()
public void setShape(int shape)
shape
- the code number for the figure. This should be one of the constants
ConformalMapFigure.LINE_SEGMENT, ConformalMapFigure.LINE, or ConformalMapFigure.CIRCLE.
Any other value is ignored.public int getPointCount()
setPointCount(int)
public void setPointCount(int pointCount)
pointCount
- the number of points to show on the line. If the specified
value is less than two, then the default number of points will be used, as
given by the constants DEFAULT_POINTS_ON_CIRCLE, DEFAULT_POINTS_ON_SEGMENT,
and DEFAULT_POINTS_ON_LINE.public void computeDrawData(View view, boolean exhibitNeedsRedraw, Transform previousTransform, Transform newTransform)
Decoration
render
method in the Exhibit class before it calls
this Decoration's doDraw
method, in order to give the Decoration
a chance to recalculate any cached data that it needs in order to draw itself.
(Note that subclasses of the View and Exhibit class are not necessarily required to
follow this pattern.) Not all Decorations will need to "cache"
computed data in this way. Decorations that do not cache data do not have to override this method.
The method in this top-level exhibit class does nothing.
In general, a Decoration should check its decorationNeedsRedraw
variable and
also check the exhibitNeedsRedraw
parameter. It should recompute cached
data if either of these is true. A decoration might also need to compute data if
the Transform has changed, if it has cached any data that depends on the Transform.
computeDrawData
in class Decoration
view
- The View that is drawing the Exhibit; this object contains other
information that might be of use, such as the Display where the Exhibit is drawn
and the the Exhibit that is being drawn.exhibitNeedsRedraw
- This parameter is set to "true" when the Exhibit changes.
If it is true, then presumably the appearance of the Exhibit has
changed, so any cached data for this decoration should probably be recomputed.previousTransform
- The Transform object that was used the last time the Exhibit was
drawn. This can be null if the Exhibit is being drawn for the first time.newTransform
- The Transform object that is being used for this drawing of the Exhibit.
Transform objects contain data about the window in the xy-plane where the Exhibit is
being drawn and about the pixel coordinates on the drawing area.
The two Transform objects are provided just in case any cached data depends on the xy-window
or on the pixel coordinates.Exhibit.render(Graphics2D, View, Transform, ArrayList)
,
Decoration.doDraw(Graphics2D, View, Transform)
public void doDraw(java.awt.Graphics2D g, View view, Transform transform)
Decoration
render
method of the Exhbit class to draw the Decoration.
The computeDrawData
method is called by render
before it calls this method, so any cached
data should be valid by the time this method is called. (Note that subclasses of View and
Exhibit are not necessarily required to follow this pattern.)
The method in this class does nothing. Subclasses will ordinarily override this method to draw the Decoration.
doDraw
in class Decoration
g
- The graphics context where the Exhibit and its decorations are being drawn.view
- The View that is drawing the Exhibit; this object contains other
information that might be of use, such as the Display, if any, associated with
the View, and the the actual Exhibit that is being drawn.transform
- Contains information about the rectangular area in the
xy-plane that is being drawn and about the rectangle of pixels in the graphics
context where it is drawn. Note that at least for the top-level View class,
transform.getX() and transform.getY() can be assumed to be zero.Exhibit.render(Graphics2D, View, Transform, ArrayList)
,
Decoration.computeDrawData(View, boolean, Transform, Transform)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |