Commit 24d54627 authored by roangel's avatar roangel
Browse files

added checkbox and textbox for scale of CFs. Need to polish it a bit, need to...

added checkbox and textbox for scale of CFs. Need to polish it a bit, need to check multiple CFs working
parent ba7fb0d1
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject> <!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.0.2, 2017-05-12T16:06:37. --> <!-- Written by QtCreator 4.0.2, 2017-05-18T11:46:07. -->
<qtcreator> <qtcreator>
<data> <data>
<variable>EnvironmentId</variable> <variable>EnvironmentId</variable>
......
...@@ -32,6 +32,8 @@ public: ...@@ -32,6 +32,8 @@ public:
std::string getName(); std::string getName();
void setScaleCFs(double scale);
private: private:
// info to fill by message // info to fill by message
......
...@@ -100,6 +100,10 @@ private slots: ...@@ -100,6 +100,10 @@ private slots:
#ifdef CATKIN_MAKE #ifdef CATKIN_MAKE
void updateNewViconData(const ptrToMessage& p_msg); void updateNewViconData(const ptrToMessage& p_msg);
#endif #endif
void on_checkBox_vicon_crazyflies_toggled(bool checked);
void on_scaleSpinBox_valueChanged(double arg1);
private: private:
Ui::MainGUIWindow *ui; Ui::MainGUIWindow *ui;
......
...@@ -16,6 +16,11 @@ crazyFly::~crazyFly() ...@@ -16,6 +16,11 @@ crazyFly::~crazyFly()
{ {
} }
void crazyFly::setScaleCFs(double scale)
{
this->setScale(scale);
}
std::string crazyFly::getName() std::string crazyFly::getName()
{ {
return m_name; return m_name;
......
...@@ -66,6 +66,14 @@ void MainGUIWindow::set_tabs(int n) ...@@ -66,6 +66,14 @@ void MainGUIWindow::set_tabs(int n)
void MainGUIWindow::_init() void MainGUIWindow::_init()
{ {
// initialize checkboxes, spinboxes,....
ui->scaleSpinBox->setRange(0.1, 100);
ui->scaleSpinBox->setSingleStep(0.1);
ui->scaleSpinBox->setValue(1);
ui->checkBox_vicon_crazyflies->setChecked(false);
ui->scaleSpinBox->setEnabled(false);
ui->graphicsView->setViewportUpdateMode(QGraphicsView::FullViewportUpdate); ui->graphicsView->setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
...@@ -157,7 +165,10 @@ void MainGUIWindow::updateNewViconData(const ptrToMessage& p_msg) //connected to ...@@ -157,7 +165,10 @@ void MainGUIWindow::updateNewViconData(const ptrToMessage& p_msg) //connected to
else else
{ {
crazyFly* tmp_p_crazyfly = new crazyFly(&(p_msg->crazyflies[i])); crazyFly* tmp_p_crazyfly = new crazyFly(&(p_msg->crazyflies[i]));
scene->addItem(tmp_p_crazyfly); if(ui->checkBox_vicon_crazyflies->checkState() == Qt::Checked)
{
scene->addItem(tmp_p_crazyfly);
}
crazyflies_vector.push_back(tmp_p_crazyfly); crazyflies_vector.push_back(tmp_p_crazyfly);
} }
} }
...@@ -334,45 +345,83 @@ void MainGUIWindow::on_pushButton_fitAll_clicked() ...@@ -334,45 +345,83 @@ void MainGUIWindow::on_pushButton_fitAll_clicked()
void MainGUIWindow::on_checkBox_vicon_markers_toggled(bool checked) void MainGUIWindow::on_checkBox_vicon_markers_toggled(bool checked)
{ {
#ifdef CATKIN_MAKE
if(checked) if(checked)
{ {
#ifdef CATKIN_MAKE
for(int i = 0; i < markers_vector.size(); i++) for(int i = 0; i < markers_vector.size(); i++)
{ {
scene->addItem(markers_vector[i]); scene->addItem(markers_vector[i]);
} }
#endif
ui->checkBox_vicon_highlight_markers->setCheckable(true); ui->checkBox_vicon_highlight_markers->setCheckable(true);
ui->checkBox_vicon_highlight_markers->setEnabled(true); ui->checkBox_vicon_highlight_markers->setEnabled(true);
} }
else else
{ {
#ifdef CATKIN_MAKE
for(int i = 0; i < markers_vector.size(); i++) for(int i = 0; i < markers_vector.size(); i++)
{ {
scene->removeItem(markers_vector[i]); scene->removeItem(markers_vector[i]);
} }
#endif
ui->checkBox_vicon_highlight_markers->setChecked(false); ui->checkBox_vicon_highlight_markers->setChecked(false);
ui->checkBox_vicon_highlight_markers->setCheckable(false); ui->checkBox_vicon_highlight_markers->setCheckable(false);
ui->checkBox_vicon_highlight_markers->setEnabled(false); ui->checkBox_vicon_highlight_markers->setEnabled(false);
} }
#endif
} }
void MainGUIWindow::on_checkBox_vicon_highlight_markers_toggled(bool checked) void MainGUIWindow::on_checkBox_vicon_highlight_markers_toggled(bool checked)
{ {
#ifdef CATKIN_MAKE
if(checked) if(checked)
{ {
#ifdef CATKIN_MAKE
for(int i = 0; i < markers_vector.size(); i++) for(int i = 0; i < markers_vector.size(); i++)
{ {
markers_vector[i]->setHighlighted(); markers_vector[i]->setHighlighted();
} }
#endif
} }
else else
{ {
#ifdef CATKIN_MAKE
for(int i = 0; i < markers_vector.size(); i++) for(int i = 0; i < markers_vector.size(); i++)
{ {
markers_vector[i]->clearHighlighted(); markers_vector[i]->clearHighlighted();
} }
#endif
}
}
void MainGUIWindow::on_checkBox_vicon_crazyflies_toggled(bool checked)
{
if(checked)
{
#ifdef CATKIN_MAKE
for(int i = 0; i < crazyflies_vector.size(); i++)
{
scene->addItem(crazyflies_vector[i]);
}
#endif
ui->scaleSpinBox->setEnabled(true);
}
else
{
#ifdef CATKIN_MAKE
for(int i = 0; i < crazyflies_vector.size(); i++)
{
scene->removeItem(crazyflies_vector[i]);
}
#endif
ui->scaleSpinBox->setEnabled(false);
}
}
void MainGUIWindow::on_scaleSpinBox_valueChanged(double arg1)
{
#ifdef CATKIN_MAKE
for(int i = 0; i < crazyflies_vector.size(); i++)
{
crazyflies_vector[i]->setScaleCFs(arg1);
} }
#endif #endif
} }
...@@ -169,10 +169,10 @@ ...@@ -169,10 +169,10 @@
<widget class="QGroupBox" name="groupBox_2"> <widget class="QGroupBox" name="groupBox_2">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>790</x> <x>760</x>
<y>230</y> <y>230</y>
<width>131</width> <width>171</width>
<height>131</height> <height>171</height>
</rect> </rect>
</property> </property>
<property name="title"> <property name="title">
...@@ -283,6 +283,55 @@ ...@@ -283,6 +283,55 @@
<bool>false</bool> <bool>false</bool>
</property> </property>
</widget> </widget>
<widget class="QCheckBox" name="checkBox_vicon_crazyflies">
<property name="geometry">
<rect>
<x>10</x>
<y>120</y>
<width>69</width>
<height>16</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>7</pointsize>
</font>
</property>
<property name="text">
<string>Show CFs</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
<widget class="QDoubleSpinBox" name="scaleSpinBox">
<property name="geometry">
<rect>
<x>120</x>
<y>120</y>
<width>51</width>
<height>21</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>90</x>
<y>123</y>
<width>28</width>
<height>10</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>7</pointsize>
</font>
</property>
<property name="text">
<string>Scale:</string>
</property>
</widget>
</widget> </widget>
<widget class="QPushButton" name="pushButton_fitAll"> <widget class="QPushButton" name="pushButton_fitAll">
<property name="geometry"> <property name="geometry">
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment