attach vtk context to gcompose
This commit is contained in:
54
src/Vtk/vtkObjectsContext.h
Normal file
54
src/Vtk/vtkObjectsContext.h
Normal file
@@ -0,0 +1,54 @@
|
||||
#ifndef U_VTKOBJECTSCONTEXT_H
|
||||
#define U_VTKOBJECTSCONTEXT_H
|
||||
|
||||
#include <map>
|
||||
#include "Core/ObjectsContext.h"
|
||||
#include "uLibVtkInterface.h"
|
||||
|
||||
class vtkAssembly;
|
||||
|
||||
namespace uLib {
|
||||
namespace Vtk {
|
||||
|
||||
/**
|
||||
* @brief vtkObjectsContext manages VTK representations (Puppets) for a collection of uLib::Objects.
|
||||
*/
|
||||
class vtkObjectsContext : public uLib::Object, public Puppet {
|
||||
public:
|
||||
virtual const char* GetClassName() const override { return "vtkObjectsContext"; }
|
||||
vtkObjectsContext(uLib::ObjectsContext *context);
|
||||
virtual ~vtkObjectsContext();
|
||||
|
||||
/** @brief Synchronizes the VTK puppets with the core ObjectsContext. */
|
||||
void Synchronize();
|
||||
|
||||
/** @brief Returns the puppet associated with a specific core object. */
|
||||
Puppet* GetPuppet(uLib::Object* obj);
|
||||
|
||||
/** @brief Updates all managed puppets. */
|
||||
virtual void Update() override;
|
||||
|
||||
public:
|
||||
virtual void PuppetAdded(Puppet* puppet);
|
||||
virtual void PuppetRemoved(Puppet* puppet);
|
||||
|
||||
public:
|
||||
/** @brief Slot called when an object is added to the core context. */
|
||||
void OnObjectAdded(uLib::Object* obj);
|
||||
/** @brief Slot called when an object is removed from the core context. */
|
||||
void OnObjectRemoved(uLib::Object* obj);
|
||||
|
||||
protected:
|
||||
/** @brief Factory method to create a puppet for a core object. */
|
||||
Puppet* CreatePuppet(uLib::Object* obj);
|
||||
|
||||
private:
|
||||
uLib::ObjectsContext *m_Context;
|
||||
std::map<uLib::Object*, Puppet*> m_Puppets;
|
||||
vtkAssembly *m_Assembly;
|
||||
};
|
||||
|
||||
} // namespace Vtk
|
||||
} // namespace uLib
|
||||
|
||||
#endif // U_VTKOBJECTSCONTEXT_H
|
||||
Reference in New Issue
Block a user