mxPath

An abstraction for creating VML and SVG paths.  See mxActor for using this object inside an mxShape for painting cells.

Summary
mxPathAn abstraction for creating VML and SVG paths.
Functions
mxPathConstructs a path for the given format, which is one of svg or vml.
Variables
formatDefines the format for the output of this path.
translatemxPoint that specifies the translation of the complete path.
scaleNumber that specifies the translation of the path.
pathContains the textual representation of the path as an array.
Functions
isVmlReturns true if format is vml.
getPathReturns string that represents the path in format.
setTranslateSet the global translation of this path, that is, the origin of the coordinate system.
moveToMoves the cursor to (x, y).
lineToDraws a straight line from the current poin to (x, y).
quadToDraws a quadratic Bézier curve from the current point to (x, y) using (x1, y1) as the control point.
curveToDraws a cubic Bézier curve from the current point to (x, y) using (x1, y1) as the control point at the beginning of the curve and (x2, y2) as the control point at the end of the curve.
ellipseAdds the given ellipse.
addPathAdds the given path.
writeWrites directly into the path.
endEnds the path.
closeCloses the path.

Functions

mxPath

function mxPath(format)

Constructs a path for the given format, which is one of svg or vml.

Parameters

formatString specifying the format.  May be one of vml or svg (default).

Variables

format

mxPath.prototype.format

Defines the format for the output of this path.  Possible values are svg and vml.

translate

mxPath.prototype.translate

mxPoint that specifies the translation of the complete path.

scale

mxPath.prototype.scale

Number that specifies the translation of the path.

path

mxPath.prototype.path

Contains the textual representation of the path as an array.

Functions

isVml

mxPath.prototype.isVml = function()

Returns true if format is vml.

getPath

mxPath.prototype.getPath = function()

Returns string that represents the path in format.

setTranslate

mxPath.prototype.setTranslate = function(x,
y)

Set the global translation of this path, that is, the origin of the coordinate system.

Parameters

xX-coordinate of the new origin.
yY-coordinate of the new origin.

moveTo

mxPath.prototype.moveTo = function(x,
y)

Moves the cursor to (x, y).

Parameters

xX-coordinate of the new cursor location.
yY-coordinate of the new cursor location.

lineTo

mxPath.prototype.lineTo = function(x,
y)

Draws a straight line from the current poin to (x, y).

Parameters

xX-coordinate of the endpoint.
yY-coordinate of the endpoint.

quadTo

mxPath.prototype.quadTo = function(x1,
y1,
x,
y)

Draws a quadratic Bézier curve from the current point to (x, y) using (x1, y1) as the control point.

Parameters

x1X-coordinate of the control point.
y1Y-coordinate of the control point.
xX-coordinate of the endpoint.
yY-coordinate of the endpoint.

curveTo

mxPath.prototype.curveTo = function(x1,
y1,
x2,
y2,
x,
y)

Draws a cubic Bézier curve from the current point to (x, y) using (x1, y1) as the control point at the beginning of the curve and (x2, y2) as the control point at the end of the curve.

Parameters

x1X-coordinate of the first control point.
y1Y-coordinate of the first control point.
x2X-coordinate of the second control point.
y2Y-coordinate of the second control point.
xX-coordinate of the endpoint.
yY-coordinate of the endpoint.

ellipse

mxPath.prototype.ellipse = function(x,
y,
w,
h)

Adds the given ellipse.  Some implementations may require the path to be closed after this operation.

addPath

mxPath.prototype.addPath = function(path)

Adds the given path.

write

mxPath.prototype.write = function(string)

Writes directly into the path.  This bypasses all conversions.

end

mxPath.prototype.end = function()

Ends the path.

close

mxPath.prototype.close = function()

Closes the path.

function mxPath(format)
Constructs a path for the given format, which is one of svg or vml.
mxPath.prototype.format
Defines the format for the output of this path.
mxPath.prototype.translate
mxPoint that specifies the translation of the complete path.
Implements a 2-dimensional vector with double precision coordinates.
mxPath.prototype.scale
Number that specifies the translation of the path.
mxPath.prototype.path
Contains the textual representation of the path as an array.
mxPath.prototype.isVml = function()
Returns true if format is vml.
mxPath.prototype.getPath = function()
Returns string that represents the path in format.
mxPath.prototype.setTranslate = function(x,
y)
Set the global translation of this path, that is, the origin of the coordinate system.
mxPath.prototype.moveTo = function(x,
y)
Moves the cursor to (x, y).
mxPath.prototype.lineTo = function(x,
y)
Draws a straight line from the current poin to (x, y).
mxPath.prototype.quadTo = function(x1,
y1,
x,
y)
Draws a quadratic Bézier curve from the current point to (x, y) using (x1, y1) as the control point.
mxPath.prototype.curveTo = function(x1,
y1,
x2,
y2,
x,
y)
Draws a cubic Bézier curve from the current point to (x, y) using (x1, y1) as the control point at the beginning of the curve and (x2, y2) as the control point at the end of the curve.
mxPath.prototype.ellipse = function(x,
y,
w,
h)
Adds the given ellipse.
mxPath.prototype.addPath = function(path)
Adds the given path.
mxPath.prototype.write = function(string)
Writes directly into the path.
mxPath.prototype.end = function()
Ends the path.
mxPath.prototype.close = function()
Closes the path.
Extends mxShape to implement an actor shape.
Base class for all shapes.
Close