Example #1
0
        public static Rect2D PolygonBoundary(IPolygonReader[] apoly, ITransEngine2D mat)
        {
            if (apoly == null)
            {
                throw (new ArgumentNullException("PolygonsBoundary(apoly)"));
            }
            Rect2D ret = Rect.Empty;
            Rect2D p;

            for (int i = 0; i < apoly.Length; i++)
            {
                p = PolygonBoundary(apoly[i], mat);
                if (ret.IsEmpty)
                {
                    ret = p;
                }
                else
                {
                    ret.Union(p);
                }
            }
            return(ret);
        }
Example #2
0
 //
 // Summary:
 //     Creates a rectangle that is exactly large enough to contain the two specified
 //     rectangles.
 //
 // Parameters:
 //   rect1:
 //     The first rectangle to include.
 //
 //   rect2:
 //     The second rectangle to include.
 //
 // Returns:
 //     The resulting rectangle.
 public static Rect2D Union(Rect2D rect1, Rect2D rect2)
 {
     return(new Rect2D(Rect.Union(rect1.myRc, rect2.myRc)));
 }
Example #3
0
 //
 // Summary:
 //     Creates a rectangle that is exactly large enough to include the specified
 //     rectangle and the specified point.
 //
 // Parameters:
 //   rect:
 //     The rectangle to include.
 //
 //   point:
 //     The point to include.
 //
 // Returns:
 //     A rectangle that is exactly large enough to contain the specified rectangle
 //     and the specified point.
 public static Rect2D Union(Rect2D rect, Point point)
 {
     return(new Rect2D(Rect.Union(rect.myRc, point)));
 }
Example #4
0
 //
 // Summary:
 //     Expands the current rectangle exactly enough to contain the specified rectangle.
 //
 // Parameters:
 //   rect:
 //     The rectangle to include.
 public void Union(Rect2D rect)
 {
     myRc.Union(rect.myRc);
 }
Example #5
0
 //
 // Summary:
 //     Returns the rectangle that results from applying the specified matrix to
 //     the specified rectangle.
 //
 // Parameters:
 //   rect:
 //     A rectangle that is the basis for the transformation.
 //
 //   matrix:
 //     A matrix that specifies the transformation to apply.
 //
 // Returns:
 //     The rectangle that results from the operation.
 public static Rect2D Transform(Rect2D rect, Matrix matrix)
 {
     return(new Rect2D(Rect.Transform(rect.myRc, matrix)));
 }
Example #6
0
 //
 // Summary:
 //     Returns a rectangle that is offset from the specified rectangle by using
 //     the specified horizontal and vertical amounts.
 //
 // Parameters:
 //   rect:
 //     The rectangle to move.
 //
 //   offsetX:
 //     The horizontal offset for the new rectangle.
 //
 //   offsetY:
 //     The vertical offset for the new rectangle.
 //
 // Returns:
 //     The resulting rectangle.
 //
 // Exceptions:
 //   System.InvalidOperationException:
 //     rect is IdaRs.GiCL2D.Rect2D.Empty.
 public static Rect2D Offset(Rect2D rect, double offsetX, double offsetY)
 {
     return(new Rect2D(Rect.Offset(rect.myRc, offsetX, offsetY)));
 }
Example #7
0
 //
 // Summary:
 //     Returns a rectangle that is offset from the specified rectangle by using
 //     the specified vector.
 //
 // Parameters:
 //   rect:
 //     The original rectangle.
 //
 //   offsetVector:
 //     A vector that specifies the horizontal and vertical offsets for the new rectangle.
 //
 // Returns:
 //     The resulting rectangle.
 //
 // Exceptions:
 //   System.InvalidOperationException:
 //     rect is IdaRs.GiCL2D.Rect2D.Empty.
 public static Rect2D Offset(Rect2D rect, Vector offsetVector)
 {
     return(new Rect2D(Rect.Offset(rect.myRc, offsetVector)));
 }
Example #8
0
 //
 // Summary:
 //     Indicates whether the specified rectangle intersects with the current rectangle.
 //
 // Parameters:
 //   rect:
 //     The rectangle to check.
 //
 // Returns:
 //     true if the specified rectangle intersects with the current rectangle; otherwise,
 //     false.
 public bool IntersectsWith(Rect2D rect)
 {
     return(myRc.IntersectsWith(rect.myRc));
 }
Example #9
0
 //
 // Summary:
 //     Returns the intersection of the specified rectangles.
 //
 // Parameters:
 //   rect1:
 //     The first rectangle to compare.
 //
 //   rect2:
 //     The second rectangle to compare.
 //
 // Returns:
 //     The intersection of the two rectangles, or IdaRs.GiCL2D.Rect2D.Empty if no
 //     intersection exists.
 public static Rect2D Intersect(Rect2D rect1, Rect2D rect2)
 {
     return(new Rect2D(Rect.Intersect(rect1.myRc, rect2.myRc)));
 }
Example #10
0
 //
 // Summary:
 //     Finds the intersection of the current rectangle and the specified rectangle,
 //     and stores the result as the current rectangle.
 //
 // Parameters:
 //   rect:
 //     The rectangle to intersect with the current rectangle.
 public void Intersect(Rect2D rect)
 {
     myRc.Intersect(rect.myRc);
 }
Example #11
0
 //
 // Summary:
 //     Creates a rectangle that results from expanding or shrinking the specified
 //     rectangle by the specified width and height amounts, in all directions.
 //
 // Parameters:
 //   rect:
 //     The IdaRs.GiCL2D.Rect2D structure to modify.
 //
 //   width:
 //     The amount by which to expand or shrink the left and right sides of the rectangle.
 //
 //   height:
 //     The amount by which to expand or shrink the top and bottom sides of the rectangle.
 //
 // Returns:
 //     The resulting rectangle.
 public static Rect2D Inflate(Rect2D rect, double width, double height)
 {
     return(new Rect2D(Rect.Inflate(rect.myRc, width, height)));
 }
Example #12
0
 //
 // Summary:
 //     Returns the rectangle that results from expanding the specified rectangle
 //     by the specified System.Windows.Size, in all directions.
 //
 // Parameters:
 //   rect:
 //     The IdaRs.GiCL2D.Rect2D structure to modify.
 //
 //   size:
 //     Specifies the amount to expand the rectangle. The System.Windows.Size structure's
 //     System.Windows.Size.Width property specifies the amount to increase the rectangle's
 //     IdaRs.GiCL2D.Rect2D.Left and IdaRs.GiCL2D.Rect2D.Right properties. The System.Windows.Size
 //     structure's System.Windows.Size.Height property specifies the amount to increase
 //     the rectangle's IdaRs.GiCL2D.Rect2D.Top and IdaRs.GiCL2D.Rect2D.Bottom properties.
 //
 // Returns:
 //     The resulting rectangle.
 public static Rect2D Inflate(Rect2D rect, Size size)
 {
     return(new Rect2D(Rect.Inflate(rect.myRc, size)));
 }
Example #13
0
 //
 // Summary:
 //     Indicates whether the specified rectangles are equal.
 //
 // Parameters:
 //   rect1:
 //     The first rectangle to compare.
 //
 //   rect2:
 //     The second rectangle to compare.
 //
 // Returns:
 //     true if the rectangles have the same IdaRs.GiCL2D.Rect2D.Location and IdaRs.GiCL2D.Rect2D.Size
 //     values; otherwise, false.
 public static bool Equals(Rect2D rect1, Rect2D rect2)
 {
     return(Rect.Equals(rect1.myRc, rect2.myRc));
 }
Example #14
0
 //
 // Summary:
 //     Indicates whether the specified rectangle is equal to the current rectangle.
 //
 // Parameters:
 //   value:
 //     The rectangle to compare to the current rectangle.
 //
 // Returns:
 //     true if the specified rectangle has the same IdaRs.GiCL2D.Rect2D.Location
 //     and IdaRs.GiCL2D.Rect2D.Size values as the current rectangle; otherwise,
 //     false.
 public bool Equals(Rect2D value)
 {
     return(myRc.Equals(value.myRc));
 }
Example #15
0
 //
 // Summary:
 //     Indicates whether the rectangle contains the specified rectangle.
 //
 // Parameters:
 //   rect:
 //     The rectangle to check.
 //
 // Returns:
 //     true if rect is entirely contained by the rectangle; otherwise, false.
 public bool Contains(Rect2D rect)
 {
     return(myRc.Contains(rect.myRc));
 }