The Physiologist's Friend Simulation API

ch.unizh.ini.friend.graphics
Class SynchronizedSeparateTransforms

java.lang.Object
  extended by ch.unizh.ini.friend.graphics.SynchronizedSeparateTransforms
All Implemented Interfaces:
BufferedTransform, SeparateTransforms, Transformable, Cloneable

public class SynchronizedSeparateTransforms
extends Object
implements SeparateTransforms

Wrapper for SeperateTransforms to be thread-safe.

Version:
$Revision: 1.7 $
Author:
Christof Marti

Field Summary
protected  SeparateTransforms st
          The object to wrap.
 
Constructor Summary
SynchronizedSeparateTransforms(SeparateTransforms st)
          Creates a new instance that wraps the given object
 
Method Summary
 Transformable apply(AffineTransform at)
          Applies the given transformation to the geometric object.
 Object clone()
          Clones this geometric object.
 Transformable getGeometry()
          Returns the original geometric object.
 AffineTransform getRotation()
          Returns the buffered rotation.
 AffineTransform getScaling()
          Returns the buffered scaling.
 AffineTransform getTransformation()
          Returns the buffered generic transformation.
 Transformable getTransformed()
          Returns a Transformable with the buffered tranformation applied.
 AffineTransform getTranslation()
          Returns the buffered translation.
 Transformable rotate(float phi)
          Rotates the geometric object by the given angle around the origin.
 Transformable rotate(float phi, float x, float y)
          Rotates the geometric object by the given angle around the given point.
 Transformable rotateTo(float phi)
          Rotates the geometric object by the given angle around the origin.
 Transformable rotateTo(float phi, float x, float y)
          Rotates the geometric object by the given angle around the given point.
 Transformable scale(float sx, float sy)
          Scales the geomtric object by the given values in x- and y-coordinates with the origin as center.
 Transformable scale(float sx, float sy, float x, float y)
          Scales the geomtric object by the given values in x- and y-coordinates with the given center (x, y).
 Transformable scaleTo(float sx, float sy)
          Scales the geomtric object by the given values in x- and y-coordinates with the origin as center.
 Transformable scaleTo(float sx, float sy, float x, float y)
          Scales the geomtric object by the given values in x- and y-coordinates with the given center (x, y).
 void setGeometry(Transformable geometry)
          Sets the original geometric object.
 void setRotation(AffineTransform rotation)
          Sets the buffered rotation.
 void setScaling(AffineTransform scaling)
          Sets the buffered scaling.
 void setTransformation(AffineTransform transformation)
          Sets the buffered generic transformation.
 void setTranslation(AffineTransform translation)
          Sets the buffered translation.
 String toString()
          return string representation of the transforms
 Transformable translate(float dx, float dy)
          Translates the geometric object by the given coordinates.
 Transformable translateTo(float dx, float dy)
          Translates the geometric object by the given coordinates.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

st

protected SeparateTransforms st
The object to wrap.

Constructor Detail

SynchronizedSeparateTransforms

public SynchronizedSeparateTransforms(SeparateTransforms st)
Creates a new instance that wraps the given object

Parameters:
st - The object to wrap.
Method Detail

apply

public Transformable apply(AffineTransform at)
Applies the given transformation to the geometric object.

Specified by:
apply in interface Transformable
Parameters:
at - The affine transformation to apply.
Returns:
this for easy concatenation or a transformed clone.

getGeometry

public Transformable getGeometry()
Returns the original geometric object.

Specified by:
getGeometry in interface SeparateTransforms
Returns:
The geometric object.

getRotation

public AffineTransform getRotation()
Returns the buffered rotation.

Specified by:
getRotation in interface SeparateTransforms
Returns:
The rotation.

getScaling

public AffineTransform getScaling()
Returns the buffered scaling.

Specified by:
getScaling in interface SeparateTransforms
Returns:
The scaling.

getTransformation

public AffineTransform getTransformation()
Returns the buffered generic transformation.

Specified by:
getTransformation in interface SeparateTransforms
Returns:
The generic transformation.

getTransformed

public Transformable getTransformed()
Returns a Transformable with the buffered tranformation applied. The returned object should be a copy that is independent of this.

Specified by:
getTransformed in interface BufferedTransform
Specified by:
getTransformed in interface SeparateTransforms
Returns:
The transformed geometric object.

getTranslation

public AffineTransform getTranslation()
Returns the buffered translation.

Specified by:
getTranslation in interface SeparateTransforms
Returns:
The translation.

rotate

public Transformable rotate(float phi)
Rotates the geometric object by the given angle around the origin.

Specified by:
rotate in interface Transformable
Parameters:
phi - Rotation angle.
Returns:
this for easy concatenation or a transformed clone.

rotate

public Transformable rotate(float phi,
                            float x,
                            float y)
Rotates the geometric object by the given angle around the given point.

Specified by:
rotate in interface Transformable
Parameters:
phi - Rotation angle.
x - x-coordinate of the rotation center.
y - y-coordinate of the rotation center.
Returns:
this for easy concatenation or a transformed clone.

scale

public Transformable scale(float sx,
                           float sy)
Scales the geomtric object by the given values in x- and y-coordinates with the origin as center.

Specified by:
scale in interface Transformable
Parameters:
sx - Scalar for x-coordinates.
sy - Scalar for y-coordinates.
Returns:
this for easy concatenation or a transformed clone.

scale

public Transformable scale(float sx,
                           float sy,
                           float x,
                           float y)
Scales the geomtric object by the given values in x- and y-coordinates with the given center (x, y).

Specified by:
scale in interface Transformable
Parameters:
sx - Scalar for x-coordinates.
sy - Scalar for y-coordinates.
x - x-coordinate of the center.
y - y-coordinate of the center.
Returns:
this for easy concatenation or a transformed clone.

setGeometry

public void setGeometry(Transformable geometry)
Sets the original geometric object.

Specified by:
setGeometry in interface SeparateTransforms
Parameters:
geometry - The geometric object.

setRotation

public void setRotation(AffineTransform rotation)
Sets the buffered rotation.

Specified by:
setRotation in interface SeparateTransforms
Parameters:
rotation - The rotation.

setScaling

public void setScaling(AffineTransform scaling)
Sets the buffered scaling.

Specified by:
setScaling in interface SeparateTransforms
Parameters:
scaling - The scaling.

setTransformation

public void setTransformation(AffineTransform transformation)
Sets the buffered generic transformation.

Specified by:
setTransformation in interface SeparateTransforms
Parameters:
transformation - The generic transformation.

setTranslation

public void setTranslation(AffineTransform translation)
Sets the buffered translation.

Specified by:
setTranslation in interface SeparateTransforms
Parameters:
translation - The translation.

translate

public Transformable translate(float dx,
                               float dy)
Translates the geometric object by the given coordinates.

Specified by:
translate in interface Transformable
Parameters:
dx - Translation in x-coordinates.
dy - Translation in y-coordinates.
Returns:
this for easy concatenation or a transformed clone.

clone

public Object clone()
Clones this geometric object.

Specified by:
clone in interface Transformable
Overrides:
clone in class Object
Returns:
The clone.

rotateTo

public Transformable rotateTo(float phi)
Rotates the geometric object by the given angle around the origin. Overwrites the current rotation.

Specified by:
rotateTo in interface SeparateTransforms
Parameters:
phi - Rotation angle.
Returns:
this for easy concatenation or a transformed clone.

rotateTo

public Transformable rotateTo(float phi,
                              float x,
                              float y)
Rotates the geometric object by the given angle around the given point. Overwrites the current rotation.

Specified by:
rotateTo in interface SeparateTransforms
Parameters:
phi - Rotation angle.
x - x-coordinate of the rotation center.
y - y-coordinate of the rotation center.
Returns:
this for easy concatenation or a transformed clone.

scaleTo

public Transformable scaleTo(float sx,
                             float sy)
Scales the geomtric object by the given values in x- and y-coordinates with the origin as center. Overwrites the current scaling.

Specified by:
scaleTo in interface SeparateTransforms
Parameters:
sx - Scalar for x-coordinates.
sy - Scalar for y-coordinates.
Returns:
this for easy concatenation or a transformed clone.

scaleTo

public Transformable scaleTo(float sx,
                             float sy,
                             float x,
                             float y)
Scales the geomtric object by the given values in x- and y-coordinates with the given center (x, y). Overwrites the current scaling.

Specified by:
scaleTo in interface SeparateTransforms
Parameters:
sx - Scalar for x-coordinates.
sy - Scalar for y-coordinates.
x - x-coordinate of the center.
y - y-coordinate of the center.
Returns:
this for easy concatenation or a transformed clone.

translateTo

public Transformable translateTo(float dx,
                                 float dy)
Translates the geometric object by the given coordinates. Overwrites the current translation.

Specified by:
translateTo in interface SeparateTransforms
Parameters:
dx - Translation in x-coordinates.
dy - Translation in y-coordinates.
Returns:
this for easy concatenation or a transformed clone.

toString

public String toString()
return string representation of the transforms

Overrides:
toString in class Object

http://www.ini.unizh.ch/~tobi/friend