examples.syn3d.plugin.java3d
Class XYZResultNodeJava3D

java.lang.Object
  extended by syn3d.base.ActiveNode
      extended by examples.syn3d.plugin.java3d.XYZResultNode
          extended by examples.syn3d.plugin.java3d.XYZResultNodeJava3D
All Implemented Interfaces:
java.io.Serializable

public class XYZResultNodeJava3D
extends XYZResultNode

This specialisation of XYZResult node creates 3D objects corresponding to the file content, using Java3D. It also handles picking, as an example how to do this very useful feature with Java3D.

See Also:
XYZResultNode, Serialized Form

Field Summary
protected  int currentVariable
          The file may contain multiple variables per point (temperature, voltage...), but only one can be displayed at a given time.
protected  java.lang.String fileName
          Used internally, the file name is displayed in the tree
protected  TransformGroup transformGroup
          This node creates a tranform group so as to easily center and scale the shape
 
Fields inherited from class syn3d.base.ActiveNode
children, name, parent
 
Constructor Summary
XYZResultNodeJava3D(ActiveNode parent)
          This specialisation of XYZResultNode creates a Java3D tranform group to hold the shape defined by the data in the file.
 
Method Summary
 void doAction(java.lang.Object action)
          Do a previously declared action
 java.lang.Object get3DObject()
          Returns the 3D object that this node refers to.
 java.util.List getActions()
          Let's declare an action to load a file
protected  java.awt.Color getColorForValue(double value)
           
protected  java.awt.Color getColorForValue(double value, float saturation)
           
 void highlight(boolean on, java.lang.Object parameter)
          Highlights this node some way.
protected  void load(java.io.File file)
          Called from doAction => Load a file with the correct file format This Method should overriden by subclasses, so as to create 3D objects according to the data in the file.
 void remove()
          Removes this node from the parent list.
 void showResult(int num)
          Shows the given result from the data file.
 
Methods inherited from class syn3d.base.ActiveNode
addChild, findDescendantOfType, findDescendantOfType, getChildren, getIcon, getName, getParent, notifyInternalChange, notifyStructuralChange, propagateAddChildEvent, propagateChangeNameEvent, propagateHighlightEvent, propagateInternalChangeEvent, propagateRemoveChildEvent, propagateStructuralChangeEvent, removeChild, removeNodeTree, removeNodeTreeFrom, restoreReferences, saveChildren, setName, setParent, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

transformGroup

protected TransformGroup transformGroup
This node creates a tranform group so as to easily center and scale the shape


fileName

protected java.lang.String fileName
Used internally, the file name is displayed in the tree


currentVariable

protected int currentVariable
The file may contain multiple variables per point (temperature, voltage...), but only one can be displayed at a given time. This gives the current variable number, it should be greater than 3 (since the first variables in the file are supposed to be X, Y, Z).

Constructor Detail

XYZResultNodeJava3D

public XYZResultNodeJava3D(ActiveNode parent)
This specialisation of XYZResultNode creates a Java3D tranform group to hold the shape defined by the data in the file. A transformation will then be applied to scale and center the shape.

Method Detail

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.

remove

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

Overrides:
remove in class ActiveNode

getActions

public java.util.List getActions()
Description copied from class: XYZResultNode
Let's declare an action to load a file

Overrides:
getActions in class XYZResultNode
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: XYZResultNode
Do a previously declared action

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

load

protected void load(java.io.File file)
             throws java.io.IOException
Description copied from class: XYZResultNode
Called from doAction => Load a file with the correct file format This Method should overriden by subclasses, so as to create 3D objects according to the data in the file.

Overrides:
load in class XYZResultNode
Throws:
java.io.IOException

showResult

public void showResult(int num)
Description copied from class: XYZResultNode
Shows the given result from the data file. variables are given in the file as X, Y, Z and a variable number of results to display for each point By default, the first variable is displayed. This function changes the variable to display

Overrides:
showResult in class XYZResultNode

highlight

public void highlight(boolean on,
                      java.lang.Object parameter)
Description copied from class: ActiveNode
Highlights this node some way. It's up to the underlying 3D model to decide what it means. This is an optional operation. Highlighting may occur when the user selects a node in the tree, for example, or when picking an object on a scene view. Note for subclasses : please call the super implementation for event propagation.

Overrides:
highlight in class ActiveNode
Parameters:
on - true indicates to highlight this node, false to revert it back to normal
parameter - A parameter set from the 3D underlying model in case of a picking operation, or the node's 3D object in case of a user selection in the Scene Tree

getColorForValue

protected java.awt.Color getColorForValue(double value)

getColorForValue

protected java.awt.Color getColorForValue(double value,
                                          float saturation)