camera3d
Class J3DBase

java.lang.Object
  extended bycamera3d.J3DBase
All Implemented Interfaces:
VcObjectChangeListener

public class J3DBase
extends java.lang.Object
implements VcObjectChangeListener

This class encapsulates the basic scene graph structure and provides some functionality (adding, retrieving, removing ) to manage the objects in the scene graph. It also permits loading VRML files into the virtual world.

Author:
Fábio Roberto de Miranda, Carlos da Silva dos Santos

Constructor Summary
J3DBase()
          Creates a new scene and adds the default views to it.
 
Method Summary
 void addContent(VcContent content)
          Adds a VcContent object to the scene graph; notifyChangeListeners is called at the end of execution.
 void addGeometryBag(GeometryBag bag)
          Added 06/2002.
 void addHelper(VcHelper helper)
          Adds a VcHelper object to the scene graph; notifyChangeListeners is called at the end of execution.
 void addLaserArray(VcLaserArray array)
          Adds a VcLaserArray to the scene graph; notifyChangeListeners is called at the end of execution.
 void addLight(VcLight light)
          Adds a VcLight to the scene graph.
 void addSceneObjectsChangeListener(SceneObjectsChangeListener listener)
          Adds a listener to this object.
 void addView(VcView view)
          Adds a VcView to the scene graph; notifyChangeListeners is called at the end of execution.
 void debugln(java.lang.String s)
          Prints a debug message.
 void frameAllObjectsInView(VcView view)
          Description of the Method
 void frameObjectInView(VcView view, VcObject vcObject)
          Description of the Method
 VcObject getByLabel(java.lang.String label)
          Returns a VcObject given its label.
 GeometryBag getDefaultGeometryBag()
           
 VcView getDefaultView()
          Returns the current default view
 javax.media.j3d.BranchGroup getJ3DRootBranchGroup()
          Gets the j3DRootBranchGroup attribute of the J3DBase object
 java.util.Vector getObjectList()
          Returns a Vector containing the list of objects in the scene graph.
 java.util.List getViewList()
          Returns a Vector containing the list of VcViews in the scene graph.
 void loadVRMLScene(java.lang.String filename)
          Loads a VMRL 2.0 file into the scene graph.
 void lookAt(VcView view, VcObject vcObject)
          Description of the Method
 void printLabels()
          Iterates through the list of objects in the scene graph and prints the label associated with each one.
 void removeVcObject(VcObject vcObject)
          Removes an VcObject from the scene graph.
 void setDefaultView(VcView view)
          Sets a view that already belongs to the collection of VcViews as the default view.
 void toggleHelpingGrid()
          Toggles exhibition of helping grid.
 void vcObjectChanged(VcObjectEvent event)
          Description of the Method
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

J3DBase

public J3DBase()
Creates a new scene and adds the default views to it.

Method Detail

setDefaultView

public void setDefaultView(VcView view)
Sets a view that already belongs to the collection of VcViews as the default view.

Parameters:
view - the new default view

getObjectList

public java.util.Vector getObjectList()
Returns a Vector containing the list of objects in the scene graph.

Returns:
The objectList value

getViewList

public java.util.List getViewList()
Returns a Vector containing the list of VcViews in the scene graph.

Returns:
The viewList value

getByLabel

public VcObject getByLabel(java.lang.String label)
Returns a VcObject given its label. It returns null in case there is no VcObject in the scene graph associated with the input label

Parameters:
label - name of object to be searched for
Returns:
VcObjet associated with the label, if it exists; null otherwise

getDefaultView

public VcView getDefaultView()
Returns the current default view

Returns:
The defaultView value

getJ3DRootBranchGroup

public javax.media.j3d.BranchGroup getJ3DRootBranchGroup()
Gets the j3DRootBranchGroup attribute of the J3DBase object

Returns:
The j3DRootBranchGroup value

getDefaultGeometryBag

public GeometryBag getDefaultGeometryBag()
Returns:
The defaultGeometryBag value

addLight

public void addLight(VcLight light)
Adds a VcLight to the scene graph. Light capabilities are set so its parameters are made editable; notifyChangeListeners() is called at the end of execution.

Parameters:
light - the new VcLight.

addView

public void addView(VcView view)
Adds a VcView to the scene graph; notifyChangeListeners is called at the end of execution.

Parameters:
view - the new VcView

addLaserArray

public void addLaserArray(VcLaserArray array)
Adds a VcLaserArray to the scene graph; notifyChangeListeners is called at the end of execution.

Parameters:
array - the new VcLaserArray

addContent

public void addContent(VcContent content)
Adds a VcContent object to the scene graph; notifyChangeListeners is called at the end of execution.

Parameters:
content - the new VcContent

addHelper

public void addHelper(VcHelper helper)
Adds a VcHelper object to the scene graph; notifyChangeListeners is called at the end of execution.

Parameters:
helper - the new VcHelper

addGeometryBag

public void addGeometryBag(GeometryBag bag)
Added 06/2002. GeometryBag will be kept at helper's BG for a while

Parameters:
bag - The feature to be added to the GeometryBag attribute

removeVcObject

public void removeVcObject(VcObject vcObject)
Removes an VcObject from the scene graph.

Parameters:
vcObject - the VcObject to be deleted.

loadVRMLScene

public void loadVRMLScene(java.lang.String filename)
Loads a VMRL 2.0 file into the scene graph. Lights and cameras in the VRML file are turned into VcLights and VcViews, respectively. All geometries are put in a single VcContent object.

Parameters:
filename - name of VRML file to be loaded

addSceneObjectsChangeListener

public void addSceneObjectsChangeListener(SceneObjectsChangeListener listener)
Adds a listener to this object. Listeners are notified of changes in the list of objects in the scene graph.

Parameters:
listener - new listener to be added

printLabels

public void printLabels()
Iterates through the list of objects in the scene graph and prints the label associated with each one.


debugln

public void debugln(java.lang.String s)
Prints a debug message. It is controlled by the debug flag.

Parameters:
s - message to be printed.

toggleHelpingGrid

public void toggleHelpingGrid()
Toggles exhibition of helping grid.


vcObjectChanged

public void vcObjectChanged(VcObjectEvent event)
Description of the Method

Specified by:
vcObjectChanged in interface VcObjectChangeListener
Parameters:
event - Description of the Parameter

frameObjectInView

public void frameObjectInView(VcView view,
                              VcObject vcObject)
Description of the Method

Parameters:
view - Description of the Parameter
vcObject - Description of the Parameter

frameAllObjectsInView

public void frameAllObjectsInView(VcView view)
Description of the Method

Parameters:
view - Description of the Parameter

lookAt

public void lookAt(VcView view,
                   VcObject vcObject)
Description of the Method

Parameters:
view - Description of the Parameter
vcObject - Description of the Parameter


Copyright © 2001-2003 F.R. Miranda, C.S. Santos, J.E. Kogler Jr.. All Rights Reserved.