javax.media.j3d
Class LOD

java.lang.Object
  extended by javax.media.j3d.SceneGraphObject
      extended by javax.media.j3d.Node
          extended by javax.media.j3d.Leaf
              extended by javax.media.j3d.Behavior
                  extended by javax.media.j3d.LOD
Direct Known Subclasses:
DistanceLOD

public abstract class LOD
extends Behavior

An LOD leaf node is an abstract behavior class that operates on a list of Switch group nodes to select one of the children of the Switch nodes. The LOD class is extended to implement various selection criteria.


Field Summary
(package private)  java.util.Vector switches
          The LOD Node's vector of switch nodes.
(package private)  WakeupOnElapsedFrames wakeupFrame
          Wakeup condition for all LOD nodes
 
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_LOCALE_READ, ALLOW_PARENT_READ, ALLOW_PICKABLE_READ, ALLOW_PICKABLE_WRITE, ENABLE_COLLISION_REPORTING, ENABLE_PICK_REPORTING
 
Fields inherited from class javax.media.j3d.SceneGraphObject
nodeHashtable, retained
 
Constructor Summary
LOD()
          Constructs and initializes an LOD node.
 
Method Summary
 void addSwitch(Switch switchNode)
          Appends the specified switch node to this LOD's list of switches.
(package private)  void duplicateAttributes(Node originalNode, boolean forceDuplicate)
          Copies all LOD information from originalNode into the current node.
 java.util.Enumeration getAllSwitches()
          Returns the enumeration object of all switches.
 Switch getSwitch(int index)
          Returns the switch node specified by the index.
 int indexOfSwitch(Switch switchNode)
          Retrieves the index of the specified switch node in this LOD node's list of switches.
 void insertSwitch(Switch switchNode, int index)
          Inserts the specified switch node at specified index.
 int numSwitches()
          Returns a count of this LOD's switches.
 void removeAllSwitches()
          Removes all switch nodes from this LOD node.
 void removeSwitch(int index)
          Removes the switch node at specified index.
 void removeSwitch(Switch switchNode)
          Removes the specified switch node from this LOD node's list of switches.
 void setSwitch(Switch switchNode, int index)
          Replaces the specified switch node with the switch node provided.
 void updateNodeReferences(NodeReferenceTable referenceTable)
          Callback used to allow a node to check if any nodes referenced by that node have been duplicated via a call to cloneTree.
 
Methods inherited from class javax.media.j3d.Behavior
createRetained, getEnable, getNumSchedulingIntervals, getSchedulingBoundingLeaf, getSchedulingBounds, getSchedulingInterval, getView, getWakeupCondition, initialize, postId, processStimulus, setEnable, setSchedulingBoundingLeaf, setSchedulingBounds, setSchedulingInterval, wakeupOn
 
Methods inherited from class javax.media.j3d.Node
checkDuplicateNode, checkForCycle, cloneNode, cloneTree, cloneTree, cloneTree, cloneTree, cloneTree, cloneTree, cloneTree, duplicateNode, getBounds, getBoundsAutoCompute, getCollidable, getLocale, getLocalToVworld, getLocalToVworld, getParent, getPickable, setBounds, setBoundsAutoCompute, setCollidable, setPickable
 
Methods inherited from class javax.media.j3d.SceneGraphObject
capabilityBitsEmpty, checkForLiveOrCompiled, clearCapability, clearCapabilityIsFrequent, clearLive, duplicateSceneGraphObject, getCapability, getCapabilityIsFrequent, getName, getNamePrefix, getNodeComponent, getUserData, isCompiled, isLive, isLiveOrCompiled, setCapability, setCapabilityIsFrequent, setCompiled, setDefaultReadCapabilities, setLive, setName, setUserData, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

wakeupFrame

WakeupOnElapsedFrames wakeupFrame
Wakeup condition for all LOD nodes


switches

java.util.Vector switches
The LOD Node's vector of switch nodes.

Constructor Detail

LOD

public LOD()
Constructs and initializes an LOD node.

Method Detail

addSwitch

public void addSwitch(Switch switchNode)
Appends the specified switch node to this LOD's list of switches.

Parameters:
switchNode - the switch node to add to this LOD's list of switches

setSwitch

public void setSwitch(Switch switchNode,
                      int index)
Replaces the specified switch node with the switch node provided.

Parameters:
switchNode - the new switch node
index - which switch node to replace

insertSwitch

public void insertSwitch(Switch switchNode,
                         int index)
Inserts the specified switch node at specified index.

Parameters:
switchNode - the new switch node
index - position to insert new switch node at

removeSwitch

public void removeSwitch(int index)
Removes the switch node at specified index.

Parameters:
index - which switch node to remove

getSwitch

public Switch getSwitch(int index)
Returns the switch node specified by the index.

Parameters:
index - which switch node to return
Returns:
the switch node at location index

getAllSwitches

public java.util.Enumeration getAllSwitches()
Returns the enumeration object of all switches.

Returns:
the enumeration object of all switches

numSwitches

public int numSwitches()
Returns a count of this LOD's switches.

Returns:
the number of switches controlled by this LOD

indexOfSwitch

public int indexOfSwitch(Switch switchNode)
Retrieves the index of the specified switch node in this LOD node's list of switches.

Parameters:
switchNode - the switch node to be looked up.
Returns:
the index of the specified switch node; returns -1 if the object is not in the list.
Since:
Java 3D 1.3

removeSwitch

public void removeSwitch(Switch switchNode)
Removes the specified switch node from this LOD node's list of switches. If the specified object is not in the list, the list is not modified.

Parameters:
switchNode - the switch node to be removed.
Since:
Java 3D 1.3

removeAllSwitches

public void removeAllSwitches()
Removes all switch nodes from this LOD node.

Since:
Java 3D 1.3

duplicateAttributes

void duplicateAttributes(Node originalNode,
                         boolean forceDuplicate)
Copies all LOD information from originalNode into the current node. This method is called from the cloneNode method which is, in turn, called by the cloneTree method.

Overrides:
duplicateAttributes in class Behavior
Parameters:
originalNode - the original node to duplicate.
forceDuplicate - when set to true, causes the duplicateOnCloneTree flag to be ignored. When false, the value of each node's duplicateOnCloneTree variable determines whether NodeComponent data is duplicated or copied.
Throws:
RestrictedAccessException - if this object is part of a live or compiled scenegraph.
See Also:
Node.duplicateNode(javax.media.j3d.Node, boolean), Node.cloneTree(), NodeComponent.setDuplicateOnCloneTree(boolean)

updateNodeReferences

public void updateNodeReferences(NodeReferenceTable referenceTable)
Callback used to allow a node to check if any nodes referenced by that node have been duplicated via a call to cloneTree. This method is called by cloneTree after all nodes in the sub-graph have been duplicated. The cloned Leaf node's method will be called and the Leaf node can then look up any node references by using the getNewObjectReference method found in the NodeReferenceTable object. If a match is found, a reference to the corresponding Node in the newly cloned sub-graph is returned. If no corresponding reference is found, either a DanglingReferenceException is thrown or a reference to the original node is returned depending on the value of the allowDanglingReferences parameter passed in the cloneTree call.

NOTE: Applications should not call this method directly. It should only be called by the cloneTree method.

Overrides:
updateNodeReferences in class Behavior
Parameters:
referenceTable - a NodeReferenceTableObject that contains the getNewObjectReference method needed to search for new object instances.
See Also:
NodeReferenceTable, Node.cloneTree(), DanglingReferenceException


Copyright 1996-2008 Sun Microsystems, Inc. All Rights Reserved. Use is subject to license terms.