Class SVGGraphWriter
java.lang.Object
com.jgraph.io.svg.SVGGraphWriter
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected SVGEdgeWriterHolds the object that creates the SVG code for edges.static doubleThe assumes proportion between the font height and the average character width.protected MapHolds the gradients created dynamically during the rendering process and added later to the defs part of the SVG output.static FontSpecifies the font used for the title of the diagram.static StringSpecifies the color the diagram title.static intSpecifies the spacing between the title and the diagram.protected SVGVertexWriterHolds object that creates the SVG code for vertices.protected RectangleHolds the bounds of the graph. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected NodecreateDropShadowFilter(Document document, int fuzziness, int dx, int dy) This implements the official recommended way of a drop shadow.protected NodecreateGradient(Document document, String id, String startColor, String endColor) Creates a new gradient element to be used my multiple cells.protected NodecreateNode(Document document, String title, GraphLayoutCache cache, int inset) protected NodecreateRoot(Document document, double w, double h, int inset) Creates the root SVG node with the basic information.createShapeNode(Document document, int shapeType, Rectangle2D bounds, double dx, double dy, String hexBackground, String hexGradient, String hexLineColor, float lineWidth, double opacity, boolean dropShadow) Creates a rect or ellipse element based on the specified values.createTextNode(Document document, String label, String align, Font font, String hexFontColor, int middleX, int y) Creates a new text element for the specified details.getGradient(Document document, String startColor, String endColor) Returns or creates a gradient object for the specified colors.Object[]Returns the labels for a graph cell as an object array.voidwrite(OutputStream out, String title, GraphLayoutCache cache, int inset) Writes the SVG.
-
Field Details
-
TITLE_FONT
Specifies the font used for the title of the diagram. -
TITLE_VSPACING
public static int TITLE_VSPACINGSpecifies the spacing between the title and the diagram. -
FONT_PROPORTION_FACTOR
public static double FONT_PROPORTION_FACTORThe assumes proportion between the font height and the average character width. -
TITLE_HEXCOLOR
Specifies the color the diagram title. -
vertexFactory
Holds object that creates the SVG code for vertices. -
edgeFactory
Holds the object that creates the SVG code for edges. -
gradients
Holds the gradients created dynamically during the rendering process and added later to the defs part of the SVG output. -
viewBox
Holds the bounds of the graph.
-
-
Constructor Details
-
SVGGraphWriter
public SVGGraphWriter()
-
-
Method Details
-
write
Writes the SVG. -
createNode
protected Node createNode(Document document, String title, GraphLayoutCache cache, int inset) throws ParserConfigurationException - Throws:
ParserConfigurationException
-
createRoot
-
getGradient
-
createGradient
-
createShapeNode
public Node createShapeNode(Document document, int shapeType, Rectangle2D bounds, double dx, double dy, String hexBackground, String hexGradient, String hexLineColor, float lineWidth, double opacity, boolean dropShadow) Creates a rect or ellipse element based on the specified values.- Parameters:
document-shapeType-bounds-dx-dy-hexBackground-hexGradient-hexLineColor-lineWidth-opacity-dropShadow-- Returns:
- a node detailing the shape on a vertex element
-
createTextNode
public Node createTextNode(Document document, String label, String align, Font font, String hexFontColor, int middleX, int y) Creates a new text element for the specified details.- Parameters:
document-label-align-font-hexFontColor-middleX-y-- Returns:
- a node detailing the label on a cell element
-
createDropShadowFilter
This implements the official recommended way of a drop shadow. However, it does not work with the SVG Plugin. We use a second shape behind the main shape as a workaround. This element is currently not added to the SVG output. See createNodeShape. -
getLabels
-