vmm.conformalmap
Class ConformalMapFigure

java.lang.Object
  extended by vmm.core.Decoration
      extended by vmm.conformalmap.ConformalMapFigure

public class ConformalMapFigure
extends Decoration

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

LINE_SEGMENT

public static final int LINE_SEGMENT
See Also:
Constant Field Values

LINE

public static final int LINE
See Also:
Constant Field Values

CIRCLE

public static final int CIRCLE
See Also:
Constant Field Values

DEFAULT_POINTS_ON_CIRCLE

public static final int DEFAULT_POINTS_ON_CIRCLE
See Also:
Constant Field Values

DEFAULT_POINTS_ON_SEGMENT

public static final int DEFAULT_POINTS_ON_SEGMENT
See Also:
Constant Field Values

DEFAULT_POINTS_ON_LINE

public static final int DEFAULT_POINTS_ON_LINE
See Also:
Constant Field Values
Constructor Detail

ConformalMapFigure

public 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

public 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

public 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.

Parameters:
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

getColor

public java.awt.Color getColor()
Gets the color of the figure.

See Also:
setColor(Color)

setColor

public void setColor(java.awt.Color color)
Sets the color to be used for drawing the figure. The default value is null, unless set by a constructor. (However note that in anaglyph stereo view, the color is ignored and the figure is drawn in as a maximally bright color.)

Parameters:
color - the color to be used; if null, then the foreground color of the View is used.

getP1

public java.awt.geom.Point2D getP1()
Gets the first of the two points that determine the figure.


setP1

public void setP1(java.awt.geom.Point2D p1)
Sets the first of the two points that determine the figure. For a circle, this is the center point of the circle. The default value is null, unless set by a constructor.

Parameters:
p1 - the point; if null, no figure is drawn.

getP2

public java.awt.geom.Point2D getP2()
Gets the second of the two points that determine the figure.


setP2

public void setP2(java.awt.geom.Point2D p2)
Sets the second of the two points that detrmine the figure. For a circle, this is a point on the circumference of the circle. The default value is null, unless set by a constructor.

Parameters:
p2 - the point; if null, no figure is drawn.

getShape

public int getShape()
Gets the code number for the shape that is drawn.

See Also:
getShape()

setShape

public void setShape(int shape)
Sets the figure that is to be drawn. The default is to draw a line segment.

Parameters:
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.

getPointCount

public int getPointCount()
Returns the number of points that are used for drawing this figure.

See Also:
setPointCount(int)

setPointCount

public void setPointCount(int pointCount)
Sets the number of points that are used for drawing the figure. More points will give a smoother curve. (For lines and line segments, the specified number of points is used only for drawing the image of the figure; in the domain, where the figure is just a straight line, the line is drawn using just two points.)

Parameters:
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.

computeDrawData

public void computeDrawData(View view,
                            boolean exhibitNeedsRedraw,
                            Transform previousTransform,
                            Transform newTransform)
Description copied from class: Decoration
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. (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.

Overrides:
computeDrawData in class Decoration
Parameters:
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.
See Also:
Exhibit.render(Graphics2D, View, Transform, ArrayList), Decoration.doDraw(Graphics2D, View, Transform)

doDraw

public void doDraw(java.awt.Graphics2D g,
                   View view,
                   Transform transform)
Description copied from class: Decoration
This method is called by the 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.

Overrides:
doDraw in class Decoration
Parameters:
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.
See Also:
Exhibit.render(Graphics2D, View, Transform, ArrayList), Decoration.computeDrawData(View, boolean, Transform, Transform)