org.jdrawing
Class TransformingDrawingElementRenderer

java.lang.Object
  extended byorg.jdrawing.TransformingDrawingElementRenderer
All Implemented Interfaces:
DrawingElementRenderer

public class TransformingDrawingElementRenderer
extends java.lang.Object
implements DrawingElementRenderer

This implementation of DrawingElementRenderer allows user to apply affine transform to drawing. It actually does not render any elements but delegates rendering requests to another element renderer.


Constructor Summary
TransformingDrawingElementRenderer(java.awt.geom.AffineTransform transform, DrawingElementRenderer renderer)
          Returns a TransformingDrawingElementRenderer with given transform and renderer.
 
Method Summary
 boolean elementContains(java.lang.Object element, java.awt.geom.Point2D point)
          Tests if the given element contains the given point.
 boolean elementIntersects(java.lang.Object element, java.awt.geom.Rectangle2D rectangle)
          Tests if the given element intersects with the given rectangle.
 java.awt.Rectangle getElementBounds(java.lang.Object element)
          Gets the bounding box for the element.
 java.awt.geom.Rectangle2D getElementBounds2D(java.lang.Object element)
          Return the high precision bounding box of the element.
 DrawingElementRenderer getRenderer()
          Gets the DrawingElementRenderer which is used by this renderer to delegate rendering requests to.
 java.awt.geom.AffineTransform getTransform()
          Gets the AffineTransform used by this transforming renderer.
 void paintDrawingElement(java.awt.Graphics graphics, java.lang.Object element)
          Paints the given element.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TransformingDrawingElementRenderer

public TransformingDrawingElementRenderer(java.awt.geom.AffineTransform transform,
                                          DrawingElementRenderer renderer)
Returns a TransformingDrawingElementRenderer with given transform and renderer.

Parameters:
transform - an AffineTransform to be applied to drawing
renderer - a DrawingElementRenderer which all rendering requests will be delegated to
Method Detail

getTransform

public java.awt.geom.AffineTransform getTransform()
Gets the AffineTransform used by this transforming renderer.

Returns:
transform used by this renderer

getRenderer

public DrawingElementRenderer getRenderer()
Gets the DrawingElementRenderer which is used by this renderer to delegate rendering requests to.

Returns:
renderer used to delegate rendering requests

paintDrawingElement

public void paintDrawingElement(java.awt.Graphics graphics,
                                java.lang.Object element)
Paints the given element.

Specified by:
paintDrawingElement in interface DrawingElementRenderer
Parameters:
graphics - graphics context to use for painting
element - element to be painted

getElementBounds

public java.awt.Rectangle getElementBounds(java.lang.Object element)
Gets the bounding box for the element.

Specified by:
getElementBounds in interface DrawingElementRenderer
Parameters:
element - element to be queried for bounding box
Returns:
bounding box of the element

getElementBounds2D

public java.awt.geom.Rectangle2D getElementBounds2D(java.lang.Object element)
Return the high precision bounding box of the element.

Specified by:
getElementBounds2D in interface DrawingElementRenderer
Parameters:
element - element to be queried for bounding box
Returns:
high precision bounding box of the element

elementIntersects

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

Specified by:
elementIntersects in interface DrawingElementRenderer
Parameters:
element - element to be checked for intersection
rectangle - rectangle to be checked for intersection
Returns:
true the given element intersects with the given rectangle; false otherwise

elementContains

public boolean elementContains(java.lang.Object element,
                               java.awt.geom.Point2D point)
Tests if the given element contains the given point.

Specified by:
elementContains in interface DrawingElementRenderer
Parameters:
element - element to be checked
point - point to be checked
Returns:
true the given element contains the given point; false otherwise