LVRMeshItem.cpp
Go to the documentation of this file.
1 
34 #include "LVRMeshItem.hpp"
35 #include "LVRItemTypes.hpp"
36 
37 namespace lvr2
38 {
39 
40 LVRMeshItem::LVRMeshItem(MeshBufferBridgePtr& ptr, QTreeWidgetItem* parent) :
41  QTreeWidgetItem(parent, LVRMeshItemType), m_meshBridge(ptr)
42 {
43  // set initial values
44  m_opacity = 1;
45  m_color = QColor(255,255,255);
46  m_visible = true;
47  m_shader = 0;
48  m_parent = parent;
49  addSubItems();
50 }
51 
53 {
54  QIcon icon;
55  icon.addFile(QString::fromUtf8(":/qv_mesh_tree_icon.png"), QSize(), QIcon::Normal, QIcon::Off);
56  setIcon(0, icon);
57  setText(0, "Triangle Mesh");
58  setExpanded(true);
59  m_meshBridge->setShading(0);
60 
61  // Setup Infos
62  QTreeWidgetItem* vertItem = new QTreeWidgetItem(this);
63  QString numVerts;
64  vertItem->setText(0, "Num Points:");
65  vertItem->setText(1, numVerts.setNum(m_meshBridge->getNumVertices()));
66  addChild(vertItem);
67 
68  QTreeWidgetItem* faceItem = new QTreeWidgetItem(this);
69  QString numFaces;
70  faceItem->setText(0, "Num Triangles:");
71  faceItem->setText(1, numFaces.setNum(m_meshBridge->getNumTriangles()));
72  addChild(faceItem);
73 }
74 
76 {
77  return m_color;
78 }
79 
80 void LVRMeshItem::setColor(QColor &c)
81 {
82  m_color = c;
83  m_meshBridge->setBaseColor(c.redF(), c.greenF(), c.blueF());
84 }
85 
87 {
88  m_meshBridge->setBaseColor(c.redF(), c.greenF(), c.blueF());
89 }
90 
92 {
93  m_meshBridge->setBaseColor(m_color.redF(), m_color.greenF(), m_color.blueF());
94 }
95 
97 {
98  return m_opacity;
99 }
100 
101 void LVRMeshItem::setOpacity(float &opacity)
102 {
103  m_meshBridge->setOpacity(opacity);
104  m_opacity = opacity;
105 }
106 
108 {
109  return m_visible;
110 }
111 
112 void LVRMeshItem::setVisibility(bool &visibility)
113 {
114  m_meshBridge->setVisibility(visibility);
115  m_visible = visibility;
116 }
117 
119 {
120  return m_shader;
121 }
122 
123 void LVRMeshItem::setShading(int &shader)
124 {
125  m_meshBridge->setShading(shader);
126  m_shader = shader;
127 }
128 
129 vtkSmartPointer<vtkActor> LVRMeshItem::getWireframeActor()
130 {
131  return m_meshBridge->getWireframeActor();
132 }
133 
135 {
136  return m_meshBridge->getMeshBuffer();
137 }
138 
139 vtkSmartPointer<vtkActor> LVRMeshItem::getActor()
140 {
141  return m_meshBridge->getMeshActor();
142 }
143 
145 {
146  // TODO Auto-generated destructor stub
147 }
148 
149 } /* namespace lvr2 */
virtual ~LVRMeshItem()
virtual void addSubItems()
Definition: LVRMeshItem.cpp:52
void setSelectionColor(QColor &c)
Definition: LVRMeshItem.cpp:86
MeshBufferBridgePtr m_meshBridge
Definition: LVRMeshItem.hpp:66
void setColor(QColor &c)
Definition: LVRMeshItem.cpp:80
std::shared_ptr< MeshBuffer > MeshBufferPtr
Definition: MeshBuffer.hpp:217
vtkSmartPointer< vtkActor > getActor()
void setShading(int &shader)
boost::shared_ptr< LVRMeshBufferBridge > MeshBufferBridgePtr
LVRMeshItem(MeshBufferBridgePtr &ptr, QTreeWidgetItem *parent=0)
Definition: LVRMeshItem.cpp:40
void setVisibility(bool &visiblity)
vtkSmartPointer< vtkActor > getWireframeActor()
QTreeWidgetItem * m_parent
Definition: LVRMeshItem.hpp:76
MeshBufferPtr getMeshBuffer()
void setOpacity(float &opacity)


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