/*////////////////////////////////////////////////////////////////////////////// // CMT Cosmic Muon Tomography project ////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// Copyright (c) 2014, Universita' degli Studi di Padova, INFN sez. di Padova All rights reserved Authors: Andrea Rigoni Garola < andrea.rigoni@pd.infn.it > //////////////////////////////////////////////////////////////////////////////*/ #ifndef U_VTK_ASSEMBLY_H #define U_VTK_ASSEMBLY_H #include "Math/Assembly.h" #include "uLibVtkInterface.h" class vtkActor; class vtkAssembly; // VTK library forward declaration (must be before namespace) namespace uLib { namespace Vtk { class vtkObjectsContext; // forward /** * @brief VTK Puppet for visualizing uLib::Assembly. * * Manages a VTK assembly (vtkAssembly from the VTK library) that groups * all child puppets and applies the Assembly's AffineTransform. It also * renders an optional bounding box wireframe computed from the Assembly's AABB. * * @note This class is uLib::Vtk::Assembly. It internally uses * the VTK library class vtkAssembly for grouping, but the two * are distinct. */ class Assembly : public Puppet { public: virtual const char *GetClassName() const override { return "Vtk.Assembly"; } Assembly(uLib::Assembly *content); virtual ~Assembly(); /** @brief Updates the VTK representation from the model (model→VTK). */ virtual void Update() override; /** @brief Synchronizes the model from the VTK representation (VTK→model). */ virtual void SyncFromVtk() override; virtual uLib::Object* GetContent() const override { return (uLib::Object*)m_Content; } virtual uLib::ObjectsContext* GetChildren() override { return (uLib::ObjectsContext*)m_Content; } /** * @brief Returns the puppet managing child objects. */ /** @brief Returns the puppet managing child objects. */ vtkObjectsContext *GetChildrenContext() const; private: void UpdateBoundingBox(); void InstallPipe(); uLib::Assembly *m_Content; vtkObjectsContext *m_ChildContext; vtkActor *m_BBoxActor; ::vtkAssembly *m_VtkAsm; // VTK library assembly — NOT this class bool m_InUpdate; // re-entrancy guard }; } // namespace Vtk } // namespace uLib #endif // U_VTK_ASSEMBLY_H