Class JPanelSurface

  • All Implemented Interfaces:
    java.awt.event.ActionListener, java.awt.event.FocusListener, java.awt.event.ItemListener, java.awt.event.KeyListener, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.event.ChangeListener, javax.swing.event.ListSelectionListener

    public class JPanelSurface
    extends JPanelRendererJ3D
    implements javax.swing.event.ListSelectionListener, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, javax.swing.event.ChangeListener
    A Java3D-based dialog for surfaces represented as triangle meshes. The surfaces are displayed in the 3D viewer that already contains a 3D image. The mouse behavior is the same for the image as it is for the surfaces, so that when the user zooms or rotates, it looks like the surfaces are part of the tri-image.
    Author:
    David Eberly, Neva Cherniavsky
    See Also:
    Serialized Form
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      (package private) class  JPanelSurface.CancelListener
      Cancel the color dialog, change nothing.
      (package private) class  JPanelSurface.OkColorListener
      Pick up the selected color and call method to change the surface color.
      • Nested classes/interfaces inherited from class javax.swing.JPanel

        javax.swing.JPanel.AccessibleJPanel
      • Nested classes/interfaces inherited from class javax.swing.JComponent

        javax.swing.JComponent.AccessibleJComponent
      • 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

      Fields 
      Modifier and Type Field Description
      private int activeLightBulbIndex
      Record the current active index of light bulb, which is being picked.
      private javax.swing.JLabel areaLabel
      The area label.
      private javax.swing.JTextField areaText
      Displays the area of triangle.
      private javax.swing.JButton colorButton
      The color button, which calls a color chooser.
      private ViewJColorChooser colorChooser
      Color chooser for when the user wants to change the color of the surface.
      private javax.swing.JLabel colorLabel
      The color button label.
      private javax.swing.JLabel comboLabel
      The polygon mode combo box label.
      private int currentIndex
      Current surface index being highlighted.
      private javax.swing.JButton decimateButton
      Decimate button.
      private javax.swing.JLabel detailLabel
      The level of detail slider label.
      private javax.swing.JSlider detailSlider
      Level of detail slider.
      private javax.swing.JLabel[] detailSliderLabels
      The labels below the detail slider.
      private int[] extents  
      private boolean findArbitraryClipping
      flag indicates arbitrary clpping bounding frame being picked.
      private boolean findProbe
      flag indicates the probe being picked.
      private static javax.vecmath.Color3f[] fixedColor
      The colors for the surfaces.
      private javax.swing.JButton levelSButton
      Save surface button.
      private javax.swing.JButton levelVButton
      Save surface button.
      private javax.swing.JButton levelWButton
      Save surface button.
      private javax.swing.JButton levelXMLButton
      Save surface button.
      private javax.media.j3d.Light[] lightArray
      An array of eight lights that can be used for illuminating the surfaces in the scene.
      private javax.media.j3d.BranchGroup[] lightArrayBG
      The branch groups to which the lights are attached.
      private ViewJComponentLightBulbs lightBulbs
      The structure for the light bulbs.
      private int[] m_aiMapIndexToJPanelLightsIndex
      The index of the lights in JPanelLights is different from the order maintained here.
      private int[] m_aiMapJPanelLightsIndexToIndex
      The index of the lights in JPanelLights is different from the order maintained here.
      private GeneralLight[] m_akLights
      The description of the lights so they can be duplicated in the "Advanced Material Properties" dialog:.
      private javax.swing.JButton m_kAdvancedMaterialOptionsButton
      The material options button, which launches the material editor window.
      (package private) javax.media.j3d.BranchGroup m_kFiberTractGroup
      For displaying the fiber bundle tracts in the orthogonal slice view:
      private javax.media.j3d.BranchGroup m_kGeodesicGroup
      For drawing the geodesic lines on the triangle mesh:.
      private JPanelLights m_kLightsControl
      Light dialog for when the user clicks the light button.
      private javax.media.j3d.TransformGroup m_kPathPositionTG
      For drawing the flythru path in the triangle mesh:.
      private javax.swing.JButton m_kStereoButton
      Stereo render button, launches the JStereoWindow for viewing the ModelTriangleMesh in stereo:.
      private javax.swing.JButton m_kSurfaceTextureButton
      Opens SurfaceTexture dialog:.
      private float maxBox
      ModelImage max dimension: (Extents * resolutions).
      private SurfaceMask mSurfaceMask
      Surface mask.
      private SurfacePaint mSurfacePaint
      Paint interface/algorithm for allowing the user to interactively paint the vertices of the ModelTriangleMesh.
      private javax.swing.JLabel opacityLabel
      The opacity slider label.
      private javax.swing.JSlider opacitySlider
      Opacity slider, not enabled yet.
      private javax.swing.JLabel[] opacitySliderLabels
      The labels below the opacity slider.
      private SurfaceRender parentScene
      The parent object that holds necessary the structures to which the surfaces will be added and modified.
      private com.sun.j3d.utils.picking.PickCanvas pickCanvas
      The PickCanvas object that ties together the canvas and the surfaces branch group to allow pick operations on the scene.
      private javax.swing.JComboBox polygonModeCB
      The combo box for the polygon mode to display.
      private float[] resolutions  
      private javax.swing.JScrollPane scroller
      The scroll pane holding the panel content.
      private static long serialVersionUID
      Use serialVersionUID for interoperability.
      private boolean setSurfaceOpacityFlag
      Indicator for the opacity slider moves.
      private javax.swing.JButton smooth1Button
      Smooth button.
      private javax.swing.JButton smooth2Button
      Smooth button.
      private javax.swing.JButton smooth3Button
      Smooth button.
      private com.sun.j3d.utils.geometry.Sphere sphere
      Sphere showing where the user clicked in the surface.
      private javax.media.j3d.BranchGroup sphereBranch
      Branch group parent of the sphere.
      private boolean sphereShowing
      Flag indicating if the sphere is currently showing.
      private javax.media.j3d.TransformGroup sphereTransform
      Transform group parent of the sphere.
      private javax.media.j3d.BranchGroup staticLightBehaviorBG
      Static light hehavior branch group.
      private javax.media.j3d.BranchGroup staticLightBG
      The branch group that holds the static light bulb.
      private ViewJComponentLightBulbs staticLightBulb
      The structure for the static light bulb.
      private javax.media.j3d.TransformGroup staticLightTG
      The transform group that holds the static light branch group.
      private com.sun.j3d.utils.behaviors.mouse.MouseTranslate staticLightTranslate
      Static light translate behavior.
      private com.sun.j3d.utils.behaviors.mouse.MouseZoom staticLightZoom
      Static light zoom behavior.
      private javax.swing.JCheckBox surfaceBackFaceCB
      Check Box for surface back face culling.
      private javax.swing.JCheckBox surfaceClipCB
      Check Box for surface clpping of the volume render.
      private java.lang.String surfaceDirectoryName
      The directory where a surface file was last loaded/saved.
      private javax.swing.JList surfaceList
      The list box in the dialog for surfaces.
      private MouseEventVector surfaceOpacityEvents
      Surface opacity changes event queue.
      private int surfaceOpacitySlice
      Surface volume opacity.
      private javax.swing.JCheckBox surfacePickableCB
      Check Box for surface pickable.
      private javax.media.j3d.BranchGroup surfaceRootBG
      The branch group that holds all the surfaces together.
      private javax.media.j3d.TransformGroup surfaceRootTG
      The transform group to which the model lights are attached.
      private int surfaceSliderCount
      Counter for surface opacity slider moves.
      private javax.swing.JCheckBox surfaceTransparencyCB
      Check Box for surface transparency.
      private java.util.Vector<SurfaceAttributes> surfaceVector
      A list of the surfaces.
      private javax.swing.JLabel triangleLabel
      The number of triangles label.
      private javax.swing.JTextField triangleText
      Displays the number of triangles.
      private javax.swing.JLabel volumeLabel
      The volume label.
      private javax.swing.JTextField volumeText
      Displays the volume of triangle.
      • Fields inherited from class javax.swing.JComponent

        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.Component

        accessibleContext, 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

      Constructors 
      Constructor Description
      JPanelSurface​(SurfaceRender parent, javax.media.j3d.Canvas3D canvas, javax.media.j3d.TransformGroup surfaceRoot, float xBox, float yBox, float zBox)
      Creates the Java3D scene graph for the application.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void actionPerformed​(java.awt.event.ActionEvent event)
      The override necessary to be an ActionListener.
      void addAttachedSurfaces()
      Add any attached surfaces the current image has in its file info (if the file info is in the xml format).
      void addBranch​(javax.media.j3d.BranchGroup kBranch, ModelTriangleMesh kMesh, javax.vecmath.Point3f kMeshCenter)
      Adds a BranchGroup to the display.
      void addFlightPath​(javax.media.j3d.Shape3D kPathShape, javax.vecmath.Point3f kPosition)
      Adds the flythru path shape and current view position to the display.
      javax.media.j3d.BranchGroup addLineArray​(javax.media.j3d.LineArray kLine, int iGroup)
      Called from the JDialogDTIInput.
      void addMesh​(ModelTriangleMesh kOld, ModelTriangleMesh kNew, java.lang.String kName)
      Called when a mesh is changed by the Geodesic class, when a mesh is cut along the geodesic curve it may be divided into two or more meshes.
      void addSurface()
      Add surface to the volume image.
      void addSurfaces​(SurfaceAttributes[] surfaces, boolean pickable)
      Adds an array of surfaces described by their SurfaceAttributes to the scene graph.
      void addSurfaces​(java.lang.String dir, java.io.File surfaceFile)
      Adding the surface with specific directory and file name.
      private void buildToolBar()
      Build the toolbar.
      float calcVolume​(ModelImage imageA, ModelTriangleMesh[] kMesh)  
      private void changePolyMode​(int mode)
      Changes the polygon mode of the selected surface by detaching it, calling the appropriate method, and reattaching it.
      private SurfaceAttributes[] containsMesh​(ModelTriangleMesh kOld)
      containsMesh returns the SurfaceAttributes[] containing the input ModelTriangleMesh parameter, where the SurfaceAttributes[] array is of length 1.
      private javax.swing.JLabel createLabel​(java.lang.String title)
      Creates a label in the proper font and color.
      private void createSurface​(SurfaceAttributes surface, boolean pickable)
      Creates a surface in the scene graph from an array of triangle meshes.
      private void decimate​(SurfaceAttributes[] surfaces)
      Decimate the surface.
      private void displayAdvancedMaterialOptions​(SurfaceAttributes[] surfaces)
      For each file in the selected list, launch the AdvancedMaterialOptions dialog:
      private void displayImageAsTexture​(SurfaceAttributes[] surfaces)
      Displays the selected surfaces with the ModelImage as a 3D texture map on the surface triangle mesh.
      private void displayStereo​(SurfaceAttributes[] surfaces)
      For each file in the selected list, launch the stereo viewer:
      void dispose()
      Dispose memory.
      private com.sun.j3d.utils.picking.PickResult doPick​(java.awt.event.MouseEvent kEvent)
      Locate the surface that corresponds to a picking operation in the viewer window.
      private void enableStaticLightBehavior​(boolean flag)
      Enable static light behavior.
      void enableSurfacePaint​(boolean bEnable)
      Enables/Disables the SurfacePaint per-vertex functions.
      void enableSurfacePaintCan​(boolean bEnable)
      Enables/Disables the SurfacePaint Paint Can function.
      void findPickedObject​(java.awt.event.MouseEvent kEvent)
      One of the overrides necessary to be a MouseListener.
      void generateNewTextureCoords​(ModelImage kImage, boolean bVertexColors, boolean bUseImageMask)
      Generates new texture coordinates for all surfaces, based on the new ModelImage texture-source.
      private void getColorChange​(java.awt.Color color)
      This is called when the user chooses a new color for the surface.
      javax.media.j3d.BranchGroup getGeodesicGroup()
      Return access to the Group data member m_kGeodesicGroup so Geodesic object can draw on the triangle mesh.
      javax.vecmath.Color3f getLightColor​(int i)
      The only caller of this method is the light attribute dialog, an object from class JDialogSurfaceLight.
      int getLightCount()
      The number of lights supported by the viewer (currently 9).
      JPanelLights getLightDialog()
      Return the surface light control dialog box.
      javax.swing.JPanel getMainPanel()
      Return the main surface panel.
      static javax.vecmath.Color4f getNewSurfaceColor​(int index)
      static function returns the next default surface color, based on the current number of surfaces displayed.
      javax.swing.JSlider getOpacitySlider()
      Get the current surface opacity slider.
      com.sun.j3d.utils.picking.PickCanvas getPickCanvas()
      Get the pick canvas.
      private SurfaceAttributes[] getSelectedSurfaces​(int[] aiSelected)
      Returns an array of SurfaceAttributes based on which surfaces are selected by the user in the surfaceList combo-box.
      javax.swing.JCheckBox getSurfaceClipCB()
      Get the surface clip check box.
      javax.swing.JList getSurfaceList()
      Get the reference to the surface list.
      SurfaceMask getSurfaceMask()
      Returns the SurfaceMask object.
      int getSurfaceOpacity()
      Get the current surface opacity value.
      java.util.Vector<SurfaceAttributes> getSurfaceVector()
      Return the surface vector reference.
      ModelImage getTextureImage()
      Returns the ModelImage used to generate the Texture3D.
      int getTextureStatus()
      Returns the texture status, either TEXTURE, VERTEX_COLOR, or NONE.
      private void init()
      Initializes the GUI components.
      private void initSphere()
      Initialize the sphere scene graph objects for the sphere showing where the user clicked in the surface.
      boolean isProbePicked()
      If probe being picked or not.
      private boolean isStaticLightEnabled()
      Check static light is enable or not.
      private boolean isStaticPicked()
      Indicates whether the static light bulb being picked by the mouse.
      boolean isSurfacePickableSelected()
      Check if the surface pickable checkbox be selected or not.
      void mouseClicked​(java.awt.event.MouseEvent kEvent)
      One of the overrides necessary to be a MouseListener.
      void mouseDragged​(java.awt.event.MouseEvent kEvent)
      One of the overrides necessary to be a MouseMotionListener.
      void mouseEntered​(java.awt.event.MouseEvent kEvent)
      One of the overrides necessary to be a MouseListener.
      void mouseExited​(java.awt.event.MouseEvent kEvent)
      One of the overrides necessary to be a MouseListener.
      void mouseMoved​(java.awt.event.MouseEvent kEvent)
      One of the overrides necessary to be a MouseMotionListener.
      void mousePressed​(java.awt.event.MouseEvent kEvent)
      DOCUMENT ME!
      void mouseReleased​(java.awt.event.MouseEvent kEvent)
      DOCUMENT ME!
      private int polygonIndexToMode​(int index)
      Convert from the polygon mode combo-box list index to the PolygonAttributes.POLYGON_LINE, PolygonAttributes.POLYGON_POINT, and PolygonAttributes.POLYGON_FILL values:
      private void readSurface​(java.lang.String dir, java.io.File surfaceFile, float surfaceOpacity)
      Adding the surface with specific directory, file name, and surfaceOpacity.
      void removeBranch​(javax.media.j3d.BranchGroup kBranch, boolean bRemoveMesh)
      Removes a BranchGroup to the display.
      void removeLineArray​(javax.media.j3d.BranchGroup kBranch)
      Called from the JDialogDTIInput.
      void removeSurface()
      Remove the surface from the volume render.
      void removeSurface​(javax.media.j3d.BranchGroup root)
      Remove the specified surface subtree from the scene graph.
      private void removeSurfaces​(SurfaceAttributes[] surfaces)
      The action taken when the Remove button is clicked in the list box.
      void replaceMesh​(ModelTriangleMesh kOld, ModelTriangleMesh kNew)
      ReplaceMesh is used by the Geodesic when a mesh is cut along either an open or closed geodesic curve, the original mesh is changed, but not deleted and no new mesh is added.
      void resizePanel​(int panelWidth, int frameHeight)
      Resizing the control panel with ViewJFrameVolumeView's frame width and height.
      void restorePerVertexColor​(javax.media.j3d.Material kMaterial, int index)
      Restores the per-vertex colors for the surface at the index parameter.
      void restoreVertexColors()
      Restores the vertex colors for the surfaces.
      private void setBackface​(SurfaceAttributes[] surfaces)
      Turns BackFace Culling on/off for the selected surfaces.
      private void setClipping​(SurfaceAttributes[] surfaces)
      Turns Clipping on/off for the selected surfaces.
      private void setElementsEnabled​(boolean flag)
      Sets the surface options GUI panel to enabled or disabled.
      void setLightAttributes​(int iIndex)
      Update the properties of the specified light bulb.
      void setLightBulbsVisible​(boolean flag)
      Sets the light bulbs to visible or invisible.
      void setMaterial​(javax.media.j3d.Material kMaterial, int iIndex)
      Called from the JPanelSurfaceMAterialProperties.java dialog when the dialog is used to change the material properties of a surface.
      void setPathPosition​(javax.vecmath.Point3f kPosition)
      Updates the position of the flythru view point along the flythru path.
      private void setPickable​(SurfaceAttributes[] surfaces)
      Turns picking on/off for the selected surfaces.
      private void setTransparency​(SurfaceAttributes[] surfaces)
      Turns Transparency on/off for the selected surfaces.
      private void setupLights​(javax.media.j3d.TransformGroup surfaceRoot)
      Create and initialize the nine lights in the scene graph.
      private void smoothSurface​(SurfaceAttributes[] surfaces, int smoothType)
      Smoothes the selected surfaces.
      void stateChanged​(javax.swing.event.ChangeEvent event)
      The override necessary to be a ChangeListener for a JSlider.
      void toggleWireframe()
      Toggle between wireframe and filled polygon mode.
      private void updateSurfaceNameList​(int[] selected)
      Called when surfaces are added or removed from the surfaceVector SurfaceAttributes list.
      private void updateSurfaceRender​(boolean bUpdateProbe)
      Updates the SurfaceRenderer.
      void updateVolumeTexture​(java.util.BitSet paintMask, javax.vecmath.Color4f kColor)
      Called from SurfacePaint.
      void valueChanged​(javax.swing.event.ListSelectionEvent kEvent)
      The override necessary to be a ListSelectionListener.
      void windowClosing​(java.awt.event.WindowEvent event)
      Overrides method in JDialogBase so dialog isn't disposed, just hidden.
      • Methods inherited from class javax.swing.JPanel

        getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
      • Methods inherited from class javax.swing.JComponent

        addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, unregisterKeyboardAction, update
      • Methods inherited from class java.awt.Container

        add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, 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, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, 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, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • Methods inherited from class java.lang.Object

        clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.awt.event.FocusListener

        focusGained, focusLost
      • Methods inherited from interface java.awt.event.ItemListener

        itemStateChanged
      • Methods inherited from interface java.awt.event.KeyListener

        keyPressed, keyReleased, keyTyped
    • Field Detail

      • serialVersionUID

        private static final long serialVersionUID
        Use serialVersionUID for interoperability.
        See Also:
        Constant Field Values
      • fixedColor

        private static javax.vecmath.Color3f[] fixedColor
        The colors for the surfaces.
      • activeLightBulbIndex

        private int activeLightBulbIndex
        Record the current active index of light bulb, which is being picked.
      • areaLabel

        private javax.swing.JLabel areaLabel
        The area label.
      • areaText

        private javax.swing.JTextField areaText
        Displays the area of triangle.
      • colorButton

        private javax.swing.JButton colorButton
        The color button, which calls a color chooser.
      • colorChooser

        private ViewJColorChooser colorChooser
        Color chooser for when the user wants to change the color of the surface.
      • colorLabel

        private javax.swing.JLabel colorLabel
        The color button label.
      • comboLabel

        private javax.swing.JLabel comboLabel
        The polygon mode combo box label.
      • currentIndex

        private int currentIndex
        Current surface index being highlighted.
      • decimateButton

        private javax.swing.JButton decimateButton
        Decimate button.
      • detailLabel

        private javax.swing.JLabel detailLabel
        The level of detail slider label.
      • detailSlider

        private javax.swing.JSlider detailSlider
        Level of detail slider.
      • detailSliderLabels

        private javax.swing.JLabel[] detailSliderLabels
        The labels below the detail slider.
      • findArbitraryClipping

        private boolean findArbitraryClipping
        flag indicates arbitrary clpping bounding frame being picked.
      • findProbe

        private boolean findProbe
        flag indicates the probe being picked.
      • levelSButton

        private javax.swing.JButton levelSButton
        Save surface button.
      • levelVButton

        private javax.swing.JButton levelVButton
        Save surface button.
      • levelWButton

        private javax.swing.JButton levelWButton
        Save surface button.
      • levelXMLButton

        private javax.swing.JButton levelXMLButton
        Save surface button.
      • lightArray

        private javax.media.j3d.Light[] lightArray
        An array of eight lights that can be used for illuminating the surfaces in the scene. The lights at indices 0 and 7 are initially enabled; the other lights are initially disabled. The default positions for the lights are at the 8 corners of the cube [0,1]^3. Light 0 is at (0,0,0) and light 7 is at (1,1,1), thereby providing suitable lighting for the visible surfaces in the scene. Other lights can be enabled as desired through the light attribute dialog.
      • lightArrayBG

        private javax.media.j3d.BranchGroup[] lightArrayBG
        The branch groups to which the lights are attached.
      • m_aiMapIndexToJPanelLightsIndex

        private final int[] m_aiMapIndexToJPanelLightsIndex
        The index of the lights in JPanelLights is different from the order maintained here. This array maps from our index to JPanelLights' index.
      • m_aiMapJPanelLightsIndexToIndex

        private final int[] m_aiMapJPanelLightsIndexToIndex
        The index of the lights in JPanelLights is different from the order maintained here. This array maps from JPanelLights' index to our index.
      • m_akLights

        private GeneralLight[] m_akLights
        The description of the lights so they can be duplicated in the "Advanced Material Properties" dialog:.
      • m_kAdvancedMaterialOptionsButton

        private javax.swing.JButton m_kAdvancedMaterialOptionsButton
        The material options button, which launches the material editor window.
      • m_kGeodesicGroup

        private javax.media.j3d.BranchGroup m_kGeodesicGroup
        For drawing the geodesic lines on the triangle mesh:.
      • m_kFiberTractGroup

        javax.media.j3d.BranchGroup m_kFiberTractGroup
        For displaying the fiber bundle tracts in the orthogonal slice view:
      • m_kLightsControl

        private JPanelLights m_kLightsControl
        Light dialog for when the user clicks the light button.
      • m_kPathPositionTG

        private javax.media.j3d.TransformGroup m_kPathPositionTG
        For drawing the flythru path in the triangle mesh:.
      • m_kStereoButton

        private javax.swing.JButton m_kStereoButton
        Stereo render button, launches the JStereoWindow for viewing the ModelTriangleMesh in stereo:.
      • m_kSurfaceTextureButton

        private javax.swing.JButton m_kSurfaceTextureButton
        Opens SurfaceTexture dialog:.
      • maxBox

        private float maxBox
        ModelImage max dimension: (Extents * resolutions).
      • resolutions

        private float[] resolutions
      • extents

        private int[] extents
      • mSurfaceMask

        private SurfaceMask mSurfaceMask
        Surface mask.
      • mSurfacePaint

        private SurfacePaint mSurfacePaint
        Paint interface/algorithm for allowing the user to interactively paint the vertices of the ModelTriangleMesh.
      • opacityLabel

        private javax.swing.JLabel opacityLabel
        The opacity slider label.
      • opacitySlider

        private javax.swing.JSlider opacitySlider
        Opacity slider, not enabled yet.
      • opacitySliderLabels

        private javax.swing.JLabel[] opacitySliderLabels
        The labels below the opacity slider.
      • parentScene

        private SurfaceRender parentScene
        The parent object that holds necessary the structures to which the surfaces will be added and modified.
      • pickCanvas

        private com.sun.j3d.utils.picking.PickCanvas pickCanvas
        The PickCanvas object that ties together the canvas and the surfaces branch group to allow pick operations on the scene.
      • polygonModeCB

        private javax.swing.JComboBox polygonModeCB
        The combo box for the polygon mode to display.
      • scroller

        private javax.swing.JScrollPane scroller
        The scroll pane holding the panel content. Useful when the screen is small.
      • setSurfaceOpacityFlag

        private boolean setSurfaceOpacityFlag
        Indicator for the opacity slider moves.
      • smooth1Button

        private javax.swing.JButton smooth1Button
        Smooth button.
      • smooth2Button

        private javax.swing.JButton smooth2Button
        Smooth button.
      • smooth3Button

        private javax.swing.JButton smooth3Button
        Smooth button.
      • sphere

        private com.sun.j3d.utils.geometry.Sphere sphere
        Sphere showing where the user clicked in the surface.
      • sphereBranch

        private javax.media.j3d.BranchGroup sphereBranch
        Branch group parent of the sphere.
      • sphereShowing

        private boolean sphereShowing
        Flag indicating if the sphere is currently showing.
      • sphereTransform

        private javax.media.j3d.TransformGroup sphereTransform
        Transform group parent of the sphere.
      • staticLightBehaviorBG

        private javax.media.j3d.BranchGroup staticLightBehaviorBG
        Static light hehavior branch group.
      • staticLightBG

        private javax.media.j3d.BranchGroup staticLightBG
        The branch group that holds the static light bulb.
      • staticLightTG

        private javax.media.j3d.TransformGroup staticLightTG
        The transform group that holds the static light branch group.
      • staticLightTranslate

        private com.sun.j3d.utils.behaviors.mouse.MouseTranslate staticLightTranslate
        Static light translate behavior.
      • staticLightZoom

        private com.sun.j3d.utils.behaviors.mouse.MouseZoom staticLightZoom
        Static light zoom behavior.
      • surfaceBackFaceCB

        private javax.swing.JCheckBox surfaceBackFaceCB
        Check Box for surface back face culling.
      • surfaceClipCB

        private javax.swing.JCheckBox surfaceClipCB
        Check Box for surface clpping of the volume render.
      • surfaceDirectoryName

        private java.lang.String surfaceDirectoryName
        The directory where a surface file was last loaded/saved. Defaults to MIPAV default directory.
      • surfaceList

        private javax.swing.JList surfaceList
        The list box in the dialog for surfaces.
      • surfaceOpacityEvents

        private MouseEventVector surfaceOpacityEvents
        Surface opacity changes event queue.
      • surfaceOpacitySlice

        private int surfaceOpacitySlice
        Surface volume opacity.
      • surfacePickableCB

        private javax.swing.JCheckBox surfacePickableCB
        Check Box for surface pickable.
      • surfaceRootBG

        private javax.media.j3d.BranchGroup surfaceRootBG
        The branch group that holds all the surfaces together.
      • surfaceRootTG

        private javax.media.j3d.TransformGroup surfaceRootTG
        The transform group to which the model lights are attached.
      • surfaceSliderCount

        private int surfaceSliderCount
        Counter for surface opacity slider moves.
      • surfaceTransparencyCB

        private javax.swing.JCheckBox surfaceTransparencyCB
        Check Box for surface transparency.
      • surfaceVector

        private java.util.Vector<SurfaceAttributes> surfaceVector
        A list of the surfaces. The elements are of type SurfaceAttributes.
      • triangleLabel

        private javax.swing.JLabel triangleLabel
        The number of triangles label.
      • triangleText

        private javax.swing.JTextField triangleText
        Displays the number of triangles.
      • volumeLabel

        private javax.swing.JLabel volumeLabel
        The volume label.
      • volumeText

        private javax.swing.JTextField volumeText
        Displays the volume of triangle.
    • Constructor Detail

      • JPanelSurface

        public JPanelSurface​(SurfaceRender parent,
                             javax.media.j3d.Canvas3D canvas,
                             javax.media.j3d.TransformGroup surfaceRoot,
                             float xBox,
                             float yBox,
                             float zBox)
        Creates the Java3D scene graph for the application. The surfaces are all children of the BranchGroup surfaceRootBG, which is in turn a child of the TransformGroup in ViewJFrameTriImage3D. That transform group controls how both the surfaces and the three image planes are displayed; by making the surfaces a child of the transform, the surfaces and image planes move together. The BranchGroup created here is used for the PickCanvas, so that the pick tool ignores the image planes when the mouse is clicked and just looks for the surfaces.

        This constructor also adds lights to the scene. Because of the texture maps on the image planes, lights don't make a difference in how the image planes are displayed. Therefore, the lights are only necessary for the surfaces.

        Parameters:
        parent - SurfaceRender reference
        canvas - Canvas3D reference
        surfaceRoot - TransformGroup root to add surfaces
        xBox - red box x dimension
        yBox - red box y dimension
        zBox - red box z dimension
    • Method Detail

      • getNewSurfaceColor

        public static javax.vecmath.Color4f getNewSurfaceColor​(int index)
        static function returns the next default surface color, based on the current number of surfaces displayed. If the number of surfaces is less than the fixedColor.length then fixedColor is the source of the surface color, otherwise a random color is generated.
        Parameters:
        index - the number of the new surface
        Returns:
        Color4f, the default surface color for the new surface.
      • actionPerformed

        public void actionPerformed​(java.awt.event.ActionEvent event)
        The override necessary to be an ActionListener. This callback is executed whenever the Add or Remove buttons are clicked, or when the color button or light button is clicked, or when the combo box changes. If the Add button is clicked, a file dialog is launched to allow the user to select new surface meshes to load from disk. If the Remove button is clicked, the currently selected surfaces in the list box are removed from the scene graph.
        Specified by:
        actionPerformed in interface java.awt.event.ActionListener
        Specified by:
        actionPerformed in class JPanelRendererBase
        Parameters:
        event - The action event.
      • addAttachedSurfaces

        public void addAttachedSurfaces()
        Add any attached surfaces the current image has in its file info (if the file info is in the xml format).
      • addBranch

        public void addBranch​(javax.media.j3d.BranchGroup kBranch,
                              ModelTriangleMesh kMesh,
                              javax.vecmath.Point3f kMeshCenter)
        Adds a BranchGroup to the display.
        Parameters:
        kBranch - BranchGroup branch group
        kMesh - ModelTriangleMesh surface mesh
        kMeshCenter - Point3f center of mass
      • addFlightPath

        public void addFlightPath​(javax.media.j3d.Shape3D kPathShape,
                                  javax.vecmath.Point3f kPosition)
        Adds the flythru path shape and current view position to the display.
        Parameters:
        kPathShape - the flythru path geometry
        kPosition - the current viewpoint.
      • addLineArray

        public javax.media.j3d.BranchGroup addLineArray​(javax.media.j3d.LineArray kLine,
                                                        int iGroup)
        Called from the JDialogDTIInput. Adds a line array representing the fiber bundle tract to the SurfaceRender.
        Parameters:
        kLine - LineArray to add
        iGroup - branch group index to add the line to.
        Returns:
        the BranchGroup the line is added to.
      • removeLineArray

        public void removeLineArray​(javax.media.j3d.BranchGroup kBranch)
        Called from the JDialogDTIInput. Removes the line array representing the fiber bundle tract from the SurfaceRender.
        Parameters:
        kBranch - the BranchGroup the line is in.
      • addMesh

        public void addMesh​(ModelTriangleMesh kOld,
                            ModelTriangleMesh kNew,
                            java.lang.String kName)
        Called when a mesh is changed by the Geodesic class, when a mesh is cut along the geodesic curve it may be divided into two or more meshes. This function allows the Geodesic class to add meshes to the scene renderer. It follows the pattern of adding a surface through the surface dialog.
        Parameters:
        kOld - ModelTriangleMesh old mesh
        kNew - ModelTriangleMesh new mesh
        kName - String mesh name
      • addSurface

        public void addSurface()
        Add surface to the volume image. Calls the FileSurface.openSurfaces function to open a file dialog so the user can choose the surfaces to add.
      • addSurfaces

        public void addSurfaces​(java.lang.String dir,
                                java.io.File surfaceFile)
        Adding the surface with specific directory and file name. Called from the ViewJFrameVolumeView class from the JPanelEndoscopy loadingSurface function.
        Parameters:
        dir - directory name
        surfaceFile - file name
      • addSurfaces

        public void addSurfaces​(SurfaceAttributes[] surfaces,
                                boolean pickable)
        Adds an array of surfaces described by their SurfaceAttributes to the scene graph.
        Parameters:
        surfaces - the new surfaces (SurfaceAttributes[]) to add to the scene graph.
        pickable - when true turn picking on for the new surfaces, when false disable picking.
      • dispose

        public void dispose()
        Dispose memory.
      • enableSurfacePaint

        public void enableSurfacePaint​(boolean bEnable)
        Enables/Disables the SurfacePaint per-vertex functions.
        Parameters:
        bEnable - when true the SurfacePaint per-vertex functions (PaintBrush, Dropper, Eraser, BrushSize) are enabled, when false they are disabled.
      • enableSurfacePaintCan

        public void enableSurfacePaintCan​(boolean bEnable)
        Enables/Disables the SurfacePaint Paint Can function.
        Parameters:
        bEnable - when true the Paint Can function is enabled, when false it is disabled.
      • findPickedObject

        public void findPickedObject​(java.awt.event.MouseEvent kEvent)
        One of the overrides necessary to be a MouseListener. The surface attribute dialog was added as a listener to the 3D canvas on which the scene is drawn. Whenever a picking operation occurs on the canvas, this member function is called. The pick operation returns the Shape3D object (null, if no object is situated at the pick location). The root of the subtree for the picked surface is looked up within the surfaces list. If found, the list box, color button, detail slider, triangle text, and polygon mode are updated to display the selected surface.

        Note. The use of Shape3D by the picker and BranchGroup by the surfaces list appears to be more complicated than necessary, and instead both should use Shape3D or BranchGroup. In fact it is necessary to structure the code as it currently is. The picker needs to locate actual geometry, so Shape3D objects must enable themselves to be picked with ray-triangle intersection testing. If the surfaces in the list were set up to be Shape3D instead of BranchGroup, then all add/remove operations would have to be based on Shape3D, not on BranchGroups. These operations are not allowed in compiled scene graphs.

        Note. The iteration over the surface list checking for the BranchGroup whose child is the picked surface is also necessary. Simpler would be to query the Shape3D object for its parent. Such a query is also not supported in a compiled scene graph.
        Parameters:
        kEvent - The mouse event.
      • generateNewTextureCoords

        public void generateNewTextureCoords​(ModelImage kImage,
                                             boolean bVertexColors,
                                             boolean bUseImageMask)
        Generates new texture coordinates for all surfaces, based on the new ModelImage texture-source. If bVertexColors is true, the ModelImage is displayed as per-vertex colors.
        Parameters:
        kImage - the new ModelImage used to texture-map the ModelTriangleMesh polygons.
        bVertexColors - when true display the ModelImage as per-vertex colors, when false, display the ModelImage as a 3D Texture.
        bUseImageMask - DOCUMENT ME!
      • getGeodesicGroup

        public javax.media.j3d.BranchGroup getGeodesicGroup()
        Return access to the Group data member m_kGeodesicGroup so Geodesic object can draw on the triangle mesh.
        Returns:
        BranchGroup root of the geodesic group reference.
      • getLightColor

        public javax.vecmath.Color3f getLightColor​(int i)
        The only caller of this method is the light attribute dialog, an object from class JDialogSurfaceLight. The dialog calls this to initialize its color button.
        Parameters:
        i - The light index (must be in [0..8]).
        Returns:
        The color of light i.
      • getLightCount

        public int getLightCount()
        The number of lights supported by the viewer (currently 9). The only caller of this method is the light attribute dialog, an object from class JDialogSurfaceLight. The dialog uses the count to create a list of lights in the scene. If the number of supported lights ever changes, the dialog code does not have to change.
        Returns:
        The number of supported lights in the scene.
      • getLightDialog

        public JPanelLights getLightDialog()
        Return the surface light control dialog box.
        Returns:
        lights Surface light dialog box
      • getMainPanel

        public javax.swing.JPanel getMainPanel()
        Return the main surface panel.
        Specified by:
        getMainPanel in class JPanelRendererBase
        Returns:
        the surface panel
      • getOpacitySlider

        public javax.swing.JSlider getOpacitySlider()
        Get the current surface opacity slider.
        Returns:
        opacitySlider Surface opacity slider
      • getPickCanvas

        public com.sun.j3d.utils.picking.PickCanvas getPickCanvas()
        Get the pick canvas.
        Returns:
        pickCanvas pick canvas.
      • getSurfaceClipCB

        public javax.swing.JCheckBox getSurfaceClipCB()
        Get the surface clip check box.
        Returns:
        surfaceClipCB surface clip check box.
      • getSurfaceList

        public javax.swing.JList getSurfaceList()
        Get the reference to the surface list. This method is called by the probePanel.
        Returns:
        surfaceList reference to surfaceList
      • getSurfaceMask

        public SurfaceMask getSurfaceMask()
        Returns the SurfaceMask object.
        Returns:
        mSurfaceMask.
      • getSurfaceOpacity

        public int getSurfaceOpacity()
        Get the current surface opacity value.
        Returns:
        surfaceOpaictySlice Surface opacity slider value
      • getSurfaceVector

        public java.util.Vector<SurfaceAttributes> getSurfaceVector()
        Return the surface vector reference.
        Returns:
        surfaceVector surface vector
      • getTextureImage

        public ModelImage getTextureImage()
        Returns the ModelImage used to generate the Texture3D.
        Returns:
        the JPanelSurfaceTexture ModelImage data source for the Texture3D object.
      • getTextureStatus

        public int getTextureStatus()
        Returns the texture status, either TEXTURE, VERTEX_COLOR, or NONE.
        Returns:
        the texture status, either TEXTURE, VERTEX_COLOR, or NONE
      • isProbePicked

        public boolean isProbePicked()
        If probe being picked or not.
        Returns:
        boolean probe picked or not
      • isSurfacePickableSelected

        public boolean isSurfacePickableSelected()
        Check if the surface pickable checkbox be selected or not.
        Returns:
        isSelected Surface pickable check box selected or not.
      • mouseClicked

        public void mouseClicked​(java.awt.event.MouseEvent kEvent)
        One of the overrides necessary to be a MouseListener. This member only exists to satisfy the conditions of being a MouseListener. It does nothing when invoked.
        Specified by:
        mouseClicked in interface java.awt.event.MouseListener
        Parameters:
        kEvent - The mouse event.
      • mouseDragged

        public void mouseDragged​(java.awt.event.MouseEvent kEvent)
        One of the overrides necessary to be a MouseMotionListener. This member only exists to satisfy the conditions of being a MouseMotionListener. It does nothing when invoked.
        Specified by:
        mouseDragged in interface java.awt.event.MouseMotionListener
        Parameters:
        kEvent - The mouse event.
      • mouseEntered

        public void mouseEntered​(java.awt.event.MouseEvent kEvent)
        One of the overrides necessary to be a MouseListener. This member only exists to satisfy the conditions of being a MouseListener. It does nothing when invoked.
        Specified by:
        mouseEntered in interface java.awt.event.MouseListener
        Parameters:
        kEvent - The mouse event.
      • mouseExited

        public void mouseExited​(java.awt.event.MouseEvent kEvent)
        One of the overrides necessary to be a MouseListener. This member only exists to satisfy the conditions of being a MouseListener. It does nothing when invoked.
        Specified by:
        mouseExited in interface java.awt.event.MouseListener
        Parameters:
        kEvent - The mouse event.
      • mouseMoved

        public void mouseMoved​(java.awt.event.MouseEvent kEvent)
        One of the overrides necessary to be a MouseMotionListener. This member only exists to satisfy the conditions of being a MouseMotionListener. It does nothing when invoked.
        Specified by:
        mouseMoved in interface java.awt.event.MouseMotionListener
        Parameters:
        kEvent - The mouse event.
      • mousePressed

        public void mousePressed​(java.awt.event.MouseEvent kEvent)
        DOCUMENT ME!
        Specified by:
        mousePressed in interface java.awt.event.MouseListener
        Parameters:
        kEvent - The mouse event.
      • mouseReleased

        public void mouseReleased​(java.awt.event.MouseEvent kEvent)
        DOCUMENT ME!
        Specified by:
        mouseReleased in interface java.awt.event.MouseListener
        Parameters:
        kEvent - The mouse event.
      • removeBranch

        public void removeBranch​(javax.media.j3d.BranchGroup kBranch,
                                 boolean bRemoveMesh)
        Removes a BranchGroup to the display.
        Parameters:
        kBranch - BranchGroup surface branch group reference.
        bRemoveMesh - boolean flag to remove the surface mesh or not
      • removeSurface

        public void removeSurface()
        Remove the surface from the volume render.
      • removeSurface

        public void removeSurface​(javax.media.j3d.BranchGroup root)
        Remove the specified surface subtree from the scene graph.
        Parameters:
        root - The root of the subtree to remove.
      • replaceMesh

        public void replaceMesh​(ModelTriangleMesh kOld,
                                ModelTriangleMesh kNew)
        ReplaceMesh is used by the Geodesic when a mesh is cut along either an open or closed geodesic curve, the original mesh is changed, but not deleted and no new mesh is added. The orginal mesh, kOld, is replced by the new mesh, kNew
        Parameters:
        kOld - ModelTriangleMesh old mesh reference
        kNew - ModelTriangleMesh new mesh reference
      • resizePanel

        public void resizePanel​(int panelWidth,
                                int frameHeight)
        Resizing the control panel with ViewJFrameVolumeView's frame width and height.
        Overrides:
        resizePanel in class JPanelRendererBase
        Parameters:
        panelWidth - int width
        frameHeight - int height
      • restorePerVertexColor

        public void restorePerVertexColor​(javax.media.j3d.Material kMaterial,
                                          int index)
        Restores the per-vertex colors for the surface at the index parameter. Called by the AdvancedMaterialProperties dialog.
        Parameters:
        kMaterial - the original Material to restore
        index - the surface index
      • restoreVertexColors

        public void restoreVertexColors()
        Restores the vertex colors for the surfaces.
      • setLightAttributes

        public void setLightAttributes​(int iIndex)
        Update the properties of the specified light bulb.
        Parameters:
        iIndex - int Index of the bulb in the array as stored in JPanelLights.
      • setLightBulbsVisible

        public void setLightBulbsVisible​(boolean flag)
        Sets the light bulbs to visible or invisible.
        Parameters:
        flag - true means visible.
      • setMaterial

        public void setMaterial​(javax.media.j3d.Material kMaterial,
                                int iIndex)
        Called from the JPanelSurfaceMAterialProperties.java dialog when the dialog is used to change the material properties of a surface. The surface is determined by the index iIndex. The color button is set to the Material diffuse color.
        Parameters:
        kMaterial - Material reference
        iIndex - int material index
      • setPathPosition

        public void setPathPosition​(javax.vecmath.Point3f kPosition)
        Updates the position of the flythru view point along the flythru path.
        Parameters:
        kPosition - Point3f
      • stateChanged

        public void stateChanged​(javax.swing.event.ChangeEvent event)
        The override necessary to be a ChangeListener for a JSlider.

        When a change occurs to the detailSlider, the user has requested that the level of detail be changed for the currently active surface. The slider range is [0,100] and is treated as a percent of maximum level of detail. A change has no effect on ModelTriangleMesh objects, but it does change the level of detail for an ModelClodMesh object. The number of triangles is also updated.

        When a change occurs to the opacity slider, the surface transparency is updated.

        Specified by:
        stateChanged in interface javax.swing.event.ChangeListener
        Parameters:
        event - The change event.
      • toggleWireframe

        public void toggleWireframe()
        Toggle between wireframe and filled polygon mode.
      • updateVolumeTexture

        public void updateVolumeTexture​(java.util.BitSet paintMask,
                                        javax.vecmath.Color4f kColor)
        Called from SurfacePaint. Used to paint the ModelImage texture with the paint can function.
        Parameters:
        paintMask - the paint mask to add to the texture.
        kColor - DOCUMENT ME!
      • valueChanged

        public void valueChanged​(javax.swing.event.ListSelectionEvent kEvent)
        The override necessary to be a ListSelectionListener. This callback is executed whenever the user selects a new item (or items) in the list box. If a single item is selected, then the selection index is remembered in iSelect and the interface items are initialized with the appropriate values corresponding to the selected surface. If multiple items are selected, then the selection index is -1 and the color button is set to the background color. The slider and polygon mode are set to the values found in the minimum selected surface.
        Specified by:
        valueChanged in interface javax.swing.event.ListSelectionListener
        Parameters:
        kEvent - The list selection event.
      • windowClosing

        public void windowClosing​(java.awt.event.WindowEvent event)
        Overrides method in JDialogBase so dialog isn't disposed, just hidden.
        Parameters:
        event - Event that triggered this method.
      • buildToolBar

        private void buildToolBar()
        Build the toolbar.
      • changePolyMode

        private void changePolyMode​(int mode)
        Changes the polygon mode of the selected surface by detaching it, calling the appropriate method, and reattaching it.
        Parameters:
        mode - The new polygon mode to set.
      • containsMesh

        private SurfaceAttributes[] containsMesh​(ModelTriangleMesh kOld)
        containsMesh returns the SurfaceAttributes[] containing the input ModelTriangleMesh parameter, where the SurfaceAttributes[] array is of length 1. If the input mesh is not in the scene graph, then null is returned.
        Parameters:
        kOld - the ModelTriangleMesh that is being searched for in the scene graph
        Returns:
        SurfaceAttributes[1], an array of 1 containing the SurfaceAttributes describing the input mesh, null if the mesh is not found.
      • createLabel

        private javax.swing.JLabel createLabel​(java.lang.String title)
        Creates a label in the proper font and color.
        Parameters:
        title - The title of the label.
        Returns:
        The new label.
      • createSurface

        private void createSurface​(SurfaceAttributes surface,
                                   boolean pickable)
        Creates a surface in the scene graph from an array of triangle meshes.
        Parameters:
        surface - Triangle meshes that make up surface
        pickable - Color of surface
      • decimate

        private void decimate​(SurfaceAttributes[] surfaces)
        Decimate the surface.
        Parameters:
        surfaces - DOCUMENT ME!
      • displayAdvancedMaterialOptions

        private void displayAdvancedMaterialOptions​(SurfaceAttributes[] surfaces)
        For each file in the selected list, launch the AdvancedMaterialOptions dialog:
        Parameters:
        surfaces - the list of selected surfaces (SurfaceAttributes)
      • displayImageAsTexture

        private void displayImageAsTexture​(SurfaceAttributes[] surfaces)
        Displays the selected surfaces with the ModelImage as a 3D texture map on the surface triangle mesh.
        Parameters:
        surfaces - the list of selected surfaces (SurfaceAttributes)
      • displayStereo

        private void displayStereo​(SurfaceAttributes[] surfaces)
        For each file in the selected list, launch the stereo viewer:
        Parameters:
        surfaces - the list of selected surfaces (SurfaceAttributes)
      • doPick

        private com.sun.j3d.utils.picking.PickResult doPick​(java.awt.event.MouseEvent kEvent)
        Locate the surface that corresponds to a picking operation in the viewer window. This member is called via the mouse listener callback. If a surface is picked, the list box is updated to show that the surface is selected and the corresponding information is set for the color button, the detail slider, and the number of triangles.
        Parameters:
        kEvent - The mouse event generated by the picking operation.
        Returns:
        The picked surface, or null if no surface is located at the pick location.
      • enableStaticLightBehavior

        private void enableStaticLightBehavior​(boolean flag)
        Enable static light behavior.
        Parameters:
        flag - true enable and false disable.
      • getColorChange

        private void getColorChange​(java.awt.Color color)
        This is called when the user chooses a new color for the surface. It changes the color of the surface.
        Parameters:
        color - Color to change surface to.
      • getSelectedSurfaces

        private SurfaceAttributes[] getSelectedSurfaces​(int[] aiSelected)
        Returns an array of SurfaceAttributes based on which surfaces are selected by the user in the surfaceList combo-box. Only surfaces are selected, VOI points are ignored.
        Parameters:
        aiSelected - the list of selected indices in the surfaceList
        Returns:
        an array of SurfaceAttributes that contains the corresponding list of surfaces from the surfaceVector.
      • init

        private void init()
        Initializes the GUI components.
      • initSphere

        private void initSphere()
        Initialize the sphere scene graph objects for the sphere showing where the user clicked in the surface.
      • isStaticLightEnabled

        private boolean isStaticLightEnabled()
        Check static light is enable or not.
        Returns:
        staticLightEnable true means enable, false means disable.
      • isStaticPicked

        private boolean isStaticPicked()
        Indicates whether the static light bulb being picked by the mouse.
        Returns:
        whether the static light bulb is being picked
      • polygonIndexToMode

        private int polygonIndexToMode​(int index)
        Convert from the polygon mode combo-box list index to the PolygonAttributes.POLYGON_LINE, PolygonAttributes.POLYGON_POINT, and PolygonAttributes.POLYGON_FILL values:
        Parameters:
        index - the index of the selected polygon mode in the polygonModeCB combo box.
        Returns:
        the corresponding PolygonAttributes defined value.
      • readSurface

        private void readSurface​(java.lang.String dir,
                                 java.io.File surfaceFile,
                                 float surfaceOpacity)
        Adding the surface with specific directory, file name, and surfaceOpacity.
        Parameters:
        dir - directory name
        surfaceFile - file name
        surfaceOpacity - opacity
      • removeSurfaces

        private void removeSurfaces​(SurfaceAttributes[] surfaces)
        The action taken when the Remove button is clicked in the list box. All selected surfaces in the list box are removed from the scene graph.
        Parameters:
        surfaces - the selected surfaces (SurfaceAttributes[]) to be removed.
      • setBackface

        private void setBackface​(SurfaceAttributes[] surfaces)
        Turns BackFace Culling on/off for the selected surfaces.
        Parameters:
        surfaces - the list of selected surfaces (SurfaceAttributes)
      • setClipping

        private void setClipping​(SurfaceAttributes[] surfaces)
        Turns Clipping on/off for the selected surfaces.
        Parameters:
        surfaces - the list of selected surfaces (SurfaceAttributes)
      • setElementsEnabled

        private void setElementsEnabled​(boolean flag)
        Sets the surface options GUI panel to enabled or disabled. If there are 0 or multiple surfaces selected, all the options should be disabled.
        Parameters:
        flag - Enable or disable.
      • setPickable

        private void setPickable​(SurfaceAttributes[] surfaces)
        Turns picking on/off for the selected surfaces.
        Parameters:
        surfaces - the list of selected surfaces (SurfaceAttributes)
      • setTransparency

        private void setTransparency​(SurfaceAttributes[] surfaces)
        Turns Transparency on/off for the selected surfaces.
        Parameters:
        surfaces - the list of selected surfaces (SurfaceAttributes)
      • setupLights

        private void setupLights​(javax.media.j3d.TransformGroup surfaceRoot)
        Create and initialize the nine lights in the scene graph. The first eight lights are positioned at the eight vertices of the cube [-1,1]^3. Light 0 is at (-1,-1,-1) and light 7 is at (1,1,1), both enabled by default. The default color for all lights is white. The default intensity is 1. All surfaces in the scene are illuminated by all enabled lights. The ninth light is ambient light, light that seems to come from all directions.
        Parameters:
        surfaceRoot - Transform group to attach lights to.
      • smoothSurface

        private void smoothSurface​(SurfaceAttributes[] surfaces,
                                   int smoothType)
        Smoothes the selected surfaces. One dialog per group of selected surfaces is displayed (not a different dialog per-serface).
        Parameters:
        surfaces - the list of selected surfaces (SurfaceAttributes)
        smoothType - the level of smoothing JDialogSmoothMesh.SMOOTH1, JDialogSmoothMesh.SMOOTH2, or JDialogSmoothMesh.SMOOTH3
      • updateSurfaceNameList

        private void updateSurfaceNameList​(int[] selected)
        Called when surfaces are added or removed from the surfaceVector SurfaceAttributes list. Updates the surfaceList combo-box displayed in the user-interface.
        Parameters:
        selected - array of names that are currently selected.
      • updateSurfaceRender

        private void updateSurfaceRender​(boolean bUpdateProbe)
        Updates the SurfaceRenderer.
        Parameters:
        bUpdateProbe - when true update the ProbeDialog.