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 */
lvr2::LVRPointCloudItem::m_color
QColor m_color
Definition: LVRPointCloudItem.hpp:75
lvr2::LVRPointCloudItem::getActor
vtkSmartPointer< vtkActor > getActor()
Definition: LVRPointCloudItem.cpp:200
lvr2::LVRPointCloudItem::m_pointBridge
PointBufferBridgePtr m_pointBridge
Definition: LVRPointCloudItem.hpp:74
lvr2::LVRPointCloudItem::getPointBufferBridge
PointBufferBridgePtr getPointBufferBridge()
Definition: LVRPointCloudItem.cpp:195
lvr2::LVRPointCloudItem::getOpacity
float getOpacity()
Definition: LVRPointCloudItem.cpp:163
lvr2::LVRPointCloudItem::getNumPoints
size_t getNumPoints()
Definition: LVRPointCloudItem.cpp:185
lvr2::PointBufferPtr
std::shared_ptr< PointBuffer > PointBufferPtr
Definition: PointBuffer.hpp:130
lvr2::LVRPointCloudItem::m_opacity
float m_opacity
Definition: LVRPointCloudItem.hpp:77
LVRItemTypes.hpp
lvr2::LVRPointCloudItem::m_colorItem
QTreeWidgetItem * m_colorItem
Definition: LVRPointCloudItem.hpp:71
lvr2::LVRPointCloudItem::m_visible
bool m_visible
Definition: LVRPointCloudItem.hpp:78
lvr2::LVRPointCloudItem::LVRPointCloudItem
LVRPointCloudItem(PointBufferBridgePtr ptr, QTreeWidgetItem *parent=0)
Definition: LVRPointCloudItem.cpp:40
lvr2::LVRPointCloudItem::setSelectionColor
void setSelectionColor(QColor &c)
Definition: LVRPointCloudItem.cpp:142
lvr2::LVRPointCloudItem::setVisibility
void setVisibility(bool &visiblity)
Definition: LVRPointCloudItem.cpp:179
kfusion::device::Normal
float4 Normal
Definition: internal.hpp:13
lvr2::LVRPointCloudItem::update
void update()
Definition: LVRPointCloudItem.cpp:100
lvr2::LVRPointCloudItemType
@ LVRPointCloudItemType
Definition: LVRItemTypes.hpp:41
lvr2::LVRPointCloudItem::resetColor
void resetColor()
Definition: LVRPointCloudItem.cpp:147
lvr2::LVRPointCloudItem::getPointSize
int getPointSize()
Definition: LVRPointCloudItem.cpp:152
lvr2::LVRPointCloudItem::~LVRPointCloudItem
virtual ~LVRPointCloudItem()
Definition: LVRPointCloudItem.cpp:205
lvr2::LVRPointCloudItem::getPointBuffer
PointBufferPtr getPointBuffer()
Definition: LVRPointCloudItem.cpp:190
lvr2::LVRPointCloudItem::getVisibility
bool getVisibility()
Definition: LVRPointCloudItem.cpp:174
lvr2::LVRPointBufferBridge
Definition: LVRPointBufferBridge.hpp:52
lvr2::LVRPointCloudItem::setPointSize
void setPointSize(int &pointSize)
Definition: LVRPointCloudItem.cpp:157
lvr2
Definition: BaseBufferManipulators.hpp:39
lvr2::LVRPointCloudItem::m_normalItem
QTreeWidgetItem * m_normalItem
Definition: LVRPointCloudItem.hpp:70
lvr2::LVRPointCloudItem::m_specItem
QTreeWidgetItem * m_specItem
Definition: LVRPointCloudItem.hpp:72
lvr2::LVRPointCloudItem::m_pointSize
int m_pointSize
Definition: LVRPointCloudItem.hpp:76
lvr2::PointBufferBridgePtr
boost::shared_ptr< LVRPointBufferBridge > PointBufferBridgePtr
Definition: LVRPointBufferBridge.hpp:116
lvr2::LVRPointCloudItem::m_numItem
QTreeWidgetItem * m_numItem
Definition: LVRPointCloudItem.hpp:69
LVRPointCloudItem.hpp
lvr2::LVRPointCloudItem::getColor
QColor getColor()
Definition: LVRPointCloudItem.cpp:131
lvr2::LVRPointCloudItem::setColor
void setColor(QColor &c)
Definition: LVRPointCloudItem.cpp:136
lvr2::LVRPointCloudItem::setOpacity
void setOpacity(float &opacity)
Definition: LVRPointCloudItem.cpp:168


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