Custom encoder for mxGraphViews. This class is created and registered dynamically at load time and used implicitly via mxCodec and the mxCodecRegistry. This codec only writes views into a XML format that can be used to create an image for the graph, that is, it contains absolute coordinates with computed perimeters, edge styles and cell styles.
mxGraphViewCodec | Custom encoder for mxGraphViews. |
Functions | |
encode | Encodes the given mxGraphView using encodeCell starting at the model’s root. |
encodeCell | Recursively encodes the specifed cell. |
codec.encode = function( enc, view )
Encodes the given mxGraphView using encodeCell starting at the model’s root. This returns the top-level graph node of the recursive encoding.
codec.encodeCell = function( enc, view, cell )
Recursively encodes the specifed cell. Uses layer as the default nodename. If the cell’s parent is null, then graph is used for the nodename. If mxGraphModel.isEdge returns true for the cell, then edge is used for the nodename, else if mxGraphModel.isVertex returns true for the cell, then vertex is used for the nodename.
mxGraph.getLabel is used to create the label attribute for the cell. For graph nodes and vertices the bounds are encoded into x, y, width and height. For edges the points are encoded into a points attribute as a space-separated list of comma-separated coordinate pairs (eg. x0,y0 x1,y1 ... xn,yn). All values from the cell style are added as attribute values to the node.
Encodes the given mxGraphView using encodeCell starting at the model’s root.
codec.encode = function( enc, view )
Recursively encodes the specifed cell.
codec.encodeCell = function( enc, view, cell )
Returns true if the given cell is an edge.
mxGraphModel.prototype.isEdge = function( cell )
Returns true if the given cell is a vertex.
mxGraphModel.prototype.isVertex = function( cell )
Returns a string or DOM node that represents the label for the given cell.
mxGraph.prototype.getLabel = function( cell )