com.tensegrity.graphics
Class MarkerFormat

java.lang.Object
  extended bycom.tensegrity.graphics.MarkerFormat
All Implemented Interfaces:
Format

public class MarkerFormat
extends java.lang.Object
implements Format

A MarkerFormat is a somewhat special format: It defines the appearance of line endpoints. This format consists of the following attributes:

The type attribute defines the overall appearance of a marker. More than 20 different marker types are defined in class MarkerFormat. The appearance of these types is shown in the following image:

The different types provided are as follows:

ARROW_SMALLFILLED

ARROW_MEDIUMFILLED

ARROW_LARGEFILLED

ARROW_SMALLFILLED_LONG

ARROW_MEDIUMFILLED_LONG

ARROW_LARGEFILLED_LONG

ARROW_SMALLFILLED_HALF

ARROW_MEDIUMFILLED_HALF

ARROW_LARGEFILLED_HALF

ARROW_SMALLFILLED_HALFLONG

ARROW_MEDIUMFILLED_HALFLONG

ARROW_LARGEFILLED_HALFLONG

ARROW_SMALLNOTFILLED

ARROW_MEDIUMNOTFILLED

ARROW_LARGENOTFILLED

ARROW_SMALLNOTFILLED_LONG

ARROW_MEDIUMNOTFILLED_LONG

ARROW_LARGENOTFILLED_LONG

SQUARE

DIAMOND

INVISIBLE

VERTLINE

The size attribute defines the size of the marker. It can be freely chosen and is given in coordinate system units.

The stroke attribute is represented by a StrokeFormat and defines the stroke the marker is surrounded by.

The paint attribute is represented by a PaintFormat and defines the filling of the marker.

Since the MarkerFormat is an object that is frequently used within the graphics api and all apis that use the graphics api MarkerFormats are subject of pooling. The pooling of the MarkerFormat instances is being done by the FormatPool. To get more informations about this class take a look at the documentation about the FormatPool.

In order to pool a MarkerFormat it has to be immutable because maybe many objects have a reference on the same MarkerFormat and modifying the MarkerFormat will affect all these objects.

For the pooling also an unique expression is needed so that a MarkerFormat can be surely identified. The unique expression is called the canonical description. This canonical description is made up of the attributes a MarkerFormat consists of and it can be gained by Format.getCanonicalDescription().

A MarkerFormat can only be created by using the FormatPool.parseMarkerFormat(String) method to ensure a correct pooling behaviour. You can obtain the canonical description by calling the on of the static methods called getCanonicalDescription().

A MarkerFormat is usually applied to a Primitive (e.g. Line2D, Polyline2D) by calling methods like Line2D.setMarkerBegin(MarkerFormat) or Line2D.setMarkerEnd(MarkerFormat).

The MarkerFormat contains other formats like PaintFormat and StrokeFormat.

Version:
$Id: MarkerFormat.java,v 1.19 2005/06/17 12:29:39 AndreasEbbert Exp $
Author:
MichaelKegel

Field Summary
static int ARROW_LARGEFILLED
          Constant that tells about a type marker supported by the MarkerFormat class
static int ARROW_LARGEFILLED_HALF
          Constant that tells about a type marker supported by the MarkerFormat class
static int ARROW_LARGEFILLED_HALFLONG
          Constant that tells about a type marker supported by the MarkerFormat class
static int ARROW_LARGEFILLED_LONG
          Constant that tells about a type marker supported by the MarkerFormat class
static int ARROW_LARGENOTFILLED
          Constant that tells about a type marker supported by the MarkerFormat class
static int ARROW_LARGENOTFILLED_LONG
          Constant that tells about a type marker supported by the MarkerFormat class
static int ARROW_MEDIUMFILLED
          Constant that tells about a type marker supported by the MarkerFormat class
static int ARROW_MEDIUMFILLED_HALF
          Constant that tells about a type marker supported by the MarkerFormat class
static int ARROW_MEDIUMFILLED_HALFLONG
          Constant that tells about a type marker supported by the MarkerFormat class
static int ARROW_MEDIUMFILLED_LONG
          Constant that tells about a type marker supported by the MarkerFormat class
static int ARROW_MEDIUMNOTFILLED
          Constant that tells about a type marker supported by the MarkerFormat class
static int ARROW_MEDIUMNOTFILLED_LONG
          Constant that tells about a type marker supported by the MarkerFormat class
static int ARROW_SMALLFILLED
          Constant that tells about a type marker supported by the MarkerFormat class
static int ARROW_SMALLFILLED_HALF
          Constant that tells about a type marker supported by the MarkerFormat class
static int ARROW_SMALLFILLED_HALFLONG
          Constant that tells about a type marker supported by the MarkerFormat class
static int ARROW_SMALLFILLED_LONG
          Constant that tells about a type marker supported by the MarkerFormat class
static int ARROW_SMALLNOTFILLED
          Constant that tells about a type marker supported by the MarkerFormat class
static int ARROW_SMALLNOTFILLED_LONG
          Constant that tells about a type marker supported by the MarkerFormat class
protected static java.lang.String CANONIC_DESCRIPTION_DELIMITER
          constant needed as delimitier for the canonical description
static MarkerFormat DEFAULT_INVISIBLE_MARKER
          global constant that defines an invisible marker
static int DIAMOND
          Constant that tells about a type marker supported by the MarkerFormat class
static int INVISIBLE
          Constant that tells about a type marker supported by the MarkerFormat class
static int MARKER_TYPE_MAX
          global constant that tells about the count of different marker types
static int SQUARE
          Constant that tells about a type marker supported by the MarkerFormat class
protected static java.lang.String TOKEN_PAINT
          enumeration that tells about the canonical description tokens
protected static java.lang.String TOKEN_SIZE
          enumeration that tells about the canonical description tokens
protected static java.lang.String TOKEN_STROKE
          enumeration that tells about the canonical description tokens
protected static java.lang.String TOKEN_TYPE
          enumeration that tells about the canonical description tokens
static int VERTLINE
          Constant that tells about a type marker supported by the MarkerFormat class
 
Constructor Summary
MarkerFormat(int type, int size, StrokeFormat stroke, PaintFormat paint)
          Constructor for MarkerFormat.
 
Method Summary
 java.lang.String getCanonicalDescription()
          Returns the canonical description of a MarkerFormat.
static java.lang.String getCanonicalDescription(int type, int size, StrokeFormat stroke, PaintFormat paint)
          Returns the canonical description of a MarkerFormat.
static java.lang.String getCanonicalDescription(java.lang.String type, java.lang.String size, java.lang.String stroke, java.lang.String paint)
          Returns the canonical description of a MarkerFormat.
 java.lang.Object[][] getFormatData()
          Returns an array filled with the attributes of the MarkerFormat.
 PaintFormat getPaint()
          Returns the PaintFormat the MarkerFormat uses to fill the background.
 int getSize()
          Returns the size.
 StrokeFormat getStroke()
          Returns the StrokeFormat the MarkerFormat uses to draw borders or lines.
 int getType()
          Returns the type.
 boolean isVisible()
          Returns a boolean that indicates whether the MarkerFormat is visible or not.
 java.lang.String toString()
          Returns a String that represent the MarkerFormat and all of the attributes of it.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

INVISIBLE

public static final int INVISIBLE
Constant that tells about a type marker supported by the MarkerFormat class

See Also:
Constant Field Values

ARROW_SMALLFILLED

public static final int ARROW_SMALLFILLED
Constant that tells about a type marker supported by the MarkerFormat class

See Also:
Constant Field Values

ARROW_MEDIUMFILLED

public static final int ARROW_MEDIUMFILLED
Constant that tells about a type marker supported by the MarkerFormat class

See Also:
Constant Field Values

ARROW_LARGEFILLED

public static final int ARROW_LARGEFILLED
Constant that tells about a type marker supported by the MarkerFormat class

See Also:
Constant Field Values

ARROW_SMALLFILLED_LONG

public static final int ARROW_SMALLFILLED_LONG
Constant that tells about a type marker supported by the MarkerFormat class

See Also:
Constant Field Values

ARROW_MEDIUMFILLED_LONG

public static final int ARROW_MEDIUMFILLED_LONG
Constant that tells about a type marker supported by the MarkerFormat class

See Also:
Constant Field Values

ARROW_LARGEFILLED_LONG

public static final int ARROW_LARGEFILLED_LONG
Constant that tells about a type marker supported by the MarkerFormat class

See Also:
Constant Field Values

ARROW_SMALLFILLED_HALF

public static final int ARROW_SMALLFILLED_HALF
Constant that tells about a type marker supported by the MarkerFormat class

See Also:
Constant Field Values

ARROW_MEDIUMFILLED_HALF

public static final int ARROW_MEDIUMFILLED_HALF
Constant that tells about a type marker supported by the MarkerFormat class

See Also:
Constant Field Values

ARROW_LARGEFILLED_HALF

public static final int ARROW_LARGEFILLED_HALF
Constant that tells about a type marker supported by the MarkerFormat class

See Also:
Constant Field Values

ARROW_SMALLFILLED_HALFLONG

public static final int ARROW_SMALLFILLED_HALFLONG
Constant that tells about a type marker supported by the MarkerFormat class

See Also:
Constant Field Values

ARROW_MEDIUMFILLED_HALFLONG

public static final int ARROW_MEDIUMFILLED_HALFLONG
Constant that tells about a type marker supported by the MarkerFormat class

See Also:
Constant Field Values

ARROW_LARGEFILLED_HALFLONG

public static final int ARROW_LARGEFILLED_HALFLONG
Constant that tells about a type marker supported by the MarkerFormat class

See Also:
Constant Field Values

ARROW_SMALLNOTFILLED

public static final int ARROW_SMALLNOTFILLED
Constant that tells about a type marker supported by the MarkerFormat class

See Also:
Constant Field Values

ARROW_MEDIUMNOTFILLED

public static final int ARROW_MEDIUMNOTFILLED
Constant that tells about a type marker supported by the MarkerFormat class

See Also:
Constant Field Values

ARROW_LARGENOTFILLED

public static final int ARROW_LARGENOTFILLED
Constant that tells about a type marker supported by the MarkerFormat class

See Also:
Constant Field Values

ARROW_SMALLNOTFILLED_LONG

public static final int ARROW_SMALLNOTFILLED_LONG
Constant that tells about a type marker supported by the MarkerFormat class

See Also:
Constant Field Values

ARROW_MEDIUMNOTFILLED_LONG

public static final int ARROW_MEDIUMNOTFILLED_LONG
Constant that tells about a type marker supported by the MarkerFormat class

See Also:
Constant Field Values

ARROW_LARGENOTFILLED_LONG

public static final int ARROW_LARGENOTFILLED_LONG
Constant that tells about a type marker supported by the MarkerFormat class

See Also:
Constant Field Values

SQUARE

public static final int SQUARE
Constant that tells about a type marker supported by the MarkerFormat class

See Also:
Constant Field Values

DIAMOND

public static final int DIAMOND
Constant that tells about a type marker supported by the MarkerFormat class

See Also:
Constant Field Values

VERTLINE

public static final int VERTLINE
Constant that tells about a type marker supported by the MarkerFormat class

See Also:
Constant Field Values

MARKER_TYPE_MAX

public static final int MARKER_TYPE_MAX
global constant that tells about the count of different marker types

See Also:
Constant Field Values

CANONIC_DESCRIPTION_DELIMITER

protected static final java.lang.String CANONIC_DESCRIPTION_DELIMITER
constant needed as delimitier for the canonical description

See Also:
Constant Field Values

TOKEN_TYPE

protected static final java.lang.String TOKEN_TYPE
enumeration that tells about the canonical description tokens

See Also:
Constant Field Values

TOKEN_SIZE

protected static final java.lang.String TOKEN_SIZE
enumeration that tells about the canonical description tokens

See Also:
Constant Field Values

TOKEN_STROKE

protected static final java.lang.String TOKEN_STROKE
enumeration that tells about the canonical description tokens

See Also:
Constant Field Values

TOKEN_PAINT

protected static final java.lang.String TOKEN_PAINT
enumeration that tells about the canonical description tokens

See Also:
Constant Field Values

DEFAULT_INVISIBLE_MARKER

public static final MarkerFormat DEFAULT_INVISIBLE_MARKER
global constant that defines an invisible marker

Constructor Detail

MarkerFormat

public MarkerFormat(int type,
                    int size,
                    StrokeFormat stroke,
                    PaintFormat paint)
Constructor for MarkerFormat.

Method Detail

getSize

public int getSize()
Returns the size.

Returns:
int the size of the marker

getType

public int getType()
Returns the type.

Returns:
int the type of the marker

getStroke

public StrokeFormat getStroke()
Returns the StrokeFormat the MarkerFormat uses to draw borders or lines.

Returns:
StrokeFormat the StrokeFormat for the marker

getPaint

public PaintFormat getPaint()
Returns the PaintFormat the MarkerFormat uses to fill the background.

Returns:
PaintFormat the PaintFormat for the marker

isVisible

public boolean isVisible()
Returns a boolean that indicates whether the MarkerFormat is visible or not.

Returns:
boolean flag that indicates a visible MarkerFormat

getFormatData

public java.lang.Object[][] getFormatData()
Returns an array filled with the attributes of the MarkerFormat. The indices of the attributes are given by constants defined in this class. This array is used by Renderers and Devices. To get more informations about this objects take a look at the documentation of Renderer and Device

Returns:
int[][] the array with the attributes if the MarkerFormat

getCanonicalDescription

public java.lang.String getCanonicalDescription()
Returns the canonical description of a MarkerFormat. For instance this description is used for the pooling of MarkerFormats. It can also be used to compare two instances of a MarkerFormat.

Specified by:
getCanonicalDescription in interface Format
Returns:
String the canonical description of a MarkerFormat

toString

public java.lang.String toString()
Returns a String that represent the MarkerFormat and all of the attributes of it. For instance this representation can be used for tracing purposes and such.

Specified by:
toString in interface Format
Returns:
String the textual representation of the MarkerFormat

getCanonicalDescription

public static final java.lang.String getCanonicalDescription(int type,
                                                             int size,
                                                             StrokeFormat stroke,
                                                             PaintFormat paint)
Returns the canonical description of a MarkerFormat. For instance this description is used for the pooling of MarkerFormats. It can also be used to compare two instances of a MarkerFormat.

Parameters:
type - the type of a MarkerFormat
size - the size of a MarkerFormat
stroke - the StrokeFormat of a MarkerFormat
paint - the PaintFormat of a MarkerFormat
Returns:
String the canonical description of a MarkerFormat

getCanonicalDescription

public static final java.lang.String getCanonicalDescription(java.lang.String type,
                                                             java.lang.String size,
                                                             java.lang.String stroke,
                                                             java.lang.String paint)
Returns the canonical description of a MarkerFormat. For instance this description is used for the pooling of MarkerFormats. It can also be used to compare two instances of a MarkerFormat.

Parameters:
type - the type of a MarkerFormat
size - the size of a MarkerFormat
stroke - the StrokeFormat of a MarkerFormat
paint - the PaintFormat of a MarkerFormat
Returns:
String the canonical description of a MarkerFormat


Copyright © 2005 Tensegrity Software GmbH. All Rights Reserved. Date of creation: 09.06.2006.