Package snap.geom
Class RectBase
java.lang.Object
snap.geom.Shape
snap.geom.RectBase
- All Implemented Interfaces:
Cloneable
A Shape subclass to form the base class for generic rectangular shapes (Rect, Oval, Arc).
-
Field Summary
Fields inherited from class snap.geom.Shape
_bounds, WIND_EVEN_ODD, WIND_NON_ZERO
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionclone()
Standard clone implementation.Returns the shape in rect.Returns a copy of this shape transformed by given transform.boolean
Standard equals implementation.static boolean
Standard equals implementation.protected Rect
Returns the shape bounds.double
Returns the height.double
getMaxX()
Returns the max x.double
getMaxY()
Returns the max y.double
getMidX()
Returns the x mid-point of the rect.double
getMidY()
Returns the y mid-point of the rect.double
getMinX()
Returns the max x.double
getMinY()
Returns the max y.getSize()
Returns the size.Returns a String reprsentation of this rect.double
getWidth()
Returns the width.double
getX()
Returns the x.getXY()
Returns the rectangle x/y as a point.double
getY()
Returns the y.void
inset
(double anInset) Insets the receiver rect by the given amount.void
inset
(double xIns, double yIns) Insets the receiver rect by the given amount.void
Insets the receiver rect by the given amount.boolean
isEmpty()
Returns whether rect is empty.void
offset
(double dx, double dy) Offsets the receiver by the given x & y.void
setCenteredXY
(double aX, double aY) Sets the box centered around given X/Y.void
setHeight
(double aValue) Sets the height.void
setRect
(double x, double y, double w, double h) Sets the rect.void
Sets the rect.void
setSize
(double aWidth, double aHeight) Sets the size.void
setWidth
(double aValue) Sets the width.void
setX
(double aValue) Sets the x.void
setXY
(double aX, double aY) Sets the rectangle x/y.void
setY
(double aValue) Sets the y.toString()
Standard toString implementation.Methods inherited from class snap.geom.Shape
addShapes, contains, contains, contains, contains, containsSeg, copyForBounds, crossesSeg, getArcLength, getBounds, getCrossings, getDistance, getFlattenedShape, getFlattenedShape, getNotSelfIntersectingShape, getPathIter, intersectShapes, intersectsSeg, intersectsShape, intersectsShape, intersectsXY, isClosed, isFlat, isMultiCycle, isSelfIntersecting, isSingleCycle, shapeChanged, subtractShapes
-
Field Details
-
x
public double x -
y
public double y -
width
public double width -
height
public double height
-
-
Constructor Details
-
RectBase
public RectBase()
-
-
Method Details
-
getX
public double getX()Returns the x. -
setX
public void setX(double aValue) Sets the x. -
getY
public double getY()Returns the y. -
setY
public void setY(double aValue) Sets the y. -
getWidth
public double getWidth()Returns the width. -
setWidth
public void setWidth(double aValue) Sets the width. -
getHeight
public double getHeight()Returns the height. -
setHeight
public void setHeight(double aValue) Sets the height. -
getXY
Returns the rectangle x/y as a point. -
setXY
public void setXY(double aX, double aY) Sets the rectangle x/y. -
getSize
Returns the size. -
setSize
public void setSize(double aWidth, double aHeight) Sets the size. -
setRect
Sets the rect. -
setRect
public void setRect(double x, double y, double w, double h) Sets the rect. -
getMinX
public double getMinX()Returns the max x. -
getMinY
public double getMinY()Returns the max y. -
getMidX
public double getMidX()Returns the x mid-point of the rect. -
getMidY
public double getMidY()Returns the y mid-point of the rect. -
getMaxX
public double getMaxX()Returns the max x. -
getMaxY
public double getMaxY()Returns the max y. -
setCenteredXY
public void setCenteredXY(double aX, double aY) Sets the box centered around given X/Y. -
getBoundsImpl
Returns the shape bounds.- Overrides:
getBoundsImpl
in classShape
-
isEmpty
public boolean isEmpty()Returns whether rect is empty. -
inset
public void inset(double anInset) Insets the receiver rect by the given amount. -
inset
public void inset(double xIns, double yIns) Insets the receiver rect by the given amount. -
inset
Insets the receiver rect by the given amount. -
offset
public void offset(double dx, double dy) Offsets the receiver by the given x & y. -
copyFor
Returns the shape in rect. -
copyFor
Returns a copy of this shape transformed by given transform. -
getSvgString
Returns a String reprsentation of this rect.- Overrides:
getSvgString
in classShape
-
clone
Standard clone implementation. -
equals
Standard equals implementation. -
toString
Standard toString implementation. -
equals
Standard equals implementation.
-