jpview.gui
Class PTMViewerApplet

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Panel
              extended by java.applet.Applet
                  extended by javax.swing.JApplet
                      extended by jpview.gui.PTMViewerApplet
All Implemented Interfaces:
java.awt.event.MouseMotionListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.lang.Runnable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.RootPaneContainer, PTMWindow

public class PTMViewerApplet
extends javax.swing.JApplet
implements java.awt.event.MouseMotionListener, PTMWindow, java.lang.Runnable

A simple Viewer applet

Author:
clyon
See Also:
Serialized Form

Field Summary
 
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
PTMViewerApplet()
           
 
Method Summary
 void fireTransform()
          exercises the current tranform operator on the PTM data
 void forceUpdate()
          force an update for the current tranform - decache and optimizations off
 int getExp()
          Returns the current value of the exponent in the specular term of the Phong lighting equation (delagate from PTM)
 float getKDiff()
          Returns the current value of kDiff in the diffuse term of the Phong lighting equation (delagate from PTM)
 float getKSpec()
          Returns the current value of kSpec in the specular term of the Phong lighting equation (delagate from PTM)
 float getLuminance()
          Get the current value for the global ambient term
 PTM getPTM()
          Returns the PTM used by the Applet
 int getPTMHeight()
          Returns the height of the current PTM
 int getPTMWidth()
          Returns the width of the current PTM
 void init()
          Initalize all the resources for this object
 void mouseDragged(java.awt.event.MouseEvent e)
          When the mouse is dragged, the light source moves with it
 void mouseMoved(java.awt.event.MouseEvent e)
          displays the current position of the mouse in the status bar
 void refreshMap()
          Reload the environment map
 void run()
          This method is called by the thread that was created in the start method.
 void setBrowser(java.awt.Container c)
          not implemented
 void setControls(PTMControls c)
          not implemented
 void setEnvironmentMap(EnvironmentMap e)
          not implemented
 void setExp(int i)
          Set the value of the exponent in the specular term of the Phong lighting equation for the specular transform operator
 void setKDiff(float f)
          set the value for kDiff in the Phong lighting equation for the PTM
 void setKSpec(float f)
          set the value for the kSpec term in the Phong lighting equation for the PTM
 void setLuminance(float f)
          Set the current value for the global ambient term
 void setMapBlurType(int i)
          set the blur type for the map ( BLUR_TYPE_SIMPLE, BLUR_TYPE_GAUSSIAN, BLUR_TYPE_NONE )
 void setMapGuassianBlurSigma(float f)
          set the value of sigma for the gaussian blur procedure
 void setMapKernelSize(int i)
          set the kernel size for the blur
 void setMapSampleSize(int i)
          set the sample size for the environment map
 void setPixelTransformOp(PixelTransformOp pto)
          not implemented
 void start()
          start the animation
 void stop()
          suspend the animation
 
Methods inherited from class javax.swing.JApplet
getAccessibleContext, getContentPane, getGlassPane, getJMenuBar, getLayeredPane, getRootPane, remove, setContentPane, setGlassPane, setJMenuBar, setLayeredPane, setLayout, update
 
Methods inherited from class java.applet.Applet
destroy, getAppletContext, getAppletInfo, getAudioClip, getAudioClip, getCodeBase, getDocumentBase, getImage, getImage, getLocale, getParameter, getParameterInfo, isActive, newAudioClip, play, play, resize, resize, setStub, showStatus
 
Methods inherited from class java.awt.Panel
addNotify
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, remove, removeAll, removeContainerListener, removeNotify, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusBackward, transferFocusDownCycle, validate
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, dispatchEvent, enable, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocusInWindow, reshape, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface jpview.gui.PTMWindow
getHeight, getLayeredPane, getWidth
 

Constructor Detail

PTMViewerApplet

public PTMViewerApplet()
Method Detail

init

public void init()
Initalize all the resources for this object

Overrides:
init in class java.applet.Applet

mouseDragged

public void mouseDragged(java.awt.event.MouseEvent e)
When the mouse is dragged, the light source moves with it

Specified by:
mouseDragged in interface java.awt.event.MouseMotionListener
Parameters:
e - the mouse event

mouseMoved

public void mouseMoved(java.awt.event.MouseEvent e)
displays the current position of the mouse in the status bar

Specified by:
mouseMoved in interface java.awt.event.MouseMotionListener
Parameters:
e - the mouse event

getPTM

public PTM getPTM()
Returns the PTM used by the Applet

Specified by:
getPTM in interface PTMWindow
Returns:
the PTM

fireTransform

public void fireTransform()
exercises the current tranform operator on the PTM data

Specified by:
fireTransform in interface PTMWindow

getExp

public int getExp()
Returns the current value of the exponent in the specular term of the Phong lighting equation (delagate from PTM)

Specified by:
getExp in interface PTMWindow
Returns:
the current exp value

getKDiff

public float getKDiff()
Returns the current value of kDiff in the diffuse term of the Phong lighting equation (delagate from PTM)

Specified by:
getKDiff in interface PTMWindow
Returns:
the current kDiff value

getKSpec

public float getKSpec()
Returns the current value of kSpec in the specular term of the Phong lighting equation (delagate from PTM)

Specified by:
getKSpec in interface PTMWindow
Returns:
the current value of kSpec

getPTMHeight

public int getPTMHeight()
Returns the height of the current PTM

Specified by:
getPTMHeight in interface PTMWindow
Returns:
the current PTM height

getPTMWidth

public int getPTMWidth()
Returns the width of the current PTM

Specified by:
getPTMWidth in interface PTMWindow
Returns:
the width of the current PTM

setKSpec

public void setKSpec(float f)
set the value for the kSpec term in the Phong lighting equation for the PTM

Specified by:
setKSpec in interface PTMWindow
Parameters:
f - the new value for kSpec

setKDiff

public void setKDiff(float f)
set the value for kDiff in the Phong lighting equation for the PTM

Specified by:
setKDiff in interface PTMWindow
Parameters:
f - the new value for kDiff

setExp

public void setExp(int i)
Set the value of the exponent in the specular term of the Phong lighting equation for the specular transform operator

Specified by:
setExp in interface PTMWindow
Parameters:
i - the new value for the exponent

getLuminance

public float getLuminance()
Get the current value for the global ambient term

Specified by:
getLuminance in interface PTMWindow
Returns:
the current value

setLuminance

public void setLuminance(float f)
Set the current value for the global ambient term

Specified by:
setLuminance in interface PTMWindow
Parameters:
f - the new value

refreshMap

public void refreshMap()
Reload the environment map

Specified by:
refreshMap in interface PTMWindow

setMapSampleSize

public void setMapSampleSize(int i)
set the sample size for the environment map

Specified by:
setMapSampleSize in interface PTMWindow
Parameters:
i - the sample size

setMapBlurType

public void setMapBlurType(int i)
set the blur type for the map ( BLUR_TYPE_SIMPLE, BLUR_TYPE_GAUSSIAN, BLUR_TYPE_NONE )

Specified by:
setMapBlurType in interface PTMWindow
Parameters:
i - the blur type

setMapGuassianBlurSigma

public void setMapGuassianBlurSigma(float f)
set the value of sigma for the gaussian blur procedure

Specified by:
setMapGuassianBlurSigma in interface PTMWindow
Parameters:
f - sigma

setMapKernelSize

public void setMapKernelSize(int i)
set the kernel size for the blur

Specified by:
setMapKernelSize in interface PTMWindow
Parameters:
i - the kernel size

start

public void start()
start the animation

Overrides:
start in class java.applet.Applet

stop

public void stop()
suspend the animation

Overrides:
stop in class java.applet.Applet

run

public void run()
This method is called by the thread that was created in the start method. It does the main animation.

Specified by:
run in interface java.lang.Runnable

forceUpdate

public void forceUpdate()
force an update for the current tranform - decache and optimizations off

Specified by:
forceUpdate in interface PTMWindow

setBrowser

public void setBrowser(java.awt.Container c)
not implemented

Specified by:
setBrowser in interface PTMWindow
Parameters:
c - the container

setEnvironmentMap

public void setEnvironmentMap(EnvironmentMap e)
not implemented

Specified by:
setEnvironmentMap in interface PTMWindow
Parameters:
e - the environment map

setPixelTransformOp

public void setPixelTransformOp(PixelTransformOp pto)
not implemented

Specified by:
setPixelTransformOp in interface PTMWindow
Parameters:
pto - the pixel transform

setControls

public void setControls(PTMControls c)
not implemented

Specified by:
setControls in interface PTMWindow
Parameters:
c - the controls