internal DEdge(DNode source, DNode target, DrawingEdge drawingEdgeParam, ConnectionToGraph connection) : base(source.ParentObject) { this.DrawingEdge = drawingEdgeParam; this.Source = source; this.Target = target; if (connection == ConnectionToGraph.Connected) { if (source == target) { source.AddSelfEdge(this); } else { source.AddOutEdge(this); target.AddInEdge(this); } } if (drawingEdgeParam.Label != null) { this.Label = new DTextLabel(this, DrawingEdge.Label); } }
internal DEdge(DNode source, DNode target, DrawingEdge drawingEdgeParam, ConnectionToGraph connection, GViewer gviewer) : base(gviewer) { DrawingEdge = drawingEdgeParam; Source = source; Target = target; if (connection == ConnectionToGraph.Connected) { if (source == target) { source.AddSelfEdge(this); } else { source.AddOutEdge(this); target.AddInEdge(this); } } if (drawingEdgeParam.Label != null) { Label = new DLabel(this, drawingEdge.Label, gviewer); } }
/// <summary> /// a helper function creating a geometry node /// </summary> /// <param name="drawingGraph"> </param> /// <param name="geometryGraph"></param> /// <param name="node"></param> /// <param name="connection">controls if the node is connected to the graph</param> /// <returns></returns> public static Core.Layout.Node CreateGeometryNode(Graph drawingGraph, GeometryGraph geometryGraph, Node node, ConnectionToGraph connection) { var geomNode = new Core.Layout.Node(); if (connection == ConnectionToGraph.Connected) { geometryGraph.Nodes.Add(geomNode); } node.GeometryNode = geomNode; geomNode.UserData = node; geomNode.Padding = node.Attr.Padding; return(geomNode); }
/// <summary> /// creates a detached edge /// </summary> /// <param name="sourceNode"></param> /// <param name="targetNode"></param> /// <param name="connection">controls is the edge will be connected to the graph</param> public Edge(Node sourceNode, Node targetNode, ConnectionToGraph connection) : this(sourceNode.Id, null, targetNode.Id) { this.SourceNode = sourceNode; this.TargetNode = targetNode; if (connection == ConnectionToGraph.Connected) { if (sourceNode == targetNode) { sourceNode.AddSelfEdge(this); } else { sourceNode.AddOutEdge(this); targetNode.AddInEdge(this); } } }
internal DEdge(DNode source, DNode target, DrawingEdge drawingEdgeParam, ConnectionToGraph connection, GViewer gviewer) : base(gviewer) { DrawingEdge = drawingEdgeParam; Source = source; Target = target; if (connection == ConnectionToGraph.Connected) { if (source == target) source.AddSelfEdge(this); else { source.AddOutEdge(this); target.AddInEdge(this); } } if (drawingEdgeParam.Label != null) Label = new DLabel(this, drawingEdge.Label, gviewer); }
internal DEdge(DNode source, DNode target, DrawingEdge drawingEdgeParam, ConnectionToGraph connection) : base(source.ParentObject) { this.DrawingEdge = drawingEdgeParam; this.Source = source; this.Target = target; if (connection == ConnectionToGraph.Connected) { if (source == target) source.AddSelfEdge(this); else { source.AddOutEdge(this); target.AddInEdge(this); } } if (drawingEdgeParam.Label != null) this.Label = new DTextLabel(this, DrawingEdge.Label); }
/// <summary> /// a helper function creating a geometry node /// </summary> /// <param name="drawingGraph"> </param> /// <param name="geometryGraph"></param> /// <param name="node"></param> /// <param name="connection">controls if the node is connected to the graph</param> /// <returns></returns> public static Core.Layout.Node CreateGeometryNode(Graph drawingGraph, GeometryGraph geometryGraph, Node node, ConnectionToGraph connection) { var geomNode = new Core.Layout.Node(); if (connection == ConnectionToGraph.Connected) geometryGraph.Nodes.Add(geomNode); node.GeometryNode = geomNode; geomNode.UserData = node; geomNode.Padding = node.Attr.Padding; return geomNode; }
void CreateNodeGeometry(DrawingNode node, Graph graph, GeometryGraph geometryGraph, GeometryPoint center, ConnectionToGraph connectionTo = ConnectionToGraph.Connected) { double width, height; StringMeasure.MeasureWithFont(node.Label.Text, new Font(node.Label.FontName, (float)node.Label.FontSize, (System.Drawing.FontStyle)(int) node.Label.FontStyle), out width, out height); node.Label.Width = width; node.Label.Height = height; if (node.Label != null) { width += 2 * node.Attr.LabelMargin; height += 2 * node.Attr.LabelMargin; } if (width < graph.Attr.MinNodeWidth) { width = graph.Attr.MinNodeWidth; } if (height < graph.Attr.MinNodeHeight) { height = graph.Attr.MinNodeHeight; } Node geomNode = node.GeometryNode = GeometryGraphCreator.CreateGeometryNode(graph, geometryGraph, node, connectionTo); geomNode.BoundaryCurve = NodeBoundaryCurves.GetNodeBoundaryCurve(node, width, height); geomNode.BoundaryCurve.Translate(center); geomNode.Center = center; }
/// <summary> /// creates a detached edge /// </summary> /// <param name="sourceNode"></param> /// <param name="targetNode"></param> /// <param name="connection">controls is the edge will be connected to the graph</param> public Edge(Node sourceNode, Node targetNode, ConnectionToGraph connection) : this(sourceNode.Id, null, targetNode.Id) { this.SourceNode = sourceNode; this.TargetNode = targetNode; if (connection == ConnectionToGraph.Connected) { if (sourceNode == targetNode) sourceNode.AddSelfEdge(this); else { sourceNode.AddOutEdge(this); targetNode.AddInEdge(this); } } }