Esempio n. 1
0
        //Craete the Connections
        private void Connect(Node headnode, Node tailnode, DecoratorShape headdecorator, DecoratorShape taildecorator)
        {
            LineConnector conn = new LineConnector();

            conn.HeadNode                  = headnode;
            conn.TailNode                  = tailnode;
            conn.HeadDecoratorShape        = headdecorator;
            conn.TailDecoratorShape        = taildecorator;
            conn.ConnectorType             = ConnectorType.Orthogonal;
            conn.LineStyle.Stroke          = new SolidColorBrush(Colors.LightSteelBlue);
            conn.TailDecoratorStyle.Stroke = new SolidColorBrush(Colors.SteelBlue);
            conn.TailDecoratorStyle.Fill   = new SolidColorBrush(Colors.SteelBlue);
            conn.HeadDecoratorStyle.Stroke = new SolidColorBrush(Colors.SteelBlue);
            conn.HeadDecoratorStyle.Fill   = new SolidColorBrush(Colors.SteelBlue);
            diagramModel.Connections.Add(conn);
        }
Esempio n. 2
0
        /// <summary>
        /// Connect the ParentNode and ChildNode
        /// </summary>
        /// <param name="parentNode">ParentNode</param>
        /// <param name="childNode">ChildNode</param>
        /// <param name="decoratorShape">DecoratorShape of the connector</param>
        /// <param name="labelText">Set the text to the label</param>
        /// <param name="OffsetX">Set the OffsetX to the label</param>
        /// <param name="OffsetY">Set the OffsetY to the label</param>
        /// <param name="DrawImage">Determines whether image should draw with label or not</param>
        /// <param name="classType">Classtype</param>
        private ConnectorBase ConnectNodes(Node parentNode, Node childNode, DecoratorShape decoratorShape, string labelText, float OffsetX, float OffsetY, bool DrawImage, int classType)
        {
            if (parentNode != null && childNode != null)
            {
                OrthogonalConnector lConnector = new OrthogonalConnector(System.Drawing.PointF.Empty, new System.Drawing.PointF(0, 1));
                lConnector.HeadDecorator.DecoratorShape = decoratorShape;
                lConnector.LineRoutingEnabled           = true;
                lConnector.LineStyle.LineColor          = Color.Goldenrod;
                lConnector.LineStyle.LineWidth          = 1;
                lConnector.CentralPort.ConnectionsLimit = 10000;

                ImageLabel imageLabel = new ImageLabel(lConnector, labelText);
                imageLabel.OffsetX      = OffsetX;
                imageLabel.OffsetY      = OffsetY;
                imageLabel.ImageOffsetX = OffsetX - 25;
                imageLabel.ImageOffsetY = OffsetY - 5;
                imageLabel.DrawImage    = DrawImage;
                if (classType == 1)
                {
                    imageLabel.TextImage = System.Drawing.Image.FromFile(@"..\..\..\..\..\..\..\Common\Images\Diagram\class diagram\6.png");
                }
                else
                {
                    imageLabel.TextImage = System.Drawing.Image.FromFile(@"..\..\..\..\..\..\..\Common\Images\Diagram\class diagram\7.png");
                }
                lConnector.Labels.Add(imageLabel);
                lConnector.HeadDecorator.Size = new System.Drawing.SizeF(12, 12);
                if (decoratorShape == DecoratorShape.Filled45Arrow)
                {
                    lConnector.HeadDecorator.FillStyle.Color = Color.White;
                }
                lConnector.HeadDecorator.LineStyle.LineColor = Color.Goldenrod;
                lConnector.LineRoutingEnabled = true;
                parentNode.CentralPort.TryConnect(lConnector.TailEndPoint);
                childNode.CentralPort.TryConnect(lConnector.HeadEndPoint);
                this.diagram1.Model.AppendChild(lConnector);
                this.diagram1.Model.SendToBack(lConnector);

                return(lConnector);
            }
            else
            {
                return(null);
            }
        }
Esempio n. 3
0
 public override void Draw()
 {
     DecoratorShape.Draw();
     SetRedBorder(DecoratorShape);
 }
Esempio n. 4
0
        //Creating the Connections and Add into DiagramModel
        private void Connect(Node head, Node tail, SolidColorBrush solidColorBrush, SolidColorBrush solidstorkebursh, DecoratorShape taildecoratorShape, DecoratorShape headdecoratorShape, ConnectorType connectorType)
        {
            LineConnector lc = new LineConnector();

            lc.HeadNode                  = head;
            lc.TailNode                  = tail;
            lc.LineStyle.Fill            = new SolidColorBrush(Colors.Black);
            lc.LineStyle.StrokeThickness = 2;
            lc.ConnectorType             = ConnectorType.Straight;
            //For Applyibf Custom Decorator Shape
            if (headdecoratorShape == DecoratorShape.Custom)
            {
                lc.CustomHeadDecoratorStyle = this.Resources["Shape6"] as Style;
            }
            else
            {
                lc.HeadDecoratorShape = headdecoratorShape;
            }
            if (taildecoratorShape == DecoratorShape.Custom)
            {
                lc.CustomTailDecoratorStyle = this.Resources["Shape4"] as Style;
            }
            else
            {
                lc.TailDecoratorShape = taildecoratorShape;
            }
            lc.HeadDecoratorShape = DecoratorShape.Diamond;
            //Apply style to Decorator Shape
            lc.HeadDecoratorStyle.Fill   = solidColorBrush;
            lc.HeadDecoratorStyle.Stroke = solidstorkebursh;
            lc.TailDecoratorStyle.Fill   = solidColorBrush;
            lc.TailDecoratorStyle.Stroke = solidstorkebursh;
            diagramModel.Connections.Add(lc);
        }
Esempio n. 5
0
        //Add the connection to DiagramModel
        private void Connect(Node headnode, Node tailnode, ConnectorType conntype, String label, DecoratorShape taildeco)
        {
            LineConnector line = new LineConnector();

            line.HeadNode           = headnode;
            line.TailNode           = tailnode;
            line.ConnectorType      = conntype;
            line.Label              = label;
            line.TailDecoratorShape = taildeco;
            diagramModel.Connections.Add(line);
        }
Esempio n. 6
0
        //Add the Lineconnector
        private LineConnector addConnection(Node headnode, Node tailnode, ConnectorType connType, DecoratorShape headdecorator, DecoratorShape taildecorator)
        {
            LineConnector conn = new LineConnector();

            conn.HeadNode      = headnode;
            conn.TailNode      = tailnode;
            conn.ConnectorType = connType;
            diagramModel.Connections.Add(conn);
            return(conn);
        }