From bcde4bc6a68ef36a4e687ecbd1284937598c4fd2 Mon Sep 17 00:00:00 2001 From: Raphael Grimm <raphael.grimm@kit.edu> Date: Fri, 26 Mar 2021 16:10:50 +0100 Subject: [PATCH] Allow more draw options elements of ArVizDrawerGui --- .../ArVizDrawerGui/Elements/PoseWidget.cpp | 3 +- .../ArVizDrawerGui/Elements/PoseWidget.ui | 153 +++++++----- .../ArVizDrawerGui/Elements/RobotWidget.cpp | 26 ++- .../ArVizDrawerGui/Elements/RobotWidget.ui | 221 +++++++++++------- 4 files changed, 252 insertions(+), 151 deletions(-) diff --git a/source/RobotAPI/gui-plugins/ArVizDrawerGui/Elements/PoseWidget.cpp b/source/RobotAPI/gui-plugins/ArVizDrawerGui/Elements/PoseWidget.cpp index 9935aa736..61e5af2ff 100644 --- a/source/RobotAPI/gui-plugins/ArVizDrawerGui/Elements/PoseWidget.cpp +++ b/source/RobotAPI/gui-plugins/ArVizDrawerGui/Elements/PoseWidget.cpp @@ -11,6 +11,7 @@ namespace armarx _ui.doubleSpinBoxTZ->value()) .orientation(_ui.doubleSpinBoxRX->value(), _ui.doubleSpinBoxRY->value(), - _ui.doubleSpinBoxRZ->value())); + _ui.doubleSpinBoxRZ->value()) + .scale(_ui.doubleSpinBoxScale->value())); } } diff --git a/source/RobotAPI/gui-plugins/ArVizDrawerGui/Elements/PoseWidget.ui b/source/RobotAPI/gui-plugins/ArVizDrawerGui/Elements/PoseWidget.ui index 4d29e4f91..fc726d091 100644 --- a/source/RobotAPI/gui-plugins/ArVizDrawerGui/Elements/PoseWidget.ui +++ b/source/RobotAPI/gui-plugins/ArVizDrawerGui/Elements/PoseWidget.ui @@ -26,6 +26,22 @@ <property name="bottomMargin"> <number>0</number> </property> + <item row="3" column="2"> + <widget class="QDoubleSpinBox" name="doubleSpinBoxRY"> + <property name="decimals"> + <number>3</number> + </property> + <property name="minimum"> + <double>-10.000000000000000</double> + </property> + <property name="maximum"> + <double>10.000000000000000</double> + </property> + <property name="singleStep"> + <double>0.010000000000000</double> + </property> + </widget> + </item> <item row="0" column="0" colspan="4"> <widget class="Line" name="line"> <property name="orientation"> @@ -33,62 +49,38 @@ </property> </widget> </item> - <item row="1" column="0" colspan="4"> - <layout class="QHBoxLayout" name="horizontalLayout"> - <item> - <widget class="QLabel" name="label"> - <property name="text"> - <string>Pose</string> - </property> - </widget> - </item> - <item> - <widget class="QPushButton" name="pushButtonDelete"> - <property name="maximumSize"> - <size> - <width>22</width> - <height>16777215</height> - </size> - </property> - <property name="text"> - <string>X</string> - </property> - <property name="checkable"> - <bool>true</bool> - </property> - </widget> - </item> - </layout> + <item row="2" column="1"> + <widget class="QDoubleSpinBox" name="doubleSpinBoxTX"> + <property name="maximum"> + <double>100000.000000000000000</double> + </property> + <property name="value"> + <double>0.000000000000000</double> + </property> + </widget> </item> - <item row="2" column="0"> - <widget class="QLabel" name="label_4"> + <item row="3" column="0"> + <widget class="QLabel" name="label_5"> <property name="text"> - <string>XYZ</string> + <string>RPY</string> </property> </widget> </item> - <item row="2" column="2"> - <widget class="QDoubleSpinBox" name="doubleSpinBoxTY"> + <item row="2" column="3"> + <widget class="QDoubleSpinBox" name="doubleSpinBoxTZ"> <property name="minimum"> <double>-100000.000000000000000</double> </property> <property name="maximum"> <double>100000.000000000000000</double> </property> - </widget> - </item> - <item row="2" column="1"> - <widget class="QDoubleSpinBox" name="doubleSpinBoxTX"> - <property name="maximum"> - <double>100000.000000000000000</double> - </property> <property name="value"> <double>0.000000000000000</double> </property> </widget> </item> - <item row="3" column="2"> - <widget class="QDoubleSpinBox" name="doubleSpinBoxRY"> + <item row="3" column="1"> + <widget class="QDoubleSpinBox" name="doubleSpinBoxRX"> <property name="decimals"> <number>3</number> </property> @@ -98,30 +90,50 @@ <property name="maximum"> <double>10.000000000000000</double> </property> + <property name="singleStep"> + <double>0.010000000000000</double> + </property> </widget> </item> - <item row="3" column="3"> - <widget class="QDoubleSpinBox" name="doubleSpinBoxRZ"> - <property name="decimals"> - <number>3</number> - </property> + <item row="2" column="2"> + <widget class="QDoubleSpinBox" name="doubleSpinBoxTY"> <property name="minimum"> - <double>-10.000000000000000</double> + <double>-100000.000000000000000</double> </property> <property name="maximum"> - <double>10.000000000000000</double> + <double>100000.000000000000000</double> </property> </widget> </item> - <item row="3" column="0"> - <widget class="QLabel" name="label_5"> - <property name="text"> - <string>RPY</string> - </property> - </widget> + <item row="1" column="0" colspan="4"> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> + <widget class="QLabel" name="label"> + <property name="text"> + <string>Pose</string> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="pushButtonDelete"> + <property name="maximumSize"> + <size> + <width>22</width> + <height>16777215</height> + </size> + </property> + <property name="text"> + <string>X</string> + </property> + <property name="checkable"> + <bool>true</bool> + </property> + </widget> + </item> + </layout> </item> - <item row="3" column="1"> - <widget class="QDoubleSpinBox" name="doubleSpinBoxRX"> + <item row="3" column="3"> + <widget class="QDoubleSpinBox" name="doubleSpinBoxRZ"> <property name="decimals"> <number>3</number> </property> @@ -131,9 +143,12 @@ <property name="maximum"> <double>10.000000000000000</double> </property> + <property name="singleStep"> + <double>0.010000000000000</double> + </property> </widget> </item> - <item row="4" column="1"> + <item row="5" column="1"> <spacer name="verticalSpacer"> <property name="orientation"> <enum>Qt::Vertical</enum> @@ -146,16 +161,30 @@ </property> </spacer> </item> - <item row="2" column="3"> - <widget class="QDoubleSpinBox" name="doubleSpinBoxTZ"> - <property name="minimum"> - <double>-100000.000000000000000</double> + <item row="2" column="0"> + <widget class="QLabel" name="label_4"> + <property name="text"> + <string>XYZ</string> </property> + </widget> + </item> + <item row="4" column="1"> + <widget class="QDoubleSpinBox" name="doubleSpinBoxScale"> <property name="maximum"> - <double>100000.000000000000000</double> + <double>1000.000000000000000</double> + </property> + <property name="singleStep"> + <double>0.100000000000000</double> </property> <property name="value"> - <double>0.000000000000000</double> + <double>1.000000000000000</double> + </property> + </widget> + </item> + <item row="4" column="0"> + <widget class="QLabel" name="label_2"> + <property name="text"> + <string>Scale</string> </property> </widget> </item> diff --git a/source/RobotAPI/gui-plugins/ArVizDrawerGui/Elements/RobotWidget.cpp b/source/RobotAPI/gui-plugins/ArVizDrawerGui/Elements/RobotWidget.cpp index d9acbc51e..1e1866223 100644 --- a/source/RobotAPI/gui-plugins/ArVizDrawerGui/Elements/RobotWidget.cpp +++ b/source/RobotAPI/gui-plugins/ArVizDrawerGui/Elements/RobotWidget.cpp @@ -5,14 +5,22 @@ namespace armarx void RobotWidget::addTo(viz::Layer& layer) const { const auto adr = reinterpret_cast<std::intptr_t>(this); - layer.add(viz::Robot("Robot_" + std::to_string(adr)) - .file(_ui.lineEditProject->text().toStdString(), - _ui.comboBoxFile->currentText().toStdString()) - .position(_ui.doubleSpinBoxTX->value(), - _ui.doubleSpinBoxTY->value(), - _ui.doubleSpinBoxTZ->value()) - .orientation(_ui.doubleSpinBoxRX->value(), - _ui.doubleSpinBoxRY->value(), - _ui.doubleSpinBoxRZ->value())); + auto r = viz::Robot("Robot_" + std::to_string(adr)) + .file(_ui.lineEditProject->text().toStdString(), + _ui.comboBoxFile->currentText().toStdString()) + .position(_ui.doubleSpinBoxTX->value(), + _ui.doubleSpinBoxTY->value(), + _ui.doubleSpinBoxTZ->value()) + .orientation(_ui.doubleSpinBoxRX->value(), + _ui.doubleSpinBoxRY->value(), + _ui.doubleSpinBoxRZ->value()); + if (_ui.checkBoxColor->isChecked()) + { + r.overrideColor(viz::Color{static_cast<float>(_ui.doubleSpinBoxR->value()), + static_cast<float>(_ui.doubleSpinBoxG->value()), + static_cast<float>(_ui.doubleSpinBoxB->value()), + static_cast<float>(_ui.doubleSpinBoxA->value())}); + } + layer.add(r); } } diff --git a/source/RobotAPI/gui-plugins/ArVizDrawerGui/Elements/RobotWidget.ui b/source/RobotAPI/gui-plugins/ArVizDrawerGui/Elements/RobotWidget.ui index e8e294d6e..0858c31b0 100644 --- a/source/RobotAPI/gui-plugins/ArVizDrawerGui/Elements/RobotWidget.ui +++ b/source/RobotAPI/gui-plugins/ArVizDrawerGui/Elements/RobotWidget.ui @@ -39,10 +39,66 @@ </property> </widget> </item> - <item row="3" column="0"> - <widget class="QLabel" name="label_3"> + <item row="4" column="0"> + <widget class="QLabel" name="label_4"> <property name="text"> - <string>Robot file</string> + <string>Base XYZ</string> + </property> + </widget> + </item> + <item row="3" column="1" colspan="3"> + <widget class="QComboBox" name="comboBoxFile"> + <property name="editable"> + <bool>true</bool> + </property> + <item> + <property name="text"> + <string>Armar6RT/robotmodel/Armar6-SH/Armar6-SH.xml</string> + </property> + </item> + <item> + <property name="text"> + <string>Armar6RT/robotmodel/Armar6-SH/Armar6-RightHand-v3.xml</string> + </property> + </item> + <item> + <property name="text"> + <string>Armar6RT/robotmodel/Armar6-SH/Armar6-LeftHand-v3.xml</string> + </property> + </item> + </widget> + </item> + <item row="1" column="0" colspan="4"> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> + <widget class="QLabel" name="label"> + <property name="text"> + <string>Robot</string> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="pushButtonDelete"> + <property name="maximumSize"> + <size> + <width>22</width> + <height>16777215</height> + </size> + </property> + <property name="text"> + <string>X</string> + </property> + <property name="checkable"> + <bool>true</bool> + </property> + </widget> + </item> + </layout> + </item> + <item row="0" column="0" colspan="4"> + <widget class="Line" name="line"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> </property> </widget> </item> @@ -57,28 +113,31 @@ <property name="maximum"> <double>10.000000000000000</double> </property> + <property name="singleStep"> + <double>0.010000000000000</double> + </property> </widget> </item> - <item row="4" column="1"> - <widget class="QDoubleSpinBox" name="doubleSpinBoxTX"> - <property name="maximum"> - <double>100000.000000000000000</double> + <item row="2" column="0"> + <widget class="QLabel" name="label_2"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> </property> - <property name="value"> - <double>0.000000000000000</double> + <property name="text"> + <string>Project name</string> </property> </widget> </item> - <item row="5" column="3"> - <widget class="QDoubleSpinBox" name="doubleSpinBoxRZ"> - <property name="decimals"> - <number>3</number> - </property> + <item row="4" column="2"> + <widget class="QDoubleSpinBox" name="doubleSpinBoxTY"> <property name="minimum"> - <double>-10.000000000000000</double> + <double>-100000.000000000000000</double> </property> <property name="maximum"> - <double>10.000000000000000</double> + <double>100000.000000000000000</double> </property> </widget> </item> @@ -89,51 +148,42 @@ </property> </widget> </item> - <item row="2" column="0"> - <widget class="QLabel" name="label_2"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> + <item row="4" column="1"> + <widget class="QDoubleSpinBox" name="doubleSpinBoxTX"> + <property name="maximum"> + <double>100000.000000000000000</double> </property> - <property name="text"> - <string>Project name</string> + <property name="value"> + <double>0.000000000000000</double> </property> </widget> </item> - <item row="4" column="0"> - <widget class="QLabel" name="label_4"> + <item row="3" column="0"> + <widget class="QLabel" name="label_3"> <property name="text"> - <string>Base XYZ</string> + <string>Robot file</string> </property> </widget> </item> - <item row="2" column="1" colspan="3"> - <widget class="QLineEdit" name="lineEditProject"/> - </item> - <item row="3" column="1" colspan="3"> - <widget class="QComboBox" name="comboBoxFile"> - <property name="editable"> - <bool>true</bool> + <item row="5" column="3"> + <widget class="QDoubleSpinBox" name="doubleSpinBoxRZ"> + <property name="decimals"> + <number>3</number> + </property> + <property name="minimum"> + <double>-10.000000000000000</double> + </property> + <property name="maximum"> + <double>10.000000000000000</double> + </property> + <property name="singleStep"> + <double>0.010000000000000</double> </property> - <item> - <property name="text"> - <string>Armar6RT/robotmodel/Armar6-SH/Armar6-SH.xml</string> - </property> - </item> - <item> - <property name="text"> - <string>Armar6RT/robotmodel/Armar6-SH/Armar6-RightHand-v3.xml</string> - </property> - </item> - <item> - <property name="text"> - <string>Armar6RT/robotmodel/Armar6-SH/Armar6-LeftHand-v3.xml</string> - </property> - </item> </widget> </item> + <item row="2" column="1" colspan="3"> + <widget class="QLineEdit" name="lineEditProject"/> + </item> <item row="5" column="1"> <widget class="QDoubleSpinBox" name="doubleSpinBoxRX"> <property name="decimals"> @@ -145,52 +195,65 @@ <property name="maximum"> <double>10.000000000000000</double> </property> + <property name="singleStep"> + <double>0.010000000000000</double> + </property> </widget> </item> - <item row="4" column="2"> - <widget class="QDoubleSpinBox" name="doubleSpinBoxTY"> - <property name="minimum"> - <double>-100000.000000000000000</double> - </property> - <property name="maximum"> - <double>100000.000000000000000</double> + <item row="6" column="0"> + <widget class="QCheckBox" name="checkBoxColor"> + <property name="text"> + <string>RGBA</string> </property> </widget> </item> - <item row="1" column="0" colspan="4"> - <layout class="QHBoxLayout" name="horizontalLayout"> + <item row="6" column="1" colspan="3"> + <layout class="QHBoxLayout" name="horizontalLayout_2"> <item> - <widget class="QLabel" name="label"> - <property name="text"> - <string>Robot</string> + <widget class="QDoubleSpinBox" name="doubleSpinBoxR"> + <property name="maximum"> + <double>1.000000000000000</double> + </property> + <property name="singleStep"> + <double>0.010000000000000</double> </property> </widget> </item> <item> - <widget class="QPushButton" name="pushButtonDelete"> - <property name="maximumSize"> - <size> - <width>22</width> - <height>16777215</height> - </size> + <widget class="QDoubleSpinBox" name="doubleSpinBoxG"> + <property name="maximum"> + <double>1.000000000000000</double> </property> - <property name="text"> - <string>X</string> + <property name="singleStep"> + <double>0.010000000000000</double> </property> - <property name="checkable"> - <bool>true</bool> + </widget> + </item> + <item> + <widget class="QDoubleSpinBox" name="doubleSpinBoxB"> + <property name="maximum"> + <double>1.000000000000000</double> + </property> + <property name="singleStep"> + <double>0.010000000000000</double> + </property> + </widget> + </item> + <item> + <widget class="QDoubleSpinBox" name="doubleSpinBoxA"> + <property name="maximum"> + <double>1.000000000000000</double> + </property> + <property name="singleStep"> + <double>0.010000000000000</double> + </property> + <property name="value"> + <double>1.000000000000000</double> </property> </widget> </item> </layout> </item> - <item row="0" column="0" colspan="4"> - <widget class="Line" name="line"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - </widget> - </item> </layout> </widget> <resources/> -- GitLab