LVRModelItem.cpp
Go to the documentation of this file.
1 
34 #include "LVRModelItem.hpp"
35 #include "LVRPointCloudItem.hpp"
36 #include "LVRMeshItem.hpp"
37 #include "LVRItemTypes.hpp"
38 #include "LVRTextureMeshItem.hpp"
39 
40 #include <vtkSmartPointer.h>
41 #include <vtkActor.h>
42 #include <vtkPolyDataMapper.h>
43 
44 namespace lvr2
45 {
46 
48  QTreeWidgetItem(LVRModelItemType), m_modelBridge(bridge), m_name(name)
49 {
50  // Setup tree widget icon
51  QIcon icon;
52  icon.addFile(QString::fromUtf8(":/qv_model_tree_icon.png"), QSize(), QIcon::Normal, QIcon::Off);
53  setIcon(0, icon);
54 
55  // Setup item properties
56  setText(0, m_name);
57  setCheckState(0, Qt::Checked);
58 
59  // Insert sub items
60  if(bridge->m_pointBridge->getNumPoints())
61  {
62  LVRPointCloudItem* pointItem = new LVRPointCloudItem(bridge->m_pointBridge, this);
63  addChild(pointItem);
64  pointItem->setExpanded(true);
65  }
66 
67  if(bridge->m_meshBridge->getNumTriangles())
68  {
69  if(bridge->m_meshBridge->hasTextures())
70  {
71  LVRTextureMeshItem* texItem = new LVRTextureMeshItem(bridge->m_meshBridge, this);
72  addChild(texItem);
73  texItem->setExpanded(true);
74  }
75  else
76  {
77  LVRMeshItem* meshItem = new LVRMeshItem(bridge->m_meshBridge, this);
78  addChild(meshItem);
79  meshItem->setExpanded(true);
80  }
81  }
82 
83  // Setup Pose
84  m_poseItem = new LVRPoseItem(bridge, this);
85  addChild(m_poseItem);
86 }
87 
89 {
91  m_name = item.m_name;
92  m_poseItem = item.m_poseItem;
93 }
94 
96 {
97  return m_poseItem->getPose();
98 }
99 
100 void LVRModelItem::setPose(const Pose& pose)
101 {
102  // Update vtk representation
103  m_modelBridge->setPose(pose);
104 
105  // Update pose item
106  m_poseItem->setPose(pose);
107 }
108 
110 {
111  return m_name;
112 }
113 
114 void LVRModelItem::setName(QString name)
115 {
116  m_name = name;
117  setText(0, m_name);
118 }
119 
121 {
122  return m_modelBridge;
123 }
124 
126 {
127  return this->checkState(0);
128 }
129 
130 void LVRModelItem::setVisibility(bool visible)
131 {
132  m_modelBridge->setVisibility(visible);
133 }
134 
135 void LVRModelItem::setModelVisibility(int column, bool globalValue)
136 {
137  if(checkState(column) == globalValue || globalValue == true)
138  {
139  setVisibility(checkState(column));
140  }
141 }
142 
144 {
145  // TODO Auto-generated destructor stub
146 }
147 
148 } /* namespace lvr2 */
lvr2::LVRModelItem::setModelVisibility
void setModelVisibility(int column, bool globalValue)
Definition: LVRModelItem.cpp:135
lvr2::LVRMeshItem
Definition: LVRMeshItem.hpp:45
lvr2::LVRModelItem::setPose
void setPose(const Pose &pose)
Definition: LVRModelItem.cpp:100
lvr2::LVRModelItem::LVRModelItem
LVRModelItem(ModelBridgePtr bridge, QString name="")
Definition: LVRModelItem.cpp:47
lvr2::LVRModelItemType
@ LVRModelItemType
Definition: LVRItemTypes.hpp:40
LVRItemTypes.hpp
lvr2::LVRTextureMeshItem
Definition: LVRTextureMeshItem.hpp:43
lvr2::LVRModelItem::~LVRModelItem
virtual ~LVRModelItem()
Definition: LVRModelItem.cpp:143
lvr2::LVRModelItem::m_poseItem
LVRPoseItem * m_poseItem
Definition: LVRModelItem.hpp:68
lvr2::LVRPointCloudItem
Definition: LVRPointCloudItem.hpp:45
LVRModelItem.hpp
LVRMeshItem.hpp
lvr2::LVRModelItem::isEnabled
bool isEnabled()
Definition: LVRModelItem.cpp:125
kfusion::device::Normal
float4 Normal
Definition: internal.hpp:13
lvr2::ModelBridgePtr
boost::shared_ptr< LVRModelBridge > ModelBridgePtr
Definition: LVRModelBridge.hpp:120
lvr2::LVRModelItem::setVisibility
void setVisibility(bool visible)
Definition: LVRModelItem.cpp:130
LVRTextureMeshItem.hpp
lvr2::LVRModelItem::getModelBridge
ModelBridgePtr getModelBridge()
Definition: LVRModelItem.cpp:120
lvr2::LVRModelItem::setName
void setName(QString name)
Definition: LVRModelItem.cpp:114
lvr2::LVRModelItem::getPose
Pose getPose()
Definition: LVRModelItem.cpp:95
lvr2::LVRModelItem
Definition: LVRModelItem.hpp:47
lvr2
Definition: BaseBufferManipulators.hpp:39
lvr2::LVRModelItem::m_modelBridge
ModelBridgePtr m_modelBridge
Definition: LVRModelItem.hpp:66
lvr2::LVRPoseItem::getPose
Pose getPose()
Definition: LVRPoseItem.cpp:94
lvr2::LVRPoseItem::setPose
void setPose(const Pose &pose)
Definition: LVRPoseItem.cpp:69
LVRPointCloudItem.hpp
lvr2::LVRModelItem::m_name
QString m_name
Definition: LVRModelItem.hpp:67
lvr2::LVRPoseItem
Definition: LVRPoseItem.hpp:44
lvr2::LVRModelItem::getName
QString getName()
Definition: LVRModelItem.cpp:109
lvr2::Pose
Definition: LVRModelBridge.hpp:51


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