Exemple #1
0
        ConnectorBase dEngineParentChild_ProvideNodeConnectorInfo(NodeConnectEventArgs args)
        {
            ConnectorBase connector = null;

            if (args.NodeRelation.RelationName == "Matthew_Family")
            {
                if (args.ParentNode != null && args.ChildNode != null)
                {
                    connector = new OrgLineConnector(PointF.Empty, new PointF(0, 1));
                    connector.HeadDecorator.DecoratorShape  = DecoratorShape.Filled45Arrow;
                    connector.HeadDecorator.FillStyle.Color = Color.LightGray;
                    connector.LineStyle.LineColor           = Color.Gray;
                    connector.LineStyle.LineWidth           = 1;

                    //Connect the nodes
                    args.ParentNode.CentralPort.TryConnect(connector.TailEndPoint);
                    args.ChildNode.CentralPort.TryConnect(connector.HeadEndPoint);
                }
            }
            else if (args.NodeRelation.RelationName == "Johnson_Family")
            {
                if (args.ParentNode != null && args.ChildNode != null)
                {
                    connector = new OrgLineConnector(PointF.Empty, new PointF(0, 1));
                    connector.HeadDecorator.DecoratorShape      = DecoratorShape.Filled45Arrow;
                    connector.HeadDecorator.FillStyle.Color     = Color.Black;
                    connector.HeadDecorator.LineStyle.LineColor = Color.Black;
                    connector.LineStyle.LineColor = Color.Black;
                    connector.LineStyle.LineWidth = 1;

                    //Connect the nodes
                    args.ParentNode.CentralPort.TryConnect(connector.TailEndPoint);
                    args.ChildNode.CentralPort.TryConnect(connector.HeadEndPoint);
                }
            }
            else if (args.NodeRelation.RelationName == "Matthew_Johnson")
            {
                if (args.ParentNode != null && args.ChildNode != null)
                {
                    connector = new OrgLineConnector(PointF.Empty, new PointF(0, 1));
                    connector.HeadDecorator.DecoratorShape      = DecoratorShape.Filled45Arrow;
                    connector.HeadDecorator.FillStyle.Color     = Color.LightGreen;
                    connector.HeadDecorator.LineStyle.LineColor = Color.LightGreen;
                    connector.LineStyle.LineColor = Color.LightGreen;
                    connector.LineStyle.LineWidth = 1;

                    //Connect the nodes
                    args.ParentNode.CentralPort.TryConnect(connector.TailEndPoint);
                    args.ChildNode.CentralPort.TryConnect(connector.HeadEndPoint);
                }
            }
            return(connector);
        }
Exemple #2
0
        /// <summary>
        /// Initializes the Diagram data
        /// </summary>
        private void InitializeDiagram()
        {
            LineConnector line = new LineConnector(new PointF[] { new PointF(320, 135), new PointF(480, 135) });

            line.HeadDecorator.DecoratorShape = DecoratorShape.Filled45Arrow;
            line.HeadDecorator.Size           = new SizeF(10, 10);
            line.LineStyle.LineWidth          = 1;
            AddLabel(line, "DirectedLink", Position.BottomCenter);
            diagram1.Model.AppendChild(line);

            OrthogonalConnector orthogonalLine = new OrthogonalConnector(new PointF(50, 50), new PointF(245, 135));

            orthogonalLine.HeadDecorator.DecoratorShape = DecoratorShape.OpenFancyArrow;
            orthogonalLine.HeadDecorator.Size           = new SizeF(10, 10);
            orthogonalLine.TailDecorator.DecoratorShape = DecoratorShape.FilledFancyArrow;
            orthogonalLine.TailDecorator.Size           = new SizeF(10, 10);
            orthogonalLine.LineStyle.LineWidth          = 1;
            AddLabel(orthogonalLine, "OrthogonalLink", Position.BottomCenter);
            diagram1.Model.AppendChild(orthogonalLine);

            OrgLineConnector orgLine = new OrgLineConnector(new PointF(245, 200), new PointF(50, 285));

            orgLine.HeadDecorator.DecoratorShape = DecoratorShape.FilledDiamond;
            orgLine.HeadDecorator.Size           = new SizeF(10, 10);
            orgLine.TailDecorator.DecoratorShape = DecoratorShape.Diamond;
            orgLine.TailDecorator.Size           = new SizeF(10, 10);
            orgLine.LineStyle.LineWidth          = 1;
            AddLabel(orgLine, "OrgLineLink", Position.BottomCenter);
            diagram1.Model.AppendChild(orgLine);

            PolyLineConnector polyLine = new PolyLineConnector(new PointF[] { new PointF(320, 225), new PointF(455, 225), new PointF(320, 265), new PointF(455, 265) });

            polyLine.HeadDecorator.DecoratorShape = DecoratorShape.Circle;
            polyLine.HeadDecorator.Size           = new SizeF(10, 10);
            polyLine.TailDecorator.DecoratorShape = DecoratorShape.FilledCircle;
            polyLine.TailDecorator.Size           = new SizeF(10, 10);
            polyLine.LineStyle.LineWidth          = 1;
            AddLabel(polyLine, "PolylineLink", Position.BottomCenter);
            diagram1.Model.AppendChild(polyLine);

            SplineNode spline = new SplineNode(new PointF[] { new PointF(100, 400), new PointF(160, 430), new PointF(100, 480) });

            spline.HeadDecorator.DecoratorShape = DecoratorShape.FilledSquare;
            spline.HeadDecorator.Size           = new SizeF(10, 10);
            spline.TailDecorator.DecoratorShape = DecoratorShape.Square;
            spline.TailDecorator.Size           = new SizeF(10, 10);
            spline.LineStyle.LineWidth          = 1;
            AddLabel(spline, "Spline", Position.BottomCenter);
            diagram1.Model.AppendChild(spline);
        }
Exemple #3
0
        /// <summary>
        /// Connects the two nodes with connector
        /// </summary>
        /// <param name="parent">From Node</param>
        /// <param name="child">To Node</param>
        private void Connect(Node parent, Node child)
        {
            OrgLineConnector link = new OrgLineConnector(PointF.Empty, new PointF(1, 1));

            link.LineStyle.LineWidth               = 2;
            link.HeadDecorator.DecoratorShape      = DecoratorShape.Filled45Arrow;
            link.HeadDecorator.FillStyle.Color     = Color.Gray;
            link.HeadDecorator.LineStyle.LineColor = Color.LightGray;
            link.HeadDecorator.Size  = new SizeF(8, 8);
            link.LineStyle.LineColor = Color.LightGray;
            parent.CentralPort.Connect(link.TailEndPoint);
            child.CentralPort.Connect(link.HeadEndPoint);
            link.EditStyle.AllowSelect = false;
            diagram1.Model.AppendChild(link);
        }
Exemple #4
0
 /// <summary>
 /// connect the nodes.
 /// </summary>
 /// <param name="parentNode">parentNode</param>
 /// <param name="childNode">childNode</param>
 /// <param name="connectionColor">ConnectionColor between parentNode and childNode</param>
 private void ConnectNodes(Node parentNode, Node childNode, Color connectionColor)
 {
     if (parentNode != null && childNode != null)
     {
         OrgLineConnector lConnector = new OrgLineConnector(PointF.Empty, new PointF(0, 1));
         lConnector.HeadDecorator.DecoratorShape      = DecoratorShape.Filled45Arrow;
         lConnector.LineStyle.LineColor               = connectionColor;
         lConnector.CentralPort.ConnectionsLimit      = 10000;
         lConnector.HeadDecorator.Size                = new SizeF(10, 10);
         lConnector.HeadDecorator.FillStyle.Color     = Color.FromArgb(140, 180, 210);
         lConnector.HeadDecorator.LineStyle.LineColor = Color.SteelBlue;
         parentNode.CentralPort.TryConnect(lConnector.TailEndPoint);
         childNode.CentralPort.TryConnect(lConnector.HeadEndPoint);
         this.diagram1.Model.AppendChild(lConnector);
         this.diagram1.Model.SendToBack(lConnector);
     }
 }
Exemple #5
0
        /// <summary>
        /// Connects the nodes
        /// </summary>
        /// <param name="emplysymbol">Parent Node</param>
        /// <param name="subemplysymbol">Child node</param>
        private void ConnectNodes(Node emplysymbol, Node subemplysymbol)
        {
            OrgLineConnector ortholink = new OrgLineConnector(PointF.Empty, new PointF(0, 1));

            ortholink.LineStyle.LineWidth           = 1f;
            ortholink.LineStyle.LineColor           = Color.Black;
            ortholink.HeadDecorator.DecoratorShape  = DecoratorShape.Filled45Arrow;
            ortholink.HeadDecorator.FillStyle.Color = Color.Black;
            this.diagram1.Model.AppendChild(ortholink);

            if (emplysymbol.CentralPort != null && subemplysymbol.CentralPort != null)
            {
                emplysymbol.CentralPort.TryConnect(ortholink.TailEndPoint);
                subemplysymbol.CentralPort.TryConnect(ortholink.HeadEndPoint);
            }

            this.diagram1.Controller.SendToBack();
        }
Exemple #6
0
        ConnectorBase dEngineSelfRelation_ProvideNodeConnectorInfo(NodeConnectEventArgs args)
        {
            OrgLineConnector connector = null;

            if (args.ParentNode != null && args.ChildNode != null)
            {
                connector = new OrgLineConnector(PointF.Empty, new PointF(0, 1));
                connector.HeadDecorator.DecoratorShape      = DecoratorShape.Filled45Arrow;
                connector.HeadDecorator.LineStyle.LineColor = Color.Gray;
                connector.HeadDecorator.FillStyle.Color     = Color.LightGray;
                connector.LineStyle.LineColor = Color.Gray;
                connector.LineStyle.LineWidth = 1;
                connector.HeadDecorator.Size  = new SizeF(8, 8);
                //Connect the nodes
                args.ParentNode.CentralPort.TryConnect(connector.TailEndPoint);
                args.ChildNode.CentralPort.TryConnect(connector.HeadEndPoint);
            }
            return(connector);
        }
Exemple #7
0
        /// <summary>
        /// Iterative sub-employee symbol node creation
        /// </summary>
        /// <param name="emply">List Employees in the XML file</param>
        protected void IterCreateEmployeeSymbol(List <XMLBindinglist> emply)
        {
            foreach (XMLBindinglist subemply in emply)
            {
                Syncfusion.Windows.Forms.Diagram.Rectangle rect = new Syncfusion.Windows.Forms.Diagram.Rectangle(200, 0, 150, 60);
                rect.Name                = subemply.EmployeeID;
                rect.FillStyle.Color     = System.Drawing.Color.FromArgb(240, 242, 240);
                rect.FillStyle.ForeColor = System.Drawing.Color.White;
                rect.FillStyle.Type      = FillStyleType.LinearGradient;
                rect.LineStyle.LineColor = System.Drawing.Color.Black;
                this.diagram1.Model.AppendChild(rect);
                Syncfusion.Windows.Forms.Diagram.Label label = new Syncfusion.Windows.Forms.Diagram.Label();
                label.Container        = rect;
                label.Text             = subemply.EmployeeName;
                label.Position         = Position.Center;
                label.FontStyle.Family = "Segoe UI";
                label.FontStyle.Size   = 8;
                rect.Labels.Add(label);

                if (!string.IsNullOrEmpty(subemply.ManagerID))
                {
                    //OrthogonalConnector conn = new OrthogonalConnector(PointF.Empty, new PointF(0, 1));
                    OrgLineConnector conn = new OrgLineConnector(System.Drawing.PointF.Empty, new System.Drawing.PointF(0, 1), MeasureUnits.Pixel);
                    conn.LineStyle.LineColor = System.Drawing.Color.Black;
                    Decorator decor = conn.HeadDecorator;
                    decor.DecoratorShape      = DecoratorShape.Filled45Arrow;
                    decor.Size                = new System.Drawing.SizeF(10, 10);
                    decor.FillStyle.Color     = System.Drawing.Color.Black;
                    decor.LineStyle.LineColor = System.Drawing.Color.Black;
                    conn.VerticalDistance     = 50;
                    Syncfusion.Windows.Forms.Diagram.Rectangle rect1 = diagram1.Model.Nodes.FindNodeByName(subemply.ManagerID) as Syncfusion.Windows.Forms.Diagram.Rectangle;

                    rect1.CentralPort.TryConnect(conn.TailEndPoint);
                    rect.CentralPort.TryConnect(conn.HeadEndPoint);
                    this.diagram1.Model.AppendChild(conn);
                    // this.diagram1.Model.BringToFront(rect1);
                }
                //orgLayoutMgr.Nodes.Clear();
                //orgLayoutMgr.Nodes.AddRange(this.diagram1.Model.Nodes);
                //orgLayoutMgr.UpdateLayout(null);
            }
        }
Exemple #8
0
        /// <summary>
        /// Connects the given nodes
        /// </summary>
        /// <param name="parentNode">Parent Node</param>
        /// <param name="childNode">Child node</param>
        private void ConnectNodes(Node parentNode, Node childNode)
        {
            if (parentNode != null && childNode != null)
            {
                OrgLineConnector conn = new OrgLineConnector(PointF.Empty, new PointF(0, 1));
                conn.VerticalDistance    = 35;
                conn.LineStyle.LineColor = Color.Gray;
                Decorator decor = conn.HeadDecorator;
                decor.DecoratorShape      = DecoratorShape.Filled45Arrow;
                decor.FillStyle.Color     = Color.White;
                decor.LineStyle.LineColor = Color.Gray;

                this.diagram1.Model.AppendChild(conn);

                parentNode.CentralPort.TryConnect(conn.TailEndPoint);
                childNode.CentralPort.TryConnect(conn.HeadEndPoint);

                this.diagram1.Model.SendToBack(conn);
            }
        }
Exemple #9
0
        /// <summary>
        /// Create a new function for connect the nodes.
        /// </summary>
        /// <param name="parentNode">ParentNode</param>
        /// <param name="childNode">ChildNode</param>
        private void ConnectNodes(Node parentNode, Node childNode)
        {
            if (parentNode != null && childNode != null)
            {
                //Create a new instance for OrgLineConnector.
                OrgLineConnector orgCon = new OrgLineConnector(new PointF(0, 0), new PointF(0, 1));
                orgCon.LineStyle.LineColor = Color.SlateBlue;
                orgCon.VerticalDistance    = parentNode.BoundingRectangle.Height - 25;
                // Set the value for decorator shape.
                Decorator decor = orgCon.HeadDecorator;
                decor.DecoratorShape      = DecoratorShape.Filled45Arrow;
                decor.Size                = new SizeF(10, 10);
                decor.FillStyle.Color     = Color.SlateBlue;
                decor.LineStyle.LineColor = Color.SlateBlue;
                // add connector to Diagram control.

                parentNode.CentralPort.TryConnect(orgCon.TailEndPoint);
                childNode.CentralPort.TryConnect(orgCon.HeadEndPoint);
                this.diagram1.Model.AppendChild(orgCon);
                this.diagram1.Model.SendToBack(orgCon);
            }
        }