Package org.eclipse.gef.geometry.planar
Class RoundedRectangle
- java.lang.Object
-
- org.eclipse.gef.geometry.planar.RoundedRectangle
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable,IGeometry,IRotatable<PolyBezier>,IScalable<RoundedRectangle>,IShape,ITranslatable<RoundedRectangle>
public final class RoundedRectangle extends java.lang.Object implements IShape
Represents the geometric shape of a rounded rectangle, i.e. a rectangle with rounded corners.arc-width width .-------------------. .--------. +----+-----+-----+----+ / / | ^ ^ | arc- | | | | | | height | | + <- arc end point -> + | | | | | \ | | height | + + | | | | | | | + <- arc end point -> + | | | | | \ | v v | +----+-----+-----+----+The maximum value for the arc-width is the width of the rectangle and the maximum value for the arc-height is the height of the rectangle. For the maximal values, the end points of the arcs are at the centers of the sides of the rectangle.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:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description RoundedRectangle(double x, double y, double width, double height, double arcWidth, double arcHeight)Constructs a newRoundedRectanglefrom the given bounds and arc values.RoundedRectangle(Rectangle r, double arcWidth, double arcHeight)Constructs a newRoundedRectanglefrom the bounds of the givenRectangleand the given arc values.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Objectclone()Overridden with public visibility as recommended withinCloneable.booleancontains(IGeometry g)booleancontains(Point p)booleanequals(java.lang.Object obj)Texpand(double h, double v)Expands the horizontal and vertical sides of thisAbstractRectangleBasedGeometrywith the values provided as input, and returnsthisfor convenience.Texpand(double left, double top, double right, double bottom)Expands thisAbstractRectangleBasedGeometryby the given amounts, and returns this for convenience.doublegetArcHeight()Returns the arc height of thisRoundedRectangle, which is the height of the arc used to define its rounded corners.doublegetArcWidth()Returns the arc width of thisRoundedRectangle, which is the width of the arc used to define its rounded corners.LinegetBottom()Returns the bottom edge of thisRoundedRectangle.ArcgetBottomLeftArc()Returns the bottom leftArcof thisRoundedRectangle.ArcgetBottomRightArc()Returns the bottom rightArcof thisRoundedRectangle.RectanglegetBounds()PointgetCenter()Returns the centerPointof thisAbstractRectangleBasedGeometry.RoundedRectanglegetCopy()Returns a new identical copy of thisIGeometry.protected doublegetEffectiveArcHeight()Returns the effective arc height, i.e. clamped to the range[0;height].protected doublegetEffectiveArcWidth()Returns the effective arc width, i.e. clamped to the range[0;width].TgetExpanded(double h, double v)Returns a new expandedAbstractRectangleBasedGeometry, where the sides are incremented by the horizontal and vertical values provided.TgetExpanded(double left, double top, double right, double bottom)Creates and returns a newAbstractRectangleBasedGeometrywith the bounds of thisAbstractRectangleBasedGeometryexpanded by the given insets.doublegetHeight()Returns the height of thisAbstractRectangleBasedGeometry.LinegetLeft()Returns the left edge of thisRoundedRectangle.PointgetLocation()Returns aPointspecifying the x and y coordinates of thisAbstractRectangleBasedGeometry.PolyBeziergetOutline()BezierCurve[]getOutlineSegments()LinegetRight()Returns the right edge of thisRoundedRectangle.PolyBeziergetRotatedCCW(Angle angle)PolyBeziergetRotatedCCW(Angle angle, double cx, double cy)PolyBeziergetRotatedCCW(Angle angle, Point center)PolyBeziergetRotatedCW(Angle angle)PolyBeziergetRotatedCW(Angle angle, double cx, double cy)PolyBeziergetRotatedCW(Angle angle, Point center)TgetScaled(double factor)Scales a copy of the calling object by the given factor relative to its centerPoint.TgetScaled(double factorX, double factorY)Scales a copy of the calling object by the given factors relative to its centerPoint.TgetScaled(double factor, double centerX, double centerY)Scales a copy of the calling object by the given factor relative to the given centerPoint(cx, cy).TgetScaled(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).TgetScaled(double factorX, double factorY, Point center)Scales a copy of the calling object by the given factors relative to the given centerPoint.TgetScaled(double factor, Point center)Scales a copy of the calling object by the given factor relative to the given centerPoint.TgetShrinked(double h, double v)Returns a newAbstractRectangleBasedGeometry, where the sides are shrinked by the horizontal and vertical values supplied.TgetShrinked(double left, double top, double right, double bottom)Returns a newAbstractRectangleBasedGeometryshrinked by the specified insets.DimensiongetSize()Returns aDimensionthat records the width and height of thisAbstractRectangleBasedGeometry.LinegetTop()Returns the top edge of thisRoundedRectangle.ArcgetTopLeftArc()Returns the top leftArcof thisRoundedRectangle.ArcgetTopRightArc()Returns the top rightArcof thisRoundedRectangle.CurvedPolygongetTransformed(AffineTransform t)TgetTranslated(double dx, double dy)Translates a copy of this object by the given values in x and y direction.TgetTranslated(Point pt)Translates a copy of this object by the givenPoint.doublegetWidth()Returns the width of thisAbstractRectangleBasedGeometry.doublegetX()Returns the x coordinate thisAbstractRectangleBasedGeometry.doublegetY()Returns the y coordinate of thisAbstractRectangleBasedGeometry.inthashCode()Tscale(double factor)Scales the calling object by the given factor relative to its centerPoint.Tscale(double fx, double fy)Scales the calling object by the given factors relative to the given centerPoint.Tscale(double factor, double cx, double cy)Scales the calling object by the given factor relative to the given centerPoint(cx, cy).Tscale(double fx, double fy, double cx, double cy)Scales the calling object by the given factors relative to the given centerPoint(cx, cy).Tscale(double fx, double fy, Point center)Scales the calling object by the given factors relative to the given centerPoint.Tscale(double factor, Point center)Scales the calling object by the given factor relative to the given centerPoint.RoundedRectanglesetArcHeight(double arcHeight)Sets the arc height of thisRoundedRectangle, which is the height of the arc used to define its rounded corners.RoundedRectanglesetArcWidth(double arcWidth)Sets the arc width of thisRoundedRectangle, which is the width of the arc used to define its rounded corners.TsetBounds(double x, double y, double w, double h)Sets the x, y, width, and height values of thisAbstractRectangleBasedGeometryto the given values.TsetBounds(Point loc, Dimension size)TsetBounds(Rectangle r)Sets the x and y coordinates and the width and height of thisAbstractRectangleBasedGeometryto the respective values of the givenRectangle.TsetHeight(double height)Sets the height of thisAbstractRectangleBasedGeometryto the given value.TsetLocation(double x, double y)Sets the x and y coordinates of thisAbstractRectangleBasedGeometryto the specified values.TsetLocation(Point p)Sets the x and y coordinates of thisAbstractRectangleBasedGeometryto the respective values of the givenPoint.TsetSize(double w, double h)Sets the width and height of thisAbstractRectangleBasedGeometryto the given values.TsetSize(Dimension d)Sets the width and height of thisAbstractRectangleBasedGeometryto the width and height of the givenDimension.TsetWidth(double width)Sets the width of thisAbstractRectangleBasedGeometryto the passed-in value.TsetX(double x)Sets the x-coordinate of thisAbstractRectangleBasedGeometryto the given value.TsetY(double y)Sets the y-coordinate of thisAbstractRectangleBasedGeometryto the given value.Tshrink(double h, double v)Shrinks the sides of thisAbstractRectangleBasedGeometryby the horizontal and vertical values provided as input, and returns thisAbstractRectangleBasedGeometryfor convenience.Tshrink(double left, double top, double right, double bottom)Shrinks thisAbstractRectangleBasedGeometryby the specified amounts.PathtoPath()java.lang.StringtoString()booleantouches(IGeometry g)Ttranslate(double dx, double dy)Translates the object by the given values in x and y direction.Ttranslate(Point p)Translates the object by the givenPoint.
-
-
-
Constructor Detail
-
RoundedRectangle
public RoundedRectangle(double x, double y, double width, double height, double arcWidth, double arcHeight)Constructs a newRoundedRectanglefrom the given bounds and arc values.- Parameters:
x- the x-coordinate of the newRoundedRectangle's boundsy- the y-coordinate of the newRoundedRectangle's boundswidth- the width of the newRoundedRectangle's boundsheight- the height of the newRoundedRectangle's boundsarcWidth- the arc width of the newRoundedRectanglerounded cornersarcHeight- the arc height of the newRoundedRectanglerounded corners
-
RoundedRectangle
public RoundedRectangle(Rectangle r, double arcWidth, double arcHeight)
Constructs a newRoundedRectanglefrom the bounds of the givenRectangleand the given arc values.- Parameters:
r- theRectangle, whose bounds are used to initialize the x, y, width, and height values of the newRoundedRectanglearcWidth- the arc width of the newRoundedRectanglerounded cornersarcHeight- the arc height of the newRoundedRectanglerounded corners
-
-
Method Detail
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
getArcHeight
public double getArcHeight()
Returns the arc height of thisRoundedRectangle, which is the height of the arc used to define its rounded corners.- Returns:
- the arc height
-
getArcWidth
public double getArcWidth()
Returns the arc width of thisRoundedRectangle, which is the width of the arc used to define its rounded corners.- Returns:
- the arc height
-
getBottom
public Line getBottom()
Returns the bottom edge of thisRoundedRectangle.- Returns:
- the bottom edge of this
RoundedRectangle.
-
getBottomLeftArc
public Arc getBottomLeftArc()
Returns the bottom leftArcof thisRoundedRectangle.- Returns:
- the bottom left
Arcof thisRoundedRectangle.
-
getBottomRightArc
public Arc getBottomRightArc()
Returns the bottom rightArcof thisRoundedRectangle.- Returns:
- the bottom right
Arcof thisRoundedRectangle.
-
getCopy
public RoundedRectangle getCopy()
Description copied from interface:IGeometryReturns a new identical copy of thisIGeometry.- Specified by:
getCopyin interfaceIGeometry- Returns:
- a copy identical to this
IGeometry - See Also:
IGeometry.getCopy()
-
getEffectiveArcHeight
protected double getEffectiveArcHeight()
Returns the effective arc height, i.e. clamped to the range[0;height].- Returns:
- the effective arc height, i.e. clamped to the range
[0;height].
-
getEffectiveArcWidth
protected double getEffectiveArcWidth()
Returns the effective arc width, i.e. clamped to the range[0;width].- Returns:
- the effective arc width, i.e. clamped to the range
[0;width].
-
getLeft
public Line getLeft()
Returns the left edge of thisRoundedRectangle.- Returns:
- the left edge of this
RoundedRectangle.
-
getOutline
public PolyBezier getOutline()
Description copied from interface:IShape- Specified by:
getOutlinein interfaceIShape- Returns:
- An
ICurverepresenting thisIShape's outline.
-
getOutlineSegments
public BezierCurve[] getOutlineSegments()
Description copied from interface:IShape- Specified by:
getOutlineSegmentsin interfaceIShape- Returns:
- The
ICurvesegments of thisIShape's outline. - See Also:
IShape.getOutlineSegments()
-
getRight
public Line getRight()
Returns the right edge of thisRoundedRectangle.- Returns:
- the right edge of this
RoundedRectangle.
-
getRotatedCCW
public PolyBezier getRotatedCCW(Angle angle)
Description copied from interface:IRotatableRotates the calling object by specifiedAnglecounter-clock-wise (CCW) around its centerPoint. Does not necessarily return an object of the same type.- Specified by:
getRotatedCCWin interfaceIRotatable<PolyBezier>- Parameters:
angle- rotationAngle- Returns:
- an
IGeometryrepresenting the result of the rotation
-
getRotatedCCW
public PolyBezier getRotatedCCW(Angle angle, double cx, double cy)
Description copied from interface:IRotatableRotates the calling object by the specifiedAnglecounter-clock-wise (CCW) around the specified centerPoint(cx, cy). Does not necessarily return an object of the same type.- Specified by:
getRotatedCCWin interfaceIRotatable<PolyBezier>- Parameters:
angle- rotationAnglecx- x-coordinate of the relativePointfor the rotationcy- y-coordinate of the relativePointfor the rotation- Returns:
- an
IGeometryrepresenting the result of the rotation
-
getRotatedCCW
public PolyBezier getRotatedCCW(Angle angle, Point center)
Description copied from interface:IRotatableRotates the calling object by the specifiedAnglecounter-clock-wise (CCW) around the specified centerPoint. Does not necessarily return an object of the same type.- Specified by:
getRotatedCCWin interfaceIRotatable<PolyBezier>- Parameters:
angle- rotationAnglecenter- relativePointfor the rotation- Returns:
- an
IGeometryrepresenting the result of the rotation
-
getRotatedCW
public PolyBezier getRotatedCW(Angle angle)
Description copied from interface:IRotatableRotates the calling object by specifiedAngleclock-wise (CW) around its centerPoint. Does not necessarily return an object of the same type.- Specified by:
getRotatedCWin interfaceIRotatable<PolyBezier>- Parameters:
angle- rotationAngle- Returns:
- an
IGeometryrepresenting the result of the rotation
-
getRotatedCW
public PolyBezier getRotatedCW(Angle angle, double cx, double cy)
Description copied from interface:IRotatableRotates the calling object by the specifiedAngleclock-wise (CW) around the specified centerPoint(cx, cy). Does not necessarily return an object of the same type.- Specified by:
getRotatedCWin interfaceIRotatable<PolyBezier>- Parameters:
angle- rotationAnglecx- x-coordinate of the relativePointfor the rotationcy- y-coordinate of the relativePointfor the rotation- Returns:
- an
IGeometryrepresenting the result of the rotation
-
getRotatedCW
public PolyBezier getRotatedCW(Angle angle, Point center)
Description copied from interface:IRotatableRotates the calling object by the specifiedAngleclock-wise (CW) around the specified centerPoint. Does not necessarily return an object of the same type.- Specified by:
getRotatedCWin interfaceIRotatable<PolyBezier>- Parameters:
angle- rotationAnglecenter- relativePointfor the rotation- Returns:
- an
IGeometryrepresenting the result of the rotation
-
getTop
public Line getTop()
Returns the top edge of thisRoundedRectangle.- Returns:
- the top edge of this
RoundedRectangle.
-
getTopLeftArc
public Arc getTopLeftArc()
Returns the top leftArcof thisRoundedRectangle.- Returns:
- the top left
Arcof thisRoundedRectangle.
-
getTopRightArc
public Arc getTopRightArc()
Returns the top rightArcof thisRoundedRectangle.- Returns:
- the top right
Arcof thisRoundedRectangle.
-
getTransformed
public CurvedPolygon getTransformed(AffineTransform t)
Default implementation returning a transformedPathrepresentation of thisIGeometry. Subclasses may override this method to return a more specific representation.- Specified by:
getTransformedin interfaceIGeometry- Specified by:
getTransformedin interfaceIShape- Parameters:
t- TheAffineTransformto be applied- Returns:
- a transformed
Pathrepresentation of thisIGeometry - See Also:
IGeometry.getTransformed(AffineTransform)
-
setArcHeight
public RoundedRectangle setArcHeight(double arcHeight)
Sets the arc height of thisRoundedRectangle, which is the height of the arc used to define its rounded corners.- Parameters:
arcHeight- the new arc height- Returns:
thisfor convenience
-
setArcWidth
public RoundedRectangle setArcWidth(double arcWidth)
Sets the arc width of thisRoundedRectangle, which is the width of the arc used to define its rounded corners.- Parameters:
arcWidth- the new arc width- Returns:
thisfor convenience
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
expand
public T expand(double h, double v)Expands the horizontal and vertical sides of thisAbstractRectangleBasedGeometrywith the values provided as input, and returnsthisfor convenience. The location of its center is kept constant.- Parameters:
h- the horizontal incrementv- the vertical increment- Returns:
thisfor convenience
-
expand
public T expand(double left, double top, double right, double bottom)Expands thisAbstractRectangleBasedGeometryby 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:
thisfor convenience
-
getCenter
public Point getCenter()
Returns the centerPointof thisAbstractRectangleBasedGeometry.- Returns:
- the center
Pointof thisAbstractRectangleBasedGeometry
-
getExpanded
public T getExpanded(double h, double v)Returns a new expandedAbstractRectangleBasedGeometry, where the sides are incremented by the horizontal and vertical values provided. The center of theAbstractRectangleBasedGeometryis maintained constant.- Parameters:
h- The horizontal incrementv- The vertical increment- Returns:
- a new expanded
AbstractRectangleBasedGeometry
-
getExpanded
public T getExpanded(double left, double top, double right, double bottom)Creates and returns a newAbstractRectangleBasedGeometrywith the bounds of thisAbstractRectangleBasedGeometryexpanded 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
public Point getLocation()
Returns aPointspecifying the x and y coordinates of thisAbstractRectangleBasedGeometry.- Returns:
- a
Pointrepresenting the x and y coordinates of thisAbstractRectangleBasedGeometry
-
getScaled
public T getScaled(double factor)
Description copied from interface:IScalableScales a copy of the calling object by the given factor relative to its centerPoint.
-
getScaled
public T getScaled(double factorX, double factorY)Description copied from interface:IScalableScales a copy of the calling object by the given factors relative to its centerPoint.
-
getScaled
public T getScaled(double factor, double centerX, double centerY)Description copied from interface:IScalableScales a copy of the calling object by the given factor relative to the given centerPoint(cx, cy).- Specified by:
getScaledin interfaceIScalable<T extends org.eclipse.gef.geometry.planar.AbstractRectangleBasedGeometry<?,?>>- Parameters:
factor- scale-factorcenterX- x-coordinate of the relativePointfor the scalingcenterY- y-coordinate of the relativePointfor the scaling- Returns:
- the new, scaled object
-
getScaled
public T getScaled(double factorX, double factorY, double centerX, double centerY)Description copied from interface:IScalableScales a copy of the calling object by the given factors relative to the given centerPoint(cx, cy).- Specified by:
getScaledin interfaceIScalable<T extends org.eclipse.gef.geometry.planar.AbstractRectangleBasedGeometry<?,?>>- Parameters:
factorX- x-scale-factorfactorY- y-scale-factorcenterX- x-coordinate of the relativePointfor the scalingcenterY- y-coordinate of the relativePointfor the scaling- Returns:
- the new, scaled object
-
getScaled
public T getScaled(double factorX, double factorY, Point center)Description copied from interface:IScalableScales a copy of the calling object by the given factors relative to the given centerPoint.
-
getScaled
public T getScaled(double factor, Point center)Description copied from interface:IScalableScales a copy of the calling object by the given factor relative to the given centerPoint.
-
getShrinked
public T getShrinked(double h, double v)Returns a newAbstractRectangleBasedGeometry, where the sides are shrinked by the horizontal and vertical values supplied. The center of thisAbstractRectangleBasedGeometryis kept constant.- Parameters:
h- horizontal reduction amountv- vertical reduction amount- Returns:
- a new, shrinked
AbstractRectangleBasedGeometry
-
getShrinked
public T getShrinked(double left, double top, double right, double bottom)Returns a newAbstractRectangleBasedGeometryshrinked 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
public final Dimension getSize()
Returns aDimensionthat records the width and height of thisAbstractRectangleBasedGeometry.- Returns:
- a
Dimensionthat records the width and height of thisAbstractRectangleBasedGeometry
-
getTranslated
public T getTranslated(double dx, double dy)Description copied from interface:ITranslatableTranslates a copy of this object by the given values in x and y direction.- Specified by:
getTranslatedin interfaceITranslatable<T extends org.eclipse.gef.geometry.planar.AbstractRectangleBasedGeometry<?,?>>- Parameters:
dx- x-translationdy- y-translation- Returns:
- a new, translated object
-
getTranslated
public T getTranslated(Point pt)
Description copied from interface:ITranslatableTranslates a copy of this object by the givenPoint.- Specified by:
getTranslatedin 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
public T scale(double factor)
Description copied from interface:IScalableScales the calling object by the given factor relative to its centerPoint.
-
scale
public T scale(double fx, double fy)Description copied from interface:IScalableScales the calling object by the given factors relative to the given centerPoint.
-
scale
public T scale(double factor, double cx, double cy)Description copied from interface:IScalableScales the calling object by the given factor relative to the given centerPoint(cx, cy).
-
scale
public T scale(double fx, double fy, double cx, double cy)Description copied from interface:IScalableScales the calling object by the given factors relative to the given centerPoint(cx, cy).- Specified by:
scalein interfaceIScalable<T extends org.eclipse.gef.geometry.planar.AbstractRectangleBasedGeometry<?,?>>- Parameters:
fx- x-scale-factorfy- y-scale-factorcx- x-coordinate of the relativePointfor the scalingcy- y-coordinate of the relativePointfor the scaling- Returns:
thisfor convenience
-
scale
public T scale(double fx, double fy, Point center)Description copied from interface:IScalableScales the calling object by the given factors relative to the given centerPoint.
-
scale
public T scale(double factor, Point center)Description copied from interface:IScalableScales the calling object by the given factor relative to the given centerPoint.
-
setBounds
public final T setBounds(double x, double y, double w, double h)Sets the x, y, width, and height values of thisAbstractRectangleBasedGeometryto the given values.- Parameters:
x- the new x-coordinatey- the new y-coordinatew- the new widthh- the new height- Returns:
thisfor convenience
-
setBounds
public final T setBounds(Rectangle r)
Sets the x and y coordinates and the width and height of thisAbstractRectangleBasedGeometryto the respective values of the givenRectangle.- Parameters:
r- theRectanglespecifying the new x, y, width, and height values of thisAbstractRectangleBasedGeometry- Returns:
thisfor convenience
-
setHeight
public final T setHeight(double height)
Sets the height of thisAbstractRectangleBasedGeometryto the given value.- Parameters:
height- the new height- Returns:
thisfor convenience
-
setLocation
public final T setLocation(double x, double y)Sets the x and y coordinates of thisAbstractRectangleBasedGeometryto the specified values.- Parameters:
x- the new x coordinate of thisAbstractRectangleBasedGeometryy- the new y coordinate of thisAbstractRectangleBasedGeometry- Returns:
thisfor convenience
-
setLocation
public final T setLocation(Point p)
Sets the x and y coordinates of thisAbstractRectangleBasedGeometryto the respective values of the givenPoint.- Parameters:
p- thePointspecifying the new x and y coordinates of thisAbstractRectangleBasedGeometry- Returns:
thisfor convenience
-
setSize
public final T setSize(Dimension d)
Sets the width and height of thisAbstractRectangleBasedGeometryto the width and height of the givenDimension.- Parameters:
d- theDimensionspecifying the new width and height of thisAbstractRectangleBasedGeometry- Returns:
thisfor convenience
-
setSize
public final T setSize(double w, double h)Sets the width and height of thisAbstractRectangleBasedGeometryto the given values.- Parameters:
w- the new width of thisAbstractRectangleBasedGeometryh- the new height of thisAbstractRectangleBasedGeometry- Returns:
thisfor convenience
-
setWidth
public final T setWidth(double width)
Sets the width of thisAbstractRectangleBasedGeometryto the passed-in value.- Parameters:
width- the new width of thisAbstractRectangleBasedGeometry- Returns:
thisfor convenience
-
setX
public final T setX(double x)
Sets the x-coordinate of thisAbstractRectangleBasedGeometryto the given value.- Parameters:
x- The new x-coordinate.- Returns:
thisfor convenience.
-
setY
public final T setY(double y)
Sets the y-coordinate of thisAbstractRectangleBasedGeometryto the given value.- Parameters:
y- The new y-coordinate.- Returns:
thisfor convenience.
-
shrink
public T shrink(double h, double v)Shrinks the sides of thisAbstractRectangleBasedGeometryby the horizontal and vertical values provided as input, and returns thisAbstractRectangleBasedGeometryfor convenience. The center of thisAbstractRectangleBasedGeometryis kept constant.- Parameters:
h- horizontal reduction amountv- vertical reduction amount- Returns:
thisfor convenience
-
shrink
public T shrink(double left, double top, double right, double bottom)Shrinks thisAbstractRectangleBasedGeometryby 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:
thisfor convenience
-
translate
public T translate(double dx, double dy)Description copied from interface:ITranslatableTranslates the object by the given values in x and y direction.- Specified by:
translatein interfaceITranslatable<T extends org.eclipse.gef.geometry.planar.AbstractRectangleBasedGeometry<?,?>>- Parameters:
dx- x-translationdy- y-translation- Returns:
thisfor convenience
-
translate
public T translate(Point p)
Description copied from interface:ITranslatableTranslates the object by the givenPoint.- Specified by:
translatein interfaceITranslatable<T extends org.eclipse.gef.geometry.planar.AbstractRectangleBasedGeometry<?,?>>- Parameters:
p- translationPoint- Returns:
thisfor convenience
-
clone
public java.lang.Object clone()
Overridden with public visibility as recommended withinCloneable.- Overrides:
clonein classjava.lang.Object
-
hashCode
public final int hashCode()
- Overrides:
hashCodein classjava.lang.Object- See Also:
Object.hashCode()
-
-