parent
1923492cbe
commit
349df169b4
|
@ -3,7 +3,7 @@
|
||||||
#include "Common/DebugLogger.h"
|
#include "Common/DebugLogger.h"
|
||||||
#define MESHON true;
|
#define MESHON true;
|
||||||
#define MESHOFF false;
|
#define MESHOFF false;
|
||||||
#define MESHIMPORT "cgns;msh;neu;stl;dat;vtk;inp"
|
#define MESHIMPORT "cgns;msh;neu;stl;dat;vtk;inp;obj"
|
||||||
#define POINTCLOUDIMPORT "xyz;pcd;ply"
|
#define POINTCLOUDIMPORT "xyz;pcd;ply"
|
||||||
#define MESHEXPORT "vtk;neu;stl"
|
#define MESHEXPORT "vtk;neu;stl"
|
||||||
#define POINTCLOUDEXPORT "pcd;ply"
|
#define POINTCLOUDEXPORT "pcd;ply"
|
||||||
|
|
|
@ -0,0 +1,284 @@
|
||||||
|
#include <QMessageBox>
|
||||||
|
#include "SelectNodeShow.h"
|
||||||
|
#include "ui_SelectNodeShow.h"
|
||||||
|
#include <QtSql/QSqlError>
|
||||||
|
#include <QHeaderView>
|
||||||
|
#include <QtSql/QSqlTableModel>
|
||||||
|
#include <QtSql/QSqlRecord>
|
||||||
|
#include <QtSql/QSqlField>
|
||||||
|
#include "MeshData/meshSingleton.h"
|
||||||
|
#include "MeshData/meshKernal.h"
|
||||||
|
#include "preWindow.h"
|
||||||
|
#include "vtkMeshSelectTableModel.h"
|
||||||
|
#include "Settings/busAPI.h" // 获取高亮颜色
|
||||||
|
#include "Settings/GraphOption.h" // 获取高亮颜色
|
||||||
|
namespace MainWidget {
|
||||||
|
|
||||||
|
SelectNodeShow::SelectNodeShow(PreWindow* preWindow,QWidget* parent)
|
||||||
|
: QDialog(parent)
|
||||||
|
, ui(new Ui::SelectNodeShow)
|
||||||
|
,_preWindow(preWindow)
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
init();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
SelectNodeShow::~SelectNodeShow()
|
||||||
|
{
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SelectNodeShow::search()
|
||||||
|
{
|
||||||
|
on_btnSearch_clicked();
|
||||||
|
}
|
||||||
|
|
||||||
|
void SelectNodeShow::revert()
|
||||||
|
{
|
||||||
|
on_btnCancel_clicked();
|
||||||
|
}
|
||||||
|
|
||||||
|
void SelectNodeShow::submit()
|
||||||
|
{
|
||||||
|
on_btnSubmit_clicked();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool SelectNodeShow::editable()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SelectNodeShow::init()
|
||||||
|
{
|
||||||
|
//m_editMode = false;
|
||||||
|
|
||||||
|
// m_access = new AccessDB(nullptr, "Threshold");
|
||||||
|
// m_access->initDB();
|
||||||
|
|
||||||
|
this->setAttribute(Qt::WA_StyledBackground);
|
||||||
|
|
||||||
|
initTableView();
|
||||||
|
}
|
||||||
|
|
||||||
|
void SelectNodeShow::initTableView()
|
||||||
|
{
|
||||||
|
this->_model=new vtkMeshSelectTableModel(_preWindow,this);
|
||||||
|
this->_model->clear();
|
||||||
|
this->ui->tableView->setModel(this->_model);
|
||||||
|
selectionModel = this->ui->tableView->selectionModel();
|
||||||
|
connect(selectionModel,SIGNAL(currentChanged(const QModelIndex&, const QModelIndex&)),this,SLOT(currentChanged(const QModelIndex&, const QModelIndex&)));
|
||||||
|
// m_sqlModel = new QSqlTableModel(this, m_access);
|
||||||
|
//
|
||||||
|
// m_sqlModel->setTable("XXX");
|
||||||
|
//
|
||||||
|
// m_sqlModel->setEditStrategy(QSqlTableModel::OnManualSubmit);
|
||||||
|
//
|
||||||
|
// if (!m_sqlModel->select()) {
|
||||||
|
// qDebug() << "查询失败";
|
||||||
|
// qDebug() << m_sqlModel->lastError();
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// ui->tableView->setModel(m_sqlModel);
|
||||||
|
//
|
||||||
|
// ui->tableView->setSelectionMode(QAbstractItemView::SingleSelection);
|
||||||
|
// ui->tableView->setSelectionBehavior(QAbstractItemView::SelectRows);
|
||||||
|
//
|
||||||
|
// ui->tableView->setShowGrid(false);
|
||||||
|
//
|
||||||
|
// ui->tableView->verticalHeader()->setVisible(false);
|
||||||
|
//
|
||||||
|
// ui->tableView->setEditTriggers(QTableView::NoEditTriggers);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool SelectNodeShow::editMode()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SelectNodeShow::on_btnEdit_clicked()
|
||||||
|
{
|
||||||
|
// // TODO
|
||||||
|
// // 将其余按键状态置灰
|
||||||
|
// // 将表格的编辑模式打开
|
||||||
|
// m_editMode = true;
|
||||||
|
//
|
||||||
|
// ui->tableView->setEditTriggers(QAbstractItemView::DoubleClicked);
|
||||||
|
//
|
||||||
|
// ui->btnNew->setDisabled(true);
|
||||||
|
// ui->btnNew->setDisabled(true);
|
||||||
|
// ui->btnDelete->setDisabled(true);
|
||||||
|
// ui->btnCancel->setEnabled(true);
|
||||||
|
// ui->btnSubmit->setEnabled(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SelectNodeShow::on_btnNew_clicked()
|
||||||
|
{
|
||||||
|
// 删除指定行数
|
||||||
|
QItemSelectionModel* selectionModel = this->ui->tableView->selectionModel();
|
||||||
|
QModelIndexList selectedIndexes = selectionModel->selectedIndexes();
|
||||||
|
if (selectedIndexes.count() == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
QList<int> rows;
|
||||||
|
for (int i = 0; i < selectedIndexes.count(); i++) {
|
||||||
|
rows.push_back(selectedIndexes[i].row());
|
||||||
|
this->_model->setRemoveFlag(selectedIndexes[i].row(),false);
|
||||||
|
}
|
||||||
|
|
||||||
|
ModuleBase::SelectModel _selectModel=this->_model->getSelectModel();
|
||||||
|
if( _selectModel== ModuleBase::BoxMeshNode || _selectModel == ModuleBase::MeshNode||_selectModel==ModuleBase::BoxMeshSurfaceNode) {
|
||||||
|
this->_model->HightlightRows(rows,Setting::BusAPI::instance()->getGraphOption()->getHighLightColor());
|
||||||
|
} else if(_selectModel == ModuleBase::BoxMeshCell || _selectModel == ModuleBase::MeshCell||_selectModel==ModuleBase::BoxMeshSurfaceCell) {
|
||||||
|
this->_model->HightlightRows(rows,Setting::BusAPI::instance()->getGraphOption()->getHighLightColor());
|
||||||
|
}
|
||||||
|
_preWindow->reRender();
|
||||||
|
this->ui->tableView->show();
|
||||||
|
}
|
||||||
|
|
||||||
|
void SelectNodeShow::on_btnSubmit_clicked()
|
||||||
|
{
|
||||||
|
// 更新items
|
||||||
|
QMultiHash<int, int> selectItems = this->_model->getSelectItems();
|
||||||
|
this->_preWindow->setSelectItems(selectItems,this->_model->getSelectModel());
|
||||||
|
}
|
||||||
|
|
||||||
|
void SelectNodeShow::on_btnCancel_clicked()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void SelectNodeShow::on_btnDelete_clicked()
|
||||||
|
{
|
||||||
|
// 删除指定行数
|
||||||
|
QItemSelectionModel* selectionModel = this->ui->tableView->selectionModel();
|
||||||
|
QModelIndexList selectedIndexes = selectionModel->selectedIndexes();
|
||||||
|
if (selectedIndexes.count() == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
QList<int> rows;
|
||||||
|
for (int i = 0; i < selectedIndexes.count(); i++) {
|
||||||
|
rows.push_back(selectedIndexes[i].row());
|
||||||
|
this->_model->setRemoveFlag(selectedIndexes[i].row(),true);
|
||||||
|
}
|
||||||
|
|
||||||
|
ModuleBase::SelectModel _selectModel=this->_model->getSelectModel();
|
||||||
|
if( _selectModel== ModuleBase::BoxMeshNode || _selectModel == ModuleBase::MeshNode||_selectModel==ModuleBase::BoxMeshSurfaceNode) {
|
||||||
|
this->_model->HightlightRows(rows,Setting::BusAPI::instance()->getGraphOption()->getMeshNodeColor());
|
||||||
|
} else if(_selectModel == ModuleBase::BoxMeshCell || _selectModel == ModuleBase::MeshCell||_selectModel==ModuleBase::BoxMeshSurfaceCell) {
|
||||||
|
this->_model->HightlightRows(rows,Setting::BusAPI::instance()->getGraphOption()->getMeshFaceColor());
|
||||||
|
}
|
||||||
|
_preWindow->reRender();
|
||||||
|
this->ui->tableView->show();
|
||||||
|
}
|
||||||
|
|
||||||
|
void SelectNodeShow::on_btnSearch_clicked()
|
||||||
|
{
|
||||||
|
// m_sqlModel->setSort(0, Qt::AscendingOrder);
|
||||||
|
//
|
||||||
|
// int result = m_sqlModel->select();
|
||||||
|
// if (!result) {
|
||||||
|
// qDebug() << u8"查询失败: " << m_sqlModel->lastError().text();
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// ui->btnNew->setEnabled(true);
|
||||||
|
// ui->btnEdit->setEnabled(true);
|
||||||
|
// ui->btnDelete->setEnabled(true);
|
||||||
|
// ui->btnCancel->setDisabled(true);
|
||||||
|
// ui->btnSubmit->setDisabled(true);
|
||||||
|
//
|
||||||
|
// ui->tableView->scrollToTop();
|
||||||
|
}
|
||||||
|
void SelectNodeShow::initSelectNodeShow(QMultiHash<int, int>* selectItems,ModuleBase::SelectModel _selectModel)
|
||||||
|
{
|
||||||
|
this->_model->SetData(selectItems,_selectModel);
|
||||||
|
//
|
||||||
|
|
||||||
|
if (this->_model->rowCount() > 1e4) {
|
||||||
|
this->ui->tableView->horizontalHeader()->setSectionResizeMode(QHeaderView::Interactive);
|
||||||
|
}else{
|
||||||
|
this->ui->tableView->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
|
||||||
|
}
|
||||||
|
this->ui->tableView->show();
|
||||||
|
|
||||||
|
}
|
||||||
|
void SelectNodeShow::currentChanged(const QModelIndex& current,
|
||||||
|
const QModelIndex& previous)
|
||||||
|
{
|
||||||
|
if (current.isValid()) {
|
||||||
|
// 处理当前行的逻辑,比如更新界面或者执行其他操作
|
||||||
|
this->_model->setCurrentRowIndex(current);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void SelectNodeShow::on_btnHightlightSelect_clicked() {
|
||||||
|
ModuleBase::SelectModel _selectModel=this->_model->getSelectModel();
|
||||||
|
// 清除选中行
|
||||||
|
QList<int> deleterows;
|
||||||
|
QList<int> highrows;
|
||||||
|
deleterows.clear();
|
||||||
|
highrows.clear();
|
||||||
|
for(int i=0;i<selectRows.size();i++) {
|
||||||
|
if(this->_model->getRemoveFlag(selectRows[i])) {
|
||||||
|
deleterows.push_back(selectRows[i]);
|
||||||
|
} else {
|
||||||
|
highrows.push_back(selectRows[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if( _selectModel== ModuleBase::BoxMeshNode || _selectModel == ModuleBase::MeshNode||_selectModel==ModuleBase::BoxMeshSurfaceNode) {
|
||||||
|
this->_model->HightlightRows(deleterows,Setting::BusAPI::instance()->getGraphOption()->getMeshNodeColor());
|
||||||
|
this->_model->HightlightRows(highrows,Setting::BusAPI::instance()->getGraphOption()->getHighLightColor());
|
||||||
|
} else if(_selectModel == ModuleBase::BoxMeshCell || _selectModel == ModuleBase::MeshCell||_selectModel==ModuleBase::BoxMeshSurfaceCell) {
|
||||||
|
this->_model->HightlightRows(deleterows,Setting::BusAPI::instance()->getGraphOption()->getMeshFaceColor());
|
||||||
|
this->_model->HightlightRows(highrows,Setting::BusAPI::instance()->getGraphOption()->getHighLightColor());
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除指定行数
|
||||||
|
QItemSelectionModel* selectionModel = this->ui->tableView->selectionModel();
|
||||||
|
QModelIndexList selectedIndexes = selectionModel->selectedIndexes();
|
||||||
|
if (selectedIndexes.count() == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
QList<int> rows;
|
||||||
|
for (int i = 0; i < selectedIndexes.count(); i++) {
|
||||||
|
rows.push_back(selectedIndexes[i].row());
|
||||||
|
}
|
||||||
|
|
||||||
|
// ModuleBase::SelectModel _selectModel=this->_model->getSelectModel();
|
||||||
|
if( _selectModel== ModuleBase::BoxMeshNode || _selectModel == ModuleBase::MeshNode||_selectModel==ModuleBase::BoxMeshSurfaceNode) {
|
||||||
|
this->_model->HightlightRows(rows,Setting::BusAPI::instance()->getGraphOption()->getPreHighLightColor());
|
||||||
|
} else if(_selectModel == ModuleBase::BoxMeshCell || _selectModel == ModuleBase::MeshCell||_selectModel==ModuleBase::BoxMeshSurfaceCell) {
|
||||||
|
this->_model->HightlightRows(rows,Setting::BusAPI::instance()->getGraphOption()->getPreHighLightColor());
|
||||||
|
}
|
||||||
|
_preWindow->reRender();
|
||||||
|
selectRows=rows;
|
||||||
|
// this->ui->tableView->show();
|
||||||
|
}
|
||||||
|
void SelectNodeShow::on_btnShowSelect_clicked() {
|
||||||
|
QList<int> deleterows;
|
||||||
|
QList<int> highrows;
|
||||||
|
deleterows.clear();
|
||||||
|
highrows.clear();
|
||||||
|
// 针对所有行进行操作
|
||||||
|
for(int i=0;i<this->_model->rowCount();i++) {
|
||||||
|
if(this->_model->getRemoveFlag(i)) {
|
||||||
|
deleterows.push_back(i);
|
||||||
|
} else {
|
||||||
|
highrows.push_back(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ModuleBase::SelectModel _selectModel=this->_model->getSelectModel();
|
||||||
|
if( _selectModel== ModuleBase::BoxMeshNode || _selectModel == ModuleBase::MeshNode||_selectModel==ModuleBase::BoxMeshSurfaceNode) {
|
||||||
|
this->_model->HightlightRows(deleterows,Setting::BusAPI::instance()->getGraphOption()->getMeshNodeColor());
|
||||||
|
this->_model->HightlightRows(highrows,Setting::BusAPI::instance()->getGraphOption()->getHighLightColor());
|
||||||
|
} else if(_selectModel == ModuleBase::BoxMeshCell || _selectModel == ModuleBase::MeshCell||_selectModel==ModuleBase::BoxMeshSurfaceCell) {
|
||||||
|
this->_model->HightlightRows(deleterows,Setting::BusAPI::instance()->getGraphOption()->getMeshFaceColor());
|
||||||
|
this->_model->HightlightRows(highrows,Setting::BusAPI::instance()->getGraphOption()->getHighLightColor());
|
||||||
|
}
|
||||||
|
|
||||||
|
_preWindow->reRender();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,81 @@
|
||||||
|
#ifndef THRESHOLDMANAGE_H
|
||||||
|
#define THRESHOLDMANAGE_H
|
||||||
|
|
||||||
|
#include "mainWidgetsAPI.h"
|
||||||
|
#include <QWidget>
|
||||||
|
#include <QDebug>
|
||||||
|
#include <QDialog>
|
||||||
|
#include <QtSql/QSqlTableModel>
|
||||||
|
#include <QtSql/QSqlDatabase>
|
||||||
|
#include <QItemSelectionModel>
|
||||||
|
#include "MeshData/meshSingleton.h"
|
||||||
|
#include "MeshData/meshKernal.h"
|
||||||
|
#include "preWindow.h"
|
||||||
|
#include "meshViewProvider.h"
|
||||||
|
#include "meshKernalViewObject.h"
|
||||||
|
#include "vtkMeshSelectTableModel.h"
|
||||||
|
#include "preWindow.h"
|
||||||
|
#include "MeshData/meshKernal.h"
|
||||||
|
#include "meshViewProvider.h"
|
||||||
|
#include "meshKernalViewObject.h"
|
||||||
|
#include "MeshData/meshSet.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class SelectNodeShow;
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace MainWidget {
|
||||||
|
class MAINWIDGETSAPI SelectNodeShow : public QDialog {
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit SelectNodeShow(PreWindow* preWindow,QWidget* parent = nullptr);
|
||||||
|
~SelectNodeShow();
|
||||||
|
|
||||||
|
void search();
|
||||||
|
|
||||||
|
void revert();
|
||||||
|
|
||||||
|
void submit();
|
||||||
|
|
||||||
|
bool editable();
|
||||||
|
|
||||||
|
bool editMode();
|
||||||
|
|
||||||
|
void initSelectNodeShow(QMultiHash<int, int>* selectItems,ModuleBase::SelectModel _selectModel);
|
||||||
|
|
||||||
|
private:
|
||||||
|
void init();
|
||||||
|
|
||||||
|
void initTableView();
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void on_btnEdit_clicked();
|
||||||
|
|
||||||
|
void on_btnNew_clicked();
|
||||||
|
|
||||||
|
void on_btnSubmit_clicked();
|
||||||
|
|
||||||
|
void on_btnCancel_clicked();
|
||||||
|
|
||||||
|
void on_btnDelete_clicked();
|
||||||
|
|
||||||
|
void on_btnSearch_clicked();
|
||||||
|
|
||||||
|
void on_btnShowSelect_clicked();
|
||||||
|
|
||||||
|
void on_btnHightlightSelect_clicked();
|
||||||
|
|
||||||
|
void currentChanged(const QModelIndex& current, const QModelIndex& previous) ;
|
||||||
|
|
||||||
|
private:
|
||||||
|
Ui::SelectNodeShow* ui;
|
||||||
|
vtkMeshSelectTableModel* _model;
|
||||||
|
PreWindow* _preWindow;
|
||||||
|
QItemSelectionModel *selectionModel;
|
||||||
|
QList<int> selectRows;
|
||||||
|
};
|
||||||
|
} // namespace MainWidget
|
||||||
|
#endif // THRESHOLDMANAGE_H
|
|
@ -0,0 +1,145 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>SelectNodeShow</class>
|
||||||
|
<widget class="QDialog" name="SelectNodeShow">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>840</width>
|
||||||
|
<height>782</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Form</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QWidget" name="widget" native="true">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>50</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true"/>
|
||||||
|
</property>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeType">
|
||||||
|
<enum>QSizePolicy::Maximum</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="btnSubmit">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Minimum" vsizetype="Expanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true"/>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>提交</string>
|
||||||
|
</property>
|
||||||
|
<property name="flat">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="btnDelete">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Minimum" vsizetype="Expanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true"/>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>删除</string>
|
||||||
|
</property>
|
||||||
|
<property name="flat">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="btnNew">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Minimum" vsizetype="Expanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true"/>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>新增</string>
|
||||||
|
</property>
|
||||||
|
<property name="flat">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="btnHightlightSelect">
|
||||||
|
<property name="text">
|
||||||
|
<string>高亮选择</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="btnShowSelect">
|
||||||
|
<property name="text">
|
||||||
|
<string>显示点集</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_2">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>1598</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QTableView" name="tableView"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
|
@ -33,6 +33,9 @@
|
||||||
#include <vtkUnstructuredGridWriter.h>
|
#include <vtkUnstructuredGridWriter.h>
|
||||||
#include <vtkPolyDataWriter.h>
|
#include <vtkPolyDataWriter.h>
|
||||||
#include <vtkSTLWriter.h>
|
#include <vtkSTLWriter.h>
|
||||||
|
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
#ifdef LAMPCAE_HAS_OPENMP
|
#ifdef LAMPCAE_HAS_OPENMP
|
||||||
#include <omp.h>
|
#include <omp.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -336,24 +339,21 @@ namespace MainWidget {
|
||||||
auto dataset = _kernal->getMeshData();
|
auto dataset = _kernal->getMeshData();
|
||||||
const int id = _kernal->getID(); // IDS (kernalid,pointId)
|
const int id = _kernal->getID(); // IDS (kernalid,pointId)
|
||||||
// cell ID与显示隐藏状态
|
// cell ID与显示隐藏状态
|
||||||
vtkSmartPointer<vtkUnsignedIntArray> kcellid_index =
|
vtkSmartPointer<vtkUnsignedIntArray> kcellid_index =vtkSmartPointer<vtkUnsignedIntArray>::New();
|
||||||
vtkSmartPointer<vtkUnsignedIntArray>::New();
|
|
||||||
kcellid_index->SetNumberOfComponents(2); // 设置 dimension
|
kcellid_index->SetNumberOfComponents(2); // 设置 dimension
|
||||||
kcellid_index->SetName("IDS");
|
kcellid_index->SetName("IDS");
|
||||||
const int ncell = dataset->GetNumberOfCells();
|
const int ncell = dataset->GetNumberOfCells();
|
||||||
for(int i = 0; i < ncell; ++i)
|
for(int i = 0; i < ncell; ++i){
|
||||||
kcellid_index->InsertNextTuple2(id, i); // 这里添加 网格id ,与 cell 序号
|
kcellid_index->InsertNextTuple2(id, i); // 这里添加 网格id ,与 cell 序号
|
||||||
|
}
|
||||||
dataset->GetCellData()->AddArray(kcellid_index);
|
dataset->GetCellData()->AddArray(kcellid_index);
|
||||||
|
vtkSmartPointer<vtkUnsignedIntArray> cstatesArray =vtkSmartPointer<vtkUnsignedIntArray>::New();
|
||||||
vtkSmartPointer<vtkUnsignedIntArray> cstatesArray =
|
|
||||||
vtkSmartPointer<vtkUnsignedIntArray>::New();
|
|
||||||
cstatesArray->SetName("SHOW");
|
cstatesArray->SetName("SHOW");
|
||||||
cstatesArray->SetNumberOfValues(ncell);
|
cstatesArray->SetNumberOfValues(ncell);
|
||||||
cstatesArray->Fill(1);
|
cstatesArray->Fill(1);
|
||||||
dataset->GetCellData()->AddArray(cstatesArray);
|
dataset->GetCellData()->AddArray(cstatesArray);
|
||||||
|
|
||||||
vtkSmartPointer<vtkIntArray> metralArray =
|
vtkSmartPointer<vtkIntArray> metralArray =vtkSmartPointer<vtkIntArray>::New();
|
||||||
vtkSmartPointer<vtkIntArray>::New();
|
|
||||||
metralArray->SetName("MATERIAL");
|
metralArray->SetName("MATERIAL");
|
||||||
metralArray->SetNumberOfValues(ncell);
|
metralArray->SetNumberOfValues(ncell);
|
||||||
metralArray->Fill(-1);
|
metralArray->Fill(-1);
|
||||||
|
@ -367,24 +367,22 @@ namespace MainWidget {
|
||||||
// dataset->GetCellData()->AddArray(selectSateArray); // select
|
// dataset->GetCellData()->AddArray(selectSateArray); // select
|
||||||
|
|
||||||
// point ID与显示隐藏状态
|
// point ID与显示隐藏状态
|
||||||
vtkSmartPointer<vtkUnsignedIntArray> kpointid_index =
|
vtkSmartPointer<vtkUnsignedIntArray> kpointid_index =vtkSmartPointer<vtkUnsignedIntArray>::New();
|
||||||
vtkSmartPointer<vtkUnsignedIntArray>::New();
|
|
||||||
kpointid_index->SetNumberOfComponents(2);
|
kpointid_index->SetNumberOfComponents(2);
|
||||||
kpointid_index->SetName("IDS");
|
kpointid_index->SetName("IDS");
|
||||||
const int npoint = dataset->GetNumberOfPoints();
|
const int npoint = dataset->GetNumberOfPoints();
|
||||||
for(int i = 0; i < npoint; ++i)
|
for(int i = 0; i < npoint; ++i){
|
||||||
kpointid_index->InsertNextTuple2(id, i);
|
kpointid_index->InsertNextTuple2(id, i);
|
||||||
|
}
|
||||||
dataset->GetPointData()->AddArray(kpointid_index);
|
dataset->GetPointData()->AddArray(kpointid_index);
|
||||||
|
|
||||||
vtkSmartPointer<vtkUnsignedIntArray> pstatesArray =
|
vtkSmartPointer<vtkUnsignedIntArray> pstatesArray =vtkSmartPointer<vtkUnsignedIntArray>::New();
|
||||||
vtkSmartPointer<vtkUnsignedIntArray>::New();
|
|
||||||
pstatesArray->SetName("SHOW");
|
pstatesArray->SetName("SHOW");
|
||||||
pstatesArray->SetNumberOfValues(npoint);
|
pstatesArray->SetNumberOfValues(npoint);
|
||||||
pstatesArray->Fill(1);
|
pstatesArray->Fill(1);
|
||||||
dataset->GetPointData()->AddArray(pstatesArray);
|
dataset->GetPointData()->AddArray(pstatesArray);
|
||||||
|
|
||||||
vtkSmartPointer<vtkIntArray> pmetralArray =
|
vtkSmartPointer<vtkIntArray> pmetralArray =vtkSmartPointer<vtkIntArray>::New();
|
||||||
vtkSmartPointer<vtkIntArray>::New();
|
|
||||||
pmetralArray->SetName("MATERIAL"); // 材料
|
pmetralArray->SetName("MATERIAL"); // 材料
|
||||||
pmetralArray->SetNumberOfValues(ncell);
|
pmetralArray->SetNumberOfValues(ncell);
|
||||||
pmetralArray->Fill(-1);
|
pmetralArray->Fill(-1);
|
||||||
|
@ -401,12 +399,42 @@ namespace MainWidget {
|
||||||
|
|
||||||
void MeshKernalViewObj::init()
|
void MeshKernalViewObj::init()
|
||||||
{
|
{
|
||||||
vtkSmartPointer<vtkAppendFilter> filter = vtkSmartPointer<vtkAppendFilter>::New();
|
qDebug()<<"init start!!! ";
|
||||||
filter->AddInputData(_kernal->getMeshData());
|
if(nullptr==_displayData){
|
||||||
filter->Update();
|
qDebug()<<"_displayData is nullptr!!!";
|
||||||
_displayData->DeepCopy(filter->GetOutput()); // 深拷贝
|
}else{
|
||||||
|
qDebug()<<"_displayData is not nullptr!!!";
|
||||||
|
}
|
||||||
|
|
||||||
auto gp = Setting::BusAPI::instance()->getGraphOption();
|
if(nullptr==_kernal->getMeshData()){
|
||||||
|
qDebug()<<"_kernal->getMeshData() is nullptr!!!";
|
||||||
|
}else{
|
||||||
|
qDebug()<<"_kernal->getMeshData() is not nullptr!!!";
|
||||||
|
}
|
||||||
|
vtkDataSet* tempData = _kernal->getMeshData();
|
||||||
|
if(nullptr==tempData){
|
||||||
|
qDebug()<<"tempData is nullptr!!!";
|
||||||
|
}else{
|
||||||
|
qDebug()<<"tempData is not nullptr!!!";
|
||||||
|
}
|
||||||
|
qDebug()<<"point count: "<<tempData->GetNumberOfPoints();
|
||||||
|
qDebug()<<"cell count: "<<tempData->GetNumberOfCells();
|
||||||
|
|
||||||
|
vtkSmartPointer<vtkGeometryFilter> geometryFilter = vtkSmartPointer<vtkGeometryFilter>::New();
|
||||||
|
geometryFilter->SetInputData(tempData);
|
||||||
|
geometryFilter->Update();
|
||||||
|
vtkSmartPointer<vtkAppendFilter> filter = vtkSmartPointer<vtkAppendFilter>::New();
|
||||||
|
filter->AddInputData(geometryFilter->GetOutput());qDebug()<<"filter->AddInputData() start!!!";
|
||||||
|
filter->Update();qDebug()<<"filter->Update() start!!!";
|
||||||
|
vtkUnstructuredGrid* tempVtkUnGridDataset=filter->GetOutput();
|
||||||
|
if(nullptr==tempVtkUnGridDataset){
|
||||||
|
qDebug()<<"tempVtkunGridDataset is nullptr!!!";
|
||||||
|
}else{
|
||||||
|
qDebug()<<"tempVtkunGridDataset is not nullptr!!!";
|
||||||
|
}
|
||||||
|
_displayData->DeepCopy(tempVtkUnGridDataset); // 深拷贝
|
||||||
|
qDebug()<<"_displayData created!!!";
|
||||||
|
Setting::GraphOption* gp = Setting::BusAPI::instance()->getGraphOption();
|
||||||
|
|
||||||
setCellColor(gp->getMeshFaceColor());
|
setCellColor(gp->getMeshFaceColor());
|
||||||
setPointColor(gp->getMeshNodeColor());
|
setPointColor(gp->getMeshNodeColor());
|
||||||
|
@ -416,18 +444,20 @@ namespace MainWidget {
|
||||||
pointMapper->SetScalarModeToUsePointData();
|
pointMapper->SetScalarModeToUsePointData();
|
||||||
_actor[POINTACTOR]->SetMapper(pointMapper);
|
_actor[POINTACTOR]->SetMapper(pointMapper);
|
||||||
_actor[POINTACTOR]->GetProperty()->SetRepresentationToPoints();
|
_actor[POINTACTOR]->GetProperty()->SetRepresentationToPoints();
|
||||||
|
qDebug()<<"pointMapper created!!!";
|
||||||
vtkSmartPointer<vtkDataSetMapper> edgeMapper = vtkSmartPointer<vtkDataSetMapper>::New();
|
vtkSmartPointer<vtkDataSetMapper> edgeMapper = vtkSmartPointer<vtkDataSetMapper>::New();
|
||||||
edgeMapper->SetInputData(_displayData);
|
edgeMapper->SetInputData(_displayData);
|
||||||
edgeMapper->SetScalarModeToUseCellData();
|
edgeMapper->SetScalarModeToUseCellData();
|
||||||
_actor[EDGEACTOR]->SetMapper(edgeMapper);
|
_actor[EDGEACTOR]->SetMapper(edgeMapper);
|
||||||
_actor[EDGEACTOR]->GetProperty()->SetRepresentationToWireframe();
|
_actor[EDGEACTOR]->GetProperty()->SetRepresentationToWireframe();
|
||||||
|
qDebug()<<"edgeMapper created!!!";
|
||||||
vtkSmartPointer<vtkDataSetMapper> faceMapper = vtkSmartPointer<vtkDataSetMapper>::New();
|
vtkSmartPointer<vtkDataSetMapper> faceMapper = vtkSmartPointer<vtkDataSetMapper>::New();
|
||||||
faceMapper->SetInputData(_displayData);
|
faceMapper->SetInputData(_displayData);
|
||||||
faceMapper->SetScalarModeToUseCellData();
|
faceMapper->SetScalarModeToUseCellData();
|
||||||
_actor[FACEACTOR]->SetMapper(faceMapper);
|
_actor[FACEACTOR]->SetMapper(faceMapper);
|
||||||
_actor[FACEACTOR]->GetProperty()->SetRepresentationToSurface();
|
_actor[FACEACTOR]->GetProperty()->SetRepresentationToSurface();
|
||||||
|
qDebug()<<"faceMapper created!!!";
|
||||||
|
qDebug()<<"init finished!!!";
|
||||||
}
|
}
|
||||||
|
|
||||||
void MeshKernalViewObj::updateDisplayMember()
|
void MeshKernalViewObj::updateDisplayMember()
|
||||||
|
|
|
@ -54,16 +54,22 @@ namespace MainWidget
|
||||||
|
|
||||||
void MeshViewProvider::updateMeshActorSlot()
|
void MeshViewProvider::updateMeshActorSlot()
|
||||||
{
|
{
|
||||||
|
// qDebug()<<"updateMeshActorSlot started!!";
|
||||||
const int nk = _meshData->getKernalCount();
|
const int nk = _meshData->getKernalCount();
|
||||||
|
// qDebug()<<"updateMeshActorSlot kernel count "<<QString::number(nk);
|
||||||
for (int i = 0; i < nk; ++i)
|
for (int i = 0; i < nk; ++i)
|
||||||
{
|
{
|
||||||
auto Kernal = _meshData->getKernalAt(i);
|
// qDebug() << "find kernel idx "<< i;
|
||||||
|
MeshData::MeshKernal* Kernal = _meshData->getKernalAt(i);
|
||||||
if (!_viewObjects.contains(Kernal))
|
if (!_viewObjects.contains(Kernal))
|
||||||
{
|
{
|
||||||
auto vobj = new MeshKernalViewObj(Kernal); // 创建一个新的视图
|
qDebug() << "_viewObjects do not contain "<<Kernal->getName();
|
||||||
|
MeshKernalViewObj* vobj =nullptr;
|
||||||
|
vobj=new MeshKernalViewObj(Kernal); // 创建一个新的视图
|
||||||
|
qDebug()<<"create MeshKernalViewObj!!";
|
||||||
_viewObjects.insert(Kernal, vobj);
|
_viewObjects.insert(Kernal, vobj);
|
||||||
updateDisplayModel(Kernal);
|
updateDisplayModel(Kernal); qDebug()<<"updateDisplayModel !!";
|
||||||
updateGraphOption(Kernal);
|
updateGraphOption(Kernal);qDebug()<<"updateGraphOption !!";
|
||||||
vtkActor **ac = vobj->getActor();
|
vtkActor **ac = vobj->getActor();
|
||||||
_preWindow->AppendActor(ac[0]);
|
_preWindow->AppendActor(ac[0]);
|
||||||
_preWindow->AppendActor(ac[1]);
|
_preWindow->AppendActor(ac[1]);
|
||||||
|
@ -77,6 +83,7 @@ namespace MainWidget
|
||||||
continue;
|
continue;
|
||||||
this->removeDisplay(ker);
|
this->removeDisplay(ker);
|
||||||
}
|
}
|
||||||
|
qDebug()<<"updateMeshActorSlot finished!!";
|
||||||
}
|
}
|
||||||
|
|
||||||
void MeshViewProvider::highLighKernel(MeshData::MeshKernal *k)
|
void MeshViewProvider::highLighKernel(MeshData::MeshKernal *k)
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -83,7 +83,7 @@ namespace MeshData
|
||||||
QString _path{};
|
QString _path{};
|
||||||
int _pointIDOffset{ -1 }; //起始ID,终止ID=起始ID+mesh.pointnum-1
|
int _pointIDOffset{ -1 }; //起始ID,终止ID=起始ID+mesh.pointnum-1
|
||||||
int _cellIDOffset{ -1 };
|
int _cellIDOffset{ -1 };
|
||||||
vtkSmartPointer<vtkDataSet> _mesh{}; // 网格颜色
|
vtkSmartPointer<vtkDataSet> _mesh{}; // 网格
|
||||||
int _dimension{ 3 };
|
int _dimension{ 3 };
|
||||||
QPair<bool, QColor> _specificColor;
|
QPair<bool, QColor> _specificColor;
|
||||||
DataProperty::DataBase* _gmshSetting{};//gmsh网格划分的属性
|
DataProperty::DataBase* _gmshSetting{};//gmsh网格划分的属性
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
#include <vtkPolyDataNormals.h>
|
#include <vtkPolyDataNormals.h>
|
||||||
#include <vtkSmoothPolyDataFilter.h>
|
#include <vtkSmoothPolyDataFilter.h>
|
||||||
#include <vtkDataSetSurfaceFilter.h>
|
#include <vtkDataSetSurfaceFilter.h>
|
||||||
|
#include <vtkOBJReader.h>
|
||||||
#include "MainWindow/MainWindow.h"
|
#include "MainWindow/MainWindow.h"
|
||||||
#include "MainWindow/SubWindowManager.h"
|
#include "MainWindow/SubWindowManager.h"
|
||||||
#include "Settings/BusAPI.h"
|
#include "Settings/BusAPI.h"
|
||||||
|
@ -51,8 +52,14 @@ namespace MeshData {
|
||||||
dataset = readSTL();
|
dataset = readSTL();
|
||||||
} else if(suffix == "dat") {
|
} else if(suffix == "dat") {
|
||||||
dataset = readTecplot();
|
dataset = readTecplot();
|
||||||
|
}else if(suffix == "obj") {
|
||||||
|
dataset = readObj();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(dataset != nullptr) {
|
if(dataset != nullptr) {
|
||||||
|
qDebug()<<"point count: "<<dataset->GetNumberOfPoints();
|
||||||
|
qDebug()<<"cell count: "<<dataset->GetNumberOfCells();
|
||||||
|
|
||||||
// 网格面片三角化
|
// 网格面片三角化
|
||||||
// emit _mainwindow->printMessage(Common::Message::Normal,
|
// emit _mainwindow->printMessage(Common::Message::Normal,
|
||||||
// u8"surface triangulation .....");
|
// u8"surface triangulation .....");
|
||||||
|
@ -112,7 +119,8 @@ namespace MeshData {
|
||||||
_stlReader->SetFileName(_fileName.toLocal8Bit().constData());
|
_stlReader->SetFileName(_fileName.toLocal8Bit().constData());
|
||||||
// _stlReader->SetMerging(true);
|
// _stlReader->SetMerging(true);
|
||||||
_stlReader->Update();
|
_stlReader->Update();
|
||||||
return _stlReader->GetOutput();
|
vtkDataSet* result= _stlReader->GetOutput();
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
vtkDataSet* VTKdataExchange::readTecplot()
|
vtkDataSet* VTKdataExchange::readTecplot()
|
||||||
|
@ -267,4 +275,18 @@ namespace MeshData {
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
vtkDataSet* VTKdataExchange::readObj()
|
||||||
|
{
|
||||||
|
if(!_threadRuning){
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
_objReader = vtkSmartPointer<vtkOBJReader>::New();
|
||||||
|
_objReader->SetFileName(_fileName.toLocal8Bit().constData());
|
||||||
|
// _stlReader->SetMerging(true);
|
||||||
|
_objReader->Update();
|
||||||
|
vtkDataSet* result= _objReader->GetOutput();
|
||||||
|
return result;
|
||||||
|
|
||||||
|
}
|
||||||
} // namespace MeshData
|
} // namespace MeshData
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
#include "meshDataExchangePlugin.h"
|
#include "meshDataExchangePlugin.h"
|
||||||
#include <vtkSmartPointer.h>
|
#include <vtkSmartPointer.h>
|
||||||
|
#include <vtkOBJReader.h>
|
||||||
#include "MeshThreadBase.h"
|
#include "MeshThreadBase.h"
|
||||||
|
|
||||||
class vtkDataSet;
|
class vtkDataSet;
|
||||||
|
@ -28,6 +29,7 @@ namespace MeshData
|
||||||
vtkDataSet* readVTK();
|
vtkDataSet* readVTK();
|
||||||
vtkDataSet* readSTL();
|
vtkDataSet* readSTL();
|
||||||
vtkDataSet* readTecplot();
|
vtkDataSet* readTecplot();
|
||||||
|
vtkDataSet* readObj();
|
||||||
|
|
||||||
bool writeVTK();
|
bool writeVTK();
|
||||||
bool writeSTL();
|
bool writeSTL();
|
||||||
|
@ -38,6 +40,7 @@ namespace MeshData
|
||||||
MeshData* _meshData{};
|
MeshData* _meshData{};
|
||||||
vtkSmartPointer<vtkDataSetReader> _vtkReader{};
|
vtkSmartPointer<vtkDataSetReader> _vtkReader{};
|
||||||
vtkSmartPointer<vtkSTLReader> _stlReader{};
|
vtkSmartPointer<vtkSTLReader> _stlReader{};
|
||||||
|
vtkSmartPointer<vtkOBJReader> _objReader{};
|
||||||
vtkSmartPointer<vtkTecplotReader> _tecplotReader{};
|
vtkSmartPointer<vtkTecplotReader> _tecplotReader{};
|
||||||
MeshOperation _operation;
|
MeshOperation _operation;
|
||||||
int _modelId;
|
int _modelId;
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QInputDialog>
|
#include <QInputDialog>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
#include <vtkAppendFilter.h>
|
||||||
|
|
||||||
namespace WBFZ {
|
namespace WBFZ {
|
||||||
DialogImportModelDataset::DialogImportModelDataset(GUI::MainWindow* _mainwindow, QWidget* parent)
|
DialogImportModelDataset::DialogImportModelDataset(GUI::MainWindow* _mainwindow, QWidget* parent)
|
||||||
|
@ -155,7 +156,7 @@ namespace WBFZ {
|
||||||
mapper->SetInputConnection(reader->GetOutputPort());
|
mapper->SetInputConnection(reader->GetOutputPort());
|
||||||
vtkSmartPointer<vtkActor> actor = vtkSmartPointer<vtkActor>::New();
|
vtkSmartPointer<vtkActor> actor = vtkSmartPointer<vtkActor>::New();
|
||||||
actor->SetMapper(mapper);
|
actor->SetMapper(mapper);
|
||||||
this->ui->progressBar->setValue(60);
|
this->ui->progressBar->setValue(70);
|
||||||
_render->AddActor(actor);
|
_render->AddActor(actor);
|
||||||
// 更新渲染窗口
|
// 更新渲染窗口
|
||||||
_render->ResetCamera();
|
_render->ResetCamera();
|
||||||
|
|
|
@ -63,6 +63,7 @@ namespace MeshData {
|
||||||
IO::IOConfigure::RegisterMeshImporter("STL(*.stl)", VTK_DAT_STL_importMesh);
|
IO::IOConfigure::RegisterMeshImporter("STL(*.stl)", VTK_DAT_STL_importMesh);
|
||||||
IO::IOConfigure::RegisterMeshImporter("Tecplot(*.dat)", VTK_DAT_STL_importMesh);
|
IO::IOConfigure::RegisterMeshImporter("Tecplot(*.dat)", VTK_DAT_STL_importMesh);
|
||||||
IO::IOConfigure::RegisterMeshImporter("VTK(*.vtk)", VTK_DAT_STL_importMesh);
|
IO::IOConfigure::RegisterMeshImporter("VTK(*.vtk)", VTK_DAT_STL_importMesh);
|
||||||
|
IO::IOConfigure::RegisterMeshImporter("Alias Wavefront Object(*.obj)", VTK_DAT_OBJ_importMesh);
|
||||||
IO::IOConfigure::RegisterMeshImporter("Abaqus(*.inp)", INPimportMesh);
|
IO::IOConfigure::RegisterMeshImporter("Abaqus(*.inp)", INPimportMesh);
|
||||||
IO::IOConfigure::RegisterMeshImporter("CNTM(*.cntm)", CNTMimportMesh);
|
IO::IOConfigure::RegisterMeshImporter("CNTM(*.cntm)", CNTMimportMesh);
|
||||||
IO::IOConfigure::RegisterMeshImporter("SU2(*.su2)", SU2importMesh);
|
IO::IOConfigure::RegisterMeshImporter("SU2(*.su2)", SU2importMesh);
|
||||||
|
@ -512,3 +513,12 @@ bool MESHDATAEXCHANGEPLUGINAPI PLYexportPCL(QString AbFileName, int modelId)
|
||||||
emit tc->threadStart(); // emit MSHwriter->start();
|
emit tc->threadStart(); // emit MSHwriter->start();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
bool MESHDATAEXCHANGEPLUGINAPI VTK_DAT_OBJ_importMesh(QString AbFileName, int modelId)
|
||||||
|
{
|
||||||
|
|
||||||
|
auto VTK_DAT_OBJ_reader = new MeshData::VTKdataExchange(
|
||||||
|
AbFileName, MeshData::MESH_READ, MeshData::MeshDataExchangePlugin::getMWpt());
|
||||||
|
ModuleBase::ThreadControl* tc = new ModuleBase::ThreadControl(VTK_DAT_OBJ_reader);
|
||||||
|
emit tc->threadStart(); // emit VTK_DAT_STL_reader->start();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
|
@ -62,6 +62,7 @@ extern "C"
|
||||||
bool MESHDATAEXCHANGEPLUGINAPI FOAMimportMesh(QString AbFileName, int modelId);
|
bool MESHDATAEXCHANGEPLUGINAPI FOAMimportMesh(QString AbFileName, int modelId);
|
||||||
bool MESHDATAEXCHANGEPLUGINAPI NEUimportMesh(QString AbFileName, int modelId);
|
bool MESHDATAEXCHANGEPLUGINAPI NEUimportMesh(QString AbFileName, int modelId);
|
||||||
bool MESHDATAEXCHANGEPLUGINAPI VTK_DAT_STL_importMesh(QString AbFileName, int modelId);
|
bool MESHDATAEXCHANGEPLUGINAPI VTK_DAT_STL_importMesh(QString AbFileName, int modelId);
|
||||||
|
bool MESHDATAEXCHANGEPLUGINAPI VTK_DAT_OBJ_importMesh(QString AbFileName, int modelId);
|
||||||
bool MESHDATAEXCHANGEPLUGINAPI INPimportMesh(QString AbFileName, int modelId);
|
bool MESHDATAEXCHANGEPLUGINAPI INPimportMesh(QString AbFileName, int modelId);
|
||||||
bool MESHDATAEXCHANGEPLUGINAPI CNTMimportMesh(QString AbFileName, int modelId);
|
bool MESHDATAEXCHANGEPLUGINAPI CNTMimportMesh(QString AbFileName, int modelId);
|
||||||
bool MESHDATAEXCHANGEPLUGINAPI SU2importMesh(QString AbFileName, int modelId);
|
bool MESHDATAEXCHANGEPLUGINAPI SU2importMesh(QString AbFileName, int modelId);
|
||||||
|
|
|
@ -310,50 +310,11 @@ namespace WBFZ {
|
||||||
DebugInfo("cellToPointFilter \n");
|
DebugInfo("cellToPointFilter \n");
|
||||||
// 获取过滤后的 vtkPolyData
|
// 获取过滤后的 vtkPolyData
|
||||||
inpolyData = cellToPointFilter->GetOutput();
|
inpolyData = cellToPointFilter->GetOutput();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
pcl::PointCloud<pcl::PointXYZRGBA>::Ptr cloud_with_rgba(new pcl::PointCloud<pcl::PointXYZRGBA>);
|
|
||||||
pcl::PointCloud<pcl::PointXYZRGBA>::Ptr cloud_filtered( new pcl::PointCloud<pcl::PointXYZRGBA>);
|
|
||||||
pcl::PointCloud<pcl::PointXYZRGBA>::Ptr output( new pcl::PointCloud<pcl::PointXYZRGBA>); // 输出结果
|
|
||||||
pcl::PointCloud<pcl::PointNormal>::Ptr cloud_with_normals(new pcl::PointCloud<pcl::PointNormal>); // 法线向量
|
|
||||||
|
|
||||||
pcl::search::KdTree<pcl::PointNormal>::Ptr tree2(new pcl::search::KdTree<pcl::PointNormal>);
|
|
||||||
|
|
||||||
pcl::io::vtkPolyDataToPointCloud(inpolyData, *cloud_with_rgba);
|
|
||||||
qDebug()<<"cloud_with_rgba "<<cloud_with_rgba->size();
|
|
||||||
PointCloudOperator::PointCloudCommon::NormalEstimation(cloud_with_rgba, cloud_with_normals);
|
|
||||||
tree2->setInputCloud(cloud_with_normals); // 构建搜索树
|
|
||||||
|
|
||||||
std::shared_ptr<pcl::PolygonMesh> mesh (new pcl::PolygonMesh); // 非智能指针,需要释放
|
|
||||||
|
|
||||||
pcl::GreedyProjectionTriangulation<pcl::PointNormal> gp3; // 定义三角化对象
|
|
||||||
gp3.setSearchRadius(_SearchRadius); // 设置连接点之间的最大距离(即三角形的最大边长)
|
|
||||||
gp3.setMu(_Mu); // 设置被样本点搜索其临近点的最远距离,为了适应点云密度的变化
|
|
||||||
gp3.setMaximumNearestNeighbors(_MaximumNearestNeighbors); // 设置样本点可搜索的邻域个数
|
|
||||||
gp3.setMaximumSurfaceAngle(_MaximumSurfaceAngle); // 设置某点法线方向偏离样本点法线方向的最大角度
|
|
||||||
gp3.setMinimumAngle(_MaximumAngle); // 设置三角化后得到三角形内角的最小角度
|
|
||||||
gp3.setMaximumAngle(_MinimumAngle); // 设置三角化后得到三角形内角的最大角度
|
|
||||||
gp3.setNormalConsistency(false); // 设置该参数保证法线朝向一致
|
|
||||||
gp3.setInputCloud(cloud_with_normals); // 设置输入点云为有向点云
|
|
||||||
gp3.setSearchMethod(tree2); // 设置搜索方式
|
|
||||||
gp3.reconstruct(*mesh); // 重建提取三角化 -- 这里会导致程序崩溃,可能存在内存泄露,
|
|
||||||
|
|
||||||
// DebugInfo("remesh over GP \n");
|
|
||||||
// return false;
|
|
||||||
size_t pointcount = PointCloudOperator::PointCloudCommon::mesh2vtk(*mesh, polydata2);
|
|
||||||
|
|
||||||
vtkSmartPointer<vtkGeometryFilter> geofilter=vtkSmartPointer<vtkGeometryFilter>::New();
|
|
||||||
geofilter->SetInputData(polydata2);
|
|
||||||
geofilter->Update();
|
|
||||||
polydata=geofilter->GetOutput();
|
|
||||||
|
|
||||||
qDebug()<<"cellToPointFilter successfully!! wait for writing file dataset : "<<inpolyData->GetNumberOfPoints()<<" "<<inpolyData->GetNumberOfCells();
|
qDebug()<<"cellToPointFilter successfully!! wait for writing file dataset : "<<inpolyData->GetNumberOfPoints()<<" "<<inpolyData->GetNumberOfCells();
|
||||||
// if(PointCloudOperator::PointCloudMeshOperator::GP(inpolyData,polydata,_SearchRadius,_Mu,_MaximumNearestNeighbors,_MaximumSurfaceAngle,_MaximumAngle,_MinimumAngle)){
|
if(PointCloudOperator::PointCloudMeshOperator::GP(inpolyData,polydata,_SearchRadius,_Mu,_MaximumNearestNeighbors,_MaximumSurfaceAngle,_MaximumAngle,_MinimumAngle)){
|
||||||
//
|
}else{
|
||||||
// }else{
|
return false;
|
||||||
// return false;
|
}
|
||||||
// }
|
|
||||||
|
|
||||||
DebugInfo("PCLGPMeshAlg successfully!! wait for writing file dataset : %d \n",nullptr==polydata);
|
DebugInfo("PCLGPMeshAlg successfully!! wait for writing file dataset : %d \n",nullptr==polydata);
|
||||||
if(nullptr!=polydata){
|
if(nullptr!=polydata){
|
||||||
|
|
Loading…
Reference in New Issue