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"?>
<!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>
<data>
<variable>EnvironmentId</variable>
......
......@@ -32,6 +32,8 @@ public:
std::string getName();
void setScaleCFs(double scale);
private:
// info to fill by message
......
......@@ -100,6 +100,10 @@ private slots:
#ifdef CATKIN_MAKE
void updateNewViconData(const ptrToMessage& p_msg);
#endif
void on_checkBox_vicon_crazyflies_toggled(bool checked);
void on_scaleSpinBox_valueChanged(double arg1);
private:
Ui::MainGUIWindow *ui;
......
......@@ -16,6 +16,11 @@ crazyFly::~crazyFly()
{
}
void crazyFly::setScaleCFs(double scale)
{
this->setScale(scale);
}
std::string crazyFly::getName()
{
return m_name;
......
......@@ -66,6 +66,14 @@ void MainGUIWindow::set_tabs(int n)
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);
......@@ -157,7 +165,10 @@ void MainGUIWindow::updateNewViconData(const ptrToMessage& p_msg) //connected to
else
{
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);
}
}
......@@ -334,45 +345,83 @@ void MainGUIWindow::on_pushButton_fitAll_clicked()
void MainGUIWindow::on_checkBox_vicon_markers_toggled(bool checked)
{
#ifdef CATKIN_MAKE
if(checked)
{
#ifdef CATKIN_MAKE
for(int i = 0; i < markers_vector.size(); i++)
{
scene->addItem(markers_vector[i]);
}
#endif
ui->checkBox_vicon_highlight_markers->setCheckable(true);
ui->checkBox_vicon_highlight_markers->setEnabled(true);
}
else
{
#ifdef CATKIN_MAKE
for(int i = 0; i < markers_vector.size(); i++)
{
scene->removeItem(markers_vector[i]);
}
#endif
ui->checkBox_vicon_highlight_markers->setChecked(false);
ui->checkBox_vicon_highlight_markers->setCheckable(false);
ui->checkBox_vicon_highlight_markers->setEnabled(false);
}
#endif
}
void MainGUIWindow::on_checkBox_vicon_highlight_markers_toggled(bool checked)
{
#ifdef CATKIN_MAKE
if(checked)
{
#ifdef CATKIN_MAKE
for(int i = 0; i < markers_vector.size(); i++)
{
markers_vector[i]->setHighlighted();
}
#endif
}
else
{
#ifdef CATKIN_MAKE
for(int i = 0; i < markers_vector.size(); i++)
{
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
}
......@@ -169,10 +169,10 @@
<widget class="QGroupBox" name="groupBox_2">
<property name="geometry">
<rect>
<x>790</x>
<x>760</x>
<y>230</y>
<width>131</width>
<height>131</height>
<width>171</width>
<height>171</height>
</rect>
</property>
<property name="title">
......@@ -283,6 +283,55 @@
<bool>false</bool>
</property>
</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 class="QPushButton" name="pushButton_fitAll">
<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