|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectedu.neu.ccs.gui.PlotMark
Class PlotMark is a class for drawing a geometric
shape or mark at a specified point in a graphics context or for
painting a Paintable at such a point.
In 2.4.0, the class was completely refactored to use the class
PlotMarkAlgorithm so that it is possible for the
user to define a new plot mark.
In 2.4.0, the alternative to use a Paintable as a
mark was also introduced.
When a plot mark is defined via a plot mark algorithm then the paint used for drawing is that determined by the graphics context. When a plot mark is defined by a paintable, then the paintable controls the entire drawing process.
In 2.4.0, it was decided to remove options that would permit a
PlotMark to be modified after construction. In other
words, a PlotMark is immutable. Instead, there are
now constructors available that permit a PlotMark to
be fully or partially cloned.
This class provides several static instances of itself. The constant names are chosen to promote compatibility with earlier versions of the class although the actual objects referenced by these constants are quite different.
In 2.6.0, the mark method was changed to always
stroke the boundary of a plot mark defined by a plot mark algorithm
whether or not the internal fill is set to true. This
was done since a pure fill may draw an asymmetric boundary. As a
consequence of this decision, a mark has the same boundary whether
filled or unfilled. Also, anti-aliasing is turned off when using a
plot mark algorithm because that will destroy the desired symmetry.
Also, in 2.6.0, we cache the Shape that corresponds
to the internal PlotMarkAlgorithm, the size, and the
standard location (0,0). This makes painting a bit faster.
Finally, in 2.6.0, we allow the plot mark size to be as small as 0 to enable the base case for certain plot mark shapes.
| Field Summary | |
private PlotMarkAlgorithm |
algorithm
The plot mark algorithm. |
static PlotMark |
ASTERISK
The asterisk plot mark. |
static PlotMark |
BLUNT_WEDGE_E
The blunt-wedge-facing-east plot mark. |
static PlotMark |
BLUNT_WEDGE_N
The blunt-wedge-facing-north plot mark. |
static PlotMark |
BLUNT_WEDGE_S
The blunt-wedge-facing-south plot mark. |
static PlotMark |
BLUNT_WEDGE_W
The blunt-wedge-facing-west plot mark. |
static PlotMark |
CIRCLE
The circle plot mark. |
static PlotMark |
CROSS
The cross plot mark. |
private static PlotMarkAlgorithm |
DEFAULT_ALGORITHM
Default plot mark algorithm: PlotMarkAlgorithm.Square. |
private static boolean |
DEFAULT_FILL
Default plot mark fill: true. |
private static int |
DEFAULT_SIZE
Default plot mark size: 3. |
static PlotMark |
DIAMOND
The diamond plot mark. |
private boolean |
fill
The plot mark fill. |
static PlotMark |
FILLED_BLUNT_WEDGE_E
The filled blunt-wedge-facing-east plot mark. |
static PlotMark |
FILLED_BLUNT_WEDGE_N
The filled blunt-wedge-facing-north plot mark. |
static PlotMark |
FILLED_BLUNT_WEDGE_S
The filled blunt-wedge-facing-south plot mark. |
static PlotMark |
FILLED_BLUNT_WEDGE_W
The filled blunt-wedge-facing-west plot mark. |
static PlotMark |
FILLED_CIRCLE
The filled circle plot mark. |
static PlotMark |
FILLED_DIAMOND
The filled diamond plot mark. |
static PlotMark |
FILLED_SHARP_WEDGE_E
The filled sharp-wedge-facing-east plot mark. |
static PlotMark |
FILLED_SHARP_WEDGE_N
The filled sharp-wedge-facing-north plot mark. |
static PlotMark |
FILLED_SHARP_WEDGE_S
The filled sharp-wedge-facing-south plot mark. |
static PlotMark |
FILLED_SHARP_WEDGE_W
The filled sharp-wedge-facing-west plot mark. |
static PlotMark |
FILLED_SQUARE
The filled square plot mark. |
static PlotMark |
FILLED_THUMB_E
The filled thumb-facing-east plot mark. |
static PlotMark |
FILLED_THUMB_N
The filled thumb-facing-north plot mark. |
static PlotMark |
FILLED_THUMB_S
The filled thumb-facing-south plot mark. |
static PlotMark |
FILLED_THUMB_W
The filled thumb-facing-west plot mark. |
static PlotMark |
FILLED_WEDGE_E
The filled wedge-facing-east plot mark. |
static PlotMark |
FILLED_WEDGE_N
The filled wedge-facing-north plot mark. |
static PlotMark |
FILLED_WEDGE_S
The filled wedge-facing-south plot mark. |
static PlotMark |
FILLED_WEDGE_W
The filled wedge-facing-west plot mark. |
static PlotMark |
H_BAR
The horizontal bar plot mark. |
private Paintable |
paintable
The paintable if used instead of an algorithm. |
static PlotMark |
PLUS
The plus plot mark. |
private Shape |
shape
The plot mark shape. |
static PlotMark |
SHARP_WEDGE_E
The sharp-wedge-facing-east plot mark. |
static PlotMark |
SHARP_WEDGE_N
The sharp-wedge-facing-north plot mark. |
static PlotMark |
SHARP_WEDGE_S
The sharp-wedge-facing-south plot mark. |
static PlotMark |
SHARP_WEDGE_W
The sharp-wedge-facing-west plot mark. |
private int |
size
The plot mark size. |
static PlotMark |
SQUARE
The square plot mark. |
private static Stroke |
standardStroke
The standard stroke: BasicStroke(1). |
static PlotMark |
THUMB_E
The thumb-facing-east plot mark. |
static PlotMark |
THUMB_N
The thumb-facing-north plot mark. |
static PlotMark |
THUMB_S
The thumb-facing-south plot mark. |
static PlotMark |
THUMB_W
The thumb-facing-west plot mark. |
static PlotMark |
V_BAR
The vertical bar plot mark. |
static PlotMark |
WEDGE_E
The wedge-facing-east plot mark. |
static PlotMark |
WEDGE_N
The wedge-facing-north plot mark. |
static PlotMark |
WEDGE_S
The wedge-facing-south plot mark. |
static PlotMark |
WEDGE_W
The wedge-facing-west plot mark. |
| Constructor Summary | |
PlotMark()
Constructs a plot mark using the defaults. |
|
PlotMark(Paintable paintable)
Constructs a plot mark using the given paintable. |
|
PlotMark(PlotMark plotmark)
Constructs a plot mark by cloning the given plot mark. |
|
PlotMark(PlotMarkAlgorithm algorithm)
Constructs a plot mark using the given algorithm and the defaults listed below. |
|
PlotMark(PlotMarkAlgorithm algorithm,
boolean fill)
Constructs a plot mark using the given algorithm, the given fill setting, and the default listed below. |
|
PlotMark(PlotMarkAlgorithm algorithm,
int size)
Constructs a plot mark using the given algorithm, the given size, and the default listed below. |
|
PlotMark(PlotMarkAlgorithm algorithm,
int size,
boolean fill)
Constructs a plot mark using the given algorithm, the given size, and the given fill setting. |
|
PlotMark(PlotMark plotmark,
boolean fill)
Constructs a plot mark using the given plot mark but changing the specified setting. |
|
PlotMark(PlotMark plotmark,
int size)
Constructs a plot mark using the given plot mark but changing the specified setting. |
|
PlotMark(PlotMark plotmark,
int size,
boolean fill)
Constructs a plot mark using the given plot mark but changing the specified settings. |
|
| Method Summary | |
PlotMarkAlgorithm |
getAlgorithm()
Returns the internal PlotMarkAlgorithm
or null if an algorithm is not used. |
boolean |
getFill()
Returns the fill setting. |
Paintable |
getPaintable()
Returns the internal Paintable
or null if a paintable is not used. |
int |
getSize()
Returns the size setting. |
private void |
initializePlotMark(PlotMarkAlgorithm algorithm,
int size,
boolean fill,
Paintable paintable)
The common initialization code for a plot mark. |
void |
mark(Graphics g,
AffineTransform T,
double x,
double y)
Draws, fills, or paints a mark at the plot point which is obtained by applying the transform to the given point. |
void |
mark(Graphics g,
AffineTransform T,
Point2D p)
Draws, fills, or paints a mark at the plot point which is obtained by applying the transform to the given point. |
void |
mark(Graphics g,
double x,
double y)
Draws, fills, or paints a mark at the given plot point. |
void |
mark(Graphics g,
Point2D p)
Draws, fills, or paints a mark at the given plot point. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final PlotMark H_BAR
public static final PlotMark V_BAR
public static final PlotMark PLUS
public static final PlotMark CROSS
public static final PlotMark ASTERISK
public static final PlotMark SQUARE
public static final PlotMark DIAMOND
public static final PlotMark CIRCLE
The circle plot mark.
See comments in PlotMarkAlgorithm.BetterCircle.
public static final PlotMark WEDGE_N
public static final PlotMark WEDGE_E
public static final PlotMark WEDGE_S
public static final PlotMark WEDGE_W
public static final PlotMark BLUNT_WEDGE_N
public static final PlotMark BLUNT_WEDGE_E
public static final PlotMark BLUNT_WEDGE_S
public static final PlotMark BLUNT_WEDGE_W
public static final PlotMark SHARP_WEDGE_N
public static final PlotMark SHARP_WEDGE_E
public static final PlotMark SHARP_WEDGE_S
public static final PlotMark SHARP_WEDGE_W
public static final PlotMark THUMB_N
public static final PlotMark THUMB_E
public static final PlotMark THUMB_S
public static final PlotMark THUMB_W
public static final PlotMark FILLED_SQUARE
public static final PlotMark FILLED_DIAMOND
public static final PlotMark FILLED_CIRCLE
The filled circle plot mark.
See comments in PlotMarkAlgorithm.BetterCircle.
public static final PlotMark FILLED_WEDGE_N
public static final PlotMark FILLED_WEDGE_E
public static final PlotMark FILLED_WEDGE_S
public static final PlotMark FILLED_WEDGE_W
public static final PlotMark FILLED_BLUNT_WEDGE_N
public static final PlotMark FILLED_BLUNT_WEDGE_E
public static final PlotMark FILLED_BLUNT_WEDGE_S
public static final PlotMark FILLED_BLUNT_WEDGE_W
public static final PlotMark FILLED_SHARP_WEDGE_N
public static final PlotMark FILLED_SHARP_WEDGE_E
public static final PlotMark FILLED_SHARP_WEDGE_S
public static final PlotMark FILLED_SHARP_WEDGE_W
public static final PlotMark FILLED_THUMB_N
public static final PlotMark FILLED_THUMB_E
public static final PlotMark FILLED_THUMB_S
public static final PlotMark FILLED_THUMB_W
private static final PlotMarkAlgorithm DEFAULT_ALGORITHM
PlotMarkAlgorithm.Square.
private static final int DEFAULT_SIZE
3.
private static final boolean DEFAULT_FILL
true.
private static final Stroke standardStroke
BasicStroke(1).
private PlotMarkAlgorithm algorithm
private int size
private boolean fill
private Shape shape
private Paintable paintable
| Constructor Detail |
public PlotMark()
Constructs a plot mark using the defaults.
Algorithm: PlotMarkAlgorithm.Square
Size: 3
Fill: true
The default plot mark is a copy of the static constant
plot mark FILLED_SQUARE.
public PlotMark(PlotMarkAlgorithm algorithm)
Constructs a plot mark using the given algorithm and the defaults listed below.
Size: 3
Fill: true
If the algorithm is null, it is set to
PlotMarkAlgorithm.Square.
algorithm - the plot mark algorithm
public PlotMark(PlotMarkAlgorithm algorithm,
int size)
Constructs a plot mark using the given algorithm, the given size, and the default listed below.
Fill: true
If the algorithm is null, it is set to
PlotMarkAlgorithm.Square.
If the size is less than 0, it is set to 0.
algorithm - the plot mark algorithmsize - the plot mark size setting
public PlotMark(PlotMarkAlgorithm algorithm,
boolean fill)
Constructs a plot mark using the given algorithm, the given fill setting, and the default listed below.
Size: 3
If the algorithm is null, it is set to
PlotMarkAlgorithm.Square.
algorithm - the plot mark algorithmfill - the plot mark fill setting
public PlotMark(PlotMarkAlgorithm algorithm,
int size,
boolean fill)
Constructs a plot mark using the given algorithm, the given size, and the given fill setting.
If the algorithm is null, it is set to
PlotMarkAlgorithm.Square.
If the size is less than 0, it is set to 0.
algorithm - the plot mark algorithmsize - the plot mark size settingfill - the plot mark fill settingpublic PlotMark(PlotMark plotmark)
Constructs a plot mark by cloning the given plot mark.
If the plot mark is null, it is set to
PlotMark.FILLED_SQUARE.
If the plot mark is set by a paintable then the new plot mark is set by the same paintable.
plotmark - the plot mark to clone
public PlotMark(PlotMark plotmark,
int size)
Constructs a plot mark using the given plot mark but changing the specified setting.
If the plot mark is null, it is set to
PlotMark.FILLED_SQUARE.
If the plot mark is set by a paintable then the new plot mark is set by the same paintable.
If the size is less than 0, it is set to 0.
plotmark - the plot mark to partially clonesize - the plot mark size setting
public PlotMark(PlotMark plotmark,
boolean fill)
Constructs a plot mark using the given plot mark but changing the specified setting.
If the plot mark is null, it is set to
PlotMark.FILLED_SQUARE.
If the plot mark is set by a paintable then the new plot mark is set by the same paintable.
plotmark - the plot mark to partially clonefill - the plot mark fill setting
public PlotMark(PlotMark plotmark,
int size,
boolean fill)
Constructs a plot mark using the given plot mark but changing the specified settings.
If the plot mark is null, it is set to
PlotMark.FILLED_SQUARE.
If the plot mark is set by a paintable then the new plot mark is set by the same paintable.
If the size is less than 0, it is set to 0.
plotmark - the plot mark to partially clonesize - the plot mark size settingfill - the plot mark fill settingpublic PlotMark(Paintable paintable)
Constructs a plot mark using the given paintable.
Uses the default plot mark algorithm and settings
if the given paintable is null.
paintable - the paintable to use for the plot mark| Method Detail |
private void initializePlotMark(PlotMarkAlgorithm algorithm,
int size,
boolean fill,
Paintable paintable)
The common initialization code for a plot mark.
algorithm - the plot mark algorithm if usedsize - the plot mark size settingfill - the plot mark fill settingpaintable - the plot mark paintable if used
public final void mark(Graphics g,
Point2D p)
Draws, fills, or paints a mark at the given plot point.
If this plot mark is defined by a plot mark algorithm, then proceed as follows:
Shape.true.BasicStroke(1) as the stroke setting.Paint as-is.Otherwise, if the plot mark is defined by a paintable, then make the call:
paintable.paintAt(g, the-plot-point)Does nothing if the given plot point is null.
g - the graphics contextp - the plot point
public final void mark(Graphics g,
double x,
double y)
Draws, fills, or paints a mark at the given plot point.
If this plot mark is defined by a plot mark algorithm, then proceed as follows:
Shape.true.BasicStroke(1) as the stroke setting.Paint as-is.Otherwise, if the plot mark is defined by a paintable, then make the call:
paintable.paintAt(g, the-plot-point)
g - the graphics contextx - the x-coordinate of the plot pointy - the y-coordinate of the plot point
public final void mark(Graphics g,
AffineTransform T,
Point2D p)
Draws, fills, or paints a mark at the plot point which is obtained by applying the transform to the given point.
In all cases, find the plot point by applying the transform to the given point.
If this plot mark is defined by a plot mark algorithm, then proceed as follows:
Shape.true.BasicStroke(1) as the stroke setting.Paint as-is.Otherwise, if the plot mark is defined by a paintable, then make the call:
paintable.paintAt(g, the-plot-point)Does nothing if the original point is null.
g - the graphics contextT - the affine transform to apply to the original pointp - the original point
public final void mark(Graphics g,
AffineTransform T,
double x,
double y)
Draws, fills, or paints a mark at the plot point which is obtained by applying the transform to the given point.
In all cases, find the plot point by applying the transform to the given point.
If this plot mark is defined by a plot mark algorithm, then proceed as follows:
Shape.true.BasicStroke(1) as the stroke setting.Paint as-is.Otherwise, if the plot mark is defined by a paintable, then make the call:
paintable.paintAt(g, the-plot-point)
g - the graphics contextT - the affine transform to apply to the original pointx - the x-coordinate of the original pointy - the y-coordinate of the original pointpublic final PlotMarkAlgorithm getAlgorithm()
PlotMarkAlgorithm
or null if an algorithm is not used.
public final int getSize()
public final boolean getFill()
public final Paintable getPaintable()
Paintable
or null if a paintable is not used.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||