examples.syn3d.plugin.java3d
Class Java3DXYZResultSyn3DPlugin

java.lang.Object
  extended by syn3d.base.Syn3DPlugin
      extended by examples.syn3d.plugin.java3d.Java3DXYZResultSyn3DPlugin
All Implemented Interfaces:
java.awt.event.KeyListener, java.util.EventListener

public class Java3DXYZResultSyn3DPlugin
extends Syn3DPlugin
implements java.awt.event.KeyListener

This is an example plugin for Java3D Syn3D. Its main goal is to create nodes specialized in loading simple 3D files. Such files contain both a geometry and some values to display on it, the format is simple and used in other applications like TecPlot. It is described in the XYZResultNode class. The main goal of this plugin is to serve as an example, and to present a few tips and tricks when dealing with Java3D (and Syn3D in general).


Field Summary
 
Fields inherited from class syn3d.base.Syn3DPlugin
pluginManager
 
Constructor Summary
Java3DXYZResultSyn3DPlugin()
           
 
Method Summary
 boolean canCreate(java.lang.String node, ActiveNode parent)
          This method is used for screne graph building, and should be fast.
 ActiveNode create(java.lang.String node, ActiveNode parent)
          Node factory.
 java.lang.String[] getNodes()
          This plugin may bring its own nodes for the scene graph.
 void keyPressed(java.awt.event.KeyEvent e)
           
 void keyReleased(java.awt.event.KeyEvent e)
           
 void keyTyped(java.awt.event.KeyEvent e)
           
 
Methods inherited from class syn3d.base.Syn3DPlugin
createFromKey
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Java3DXYZResultSyn3DPlugin

public Java3DXYZResultSyn3DPlugin()
Method Detail

getNodes

public java.lang.String[] getNodes()
Description copied from class: Syn3DPlugin
This plugin may bring its own nodes for the scene graph. It should return here the names for the node types it can create. Tip: It is possible to gather the types by categories, using "|" in the strings. ex: "Shapes|Sphere", "Shapes|Cube", "Branch|Switch", "Branch|Group"... In popup menus, entries in the same categories are gathered in the same sub-menu

Overrides:
getNodes in class Syn3DPlugin
Returns:
An array of node types. An empty array or null is accepted if this plugin does not bring new nodes

canCreate

public boolean canCreate(java.lang.String node,
                         ActiveNode parent)
Description copied from class: Syn3DPlugin
This method is used for screne graph building, and should be fast. It determines what nodes can be added to a given node in the scene graph. This operation may be supported only for a given underlying 3D platform (Xith3D, Java3D), so check this too. Tip : check if the parent 3D object corresponds to a 3D architecture this plugin handles.

Overrides:
canCreate in class Syn3DPlugin
Parameters:
node - A node type, previously returned by the getNodes() method
parent - The candidate node on which the systems want to know if a new node of the given type could be added as a child.
Returns:
true if a new node of this type could be added to the parent. The new node shall not be created at this point.

create

public ActiveNode create(java.lang.String node,
                         ActiveNode parent)
Description copied from class: Syn3DPlugin
Node factory. On successful return from canCreate(...), the user may select a node type handled by this plugin. This method is responsible for creating such a node, and it is also responsible for attaching the 3D object it refers to as a child to the parent node 3Dobject. Note: The 3D platform used is the same as in canCreate, of course.

Overrides:
create in class Syn3DPlugin
Parameters:
node - A node type, previously returned by the getNodes() method
parent - The existing node on which to attach the new node as a child.
Returns:
A valid ActiveNode, attached to the given parent. null is permitted if something has changed since the moment when canCreate was called and the node cannot be created now. (no thread synchronization, so it may happen).

keyTyped

public void keyTyped(java.awt.event.KeyEvent e)
Specified by:
keyTyped in interface java.awt.event.KeyListener

keyReleased

public void keyReleased(java.awt.event.KeyEvent e)
Specified by:
keyReleased in interface java.awt.event.KeyListener

keyPressed

public void keyPressed(java.awt.event.KeyEvent e)
Specified by:
keyPressed in interface java.awt.event.KeyListener