JClass DesktopViews 6.3.0 API
Documentation

com.klg.jclass.chart3d
Class JCSymbolStyle

java.lang.Object
  |
  +--com.klg.jclass.chart3d.JCStyle
        |
        +--com.klg.jclass.chart3d.JCSymbolStyle
All Implemented Interfaces:
Serializable

public class JCSymbolStyle
extends JCStyle

JCSymbolStyle controls the appearance of points in a scatter plot by allowing the modification of the symbol shape, symbol color, and symbol size.

See Also:
Serialized Form

Field Summary
static String BOX
           
static String CIRCLE
           
protected  Color color
          The symbol color.
protected  int colorIndex
          The index into the default color for this object.
static String CONE
           
static String CROSS
           
static String CUBE
           
static String CYLINDER
           
static int DEFAULT_SIZE
          The default size of a symbol.
protected static String[] defaultShapes
          The default shape list (intialized to the standard default array).
static String DIAMOND
           
static String DOT
           
static String HORIZ_LINE
           
static String NONE
          The following are predefined shapes for the Java2D implementation.
static String POINT
           
static String RECTANGLE
           
protected  String shape
          The symbol shape.
protected  int shapeIndex
          The index into the default shape array for this object.
protected  int size
          The symbol size in pixels.
static String SPHERE
          The following are predefined shapes for the Java3D implementation.
static String SQUARE
           
static String STAR
           
static Hashtable symbolInstances
          Keeps a static table of symbol instances.
static String TETRAHEDRON
           
static String TRIANGLE
           
static String VERT_LINE
           
 
Fields inherited from class com.klg.jclass.chart3d.JCStyle
defaultColors, FILL_STYLE, LINE_STYLE, parent, SYMBOL_STYLE
 
Constructor Summary
JCSymbolStyle(String shape, Color color, int size)
          Constructor for symbol style objects.
 
Method Summary
 void draw(Graphics gc, int x, int y)
          Draws a symbol at the specified location, using the properties of the JCSymbolStyle instance.
 void draw(Graphics gc, int x, int y, Color col)
          Draws a symbol at the specified location, using the properties of the JCSymbolStyle instance.
 void draw(Graphics gc, int x, int y, int sz)
          Draws a symbol at the specified location, using the properties of the JCSymbolStyle instance.
 void draw(Graphics gc, int x, int y, int sz, Color col)
          Draws a symbol at the specified location, using the properties of the JCSymbolStyle instance.
 Color getColor()
          Gets the Color property of JCSymbolStyle, which determines the color used to paint the symbols.
 int getColorIndex()
          Returns the index used to generate the color.
protected static String getDefaultShape(com.klg.jclass.chart3d.JCChart3d c)
          Gets the current default shape for this chart based on its default shape index.
static String[] getDefaultShapes()
          Allows access to the default shape list.
 String getShape()
          Gets the Shape property.
 int getSize()
          Gets the Size property.
static com.klg.jclass.chart3d.shape.JCSymbolShape getSymbolShapeInstance(String shape)
          Gets an instance of a symbol shape object for a given shape.
static com.klg.jclass.chart3d.JCSymbolStyle makeDefault(com.klg.jclass.chart3d.JCChart3d c)
          Creates a default symbol style.
 void setColor(Color color)
          Sets the Color property of JCSymbolStyle, which determines the color used to paint the symbols.
static void setDefault2dShapes(String[] newShapes)
          Uses a new default 2d shapes array.
static void setDefault3dShapes(String[] newShapes)
          Uses a new default 3d shapes array.
 void setShape(String shape)
          Sets the Shape property.
 void setSize(int size)
          Sets the Size property of JCSymbolStyle, which determines the size of the symbols.
static int shapeToIndex(String shape)
          Gets a default shape's index from its String value.
 
Methods inherited from class com.klg.jclass.chart3d.JCStyle
getDefaultColors, setDefaultColors
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

shape

protected String shape
The symbol shape.


colorIndex

protected int colorIndex
The index into the default color for this object.


shapeIndex

protected int shapeIndex
The index into the default shape array for this object.


color

protected Color color
The symbol color.


size

protected int size
The symbol size in pixels.


DEFAULT_SIZE

public static final int DEFAULT_SIZE
The default size of a symbol.

See Also:
Constant Field Values

symbolInstances

public static Hashtable symbolInstances
Keeps a static table of symbol instances.


NONE

public static final String NONE
The following are predefined shapes for the Java2D implementation.


DOT

public static final String DOT
See Also:
Constant Field Values

BOX

public static final String BOX
See Also:
Constant Field Values

TRIANGLE

public static final String TRIANGLE
See Also:
Constant Field Values

DIAMOND

public static final String DIAMOND
See Also:
Constant Field Values

STAR

public static final String STAR
See Also:
Constant Field Values

VERT_LINE

public static final String VERT_LINE
See Also:
Constant Field Values

HORIZ_LINE

public static final String HORIZ_LINE
See Also:
Constant Field Values

CROSS

public static final String CROSS
See Also:
Constant Field Values

CIRCLE

public static final String CIRCLE
See Also:
Constant Field Values

SQUARE

public static final String SQUARE
See Also:
Constant Field Values

RECTANGLE

public static final String RECTANGLE
See Also:
Constant Field Values

SPHERE

public static final String SPHERE
The following are predefined shapes for the Java3D implementation.

See Also:
Constant Field Values

CUBE

public static final String CUBE
See Also:
Constant Field Values

CONE

public static final String CONE
See Also:
Constant Field Values

POINT

public static final String POINT
See Also:
Constant Field Values

CYLINDER

public static final String CYLINDER
See Also:
Constant Field Values

TETRAHEDRON

public static final String TETRAHEDRON
See Also:
Constant Field Values

defaultShapes

protected static String[] defaultShapes
The default shape list (intialized to the standard default array).

Constructor Detail

JCSymbolStyle

public JCSymbolStyle(String shape,
                     Color color,
                     int size)
Constructor for symbol style objects.

Parameters:
shape - symbol shape (one of NONE, DOT, BOX, TRIANGLE, DIAMOND, STAR, VERT_LINE, HORIZ_LINE, CROSS, CIRCLE, or SQUARE)
color - symbol color
size - symbol size
Method Detail

makeDefault

public static com.klg.jclass.chart3d.JCSymbolStyle makeDefault(com.klg.jclass.chart3d.JCChart3d c)
Creates a default symbol style.

Parameters:
c - the chart for which to generate the default symbol style
Returns:
JCSymbolStyle object with default color and symbol style. The defaults are cycled, so consecutive calls will return different symbol styles.

getDefaultShapes

public static String[] getDefaultShapes()
Allows access to the default shape list.

Returns:
default shape list

setDefault2dShapes

public static void setDefault2dShapes(String[] newShapes)
Uses a new default 2d shapes array.

Parameters:
newShapes - the new default shapes array

setDefault3dShapes

public static void setDefault3dShapes(String[] newShapes)
Uses a new default 3d shapes array.

Parameters:
newShapes - the new default shapes array

shapeToIndex

public static int shapeToIndex(String shape)
Gets a default shape's index from its String value.

Parameters:
shape - the shape for which to get the index
Returns:
the index in the defaultShapes array of the shape (returns -1 if not found)

draw

public void draw(Graphics gc,
                 int x,
                 int y)
Draws a symbol at the specified location, using the properties of the JCSymbolStyle instance.

Parameters:
gc - graphics context to use for drawing
x - x position of symbol (in pixels)
y - y position of symbol (in pixels)

draw

public void draw(Graphics gc,
                 int x,
                 int y,
                 Color col)
Draws a symbol at the specified location, using the properties of the JCSymbolStyle instance.

Parameters:
gc - graphics context to use for drawing
x - x position of symbol (in pixels)
y - y position of symbol (in pixels)
col - the color to draw with

draw

public void draw(Graphics gc,
                 int x,
                 int y,
                 int sz)
Draws a symbol at the specified location, using the properties of the JCSymbolStyle instance.

Parameters:
gc - graphics context to use for drawing
x - x position of symbol (in pixels)
y - y position of symbol (in pixels)
sz - size of the symbol

draw

public void draw(Graphics gc,
                 int x,
                 int y,
                 int sz,
                 Color col)
Draws a symbol at the specified location, using the properties of the JCSymbolStyle instance.

Parameters:
gc - graphics context to use for drawing
x - x position of symbol (in pixels)
y - y position of symbol (in pixels)
sz - size of the symbol
col - the color to draw with

getShape

public String getShape()
Gets the Shape property. The Shape property determines the shape of symbol that will be drawn.

Returns:
one of NONE, DOT, BOX, TRIANGLE, DIAMOND, STAR, VERT_LINE, HORIZ_LINE, CROSS, CIRCLE, SQUARE or RECTANGLE

setShape

public void setShape(String shape)
Sets the Shape property. The Shape property determines the shape of symbol that will be drawn.

Parameters:
shape - one of NONE, DOT, BOX, TRIANGLE, DIAMOND, STAR, VERT_LINE, HORIZ_LINE, CROSS, CIRCLE, SQUARE or RECTANGLE

getColor

public Color getColor()
Gets the Color property of JCSymbolStyle, which determines the color used to paint the symbols.

Returns:
AWT Color class representing the color to be used to paint the symbols. If null, the current color of the Graphics object is used.

setColor

public void setColor(Color color)
Sets the Color property of JCSymbolStyle, which determines the color used to paint the symbols.

Parameters:
color - AWT Color class representing the color to be used to paint the symbols. If null, the current color of the Graphics object is used.

getSize

public int getSize()
Gets the Size property. The Size property determines the size of the symbols.
Note: A value of zero size means the symbol will not be drawn.

Returns:
positive integer representing size

setSize

public void setSize(int size)
Sets the Size property of JCSymbolStyle, which determines the size of the symbols.
Note: A value of zero size means the symbol will not be drawn.

Parameters:
size - positive integer representing size

getDefaultShape

protected static String getDefaultShape(com.klg.jclass.chart3d.JCChart3d c)
Gets the current default shape for this chart based on its default shape index.

Parameters:
c -
Returns:
the index of the default shape to be used

getColorIndex

public int getColorIndex()
Returns the index used to generate the color. Only set if default colors are used.

Returns:
the current index into the default color array

getSymbolShapeInstance

public static com.klg.jclass.chart3d.shape.JCSymbolShape getSymbolShapeInstance(String shape)
Gets an instance of a symbol shape object for a given shape. Look it up in the hashTable. If it exists in the table, use it. If not, create a new instance and store it in the table.

Parameters:
shape - the shape whose value points to a class to instantiate
Returns:
an object which implements the JCSymbolShape interface, ready for use

Copyright © 2004 Quest Software Inc..
All rights reserved.