visual.statik
Class AbstractTransformableContent

java.lang.Object
  extended by visual.statik.AbstractTransformableContent
All Implemented Interfaces:
SimpleContent, TransformableContent
Direct Known Subclasses:
AbstractAggregateContent, Content, Content

public abstract class AbstractTransformableContent
extends java.lang.Object
implements TransformableContent

A partial implementation of the TransformableContent interface that keeps track of transformation information

See Also:
"The Design and Implementation of Multimedia Software © 2011"

Field Summary
protected  double angle
           
protected  boolean relocated
           
protected  boolean rerotated
           
protected  boolean rescaled
           
protected  double x
           
protected  double xRotation
           
protected  double xScale
           
protected  double y
           
protected  double yRotation
           
protected  double yScale
           
 
Constructor Summary
AbstractTransformableContent()
          Default Constructor
 
Method Summary
protected  java.awt.geom.AffineTransform getAffineTransform()
          Get the (concatenated) AffineTransform
 java.awt.geom.Rectangle2D getBounds2D()
          Returns a high precision bounding box of the appropriately transformed content
abstract  java.awt.geom.Rectangle2D getBounds2D(boolean transformed)
          Returns a high precision bounding box of the Content either before or after it is transformed
protected  boolean isTransformationRequired()
          Does this AbstractTransformableContent object need to be transformed before being used?
 void setLocation(double x, double y)
          Set the translation (required by TransformedContent)
 void setRotation(double angle, double x, double y)
          Set the angle of rotation around the midpoint (required by TransformedContent)
 void setScale(double scale)
          Set the scaling
 void setScale(double xScale, double yScale)
          Set the scaling (required by TransformedContent)
protected  void setTransformationRequired(boolean required)
          Set whether this AbstractTransformableContent object needs to be transformed before being used
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface visual.statik.SimpleContent
render
 

Field Detail

relocated

protected boolean relocated

rerotated

protected boolean rerotated

rescaled

protected boolean rescaled

angle

protected double angle

xScale

protected double xScale

yScale

protected double yScale

x

protected double x

y

protected double y

xRotation

protected double xRotation

yRotation

protected double yRotation
Constructor Detail

AbstractTransformableContent

public AbstractTransformableContent()
Default Constructor

Method Detail

getAffineTransform

protected java.awt.geom.AffineTransform getAffineTransform()
Get the (concatenated) AffineTransform

Returns:
The rotation, scaling and translation concatenated

getBounds2D

public java.awt.geom.Rectangle2D getBounds2D()
Returns a high precision bounding box of the appropriately transformed content

Returns:
The bounding box

getBounds2D

public abstract java.awt.geom.Rectangle2D getBounds2D(boolean transformed)
Returns a high precision bounding box of the Content either before or after it is transformed

Specified by:
getBounds2D in interface TransformableContent
Parameters:
transformed - true to get the BB of the transformed content
Returns:
The bounding box

setLocation

public void setLocation(double x,
                        double y)
Set the translation (required by TransformedContent)

Specified by:
setLocation in interface TransformableContent
Parameters:
x - The x posiiton
y - The y position

setRotation

public void setRotation(double angle,
                        double x,
                        double y)
Set the angle of rotation around the midpoint (required by TransformedContent)

Specified by:
setRotation in interface TransformableContent
Parameters:
angle - The rotation angle
x - The x-coordinate of the point to rotate around
y - The y-coordinate of the point to rotate around

setScale

public void setScale(double xScale,
                     double yScale)
Set the scaling (required by TransformedContent)

Specified by:
setScale in interface TransformableContent
Parameters:
xScale - The scaling in the horizontal dimension
yScale - The scaling in the vertical dimension

setScale

public void setScale(double scale)
Set the scaling

Parameters:
scale - The scaling (in both dimensions)

setTransformationRequired

protected void setTransformationRequired(boolean required)
Set whether this AbstractTransformableContent object needs to be transformed before being used

Parameters:
required - true to indicate that a transformation is requried

isTransformationRequired

protected boolean isTransformationRequired()
Does this AbstractTransformableContent object need to be transformed before being used?

Returns:
true to indicate a transformation is required


Design and Implementation of Multimedia Software, Jones and Bartlett Publishers