gishur.graph.gui
Class ScreenGraphTransformation

java.lang.Object
  |
  +--gishur.gui2.ScreenTransformation
        |
        +--gishur.graph.gui.ScreenGraphTransformation

public class ScreenGraphTransformation
extends ScreenTransformation

Transformation class for graphical output of Graphs. This class converts the position information stored in java.awt.Point-objects into screen coordinates and vice versa. There are methods which seem to accept or return Objects, e.g. transform(Object) or inverseTransform(Point). This is only a consequence of the general interface of ScreenTransformations, which must be implemented here, in fact these methods only work with java.awt.Point-objects and only return Points as well.

Version:
1.0
Author:
Christoph Sachse

Constructor Summary
ScreenGraphTransformation()
          Default constructor.
 
Method Summary
 java.awt.Point deltaTransform(java.lang.Object vis)
          Transforms a relative distance vector in user space to a relative distance vector in screen coordinates.
 java.awt.Point[] deltaTransform(java.lang.Object[] visa, int off, int len)
          Transforms a subarray of relative distance vectors in user space (represented by the coordinates of the given FloatPoint-objects) to a relative distance vector array in screen coordinates.
 java.lang.Object inverseDeltaTransform(java.awt.Point point)
          Transforms a relative distance vector in screen coordinates to a relative distance vector user space, represented by a FloatPoint.
 java.lang.Object inverseDeltaTransform(java.awt.Point[] points, int off, int len)
          Transforms a subarray of relative distance vectors in screen coordinates to an array of user space coordinates.
 AffineTransformation inverseTransform(double m00, double m01, double m02, double m10, double m11, double m12)
          Transforms the given transformation matrix for an affine transformation in screen coordinates to a transformation matrix in user space that does the same transformation with the original object.
 java.lang.Object inverseTransform(int x, int y)
          Transforms one point on the screen to a point object in user space.
 java.lang.Object inverseTransform(java.awt.Point p)
          Transforms a Point on the screen to a point object in user space.
 java.lang.Object[] inverseTransform(java.awt.Point[] points, int off, int len)
          Transforms a subarray of points in screen coordinates to an array of FloatPoints representing the user space coordinates.
 void resetTransform()
          Resets the ScreenTransformation to its initial values (identity).
 void restoreStatus(java.lang.Object status)
          Restores a state saved via saveStatus().
 java.lang.Object saveStatus()
          Returns the status of the ScreenTransformation to restore it via restoreStatus(java.lang.Object).
 void screenTransform(double m00, double m01, double m02, double m10, double m11, double m12)
          Transforms the ScreenTransformation with the given transformation matrix.
 java.awt.Point transform(float x, float y)
          Transforms a point in user space coordinates (given as floats) to a java.awt.Point representing screen coordinates.
 java.awt.Point transform(java.lang.Object point)
          Transforms a point in user space to a point on the screen.
 java.awt.Point[] transform(java.lang.Object[] visa, int off, int len)
          Transforms a subarray of points in user space to a point array in screen coordinates.
 
Methods inherited from class gishur.gui2.ScreenTransformation
bounds, deltaTransform, inverseDeltaTransform, inverseTransform, rotate, rotate, rotate, scale, scale, transform, transformedBounds, translate, zoomTo
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ScreenGraphTransformation

public ScreenGraphTransformation()
Default constructor.
Method Detail

saveStatus

public java.lang.Object saveStatus()
Returns the status of the ScreenTransformation to restore it via restoreStatus(java.lang.Object).
Overrides:
saveStatus in class ScreenTransformation
Returns:
the status of the ScreenTransformation.

restoreStatus

public void restoreStatus(java.lang.Object status)
Restores a state saved via saveStatus().
Overrides:
restoreStatus in class ScreenTransformation
Parameters:
status - the status to restore (must be saved via saveStatus()).

transform

public java.awt.Point transform(java.lang.Object point)
Transforms a point in user space to a point on the screen.
Overrides:
transform in class ScreenTransformation
Parameters:
point - the point-object storing the position in user space
Returns:
point in screen coordinates.

transform

public java.awt.Point transform(float x,
                                float y)
Transforms a point in user space coordinates (given as floats) to a java.awt.Point representing screen coordinates.
Parameters:
x,y - the user space float-coordinates
Returns:
a java.awt.Point representing the screen coordinates

transform

public java.awt.Point[] transform(java.lang.Object[] visa,
                                  int off,
                                  int len)
Transforms a subarray of points in user space to a point array in screen coordinates.
Overrides:
transform in class ScreenTransformation
Parameters:
visa - array of FloatPoint-objects storing coordinates in user space
off - offset of the subarray
len - length of the subarray
Returns:
Array of points in screen coordinates.

inverseTransform

public java.lang.Object inverseTransform(java.awt.Point p)
Transforms a Point on the screen to a point object in user space.
Overrides:
inverseTransform in class ScreenTransformation
Parameters:
p - the screen point
Returns:
a point in user space as a Point-object

inverseTransform

public java.lang.Object inverseTransform(int x,
                                         int y)
Transforms one point on the screen to a point object in user space.
Overrides:
inverseTransform in class ScreenTransformation
Parameters:
x,y - point in screen coordinates
Returns:
user space coordinates as a Point.

inverseTransform

public java.lang.Object[] inverseTransform(java.awt.Point[] points,
                                           int off,
                                           int len)
Transforms a subarray of points in screen coordinates to an array of FloatPoints representing the user space coordinates.
Overrides:
inverseTransform in class ScreenTransformation
Parameters:
points - array of points in screen coordinates
off - offset of the subarray
len - length of the subarray
Returns:
Array of FloatPoints representing coordinates in user space.

deltaTransform

public java.awt.Point deltaTransform(java.lang.Object vis)
Transforms a relative distance vector in user space to a relative distance vector in screen coordinates.
Overrides:
deltaTransform in class ScreenTransformation
Parameters:
vis - Point-object whose coordinates represent a vector in user space
Returns:
Vector in screen coordinates represented by a Point.

deltaTransform

public java.awt.Point[] deltaTransform(java.lang.Object[] visa,
                                       int off,
                                       int len)
Transforms a subarray of relative distance vectors in user space (represented by the coordinates of the given FloatPoint-objects) to a relative distance vector array in screen coordinates.
Overrides:
deltaTransform in class ScreenTransformation
Parameters:
visa - array of FloatPoint-objects representing vectors in user space
off - offset of the subarray
len - length of the subarray
Returns:
array of relative distance vectors in screen coordinates.

inverseDeltaTransform

public java.lang.Object inverseDeltaTransform(java.awt.Point point)
Transforms a relative distance vector in screen coordinates to a relative distance vector user space, represented by a FloatPoint.
Overrides:
inverseDeltaTransform in class ScreenTransformation
Parameters:
point - vector in screen coordinates
Returns:
user space coordinates.

inverseDeltaTransform

public java.lang.Object inverseDeltaTransform(java.awt.Point[] points,
                                              int off,
                                              int len)
Transforms a subarray of relative distance vectors in screen coordinates to an array of user space coordinates.
Overrides:
inverseDeltaTransform in class ScreenTransformation
Parameters:
points - array of relative distance vectors in screen coordinates
off - offset of the subarray
len - length of the subarray
Returns:
Array of relative distance vectors in user space, represented by an array of FloatPoints.

inverseTransform

public AffineTransformation inverseTransform(double m00,
                                             double m01,
                                             double m02,
                                             double m10,
                                             double m11,
                                             double m12)
Transforms the given transformation matrix for an affine transformation in screen coordinates to a transformation matrix in user space that does the same transformation with the original object. Let T be the screen transformation matrix used to transform objects from user space to screen coordinates, let T' be its inverse and A the given matrix, the returned matrix is T'AT.
Parameters:
m00,m01,m02 - first row of the transformation matrix
m10,m11,m12 - second row of the transformation matrix
Returns:
the transformation matrix transformed in user space

resetTransform

public void resetTransform()
Resets the ScreenTransformation to its initial values (identity).
Overrides:
resetTransform in class ScreenTransformation

screenTransform

public void screenTransform(double m00,
                            double m01,
                            double m02,
                            double m10,
                            double m11,
                            double m12)
Transforms the ScreenTransformation with the given transformation matrix.
Overrides:
screenTransform in class ScreenTransformation
Parameters:
m00,m01,m02 - first row of the transformation matrix
m10,m11,m12 - second row of the transformation matrix