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 */
lvr2::LVRMeshItem::resetColor
void resetColor()
Definition: LVRMeshItem.cpp:91
lvr2::MeshBufferBridgePtr
boost::shared_ptr< LVRMeshBufferBridge > MeshBufferBridgePtr
Definition: LVRMeshBufferBridge.hpp:106
lvr2::LVRMeshItem::getActor
vtkSmartPointer< vtkActor > getActor()
Definition: LVRMeshItem.cpp:139
lvr2::LVRMeshItem::setColor
void setColor(QColor &c)
Definition: LVRMeshItem.cpp:80
lvr2::LVRMeshItem::m_meshBridge
MeshBufferBridgePtr m_meshBridge
Definition: LVRMeshItem.hpp:66
lvr2::LVRMeshItem::~LVRMeshItem
virtual ~LVRMeshItem()
Definition: LVRMeshItem.cpp:144
LVRItemTypes.hpp
lvr2::LVRMeshItem::getWireframeActor
vtkSmartPointer< vtkActor > getWireframeActor()
Definition: LVRMeshItem.cpp:129
lvr2::LVRMeshItem::getOpacity
float getOpacity()
Definition: LVRMeshItem.cpp:96
LVRMeshItem.hpp
kfusion::device::Normal
float4 Normal
Definition: internal.hpp:13
lvr2::LVRMeshItem::getColor
QColor getColor()
Definition: LVRMeshItem.cpp:75
lvr2::LVRMeshItem::setShading
void setShading(int &shader)
Definition: LVRMeshItem.cpp:123
lvr2::LVRMeshItem::getMeshBuffer
MeshBufferPtr getMeshBuffer()
Definition: LVRMeshItem.cpp:134
lvr2::LVRMeshItem::getVisibility
bool getVisibility()
Definition: LVRMeshItem.cpp:107
lvr2::LVRMeshItem::m_shader
int m_shader
Definition: LVRMeshItem.hpp:73
lvr2::LVRMeshItem::setSelectionColor
void setSelectionColor(QColor &c)
Definition: LVRMeshItem.cpp:86
lvr2::LVRMeshItem::LVRMeshItem
LVRMeshItem(MeshBufferBridgePtr &ptr, QTreeWidgetItem *parent=0)
Definition: LVRMeshItem.cpp:40
lvr2::LVRMeshItem::getShading
int getShading()
Definition: LVRMeshItem.cpp:118
lvr2::LVRMeshItem::m_visible
bool m_visible
Definition: LVRMeshItem.hpp:72
lvr2
Definition: BaseBufferManipulators.hpp:39
lvr2::MeshBufferPtr
std::shared_ptr< MeshBuffer > MeshBufferPtr
Definition: MeshBuffer.hpp:217
lvr2::LVRMeshItem::m_parent
QTreeWidgetItem * m_parent
Definition: LVRMeshItem.hpp:76
lvr2::LVRMeshItem::m_opacity
float m_opacity
Definition: LVRMeshItem.hpp:71
lvr2::LVRMeshItem::setVisibility
void setVisibility(bool &visiblity)
Definition: LVRMeshItem.cpp:112
lvr2::LVRMeshItem::setOpacity
void setOpacity(float &opacity)
Definition: LVRMeshItem.cpp:101
lvr2::LVRMeshItem::m_color
QColor m_color
Definition: LVRMeshItem.hpp:69
lvr2::LVRMeshItemType
@ LVRMeshItemType
Definition: LVRItemTypes.hpp:42
lvr2::LVRMeshItem::addSubItems
virtual void addSubItems()
Definition: LVRMeshItem.cpp:52


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