edu.neu.ccs.gui
Class PlotMark

java.lang.Object
  |
  +--edu.neu.ccs.gui.PlotMark

public class PlotMark
extends Object

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.

Since:
1.0

Field Summary
protected  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.
static PlotMark DIAMOND
          The diamond plot mark.
protected  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_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.
protected  Paintable paintable
          The paintable if used instead of an algorithm.
static PlotMark PLUS
          The plus plot mark.
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.
protected  int size
          The plot mark size.
static PlotMark SQUARE
          The square 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.
 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

H_BAR

public static final PlotMark H_BAR
The horizontal bar plot mark.


V_BAR

public static final PlotMark V_BAR
The vertical bar plot mark.


PLUS

public static final PlotMark PLUS
The plus plot mark.


CROSS

public static final PlotMark CROSS
The cross plot mark.


ASTERISK

public static final PlotMark ASTERISK
The asterisk plot mark.


SQUARE

public static final PlotMark SQUARE
The square plot mark.


CIRCLE

public static final PlotMark CIRCLE
The circle plot mark.


DIAMOND

public static final PlotMark DIAMOND
The diamond plot mark.


WEDGE_N

public static final PlotMark WEDGE_N
The wedge-facing-north plot mark.


WEDGE_E

public static final PlotMark WEDGE_E
The wedge-facing-east plot mark.


WEDGE_S

public static final PlotMark WEDGE_S
The wedge-facing-south plot mark.


WEDGE_W

public static final PlotMark WEDGE_W
The wedge-facing-west plot mark.


BLUNT_WEDGE_N

public static final PlotMark BLUNT_WEDGE_N
The blunt-wedge-facing-north plot mark.


BLUNT_WEDGE_E

public static final PlotMark BLUNT_WEDGE_E
The blunt-wedge-facing-east plot mark.


BLUNT_WEDGE_S

public static final PlotMark BLUNT_WEDGE_S
The blunt-wedge-facing-south plot mark.


BLUNT_WEDGE_W

public static final PlotMark BLUNT_WEDGE_W
The blunt-wedge-facing-west plot mark.


SHARP_WEDGE_N

public static final PlotMark SHARP_WEDGE_N
The sharp-wedge-facing-north plot mark.


SHARP_WEDGE_E

public static final PlotMark SHARP_WEDGE_E
The sharp-wedge-facing-east plot mark.


SHARP_WEDGE_S

public static final PlotMark SHARP_WEDGE_S
The sharp-wedge-facing-south plot mark.


SHARP_WEDGE_W

public static final PlotMark SHARP_WEDGE_W
The sharp-wedge-facing-west plot mark.


FILLED_SQUARE

public static final PlotMark FILLED_SQUARE
The filled square plot mark.


FILLED_CIRCLE

public static final PlotMark FILLED_CIRCLE
The filled circle plot mark.


FILLED_DIAMOND

public static final PlotMark FILLED_DIAMOND
The filled diamond plot mark.


FILLED_WEDGE_N

public static final PlotMark FILLED_WEDGE_N
The filled wedge-facing-north plot mark.


FILLED_WEDGE_E

public static final PlotMark FILLED_WEDGE_E
The filled wedge-facing-east plot mark.


FILLED_WEDGE_S

public static final PlotMark FILLED_WEDGE_S
The filled wedge-facing-south plot mark.


FILLED_WEDGE_W

public static final PlotMark FILLED_WEDGE_W
The filled wedge-facing-west plot mark.


FILLED_BLUNT_WEDGE_N

public static final PlotMark FILLED_BLUNT_WEDGE_N
The filled blunt-wedge-facing-north plot mark.


FILLED_BLUNT_WEDGE_E

public static final PlotMark FILLED_BLUNT_WEDGE_E
The filled blunt-wedge-facing-east plot mark.


FILLED_BLUNT_WEDGE_S

public static final PlotMark FILLED_BLUNT_WEDGE_S
The filled blunt-wedge-facing-south plot mark.


FILLED_BLUNT_WEDGE_W

public static final PlotMark FILLED_BLUNT_WEDGE_W
The filled blunt-wedge-facing-west plot mark.


FILLED_SHARP_WEDGE_N

public static final PlotMark FILLED_SHARP_WEDGE_N
The filled sharp-wedge-facing-north plot mark.


FILLED_SHARP_WEDGE_E

public static final PlotMark FILLED_SHARP_WEDGE_E
The filled sharp-wedge-facing-east plot mark.


FILLED_SHARP_WEDGE_S

public static final PlotMark FILLED_SHARP_WEDGE_S
The filled sharp-wedge-facing-south plot mark.


FILLED_SHARP_WEDGE_W

public static final PlotMark FILLED_SHARP_WEDGE_W
The filled sharp-wedge-facing-west plot mark.


algorithm

protected PlotMarkAlgorithm algorithm
The plot mark algorithm.


size

protected int size
The plot mark size.


fill

protected boolean fill
The plot mark fill.


paintable

protected Paintable paintable
The paintable if used instead of an algorithm.

Constructor Detail

PlotMark

public PlotMark()

Constructs a plot mark using the defaults.

The default plot mark is a copy of the static constant plot mark FILLED_SQUARE.


PlotMark

public PlotMark(PlotMarkAlgorithm algorithm)

Constructs a plot mark using the given algorithm and the defaults listed below.

If the algorithm is null, it is set to PlotMarkAlgorithm.Square.

Parameters:
algorithm - the plot mark algorithm

PlotMark

public PlotMark(PlotMarkAlgorithm algorithm,
                int size)

Constructs a plot mark using the given algorithm, the given size, and the default listed below.

If the algorithm is null, it is set to PlotMarkAlgorithm.Square.

If the size is less than 1, it is set to 1.

Parameters:
algorithm - the plot mark algorithm
size - the plot mark size setting

PlotMark

public PlotMark(PlotMarkAlgorithm algorithm,
                boolean fill)

Constructs a plot mark using the given algorithm, the given fill setting, and the default listed below.

If the algorithm is null, it is set to PlotMarkAlgorithm.Square.

Parameters:
algorithm - the plot mark algorithm
fill - the plot mark fill setting

PlotMark

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 1, it is set to 1.

Parameters:
algorithm - the plot mark algorithm
size - the plot mark size setting
fill - the plot mark fill setting

PlotMark

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

Parameters:
plotmark - the plot mark to clone

PlotMark

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 1, it is set to 1.

Parameters:
plotmark - the plot mark to partially clone
size - the plot mark size setting

PlotMark

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.

Parameters:
plotmark - the plot mark to partially clone
fill - the plot mark fill setting

PlotMark

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 1, it is set to 1.

Parameters:
plotmark - the plot mark to partially clone
size - the plot mark size setting
fill - the plot mark fill setting

PlotMark

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

Parameters:
paintable - the paintable to use for the plot mark
Method Detail

mark

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.

Otherwise, if the plot mark is defined by a paintable, then perform the following action.

Does nothing if the given plot point is null.

Parameters:
g - the graphics context
p - the plot point

mark

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.

Otherwise, if the plot mark is defined by a paintable, then perform the following action.

Parameters:
g - the graphics context
x - the x-coordinate of the plot point
y - the y-coordinate of the plot point

mark

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.

Then, if this plot mark is defined by a plot mark algorithm, proceed as follows.

Otherwise, if the plot mark is defined by a paintable, then perform the following action.

Does nothing if the original point is null.

Parameters:
g - the graphics context
T - the affine transform to apply to the original point
p - the original point

mark

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.

Then, if this plot mark is defined by a plot mark algorithm, proceed as follows.

Otherwise, if the plot mark is defined by a paintable, then perform the following action.

Parameters:
g - the graphics context
T - the affine transform to apply to the original point
x - the x-coordinate of the original point
y - the y-coordinate of the original point

getAlgorithm

public final PlotMarkAlgorithm getAlgorithm()
Returns the internal PlotMarkAlgorithm or null if an algorithm is not used.


getSize

public final int getSize()
Returns the size setting. This will not be used if the plot mark is defined by a paintable.


getFill

public final boolean getFill()
Returns the fill setting. This will not be used if the plot mark is defined by a paintable.


getPaintable

public final Paintable getPaintable()
Returns the internal Paintable or null if a paintable is not used.