syn3d.nodes.xith3d
Class SceneNodeXith3D

java.lang.Object
  extended by syn3d.base.ActiveNode
      extended by syn3d.nodes.GroupNode
          extended by syn3d.nodes.SceneNode
              extended by syn3d.nodes.xith3d.SceneNodeXith3D
All Implemented Interfaces:
java.io.Serializable, EndNotificationListener, SceneChangeListener

public class SceneNodeXith3D
extends SceneNode
implements SceneChangeListener

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class syn3d.nodes.SceneNode
SceneNode.SceneTimerTask
 
Field Summary
protected  BranchGroup branchgroup
           
protected  Frame3DXith3D frame
           
protected  int lightRotationMode
           
protected  DirectionalLight[] lights
           
protected  Shape3D lightVector
           
protected  Locale locale
           
protected  PluginManager pluginManager
           
protected  BranchGroup rootGroup
           
protected  VirtualUniverse universe
           
 
Fields inherited from class syn3d.nodes.SceneNode
anonymousSceneNumber, dirtyNodes, fileName, FLY_BY_MODE, icon, listeners, REFRESH_PERIOD, refreshPeriod, refreshPeriodChanged, ROTATION_MODE, timer, viewingMode
 
Fields inherited from class syn3d.base.ActiveNode
children, name, parent
 
Constructor Summary
SceneNodeXith3D(ActiveNode parent, PluginManager pm)
           
 
Method Summary
 void autoZoom()
          Auto zooms the scene out of all objects
 void changeProjection()
          Turns perspective on an off
 void doAction(java.lang.Object action)
          When the user has selected an action in the list return by getActions(), this method is called.
 java.lang.Object get3DObject()
          Returns the 3D object that this node refers to.
 java.util.List getActions()
          Returns a list of possible actions on this node.
 BranchGroup getBranchgroup()
           
 int getLightRotationMode()
           
 DirectionalLight[] getLights()
           
 Locale getLocale()
           
 VirtualUniverse getUniverse()
           
 void init2DPosition(int posX, int posY)
          Initialize 2D rotation algorithm with the current position as origin.
 boolean isVisible()
           
 ActiveNode pick(int posX, int posY)
          Selects a single pick at the given position.
 void remove()
          Removes this node from the parent list.
 void reset()
          Reset all values to default
 void rotate2D(int newX, int newY)
          Does a rotation of the scene according to moves in a 2D coordinate system.
 void sceneChanged(SceneNode scene)
           
 void setVisible(boolean status)
           
 void showLightVector(float x, float y, float z)
           
 java.util.ArrayList toggleAllPicks(int posX, int posY)
          Adds or removes all picks between the given position and the last position, to the selected objects.
 java.util.ArrayList toggleSinglePick(int posX, int posY)
          Adds or removes a single pick at the given position to the selected objects.
 void translate2D(int newX, int newY)
          Does a translation of the scene according to moves in a 2D coordinate system.
 void zoom(int zoomIncrement)
          Zooms in or out of the scene according to the increment.
 void zoom2D(int newX, int newY)
          Uses the 2D increments in position to compute a zoom factor, then zooms the scene accordingly.
 
Methods inherited from class syn3d.nodes.SceneNode
addDirtyNode, addListener, getIcon, getRefreshPeriod, getScene, getViewingMode, notificationEnd, notifyChange, notifyListeners, propagateHighlightEvent, propagateInternalChangeEvent, removeDirtyNode, removeListener, restoreReferences, restoreScene, saveChildren, setRefreshPeriod, setViewingMode
 
Methods inherited from class syn3d.nodes.GroupNode
getScene
 
Methods inherited from class syn3d.base.ActiveNode
addChild, findDescendantOfType, findDescendantOfType, getChildren, getName, getParent, highlight, notifyInternalChange, notifyStructuralChange, propagateAddChildEvent, propagateChangeNameEvent, propagateRemoveChildEvent, propagateStructuralChangeEvent, removeChild, removeNodeTree, removeNodeTreeFrom, setName, setParent, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

universe

protected VirtualUniverse universe

locale

protected Locale locale

rootGroup

protected BranchGroup rootGroup

branchgroup

protected BranchGroup branchgroup

frame

protected Frame3DXith3D frame

lights

protected DirectionalLight[] lights

lightVector

protected Shape3D lightVector

lightRotationMode

protected int lightRotationMode

pluginManager

protected PluginManager pluginManager
Constructor Detail

SceneNodeXith3D

public SceneNodeXith3D(ActiveNode parent,
                       PluginManager pm)
Method Detail

remove

public void remove()
Description copied from class: SceneNode
Removes this node from the parent list. Notifies the parents for structural change.

Overrides:
remove in class SceneNode

get3DObject

public java.lang.Object get3DObject()
Description copied from class: ActiveNode
Returns the 3D object that this node refers to. The object may depend on the 3D model used (Xith3D, Java3D) This object was previously created in the plugin create method, or in the loadTo method during de-serialization.

Overrides:
get3DObject in class ActiveNode
Returns:
the Object used for the scene graph, which probably depends on the underlying 3D architecture. This can be used on a parent node in the plugin canCreate method to check for this architecture.

getActions

public java.util.List getActions()
Description copied from class: ActiveNode
Returns a list of possible actions on this node. Actions may be classified by categories using the "|" separator. Ex: a transform node may have the following actions: "Rotate|90° on X", "Rotate|180° on X", etc...

Overrides:
getActions in class SceneNode
Returns:
an array of possible actions, or a null or empty array if this node doesn't handle any action

doAction

public void doAction(java.lang.Object action)
Description copied from class: ActiveNode
When the user has selected an action in the list return by getActions(), this method is called. The node should then do what it claims.

Overrides:
doAction in class SceneNode
Parameters:
action - An action previously declared by the getActions method.

isVisible

public boolean isVisible()
Overrides:
isVisible in class SceneNode

setVisible

public void setVisible(boolean status)
Overrides:
setVisible in class SceneNode

getBranchgroup

public BranchGroup getBranchgroup()
Returns:
Returns the branchgroup.

getLocale

public Locale getLocale()
Returns:
Returns the locale.

getUniverse

public VirtualUniverse getUniverse()
Returns:
Returns the universe.

getLights

public DirectionalLight[] getLights()
Returns:
Returns the lights.

getLightRotationMode

public int getLightRotationMode()
Returns:
Returns the rotationMode.

sceneChanged

public void sceneChanged(SceneNode scene)
Specified by:
sceneChanged in interface SceneChangeListener

showLightVector

public void showLightVector(float x,
                            float y,
                            float z)

init2DPosition

public void init2DPosition(int posX,
                           int posY)
Description copied from class: SceneNode
Initialize 2D rotation algorithm with the current position as origin. Typically, this is related to mouse positions in X and Y.

Overrides:
init2DPosition in class SceneNode

rotate2D

public void rotate2D(int newX,
                     int newY)
Description copied from class: SceneNode
Does a rotation of the scene according to moves in a 2D coordinate system. Use init2DPosition to position an origin, then do as many rotate2D as required.

Overrides:
rotate2D in class SceneNode
Parameters:
newX - The new X position in 2D, typically a mouse position
newY - The new Y position in 2D, typically a mouse position

translate2D

public void translate2D(int newX,
                        int newY)
Description copied from class: SceneNode
Does a translation of the scene according to moves in a 2D coordinate system. Use init2DPosition to position an origin, then do as many translate2D as required.

Overrides:
translate2D in class SceneNode
Parameters:
newX - The new X position in 2D, typically a mouse position
newY - The new Y position in 2D, typically a mouse position

zoom

public void zoom(int zoomIncrement)
Description copied from class: SceneNode
Zooms in or out of the scene according to the increment. This is an arbitrary algorithm to help create correct zoom factors. You could use setZoomFactor and then update the zoom matrix directly, with the same effect.
The added value of this function is to provide a relative and easy to manipulate way to zoom in or out, with increments like +1 or -1 for small zooms, and +10 and -10 for greater zooms, etc...

Overrides:
zoom in class SceneNode
Parameters:
zoomIncrement - A value typically 1 or -1, but which can be greater for fast zooms. Positive values zoom in, negative values zoom out.

zoom2D

public void zoom2D(int newX,
                   int newY)
Description copied from class: SceneNode
Uses the 2D increments in position to compute a zoom factor, then zooms the scene accordingly.

Overrides:
zoom2D in class SceneNode
Parameters:
newX - The new X position in 2D, typically a mouse position
newY - The new Y position in 2D, typically a mouse position

changeProjection

public void changeProjection()
Description copied from class: SceneNode
Turns perspective on an off

Overrides:
changeProjection in class SceneNode

reset

public void reset()
Description copied from class: SceneNode
Reset all values to default

Overrides:
reset in class SceneNode

autoZoom

public void autoZoom()
Description copied from class: SceneNode
Auto zooms the scene out of all objects

Overrides:
autoZoom in class SceneNode

toggleSinglePick

public java.util.ArrayList toggleSinglePick(int posX,
                                            int posY)
Description copied from class: SceneNode
Adds or removes a single pick at the given position to the selected objects.

Overrides:
toggleSinglePick in class SceneNode
Parameters:
posX - the 2D X position where to do the picking
posY - the 2D Y position where to do the picking
Returns:
Returns the current selection, possibly an empy array
See Also:
ActiveNode.higlight(boolean,Object)

toggleAllPicks

public java.util.ArrayList toggleAllPicks(int posX,
                                          int posY)
Description copied from class: SceneNode
Adds or removes all picks between the given position and the last position, to the selected objects.

Overrides:
toggleAllPicks in class SceneNode
Parameters:
posX - the 2D X position defining a region with the last position. All objects in this region should be picked.
Returns:
Returns the current selection, possibly an empy array
See Also:
ActiveNode.higlight(boolean,Object)

pick

public ActiveNode pick(int posX,
                       int posY)
Description copied from class: SceneNode
Selects a single pick at the given position.

Overrides:
pick in class SceneNode
Parameters:
posX - the 2D X position where to do the picking
posY - the 2D Y position where to do the picking
Returns:
Returns the picked node or possibly a null object if there was nothing to pick at this position
See Also:
ActiveNode.higlight(boolean,Object)