org.jdrawing.graphics
Class AbstractDrawRect

java.lang.Object
  extended byorg.jdrawing.graphics.GraphicsOperation
      extended byorg.jdrawing.graphics.RectangleOperation
          extended byorg.jdrawing.graphics.AbstractDrawRect
All Implemented Interfaces:
DrawingElement
Direct Known Subclasses:
Draw3DRect, DrawRect

public abstract class AbstractDrawRect
extends RectangleOperation

Base class for drawing operations, which outlines the rectangle.


Constructor Summary
AbstractDrawRect(int x, int y, int width, int height)
          Returns AbstractDrawRect with given rectangle.
AbstractDrawRect(int x, int y, int width, int height, Style style)
          Returns AbstractDrawRect with given rectangle.
 
Method Summary
 boolean contains(java.awt.geom.Point2D point)
          Tests if the element contains a given point.
 java.awt.Rectangle getBounds()
          Returns bounding box of the element.
 java.awt.geom.Rectangle2D getBounds2D()
          Returns high precision bounding box of the element.
 java.awt.Shape getShapeOfOperation()
          Returns shape of the area updated by this operation.
 boolean intersects(java.awt.geom.Rectangle2D rectangle)
          Tests if the element intersects with the given rectangle.
 
Methods inherited from class org.jdrawing.graphics.RectangleOperation
getHeight, getWidth, getX, getY, setHeight, setRectangle, setWidth, setX, setY
 
Methods inherited from class org.jdrawing.graphics.GraphicsOperation
getPosition, getStyle, paint, paintOperation, setPosition, setStyle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractDrawRect

public AbstractDrawRect(int x,
                        int y,
                        int width,
                        int height)
Returns AbstractDrawRect with given rectangle.

Parameters:
x - left edge of the rectangle
y - top edge of the rectange
width - width of the rectangle
height - height of the rectange

AbstractDrawRect

public AbstractDrawRect(int x,
                        int y,
                        int width,
                        int height,
                        Style style)
Returns AbstractDrawRect with given rectangle.

Parameters:
x - left edge of the rectangle
y - top edge of the rectangle
width - width of the rectangle
height - height of the rectangle
Method Detail

getBounds

public java.awt.Rectangle getBounds()
Returns bounding box of the element. If the element is unbounded then this method returns null.

Specified by:
getBounds in interface DrawingElement
Overrides:
getBounds in class GraphicsOperation
Returns:
bounding box of the element or null is the element is unbounded

getBounds2D

public java.awt.geom.Rectangle2D getBounds2D()
Returns high precision bounding box of the element. If the element is unbounded then this method returns null.

Specified by:
getBounds2D in interface DrawingElement
Overrides:
getBounds2D in class GraphicsOperation
Returns:
high precision bounding box of the element or null if the element is unbounded

intersects

public boolean intersects(java.awt.geom.Rectangle2D rectangle)
Tests if the element intersects with the given rectangle.

Specified by:
intersects in interface DrawingElement
Overrides:
intersects in class GraphicsOperation
Parameters:
rectangle - rectangle to be checked for intersection
Returns:
true if the element intersects with the given rectangle; false otherwase

contains

public boolean contains(java.awt.geom.Point2D point)
Tests if the element contains a given point.

Specified by:
contains in interface DrawingElement
Overrides:
contains in class GraphicsOperation
Parameters:
point - to be checked
Returns:
true if the element contains a given point; false otherwise

getShapeOfOperation

public java.awt.Shape getShapeOfOperation()
Returns shape of the area updated by this operation.

Specified by:
getShapeOfOperation in class GraphicsOperation
Returns:
the shape of updated area