add vtk geant solid and scene
This commit is contained in:
87
src/Vtk/HEP/Geant/vtkGeantScene.h
Normal file
87
src/Vtk/HEP/Geant/vtkGeantScene.h
Normal file
@@ -0,0 +1,87 @@
|
||||
/*//////////////////////////////////////////////////////////////////////////////
|
||||
// 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 vtkGeantSolid;
|
||||
|
||||
/**
|
||||
* @brief VTK Puppet representing the entire Geant::Scene.
|
||||
*
|
||||
* When constructed, it creates child puppets for the world box (as a
|
||||
* vtkContainerBox wireframe) and for each non-world Solid in the scene
|
||||
* (as vtkGeantSolid 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::vtkGeantScene vtkScene(&scene);
|
||||
* vtkScene.AddToViewer(viewer);
|
||||
* viewer.Start();
|
||||
* @endcode
|
||||
*/
|
||||
class vtkGeantScene : public Object {
|
||||
public:
|
||||
vtkGeantScene(Geant::Scene *scene);
|
||||
~vtkGeantScene();
|
||||
|
||||
/// Add all puppets (world box + solids) to a viewer.
|
||||
void AddToViewer(class Viewport &viewer);
|
||||
|
||||
/// Remove all puppets from viewport.
|
||||
void RemoveFromViewer(class Viewport &viewer);
|
||||
|
||||
/// Get the world box puppet
|
||||
vtkContainerBox* GetWorldPuppet() const { return m_WorldPuppet; }
|
||||
|
||||
/// Get the solid puppets
|
||||
const std::vector<vtkGeantSolid*>& GetSolidPuppets() const { return m_SolidPuppets; }
|
||||
|
||||
private:
|
||||
Geant::Scene *m_Scene;
|
||||
vtkContainerBox *m_WorldPuppet;
|
||||
std::vector<vtkGeantSolid*> m_SolidPuppets;
|
||||
};
|
||||
|
||||
} // namespace Vtk
|
||||
} // namespace uLib
|
||||
|
||||
#endif // U_VTKGEANTSCENE_H
|
||||
Reference in New Issue
Block a user