From 2aba2ef73861eb8151635df6c2eac9858bd2aaae Mon Sep 17 00:00:00 2001 From: Samuils Rulovs Date: Mon, 6 Sep 2021 15:42:16 +0200 Subject: [PATCH 1/5] Added delete Object function --- UserInterface/MainWindow.cpp | 15 +++++++++++++++ UserInterface/MainWindow.h | 1 + 2 files changed, 16 insertions(+) diff --git a/UserInterface/MainWindow.cpp b/UserInterface/MainWindow.cpp index 258b5a5ed..7f7b1ec97 100644 --- a/UserInterface/MainWindow.cpp +++ b/UserInterface/MainWindow.cpp @@ -552,6 +552,17 @@ void OpenInfraPlatform::UserInterface::MainWindow::updateModelsUI() // do nothing } + //6. Function delete an object + if (std::dynamic_pointer_cast(model)) + { + auto itemDeleteObject = new QTreeWidgetItem(itemModel); + itemDeleteObject->setText(0, "Delete object"); + + QPushButton *launchDeleteObjectButton = new QPushButton(); + launchDeleteObjectButton->setText("Delete object"); + QObject::connect(launchDeleteObjectButton, SIGNAL(clicked()), this, SLOT(on_actionDeleteObject_triggered())); + modelsTreeWidget_->setItemWidget(itemDeleteObject, 1, launchDeleteObjectButton); + } // expanded per default itemModel->setExpanded(true); } @@ -910,6 +921,10 @@ void OpenInfraPlatform::UserInterface::MainWindow::actionGetCameraState() { */ } +void OpenInfraPlatform::UserInterface::MainWindow::on_actionDeleteObject_triggered(){ + +} + #ifdef OIP_WITH_POINT_CLOUD_PROCESSING void OpenInfraPlatform::UserInterface::MainWindow::on_actionMerge_LAS_File_triggered() { diff --git a/UserInterface/MainWindow.h b/UserInterface/MainWindow.h index c9528ed0c..81ae6ea1e 100644 --- a/UserInterface/MainWindow.h +++ b/UserInterface/MainWindow.h @@ -186,6 +186,7 @@ namespace OpenInfraPlatform //void on_actionVertical_alignment_triggered(); void on_actionViewport_as_screenshot_triggered(); //void on_actionAdd_Georeference_triggered(); + void on_actionDeleteObject_triggered(); //void on_checkBoxDifferentColorsForVerticalAlignmentElements_clicked(bool checked); //void on_checkBoxHighlightSelectedAlignmentSegment_clicked(bool checked); From 2d2ef2f380a98b9283a64b537a9b010f8bc67b89 Mon Sep 17 00:00:00 2001 From: Samuils Rulovs Date: Wed, 8 Sep 2021 12:03:06 +0200 Subject: [PATCH 2/5] Trying to implement delete object function --- UserInterface/MainWindow.cpp | 10 ++++++++-- UserInterface/MainWindow.h | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/UserInterface/MainWindow.cpp b/UserInterface/MainWindow.cpp index 7f7b1ec97..dfe2b32ae 100644 --- a/UserInterface/MainWindow.cpp +++ b/UserInterface/MainWindow.cpp @@ -560,7 +560,7 @@ void OpenInfraPlatform::UserInterface::MainWindow::updateModelsUI() QPushButton *launchDeleteObjectButton = new QPushButton(); launchDeleteObjectButton->setText("Delete object"); - QObject::connect(launchDeleteObjectButton, SIGNAL(clicked()), this, SLOT(on_actionDeleteObject_triggered())); + QObject::connect(launchDeleteObjectButton, SIGNAL(clicked()), this, SLOT(on_actionDeleteObject_triggered(model, filename))); modelsTreeWidget_->setItemWidget(itemDeleteObject, 1, launchDeleteObjectButton); } // expanded per default @@ -921,8 +921,14 @@ void OpenInfraPlatform::UserInterface::MainWindow::actionGetCameraState() { */ } -void OpenInfraPlatform::UserInterface::MainWindow::on_actionDeleteObject_triggered(){ +void OpenInfraPlatform::UserInterface::MainWindow::on_actionDeleteObject_triggered(const std::shared_ptr& model, const QString& filename){ + + QMessageBox::information(this, tr("Delete object"), + tr("The Button works!"), QMessageBox::Ok); + //OpenInfraPlatform::Core::DataManagement::Data::removeModel(model); + for (auto el : modelsTreeWidget_->findItems(filename, Qt::MatchFlag::MatchExactly, 1)) + modelsTreeWidget_->invisibleRootItem()->removeChild(el); } #ifdef OIP_WITH_POINT_CLOUD_PROCESSING diff --git a/UserInterface/MainWindow.h b/UserInterface/MainWindow.h index 81ae6ea1e..1e07f35e4 100644 --- a/UserInterface/MainWindow.h +++ b/UserInterface/MainWindow.h @@ -186,7 +186,7 @@ namespace OpenInfraPlatform //void on_actionVertical_alignment_triggered(); void on_actionViewport_as_screenshot_triggered(); //void on_actionAdd_Georeference_triggered(); - void on_actionDeleteObject_triggered(); + void on_actionDeleteObject_triggered(const std::shared_ptr& model, const QString& fileName); //void on_checkBoxDifferentColorsForVerticalAlignmentElements_clicked(bool checked); //void on_checkBoxHighlightSelectedAlignmentSegment_clicked(bool checked); From e1fcc3f2bed4db1dd6bd22e7d1a04b7d81083d68 Mon Sep 17 00:00:00 2001 From: Samuils Rulovs Date: Sun, 12 Sep 2021 13:34:39 +0300 Subject: [PATCH 3/5] Updated function "Delete object", thus it would work on click --- UserInterface/MainWindow.cpp | 22 ++++++++++------------ UserInterface/MainWindow.h | 2 +- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/UserInterface/MainWindow.cpp b/UserInterface/MainWindow.cpp index dfe2b32ae..706e791c8 100644 --- a/UserInterface/MainWindow.cpp +++ b/UserInterface/MainWindow.cpp @@ -552,17 +552,15 @@ void OpenInfraPlatform::UserInterface::MainWindow::updateModelsUI() // do nothing } - //6. Function delete an object - if (std::dynamic_pointer_cast(model)) - { - auto itemDeleteObject = new QTreeWidgetItem(itemModel); - itemDeleteObject->setText(0, "Delete object"); - - QPushButton *launchDeleteObjectButton = new QPushButton(); - launchDeleteObjectButton->setText("Delete object"); - QObject::connect(launchDeleteObjectButton, SIGNAL(clicked()), this, SLOT(on_actionDeleteObject_triggered(model, filename))); - modelsTreeWidget_->setItemWidget(itemDeleteObject, 1, launchDeleteObjectButton); - } + //7. Function delete an object + auto itemDeleteObject = new QTreeWidgetItem(itemModel); + itemDeleteObject->setText(0, "Delete object"); + + QPushButton *launchDeleteObjectButton = new QPushButton(); + launchDeleteObjectButton->setText("Delete object"); + QObject::connect(launchDeleteObjectButton, &QPushButton::clicked, [this, model, filename] {on_actionDeleteObject_triggered(model, filename); }); + modelsTreeWidget_->setItemWidget(itemDeleteObject, 1, launchDeleteObjectButton); + // expanded per default itemModel->setExpanded(true); } @@ -921,7 +919,7 @@ void OpenInfraPlatform::UserInterface::MainWindow::actionGetCameraState() { */ } -void OpenInfraPlatform::UserInterface::MainWindow::on_actionDeleteObject_triggered(const std::shared_ptr& model, const QString& filename){ +void OpenInfraPlatform::UserInterface::MainWindow::on_actionDeleteObject_triggered(const std::shared_ptr& model, const QString& filename){ QMessageBox::information(this, tr("Delete object"), tr("The Button works!"), QMessageBox::Ok); diff --git a/UserInterface/MainWindow.h b/UserInterface/MainWindow.h index 1e07f35e4..52af95e86 100644 --- a/UserInterface/MainWindow.h +++ b/UserInterface/MainWindow.h @@ -186,7 +186,7 @@ namespace OpenInfraPlatform //void on_actionVertical_alignment_triggered(); void on_actionViewport_as_screenshot_triggered(); //void on_actionAdd_Georeference_triggered(); - void on_actionDeleteObject_triggered(const std::shared_ptr& model, const QString& fileName); + void on_actionDeleteObject_triggered(const std::shared_ptr& model, const QString& fileName); //void on_checkBoxDifferentColorsForVerticalAlignmentElements_clicked(bool checked); //void on_checkBoxHighlightSelectedAlignmentSegment_clicked(bool checked); From af21b5f432f8cc49f8bebacc5c36a1402f152392 Mon Sep 17 00:00:00 2001 From: Samuils Rulovs Date: Fri, 12 Nov 2021 13:40:49 +0100 Subject: [PATCH 4/5] Some changes to delete Object function --- UserInterface/MainWindow.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/UserInterface/MainWindow.cpp b/UserInterface/MainWindow.cpp index 706e791c8..0fe3cf351 100644 --- a/UserInterface/MainWindow.cpp +++ b/UserInterface/MainWindow.cpp @@ -923,7 +923,8 @@ void OpenInfraPlatform::UserInterface::MainWindow::on_actionDeleteObject_trigger QMessageBox::information(this, tr("Delete object"), tr("The Button works!"), QMessageBox::Ok); - //OpenInfraPlatform::Core::DataManagement::Data::removeModel(model); + auto data = OpenInfraPlatform::Core::DataManagement::Data::Data(); + data.removeModel(model); for (auto el : modelsTreeWidget_->findItems(filename, Qt::MatchFlag::MatchExactly, 1)) modelsTreeWidget_->invisibleRootItem()->removeChild(el); From 4166de84d037e1123df593e0b2850b426b35d97e Mon Sep 17 00:00:00 2001 From: Samuils Rulovs Date: Sun, 9 Apr 2023 12:12:51 +0200 Subject: [PATCH 5/5] Commenting out the code --- UserInterface/MainWindow.cpp | 37 ++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/UserInterface/MainWindow.cpp b/UserInterface/MainWindow.cpp index c8a5bcf82..c51b3d2d9 100644 --- a/UserInterface/MainWindow.cpp +++ b/UserInterface/MainWindow.cpp @@ -554,13 +554,18 @@ void OpenInfraPlatform::UserInterface::MainWindow::updateModelsUI() } //7. Function delete an object - auto itemDeleteObject = new QTreeWidgetItem(itemModel); - itemDeleteObject->setText(0, "Delete object"); - QPushButton *launchDeleteObjectButton = new QPushButton(); - launchDeleteObjectButton->setText("Delete object"); - QObject::connect(launchDeleteObjectButton, &QPushButton::clicked, [this, model, filename] {on_actionDeleteObject_triggered(model, filename); }); - modelsTreeWidget_->setItemWidget(itemDeleteObject, 1, launchDeleteObjectButton); + //// Create a button for deleting an object + //auto deleteObjectButton = new QPushButton(); + //deleteObjectButton->setText("Delete object"); + + //// Connect the button to the slot for deleting an object + //QObject::connect(deleteObjectButton, &QPushButton::clicked, [this, model, filename] {on_actionDeleteObject_triggered(model, filename); }); + + //// Create a QTreeWidgetItem for the delete object button + //auto itemDeleteObject = new QTreeWidgetItem(itemModel); + //itemDeleteObject->setText(0, "Delete object"); + //modelsTreeWidget_->setItemWidget(itemDeleteObject, 1, deleteObjectButton); // expanded per default itemModel->setExpanded(true); @@ -920,16 +925,16 @@ void OpenInfraPlatform::UserInterface::MainWindow::actionGetCameraState() { */ } -void OpenInfraPlatform::UserInterface::MainWindow::on_actionDeleteObject_triggered(const std::shared_ptr& model, const QString& filename){ - - QMessageBox::information(this, tr("Delete object"), - tr("The Button works!"), QMessageBox::Ok); - auto data = OpenInfraPlatform::Core::DataManagement::Data::Data(); - data.removeModel(model); - - for (auto el : modelsTreeWidget_->findItems(filename, Qt::MatchFlag::MatchExactly, 1)) - modelsTreeWidget_->invisibleRootItem()->removeChild(el); -} +//void OpenInfraPlatform::UserInterface::MainWindow::on_actionDeleteObject_triggered(const std::shared_ptr& model, const QString& filename){ +// +// //QMessageBox::information(this, tr("Delete object"), +// // tr("The Button works!"), QMessageBox::Ok); +// //auto data = OpenInfraPlatform::Core::DataManagement::Data::Data(); +// //data.removeModel(model); +// +// //for (auto el : modelsTreeWidget_->findItems(filename, Qt::MatchFlag::MatchExactly, 1)) +// // modelsTreeWidget_->invisibleRootItem()->removeChild(el); +//} #ifdef OIP_WITH_POINT_CLOUD_PROCESSING