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

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.DrawableContainerTag
              extended by cox.jmatt.java.MathTools.markup.svg.GroupTag
                  extended by cox.jmatt.java.MathTools.markup.svg.SymbolTag
                      extended by cox.jmatt.java.MathTools.markup.svg.SVGTag

public class SVGTag
extends SymbolTag

This class encapsulates the <svg> tag. By default this is a 'root' tag, meaning it will automatically have the '<?xml ... ?>' declaration prepended when toString() is called. Change this with setAsRoot(). Similarly, since this is the ONLY tag allowed to have a <defs> block, this is the only tag class that can add a StylePen.

Root SVG tags must have a width and a height, therefore a String width and height are requred to create one. Since there are some conditions under which an <svg> tag might not need them, they can be cleared. Use the setSize() method to do this, but do so carefully!

SVG and Units

By the SVG specification almost all numeric attributes are allowed to have units associated with them. MathTools does not allow this: all values on the other tags are given in user units. User units are specified in a tag's 'viewBox=' attribute, for those that have it, or a parent's attribute for those that don't. Since the root tag of an SVG document is an <svg> tag, it must have its viewport specified! The viewport should be specified for a convenient number of user-units per unit given for the root tag's height and width.


Nested Class Summary
 
Nested classes/interfaces inherited from class cox.jmatt.java.MathTools.markup.svg.StyleTag
StyleTag.TagKeys
 
Field Summary
static java.lang.String NSURI
          This contains the SVG namespace URI.
static java.lang.String NSURI_XLINK
          This contains the 'xmlns:xlink' namespace URI.
 
Fields inherited from class cox.jmatt.java.MathTools.markup.Tag
myTagName
 
Method Summary
 SVGTag add(StylePen pPen)
          Since this is the only tag class allowed to have a <defs> block, this is the only class that needs to add StylePens! Use this method to do so.
static SVGTag newInstance(java.lang.String pWidth, java.lang.String pHeight)
          An SVGTag must have width and height set.
 void reset()
          Overridden to preserve width and height during a reset.
 SVGTag setAsRoot(boolean isRoot)
          By assumption any SVGTag generated is the root tag of a document.
 void setSize(java.lang.String pWidth, java.lang.String pHeight)
          This method can be used to re-set width and height or to clear them, by setting null.
 java.lang.String toString()
          Overridden to handle root tag processing.
 
Methods inherited from class cox.jmatt.java.MathTools.markup.svg.SymbolTag
newInstance, reset, setID, setPAR, setViewBox
 
Methods inherited from class cox.jmatt.java.MathTools.markup.svg.GroupTag
configureTag, setDesc, setTitle
 
Methods inherited from class cox.jmatt.java.MathTools.markup.svg.DrawableContainerTag
_addContent, _addCSS, _addDef, _content, _setContent, _setDesc, _setOBUS, _setPAR, _setTitle, _setViewBox, add, addRaw, drawCircle, drawEllipse, drawLine, drawPath, drawPoint, drawPolygon, drawPolyline, drawRectangle, drawRectangle, drawText
 
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, _fixKey, _setEnableXMLTag, badPizza, closeTag, configureTagFromGlobalPizza, makeTag, openTag, validString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NSURI

public static final java.lang.String NSURI
This contains the SVG namespace URI.

See Also:
Constant Field Values

NSURI_XLINK

public static final java.lang.String NSURI_XLINK
This contains the 'xmlns:xlink' namespace URI.

See Also:
Constant Field Values
Method Detail

newInstance

public static final SVGTag newInstance(java.lang.String pWidth,
                                       java.lang.String pHeight)
An SVGTag must have width and height set. Period. Unless they are, this method returns null. Period.


setAsRoot

public SVGTag setAsRoot(boolean isRoot)
By assumption any SVGTag generated is the root tag of a document. This means, when converted to String, that the XML declaration tag is automatically prepended to the tag. If this <svg> tag should NOT, for whatever reason, have the beginning XML declaration use this method to disable it.


toString

public java.lang.String toString()
Overridden to handle root tag processing.

Overrides:
toString in class Tag

reset

public void reset()
Overridden to preserve width and height during a reset.

Overrides:
reset in class SymbolTag

setSize

public void setSize(java.lang.String pWidth,
                    java.lang.String pHeight)
This method can be used to re-set width and height or to clear them, by setting null. Use with care!


add

public SVGTag add(StylePen pPen)
Since this is the only tag class allowed to have a <defs> block, this is the only class that needs to add StylePens! Use this method to do so. IMPORTANT NOTE: This is not the same as setting a pen, rather, this is the method that stores the data corresponding to that pen! This method DOES prepend the dot for a class selector.