detector chamber in vtk
This commit is contained in:
@@ -9,11 +9,13 @@
|
||||
set(HEP_DETECTORS_SOURCES
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/vtkMuonScatter.cxx
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/vtkMuonEvent.cxx
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/vtkDetectorChamber.cxx
|
||||
PARENT_SCOPE)
|
||||
|
||||
set(HEP_DETECTORS_HEADERS
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/vtkMuonScatter.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/vtkMuonEvent.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/vtkDetectorChamber.h
|
||||
PARENT_SCOPE)
|
||||
|
||||
if(BUILD_TESTING)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
# TESTS
|
||||
set(TESTS
|
||||
vtkMuonScatterTest
|
||||
vtkDetectorChamberTest
|
||||
)
|
||||
|
||||
set(LIBRARIES
|
||||
|
||||
52
src/Vtk/HEP/Detectors/testing/vtkDetectorChamberTest.cpp
Normal file
52
src/Vtk/HEP/Detectors/testing/vtkDetectorChamberTest.cpp
Normal file
@@ -0,0 +1,52 @@
|
||||
/*//////////////////////////////////////////////////////////////////////////////
|
||||
// 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.
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////*/
|
||||
|
||||
#include "Vtk/HEP/Detectors/vtkDetectorChamber.h"
|
||||
#include "HEP/Detectors/DetectorChamber.h"
|
||||
|
||||
#include "Vtk/uLibVtkViewer.h"
|
||||
|
||||
#define BOOST_TEST_MODULE vtkDetectorChamberTest
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
BOOST_AUTO_TEST_CASE(vtkDetectorChamberTest) {
|
||||
uLib::DetectorChamber content;
|
||||
content.SetSize(uLib::Vector3f(10, 10, 10));
|
||||
content.SetPosition(uLib::Vector3f(0, 0, 0));
|
||||
|
||||
uLib::Vtk::vtkDetectorChamber vtkDetectorChamber(&content);
|
||||
|
||||
if (!vtkDetectorChamber.GetProp()) {
|
||||
BOOST_FAIL("vtkDetectorChamber::GetProp() returned NULL");
|
||||
}
|
||||
|
||||
if (std::getenv("CTEST_PROJECT_NAME") == nullptr) {
|
||||
uLib::Vtk::Viewer viewer;
|
||||
viewer.AddPuppet(vtkDetectorChamber);
|
||||
viewer.Start();
|
||||
}
|
||||
|
||||
BOOST_CHECK(true); // reached here without crash
|
||||
}
|
||||
50
src/Vtk/HEP/Detectors/vtkDetectorChamber.cxx
Normal file
50
src/Vtk/HEP/Detectors/vtkDetectorChamber.cxx
Normal file
@@ -0,0 +1,50 @@
|
||||
/*//////////////////////////////////////////////////////////////////////////////
|
||||
// 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.
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////*/
|
||||
|
||||
#include "Vtk/HEP/Detectors/vtkDetectorChamber.h"
|
||||
#include "Vtk/vtkContainerBox.h"
|
||||
|
||||
namespace uLib {
|
||||
namespace Vtk {
|
||||
|
||||
vtkDetectorChamber::vtkDetectorChamber(DetectorChamber *content)
|
||||
: vtkContainerBox(content) {
|
||||
InstallPipe();
|
||||
}
|
||||
|
||||
vtkDetectorChamber::~vtkDetectorChamber() {}
|
||||
|
||||
DetectorChamber *vtkDetectorChamber::GetContent() {
|
||||
return static_cast<DetectorChamber *>(m_Content);
|
||||
}
|
||||
|
||||
void vtkDetectorChamber::PrintSelf(std::ostream &o) const {
|
||||
vtkContainerBox::PrintSelf(o);
|
||||
}
|
||||
|
||||
void vtkDetectorChamber::InstallPipe() { vtkContainerBox::InstallPipe(); }
|
||||
|
||||
} // namespace Vtk
|
||||
} // namespace uLib
|
||||
73
src/Vtk/HEP/Detectors/vtkDetectorChamber.h
Normal file
73
src/Vtk/HEP/Detectors/vtkDetectorChamber.h
Normal file
@@ -0,0 +1,73 @@
|
||||
/*//////////////////////////////////////////////////////////////////////////////
|
||||
// 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 VTK_DETECTOR_CHAMBER_H
|
||||
#define VTK_DETECTOR_CHAMBER_H
|
||||
|
||||
#include <vtkActor.h>
|
||||
#include <vtkAppendPolyData.h>
|
||||
#include <vtkLineSource.h>
|
||||
#include <vtkPolyDataMapper.h>
|
||||
#include <vtkSmartPointer.h>
|
||||
#include <vtkSphereSource.h>
|
||||
|
||||
#include <vtk3DWidget.h>
|
||||
#include <vtkBoxWidget.h>
|
||||
|
||||
#include <vtkRenderWindowInteractor.h>
|
||||
|
||||
#include <vtkCommand.h>
|
||||
#include <vtkTransform.h>
|
||||
|
||||
#include "Math/Dense.h"
|
||||
|
||||
#include "HEP/Detectors/DetectorChamber.h"
|
||||
#include "Vtk/uLibVtkInterface.h"
|
||||
#include "Vtk/vtkContainerBox.h"
|
||||
|
||||
namespace uLib {
|
||||
namespace Vtk {
|
||||
|
||||
class vtkDetectorChamber : public vtkContainerBox {
|
||||
typedef DetectorChamber Content;
|
||||
|
||||
public:
|
||||
vtkDetectorChamber(DetectorChamber *content);
|
||||
~vtkDetectorChamber();
|
||||
|
||||
Content *GetContent();
|
||||
|
||||
void PrintSelf(std::ostream &o) const;
|
||||
|
||||
private:
|
||||
void InstallPipe();
|
||||
|
||||
vtkDetectorChamber::Content *content;
|
||||
};
|
||||
|
||||
} // namespace Vtk
|
||||
} // namespace uLib
|
||||
|
||||
#endif // VTK_DETECTOR_CHAMBER_H
|
||||
@@ -23,54 +23,44 @@
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////*/
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
|
||||
#include <vtkSmartPointer.h>
|
||||
#include <vtkCubeSource.h>
|
||||
#include <vtkActor.h>
|
||||
#include <vtkAxes.h>
|
||||
#include <vtkAssembly.h>
|
||||
#include <vtkAxes.h>
|
||||
#include <vtkCubeSource.h>
|
||||
#include <vtkLineSource.h>
|
||||
#include <vtkPolyDataMapper.h>
|
||||
#include <vtkProperty.h>
|
||||
#include <vtkLineSource.h>
|
||||
#include <vtkSmartPointer.h>
|
||||
|
||||
#include "vtkContainerBox.h"
|
||||
|
||||
namespace uLib {
|
||||
namespace Vtk {
|
||||
|
||||
|
||||
vtkContainerBox::vtkContainerBox(vtkContainerBox::Content &content) :
|
||||
m_Cube(vtkActor::New()),
|
||||
m_Axes(vtkActor::New()),
|
||||
m_Pivot(vtkActor::New()),
|
||||
m_Content(&content)
|
||||
{
|
||||
vtkContainerBox::vtkContainerBox(vtkContainerBox::Content *content)
|
||||
: m_Cube(vtkActor::New()), m_Axes(vtkActor::New()),
|
||||
m_Pivot(vtkActor::New()), m_Content(content) {
|
||||
this->InstallPipe();
|
||||
}
|
||||
|
||||
vtkContainerBox::~vtkContainerBox()
|
||||
{
|
||||
vtkContainerBox::~vtkContainerBox() {
|
||||
m_Cube->Delete();
|
||||
m_Axes->Delete();
|
||||
m_Pivot->Delete();
|
||||
}
|
||||
|
||||
vtkPolyData *vtkContainerBox::GetPolyData() const
|
||||
{
|
||||
vtkPolyData *vtkContainerBox::GetPolyData() const {
|
||||
// TODO
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void vtkContainerBox::InstallPipe()
|
||||
{
|
||||
if(!m_Content) return;
|
||||
void vtkContainerBox::InstallPipe() {
|
||||
if (!m_Content)
|
||||
return;
|
||||
Content *c = m_Content;
|
||||
|
||||
// CUBE
|
||||
@@ -123,7 +113,5 @@ void vtkContainerBox::InstallPipe()
|
||||
this->SetProp(m_Pivot);
|
||||
}
|
||||
|
||||
|
||||
|
||||
} // vtk
|
||||
} // uLib
|
||||
} // namespace Vtk
|
||||
} // namespace uLib
|
||||
|
||||
@@ -23,28 +23,25 @@
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////*/
|
||||
|
||||
|
||||
|
||||
#ifndef U_VTKCONTAINERBOX_H
|
||||
#define U_VTKCONTAINERBOX_H
|
||||
|
||||
|
||||
#include "uLibVtkInterface.h"
|
||||
#include "Math/ContainerBox.h"
|
||||
|
||||
#include "uLibVtkInterface.h"
|
||||
|
||||
namespace uLib {
|
||||
namespace Vtk {
|
||||
|
||||
class vtkContainerBox : public Puppet, public Polydata {
|
||||
typedef ContainerBox Content;
|
||||
|
||||
public:
|
||||
vtkContainerBox(Content &content);
|
||||
vtkContainerBox(Content *content);
|
||||
~vtkContainerBox();
|
||||
|
||||
virtual class vtkPolyData *GetPolyData() const;
|
||||
|
||||
private:
|
||||
protected:
|
||||
void InstallPipe();
|
||||
|
||||
vtkActor *m_Cube;
|
||||
@@ -53,7 +50,7 @@ private:
|
||||
vtkContainerBox::Content *m_Content;
|
||||
};
|
||||
|
||||
} // vtk
|
||||
} // uLib
|
||||
} // namespace Vtk
|
||||
} // namespace uLib
|
||||
|
||||
#endif // VTKCONTAINERBOX_H
|
||||
|
||||
Reference in New Issue
Block a user