it.polito.elite.visualization.ontoviewer.scenes3D
Class Scene3D

java.lang.Object
  extended by it.polito.elite.visualization.ontoviewer.scenes3D.Scene3D
Direct Known Subclasses:
SceneDependencyTree6, SceneFocusConcept3, SceneFocusFacts5, SceneFocusInstances4, SceneFocusRoots1, SceneFocusTree2

public abstract class Scene3D
extends java.lang.Object

Scene3D is the abstract base class in the package and any concrete scene has to extend it. It contains abstract methods wich define an interface and it provides some utility procedures for creating the scene as

Author:
alessio.bosca@polito.it

Field Summary
protected  MyMouseCursorSelector behaviorCURS
           
protected  com.sun.j3d.utils.behaviors.mouse.MouseRotate behaviorROT
           
protected  MyMouseTranslate behaviorTRAS
          Behaviours per l'interazione con la scena tramite il mouse
protected  com.sun.j3d.utils.behaviors.mouse.MouseWheelZoom behaviorZOOM
           
protected  javax.media.j3d.BranchGroup bgLabelScene
          Gruppi che incapsulano la scena
protected  javax.media.j3d.BranchGroup bgSCENE
          Gruppi che incapsulano la scena
private  javax.media.j3d.BoundingSphere bounds
          dimensions of the 3D area
protected  java.lang.String currentConceptURI
          the uris of the current concept
protected  java.lang.String currentInstanceURI
           
static int numScenes
           
protected  java.util.Hashtable<java.lang.String,javax.vecmath.Vector3f> positions
           
 Pane3DScene refMainPanel
          reference to the main Panel
protected  javax.vecmath.Vector3f rootPosition
           
protected  int sceneID
          number of scene id
protected  MyPickBehaviour simplePick
          Behaviour that manages that captures the mouse clicks and retrieves the 3D object picked by its USER DATA field
protected  javax.media.j3d.TransformGroup tgROT
           
protected  javax.media.j3d.TransformGroup tgSCENE
           
 
Constructor Summary
protected Scene3D(Pane3DScene _mf, java.lang.String conceptUri, java.lang.String instanceUri, int sceneID)
           
 
Method Summary
protected  void addBehaviors()
          Adds mouse related behaviour to manage scene interaction (pan, zoom, rotate, pick...)
 void addPopUpMenu(java.awt.PopupMenu menu)
           
 void addSceneLabel(java.lang.String textString)
           
 void backToInitialSceneView()
           
 javax.vecmath.Vector3f centralPositionAtGivenHeightScale(float scale)
           
private  int computeOccurenceOf(java.lang.String source, char ch)
           
protected  void createBGandTGforTheScene()
           
protected  javax.media.j3d.BranchGroup createBranchGroup()
          Creates a proper BranchGroup
private  java.awt.PopupMenu createPopupSelectionMenu(java.lang.String logicsetDescritpion, boolean isSubMenu)
           
protected  java.util.HashSet<java.lang.Integer> createRandomSet(int numOfElem, int limit)
          Utility methods that create a set of random integers, useful for assigning void positions in sparse visualizations
abstract  void createScene()
           
protected  javax.media.j3d.TransformGroup createTransformGroup()
          Creates a proper TransformGroup
abstract  void expand_OR_collapseElement(java.lang.String uri)
           
abstract  void fadeInAnimation()
           
abstract  void fadeOutAnimation(java.lang.String uri, Scene3D nextScene)
           
 javax.vecmath.Point3f get2DTo3DPoint(int x, int y)
           
 javax.vecmath.Point2d get3DTo2DPoint(javax.vecmath.Point3d point3d)
           
 javax.media.j3d.Bounds getBounds()
           
 java.awt.Dimension getCanvas3DSize()
           
 java.lang.String getCurrentConceptURI()
           
 java.lang.String getCurrentInstanceURI()
           
 javax.media.j3d.BranchGroup getSceneBranchGroup()
           
 int getSceneID()
           
private static void getShapes(java.util.Enumeration p_children, java.util.ArrayList<javax.media.j3d.Shape3D> p_shapes)
          A recursive method for exploring the tree and retrieving the Shapes3D
static javax.media.j3d.Shape3D[] getShapes(javax.media.j3d.Group group)
          Gets all the Shapes3D Objects rooted in a given TransformGroup
 void recreateSceneFromScratch()
           
protected  void removeBehaviours()
          remove mouse related behaviours from the scene (actually disables them..)
 void removePopUpMenu(java.awt.PopupMenu menu)
           
 void repaintCanvas()
           
abstract  void selectElement(java.lang.String uri)
           
 void setCurrentConceptURI(java.lang.String currentConceptURI)
           
 void setCurrentInstanceURI(java.lang.String currentInstanceURI)
           
abstract  boolean showContextMenu(java.awt.PopupMenu menu, java.lang.String uri)
           
abstract  boolean showRelationContextMenu(java.awt.PopupMenu menu, java.util.HashSet<RelationData> relSet)
           
protected  void showSelectionPopUp(java.lang.String content)
           
 void updateView(javax.vecmath.Vector3f center)
          Centers the scene in a new position
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

behaviorCURS

protected MyMouseCursorSelector behaviorCURS

behaviorROT

protected com.sun.j3d.utils.behaviors.mouse.MouseRotate behaviorROT

behaviorTRAS

protected MyMouseTranslate behaviorTRAS
Behaviours per l'interazione con la scena tramite il mouse


behaviorZOOM

protected com.sun.j3d.utils.behaviors.mouse.MouseWheelZoom behaviorZOOM

bgLabelScene

protected javax.media.j3d.BranchGroup bgLabelScene
Gruppi che incapsulano la scena


bgSCENE

protected javax.media.j3d.BranchGroup bgSCENE
Gruppi che incapsulano la scena


bounds

private javax.media.j3d.BoundingSphere bounds
dimensions of the 3D area


currentConceptURI

protected java.lang.String currentConceptURI
the uris of the current concept


currentInstanceURI

protected java.lang.String currentInstanceURI

numScenes

public static final int numScenes
See Also:
Constant Field Values

positions

protected java.util.Hashtable<java.lang.String,javax.vecmath.Vector3f> positions

refMainPanel

public Pane3DScene refMainPanel
reference to the main Panel


rootPosition

protected javax.vecmath.Vector3f rootPosition

sceneID

protected int sceneID
number of scene id


simplePick

protected MyPickBehaviour simplePick
Behaviour that manages that captures the mouse clicks and retrieves the 3D object picked by its USER DATA field


tgROT

protected javax.media.j3d.TransformGroup tgROT

tgSCENE

protected javax.media.j3d.TransformGroup tgSCENE
Constructor Detail

Scene3D

protected Scene3D(Pane3DScene _mf,
                  java.lang.String conceptUri,
                  java.lang.String instanceUri,
                  int sceneID)
Method Detail

addBehaviors

protected void addBehaviors()
Adds mouse related behaviour to manage scene interaction (pan, zoom, rotate, pick...)


addPopUpMenu

public void addPopUpMenu(java.awt.PopupMenu menu)

addSceneLabel

public void addSceneLabel(java.lang.String textString)

backToInitialSceneView

public void backToInitialSceneView()

centralPositionAtGivenHeightScale

public javax.vecmath.Vector3f centralPositionAtGivenHeightScale(float scale)

computeOccurenceOf

private int computeOccurenceOf(java.lang.String source,
                               char ch)

createBGandTGforTheScene

protected void createBGandTGforTheScene()

createBranchGroup

protected javax.media.j3d.BranchGroup createBranchGroup()
Creates a proper BranchGroup

Returns:
a new BranchGroup

createPopupSelectionMenu

private java.awt.PopupMenu createPopupSelectionMenu(java.lang.String logicsetDescritpion,
                                                    boolean isSubMenu)

createRandomSet

protected java.util.HashSet<java.lang.Integer> createRandomSet(int numOfElem,
                                                               int limit)
Utility methods that create a set of random integers, useful for assigning void positions in sparse visualizations


createScene

public abstract void createScene()

createTransformGroup

protected javax.media.j3d.TransformGroup createTransformGroup()
Creates a proper TransformGroup

Returns:
a new TransformGroup

expand_OR_collapseElement

public abstract void expand_OR_collapseElement(java.lang.String uri)

fadeInAnimation

public abstract void fadeInAnimation()

fadeOutAnimation

public abstract void fadeOutAnimation(java.lang.String uri,
                                      Scene3D nextScene)

get2DTo3DPoint

public javax.vecmath.Point3f get2DTo3DPoint(int x,
                                            int y)

get3DTo2DPoint

public javax.vecmath.Point2d get3DTo2DPoint(javax.vecmath.Point3d point3d)

getBounds

public javax.media.j3d.Bounds getBounds()

getCanvas3DSize

public java.awt.Dimension getCanvas3DSize()

getCurrentConceptURI

public java.lang.String getCurrentConceptURI()
Returns:
currentConceptURI

getCurrentInstanceURI

public java.lang.String getCurrentInstanceURI()

getSceneBranchGroup

public javax.media.j3d.BranchGroup getSceneBranchGroup()

getSceneID

public int getSceneID()
Returns:
Returns the sceneID.

getShapes

private static void getShapes(java.util.Enumeration p_children,
                              java.util.ArrayList<javax.media.j3d.Shape3D> p_shapes)
A recursive method for exploring the tree and retrieving the Shapes3D

Parameters:
p_children -
p_shapes -

getShapes

public static javax.media.j3d.Shape3D[] getShapes(javax.media.j3d.Group group)
Gets all the Shapes3D Objects rooted in a given TransformGroup

Parameters:
group - the Group containing the Shape3D to retrieve
Returns:
an array containing all the retrieved Shapes3Ds

recreateSceneFromScratch

public void recreateSceneFromScratch()

removeBehaviours

protected void removeBehaviours()
remove mouse related behaviours from the scene (actually disables them..) mainly used during the animations (this way users can't interfere during animation process)


removePopUpMenu

public void removePopUpMenu(java.awt.PopupMenu menu)

repaintCanvas

public void repaintCanvas()

selectElement

public abstract void selectElement(java.lang.String uri)

setCurrentConceptURI

public void setCurrentConceptURI(java.lang.String currentConceptURI)
Parameters:
currentConceptURI - The currentConceptURI to set.

setCurrentInstanceURI

public void setCurrentInstanceURI(java.lang.String currentInstanceURI)
Parameters:
currentInstanceURI - The currentInstanceURI to set.

showContextMenu

public abstract boolean showContextMenu(java.awt.PopupMenu menu,
                                        java.lang.String uri)

showRelationContextMenu

public abstract boolean showRelationContextMenu(java.awt.PopupMenu menu,
                                                java.util.HashSet<RelationData> relSet)

showSelectionPopUp

protected void showSelectionPopUp(java.lang.String content)

updateView

public void updateView(javax.vecmath.Vector3f center)
Centers the scene in a new position