Package org.eclipse.gef.geometry.planar
Class Arc
- java.lang.Object
-
- org.eclipse.gef.geometry.planar.Arc
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Cloneable
,ICurve
,IGeometry
,IRotatable<PolyBezier>
,IScalable<Arc>
,ITranslatable<Arc>
public final class Arc extends java.lang.Object implements ICurve
Represents the geometric shape of anArc
, which is defined by its enclosing framingRectangle
, a startAngle
(relative to the x-axis), and an angular extend in counter-clockwise (CCW) direction.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected Angle
angularExtent
The counter-clockwise (CCW)Angle
that spans thisAbstractArcBasedGeometry
.protected Angle
startAngle
The counter-clockwise (CCW)Angle
to the x-axis at which thisAbstractArcBasedGeometry
begins.
-
Constructor Summary
Constructors Constructor Description Arc(double x, double y, double width, double height, Angle startAngle, Angle angularExtent)
Constructs a newArc
of the given values.Arc(org.eclipse.gef.geometry.planar.AbstractRectangleBasedGeometry<?,?> r, Angle startAngle, Angle angularExtent)
Constructs a newArc
of the given values.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Object
clone()
Overridden with public visibility as recommended withinCloneable
.protected CubicCurve[]
computeBezierApproximation()
Computes aCubicCurve
approximation for thisAbstractArcBasedGeometry
.boolean
contains(Point p)
boolean
equals(java.lang.Object obj)
T
expand(double h, double v)
Expands the horizontal and vertical sides of thisAbstractRectangleBasedGeometry
with the values provided as input, and returnsthis
for convenience.T
expand(double left, double top, double right, double bottom)
Expands thisAbstractRectangleBasedGeometry
by the given amounts, and returns this for convenience.Angle
getAngularExtent()
Rectangle
getBounds()
Point
getCenter()
Returns the centerPoint
of thisAbstractRectangleBasedGeometry
.Arc
getCopy()
Returns a new identical copy of thisIGeometry
.T
getExpanded(double h, double v)
Returns a new expandedAbstractRectangleBasedGeometry
, where the sides are incremented by the horizontal and vertical values provided.T
getExpanded(double left, double top, double right, double bottom)
Creates and returns a newAbstractRectangleBasedGeometry
with the bounds of thisAbstractRectangleBasedGeometry
expanded by the given insets.double
getHeight()
Returns the height of thisAbstractRectangleBasedGeometry
.Point[]
getIntersections(ICurve c)
Point
getLocation()
Returns aPoint
specifying the x and y coordinates of thisAbstractRectangleBasedGeometry
.ICurve[]
getOverlaps(ICurve c)
Point
getP1()
Returns the startPoint
of thisAbstractArcBasedGeometry
.Point
getP2()
Returns the endPoint
of thisAbstractArcBasedGeometry
.Point
getPoint(Angle angularExtent)
Computes aPoint
on thisAbstractArcBasedGeometry
.Point
getProjection(Point reference)
PolyBezier
getRotatedCCW(Angle angle)
PolyBezier
getRotatedCCW(Angle angle, double cx, double cy)
PolyBezier
getRotatedCCW(Angle angle, Point center)
PolyBezier
getRotatedCW(Angle angle)
PolyBezier
getRotatedCW(Angle angle, double cx, double cy)
PolyBezier
getRotatedCW(Angle angle, Point center)
T
getScaled(double factor)
Scales a copy of the calling object by the given factor relative to its centerPoint
.T
getScaled(double factorX, double factorY)
Scales a copy of the calling object by the given factors relative to its centerPoint
.T
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).T
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).T
getScaled(double factorX, double factorY, Point center)
Scales a copy of the calling object by the given factors relative to the given centerPoint
.T
getScaled(double factor, Point center)
Scales a copy of the calling object by the given factor relative to the given centerPoint
.T
getShrinked(double h, double v)
Returns a newAbstractRectangleBasedGeometry
, where the sides are shrinked by the horizontal and vertical values supplied.T
getShrinked(double left, double top, double right, double bottom)
Returns a newAbstractRectangleBasedGeometry
shrinked by the specified insets.Dimension
getSize()
Returns aDimension
that records the width and height of thisAbstractRectangleBasedGeometry
.Angle
getStartAngle()
Returns thisAbstractArcBasedGeometry
's startAngle
.IGeometry
getTransformed(AffineTransform t)
T
getTranslated(double dx, double dy)
Translates a copy of this object by the given values in x and y direction.T
getTranslated(Point pt)
Translates a copy of this object by the givenPoint
.double
getWidth()
Returns the width of thisAbstractRectangleBasedGeometry
.double
getX()
Returns the x coordinate thisAbstractRectangleBasedGeometry
.double
getX1()
Returns the x coordinate of the startPoint
of thisAbstractArcBasedGeometry
.double
getX2()
Returns the x coordinate of the endPoint
of thisAbstractArcBasedGeometry
.double
getY()
Returns the y coordinate of thisAbstractRectangleBasedGeometry
.double
getY1()
Returns the y coordinate of the startPoint
of thisAbstractArcBasedGeometry
.double
getY2()
Returns the y coordinate of the endPoint
of thisAbstractArcBasedGeometry
.int
hashCode()
boolean
intersects(ICurve c)
boolean
overlaps(ICurve c)
T
scale(double factor)
Scales the calling object by the given factor relative to its centerPoint
.T
scale(double fx, double fy)
Scales the calling object by the given factors relative to the given centerPoint
.T
scale(double factor, double cx, double cy)
Scales the calling object by the given factor relative to the given centerPoint
(cx, cy).T
scale(double fx, double fy, double cx, double cy)
Scales the calling object by the given factors relative to the given centerPoint
(cx, cy).T
scale(double fx, double fy, Point center)
Scales the calling object by the given factors relative to the given centerPoint
.T
scale(double factor, Point center)
Scales the calling object by the given factor relative to the given centerPoint
.T
setAngularExtent(Angle angularExtent)
Sets the extensionAngle
of thisAbstractArcBasedGeometry
.T
setBounds(double x, double y, double w, double h)
Sets the x, y, width, and height values of thisAbstractRectangleBasedGeometry
to the given values.T
setBounds(Point loc, Dimension size)
T
setBounds(Rectangle r)
Sets the x and y coordinates and the width and height of thisAbstractRectangleBasedGeometry
to the respective values of the givenRectangle
.T
setHeight(double height)
Sets the height of thisAbstractRectangleBasedGeometry
to the given value.T
setLocation(double x, double y)
Sets the x and y coordinates of thisAbstractRectangleBasedGeometry
to the specified values.T
setLocation(Point p)
Sets the x and y coordinates of thisAbstractRectangleBasedGeometry
to the respective values of the givenPoint
.T
setSize(double w, double h)
Sets the width and height of thisAbstractRectangleBasedGeometry
to the given values.T
setSize(Dimension d)
Sets the width and height of thisAbstractRectangleBasedGeometry
to the width and height of the givenDimension
.T
setStartAngle(Angle startAngle)
Sets the startAngle
of thisAbstractArcBasedGeometry
.T
setWidth(double width)
Sets the width of thisAbstractRectangleBasedGeometry
to the passed-in value.T
setX(double x)
Sets the x-coordinate of thisAbstractRectangleBasedGeometry
to the given value.T
setY(double y)
Sets the y-coordinate of thisAbstractRectangleBasedGeometry
to the given value.T
shrink(double h, double v)
Shrinks the sides of thisAbstractRectangleBasedGeometry
by the horizontal and vertical values provided as input, and returns thisAbstractRectangleBasedGeometry
for convenience.T
shrink(double left, double top, double right, double bottom)
Shrinks thisAbstractRectangleBasedGeometry
by the specified amounts.CubicCurve[]
toBezier()
Computes a list ofBezierCurve
s that approximate theICurve
.Path
toPath()
java.lang.String
toString()
boolean
touches(IGeometry g)
T
translate(double dx, double dy)
Translates the object by the given values in x and y direction.T
translate(Point p)
Translates the object by the givenPoint
.-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.eclipse.gef.geometry.planar.ICurve
getP1, getP2, getX1, getX2, getY1, getY2
-
Methods inherited from interface org.eclipse.gef.geometry.planar.IGeometry
getTransformed, toPath, touches
-
-
-
-
Constructor Detail
-
Arc
public Arc(org.eclipse.gef.geometry.planar.AbstractRectangleBasedGeometry<?,?> r, Angle startAngle, Angle angularExtent)
Constructs a newArc
of the given values. AnArc
is cut out of anEllipse
. The startAngle
is the counter-clockwise (CCW)Angle
to the x-axis at which theArc
begins. The angular extent is the CCWAngle
that spans theArc
, i.e. the resulting endAngle
of theArc
is the sum of the startAngle
and the angular extent.
-
Arc
public Arc(double x, double y, double width, double height, Angle startAngle, Angle angularExtent)
Constructs a newArc
of the given values. AnArc
is cut out of anEllipse
. The startAngle
is the counter-clockwise (CCW)Angle
to the x-axis at which theArc
begins. The angular extent is the CCWAngle
that spans theArc
, i.e. the resulting endAngle
of theArc
is the sum of the startAngle
and the angular extent.- Parameters:
x
- the x coordinate of the bounds of theEllipse
of which theArc
is cut outy
- the y coordinate of the bounds of theEllipse
of which theArc
is cut outwidth
- the width of the bounds of theEllipse
of which theArc
is cut outheight
- the height of the bounds of theEllipse
of which theArc
is cut outstartAngle
- the CCWAngle
at which theArc
beginsangularExtent
- the CCWAngle
that spans theArc
-
-
Method Detail
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
getCopy
public Arc getCopy()
Description copied from interface:IGeometry
Returns a new identical copy of thisIGeometry
.
-
getIntersections
public Point[] getIntersections(ICurve c)
Description copied from interface:ICurve
- Specified by:
getIntersections
in interfaceICurve
- Parameters:
c
- TheICurve
to compute intersection points with.- Returns:
- The points of intersection.
-
getOverlaps
public ICurve[] getOverlaps(ICurve c)
Description copied from interface:ICurve
- Specified by:
getOverlaps
in interfaceICurve
- Parameters:
c
- The curve to compute overlaps with.- Returns:
- The segments where both curves overlap.
-
getProjection
public Point getProjection(Point reference)
Description copied from interface:ICurve
Returns a projection of the given referencePoint
onto thisICurve
, i.e. aPoint
on thisICurve
that is closest to the given referencePoint
. Note, that- Specified by:
getProjection
in interfaceICurve
- Parameters:
reference
- The referencePoint
for which to return the projection.- Returns:
- The projection of the given reference
Point
onto thisICurve
.
-
getRotatedCCW
public PolyBezier getRotatedCCW(Angle angle)
Description copied from interface:IRotatable
Rotates the calling object by specifiedAngle
counter-clock-wise (CCW) around its centerPoint
. Does not necessarily return an object of the same type.- Specified by:
getRotatedCCW
in interfaceIRotatable<PolyBezier>
- Parameters:
angle
- rotationAngle
- Returns:
- an
IGeometry
representing the result of the rotation
-
getRotatedCCW
public PolyBezier getRotatedCCW(Angle angle, double cx, double cy)
Description copied from interface:IRotatable
Rotates the calling object by the specifiedAngle
counter-clock-wise (CCW) around the specified centerPoint
(cx, cy). Does not necessarily return an object of the same type.- Specified by:
getRotatedCCW
in interfaceIRotatable<PolyBezier>
- Parameters:
angle
- rotationAngle
cx
- x-coordinate of the relativePoint
for the rotationcy
- y-coordinate of the relativePoint
for the rotation- Returns:
- an
IGeometry
representing the result of the rotation
-
getRotatedCCW
public PolyBezier getRotatedCCW(Angle angle, Point center)
Description copied from interface:IRotatable
Rotates the calling object by the specifiedAngle
counter-clock-wise (CCW) around the specified centerPoint
. Does not necessarily return an object of the same type.- Specified by:
getRotatedCCW
in interfaceIRotatable<PolyBezier>
- Parameters:
angle
- rotationAngle
center
- relativePoint
for the rotation- Returns:
- an
IGeometry
representing the result of the rotation
-
getRotatedCW
public PolyBezier getRotatedCW(Angle angle)
Description copied from interface:IRotatable
Rotates the calling object by specifiedAngle
clock-wise (CW) around its centerPoint
. Does not necessarily return an object of the same type.- Specified by:
getRotatedCW
in interfaceIRotatable<PolyBezier>
- Parameters:
angle
- rotationAngle
- Returns:
- an
IGeometry
representing the result of the rotation
-
getRotatedCW
public PolyBezier getRotatedCW(Angle angle, double cx, double cy)
Description copied from interface:IRotatable
Rotates the calling object by the specifiedAngle
clock-wise (CW) around the specified centerPoint
(cx, cy). Does not necessarily return an object of the same type.- Specified by:
getRotatedCW
in interfaceIRotatable<PolyBezier>
- Parameters:
angle
- rotationAngle
cx
- x-coordinate of the relativePoint
for the rotationcy
- y-coordinate of the relativePoint
for the rotation- Returns:
- an
IGeometry
representing the result of the rotation
-
getRotatedCW
public PolyBezier getRotatedCW(Angle angle, Point center)
Description copied from interface:IRotatable
Rotates the calling object by the specifiedAngle
clock-wise (CW) around the specified centerPoint
. Does not necessarily return an object of the same type.- Specified by:
getRotatedCW
in interfaceIRotatable<PolyBezier>
- Parameters:
angle
- rotationAngle
center
- relativePoint
for the rotation- Returns:
- an
IGeometry
representing the result of the rotation
-
intersects
public boolean intersects(ICurve c)
Description copied from interface:ICurve
Tests if thisICurve
and the givenICurve
intersect, i.e. whether a final set of intersection points exists. Two curves intersect if they touch (seeIGeometry.touches(IGeometry)
) but do not overlap (seeICurve.overlaps(ICurve)
).- Specified by:
intersects
in interfaceICurve
- Parameters:
c
- TheICurve
to test for intersections.- Returns:
true
if they intersect,false
otherwise
-
overlaps
public boolean overlaps(ICurve c)
Description copied from interface:ICurve
Tests if thisICurve
and the givenICurve
overlap, i.e. whether an infinite set of intersection points exists. Two curves overlap if they touch (seeIGeometry.touches(IGeometry)
) but not intersect (seeICurve.intersects(ICurve)
).
-
toBezier
public CubicCurve[] toBezier()
Description copied from interface:ICurve
Computes a list ofBezierCurve
s that approximate theICurve
. For example, aLine
or aBezierCurve
in general could return a list with the curve itself as its only element. But anEllipse
or anArc
may return a list of consecutiveBezierCurve
s which approximate theICurve
.- Specified by:
toBezier
in interfaceICurve
- Returns:
- a list of
BezierCurve
s that approximate theICurve
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
computeBezierApproximation
protected CubicCurve[] computeBezierApproximation()
Computes aCubicCurve
approximation for thisAbstractArcBasedGeometry
. It is approximated by a maximum of fourCubicCurve
s, each of which covers a maximum of 90 degrees.- Returns:
- a
CubicCurve
approximation for thisAbstractArcBasedGeometry
-
getAngularExtent
public Angle getAngularExtent()
Returns the extensionAngle
of thisAbstractArcBasedGeometry
, i.e. theAngle
defining the span of thisAbstractArcBasedGeometry
.- Returns:
- the extension
Angle
of thisAbstractArcBasedGeometry
-
getP1
public Point getP1()
Returns the startPoint
of thisAbstractArcBasedGeometry
.- Returns:
- the start
Point
of thisAbstractArcBasedGeometry
-
getP2
public Point getP2()
Returns the endPoint
of thisAbstractArcBasedGeometry
.- Returns:
- the end
Point
of thisAbstractArcBasedGeometry
-
getStartAngle
public Angle getStartAngle()
Returns thisAbstractArcBasedGeometry
's startAngle
.- Returns:
- this
AbstractArcBasedGeometry
's startAngle
-
getX1
public double getX1()
Returns the x coordinate of the startPoint
of thisAbstractArcBasedGeometry
.- Returns:
- the x coordinate of the start
Point
of thisAbstractArcBasedGeometry
-
getX2
public double getX2()
Returns the x coordinate of the endPoint
of thisAbstractArcBasedGeometry
.- Returns:
- the x coordinate of the end
Point
of thisAbstractArcBasedGeometry
-
getY1
public double getY1()
Returns the y coordinate of the startPoint
of thisAbstractArcBasedGeometry
.- Returns:
- the y coordinate of the start
Point
of thisAbstractArcBasedGeometry
-
getY2
public double getY2()
Returns the y coordinate of the endPoint
of thisAbstractArcBasedGeometry
.- Returns:
- the y coordinate of the end
Point
of thisAbstractArcBasedGeometry
-
setAngularExtent
public T setAngularExtent(Angle angularExtent)
Sets the extensionAngle
of thisAbstractArcBasedGeometry
.- Parameters:
angularExtent
- the new extensionAngle
for thisAbstractArcBasedGeometry
- Returns:
this
for convenience
-
setStartAngle
public T setStartAngle(Angle startAngle)
Sets the startAngle
of thisAbstractArcBasedGeometry
.- Parameters:
startAngle
- the new startAngle
for thisAbstractArcBasedGeometry
- Returns:
this
for convenience
-
toPath
public Path toPath()
Description copied from interface:IGeometry
- Returns:
- A new
Path
representation for thisIGeometry
. - See Also:
IGeometry.toPath()
-
expand
public T expand(double h, double v)
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
public T expand(double left, double top, double right, double bottom)
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
-
getCenter
public Point getCenter()
Returns the centerPoint
of thisAbstractRectangleBasedGeometry
.- Returns:
- the center
Point
of 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 theAbstractRectangleBasedGeometry
is 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 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
public Point getLocation()
Returns aPoint
specifying the x and y coordinates of thisAbstractRectangleBasedGeometry
.- Returns:
- a
Point
representing the x and y coordinates of thisAbstractRectangleBasedGeometry
-
getScaled
public T getScaled(double factor)
Description copied from interface:IScalable
Scales 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:IScalable
Scales 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: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
public T getScaled(double factorX, double factorY, double centerX, double centerY)
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
public T getScaled(double factorX, double factorY, Point center)
Description copied from interface:IScalable
Scales 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:IScalable
Scales 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 thisAbstractRectangleBasedGeometry
is 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 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
public final Dimension getSize()
Returns aDimension
that records the width and height of thisAbstractRectangleBasedGeometry
.- Returns:
- a
Dimension
that records the width and height of thisAbstractRectangleBasedGeometry
-
getTranslated
public T getTranslated(double dx, double dy)
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
public T getTranslated(Point pt)
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
public T scale(double factor)
Description copied from interface:IScalable
Scales the calling object by the given factor relative to its centerPoint
.
-
scale
public T scale(double fx, double fy)
Description copied from interface:IScalable
Scales 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:IScalable
Scales 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: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
public T scale(double fx, double fy, Point center)
Description copied from interface:IScalable
Scales the calling object by the given factors relative to the given centerPoint
.
-
scale
public T scale(double factor, Point center)
Description copied from interface:IScalable
Scales 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 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
public final T setBounds(Rectangle r)
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
public final T setHeight(double height)
Sets the height of thisAbstractRectangleBasedGeometry
to the given value.- Parameters:
height
- the new height- Returns:
this
for convenience
-
setLocation
public final T setLocation(double x, double y)
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
public final T setLocation(Point p)
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
public final T setSize(Dimension d)
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
public final T setSize(double w, double h)
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
public final T setWidth(double width)
Sets the width of thisAbstractRectangleBasedGeometry
to the passed-in value.- Parameters:
width
- the new width of thisAbstractRectangleBasedGeometry
- Returns:
this
for convenience
-
setX
public final T setX(double x)
Sets the x-coordinate of thisAbstractRectangleBasedGeometry
to the given value.- Parameters:
x
- The new x-coordinate.- Returns:
this
for convenience.
-
setY
public final T setY(double y)
Sets the y-coordinate of thisAbstractRectangleBasedGeometry
to the given value.- Parameters:
y
- The new y-coordinate.- Returns:
this
for convenience.
-
shrink
public T shrink(double h, double v)
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
public T shrink(double left, double top, double right, double bottom)
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
public T translate(double dx, double dy)
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
public T translate(Point p)
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
public java.lang.Object clone()
Overridden with public visibility as recommended withinCloneable
.- Overrides:
clone
in classjava.lang.Object
-
getTransformed
public IGeometry getTransformed(AffineTransform t)
Default implementation returning a transformedPath
representation of thisIGeometry
. Subclasses may override this method to return a more specific representation.- Specified by:
getTransformed
in interfaceIGeometry
- Parameters:
t
- TheAffineTransform
to be applied- Returns:
- a transformed
Path
representation of thisIGeometry
-
hashCode
public final int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
- See Also:
Object.hashCode()
-
-