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 */
lvr2::LVRTreeWidgetHelper::LVRTreeWidgetHelper
LVRTreeWidgetHelper(QTreeWidget *widget)
Definition: LVRTreeWidgetHelper.cpp:44
lvr2::LVRTreeWidgetHelper::m_treeWidget
QTreeWidget * m_treeWidget
Definition: LVRTreeWidgetHelper.hpp:59
lvr2::LVRMeshItem
Definition: LVRMeshItem.hpp:45
lvr2::LVRTreeWidgetHelper::getPointBuffer
PointBufferPtr getPointBuffer(QString name)
Definition: LVRTreeWidgetHelper.cpp:49
lvr2::PointBufferPtr
std::shared_ptr< PointBuffer > PointBufferPtr
Definition: PointBuffer.hpp:130
LVRTreeWidgetHelper.hpp
lvr2::LVRModelItemType
@ LVRModelItemType
Definition: LVRItemTypes.hpp:40
lvr2::LVRPointCloudItem
Definition: LVRPointCloudItem.hpp:45
lvr2::LVRTreeWidgetHelper::getModelItem
LVRModelItem * getModelItem(QString name)
Definition: LVRTreeWidgetHelper.cpp:108
lvr2::LVRPointCloudItemType
@ LVRPointCloudItemType
Definition: LVRItemTypes.hpp:41
lvr2::LVRTreeWidgetHelper::getMeshBuffer
MeshBufferPtr getMeshBuffer(QString name)
Definition: LVRTreeWidgetHelper.cpp:79
lvr2::LVRMeshItem::getMeshBuffer
MeshBufferPtr getMeshBuffer()
Definition: LVRMeshItem.cpp:134
lvr2::LVRPointCloudItem::getPointBuffer
PointBufferPtr getPointBuffer()
Definition: LVRPointCloudItem.cpp:190
lvr2::LVRModelItem
Definition: LVRModelItem.hpp:47
lvr2
Definition: BaseBufferManipulators.hpp:39
lvr2::MeshBufferPtr
std::shared_ptr< MeshBuffer > MeshBufferPtr
Definition: MeshBuffer.hpp:217
lvr2::LVRMeshItemType
@ LVRMeshItemType
Definition: LVRItemTypes.hpp:42


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