add assembly
This commit is contained in:
71
src/Vtk/Math/vtkAssembly.h
Normal file
71
src/Vtk/Math/vtkAssembly.h
Normal file
@@ -0,0 +1,71 @@
|
||||
/*//////////////////////////////////////////////////////////////////////////////
|
||||
// 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;
|
||||
|
||||
virtual uLib::Object* GetContent() const override { return (uLib::Object*)m_Content; }
|
||||
|
||||
/** @brief Called when the model signals an update (model→VTK push). */
|
||||
void contentUpdate();
|
||||
|
||||
/** @brief Returns the puppet managing child objects. */
|
||||
vtkObjectsContext *GetChildrenContext() const;
|
||||
|
||||
private:
|
||||
void UpdateTransform();
|
||||
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
|
||||
bool m_BlockUpdate; // block feedback from contentUpdate→Update
|
||||
};
|
||||
|
||||
} // namespace Vtk
|
||||
} // namespace uLib
|
||||
|
||||
#endif // U_VTK_ASSEMBLY_H
|
||||
Reference in New Issue
Block a user