de.uka.algo.GT3D
Class BFSVisualizer

java.lang.Object
  extended by de.uka.algo.GT3D.BFSVisualizer
All Implemented Interfaces:
Scene3DProvider

public class BFSVisualizer
extends java.lang.Object
implements Scene3DProvider


Field Summary
(package private)  javax.media.j3d.ColoringAttributes axisColoringAttributes
           
(package private)  float axisConeLength
           
(package private)  float axisConeRadius
           
(package private)  float axisLength
           
(package private)  javax.media.j3d.Material axisMaterial
           
(package private)  float axisRadius
           
(package private)  float axisTranslation
           
(package private)  javax.vecmath.Color3f black
           
(package private)  javax.vecmath.Color3f blue
           
(package private)  javax.vecmath.Color3f brown
           
(package private)  javax.vecmath.Color3f darkblue
           
(package private)  javax.vecmath.Color3f darkergray
           
(package private)  javax.vecmath.Color3f darkgray
           
(package private)  javax.vecmath.Color3f darkgreen
           
(package private)  javax.vecmath.Color3f darkyellow
           
private  javax.media.j3d.BranchGroup dynamicRoot
          The root of everything that is going to be dynamic
private  javax.media.j3d.BranchGroup dynLightRoot
          The root for all the lights
private  javax.media.j3d.BranchGroup edgeRoot
          The root for all the edges
(package private)  float edgeThickness
           
private  java.util.Map<edu.uci.ics.jung.graph.Edge,javax.media.j3d.BranchGroup> edgeToBG
           
private  java.util.Map<edu.uci.ics.jung.graph.Edge,com.sun.j3d.utils.geometry.Cylinder> edgeToCylinder
           
(package private)  javax.vecmath.Color3f green
           
(package private)  javax.vecmath.Color3f lightblue
           
(package private)  javax.vecmath.Color3f lightgray
           
(package private)  javax.vecmath.Color3f lightgreen
           
(package private)  javax.vecmath.Color3f lightred
           
(package private)  javax.vecmath.Color3f lightyellow
           
private  javax.media.j3d.BranchGroup nodeRoot
          The root for all the nodes
private  java.util.Map<edu.uci.ics.jung.graph.Vertex,javax.vecmath.Vector3f> nodeToLocation
           
private  java.util.Map<edu.uci.ics.jung.graph.Vertex,com.sun.j3d.utils.geometry.Sphere> nodeToSphere
           
private  java.util.Map<edu.uci.ics.jung.graph.Vertex,javax.media.j3d.TransformGroup> nodeToTG
           
(package private)  javax.vecmath.Color3f orange
           
(package private)  javax.vecmath.Color3f red
           
private  javax.media.j3d.BranchGroup sceneRoot
          The root of it all
private  javax.media.j3d.BranchGroup staticRoot
          The root for everything static
private  edu.uci.ics.jung.graph.DirectedGraph theGraph
          A reference on the underlying graph which is drawn.
(package private)  javax.vecmath.Color3f white
           
(package private)  float xAxisLength
           
(package private)  javax.vecmath.Color3f yellow
           
 
Constructor Summary
BFSVisualizer(edu.uci.ics.jung.graph.DirectedGraph aGraph)
          initializes the Graph
 
Method Summary
private  void createCoordinateSystem(javax.media.j3d.BranchGroup objRoot)
          Draws the coordinate system.
private  void createLight(javax.media.j3d.BranchGroup objRoot)
          Let there be light.
protected  void deleteEdge(edu.uci.ics.jung.graph.Edge e)
           
 javax.media.j3d.BranchGroup getChild()
           
protected  javax.media.j3d.Transform3D getEdgeT3D(edu.uci.ics.jung.graph.Vertex source, edu.uci.ics.jung.graph.Vertex target)
          computes the transformation for placing an edge between two vertices
private  javax.vecmath.Vector3f getNodeLocation(edu.uci.ics.jung.graph.Vertex currentNode)
           
private  com.sun.j3d.utils.geometry.Sphere getNodeSphere(edu.uci.ics.jung.graph.Vertex currentNode)
           
 javax.vecmath.Vector3d getStartPosition()
          The scene must be centered at the origin.
 void highlight(edu.uci.ics.jung.graph.Vertex v)
          A simple way of highlighting a node.
private  void imprintSourceGraph(javax.media.j3d.BranchGroup nRoot, javax.media.j3d.BranchGroup eRoot)
          Draws nodes, edges and light
private  javax.media.j3d.Node placeEdge(edu.uci.ics.jung.graph.Edge theEdge, float thickness, edu.uci.ics.jung.graph.Vertex source, edu.uci.ics.jung.graph.Vertex target)
          Draws an edge.
 void setNodeLocation(edu.uci.ics.jung.graph.Vertex v, javax.vecmath.Vector3f loc)
          Places a Vertex at a specified location.
 void showGraph()
          Constructs the scene.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

theGraph

private edu.uci.ics.jung.graph.DirectedGraph theGraph
A reference on the underlying graph which is drawn.


sceneRoot

private javax.media.j3d.BranchGroup sceneRoot
The root of it all


dynamicRoot

private javax.media.j3d.BranchGroup dynamicRoot
The root of everything that is going to be dynamic


staticRoot

private javax.media.j3d.BranchGroup staticRoot
The root for everything static


nodeRoot

private javax.media.j3d.BranchGroup nodeRoot
The root for all the nodes


edgeRoot

private javax.media.j3d.BranchGroup edgeRoot
The root for all the edges


dynLightRoot

private javax.media.j3d.BranchGroup dynLightRoot
The root for all the lights


nodeToLocation

private java.util.Map<edu.uci.ics.jung.graph.Vertex,javax.vecmath.Vector3f> nodeToLocation

nodeToSphere

private java.util.Map<edu.uci.ics.jung.graph.Vertex,com.sun.j3d.utils.geometry.Sphere> nodeToSphere

nodeToTG

private java.util.Map<edu.uci.ics.jung.graph.Vertex,javax.media.j3d.TransformGroup> nodeToTG

edgeToCylinder

private java.util.Map<edu.uci.ics.jung.graph.Edge,com.sun.j3d.utils.geometry.Cylinder> edgeToCylinder

edgeToBG

private java.util.Map<edu.uci.ics.jung.graph.Edge,javax.media.j3d.BranchGroup> edgeToBG

edgeThickness

final float edgeThickness
See Also:
Constant Field Values

axisRadius

final float axisRadius
See Also:
Constant Field Values

axisConeLength

final float axisConeLength
See Also:
Constant Field Values

axisConeRadius

final float axisConeRadius
See Also:
Constant Field Values

xAxisLength

final float xAxisLength
See Also:
Constant Field Values

axisLength

final float axisLength
See Also:
Constant Field Values

axisTranslation

final float axisTranslation
See Also:
Constant Field Values

axisColoringAttributes

javax.media.j3d.ColoringAttributes axisColoringAttributes

axisMaterial

javax.media.j3d.Material axisMaterial

black

javax.vecmath.Color3f black

white

javax.vecmath.Color3f white

red

javax.vecmath.Color3f red

lightred

javax.vecmath.Color3f lightred

blue

javax.vecmath.Color3f blue

lightblue

javax.vecmath.Color3f lightblue

darkblue

javax.vecmath.Color3f darkblue

yellow

javax.vecmath.Color3f yellow

darkyellow

javax.vecmath.Color3f darkyellow

lightyellow

javax.vecmath.Color3f lightyellow

orange

javax.vecmath.Color3f orange

green

javax.vecmath.Color3f green

darkgreen

javax.vecmath.Color3f darkgreen

lightgreen

javax.vecmath.Color3f lightgreen

brown

javax.vecmath.Color3f brown

darkgray

javax.vecmath.Color3f darkgray

lightgray

javax.vecmath.Color3f lightgray

darkergray

javax.vecmath.Color3f darkergray
Constructor Detail

BFSVisualizer

public BFSVisualizer(edu.uci.ics.jung.graph.DirectedGraph aGraph)
initializes the Graph

Parameters:
aGraph -
Method Detail

showGraph

public void showGraph()
Constructs the scene.


imprintSourceGraph

private void imprintSourceGraph(javax.media.j3d.BranchGroup nRoot,
                                javax.media.j3d.BranchGroup eRoot)
Draws nodes, edges and light

Parameters:
nRoot - The Branchgroup for all the nodes.
eRoot - The Branchgroup for all the edges.

getNodeLocation

private javax.vecmath.Vector3f getNodeLocation(edu.uci.ics.jung.graph.Vertex currentNode)

getNodeSphere

private com.sun.j3d.utils.geometry.Sphere getNodeSphere(edu.uci.ics.jung.graph.Vertex currentNode)

getEdgeT3D

protected javax.media.j3d.Transform3D getEdgeT3D(edu.uci.ics.jung.graph.Vertex source,
                                                 edu.uci.ics.jung.graph.Vertex target)
computes the transformation for placing an edge between two vertices

Parameters:
source - First node.
target - Second node.
Returns:
The transformation.

placeEdge

private javax.media.j3d.Node placeEdge(edu.uci.ics.jung.graph.Edge theEdge,
                                       float thickness,
                                       edu.uci.ics.jung.graph.Vertex source,
                                       edu.uci.ics.jung.graph.Vertex target)
Draws an edge.

Parameters:
theEdge -
thickness -
source -
target -
Returns:
The BranchGroup of the created edge.

deleteEdge

protected void deleteEdge(edu.uci.ics.jung.graph.Edge e)

createCoordinateSystem

private void createCoordinateSystem(javax.media.j3d.BranchGroup objRoot)
Draws the coordinate system.

Parameters:
objRoot - The sub-scene is attached to this BranchGroup.

createLight

private void createLight(javax.media.j3d.BranchGroup objRoot)
Let there be light.

Parameters:
objRoot - The sub-scene is attached to this BranchGroup.

getChild

public javax.media.j3d.BranchGroup getChild()
Specified by:
getChild in interface Scene3DProvider
Returns:
The root of your scene graph.

getStartPosition

public javax.vecmath.Vector3d getStartPosition()
Description copied from interface: Scene3DProvider
The scene must be centered at the origin. The return value specifies the x-, y-, and z-size of the scene (should be smaller than 100).

Specified by:
getStartPosition in interface Scene3DProvider
Returns:
a bounding box of the 3d scene.

setNodeLocation

public void setNodeLocation(edu.uci.ics.jung.graph.Vertex v,
                            javax.vecmath.Vector3f loc)
Places a Vertex at a specified location.

Parameters:
v - The vertex.
loc - The new location.

highlight

public void highlight(edu.uci.ics.jung.graph.Vertex v)
A simple way of highlighting a node.

Parameters:
v -