Class BaseRectangle

    • Constructor Detail

      • BaseRectangle

        public BaseRectangle()
        Initializes the string with "0 0 0 0".
      • BaseRectangle

        public BaseRectangle​(String s)
        Initializes the object with the string to parse.
        Parameters:
        s - the string to parse
      • BaseRectangle

        public BaseRectangle​(String s,
                             boolean isXYXY)
        Initializes the object with the string to parse.
        Parameters:
        s - the string to parse
        isXYXY - whether in format 'x0 y0 x1 y1' (true) or 'x y w h' (false)
      • BaseRectangle

        public BaseRectangle​(Rectangle location)
        Initializes the object with the location to use.
        Parameters:
        location - the location to use
      • BaseRectangle

        public BaseRectangle​(int x,
                             int y,
                             int w,
                             int h)
        Initializes the object with the string to parse.
        Parameters:
        x - the x of the top-left corner
        y - the y of the top-left corner
        w - the width
        h - the height
      • BaseRectangle

        public BaseRectangle​(int x,
                             int y,
                             int w_or_x,
                             int h_or_y,
                             boolean isXY)
        Initializes the object with the string to parse.
        Parameters:
        x - the x of the top-left corner
        y - the y of the top-left corner
        w_or_x - the width or x of bottom-right corner
        h_or_y - the height or y of bottom-right corner
        isXY - whether in format 'x0 y0 x1 y1' (true) or 'x y w h' (false)
      • BaseRectangle

        public BaseRectangle​(double x,
                             double y,
                             double w,
                             double h)
        Initializes the object with the string to parse.
        Parameters:
        x - the x of the top-left corner
        y - the y of the top-left corner
        w - the width
        h - the height
      • BaseRectangle

        public BaseRectangle​(double x,
                             double y,
                             double w_or_x,
                             double h_or_y,
                             boolean isXY)
        Initializes the object with the string to parse.
        Parameters:
        x - the x of the top-left corner
        y - the y of the top-left corner
        w_or_x - the width or x of bottom-right corner
        h_or_y - the height or y of bottom-right corner
        isXY - whether in format 'x0 y0 x1 y1' (true) or 'x y w h' (false)
    • Method Detail

      • isValid

        public boolean isValid​(String value)
        Checks whether the string value is a valid presentation for this class.
        Overrides:
        isValid in class AbstractBaseString
        Parameters:
        value - the string value to check
        Returns:
        true if non-null
      • doubleValue

        public double[] doubleValue()
        Returns the location as array (x, y, w, h).
        Returns:
        the location array
      • intValue

        public int[] intValue()
        Returns the location as array (x, y, w, h).
        Returns:
        the location array
      • rectangleValue

        public Rectangle rectangleValue()
        Returns the quadrilateral location.
        Returns:
        the quadrilateral
      • xyValue

        public String xyValue()
        Returns the rectangle in 'x0 y0 x1 y1' format.
        Returns:
        the string value
      • centerValue

        public Point2D centerValue()
        Returns the center of the quadrilateral.
        Returns:
        the center
      • getTipText

        public String getTipText()
        Returns a tool tip for the GUI editor (ignored if null is returned).
        Specified by:
        getTipText in class AbstractBaseString
        Returns:
        the tool tip
      • isValidFormat

        public static boolean isValidFormat​(String value)
        Checks whether the string value is a valid presentation for this class.
        Parameters:
        value - the string value to check
        Returns:
        true if non-null
      • fromXYXY

        public static String fromXYXY​(String x0y0x1y1)
        Parses the string in XY format and returns it in xywh format. Assumes there are 4 numbers present.
        Parameters:
        x0y0x1y1 - the string to parse
        Returns:
        the converted string
        See Also:
        isValidFormat(String)