88 lines
2.6 KiB
C++
88 lines
2.6 KiB
C++
/*//////////////////////////////////////////////////////////////////////////////
|
|
// 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 >
|
|
|
|
------------------------------------------------------------------
|
|
This library is free software; you can redistribute it and/or
|
|
modify it under the terms of the GNU Lesser General Public
|
|
License as published by the Free Software Foundation; either
|
|
version 3.0 of the License, or (at your option) any later version.
|
|
|
|
This library is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Lesser General Public License for more details.
|
|
|
|
You should have received a copy of the GNU Lesser General Public
|
|
License along with this library.
|
|
|
|
//////////////////////////////////////////////////////////////////////////////*/
|
|
|
|
#ifndef U_VTKGEANTSCENE_H
|
|
#define U_VTKGEANTSCENE_H
|
|
|
|
#include "HEP/Geant/Scene.h"
|
|
#include "uLibVtkInterface.h"
|
|
#include "Vtk/Math/vtkContainerBox.h"
|
|
|
|
#include <vector>
|
|
#include <memory>
|
|
|
|
namespace uLib {
|
|
namespace Vtk {
|
|
|
|
class GeantSolid;
|
|
|
|
/**
|
|
* @brief VTK Prop3D representing the entire Geant::Scene.
|
|
*
|
|
* When constructed, it creates child prop3ds for the world box (as a
|
|
* ContainerBox wireframe) and for each non-world Solid in the scene
|
|
* (as GeantSolid surfaces).
|
|
*
|
|
* Usage:
|
|
* @code
|
|
* Geant::Scene scene;
|
|
* scene.ConstructWorldBox(Vector3f(30_m, 30_m, 30_m), "G4_AIR");
|
|
* // ... add solids ...
|
|
* scene.Initialize();
|
|
*
|
|
* Vtk::Viewer viewer;
|
|
* Vtk::GeantScene vtkScene(&scene);
|
|
* vtkScene.AddToViewer(viewer);
|
|
* viewer.Start();
|
|
* @endcode
|
|
*/
|
|
class GeantScene : public Object {
|
|
public:
|
|
GeantScene(Geant::Scene *scene);
|
|
~GeantScene();
|
|
|
|
/// Add all prop3ds (world box + solids) to a viewer.
|
|
void AddToViewer(class Viewport &viewer);
|
|
|
|
/// Remove all prop3ds from viewport.
|
|
void RemoveFromViewer(class Viewport &viewer);
|
|
|
|
/// Get the world box prop3d
|
|
ContainerBox* GetWorldProp3D() const { return m_WorldProp3D; }
|
|
|
|
/// Get the solid prop3ds
|
|
const std::vector<GeantSolid*>& GetSolidProp3Ds() const { return m_SolidProp3Ds; }
|
|
|
|
private:
|
|
Geant::Scene *m_Scene;
|
|
ContainerBox *m_WorldProp3D;
|
|
std::vector<GeantSolid*> m_SolidProp3Ds;
|
|
};
|
|
|
|
} // namespace Vtk
|
|
} // namespace uLib
|
|
|
|
#endif // U_VTKGEANTSCENE_H
|