Aviatrix3D
2.1.0

org.j3d.aviatrix3d
Class CompositeLayer2D

java.lang.Object
  extended by org.j3d.aviatrix3d.SceneGraphObject
      extended by org.j3d.aviatrix3d.Layer
          extended by org.j3d.aviatrix3d.CompositeLayer2D
All Implemented Interfaces:
Cullable, LayerCullable

public class CompositeLayer2D
extends Layer

A layer that allows the definition of multiple viewports to be rendered, but is restricted to 2D rendering only.

This layer allows for the provision of multiple viewports within it. Each viewport is independently managed. Not provision is made for checking if viewports overlap or do other visually unappealing things. A typical use of this layer would be to provide multiple views onto a single shared scene graph, reminiscent of 3D editor applications like AutoCAD, Maya et al.

Internationalisation Resource Names

Version:
$Revision: 2.9 $
Author:
Justin Couch

Field Summary
 
Fields inherited from class org.j3d.aviatrix3d.Layer
COMPOSITE, COMPOSITE_2D, layerType, SIMPLE, SIMPLE_2D
 
Fields inherited from class org.j3d.aviatrix3d.SceneGraphObject
alive, LISTENER_SET_TIMING_ERR_PROP, updateHandler
 
Constructor Summary
CompositeLayer2D()
          Construct a new layer instance.
 
Method Summary
 void addViewport(Viewport2D vp)
          Add a new viewport to be used by this layer.
 void clearViewports()
          Remove all the viewports from this layer.
 ViewportCullable getCullableViewport(int viewportIndex)
          Get the cullable layer child that for the given layer index.
 Viewport2D getViewport(int num)
          Get the currently set viewport instance at a specific index.
 void insertViewport(Viewport2D vp, int index)
          Add a new viewport to be used by this layer at a specified position in the array of viewpor.
 int numCullableChildren()
          Returns the number of valid cullable children to process.
 int numViewports()
          Return how many viewports this layer contains.
 Viewport2D removeViewport(int num)
          Remove the given viewport at the specified index from this layer.
 void removeViewport(Viewport2D vp)
          Remove the given viewport from this layer.
protected  void setLive(boolean state)
          Notification that this object is live now.
protected  void setUpdateHandler(NodeUpdateHandler handler)
          Set the viewportgraph update handler for this node.
 
Methods inherited from class org.j3d.aviatrix3d.Layer
compareTo, equals, equals, getCullable, getType
 
Methods inherited from class org.j3d.aviatrix3d.SceneGraphObject
checkForCyclicChild, checkForCyclicParent, dataChanged, getAppUpdateWriteTimingMessage, getBoundsWriteTimingMessage, getDataWriteTimingMessage, getUserData, isLive, setUserData
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CompositeLayer2D

public CompositeLayer2D()
Construct a new layer instance.

Method Detail

getCullableViewport

public ViewportCullable getCullableViewport(int viewportIndex)
Get the cullable layer child that for the given layer index.

Returns:
The layer cullable at the given index or null

numCullableChildren

public int numCullableChildren()
Returns the number of valid cullable children to process. If there are no valid cullable children, return 0.

Returns:
A number greater than or equal to zero

setUpdateHandler

protected void setUpdateHandler(NodeUpdateHandler handler)
Set the viewportgraph update handler for this node. It will notify all its children of the value. A null value will clear the current handler.

Overrides:
setUpdateHandler in class SceneGraphObject
Parameters:
handler - The instance to use as a handler

setLive

protected void setLive(boolean state)
Notification that this object is live now. Overridden to make sure that the live state of the nodes represents the same state as the parent viewport graph.

Overrides:
setLive in class SceneGraphObject
Parameters:
state - true if this should be marked as live now

addViewport

public void addViewport(Viewport2D vp)
                 throws InvalidWriteTimingException,
                        AlreadyParentedException
Add a new viewport to be used by this layer. Adding null references is silently ignored. The viewport is added to the end of the current listing.

Note that a viewport cannot have more than one parent, so sharing it between layers will result in an error.

Parameters:
vp - The viewport instance to use
Throws:
InvalidWriteTimingException - An attempt was made to write outside of the NodeUpdateListener data change callback method
AlreadyParentedException - This viewport already has a current parent preventing it from being used

insertViewport

public void insertViewport(Viewport2D vp,
                           int index)
                    throws InvalidWriteTimingException,
                           AlreadyParentedException
Add a new viewport to be used by this layer at a specified position in the array of viewpor. Adding null references is silently ignored. If the index is greater than the current number of registered viewports, the viewport is added to the end of the current list. If the index is zero or negative, it is inserted at the front of the list.

Note that a viewport cannot have more than one parent, so sharing it between layers will result in an error.

Parameters:
vp - The viewport instance to use
index - The position in the list to put this viewport
Throws:
InvalidWriteTimingException - An attempt was made to write outside of the NodeUpdateListener data change callback method
AlreadyParentedException - This viewport already has a current parent preventing it from being used

removeViewport

public void removeViewport(Viewport2D vp)
Remove the given viewport from this layer. If the viewport is not registered, then the request is silently ignored.

Parameters:
vp - The viewport instance to be removed
Throws:
InvalidWriteTimingException - An attempt was made to write outside of the NodeUpdateListener data change callback method

removeViewport

public Viewport2D removeViewport(int num)
Remove the given viewport at the specified index from this layer. If the index is out of bounds, null is returned and nothing happens. All viewports at indices above this number are shifted down by 1.

Parameters:
num - The index of the viewport to remove
Returns:
viewport The viewport that was at the given index
Throws:
InvalidWriteTimingException - An attempt was made to write outside of the NodeUpdateListener data change callback method

clearViewports

public void clearViewports()
Remove all the viewports from this layer.

Throws:
InvalidWriteTimingException - An attempt was made to write outside of the NodeUpdateListener data change callback method

getViewport

public Viewport2D getViewport(int num)
Get the currently set viewport instance at a specific index. If no viewport is set at that index, null is returned.

Parameters:
num - The index of the viewport to fetch
Returns:
The current viewport instance or null

numViewports

public int numViewports()
Return how many viewports this layer contains.

Returns:
A value >= 0

Aviatrix3D
2.1.0

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