Exemplo n.º 1
0
        internal static DiagramText FindLabel(DiagramShape obj)
        {
            DiagramText text1 = obj as DiagramText;

            if (text1 != null)
            {
                return(text1);
            }
            GroupShape group1 = obj as GroupShape;

            if (group1 != null)
            {
                GroupEnumerator enumerator2 = group1.GetEnumerator();
                GroupEnumerator enumerator1 = enumerator2.GetEnumerator();
                while (enumerator1.MoveNext())
                {
                    DiagramText text2 = DiagramNode.FindLabel(enumerator1.Current);
                    if (text2 != null)
                    {
                        return(text2);
                    }
                }
            }
            return(null);
        }
Exemplo n.º 2
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);
                        }
                    }
                }
            }
        }
Exemplo n.º 3
0
 private Shapes.IDiagramPort pickNearestPort1(Shapes.DiagramShape obj, PointF dc, Shapes.IDiagramPort bestPort, ref float bestDist)
 {
     Shapes.IDiagramPort port1 = obj as Shapes.IDiagramPort;
     if (port1 != null)
     {
         PointF tf1     = this.PortPoint(port1, dc);
         float  single1 = dc.X - tf1.X;
         float  single2 = dc.Y - tf1.Y;
         float  single3 = (single1 * single1) + (single2 * single2);
         if (single3 <= bestDist)
         {
             object obj1 = null;
             if (this.ValidPortsCache != null)
             {
                 obj1 = this.ValidPortsCache[port1];
             }
             if (obj1 == ToolLinking.Valid)
             {
                 bestPort = port1;
                 bestDist = single3;
             }
             else if (obj1 != ToolLinking.Invalid)
             {
                 if ((this.Forwards && this.IsValidLink(this.OriginalStartPort, port1)) || (!this.Forwards && this.IsValidLink(port1, this.OriginalStartPort)))
                 {
                     if (this.ValidPortsCache != null)
                     {
                         this.ValidPortsCache[port1] = ToolLinking.Valid;
                     }
                     bestPort = port1;
                     bestDist = single3;
                 }
                 else if (this.ValidPortsCache != null)
                 {
                     this.ValidPortsCache[port1] = ToolLinking.Invalid;
                 }
             }
         }
     }
     Shapes.GroupShape group1 = obj as Shapes.GroupShape;
     if (group1 != null)
     {
         Shapes.GroupEnumerator enumerator2 = group1.GetEnumerator();
         Shapes.GroupEnumerator enumerator1 = enumerator2.GetEnumerator();
         while (enumerator1.MoveNext())
         {
             Shapes.DiagramShape obj2 = enumerator1.Current;
             bestPort = this.pickNearestPort1(obj2, dc, bestPort, ref bestDist);
         }
     }
     return(bestPort);
 }
Exemplo n.º 4
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);
                }
            }
        }