LVRPointInfo.cpp
Go to the documentation of this file.
1 
28 #include "LVRPointInfo.hpp"
29 
30 namespace lvr2
31 {
32 
33 LVRPointInfo::LVRPointInfo(QWidget* parent, PointBufferPtr pointBuffer, int pointId) :
34  QDialog(parent)
35 {
36  setAttribute(Qt::WA_DeleteOnClose);
37 
38  m_pointInfo.setupUi(this);
39 
40  size_t n = pointBuffer->numPoints();
41  floatArr points = pointBuffer->getPointArray();
42 
43  if (pointId < 0 || pointId >= n)
44  {
45  done(0);
46  return;
47  }
48 
49  m_pointInfo.infoText->setText(QString("Selected: %1, %2, %3")
50  .arg(points[pointId * 3], 10, 'g', 4)
51  .arg(points[pointId * 3 + 1], 10, 'g', 4)
52  .arg(points[pointId * 3 + 2], 10, 'g', 4));
53 
54  UCharChannelOptional spec_channels = pointBuffer->getUCharChannel("spectral_channels");
55  size_t n_spec = spec_channels->numElements();
56  m_numChannels = spec_channels->width();
57 
58  if (pointId >= n_spec)
59  {
60  done(0);
61  return;
62  }
63  else
64  {
65  m_data = floatArr(new float[m_numChannels]);
66  for (size_t i = 0; i < m_numChannels; i++)
67  {
68  m_data[i] = (*spec_channels)[pointId][i];
69  }
70  }
71 
72  refresh();
73 
74  QObject::connect(m_pointInfo.shouldScale, SIGNAL(stateChanged(int)), this, SLOT(refresh()));
75 }
76 
78 {
79  // TODO Auto-generated destructor stub
80 }
81 
83 {
84  if (m_pointInfo.shouldScale->isChecked())
85  {
86  m_pointInfo.plotter->setPoints(m_data, m_numChannels);
87  }
88  else
89  {
90  m_pointInfo.plotter->setPoints(m_data, m_numChannels, 0, 1);
91  }
92 
93  show();
94  raise();
95  activateWindow();
96 }
97 
98 } // namespace lvr2
lvr2::floatArr
boost::shared_array< float > floatArr
Definition: DataStruct.hpp:133
lvr2::LVRPointInfo::m_data
floatArr m_data
Definition: LVRPointInfo.hpp:55
lvr2::UCharChannelOptional
UCharChannel::Optional UCharChannelOptional
Definition: Channel.hpp:96
lvr2::PointBufferPtr
std::shared_ptr< PointBuffer > PointBufferPtr
Definition: PointBuffer.hpp:130
lvr2::LVRPointInfo::m_pointInfo
PointInfo m_pointInfo
Definition: LVRPointInfo.hpp:54
lvr2::hdf5util::setAttribute
void setAttribute(HighFive::Group &g, const std::string &attr_name, T &data)
lvr2::LVRPointInfo::refresh
void refresh()
Definition: LVRPointInfo.cpp:82
lvr2::LVRPointInfo::m_numChannels
size_t m_numChannels
Definition: LVRPointInfo.hpp:56
lvr2::LVRPointInfo::LVRPointInfo
LVRPointInfo(QWidget *parent, PointBufferPtr points, int pointId)
Definition: LVRPointInfo.cpp:33
lvr2::LVRPointInfo::~LVRPointInfo
virtual ~LVRPointInfo()
Definition: LVRPointInfo.cpp:77
LVRPointInfo.hpp
lvr2
Definition: BaseBufferManipulators.hpp:39


lvr2
Author(s): Thomas Wiemann , Sebastian Pütz , Alexander Mock , Lars Kiesow , Lukas Kalbertodt , Tristan Igelbrink , Johan M. von Behren , Dominik Feldschnieders , Alexander Löhr
autogenerated on Wed Mar 2 2022 00:37:24