Package snap.geom

Class RectBase

java.lang.Object
snap.geom.Shape
snap.geom.RectBase
All Implemented Interfaces:
Cloneable
Direct Known Subclasses:
Arc, Ellipse, Rect, RoundRect

public abstract class RectBase extends Shape implements Cloneable
A Shape subclass to form the base class for generic rectangular shapes (Rect, Oval, Arc).
  • 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.
      Overrides:
      getX in class Shape
    • setX

      public void setX(double aValue)
      Sets the x.
    • getY

      public double getY()
      Returns the y.
      Overrides:
      getY in class Shape
    • setY

      public void setY(double aValue)
      Sets the y.
    • getWidth

      public double getWidth()
      Returns the width.
      Overrides:
      getWidth in class Shape
    • setWidth

      public void setWidth(double aValue)
      Sets the width.
    • getHeight

      public double getHeight()
      Returns the height.
      Overrides:
      getHeight in class Shape
    • setHeight

      public void setHeight(double aValue)
      Sets the height.
    • getXY

      public Point getXY()
      Returns the rectangle x/y as a point.
    • setXY

      public void setXY(double aX, double aY)
      Sets the rectangle x/y.
    • getSize

      public Size getSize()
      Returns the size.
    • setSize

      public void setSize(double aWidth, double aHeight)
      Sets the size.
    • setRect

      public void setRect(Rect r)
      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

      protected Rect getBoundsImpl()
      Returns the shape bounds.
      Overrides:
      getBoundsImpl in class Shape
    • 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

      public void inset(Insets anIns)
      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

      public Shape copyFor(Rect aRect)
      Returns the shape in rect.
      Overrides:
      copyFor in class Shape
    • copyFor

      public Shape copyFor(Transform aTrans)
      Returns a copy of this shape transformed by given transform.
      Overrides:
      copyFor in class Shape
    • getSvgString

      public String getSvgString()
      Returns a String reprsentation of this rect.
      Overrides:
      getSvgString in class Shape
    • clone

      public RectBase clone()
      Standard clone implementation.
      Overrides:
      clone in class Object
    • equals

      public boolean equals(Object anObj)
      Standard equals implementation.
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Standard toString implementation.
      Overrides:
      toString in class Shape
    • equals

      public static boolean equals(Rect aRect, double aX, double aY, double aW, double aH)
      Standard equals implementation.