public class SVGGraphWriter
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected SVGEdgeWriter |
edgeFactory
Holds the object that creates the SVG code for edges.
|
static double |
FONT_PROPORTION_FACTOR
The assumes proportion between the font height and the average character
width.
|
protected java.util.Map |
gradients
Holds the gradients created dynamically during the rendering process and
added later to the defs part of the SVG output.
|
static java.awt.Font |
TITLE_FONT
Specifies the font used for the title of the diagram.
|
static java.lang.String |
TITLE_HEXCOLOR
Specifies the color the diagram title.
|
static int |
TITLE_VSPACING
Specifies the spacing between the title and the diagram.
|
protected SVGVertexWriter |
vertexFactory
Holds object that creates the SVG code for vertices.
|
protected java.awt.Rectangle |
viewBox
Holds the bounds of the graph.
|
Constructor and Description |
---|
SVGGraphWriter() |
Modifier and Type | Method and Description |
---|---|
protected org.w3c.dom.Node |
createDropShadowFilter(org.w3c.dom.Document document,
int fuzziness,
int dx,
int dy)
This implements the official recommended way of a drop shadow.
|
protected org.w3c.dom.Node |
createGradient(org.w3c.dom.Document document,
java.lang.String id,
java.lang.String startColor,
java.lang.String endColor)
Creates a new gradient element to be used my multiple cells.
|
protected org.w3c.dom.Node |
createNode(org.w3c.dom.Document document,
java.lang.String title,
GraphLayoutCache cache,
int inset) |
protected org.w3c.dom.Node |
createRoot(org.w3c.dom.Document document,
double w,
double h,
int inset)
Creates the root SVG node with the basic information.
|
org.w3c.dom.Node |
createShapeNode(org.w3c.dom.Document document,
int shapeType,
java.awt.geom.Rectangle2D bounds,
double dx,
double dy,
java.lang.String hexBackground,
java.lang.String hexGradient,
java.lang.String hexLineColor,
float lineWidth,
double opacity,
boolean dropShadow)
Creates a rect or ellipse element based on the specified values.
|
org.w3c.dom.Node |
createTextNode(org.w3c.dom.Document document,
java.lang.String label,
java.lang.String align,
java.awt.Font font,
java.lang.String hexFontColor,
int middleX,
int y)
Creates a new text element for the specified details.
|
org.w3c.dom.Node |
getGradient(org.w3c.dom.Document document,
java.lang.String startColor,
java.lang.String endColor)
Returns or creates a gradient object for the specified colors.
|
java.lang.Object[] |
getLabels(CellView view)
Returns the labels for a graph cell as an object array.
|
void |
write(java.io.OutputStream out,
java.lang.String title,
GraphLayoutCache cache,
int inset)
Writes the SVG.
|
public static java.awt.Font TITLE_FONT
public static int TITLE_VSPACING
public static double FONT_PROPORTION_FACTOR
public static java.lang.String TITLE_HEXCOLOR
protected SVGVertexWriter vertexFactory
protected SVGEdgeWriter edgeFactory
protected java.util.Map gradients
protected java.awt.Rectangle viewBox
public void write(java.io.OutputStream out, java.lang.String title, GraphLayoutCache cache, int inset)
protected org.w3c.dom.Node createNode(org.w3c.dom.Document document, java.lang.String title, GraphLayoutCache cache, int inset) throws javax.xml.parsers.ParserConfigurationException
javax.xml.parsers.ParserConfigurationException
protected org.w3c.dom.Node createRoot(org.w3c.dom.Document document, double w, double h, int inset)
document
- w
- h
- inset
- public org.w3c.dom.Node getGradient(org.w3c.dom.Document document, java.lang.String startColor, java.lang.String endColor)
document
- startColor
- endColor
- protected org.w3c.dom.Node createGradient(org.w3c.dom.Document document, java.lang.String id, java.lang.String startColor, java.lang.String endColor)
document
- id
- startColor
- endColor
- public org.w3c.dom.Node createShapeNode(org.w3c.dom.Document document, int shapeType, java.awt.geom.Rectangle2D bounds, double dx, double dy, java.lang.String hexBackground, java.lang.String hexGradient, java.lang.String hexLineColor, float lineWidth, double opacity, boolean dropShadow)
document
- shapeType
- bounds
- dx
- dy
- hexBackground
- hexGradient
- hexLineColor
- lineWidth
- opacity
- dropShadow
- public org.w3c.dom.Node createTextNode(org.w3c.dom.Document document, java.lang.String label, java.lang.String align, java.awt.Font font, java.lang.String hexFontColor, int middleX, int y)
document
- label
- align
- font
- hexFontColor
- middleX
- y
- protected org.w3c.dom.Node createDropShadowFilter(org.w3c.dom.Document document, int fuzziness, int dx, int dy)
public java.lang.Object[] getLabels(CellView view)
view
- Copyright (C) 2001-2009 JGraph Ltd. All rights reserved.