SMTK
@SMTK_VERSION@
Simulation Modeling Tool Kit
|
A VTK geometry provider for the VTK session. More...
#include <Geometry.h>
Public Types | |
using | CacheBaseType = smtk::extension::vtk::geometry::Geometry |
using | DataType = Superclass::DataType |
![]() | |
using | GenerationNumber = Geometry::GenerationNumber |
using | DataType = typename smtk::extension::vtk::geometry::Geometry ::DataType |
using | BoundingBox = Geometry::BoundingBox |
using | Visitor = Geometry::Visitor |
![]() | |
enum | Purpose { Surface, Glyph, Label } |
The contextual purpose of geometry supplied by the provider. More... | |
using | DataType = vtkSmartPointer< vtkDataObject > |
![]() | |
using | DataType = vtkSmartPointer< vtkDataObject > |
![]() | |
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::session::vtk::Geometry) | |
smtkSuperclassMacro (smtk::geometry::Cache< CacheBaseType >) | |
Geometry (const std::shared_ptr< smtk::session::vtk::Resource > &parent) | |
smtk::geometry::Resource::Ptr | resource () const override |
Every provider must indicate the resource it provides geometry for. | |
void | queryGeometry (const smtk::resource::PersistentObject::Ptr &obj, CacheEntry &entry) const override |
Create a geometric representation of an object on demand. More... | |
int | dimension (const smtk::resource::PersistentObject::Ptr &obj) const override |
Purpose | purpose (const smtk::resource::PersistentObject::Ptr &obj) const override |
void | update () const override |
void | geometricBounds (const DataType &, BoundingBox &bbox) const override |
![]() | |
smtkTypeMacro (Cache) | |
smtkSharedFromThisMacro (Geometry) | |
smtkSuperclassMacro (smtk::extension::vtk::geometry::Geometry) | |
GenerationNumber | generationNumber (const smtk::resource::PersistentObject::Ptr &obj) const override |
Return the generation number of geometry held by the cache for the given object. More... | |
void | bounds (const smtk::resource::PersistentObject::Ptr &obj, BoundingBox &bds) const override |
Return the geometric bounds. | |
DataType & | data (const smtk::resource::PersistentObject::Ptr &obj) const override |
Provide access to the actual cached geometry reference. | |
void | visit (Visitor visitor) const override |
Visit each persistent object that has renderable geometry. More... | |
void | markModified (const smtk::resource::PersistentObject::Ptr &obj) override |
Remove a cache entry's geometry (but keep its generation number intact). More... | |
bool | erase (const smtk::common::UUID &uid) override |
Remove a cache entry completely. More... | |
![]() | |
smtkTypeMacro (smtk::extension::vtk::geometry::Geometry) | |
smtkSuperclassMacro (smtk::geometry::GeometryForBackend< DataType >) | |
const Backend & | backend () 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. | |
![]() | |
smtkTypeMacro (GeometryForBackend) | |
smtkSuperclassMacro (Geometry) | |
virtual void | update () const |
virtual vtkSmartPointer< vtkDataObject > & | data (const resource::PersistentObject::Ptr &) const=0 |
Return the data associated with an object. More... | |
![]() | |
smtkTypeMacroBase (Geometry) | |
GenerationNumber | lastModified () const |
Indication of when the geometry has last been updated. More... | |
virtual GenerationNumber | generationNumber (const resource::PersistentObject::Ptr &) const =0 |
Query methods. More... | |
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 | markModified (const resource::PersistentObject::Ptr &obj)=0 |
Modfication methods. More... | |
Static Public Member Functions | |
static int | dimensionOf (const DataType &geom, const smtk::model::EntityPtr &ent) |
![]() | |
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 Member Functions | |
void | updateEntity (const smtk::model::EntityPtr &, CacheEntry &entry) const |
Protected Attributes | |
std::weak_ptr< smtk::session::vtk::Resource > | m_parent |
![]() | |
std::map< smtk::common::UUID, CacheEntry > | m_cache |
![]() | |
Backend | m_backend |
![]() | |
std::atomic< GenerationNumber > | m_lastModified |
Additional Inherited Members | |
![]() | |
static constexpr GenerationNumber | Invalid |
static constexpr GenerationNumber | Initial |
![]() | |
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). | |
A VTK geometry provider for the VTK session.
|
overridevirtual |
Create a geometric representation of an object on demand.
Subclasses should override this unless the resource keeps the cache up to date via some other method not provided by this class. In that case, the provided implementation should never be invoked; if it is, it will result in cache entries being deleted.
This method should always edit the cache entry, either by marking it invalid (assigning Invalid to m_generation) or updating the geometry in m_geometry. This method should never modify the cache itself.
Anything that calls this method is responsible for checking whether existing cache entries are up to date before calling this method. Only call this when the cache must be updated.
If the cache entry is valid upon entry, this method should either update the geometry and increment the generation number or mark the cache entry as invalid.
Returning the the entry in an invalid state indicates that the object has no geometric representation and any existing cache entry will be removed.
Reimplemented from smtk::geometry::Cache< smtk::extension::vtk::geometry::Geometry >.