uk.ac.starlink.ast.grf
Class DefaultGrfMarker

java.lang.Object
  extended by uk.ac.starlink.ast.grf.DefaultGrfMarker

public class DefaultGrfMarker
extends Object

Java class to draw a marker into a Graphics2D object. The range of markers provided are defined as constants of this class. The default is a circle. Markers are defined using a position and a typical size, rather than precise geometries.

Version:
$Id$
Author:
Peter W. Draper

Field Summary
static int CIRCLE
          Use a circle marker.
static int CROSS
          Use a cross marker.
static int DIAMOND
          Use a diamond marker.
static int DOT
          Use a dot marker.
static int DOWNTRIANGLE
          Use a pointing down triangle marker.
static int FILLEDCIRCLE
          Use a filled circle marker.
static int FILLEDDIAMOND
          Use a filled diamond marker.
static int FILLEDDOWNTRIANGLE
          Use a filled pointing down triangle marker.
static int FILLEDSQUARE
          Use a filled square marker.
static int FILLEDUPTRIANGLE
          Use a filled pointing up triangle marker.
static int PLUS
          Use a plus marker.
static int SQUARE
          Use a square marker.
static int STAR
          Use a star marker.
static int UPTRIANGLE
          Use a pointing up triangle marker.
 
Constructor Summary
DefaultGrfMarker()
           
 
Method Summary
static void draw(Graphics2D g2, int type, double x, double y, double size)
          Draw a marker at a given position.
protected static void drawCircle(Graphics2D g2, double x, double y, double size, boolean filled)
          Draw a circle.
protected static void drawCross(Graphics2D g2, double x, double y, double size)
          Draw a cross.
protected static void drawDiamond(Graphics2D g2, double x, double y, double size, boolean filled)
          Draw a diamond.
protected static void drawDot(Graphics2D g2, double x, double y, double size)
          Draw a dot, should be a point really, but is a filled square of size 1.
protected static void drawPlus(Graphics2D g2, double x, double y, double size)
          Draw a plus.
protected static void drawSquare(Graphics2D g2, double x, double y, double size, boolean filled)
          Draw a square.
protected static void drawStar(Graphics2D g2, double x, double y, double size)
          Draw a star (cross+plus).
protected static void drawTriangle(Graphics2D g2, double x, double y, double size, boolean up, boolean filled)
          Draw an equilateral triangle
static String getDescription(int type)
          Get a user presentable description of a marker.
static int getNumMarkers()
          Return the number of markers.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DOT

public static final int DOT
Use a dot marker.

See Also:
Constant Field Values

CROSS

public static final int CROSS
Use a cross marker.

See Also:
Constant Field Values

PLUS

public static final int PLUS
Use a plus marker.

See Also:
Constant Field Values

SQUARE

public static final int SQUARE
Use a square marker.

See Also:
Constant Field Values

STAR

public static final int STAR
Use a star marker.

See Also:
Constant Field Values

CIRCLE

public static final int CIRCLE
Use a circle marker.

See Also:
Constant Field Values

DIAMOND

public static final int DIAMOND
Use a diamond marker.

See Also:
Constant Field Values

UPTRIANGLE

public static final int UPTRIANGLE
Use a pointing up triangle marker.

See Also:
Constant Field Values

DOWNTRIANGLE

public static final int DOWNTRIANGLE
Use a pointing down triangle marker.

See Also:
Constant Field Values

FILLEDSQUARE

public static final int FILLEDSQUARE
Use a filled square marker.

See Also:
Constant Field Values

FILLEDCIRCLE

public static final int FILLEDCIRCLE
Use a filled circle marker.

See Also:
Constant Field Values

FILLEDDIAMOND

public static final int FILLEDDIAMOND
Use a filled diamond marker.

See Also:
Constant Field Values

FILLEDUPTRIANGLE

public static final int FILLEDUPTRIANGLE
Use a filled pointing up triangle marker.

See Also:
Constant Field Values

FILLEDDOWNTRIANGLE

public static final int FILLEDDOWNTRIANGLE
Use a filled pointing down triangle marker.

See Also:
Constant Field Values
Constructor Detail

DefaultGrfMarker

public DefaultGrfMarker()
Method Detail

draw

public static void draw(Graphics2D g2,
                        int type,
                        double x,
                        double y,
                        double size)
Draw a marker at a given position.

Parameters:
g2 - the Graphics2D to draw onto
type - the type of marker to draw. Must be one of the defined constants, CIRCLE, SQUARE etc.
x - the X centre of the marker (graphics coordinates)
y - the Y centre of the marker (graphics coordinates)
size - the size of the marker (graphics coordinates)

getDescription

public static String getDescription(int type)
Get a user presentable description of a marker.

Parameters:
type - the type of marker (POINT etc.).
Returns:
the marker description.

getNumMarkers

public static int getNumMarkers()
Return the number of markers.


drawDot

protected static void drawDot(Graphics2D g2,
                              double x,
                              double y,
                              double size)
Draw a dot, should be a point really, but is a filled square of size 1.


drawCross

protected static void drawCross(Graphics2D g2,
                                double x,
                                double y,
                                double size)
Draw a cross.


drawPlus

protected static void drawPlus(Graphics2D g2,
                               double x,
                               double y,
                               double size)
Draw a plus.


drawSquare

protected static void drawSquare(Graphics2D g2,
                                 double x,
                                 double y,
                                 double size,
                                 boolean filled)
Draw a square.


drawStar

protected static void drawStar(Graphics2D g2,
                               double x,
                               double y,
                               double size)
Draw a star (cross+plus).


drawCircle

protected static void drawCircle(Graphics2D g2,
                                 double x,
                                 double y,
                                 double size,
                                 boolean filled)
Draw a circle.


drawDiamond

protected static void drawDiamond(Graphics2D g2,
                                  double x,
                                  double y,
                                  double size,
                                  boolean filled)
Draw a diamond.


drawTriangle

protected static void drawTriangle(Graphics2D g2,
                                   double x,
                                   double y,
                                   double size,
                                   boolean up,
                                   boolean filled)
Draw an equilateral triangle



Copyright © 2017 Central Laboratory of the Research Councils. All Rights Reserved.