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 */
LVRPoseItem * m_poseItem
ModelBridgePtr m_modelBridge
void setVisibility(bool visible)
ModelBridgePtr getModelBridge()
LVRModelItem(ModelBridgePtr bridge, QString name="")
boost::shared_ptr< LVRModelBridge > ModelBridgePtr
void setName(QString name)
void setPose(const Pose &pose)
Definition: LVRPoseItem.cpp:69
void setPose(const Pose &pose)
void setModelVisibility(int column, bool globalValue)


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