Class SurfaceAttributes

java.lang.Object
gov.nih.mipav.view.renderer.J3D.surfaceview.SurfaceAttributes

public class SurfaceAttributes extends Object
Class that holds the information about each surface displayed in the SurfaceRenderer. It is the main surface data structure used in the JPanelSurface, FileSurface, and SurfaceMask classes. SurfaceAttributes contains one or more triangle-mesh objects. The triangle-meshes may be of type ClodMesh or of type ModelTriangleMesh. The mIsClodMesh data member, when true indicates that the meshes are of type ClodMesh and when false indicates that the meshes are of type ModelTriangleMesh. Each data member represents global properties of all triangle meshes contained in this class. For example the area and volume values are the sums of the volumes and areas of each mesh contained in the object.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private float
    Total area of triangle meshes.
    private javax.vecmath.Point3f
    Surface center.
    private javax.vecmath.Color4f
    Color of surface.
    private String
    The full path to the surface file.
    private boolean
    true indicates that this surface is a clod mesh, false that it is a standard triangle mesh; clod meshes can change level of detail, triangle meshes cannot.
    private int
    Detail level of surface; only applies to clod meshes.
    private javax.media.j3d.Material
    Surface Material.
    private String
    Name of surface displayed in list box.
    private int
    Total number of triangles in the meshes.
    private float
    opacity of surface.
    private javax.vecmath.Color4f[][]
    Color of surface.
    private int
    Polygon mode of surface, one of PolygonAttribute.POLYGON_FILL, PolygonAttribute.POLYGON_LINE, or PolygonAttribute.POLYGON_POINT.
    private javax.media.j3d.BranchGroup
    Surface subtree, holds all the Shape3D objects that make up the surface.
    private BitSet
    mSurfaceMask represents the intersection of the ModelImage volume data with the triangle-meshes.
    private javax.media.j3d.Shape3D[]
    Shape3D[] array
    ModelTriangleMesh.
    private float
    Total volume of triangle meshes.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    private void
    Stores the per-vertex colors when the material is set -- used to restore per-vertex color from the AdvancedMaterials dialog.
    private javax.media.j3d.Material
    copyMaterial(javax.media.j3d.Material material)
     
    float
    Return the surface area of the ModelTriangleMesh objects.
    javax.media.j3d.BranchGroup
    returns the BranchGroup from the scene graph
    javax.vecmath.Point3f
    Gets the center of the ModelTriangleMesh objects.
    javax.vecmath.Color3f
    Gets a Color3f copy of the surface color.
    javax.vecmath.Color4f
    Gets the surface color.
    WildMagic.LibFoundation.Mathematics.ColorRGBA
    Gets the surface color.
    Returns the file pathname of the surface, if the surface was loaded from file.
    boolean
    Returns if the mesh is type ClodMesh or ModelTriangleMesh.
    int
    returns the level of detail
    returns the surface mask data
    javax.media.j3d.Material
    returns a new copy of the Material.
    returns the array of ModelTriangleMesh objects.
    Returns the file name of the surface, if the surface was loaded from file.
    int
    Gets the number of triangles of the ModelTriangleMesh objects.
    float
    returns the surface opacity
    javax.vecmath.Color4f[][]
    Get the per-vertex color array.
    int
    Returns the polgyon mode.
    javax.media.j3d.Shape3D[]
    returns the array of Shape3D objects.
    float
    Gets the surface volume.
    void
    restorePerVertexColors(javax.media.j3d.Material material)
    Restores the ModelTriangleMesh per-vertex colors to the saved per-vertex colors.
    void
    Restores the ModelTriangleMesh per-vertex colors to the surface color.
    void
    setArea(float area)
    Sets the value of the surface area of the ModelTriangleMesh objects.
    void
    setBranch(javax.media.j3d.BranchGroup branch)
    sets the BranchGroup in the scene graph that renders the surface.
    void
    setColor(javax.vecmath.Color4f color)
    Sets the surface color.
    void
    setIsClodMesh(boolean isClod)
    Sets the clod mesh flag.
    void
    setLevelDetail(int levelDetail)
    sets the level of detail for the ClodMesh
    void
    Sets the volume mask data -- the intersection of the triangle mesh with the volume data.
    void
    setMaterial(javax.media.j3d.Material material)
    sets the surface Material. the Material diffuse color is used to set the color value as well.
    void
    sets the array of ModelTriangleMesh objects:
    void
    setNumberTriangles(int nTriangles)
    Sets the number of triangles of the ModelTriangleMesh objects.
    void
    setOpacity(float opacity)
    sets the surface Opacity.
    void
    setPerVertexColorArray(javax.vecmath.Color4f[] color, int index)
    Set the per-vertex color array.
    void
    setPolygonMode(int mode)
    Sets the surface polygon mode.
    void
    setShape(javax.media.j3d.Shape3D[] surfaceShape)
    sets the array of Shape3D objects:
    void
    setVolume(float volume)
    Sets the value of the surface volume.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • mIsClodMesh

      private boolean mIsClodMesh
      true indicates that this surface is a clod mesh, false that it is a standard triangle mesh; clod meshes can change level of detail, triangle meshes cannot.
    • mTriangleMesh

      private ModelTriangleMesh[] mTriangleMesh
      ModelTriangleMesh.
    • mSurfaceMask

      private BitSet mSurfaceMask
      mSurfaceMask represents the intersection of the ModelImage volume data with the triangle-meshes. It is a filled-volume mask.
    • mSurfaceBranchGroup

      private javax.media.j3d.BranchGroup mSurfaceBranchGroup
      Surface subtree, holds all the Shape3D objects that make up the surface.
    • mSurfaceShape

      private javax.media.j3d.Shape3D[] mSurfaceShape
      Shape3D[] array
    • mColor

      private javax.vecmath.Color4f mColor
      Color of surface.
    • mPerVertexColors_Backup

      private javax.vecmath.Color4f[][] mPerVertexColors_Backup
      Color of surface.
    • mMaterial

      private javax.media.j3d.Material mMaterial
      Surface Material.
    • mOpacity

      private float mOpacity
      opacity of surface.
    • mLevelDetail

      private int mLevelDetail
      Detail level of surface; only applies to clod meshes.
    • mPolygonMode

      private int mPolygonMode
      Polygon mode of surface, one of PolygonAttribute.POLYGON_FILL, PolygonAttribute.POLYGON_LINE, or PolygonAttribute.POLYGON_POINT.
    • mFullPath

      private String mFullPath
      The full path to the surface file.
    • mName

      private String mName
      Name of surface displayed in list box.
    • mNumberTriangles

      private int mNumberTriangles
      Total number of triangles in the meshes. Changes with level of detail.
    • mVolume

      private float mVolume
      Total volume of triangle meshes. Changes with level of detail.
    • mArea

      private float mArea
      Total area of triangle meshes. Changes with level of detail.
    • mCenter

      private javax.vecmath.Point3f mCenter
      Surface center.
  • Constructor Details

    • SurfaceAttributes

      public SurfaceAttributes(ModelTriangleMesh[] mesh, String fullPath, String name)
      Constructor. Most common usage of SurfaceAttributes.
      Parameters:
      mesh - array of ModelTriangleMesh objects the SurfaceAttributes describes
      fullPath - directory/file name containing the triangle mesh
      name - file name
  • Method Details

    • setMesh

      public void setMesh(ModelTriangleMesh[] mesh)
      sets the array of ModelTriangleMesh objects:
      Parameters:
      mesh - array of ModelTriangleMesh objects.
    • getMesh

      public ModelTriangleMesh[] getMesh()
      returns the array of ModelTriangleMesh objects.
      Returns:
      mTriangleMesh, the array of ModelTriangleMesh objects.
    • setShape

      public void setShape(javax.media.j3d.Shape3D[] surfaceShape)
      sets the array of Shape3D objects:
      Parameters:
      surfaceShape - array of Shape3D objects.
    • getShape

      public javax.media.j3d.Shape3D[] getShape()
      returns the array of Shape3D objects.
      Returns:
      mSurfaceShape, the array of Shape3D objects.
    • setMaterial

      public void setMaterial(javax.media.j3d.Material material)
      sets the surface Material. the Material diffuse color is used to set the color value as well.
      Parameters:
      material - new surface Material.
    • backupColors

      private void backupColors()
      Stores the per-vertex colors when the material is set -- used to restore per-vertex color from the AdvancedMaterials dialog.
    • getPerVertexColorArray

      public javax.vecmath.Color4f[][] getPerVertexColorArray()
      Get the per-vertex color array.
      Returns:
      mPerVertexColors_Backup surface color array.
    • setPerVertexColorArray

      public void setPerVertexColorArray(javax.vecmath.Color4f[] color, int index)
      Set the per-vertex color array.
      Parameters:
      color - stored per vertex color array reference.
    • getMaterial

      public javax.media.j3d.Material getMaterial()
      returns a new copy of the Material.
      Returns:
      mMaterial, a new copy of the surface Material.
    • copyMaterial

      private javax.media.j3d.Material copyMaterial(javax.media.j3d.Material material)
    • setOpacity

      public void setOpacity(float opacity)
      sets the surface Opacity.
      Parameters:
      opacity - new opacity value.
    • getOpacity

      public float getOpacity()
      returns the surface opacity
      Returns:
      mOpacity, surface opacity.
    • setLevelDetail

      public void setLevelDetail(int levelDetail)
      sets the level of detail for the ClodMesh
      Parameters:
      levelDetail - the level of detail
    • getLevelDetail

      public int getLevelDetail()
      returns the level of detail
      Returns:
      mLevelDetail, the level of detail
    • setBranch

      public void setBranch(javax.media.j3d.BranchGroup branch)
      sets the BranchGroup in the scene graph that renders the surface.
      Parameters:
      branch - BranchGroup in the scenegraph
    • getBranch

      public javax.media.j3d.BranchGroup getBranch()
      returns the BranchGroup from the scene graph
      Returns:
      mSurfaceBranchGroup, the BranchGroup containing the mesh
    • setMask

      public void setMask(BitSet mask)
      Sets the volume mask data -- the intersection of the triangle mesh with the volume data.
      Parameters:
      mask - the BitSet mask data
    • getMask

      public BitSet getMask()
      returns the surface mask data
      Returns:
      mSurfaceMask, intersection of the triangle mesh with the volume data.
    • setIsClodMesh

      public void setIsClodMesh(boolean isClod)
      Sets the clod mesh flag.
      Parameters:
      isClod - when true the mesh is of type ClodMesh, when false the mesh is ModelTriangleMesh
    • getIsClodMesh

      public boolean getIsClodMesh()
      Returns if the mesh is type ClodMesh or ModelTriangleMesh.
      Returns:
      mIsClodMesh, true when the mesh is type ClodMesh, false when the mesh is type ModelTriangleMesh
    • getName

      public String getName()
      Returns the file name of the surface, if the surface was loaded from file.
      Returns:
      mName, the surface file name, or surface name.
    • getFullPath

      public String getFullPath()
      Returns the file pathname of the surface, if the surface was loaded from file.
      Returns:
      mFullPath, the surface pathname, or null.
    • restoreVertexColors

      public void restoreVertexColors()
      Restores the ModelTriangleMesh per-vertex colors to the surface color. Used to clear all paint or remove the per-vertex texture-based color.
    • restorePerVertexColors

      public void restorePerVertexColors(javax.media.j3d.Material material)
      Restores the ModelTriangleMesh per-vertex colors to the saved per-vertex colors.
      Parameters:
      material - the material to restore.
    • setColor

      public void setColor(javax.vecmath.Color4f color)
      Sets the surface color. Also sets the Material diffuse, specular, and ambient colors.
      Parameters:
      color - the new surface Color.
    • getColorRGBA

      public WildMagic.LibFoundation.Mathematics.ColorRGBA getColorRGBA()
      Gets the surface color.
      Returns:
      mColor, the surface color.
    • getColor4f

      public javax.vecmath.Color4f getColor4f()
      Gets the surface color.
      Returns:
      mColor, the surface color.
    • getColor3

      public javax.vecmath.Color3f getColor3()
      Gets a Color3f copy of the surface color.
      Returns:
      a Color3f copy of the surface color.
    • setPolygonMode

      public void setPolygonMode(int mode)
      Sets the surface polygon mode. PolygonAttributes.POLYGON_FILL, PolygonAttributes.POLYGON_LINE, or PolygonAttributes.POLYGON_POINT
      Parameters:
      mode - PolygonAttributes mode
    • getPolygonMode

      public int getPolygonMode()
      Returns the polgyon mode.
      Returns:
      mPolygonMode PolygonAttributes.POLYGON_FILL, PolygonAttributes.POLYGON_LINE, or PolygonAttributes.POLYGON_POINT
    • setVolume

      public void setVolume(float volume)
      Sets the value of the surface volume.
      Parameters:
      volume - the surface volume contained in the ModelTriangleMesh objects.
    • getVolume

      public float getVolume()
      Gets the surface volume.
      Returns:
      the volume contained within the ModelTriangleMesh objects.
    • setArea

      public void setArea(float area)
      Sets the value of the surface area of the ModelTriangleMesh objects.
      Parameters:
      area - the surface area of the ModelTriangleMesh objects.
    • getArea

      public float getArea()
      Return the surface area of the ModelTriangleMesh objects.
      Returns:
      area, the surface area of the ModelTriangleMesh objects.
    • setNumberTriangles

      public void setNumberTriangles(int nTriangles)
      Sets the number of triangles of the ModelTriangleMesh objects.
      Parameters:
      nTriangles - the number of triangles of the ModelTriangleMesh objects.
    • getNumberTriangles

      public int getNumberTriangles()
      Gets the number of triangles of the ModelTriangleMesh objects.
      Returns:
      nNumberTriangles, the number of triangles of the ModelTriangleMesh objects.
    • getCenter

      public javax.vecmath.Point3f getCenter()
      Gets the center of the ModelTriangleMesh objects.
      Returns:
      mCenter, the center of the ModelTriangleMesh objects.