bass.visualisation.view
Class GraphCanvas

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Canvas
          extended by javax.media.j3d.Canvas3D
              extended by bass.visualisation.view.GraphCanvas
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible

public class GraphCanvas
extends javax.media.j3d.Canvas3D

The canvas for bass. Setting up all behaviours, the universe, all interaction with the scene etc... Every call to add stuff into the scenegraph goes from here.

Version:
0.1
Author:
Patrick Mai
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.awt.Canvas
java.awt.Canvas.AccessibleAWTCanvas
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
private  javax.media.j3d.BranchGroup bg
           
private  javax.media.j3d.Bounds bounds
           
private  java.awt.event.KeyListener keyListener
           
private  com.sun.j3d.utils.behaviors.mouse.MouseRotate MouseRotate
           
private  com.sun.j3d.utils.behaviors.mouse.MouseTranslate MouseTranslate
           
private  com.sun.j3d.utils.behaviors.mouse.MouseZoom MouseZoom
           
protected  javax.media.j3d.TransformGroup transformGroup
           
protected  javax.media.j3d.TransformGroup transformGroup1
           
private  com.sun.j3d.utils.universe.SimpleUniverse universe
           
 
Fields inherited from class javax.media.j3d.Canvas3D
FIELD_ALL, FIELD_LEFT, FIELD_RIGHT
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
GraphCanvas(int xsize, int ysize)
          The constructor calls the superconstructor and get the java3d preferred configuration for a simple universe object
 
Method Summary
private  void addMouseRotators(javax.media.j3d.Bounds bounds)
          addMouseRotators sets up the mouse behaviours and add them to the branchgroup
 void createEmptyUniverse()
          createEmptyUniverse is called on startup of bass so a black screen is seen inside the gui
 void createUniverse()
          createUniverse is called when a band should be visualized, on startup createEmptyUniverse is called to set up an empty black screen
 com.sun.j3d.utils.behaviors.mouse.MouseRotate getMouseRotate()
           
 com.sun.j3d.utils.behaviors.mouse.MouseTranslate getMouseTranslate()
           
 com.sun.j3d.utils.behaviors.mouse.MouseZoom getMouseZoom()
           
 void init()
          The initialization goes here
 void resetToFarView()
          reset to far view does not use the logarithm to compute the z-transaltion.
 void resetToNearView()
          resetToNearView is called from the 'reset view' button in the gui.
 void setAntialiasingEnabled(boolean enabled)
          Enables antialiasing.
 void setStereoSeparation(double separation)
          Not used in the current version of bass
 void startVisualisation(java.lang.String bandID, int minFriends, int depth, boolean friendsconnection, boolean edgeconnection, boolean names, Gui theGui)
          This method is called directly from the gui (from it's thread).
 
Methods inherited from class javax.media.j3d.Canvas3D
addNotify, getBounds, getBounds, getCenterEyeInImagePlate, getDoubleBufferAvailable, getDoubleBufferEnable, getGraphics2D, getGraphicsContext3D, getHeight, getImagePlateToVworld, getInverseVworldProjection, getLeftEyeInImagePlate, getLeftManualEyeInImagePlate, getLocation, getLocation, getLocationOnScreen, getMonoscopicViewPolicy, getOffScreenBuffer, getOffScreenLocation, getOffScreenLocation, getPhysicalHeight, getPhysicalWidth, getPixelLocationFromImagePlate, getPixelLocationInImagePlate, getPixelLocationInImagePlate, getRightEyeInImagePlate, getRightManualEyeInImagePlate, getSceneAntialiasingAvailable, getScreen3D, getSize, getSize, getStereoAvailable, getStereoEnable, getView, getVworldProjection, getVworldToImagePlate, getWidth, getX, getY, isOffScreen, isRendererRunning, isShadingLanguageSupported, paint, postRender, postSwap, preRender, queryProperties, removeNotify, renderField, renderOffScreenBuffer, setDoubleBufferEnable, setLeftManualEyeInImagePlate, setMonoscopicViewPolicy, setOffScreenBuffer, setOffScreenLocation, setOffScreenLocation, setRightManualEyeInImagePlate, setStereoEnable, startRenderer, stopRenderer, swap, waitForOffScreenRendering
 
Methods inherited from class java.awt.Canvas
createBufferStrategy, createBufferStrategy, getAccessibleContext, getBufferStrategy, update
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, deliverEvent, disable, disableEvents, dispatchEvent, doLayout, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAlignmentX, getAlignmentY, getBackground, getColorModel, getComponentAt, getComponentAt, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeys, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getListeners, getLocale, getMaximumSize, getMinimumSize, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusCycleRoot, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, paramString, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, processComponentEvent, processEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFont, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

transformGroup

protected javax.media.j3d.TransformGroup transformGroup

transformGroup1

protected javax.media.j3d.TransformGroup transformGroup1

bg

private javax.media.j3d.BranchGroup bg

bounds

private javax.media.j3d.Bounds bounds

universe

private com.sun.j3d.utils.universe.SimpleUniverse universe

MouseRotate

private com.sun.j3d.utils.behaviors.mouse.MouseRotate MouseRotate

MouseTranslate

private com.sun.j3d.utils.behaviors.mouse.MouseTranslate MouseTranslate

MouseZoom

private com.sun.j3d.utils.behaviors.mouse.MouseZoom MouseZoom

keyListener

private java.awt.event.KeyListener keyListener
Constructor Detail

GraphCanvas

public GraphCanvas(int xsize,
                   int ysize)
The constructor calls the superconstructor and get the java3d preferred configuration for a simple universe object

Parameters:
xsize - the size og the window in x
ysize - the size of the window in y
Method Detail

init

public void init()
The initialization goes here


startVisualisation

public void startVisualisation(java.lang.String bandID,
                               int minFriends,
                               int depth,
                               boolean friendsconnection,
                               boolean edgeconnection,
                               boolean names,
                               Gui theGui)
This method is called directly from the gui (from it's thread). Every following action goes from here. It calls BassSceneGraph. From there bandview etc... If all went well the 'filled' Branchgroup will be added to a transformgroup. This TG is then added to the universe object

Parameters:
bandID - the id of the target band
minFriends - the minimum amount of friends a band needs to be in the visualization
depth - the hierarchielevel
friendsconnection - should the connections between friends be shown?
edgeconnection - should the connections from the mainband to it's friends be shown?
names - should the name of each band on the screen be shown?

createUniverse

public void createUniverse()
createUniverse is called when a band should be visualized, on startup createEmptyUniverse is called to set up an empty black screen


createEmptyUniverse

public void createEmptyUniverse()
createEmptyUniverse is called on startup of bass so a black screen is seen inside the gui


setStereoSeparation

public void setStereoSeparation(double separation)
Not used in the current version of bass

Parameters:
separation -

resetToNearView

public void resetToNearView()
resetToNearView is called from the 'reset view' button in the gui. It sets the view in a way all elements on the screen can be seen. Therfore it uses the logarithm fore translating the view into the nagative z-axis


resetToFarView

public void resetToFarView()
reset to far view does not use the logarithm to compute the z-transaltion. It just translate the whole scene 3 times the value into the nagative z-axis. Mainly for testing purposes we decided to let the method stay. It can be used with the "f"-key on the keyboard.


addMouseRotators

private void addMouseRotators(javax.media.j3d.Bounds bounds)
addMouseRotators sets up the mouse behaviours and add them to the branchgroup

Parameters:
bounds - the bounds object

getMouseTranslate

public com.sun.j3d.utils.behaviors.mouse.MouseTranslate getMouseTranslate()

getMouseRotate

public com.sun.j3d.utils.behaviors.mouse.MouseRotate getMouseRotate()

getMouseZoom

public com.sun.j3d.utils.behaviors.mouse.MouseZoom getMouseZoom()

setAntialiasingEnabled

public void setAntialiasingEnabled(boolean enabled)
Enables antialiasing. We are not sure if the performance loss we get while call this method is huge. We just use it and hence let it stay.

Parameters:
enabled -