public class Rectangle extends AbstractRectangle implements Serializable
Modifier and Type | Field and Description |
---|---|
double |
height
The height of the rectangle.
|
double |
width
The width of the rectangle.
|
double |
x
The x-coordinate of the rectangle's upper left corner.
|
double |
y
The y-coordinate of the rectangle's upper left corner.
|
OUT_BOTTOM, OUT_LEFT, OUT_RIGHT, OUT_TOP
Constructor and Description |
---|
Rectangle()
Constructs a rectangle at (0,0) and with dimensions (0,0).
|
Rectangle(double x,
double y,
double width,
double height)
Constructs a rectangle with the specified upper-left corner and dimensions.
|
Rectangle(IDimension d)
Constructs a rectangle with upper-left corner at (0,0) and the supplied dimensions.
|
Rectangle(IRectangle r)
Constructs a rectangle with bounds equal to the supplied rectangle.
|
Rectangle(XY p)
Constructs a rectangle with the supplied upper-left corner and dimensions (0,0).
|
Rectangle(XY p,
IDimension d)
Constructs a rectangle with upper-left corner at the supplied point and with the supplied
dimensions.
|
Modifier and Type | Method and Description |
---|---|
void |
add(double px,
double py)
Expands the bounds of this rectangle to contain the specified point.
|
void |
add(IRectangle r)
Expands the bounds of this rectangle to contain the supplied rectangle.
|
void |
add(XY p)
Expands the bounds of this rectangle to contain the supplied point.
|
void |
grow(double dx,
double dy)
Grows the bounds of this rectangle by the specified amount (i.e.
|
double |
height()
Returns the height of the framing rectangle.
|
void |
setBounds(double x,
double y,
double width,
double height)
Sets the bounds of this rectangle to the specified bounds.
|
void |
setBounds(IRectangle r)
Sets the bounds of this rectangle to those of the supplied rectangle.
|
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 |
setLocation(double x,
double y)
Sets the upper-left corner of this rectangle to the specified point.
|
void |
setLocation(XY p)
Sets the upper-left corner of this rectangle to the supplied point.
|
void |
setSize(double width,
double height)
Sets the size of this rectangle to the specified dimensions.
|
void |
setSize(IDimension d)
Sets the size of this rectangle to the supplied dimensions.
|
void |
translate(double mx,
double my)
Translates the upper-left corner of this rectangle by the specified amount.
|
double |
width()
Returns the width of the framing rectangle.
|
double |
x()
Returns the x-coordinate of the upper-left corner of the framing rectangle.
|
double |
y()
Returns the y-coordinate of the upper-left corner of the framing rectangle.
|
clone, contains, contains, equals, hashCode, intersection, intersection, intersects, intersectsLine, intersectsLine, location, location, outcode, outcode, pathIterator, pathIterator, size, size, toString, union
bounds, bounds, center, centerX, centerY, contains, contains, frame, frame, intersects, isEmpty, max, maxX, maxY, min, minX, minY, setFrame, setFrame, setFrameFromCenter, setFrameFromCenter, setFrameFromDiagonal, setFrameFromDiagonal
public double x
public double y
public double width
public double height
public Rectangle()
public Rectangle(XY p)
public Rectangle(IDimension d)
public Rectangle(XY p, IDimension d)
public Rectangle(double x, double y, double width, double height)
public Rectangle(IRectangle r)
public void setLocation(double x, double y)
public void setLocation(XY p)
public void setSize(double width, double height)
public void setSize(IDimension d)
public void setBounds(double x, double y, double width, double height)
public void setBounds(IRectangle r)
public void grow(double dx, double dy)
public void translate(double mx, double my)
public void add(double px, double py)
public void add(XY p)
public void add(IRectangle r)
public double x()
IRectangularShape
x
in interface IRectangularShape
public double y()
IRectangularShape
y
in interface IRectangularShape
public double width()
IRectangularShape
width
in interface IRectangularShape
public double height()
IRectangularShape
height
in interface IRectangularShape
public void setFrame(double x, double y, double width, double height)
RectangularShape
setFrame
in class RectangularShape
Copyright © 2017. All rights reserved.