Class MoMeshCellShape

All Implemented Interfaces:
SafeDisposable

public class MoMeshCellShape extends MoMeshRepresentation
Rendering node that displays a set of cells of a mesh.

This node renders an unstructured surface mesh defined by a set of cells in the original mesh. The set of cells to be rendered is specified by a list of cell indices. The size of the rendered cells can be scaled up or down using the scaleFactor field and annotation of the cell and node names can optionally be displayed.

The cell name annotated is defined in the following way:

  • if a MoStringSet node is inherited in the scene graph with the suitable type and DataBinding.PER_CELL binding, the cell name is defined by the string returned by MiStringSetI.get(long) or MiStringSetIj.get(long, long) or MiStringSetIjk.get(int, int, int).
    The suitable type depends on the mesh type handled by the inherited MoMesh instance. For instance if the MoMesh handles an unstructured mesh (see MiVolumeMeshUnstructured and MiSurfaceMeshUnstructured ) a suitable string set as cell name is of type MiStringSetI. If the MoMesh handles an MiVolumeMeshHexahedronIjk, a suitable string set as cell name is of type MiStringSetIjk. If several MoStringSet are inherited with the suitable string set type and PER_CELL binding, the last one on the state list is used.
  • if no suitable MoStringSet is inherited in the scene graph, the cell name is defined by the string corresponding to the serialization of its cell ids. For Ij or Ijk mesh type the ij or ijk ids are separated by commas.
The node name annotated is defined in the same way but the suitable binding is obviously DataBinding.PER_NODE.

The cells can be colored using a scalar set defined in the colorScalarSetId inherited field. This is an index into the list of scalar sets existing in the traversal state (see the MoScalarSetxxx nodes). To disable coloring set this field to -1.

See Also:
  • Field Details

    • inclusiveList

      public SoSFBool inclusiveList
      When set to true the cellIndices field will represent the list of cells to display and the list of cells to exclude otherwise.
      The default value is true
    • cellIndices

      public SoMFInt64 cellIndices
      Field representing the list of cells given by their index in the mesh.
      If the mesh is unstructured, each value of cellIndices represents one cell.
      If the mesh is a structured surface mesh, each cell is defined by a pair of indices (cellIndices(i), cellIndices(i+1)).
      If the mesh is a structured volume mesh, each cell is defined by three indices (cellIndices(i), cellIndices(i+1), cellIndices(i+2)).
      So, depending on the type of mesh, one, two or three indices are necessary to define each cell.

      Note: If the index list is empty, no cells are displayed when inclusiveList is set to true and all cells otherwise. By default, the list is empty.

    • factor

      public SoSFFloat factor
      Field representing the factor to resize extracted cells.
      A factor lower than one will shrink cells, whereas a factor greater than one will expand cells.
      The default value is 1.0, which will not resize cells.
    • showCellName

      public SoSFBool showCellName
      When set to true the cell's name is displayed near the cell. The default value is false.
      The documentation of this class describes how the cell's name is defined.
    • showNodeName

      public SoSFBool showNodeName
      When set to true the node's names are displayed near the cell. The default value is false.
      The documentation of this class describes how the node's name is defined.
      Note: For structured meshes, this field is not used since nodes are computed implicitly.
    • offset

      public SoSFFloat offset
      Field representing the distance to shift the display of node names away from the node coordinates.
      A negative offset will display node names inside the cell, whereas a positive offset will display them outside the cell.
      Note: The offset is relative to the cell's size if the relativeOffset field is set to true. Otherwise it represents an absolute distance.
      The default value is 0.1, which will slightly shift node names outside the cell.
    • relativeOffset

      public SoSFBool relativeOffset
      When set to true the distance between the node and the name to display is relative to the size of the cell.
      Note: For unstructured meshes, the offset field is then multiplied by the getRelativeSize() method from the cell interface. A default implementation of getRelativeSize() returns 1 which will leave the offset as an absolute distance. getRelativeSize() needs to be overloaded to activate this feature for unstructured mesh (see class MiCell).
      The default value is false.
  • Constructor Details

    • MoMeshCellShape

      public MoMeshCellShape()
      Constructs a rendering node with default options and cell indices list.
      • cellIndices is empty
      • inclusiveList = true
      • factor = 1
      • showCellName = false
      • showNodeName = false
      • offset = 0.1
      • relativeOffset = false
  • Method Details

    • getUnstructuredExtractor

      public MiCellExtractUnstructured getUnstructuredExtractor()
      Gets the cell extractor for unstructured meshes to reuse outside this node.
      Note: The returned object may be null if no unstructured mesh has been set in the scene graph or if no render action has traversed the scene graph.
      Returns:
      the cell extractor for unstructured meshes
    • getIjkExtractor

      public MiCellExtractIjk getIjkExtractor()
      Gets the cell extractor for IJK meshes to reuse outside this node.
      Note: The returned object may be null if no IJK mesh has been set in the scene graph or if no render action has traversed the scene graph.
      Returns:
      the cell extractor for IJK meshes
    • getHexahedronIjkExtractor

      public MiCellExtractHexahedronIjk getHexahedronIjkExtractor()
      Gets the cell extractor for hexahedron IJK meshes to reuse outside this node.
      Note: The returned object may be null if no hexahedron IJK mesh has been set in the scene graph or if no render action has traversed the scene graph.
      Returns:
      the cell extractor for hexahedron IJK meshes
    • getIjExtractor

      public MiCellExtractIj getIjExtractor()
      Gets the cell extractor for structured surface meshes to reuse outside this node.
      Note: The returned object may be null if no structured surface mesh has been set in the scene graph or if no render action has traversed the scene graph.
      Returns:
      the cell extractor for structured surface meshes