|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectedu.neu.ccs.gui.PlotMarkAlgorithm
Class PlotMarkAlgorithm defines the requirements for an
algorithm that will produce a scalable shape defined in the neighborhood
of a given point. This class is intended to be used in constructors for
the class PlotMark.
This class provides several static instances of itself.
The following changes were made in 2.6.0:
size parameter was reduced from
1 to 0 to permit the base case of each shape to be created.
BetterCircle was
introduced that produces elegant, symmetrical circles for
small values of the size parameter.
QuarterCircleData and
BetterCirclePath on which the algorithm
BetterCircle is based are made available as
public static methods.
JavaCircle and is still available.
| Field Summary | |
static PlotMarkAlgorithm |
Asterisk
The asterisk algorithm. |
static PlotMarkAlgorithm |
BetterCircle
The better circle algorithm for creation of plot marks. |
static PlotMarkAlgorithm |
BluntWedgeE
The blunt-wedge-facing-east algorithm. |
static PlotMarkAlgorithm |
BluntWedgeN
The blunt-wedge-facing-north algorithm. |
static PlotMarkAlgorithm |
BluntWedgeS
The blunt-wedge-facing-south algorithm. |
static PlotMarkAlgorithm |
BluntWedgeW
The blunt-wedge-facing-west algorithm. |
static PlotMarkAlgorithm |
Cross
The cross sign algorithm. |
static PlotMarkAlgorithm |
Diamond
The diamond algorithm. |
static PlotMarkAlgorithm |
HBar
The horizontal bar algorithm. |
static PlotMarkAlgorithm |
JavaCircle
The Java circle algorithm. |
static PlotMarkAlgorithm |
Plus
The plus sign algorithm. |
static PlotMarkAlgorithm |
SharpWedgeE
The sharp-wedge-facing-east algorithm. |
static PlotMarkAlgorithm |
SharpWedgeN
The sharp-wedge-facing-north algorithm. |
static PlotMarkAlgorithm |
SharpWedgeS
The sharp-wedge-facing-south algorithm. |
static PlotMarkAlgorithm |
SharpWedgeW
The sharp-wedge-facing-west algorithm. |
static PlotMarkAlgorithm |
Square
The square algorithm. |
static PlotMarkAlgorithm |
ThumbE
The thumb-facing-east algorithm. |
static PlotMarkAlgorithm |
ThumbN
The thumb-facing-north algorithm. |
static PlotMarkAlgorithm |
ThumbS
The thumb-facing-south algorithm. |
static PlotMarkAlgorithm |
ThumbW
The thumb-facing-west algorithm. |
static PlotMarkAlgorithm |
VBar
The vertical bar algorithm. |
static PlotMarkAlgorithm |
WedgeE
The wedge-facing-east algorithm. |
static PlotMarkAlgorithm |
WedgeN
The wedge-facing-north algorithm. |
static PlotMarkAlgorithm |
WedgeS
The wedge-facing-south algorithm. |
static PlotMarkAlgorithm |
WedgeW
The wedge-facing-west algorithm. |
| Constructor Summary | |
PlotMarkAlgorithm()
|
|
| Method Summary | |
static Shape |
BetterCirclePath(int x,
int y,
int radius)
Returns a full circle path with the given center (x,y) and the given radius using the method QuarterCircleData for the computation. |
abstract Shape |
makeShape(double x,
double y,
int size)
Returns a shape constructed in the neighborhood of the given point and scaled with the given size. |
Shape |
makeShape(Point2D p,
int size)
Returns a shape constructed in the neighborhood of the given point and scaled with the given size. |
static int[][] |
QuarterCircleData(int radius)
Returns the data for construction of a quarter circle path of the given radius. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final PlotMarkAlgorithm HBar
The horizontal bar algorithm.
Produces the line segment path
(x-size,y) to (x+size,y).
When used in a PlotMark, the fill setting should
be false.
public static final PlotMarkAlgorithm VBar
The vertical bar algorithm.
Produces the line segment path
(x,y-size) to (x,y+size).
When used in a PlotMark, the fill setting should
be false.
public static final PlotMarkAlgorithm Plus
The plus sign algorithm.
Produces the combined path with 2 line segments:
(x-size,y) to (x+size,y)(x,y-size) to (x,y+size)When used in a PlotMark, the fill setting should
be false.
public static final PlotMarkAlgorithm Cross
The cross sign algorithm.
Produces the combined path with 2 line segments:
(x-size,y-size) to (x+size,y+size)(x+size,y-size) to (x-size,y+size)When used in a PlotMark, the fill setting should
be false.
public static final PlotMarkAlgorithm Asterisk
The asterisk algorithm.
Produces the combined path with 4 line segments:
(x-size,y) to (x+size,y)(x,y-size) to (x,y+size)(x-size,y-size) to (x+size,y+size)(x+size,y-size) to (x-size,y+size)When used in a PlotMark, the fill setting should
be false.
public static final PlotMarkAlgorithm Square
The square algorithm.
Returns new XSquare(x, y, size).
public static final PlotMarkAlgorithm Diamond
The diamond algorithm.
Produces the closed path with 4 vertices:
(x,y-size)(x+size,y)(x,y+size)(x-size,y)
public static PlotMarkAlgorithm BetterCircle
The better circle algorithm for creation of plot marks.
Uses the method BetterCirclePath which is
in turn based on the method QuarterCircleData.
The path produced has 8-fold symmetry about the horizontal,
vertical, and two diagonal axes. Its appearance for small
values of size is much better than that given
by Java's algorithm.
On the other hand, for large values of size,
this algorithm is more computationally intensive than the
JavaCircle technique.
If size > 16384, this algorithm will
revert to the JavaCircle algorithm.
public static final PlotMarkAlgorithm JavaCircle
The Java circle algorithm.
Returns:
new XCircle(x, y, size)
This is equivalent to the pure Java call:
new Ellipse2D.Double(x-size, y-size, 2*size, 2*size)
Warning: For small values of size, the circle
constructed by Java does not have 8-fold symmetry about the
horizontal, vertical, and two diagonal axes. The circle is
therefore not very pleasing aesthetically.
See BetterCircle.
public static final PlotMarkAlgorithm WedgeN
The wedge-facing-north algorithm.
Produces the closed path with 3 vertices:
(x,y)(x+size,y+(2*size))(x-size,y+(2*size))
public static final PlotMarkAlgorithm WedgeE
The wedge-facing-east algorithm.
Produces the closed path with 3 vertices:
(x,y)(x-(2*size),y+size)(x-(2*size),y-size)
public static final PlotMarkAlgorithm WedgeS
The wedge-facing-south algorithm.
Produces the closed path with 3 vertices:
(x,y)(x-size,y-(2*size))(x+size,y-(2*size))
public static final PlotMarkAlgorithm WedgeW
The wedge-facing-west algorithm.
Produces the closed path with 3 vertices:
(x,y)(x+(2*size),y-size)(x+(2*size),y+size)
public static final PlotMarkAlgorithm BluntWedgeN
The blunt-wedge-facing-north algorithm.
Produces the closed path with 3 vertices:
(x,y)(x+size,y+size)(x-size,y+size)
public static final PlotMarkAlgorithm BluntWedgeE
The blunt-wedge-facing-east algorithm.
Produces the closed path with 3 vertices:
(x,y)(x-size,y+size)(x-size,y-size)
public static final PlotMarkAlgorithm BluntWedgeS
The blunt-wedge-facing-south algorithm.
Produces the closed path with 3 vertices:
(x,y)(x-size,y-size)(x+size,y-size)
public static final PlotMarkAlgorithm BluntWedgeW
The blunt-wedge-facing-west algorithm.
Produces the closed path with 3 vertices:
(x,y)(x+size,y-size)(x+size,y+size)
public static final PlotMarkAlgorithm SharpWedgeN
The sharp-wedge-facing-north algorithm.
Produces the closed path with 3 vertices:
(x,y)(x+size,y+(3*size))(x-size,y+(3*size))
public static final PlotMarkAlgorithm SharpWedgeE
The sharp-wedge-facing-east algorithm.
Produces the closed path with 3 vertices:
(x,y)(x-(3*size),y+size)(x-(3*size),y-size)
public static final PlotMarkAlgorithm SharpWedgeS
The sharp-wedge-facing-south algorithm.
Produces the closed path with 3 vertices:
(x,y)(x-size,y-(3*size))(x+size,y-(3*size))
public static final PlotMarkAlgorithm SharpWedgeW
The sharp-wedge-facing-west algorithm.
Produces the closed path with 3 vertices:
(x,y)(x+(3*size),y-size)(x+(3*size),y+size)
public static final PlotMarkAlgorithm ThumbN
The thumb-facing-north algorithm.
Produces the closed path with 5 vertices:
(x,y)(x+size,y+size)(x+size,y+(2*size))(x-size,y+(2*size))(x-size,y+size)
public static final PlotMarkAlgorithm ThumbE
The thumb-facing-east algorithm.
Produces the closed path with 5 vertices:
(x,y)(x-size,y+size)(x-(2*size),y+size)(x-(2*size),y-size)(x-size,y-size)
public static final PlotMarkAlgorithm ThumbS
The thumb-facing-south algorithm.
Produces the closed path with 5 vertices:
(x,y)(x-size,y-size)(x-size,y-(2*size))(x+size,y-(2*size))(x+size,y-size)
public static final PlotMarkAlgorithm ThumbW
The thumb-facing-west algorithm.
Produces the closed path with 5 vertices:
(x,y)(x+size,y-size)(x+(2*size),y-size)(x+(2*size),y+size)(x+size,y+size)
| Constructor Detail |
public PlotMarkAlgorithm()
| Method Detail |
public final Shape makeShape(Point2D p,
int size)
Returns a shape constructed in the neighborhood of the given point and scaled with the given size.
If the given point is null, returns an empty shape.
Otherwise calls makeShape(double, double, int).
p - the point defining where to place the shapesize - the scale size
public abstract Shape makeShape(double x,
double y,
int size)
Returns a shape constructed in the neighborhood of the given point and scaled with the given size.
When defined this method may return an empty shape but should not
return null.
The scale size should be forced to at least 0 before building the shape.
x - the x-coordinate of the point defining where
to place the shapey - the y-coordinate of the point defining where
to place the shapesize - the scale sizepublic static int[][] QuarterCircleData(int radius)
Returns the data for construction of a quarter circle path of the given radius.
Assume that the int[][] returned has the
name data. Then data is
normally of size 2. Let:
int[] xx = data[0];
int[] yy = data[1];
Then, the array xx contains the
x-coordinates of desired data points
and the array yy the corresponding
y-coordinates. In particular, the arrays have
the same length, say, k. The ends
of the arrays are as follows:
xx[0] equals radius.
yy[0] equals 0.
xx[k-1] equals 0.
yy[k-1] equals radius.
More generally, the data is constructed to include
the boundary points (x,y) whose distance
from the origin is less than or equal to
radius+0.5. A horizontal or vertical run
of boundary points is represented by the two endpoints
of the run.
The path associated with the quarter circle data is designed to be symmetrical relative to the main diagonal.
Note that:
radius <= 0 returns
the array { { 0 }, { 0 } }
radius > 16384 returns
null.
The latter constraint is due to a desire to do all internal computations in integer arithmetic.
radius - the radius of the desired quarter circle
public static Shape BetterCirclePath(int x,
int y,
int radius)
Returns a full circle path with the given center
(x,y) and the given radius using the method
QuarterCircleData for the computation.
Since that method provides only a quarter of a
circle, the remaining path points are generated via
symmetry. In particular, 8-fold symmetry about the
horizontal, vertical, and two diagonal axes is
therefore guaranteed.
If radius > 16384, the method
QuarterCircleData cannot be used so
this method returns an XCircle-based
path instead.
x - the circle x-centery - the circle y-centerradius - the circle radius
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||