org.graffiti.plugin.view
Class Viewport

java.lang.Object
  extended by org.graffiti.plugin.view.Viewport
All Implemented Interfaces:
Zoomable
Direct Known Subclasses:
ViewportAdapter

public abstract class Viewport
extends Object
implements Zoomable

Version:
$Revision$ $Date$
Author:
Andreas Gleißner

Constructor Summary
Viewport()
           
 
Method Summary
 Rectangle2D getDisplayBounds()
          Returns the bounds of the display component.
 Rectangle2D getlogicalDisplayBounds()
          Returns the bounds of the display component.
 Rectangle2D getLogicalElementsBounds()
          Returns a rectangle enclosing all graph elements.
 double getRotation()
          Returns the rotation in radians.
 Point2D getTranslation()
          Returns the translation.
 double getZoom()
          Returns the zoom factor.
 AffineTransform getZoomRotationTransform()
           
 Point2D inverseTransform(Point2D point)
           
 void setRotation(double angle)
          Sets the rotation in radians.
 void setSimultanously(double zoomFactor, double angle, Point2D translation)
          Simultanously sets zoom, rotation and translation.
 void setTranslation(Point2D translation)
          Sets the translation.
 Point2D transform(Point2D point)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.graffiti.plugin.view.Zoomable
getZoomTransform, setZoom
 

Constructor Detail

Viewport

public Viewport()
Method Detail

getZoom

public double getZoom()
Returns the zoom factor.

Specified by:
getZoom in interface Zoomable
Returns:
the zoom factor. Smaller values yield in the display of a greater area with fewer details ("a view from greater distance"). 1.0 is the default value. Must be a finite value greater than 0.0.

getRotation

public double getRotation()
Returns the rotation in radians.

Returns:
the rotation angle in radians. 0.0 is the default value.

getTranslation

public Point2D getTranslation()
Returns the translation.

Returns:
the translation. (0.0, 0.0) is the default value.

getLogicalElementsBounds

public Rectangle2D getLogicalElementsBounds()
Returns a rectangle enclosing all graph elements.

Returns:
a rectangle enclosing all graph elements in logical (attribute system) coordinates.

getDisplayBounds

public Rectangle2D getDisplayBounds()
Returns the bounds of the display component.

Returns:
the bounds of the display component in display coordinates.

getlogicalDisplayBounds

public Rectangle2D getlogicalDisplayBounds()
Returns the bounds of the display component.

Returns:
the bounds of the display component in logical (attribute system) coordinates.

setRotation

public void setRotation(double angle)
Sets the rotation in radians. Should call ViewportEventDispatcher.onViewportChange(Viewport) on the ViewportEventDispatcher returned by MainFrame.getViewportEventDispatcher(). Do not call setRotation from within an implementation of ViewportListener.onViewportChange(Viewport), as it may cause a deadlock. An actual change of the rotation is not guaranteed. The Viewport may arbitrarily restrict the values.

Parameters:
angle - the rotation angle in radians. 0.0 is the default value.

setTranslation

public void setTranslation(Point2D translation)
Sets the translation. Should call ViewportEventDispatcher.onViewportChange(Viewport) on the ViewportEventDispatcher returned by MainFrame.getViewportEventDispatcher(). Do not call setRotation from within an implementation of ViewportListener.onViewportChange(Viewport), as it may cause a deadlock. An actual change of the translation is not guaranteed. The Viewport may arbitrarily restrict the values.

Parameters:
translation - the translation to set. (0.0, 0.0) is the default value.

setSimultanously

public void setSimultanously(double zoomFactor,
                             double angle,
                             Point2D translation)
Simultanously sets zoom, rotation and translation. This is useful as the viewport else may modify the translation due to a call to setZoom etc., which makes simultanously forcing all three to specific values tricky.

Parameters:
zoomFactor - the zoom factor. See Zoomable.setZoom(double).
angle - the rotation angle. See setRotation(double).
translation - the translation. See setTranslation(Point2D).

transform

public Point2D transform(Point2D point)

inverseTransform

public Point2D inverseTransform(Point2D point)

getZoomRotationTransform

public AffineTransform getZoomRotationTransform()


Generated at 2012-05-30 11:00:36 PM CEST