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
UCharChannel::Optional UCharChannelOptional
Definition: Channel.hpp:96
std::shared_ptr< PointBuffer > PointBufferPtr
void setAttribute(HighFive::Group &g, const std::string &attr_name, T &data)
boost::shared_array< float > floatArr
Definition: DataStruct.hpp:133
virtual ~LVRPointInfo()
LVRPointInfo(QWidget *parent, PointBufferPtr points, int pointId)


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 Mon Feb 28 2022 22:46:08