Example #1
0
 private void considerLink(IDiagramLine l, IDiagramPort p, Search s, ArrayList items)
 {
     bool flag1 = (s & Search.NotSelf) == ((Search)0);
     if ((l.FromPort == p) && ((flag1 || (l.ToPort.DiagramShape == null)) || !l.ToPort.DiagramShape.IsChildOf(this)))
     {
         if ((s & Search.LinksOut) != ((Search)0))
         {
             this.addItem(items, l);
         }
         if ((s & Search.NodesOut) != ((Search)0))
         {
             this.addItem(items, l.ToNode);
         }
     }
     if ((l.ToPort == p) && ((flag1 || (l.FromPort.DiagramShape == null)) || !l.FromPort.DiagramShape.IsChildOf(this)))
     {
         if ((s & Search.LinksIn) != ((Search)0))
         {
             this.addItem(items, l);
         }
         if ((s & Search.NodesIn) != ((Search)0))
         {
             this.addItem(items, l.FromNode);
         }
     }
 }
Example #2
0
        private void considerLink(IDiagramLine l, IDiagramPort p, Search s, ArrayList items)
        {
            bool flag1 = (s & Search.NotSelf) == ((Search)0);

            if ((l.FromPort == p) && ((flag1 || (l.ToPort.DiagramShape == null)) || !l.ToPort.DiagramShape.IsChildOf(this)))
            {
                if ((s & Search.LinksOut) != ((Search)0))
                {
                    this.addItem(items, l);
                }
                if ((s & Search.NodesOut) != ((Search)0))
                {
                    this.addItem(items, l.ToNode);
                }
            }
            if ((l.ToPort == p) && ((flag1 || (l.FromPort.DiagramShape == null)) || !l.FromPort.DiagramShape.IsChildOf(this)))
            {
                if ((s & Search.LinksIn) != ((Search)0))
                {
                    this.addItem(items, l);
                }
                if ((s & Search.NodesIn) != ((Search)0))
                {
                    this.addItem(items, l.FromNode);
                }
            }
        }
Example #3
0
 internal LinkInfo(IDiagramLine l, float a, int s, float d)
 {
     this.Link      = l;
     this.Angle     = a;
     this.Side      = s;
     this.Direction = d;
 }
Example #4
0
 public virtual float GetDirection(IDiagramLine link)
 {
     if (link == null)
     {
         return(0f);
     }
     if (link.FromPort == this)
     {
         return(this.GetFromLinkDir(link));
     }
     return(this.GetToLinkDir(link));
 }
Example #5
0
        public virtual float GetAngle(IDiagramLine link)
        {
            if (link == null)
            {
                return(0f);
            }
            IDiagramPort port1 = link.GetOtherPort(this);

            if (port1 == null)
            {
                if (((link.FromPort != null) && (link.FromPort.DiagramShape != null)) && (link.FromPort.DiagramShape.Bounds == this.Bounds))
                {
                    port1 = link.ToPort;
                }
                else if (((link.ToPort != null) && (link.ToPort.DiagramShape != null)) && (link.ToPort.DiagramShape.Bounds == this.Bounds))
                {
                    port1 = link.FromPort;
                }
            }
            if (port1 == null)
            {
                return(0f);
            }
            DiagramShape obj1 = port1.DiagramShape;

            if (obj1 == null)
            {
                return(0f);
            }
            PointF tf1 = obj1.Center;
            PointF tf2 = base.Center;

            Shapes.LineGraph link1 = link as Shapes.LineGraph;
            if ((link1 == null) && (link is TextLine))
            {
                link1 = ((TextLine)link).RealLink;
            }
            if ((link1 != null) && (link1.PointsCount > 0))
            {
                if (link1.FromPort == port1)
                {
                    tf1 = link1.GetPoint(0);
                }
                else
                {
                    tf1 = link1.GetPoint(link1.PointsCount - 1);
                }
            }
            return(StrokeGraph.GetAngle(tf1.X - tf2.X, tf1.Y - tf2.Y));
        }
Example #6
0
 public virtual float GetAngle(IDiagramLine link)
 {
     if (link == null)
     {
         return 0f;
     }
     IDiagramPort port1 = link.GetOtherPort(this);
     if (port1 == null)
     {
         if (((link.FromPort != null) && (link.FromPort.DiagramShape != null)) && (link.FromPort.DiagramShape.Bounds == this.Bounds))
         {
             port1 = link.ToPort;
         }
         else if (((link.ToPort != null) && (link.ToPort.DiagramShape != null)) && (link.ToPort.DiagramShape.Bounds == this.Bounds))
         {
             port1 = link.FromPort;
         }
     }
     if (port1 == null)
     {
         return 0f;
     }
     DiagramShape obj1 = port1.DiagramShape;
     if (obj1 == null)
     {
         return 0f;
     }
     PointF tf1 = obj1.Center;
     PointF tf2 = base.Center;
     Shapes.LineGraph link1 = link as Shapes.LineGraph;
     if ((link1 == null) && (link is TextLine))
     {
         link1 = ((TextLine)link).RealLink;
     }
     if ((link1 != null) && (link1.PointsCount > 0))
     {
         if (link1.FromPort == port1)
         {
             tf1 = link1.GetPoint(0);
         }
         else
         {
             tf1 = link1.GetPoint(link1.PointsCount - 1);
         }
     }
     return StrokeGraph.GetAngle(tf1.X - tf2.X, tf1.Y - tf2.Y);
 }
Example #7
0
 public virtual bool IsOrthogonal(IDiagramLine link)
 {
     if (link != null)
     {
         Shapes.LineGraph link1 = link as Shapes.LineGraph;
         if (link1 != null)
         {
             return(link1.Orthogonal);
         }
         TextLine link2 = link as TextLine;
         if (link2 != null)
         {
             return(link2.Orthogonal);
         }
     }
     return(false);
 }
Example #8
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);
                }
            }
        }
Example #9
0
        public override float GetToLinkDir(IDiagramLine link)
        {
            if ((this.ToSpot != 0) && (this.ToSpot != 1))
            {
                return(this.GetLinkDir(this.ToSpot));
            }
            float single1 = this.GetAngle(link);

            if (this.IsOrthogonal(link))
            {
                if ((single1 >= 30f) && (single1 < 120f))
                {
                    return(90f);
                }
                if ((single1 >= 120f) && (single1 < 210f))
                {
                    return(180f);
                }
                if ((single1 >= 210f) && (single1 < 300f))
                {
                    return(270f);
                }
                return(0f);
            }
            if ((single1 > 45f) && (single1 < 135f))
            {
                return(90f);
            }
            if ((single1 >= 135f) && (single1 <= 225f))
            {
                return(180f);
            }
            if ((single1 > 225f) && (single1 < 315f))
            {
                return(270f);
            }
            return(0f);
        }
Example #10
0
        public override float GetFromLinkDir(IDiagramLine link)
        {
            if ((this.FromSpot != 0) && (this.FromSpot != 1))
            {
                return(this.GetLinkDir(this.FromSpot));
            }
            float single1 = this.GetAngle(link);

            if (this.IsOrthogonal(link))
            {
                if ((single1 >= 60f) && (single1 < 150f))
                {
                    return(90f);
                }
                if ((single1 >= 150f) && (single1 < 240f))
                {
                    return(180f);
                }
                if ((single1 >= 240f) && (single1 < 330f))
                {
                    return(270f);
                }
                return(0f);
            }
            if ((single1 > 45f) && (single1 < 135f))
            {
                return(90f);
            }
            if ((single1 >= 135f) && (single1 <= 225f))
            {
                return(180f);
            }
            if ((single1 > 225f) && (single1 < 315f))
            {
                return(270f);
            }
            return(0f);
        }
Example #11
0
 public override PointF GetFromLinkPoint(IDiagramLine link)
 {
     return(this.GetLinkPoint(this.FromSpot));
 }
Example #12
0
 internal LinkInfo[] SortLinks()
 {
     if ((this.mySortedLinks == null) || (this.mySortedLinks.Length != this.LinksCount))
     {
         this.mySortedLinks = new LinkInfo[this.LinksCount];
     }
     if (!this.myRespreading)
     {
         bool flag1 = this.myRespreading;
         this.myRespreading = true;
         int num1 = 0;
         PortLinkEnumerator enumerator1 = this.Links.GetEnumerator();
         while (enumerator1.MoveNext())
         {
             int          num2;
             IDiagramLine link1   = enumerator1.Current;
             float        single1 = this.GetDirection(link1);
             float        single2 = this.GetAngle(link1);
             if (single1 == 0f)
             {
                 num2 = 0x40;
                 if (single2 > 180f)
                 {
                     single2 -= 360f;
                 }
             }
             else if (single1 == 90f)
             {
                 num2 = 0x80;
             }
             else if (single1 == 180f)
             {
                 num2 = 0x100;
             }
             else
             {
                 num2 = 0x20;
             }
             this.mySortedLinks[num1++] = new LinkInfo(link1, single2, num2, single1);
         }
         Array.Sort(this.mySortedLinks, 0, this.mySortedLinks.Length, BoxPort.myComparer);
         int num3 = this.mySortedLinks.Length;
         int num4 = -1;
         int num5 = 0;
         num1 = 0;
         while (num1 < num3)
         {
             LinkInfo info1 = this.mySortedLinks[num1];
             if (info1.Side != num4)
             {
                 num4 = info1.Side;
                 num5 = 0;
             }
             info1.IndexOnSide = num5;
             num5++;
             num1++;
         }
         num4 = -1;
         num5 = 0;
         for (num1 = num3 - 1; num1 >= 0; num1--)
         {
             LinkInfo info2 = this.mySortedLinks[num1];
             if (info2.Side != num4)
             {
                 num4 = info2.Side;
                 num5 = info2.IndexOnSide + 1;
             }
             info2.NumOnSide = num5;
             info2.LinkPoint = this.GetSideLinkPoint(info2);
         }
         this.myRespreading = flag1;
     }
     return(this.mySortedLinks);
 }
Example #13
0
 public virtual float GetDirection(IDiagramLine link)
 {
     if (link == null)
     {
         return 0f;
     }
     if (link.FromPort == this)
     {
         return this.GetFromLinkDir(link);
     }
     return this.GetToLinkDir(link);
 }
Example #14
0
        public override PointF GetToLinkPoint(IDiagramLine link)
        {
            DiagramShape obj1 = this.PortObject;

            if ((obj1 == null) || (obj1.Layer == null))
            {
                obj1 = this;
            }
            if ((this.ToSpot != 0) && (this.ToSpot != 1))
            {
                return(obj1.GetSpotLocation(this.ToSpot));
            }
            if ((link == null) || (link.DiagramShape == null))
            {
                return(obj1.Center);
            }
            if (this.LinkPointsSpread)
            {
                LinkInfo[] infoArray1 = this.SortLinks();
                int        num1       = infoArray1.Length;
                for (int num2 = 0; num2 < num1; num2++)
                {
                    LinkInfo info1 = infoArray1[num2];
                    if (info1.Link == link)
                    {
                        return(info1.LinkPoint);
                    }
                }
            }
            float single1 = this.GetAngle(link);
            int   num3    = 1;

            if (this.IsOrthogonal(link))
            {
                if ((single1 >= 30f) && (single1 < 120f))
                {
                    num3 = 0x80;
                }
                else if ((single1 >= 120f) && (single1 < 210f))
                {
                    num3 = 0x100;
                }
                else if ((single1 >= 210f) && (single1 < 300f))
                {
                    num3 = 0x20;
                }
                else
                {
                    num3 = 0x40;
                }
            }
            else if ((single1 > 45f) && (single1 < 135f))
            {
                num3 = 0x80;
            }
            else if ((single1 >= 135f) && (single1 <= 225f))
            {
                num3 = 0x100;
            }
            else if ((single1 > 225f) && (single1 < 315f))
            {
                num3 = 0x20;
            }
            else
            {
                num3 = 0x40;
            }
            return(obj1.GetSpotLocation(num3));
        }
Example #15
0
 public override float GetFromLinkDir(IDiagramLine link)
 {
     if ((this.FromSpot != 0) && (this.FromSpot != 1))
     {
         return this.GetLinkDir(this.FromSpot);
     }
     float single1 = this.GetAngle(link);
     if (this.IsOrthogonal(link))
     {
         if ((single1 >= 60f) && (single1 < 150f))
         {
             return 90f;
         }
         if ((single1 >= 150f) && (single1 < 240f))
         {
             return 180f;
         }
         if ((single1 >= 240f) && (single1 < 330f))
         {
             return 270f;
         }
         return 0f;
     }
     if ((single1 > 45f) && (single1 < 135f))
     {
         return 90f;
     }
     if ((single1 >= 135f) && (single1 <= 225f))
     {
         return 180f;
     }
     if ((single1 > 225f) && (single1 < 315f))
     {
         return 270f;
     }
     return 0f;
 }
Example #16
0
 public override PointF GetFromLinkPoint(IDiagramLine link)
 {
     return this.GetLinkPoint(this.FromSpot);
 }
Example #17
0
 public override float GetToLinkDir(IDiagramLine link)
 {
     if ((this.ToSpot != 0) && (this.ToSpot != 1))
     {
         return this.GetLinkDir(this.ToSpot);
     }
     float single1 = this.GetAngle(link);
     if (this.IsOrthogonal(link))
     {
         if ((single1 >= 30f) && (single1 < 120f))
         {
             return 90f;
         }
         if ((single1 >= 120f) && (single1 < 210f))
         {
             return 180f;
         }
         if ((single1 >= 210f) && (single1 < 300f))
         {
             return 270f;
         }
         return 0f;
     }
     if ((single1 > 45f) && (single1 < 135f))
     {
         return 90f;
     }
     if ((single1 >= 135f) && (single1 <= 225f))
     {
         return 180f;
     }
     if ((single1 > 225f) && (single1 < 315f))
     {
         return 270f;
     }
     return 0f;
 }
Example #18
0
 public override PointF GetToLinkPoint(IDiagramLine link)
 {
     DiagramShape obj1 = this.PortObject;
     if ((obj1 == null) || (obj1.Layer == null))
     {
         obj1 = this;
     }
     if ((this.ToSpot != 0) && (this.ToSpot != 1))
     {
         return obj1.GetSpotLocation(this.ToSpot);
     }
     if ((link == null) || (link.DiagramShape == null))
     {
         return obj1.Center;
     }
     if (this.LinkPointsSpread)
     {
         LinkInfo[] infoArray1 = this.SortLinks();
         int num1 = infoArray1.Length;
         for (int num2 = 0; num2 < num1; num2++)
         {
             LinkInfo info1 = infoArray1[num2];
             if (info1.Link == link)
             {
                 return info1.LinkPoint;
             }
         }
     }
     float single1 = this.GetAngle(link);
     int num3 = 1;
     if (this.IsOrthogonal(link))
     {
         if ((single1 >= 30f) && (single1 < 120f))
         {
             num3 = 0x80;
         }
         else if ((single1 >= 120f) && (single1 < 210f))
         {
             num3 = 0x100;
         }
         else if ((single1 >= 210f) && (single1 < 300f))
         {
             num3 = 0x20;
         }
         else
         {
             num3 = 0x40;
         }
     }
     else if ((single1 > 45f) && (single1 < 135f))
     {
         num3 = 0x80;
     }
     else if ((single1 >= 135f) && (single1 <= 225f))
     {
         num3 = 0x100;
     }
     else if ((single1 > 225f) && (single1 < 315f))
     {
         num3 = 0x20;
     }
     else
     {
         num3 = 0x40;
     }
     return obj1.GetSpotLocation(num3);
 }
Example #19
0
 internal LinkInfo(IDiagramLine l, float a, int s, float d)
 {
     this.Link = l;
     this.Angle = a;
     this.Side = s;
     this.Direction = d;
 }
Example #20
0
 public virtual bool IsOrthogonal(IDiagramLine link)
 {
     if (link != null)
     {
         Shapes.LineGraph link1 = link as Shapes.LineGraph;
         if (link1 != null)
         {
             return link1.Orthogonal;
         }
         TextLine link2 = link as TextLine;
         if (link2 != null)
         {
             return link2.Orthogonal;
         }
     }
     return false;
 }
Example #21
0
 public static IDiagramNode GetOtherNode(IDiagramLine l, IDiagramNode n)
 {
     if (l.FromPort.Node == n)
     {
         return l.ToPort.Node;
     }
     if (l.ToPort.Node == n)
     {
         return l.FromPort.Node;
     }
     return null;
 }
Example #22
0
 public override PointF GetToLinkPoint(IDiagramLine link)
 {
     return this.GetLinkPoint(this.ToSpot);
 }
Example #23
0
 public static IDiagramPort GetOtherPort(IDiagramLine l, IDiagramPort p)
 {
     if (l.FromPort == p)
     {
         return l.ToPort;
     }
     if (l.ToPort == p)
     {
         return l.FromPort;
     }
     return null;
 }
Example #24
0
 public override PointF GetToLinkPoint(IDiagramLine link)
 {
     return(this.GetLinkPoint(this.ToSpot));
 }