exe
Class GAIGSprimitiveCollection

java.lang.Object
  extended by exe.GAIGSprimitiveCollection
All Implemented Interfaces:
GAIGSdatastr

public class GAIGSprimitiveCollection
extends java.lang.Object
implements GAIGSdatastr

GAIGSprimitiveCollection provides the ability to draw 2D graphics for use in visualizations. This class supports a variety of 2D graphics primitives, including lines, polygons, circles, ellipises, etc. Creation of the primitives adheres to the other GAIGS classes and colors are specified with the standard color string.

Version:
6/22/2010
Author:
Shawn Recker

Nested Class Summary
protected  class GAIGSprimitiveCollection.Circle
           
protected  class GAIGSprimitiveCollection.Ellipse
           
protected  class GAIGSprimitiveCollection.Polygon
           
protected static interface GAIGSprimitiveCollection.Primitive
           
protected  class GAIGSprimitiveCollection.StraightLine
           
 
Field Summary
 int LINE_WIDTH
           
protected  java.lang.String name
          The Name of the collection of graphical primitives
protected  java.util.ArrayList<GAIGSprimitiveCollection.Primitive> primitives
          The Current collection of graphical primitives
 double TEXT_HEIGHT
           
 
Fields inherited from interface exe.GAIGSdatastr
DEFAULT_COLOR, DEFAULT_FONT_SIZE, DEFAULT_NAME, DEFAULT_X1, DEFAULT_X2, DEFAULT_Y1, DEFAULT_Y2
 
Constructor Summary
GAIGSprimitiveCollection()
          Creates an empty primitive collection with no name
GAIGSprimitiveCollection(java.lang.String name)
          Creates an empty primitive collection with the specified name
 
Method Summary
 void addArrow(double[] x, double[] y, java.lang.String color, java.lang.String lcolor, java.lang.String label, double headSize)
          Adds a line to the primitive collection ending in an arrow
 void addArrow(double[] x, double[] y, java.lang.String color, java.lang.String lcolor, java.lang.String label, double headSize, double textHeight, int lineWidth)
          Adds a line to the primitive collection ending in an arrow
 void addCircle(double cx, double cy, double r, java.lang.String fillColor, java.lang.String outlineColor, java.lang.String labelColor, java.lang.String labelText)
          Adds a circle to the primitive collection
 void addCircle(double cx, double cy, double r, java.lang.String fillColor, java.lang.String outlineColor, java.lang.String labelColor, java.lang.String labelText, double textHeight, int lineWidth)
          Adds a circle to the primitive collection
 void addDashedLine(double[] x, double[] y, java.lang.String color, java.lang.String lcolor, java.lang.String label, double dashSize)
          Adds a line to the primitive collection
 void addDashedLine(double[] x, double[] y, java.lang.String color, java.lang.String lcolor, java.lang.String label, double dashSize, double textHeight, int lineWidth)
          Adds a line to the primitive collection
 void addEllipse(double x, double y, double stAngle, double endAngle, double xR, double yR, java.lang.String color, java.lang.String lcolor, java.lang.String label)
          Adds an ellipse to the primitive collection.
 void addEllipse(double x, double y, double stAngle, double endAngle, double xR, double yR, java.lang.String color, java.lang.String lcolor, java.lang.String label, double textHeight, int lineWidth)
          Adds an ellipse to the primitive collection.
 void addLine(double[] x, double[] y, java.lang.String color, java.lang.String lcolor, java.lang.String label)
          Adds a line to the primitive collection
 void addLine(double[] x, double[] y, java.lang.String color, java.lang.String lcolor, java.lang.String label, double textHeight, int lineWidth)
          Adds a line to the primitive collection
 void addPolygon(int nSides, double[] ptsX, double[] ptsY, java.lang.String fillColor, java.lang.String outlineColor, java.lang.String labelColor, java.lang.String labelText)
          Adds a polygon to the primitive collection
 void addPolygon(int nSides, double[] ptsX, double[] ptsY, java.lang.String fillColor, java.lang.String outlineColor, java.lang.String labelColor, java.lang.String labelText, double textHeight, int lineWidth)
          Adds a polygon to the primitive collection
 void clearPrimitives()
          Removes all primitives from the collection
 java.lang.String getName()
          Returns the name of the primitive collection
 void setName(java.lang.String name)
          Sets the name of the primitive collection
 java.lang.String toXML()
          Creates and Returns the GAIGS XML code for the current state of the primitive collection
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TEXT_HEIGHT

public final double TEXT_HEIGHT
See Also:
Constant Field Values

LINE_WIDTH

public final int LINE_WIDTH
See Also:
Constant Field Values

primitives

protected java.util.ArrayList<GAIGSprimitiveCollection.Primitive> primitives
The Current collection of graphical primitives


name

protected java.lang.String name
The Name of the collection of graphical primitives

Constructor Detail

GAIGSprimitiveCollection

public GAIGSprimitiveCollection()
Creates an empty primitive collection with no name


GAIGSprimitiveCollection

public GAIGSprimitiveCollection(java.lang.String name)
Creates an empty primitive collection with the specified name

Method Detail

setName

public void setName(java.lang.String name)
Sets the name of the primitive collection

Specified by:
setName in interface GAIGSdatastr
Parameters:
name - The name of the collection

getName

public java.lang.String getName()
Returns the name of the primitive collection

Specified by:
getName in interface GAIGSdatastr
Returns:
The name of the primitive collection

toXML

public java.lang.String toXML()
Creates and Returns the GAIGS XML code for the current state of the primitive collection

Specified by:
toXML in interface GAIGSdatastr
Returns:
A String containing GAIGS XML code for the primitive collection

clearPrimitives

public void clearPrimitives()
Removes all primitives from the collection


addCircle

public void addCircle(double cx,
                      double cy,
                      double r,
                      java.lang.String fillColor,
                      java.lang.String outlineColor,
                      java.lang.String labelColor,
                      java.lang.String labelText,
                      double textHeight,
                      int lineWidth)
Adds a circle to the primitive collection

Parameters:
cx - The center x coordinate of the circle
cy - The center y coordinate of the circle
r - The radius of the circle
fillColor - The internal color of the circle (use an empty string for no fill color)
outlineColor - The color of the circle outline
labelColor - The color of the text in the circle label
labelText - The text to be drawn in the center of the circle
textHeight - The Height of the text in the label
lineWidth - The thickness of the outline of the circle

addPolygon

public void addPolygon(int nSides,
                       double[] ptsX,
                       double[] ptsY,
                       java.lang.String fillColor,
                       java.lang.String outlineColor,
                       java.lang.String labelColor,
                       java.lang.String labelText,
                       double textHeight,
                       int lineWidth)
Adds a polygon to the primitive collection

Parameters:
nSides - The number of sides to the polygon
ptsX - Array containing the x coordinate values for the polygon
otsY - Array containing the y coordinate values for the polygon
fillColor - The internal color of the polygon (use an empty string for no fill color)
outlineColor - The color of the circle polygon
labelColor - The color of the text in the circle label
labelText - The text to be drawn in the center of the circle
lineWidth - The thickness of the outline of the polygon

addLine

public void addLine(double[] x,
                    double[] y,
                    java.lang.String color,
                    java.lang.String lcolor,
                    java.lang.String label,
                    double textHeight,
                    int lineWidth)
Adds a line to the primitive collection

Parameters:
x - Array of 2 containing the x coordinates for the start point and end point
y - Array of 2 containing the y coordinates for the start point and end point
color - The color of the line
lcolor - The color of the text in the label
label - The text to printed near the line
textHeight - The Height of the text in the label
lineWidth - The thickness of the line

addDashedLine

public void addDashedLine(double[] x,
                          double[] y,
                          java.lang.String color,
                          java.lang.String lcolor,
                          java.lang.String label,
                          double dashSize,
                          double textHeight,
                          int lineWidth)
Adds a line to the primitive collection

Parameters:
x - Array of 2 containing the x coordinates for the start point and end point
y - Array of 2 containing the y coordinates for the start point and end point
color - The color of the line
lcolor - The color of the text in the label
label - The text to printed near the line
dashSize - The length of the dash in the line
textHeight - The Height of the text in the label
lineWidth - The thickness of the line dashes

addArrow

public void addArrow(double[] x,
                     double[] y,
                     java.lang.String color,
                     java.lang.String lcolor,
                     java.lang.String label,
                     double headSize,
                     double textHeight,
                     int lineWidth)
Adds a line to the primitive collection ending in an arrow

Parameters:
x - Array of 2 containing the x coordinates for the start point and end point
y - Array of 2 containing the y coordinates for the start point and end point
color - The color of the line
lcolor - The color of the text in the label
label - The text to printed near the line
headSize - The size of the arrow head
textHeight - The Height of the text in the label
lineWidth - The thickness of the line

addEllipse

public void addEllipse(double x,
                       double y,
                       double stAngle,
                       double endAngle,
                       double xR,
                       double yR,
                       java.lang.String color,
                       java.lang.String lcolor,
                       java.lang.String label,
                       double textHeight,
                       int lineWidth)
Adds an ellipse to the primitive collection. Does not support a filled ellipse.

Parameters:
x - The lower right hand x coordinate of the ellipse bounds
y - The lower right hand y coordinate of the ellipse bounds
stAngle - The starting angle in radians of the ellipse
endAngle - The ending angle in radians of the ellipse
xR - The radius value along the x axis
yR - The radius value along the y axis
color - The color of the outline of the ellipse
lcolor - The color of the text in the label
label - The text for the label to appear in the center of the ellipse
textHeight - The Height of the text in the label
lineWidth - The width of the outline of the circle

addCircle

public void addCircle(double cx,
                      double cy,
                      double r,
                      java.lang.String fillColor,
                      java.lang.String outlineColor,
                      java.lang.String labelColor,
                      java.lang.String labelText)
Adds a circle to the primitive collection

Parameters:
cx - The center x coordinate of the circle
cy - The center y coordinate of the circle
r - The radius of the circle
fillColor - The internal color of the circle (use an empty string for no fill color)
outlineColor - The color of the circle outline
labelColor - The color of the text in the circle label
labelText - The text to be drawn in the center of the circle

addPolygon

public void addPolygon(int nSides,
                       double[] ptsX,
                       double[] ptsY,
                       java.lang.String fillColor,
                       java.lang.String outlineColor,
                       java.lang.String labelColor,
                       java.lang.String labelText)
Adds a polygon to the primitive collection

Parameters:
nSides - The number of sides to the polygon
ptsX - Array containing the x coordinate values for the polygon
otsY - Array containing the y coordinate values for the polygon
fillColor - The internal color of the polygon (use an empty string for no fill color)
outlineColor - The color of the circle polygon
labelColor - The color of the text in the circle label
labelText - The text to be drawn in the center of the circle

addLine

public void addLine(double[] x,
                    double[] y,
                    java.lang.String color,
                    java.lang.String lcolor,
                    java.lang.String label)
Adds a line to the primitive collection

Parameters:
x - Array of 2 containing the x coordinates for the start point and end point
y - Array of 2 containing the y coordinates for the start point and end point
color - The color of the line
lcolor - The color of the text in the label
label - The text to printed near the line

addDashedLine

public void addDashedLine(double[] x,
                          double[] y,
                          java.lang.String color,
                          java.lang.String lcolor,
                          java.lang.String label,
                          double dashSize)
Adds a line to the primitive collection

Parameters:
x - Array of 2 containing the x coordinates for the start point and end point
y - Array of 2 containing the y coordinates for the start point and end point
color - The color of the line
lcolor - The color of the text in the label
label - The text to printed near the line
dashSize - The length of the dash in the line

addArrow

public void addArrow(double[] x,
                     double[] y,
                     java.lang.String color,
                     java.lang.String lcolor,
                     java.lang.String label,
                     double headSize)
Adds a line to the primitive collection ending in an arrow

Parameters:
x - Array of 2 containing the x coordinates for the start point and end point
y - Array of 2 containing the y coordinates for the start point and end point
color - The color of the line
lcolor - The color of the text in the label
label - The text to printed near the line
headSize - The size of the arrow head

addEllipse

public void addEllipse(double x,
                       double y,
                       double stAngle,
                       double endAngle,
                       double xR,
                       double yR,
                       java.lang.String color,
                       java.lang.String lcolor,
                       java.lang.String label)
Adds an ellipse to the primitive collection. Does not support a filled ellipse.

Parameters:
x - The lower right hand x coordinate of the ellipse bounds
y - The lower right hand y coordinate of the ellipse bounds
stAngle - The starting angle in radians of the ellipse
endAngle - The ending angle in radians of the ellipse
xR - The radius value along the x axis
yR - The radius value along the y axis
color - The color of the outline of the ellipse
lcolor - The color of the text in the label
label - The text for the label to appear in the center of the ellipse
textHeight - The Height of the text in the label