cox.jmatt.java.MathTools.markup.svg
Class CircleTag

java.lang.Object
  extended by cox.jmatt.java.MathTools.markup.Tag
      extended by cox.jmatt.java.MathTools.markup.svg.StyleTag
          extended by cox.jmatt.java.MathTools.markup.svg.CircleTag

public class CircleTag
extends StyleTag

This class handles the SVG <circle> tag. It has methods to set the center and radius, along with the inherited default methods. It is also responsible for creating points, which are nothing more than circles of very small radius with the same stroke and fill colors. Since points are so simple, they are returned as String and not CircleTag. The only things configurable about them are color and radius and those have specific setters.


Nested Class Summary
 
Nested classes/interfaces inherited from class cox.jmatt.java.MathTools.markup.svg.StyleTag
StyleTag.TagKeys
 
Field Summary
static double DEFAULT_POINT_RADIUS
          Default radius size for points.
 
Fields inherited from class cox.jmatt.java.MathTools.markup.Tag
myTagName
 
Constructor Summary
CircleTag()
          Standard constructor for a default CircleTag.
CircleTag(java.lang.Double pX, java.lang.Double pY, java.lang.Double pRadius)
          Full constructor, all data supplied.
 
Method Summary
 void configureTag(java.lang.String pPrefix, java.util.Properties pPizza)
          Pizza-configure this tag.
 CircleTag copyOf()
          Copy this class.
 java.lang.String getNewPoint(double pX, double pY)
          Instance method to create a point.
static java.lang.String getPoint(double pX, double pY)
          Create and return a point as a String.
 void reset()
          Overridden to handle point settings as well.
 CircleTag setData(java.lang.Double pX, java.lang.Double pY, java.lang.Double pRadius)
          Use this method to set or change the center or radius of the circle.
 void setNewPointData(double pSize, java.lang.String pColor)
          Instance version.
static void setPointData(double pSize, java.lang.String pColor)
          Set the color and size of all points creates subsequently.
 
Methods inherited from class cox.jmatt.java.MathTools.markup.svg.StyleTag
_configureTag, _enableCopy, canHaveDefs, isInDefs, setDefaultPen, setDefaultStyle, setDefaultTransform, setPen, setStyle, setTransform
 
Methods inherited from class cox.jmatt.java.MathTools.markup.Tag
_addAttribute, _addAttributes, _addNAttribute, _asBoolean, _asDouble, _asInt, _attributes, _clampNAttribute, _clampNAttribute, _content, _fixKey, _setContent, _setEnableXMLTag, badPizza, closeTag, configureTagFromGlobalPizza, makeTag, openTag, setID, toString, validString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_POINT_RADIUS

public static final double DEFAULT_POINT_RADIUS
Default radius size for points. Currently 1.

See Also:
Constant Field Values
Constructor Detail

CircleTag

public CircleTag()
Standard constructor for a default CircleTag. All data is at default value.


CircleTag

public CircleTag(java.lang.Double pX,
                 java.lang.Double pY,
                 java.lang.Double pRadius)
Full constructor, all data supplied.

Method Detail

setData

public CircleTag setData(java.lang.Double pX,
                         java.lang.Double pY,
                         java.lang.Double pRadius)
Use this method to set or change the center or radius of the circle. Passing null in one of the values ignores that value and does not clear it.

Parameters:
pX - The X-coordinate of the center.
pY - The Y-coordinate of the center.
pRadius - The radius of the circle.

reset

public void reset()
Overridden to handle point settings as well.

Overrides:
reset in class Tag

copyOf

public CircleTag copyOf()
Copy this class.


configureTag

public void configureTag(java.lang.String pPrefix,
                         java.util.Properties pPizza)

Pizza-configure this tag. The prefix for this tag is 'markup.svg.Circle.' and the recognized values are:

This method works by collecting ALL values available then calling the appropriate 'set' methods. Any value not found in the pizza are set as null (-1.0 in the case of point radius). If no values are found none are set: at least one of 'cx', 'cy' and 'radius' must be defined otherwise the set method is not called. Likewise if 'point.size' or 'point.color' are both skipped the 'setPointData' method is not called.

Any errors parsing values cause that particular value to be skipped.

Overrides:
configureTag in class Tag
pPizza - A Properties object holding configuration data for the subclass instance.

setPointData

public static final void setPointData(double pSize,
                                      java.lang.String pColor)
Set the color and size of all points creates subsequently. Any size less than DEFAULT_POINT_RADIUS becomes DEFAULT_POINT_RADIUS, and setting color to null or blank restores the default (black).

Parameters:
pSize - The radius of the point. Minimum value of DEFAULT_POINT_RADIUS.
pColor - The stroke and fill color as a String.

setNewPointData

public void setNewPointData(double pSize,
                            java.lang.String pColor)
Instance version.


getPoint

public static java.lang.String getPoint(double pX,
                                        double pY)
Create and return a point as a String. Since it is a point, only the coordinates are required. The point appears at (pX, pY).


getNewPoint

public java.lang.String getNewPoint(double pX,
                                    double pY)
Instance method to create a point.