com.tensegrity.graphics
Class Viewport

java.lang.Object
  extended bycom.tensegrity.graphics.Viewport

public final class Viewport
extends java.lang.Object

This class defines a viewport on a given child component.

A Viewport consists of the following attributes:

Version:
$Id: Viewport.java,v 1.26 2004/07/06 07:12:09 MichaelKegel Exp $
Author:
S. Rutz

Field Summary
static int ALIGN_CENTER
          constant that tells about an alignment type of the viewport
static int ALIGN_LEFTTOP
          constant that tells about an alignment type of the viewport
 
Constructor Summary
Viewport()
          Constructs a new default Viewport with center alignment.
Viewport(double tx, double ty, double sx, double sy)
          Constructs a new Viewport with center alignment and the given settings.
Viewport(int alignment)
          Constructs a new default Viewport.
Viewport(Viewport viewport)
          Copy constructor for viewports.
 
Method Summary
 double getScaleX()
          Returns the x scale factor.
 double getScaleY()
          Returns the y scale factor.
 void getTransform(Transform2D xform)
          Returns the transform that this View defines.
 double getTranslationX()
          Returns the translation in x direction.
 double getTranslationY()
          Returns the translation in y direction.
 void set(double tx, double ty, double sx, double sy)
          Sets the values of this Viewport.
 void set(Viewport viewport)
          Set the viewport to the values of the given viewport.
 void setRectangle(int x, int y, int width, int height)
          Sets the values of this Viewport.
 void setScaleX(double sx)
          Sets the x scale factor.
 void setScaleY(double sy)
          Sets the y scale factor.
 void setTranslationX(double tx)
          Sets the translation in x direction.
 void setTranslationY(double ty)
          Sets the translation in y direction.
 java.lang.String toString()
          Returns a string representation of the this Viewport.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ALIGN_CENTER

public static final int ALIGN_CENTER
constant that tells about an alignment type of the viewport

See Also:
Constant Field Values

ALIGN_LEFTTOP

public static final int ALIGN_LEFTTOP
constant that tells about an alignment type of the viewport

See Also:
Constant Field Values
Constructor Detail

Viewport

public Viewport()
Constructs a new default Viewport with center alignment.


Viewport

public Viewport(int alignment)
Constructs a new default Viewport. with the given alignment.

Parameters:
alignment - the alignment to use.

Viewport

public Viewport(double tx,
                double ty,
                double sx,
                double sy)
Constructs a new Viewport with center alignment and the given settings.

Parameters:
tx - translation x component.
ty - translation y component.
sx - scaling in x direction.
sy - scaling in y direction.

Viewport

public Viewport(Viewport viewport)
Copy constructor for viewports.

Parameters:
viewport - the source Viewport instance to copy values from.
Method Detail

set

public final void set(Viewport viewport)
Set the viewport to the values of the given viewport.

Parameters:
viewport - the Viewport holding the values to set.

set

public final void set(double tx,
                      double ty,
                      double sx,
                      double sy)
Sets the values of this Viewport.

Parameters:
tx - translation x component.
ty - translation y component.
sx - scaling in x direction.
sy - scaling in y direction.

setRectangle

public final void setRectangle(int x,
                               int y,
                               int width,
                               int height)
Sets the values of this Viewport.

Parameters:
x - the left corner of the Viewport.
y - the top corner of the Viewport.
width - the width of the Viewport.
height - the height of the Viewport.

getTranslationX

public final double getTranslationX()
Returns the translation in x direction.

Returns:
the translation in x direction.

setTranslationX

public final void setTranslationX(double tx)
Sets the translation in x direction.

Parameters:
tx - the translation in x direction.

getTranslationY

public final double getTranslationY()
Returns the translation in y direction.

Returns:
the translation in y direction.

setTranslationY

public final void setTranslationY(double ty)
Sets the translation in y direction.


getScaleX

public final double getScaleX()
Returns the x scale factor.

Returns:
the x scale factor.

setScaleX

public final void setScaleX(double sx)
Sets the x scale factor.

Parameters:
sx - the x scale factor.

getScaleY

public final double getScaleY()
Returns the y scale factor.

Returns:
the y scale factor.

setScaleY

public final void setScaleY(double sy)
Sets the y scale factor.

Parameters:
sy - the y scale factor.

getTransform

public final void getTransform(Transform2D xform)
Returns the transform that this View defines.

Parameters:
xform - the pointer to the element that should be used for returning the value.

toString

public java.lang.String toString()
Returns a string representation of the this Viewport.

Returns:
string representation of the this Viewport.


Copyright © 2005 Tensegrity Software GmbH. All Rights Reserved. Date of creation: 09.06.2006.