示例#1
0
        public override void Paint(Graphics g, DiagramView view)
        {
            bool            flag1       = view.IsPrinting;
            RectangleF      ef1         = g.ClipBounds;
            bool            flag2       = DiagramShape.ContainsRect(ef1, this.Bounds);
            GroupEnumerator enumerator2 = this.GetEnumerator();
            GroupEnumerator enumerator1 = enumerator2.GetEnumerator();

            while (enumerator1.MoveNext())
            {
                DiagramShape obj1 = enumerator1.Current;
                if (flag1 ? obj1.CanPrint() : obj1.CanView())
                {
                    bool flag3 = flag2;
                    if (!flag3)
                    {
                        RectangleF ef2 = obj1.Bounds;
                        ef2   = obj1.ExpandPaintBounds(ef2, view);
                        flag3 = DiagramShape.IntersectsRect(ef2, ef1);
                    }
                    if (flag3)
                    {
                        obj1.Paint(g, view);
                    }
                }
            }
        }
示例#2
0
        IEnumerator IEnumerable.GetEnumerator()
        {
            GroupEnumerator enumerator1 = this;

            enumerator1.Reset();
            return(enumerator1);
        }
示例#3
0
        public GroupEnumerator GetEnumerator()
        {
            GroupEnumerator enumerator1 = this;

            enumerator1.Reset();
            return(enumerator1);
        }
示例#4
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);
        }
示例#5
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);
                        }
                    }
                }
            }
        }
示例#6
0
        private void CalculatePaintBounds(DiagramView view)
        {
            base.InternalFlags &= -1048577;
            RectangleF      ef1         = this.Bounds;
            float           single1     = ef1.X;
            float           single2     = ef1.Y;
            float           single3     = single1 + ef1.Width;
            float           single4     = single2 + ef1.Height;
            GroupEnumerator enumerator2 = this.GetEnumerator();
            GroupEnumerator enumerator1 = enumerator2.GetEnumerator();

            while (enumerator1.MoveNext())
            {
                DiagramShape obj1 = enumerator1.Current;
                RectangleF   ef2  = obj1.Bounds;
                ef2     = obj1.ExpandPaintBounds(ef2, view);
                single1 = System.Math.Min(single1, ef2.X);
                single2 = System.Math.Min(single2, ef2.Y);
                single3 = System.Math.Max(single3, (float)(ef2.X + ef2.Width));
                single4 = System.Math.Max(single4, (float)(ef2.Y + ef2.Height));
            }
            if (view != null)
            {
                this.myPaintBoundsShadowOffset = this.GetShadowOffset(view);
            }
            this.myLeft   = ef1.X - single1;
            this.myTop    = ef1.Y - single2;
            this.myRight  = single3 - (ef1.X + ef1.Width);
            this.myBottom = single4 - (ef1.Y + ef1.Height);
        }
示例#7
0
 public override void LayoutChildren(DiagramShape childchanged)
 {
     if (!base.Initializing)
     {
         this.ResetPath();
         float single1 = base.Left;
         float single2 = base.Top;
         float single3 = 0f;
         float single4 = 0f;
         float single5 = this.Spacing;
         if (this.LinePenInfo != null)
         {
             single5 = System.Math.Max(this.LinePenInfo.Width, single5);
         }
         GroupEnumerator enumerator1 = base.GetEnumerator();
         while (enumerator1.MoveNext())
         {
             DiagramShape obj1 = enumerator1.Current;
             if ((obj1 != null) && obj1.CanView())
             {
                 single3 = System.Math.Max(single3, obj1.Width);
                 single4 = System.Math.Max(single4, obj1.Height);
             }
         }
         SizeF ef1     = this.TopLeftMargin;
         SizeF ef2     = this.BottomRightMargin;
         float single6 = single1 + ef1.Width;
         float single7 = single2 + ef1.Height;
         if (this.Orientation == System.Windows.Forms.Orientation.Vertical)
         {
             float single8 = single7;
             for (int num1 = 0; num1 < this.Count; num1++)
             {
                 float single9 = single8;
                 single8 = System.Math.Max(single8, this.LayoutItem(num1, new RectangleF(single6, single8, single3, single4 - single8)));
                 if (single8 > single9)
                 {
                     single8 += single5;
                 }
             }
         }
         else
         {
             float single10 = single6;
             for (int num2 = 0; num2 < this.Count; num2++)
             {
                 float single11 = single10;
                 single10 = System.Math.Max(single10, this.LayoutItem(num2, new RectangleF(single10, single7, single3 - single10, single4)));
                 if (single10 > single11)
                 {
                     single10 += single5;
                 }
             }
         }
         base.InvalidBounds = true;
     }
 }
示例#8
0
        protected virtual void CopyChildren(GroupShape newgroup, CopyDictionary env)
        {
            GroupEnumerator enumerator2 = this.GetEnumerator();
            GroupEnumerator enumerator1 = enumerator2.GetEnumerator();

            while (enumerator1.MoveNext())
            {
                DiagramShape obj1 = enumerator1.Current;
                DiagramShape obj2 = env.Copy(obj1);
                newgroup.Add(obj2);
            }
        }
示例#9
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);
 }
示例#10
0
        protected virtual void MoveChildren(RectangleF old)
        {
            float           single1     = base.Left - old.X;
            float           single2     = base.Top - old.Y;
            GroupEnumerator enumerator2 = this.GetEnumerator();
            GroupEnumerator enumerator1 = enumerator2.GetEnumerator();

            while (enumerator1.MoveNext())
            {
                DiagramShape obj1 = enumerator1.Current;
                RectangleF   ef1  = obj1.Bounds;
                obj1.Bounds = new RectangleF(ef1.X + single1, ef1.Y + single2, ef1.Width, ef1.Height);
            }
        }
示例#11
0
 public override bool ContainsPoint(PointF p)
 {
     if (DiagramShape.ContainsRect(this.Bounds, p))
     {
         GroupEnumerator enumerator2 = this.GetEnumerator();
         GroupEnumerator enumerator1 = enumerator2.GetEnumerator();
         while (enumerator1.MoveNext())
         {
             DiagramShape obj1 = enumerator1.Current;
             if (obj1.CanView() && obj1.ContainsPoint(p))
             {
                 return(true);
             }
         }
     }
     return(false);
 }
示例#12
0
        public virtual void OnItemWidthChanged(float old)
        {
            float           single1     = this.ItemWidth;
            GroupEnumerator enumerator1 = this.ListGroup.GetEnumerator();

            while (enumerator1.MoveNext())
            {
                DiagramShape obj1  = enumerator1.Current;
                DiagramText  text1 = obj1 as DiagramText;
                if ((text1 != null) && (single1 > 0f))
                {
                    text1.WrappingWidth = single1;
                }
                if ((obj1 != null) && (single1 > 0f))
                {
                    obj1.Width = single1;
                }
            }
        }
示例#13
0
 public override void LayoutChildren(DiagramShape childchanged)
 {
     if (!base.Initializing && (this.myListGroup != null))
     {
         base.Initializing = true;
         if (this.myTopPort != null)
         {
             this.myTopPort.SetSpotLocation(0x80, this.myListGroup, 0x20);
         }
         if (this.myBottomPort != null)
         {
             this.myBottomPort.SetSpotLocation(0x20, this.myListGroup, 0x80);
         }
         int             num1        = 0;
         GroupEnumerator enumerator1 = this.myListGroup.GetEnumerator();
         while (enumerator1.MoveNext())
         {
             DiagramShape obj1 = enumerator1.Current;
             if ((obj1 != null) && (num1 < this.myLeftPorts.Count))
             {
                 DiagramShape obj2 = (DiagramShape)this.myLeftPorts[num1];
                 if (obj2 != null)
                 {
                     PointF tf1 = obj1.GetSpotLocation(0x100);
                     tf1.X = this.myListGroup.Left;
                     obj2.SetSpotLocation(0x40, tf1);
                 }
             }
             if ((obj1 != null) && (num1 < this.myRightPorts.Count))
             {
                 DiagramShape obj3 = (DiagramShape)this.myRightPorts[num1];
                 if (obj3 != null)
                 {
                     PointF tf2 = obj1.GetSpotLocation(0x40);
                     tf2.X = this.myListGroup.Right;
                     obj3.SetSpotLocation(0x100, tf2);
                 }
             }
             num1++;
         }
         base.Initializing = false;
     }
 }
示例#14
0
        protected override RectangleF ComputeBounds()
        {
            RectangleF      ef1         = this.Bounds;
            bool            flag1       = false;
            GroupEnumerator enumerator2 = this.GetEnumerator();
            GroupEnumerator enumerator1 = enumerator2.GetEnumerator();

            while (enumerator1.MoveNext())
            {
                DiagramShape obj1 = enumerator1.Current;
                if (!flag1)
                {
                    ef1   = obj1.Bounds;
                    flag1 = true;
                    continue;
                }
                ef1 = DiagramShape.UnionRect(ef1, obj1.Bounds);
            }
            return(ef1);
        }
示例#15
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);
                }
            }
        }
示例#16
0
        public override bool GetNearestIntersectionPoint(PointF p1, PointF p2, out PointF result)
        {
            float           single1     = 1E+21f;
            PointF          tf2         = new PointF();
            GroupEnumerator enumerator2 = this.GetEnumerator();
            GroupEnumerator enumerator1 = enumerator2.GetEnumerator();

            while (enumerator1.MoveNext())
            {
                PointF       tf1;
                DiagramShape obj1 = enumerator1.Current;
                if (obj1.CanView() && obj1.GetNearestIntersectionPoint(p1, p2, out tf1))
                {
                    float single2 = ((tf1.X - p1.X) * (tf1.X - p1.X)) + ((tf1.Y - p1.Y) * (tf1.Y - p1.Y));
                    if (single2 < single1)
                    {
                        single1 = single2;
                        tf2     = tf1;
                    }
                }
            }
            result = tf2;
            return(single1 < 1E+21f);
        }
示例#17
0
 protected virtual void RescaleChildren(RectangleF old)
 {
     if ((old.Width > 0f) && (old.Height > 0f))
     {
         RectangleF      ef1         = this.Bounds;
         float           single1     = ef1.Width / old.Width;
         float           single2     = ef1.Height / old.Height;
         GroupEnumerator enumerator2 = this.GetEnumerator();
         GroupEnumerator enumerator1 = enumerator2.GetEnumerator();
         while (enumerator1.MoveNext())
         {
             DiagramShape obj1 = enumerator1.Current;
             if (obj1.AutoRescales)
             {
                 RectangleF ef2     = obj1.Bounds;
                 float      single3 = ef1.X + ((ef2.X - old.X) * single1);
                 float      single4 = ef1.Y + ((ef2.Y - old.Y) * single2);
                 float      single5 = ef2.Width * single1;
                 float      single6 = ef2.Height * single2;
                 obj1.Bounds = new RectangleF(single3, single4, single5, single6);
             }
         }
     }
 }