/// <summary> /// Inserts the given cell into its parent and terminal cells. /// </summary> /// <param name="cell"></param> public void InsertIntoGraph(mxICell cell) { mxICell parent = cell.Parent; mxICell source = cell.GetTerminal(true); mxICell target = cell.GetTerminal(false); // Fixes possible inconsistencies during insert into graph cell.SetTerminal(null, false); cell.SetTerminal(null, true); cell.Parent = null; if (parent != null) { parent.Insert(cell); } if (source != null) { source.InsertEdge(cell, true); } if (target != null) { target.InsertEdge(cell, false); } }
/* (non-Dotnetdoc) * see com.mxgraph.mxIGraphModel.SetTerminal(Object, Object, bool) */ public Object SetTerminal(Object edge, Object terminal, bool isSource) { mxICell mxe = (mxICell)edge; mxICell previous = mxe.GetTerminal(isSource); BeginUpdate(); try { if (terminal != null) { ((mxICell)terminal).InsertEdge(mxe, isSource); } else if (previous != null) { previous.RemoveEdge(mxe, isSource); } } finally { EndUpdate(); } if (IsMaintainEdgeParent) { UpdateEdgeParent(edge, Root); } return(terminal); }
/* (non-Dotnetdoc) * see com.mxgraph.mxICell.RemoveEdge(mxICell, bool) */ public mxICell RemoveEdge(mxICell edge, bool isOutgoing) { if (edge != null) { if (edge.GetTerminal(!isOutgoing) != this && edges != null) { edges.Remove(edge); } edge.SetTerminal(null, isOutgoing); } return(edge); }
/* (non-Dotnetdoc) * see com.mxgraph.mxICell.InsertEdge(mxICell, bool) */ public mxICell InsertEdge(mxICell edge, bool isOutgoing) { if (edge != null) { edge.RemoveFromTerminal(isOutgoing); edge.SetTerminal(this, isOutgoing); if (edges == null || edge.GetTerminal(!isOutgoing) != this || !edges.Contains(edge)) { if (edges == null) { edges = new List <mxICell>(); } edges.Add(edge); } } return(edge); }
/* (non-Dotnetdoc) * see com.mxgraph.mxICell.RemoveEdge(mxICell, bool) */ public mxICell RemoveEdge(mxICell edge, bool isOutgoing) { if (edge != null) { if (edge.GetTerminal(!isOutgoing) != this && edges != null) { edges.Remove(edge); } edge.SetTerminal(null, isOutgoing); } return edge; }
/* (non-Dotnetdoc) * see com.mxgraph.mxICell.InsertEdge(mxICell, bool) */ public mxICell InsertEdge(mxICell edge, bool isOutgoing) { if (edge != null) { edge.RemoveFromTerminal(isOutgoing); edge.SetTerminal(this, isOutgoing); if (edges == null || edge.GetTerminal(!isOutgoing) != this || !edges.Contains(edge)) { if (edges == null) { edges = new List<mxICell>(); } edges.Add(edge); } } return edge; }