Class JPanelSurface_WM

All Implemented Interfaces:
ActionListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, ChangeListener, ListSelectionListener, RootPaneContainer, WindowConstants

public class JPanelSurface_WM extends JInterfaceBase implements ListSelectionListener, ChangeListener
See Also:
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      Use serialVersionUID for interoperability.
      See Also:
    • volumeCoordsCheck

      private JCheckBox volumeCoordsCheck
      loads mesh files in basic volume coordinates
    • fixedColor

      private static WildMagic.LibFoundation.Mathematics.ColorRGB[] fixedColor
      The colors for the surfaces.
    • areaLabel

      private JLabel areaLabel
      The area label.
    • areaText

      private JTextField areaText
      Displays the area of triangle.
    • colorButton

      private JButton colorButton
      The color button, which calls a color chooser.
    • colorLabel

      private JLabel colorLabel
      The color button label.
    • comboLabel

      private JLabel comboLabel
      The polygon mode combo box label.
    • decimateButton

      private JButton decimateButton
      Decimate button.
    • detailLabel

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

      private JSlider detailSlider
      Level of detail slider.
    • detailSliderLabels

      private JLabel[] detailSliderLabels
      The labels below the detail slider.
    • saveSurfaceButton

      private JButton saveSurfaceButton
      Save surface button.
    • savePLYSurfaceButton

      private JButton savePLYSurfaceButton
      Save .PLY surface button.
    • saveSTLSurfaceButton

      private JButton saveSTLSurfaceButton
      Save .STL surface button.
    • m_kSurfacePaint

      private SurfacePaint_WM m_kSurfacePaint
      Paint tool-bar (contained in the SurfacePaint class)
    • m_kAdvancedMaterialOptionsButton

      private JButton m_kAdvancedMaterialOptionsButton
      The material options button, which launches the material editor window.
    • m_kSurfaceTextureButton

      private JButton m_kSurfaceTextureButton
      Opens SurfaceTexture dialog:.
    • opacityLabel

      private JLabel opacityLabel
      The opacity slider label.
    • opacitySlider

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

      private JLabel[] opacitySliderLabels
      The labels below the opacity slider.
    • polygonModeCB

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

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

      private JButton invertNormals
      Smooth button.
    • smooth1Button

      private JButton smooth1Button
      Smooth button.
    • smooth2Button

      private JButton smooth2Button
      Smooth button.
    • smooth3Button

      private JButton smooth3Button
      Smooth button.
    • convexHull

      private JButton convexHull
      Smooth button.
    • subdivideTriangles

      private JButton subdivideTriangles
      Smooth button.
    • extractConnected

      private JButton extractConnected
      Smooth button.
    • polylineList

      private JList polylineList
      Polyline list box in the dialog for surfaces.
    • surfaceList

      private JList<String> surfaceList
      The list box in the dialog for surfaces.
    • listModel

      private DefaultListModel<String> listModel
    • surfacePickableCB

      private JCheckBox surfacePickableCB
      Check Box for surface picking.
    • surfaceBackFaceCB

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

      private JCheckBox surfaceClipCB
      Check Box for surface clpping of the volume render.
    • surfaceTransparencyCB

      private JCheckBox surfaceTransparencyCB
      Check Box for surface transparency.
    • triangleLabel

      private JLabel triangleLabel
      The number of triangles label.
    • triangleText

      private JTextField triangleText
      Displays the number of triangles.
    • volumeLabel

      private JLabel volumeLabel
      The volume label.
    • volumeText

      private JTextField volumeText
      Displays the volume of triangle.
    • polylineCounterList

      private DefaultListModel polylineCounterList
      Polyline counter list invalid input: '<'index, groupID>
    • polylineCounter

      private int polylineCounter
      constant polyline counter
    • decimationPercentage

      private double decimationPercentage
      Decimation Percentage
    • tmesh

      private TriangleMesh[] tmesh
      triangle mesh for decimation.
    • m_akSurfaceStates

      private Vector<SurfaceState> m_akSurfaceStates
  • Constructor Details

    • JPanelSurface_WM

      public JPanelSurface_WM(VolumeTriPlanarInterface kVolumeViewer)
      Constructor.
      Parameters:
      kVolumeViewer - parent frame.
  • Method Details

    • getNewSurfaceColor

      public static WildMagic.LibFoundation.Mathematics.ColorRGB 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(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 ActionListener
      Parameters:
      event - The action event.
    • addSurface

      private 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.
    • getSurfaceStates

      public Vector<SurfaceState> getSurfaceStates()
    • setSurfaceStates

      public void setSurfaceStates(Vector<SurfaceState> kSurfaces)
    • addSurfaces

      public void addSurfaces(WildMagic.LibGraphics.SceneGraph.TriMesh[] akSurfaces)
      Add surfaces to the Volume Tri-Planar renderer.
      Parameters:
      akSurfaces - new surfaces.
    • changePolyMode

      public void changePolyMode(WildMagic.LibGraphics.Rendering.WireframeState.FillMode 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.
    • disposeLocal

      public void disposeLocal()
      Dispose the local 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.
    • getSelectedSurface

      public String getSelectedSurface()
      Return the name of the selected surface.
      Returns:
      name of the selected surface.
    • getSelectedSurfaces

      public String[] getSelectedSurfaces()
      Return the names of the selected surfaces.
      Returns:
      names of the selected surfaces.
    • ImageAsTexture

      public void ImageAsTexture(boolean bTextureOn, boolean bUseNewImage, boolean bUseNewLUT)
      Turn surface texture on/off.
      Parameters:
      bTextureOn - texture on/off.
      bUseNewImage - when true use the user-specified ModelImage, when false use default ModelImage.
      bUseNewLUT - when true use the user-specified LUT, when false use the defaulet LUT.
    • isSurfacePickableSelected

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

      public void resizePanel(int panelWidth, int frameHeight)
      Resizing the control panel with ViewJFrameVolumeView's frame width and height.
      Parameters:
      panelWidth - int width
      frameHeight - int height
    • setButtonColor

      public void setButtonColor(JButton _button, Color _color)
      Description copied from class: JInterfaceBase
      Set the color of the button. Derived classes may also perform other functions.
      Overrides:
      setButtonColor in class JInterfaceBase
      Parameters:
      _button - button.
      _color - color.
    • setDropperColor

      public void setDropperColor(WildMagic.LibFoundation.Mathematics.ColorRGBA kDropperColor, WildMagic.LibFoundation.Mathematics.Vector3f kPickPoint)
      Set the paint can color.
      Parameters:
      kDropperColor - color.
      kPickPoint - picked point on the surface.
    • SetImageNew

      public void SetImageNew(ModelImage kImage)
      Set the user-specified ModelImage to use as the surface texture.
      Parameters:
      kImage - ModelImage to use as the surface texture.
    • SetLUTNew

      public void SetLUTNew(ModelStorageBase kLUT)
      Set the user-specified LUT for surface texture.
      Parameters:
      kLUT - ModelLUT
      kRGBT - ModelRGB for color images.
    • setMaterial

      public void setMaterial(WildMagic.LibGraphics.Rendering.MaterialState 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
    • stateChanged

      public void stateChanged(ChangeEvent event)
      Specified by:
      stateChanged in interface ChangeListener
    • surfaceAdded

      public boolean surfaceAdded()
      Returns true if a surface exists in the Renderer.
      Returns:
      true if a surface exists in the Renderer.
    • toggleGeodesicPathDisplay

      public void toggleGeodesicPathDisplay(int iWhich)
      Toggle which type of Geodesic is displayed on the surface (Euclidian, Dijkstra, Geodesic).
      Parameters:
      iWhich - type of Geodesic is displayed on the surface (Euclidian, Dijkstra, Geodesic).
    • valueChanged

      public void valueChanged(ListSelectionEvent kEvent)
      Specified by:
      valueChanged in interface ListSelectionListener
    • getSelected

      public int getSelected()
    • setSelected

      public void setSelected(int i)
    • updateSelected

      private void updateSelected(int i)
    • addPolyline

      public void addPolyline()
      Add polyline to the render.
    • buildToolBar

      private void buildToolBar()
      Build the toolbar.
    • createLabel

      private JLabel createLabel(String title)
      Creates a label in the proper font and color.
      Parameters:
      title - The title of the label.
      Returns:
      The new label.
    • decimate

      private void decimate(int[] aiSelected)
      Decimate the selected surfaces.
      Parameters:
      aiSelected - selected surfaces.
    • invertNormals

      private void invertNormals(int[] aiSelected)
      Decimate the selected surfaces.
      Parameters:
      aiSelected - selected surfaces.
    • extractConnectedComponents

      private void extractConnectedComponents(int[] aiSelected)
      Decimate the selected surfaces.
      Parameters:
      aiSelected - selected surfaces.
    • convexHull

      private void convexHull(int[] aiSelected)
    • CalcMinMaxEdgeLength

      private float[] CalcMinMaxEdgeLength(WildMagic.LibGraphics.SceneGraph.TriMesh mesh)
    • subDivideTriangles

      private void subDivideTriangles(int[] aiSelected)
    • convexHull

      private WildMagic.LibGraphics.SceneGraph.TriMesh convexHull(WildMagic.LibGraphics.SceneGraph.TriMesh mesh)
    • displayAdvancedMaterialOptions

      private void displayAdvancedMaterialOptions(int[] aiSelected)
      Display the Surface Material dialog for the selected surfaces.
      Parameters:
      aiSelected - the selected surfaces.
    • init

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

      private WildMagic.LibGraphics.Rendering.WireframeState.FillMode 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.
    • fillModeToPolygonIndex

      private int fillModeToPolygonIndex(WildMagic.LibGraphics.Rendering.WireframeState.FillMode mode)
    • removePolyline

      private void removePolyline()
      Remove polyline from the render
    • removeSurface

      private void removeSurface()
      Remove the selected surfaces.
    • removeUnusedVertices

      private WildMagic.LibGraphics.SceneGraph.TriMesh removeUnusedVertices(WildMagic.LibGraphics.SceneGraph.TriMesh kMesh)
    • saveSurfaces

      private void saveSurfaces(int[] aiSelected, String kCommand)
      Save the selected surfaces. The kCommand parameter determines the file type.
      Parameters:
      aiSelected - selected surfaces.
      kCommand - save command, specifies the file type.
    • saveProstateSurfaces

      private void saveProstateSurfaces(int[] aiSelected, String kCommand)
      Save the selected surfaces. The kCommand parameter determines the file type.
      Parameters:
      aiSelected - selected surfaces.
      kCommand - save command, specifies the file type.
    • setBackface

      private void setBackface(int[] aiSelected)
      Turn backface culling on/off for the selected surfaces.
      Parameters:
      aiSelected - selected surfaces.
    • setClipping

      private void setClipping(int[] aiSelected)
      Turns Clipping on/off for the selected surfaces.
      Parameters:
      aiSelected - 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(int[] aiSelected)
      Turn picking culling on/off for the selected surfaces.
      Parameters:
      aiSelected - selected surfaces.
    • setTransparency

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

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