/// <summary>
        /// Gets an enumerator for iterating over the child GoObjects of this group.
        /// </summary>
        public GoGroupEnumerator GetEnumerator()
        {
            GoGroupEnumerator result = this;

            result.Reset();
            return(result);
        }
        IEnumerator <GoObject> IEnumerable <GoObject> .GetEnumerator()
        {
            GoGroupEnumerator goGroupEnumerator = this;

            goGroupEnumerator.Reset();
            return(goGroupEnumerator);
        }
        IEnumerator IEnumerable.GetEnumerator()
        {
            GoGroupEnumerator goGroupEnumerator = this;

            goGroupEnumerator.Reset();
            return(goGroupEnumerator);
        }
Beispiel #4
0
        /// <summary>
        /// This just moves all the children from the group's former location.
        /// </summary>
        /// <param name="prevRect">
        /// The original bounds, in document coordinates.
        /// </param>
        /// <remarks>
        /// This first moves all <see cref="T:Northwoods.Go.IGoLink" />s, and then all the other child objects.
        /// </remarks>
        protected override void MoveChildren(RectangleF prevRect)
        {
            float num  = base.Left - prevRect.X;
            float num2 = base.Top - prevRect.Y;

            using (GoGroupEnumerator goGroupEnumerator = GetEnumerator())
            {
                while (goGroupEnumerator.MoveNext())
                {
                    GoObject current = goGroupEnumerator.Current;
                    if (current is IGoLink)
                    {
                        RectangleF bounds = current.Bounds;
                        current.Bounds = new RectangleF(bounds.X + num, bounds.Y + num2, bounds.Width, bounds.Height);
                    }
                }
            }
            using (GoGroupEnumerator goGroupEnumerator = GetEnumerator())
            {
                while (goGroupEnumerator.MoveNext())
                {
                    GoObject current2 = goGroupEnumerator.Current;
                    if (!(current2 is IGoLink))
                    {
                        RectangleF bounds2 = current2.Bounds;
                        current2.Bounds = new RectangleF(bounds2.X + num, bounds2.Y + num2, bounds2.Width, bounds2.Height);
                    }
                }
            }
        }
Beispiel #5
0
 /// <summary>
 /// This handles the general case of a resize by scaling and repositioning all the children.
 /// </summary>
 /// <param name="prevRect">
 /// The original bounds, in document coordinates.
 /// </param>
 /// <remarks>
 /// Any children whose <c>AutoRescales</c> property is false is not
 /// resized and repositioned.
 /// This first rescales all <see cref="T:Northwoods.Go.IGoLink" />s, and then all the other child objects.
 /// </remarks>
 protected override void RescaleChildren(RectangleF prevRect)
 {
     if (!(prevRect.Width <= 0f) && !(prevRect.Height <= 0f))
     {
         RectangleF bounds = Bounds;
         float      num    = bounds.Width / prevRect.Width;
         float      num2   = bounds.Height / prevRect.Height;
         using (GoGroupEnumerator goGroupEnumerator = GetEnumerator())
         {
             while (goGroupEnumerator.MoveNext())
             {
                 GoObject current = goGroupEnumerator.Current;
                 if (current is IGoLink && current.AutoRescales)
                 {
                     RectangleF bounds2 = current.Bounds;
                     float      x       = bounds.X + (bounds2.X - prevRect.X) * num;
                     float      y       = bounds.Y + (bounds2.Y - prevRect.Y) * num2;
                     float      width   = bounds2.Width * num;
                     float      height  = bounds2.Height * num2;
                     current.Bounds = new RectangleF(x, y, width, height);
                 }
             }
         }
         using (GoGroupEnumerator goGroupEnumerator = GetEnumerator())
         {
             while (goGroupEnumerator.MoveNext())
             {
                 GoObject current2 = goGroupEnumerator.Current;
                 if (!(current2 is IGoLink) && current2.AutoRescales)
                 {
                     RectangleF bounds3 = current2.Bounds;
                     float      x2      = bounds.X + (bounds3.X - prevRect.X) * num;
                     float      y2      = bounds.Y + (bounds3.Y - prevRect.Y) * num2;
                     float      width2  = bounds3.Width * num;
                     float      height2 = bounds3.Height * num2;
                     current2.Bounds = new RectangleF(x2, y2, width2, height2);
                 }
             }
         }
     }
 }