|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcox.jmatt.java.MathTools.graphing.xml.RenderableXML
cox.jmatt.java.MathTools.graphing.xml.GraphPaperXML
public class GraphPaperXML
This is the bring-together class of the graphing.xml.*
package. When GraphPaperXML
is rendered it yields an XML document containing
all of the graphing data. All Object arguments are toString()
-ed to allow for proper representation, so implementations that do NOT use Strings
won't get the best mileage from this one.
Implementations that do use Strings can use this package to persistently store graphs. The ONLY non-standard method used is setID()
and it is used transparently.
Common XML attributes are ID, name, and type. The type is that set in Renderable, and the IDs are assigned when graphing components are added to GraphPaper.
The 'name=' attribute is assigned when the component is created; from GraphEngine
. This is all handled automatically. Calling GraphPaper's
render()
method both generates root tags and GraphPaper data and renders all contained elements, in order: Axes, Graphs, Polygons, Transforms, and
parameters. The tags are simple, straightforward, and easy to use.
NOTE: None of the XML package classes need or use a rendering context Object. It is ignored in all cases.
Field Summary |
---|
Fields inherited from class cox.jmatt.java.MathTools.graphing.xml.RenderableXML |
---|
myID, myName, myParams, myType |
Constructor Summary | |
---|---|
GraphPaperXML()
Zero-argument constructor. |
|
GraphPaperXML(java.lang.String pName)
Constructor for named GraphPaperXML. |
Method Summary | |
---|---|
boolean |
addAxis(java.lang.String pKey,
Axis pAxis)
Add an Axis to this GraphPaper . |
boolean |
addGraph(java.lang.String pKey,
Graphable pGraph)
Add a Graphable to this GraphPaper . |
boolean |
addPolygon(java.lang.String pKey,
Polygon pPoly)
Add an Polygon to this GraphPaper . |
boolean |
addTransform(java.lang.Object pTransform)
Transforms, if used, MUST be representable by String! If the transform is null, it is ignored and false is returned. |
java.lang.Object |
render(java.lang.Object pContext)
Bring it all together and print it out as XML. |
boolean |
setRanges(double pXMin,
double pYMin,
double pXMax,
double pYMax)
Ranges are presented as attributes in the <GraphPaper> tag: xmin, ymin, xmax, ymax. |
boolean |
setSize(double pWidth,
double pHeight)
Height and width are rendered as 'height=' and 'width=' attributes on the <GraphPaper> tag. |
Methods inherited from class cox.jmatt.java.MathTools.graphing.xml.RenderableXML |
---|
setID, setParameter, setType, testCondition |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface cox.jmatt.java.MathTools.graphing.Renderable |
---|
setParameter, setType, testCondition |
Constructor Detail |
---|
public GraphPaperXML()
public GraphPaperXML(java.lang.String pName)
Method Detail |
---|
public boolean setRanges(double pXMin, double pYMin, double pXMax, double pYMax)
setRanges
in interface GraphPaper
pXMin
- The minimum horizontal (X) value on the graph.pYMin
- The minimum vertical (Y) value for the graph.pXMax
- The maximum horizontal value for the graph.pYMax
- The maximum vertical (Y) value on the graph.
public boolean setSize(double pWidth, double pHeight)
setSize
in interface GraphPaper
pWidth
- The width of the graph.pHeight
- The height of the graph.
public boolean addTransform(java.lang.Object pTransform)
toString()
is added and the return value is true.
addTransform
in interface GraphPaper
pTransform
- The transformation to apply.
public boolean addAxis(java.lang.String pKey, Axis pAxis)
Axis
to this GraphPaper
. The key argument becomes the Axis' ID attribute, it MUST NOT be null or blank! If pAxis is null
it is removed, returning true if it was there and false if not.
addAxis
in interface GraphPaper
pKey
- The identification or description of the Axis being added.pAxis
- The Axis to add.
public boolean addGraph(java.lang.String pKey, Graphable pGraph)
Graphable
to this GraphPaper
. The key argument becomes the Axis' ID attribute, it MUST NOT be null or blank! If pGraph is null
it is removed, returning true if it was there and false if not.
addGraph
in interface GraphPaper
pKey
- The String key used to identify the graph.pGraph
- The graph to add.
public boolean addPolygon(java.lang.String pKey, Polygon pPoly)
Polygon
to this GraphPaper
. The key argument becomes the Axis' ID attribute, it MUST NOT be null or blank! If pPoly is null
it is removed, returning true if it was there and false if not.
addPolygon
in interface GraphPaper
pKey
- The String key used to identify the polygon.pPoly
- The Polygon
to add.
public java.lang.Object render(java.lang.Object pContext)
render
in interface Renderable
render
in class RenderableXML
pContext
- The Context Object to be used for rendering.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |