LVRTreeWidgetHelper.cpp
Go to the documentation of this file.
1 
34 #include "LVRTreeWidgetHelper.hpp"
35 
36 #include "../widgets/LVRPointCloudItem.hpp"
37 #include "../widgets/LVRMeshItem.hpp"
38 
39 #include <QTreeWidgetItemIterator>
40 
41 namespace lvr2
42 {
43 
45 {
46  m_treeWidget = tree;
47 }
48 
50 {
51  PointBufferPtr ptr;
52  QTreeWidgetItemIterator m_it(m_treeWidget);
53  while(*m_it)
54  {
55  if ( (*m_it)->type() == LVRModelItemType)
56  {
57  if( (*m_it)->text(0) == name)
58  {
59  cout << "Name check: " << (*m_it)->text(0).toStdString() << " " << name.toStdString() << endl;
60  // Find point cloud sub item
61  LVRModelItem* item = static_cast<LVRModelItem*>(*m_it);
62  for(size_t i = 0; i < item->childCount(); i++)
63  {
64  QTreeWidgetItem* treeItem = item->child(i);
65  if(treeItem && treeItem->type() == LVRPointCloudItemType)
66  {
67  LVRPointCloudItem* pointItem = static_cast<LVRPointCloudItem*>(treeItem);
68  ptr = pointItem->getPointBuffer();
69  }
70  }
71  break;
72  }
73  }
74  ++m_it;
75  }
76  return ptr;
77 }
78 
80 {
81  MeshBufferPtr ptr;
82  QTreeWidgetItemIterator m_it(m_treeWidget);
83  while(*m_it)
84  {
85  if ( (*m_it)->type() == LVRModelItemType)
86  {
87  if( (*m_it)->text(0) == name)
88  {
89  // Find point cloud sub item
90  QTreeWidgetItemIterator sub_it(*m_it);
91  while(*sub_it)
92  {
93  if( (*sub_it)->type() == LVRMeshItemType)
94  {
95  LVRMeshItem* mesh_item = static_cast<LVRMeshItem*>(*sub_it);
96  ptr = mesh_item->getMeshBuffer();
97  }
98  ++sub_it;
99  }
100  break;
101  }
102  ++m_it;
103  }
104  }
105  return ptr;
106 }
107 
109 {
110  cout << "GET MODEL ITEM" << endl;
111  LVRModelItem* ptr;
112  QTreeWidgetItemIterator it(m_treeWidget);
113  while (*it)
114  {
115  if ( (*it)->type() == LVRModelItemType)
116  {
117  if( (*it)->text(0) == name)
118  {
119  return static_cast<LVRModelItem*>(*it);
120  }
121  }
122  ++it;
123  }
124  return ptr;
125 }
126 
127 } /* namespace lvr2 */
PointBufferPtr getPointBuffer(QString name)
std::shared_ptr< MeshBuffer > MeshBufferPtr
Definition: MeshBuffer.hpp:217
PointBufferPtr getPointBuffer()
std::shared_ptr< PointBuffer > PointBufferPtr
MeshBufferPtr getMeshBuffer(QString name)
LVRTreeWidgetHelper(QTreeWidget *widget)
LVRModelItem * getModelItem(QString name)
MeshBufferPtr getMeshBuffer()


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