114 lines
3.1 KiB
C++
114 lines
3.1 KiB
C++
/**
|
|
* @file DialogPCLStatisticalRemoveFilter.cpp
|
|
* @brief None
|
|
* @author 陈增辉 (3045316072@qq.com)
|
|
* @version 2.5.0
|
|
* @date 2024/4/5
|
|
* @copyright Copyright (c) Since 2024 中科卫星应用研究院 All rights reserved.
|
|
*/
|
|
|
|
// You may need to build the project (run Qt uic code generator) to get
|
|
// "ui_DialogPCLStatisticalRemoveFilter.h" resolved
|
|
|
|
#include "DialogPCLStatisticalRemoveFilter.h"
|
|
#include "ui_DialogPCLStatisticalRemoveFilter.h"
|
|
|
|
#include "PythonModule/PyAgent.h"
|
|
#include "MeshData/meshSingleton.h"
|
|
#include "MeshData/meshSet.h"
|
|
#include <QMenu>
|
|
#include <QDebug>
|
|
|
|
|
|
//auto meshData = MeshData::MeshData::getInstance();
|
|
|
|
|
|
namespace MainWidget {
|
|
DialogPCLStatisticalRemoveFilter::DialogPCLStatisticalRemoveFilter(GUI::MainWindow *parent)
|
|
: QFDialog(parent),
|
|
_ui(new Ui::DialogPCLStatisticalRemoveFilter),
|
|
_mw(parent),
|
|
_selectdlg(new DialogSelectComponents(parent))
|
|
{
|
|
_ui->setupUi(this);
|
|
_ui->geoSelectPoint->setToolTip(tr("Clicked Button Selected Components"));
|
|
setWindowTitle(tr("Statistical Remove Filter"));
|
|
_ui->listWidget->setContextMenuPolicy(Qt::CustomContextMenu);
|
|
|
|
|
|
connect(_ui->geoSelectPoint, &QPushButton::clicked, [=]()
|
|
{ _selectdlg->clearSelectItems(); _selectdlg->exec(); });
|
|
connect(_selectdlg, SIGNAL(selectedComponentsSig(QList<MeshData::MeshSet *>)), this, SLOT(selectedComponentsSlot(QList<MeshData::MeshSet *>)));
|
|
connect(_ui->listWidget, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(customContextMenuRequestedSlot(const QPoint &)));
|
|
}
|
|
|
|
DialogPCLStatisticalRemoveFilter::~DialogPCLStatisticalRemoveFilter()
|
|
{
|
|
delete _ui;
|
|
_ui = NULL;
|
|
delete _selectdlg;
|
|
_selectdlg = NULL;
|
|
}
|
|
|
|
|
|
|
|
|
|
void DialogPCLStatisticalRemoveFilter::accept()
|
|
{
|
|
if (_components.size() == 0)
|
|
return;
|
|
|
|
QString componentIds, rotate, moveLocation, scale;
|
|
for (auto component : _components)
|
|
componentIds.append(QString(",%1").arg(component->getID()));
|
|
componentIds.remove(0, 1);
|
|
|
|
double MeanK=_ui->MeanK->value();
|
|
double stddev=_ui->Stddev->value();
|
|
|
|
emit excuteAlg(componentIds,MeanK,stddev);
|
|
|
|
QFDialog::accept();
|
|
}
|
|
|
|
void DialogPCLStatisticalRemoveFilter::selectedComponentsSlot(QList<MeshData::MeshSet *> components)
|
|
{
|
|
for (MeshData::MeshSet *set : components)
|
|
{
|
|
if (_components.contains(set))
|
|
continue;
|
|
_components.append(set);
|
|
_ui->listWidget->addItem(set->getName());
|
|
}
|
|
}
|
|
|
|
void DialogPCLStatisticalRemoveFilter::customContextMenuRequestedSlot(const QPoint &point)
|
|
{
|
|
QListWidgetItem *curItem = _ui->listWidget->itemAt(point);
|
|
if (!curItem)
|
|
return;
|
|
|
|
QMenu *menu = new QMenu(this);
|
|
QAction *deleteItem = new QAction(tr("delete this item"));
|
|
menu->addAction(deleteItem);
|
|
connect(menu, &QMenu::triggered, [=]()
|
|
{ removeCurrentItem(curItem); });
|
|
menu->exec(QCursor::pos());
|
|
}
|
|
|
|
void DialogPCLStatisticalRemoveFilter::removeCurrentItem(QListWidgetItem *curItem)
|
|
{
|
|
auto meshData = MeshData::MeshData::getInstance();
|
|
auto meshSet = meshData->getMeshSetByName(curItem->text());
|
|
if (!meshSet)
|
|
return;
|
|
_components.removeOne(meshSet);
|
|
_ui->listWidget->removeItemWidget(curItem);
|
|
delete curItem;
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace MainWidget
|