com.aspose.pdf

Interfaces

Classes

Enums

Exceptions

com.aspose.pdf

Class Rectangle

    • Constructor Summary

      Constructors 
      Constructor and Description
      Rectangle(double llx, double lly, double urx, double ury)
      Constructor of Rectangle.
    • Constructor Detail

      • Rectangle

        public Rectangle(double llx,
                         double lly,
                         double urx,
                         double ury)

        Constructor of Rectangle.

        Parameters:
        llx - X of lower left corner.
        lly - Y of lower left corner.
        urx - X of upper right corner.
        ury - Y of upper right corner.
    • Method Detail

      • getWidth

        public double getWidth()

        Gets width of rectangle.

        Returns:
        double value
      • getHeight

        public double getHeight()

        Get height of rectangle.

        Returns:
        double value
      • getLLX

        public double getLLX()

        Gets X-coordinate of lower - left corner.

        Returns:
        double value
      • setLLX

        public void setLLX(double value)

        Sets X-coordinate of lower - left corner.

        Parameters:
        value - double value
      • getLLY

        public double getLLY()

        Gets Y - coordinate of lower-left corner.

        Returns:
        double value
      • setLLY

        public void setLLY(double value)

        Sets Y - coordinate of lower-left corner.

        Parameters:
        value - double value
      • getURX

        public double getURX()

        Gets X - coordinate of upper-right corner.

        Returns:
        double value
      • setURX

        public void setURX(double value)

        Sets X - coordinate of upper-right corner.

        Parameters:
        value - double value
      • getURY

        public double getURY()

        Gets Y - coordinate of upper-right corner.

        Returns:
        double value
      • setURY

        public void setURY(double value)

        Sets Y - coordinate of upper-right corner.

        Parameters:
        value - double value
      • toRect

        public Rectangle toRect()

        Converts rectangle to instance of System.Drawing.Rectangle. Floating-point positions and size are truncated.

        Returns:
        Result of conversion.
      • fromRect

        public static Rectangle fromRect(Rectangle src)

        Initializes new rectangle from given instance of System.Drawing.Rectangle.

        Parameters:
        src - Source rectangle which position and size will be set to new rectangle.
        Returns:
        New rectangle.
      • toArray

        public com.aspose.pdf.engine.data.PdfArray toArray(com.aspose.pdf.engine.data.ITrailerable trailerable)
      • toString

        public String toString()

        Gets rectangle string representation.

        Overrides:
        toString in class Object
        Returns:
        String has format llx,lly,urx,ury.
      • parse

        public static Rectangle parse(String value)

        Try to parse string and extract from it rectangle components llx, lly, urx, ury.

        Parameters:
        value - String to parse.
        Returns:
        Rectangle object.
      • getEmpty

        public static Rectangle getEmpty()

        Gets empty rectangle

        Returns:
        new Rectangle object
      • getTrivial

        public static Rectangle getTrivial()

        Initializes trivial rectangle i.e. rectangle with zero position and size.

        Returns:
        new Rectangle object
      • isTrivial

        public boolean isTrivial()

        Checks if rectangle is trivial i.e. has zero size and position.

        Returns:
        boolean value
      • isEmpty

        public boolean isEmpty()

        Checks if rectangle is empty.

        Returns:
        boolean value
      • isPoint

        public boolean isPoint()

        Checks if rectangle is point i.e. LLX is equal URX and LLY is equal URY.

        Returns:
        boolean value
      • equals

        public boolean equals(Object other)

        Check if rectangles are equal i.e. have same position and sizes.

        Overrides:
        equals in class Object
        Parameters:
        other - Rectangle which will be compared.
        Returns:
        True if rectangles are equals, false otherwise.
      • nearEquals

        public boolean nearEquals(Rectangle other,
                                  double delta)

        Check if rectangles are near equal i.e. have near same (up to delta) position and sizes.

        Parameters:
        other - Rectangle which will be compared.
        delta - Value of comparation tollerance.
        Returns:
        True if rectangles are equals, false otherwise.
      • hashCode

        public int hashCode()
        Returns a hash code value for the object. This method is supported for the benefit of hash tables such as those provided by HashMap.

        The general contract of hashCode is:

        • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
        • If two objects are equal according to the equals(Object) method, then calling the hashCode method on each of the two objects must produce the same integer result.
        • It is not required that if two objects are unequal according to the Object.equals(java.lang.Object) method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.

        As much as is reasonably practical, the hashCode method defined by class Object does return distinct integers for distinct objects. (This is typically implemented by converting the internal address of the object into an integer, but this implementation technique is not required by the JavaTM programming language.)

        Overrides:
        hashCode in class Object
        Returns:
        a hash code value for this object.
        See Also:
        Object.equals(java.lang.Object), System.identityHashCode(java.lang.Object)
      • intersect

        public Rectangle intersect(Rectangle otherRect)

        Intersects to rectangles.

        Parameters:
        otherRect - Rectangle to which this recatangle be intersected.
        Returns:
        Intersection of rectangles; null if rectangles are not intersected.
      • join

        public Rectangle join(Rectangle otherRect)

        Joins rectangles.

        Parameters:
        otherRect - Rectangle to which this rectangle be joined.
        Returns:
        Described rectangle.
      • _Intersect

        @Deprecated
        public void _Intersect(Rectangle otherRect)
        Deprecated. 

        Intersects rectangles. Obsolete method. Please use Intersect instead.

        Parameters:
        otherRect - Rectangle object
      • isIntersect

        public boolean isIntersect(Rectangle otherRect)

        Determines whether this rectangle intersects with other rectangle.

        Parameters:
        otherRect - Intersection will be tested with specified rectangle.
        Returns:
        True if this rectangle intersects with specified rectangle. Otherwise false.
      • rotate

        public void rotate(int angle)

        Rotate rectangle by the specified angle.

        Parameters:
        angle - Angle of rotation. Member of Rotation enumeration.
        See Also:
        Rotation
      • rotateAngle

        public void rotateAngle(int angle)

        Rotate rectangle by the specified angle.

        Parameters:
        angle - Angle of rotation in degrees between 0 and 360.
      • compareTo

        public int compareTo(Object arg0)

        CompareTo

        Specified by:
        compareTo in interface Comparable<Object>
        Parameters:
        arg0 - Object for compare
        Returns:
        int value
      • clone

        public Object clone()

        Clones the Rectangle object.

        Overrides:
        clone in class Object
        Returns:
        Clone object.
      • deepClone

        public Object deepClone()

        Clones the Rectangle object.

        Returns:
        Clone object.