Class GObject

    • Field Detail

      • gAttributeManager

        private final GAttributeManager gAttributeManager
        the manager to manage the state of this object
      • drawShape

        protected Shape drawShape
        the actual shape object that shows on the canvas
    • Constructor Detail

      • GObject

        protected GObject​(Double x,
                          Double y,
                          Color col,
                          Boolean filled,
                          Integer lineWidth,
                          Double width,
                          Double height,
                          Double x2,
                          Double y2,
                          Boolean visible,
                          String fontName,
                          Integer fontStyle,
                          Double fontSize,
                          String textString)
        the constructor will call the GAttributeManager to manage all the attributes
        Parameters:
        x - location, x
        y - location, y
        col - paint color
        filled - whether filled
        lineWidth - width of lines
        width - width of the object, if applicable
        height - height of the object, if applicable
        x2 - x2 of the object, if applicable
        y2 - y2 of the object, if applicable
        visible - whether visible
        fontName - font name
        fontSize - font size
        fontStyle - plain, bold, or italic
        textString - the text content
    • Method Detail

      • draw

        public abstract void draw​(Graphics2D g)
        generate the shape to draw
        Parameters:
        g - the Graphics to paint
      • inShape

        public boolean inShape​(double mx,
                               double my)
        Whether the given position is in this object
        Parameters:
        mx - x
        my - y
        Returns:
        True if in the object
      • getAttributeManager

        public GAttributeManager getAttributeManager()
        Get the attribute manager of this object
        Returns:
        the attribute manager
      • getCurrentAttributes

        public GAttributesI getCurrentAttributes()
        Get the attributes for the current state
        Returns:
        current attributes
      • getResizePoints

        public Point2D[] getResizePoints()
        get the position of the diagonal points to draw the resize points
        Returns:
        diagonal points