增加了动态海浪表面模型生成
parent
5bcc3cf68d
commit
848b29f97f
|
@ -31,6 +31,8 @@
|
|||
#include "CustomizerHelper.h"
|
||||
#include "DialogAbout.h"
|
||||
#include "Geometry/geometryData.h"
|
||||
#include "Geometry/geometrySet.h"
|
||||
#include "DataProperty/DataBase.h"
|
||||
#include "GeometryWidgets/dialogSketchPlane.h"
|
||||
#include "GmshModule/GmshModule.h"
|
||||
#include "IO/IOConfig.h"
|
||||
|
@ -59,6 +61,9 @@
|
|||
#include "Settings/GraphOption.h"
|
||||
#include "SignalHandler.h"
|
||||
#include "SolverControl/DialogSolverManager.h"
|
||||
#include "PointCloudOperator/MeshOpearatorCommon.h"
|
||||
|
||||
|
||||
#include "SubWindowManager.h"
|
||||
#include "Translator.h"
|
||||
|
||||
|
@ -75,6 +80,7 @@
|
|||
#include <QTreeWidgetItem>
|
||||
#include <vtkCellDataToPointData.h>
|
||||
#include <pcl/io/vtk_lib_io.h>
|
||||
#include <TopTools_HSequenceOfShape.hxx>
|
||||
// ribbon
|
||||
#include "SARibbonBar/SARibbonBar.h"
|
||||
#include "SARibbonBar/SARibbonCategory.h"
|
||||
|
@ -95,6 +101,7 @@
|
|||
|
||||
// logger
|
||||
#include "Common/DebugLogger.h"
|
||||
#include "PluginWBFZExchangePlugin/OCCTBase.h"
|
||||
|
||||
namespace GUI {
|
||||
MainWindow::MainWindow(bool useRibbon)
|
||||
|
@ -441,6 +448,12 @@ namespace GUI {
|
|||
// 网格三角网
|
||||
connect(_ui->actionMeshTriangleSurface,SIGNAL(triggered()),this,SLOT(on_actionMeshTriangleSurface()));
|
||||
|
||||
// 网格转换为几何
|
||||
connect(_controlPanel,SIGNAL(MeshToGeometrySig(MeshData::MeshKernal *)),this,SLOT(on_MeshToGeo(MeshData::MeshKernal *)));
|
||||
|
||||
// 网格
|
||||
connect(_ui->action_generatorWaterPlane,SIGNAL(triggered()),this, SLOT(on_action_generatorWaterPlane()));
|
||||
// connect(_ui->actionMeshToOCCT,SIGNAL(triggered()),this,SLOT(on_actionMeshToOCCT()));
|
||||
}
|
||||
|
||||
void MainWindow::registerMoudel()
|
||||
|
@ -1763,10 +1776,32 @@ namespace GUI {
|
|||
void MainWindow::on_actionMeshTriangleSurface() {
|
||||
DebugInfo("MainWindow::on_actionMeshTriangleSurface\n");
|
||||
emit this->on_actionMeshTriangleSurfaceSIGNAL(this);
|
||||
}
|
||||
void MainWindow::on_MeshToGeo(MeshData::MeshKernal* k) {
|
||||
DebugInfo("MainWindow::on_MeshToGeo\n");
|
||||
vtkDataSet* meshdata= k->getMeshData();
|
||||
vtkPolyData* polydata=vtkPolyData::SafeDownCast(meshdata);
|
||||
TopoDS_Shape* polyshp=MeshOpearator::MeshOpearatorCommon::vtkPolygonToOCC(polydata);
|
||||
if(nullptr==polyshp){
|
||||
return;
|
||||
}
|
||||
Geometry::GeometrySet* geoSet = new Geometry::GeometrySet(Geometry::GeometryType::STL,true);
|
||||
qDebug()<<"Model geoSet";
|
||||
TopoDS_Shape* polyshptemp=new TopoDS_Shape();
|
||||
geoSet->setShape(polyshptemp);
|
||||
geoSet->setName(k->getName()+"_mesh2OCCT");
|
||||
Geometry::GeometryData::getInstance()->appendGeometrySet(geoSet);
|
||||
qDebug()<<"Model geoSet";
|
||||
emit this->updateActionStatesSig();
|
||||
emit this->_subWindowManager->getPreWindow()->showGeoSet(geoSet,true);
|
||||
emit this->updateGeometryTreeSig();
|
||||
|
||||
qDebug()<<"Model over";
|
||||
|
||||
|
||||
|
||||
}
|
||||
void MainWindow::on_action_generatorWaterPlane() {
|
||||
DebugInfo("MainWindow::on_action_generatorWaterPlane\n");
|
||||
emit this->on_action_generatorWaterPlaneSIGNAL(this);
|
||||
}
|
||||
|
||||
} // namespace GUI
|
||||
|
|
|
@ -346,6 +346,10 @@ namespace GUI {
|
|||
|
||||
void on_actionMeshTriangleSurfaceSIGNAL(GUI::MainWindow* m);
|
||||
|
||||
void on_actionMeshToOCCTSIGNAL(GUI::MainWindow* m);
|
||||
|
||||
void on_action_generatorWaterPlaneSIGNAL(GUI::MainWindow* m);
|
||||
|
||||
public slots:
|
||||
/*状态栏显示信息 */
|
||||
void setStatusBarInfo(QString);
|
||||
|
@ -427,6 +431,9 @@ namespace GUI {
|
|||
|
||||
void on_saveMeshEdit();
|
||||
void on_actionMeshTriangleSurface();
|
||||
|
||||
//void on_actionMeshToOCCT();
|
||||
|
||||
private slots:
|
||||
/*关闭主窗口 */
|
||||
void closeWindow();
|
||||
|
@ -508,6 +515,10 @@ namespace GUI {
|
|||
|
||||
void on_actionRCShowTool();
|
||||
|
||||
// meshtoGeo
|
||||
void on_MeshToGeo(MeshData::MeshKernal *k);
|
||||
|
||||
void on_action_generatorWaterPlane();
|
||||
private:
|
||||
/*初始化Menu*/
|
||||
// void initMenu();
|
||||
|
|
|
@ -774,6 +774,7 @@
|
|||
<string>制备</string>
|
||||
</property>
|
||||
<addaction name="actionLoadPreDynamicWaterBodyMeshFile"/>
|
||||
<addaction name="action_generatorWaterPlane"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionScaneExport"/>
|
||||
</widget>
|
||||
|
@ -2748,10 +2749,23 @@
|
|||
</property>
|
||||
</action>
|
||||
<action name="actionMeshTriangleSurface">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>MeshTriangleSurface</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionMeshToOCCT">
|
||||
<property name="text">
|
||||
<string>MeshToOCCT</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="action_generatorWaterPlane">
|
||||
<property name="text">
|
||||
<string>生成动态水面</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../qrc/qianfan.qrc"/>
|
||||
|
|
|
@ -22,6 +22,9 @@
|
|||
#include "AsciiOpenDialog.h"
|
||||
#include <QFileInfo>
|
||||
#include "MeshOperator.h"
|
||||
#include "wavemodel.h"
|
||||
|
||||
|
||||
|
||||
GUI::MainWindow* MeshData::MeshDataExchangePlugin::_mainwindow = nullptr;
|
||||
namespace MeshData {
|
||||
|
@ -49,7 +52,8 @@ namespace MeshData {
|
|||
SLOT(on_clipMesh(GUI::MainWindow*)));
|
||||
connect(_mainwindow, SIGNAL(on_saveMeshSIGNAL(GUI::MainWindow*)), this,
|
||||
SLOT(on_saveMesh(GUI::MainWindow*)));
|
||||
|
||||
connect(_mainwindow, SIGNAL(on_action_generatorWaterPlaneSIGNAL(GUI::MainWindow*)), this,
|
||||
SLOT(on_action_generatorWaterPlane(GUI::MainWindow*)));
|
||||
}
|
||||
|
||||
bool MeshDataExchangePlugin::install()
|
||||
|
@ -164,10 +168,18 @@ namespace MeshData {
|
|||
MeshOperator* _meshOperator = new MeshOperator(m);
|
||||
_meshOperator->on_clipMesh();
|
||||
}
|
||||
void MeshDataExchangePlugin::on_saveMesh(GUI::MainWindow* m) {
|
||||
void MeshDataExchangePlugin::on_saveMesh(GUI::MainWindow* m)
|
||||
{
|
||||
MeshOperator* _meshOperator = new MeshOperator(m);
|
||||
_meshOperator->on_saveMesh();
|
||||
}
|
||||
void MeshDataExchangePlugin::on_action_generatorWaterPlane(GUI::MainWindow* m)
|
||||
{
|
||||
// 生成水平面
|
||||
DebugInfo("on_action_generatorWaterPlane\n");
|
||||
wave::wavemodel* w = new wave::wavemodel(m);
|
||||
w->show();
|
||||
}
|
||||
|
||||
} // namespace MeshData
|
||||
|
||||
|
@ -188,7 +200,8 @@ bool CGNSimportMesh(QString AbFileName, int modelId)
|
|||
|
||||
bool CGNSexportMesh(QString AbFileName, int modelId)
|
||||
{
|
||||
MeshData::MeshOperator* _meshOperator = new MeshData::MeshOperator(MeshData::MeshDataExchangePlugin::getMWpt());
|
||||
MeshData::MeshOperator* _meshOperator =
|
||||
new MeshData::MeshOperator(MeshData::MeshDataExchangePlugin::getMWpt());
|
||||
_meshOperator->on_saveMesh();
|
||||
|
||||
auto CGNSwriter = new MeshData::CGNSdataExchange(
|
||||
|
@ -200,8 +213,6 @@ bool CGNSexportMesh(QString AbFileName, int modelId)
|
|||
|
||||
bool MSHimportMesh(QString AbFileName, int modelId)
|
||||
{
|
||||
|
||||
|
||||
auto MSHreader = new MeshData::MSHdataExchange(AbFileName, MeshData::MESH_READ,
|
||||
MeshData::MeshDataExchangePlugin::getMWpt());
|
||||
ModuleBase::ThreadControl* tc = new ModuleBase::ThreadControl(MSHreader);
|
||||
|
@ -211,8 +222,8 @@ bool MSHimportMesh(QString AbFileName, int modelId)
|
|||
|
||||
bool MSHexportMesh(QString AbFileName, int modelId)
|
||||
{
|
||||
|
||||
MeshData::MeshOperator* _meshOperator = new MeshData::MeshOperator(MeshData::MeshDataExchangePlugin::getMWpt());
|
||||
MeshData::MeshOperator* _meshOperator =
|
||||
new MeshData::MeshOperator(MeshData::MeshDataExchangePlugin::getMWpt());
|
||||
_meshOperator->on_saveMesh();
|
||||
|
||||
auto MSHwriter = new MeshData::MSHdataExchange(
|
||||
|
@ -233,7 +244,8 @@ bool NEUimportMesh(QString AbFileName, int modelId)
|
|||
|
||||
bool NEUexportMesh(QString AbFileName, int modelId)
|
||||
{
|
||||
MeshData::MeshOperator* _meshOperator = new MeshData::MeshOperator(MeshData::MeshDataExchangePlugin::getMWpt());
|
||||
MeshData::MeshOperator* _meshOperator =
|
||||
new MeshData::MeshOperator(MeshData::MeshDataExchangePlugin::getMWpt());
|
||||
_meshOperator->on_saveMesh();
|
||||
|
||||
auto NEUwriter = new MeshData::NEUdataExchange(
|
||||
|
@ -254,7 +266,8 @@ bool VTK_DAT_STL_importMesh(QString AbFileName, int modelId)
|
|||
|
||||
bool VTK_DAT_STL_exportMesh(QString AbFileName, int modelId)
|
||||
{
|
||||
MeshData::MeshOperator* _meshOperator = new MeshData::MeshOperator(MeshData::MeshDataExchangePlugin::getMWpt());
|
||||
MeshData::MeshOperator* _meshOperator =
|
||||
new MeshData::MeshOperator(MeshData::MeshDataExchangePlugin::getMWpt());
|
||||
_meshOperator->on_saveMesh();
|
||||
|
||||
auto VTK_DAT_STL_writer = new MeshData::VTKdataExchange(
|
||||
|
@ -275,7 +288,8 @@ bool INPimportMesh(QString AbFileName, int modelId)
|
|||
|
||||
bool INPexportMesh(QString AbFileName, int modelId)
|
||||
{
|
||||
MeshData::MeshOperator* _meshOperator = new MeshData::MeshOperator(MeshData::MeshDataExchangePlugin::getMWpt());
|
||||
MeshData::MeshOperator* _meshOperator =
|
||||
new MeshData::MeshOperator(MeshData::MeshDataExchangePlugin::getMWpt());
|
||||
_meshOperator->on_saveMesh();
|
||||
|
||||
auto INPwriter = new MeshData::INPdataExchange(
|
||||
|
@ -296,7 +310,8 @@ bool CNTMimportMesh(QString AbFileName, int modelId)
|
|||
|
||||
bool CNTMexportMesh(QString AbFileName, int modelId)
|
||||
{
|
||||
MeshData::MeshOperator* _meshOperator = new MeshData::MeshOperator(MeshData::MeshDataExchangePlugin::getMWpt());
|
||||
MeshData::MeshOperator* _meshOperator =
|
||||
new MeshData::MeshOperator(MeshData::MeshDataExchangePlugin::getMWpt());
|
||||
_meshOperator->on_saveMesh();
|
||||
|
||||
auto CNTMwriter = new MeshData::CNTMdataExchange(
|
||||
|
@ -327,7 +342,8 @@ bool SU2importMesh(QString AbFileName, int modelId)
|
|||
|
||||
bool SU2exportMesh(QString AbFileName, int modelId)
|
||||
{
|
||||
MeshData::MeshOperator* _meshOperator = new MeshData::MeshOperator(MeshData::MeshDataExchangePlugin::getMWpt());
|
||||
MeshData::MeshOperator* _meshOperator =
|
||||
new MeshData::MeshOperator(MeshData::MeshDataExchangePlugin::getMWpt());
|
||||
_meshOperator->on_saveMesh();
|
||||
|
||||
auto SU2writer = new MeshData::CNTMdataExchange(
|
||||
|
@ -349,7 +365,8 @@ bool AnotherSU2importMesh(QString AbFileName)
|
|||
|
||||
bool AnotherSU2exportMesh(QString AbFileName, int modelId)
|
||||
{
|
||||
MeshData::MeshOperator* _meshOperator = new MeshData::MeshOperator(MeshData::MeshDataExchangePlugin::getMWpt());
|
||||
MeshData::MeshOperator* _meshOperator =
|
||||
new MeshData::MeshOperator(MeshData::MeshDataExchangePlugin::getMWpt());
|
||||
_meshOperator->on_saveMesh();
|
||||
|
||||
auto SU2writer = new MeshData::CNTMdataExchange(
|
||||
|
@ -372,7 +389,8 @@ bool KEYimportMesh(QString AbFileName, int modelId)
|
|||
|
||||
bool KEYexportMesh(QString AbFileName, int modelId)
|
||||
{
|
||||
MeshData::MeshOperator* _meshOperator = new MeshData::MeshOperator(MeshData::MeshDataExchangePlugin::getMWpt());
|
||||
MeshData::MeshOperator* _meshOperator =
|
||||
new MeshData::MeshOperator(MeshData::MeshDataExchangePlugin::getMWpt());
|
||||
_meshOperator->on_saveMesh();
|
||||
|
||||
auto KEYwirter = new MeshData::KEYdataExchange(
|
||||
|
@ -405,7 +423,8 @@ bool MESHDATAEXCHANGEPLUGINAPI BDFimportMesh(QString AbFileName, int modelId)
|
|||
|
||||
bool MESHDATAEXCHANGEPLUGINAPI PDBexportMesh(QString AbFileName, int modelId)
|
||||
{
|
||||
MeshData::MeshOperator* _meshOperator = new MeshData::MeshOperator(MeshData::MeshDataExchangePlugin::getMWpt());
|
||||
MeshData::MeshOperator* _meshOperator =
|
||||
new MeshData::MeshOperator(MeshData::MeshDataExchangePlugin::getMWpt());
|
||||
_meshOperator->on_saveMesh();
|
||||
|
||||
auto PDBWriter = new MeshData::PDBdataExchange(
|
||||
|
@ -427,7 +446,8 @@ bool MESHDATAEXCHANGEPLUGINAPI FOAMimportMesh(QString AbFileName, int modelId)
|
|||
|
||||
bool MESHDATAEXCHANGEPLUGINAPI FOAMexportMesh(QString AbFileName, int id)
|
||||
{
|
||||
MeshData::MeshOperator* _meshOperator = new MeshData::MeshOperator(MeshData::MeshDataExchangePlugin::getMWpt());
|
||||
MeshData::MeshOperator* _meshOperator =
|
||||
new MeshData::MeshOperator(MeshData::MeshDataExchangePlugin::getMWpt());
|
||||
_meshOperator->on_saveMesh();
|
||||
|
||||
auto FoamWriter = new MeshData::FoamDataExchange(
|
||||
|
@ -473,7 +493,8 @@ bool MESHDATAEXCHANGEPLUGINAPI PLYimportPCL(QString AbFileName, int id)
|
|||
|
||||
bool MESHDATAEXCHANGEPLUGINAPI PCDexportPCL(QString AbFileName, int modelId)
|
||||
{
|
||||
MeshData::MeshOperator* _meshOperator = new MeshData::MeshOperator(MeshData::MeshDataExchangePlugin::getMWpt());
|
||||
MeshData::MeshOperator* _meshOperator =
|
||||
new MeshData::MeshOperator(MeshData::MeshDataExchangePlugin::getMWpt());
|
||||
_meshOperator->on_saveMesh();
|
||||
|
||||
auto pcdWriter = new MeshData::PointClouddataExchange(
|
||||
|
@ -485,7 +506,8 @@ bool MESHDATAEXCHANGEPLUGINAPI PCDexportPCL(QString AbFileName, int modelId)
|
|||
|
||||
bool MESHDATAEXCHANGEPLUGINAPI PLYexportPCL(QString AbFileName, int modelId)
|
||||
{
|
||||
MeshData::MeshOperator* _meshOperator = new MeshData::MeshOperator(MeshData::MeshDataExchangePlugin::getMWpt());
|
||||
MeshData::MeshOperator* _meshOperator =
|
||||
new MeshData::MeshOperator(MeshData::MeshDataExchangePlugin::getMWpt());
|
||||
_meshOperator->on_saveMesh();
|
||||
|
||||
auto pcdWriter = new MeshData::PointClouddataExchange(
|
||||
|
|
|
@ -38,6 +38,7 @@ namespace MeshData {
|
|||
void on_copyMesh(GUI::MainWindow* m);
|
||||
void on_clipMesh(GUI::MainWindow* m);
|
||||
void on_saveMesh(GUI::MainWindow* m);
|
||||
void on_action_generatorWaterPlane(GUI::MainWindow* m);
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
|
||||
namespace wave {
|
||||
|
||||
wavemodel::wavemodel(GUI::MainWindow* _mainwindow, QWidget* parent)
|
||||
wavemodel::wavemodel(GUI::MainWindow* _mainwindow)
|
||||
: QDialog(_mainwindow),
|
||||
_mainwindow(_mainwindow),
|
||||
ui(new Ui::wavemodel)
|
||||
|
@ -120,11 +120,20 @@ namespace wave {
|
|||
//清除所有模型
|
||||
_render->RemoveAllViewProps();
|
||||
|
||||
// 获取 textEdit_t 和 textEdit_v 的输入值
|
||||
QString text_t = ui->textEdit_t->toPlainText();
|
||||
QString text_v = ui->textEdit_v->toPlainText();
|
||||
QString text_r = ui->textEdit_r->toPlainText();
|
||||
QString text_g = ui->textEdit_g->toPlainText();
|
||||
|
||||
|
||||
double v =ui->doubleSpinBox_v->value();
|
||||
double t =ui->doubleSpinBox_t->value();
|
||||
double Ymin =ui->doubleSpinBox_YMin->value();
|
||||
double Ymax =ui->doubleSpinBox_YMax->value();
|
||||
double Xmin =ui->doubleSpinBox_XMin->value();
|
||||
double Xmax =ui->doubleSpinBox_XMax->value();
|
||||
double rand =ui->doubleSpinBox_r->value();
|
||||
int grid=ui->spinBox_g->value(); // 采样点数
|
||||
|
||||
// 计算采样间隔
|
||||
double xdelta=(Xmax-Xmin)/(grid-1);
|
||||
double ydelta=(Ymax-Ymin)/(grid-1);
|
||||
|
||||
|
||||
_structuredGrid= vtkSmartPointer<vtkStructuredGrid>::New();
|
||||
|
@ -132,10 +141,6 @@ namespace wave {
|
|||
vtkSmartPointer<vtkFloatArray> heights = vtkSmartPointer<vtkFloatArray>::New();
|
||||
heights->SetName("Height");
|
||||
|
||||
double t = text_t.toDouble();
|
||||
double v = text_v.toDouble();
|
||||
double rand = text_r.toDouble();
|
||||
double grid = text_g.toDouble();
|
||||
|
||||
const double g = 9.8; // 重力加速度常数
|
||||
const int m = 5; // theta 的段数
|
||||
|
@ -154,15 +159,15 @@ namespace wave {
|
|||
|
||||
for (int xi = 0; xi < grid; ++xi) {
|
||||
for(int yi = 0; yi < grid; ++yi) {
|
||||
points->InsertNextPoint(15.0 * xi, 15.0 * yi, 0.0);
|
||||
points->InsertNextPoint(xdelta * xi, ydelta * yi, 0.0);
|
||||
heights->InsertNextValue(0);
|
||||
}
|
||||
}
|
||||
double temp,omg_i,k_i,theta_j,eps,S_omg,p,q,fi_u;
|
||||
// 计算波浪高度
|
||||
for (int i = 1; i <= n; ++i) {
|
||||
double omg_i = (rand + i - 1) * d_omg + min_omg;
|
||||
double k_i = omg_i * omg_i / g;
|
||||
omg_i = (rand + i - 1) * d_omg + min_omg;
|
||||
k_i = omg_i * omg_i / g;
|
||||
for (int j = 1; j <= m; ++j) {
|
||||
theta_j = -M_PI / 2 + d_theta * j;
|
||||
eps = M_PI / 2 * (rand);
|
||||
|
@ -210,4 +215,59 @@ namespace wave {
|
|||
|
||||
}
|
||||
|
||||
|
||||
void wavemodel::SaveWaveModel(QString filepath){
|
||||
if(nullptr==_structuredGrid){
|
||||
qDebug()<<"inpolyData ,nullptr : ";
|
||||
}else{
|
||||
qDebug()<<"inpolyData , cell Count : "+QString::number(_structuredGrid->GetNumberOfCells());
|
||||
}
|
||||
// stl 支持 polygondata 格式 vtkdataset
|
||||
vtkSmartPointer<vtkGeometryFilter> polygonMeshFilter = vtkSmartPointer<vtkGeometryFilter>::New();
|
||||
polygonMeshFilter->AddInputData(_structuredGrid);
|
||||
polygonMeshFilter->Update();
|
||||
if(nullptr==polygonMeshFilter->GetOutput()){
|
||||
qDebug()<<" polygonMeshFilter write std error !!!! "+filepath;
|
||||
}else{
|
||||
|
||||
}
|
||||
|
||||
|
||||
vtkSmartPointer<vtkSTLWriter> writer = vtkSmartPointer<vtkSTLWriter>::New();
|
||||
writer->SetInputData(polygonMeshFilter->GetOutput());
|
||||
writer->SetFileTypeToBinary();
|
||||
writer->SetFileName(filepath.toLocal8Bit().constData());
|
||||
writer->Write();
|
||||
|
||||
QFile outfile(filepath);
|
||||
if(outfile.exists()){
|
||||
_curModelPath=filepath;
|
||||
}
|
||||
else{
|
||||
QMessageBox::warning(nullptr, QObject::tr("Warning"), QObject::tr("wave model save Error !"));
|
||||
}
|
||||
}
|
||||
// 导入网格
|
||||
void wavemodel::importMeshModelToMainWindows( ) {
|
||||
QString stdPath=_curModelPath;
|
||||
QFileInfo info(stdPath);
|
||||
QString name = info.fileName();
|
||||
QString path = info.filePath();
|
||||
QString suffix = "STL(*.stl)"; // 这里应该与 MeshDataExchangePlugin::install() 中的一致
|
||||
//info.suffix().toLower();
|
||||
emit _mainwindow->importMeshSIGN(stdPath,suffix,-1);
|
||||
}
|
||||
void wavemodel::on_push_save_models_slot() {
|
||||
|
||||
QString filepath = QFileDialog::getSaveFileName(this, tr("Save wave model "), "", "STL(*.stl)");
|
||||
if (filepath.isEmpty())
|
||||
{
|
||||
return ;
|
||||
|
||||
}else{
|
||||
this->SaveWaveModel(filepath);
|
||||
this->importMeshModelToMainWindows();
|
||||
};
|
||||
}
|
||||
|
||||
} // namespace wave
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
#ifndef LAMPCAE_WAVEMODEL_H
|
||||
#define LAMPCAE_WAVEMODEL_H
|
||||
|
||||
#include "meshDataExchangePluginAPI.h"
|
||||
#include <QDialog>
|
||||
#include "ModuleBase/graph3DWindow.h"
|
||||
#include <QString>
|
||||
|
@ -35,8 +35,8 @@ namespace wave {
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit wavemodel(GUI::MainWindow* _mainwindow, QWidget* parent = nullptr);
|
||||
~wavemodel() override;
|
||||
explicit wavemodel(GUI::MainWindow* _mainwindow);
|
||||
~wavemodel();
|
||||
|
||||
public slots:
|
||||
void on_push_wave_models_slot();
|
||||
|
@ -51,10 +51,15 @@ namespace wave {
|
|||
vtkSmartPointer<vtkRenderer> _render;
|
||||
vtkSmartPointer<vtkGenericOpenGLRenderWindow> _renderWindow;
|
||||
vtkSmartPointer<vtkRenderWindowInteractor> _interactor;
|
||||
|
||||
vtkSmartPointer<vtkStructuredGrid> _structuredGrid ;
|
||||
QString _curModelPath;
|
||||
public:
|
||||
void initVTKView();
|
||||
vtkSmartPointer<vtkStructuredGrid> createDefaultGrid();
|
||||
|
||||
// 保存模型
|
||||
void SaveWaveModel(QString filepath);
|
||||
// 加载模型
|
||||
void importMeshModelToMainWindows();
|
||||
};
|
||||
} // namespace wave
|
||||
|
||||
|
|
|
@ -43,172 +43,327 @@
|
|||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<widget class="QLabel" name="label_t">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>100</y>
|
||||
<width>100</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>请输入时间t(s):</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_v">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>190</y>
|
||||
<width>100</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>请输入速度v(m/s):</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="ShowWave_pushButton">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>510</y>
|
||||
<width>310</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>确定</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QTextEdit" name="textEdit_t">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>120</x>
|
||||
<y>90</y>
|
||||
<width>141</width>
|
||||
<height>41</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QTextEdit" name="textEdit_v">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>120</x>
|
||||
<y>180</y>
|
||||
<width>141</width>
|
||||
<height>41</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_r">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>280</y>
|
||||
<width>100</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>请输入随机数种子(0-1):</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QTextEdit" name="textEdit_r">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>120</x>
|
||||
<y>270</y>
|
||||
<width>141</width>
|
||||
<height>41</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_g">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>370</y>
|
||||
<width>100</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>请输入网格大小:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QTextEdit" name="textEdit_g">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>120</x>
|
||||
<y>360</y>
|
||||
<width>141</width>
|
||||
<height>41</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="SaveModel_pushButton">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>610</y>
|
||||
<width>310</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>保存模型stl文件</string>
|
||||
</property>
|
||||
</widget>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QFrame" name="frame_4">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_r">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>随机数种子(0-1):</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QDoubleSpinBox" name="doubleSpinBox_XMax">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>30</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>30</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>-10000.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>10000.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="label_g">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>采样点数:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QDoubleSpinBox" name="doubleSpinBox_v">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>30</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>30</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>-10000.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>10000.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Y最大值</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>X最大值</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QDoubleSpinBox" name="doubleSpinBox_t">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>30</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>30</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>-10000.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>10000.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_v">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>速度v(m/s):</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="QDoubleSpinBox" name="doubleSpinBox_YMax">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>30</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>30</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>-10000.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>10000.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_t">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>时间t(s):</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
<widget class="QSpinBox" name="spinBox_g">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>30</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>30</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>100000</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QDoubleSpinBox" name="doubleSpinBox_YMin">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>30</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>30</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>-10000.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>10000.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QDoubleSpinBox" name="doubleSpinBox_XMin">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>30</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>30</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>-10000.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>10000.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Y最小值</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>X最小值</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QDoubleSpinBox" name="doubleSpinBox_r">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>30</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>30</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>0.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>1.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="ShowWave_pushButton">
|
||||
<property name="text">
|
||||
<string>生成预览模型</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="SaveModel_pushButton">
|
||||
<property name="text">
|
||||
<string>保存模型并加载模型</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
|
@ -239,13 +394,6 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
|
@ -3,7 +3,9 @@ QMainWindow{
|
|||
background-color: #FFFFFF;
|
||||
}
|
||||
|
||||
|
||||
QMainWindow::title{
|
||||
font-size: 16px;
|
||||
}
|
||||
/* Nice Windows-XP-style password character. */
|
||||
QLineEdit[echoMode="2"] {
|
||||
lineedit-password-character: 9679;
|
||||
|
|
Loading…
Reference in New Issue