Simulation Modeling Tool Kit
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
smtk::session::polygon::vtk::Geometry Class Reference

A VTK geometry provider for the polygon session. More...

#include <Geometry.h>

Inheritance diagram for smtk::session::polygon::vtk::Geometry:
Collaboration diagram for smtk::session::polygon::vtk::Geometry:

Public Types

using CacheBaseType = smtk::extension::vtk::geometry::Geometry
using DataType = Superclass::DataType
using VertexPtr = internal::VertexPtr
using EdgePtr = internal::EdgePtr
using PolyModel = internal::pmodel *
- Public Types inherited from smtk::geometry::Cache< smtk::extension::vtk::geometry::Geometry >
using GenerationNumber = Geometry::GenerationNumber
using DataType = typename smtk::extension::vtk::geometry::Geometry ::DataType
using BoundingBox = Geometry::BoundingBox
using Visitor = Geometry::Visitor
- Public Types inherited from smtk::extension::vtk::geometry::Geometry
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::session::polygon::vtk::Geometry)
 smtkSuperclassMacro (smtk::geometry::Cache< CacheBaseType >)
 Geometry (const std::shared_ptr< smtk::session::polygon::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
- Public Member Functions inherited from smtk::geometry::Cache< smtk::extension::vtk::geometry::Geometry >
 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...
- Public Member Functions inherited from smtk::extension::vtk::geometry::Geometry
 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 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)
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...

Protected Member Functions

void updateVertex (const PolyModel &, const VertexPtr &, CacheEntry &entry) const
void updateEdge (const PolyModel &, const EdgePtr &, CacheEntry &entry) const
void updateFace (const PolyModel &, const smtk::model::EntityPtr &, CacheEntry &entry) const

Protected Attributes

std::weak_ptr< smtk::session::polygon::Resourcem_parent
- Protected Attributes inherited from smtk::geometry::Cache< smtk::extension::vtk::geometry::Geometry >
std::map< smtk::common::UUID, CacheEntry > m_cache
- Protected Attributes inherited from smtk::extension::vtk::geometry::Geometry
Backend m_backend
- Protected Attributes inherited from smtk::geometry::Geometry
std::atomic< GenerationNumberm_lastModified

Additional Inherited Members

- Static Public Member Functions inherited from smtk::extension::vtk::geometry::Geometry
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...
- Static Public Attributes inherited from smtk::geometry::Cache< smtk::extension::vtk::geometry::Geometry >
static constexpr GenerationNumber Invalid
static constexpr GenerationNumber Initial
- 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 VTK geometry provider for the polygon session.

Member Function Documentation

◆ queryGeometry()

void smtk::session::polygon::vtk::Geometry::queryGeometry ( const smtk::resource::PersistentObject::Ptr &  ,
CacheEntry &  cache 
) const

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 >.

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