Package org.eclipse.gef.geometry.planar
Class Rectangle
java.lang.Object
org.eclipse.gef.geometry.planar.Rectangle
- All Implemented Interfaces:
Serializable
,Cloneable
,IGeometry
,IRotatable<Polygon>
,IScalable<Rectangle>
,IShape
,ITranslatable<Rectangle>
Represents the geometric shape of a rectangle, where a rectangle is
characterized by means of its upper left corner (x,y) and its size (width,
height).
Note that while all manipulations (e.g. within shrink, expand) within this
class are based on double precision, all comparisons (e.g. within contains,
intersects, equals, etc.) are based on a limited precision (with an accuracy
defined within
PrecisionUtils
) to compensate for rounding effects.- See Also:
-
Constructor Summary
ConstructorDescriptionConstructs aRectangle
with location (0,0) and a size of (0,0).Rectangle
(double x, double y, double width, double height) Constructs a Rectangle from the given values for its location (upper-left corner point) and its size.Constructs a newRectangle
with the given location and size. -
Method Summary
Modifier and TypeMethodDescriptionclone()
Overridden with public visibility as recommended withinCloneable
.boolean
contains
(double x, double y) Returns whether the point given by x and y is within the boundaries of this Rectangle.boolean
contains
(double x, double y, double width, double height) Returns true in case the rectangle specified by (x, y, width, height) is contained within thisRectangle
.boolean
boolean
Returns whether the given point is within the boundaries of this Rectangle.boolean
boolean
equals
(double x, double y, double width, double height) Returnstrue
if this Rectangle's x, y, width, and height values are identical to the provided ones.boolean
Returns whether the input object is equal to this Rectangle or not.expand
(double h, double v) Expands the horizontal and vertical sides of thisAbstractRectangleBasedGeometry
with the values provided as input, and returnsthis
for convenience.expand
(double left, double top, double right, double bottom) Expands thisAbstractRectangleBasedGeometry
by the given amounts, and returns this for convenience.double
getArea()
Returns the area of thisRectangle
, i.e. the product of its width and height.Returns a new Point representing the middle point of the bottom side of this Rectangle.Returns a new Point representing the bottom left point of this Rectangle.Returns a new Point representing the bottom right point of this Rectangle.Returns the centerPoint
of thisAbstractRectangleBasedGeometry
.getCopy()
Returns a new Rectangle which has the exact same parameters as this Rectangle.getExpanded
(double h, double v) Returns a new expandedAbstractRectangleBasedGeometry
, where the sides are incremented by the horizontal and vertical values provided.getExpanded
(double left, double top, double right, double bottom) Creates and returns a newAbstractRectangleBasedGeometry
with the bounds of thisAbstractRectangleBasedGeometry
expanded by the given insets.final double
Returns the height of thisAbstractRectangleBasedGeometry
.getIntersected
(Rectangle rect) Returns a new Rectangle which has the intersection of this Rectangle and the rectangle provided as input.getLeft()
Returns a new Point representing the middle point of the left hand side of this Rectangle.Returns aPoint
specifying the x and y coordinates of thisAbstractRectangleBasedGeometry
.Line[]
Point[]
getRight()
Returns a new Point which represents the middle point of the right hand side of this Rectangle.getRotatedCCW
(Angle alpha) getRotatedCCW
(Angle alpha, double cx, double cy) getRotatedCCW
(Angle alpha, Point center) getRotatedCW
(Angle alpha) getRotatedCW
(Angle alpha, double cx, double cy) getRotatedCW
(Angle alpha, Point center) getScaled
(double factor) Scales a copy of the calling object by the given factor relative to its centerPoint
.getScaled
(double factorX, double factorY) Scales a copy of the calling object by the given factors relative to its centerPoint
.getScaled
(double factor, double centerX, double centerY) Scales a copy of the calling object by the given factor relative to the given centerPoint
(cx, cy).getScaled
(double factorX, double factorY, double centerX, double centerY) Scales a copy of the calling object by the given factors relative to the given centerPoint
(cx, cy).Scales a copy of the calling object by the given factors relative to the given centerPoint
.Scales a copy of the calling object by the given factor relative to the given centerPoint
.getShrinked
(double h, double v) Returns a newAbstractRectangleBasedGeometry
, where the sides are shrinked by the horizontal and vertical values supplied.getShrinked
(double left, double top, double right, double bottom) Returns a newAbstractRectangleBasedGeometry
shrinked by the specified insets.final Dimension
getSize()
Returns aDimension
that records the width and height of thisAbstractRectangleBasedGeometry
.getTop()
Returns a new Point which represents the middle point of the top side of this Rectangle.Returns a new Point which represents the top left hand corner of this Rectangle.Returns a new Point which represents the top right hand corner of this Rectangle.getTranslated
(double dx, double dy) Translates a copy of this object by the given values in x and y direction.getTranslated
(Point pt) Translates a copy of this object by the givenPoint
.Returns a new rectangle whose width and height have been interchanged, as well as its x and y values.getUnioned
(Point p) Returns a new Rectangle which contains both this Rectangle and the Point supplied as input.getUnioned
(Rectangle rect) Returns a new Rectangle which contains both this Rectangle and the Rectangle supplied as input.final double
getWidth()
Returns the width of thisAbstractRectangleBasedGeometry
.final double
getX()
Returns the x coordinate thisAbstractRectangleBasedGeometry
.final double
getY()
Returns the y coordinate of thisAbstractRectangleBasedGeometry
.final int
hashCode()
boolean
isEmpty()
Returnstrue
if this Rectangle's width or height is less than or equal to 0.scale
(double factor) Scales the calling object by the given factor relative to its centerPoint
.scale
(double fx, double fy) Scales the calling object by the given factors relative to the given centerPoint
.scale
(double factor, double cx, double cy) Scales the calling object by the given factor relative to the given centerPoint
(cx, cy).scale
(double fx, double fy, double cx, double cy) Scales the calling object by the given factors relative to the given centerPoint
(cx, cy).Scales the calling object by the given factors relative to the given centerPoint
.Scales the calling object by the given factor relative to the given centerPoint
.final Rectangle
setBounds
(double x, double y, double w, double h) Sets the x, y, width, and height values of thisAbstractRectangleBasedGeometry
to the given values.final Rectangle
final Rectangle
Sets the x and y coordinates and the width and height of thisAbstractRectangleBasedGeometry
to the respective values of the givenRectangle
.final Rectangle
setHeight
(double height) Sets the height of thisAbstractRectangleBasedGeometry
to the given value.final Rectangle
setLocation
(double x, double y) Sets the x and y coordinates of thisAbstractRectangleBasedGeometry
to the specified values.final Rectangle
setLocation
(Point p) Sets the x and y coordinates of thisAbstractRectangleBasedGeometry
to the respective values of the givenPoint
.final Rectangle
setSize
(double w, double h) Sets the width and height of thisAbstractRectangleBasedGeometry
to the given values.final Rectangle
Sets the width and height of thisAbstractRectangleBasedGeometry
to the width and height of the givenDimension
.final Rectangle
setWidth
(double width) Sets the width of thisAbstractRectangleBasedGeometry
to the passed-in value.final Rectangle
setX
(double x) Sets the x-coordinate of thisAbstractRectangleBasedGeometry
to the given value.final Rectangle
setY
(double y) Sets the y-coordinate of thisAbstractRectangleBasedGeometry
to the given value.shrink
(double h, double v) Shrinks the sides of thisAbstractRectangleBasedGeometry
by the horizontal and vertical values provided as input, and returns thisAbstractRectangleBasedGeometry
for convenience.shrink
(double left, double top, double right, double bottom) Shrinks thisAbstractRectangleBasedGeometry
by the specified amounts.toPath()
toString()
boolean
boolean
boolean
translate
(double dx, double dy) Translates the object by the given values in x and y direction.Translates the object by the givenPoint
.Switches the x and y values, as well as the width and height of this Rectangle.union
(double x, double y) union
(double x, double y, double w, double h)
-
Constructor Details
-
Rectangle
public Rectangle()Constructs aRectangle
with location (0,0) and a size of (0,0). -
Rectangle
public Rectangle(double x, double y, double width, double height) Constructs a Rectangle from the given values for its location (upper-left corner point) and its size. If a negative, width or height is passed in, 0 will be used instead. -
Rectangle
Constructs a newRectangle
with the given location and size. -
Rectangle
-
Rectangle
-
-
Method Details
-
contains
public boolean contains(double x, double y) Returns whether the point given by x and y is within the boundaries of this Rectangle.- Parameters:
x
- the x-coordinate of the point to testy
- the y-coordinate of the point to test- Returns:
- true if the Point is (imprecisely) contained within this Rectangle
-
contains
public boolean contains(double x, double y, double width, double height) Returns true in case the rectangle specified by (x, y, width, height) is contained within thisRectangle
.- Parameters:
x
- The x coordinate of the rectangle to be tested for containmenty
- The y coordinate of the rectangle to be tested for containmentwidth
- The width of the rectangle to be tested for containmentheight
- The height of the rectangle to be tested for containment- Returns:
true
if the rectangle characterized by (x,y, width, height) is (imprecisely) fully contained within thisRectangle
,false
otherwise
-
contains
Description copied from interface:IShape
-
contains
Returns whether the given point is within the boundaries of this Rectangle. The boundaries are inclusive of the top and left edges, but exclusive of the bottom and right edges. -
contains
-
equals
public boolean equals(double x, double y, double width, double height) Returnstrue
if this Rectangle's x, y, width, and height values are identical to the provided ones.- Parameters:
x
- The x value to testy
- The y value to testwidth
- The width value to testheight
- The height value to test- Returns:
true
if this Rectangle's x, y, width, and height values are (imprecisely) equal to the provided ones,false
otherwise
-
equals
Returns whether the input object is equal to this Rectangle or not. Rectangles are equivalent if their x, y, height, and width values are the same. -
getArea
public double getArea()Returns the area of thisRectangle
, i.e. the product of its width and height.- Returns:
- the area of this
Rectangle
-
getBottom
Returns a new Point representing the middle point of the bottom side of this Rectangle.- Returns:
- Point at the bottom of the Rectangle
-
getBottomLeft
Returns a new Point representing the bottom left point of this Rectangle.- Returns:
- Point at the bottom left of the rectangle
-
getBottomRight
Returns a new Point representing the bottom right point of this Rectangle.- Returns:
- Point at the bottom right of the rectangle
-
getCopy
Returns a new Rectangle which has the exact same parameters as this Rectangle. -
getIntersected
Returns a new Rectangle which has the intersection of this Rectangle and the rectangle provided as input. Returns an empty Rectangle if there is no intersection.- Parameters:
rect
- Rectangle provided to test for intersection- Returns:
- A new Rectangle representing the intersection
-
getLeft
Returns a new Point representing the middle point of the left hand side of this Rectangle.- Returns:
- Point at the left of the Rectangle
-
getOutline
Description copied from interface:IShape
- Specified by:
getOutline
in interfaceIShape
- Returns:
- An
ICurve
representing thisIShape
's outline.
-
getOutlineSegments
- Specified by:
getOutlineSegments
in interfaceIShape
- Returns:
- An array containing
Line
representations of thisRectangle
's borders.
-
getPoints
Returns an array ofPoint
s representing the top-left, top-right, bottom-right, and bottom-left border points of thisRectangle
.- Returns:
- An array containing the border points of this
Rectangle
-
getRight
Returns a new Point which represents the middle point of the right hand side of this Rectangle.- Returns:
- Point at the right of the Rectangle
-
getRotatedCCW
Rotates thisRectangle
counter-clock-wise by the givenAngle
around the centerPoint
of thisRectangle
(seeAbstractRectangleBasedGeometry.getCenter()
).- Specified by:
getRotatedCCW
in interfaceIRotatable<Polygon>
- Parameters:
alpha
- The rotationAngle
.- Returns:
- the resulting
Polygon
- See Also:
-
getRotatedCCW
Rotates thisRectangle
counter-clock-wise by the givenAngle
around the givenPoint
. If the rotationAngle
is not an integer multiple of 90 degrees, the resulting figure cannot be expressed as aRectangle
object. That's why this method returns aPolygon
instead.- Specified by:
getRotatedCCW
in interfaceIRotatable<Polygon>
- Parameters:
alpha
- the rotation anglecx
- x-component of the center point for the rotationcy
- y-component of the center point for the rotation- Returns:
- the resulting
Polygon
-
getRotatedCCW
Rotates thisRectangle
counter-clock-wise by the givenAngle
around the givenPoint
. If the rotationAngle
is not an integer multiple of 90 degrees, the resulting figure cannot be expressed as aRectangle
object. That's why this method returns aPolygon
instead.- Specified by:
getRotatedCCW
in interfaceIRotatable<Polygon>
- Parameters:
alpha
- the rotation anglecenter
- the center point for the rotation- Returns:
- the resulting
Polygon
-
getRotatedCW
Rotates thisRectangle
clock-wise by the givenAngle
around the center (AbstractRectangleBasedGeometry.getCenter()
) of thisRectangle
.- Specified by:
getRotatedCW
in interfaceIRotatable<Polygon>
- Parameters:
alpha
- the rotationAngle
- Returns:
- the resulting
Polygon
- See Also:
-
getRotatedCW
Rotates thisRectangle
clock-wise by the givenAngle
alpha around the givenPoint
(cx, cy). If the rotationAngle
is not an integer multiple of 90 degrees, the resulting figure cannot be expressed as aRectangle
object. That's why this method returns aPolygon
instead.- Specified by:
getRotatedCW
in interfaceIRotatable<Polygon>
- Parameters:
alpha
- the rotation anglecx
- x-component of the center point for the rotationcy
- y-component of the center point for the rotation- Returns:
- the resulting
Polygon
-
getRotatedCW
Rotates thisRectangle
clock-wise by the givenAngle
alpha around the givenPoint
. If the rotationAngle
is not an integer multiple of 90 degrees, the resulting figure cannot be expressed as aRectangle
object. That's why this method returns aPolygon
instead.- Specified by:
getRotatedCW
in interfaceIRotatable<Polygon>
- Parameters:
alpha
- the rotation anglecenter
- the center point for the rotation- Returns:
- the resulting
Polygon
-
getTop
Returns a new Point which represents the middle point of the top side of this Rectangle.- Returns:
- Point at the top of the Rectangle
-
getTopLeft
Returns a new Point which represents the top left hand corner of this Rectangle.- Returns:
- Point at the top left of the rectangle
-
getTopRight
Returns a new Point which represents the top right hand corner of this Rectangle.- Returns:
- Point at the top right of the rectangle
-
getTransformed
- Specified by:
getTransformed
in interfaceIGeometry
- Specified by:
getTransformed
in interfaceIShape
- Parameters:
t
- TheAffineTransform
to be applied- Returns:
- a transformed
Path
representation of thisIGeometry
- See Also:
-
getTransposed
Returns a new rectangle whose width and height have been interchanged, as well as its x and y values. This can be useful in orientation changes.- Returns:
- The transposed rectangle
-
getUnioned
Returns a new Rectangle which contains both this Rectangle and the Point supplied as input.- Parameters:
p
- Point for calculating union- Returns:
- A new unioned Rectangle
-
getUnioned
Returns a new Rectangle which contains both this Rectangle and the Rectangle supplied as input.- Parameters:
rect
- Rectangle for calculating union- Returns:
- A new unioned Rectangle
-
intersect
-
isEmpty
public boolean isEmpty()Returnstrue
if this Rectangle's width or height is less than or equal to 0.- Returns:
true
if this Rectangle is (imprecisely) considered to be empty
-
toPath
Description copied from interface:IGeometry
-
toPolygon
Converts thisRectangle
into aPolygon
representation. The control points used to construct the polygon are the border points returned bygetPoints()
. -
toString
-
touches
Description copied from interface:IGeometry
-
touches
-
touches
Tests whether thisRectangle
and the given otherRectangle
touch, i.e. whether they have at least one point in common. -
transpose
Switches the x and y values, as well as the width and height of this Rectangle. Useful for orientation changes.- Returns:
this
for convenience
-
union
-
union
-
union
- Parameters:
p
- ThePoint
to union with- Returns:
this
for convenience
-
union
- Parameters:
r
- TheRectangle
to union with- Returns:
this
for convenience
-
expand
Expands the horizontal and vertical sides of thisAbstractRectangleBasedGeometry
with the values provided as input, and returnsthis
for convenience. The location of its center is kept constant.- Parameters:
h
- the horizontal incrementv
- the vertical increment- Returns:
this
for convenience
-
expand
Expands thisAbstractRectangleBasedGeometry
by the given amounts, and returns this for convenience.- Parameters:
left
- the amount to expand the left sidetop
- the amount to expand the top sideright
- the amount to expand the right sidebottom
- the amount to expand the bottom side- Returns:
this
for convenience
-
getBounds
Description copied from interface:IGeometry
-
getCenter
Returns the centerPoint
of thisAbstractRectangleBasedGeometry
.- Returns:
- the center
Point
of thisAbstractRectangleBasedGeometry
-
getExpanded
Returns a new expandedAbstractRectangleBasedGeometry
, where the sides are incremented by the horizontal and vertical values provided. The center of theAbstractRectangleBasedGeometry
is maintained constant.- Parameters:
h
- The horizontal incrementv
- The vertical increment- Returns:
- a new expanded
AbstractRectangleBasedGeometry
-
getExpanded
Creates and returns a newAbstractRectangleBasedGeometry
with the bounds of thisAbstractRectangleBasedGeometry
expanded by the given insets.- Parameters:
left
- the amount to expand the left sidetop
- the amount to expand the top sideright
- the amount to expand the right sidebottom
- the amount to expand the bottom side- Returns:
- a new expanded
AbstractRectangleBasedGeometry
-
getHeight
public final double getHeight()Returns the height of thisAbstractRectangleBasedGeometry
.- Returns:
- the height of this
AbstractRectangleBasedGeometry
-
getLocation
Returns aPoint
specifying the x and y coordinates of thisAbstractRectangleBasedGeometry
.- Returns:
- a
Point
representing the x and y coordinates of thisAbstractRectangleBasedGeometry
-
getScaled
Description copied from interface:IScalable
Scales a copy of the calling object by the given factor relative to its centerPoint
. -
getScaled
Description copied from interface:IScalable
Scales a copy of the calling object by the given factors relative to its centerPoint
. -
getScaled
Description copied from interface:IScalable
Scales a copy of the calling object by the given factor relative to the given centerPoint
(cx, cy).- Specified by:
getScaled
in interfaceIScalable<T extends org.eclipse.gef.geometry.planar.AbstractRectangleBasedGeometry<?,
?>> - Parameters:
factor
- scale-factorcenterX
- x-coordinate of the relativePoint
for the scalingcenterY
- y-coordinate of the relativePoint
for the scaling- Returns:
- the new, scaled object
-
getScaled
Description copied from interface:IScalable
Scales a copy of the calling object by the given factors relative to the given centerPoint
(cx, cy).- Specified by:
getScaled
in interfaceIScalable<T extends org.eclipse.gef.geometry.planar.AbstractRectangleBasedGeometry<?,
?>> - Parameters:
factorX
- x-scale-factorfactorY
- y-scale-factorcenterX
- x-coordinate of the relativePoint
for the scalingcenterY
- y-coordinate of the relativePoint
for the scaling- Returns:
- the new, scaled object
-
getScaled
Description copied from interface:IScalable
Scales a copy of the calling object by the given factors relative to the given centerPoint
. -
getScaled
Description copied from interface:IScalable
Scales a copy of the calling object by the given factor relative to the given centerPoint
. -
getShrinked
Returns a newAbstractRectangleBasedGeometry
, where the sides are shrinked by the horizontal and vertical values supplied. The center of thisAbstractRectangleBasedGeometry
is kept constant.- Parameters:
h
- horizontal reduction amountv
- vertical reduction amount- Returns:
- a new, shrinked
AbstractRectangleBasedGeometry
-
getShrinked
Returns a newAbstractRectangleBasedGeometry
shrinked by the specified insets.- Parameters:
left
- the amount to shrink the left sidetop
- the amount to shrink the top sideright
- the amount to shrink the right sidebottom
- the amount to shrink the bottom side- Returns:
- a new, shrinked
AbstractRectangleBasedGeometry
-
getSize
Returns aDimension
that records the width and height of thisAbstractRectangleBasedGeometry
.- Returns:
- a
Dimension
that records the width and height of thisAbstractRectangleBasedGeometry
-
getTranslated
Description copied from interface:ITranslatable
Translates a copy of this object by the given values in x and y direction.- Specified by:
getTranslated
in interfaceITranslatable<T extends org.eclipse.gef.geometry.planar.AbstractRectangleBasedGeometry<?,
?>> - Parameters:
dx
- x-translationdy
- y-translation- Returns:
- a new, translated object
-
getTranslated
Description copied from interface:ITranslatable
Translates a copy of this object by the givenPoint
.- Specified by:
getTranslated
in interfaceITranslatable<T extends org.eclipse.gef.geometry.planar.AbstractRectangleBasedGeometry<?,
?>> - Parameters:
pt
- translationPoint
- Returns:
- a new, translated object
-
getWidth
public final double getWidth()Returns the width of thisAbstractRectangleBasedGeometry
.- Returns:
- the width of this
AbstractRectangleBasedGeometry
-
getX
public final double getX()Returns the x coordinate thisAbstractRectangleBasedGeometry
.- Returns:
- the x coordinate this
AbstractRectangleBasedGeometry
-
getY
public final double getY()Returns the y coordinate of thisAbstractRectangleBasedGeometry
.- Returns:
- the y coordinate of this
AbstractRectangleBasedGeometry
-
scale
Description copied from interface:IScalable
Scales the calling object by the given factor relative to its centerPoint
. -
scale
Description copied from interface:IScalable
Scales the calling object by the given factors relative to the given centerPoint
. -
scale
Description copied from interface:IScalable
Scales the calling object by the given factor relative to the given centerPoint
(cx, cy). -
scale
Description copied from interface:IScalable
Scales the calling object by the given factors relative to the given centerPoint
(cx, cy).- Specified by:
scale
in interfaceIScalable<T extends org.eclipse.gef.geometry.planar.AbstractRectangleBasedGeometry<?,
?>> - Parameters:
fx
- x-scale-factorfy
- y-scale-factorcx
- x-coordinate of the relativePoint
for the scalingcy
- y-coordinate of the relativePoint
for the scaling- Returns:
this
for convenience
-
scale
Description copied from interface:IScalable
Scales the calling object by the given factors relative to the given centerPoint
. -
scale
Description copied from interface:IScalable
Scales the calling object by the given factor relative to the given centerPoint
. -
setBounds
Sets the x, y, width, and height values of thisAbstractRectangleBasedGeometry
to the given values.- Parameters:
x
- the new x-coordinatey
- the new y-coordinatew
- the new widthh
- the new height- Returns:
this
for convenience
-
setBounds
-
setBounds
Sets the x and y coordinates and the width and height of thisAbstractRectangleBasedGeometry
to the respective values of the givenRectangle
.- Parameters:
r
- theRectangle
specifying the new x, y, width, and height values of thisAbstractRectangleBasedGeometry
- Returns:
this
for convenience
-
setHeight
Sets the height of thisAbstractRectangleBasedGeometry
to the given value.- Parameters:
height
- the new height- Returns:
this
for convenience
-
setLocation
Sets the x and y coordinates of thisAbstractRectangleBasedGeometry
to the specified values.- Parameters:
x
- the new x coordinate of thisAbstractRectangleBasedGeometry
y
- the new y coordinate of thisAbstractRectangleBasedGeometry
- Returns:
this
for convenience
-
setLocation
Sets the x and y coordinates of thisAbstractRectangleBasedGeometry
to the respective values of the givenPoint
.- Parameters:
p
- thePoint
specifying the new x and y coordinates of thisAbstractRectangleBasedGeometry
- Returns:
this
for convenience
-
setSize
Sets the width and height of thisAbstractRectangleBasedGeometry
to the width and height of the givenDimension
.- Parameters:
d
- theDimension
specifying the new width and height of thisAbstractRectangleBasedGeometry
- Returns:
this
for convenience
-
setSize
Sets the width and height of thisAbstractRectangleBasedGeometry
to the given values.- Parameters:
w
- the new width of thisAbstractRectangleBasedGeometry
h
- the new height of thisAbstractRectangleBasedGeometry
- Returns:
this
for convenience
-
setWidth
Sets the width of thisAbstractRectangleBasedGeometry
to the passed-in value.- Parameters:
width
- the new width of thisAbstractRectangleBasedGeometry
- Returns:
this
for convenience
-
setX
Sets the x-coordinate of thisAbstractRectangleBasedGeometry
to the given value.- Parameters:
x
- The new x-coordinate.- Returns:
this
for convenience.
-
setY
Sets the y-coordinate of thisAbstractRectangleBasedGeometry
to the given value.- Parameters:
y
- The new y-coordinate.- Returns:
this
for convenience.
-
shrink
Shrinks the sides of thisAbstractRectangleBasedGeometry
by the horizontal and vertical values provided as input, and returns thisAbstractRectangleBasedGeometry
for convenience. The center of thisAbstractRectangleBasedGeometry
is kept constant.- Parameters:
h
- horizontal reduction amountv
- vertical reduction amount- Returns:
this
for convenience
-
shrink
Shrinks thisAbstractRectangleBasedGeometry
by the specified amounts.- Parameters:
left
- the amount to shrink the left sidetop
- the amount to shrink the top sideright
- the amount to shrink the right sidebottom
- the amount to shrink the bottom side- Returns:
this
for convenience
-
translate
Description copied from interface:ITranslatable
Translates the object by the given values in x and y direction.- Specified by:
translate
in interfaceITranslatable<T extends org.eclipse.gef.geometry.planar.AbstractRectangleBasedGeometry<?,
?>> - Parameters:
dx
- x-translationdy
- y-translation- Returns:
this
for convenience
-
translate
Description copied from interface:ITranslatable
Translates the object by the givenPoint
.- Specified by:
translate
in interfaceITranslatable<T extends org.eclipse.gef.geometry.planar.AbstractRectangleBasedGeometry<?,
?>> - Parameters:
p
- translationPoint
- Returns:
this
for convenience
-
clone
Overridden with public visibility as recommended withinCloneable
. -
hashCode
public final int hashCode()
-