public abstract class RectangularShape extends Object implements IRectangularShape
IShape
objects whose geometry is defined by a rectangular
frame.Constructor and Description |
---|
RectangularShape() |
Modifier and Type | Method and Description |
---|---|
Rectangle |
bounds()
Returns a copy of the bounding rectangle for this shape.
|
Rectangle |
bounds(Rectangle target)
Initializes the supplied rectangle with this shape's bounding rectangle.
|
Point |
center()
Returns the center of the framing rectangle.
|
double |
centerX()
Returns the x-coordinate of the center of the framing rectangle.
|
double |
centerY()
Returns the y-coordinate of the center of the framing rectangle.
|
boolean |
contains(IRectangle rect)
Returns true if this shape completely contains the supplied rectangle.
|
boolean |
contains(XY point)
Returns true if this shape contains the supplied point.
|
Rectangle |
frame()
Returns a copy of this shape's framing rectangle.
|
Rectangle |
frame(Rectangle target)
Initializes the supplied rectangle with this shape's framing rectangle.
|
boolean |
intersects(IRectangle rect)
Returns true if this shape intersects the supplied rectangle.
|
boolean |
isEmpty()
Returns true if this shape encloses no area.
|
Point |
max()
Returns the maximum x,y-coordinate of the framing rectangle.
|
double |
maxX()
Returns the maximum x-coordinate of the framing rectangle.
|
double |
maxY()
Returns the maximum y-coordinate of the framing rectangle.
|
Point |
min()
Returns the minimum x,y-coordinate of the framing rectangle.
|
double |
minX()
Returns the minimum x-coordinate of the framing rectangle.
|
double |
minY()
Returns the minimum y-coordinate of the framing rectangle.
|
PathIterator |
pathIterator(Transform t,
double flatness)
Returns an iterator over the path described by this shape.
|
abstract void |
setFrame(double x,
double y,
double width,
double height)
Sets the location and size of the framing rectangle of this shape to the specified values.
|
void |
setFrame(IRectangle r)
Sets the location and size of the framing rectangle of this shape to be equal to the
supplied rectangle.
|
void |
setFrame(XY loc,
IDimension size)
Sets the location and size of the framing rectangle of this shape to the supplied values.
|
void |
setFrameFromCenter(double centerX,
double centerY,
double cornerX,
double cornerY)
Sets the location and size of the framing rectangle of this shape based on the specified
center and corner points.
|
void |
setFrameFromCenter(XY center,
XY corner)
Sets the location and size of the framing rectangle of this shape based on the supplied
center and corner points.
|
void |
setFrameFromDiagonal(double x1,
double y1,
double x2,
double y2)
Sets the location and size of the framing rectangle of this shape based on the specified
diagonal line.
|
void |
setFrameFromDiagonal(XY p1,
XY p2)
Sets the location and size of the framing rectangle of this shape based on the supplied
diagonal line.
|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
height, width, x, y
contains, contains, intersects, pathIterator
public abstract void setFrame(double x, double y, double width, double height)
public void setFrame(XY loc, IDimension size)
public void setFrame(IRectangle r)
public void setFrameFromDiagonal(double x1, double y1, double x2, double y2)
public void setFrameFromDiagonal(XY p1, XY p2)
public void setFrameFromCenter(double centerX, double centerY, double cornerX, double cornerY)
public void setFrameFromCenter(XY center, XY corner)
public Point min()
IRectangularShape
min
in interface IRectangularShape
public double minX()
IRectangularShape
minX
in interface IRectangularShape
public double minY()
IRectangularShape
minY
in interface IRectangularShape
public Point max()
IRectangularShape
max
in interface IRectangularShape
public double maxX()
IRectangularShape
maxX
in interface IRectangularShape
public double maxY()
IRectangularShape
maxY
in interface IRectangularShape
public Point center()
IRectangularShape
center
in interface IRectangularShape
public double centerX()
IRectangularShape
centerX
in interface IRectangularShape
public double centerY()
IRectangularShape
centerY
in interface IRectangularShape
public Rectangle frame()
IRectangularShape
frame
in interface IRectangularShape
public Rectangle frame(Rectangle target)
IRectangularShape
frame
in interface IRectangularShape
public boolean isEmpty()
IShape
public boolean contains(XY point)
IShape
public boolean contains(IRectangle rect)
IShape
public boolean intersects(IRectangle rect)
IShape
intersects
in interface IShape
public Rectangle bounds()
IShape
public Rectangle bounds(Rectangle target)
IShape
public PathIterator pathIterator(Transform t, double flatness)
IShape
pathIterator
in interface IShape
t
- if supplied, the points in the path are transformed using this.flatness
- when approximating curved segments with lines, this controls the maximum
distance the lines are allowed to deviate from the approximated curve, thus a higher
flatness value generally allows for a path with fewer segments.Copyright © 2017. All rights reserved.