com.mxgraph.canvas
Class mxSvgCanvas
- java.lang.Object
-
- com.mxgraph.canvas.mxBasicCanvas
-
- com.mxgraph.canvas.mxSvgCanvas
-
- All Implemented Interfaces:
- mxICanvas
public class mxSvgCanvas extends mxBasicCanvas
An implementation of a canvas that uses SVG for painting. This canvas ignores the STYLE_LABEL_BACKGROUNDCOLOR and STYLE_LABEL_BORDERCOLOR styles due to limitations of SVG.
-
-
Field Summary
-
Fields inherited from class com.mxgraph.canvas.mxBasicCanvas
DEFAULT_IMAGEBASEPATH, PRESERVE_IMAGE_ASPECT
-
-
Constructor Summary
Constructors Constructor and Description mxSvgCanvas()Constructs a new SVG canvas for the specified dimension and scale.mxSvgCanvas(org.w3c.dom.Document document)Constructs a new SVG canvas for the specified bounds, scale and background color.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidappendSvgElement(org.w3c.dom.Element node)java.lang.ObjectdrawCell(mxCellState state)Draws the given cell.java.lang.ObjectdrawLabel(java.lang.String label, mxCellState state, boolean html)Draws the given label.org.w3c.dom.ElementdrawLine(java.util.List<mxPoint> pts, java.util.Map<java.lang.String,java.lang.Object> style)Draws the given lines as segments between all points of the given list of mxPoints.mxPointdrawMarker(org.w3c.dom.Element parent, java.lang.Object type, mxPoint p0, mxPoint pe, float size, float strokeWidth, java.lang.String color)Draws the specified marker as a child path in the given parent.org.w3c.dom.ElementdrawShape(int x, int y, int w, int h, java.util.Map<java.lang.String,java.lang.Object> style)Draws the shape specified with the STYLE_SHAPE key in the given style.java.lang.ObjectdrawText(java.lang.String text, int x, int y, int w, int h, java.util.Map<java.lang.String,java.lang.Object> style)Draws the specified text either using drawHtmlString or using drawString.org.w3c.dom.DocumentgetDocument()Returns a reference to the document that represents the canvas.org.w3c.dom.ElementgetGlassGradientElement()org.w3c.dom.ElementgetGradientElement(java.lang.String start, java.lang.String end, java.lang.String direction)java.lang.StringgetGradientId(java.lang.String start, java.lang.String end, java.lang.String direction)booleanisEmbedded()voidsetDocument(org.w3c.dom.Document document)voidsetEmbedded(boolean value)-
Methods inherited from class com.mxgraph.canvas.mxBasicCanvas
flushImageCache, getImageBasePath, getImageForStyle, getScale, getTranslate, isDrawLabels, loadImage, setDrawLabels, setImageBasePath, setScale, setTranslate
-
-
-
-
Constructor Detail
-
mxSvgCanvas
public mxSvgCanvas()
Constructs a new SVG canvas for the specified dimension and scale.
-
mxSvgCanvas
public mxSvgCanvas(org.w3c.dom.Document document)
Constructs a new SVG canvas for the specified bounds, scale and background color.
-
-
Method Detail
-
appendSvgElement
public void appendSvgElement(org.w3c.dom.Element node)
-
getGradientElement
public org.w3c.dom.Element getGradientElement(java.lang.String start, java.lang.String end, java.lang.String direction)
-
getGlassGradientElement
public org.w3c.dom.Element getGlassGradientElement()
-
getGradientId
public java.lang.String getGradientId(java.lang.String start, java.lang.String end, java.lang.String direction)
-
setDocument
public void setDocument(org.w3c.dom.Document document)
-
getDocument
public org.w3c.dom.Document getDocument()
Returns a reference to the document that represents the canvas.- Returns:
- Returns the document.
-
setEmbedded
public void setEmbedded(boolean value)
-
isEmbedded
public boolean isEmbedded()
-
drawCell
public java.lang.Object drawCell(mxCellState state)
Description copied from interface:mxICanvasDraws the given cell.- Parameters:
state- State of the cell to be painted.- Returns:
- Object that represents the cell.
-
drawLabel
public java.lang.Object drawLabel(java.lang.String label, mxCellState state, boolean html)Description copied from interface:mxICanvasDraws the given label.- Parameters:
label- String that represents the label.state- State of the cell whose label is to be painted.html- Specifies if the label contains HTML markup.- Returns:
- Object that represents the label.
-
drawShape
public org.w3c.dom.Element drawShape(int x, int y, int w, int h, java.util.Map<java.lang.String,java.lang.Object> style)Draws the shape specified with the STYLE_SHAPE key in the given style.- Parameters:
x- X-coordinate of the shape.y- Y-coordinate of the shape.w- Width of the shape.h- Height of the shape.style- Style of the the shape.
-
drawLine
public org.w3c.dom.Element drawLine(java.util.List<mxPoint> pts, java.util.Map<java.lang.String,java.lang.Object> style)
Draws the given lines as segments between all points of the given list of mxPoints.- Parameters:
pts- List of points that define the line.style- Style to be used for painting the line.
-
drawMarker
public mxPoint drawMarker(org.w3c.dom.Element parent, java.lang.Object type, mxPoint p0, mxPoint pe, float size, float strokeWidth, java.lang.String color)
Draws the specified marker as a child path in the given parent.
-
drawText
public java.lang.Object drawText(java.lang.String text, int x, int y, int w, int h, java.util.Map<java.lang.String,java.lang.Object> style)Draws the specified text either using drawHtmlString or using drawString.- Parameters:
text- Text to be painted.x- X-coordinate of the text.y- Y-coordinate of the text.w- Width of the text.h- Height of the text.style- Style to be used for painting the text.
-
-
DataMelt 3.0 © DataMelt by jWork.ORG