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 voidaddArguments(java.lang.StringBuilder buffer)Rectangleclone()booleancontains(double x, double y)Return true if this shape contains the point defined by (x,y).booleanequals(java.lang.Object other)doublefastGetX(int index)Get the X coordinate of the Point atindex.doublefastGetY(int index)Get the Y coordinate of the Point atindex.booleanfastIntersects(Rectangle box)Check if this shape's bounding box intersects withbox.RectanglegetBoundingBox()Get the rectangle that represents the bounding box that fully contains this shape.static RectanglegetBoundingBox(Shape a, Shape b)Get a bounding box that contains bothaandb.doublegetHeight()Get the height of this shape's bounding box.PointgetMaximum()doublegetMaximumX()doublegetMaximumY()PointgetMinimum()doublegetMinimumX()doublegetMinimumY()java.lang.StringgetTypeName()doublegetWidth()Get the width of this shape's bounding box.inthashCode()booleanintersects(double minX, double minY, double maxX, double maxY)Check if this rectangle intersects with rectangle defined by (minX, minY), (maxX, maxY).protected static booleanintersects(double minX1, double minY1, double maxX1, double maxY1, double minX2, double minY2, double maxX2, double maxY2)Check if 2 bounding boxes intersect.booleanintersects(Rectangle box, Shape other)Check if this shape intersects withother.booleanlineIntersects(double x1, double y1, double x2, double y2)Check if the line (x1, y1), (x2, y2) intersects with this polygon.RectanglereadExternal(java.io.DataInput in)voidsetMaximum(Point value)voidsetMaximumX(double value)voidsetMaximumY(double value)voidsetMinimum(Point value)voidsetMinimumX(double value)voidsetMinimumY(double value)intsize()Return the number of vertices in this polygon.voidwriteExternal(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:
getTypeNamein 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:
sizein classAbstractPolygon
-
fastGetX
public double fastGetX(int index)
Get the X coordinate of the Point atindex.WARNING: this method assumes that
indexis positive and less thanAbstractPolygon.size().- Specified by:
fastGetXin classAbstractPolygon
-
fastGetY
public double fastGetY(int index)
Get the Y coordinate of the Point atindex.WARNING: this method assumes that
indexis positive and less thanAbstractPolygon.size().- Specified by:
fastGetYin 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:
getBoundingBoxin 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:
intersectsin 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:
fastIntersectsin 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:
lineIntersectsin classAbstractPolygon
-
addArguments
public void addArguments(java.lang.StringBuilder buffer)
- Specified by:
addArgumentsin classShape
-
equals
public boolean equals(java.lang.Object other)
- Overrides:
equalsin 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 bothaandb.
-
writeExternal
public void writeExternal(java.io.DataOutput out) throws java.io.IOException- Specified by:
writeExternalin classShape- Throws:
java.io.IOException
-
readExternal
public Rectangle readExternal(java.io.DataInput in) throws java.io.IOException
- Specified by:
readExternalin classShape- Throws:
java.io.IOException
-
-