Class NetVis

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--NetVis
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class NetVis
extends javax.swing.JComponent

Class for visualizing net data. Generates a basic 2d-visualization of a graph (knots and edges), and uses this visualization as texture for a polygon in 3d. Then, additional information is visualized using cylinders based on this polygon and extending in z-direction.

Author:
Stefan Daschek
See Also:
Serialized Form

Field Summary
(package private)  float angle
           
(package private) static int BORDER
          Size (in pixel) of border around 2D-visualization.
(package private)  javax.media.j3d.Canvas3D c3D
           
(package private)  java.awt.Paint clearPaint
          Paint used for clearing pies.
(package private) static float CYLHEIGHT
          Maximum height (in world-coordinates) of cylinders used for 3d-visualization.
(package private) static float CYLRADIUS
          Radius (in world-coordinates) of cylinders used for 3d-visualization.
(package private)  java.awt.Paint edgePaint
          Paint used for visualizing edges.
(package private)  java.awt.Stroke edgeStroke
          Stroke used for visualizing edges.
(package private) static int KNOTSIZE
          Size (in pixel) of circles representing knots in 2d-visualization.
(package private)  java.awt.Stroke knotStroke
          Stroke used for visualizing knots.
(package private)  NetData netData
          Data to be visualized.
(package private)  javax.media.j3d.TransformGroup objTrans
           
(package private)  java.awt.Paint pie2Paint
          Paint used for fill of pies.
(package private)  java.awt.Paint piePaint
          Paint used for outline of pies.
(package private) static int PIERADIUS
          Size (in pixel) of pie-charts used in 2d-visualization.
(package private)  java.awt.Stroke pieStroke
          Stroke used for visualizing pies.
(package private)  boolean show2dPies
          Flag whether pies should be drawn.
(package private)  boolean show3dCapacity
          Flag whether cylinders visualizing capacity data should be drawn.
(package private)  boolean show3dLoad
          Flag whether cylinders visualizing load data should be drawn.
(package private)  javax.media.j3d.Switch sw
           
(package private)  javax.media.j3d.Transform3D t3d3
           
(package private)  javax.media.j3d.Texture tex
           
(package private) static int TEXTURESIZE
          Size (in pixel) of generated 2d-visualization texture.
(package private)  javax.media.j3d.Transform3D trans
           
private  com.sun.j3d.utils.universe.SimpleUniverse u
           
(package private)  java.awt.image.BufferedImage vis2DImg
           
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Container
 
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
NetVis()
          Default constructor.
 
Method Summary
 javax.media.j3d.BranchGroup createSceneGraph()
          Creates scene graph for Java3D.
 void reset3d()
          Reset viewing transform of scene graph to initial value.
 void setNetData(NetData netData)
          Set data to be visualized and update scene graph and 2d visualization.
 void setShow2dPies(boolean show)
          Toggle visualization of 2d pies.
 void setShow3dCapacity(boolean show)
          Toggle visualization of capacity data.
 void setShow3dLoad(boolean show)
          Toggle visualization of load data.
 void setup()
          Does basic setup of Java3D, create 2d visualization and 3d scene graph.
protected  void updateShow3d()
          Update scene graph to show correct objects according to flags show3dLoad and show3dCapacity.
protected  void visualize2D(java.awt.image.BufferedImage img)
          Do 2d visualization of graph.
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

BORDER

static final int BORDER
Size (in pixel) of border around 2D-visualization.

See Also:
Constant Field Values

TEXTURESIZE

static final int TEXTURESIZE
Size (in pixel) of generated 2d-visualization texture.

See Also:
Constant Field Values

KNOTSIZE

static final int KNOTSIZE
Size (in pixel) of circles representing knots in 2d-visualization.

See Also:
Constant Field Values

PIERADIUS

static final int PIERADIUS
Size (in pixel) of pie-charts used in 2d-visualization.

See Also:
Constant Field Values

CYLRADIUS

static final float CYLRADIUS
Radius (in world-coordinates) of cylinders used for 3d-visualization.

See Also:
Constant Field Values

CYLHEIGHT

static final float CYLHEIGHT
Maximum height (in world-coordinates) of cylinders used for 3d-visualization.

See Also:
Constant Field Values

edgeStroke

java.awt.Stroke edgeStroke
Stroke used for visualizing edges.


edgePaint

java.awt.Paint edgePaint
Paint used for visualizing edges.


knotStroke

java.awt.Stroke knotStroke
Stroke used for visualizing knots.


pieStroke

java.awt.Stroke pieStroke
Stroke used for visualizing pies.


clearPaint

java.awt.Paint clearPaint
Paint used for clearing pies.


piePaint

java.awt.Paint piePaint
Paint used for outline of pies.


pie2Paint

java.awt.Paint pie2Paint
Paint used for fill of pies.


show2dPies

boolean show2dPies
Flag whether pies should be drawn.


show3dLoad

boolean show3dLoad
Flag whether cylinders visualizing load data should be drawn.


show3dCapacity

boolean show3dCapacity
Flag whether cylinders visualizing capacity data should be drawn.


netData

NetData netData
Data to be visualized.


c3D

javax.media.j3d.Canvas3D c3D

u

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

objTrans

javax.media.j3d.TransformGroup objTrans

angle

float angle

trans

javax.media.j3d.Transform3D trans

t3d3

javax.media.j3d.Transform3D t3d3

tex

javax.media.j3d.Texture tex

vis2DImg

java.awt.image.BufferedImage vis2DImg

sw

javax.media.j3d.Switch sw
Constructor Detail

NetVis

public NetVis()
Default constructor. Initializes netData with null.

Method Detail

createSceneGraph

public javax.media.j3d.BranchGroup createSceneGraph()
Creates scene graph for Java3D.

Returns:
BranchGroup consisting of all elements in the scene graph.

setup

public void setup()
Does basic setup of Java3D, create 2d visualization and 3d scene graph.


setNetData

public void setNetData(NetData netData)
Set data to be visualized and update scene graph and 2d visualization.

Parameters:
netData - NetData object to be visualized.

visualize2D

protected void visualize2D(java.awt.image.BufferedImage img)
Do 2d visualization of graph. Visualize knots, edges and piecharts.

Parameters:
img - BufferedImg used for constructing the visualization.

setShow3dLoad

public void setShow3dLoad(boolean show)
Toggle visualization of load data.

Parameters:
show - True if load data should be visualized.

setShow3dCapacity

public void setShow3dCapacity(boolean show)
Toggle visualization of capacity data.

Parameters:
show - True if capacity data should be visualized.

updateShow3d

protected void updateShow3d()
Update scene graph to show correct objects according to flags show3dLoad and show3dCapacity.


setShow2dPies

public void setShow2dPies(boolean show)
Toggle visualization of 2d pies.

Parameters:
show - True if 2d pies should be visualized.

reset3d

public void reset3d()
Reset viewing transform of scene graph to initial value.