Package com.attivio.sdk.geo
Class Rectangle
- java.lang.Object
-
- com.attivio.sdk.geo.Shape
-
- com.attivio.sdk.geo.AbstractPolygon
-
- com.attivio.sdk.geo.Rectangle
-
- All Implemented Interfaces:
java.io.Externalizable
,java.io.Serializable
,java.lang.Cloneable
,java.lang.Comparable<Shape>
public final class Rectangle extends AbstractPolygon
Defines a rectangle.WARNING: this API is experimental and will likely change in the near future.
- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addArguments(java.lang.StringBuilder buffer)
Rectangle
clone()
boolean
contains(double x, double y)
Return true if this shape contains the point defined by (x
,y
).boolean
equals(java.lang.Object other)
double
fastGetX(int index)
Get the X coordinate of the Point atindex
.double
fastGetY(int index)
Get the Y coordinate of the Point atindex
.boolean
fastIntersects(Rectangle box)
Check if this shape's bounding box intersects withbox
.Rectangle
getBoundingBox()
Get the rectangle that represents the bounding box that fully contains this shape.static Rectangle
getBoundingBox(Shape a, Shape b)
Get a bounding box that contains botha
andb
.double
getHeight()
Get the height of this shape's bounding box.Point
getMaximum()
double
getMaximumX()
double
getMaximumY()
Point
getMinimum()
double
getMinimumX()
double
getMinimumY()
java.lang.String
getTypeName()
double
getWidth()
Get the width of this shape's bounding box.int
hashCode()
boolean
intersects(double minX, double minY, double maxX, double maxY)
Check if this rectangle intersects with rectangle defined by (minX, minY), (maxX, maxY).protected static boolean
intersects(double minX1, double minY1, double maxX1, double maxY1, double minX2, double minY2, double maxX2, double maxY2)
Check if 2 bounding boxes intersect.boolean
intersects(Rectangle box, Shape other)
Check if this shape intersects withother
.boolean
lineIntersects(double x1, double y1, double x2, double y2)
Check if the line (x1, y1), (x2, y2) intersects with this polygon.Rectangle
readExternal(java.io.DataInput in)
void
setMaximum(Point value)
void
setMaximumX(double value)
void
setMaximumY(double value)
void
setMinimum(Point value)
void
setMinimumX(double value)
void
setMinimumY(double value)
int
size()
Return the number of vertices in this polygon.void
writeExternal(java.io.DataOutput out)
-
Methods inherited from class com.attivio.sdk.geo.AbstractPolygon
getPoint, getPointX, getPointY, intersects
-
Methods inherited from class com.attivio.sdk.geo.Shape
compareTo, contains, intersects, readExternal, toString, toString, toString, valueOf, writeExternal
-
-
-
-
Method Detail
-
getTypeName
public java.lang.String getTypeName()
- Specified by:
getTypeName
in classShape
-
getWidth
public double getWidth()
Get the width of this shape's bounding box.
-
getHeight
public double getHeight()
Get the height of this shape's bounding box.
-
size
public int size()
Return the number of vertices in this polygon.- Specified by:
size
in classAbstractPolygon
-
fastGetX
public double fastGetX(int index)
Get the X coordinate of the Point atindex
.WARNING: this method assumes that
index
is positive and less thanAbstractPolygon.size()
.- Specified by:
fastGetX
in classAbstractPolygon
-
fastGetY
public double fastGetY(int index)
Get the Y coordinate of the Point atindex
.WARNING: this method assumes that
index
is positive and less thanAbstractPolygon.size()
.- Specified by:
fastGetY
in classAbstractPolygon
-
getMinimum
public Point getMinimum()
-
setMinimum
public void setMinimum(Point value)
-
getMinimumX
public double getMinimumX()
-
setMinimumX
public void setMinimumX(double value)
-
getMinimumY
public double getMinimumY()
-
setMinimumY
public void setMinimumY(double value)
-
getMaximum
public Point getMaximum()
-
setMaximum
public void setMaximum(Point value)
-
getMaximumX
public double getMaximumX()
-
setMaximumX
public void setMaximumX(double value)
-
getMaximumY
public double getMaximumY()
-
setMaximumY
public void setMaximumY(double value)
-
getBoundingBox
public Rectangle getBoundingBox()
Get the rectangle that represents the bounding box that fully contains this shape.- Specified by:
getBoundingBox
in classShape
-
contains
public boolean contains(double x, double y)
Return true if this shape contains the point defined by (x
,y
).
-
intersects
public boolean intersects(Rectangle box, Shape other)
Check if this shape intersects withother
.- Overrides:
intersects
in classAbstractPolygon
- Parameters:
box
- The bounding box of this shape fromShape.getBoundingBox()
.other
- The shape to check for intersection with
-
fastIntersects
public boolean fastIntersects(Rectangle box)
Check if this shape's bounding box intersects withbox
.- Specified by:
fastIntersects
in classShape
-
intersects
public boolean intersects(double minX, double minY, double maxX, double maxY)
Check if this rectangle intersects with rectangle defined by (minX, minY), (maxX, maxY).
-
intersects
protected static boolean intersects(double minX1, double minY1, double maxX1, double maxY1, double minX2, double minY2, double maxX2, double maxY2)
Check if 2 bounding boxes intersect.
-
lineIntersects
public boolean lineIntersects(double x1, double y1, double x2, double y2)
Check if the line (x1, y1), (x2, y2) intersects with this polygon.- Specified by:
lineIntersects
in classAbstractPolygon
-
addArguments
public void addArguments(java.lang.StringBuilder buffer)
- Specified by:
addArguments
in classShape
-
equals
public boolean equals(java.lang.Object other)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
Description copied from class:Shape
-
getBoundingBox
public static Rectangle getBoundingBox(Shape a, Shape b)
Get a bounding box that contains botha
andb
.
-
writeExternal
public void writeExternal(java.io.DataOutput out) throws java.io.IOException
- Specified by:
writeExternal
in classShape
- Throws:
java.io.IOException
-
readExternal
public Rectangle readExternal(java.io.DataInput in) throws java.io.IOException
- Specified by:
readExternal
in classShape
- Throws:
java.io.IOException
-
-