SMTK  @SMTK_VERSION@
Simulation Modeling Tool Kit
Public Types | Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
smtk::extension::vtk::geometry::Geometry Class Referenceabstract

A base class for geometry providers that will supply VTK data. More...

#include <Geometry.h>

Inheritance diagram for smtk::extension::vtk::geometry::Geometry:
[legend]
Collaboration diagram for smtk::extension::vtk::geometry::Geometry:
[legend]

Public Types

enum  Purpose { Surface, Glyph, Label }
 The contextual purpose of geometry supplied by the provider. More...
 
using DataType = vtkSmartPointer< vtkDataObject >
 
- Public Types inherited from smtk::geometry::GeometryForBackend< vtkSmartPointer< vtkDataObject > >
using DataType = vtkSmartPointer< vtkDataObject >
 
- Public Types inherited from smtk::geometry::Geometry
using GenerationNumber = size_t
 An integral type to hold monotonically increasing generation numbers (a.k.a. More...
 
using BoundingBox = std::array< double, 6 >
 A bounding box is represented as an array of 6 numbers, ordered xmin, xmax, ymin, ymax, zmin, zmax.
 
using Visitor = std::function< bool(const resource::PersistentObject::Ptr &, GenerationNumber)>
 The signature of functions used to visit all objects with tessellation data.
 
using Specification = std::tuple< smtk::resource::ResourcePtr, const smtk::geometry::Backend & >
 The data needed to request a geometry provider (a resource and backend). More...
 
using UniquePtr = std::unique_ptr< smtk::geometry::Geometry >
 The return type of the geometry-provider generator class. More...
 

Public Member Functions

 smtkTypeMacro (smtk::extension::vtk::geometry::Geometry)
 
 smtkSuperclassMacro (smtk::geometry::GeometryForBackend< DataType >)
 
const Backendbackend () const override
 Every provider must indicate the backend for which it is specialized.
 
virtual int dimension (const smtk::resource::PersistentObjectPtr &obj) const =0
 The VTK backend requires the parametric dimension of each object's geometry. More...
 
virtual Purpose purpose (const smtk::resource::PersistentObjectPtr &obj) const =0
 The VTK backend requires a purpose for each object's geometry.
 
- Public Member Functions inherited from smtk::geometry::GeometryForBackend< vtkSmartPointer< vtkDataObject > >
 smtkTypeMacro (GeometryForBackend)
 
 smtkSuperclassMacro (Geometry)
 
virtual void update () const
 
virtual void geometricBounds (const vtkSmartPointer< vtkDataObject > &, BoundingBox &) const=0
 
virtual vtkSmartPointer< vtkDataObject > & data (const resource::PersistentObject::Ptr &) const=0
 Return the data associated with an object. More...
 
- Public Member Functions inherited from smtk::geometry::Geometry
 smtkTypeMacroBase (Geometry)
 
virtual ResourcePtr resource () const =0
 Every provider must indicate the resource it provides geometry for.
 
GenerationNumber lastModified () const
 Indication of when the geometry has last been updated. More...
 
virtual GenerationNumber generationNumber (const resource::PersistentObject::Ptr &) const =0
 Return a monotonically increasing number that changes whenever the object's geometry changes.
 
virtual void bounds (const resource::PersistentObject::Ptr &, BoundingBox &bds) const =0
 Populate the bounds (bds) with the given object's bounds.
 
virtual bool readLockRequired () const
 Return true if the resource owning this geometryProvider must be read-locked before rendering prep. More...
 
virtual void visit (Visitor fn) const =0
 Visit each persistent object that has renderable geometry.
 
virtual void markModified (const resource::PersistentObject::Ptr &obj)=0
 Mark the object's geometry as modified. More...
 
virtual bool erase (const smtk::common::UUID &uid)=0
 Inform the geometry provider that an object is about to be or has been deleted. More...
 
virtual bool copyGeometry (const UniquePtr &sourceGeometry, smtk::resource::CopyOptions &options)
 This method is used by smtk::geometry::Resource::copyGeometry() to shallow-copy renderable geometry into a cloned/copied resource. More...
 

Static Public Member Functions

static void addColorArray (vtkDataObject *data, const std::vector< double > &color, const std::string &name="entity color")
 A convenience to add a field-data color array to a cache entry (used to set object color).
 
static bool addTransformArrayIfPresent (vtkDataObject *data, const std::shared_ptr< smtk::resource::PersistentObject > &object, const std::string &outputArrayName="transform")
 A convenience to add a field-data transform array the representation will apply to the data before rendering. More...
 

Protected Attributes

Backend m_backend
 
- Protected Attributes inherited from smtk::geometry::Geometry
std::atomic< GenerationNumberm_lastModified
 

Additional Inherited Members

- Static Public Attributes inherited from smtk::geometry::Geometry
static constexpr GenerationNumber Invalid = std::numeric_limits<GenerationNumber>::lowest()
 A special generation number that marks an object as having no geometric representation.
 
static constexpr GenerationNumber Initial = std::numeric_limits<GenerationNumber>::lowest() + 1
 The lowest valid generation number (which may be used as the initial value).
 

Detailed Description

A base class for geometry providers that will supply VTK data.

In addition to the data itself, VTK needs some information about the context of the data:

Member Enumeration Documentation

◆ Purpose

The contextual purpose of geometry supplied by the provider.

Enumerator
Surface 

Geometry is a set of cells representing a simulation manifold.

Glyph 

Geometry is a set of points with scalars representing orientation, scale, etc.

Label 

Geometry has a cell-scalar that indicates classification, possibly of multiple objects.

Member Function Documentation

◆ addTransformArrayIfPresent()

bool smtk::extension::vtk::geometry::Geometry::addTransformArrayIfPresent ( vtkDataObject *  data,
const std::shared_ptr< smtk::resource::PersistentObject > &  object,
const std::string &  outputArrayName = "transform" 
)
static

A convenience to add a field-data transform array the representation will apply to the data before rendering.

This method returns true if object has a CoordinateFrame property named "transform" or "smtk.geometry.transform" (because an array is added to data) and false otherwise.

Note that if object has CoordinateFrame values at both names, "transform" is preferred since it is more likely to be directly specified by an end user.

Note the outputArrayName is not the name of the property to examine, but the name to be assigned to an output VTK data-array (if any is created).

◆ dimension()

virtual int smtk::extension::vtk::geometry::Geometry::dimension ( const smtk::resource::PersistentObjectPtr obj) const
pure virtual

The VTK backend requires the parametric dimension of each object's geometry.

This is used to order rendering so that things of lower dimension are rendered to the z-buffer before objects of higher dimension (giving them priority so they are not obscured).


The documentation for this class was generated from the following files: