Class SurfaceAttributes
java.lang.Object
gov.nih.mipav.view.renderer.J3D.surfaceview.SurfaceAttributes
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
FieldsModifier and TypeFieldDescriptionprivate floatTotal area of triangle meshes.private javax.vecmath.Point3fSurface center.private javax.vecmath.Color4fColor of surface.private StringThe full path to the surface file.private booleantrueindicates that this surface is a clod mesh,falsethat it is a standard triangle mesh; clod meshes can change level of detail, triangle meshes cannot.private intDetail level of surface; only applies to clod meshes.private javax.media.j3d.MaterialSurface Material.private StringName of surface displayed in list box.private intTotal number of triangles in the meshes.private floatopacity of surface.private javax.vecmath.Color4f[][]Color of surface.private intPolygon mode of surface, one of PolygonAttribute.POLYGON_FILL, PolygonAttribute.POLYGON_LINE, or PolygonAttribute.POLYGON_POINT.private javax.media.j3d.BranchGroupSurface subtree, holds all the Shape3D objects that make up the surface.private BitSetmSurfaceMask represents the intersection of the ModelImage volume data with the triangle-meshes.private javax.media.j3d.Shape3D[]Shape3D[] arrayprivate ModelTriangleMesh[]ModelTriangleMesh.private floatTotal volume of triangle meshes. -
Constructor Summary
ConstructorsConstructorDescriptionSurfaceAttributes(ModelTriangleMesh[] mesh, String fullPath, String name) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionprivate voidStores the per-vertex colors when the material is set -- used to restore per-vertex color from the AdvancedMaterials dialog.private javax.media.j3d.MaterialcopyMaterial(javax.media.j3d.Material material) floatgetArea()Return the surface area of the ModelTriangleMesh objects.javax.media.j3d.BranchGroupreturns the BranchGroup from the scene graphjavax.vecmath.Point3fGets the center of the ModelTriangleMesh objects.javax.vecmath.Color3fGets a Color3f copy of the surface color.javax.vecmath.Color4fGets the surface color.WildMagic.LibFoundation.Mathematics.ColorRGBAGets the surface color.Returns the file pathname of the surface, if the surface was loaded from file.booleanReturns if the mesh is type ClodMesh or ModelTriangleMesh.intreturns the level of detailgetMask()returns the surface mask datajavax.media.j3d.Materialreturns a new copy of the Material.getMesh()returns the array of ModelTriangleMesh objects.getName()Returns the file name of the surface, if the surface was loaded from file.intGets the number of triangles of the ModelTriangleMesh objects.floatreturns the surface opacityjavax.vecmath.Color4f[][]Get the per-vertex color array.intReturns the polgyon mode.javax.media.j3d.Shape3D[]getShape()returns the array of Shape3D objects.floatGets the surface volume.voidrestorePerVertexColors(javax.media.j3d.Material material) Restores the ModelTriangleMesh per-vertex colors to the saved per-vertex colors.voidRestores the ModelTriangleMesh per-vertex colors to the surface color.voidsetArea(float area) Sets the value of the surface area of the ModelTriangleMesh objects.voidsetBranch(javax.media.j3d.BranchGroup branch) sets the BranchGroup in the scene graph that renders the surface.voidsetColor(javax.vecmath.Color4f color) Sets the surface color.voidsetIsClodMesh(boolean isClod) Sets the clod mesh flag.voidsetLevelDetail(int levelDetail) sets the level of detail for the ClodMeshvoidSets the volume mask data -- the intersection of the triangle mesh with the volume data.voidsetMaterial(javax.media.j3d.Material material) sets the surface Material. the Material diffuse color is used to set the color value as well.voidsetMesh(ModelTriangleMesh[] mesh) sets the array of ModelTriangleMesh objects:voidsetNumberTriangles(int nTriangles) Sets the number of triangles of the ModelTriangleMesh objects.voidsetOpacity(float opacity) sets the surface Opacity.voidsetPerVertexColorArray(javax.vecmath.Color4f[] color, int index) Set the per-vertex color array.voidsetPolygonMode(int mode) Sets the surface polygon mode.voidsetShape(javax.media.j3d.Shape3D[] surfaceShape) sets the array of Shape3D objects:voidsetVolume(float volume) Sets the value of the surface volume.
-
Field Details
-
mIsClodMesh
private boolean mIsClodMeshtrueindicates that this surface is a clod mesh,falsethat it is a standard triangle mesh; clod meshes can change level of detail, triangle meshes cannot. -
mTriangleMesh
ModelTriangleMesh. -
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 mSurfaceBranchGroupSurface subtree, holds all the Shape3D objects that make up the surface. -
mSurfaceShape
private javax.media.j3d.Shape3D[] mSurfaceShapeShape3D[] array -
mColor
private javax.vecmath.Color4f mColorColor of surface. -
mPerVertexColors_Backup
private javax.vecmath.Color4f[][] mPerVertexColors_BackupColor of surface. -
mMaterial
private javax.media.j3d.Material mMaterialSurface Material. -
mOpacity
private float mOpacityopacity of surface. -
mLevelDetail
private int mLevelDetailDetail level of surface; only applies to clod meshes. -
mPolygonMode
private int mPolygonModePolygon mode of surface, one of PolygonAttribute.POLYGON_FILL, PolygonAttribute.POLYGON_LINE, or PolygonAttribute.POLYGON_POINT. -
mFullPath
The full path to the surface file. -
mName
Name of surface displayed in list box. -
mNumberTriangles
private int mNumberTrianglesTotal number of triangles in the meshes. Changes with level of detail. -
mVolume
private float mVolumeTotal volume of triangle meshes. Changes with level of detail. -
mArea
private float mAreaTotal area of triangle meshes. Changes with level of detail. -
mCenter
private javax.vecmath.Point3f mCenterSurface center.
-
-
Constructor Details
-
SurfaceAttributes
Constructor. Most common usage of SurfaceAttributes.- Parameters:
mesh- array of ModelTriangleMesh objects the SurfaceAttributes describesfullPath- directory/file name containing the triangle meshname- file name
-
-
Method Details
-
setMesh
sets the array of ModelTriangleMesh objects:- Parameters:
mesh- array of ModelTriangleMesh objects.
-
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
Sets the volume mask data -- the intersection of the triangle mesh with the volume data.- Parameters:
mask- the BitSet mask data
-
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
Returns the file name of the surface, if the surface was loaded from file.- Returns:
- mName, the surface file name, or surface name.
-
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.
-