Aviatrix3D
2.1.0

org.j3d.aviatrix3d
Class Viewport

java.lang.Object
  extended by org.j3d.aviatrix3d.SceneGraphObject
      extended by org.j3d.aviatrix3d.Viewport
Direct Known Subclasses:
CompositeViewport, MultipassViewport, SimpleViewport, Viewport2D

public abstract class Viewport
extends SceneGraphObject

Abstract representation of a viewport on the drawable surface.

A viewport defines the amount of screen to cover in pixel dimensions. Viewports may be used to segregate the rendered surface into multiple separate entities. An example of this is the 4-view CAD application, where each viewport has a different viewpoint looking into a shared scene graph structure.

Viewports define their coordinate system in the window-system interface: The x,y position is the lower left corner, with height going up the screen and width heading to the right.

Viewports cannot be shared amongst multiple parent layers.

Version:
$Revision: 1.6 $
Author:
Justin Couch

Field Summary
static int COMPOSITE
          The viewport is a composite type, having many local layers defined
static int FLAT
          The viewport is a 2D type, allowing only flat projections and automatically calculated view environment information.
static int MULTIPASS
          The viewport is a multipass type, allowing multiple rendering passes for a single layer.
static int SIMPLE
          The viewport is a simple type, having single scene defined
protected  int viewHeight
          The width of the viewport in pixels
protected  int viewportType
          The viewport type constant
protected  int viewWidth
          The width of the viewport in pixels
protected  int viewX
          The lower left X position of the viewpoint, in pixels
protected  int viewY
          The lower left Y position of the viewpoint, in pixels
 
Fields inherited from class org.j3d.aviatrix3d.SceneGraphObject
alive, LISTENER_SET_TIMING_ERR_PROP, updateHandler
 
Constructor Summary
protected Viewport(int type)
          Create a default instance of this viewport.
 
Method Summary
 void getDimensions(int[] dim)
          Get the dimensions of the viewport, copied into the user-provided array.
 int getHeight()
          Convenience method to fetch the height of the viewport.
 int getType()
          Get the type that this layer represents
 int getWidth()
          Convenience method to fetch the width of the viewport.
 int getX()
          Convenience method to fetch the starting X position.
 int getY()
          Convenience method to fetch the starting Y position.
 boolean isValid()
          Check to see if this is a valid viewport.
 void setDimensions(int x, int y, int width, int height)
          Set the dimensions of the viewport in pixels.
 
Methods inherited from class org.j3d.aviatrix3d.SceneGraphObject
checkForCyclicChild, checkForCyclicParent, dataChanged, getAppUpdateWriteTimingMessage, getBoundsWriteTimingMessage, getDataWriteTimingMessage, getUserData, isLive, setLive, setUpdateHandler, setUserData
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SIMPLE

public static final int SIMPLE
The viewport is a simple type, having single scene defined

See Also:
Constant Field Values

COMPOSITE

public static final int COMPOSITE
The viewport is a composite type, having many local layers defined

See Also:
Constant Field Values

MULTIPASS

public static final int MULTIPASS
The viewport is a multipass type, allowing multiple rendering passes for a single layer.

See Also:
Constant Field Values

FLAT

public static final int FLAT
The viewport is a 2D type, allowing only flat projections and automatically calculated view environment information.

See Also:
Constant Field Values

viewportType

protected final int viewportType
The viewport type constant


viewX

protected int viewX
The lower left X position of the viewpoint, in pixels


viewY

protected int viewY
The lower left Y position of the viewpoint, in pixels


viewWidth

protected int viewWidth
The width of the viewport in pixels


viewHeight

protected int viewHeight
The width of the viewport in pixels

Constructor Detail

Viewport

protected Viewport(int type)
Create a default instance of this viewport. All values are set to zero.

Parameters:
type - The type constant for this layer
Method Detail

setDimensions

public void setDimensions(int x,
                          int y,
                          int width,
                          int height)
                   throws InvalidWriteTimingException
Set the dimensions of the viewport in pixels. Coordinates are defined in the space of the parent component that is being rendered to.

Parameters:
x - The lower left x coordinate for the view
y - The lower left y coordinate for the view
width - The width of the viewport in pixels
height - The height of the viewport in pixels
Throws:
InvalidWriteTimingException - An attempt was made to write outside of the ApplicationUpdateObserver callback method

getDimensions

public void getDimensions(int[] dim)
Get the dimensions of the viewport, copied into the user-provided array. The array must be at least 4 units in length, and the values are copied in the order x, y, width, height.

Parameters:
dim - The array to copy the values into

getX

public int getX()
Convenience method to fetch the starting X position.

Returns:
The lower left X coordinate, in pixels

getY

public int getY()
Convenience method to fetch the starting Y position.

Returns:
The lower left Y coordinate, in pixels

getWidth

public int getWidth()
Convenience method to fetch the width of the viewport.

Returns:
The width amount, in pixels

getHeight

public int getHeight()
Convenience method to fetch the height of the viewport.

Returns:
The height amount, in pixels

getType

public int getType()
Get the type that this layer represents

Returns:
A layer type descriptor

isValid

public boolean isValid()
Check to see if this is a valid viewport. A valid viewport requires that the width and height are both greater than zero and that X + width and Y + height are positive.

Returns:
true if the viewport represents a valid screen space

Aviatrix3D
2.1.0

Latest Info from http://aviatrix3d.j3d.org/
Copyright © 2003 - 2009 j3d.org