diff --git a/src/ui/map3D/Pixhawk3DWidget.cc b/src/ui/map3D/Pixhawk3DWidget.cc index ef973285cbbc48f1ea9df170671ee00fa661664d..ebdd765e5f3336bc8e1e10dd321e68b6bafd1284 100644 --- a/src/ui/map3D/Pixhawk3DWidget.cc +++ b/src/ui/map3D/Pixhawk3DWidget.cc @@ -385,6 +385,24 @@ Pixhawk3DWidget::setpointChanged(int uasId, float x, float y, float z, } } +void +Pixhawk3DWidget::clearData(void) +{ + QMutableMapIterator it(mSystemContainerMap); + while (it.hasNext()) + { + it.next(); + + SystemContainer& systemData = it.value(); + + // clear setpoint data + systemData.setpointGroupNode()->removeChildren(0, systemData.setpointGroupNode()->getNumChildren()); + + // clear trail data + systemData.trailMap().clear(); + } +} + void Pixhawk3DWidget::showViewParamWindow(void) { @@ -1002,12 +1020,16 @@ Pixhawk3DWidget::addModels(QVector< osg::ref_ptr >& models, void Pixhawk3DWidget::buildLayout(void) { + QPushButton* clearDataButton = new QPushButton(this); + clearDataButton->setText("Clear Data"); + QPushButton* viewParamWindowButton = new QPushButton(this); viewParamWindowButton->setCheckable(true); viewParamWindowButton->setText("View Parameters"); QHBoxLayout* layoutTop = new QHBoxLayout; layoutTop->addItem(new QSpacerItem(10, 0, QSizePolicy::Expanding, QSizePolicy::Expanding)); + layoutTop->addWidget(clearDataButton); layoutTop->addWidget(viewParamWindowButton); QPushButton* recenterButton = new QPushButton(this); @@ -1031,6 +1053,8 @@ Pixhawk3DWidget::buildLayout(void) layout->setRowStretch(1, 100); layout->setRowStretch(2, 1); + connect(clearDataButton, SIGNAL(clicked()), + this, SLOT(clearData())); connect(viewParamWindowButton, SIGNAL(clicked()), this, SLOT(showViewParamWindow())); connect(recenterButton, SIGNAL(clicked()), diff --git a/src/ui/map3D/Pixhawk3DWidget.h b/src/ui/map3D/Pixhawk3DWidget.h index b7713a13025e939af92b564bc29970e6d602cff9..61cfecac37cf951de57f1dee9a4c80919e8de5b4 100644 --- a/src/ui/map3D/Pixhawk3DWidget.h +++ b/src/ui/map3D/Pixhawk3DWidget.h @@ -66,6 +66,7 @@ signals: void systemCreatedSignal(UASInterface* uas); private slots: + void clearData(void); void showViewParamWindow(void); void followCameraChanged(int systemId); void recenterActiveCamera(void);