j3d.org Code

org.j3d.renderer.java3d.overlay
Class OverlayManager

java.lang.Object
  extended byjavax.media.j3d.SceneGraphObject
      extended byjavax.media.j3d.Node
          extended byjavax.media.j3d.Group
              extended byjavax.media.j3d.BranchGroup
                  extended byorg.j3d.renderer.java3d.overlay.OverlayManager
All Implemented Interfaces:
java.awt.event.ComponentListener, java.util.EventListener

public class OverlayManager
extends javax.media.j3d.BranchGroup
implements java.awt.event.ComponentListener

The overlay manager keeps track of all the overlay's on the screen and makes sure they are updated with the view transform once a frame.

The Overlay manager should be placed into the scenegraph where the view transform is. It also assumes that none of the child overlays set have the Canvas3D reference set and so manages that all for them.

Version:
$Revision: 1.1 $
Author:
Justin Couch

Field Summary
 
Fields inherited from class javax.media.j3d.BranchGroup
ALLOW_DETACH
 
Fields inherited from class javax.media.j3d.Group
ALLOW_CHILDREN_EXTEND, ALLOW_CHILDREN_READ, ALLOW_CHILDREN_WRITE, ALLOW_COLLISION_BOUNDS_READ, ALLOW_COLLISION_BOUNDS_WRITE
 
Fields inherited from class javax.media.j3d.Node
ALLOW_AUTO_COMPUTE_BOUNDS_READ, ALLOW_AUTO_COMPUTE_BOUNDS_WRITE, ALLOW_BOUNDS_READ, ALLOW_BOUNDS_WRITE, ALLOW_COLLIDABLE_READ, ALLOW_COLLIDABLE_WRITE, ALLOW_LOCAL_TO_VWORLD_READ, ALLOW_PICKABLE_READ, ALLOW_PICKABLE_WRITE, ENABLE_COLLISION_REPORTING, ENABLE_PICK_REPORTING
 
Constructor Summary
OverlayManager(javax.media.j3d.Canvas3D canvas)
          Create a new manager that works on the given canvas.
OverlayManager(javax.media.j3d.Canvas3D canvas, UpdateManager updateManager)
          Constructs an overlay window with an update manager.
 
Method Summary
 void addOverlay(Overlay overlay)
          This adds an overlay into the overlay manager system.
 void clearOverlays()
          Clear all the current overlays.
 void componentHidden(java.awt.event.ComponentEvent e)
          Notification that the component has been hidden.
 void componentMoved(java.awt.event.ComponentEvent e)
          Notification that the component has been moved.
 void componentResized(java.awt.event.ComponentEvent e)
          Notification that the component has been resized.
 void componentShown(java.awt.event.ComponentEvent e)
          Notification that the component has been shown.
 UpdateManager getUpdateManager()
          Returns the UpdateManager responsible for seeing that updates to the Overlay only take place between frames.
 void initialize()
          Initialise the manager, which in turn initializes all the managed overlays.
 void newFrame(javax.media.j3d.Transform3D viewTransform)
          Called once a frame to update the different overlays
 void removeOverlay(Overlay overlay)
          This removes the overlay from the overlay system.
 void setPosition(Overlay overlay, int x, int y)
          Sets the position of the specified overlay
 void setUpdateManager(UpdateManager manager)
          Set the UpdateManager to the new value.
 void viewChanged()
          Notification that the canvas's view has changed.
 
Methods inherited from class javax.media.j3d.BranchGroup
cloneNode, compile, detach, pickAll, pickAllSorted, pickAny, pickClosest
 
Methods inherited from class javax.media.j3d.Group
addChild, getAllChildren, getAlternateCollisionTarget, getChild, getCollisionBounds, indexOfChild, insertChild, moveTo, numChildren, removeAllChildren, removeChild, removeChild, setAlternateCollisionTarget, setChild, setCollisionBounds
 
Methods inherited from class javax.media.j3d.Node
cloneTree, cloneTree, cloneTree, cloneTree, cloneTree, cloneTree, duplicateNode, getBounds, getBoundsAutoCompute, getCollidable, getLocalToVworld, getLocalToVworld, getParent, getPickable, setBounds, setBoundsAutoCompute, setCollidable, setPickable
 
Methods inherited from class javax.media.j3d.SceneGraphObject
clearCapability, clearCapabilityIsFrequent, duplicateSceneGraphObject, getCapability, getCapabilityIsFrequent, getUserData, isCompiled, isLive, setCapability, setCapabilityIsFrequent, setUserData, updateNodeReferences
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OverlayManager

public OverlayManager(javax.media.j3d.Canvas3D canvas)
Create a new manager that works on the given canvas. It does not have an update manager provided, so it will provide its own and add it as part of the scene graph below this BranchGroup.

Parameters:
canvas - The canvas the overlay is drawn on

OverlayManager

public OverlayManager(javax.media.j3d.Canvas3D canvas,
                      UpdateManager updateManager)
Constructs an overlay window with an update manager. It has two buffers. This window will not be visible unless it is added to the scene under the view platform transform. If the bounds are null, then resize the overlay to fit the canvas and then track the size of the canvas.

Parameters:
canvas - The canvas the overlay is drawn on
updateManager - Responsible for allowing the Overlay to update between renders. If this is null a default manager is created
Method Detail

viewChanged

public void viewChanged()
Notification that the canvas's view has changed.


componentResized

public void componentResized(java.awt.event.ComponentEvent e)
Notification that the component has been resized.

Specified by:
componentResized in interface java.awt.event.ComponentListener
Parameters:
e - The event that caused this method to be called

componentMoved

public void componentMoved(java.awt.event.ComponentEvent e)
Notification that the component has been moved.

Specified by:
componentMoved in interface java.awt.event.ComponentListener
Parameters:
e - The event that caused this method to be called

componentShown

public void componentShown(java.awt.event.ComponentEvent e)
Notification that the component has been shown. This is the component being shown, not the window that it is contained in.

Specified by:
componentShown in interface java.awt.event.ComponentListener
Parameters:
e - The event that caused this method to be called

componentHidden

public void componentHidden(java.awt.event.ComponentEvent e)
Notification that the component has been hidden.

Specified by:
componentHidden in interface java.awt.event.ComponentListener
Parameters:
e - The event that caused this method to be called

initialize

public void initialize()
Initialise the manager, which in turn initializes all the managed overlays.


getUpdateManager

public UpdateManager getUpdateManager()
Returns the UpdateManager responsible for seeing that updates to the Overlay only take place between frames.


setUpdateManager

public void setUpdateManager(UpdateManager manager)
Set the UpdateManager to the new value. If the reference is null, it will clear the current manager.


setPosition

public void setPosition(Overlay overlay,
                        int x,
                        int y)
Sets the position of the specified overlay


newFrame

public void newFrame(javax.media.j3d.Transform3D viewTransform)
Called once a frame to update the different overlays


addOverlay

public void addOverlay(Overlay overlay)
This adds an overlay into the overlay manager system.

Parameters:
overlay - The overlay to add

removeOverlay

public void removeOverlay(Overlay overlay)
This removes the overlay from the overlay system. The underlying resources will be released.

Parameters:
overlay - The overlay to remove

clearOverlays

public void clearOverlays()
Clear all the current overlays. This is either to reset or to close down the application.


j3d.org Code

Latest Info from http://code.j3d.org/
Copyright © 2001 - j3d.org