mxGraphViewImageReader

A display XML to image converter.  This allows to create an image of a graph without having to parse and create the graph model using the XML file created for the mxGraphView object in the thin client.

To create the XML for the mxGraphView on the client

var enc = new mxCodec(mxUtils.createXMLDocument());
var node = enc.encode(editor.graph.view);
var xml = mxUtils.getXML(node);
Summary
mxGraphViewImageReaderA display XML to image converter.
Variables
canvasHolds the canvas.
scaleHolds the global scale of the graph.
parserHolds the SAX parser.
backgroundHolds the background color.
borderHolds the border size.
Functions
mxGraphViewImageReaderConstructs a new image graph view reader.
createCanvasReturns the canvas to be used for rendering.
readReads the specified view XML string.
readFileReads the specified view XML file in blocks of 4096 bytes.
startElementInvoked by the SAX parser when an element starts.
parseStateParses the bounds, absolute points and label information from the style of the state into its respective fields and returns the label of the cell.
parsePointsParses a string that represents a list of points into an array of mxPoints.
endElementInvoked by the SAX parser when an element ends.
destroyDestroy all allocated resources for this reader.
convertCreates the image for the given display XML string.
convertFileCreates the image for the given display XML file.

Variables

canvas

var $canvas

Holds the canvas.

scale

var $scale

Holds the global scale of the graph.  This is set just before createCanvas is called.

parser

var $parser

Holds the SAX parser.

background

var $background

Holds the background color.

border

var $border

Holds the border size.  Default is 0.

Functions

mxGraphViewImageReader

function mxGraphViewImageReader($background =  null,
$border =  0)

Constructs a new image graph view reader.

createCanvas

function createCanvas($attrs)

Returns the canvas to be used for rendering.

read

function read($string)

Reads the specified view XML string.

readFile

function readFile($filename)

Reads the specified view XML file in blocks of 4096 bytes.

startElement

function startElement($parser,
$name,
$attrs)

Invoked by the SAX parser when an element starts.

parseState

function parseState($state,
$edge)

Parses the bounds, absolute points and label information from the style of the state into its respective fields and returns the label of the cell.

parsePoints

function parsePoints($str)

Parses a string that represents a list of points into an array of mxPoints.

endElement

function endElement($parser,
$name)

Invoked by the SAX parser when an element ends.

destroy

function destroy()

Destroy all allocated resources for this reader.

convert

static function convert($string,  
$background =  null)

Creates the image for the given display XML string.

convertFile

static function convertFile($filename,  
$background =  null)

Creates the image for the given display XML file.

var $canvas
Holds the canvas.
var $scale
Holds the global scale of the graph.
var $parser
Holds the SAX parser.
var $background
Holds the background color.
var $border
Holds the border size.
function mxGraphViewImageReader($background =  null,
$border =  0)
Constructs a new image graph view reader.
function createCanvas($attrs)
Returns the canvas to be used for rendering.
function read($string)
Reads the specified view XML string.
function readFile($filename)
Reads the specified view XML file in blocks of 4096 bytes.
function startElement($parser,
$name,
$attrs)
Invoked by the SAX parser when an element starts.
function parseState($state,
$edge)
Parses the bounds, absolute points and label information from the style of the state into its respective fields and returns the label of the cell.
function parsePoints($str)
Parses a string that represents a list of points into an array of mxPoints.
Implements a 2-dimensional point with double precision coordinates.
function endElement($parser,
$name)
Invoked by the SAX parser when an element ends.
function destroy()
Destroy all allocated resources for this reader.
static function convert($string,  
$background =  null)
Creates the image for the given display XML string.
static function convertFile($filename,  
$background =  null)
Creates the image for the given display XML file.
Close