LVRBoundingBoxItem.cpp
Go to the documentation of this file.
1 #include "LVRBoundingBoxItem.hpp"
2 
3 #include "LVRItemTypes.hpp"
4 
5 namespace lvr2
6 {
7 
10  QString name,
11  QTreeWidgetItem *parent) : QTreeWidgetItem(parent, LVRBoundingBoxItemType),
12  m_bb(bb),
13  m_name(name)
14 {
15  setText(0, m_name);
16  setCheckState(0, Qt::Unchecked);
17 
18  auto tmp = m_bb->getBoundingBox();
19 
20  QTreeWidgetItem *min_x_item = new QTreeWidgetItem(this);
21  min_x_item->setText(0, "Min X:");
22  min_x_item->setText(1, std::to_string(tmp.getMin().x).c_str());
23 
24  QTreeWidgetItem *min_y_item = new QTreeWidgetItem(this);
25  min_y_item->setText(0, "Min Y:");
26  min_y_item->setText(1, std::to_string(tmp.getMin().y).c_str());
27 
28  QTreeWidgetItem *min_z_item = new QTreeWidgetItem(this);
29  min_z_item->setText(0, "Min Z:");
30  min_z_item->setText(1, std::to_string(tmp.getMin().z).c_str());
31 
32  QTreeWidgetItem *max_x_item = new QTreeWidgetItem(this);
33  max_x_item->setText(0, "Max X:");
34  max_x_item->setText(1, std::to_string(tmp.getMax().x).c_str());
35 
36  QTreeWidgetItem *max_y_item = new QTreeWidgetItem(this);
37  max_y_item->setText(0, "Max Y:");
38  max_y_item->setText(1, std::to_string(tmp.getMax().y).c_str());
39 
40  QTreeWidgetItem *max_z_item = new QTreeWidgetItem(this);
41  max_z_item->setText(0, "Max Z:");
42  max_z_item->setText(1, std::to_string(tmp.getMax().z).c_str());
43 }
44 
46 {
47  bool parent_enabled = true;
48  if (parent() && !parent()->checkState(0))
49  {
50  parent_enabled = false;
51  }
52 
53  if (m_bb)
54  {
55  m_bb->setVisibility(parent_enabled && checkState(0) && visible);
56  }
57 }
58 
59 } // namesapce lvr2
BoundingBoxBridgePtr m_bb
void setVisibility(bool visible)
LVRBoundingBoxItem(BoundingBoxBridgePtr bb, QString name="", QTreeWidgetItem *parent=NULL)
boost::shared_ptr< LVRBoundingBoxBridge > BoundingBoxBridgePtr


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