snakeprogram3d.display3d
Class InteractiveView

java.lang.Object
  extended by snakeprogram3d.display3d.InteractiveView

public class InteractiveView
extends java.lang.Object

Shows 3 perpendicular planes, that can be clicked on during certain times.


Constructor Summary
InteractiveView(java.awt.GraphicsConfiguration gc)
          Interactive view displays 3 perpendicular planes used for interacting with the 3d scene.
 
Method Summary
 void addMarker(java.lang.String name)
          Add a marker with a name
 void addSnake(Snake s)
          Add a Snake by creating a poly linea polyline that is backed by the added snake.
 void addSnakeListener(SnakeModel sm)
          This is how the 3D clicks are transfered to the snake model.
 void clearMarkers()
          Remove all markers
 javax.media.j3d.TexCoordGeneration createTexCoordinteGeneration(float x, float y, float z)
          Uses the vectors x,y,z to scale the volume texture to the proper coordinates.
 void deleteSnake(Snake s)
          deletes the chosen snake by removing it from the scene and from the list of stored snakes
 void drawRawSnake(java.util.ArrayList<double[]> raw)
          Snakes are stored as an array list of double[] when they are being initialized.
 void followCursor(double x, double y, double z)
          During initialization this follows the cursor with a polyline
 java.awt.Component getComponent()
          Gets the component that this is being drawn on.]
 void moveDown()
           
 void moveUp()
           
 void placeMarker(java.lang.String name, double[] pt)
          move marker to the position pt
 void refreshImages()
          Refreshes the texture being displayed w/out changing the geometry
 void reset(SnakeBufferedImages sbi)
          Resets the current display, clears all snakes, planes and bounding boxes resets the scale, creates new planes and bounding boxes then applies the threed texture
 void setInitializing(boolean v)
          While initializing a line is drawn to the cursor.
 void setSelected(Snake s)
          There is a selected snake, it is red and clickable.
 void synchronizeSnakes(MultipleSnakesStore ss)
          Removes all old snakes and adds any snakes that need to be displayed in this frame.
 void updateCursor(double x, double y, double z)
          Recieves a coordinate in image space and coverts it to the scene space,moves the cursor to that location.
 void updateDisplay(int cur)
          Updates the XY plane displayed
 void updatePick(com.sun.j3d.utils.picking.PickResult[] results, java.awt.event.MouseEvent evt, boolean clicked)
          Use the PickResults to find the point on the plane that the pick result occured over.
 void updateSnakePositions()
          The polylines are backed by a snake but their geometry is based on a different object so they need to be updated after the snake deforms.
 void updateYZPosition()
          Updates the position of the yz plane according to the current index.
 void updateZXPosition()
          Updates the position of the zx plane according to the current index.
 void wipeDown()
           
 void wipeUp()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InteractiveView

public InteractiveView(java.awt.GraphicsConfiguration gc)
Interactive view displays 3 perpendicular planes used for interacting with the 3d scene.

Parameters:
gc - used for getting the best graphics configuration.
Method Detail

getComponent

public java.awt.Component getComponent()
Gets the component that this is being drawn on.]

Returns:
the datacanvas as an awt component for being added to a border layout.

addSnake

public void addSnake(Snake s)
Add a Snake by creating a poly linea polyline that is backed by the added snake.

Parameters:
s - snake that will be drawn on 3d section view

updateSnakePositions

public void updateSnakePositions()
The polylines are backed by a snake but their geometry is based on a different object so they need to be updated after the snake deforms.


deleteSnake

public void deleteSnake(Snake s)
deletes the chosen snake by removing it from the scene and from the list of stored snakes

Parameters:
s - the snake that will be removed

updateCursor

public void updateCursor(double x,
                         double y,
                         double z)
Recieves a coordinate in image space and coverts it to the scene space,moves the cursor to that location.

Parameters:
x - image or 'real' space coordinate.
y - image or 'real' space coordinate.
z - image or 'real' space coordinate.

followCursor

public void followCursor(double x,
                         double y,
                         double z)
During initialization this follows the cursor with a polyline

Parameters:
x - coordinate
y - coordinate
z - coordinate

updatePick

public void updatePick(com.sun.j3d.utils.picking.PickResult[] results,
                       java.awt.event.MouseEvent evt,
                       boolean clicked)
Use the PickResults to find the point on the plane that the pick result occured over. Returns the first plane encountered in array so the results should be sorted by closest to pick source.

Parameters:
results - sorted list of PickResults
evt - the moust event that generated the pick
clicked - if it was a click

reset

public void reset(SnakeBufferedImages sbi)
Resets the current display, clears all snakes, planes and bounding boxes resets the scale, creates new planes and bounding boxes then applies the threed texture

Parameters:
sbi - contains the dimensions and the volume texture

createTexCoordinteGeneration

public javax.media.j3d.TexCoordGeneration createTexCoordinteGeneration(float x,
                                                                       float y,
                                                                       float z)
Uses the vectors x,y,z to scale the volume texture to the proper coordinates.

Parameters:
x - coordinate scaled to principle axis
y - coordinate scaled to principle axis
z - coordinate scaled to principle axis
Returns:
TextureCoordinate generation so that the slices can slice a volume texture.

updateDisplay

public void updateDisplay(int cur)
Updates the XY plane displayed

Parameters:
cur - checks if this index is in range, cur is in reference to z-slices so its index begins at 1.

moveUp

public void moveUp()

moveDown

public void moveDown()

updateYZPosition

public void updateYZPosition()
Updates the position of the yz plane according to the current index.


wipeDown

public void wipeDown()

wipeUp

public void wipeUp()

updateZXPosition

public void updateZXPosition()
Updates the position of the zx plane according to the current index.


refreshImages

public void refreshImages()
Refreshes the texture being displayed w/out changing the geometry


synchronizeSnakes

public void synchronizeSnakes(MultipleSnakesStore ss)
Removes all old snakes and adds any snakes that need to be displayed in this frame.

Parameters:
ss - contains snakes.

addSnakeListener

public void addSnakeListener(SnakeModel sm)
This is how the 3D clicks are transfered to the snake model.

Parameters:
sm - runs the show.

drawRawSnake

public void drawRawSnake(java.util.ArrayList<double[]> raw)
Snakes are stored as an array list of double[] when they are being initialized.

Parameters:
raw - coordinates representing the snake being initialized.

addMarker

public void addMarker(java.lang.String name)
Add a marker with a name

Parameters:
name - of the marker for further access

placeMarker

public void placeMarker(java.lang.String name,
                        double[] pt)
move marker to the position pt

Parameters:
name - name of the marker being moved
pt - position (in image coordinates) of where to put the marker.

clearMarkers

public void clearMarkers()
Remove all markers


setSelected

public void setSelected(Snake s)
There is a selected snake, it is red and clickable. This function takes changing the color, and making it clickable.

Parameters:
s -

setInitializing

public void setInitializing(boolean v)
While initializing a line is drawn to the cursor.

Parameters:
v - whether or not the snake is actually initializing.