Beispiel #1
0
        internal static void setAllNoClear(DiagramShape obj, bool b)
        {
            DiagramPort port1 = obj as DiagramPort;

            if (port1 != null)
            {
                port1.NoClearLinks = b;
            }
            else
            {
                LineGraph link1 = obj as LineGraph;
                if (link1 != null)
                {
                    link1.NoClearPorts = b;
                }
                else
                {
                    GroupShape group1 = obj as GroupShape;
                    if (group1 != null)
                    {
                        GroupEnumerator enumerator1 = group1.GetEnumerator();
                        while (enumerator1.MoveNext())
                        {
                            GroupShape.setAllNoClear(enumerator1.Current, b);
                        }
                    }
                }
            }
        }
Beispiel #2
0
        protected virtual DiagramPort CreatePort(bool input)
        {
            DiagramPort port1 = new DiagramPort();

            port1.Size        = new SizeF(6f, 6f);
            port1.IsValidFrom = !input;
            port1.IsValidTo   = input;
            return(port1);
        }
Beispiel #3
0
        protected virtual DiagramPort CreatePort(int spot)
        {
            DiagramPort port1 = new DiagramPort();

            port1.Style    = DiagramPortStyle.None;
            port1.Size     = new SizeF(4f, 4f);
            port1.FromSpot = spot;
            port1.ToSpot   = spot;
            return(port1);
        }
Beispiel #4
0
        protected virtual DiagramPort CreatePort()
        {
            DiagramPort port1 = new DiagramPort();

            port1.Style    = DiagramPortStyle.Ellipse;
            port1.FromSpot = 0;
            port1.ToSpot   = 0;
            port1.Size     = BasicNode.DefaultPortSize;
            return(port1);
        }
Beispiel #5
0
        protected virtual DiagramPort CreatePort()
        {
            DiagramPort port1 = new DiagramPort();

            port1.Style      = DiagramPortStyle.None;
            port1.Size       = new SizeF(6f, 6f);
            port1.FromSpot   = 0;
            port1.ToSpot     = 0;
            port1.PortObject = this;
            return(port1);
        }
Beispiel #6
0
        protected virtual DiagramPort CreatePort(int Spot)
        {
            DiagramPort port = new DiagramPort();

            port.Style    = DiagramPortStyle.None;
            port.Size     = new SizeF(4f, 4f);
            port.FromSpot = Spot;
            port.ToSpot   = Spot;
            this.Add(port);

            return(port);
        }
Beispiel #7
0
        protected virtual DiagramGraph CreateShape(DiagramPort p)
        {
            DiagramGraph shape1 = new EllipseGraph();
            SizeF        ef1    = p.Size;

            shape1.Size       = new SizeF(ef1.Width + (2f * BasicNode.DefaultShapeMargin.Width), ef1.Height + (2f * BasicNode.DefaultShapeMargin.Height));
            shape1.Selectable = false;
            shape1.Resizable  = false;
            shape1.Reshapable = false;
            shape1.Brush      = DiagramGraph.Brushes_White;
            return(shape1);
        }
Beispiel #8
0
        public virtual DiagramShape CreateEndPort(bool top)
        {
            DiagramPort port1 = new DiagramPort();

            port1.Size  = new SizeF(5f, 3f);
            port1.Style = DiagramPortStyle.None;
            if (top)
            {
                port1.FromSpot = 0x20;
                port1.ToSpot   = 0x20;
                return(port1);
            }
            port1.FromSpot = 0x80;
            port1.ToSpot   = 0x80;
            return(port1);
        }
Beispiel #9
0
        public virtual DiagramShape CreatePort(bool left, int idx)
        {
            DiagramPort port1 = new DiagramPort();

            port1.Size  = new SizeF(3f, 5f);
            port1.Style = DiagramPortStyle.None;
            if (left)
            {
                port1.FromSpot = 0x100;
                port1.ToSpot   = 0x100;
                return(port1);
            }
            port1.FromSpot = 0x40;
            port1.ToSpot   = 0x40;
            return(port1);
        }
Beispiel #10
0
        private void findAllAux(DiagramShape obj, Search s, ArrayList items)
        {
            IDiagramPort port1 = obj as IDiagramPort;

            if (port1 != null)
            {
                if ((s & Search.Ports) != ((Search)0))
                {
                    this.addItem(items, port1);
                }
                DiagramPort port2 = port1 as DiagramPort;
                if (port2 != null)
                {
                    PortLinkEnumerator enumerator1 = port2.Links.GetEnumerator();
                    while (enumerator1.MoveNext())
                    {
                        IDiagramLine link1 = enumerator1.Current;
                        this.considerLink(link1, port1, s, items);
                    }
                }
                else
                {
                    foreach (IDiagramLine link2 in port1.Links)
                    {
                        this.considerLink(link2, port1, s, items);
                    }
                }
            }
            GroupShape group1 = obj as GroupShape;

            if (group1 != null)
            {
                GroupEnumerator enumerator5 = group1.GetEnumerator();
                GroupEnumerator enumerator4 = enumerator5.GetEnumerator();
                while (enumerator4.MoveNext())
                {
                    DiagramShape obj1 = enumerator4.Current;
                    this.findAllAux(obj1, s, items);
                }
            }
        }
Beispiel #11
0
 protected virtual DiagramPort CreatePort(bool input)
 {
     DiagramPort port1 = new DiagramPort();
     port1.Size = new SizeF(6f, 6f);
     port1.IsValidFrom = !input;
     port1.IsValidTo = input;
     return port1;
 }
Beispiel #12
0
 protected virtual DiagramPort CreatePort()
 {
     DiagramPort port1 = new DiagramPort();
     port1.Style = DiagramPortStyle.Ellipse;
     port1.FromSpot = 0;
     port1.ToSpot = 0;
     port1.Size = BasicNode.DefaultPortSize;
     return port1;
 }
Beispiel #13
0
 protected virtual DiagramGraph CreateShape(DiagramPort p)
 {
     DiagramGraph shape1 = new EllipseGraph();
     SizeF ef1 = p.Size;
     shape1.Size = new SizeF(ef1.Width + (2f * BasicNode.DefaultShapeMargin.Width), ef1.Height + (2f * BasicNode.DefaultShapeMargin.Height));
     shape1.Selectable = false;
     shape1.Resizable = false;
     shape1.Reshapable = false;
     shape1.Brush = DiagramGraph.Brushes_White;
     return shape1;
 }
Beispiel #14
0
        public override void LayoutChildren(DiagramShape childchanged)
        {
            if (!base.Initializing && this.Background != null)
            {
                if (this.Label != null)
                {
                    if (this.AutoResizes)
                    {
                        this.Background.Bounds = new RectangleF(
                            this.Label.Left - this.TopLeftMargin.Width,
                            this.Label.Top - this.TopLeftMargin.Height,
                            (this.Label.Width + this.TopLeftMargin.Width) + this.BottomRightMargin.Width,
                            (this.Label.Height + this.TopLeftMargin.Height) + this.BottomRightMargin.Height);
                    }
                    else
                    {
                        float width          = System.Math.Max((float)(this.Background.Width - (this.TopLeftMargin.Width + this.BottomRightMargin.Width + this.Icon.Width) - 8f), (float)0f);
                        float wrappingHeight = System.Math.Max((float)(this.Background.Height - (this.TopLeftMargin.Height + this.BottomRightMargin.Height)), (float)0f);
                        this.Label.Width         = width;
                        this.Label.WrappingWidth = System.Math.Max((float)(this.Background.Width - (this.TopLeftMargin.Width + this.BottomRightMargin.Width + this.Icon.Width)), (float)0f);;
                        this.Label.UpdateSize();
                        float height = System.Math.Min(this.Label.Height, wrappingHeight);
                        float x      = this.Background.Left + this.TopLeftMargin.Width + this.Icon.Width;
                        float offset = wrappingHeight > height ? (wrappingHeight - height) / 2 : 0;
                        float y      = this.Background.Bounds.Y + this.TopLeftMargin.Height + offset; this.Label.Bounds = new RectangleF(x, y, width, height);
                    }
                }

                if (this.LeftPorts != null && this.LeftPorts.Length > 0)
                {
                    float deltaY = this.Background.Bounds.Height / this.LeftPorts.Length;

                    for (int count = 0; count < this.LeftPorts.Length; count++)
                    {
                        DiagramPort port = this.LeftPorts[count];
                        if (port == null)
                        {
                            continue;
                        }

                        PointF tf1 = new PointF();

                        tf1.X = this.Background.Bounds.X;
                        tf1.Y = this.Background.Bounds.Y + deltaY * ((float)count + 0.5f);

                        RectangleF ef1 = port.Bounds;
                        ef1.X       = tf1.X;
                        ef1.Y       = tf1.Y - (ef1.Height / 2f);
                        port.Bounds = ef1;
                    }
                }

                if (this.RightPorts != null && this.RightPorts.Length > 0)
                {
                    float deltaY = this.Background.Bounds.Height / this.RightPorts.Length;

                    for (int count = 0; count < this.RightPorts.Length; count++)
                    {
                        DiagramPort port = this.RightPorts[count];
                        if (port == null)
                        {
                            continue;
                        }

                        PointF tf1 = new PointF();

                        tf1.X = this.Background.Bounds.X + this.Background.Bounds.Width;
                        tf1.Y = this.Background.Bounds.Y + deltaY * ((float)count + 0.5f);

                        RectangleF ef1 = port.Bounds;
                        ef1.X       = tf1.X - ef1.Width;
                        ef1.Y       = tf1.Y - (ef1.Height / 2f);
                        port.Bounds = ef1;
                    }
                }

                if (this.TopPorts != null && this.TopPorts.Length > 0)
                {
                    float deltaX = this.Background.Bounds.Width / this.TopPorts.Length;

                    for (int count = 0; count < this.TopPorts.Length; count++)
                    {
                        DiagramPort port = this.TopPorts[count];
                        if (port != null)
                        {
                            PointF tf1 = new PointF();

                            tf1.X = this.Background.Bounds.X + deltaX * ((float)count + 0.5f);
                            tf1.Y = this.Background.Bounds.Y;

                            RectangleF ef1 = port.Bounds;
                            ef1.X       = tf1.X - (ef1.Width / 2f);
                            ef1.Y       = tf1.Y;
                            port.Bounds = ef1;
                        }
                    }
                }

                if (this.BottomPorts != null && this.BottomPorts.Length > 0)
                {
                    float deltaX = this.Background.Bounds.Width / this.BottomPorts.Length;

                    for (int count = 0; count < this.BottomPorts.Length; count++)
                    {
                        DiagramPort port = this.BottomPorts[count];
                        if (port != null)
                        {
                            PointF tf1 = new PointF();

                            tf1.X = this.Background.Bounds.X + deltaX * ((float)count + 0.5f);
                            tf1.Y = this.Background.Bounds.Y + this.Background.Bounds.Height;

                            RectangleF ef1 = port.Bounds;
                            ef1.X       = tf1.X - ef1.Width / 2f;
                            ef1.Y       = tf1.Y - ef1.Height;
                            port.Bounds = ef1;
                        }
                    }
                }
            }
        }
Beispiel #15
0
 protected virtual DiagramPort CreatePort()
 {
     DiagramPort port1 = new DiagramPort();
     port1.Style = DiagramPortStyle.None;
     port1.Size = new SizeF(6f, 6f);
     port1.FromSpot = 0;
     port1.ToSpot = 0;
     port1.PortObject = this;
     return port1;
 }
Beispiel #16
0
 private void CalculateLineNoSpot(DiagramShape fromObj, DiagramPort from, DiagramShape toObj, DiagramPort to)
 {
     this.ClearPoints();
     PointF tf1 = fromObj.Center;
     PointF tf2 = toObj.Center;
     if (from == null)
     {
         if (!fromObj.GetNearestIntersectionPoint(tf2, tf1, out tf1))
         {
             tf1 = fromObj.Center;
         }
     }
     else
     {
         tf1 = from.GetFromLinkPoint(this.AbstractLink);
     }
     if (to == null)
     {
         if (!toObj.GetNearestIntersectionPoint(tf1, tf2, out tf2))
         {
             tf2 = toObj.Center;
         }
     }
     else
     {
         tf2 = to.GetToLinkPoint(this.AbstractLink);
     }
     this.AddPoint(tf1);
     this.AddPoint(tf2);
 }
Beispiel #17
0
 private void CalculateBezierNoSpot(DiagramShape fromObj, DiagramPort from, DiagramShape toObj, DiagramPort to)
 {
     this.ClearPoints();
     PointF tf1 = fromObj.Center;
     PointF tf2 = toObj.Center;
     if (from == null)
     {
         if (!fromObj.GetNearestIntersectionPoint(tf2, tf1, out tf1))
         {
             tf1 = fromObj.Center;
         }
     }
     else
     {
         tf1 = from.GetFromLinkPoint(this.AbstractLink);
     }
     if (to == null)
     {
         if (!toObj.GetNearestIntersectionPoint(tf1, tf2, out tf2))
         {
             tf2 = toObj.Center;
         }
     }
     else
     {
         tf2 = to.GetToLinkPoint(this.AbstractLink);
     }
     float single1 = tf2.X - tf1.X;
     float single2 = tf2.Y - tf1.Y;
     System.Math.Sqrt((double)((single1 * single1) + (single2 * single2)));
     float single3 = this.Curviness;
     float single4 = System.Math.Abs(single3);
     if (single3 < 0f)
     {
         single4 = -single4;
     }
     float single5 = 0f;
     float single6 = 0f;
     float single7 = tf1.X + (single1 / 3f);
     float single8 = tf1.Y + (single2 / 3f);
     float single9 = single7;
     float single10 = single8;
     if (base.IsApprox(single2, (float)0f))
     {
         if (single1 > 0f)
         {
             single10 -= single4;
         }
         else
         {
             single10 += single4;
         }
     }
     else
     {
         single5 = -single1 / single2;
         single6 = (float)System.Math.Sqrt((double)((single4 * single4) / ((single5 * single5) + 1f)));
         if (single3 < 0f)
         {
             single6 = -single6;
         }
         single9 = (((single2 < 0f) ? ((float)(-1)) : ((float)1)) * single6) + single7;
         single10 = (single5 * (single9 - single7)) + single8;
     }
     single7 = tf1.X + ((2f * single1) / 3f);
     single8 = tf1.Y + ((2f * single2) / 3f);
     float single11 = single7;
     float single12 = single8;
     if (base.IsApprox(single2, (float)0f))
     {
         if (single1 > 0f)
         {
             single12 -= single4;
         }
         else
         {
             single12 += single4;
         }
     }
     else
     {
         single11 = (((single2 < 0f) ? ((float)(-1)) : ((float)1)) * single6) + single7;
         single12 = (single5 * (single11 - single7)) + single8;
     }
     this.AddPoint(tf1);
     base.AddPoint(single9, single10);
     base.AddPoint(single11, single12);
     this.AddPoint(tf2);
     this.SetPoint(0, from.GetFromLinkPoint(this.AbstractLink));
     this.SetPoint(3, to.GetToLinkPoint(this.AbstractLink));
 }
Beispiel #18
0
 public virtual DiagramShape CreatePort(bool left, int idx)
 {
     DiagramPort port1 = new DiagramPort();
     port1.Size = new SizeF(3f, 5f);
     port1.Style = DiagramPortStyle.None;
     if (left)
     {
         port1.FromSpot = 0x100;
         port1.ToSpot = 0x100;
         return port1;
     }
     port1.FromSpot = 0x40;
     port1.ToSpot = 0x40;
     return port1;
 }
Beispiel #19
0
        protected virtual DiagramPort CreatePort(int Spot)
        {
            DiagramPort port = new DiagramPort();
            port.Style = DiagramPortStyle.None;
            port.Size = new SizeF(4f, 4f);
            port.FromSpot = Spot;
            port.ToSpot = Spot;
            this.Add(port);

            return port;
        }
Beispiel #20
0
 protected virtual DiagramPort CreatePort(int spot)
 {
     DiagramPort port1 = new DiagramPort();
     port1.Style = DiagramPortStyle.None;
     port1.Size = new SizeF(4f, 4f);
     port1.FromSpot = spot;
     port1.ToSpot = spot;
     return port1;
 }
Beispiel #21
0
 public virtual DiagramShape CreateEndPort(bool top)
 {
     DiagramPort port1 = new DiagramPort();
     port1.Size = new SizeF(5f, 3f);
     port1.Style = DiagramPortStyle.None;
     if (top)
     {
         port1.FromSpot = 0x20;
         port1.ToSpot = 0x20;
         return port1;
     }
     port1.FromSpot = 0x80;
     port1.ToSpot = 0x80;
     return port1;
 }