## org.j3d.geom.overlay
Class OverlayManager

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.4 $
Author:
  Justin Couch

Field Detail

### CONSOLE_Z

    private static double CONSOLE_Z

  I do not undersand what this is for

### updateManager

    private org.j3d.geom.overlay.UpdateManager updateManager

  The update manager for keeping us in sync

### awtBehavior

    private org.j3d.geom.overlay.AWTEventBehavior awtBehavior

  Behaviour for processing interactive events

### consoleTG

    private javax.media.j3d.TransformGroup consoleTG

  Transformation to make the raster become screen coords as well

### windows

    private javax.media.j3d.BranchGroup windows

  Group containing all the child overlays

### planeOffset

    private javax.media.j3d.Transform3D planeOffset

  Transform of image plate

### worldTransform

    private javax.media.j3d.Transform3D worldTransform

  Total transform used to correct the overlays each frame

### canvasDim

    private java.awt.Dimension canvasDim

  the dimensions of the Canvas3d

### checkDim

    private java.awt.Dimension checkDim

  used to check for dimension changes

### canvas3D

    private javax.media.j3d.Canvas3D canvas3D

  Canvas we are displayed on

### overlays

    private java.util.ArrayList overlays

  List of all the overlays that are children here

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,
                          org.j3d.geom.overlay.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
  `bounds` - The part of the canvas covered by the overlay
  `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.

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.

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.

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.

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 org.j3d.geom.overlay.UpdateManager getUpdateManager()

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

Parameters:
  `The` - update manage instance for this overlay

### setUpdateManager

    public void setUpdateManager(org.j3d.geom.overlay.UpdateManager manager)

  Set the UpdateManager to the new value. If the reference is null, it will clear the current manager.

Parameters:
  `updateManager` - A reference to the new manage instance to use

### setPosition

    public void setPosition(org.j3d.geom.overlay.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(org.j3d.geom.overlay.Overlay overlay)

  This adds an overlay into the overlay manager system.

Parameters:
  `overlay` - The overlay to add

### removeOverlay

    public void removeOverlay(org.j3d.geom.overlay.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.

### calcImagePlate

    private void calcImagePlate()

  calculates the image plate transformation considering the field of view and the size of the screen.

### checkScreenSize

    private void checkScreenSize()

  Synchronize with the view platform