|
mxGraph 2.1.0.3 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.mxgraph.canvas.mxBasicCanvas com.mxgraph.canvas.mxSvgCanvas
public class mxSvgCanvas
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 | |
---|---|
protected Element |
defs
|
protected Document |
document
Holds the HTML document that represents the canvas. |
protected boolean |
embedded
Specifies if images should be embedded as base64 encoded strings. |
Fields inherited from class com.mxgraph.canvas.mxBasicCanvas |
---|
DEFAULT_IMAGEBASEPATH, drawLabels, imageBasePath, imageCache, PRESERVE_IMAGE_ASPECT, scale, translate |
Constructor Summary | |
---|---|
mxSvgCanvas()
Constructs a new SVG canvas for the specified dimension and scale. |
|
mxSvgCanvas(Document document)
Constructs a new SVG canvas for the specified bounds, scale and background color. |
Method Summary | |
---|---|
void |
appendSvgElement(Element node)
|
protected String |
createDataUrl(String src)
|
protected Element |
createGradientElement(String start,
String end,
String direction)
|
protected Element |
createImageElement(double x,
double y,
double w,
double h,
String src,
boolean aspect,
boolean flipH,
boolean flipV,
boolean embedded)
|
Object |
drawCell(mxCellState state)
Draws the given cell. |
Object |
drawLabel(String label,
mxCellState state,
boolean html)
Draws the given label. |
Element |
drawLine(List<mxPoint> pts,
Map<String,Object> style)
Draws the given lines as segments between all points of the given list of mxPoints. |
mxPoint |
drawMarker(Element parent,
Object type,
mxPoint p0,
mxPoint pe,
float size,
float strokeWidth,
String color)
Draws the specified marker as a child path in the given parent. |
Element |
drawShape(int x,
int y,
int w,
int h,
Map<String,Object> style)
Draws the shape specified with the STYLE_SHAPE key in the given style. |
Object |
drawText(String text,
int x,
int y,
int w,
int h,
Map<String,Object> style)
Draws the specified text either using drawHtmlString or using drawString. |
protected Element |
getDefsElement()
|
Document |
getDocument()
Returns a reference to the document that represents the canvas. |
protected Element |
getEmbeddedImageElement(String src)
|
Element |
getGlassGradientElement()
|
Element |
getGradientElement(String start,
String end,
String direction)
|
String |
getGradientId(String start,
String end,
String direction)
|
protected InputStream |
getResource(String src)
|
boolean |
isEmbedded()
|
protected boolean |
isImageResource(String src)
Returns true if the given string ends with .png, .jpg or .gif. |
void |
setDocument(Document document)
|
void |
setEmbedded(boolean value)
|
Methods inherited from class com.mxgraph.canvas.mxBasicCanvas |
---|
flushImageCache, getImageBasePath, getImageForStyle, getScale, getTranslate, isDrawLabels, loadImage, setDrawLabels, setImageBasePath, setScale, setTranslate |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected Document document
protected Element defs
protected boolean embedded
Constructor Detail |
---|
public mxSvgCanvas()
public mxSvgCanvas(Document document)
Method Detail |
---|
public void appendSvgElement(Element node)
protected Element getDefsElement()
public Element getGradientElement(String start, String end, String direction)
public Element getGlassGradientElement()
protected Element createGradientElement(String start, String end, String direction)
public String getGradientId(String start, String end, String direction)
protected boolean isImageResource(String src)
protected InputStream getResource(String src)
protected String createDataUrl(String src) throws IOException
IOException
protected Element getEmbeddedImageElement(String src)
protected Element createImageElement(double x, double y, double w, double h, String src, boolean aspect, boolean flipH, boolean flipV, boolean embedded)
public void setDocument(Document document)
public Document getDocument()
public void setEmbedded(boolean value)
public boolean isEmbedded()
public Object drawCell(mxCellState state)
mxICanvas
state
- State of the cell to be painted.
public Object drawLabel(String label, mxCellState state, boolean html)
mxICanvas
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.
public Element drawShape(int x, int y, int w, int h, Map<String,Object> style)
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.public Element drawLine(List<mxPoint> pts, Map<String,Object> style)
pts
- List of points that define the line.style
- Style to be used for painting the line.public mxPoint drawMarker(Element parent, Object type, mxPoint p0, mxPoint pe, float size, float strokeWidth, String color)
public Object drawText(String text, int x, int y, int w, int h, Map<String,Object> style)
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.
|
mxGraph 2.1.0.3 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |