|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.epseelon.mobimap.geom.RectangularShape
public abstract class RectangularShape
This class provides a generic framework, and several helper methods, for subclasses which represent geometric objects inside a rectangular frame. This does not specify any geometry except for the bounding box.
Rectangle2D| Constructor Summary | |
|---|---|
protected |
RectangularShape()
Default constructor. |
| Method Summary | |
|---|---|
boolean |
contains(Point2D p)
Tests if a point is inside the boundary of the shape. |
boolean |
contains(Rectangle2D r)
Tests if the shape completely contains the given rectangle. |
Rectangle |
getBounds()
Returns a bounding box for this shape, in integer format. |
double |
getCenterX()
Return the x coordinate of the center point of the framing rectangle. |
double |
getCenterY()
Return the y coordinate of the center point of the framing rectangle. |
Rectangle2D |
getFrame()
Return the frame around this object. |
abstract double |
getHeight()
Get the height of the framing rectangle. |
double |
getMaxX()
Get the maximum x coordinate in the frame. |
double |
getMaxY()
Get the maximum y coordinate in the frame. |
double |
getMinX()
Get the minimum x coordinate in the frame. |
double |
getMinY()
Get the minimum y coordinate in the frame. |
abstract double |
getWidth()
Get the width of the framing rectangle. |
abstract double |
getX()
Get the x coordinate of the upper-left corner of the framing rectangle. |
abstract double |
getY()
Get the y coordinate of the upper-left corner of the framing rectangle. |
boolean |
intersects(Rectangle2D r)
Tests if a rectangle and this shape share common internal points. |
abstract boolean |
isEmpty()
Test if the shape is empty, meaning that no points are inside it. |
abstract void |
setFrame(double x,
double y,
double w,
double h)
Set the framing rectangle of this shape to the given coordinate and size. |
void |
setFrame(Point2D p,
Dimension2D d)
Set the framing rectangle of this shape to the given coordinate and size. |
void |
setFrame(Rectangle2D r)
Set the framing rectangle of this shape to the given rectangle. |
void |
setFrameFromCenter(double centerX,
double centerY,
double cornerX,
double cornerY)
Set the framing rectangle of this shape using the center of the frame, and one of the four corners. |
void |
setFrameFromCenter(Point2D center,
Point2D corner)
Set the framing rectangle of this shape using the center of the frame, and one of the four corners. |
void |
setFrameFromDiagonal(double x1,
double y1,
double x2,
double y2)
Set the framing rectangle of this shape using two points on a diagonal. |
void |
setFrameFromDiagonal(Point2D p1,
Point2D p2)
Set the framing rectangle of this shape using two points on a diagonal. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.epseelon.mobimap.geom.Shape |
|---|
contains, contains, getBounds2D, intersects |
| Constructor Detail |
|---|
protected RectangularShape()
| Method Detail |
|---|
public abstract double getX()
public abstract double getY()
public abstract double getWidth()
public abstract double getHeight()
public double getMinX()
public double getMinY()
public double getMaxX()
public double getMaxY()
public double getCenterX()
public double getCenterY()
public Rectangle2D getFrame()
setFrame(double, double, double, double)public abstract boolean isEmpty()
public abstract void setFrame(double x,
double y,
double w,
double h)
x - the new x coordinatey - the new y coordinatew - the new widthh - the new heightgetFrame()
public void setFrame(Point2D p,
Dimension2D d)
p - the new pointd - the new dimension
java.lang.NullPointerException - if p or d is nullgetFrame()public void setFrame(Rectangle2D r)
r - the new framing rectangle
java.lang.NullPointerException - if r is nullgetFrame()
public void setFrameFromDiagonal(double x1,
double y1,
double x2,
double y2)
x1 - the first x coordinatey1 - the first y coordinatex2 - the second x coordinatey2 - the second y coordinate
public void setFrameFromDiagonal(Point2D p1,
Point2D p2)
p1 - the first pointp2 - the second point
java.lang.NullPointerException - if either point is null
public void setFrameFromCenter(double centerX,
double centerY,
double cornerX,
double cornerY)
centerX - the x coordinate at the centercenterY - the y coordinate at the centercornerX - the x coordinate at a cornercornerY - the y coordinate at a corner
public void setFrameFromCenter(Point2D center,
Point2D corner)
center - the center pointcorner - a corner point
java.lang.NullPointerException - if either point is nullpublic boolean contains(Point2D p)
contains in interface Shapep - the point to test
java.lang.NullPointerException - if p is nullShape.contains(double, double)public boolean intersects(Rectangle2D r)
intersects in interface Shaper - the rectangle to test
java.lang.NullPointerException - if r is nullShape.intersects(double, double, double, double)public boolean contains(Rectangle2D r)
contains in interface Shaper - the rectangle to test
java.lang.NullPointerException - if r is nullShape.contains(double, double, double, double)public Rectangle getBounds()
getBounds in interface ShapeShape.getBounds2D()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||