GridView
Class Viewer

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Window
              extended by java.awt.Frame
                  extended by javax.swing.JFrame
                      extended by GridView.Viewer
All Implemented Interfaces:
ViewerInterface, java.awt.event.ActionListener, java.awt.event.ComponentListener, java.awt.event.ItemListener, java.awt.event.WindowListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.event.CaretListener, javax.swing.event.ChangeListener, javax.swing.RootPaneContainer, javax.swing.WindowConstants

public class Viewer
extends javax.swing.JFrame
implements java.awt.event.ActionListener, javax.swing.event.ChangeListener, java.awt.event.WindowListener, java.awt.event.ItemListener, javax.swing.event.CaretListener, java.awt.event.ComponentListener, ViewerInterface

Viewer class that defines the main GUI window.

Viewer class is a part of the model - view - controller architechture that this software is based on. This class defines the main GUI window.

Since:
1.0
See Also:
Serialized Form

Nested Class Summary
static class Viewer.CurrMode
          Mode representing the current operation mode.
static class Viewer.DrawMode
          Mode representing the current drawing canvas type.
 
Nested classes/interfaces inherited from class javax.swing.JFrame
javax.swing.JFrame.AccessibleJFrame
 
Nested classes/interfaces inherited from class java.awt.Frame
java.awt.Frame.AccessibleAWTFrame
 
Nested classes/interfaces inherited from class java.awt.Window
java.awt.Window.AccessibleAWTWindow
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
private  boolean bSpecularShading
           
private  double dCameraX
          Postion of camera.
private  double dCameraY
           
private  double dCameraZ
           
private  double dXCenterOfProjection
          Distance behind camera along X axis for center of projection.
private  double dYCenterOfProjection
          Distance behind camera along Y axis for center of projection.
private  double dZCenterOfProjection
          Center of projection behind the camera position.
private  int LINIT
           
private  int LMAX
           
private  int LMIN
          Constants used in initializing JSlider values.
private  javax.swing.ButtonGroup m2DOpenNewPlotGroupBox
           
private  java.util.ArrayList<javax.swing.JRadioButtonMenuItem> m2DPlotList
           
private  TwoDPlotManager m2DPlotManager
           
private  Plot2DPreferenceDialog m2DPlotPrefDlg
           
private  javax.swing.JMenuItem m2DPlotPrefMItem
           
private  javax.swing.ButtonGroup m2DPlotsGroupBox
           
private  javax.swing.ButtonGroup m2DPlotTypeGroupBox
           
private  ThreeDPlotter<java.lang.Float> m3DPlotCanvas
           
private  javax.swing.JMenuItem mAboutMItem
           
private  java.lang.String mAppTitle
          Window title.
private  javax.swing.JRadioButtonMenuItem mAxonometricMItem
           
private  javax.swing.JMenuItem mBackgroundColorMItem
           
private  javax.swing.JPanel mBottomPanel
           
private  DrawingCanvas mCanvas
           
private  MyColorButton mColorButton
           
private  Controller mController
          This is the controller instance.
private  Viewer.CurrMode mCurrMode
          Current mode.
private  javax.swing.JComboBox mCurrObjComboBox
           
private  javax.swing.JButton mCutObjectButton
           
private  javax.swing.JMenuItem mCutObjectMItem
           
private  javax.swing.JScrollPane mDrawingAreaScrollPane
          Scroll pane containing drawing area.
private  Viewer.DrawMode mDrawMode
          Current drawing mode.
private  javax.swing.JButton mEditTextFileButton
           
private  javax.swing.JMenuItem mEditTextFileMenu
           
private  javax.swing.JComboBox mEntityColorComboBox
           
private  javax.swing.JButton mExitButton
           
private  javax.swing.JMenuItem mExitMItem
           
private  javax.swing.JMenu mFileMenu
           
private  javax.swing.JMenuItem mFileOpenMenu
           
private  javax.swing.JRadioButtonMenuItem mFinancialMItem
           
private  javax.swing.JMenuItem mFourierMItem
           
private  javax.swing.JRadioButtonMenuItem mGeomViewMItem
           
private  javax.swing.JRadioButtonMenuItem mGtsMItem
           
private  javax.swing.JButton mHandButton
           
private  javax.swing.JButton mHelpButton
           
private  javax.swing.JMenu mHelpMenu
           
private  javax.swing.JMenuItem mHelpTopicsMItem
           
private  javax.swing.JRadioButtonMenuItem mHistogramMItem
           
private  javax.swing.JButton mHomeButton
           
private  float mLightIntensity
           
private  javax.swing.JSlider mLightIntensitySlider
           
private  javax.swing.JRadioButtonMenuItem mLinePlotMItem
           
private  javax.swing.JPanel mMainPane
          Main panel containing the drawing area, output panel, slider etc.
private  javax.swing.JMenuBar mMenuBar
          Main menubar.
private  javax.swing.JTextField mMouseCoorTextField
           
private  MovingAverage<java.lang.Float> mMovingAvgGenerator
           
private  javax.swing.JMenuItem mMovingAvgMItem
           
private  javax.swing.JRadioButtonMenuItem mNonMetallicReflectionMItem
           
private  javax.swing.JRadioButtonMenuItem mOnePtPerspectiveViewMItem
           
private  javax.swing.JButton mOpenButton
           
private  javax.swing.JRadioButtonMenuItem mOpenInCurrPlotMItem
           
private  javax.swing.JRadioButtonMenuItem mOpenInNewPlotMItem
           
private  OutputPanel mOutPanel
           
private  float mPanDistance
           
private  javax.swing.JTextField mPanDistEdit
           
private  javax.swing.JLabel mPanDistLabel
           
private  javax.swing.JButton mPandownButton
           
private  javax.swing.JMenuItem mPanDownMItem
           
private  javax.swing.JButton mPanleftButton
           
private  javax.swing.JMenuItem mPanLeftMItem
           
private  javax.swing.JButton mPanrightButton
           
private  javax.swing.JMenuItem mPanRightMItem
           
private  javax.swing.JButton mPanupButton
           
private  javax.swing.JMenuItem mPanUpMItem
           
private  javax.swing.JRadioButtonMenuItem mPhongReflectionMItem
           
private  javax.swing.JComboBox mPlotVarComboBox
           
private  javax.swing.JLabel mPlotVarLabel
           
private  javax.swing.JRadioButtonMenuItem mPmeshMItem
           
private  javax.swing.JMenu mPreferencesMenu
           
private  javax.swing.JProgressBar mProgressBar
           
private  javax.swing.ButtonGroup mProjectionGroupBox
           
private  javax.swing.JButton mQueryPointButton
           
private  javax.swing.ButtonGroup mReflectionGroupBox
           
private  javax.swing.JMenuItem mRemoveAllObjMItem
           
private  javax.swing.JButton mRemoveObjectButton
           
private  javax.swing.JMenuItem mRemoveObjMItem
           
private  javax.swing.JButton mRulerButton
           
private  MyColorButton mRulerColorButton
           
private  javax.swing.JLabel mRulerColorLabel
           
private  javax.swing.JMenuItem mRulerMItem
           
private  javax.swing.JMenuItem mRulerPrefMItem
           
private  javax.swing.JMenu mSaveAsMenu
           
private  javax.swing.ButtonGroup mSaveAsRadioGroup
           
private  javax.swing.JButton mSaveButton
           
private  javax.swing.JButton mScientificModeButton
           
private  javax.swing.JButton mScreenshotButton
           
private  javax.swing.JMenuItem mScreenShotMenu
           
private  javax.swing.JLabel mSetCurObjLabel
           
private  javax.swing.JPanel mSliderEtcPanel
           
private  javax.swing.JLabel mSliderLabel
           
private  javax.swing.JButton mSurfaceButton
           
private  javax.swing.JRadioButtonMenuItem mSurfaceOnlyMItem
           
private  javax.swing.JRadioButtonMenuItem mSurfaceViewMItem
           
private  javax.swing.JButton mThreeDPlotButton
           
private  javax.swing.JRadioButtonMenuItem mThreePtPerspectiveViewMItem
           
private  javax.swing.JButton mToggleGeomButton
           
private  javax.swing.JToolBar mToolBar
           
private  javax.swing.JMenu mToolsMenu
           
private  javax.swing.JRadioButtonMenuItem mTrajectoryMovieMItem
           
private  javax.swing.JRadioButtonMenuItem mTwoPtPerspectiveViewMItem
           
private  javax.swing.JCheckBoxMenuItem mUniversalLightingMItem
           
private  javax.swing.ButtonGroup mViewGroupBox
           
private  javax.swing.JMenu mViewMenu
           
private  javax.swing.JRadioButtonMenuItem mVrml2MItem
           
private  javax.swing.JButton mWhatsThisButton
           
private  javax.swing.JMenuItem mWhatsThisMItem
           
private  javax.swing.JButton mWireframeButton
           
private  javax.swing.JRadioButtonMenuItem mWireframeViewMItem
           
private  javax.swing.JButton mZoominButton
           
private  javax.swing.JMenuItem mZoomInMItem
           
private  javax.swing.JButton mZoomoutButton
           
private  javax.swing.JMenuItem mZoomOutMItem
           
 
Fields inherited from class javax.swing.JFrame
accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
 
Fields inherited from class java.awt.Frame
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface javax.swing.WindowConstants
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
Viewer()
          Class constructor that creates and displays the Viewer.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent ae)
          Method that gets called for objects implementing ActionListener.
private  javax.swing.JRadioButtonMenuItem AddPlotMenuItem()
           
 void AddToColorComboBox(java.lang.String smallFileName)
          Add object surface and edge color options to the color combo box.
 void AddToCurrObjComboBox(java.lang.String smallFileName)
          Add object to the object list from where it can be specified as the current object.
private  void ButtonColorChanged()
          Color has been changed in color choose button.
 void caretUpdate(javax.swing.event.CaretEvent e)
          Caret event listener code.
 void ChangeDrawingPane(java.awt.Container drawContainer, Viewer.DrawMode newDrawMode)
           
 void componentHidden(java.awt.event.ComponentEvent e)
           
 void componentMoved(java.awt.event.ComponentEvent e)
           
 void componentResized(java.awt.event.ComponentEvent e)
           
 void componentShown(java.awt.event.ComponentEvent e)
           
private  void CreateDrawingCanvas()
          Create the drawing canvas (used for drawing stuff).
static java.awt.Image createImage(java.lang.String name)
          Create an image from image file name.
static javax.swing.ImageIcon createImageIcon(java.lang.String name)
          Returns an ImageIcon, or null if the file name was invalid.
private  void CreateLightIntensitySliderAndLabel()
          Create the light intensity adjusting slider and label.
private  void CreateMenuBar()
          Create the menu bar, instance stored in mMenuBar.
private  javax.swing.JMenu CreateNewJMenu(java.lang.String title, int mnemonic, java.lang.String description)
          Creates and reaturns a new JMenu with specified title, description, and mnemonic (accelerator).
private  void CreateSliderPanel()
          Creates the panel that holds slider (light intensity), label for intensity slider, color setting combo box and control, and boxes for setting near plane, far plane, bottom plane, up plane, right plane and left plane (defining the viewing volume).
private  void CreateToolBar()
          Create a tool bar.
private  javax.swing.JButton CreateToolbarButton(java.lang.String imageName, java.lang.String actionCommand, java.lang.String toolTipText, java.lang.String altText)
          Create a tool bar button.
 void DeleteCurrObj()
          Delete the current object (current selection from current object combo box).
 boolean DeleteFromColorComboBox(java.lang.String smallFileName)
          Delete entries corresponding to an objet from color combo box.
private  void DrawAxonometricView()
          Draws axonometric view (foreshortening along axes depends on viewing direction.
private  void DrawOnePointPerspectiveView()
          Draws one point perspective view of the current scene.
private  void DrawThreePointPerspectiveView()
          Draws three point perspective view of the current scene.
private  void DrawTwoPointPerspectiveView()
          Draws two point perspective view of the current scene.
private  void FourierTransform(TwoDPlotter<java.lang.Float> plot)
           
private  void GenerateMovingAvg(TwoDPlotter<java.lang.Float> plot)
           
 void GetCameraCenterProj(float[] centerProj)
           
 void GetCameraPos(float[] cameraPos)
           
 Viewer.DrawMode GetCurrentDrawMode()
           
 Viewer.CurrMode GetCurrentViewerMode()
           
 OutputPanel GetOutputPanel()
          Gets the output panel used for output messages shown on viewer.
private  void GetPhongExponent()
           
 boolean IsSpecularShading()
           
 void itemStateChanged(java.awt.event.ItemEvent e)
          Respond to the color combo box item changed events.
static void launchGUI()
          Launches the GUI.
 float LightIntensity()
           
private  void OpenFile()
          Bring up a dialog to open a file.
private  void RemovePlotMenuItem(int plotIndex)
           
 void ReportMouseCoor(int x, int y)
          Print mouse coordinates on JTextField (status bar).
private  void RulerColorChanged()
          Bring up a dialog to choose line color, proceed accordingly.
private  void SaveFile()
           
private  void SerializeAndExit()
           
static void showWindow(java.lang.String[] args)
          Shows the window after creating the GUI.
 int SpecularExponent()
          Get specular exponent, currently hardcoded to 5.
 void stateChanged(javax.swing.event.ChangeEvent e)
          Listen to the slider stateChanged event.
private  void UpdateDrawMode()
          Update the button state depending upon the current value of drawing mode (mDrawMode).
private  void UpdateMode()
          Update the button state depending upon the current value of mode (mCurrMode).
 void windowActivated(java.awt.event.WindowEvent e)
           
 void windowClosed(java.awt.event.WindowEvent e)
           
 void windowClosing(java.awt.event.WindowEvent e)
           
 void windowDeactivated(java.awt.event.WindowEvent e)
           
 void windowDeiconified(java.awt.event.WindowEvent e)
           
 void windowIconified(java.awt.event.WindowEvent e)
           
 void windowOpened(java.awt.event.WindowEvent e)
           
 
Methods inherited from class javax.swing.JFrame
addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
 
Methods inherited from class java.awt.Frame
addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setResizable, setState, setTitle, setUndecorated
 
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOwnedWindows, getOwner, getOwnerlessWindows, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isShowing, pack, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setVisible, show, toBack, toFront
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, 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, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, setBackground, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.awt.MenuContainer
getFont, postEvent
 

Field Detail

mController

private Controller mController
This is the controller instance.


mMainPane

private javax.swing.JPanel mMainPane
Main panel containing the drawing area, output panel, slider etc.


mAppTitle

private java.lang.String mAppTitle
Window title. (main app window)


mDrawingAreaScrollPane

private javax.swing.JScrollPane mDrawingAreaScrollPane
Scroll pane containing drawing area.


mMenuBar

private javax.swing.JMenuBar mMenuBar
Main menubar.


LMIN

private final int LMIN
Constants used in initializing JSlider values.

See Also:
mLightIntensitySlider, Constant Field Values

LMAX

private final int LMAX
See Also:
Constant Field Values

LINIT

private final int LINIT
See Also:
Constant Field Values

mLightIntensity

private float mLightIntensity

mFileMenu

private javax.swing.JMenu mFileMenu

mViewMenu

private javax.swing.JMenu mViewMenu

mToolsMenu

private javax.swing.JMenu mToolsMenu

mPreferencesMenu

private javax.swing.JMenu mPreferencesMenu

mHelpMenu

private javax.swing.JMenu mHelpMenu

mFileOpenMenu

private javax.swing.JMenuItem mFileOpenMenu

mEditTextFileMenu

private javax.swing.JMenuItem mEditTextFileMenu

mScreenShotMenu

private javax.swing.JMenuItem mScreenShotMenu

mSaveAsMenu

private javax.swing.JMenu mSaveAsMenu

mSaveAsRadioGroup

private javax.swing.ButtonGroup mSaveAsRadioGroup

mPmeshMItem

private javax.swing.JRadioButtonMenuItem mPmeshMItem

mGtsMItem

private javax.swing.JRadioButtonMenuItem mGtsMItem

mGeomViewMItem

private javax.swing.JRadioButtonMenuItem mGeomViewMItem

mVrml2MItem

private javax.swing.JRadioButtonMenuItem mVrml2MItem

mRemoveObjMItem

private javax.swing.JMenuItem mRemoveObjMItem

mRemoveAllObjMItem

private javax.swing.JMenuItem mRemoveAllObjMItem

mExitMItem

private javax.swing.JMenuItem mExitMItem

mViewGroupBox

private javax.swing.ButtonGroup mViewGroupBox

mWireframeViewMItem

private javax.swing.JRadioButtonMenuItem mWireframeViewMItem

mSurfaceViewMItem

private javax.swing.JRadioButtonMenuItem mSurfaceViewMItem

mSurfaceOnlyMItem

private javax.swing.JRadioButtonMenuItem mSurfaceOnlyMItem

mTrajectoryMovieMItem

private javax.swing.JRadioButtonMenuItem mTrajectoryMovieMItem

mUniversalLightingMItem

private javax.swing.JCheckBoxMenuItem mUniversalLightingMItem

mReflectionGroupBox

private javax.swing.ButtonGroup mReflectionGroupBox

mPhongReflectionMItem

private javax.swing.JRadioButtonMenuItem mPhongReflectionMItem

mNonMetallicReflectionMItem

private javax.swing.JRadioButtonMenuItem mNonMetallicReflectionMItem

mProjectionGroupBox

private javax.swing.ButtonGroup mProjectionGroupBox

mAxonometricMItem

private javax.swing.JRadioButtonMenuItem mAxonometricMItem

mOnePtPerspectiveViewMItem

private javax.swing.JRadioButtonMenuItem mOnePtPerspectiveViewMItem

mTwoPtPerspectiveViewMItem

private javax.swing.JRadioButtonMenuItem mTwoPtPerspectiveViewMItem

mThreePtPerspectiveViewMItem

private javax.swing.JRadioButtonMenuItem mThreePtPerspectiveViewMItem

mCutObjectMItem

private javax.swing.JMenuItem mCutObjectMItem

mZoomOutMItem

private javax.swing.JMenuItem mZoomOutMItem

mZoomInMItem

private javax.swing.JMenuItem mZoomInMItem

mPanLeftMItem

private javax.swing.JMenuItem mPanLeftMItem

mPanRightMItem

private javax.swing.JMenuItem mPanRightMItem

mPanUpMItem

private javax.swing.JMenuItem mPanUpMItem

mPanDownMItem

private javax.swing.JMenuItem mPanDownMItem

mRulerMItem

private javax.swing.JMenuItem mRulerMItem

mFourierMItem

private javax.swing.JMenuItem mFourierMItem

mMovingAvgMItem

private javax.swing.JMenuItem mMovingAvgMItem

mBackgroundColorMItem

private javax.swing.JMenuItem mBackgroundColorMItem

mRulerPrefMItem

private javax.swing.JMenuItem mRulerPrefMItem

m2DPlotPrefMItem

private javax.swing.JMenuItem m2DPlotPrefMItem

mAboutMItem

private javax.swing.JMenuItem mAboutMItem

mHelpTopicsMItem

private javax.swing.JMenuItem mHelpTopicsMItem

mWhatsThisMItem

private javax.swing.JMenuItem mWhatsThisMItem

mToolBar

private javax.swing.JToolBar mToolBar

mOpenButton

private javax.swing.JButton mOpenButton

mSaveButton

private javax.swing.JButton mSaveButton

mEditTextFileButton

private javax.swing.JButton mEditTextFileButton

mScreenshotButton

private javax.swing.JButton mScreenshotButton

mHomeButton

private javax.swing.JButton mHomeButton

mRemoveObjectButton

private javax.swing.JButton mRemoveObjectButton

mCutObjectButton

private javax.swing.JButton mCutObjectButton

mZoominButton

private javax.swing.JButton mZoominButton

mZoomoutButton

private javax.swing.JButton mZoomoutButton

mRulerButton

private javax.swing.JButton mRulerButton

mWireframeButton

private javax.swing.JButton mWireframeButton

mSurfaceButton

private javax.swing.JButton mSurfaceButton

mToggleGeomButton

private javax.swing.JButton mToggleGeomButton

mScientificModeButton

private javax.swing.JButton mScientificModeButton

mThreeDPlotButton

private javax.swing.JButton mThreeDPlotButton

mHandButton

private javax.swing.JButton mHandButton

mQueryPointButton

private javax.swing.JButton mQueryPointButton

mPanupButton

private javax.swing.JButton mPanupButton

mPandownButton

private javax.swing.JButton mPandownButton

mPanleftButton

private javax.swing.JButton mPanleftButton

mPanrightButton

private javax.swing.JButton mPanrightButton

mWhatsThisButton

private javax.swing.JButton mWhatsThisButton

mHelpButton

private javax.swing.JButton mHelpButton

mExitButton

private javax.swing.JButton mExitButton

bSpecularShading

private boolean bSpecularShading

dZCenterOfProjection

private double dZCenterOfProjection
Center of projection behind the camera position. Expresse relative to camera position. Eg, value of 10 means center of projection is 10 units behind the current camera position as given by mCameraX, mCameraY, mCameraZ.
Useful in perspective projectons.


dYCenterOfProjection

private double dYCenterOfProjection
Distance behind camera along Y axis for center of projection. Used in two point perspective projections


dXCenterOfProjection

private double dXCenterOfProjection
Distance behind camera along X axis for center of projection. Used in two point perspective projections


dCameraX

private double dCameraX
Postion of camera. Useful in perspective projectons.


dCameraY

private double dCameraY

dCameraZ

private double dCameraZ

mCurrMode

private Viewer.CurrMode mCurrMode
Current mode.

See Also:
Viewer.CurrMode

mDrawMode

private Viewer.DrawMode mDrawMode
Current drawing mode.

See Also:
Viewer.DrawMode

mLightIntensitySlider

private javax.swing.JSlider mLightIntensitySlider

mSliderLabel

private javax.swing.JLabel mSliderLabel

mCanvas

private DrawingCanvas mCanvas

m2DPlotManager

private TwoDPlotManager m2DPlotManager

m3DPlotCanvas

private ThreeDPlotter<java.lang.Float> m3DPlotCanvas

mMovingAvgGenerator

private MovingAverage<java.lang.Float> mMovingAvgGenerator

mOutPanel

private OutputPanel mOutPanel

m2DPlotPrefDlg

private Plot2DPreferenceDialog m2DPlotPrefDlg

mBottomPanel

private javax.swing.JPanel mBottomPanel

mMouseCoorTextField

private javax.swing.JTextField mMouseCoorTextField

mProgressBar

private javax.swing.JProgressBar mProgressBar

mSliderEtcPanel

private javax.swing.JPanel mSliderEtcPanel

mSetCurObjLabel

private javax.swing.JLabel mSetCurObjLabel

mEntityColorComboBox

private javax.swing.JComboBox mEntityColorComboBox

mColorButton

private MyColorButton mColorButton

mCurrObjComboBox

private javax.swing.JComboBox mCurrObjComboBox

mPlotVarLabel

private javax.swing.JLabel mPlotVarLabel

mPlotVarComboBox

private javax.swing.JComboBox mPlotVarComboBox

mPanDistLabel

private javax.swing.JLabel mPanDistLabel

mPanDistEdit

private javax.swing.JTextField mPanDistEdit

mRulerColorLabel

private javax.swing.JLabel mRulerColorLabel

mRulerColorButton

private MyColorButton mRulerColorButton

mPanDistance

private float mPanDistance

m2DPlotTypeGroupBox

private javax.swing.ButtonGroup m2DPlotTypeGroupBox

mLinePlotMItem

private javax.swing.JRadioButtonMenuItem mLinePlotMItem

mHistogramMItem

private javax.swing.JRadioButtonMenuItem mHistogramMItem

mFinancialMItem

private javax.swing.JRadioButtonMenuItem mFinancialMItem

m2DOpenNewPlotGroupBox

private javax.swing.ButtonGroup m2DOpenNewPlotGroupBox

mOpenInNewPlotMItem

private javax.swing.JRadioButtonMenuItem mOpenInNewPlotMItem

mOpenInCurrPlotMItem

private javax.swing.JRadioButtonMenuItem mOpenInCurrPlotMItem

m2DPlotsGroupBox

private javax.swing.ButtonGroup m2DPlotsGroupBox

m2DPlotList

private java.util.ArrayList<javax.swing.JRadioButtonMenuItem> m2DPlotList
Constructor Detail

Viewer

public Viewer()
Class constructor that creates and displays the Viewer. Creates the drawing area, menu, output panel etc

See Also:
OutputPanel, DrawingCanvas
Method Detail

GetOutputPanel

public OutputPanel GetOutputPanel()
Gets the output panel used for output messages shown on viewer.

Returns:
Instance of OutputPanel.
See Also:
OutputPanel

ChangeDrawingPane

public void ChangeDrawingPane(java.awt.Container drawContainer,
                              Viewer.DrawMode newDrawMode)

UpdateMode

private void UpdateMode()
Update the button state depending upon the current value of mode (mCurrMode).

See Also:
mCurrMode

UpdateDrawMode

private void UpdateDrawMode()
Update the button state depending upon the current value of drawing mode (mDrawMode).

See Also:
mDrawMode, Viewer.DrawMode

GetCurrentViewerMode

public Viewer.CurrMode GetCurrentViewerMode()

GetCurrentDrawMode

public Viewer.DrawMode GetCurrentDrawMode()

CreateSliderPanel

private void CreateSliderPanel()
Creates the panel that holds slider (light intensity), label for intensity slider, color setting combo box and control, and boxes for setting near plane, far plane, bottom plane, up plane, right plane and left plane (defining the viewing volume). Leave the viewing volume boxes blank if no volume based culling is desired.


AddToColorComboBox

public void AddToColorComboBox(java.lang.String smallFileName)
Add object surface and edge color options to the color combo box.

Specified by:
AddToColorComboBox in interface ViewerInterface
Parameters:
smallFileName - The last part of file name. Eg /path/file.gts becomes file.gts
See Also:
mEntityColorComboBox

DeleteFromColorComboBox

public boolean DeleteFromColorComboBox(java.lang.String smallFileName)
Delete entries corresponding to an objet from color combo box.

Parameters:
smallFileName - The last part of file name. Eg /path/file.gts becomes file.gts. If the file name is empty, deletes the last loaded object from combo list.
Returns:
true if items found and deleted from combo box, false otherwise
See Also:
mEntityColorComboBox

AddToCurrObjComboBox

public void AddToCurrObjComboBox(java.lang.String smallFileName)
Add object to the object list from where it can be specified as the current object.

Parameters:
smallFileName - The last part of file name corresponding to the object. Eg /path/file.gts becomes file.gts
See Also:
mCurrObjComboBox

DeleteCurrObj

public void DeleteCurrObj()
Delete the current object (current selection from current object combo box). The function deletes the combo box entry, removes corresponding entries from color combo box, deletes the object and repaints the screen.


CreateDrawingCanvas

private void CreateDrawingCanvas()
Create the drawing canvas (used for drawing stuff). Puts the instance in mCanvas instance field. The mCanvas is put inside a scrollable pane, to enable the user to change the size of the drawing area.

See Also:
DrawingCanvas, mCanvas

CreateLightIntensitySliderAndLabel

private void CreateLightIntensitySliderAndLabel()
Create the light intensity adjusting slider and label. Puts the instance in mLightIntensity and mSliderLabel instance fields

See Also:
DrawingCanvas, mLightIntensitySlider, mSliderLabel

DrawOnePointPerspectiveView

private void DrawOnePointPerspectiveView()
Draws one point perspective view of the current scene.


DrawTwoPointPerspectiveView

private void DrawTwoPointPerspectiveView()
Draws two point perspective view of the current scene.


DrawThreePointPerspectiveView

private void DrawThreePointPerspectiveView()
Draws three point perspective view of the current scene.


GetCameraCenterProj

public void GetCameraCenterProj(float[] centerProj)

GetCameraPos

public void GetCameraPos(float[] cameraPos)

DrawAxonometricView

private void DrawAxonometricView()
Draws axonometric view (foreshortening along axes depends on viewing direction. The view is obtained using the following steps:
  1. Translate the origin to the center of screen.
  2. Rotate the z axis to pass through the line through screen center and eye pos
  3. Rotate the y axis to point along UP dir
  4. Apply the axonometric projection: ignore Z coordinate
  5. Draw


CreateNewJMenu

private javax.swing.JMenu CreateNewJMenu(java.lang.String title,
                                         int mnemonic,
                                         java.lang.String description)
Creates and reaturns a new JMenu with specified title, description, and mnemonic (accelerator).

Parameters:
title - JMenu label
mnemonic - JMenu hot key (accelerator).
description - Description for use with assistive devices.
Returns:
JMenu creates with specified attributes

CreateToolbarButton

private javax.swing.JButton CreateToolbarButton(java.lang.String imageName,
                                                java.lang.String actionCommand,
                                                java.lang.String toolTipText,
                                                java.lang.String altText)
Create a tool bar button. Sets the action command, tool tip and icon and returns the newly created button.

Parameters:
imageName - Name of image file (must be in resource subdirectory).
actionCommand - String identifying the button.
toolTipText - Tool tip
altText - text to show if icon is not available.

CreateToolBar

private void CreateToolBar()
Create a tool bar. The instance variable is mToolBar.


CreateMenuBar

private void CreateMenuBar()
Create the menu bar, instance stored in mMenuBar.

See Also:
mMenuBar

OpenFile

private void OpenFile()
Bring up a dialog to open a file.


SaveFile

private void SaveFile()

GetPhongExponent

private void GetPhongExponent()

ButtonColorChanged

private void ButtonColorChanged()
Color has been changed in color choose button. Apply the change to appropriate objects.


RulerColorChanged

private void RulerColorChanged()
Bring up a dialog to choose line color, proceed accordingly.


LightIntensity

public float LightIntensity()

SpecularExponent

public int SpecularExponent()
Get specular exponent, currently hardcoded to 5. This value is used if specular shading is turned on.

Returns:
specular exponent >= 1

IsSpecularShading

public boolean IsSpecularShading()

caretUpdate

public void caretUpdate(javax.swing.event.CaretEvent e)
Caret event listener code.

Specified by:
caretUpdate in interface javax.swing.event.CaretListener
Parameters:
e - CaretEvent

FourierTransform

private void FourierTransform(TwoDPlotter<java.lang.Float> plot)

GenerateMovingAvg

private void GenerateMovingAvg(TwoDPlotter<java.lang.Float> plot)

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent ae)
Method that gets called for objects implementing ActionListener. All JButtons and JMenuItems emit this event on being clicked.

Specified by:
actionPerformed in interface java.awt.event.ActionListener
Parameters:
ae - Action event instance.

RemovePlotMenuItem

private void RemovePlotMenuItem(int plotIndex)

AddPlotMenuItem

private javax.swing.JRadioButtonMenuItem AddPlotMenuItem()

itemStateChanged

public void itemStateChanged(java.awt.event.ItemEvent e)
Respond to the color combo box item changed events.

Specified by:
itemStateChanged in interface java.awt.event.ItemListener
Parameters:
e - ItemEvent
See Also:
mEntityColorComboBox

stateChanged

public void stateChanged(javax.swing.event.ChangeEvent e)
Listen to the slider stateChanged event.

Specified by:
stateChanged in interface javax.swing.event.ChangeListener
Parameters:
e - ChangeEvent
See Also:
mLightIntensitySlider

windowActivated

public void windowActivated(java.awt.event.WindowEvent e)
Specified by:
windowActivated in interface java.awt.event.WindowListener

windowClosed

public void windowClosed(java.awt.event.WindowEvent e)
Specified by:
windowClosed in interface java.awt.event.WindowListener

SerializeAndExit

private void SerializeAndExit()

windowClosing

public void windowClosing(java.awt.event.WindowEvent e)
Specified by:
windowClosing in interface java.awt.event.WindowListener

windowDeactivated

public void windowDeactivated(java.awt.event.WindowEvent e)
Specified by:
windowDeactivated in interface java.awt.event.WindowListener

windowDeiconified

public void windowDeiconified(java.awt.event.WindowEvent e)
Specified by:
windowDeiconified in interface java.awt.event.WindowListener

windowIconified

public void windowIconified(java.awt.event.WindowEvent e)
Specified by:
windowIconified in interface java.awt.event.WindowListener

windowOpened

public void windowOpened(java.awt.event.WindowEvent e)
Specified by:
windowOpened in interface java.awt.event.WindowListener

componentHidden

public void componentHidden(java.awt.event.ComponentEvent e)
Specified by:
componentHidden in interface java.awt.event.ComponentListener

componentShown

public void componentShown(java.awt.event.ComponentEvent e)
Specified by:
componentShown in interface java.awt.event.ComponentListener

componentResized

public void componentResized(java.awt.event.ComponentEvent e)
Specified by:
componentResized in interface java.awt.event.ComponentListener

componentMoved

public void componentMoved(java.awt.event.ComponentEvent e)
Specified by:
componentMoved in interface java.awt.event.ComponentListener

ReportMouseCoor

public void ReportMouseCoor(int x,
                            int y)
Print mouse coordinates on JTextField (status bar). This method is called from DrawingCanvas.

Parameters:
x - Mouse x coordinate.
y - Mouse y coordinate.
See Also:
DrawingCanvas.mouseMoved(MouseEvent)

createImage

public static java.awt.Image createImage(java.lang.String name)
Create an image from image file name. This function is used to create new

Assumes the file is present in resource subdirectory with specified file name. This is necessary for constructing a system independent file path that will work on any platform.

Parameters:
name - Name of file from which to generate the image.
Returns:
Image instance.

createImageIcon

public static javax.swing.ImageIcon createImageIcon(java.lang.String name)
Returns an ImageIcon, or null if the file name was invalid.

File name must be the name of the file (no path). This file must be located in resource directory of the distribution. This is essential to be able to write out the file name in a platform independent style.

Parameters:
name - File name containing the picture (must be in resource directory).
Returns:
Icon corresponding to the supplied image.

launchGUI

public static void launchGUI()
Launches the GUI. This method must be invoked from the event dispatching thread.

The method tries to set the look and feel of the GUI to the system compatible look and feel. If that is unavailable, it uses the cross platform look and feel.


showWindow

public static void showWindow(java.lang.String[] args)
Shows the window after creating the GUI. This method is the equivalent of main function.

Parameters:
args - Arguments passed to the method. Currently des not use any supplied ommand line arguments.