Class OrientedRectangle

All Implemented Interfaces:
Geometry, PolygonTypeGeometry, Surface, Serializable, Cloneable
Direct Known Subclasses:
Annotation, OrientedRectangle.Double, OrientedRectangle.Float

public abstract class OrientedRectangle extends Polygon
See Also:
  • Constructor Details

    • OrientedRectangle

      protected OrientedRectangle(LinearRing ring)
  • Method Details

    • setCoord0

      public void setCoord0(Point coord0)
      Parameters:
      point -
    • setCoord1

      public void setCoord1(Point coord1)
      Parameters:
      point -
    • setCoord2

      public void setCoord2(Point coord2)
      Parameters:
      point -
    • setCoord3

      public void setCoord3(Point coord3)
      Parameters:
      point -
    • setCoord4

      public void setCoord4(Point coord)
      Parameters:
      point -
    • centroid

      public Point centroid()
      Description copied from class: Polygon
      Computes the centroid (center of mass) of the polygon, considering possibles holes in it.
      it also computes Area, available with getTempArea if needed
      Specified by:
      centroid in interface PolygonTypeGeometry
      Specified by:
      centroid in interface Surface
      Overrides:
      centroid in class Polygon
      Returns:
      the center of mass
    • getCoord0

      public Point getCoord0()
      Returns:
      Returns the coord0.
    • getCoord1

      public Point getCoord1()
      Returns:
      Returns the coord1.
    • getCoord2

      public Point getCoord2()
      Returns:
      Returns the coord2.
    • getCoord3

      public Point getCoord3()
      Returns:
      Returns the coord3.
    • getCoord4

      public Point getCoord4()
      Returns:
      Returns the coord4.
    • add

      public OrientedRectangle add(Rectangle rect)
      Adds the specified rectangle to this one. The reulting rectangle is not rotated. In other words, this method returns the minimum bounding rectangle containing this rotated rectangle and the specified rotated rectangle. This instance is modified.
      Parameters:
      rect - the rectangle to add
      Returns:
      the new rectangle combining the 2 rectangles
    • add

    • contains

      public boolean contains(Point coord)
    • contains

      public boolean contains(Point coord, PrecisionModel precisionModel)
    • intersects

      public boolean intersects(Rectangle rect)
    • intersects

      public boolean intersects(Rectangle rect, PrecisionModel precisionModel)
    • intersects

      public boolean intersects(OrientedRectangle rect)
    • intersects

      public boolean intersects(OrientedRectangle rect, PrecisionModel precisionModel)
    • inflate

      public OrientedRectangle inflate(double factor)
    • getWidth

      public abstract double getWidth()
    • getHeight

      public abstract double getHeight()
    • setWidth

      public abstract void setWidth(double width)
    • setHeight

      public abstract void setHeight(double height)
    • serialize

      public Point[] serialize()
      Description copied from class: Polygon
      This polygon as an array of Point
      Specified by:
      serialize in interface Geometry
      Overrides:
      serialize in class Polygon
      Returns:
      this geometry as an array of Point.
    • setBounds

      public abstract void setBounds(Rectangle bounds)
    • createBounds

      public void createBounds()
      Description copied from class: Polygon
      creates the bounding box
      called in the constructor, not needed from outside
      Specified by:
      createBounds in interface Geometry
      Overrides:
      createBounds in class Polygon
    • transform

      public Geometry transform(Transformation tr)
      Creates a clone of the current oriented rectangle and returns the new instance tranformed with the specified geometry transformation.
      The returned geometry can be of any geometry types after the transformation.
      Specified by:
      transform in interface Geometry
      Overrides:
      transform in class Polygon
      Parameters:
      tr - the transformation to apply.
      Returns:
      the newly created and transformed geometry instance.