

PREV CLASS NEXT CLASS  FRAMES NO FRAMES  
SUMMARY: NESTED  FIELD  CONSTR  METHOD  DETAIL: FIELD  CONSTR  METHOD 
java.lang.Object edu.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 bluntwedgefacingeast algorithm. 
static PlotMarkAlgorithm 
BluntWedgeN
The bluntwedgefacingnorth algorithm. 
static PlotMarkAlgorithm 
BluntWedgeS
The bluntwedgefacingsouth algorithm. 
static PlotMarkAlgorithm 
BluntWedgeW
The bluntwedgefacingwest 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 sharpwedgefacingeast algorithm. 
static PlotMarkAlgorithm 
SharpWedgeN
The sharpwedgefacingnorth algorithm. 
static PlotMarkAlgorithm 
SharpWedgeS
The sharpwedgefacingsouth algorithm. 
static PlotMarkAlgorithm 
SharpWedgeW
The sharpwedgefacingwest algorithm. 
static PlotMarkAlgorithm 
Square
The square algorithm. 
static PlotMarkAlgorithm 
ThumbE
The thumbfacingeast algorithm. 
static PlotMarkAlgorithm 
ThumbN
The thumbfacingnorth algorithm. 
static PlotMarkAlgorithm 
ThumbS
The thumbfacingsouth algorithm. 
static PlotMarkAlgorithm 
ThumbW
The thumbfacingwest algorithm. 
static PlotMarkAlgorithm 
VBar
The vertical bar algorithm. 
static PlotMarkAlgorithm 
WedgeE
The wedgefacingeast algorithm. 
static PlotMarkAlgorithm 
WedgeN
The wedgefacingnorth algorithm. 
static PlotMarkAlgorithm 
WedgeS
The wedgefacingsouth algorithm. 
static PlotMarkAlgorithm 
WedgeW
The wedgefacingwest 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
(xsize,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,ysize)
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:
(xsize,y)
to (x+size,y)
(x,ysize)
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:
(xsize,ysize)
to (x+size,y+size)
(x+size,ysize)
to (xsize,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:
(xsize,y)
to (x+size,y)
(x,ysize)
to (x,y+size)
(xsize,ysize)
to (x+size,y+size)
(x+size,ysize)
to (xsize,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,ysize)
(x+size,y)
(x,y+size)
(xsize,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 8fold 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(xsize, ysize, 2*size, 2*size)
Warning: For small values of size
, the circle
constructed by Java does not have 8fold 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 wedgefacingnorth algorithm.
Produces the closed path with 3 vertices:
(x,y)
(x+size,y+(2*size))
(xsize,y+(2*size))
public static final PlotMarkAlgorithm WedgeE
The wedgefacingeast algorithm.
Produces the closed path with 3 vertices:
(x,y)
(x(2*size),y+size)
(x(2*size),ysize)
public static final PlotMarkAlgorithm WedgeS
The wedgefacingsouth algorithm.
Produces the closed path with 3 vertices:
(x,y)
(xsize,y(2*size))
(x+size,y(2*size))
public static final PlotMarkAlgorithm WedgeW
The wedgefacingwest algorithm.
Produces the closed path with 3 vertices:
(x,y)
(x+(2*size),ysize)
(x+(2*size),y+size)
public static final PlotMarkAlgorithm BluntWedgeN
The bluntwedgefacingnorth algorithm.
Produces the closed path with 3 vertices:
(x,y)
(x+size,y+size)
(xsize,y+size)
public static final PlotMarkAlgorithm BluntWedgeE
The bluntwedgefacingeast algorithm.
Produces the closed path with 3 vertices:
(x,y)
(xsize,y+size)
(xsize,ysize)
public static final PlotMarkAlgorithm BluntWedgeS
The bluntwedgefacingsouth algorithm.
Produces the closed path with 3 vertices:
(x,y)
(xsize,ysize)
(x+size,ysize)
public static final PlotMarkAlgorithm BluntWedgeW
The bluntwedgefacingwest algorithm.
Produces the closed path with 3 vertices:
(x,y)
(x+size,ysize)
(x+size,y+size)
public static final PlotMarkAlgorithm SharpWedgeN
The sharpwedgefacingnorth algorithm.
Produces the closed path with 3 vertices:
(x,y)
(x+size,y+(3*size))
(xsize,y+(3*size))
public static final PlotMarkAlgorithm SharpWedgeE
The sharpwedgefacingeast algorithm.
Produces the closed path with 3 vertices:
(x,y)
(x(3*size),y+size)
(x(3*size),ysize)
public static final PlotMarkAlgorithm SharpWedgeS
The sharpwedgefacingsouth algorithm.
Produces the closed path with 3 vertices:
(x,y)
(xsize,y(3*size))
(x+size,y(3*size))
public static final PlotMarkAlgorithm SharpWedgeW
The sharpwedgefacingwest algorithm.
Produces the closed path with 3 vertices:
(x,y)
(x+(3*size),ysize)
(x+(3*size),y+size)
public static final PlotMarkAlgorithm ThumbN
The thumbfacingnorth algorithm.
Produces the closed path with 5 vertices:
(x,y)
(x+size,y+size)
(x+size,y+(2*size))
(xsize,y+(2*size))
(xsize,y+size)
public static final PlotMarkAlgorithm ThumbE
The thumbfacingeast algorithm.
Produces the closed path with 5 vertices:
(x,y)
(xsize,y+size)
(x(2*size),y+size)
(x(2*size),ysize)
(xsize,ysize)
public static final PlotMarkAlgorithm ThumbS
The thumbfacingsouth algorithm.
Produces the closed path with 5 vertices:
(x,y)
(xsize,ysize)
(xsize,y(2*size))
(x+size,y(2*size))
(x+size,ysize)
public static final PlotMarkAlgorithm ThumbW
The thumbfacingwest algorithm.
Produces the closed path with 5 vertices:
(x,y)
(x+size,ysize)
(x+(2*size),ysize)
(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 sizepublic 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 xcoordinate of the point defining where
to place the shapey
 the ycoordinate 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
xcoordinates of desired data points
and the array yy
the corresponding
ycoordinates. 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[k1]
equals 0
.
yy[k1]
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 circlepublic 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, 8fold 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 xcentery
 the circle ycenterradius
 the circle radius


PREV CLASS NEXT CLASS  FRAMES NO FRAMES  
SUMMARY: NESTED  FIELD  CONSTR  METHOD  DETAIL: FIELD  CONSTR  METHOD 