gishur.gui2
Class ElementTransform

java.lang.Object
  |
  +--gishur.gui2.ElementTransform

public abstract class ElementTransform
extends java.lang.Object

Version:
1.0
Author:
Thomas Wolf

Constructor Summary
ElementTransform()
           
 
Method Summary
 java.lang.String getValidElement(java.lang.String name)
          Returns the (finest) element which will be accepted by the element transformation and which is a parent of the given element (or itself).
 void moveFromTo(java.lang.String element, int sx, int sy, int ex, int ey)
          Transforms the given element according to the point move from (sx,sy) to (ex,ey).
 void rotate(java.lang.String element, double angle)
          Rotates the element around the origin.
 void rotate(java.lang.String element, int cx, int cy, double angle)
          Rotates the element around an anchor point.
 void rotate(java.lang.String element, int cx, int cy, int sx, int sy, int ex, int ey)
          Rotates the element around an anchor point with the angle of rotation given by the two points start and end.
 void rotate(java.lang.String element, java.awt.Point center, double angle)
          Rotates the element around an anchor point.
 void rotate(java.lang.String element, java.awt.Point center, java.awt.Point start, java.awt.Point end)
          Rotates the element around an anchor point with the angle of rotation given by the two points start and end.
 void scale(java.lang.String element, double xscale, double yscale)
          Scales the element with the given scale factors.
 void scale(java.lang.String element, int cx, int cy, double xscale, double yscale)
          Scales the element with leaving the given center point unchanged.
 void scale(java.lang.String element, java.awt.Point center, double xscale, double yscale)
          Scales the element with leaving the given center point unchanged.
abstract  void transform(java.lang.String element, double m00, double m01, double m02, double m10, double m11, double m12)
          Transforms the element with the given transformation matrix.
 void translate(java.lang.String element, int dx, int dy)
          Translates the element by the given vector.
 void translate(java.lang.String element, java.awt.Point v)
          Translates the element by the given vector.
protected  boolean validateElement(java.lang.String name)
          Validates an element name for element transformation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ElementTransform

public ElementTransform()
Method Detail

transform

public abstract void transform(java.lang.String element,
                               double m00,
                               double m01,
                               double m02,
                               double m10,
                               double m11,
                               double m12)
Transforms the element with the given transformation matrix.
Parameters:
element - the name of the element to transform
m00,m01,m02 - first row of the transformation matrix
m10,m11,m12 - second row of the transformation matrix

scale

public void scale(java.lang.String element,
                  int cx,
                  int cy,
                  double xscale,
                  double yscale)
Scales the element with leaving the given center point unchanged.
Parameters:
element - the name of the element to transform
cx,cy - the center point (will be unchanged)
xscale - scale factor for the x-axis
yscale - scale factor for the y-axis

scale

public void scale(java.lang.String element,
                  java.awt.Point center,
                  double xscale,
                  double yscale)
Scales the element with leaving the given center point unchanged.
Parameters:
element - the name of the element to transform
center - the center point (will be unchanged)
xscale - scale factor for the x-axis
yscale - scale factor for the y-axis

scale

public void scale(java.lang.String element,
                  double xscale,
                  double yscale)
Scales the element with the given scale factors.
Parameters:
element - the name of the element to transform
xscale - scale factor for the x-axis
yscale - scale factor for the y-axis

rotate

public void rotate(java.lang.String element,
                   int cx,
                   int cy,
                   double angle)
Rotates the element around an anchor point.
Parameters:
element - the name of the element to transform
cx,cy - anchor point
angle - the angle of rotation in radians

rotate

public void rotate(java.lang.String element,
                   java.awt.Point center,
                   double angle)
Rotates the element around an anchor point.
Parameters:
element - the name of the element to transform
center - anchor point
angle - the angle of rotation in radians

rotate

public void rotate(java.lang.String element,
                   int cx,
                   int cy,
                   int sx,
                   int sy,
                   int ex,
                   int ey)
Rotates the element around an anchor point with the angle of rotation given by the two points start and end.
Parameters:
element - the name of the element to transform
cx,cy - anchor point
sx,sy - start point
ex,ey - end point

rotate

public void rotate(java.lang.String element,
                   java.awt.Point center,
                   java.awt.Point start,
                   java.awt.Point end)
Rotates the element around an anchor point with the angle of rotation given by the two points start and end.
Parameters:
element - the name of the element to transform
center - anchor point
start - start point
end - end point

rotate

public void rotate(java.lang.String element,
                   double angle)
Rotates the element around the origin.
Parameters:
element - the name of the element to transform
angle - the angle of rotation

translate

public void translate(java.lang.String element,
                      int dx,
                      int dy)
Translates the element by the given vector.
Parameters:
element - the name of the element to transform
dx,dy - the translational vector

translate

public void translate(java.lang.String element,
                      java.awt.Point v)
Translates the element by the given vector.
Parameters:
element - the name of the element to transform
v - the translational vector

moveFromTo

public void moveFromTo(java.lang.String element,
                       int sx,
                       int sy,
                       int ex,
                       int ey)
Transforms the given element according to the point move from (sx,sy) to (ex,ey). This should be rather called than translate, because some element can react in another way if the point where they are picked up is known.
Parameters:
element - the name of the element to transform
sx,sy - the start point of the moving operation
ex,ey - the end point of the moving operation

validateElement

protected boolean validateElement(java.lang.String name)
Validates an element name for element transformation. If true is returned, the element can be used by the element transformation. This method should work fast. The given name will be a local name of the element (without the shapes name). This implementation accepts no active elements.
Parameters:
name - member element name of the DisplayObject's shape.
Returns:
true, if the element was accepted

getValidElement

public java.lang.String getValidElement(java.lang.String name)
Returns the (finest) element which will be accepted by the element transformation and which is a parent of the given element (or itself).
Parameters:
name - the elements (full) name
Returns:
a valid element name