mxParallelEdgeLayout

Extends mxGraphLayout for arranging parallel edges.  This layout works on edges for all pairs of vertices where there is more than one edge connecting the latter.

Example

var layout = new mxParallelEdgeLayout(graph);
layout.execute(graph.getDefaultParent());

To run the layout for the parallel edges of a changed edge only, the following code can be used.

var layout = new mxParallelEdgeLayout(graph);

graph.addListener(mxEvent.CELL_CONNECTED, function(sender, evt)
{
  var model = graph.getModel();
  var edge = evt.getProperty('edge');
  var src = model.getTerminal(edge, true);
  var trg = model.getTerminal(edge, false);

  layout.isEdgeIgnored = function(edge2)
  {
    var src2 = model.getTerminal(edge2, true);
    var trg2 = model.getTerminal(edge2, false);

    return !(model.isEdge(edge2) && ((src == src2 && trg == trg2) || (src == trg2 && trg == src2)));
  };

  layout.execute(graph.getDefaultParent());
});
Summary
mxParallelEdgeLayoutExtends mxGraphLayout for arranging parallel edges.
Functions
mxParallelEdgeLayoutConstructs a new parallel edge layout for the specified graph.
Variables
spacingDefines the spacing between the parallels.
Functions
executeImplements mxGraphLayout.execute.
findParallelsFinds the parallel edges in the given parent.
getEdgeIdReturns a unique ID for the given edge.
layoutLays out the parallel edges in the given array.
routeRoutes the given edge via the given point.

Functions

mxParallelEdgeLayout

function mxParallelEdgeLayout(graph)

Constructs a new parallel edge layout for the specified graph.

Variables

spacing

mxParallelEdgeLayout.prototype.spacing

Defines the spacing between the parallels.  Default is 20.

Functions

execute

mxParallelEdgeLayout.prototype.execute = function(parent)

Implements mxGraphLayout.execute.

findParallels

mxParallelEdgeLayout.prototype.findParallels = function(parent)

Finds the parallel edges in the given parent.

getEdgeId

mxParallelEdgeLayout.prototype.getEdgeId = function(edge)

Returns a unique ID for the given edge.  The id is independent of the edge direction and is built using the visible terminal of the given edge.

layout

mxParallelEdgeLayout.prototype.layout = function(parallels)

Lays out the parallel edges in the given array.

route

mxParallelEdgeLayout.prototype.route = function(edge,
x,
y)

Routes the given edge via the given point.

Base class for all layout algorithms in mxGraph.
function mxParallelEdgeLayout(graph)
Constructs a new parallel edge layout for the specified graph.
mxParallelEdgeLayout.prototype.spacing
Defines the spacing between the parallels.
mxParallelEdgeLayout.prototype.execute = function(parent)
Implements mxGraphLayout.execute.
mxGraphLayout.prototype.execute = function(parent)
Executes the layout algorithm for the children of the given parent.
mxParallelEdgeLayout.prototype.findParallels = function(parent)
Finds the parallel edges in the given parent.
mxParallelEdgeLayout.prototype.getEdgeId = function(edge)
Returns a unique ID for the given edge.
mxParallelEdgeLayout.prototype.layout = function(parallels)
Lays out the parallel edges in the given array.
mxParallelEdgeLayout.prototype.route = function(edge,
x,
y)
Routes the given edge via the given point.
Close