LVRPointCloudItem.cpp
Go to the documentation of this file.
1 
34 #include "LVRPointCloudItem.hpp"
35 #include "LVRItemTypes.hpp"
36 
37 namespace lvr2
38 {
39 
41  QTreeWidgetItem(item, LVRPointCloudItemType), m_parent(item), m_pointBridge(ptr)
42 {
43  // Setup tree widget icon
44  QIcon icon;
45  icon.addFile(QString::fromUtf8(":/qv_pc_tree_icon.png"), QSize(), QIcon::Normal, QIcon::Off);
46  setIcon(0, icon);
47  setText(0, "Point Cloud");
48  setExpanded(true);
49 
50  // Setup Infos
51  m_numItem = new QTreeWidgetItem(this);
52  QString num;
53  m_numItem->setText(0, "Num Points:");
54  m_numItem->setText(1, num.setNum(ptr->getNumPoints()));
55  addChild(m_numItem);
56 
57  m_normalItem = new QTreeWidgetItem(this);
58  m_normalItem->setText(0, "Has Normals:");
59  if(ptr->hasNormals())
60  {
61  m_normalItem->setText(1, "yes");
62  }
63  else
64  {
65  m_normalItem->setText(1, "no");
66  }
67  addChild(m_normalItem);
68 
69  m_colorItem = new QTreeWidgetItem(this);
70  m_colorItem->setText(0, "Has Colors:");
71  if(ptr->hasColors())
72  {
73  m_colorItem->setText(1, "yes");
74  }
75  else
76  {
77  m_colorItem->setText(1, "no");
78  }
79  addChild(m_colorItem);
80 
81  m_specItem = new QTreeWidgetItem(this);
82  m_specItem->setText(0, "Has Spectraldata:");
83  if(ptr->getPointBuffer()->getUCharChannel("spectral_channels"))
84  {
85  m_specItem->setText(1, "yes");
86  }
87  else
88  {
89  m_specItem->setText(1, "no");
90  }
91  addChild(m_specItem);
92 
93  // set initial values
94  m_opacity = 1;
95  m_pointSize = 1;
96  m_color = QColor(255,255,255);
97  m_visible = true;
98 }
99 
101 {
102  m_pointBridge.reset(new LVRPointBufferBridge(m_pointBridge->getPointBuffer()));
103 
104  QString num;
105  m_numItem->setText(1, num.setNum(m_pointBridge->getNumPoints()));
106 
107  // normals update
108  if(m_pointBridge->hasNormals()) {
109  m_normalItem->setText(1, "yes");
110  } else {
111  m_normalItem->setText(1, "no");
112  }
113 
114  // color update
115  if(m_pointBridge->hasColors())
116  {
117  m_colorItem->setText(1, "yes");
118  } else {
119  m_colorItem->setText(1, "no");
120  }
121 
122  // hyperspectral update
123  if(m_pointBridge->getPointBuffer()->getUCharChannel("spectral_channels")) {
124  m_specItem->setText(1, "yes");
125  } else {
126  m_specItem->setText(1, "no");
127  }
128 
129 }
130 
132 {
133  return m_color;
134 }
135 
137 {
138  m_pointBridge->setBaseColor(c.redF(), c.greenF(), c.blueF());
139  m_color = c;
140 }
141 
143 {
144  m_pointBridge->setBaseColor(c.redF(), c.greenF(), c.blueF());
145 }
146 
148 {
149  m_pointBridge->setBaseColor(m_color.redF(), m_color.greenF(), m_color.blueF());
150 }
151 
153 {
154  return m_pointSize;
155 }
156 
158 {
159  m_pointBridge->setPointSize(pointSize);
160  m_pointSize = pointSize;
161 }
162 
164 {
165  return m_opacity;
166 }
167 
168 void LVRPointCloudItem::setOpacity(float &opacity)
169 {
170  m_pointBridge->setOpacity(opacity);
171  m_opacity = opacity;
172 }
173 
175 {
176  return m_visible;
177 }
178 
179 void LVRPointCloudItem::setVisibility(bool &visibility)
180 {
181  m_pointBridge->setVisibility(visibility);
182  m_visible = visibility;
183 }
184 
186 {
187  return m_pointBridge->getNumPoints();
188 }
189 
191 {
192  return m_pointBridge->getPointBuffer();
193 }
194 
196 {
197  return m_pointBridge;
198 }
199 
200 vtkSmartPointer<vtkActor> LVRPointCloudItem::getActor()
201 {
202  return m_pointBridge->getPointCloudActor();
203 }
204 
206 {
207  // TODO Auto-generated destructor stub
208 }
209 
210 } /* namespace lvr2 */
QTreeWidgetItem * m_numItem
boost::shared_ptr< LVRPointBufferBridge > PointBufferBridgePtr
PointBufferPtr getPointBuffer()
PointBufferBridgePtr m_pointBridge
QTreeWidgetItem * m_colorItem
std::shared_ptr< PointBuffer > PointBufferPtr
void setVisibility(bool &visiblity)
void setOpacity(float &opacity)
vtkSmartPointer< vtkActor > getActor()
QTreeWidgetItem * m_normalItem
QTreeWidgetItem * m_specItem
void setSelectionColor(QColor &c)
void setPointSize(int &pointSize)
PointBufferBridgePtr getPointBufferBridge()
LVRPointCloudItem(PointBufferBridgePtr ptr, QTreeWidgetItem *parent=0)


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