Packages

 

com.aspose.cad

Class RectangleF



  • public class RectangleF
    extends com.aspose.ms.lang.Struct<RectangleF>

    Stores a set of four floating-point numbers that represent the location and size of a rectangle.

    • Constructor Summary

      Constructors 
      Constructor and Description
      RectangleF() 
      RectangleF(float x, float y, float width, float height)
      Initializes a new instance of the com.aspose.cad.RectangleF object with the specified location and size.
      RectangleF(PointF location, SizeF size)
      Initializes a new instance of the com.aspose.cad.RectangleF object with the specified location and size.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      Object clone() 
      RectangleF Clone() 
      void CloneTo(RectangleF that) 
      boolean contains(float x, float y)
      Determines if the specified point is contained within this com.aspose.cad.RectangleF object.
      boolean contains(PointF point)
      Determines if the specified point is contained within this com.aspose.cad.RectangleF object.
      boolean contains(RectangleF rect)
      Determines if the rectangular region represented by rect is entirely contained within this com.aspose.cad.RectangleF object.
      boolean equals(Object obj)
      Tests whether obj is a com.aspose.cad.RectangleF with the same location and size of this com.aspose.cad.RectangleF.
      static RectangleF fromLeftTopRightBottom(float left, float top, float right, float bottom)
      Creates a com.aspose.cad.RectangleF object with upper-left corner and lower-right corner at the specified locations.
      static RectangleF fromPoints(PointF point1, PointF point2)
      Creates a new Rectangle from two points specified.
      float getBottom()
      Gets the y-coordinate that is the sum of com.aspose.cad.RectangleF.Y and com.aspose.cad.RectangleF.Height of this com.aspose.cad.RectangleF object.
      static RectangleF getEmpty()
      Gets a new instance of the com.aspose.cad.RectangleF object that has com.aspose.cad.RectangleF.X, com.aspose.cad.RectangleF.Y, com.aspose.cad.RectangleF.Width and com.aspose.cad.RectangleF.Height values set to zero.
      float getHeight()
      Gets the height of this com.aspose.cad.RectangleF object.
      float getLeft()
      Gets the x-coordinate of the left edge of this com.aspose.cad.RectangleF object.
      PointF getLocation()
      Gets or sets the coordinates of the upper-left corner of this com.aspose.cad.RectangleF object.
      float getRight()
      Gets the x-coordinate that is the sum of com.aspose.cad.RectangleF.X and com.aspose.cad.RectangleF.Width of this com.aspose.cad.RectangleF object.
      SizeF getSize()
      Gets of this com.aspose.cad.RectangleF.
      float getTop()
      Gets the y-coordinate of the top edge of this com.aspose.cad.RectangleF object.
      float getWidth()
      Gets the width of this com.aspose.cad.RectangleF object.
      float getX()
      Gets the x-coordinate of the upper-left corner of this com.aspose.cad.RectangleF object.
      float getY()
      Gets the y-coordinate of the upper-left corner of this com.aspose.cad.RectangleF object.
      int hashCode()
      Gets the hash code for this com.aspose.cad.RectangleF object.
      void inflate(float x, float y)
      Inflates this com.aspose.cad.RectangleF object by the specified amount.
      static RectangleF inflate(RectangleF rect, float x, float y)
      Creates and returns an inflated copy of the specified com.aspose.cad.RectangleF object.
      void inflate(SizeF size)
      Inflates this com.aspose.cad.RectangleF by the specified amount.
      void intersect(RectangleF rect)
      Replaces this com.aspose.cad.RectangleF object with the intersection of itself and the specified com.aspose.cad.RectangleF object.
      static RectangleF intersect(RectangleF a, RectangleF b)
      Returns a com.aspose.cad.RectangleF object that represents the intersection of two rectangles.
      boolean intersectsWith(RectangleF rect)
      Determines if this rectangle intersects with rect.
      boolean isEmpty()
      Gets a value indicating whether the com.aspose.cad.RectangleF.Width or com.aspose.cad.RectangleF.Height property of this com.aspose.cad.RectangleF has a value of zero.
      void normalize()
      Normalizes the rectangle by making it's width and height positive, left less than right and top less than bottom.
      void offset(float x, float y)
      Adjusts the location of this rectangle by the specified amount.
      void offset(PointF pos)
      Adjusts the location of this rectangle by the specified amount.
      static boolean op_Equality(RectangleF left, RectangleF right)
      Tests whether two com.aspose.cad.RectangleF objects have equal location and size.
      static boolean op_Inequality(RectangleF left, RectangleF right)
      Tests whether two com.aspose.cad.RectangleF objects differ in location or size.
      void setBottom(float value)
      Sets the y-coordinate that is the sum of com.aspose.cad.RectangleF.Y and com.aspose.cad.RectangleF.Height of this com.aspose.cad.RectangleF object.
      void setHeight(float value)
      Sets the height of this com.aspose.cad.RectangleF object.
      void setLeft(float value)
      Sets the x-coordinate of the left edge of this com.aspose.cad.RectangleF object.
      void setLocation(PointF value)
      Sets the coordinates of the upper-left corner of this com.aspose.cad.RectangleF object.
      void setRight(float value)
      Sets the x-coordinate that is the sum of com.aspose.cad.RectangleF.X and com.aspose.cad.RectangleF.Width of this com.aspose.cad.RectangleF object.
      void setSize(SizeF value)
      Gets the size of this com.aspose.cad.RectangleF.
      void setTop(float value)
      Sets the y-coordinate of the top edge of this com.aspose.cad.RectangleF object.
      void setWidth(float value)
      Sets the width of this com.aspose.cad.RectangleF object.
      void setX(float value)
      Sets the x-coordinate of the upper-left corner of this com.aspose.cad.RectangleF object.
      void setY(float value)
      Sets the y-coordinate of the upper-left corner of this com.aspose.cad.RectangleF object.
      static RectangleF to_RectangleF(Rectangle rect)
      Converts the specified com.aspose.cad.Rectangle object to a com.aspose.cad.RectangleF object.
      String toString()
      Converts the attributes of this com.aspose.cad.RectangleF to a human-readable string.
      static RectangleF union(RectangleF a, RectangleF b)
      Creates the smallest possible third rectangle that can contain both of two rectangles that form a union.
    • Constructor Detail

      • RectangleF

        public RectangleF()
      • RectangleF

        public RectangleF(float x,
                          float y,
                          float width,
                          float height)

        Initializes a new instance of the com.aspose.cad.RectangleF object with the specified location and size.

        Parameters:
        x - The x-coordinate of the upper-left corner of the rectangle.
        y - The y-coordinate of the upper-left corner of the rectangle.
        width - The width of the rectangle.
        height - The height of the rectangle.
      • RectangleF

        public RectangleF(PointF location,
                          SizeF size)

        Initializes a new instance of the com.aspose.cad.RectangleF object with the specified location and size.

        Parameters:
        location - A com.aspose.cad.PointF that represents the upper-left corner of the rectangular region.
        size - A com.aspose.cad.SizeF that represents the width and height of the rectangular region.
    • Method Detail

      • getEmpty

        public static RectangleF getEmpty()

        Gets a new instance of the com.aspose.cad.RectangleF object that has com.aspose.cad.RectangleF.X, com.aspose.cad.RectangleF.Y, com.aspose.cad.RectangleF.Width and com.aspose.cad.RectangleF.Height values set to zero.

        Returns:
        a new instance of the rectangle
      • getLocation

        public PointF getLocation()

        Gets or sets the coordinates of the upper-left corner of this com.aspose.cad.RectangleF object.

        Returns:
        A com.aspose.cad.PointF that represents the upper-left corner of this com.aspose.cad.RectangleF object.
      • setLocation

        public void setLocation(PointF value)

        Sets the coordinates of the upper-left corner of this com.aspose.cad.RectangleF object.

        Parameters:
        value - The location of rectangle
      • getSize

        public SizeF getSize()

        Gets of this com.aspose.cad.RectangleF.

        Returns:
        A com.aspose.cad.SizeF that represents the width and height of this com.aspose.cad.RectangleF object.
      • setSize

        public void setSize(SizeF value)

        Gets the size of this com.aspose.cad.RectangleF.

        Parameters:
        value - The new size of rectangle
      • getX

        public float getX()

        Gets the x-coordinate of the upper-left corner of this com.aspose.cad.RectangleF object.

        Returns:
        The x-coordinate of the upper-left corner of this com.aspose.cad.RectangleF object.
      • setX

        public void setX(float value)

        Sets the x-coordinate of the upper-left corner of this com.aspose.cad.RectangleF object.

        Parameters:
        value - The x-coordinate
      • getY

        public float getY()

        Gets the y-coordinate of the upper-left corner of this com.aspose.cad.RectangleF object.

        Returns:
        The y-coordinate of the upper-left corner of this com.aspose.cad.RectangleF object.
      • setY

        public void setY(float value)

        Sets the y-coordinate of the upper-left corner of this com.aspose.cad.RectangleF object.

        Parameters:
        value - The y-coordinate
      • getWidth

        public float getWidth()

        Gets the width of this com.aspose.cad.RectangleF object.

        Returns:
        The width of this com.aspose.cad.RectangleF object.
      • setWidth

        public void setWidth(float value)

        Sets the width of this com.aspose.cad.RectangleF object.

        Parameters:
        value - The width of rectangle
      • getHeight

        public float getHeight()

        Gets the height of this com.aspose.cad.RectangleF object.

        Returns:
        The height of this com.aspose.cad.RectangleF object.
      • setHeight

        public void setHeight(float value)

        Sets the height of this com.aspose.cad.RectangleF object.

        Parameters:
        value - The height of rectangle
      • getLeft

        public float getLeft()

        Gets the x-coordinate of the left edge of this com.aspose.cad.RectangleF object.

        Returns:
        The x-coordinate of the left edge of this com.aspose.cad.RectangleF object.
      • setLeft

        public void setLeft(float value)

        Sets the x-coordinate of the left edge of this com.aspose.cad.RectangleF object.

        Parameters:
        value - The x-coordinate of the left edge of this RectangleF object
      • getTop

        public float getTop()

        Gets the y-coordinate of the top edge of this com.aspose.cad.RectangleF object.

        Returns:
        The y-coordinate of the top edge of this com.aspose.cad.RectangleF object.
      • setTop

        public void setTop(float value)

        Sets the y-coordinate of the top edge of this com.aspose.cad.RectangleF object.

        Parameters:
        value - The y-coordinate of the top edge of this RectangleF object.
      • getRight

        public float getRight()

        Gets the x-coordinate that is the sum of com.aspose.cad.RectangleF.X and com.aspose.cad.RectangleF.Width of this com.aspose.cad.RectangleF object.

        Returns:
        The x-coordinate that is the sum of com.aspose.cad.RectangleF.X and com.aspose.cad.RectangleF.Width of this com.aspose.cad.RectangleF object.
      • setRight

        public void setRight(float value)

        Sets the x-coordinate that is the sum of com.aspose.cad.RectangleF.X and com.aspose.cad.RectangleF.Width of this com.aspose.cad.RectangleF object.

        Parameters:
        value - the x-coordinate that is the sum of RectangleF.x and RectangleF.width of this object
      • getBottom

        public float getBottom()

        Gets the y-coordinate that is the sum of com.aspose.cad.RectangleF.Y and com.aspose.cad.RectangleF.Height of this com.aspose.cad.RectangleF object.

        Returns:
        The y-coordinate that is the sum of com.aspose.cad.RectangleF.Y and com.aspose.cad.RectangleF.Height of this com.aspose.cad.RectangleF object.
      • setBottom

        public void setBottom(float value)

        Sets the y-coordinate that is the sum of com.aspose.cad.RectangleF.Y and com.aspose.cad.RectangleF.Height of this com.aspose.cad.RectangleF object.

        Parameters:
        value - the y-coordinate that is the sum of com.aspose.cad.RectangleF.Y and com.aspose.cad.RectangleF.Height of this com.aspose.cad.RectangleF object
      • isEmpty

        public boolean isEmpty()

        Gets a value indicating whether the com.aspose.cad.RectangleF.Width or com.aspose.cad.RectangleF.Height property of this com.aspose.cad.RectangleF has a value of zero.

        Returns:
        This property returns true if the com.aspose.cad.RectangleF.Width or com.aspose.cad.RectangleF.Height property of this com.aspose.cad.RectangleF has a value of zero; otherwise, false.
      • fromPoints

        public static RectangleF fromPoints(PointF point1,
                                            PointF point2)

        Creates a new Rectangle from two points specified. Two verticles of the created Rectangle will be equal to the passed point1 and point2. These would be typically the opposite vertices.

        Parameters:
        point1 - The first Point for the new rectangle.
        point2 - The second Point for the new rectangle.
        Returns:
        A newly created Rectangle.
      • inflate

        public static RectangleF inflate(RectangleF rect,
                                         float x,
                                         float y)

        Creates and returns an inflated copy of the specified com.aspose.cad.RectangleF object. The copy is inflated by the specified amount. The original rectangle remains unmodified.

        Parameters:
        rect - The com.aspose.cad.RectangleF to be copied. This rectangle is not modified.
        x - The amount to inflate the copy of the rectangle horizontally.
        y - The amount to inflate the copy of the rectangle vertically.
        Returns:
        The inflated com.aspose.cad.RectangleF.
      • intersect

        public static RectangleF intersect(RectangleF a,
                                           RectangleF b)

        Returns a com.aspose.cad.RectangleF object that represents the intersection of two rectangles. If there is no intersection, and empty com.aspose.cad.RectangleF is returned.

        Parameters:
        a - A first rectangle to intersect.
        b - A second rectangle to intersect.
        Returns:
        A third com.aspose.cad.RectangleF object the size of which represents the overlapped area of the two specified rectangles.
      • union

        public static RectangleF union(RectangleF a,
                                       RectangleF b)

        Creates the smallest possible third rectangle that can contain both of two rectangles that form a union.

        Parameters:
        a - A first rectangle to union.
        b - A second rectangle to union.
        Returns:
        A third com.aspose.cad.RectangleF object that contains both of the two rectangles that form the union.
      • op_Equality

        public static boolean op_Equality(RectangleF left,
                                          RectangleF right)

        Tests whether two com.aspose.cad.RectangleF objects have equal location and size.

        Parameters:
        left - The com.aspose.cad.RectangleF object that is to the left of the equality operator.
        right - The com.aspose.cad.RectangleF object that is to the right of the equality operator.
        Returns:
        This operator returns true if the two specified com.aspose.cad.RectangleF objects have equal com.aspose.cad.RectangleF.X, com.aspose.cad.RectangleF.Y, com.aspose.cad.RectangleF.Width, and com.aspose.cad.RectangleF.Height properties.
      • op_Inequality

        public static boolean op_Inequality(RectangleF left,
                                            RectangleF right)

        Tests whether two com.aspose.cad.RectangleF objects differ in location or size.

        Parameters:
        left - The com.aspose.cad.RectangleF object that is to the left of the inequality operator.
        right - The com.aspose.cad.RectangleF object that is to the right of the inequality operator.
        Returns:
        This operator returns true if any of the com.aspose.cad.RectangleF.X, com.aspose.cad.RectangleF.Y, com.aspose.cad.RectangleF.Width, or com.aspose.cad.RectangleF.Height properties of the two com.aspose.cad.RectangleF objects are unequal; otherwise false.
      • to_RectangleF

        public static RectangleF to_RectangleF(Rectangle rect)

        Converts the specified com.aspose.cad.Rectangle object to a com.aspose.cad.RectangleF object.

        Parameters:
        rect - The com.aspose.cad.Rectangle object to convert.
        Returns:
        The com.aspose.cad.RectangleF object that is converted from the specified com.aspose.cad.Rectangle object.
      • fromLeftTopRightBottom

        public static RectangleF fromLeftTopRightBottom(float left,
                                                        float top,
                                                        float right,
                                                        float bottom)

        Creates a com.aspose.cad.RectangleF object with upper-left corner and lower-right corner at the specified locations.

        Parameters:
        left - The x-coordinate of the upper-left corner of the rectangular region.
        top - The y-coordinate of the upper-left corner of the rectangular region.
        right - The x-coordinate of the lower-right corner of the rectangular region.
        bottom - The y-coordinate of the lower-right corner of the rectangular region.
        Returns:
        The new com.aspose.cad.RectangleF that this method creates.
      • normalize

        public void normalize()

        Normalizes the rectangle by making it's width and height positive, left less than right and top less than bottom.

      • contains

        public boolean contains(float x,
                                float y)

        Determines if the specified point is contained within this com.aspose.cad.RectangleF object.

        Parameters:
        x - The x-coordinate of the point to test.
        y - The y-coordinate of the point to test.
        Returns:
        This method returns true if the point defined by x and y is contained within this com.aspose.cad.RectangleF object; otherwise false.
      • contains

        public boolean contains(PointF point)

        Determines if the specified point is contained within this com.aspose.cad.RectangleF object.

        Parameters:
        point - The com.aspose.cad.PointF to test.
        Returns:
        This method returns true if the point represented by the point parameter is contained within this com.aspose.cad.RectangleF object; otherwise false.
      • contains

        public boolean contains(RectangleF rect)

        Determines if the rectangular region represented by rect is entirely contained within this com.aspose.cad.RectangleF object.

        Parameters:
        rect - The com.aspose.cad.RectangleF to test.
        Returns:
        This method returns true if the rectangular region represented by rect is entirely contained within the rectangular region represented by this com.aspose.cad.RectangleF; otherwise false.
      • inflate

        public void inflate(float x,
                            float y)

        Inflates this com.aspose.cad.RectangleF object by the specified amount.

        Parameters:
        x - The amount to inflate this com.aspose.cad.RectangleF object horizontally.
        y - The amount to inflate this com.aspose.cad.RectangleF object vertically.
      • inflate

        public void inflate(SizeF size)

        Inflates this com.aspose.cad.RectangleF by the specified amount.

        Parameters:
        size - The amount to inflate this rectangle.
      • intersect

        public void intersect(RectangleF rect)

        Replaces this com.aspose.cad.RectangleF object with the intersection of itself and the specified com.aspose.cad.RectangleF object.

        Parameters:
        rect - The rectangle to intersect.
      • intersectsWith

        public boolean intersectsWith(RectangleF rect)

        Determines if this rectangle intersects with rect.

        Parameters:
        rect - The rectangle to test.
        Returns:
        This method returns true if there is any intersection.
      • offset

        public void offset(PointF pos)

        Adjusts the location of this rectangle by the specified amount.

        Parameters:
        pos - The amount to offset the location.
      • offset

        public void offset(float x,
                           float y)

        Adjusts the location of this rectangle by the specified amount.

        Parameters:
        x - The amount to offset the location horizontally.
        y - The amount to offset the location vertically.
      • equals

        public boolean equals(Object obj)

        Tests whether obj is a com.aspose.cad.RectangleF with the same location and size of this com.aspose.cad.RectangleF.

        Overrides:
        equals in class Object
        Parameters:
        obj - The System.Object to test.
        Returns:
        This method returns true if obj is a com.aspose.cad.RectangleF and its X, Y, Width, and Height properties are equal to the corresponding properties of this com.aspose.cad.RectangleF; otherwise, false.
      • hashCode

        public int hashCode()

        Gets the hash code for this com.aspose.cad.RectangleF object.

        Overrides:
        hashCode in class Object
        Returns:
        The hash code for this com.aspose.cad.RectangleF.
      • toString

        public String toString()

        Converts the attributes of this com.aspose.cad.RectangleF to a human-readable string.

        Overrides:
        toString in class Object
        Returns:
        A string that contains the position, width, and height of this com.aspose.cad.RectangleF object.
      • CloneTo

        public void CloneTo(RectangleF that)
        Specified by:
        CloneTo in class com.aspose.ms.System.ValueType<RectangleF>
      • Clone

        public RectangleF Clone()
        Specified by:
        Clone in class com.aspose.ms.System.ValueType<RectangleF>