Added getMin/getMax/getCenter to f/d rectangular shape.
This commit is contained in:
@@ -23,18 +23,27 @@ public interface IRectangularShape extends IShape
|
||||
/** Returns the height of the framing rectangle. */
|
||||
double getHeight ();
|
||||
|
||||
/** Returns the minimum x,y-coordinate of the framing rectangle. */
|
||||
Point getMin ();
|
||||
|
||||
/** Returns the minimum x-coordinate of the framing rectangle. */
|
||||
double getMinX ();
|
||||
|
||||
/** Returns the minimum y-coordinate of the framing rectangle. */
|
||||
double getMinY ();
|
||||
|
||||
/** Returns the maximum x,y-coordinate of the framing rectangle. */
|
||||
Point getMax ();
|
||||
|
||||
/** Returns the maximum x-coordinate of the framing rectangle. */
|
||||
double getMaxX ();
|
||||
|
||||
/** Returns the maximum y-coordinate of the framing rectangle. */
|
||||
double getMaxY ();
|
||||
|
||||
/** Returns the center of the framing rectangle. */
|
||||
Point getCenter ();
|
||||
|
||||
/** Returns the x-coordinate of the center of the framing rectangle. */
|
||||
double getCenterX ();
|
||||
|
||||
|
||||
@@ -80,6 +80,12 @@ public abstract class RectangularShape implements IRectangularShape
|
||||
setFrameFromCenter(center.getX(), center.getY(), corner.getX(), corner.getY());
|
||||
}
|
||||
|
||||
@Override // from IRectangularShape
|
||||
public Point getMin ()
|
||||
{
|
||||
return new Point(getMinX(), getMinY());
|
||||
}
|
||||
|
||||
@Override // from IRectangularShape
|
||||
public double getMinX () {
|
||||
return getX();
|
||||
@@ -90,6 +96,12 @@ public abstract class RectangularShape implements IRectangularShape
|
||||
return getY();
|
||||
}
|
||||
|
||||
@Override // from IRectangularShape
|
||||
public Point getMax ()
|
||||
{
|
||||
return new Point(getMaxX(), getMaxY());
|
||||
}
|
||||
|
||||
@Override // from IRectangularShape
|
||||
public double getMaxX () {
|
||||
return getX() + getWidth();
|
||||
@@ -100,6 +112,12 @@ public abstract class RectangularShape implements IRectangularShape
|
||||
return getY() + getHeight();
|
||||
}
|
||||
|
||||
@Override // from IRectangularShape
|
||||
public Point getCenter ()
|
||||
{
|
||||
return new Point(getCenterX(), getCenterY());
|
||||
}
|
||||
|
||||
@Override // from IRectangularShape
|
||||
public double getCenterX () {
|
||||
return getX() + getWidth() / 2;
|
||||
|
||||
@@ -23,18 +23,27 @@ public interface IRectangularShape extends IShape
|
||||
/** Returns the height of the framing rectangle. */
|
||||
float getHeight ();
|
||||
|
||||
/** Returns the minimum x,y-coordinate of the framing rectangle. */
|
||||
Point getMin ();
|
||||
|
||||
/** Returns the minimum x-coordinate of the framing rectangle. */
|
||||
float getMinX ();
|
||||
|
||||
/** Returns the minimum y-coordinate of the framing rectangle. */
|
||||
float getMinY ();
|
||||
|
||||
/** Returns the maximum x,y-coordinate of the framing rectangle. */
|
||||
Point getMax ();
|
||||
|
||||
/** Returns the maximum x-coordinate of the framing rectangle. */
|
||||
float getMaxX ();
|
||||
|
||||
/** Returns the maximum y-coordinate of the framing rectangle. */
|
||||
float getMaxY ();
|
||||
|
||||
/** Returns the center of the framing rectangle. */
|
||||
Point getCenter ();
|
||||
|
||||
/** Returns the x-coordinate of the center of the framing rectangle. */
|
||||
float getCenterX ();
|
||||
|
||||
|
||||
@@ -80,6 +80,12 @@ public abstract class RectangularShape implements IRectangularShape
|
||||
setFrameFromCenter(center.getX(), center.getY(), corner.getX(), corner.getY());
|
||||
}
|
||||
|
||||
@Override // from IRectangularShape
|
||||
public Point getMin ()
|
||||
{
|
||||
return new Point(getMinX(), getMinY());
|
||||
}
|
||||
|
||||
@Override // from IRectangularShape
|
||||
public float getMinX () {
|
||||
return getX();
|
||||
@@ -90,6 +96,12 @@ public abstract class RectangularShape implements IRectangularShape
|
||||
return getY();
|
||||
}
|
||||
|
||||
@Override // from IRectangularShape
|
||||
public Point getMax ()
|
||||
{
|
||||
return new Point(getMaxX(), getMaxY());
|
||||
}
|
||||
|
||||
@Override // from IRectangularShape
|
||||
public float getMaxX () {
|
||||
return getX() + getWidth();
|
||||
@@ -100,6 +112,12 @@ public abstract class RectangularShape implements IRectangularShape
|
||||
return getY() + getHeight();
|
||||
}
|
||||
|
||||
@Override // from IRectangularShape
|
||||
public Point getCenter ()
|
||||
{
|
||||
return new Point(getCenterX(), getCenterY());
|
||||
}
|
||||
|
||||
@Override // from IRectangularShape
|
||||
public float getCenterX () {
|
||||
return getX() + getWidth() / 2;
|
||||
|
||||
@@ -42,12 +42,12 @@ public interface IRectangle extends IShape, Cloneable
|
||||
int getMinY ();
|
||||
|
||||
/** Returns the maximum x-coordinate of the framing rectangle. <em>Note:</em> this method
|
||||
* differs from its inting-point counterparts in that it considers {@code (x + width - 1)} to
|
||||
* differs from its floating-point counterparts in that it considers {@code (x + width - 1)} to
|
||||
* be a rectangle's maximum x-coordinate. */
|
||||
int getMaxX ();
|
||||
|
||||
/** Returns the maximum y-coordinate of the framing rectangle. <em>Note:</em> this method
|
||||
* differs from its inting-point counterparts in that it considers {@code (y + height - 1)}
|
||||
* differs from its floating-point counterparts in that it considers {@code (y + height - 1)}
|
||||
* to be a rectangle's maximum x-coordinate. */
|
||||
int getMaxY ();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user