diff --git a/.gitignore b/.gitignore index e385656..3051875 100644 --- a/.gitignore +++ b/.gitignore @@ -1,199 +1,8 @@ -# Prerequisites -*.d - -# Compiled Object files -*.slo -*.lo -*.o -*.obj - -# Precompiled Headers -*.gch -*.pch - -# Compiled Dynamic libraries -*.so -*.dylib -*.dll - -# Fortran module files -*.mod -*.smod - -# Compiled Static libraries -*.lai -*.la -*.a -*.lib - -# Executables -*.exe -*.out -*.app -python37 -Build -Code/.vs - -output/* -Code/*/debug -Code/*/release -Code/*/Makefile* -Code/Makefile* -Code/PluginFluent/* -cgns/* -cgns00/* -*.vcxproj -*.vcxproj.filters -*.vcxproj.user -*.stash -*.bat -/Doxygen -/DoxyConfig -/*.nsi -/.vscode -/Code/*.user -/Code/*.sln -/build-FastCAE-Desktop_Qt_5_14_2_MSVC2017_64bit-Debug -Code/FastCAE.pro.user.4f627ea -/src/Copy_Pys.bat -/src/Copy_Pys.sh -/src/Copy_SOs.sh -/src/Create_Linux64_Project.sh -/src/Create_X64_Project.bat -/src/FastCAE.pro -/src/hdf5.pri -/src/occ.pri -/src/python.pri -/src/qwt.pri -/src/Run_MSVC.bat -/src/tecio.pri -/src/Translate.bat -/src/vtk.pri -/src/cgns.pri -/src/Copy_DLLs.bat -/src/BCBase/BCBase.pro -/src/BCBase/_Create_Project.bat -/src/BCBase/_Create_project.sh -/src/BCBase/BCBase.pri -/src/ConfigOptions/ConfigOptions.pro -/src/ConfigOptions/_Create_Project.bat -/src/ConfigOptions/_Create_project.sh -/src/ConfigOptions/ConfigOptions.pri -/src/DataProperty/DataProperty.pro -/src/DataProperty/_Create_Project.bat -/src/DataProperty/_Create_project.sh -/src/DataProperty/DataProperty.pri -/src/geometry/geometry.pro -/src/geometry/_Create_Project.bat -/src/geometry/_Create_project.sh -/src/geometry/geometry.pri -/src/GeometryCommand/GeometryCommand.pro -/src/GeometryCommand/_Create_Project.bat -/src/GeometryCommand/_Create_project.sh -/src/GeometryCommand/GeometryCommand.pri -/src/GeometryDataExchange/GeometryDataExchange.pro -/src/GeometryDataExchange/_Create_Project.bat -/src/GeometryDataExchange/_Create_project.sh -/src/GeometryDataExchange/GeometryDataExchange.pri -/src/GeometryWidgets/GeometryWidgets.pri -/src/GeometryWidgets/GeometryWidgets.pro -/src/GeometryWidgets/_Create_project.sh -/src/GeometryWidgets/_Create_Project.bat -/src/GmshModule/GmshModule.pri -/src/GmshModule/GmshModule.pro -/src/GmshModule/_Create_Project.bat -/src/GmshModule/_Create_project.sh -/src/IO/IO.pri -/src/IO/IO.pro -/src/IO/_Create_Project.bat -/src/IO/_Create_project.sh -/src/License/License.pri -/src/License/License.pro -/src/License/_Create_Project.bat -/src/License/_Create_project.sh -/src/MainWidgets/MainWidgets.pri -/src/MainWidgets/MainWidgets.pro -/src/MainWidgets/_Create_Project.bat -/src/MainWidgets/_Create_project.sh -/src/mainWindow/mainWindow.pri -/src/mainWindow/mainWindow.pro -/src/mainWindow/_Create_Project.bat -/src/mainWindow/_Create_project.sh -/src/Material/Material.pri -/src/Material/Material.pro -/src/Material/_Create_Project.bat -/src/Material/_Create_project.sh -/src/meshData/meshData.pro -/src/meshData/_Create_Project.bat -/src/meshData/_Create_project.sh -/src/meshData/meshData.pri -/src/ModelData/ModelData.pri -/src/ModelData/ModelData.pro -/src/ModelData/_Create_Project.bat -/src/ModelData/_Create_project.sh -/src/moduleBase/moduleBase.pri -/src/moduleBase/moduleBase.pro -/src/moduleBase/_Create_Project.bat -/src/moduleBase/_Create_project.sh -/src/ParaClassFactory/ParaClassFactory.pro -/src/ParaClassFactory/_Create_Project.bat -/src/ParaClassFactory/_Create_project.sh -/src/ParaClassFactory/ParaClassFactory.pri -/src/PluginCustomizer/PluginCustomizer.pri -/src/PluginCustomizer/PluginCustomizer.pro -/src/PluginCustomizer/_Create_Project.bat -/src/PluginCustomizer/_Create_project.sh -/src/PluginManager/PluginManager.pri -/src/PluginManager/PluginManager.pro -/src/PluginManager/_Create_Project.bat -/src/PluginManager/_Create_project.sh -/src/PluginMeshDataExchange/PluginMeshDataExchange.pro -/src/PluginMeshDataExchange/_Create_Project.bat -/src/PluginMeshDataExchange/_Create_project.sh -/src/PluginMeshDataExchange/PluginMeshDataExchange.pri -/src/PostAlgorithm/PostAlgorithm.pri -/src/PostAlgorithm/PostAlgorithm.pro -/src/PostAlgorithm/_Create_Project.bat -/src/PostCurveDataManager/PostCurveDataManager.pri -/src/PostCurveDataManager/PostCurveDataManager.pro -/src/PostInterface/PostInterface.pri -/src/PostInterface/PostInterface.pro -/src/PostInterface/_Create_Project.bat -/src/PostPlotWidget/PostPlotWidget.pri -/src/PostPlotWidget/PostPlotWidget.pro -/src/PostRenderData/PostRenderData.pri -/src/PostRenderData/PostRenderData.pro -/src/PostRenderData/_Create_Project.bat -/src/PostWidgets/PostWidgets.pri -/src/PostWidgets/PostWidgets.pro -/src/PostWidgets/_Create_Project.bat -/src/PostWidgets/_Create_project.sh -/src/ProjectTree/ProjectTree.pri -/src/ProjectTree/ProjectTree.pro -/src/ProjectTree/_Create_Project.bat -/src/ProjectTree/_Create_project.sh -/src/ProjectTreeExtend/ProjectTreeExtend.pro -/src/ProjectTreeExtend/_Create_Project.bat -/src/ProjectTreeExtend/_Create_project.sh -/src/ProjectTreeExtend/ProjectTreeExtend.pri -/src/SARibbonBar/_Create_Project.bat -/src/SelfDefObject/SelfDefObject.pri -/src/SelfDefObject/SelfDefObject.pro -/src/SelfDefObject/_Create_Project.bat -/src/SelfDefObject/_Create_project.sh -/src/settings/settings.pro -/src/settings/_Create_Project.bat -/src/settings/_Create_project.sh -/src/settings/settings.pri -/src/SolverControl/SolverControl.pri -/src/SolverControl/SolverControl.pro -/src/SolverControl/_Create_Project.bat -/src/SolverControl/_Create_project.sh -/src/UserGuidence/UserGuidence.pro -/src/UserGuidence/_Create_Project.bat -/src/UserGuidence/_Create_project.sh -/src/UserGuidence/UserGuidence.pri -/src/XGenerateReport/XGenerateReport.pri -/src/XGenerateReport/XGenerateReport.pro -/src/XGenerateReport/_Create_Project.bat -/src/XGenerateReport/_Create_project.sh +.vscode +.vs +.idea +/build +/install +/extlib +/cmake-build-debug +/cmake-build-release diff --git a/CMakeLists.txt b/CMakeLists.txt index b97bff6..c7187cc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -44,7 +44,7 @@ endif() #----------------------------------------------------------------------------- # 测试环境定义(如果在支持cmake系统的IDE中编写代码,可以打开以下注释,并将路径修改为自己的Qt路径) #----------------------------------------------------------------------------- -#[[set(CMAKE_INSTALL_PREFIX "${CMAKE_SOURCE_DIR}/install") +set(CMAKE_INSTALL_PREFIX "${CMAKE_SOURCE_DIR}/install") message(STATUS "${PROJECT_NAME} will be installed to ${CMAKE_INSTALL_PREFIX}") if (NOT DEFINED Qt5_DIR) @@ -53,7 +53,7 @@ if (NOT DEFINED Qt5_DIR) elseif(FASTCAE_WIN) set(Qt5_DIR "D:/software/Qt/Qt5.14.2/5.14.2/msvc2017_64/lib/cmake/Qt5" CACHE PATH "Qt5Config.cmake所在目录" FORCE) endif() -endif()]] +endif() #----------------------------------------------------------------------------- # 编译选项设置 diff --git a/cmake/FindHDF5.cmake b/cmake/FindHDF5.cmake index 26fbcef..4816b80 100644 --- a/cmake/FindHDF5.cmake +++ b/cmake/FindHDF5.cmake @@ -72,21 +72,26 @@ add_library(FASTCAE::HDF5HL SHARED IMPORTED) add_library(FASTCAE::HDF5HLCPP SHARED IMPORTED) add_library(FASTCAE::HDF5TOOLS SHARED IMPORTED) +set_property(TARGET FASTCAE::HDF5 PROPERTY INTERFACE_COMPILE_DEFINITIONS "H5_BUILT_AS_DYNAMIC_LIB") set_property(TARGET FASTCAE::HDF5 PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${HDF5_INCLUDE_DIRS}) set_property(TARGET FASTCAE::HDF5 APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) +set_property(TARGET FASTCAE::HDF5CPP PROPERTY INTERFACE_COMPILE_DEFINITIONS "H5_BUILT_AS_DYNAMIC_LIB") set_property(TARGET FASTCAE::HDF5CPP PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${HDF5_INCLUDE_DIRS}) set_property(TARGET FASTCAE::HDF5CPP APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) set_property(TARGET FASTCAE::HDF5CPP PROPERTY INTERFACE_LINK_LIBRARIES FASTCAE::HDF5) +set_property(TARGET FASTCAE::HDF5HL PROPERTY INTERFACE_COMPILE_DEFINITIONS "H5_BUILT_AS_DYNAMIC_LIB") set_property(TARGET FASTCAE::HDF5HL PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${HDF5_INCLUDE_DIRS}) set_property(TARGET FASTCAE::HDF5HL APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) set_property(TARGET FASTCAE::HDF5HL PROPERTY INTERFACE_LINK_LIBRARIES FASTCAE::HDF5) +set_property(TARGET FASTCAE::HDF5HLCPP PROPERTY INTERFACE_COMPILE_DEFINITIONS "H5_BUILT_AS_DYNAMIC_LIB") set_property(TARGET FASTCAE::HDF5HLCPP PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${HDF5_INCLUDE_DIRS}) set_property(TARGET FASTCAE::HDF5HLCPP APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) set_property(TARGET FASTCAE::HDF5HLCPP PROPERTY INTERFACE_LINK_LIBRARIES FASTCAE::HDF5HL) +set_property(TARGET FASTCAE::HDF5TOOLS PROPERTY INTERFACE_COMPILE_DEFINITIONS "H5_BUILT_AS_DYNAMIC_LIB") set_property(TARGET FASTCAE::HDF5TOOLS PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${HDF5_INCLUDE_DIRS}) set_property(TARGET FASTCAE::HDF5TOOLS APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) set_property(TARGET FASTCAE::HDF5TOOLS PROPERTY INTERFACE_LINK_LIBRARIES FASTCAE::HDF5) diff --git a/src/FastCAE/CMakeLists.txt b/src/FastCAE/CMakeLists.txt index ea0303d..87baca9 100644 --- a/src/FastCAE/CMakeLists.txt +++ b/src/FastCAE/CMakeLists.txt @@ -36,9 +36,8 @@ if(_WIN_) #list(APPEND _depend_library XGenerateReport License) endif() - list(APPEND _runtimes_libraries - Qt5::Core Qt5::Gui Qt5::Widgets + Qt5::Core Qt5::Gui Qt5::Widgets FASTCAE::HDF5 FASTCAE::HDF5CPP ) #----------------------------------------------------------------------------- diff --git a/src/geometry/CMakeLists.txt b/src/Geometry/CMakeLists.txt similarity index 100% rename from src/geometry/CMakeLists.txt rename to src/Geometry/CMakeLists.txt diff --git a/src/geometry/GeoCommon.cpp b/src/Geometry/GeoCommon.cpp similarity index 100% rename from src/geometry/GeoCommon.cpp rename to src/Geometry/GeoCommon.cpp diff --git a/src/geometry/GeoCommon.h b/src/Geometry/GeoCommon.h similarity index 100% rename from src/geometry/GeoCommon.h rename to src/Geometry/GeoCommon.h diff --git a/src/geometry/GeoComponent.cpp b/src/Geometry/GeoComponent.cpp similarity index 100% rename from src/geometry/GeoComponent.cpp rename to src/Geometry/GeoComponent.cpp diff --git a/src/geometry/GeoComponent.h b/src/Geometry/GeoComponent.h similarity index 100% rename from src/geometry/GeoComponent.h rename to src/Geometry/GeoComponent.h diff --git a/src/geometry/GeometryPy.cpp b/src/Geometry/GeometryPy.cpp similarity index 100% rename from src/geometry/GeometryPy.cpp rename to src/Geometry/GeometryPy.cpp diff --git a/src/geometry/GeometryPy.h b/src/Geometry/GeometryPy.h similarity index 100% rename from src/geometry/GeometryPy.h rename to src/Geometry/GeometryPy.h diff --git a/src/geometry/geometryAPI.h b/src/Geometry/geometryAPI.h similarity index 100% rename from src/geometry/geometryAPI.h rename to src/Geometry/geometryAPI.h diff --git a/src/geometry/geometryData.cpp b/src/Geometry/geometryData.cpp similarity index 100% rename from src/geometry/geometryData.cpp rename to src/Geometry/geometryData.cpp diff --git a/src/geometry/geometryData.h b/src/Geometry/geometryData.h similarity index 100% rename from src/geometry/geometryData.h rename to src/Geometry/geometryData.h diff --git a/src/geometry/geometryDatum.cpp b/src/Geometry/geometryDatum.cpp similarity index 100% rename from src/geometry/geometryDatum.cpp rename to src/Geometry/geometryDatum.cpp diff --git a/src/geometry/geometryDatum.h b/src/Geometry/geometryDatum.h similarity index 100% rename from src/geometry/geometryDatum.h rename to src/Geometry/geometryDatum.h diff --git a/src/geometry/geometryExporter.cpp b/src/Geometry/geometryExporter.cpp similarity index 100% rename from src/geometry/geometryExporter.cpp rename to src/Geometry/geometryExporter.cpp diff --git a/src/geometry/geometryExporter.h b/src/Geometry/geometryExporter.h similarity index 100% rename from src/geometry/geometryExporter.h rename to src/Geometry/geometryExporter.h diff --git a/src/geometry/geometryModelParaBase.cpp b/src/Geometry/geometryModelParaBase.cpp similarity index 100% rename from src/geometry/geometryModelParaBase.cpp rename to src/Geometry/geometryModelParaBase.cpp diff --git a/src/geometry/geometryModelParaBase.h b/src/Geometry/geometryModelParaBase.h similarity index 100% rename from src/geometry/geometryModelParaBase.h rename to src/Geometry/geometryModelParaBase.h diff --git a/src/geometry/geometryParaBoolOperation.cpp b/src/Geometry/geometryParaBoolOperation.cpp similarity index 100% rename from src/geometry/geometryParaBoolOperation.cpp rename to src/Geometry/geometryParaBoolOperation.cpp diff --git a/src/geometry/geometryParaBoolOperation.h b/src/Geometry/geometryParaBoolOperation.h similarity index 100% rename from src/geometry/geometryParaBoolOperation.h rename to src/Geometry/geometryParaBoolOperation.h diff --git a/src/geometry/geometryParaBox.cpp b/src/Geometry/geometryParaBox.cpp similarity index 100% rename from src/geometry/geometryParaBox.cpp rename to src/Geometry/geometryParaBox.cpp diff --git a/src/geometry/geometryParaBox.h b/src/Geometry/geometryParaBox.h similarity index 100% rename from src/geometry/geometryParaBox.h rename to src/Geometry/geometryParaBox.h diff --git a/src/geometry/geometryParaChamfer.cpp b/src/Geometry/geometryParaChamfer.cpp similarity index 100% rename from src/geometry/geometryParaChamfer.cpp rename to src/Geometry/geometryParaChamfer.cpp diff --git a/src/geometry/geometryParaChamfer.h b/src/Geometry/geometryParaChamfer.h similarity index 100% rename from src/geometry/geometryParaChamfer.h rename to src/Geometry/geometryParaChamfer.h diff --git a/src/geometry/geometryParaCone.cpp b/src/Geometry/geometryParaCone.cpp similarity index 100% rename from src/geometry/geometryParaCone.cpp rename to src/Geometry/geometryParaCone.cpp diff --git a/src/geometry/geometryParaCone.h b/src/Geometry/geometryParaCone.h similarity index 100% rename from src/geometry/geometryParaCone.h rename to src/Geometry/geometryParaCone.h diff --git a/src/geometry/geometryParaCylinder.cpp b/src/Geometry/geometryParaCylinder.cpp similarity index 100% rename from src/geometry/geometryParaCylinder.cpp rename to src/Geometry/geometryParaCylinder.cpp diff --git a/src/geometry/geometryParaCylinder.h b/src/Geometry/geometryParaCylinder.h similarity index 100% rename from src/geometry/geometryParaCylinder.h rename to src/Geometry/geometryParaCylinder.h diff --git a/src/geometry/geometryParaExtrusion.cpp b/src/Geometry/geometryParaExtrusion.cpp similarity index 100% rename from src/geometry/geometryParaExtrusion.cpp rename to src/Geometry/geometryParaExtrusion.cpp diff --git a/src/geometry/geometryParaExtrusion.h b/src/Geometry/geometryParaExtrusion.h similarity index 100% rename from src/geometry/geometryParaExtrusion.h rename to src/Geometry/geometryParaExtrusion.h diff --git a/src/geometry/geometryParaFace.cpp b/src/Geometry/geometryParaFace.cpp similarity index 100% rename from src/geometry/geometryParaFace.cpp rename to src/Geometry/geometryParaFace.cpp diff --git a/src/geometry/geometryParaFace.h b/src/Geometry/geometryParaFace.h similarity index 100% rename from src/geometry/geometryParaFace.h rename to src/Geometry/geometryParaFace.h diff --git a/src/geometry/geometryParaFillet.cpp b/src/Geometry/geometryParaFillet.cpp similarity index 100% rename from src/geometry/geometryParaFillet.cpp rename to src/Geometry/geometryParaFillet.cpp diff --git a/src/geometry/geometryParaFillet.h b/src/Geometry/geometryParaFillet.h similarity index 100% rename from src/geometry/geometryParaFillet.h rename to src/Geometry/geometryParaFillet.h diff --git a/src/geometry/geometryParaGeoSplitter.cpp b/src/Geometry/geometryParaGeoSplitter.cpp similarity index 100% rename from src/geometry/geometryParaGeoSplitter.cpp rename to src/Geometry/geometryParaGeoSplitter.cpp diff --git a/src/geometry/geometryParaGeoSplitter.h b/src/Geometry/geometryParaGeoSplitter.h similarity index 100% rename from src/geometry/geometryParaGeoSplitter.h rename to src/Geometry/geometryParaGeoSplitter.h diff --git a/src/geometry/geometryParaLine.cpp b/src/Geometry/geometryParaLine.cpp similarity index 100% rename from src/geometry/geometryParaLine.cpp rename to src/Geometry/geometryParaLine.cpp diff --git a/src/geometry/geometryParaLine.h b/src/Geometry/geometryParaLine.h similarity index 100% rename from src/geometry/geometryParaLine.h rename to src/Geometry/geometryParaLine.h diff --git a/src/geometry/geometryParaLoft.cpp b/src/Geometry/geometryParaLoft.cpp similarity index 100% rename from src/geometry/geometryParaLoft.cpp rename to src/Geometry/geometryParaLoft.cpp diff --git a/src/geometry/geometryParaLoft.h b/src/Geometry/geometryParaLoft.h similarity index 100% rename from src/geometry/geometryParaLoft.h rename to src/Geometry/geometryParaLoft.h diff --git a/src/geometry/geometryParaMakeFillGap.cpp b/src/Geometry/geometryParaMakeFillGap.cpp similarity index 100% rename from src/geometry/geometryParaMakeFillGap.cpp rename to src/Geometry/geometryParaMakeFillGap.cpp diff --git a/src/geometry/geometryParaMakeFillGap.h b/src/Geometry/geometryParaMakeFillGap.h similarity index 100% rename from src/geometry/geometryParaMakeFillGap.h rename to src/Geometry/geometryParaMakeFillGap.h diff --git a/src/geometry/geometryParaMakeFillHole.cpp b/src/Geometry/geometryParaMakeFillHole.cpp similarity index 100% rename from src/geometry/geometryParaMakeFillHole.cpp rename to src/Geometry/geometryParaMakeFillHole.cpp diff --git a/src/geometry/geometryParaMakeFillHole.h b/src/Geometry/geometryParaMakeFillHole.h similarity index 100% rename from src/geometry/geometryParaMakeFillHole.h rename to src/Geometry/geometryParaMakeFillHole.h diff --git a/src/geometry/geometryParaMakeMatrix.cpp b/src/Geometry/geometryParaMakeMatrix.cpp similarity index 100% rename from src/geometry/geometryParaMakeMatrix.cpp rename to src/Geometry/geometryParaMakeMatrix.cpp diff --git a/src/geometry/geometryParaMakeMatrix.h b/src/Geometry/geometryParaMakeMatrix.h similarity index 100% rename from src/geometry/geometryParaMakeMatrix.h rename to src/Geometry/geometryParaMakeMatrix.h diff --git a/src/geometry/geometryParaMakeMirror.cpp b/src/Geometry/geometryParaMakeMirror.cpp similarity index 100% rename from src/geometry/geometryParaMakeMirror.cpp rename to src/Geometry/geometryParaMakeMirror.cpp diff --git a/src/geometry/geometryParaMakeMirror.h b/src/Geometry/geometryParaMakeMirror.h similarity index 100% rename from src/geometry/geometryParaMakeMirror.h rename to src/Geometry/geometryParaMakeMirror.h diff --git a/src/geometry/geometryParaMakeMove.cpp b/src/Geometry/geometryParaMakeMove.cpp similarity index 100% rename from src/geometry/geometryParaMakeMove.cpp rename to src/Geometry/geometryParaMakeMove.cpp diff --git a/src/geometry/geometryParaMakeMove.h b/src/Geometry/geometryParaMakeMove.h similarity index 100% rename from src/geometry/geometryParaMakeMove.h rename to src/Geometry/geometryParaMakeMove.h diff --git a/src/geometry/geometryParaMakeRemoveSurface.cpp b/src/Geometry/geometryParaMakeRemoveSurface.cpp similarity index 100% rename from src/geometry/geometryParaMakeRemoveSurface.cpp rename to src/Geometry/geometryParaMakeRemoveSurface.cpp diff --git a/src/geometry/geometryParaMakeRemoveSurface.h b/src/Geometry/geometryParaMakeRemoveSurface.h similarity index 100% rename from src/geometry/geometryParaMakeRemoveSurface.h rename to src/Geometry/geometryParaMakeRemoveSurface.h diff --git a/src/geometry/geometryParaPoint.cpp b/src/Geometry/geometryParaPoint.cpp similarity index 100% rename from src/geometry/geometryParaPoint.cpp rename to src/Geometry/geometryParaPoint.cpp diff --git a/src/geometry/geometryParaPoint.h b/src/Geometry/geometryParaPoint.h similarity index 100% rename from src/geometry/geometryParaPoint.h rename to src/Geometry/geometryParaPoint.h diff --git a/src/geometry/geometryParaRevol.cpp b/src/Geometry/geometryParaRevol.cpp similarity index 100% rename from src/geometry/geometryParaRevol.cpp rename to src/Geometry/geometryParaRevol.cpp diff --git a/src/geometry/geometryParaRevol.h b/src/Geometry/geometryParaRevol.h similarity index 100% rename from src/geometry/geometryParaRevol.h rename to src/Geometry/geometryParaRevol.h diff --git a/src/geometry/geometryParaRotateFeature.cpp b/src/Geometry/geometryParaRotateFeature.cpp similarity index 100% rename from src/geometry/geometryParaRotateFeature.cpp rename to src/Geometry/geometryParaRotateFeature.cpp diff --git a/src/geometry/geometryParaRotateFeature.h b/src/Geometry/geometryParaRotateFeature.h similarity index 100% rename from src/geometry/geometryParaRotateFeature.h rename to src/Geometry/geometryParaRotateFeature.h diff --git a/src/geometry/geometryParaSphere.cpp b/src/Geometry/geometryParaSphere.cpp similarity index 100% rename from src/geometry/geometryParaSphere.cpp rename to src/Geometry/geometryParaSphere.cpp diff --git a/src/geometry/geometryParaSphere.h b/src/Geometry/geometryParaSphere.h similarity index 100% rename from src/geometry/geometryParaSphere.h rename to src/Geometry/geometryParaSphere.h diff --git a/src/geometry/geometryParaSweep.cpp b/src/Geometry/geometryParaSweep.cpp similarity index 100% rename from src/geometry/geometryParaSweep.cpp rename to src/Geometry/geometryParaSweep.cpp diff --git a/src/geometry/geometryParaSweep.h b/src/Geometry/geometryParaSweep.h similarity index 100% rename from src/geometry/geometryParaSweep.h rename to src/Geometry/geometryParaSweep.h diff --git a/src/geometry/geometryParaVariableFillet.cpp b/src/Geometry/geometryParaVariableFillet.cpp similarity index 100% rename from src/geometry/geometryParaVariableFillet.cpp rename to src/Geometry/geometryParaVariableFillet.cpp diff --git a/src/geometry/geometryParaVariableFillet.h b/src/Geometry/geometryParaVariableFillet.h similarity index 100% rename from src/geometry/geometryParaVariableFillet.h rename to src/Geometry/geometryParaVariableFillet.h diff --git a/src/Geometry/geometrySet.cpp b/src/Geometry/geometrySet.cpp new file mode 100644 index 0000000..6173b7a --- /dev/null +++ b/src/Geometry/geometrySet.cpp @@ -0,0 +1,529 @@ +/** + * @file geometrySet.cpp + * @brief 几何形状表示类源文件 + * @author FastCAE研发小组(fastcae@diso.cn) + * @version 2.5.0 + * @date 2022-03-24 11:03 + * @copyright Copyright (c) Since 2020 青岛数智船海科技有限公司 All rights reserved. + * + * ============================================================================ + * Program: FastCAE + * + * Copyright (c) Since 2020 青岛数智船海科技有限公司 All rights reserved. + * See License or http://www.fastcae.com/ for details. + * + * BSD 3-Clause License + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. + * ================================================================================== + */ +#include "geometrySet.h" + +#include "Geometry/geometryModelParaBase.h" +#include "geometryModelParaBase.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace Geometry { + int GeometrySet::idOffset = 0; + TopoDS_Shape* GeometrySet::tempShape = new TopoDS_Shape; + + int GeometrySet::getMaxID() + { + return idOffset; + } + GeometrySet::GeometrySet(GeometryType type, bool need) + { + _type = type; + if(need) { + idOffset++; + setID(idOffset); + } + appendProperty(QString("Visible"), _visible); + } + GeometrySet::~GeometrySet() + { + if(_shape != nullptr) + delete _shape; + + if(_parameter != nullptr) + delete _parameter; + } + void GeometrySet::dataToStream(QDataStream* s) + { + *s << _id << _name << _visible; + } + // void GeometrySet::setFilePath(const QString& filepath) + // { + // _filePath = filepath; + // appendProperty(QString("Path"), _filePath); + // } + // QString GeometrySet::getFilePath() + // { + // return _filePath; + // } + void GeometrySet::setVisible(bool v) + { + _visible = v; + appendProperty(QString("Visible"), _visible); + } + bool GeometrySet::isVisible() + { + return _visible; + } + void GeometrySet::setType(GeometryType t) + { + _type = t; + } + GeometryType GeometrySet::getType() + { + return _type; + } + void GeometrySet::setShape(TopoDS_Shape* shape) + { + _shape = shape; + int i = 0; + for(TopExp_Explorer faceExp(*shape, TopAbs_FACE); faceExp.More(); faceExp.Next()) + ++i; + appendProperty(QObject::tr("Surfaces"), i); + } + TopoDS_Shape* GeometrySet::getShape() + { + return _shape; + } + + void GeometrySet::setPoly(vtkPolyData* poly) + { + _polyData = poly; + } + + vtkPolyData* GeometrySet::getPoly() + { + return _polyData; + } + + TopoDS_Shape* GeometrySet::getShape(int type, int index) + { + *tempShape = TopoDS_Shape(); + TopAbs_ShapeEnum shapeType; + switch(type) { + case 1: + shapeType = TopAbs_VERTEX; + break; + case 2: + shapeType = TopAbs_EDGE; + break; + case 3: + shapeType = TopAbs_FACE; + break; + case 4: + shapeType = TopAbs_SOLID; + break; + default: + return tempShape; + } + TopExp_Explorer ptExp(*_shape, shapeType); + for(int i = 0; ptExp.More(); ptExp.Next(), ++i) { + if(i == index) { + *tempShape = ptExp.Current(); + break; + } + } + return tempShape; + } + + const TopoDS_Shape& GeometrySet::getRealShape(int type, int index) + { + *tempShape = TopoDS_Shape(); + TopAbs_ShapeEnum shapeType; + switch(type) { + case 1: + shapeType = TopAbs_VERTEX; + break; + case 2: + shapeType = TopAbs_EDGE; + break; + case 3: + shapeType = TopAbs_FACE; + break; + case 4: + shapeType = TopAbs_SOLID; + break; + default: + return *tempShape; + } + TopExp_Explorer ptExp(*_shape, shapeType); + for(int i = 0; ptExp.More(); ptExp.Next(), ++i) { + if(i == index) + *tempShape = ptExp.Current(); + } + return *tempShape; + } + + // void GeometrySet::setStlDataSet(vtkSmartPointer polyData) + // { + // _polyData = polyData; + // appendProperty(QObject::tr("Triangles"), (int)polyData->GetNumberOfCells()); + // } + // vtkDataSet* GeometrySet::getStlDataSet() + // { + // return _polyData; + // } + QDomElement& GeometrySet::writeToProjectFile(QDomDocument* doc, QDomElement* ele, bool isDiso) + { + QDomElement element = doc->createElement("GeoSet"); // 创建子节点 + QDomAttr idattr = doc->createAttribute("ID"); + idattr.setValue(QString::number(_id)); + element.setAttributeNode(idattr); + QDomAttr visible = doc->createAttribute("Visible"); + visible.setValue("True"); + if(!_visible) + visible.setValue("False"); + element.setAttributeNode(visible); + + QDomAttr isSTL = doc->createAttribute("ISSTL"); + isSTL.setValue("True"); + if(_type != STL) + isSTL.setValue("False"); + element.setAttributeNode(isSTL); + + QDomElement nameele = doc->createElement("Name"); + QDomText nameText = doc->createTextNode(_name); + nameele.appendChild(nameText); + element.appendChild(nameele); + // QDomElement pathele = doc->createElement("Path"); + // QDomText pathtext = doc->createTextNode(_filePath); + // pathele.appendChild(pathtext); + // element.appendChild(pathele); + + ele->appendChild(element); // 子节点挂载 + if(_parameter != nullptr) + _parameter->writeToProjectFile(doc, &element); + + if(isDiso) { + QString exelPath = QCoreApplication::applicationDirPath(); + const QString tempPath = exelPath + "/../tempIO/" + QString("%1.brep").arg(_id); + if(_type != STL) + this->writeBrep(tempPath); + else + this->writePoly(tempPath); + } + + for(int i = 0; i < _subSetList.size(); ++i) { + GeometrySet* subset = _subSetList.at(i); + subset->writeSubSet(doc, &element, isDiso); + } + + return element; + } + void GeometrySet::setID(int id) + { + DataBase::setID(id); + if(id > idOffset) + idOffset = id; + } + void GeometrySet::resetMaxID() + { + idOffset = 0; + } + void GeometrySet::readDataFromProjectFile(QDomElement* element, bool isDiso) + { + QDomNodeList subNodeList = element->elementsByTagName("SubSet"); + const int nsub = subNodeList.size(); + for(int i = 0; i < nsub; ++i) { + QDomElement subele = subNodeList.at(0).toElement(); + GeometrySet* subset = new GeometrySet; + subset->readSubSet(&subele, isDiso); + _subSetList.append(subset); + element->removeChild(subele); + } + + int id = element->attribute("ID").toInt(); + this->setID(id); + bool visible = true; + QString vis = element->attribute("Visible"); + if(vis.toLower() == "false") + visible = false; + this->setVisible(visible); + QString isSTL = element->attribute("ISSTL"); + if(isSTL.toLower() == "true") + this->setType(STL); + QDomNodeList nameNode = element->elementsByTagName("Name"); + + if(nameNode.size() != 1) + return; + QString name = nameNode.at(0).toElement().text(); + // qDebug() << name; + this->setName(name); + + QDomNodeList paraList = element->elementsByTagName("Parameter"); + if(paraList.size() == 1) { + QDomElement paraele = paraList.at(0).toElement(); + QString type = paraele.attribute("Type"); + // qDebug() << type; + _parameter = GeometryModelParaBase::createParaByString(type); + if(_parameter != nullptr) + _parameter->readDataFromProjectFile(¶ele); + } + + if(isDiso) { + QString exelPath = QCoreApplication::applicationDirPath(); + const QString tempPath = exelPath + "/../tempIO/" + QString("%1.brep").arg(_id); + + if(_type != STL) + this->readBrep(tempPath); + else + this->readPoly(tempPath); + } + } + + void GeometrySet::removeSubSet(GeometrySet* set) + { + _subSetList.removeOne(set); + } + + void GeometrySet::appendSubSet(GeometrySet* set) + { + _subSetList.append(set); + } + + int GeometrySet::getSubSetCount() + { + return _subSetList.size(); + } + + GeometrySet* GeometrySet::getSubSetAt(int index) + { + if(index >= 0 && index < _subSetList.size()) { + return _subSetList.at(index); + } + return nullptr; + } + + bool GeometrySet::writeBrep(QString name) + { + QByteArray arr = name.toLatin1(); + char* ch = arr.data(); + + TopoDS_Compound aRes; + BRep_Builder aBuilder; + aBuilder.MakeCompound(aRes); + + if(_shape == nullptr) + return false; + aBuilder.Add(aRes, *_shape); + + return BRepTools::Write(aRes, ch); + } + + bool GeometrySet::writePoly(QString name) + { + QByteArray arr = name.toLatin1(); + char* ch = arr.data(); + + vtkDataSetWriter* w = vtkDataSetWriter::New(); + w->SetInputData(_polyData); + w->SetFileName(ch); + w->SetFileTypeToBinary(); + w->Update(); + w->Delete(); + + return true; + } + + void GeometrySet::setParameter(GeometryModelParaBase* p) + { + _parameter = p; + } + + GeometryModelParaBase* GeometrySet::getParameter() + { + return _parameter; + } + + bool GeometrySet::isEditable() + { + return _parameter != nullptr; + } + + bool GeometrySet::readBrep(QString name) + { + QByteArray arr = name.toLatin1(); + char* ch = arr.data(); + TopoDS_Shape* ashape = new TopoDS_Shape; + BRep_Builder builder; + BRepTools::Read(*ashape, (const Standard_CString)ch, builder); + if(ashape->IsNull()) { + delete ashape; + return false; + } + _shape = ashape; + return true; + } + + bool GeometrySet::readPoly(QString name) + { + QByteArray arr = name.toLatin1(); + char* ch = arr.data(); + _polyData = vtkPolyData::New(); + auto reader = vtkPolyDataReader::New(); + reader->SetFileName(ch); + reader->Update(); + auto poly = reader->GetOutput(); + int n = poly->GetNumberOfCells(); + _polyData->DeepCopy(reader->GetOutput()); + reader->Delete(); + return true; + } + + void GeometrySet::writeSubSet(QDomDocument* doc, QDomElement* parent, bool isdiso) + { + QDomElement element = doc->createElement("SubSet"); // 创建子节点 + QDomAttr idattr = doc->createAttribute("ID"); + idattr.setValue(QString::number(_id)); + element.setAttributeNode(idattr); + QDomAttr visible = doc->createAttribute("Visible"); + visible.setValue("True"); + if(!_visible) + visible.setValue("False"); + element.setAttributeNode(visible); + QDomAttr isSTL = doc->createAttribute("ISSTL"); + isSTL.setValue("True"); + if(_type != STL) + isSTL.setValue("False"); + element.setAttributeNode(isSTL); + QDomElement nameele = doc->createElement("Name"); + QDomText nameText = doc->createTextNode(_name); + nameele.appendChild(nameText); + element.appendChild(nameele); + + parent->appendChild(element); // 子节点挂载 + if(_parameter != nullptr) + _parameter->writeToProjectFile(doc, &element); + + if(isdiso) { + QString exelPath = QCoreApplication::applicationDirPath(); + const QString tempPath = exelPath + "/../tempIO/" + QString("%1.brep").arg(_id); + if(_type != STL) + this->writeBrep(tempPath); + else + this->writePoly(tempPath); + } + } + + void GeometrySet::readSubSet(QDomElement* element, bool isDiso /*= false*/) + { + int id = element->attribute("ID").toInt(); + this->setID(id); + bool visible = true; + QString vis = element->attribute("Visible"); + if(vis.toLower() == "false") + visible = false; + this->setVisible(visible); + QString isSTL = element->attribute("ISSTL"); + if(isSTL.toLower() == "true") + this->setType(STL); + QDomNodeList nameNode = element->elementsByTagName("Name"); + if(nameNode.size() != 1) + return; + QString name = nameNode.at(0).toElement().text(); + // qDebug() << name; + this->setName(name); + + QDomNodeList paraList = element->elementsByTagName("Parameter"); + if(paraList.size() == 1) { + QDomElement paraele = paraList.at(0).toElement(); + QString type = paraele.attribute("Type"); + _parameter = GeometryModelParaBase::createParaByString(type); + if(_parameter != nullptr) + _parameter->readDataFromProjectFile(¶ele); + } + + if(isDiso) { + QString exelPath = QCoreApplication::applicationDirPath(); + const QString tempPath = exelPath + "/../tempIO/" + QString("%1.brep").arg(_id); + + if(_type != STL) + this->readBrep(tempPath); + else + this->readPoly(tempPath); + } + } + + GeometrySet* GeometrySet::getSetByID(int id) + { + GeometrySet* s = nullptr; + if(id == _id) + s = this; + else { + const int n = _subSetList.size(); + for(int i = 0; i < n; ++i) { + GeometrySet* temp = _subSetList.at(i); + if(id == temp->getID()) { + s = temp; + break; + } + } + } + return s; + } + + int GeometrySet::getGeoMemberCount(int type) + { + TopAbs_ShapeEnum shapeType; + switch(type) { + case 1: + shapeType = TopAbs_VERTEX; + break; + case 2: + shapeType = TopAbs_EDGE; + break; + case 3: + shapeType = TopAbs_FACE; + break; + case 4: + shapeType = TopAbs_SOLID; + break; + default: + return -1; + } + TopExp_Explorer ptExp(*_shape, shapeType); + QList tshapelist; + for(int index = 0; ptExp.More(); ptExp.Next(), ++index) { + TopoDS_Shape s = ptExp.Current(); + Handle(TopoDS_TShape) ts = s.TShape(); + if(tshapelist.contains(ts)) + continue; + tshapelist.append(ts); + } + return tshapelist.size(); + } + + void GeometrySet::releaseSubSet() + { + for(int i = 0; i < _subSetList.size(); ++i) { + delete _subSetList.at(i); + } + _subSetList.clear(); + } + +} // namespace Geometry diff --git a/src/geometry/geometrySet.h b/src/Geometry/geometrySet.h similarity index 100% rename from src/geometry/geometrySet.h rename to src/Geometry/geometrySet.h diff --git a/src/geometry/geometrySketch.cpp b/src/Geometry/geometrySketch.cpp similarity index 100% rename from src/geometry/geometrySketch.cpp rename to src/Geometry/geometrySketch.cpp diff --git a/src/geometry/geometrySketch.h b/src/Geometry/geometrySketch.h similarity index 100% rename from src/geometry/geometrySketch.h rename to src/Geometry/geometrySketch.h diff --git a/src/GeometryDataExchange/STLdataExchange.cpp b/src/GeometryDataExchange/STLdataExchange.cpp index d36e531..e7828ec 100644 --- a/src/GeometryDataExchange/STLdataExchange.cpp +++ b/src/GeometryDataExchange/STLdataExchange.cpp @@ -1,6 +1,6 @@ #include "STLdataExchange.h" -#include "geometry/geometrySet.h" -#include "geometry/geometryData.h" +#include "Geometry/geometrySet.h" +#include "Geometry/geometryData.h" #include #include diff --git a/src/IO/ProjectFileIO.cpp b/src/IO/ProjectFileIO.cpp index 2f6087a..1efffd7 100644 --- a/src/IO/ProjectFileIO.cpp +++ b/src/IO/ProjectFileIO.cpp @@ -1,54 +1,56 @@ #include "ProjectFileIO.h" -#include -#include + +#include "DataProperty/modelTreeItemType.h" #include "Geometry/geometryData.h" +#include "Geometry/geometrySet.h" +#include "MainWindow/SignalHandler.h" +#include "Material/MaterialSingletion.h" #include "MeshData/meshSingleton.h" -#include "ModelData/modelDataSingleton.h" #include "ModelData/modelDataBase.h" #include "ModelData/modelDataBaseExtend.h" #include "ModelData/modelDataFactory.h" -#include "DataProperty/modelTreeItemType.h" -#include "Material/MaterialSingletion.h" -#include "Geometry/geometrySet.h" +#include "ModelData/modelDataSingleton.h" #include "ModuleBase/CommonFunctions.h" #include "PluginManager/PluginManager.h" -#include "MainWindow/signalHandler.h" -#include -#include -#include -#include -#include -#include -#include + #include #include -#include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include -namespace IO -{ - ProjectFileIO::ProjectFileIO(GUI::MainWindow *mw, GUI::SignalHandler *sh, const QString &fileName, bool read) - : IOBase(fileName), ModuleBase::ThreadTask(mw), _read(read) +namespace IO { + ProjectFileIO::ProjectFileIO(GUI::MainWindow* mw, GUI::SignalHandler* sh, + const QString& fileName, bool read) + : IOBase(fileName) + , ModuleBase::ThreadTask(mw) + , _read(read) { - _geoData = Geometry::GeometryData::getInstance(); - _meshData = MeshData::MeshData::getInstance(); - _modelData = ModelData::ModelDataSingleton::getinstance(); + _geoData = Geometry::GeometryData::getInstance(); + _meshData = MeshData::MeshData::getInstance(); + _modelData = ModelData::ModelDataSingleton::getinstance(); _materialData = Material::MaterialSingleton::getInstance(); - _plugins = Plugins::PluginManager::getInstance(); + _plugins = Plugins::PluginManager::getInstance(); - connect(this, SIGNAL(processFinished(QString, bool, bool)), sh, SIGNAL(projectFileProcessedSig(QString, bool, bool))); + connect(this, SIGNAL(processFinished(QString, bool, bool)), sh, + SIGNAL(projectFileProcessedSig(QString, bool, bool))); } void ProjectFileIO::run() { bool success = false; - if (_read) - { + if(_read) { emit showInformation(tr("Opening Project File: \"%1\"").arg(_filename)); success = this->read(); - } - else - { + } else { emit showInformation(tr("Saving Project File: \"%1\"").arg(_filename)); success = this->write(); } @@ -58,15 +60,15 @@ namespace IO bool ProjectFileIO::write(QString s) { - if (s.isEmpty()) + if(s.isEmpty()) s = _filename; - bool ok = false; + bool ok = false; QString suffix = s.right(4).toLower(); qDebug() << s << suffix; - if (suffix == ".xml") + if(suffix == ".xml") ok = writeXml(s); - else if (suffix == "diso") + else if(suffix == "diso") ok = writeDiso(s); return ok; @@ -74,44 +76,45 @@ namespace IO bool ProjectFileIO::writeDiso(QString fileName) { - bool ok = false; - QString exelPath = QCoreApplication::applicationDirPath(); + bool ok = false; + QString exelPath = QCoreApplication::applicationDirPath(); const QString tempPath = exelPath + "/../tempIO/"; /*bool okremove = */ RemoveDir(tempPath); QDir dir = QDir(tempPath); - if (!dir.exists()) + if(!dir.exists()) dir.mkdir(tempPath); bool isEmpty = true; - _doc = new QDomDocument; - QDomProcessingInstruction instruction = _doc->createProcessingInstruction("xml", "version=\"1.0\" encoding=\"UTF-8\""); + _doc = new QDomDocument; + QDomProcessingInstruction instruction = + _doc->createProcessingInstruction("xml", "version=\"1.0\" encoding=\"UTF-8\""); _doc->appendChild(instruction); QDomElement root = _doc->createElement("DISO_FILE_1.0"); _doc->appendChild(root); const int geoCount = _geoData->getGeometrySetCount(); - if (geoCount > 0) //写出几何 + if(geoCount > 0) // 写出几何 { isEmpty = false; _geoData->writeToProjectFile(_doc, &root, true); } const int meshCount = _meshData->getKernalCount(); - if (meshCount > 0) //写出网格 + if(meshCount > 0) // 写出网格 { isEmpty = false; // _meshData->writeToProjectFile(_doc, &root); } const int nMaterial = _materialData->getMaterialCount(); - if (nMaterial > 0) //写出材料 + if(nMaterial > 0) // 写出材料 { isEmpty = false; _materialData->writeToProjectFile(_doc, &root); } const int modelCount = _modelData->getModelCount(); - if (modelCount > 0) //写出物理模型 + if(modelCount > 0) // 写出物理模型 { isEmpty = false; _modelData->writeToProjectFile(_doc, &root); @@ -120,17 +123,16 @@ namespace IO _plugins->writeToProjectFile(_doc, &root); // if (isEmpty) return false; //数据为空 不写文件 QFile file(tempPath + "case.xml"); - if (!file.open(QIODevice::WriteOnly | QIODevice::Truncate | QIODevice::Text)) + if(!file.open(QIODevice::WriteOnly | QIODevice::Truncate | QIODevice::Text)) return false; _stream = new QTextStream(&file); _doc->save(*_stream, 4); file.close(); - //写网格 + // 写网格 - if (meshCount > 0) - { + if(meshCount > 0) { QFile mhFile(tempPath + "mesh.mh"); - if (!mhFile.open(QIODevice::WriteOnly)) + if(!mhFile.open(QIODevice::WriteOnly)) return false; _dataStream = new QDataStream(&mhFile); _meshData->writeBinaryFile(_dataStream); @@ -144,39 +146,40 @@ namespace IO bool ProjectFileIO::writeXml(QString fileName) { bool isEmpty = true; - _doc = new QDomDocument; - QDomProcessingInstruction instruction = _doc->createProcessingInstruction("xml", "version=\"1.0\" encoding=\"UTF-8\""); + _doc = new QDomDocument; + QDomProcessingInstruction instruction = + _doc->createProcessingInstruction("xml", "version=\"1.0\" encoding=\"UTF-8\""); _doc->appendChild(instruction); QDomElement root = _doc->createElement("DISO_FILE_1.0"); _doc->appendChild(root); const int geoCount = _geoData->getGeometrySetCount(); - if (geoCount > 0) //写出几何 + if(geoCount > 0) // 写出几何 { isEmpty = false; _geoData->writeToProjectFile(_doc, &root); } const int meshCount = _meshData->getKernalCount(); - if (meshCount > 0) //写出网格 + if(meshCount > 0) // 写出网格 { isEmpty = false; _meshData->writeToProjectFile(_doc, &root); } const int nMaterial = _materialData->getMaterialCount(); - if (nMaterial > 0) //写出材料 + if(nMaterial > 0) // 写出材料 { isEmpty = false; _materialData->writeToProjectFile(_doc, &root); } const int modelCount = _modelData->getModelCount(); - if (modelCount > 0) //写出物理模型 + if(modelCount > 0) // 写出物理模型 { isEmpty = false; _modelData->writeToProjectFile(_doc, &root); } _plugins->writeToProjectFile(_doc, &root); // if (isEmpty) return false; //数据为空 不写文件 - if (!_file.open(QIODevice::WriteOnly | QIODevice::Truncate | QIODevice::Text)) + if(!_file.open(QIODevice::WriteOnly | QIODevice::Truncate | QIODevice::Text)) return false; _stream = new QTextStream(&_file); _doc->save(*_stream, 4); @@ -187,35 +190,34 @@ namespace IO bool ProjectFileIO::read() { - bool ok = false; - QString f = _filename; + bool ok = false; + QString f = _filename; // qDebug() << f; QString suffix = f.right(4); - if (suffix == ".xml") + if(suffix == ".xml") ok = readXml(f); - else if (suffix == "diso") + else if(suffix == "diso") ok = readDiso(f); return ok; } bool ProjectFileIO::readXml(QString fileName) { - if (!_file.open(QIODevice::ReadOnly | QFile::Text)) + if(!_file.open(QIODevice::ReadOnly | QFile::Text)) return false; _doc = new QDomDocument; - int row{0}, col{0}; + int row{ 0 }, col{ 0 }; QString errstr{}; - if (!_doc->setContent(&_file, true, &errstr, &row, &col)) - { + if(!_doc->setContent(&_file, true, &errstr, &row, &col)) { qDebug() << errstr << "line: " << row << "col: " << col; _file.close(); return false; } QDomNodeList modelNodeList = _doc->elementsByTagName("ModelData"); - QDomNodeList geoNodeList = _doc->elementsByTagName("Geometry"); - QDomNodeList meshNodeList = _doc->elementsByTagName("Mesh"); - QDomNodeList materialList = _doc->elementsByTagName("Materials"); - QDomNodeList pluginList = _doc->elementsByTagName("Plugins"); + QDomNodeList geoNodeList = _doc->elementsByTagName("Geometry"); + QDomNodeList meshNodeList = _doc->elementsByTagName("Mesh"); + QDomNodeList materialList = _doc->elementsByTagName("Materials"); + QDomNodeList pluginList = _doc->elementsByTagName("Plugins"); // if (modelNodeList.size() + geoNodeList.size() + meshNodeList.size() <= 0) // { // _file.close(); @@ -233,35 +235,33 @@ namespace IO bool ProjectFileIO::readDiso(QString fileName) { - QString exelPath = QCoreApplication::applicationDirPath(); + QString exelPath = QCoreApplication::applicationDirPath(); const QString tempPath = exelPath + "/../tempIO/"; - bool okremove = RemoveDir(tempPath); - if (okremove) - { + bool okremove = RemoveDir(tempPath); + if(okremove) { QDir dir = QDir(tempPath); - if (!dir.exists()) + if(!dir.exists()) dir.mkdir(tempPath); } QStringList files = JlCompress::extractDir(fileName, tempPath); - if (files.size() == 0) + if(files.size() == 0) return false; QFile file(tempPath + "case.xml"); - if (!file.open(QIODevice::ReadOnly | QFile::Text)) + if(!file.open(QIODevice::ReadOnly | QFile::Text)) return false; _doc = new QDomDocument; - if (!_doc->setContent(&file)) - { + if(!_doc->setContent(&file)) { file.close(); return false; } QDomNodeList modelNodeList = _doc->elementsByTagName("ModelData"); - QDomNodeList geoNodeList = _doc->elementsByTagName("Geometry"); + QDomNodeList geoNodeList = _doc->elementsByTagName("Geometry"); // QDomNodeList meshNodeList = _doc->elementsByTagName("Mesh"); - QDomNodeList materialList = _doc->elementsByTagName("Materials"); - QDomNodeList pluginList = _doc->elementsByTagName("Plugins"); + QDomNodeList materialList = _doc->elementsByTagName("Materials"); + QDomNodeList pluginList = _doc->elementsByTagName("Plugins"); // if (modelNodeList.size() + geoNodeList.size() /*+ meshNodeList.size()*/ <= 0) // { // _file.close(); @@ -271,8 +271,7 @@ namespace IO // readMeshData(&meshNodeList); QFile mhFile(tempPath + "mesh.mh"); - if (mhFile.open(QIODevice::ReadOnly)) - { + if(mhFile.open(QIODevice::ReadOnly)) { _dataStream = new QDataStream(&mhFile); _meshData->readBinaryFile(_dataStream); _meshData->generateDisplayDataSet(); @@ -287,55 +286,54 @@ namespace IO return true; } - void ProjectFileIO::readGeoData(QDomNodeList *nodeList, bool isdiso) + void ProjectFileIO::readGeoData(QDomNodeList* nodeList, bool isdiso) { const int nodeCount = nodeList->size(); - if (nodeCount != 1) + if(nodeCount != 1) return; _geoData->readFromProjectFile(nodeList, isdiso); } - void ProjectFileIO::readMeshData(QDomNodeList *nodeList) + void ProjectFileIO::readMeshData(QDomNodeList* nodeList) { const int nodeCount = nodeList->size(); - if (nodeCount != 1) + if(nodeCount != 1) return; _meshData->readFromProjectFile(nodeList); _meshData->generateDisplayDataSet(); } - void ProjectFileIO::readMaterialData(QDomNodeList *nodelist) + void ProjectFileIO::readMaterialData(QDomNodeList* nodelist) { const int nodeCount = nodelist->size(); - if (nodeCount != 1) + if(nodeCount != 1) return; QDomElement ele = nodelist->at(0).toElement(); _materialData->readDataFromProjectFile(&ele); } - void ProjectFileIO::readPluginData(QDomNodeList *nodeList) + void ProjectFileIO::readPluginData(QDomNodeList* nodeList) { const int nodeCount = nodeList->size(); - if (nodeCount != 1) + if(nodeCount != 1) return; QDomElement ele = nodeList->at(0).toElement(); _plugins->readDataFromProjectFile(&ele); } - void ProjectFileIO::readModelData(QDomNodeList *nodeList) + void ProjectFileIO::readModelData(QDomNodeList* nodeList) { const int nodeCount = nodeList->size(); - if (nodeCount != 1) + if(nodeCount != 1) return; - QDomElement root = nodeList->at(0).toElement(); - QDomNodeList modelList = root.elementsByTagName("Model"); - const int modelCount = modelList.size(); - for (int i = 0; i < modelCount; ++i) - { - QDomElement model = modelList.at(i).toElement(); - QString stype = model.attribute("Type"); - ProjectTreeType type = getTreeTypeByString(stype); - ModelData::ModelDataBase *modelData = nullptr; - modelData = ModelData::ModelDataFactory::createModel(type); - if (modelData == nullptr) + QDomElement root = nodeList->at(0).toElement(); + QDomNodeList modelList = root.elementsByTagName("Model"); + const int modelCount = modelList.size(); + for(int i = 0; i < modelCount; ++i) { + QDomElement model = modelList.at(i).toElement(); + QString stype = model.attribute("Type"); + ProjectTreeType type = getTreeTypeByString(stype); + ModelData::ModelDataBase* modelData = nullptr; + modelData = ModelData::ModelDataFactory::createModel(type); + if(modelData == nullptr) continue; QThread::msleep(100); @@ -347,4 +345,4 @@ namespace IO } } -} +} // namespace IO diff --git a/src/mainWindow/CMakeLists.txt b/src/MainWindow/CMakeLists.txt similarity index 100% rename from src/mainWindow/CMakeLists.txt rename to src/MainWindow/CMakeLists.txt diff --git a/src/mainWindow/CustomizerHelper.cpp b/src/MainWindow/CustomizerHelper.cpp similarity index 81% rename from src/mainWindow/CustomizerHelper.cpp rename to src/MainWindow/CustomizerHelper.cpp index 4d15b8d..c4cb7cc 100644 --- a/src/mainWindow/CustomizerHelper.cpp +++ b/src/MainWindow/CustomizerHelper.cpp @@ -1,36 +1,37 @@ #include "CustomizerHelper.h" -#include "MainWindow.h" -#include "signalHandler.h" -#include "SubWindowManager.h" + +#include "ConfigOptions/ConfigDataReader.h" +#include "ConfigOptions/ConfigOptions.h" #include "ConfigOptions/GeometryConfig.h" +#include "ConfigOptions/GlobalConfig.h" #include "ConfigOptions/MeshConfig.h" #include "ConfigOptions/PostConfig.h" #include "ConfigOptions/ProjectTreeConfig.h" -#include "ConfigOptions/ConfigOptions.h" -#include "ConfigOptions/ConfigDataReader.h" -#include "ConfigOptions/GlobalConfig.h" +#include "IO/IOConfig.h" #include "MainWidgets/ControlPanel.h" #include "MainWidgets/messageWindow.h" +#include "MainWindow.h" +#include "MainWindow/SARibbonMWUi.h" #include "PythonModule/PyAgent.h" +#include "SARibbonBar/SARibbonBar.h" +#include "SARibbonBar/SARibbonCategory.h" +#include "SARibbonBar/SARibbonMainWindow.h" #include "Settings/BusAPI.h" -#include "IO/IOConfig.h" +#include "SignalHandler.h" +#include "SubWindowManager.h" + #include -#include +#include #include #include -#include -#include "SARibbonBar/SARibbonMainWindow.h" -#include "SARibbonBar/SARibbonCategory.h" -#include "MainWindow/SARibbonMWUi.h" -#include "SARibbonBar/SARibbonBar.h" +#include -namespace GUI -{ - CustomizerHelper::CustomizerHelper(MainWindow *m, Ui::MainWindowRibbon *ui) - : _mainWindow(m), _ui(ui) +namespace GUI { + CustomizerHelper::CustomizerHelper(MainWindow* m, Ui::MainWindowRibbon* ui) + : _mainWindow(m) + , _ui(ui) { - if (!isUseRibbon()) - { + if(!isUseRibbon()) { _menuList.append(_ui->menuFile); _menuList.append(_ui->menuView); _menuList.append(_ui->menuGeometry); @@ -67,28 +68,23 @@ namespace GUI void CustomizerHelper::startCustomizer() { qDebug() << "mainWindow start cus"; - if (!isUseRibbon()) - { - for (QToolBar *tb : _toolBarList) + if(!isUseRibbon()) { + for(QToolBar* tb : _toolBarList) tb->setVisible(false); - for (QMenu *me : _menuList) - { - QList acs = me->findChildren(); - for (auto a : acs) + for(QMenu* me : _menuList) { + QList acs = me->findChildren(); + for(auto a : acs) a->setVisible(false); } - } - else - { - QList pannels = _ui->home_page->pannelList(); + } else { + QList pannels = _ui->home_page->pannelList(); pannels += _ui->geometry_page->pannelList(); pannels += _ui->mesh_page->pannelList(); pannels += _ui->solve_page->pannelList(); pannels += _ui->window_page->pannelList(); pannels += _ui->help_page->pannelList(); - for (SARibbonPannel *pannel : pannels) - { + for(SARibbonPannel* pannel : pannels) { // modify false -> true pannel->setVisible(true); } @@ -103,28 +99,24 @@ namespace GUI void CustomizerHelper::finishCustomizer() { qDebug() << "mainWindow finish cus"; - if (!isUseRibbon()) - { - for (QToolBar *tb : _toolBarList) + if(!isUseRibbon()) { + for(QToolBar* tb : _toolBarList) tb->setVisible(true); - for (QMenu *me : _menuList) - { - QList acs = me->findChildren(); - for (auto a : acs) + for(QMenu* me : _menuList) { + QList acs = me->findChildren(); + for(auto a : acs) a->setVisible(true); } _ui->SketchToolBar->setVisible(false); - } - else - { - QList pannels = _ui->home_page->pannelList(); + } else { + QList pannels = _ui->home_page->pannelList(); pannels += _ui->geometry_page->pannelList(); pannels += _ui->mesh_page->pannelList(); pannels += _ui->solve_page->pannelList(); pannels += _ui->window_page->pannelList(); pannels += _ui->help_page->pannelList(); - for (SARibbonPannel *pannel : pannels) + for(SARibbonPannel* pannel : pannels) pannel->setVisible(true); } _mainWindow->getControlPanel()->setVisible(true); @@ -135,8 +127,7 @@ namespace GUI bool CustomizerHelper::isUseRibbon() const { // SARibbonMainWindow* ribbonwindow = qobject_cast(_mainWindow); - if (_mainWindow != nullptr) - { + if(_mainWindow != nullptr) { return _mainWindow->isUseRibbon(); } return false; @@ -145,20 +136,19 @@ namespace GUI void CustomizerHelper::registerInterface() { QString error = this->readConfigOptions(); - if (!error.isEmpty()) - { - // QMessageBox::StandardButton b = QMessageBox::critical(_mainWindow, "Error", QObject::tr("Error Occured %1 ! still continue?").arg(error), QMessageBox::Yes | QMessageBox::No); - // if (b == QMessageBox::No) return; + if(!error.isEmpty()) { + // QMessageBox::StandardButton b = QMessageBox::critical(_mainWindow, "Error", + // QObject::tr("Error Occured %1 ! still continue?").arg(error), QMessageBox::Yes | + // QMessageBox::No); if (b == QMessageBox::No) return; } this->updateBasicInfo(); - ConfigOption::ConfigOption *option = ConfigOption::ConfigOption::getInstance(); - ConfigOption::GeometryConfig *geometryOption = option->getGeometryConfig(); - ConfigOption::MeshConfig *meshOption = option->getMeshConfig(); + ConfigOption::ConfigOption* option = ConfigOption::ConfigOption::getInstance(); + ConfigOption::GeometryConfig* geometryOption = option->getGeometryConfig(); + ConfigOption::MeshConfig* meshOption = option->getMeshConfig(); - if (!isUseRibbon()) - { + if(!isUseRibbon()) { bool ok = geometryOption->isImportGeometryEnabled(); this->enableGeoImport(ok); ok = geometryOption->isExportGeometryEnabled(); @@ -176,10 +166,10 @@ namespace GUI ok = geometryOption->isGeometryCreateSetEnabled(); _ui->actionCreateGeoComponent->setVisible(ok); - ok = meshOption->isImportMeshEnabled(); + ok = meshOption->isImportMeshEnabled(); const QStringList plgsin = IO::IOConfigure::getMeshImporters(); this->enableMeshImport(ok || (!plgsin.isEmpty())); - ok = meshOption->isExportMeshEnabled(); + ok = meshOption->isExportMeshEnabled(); const QStringList plgsex = IO::IOConfigure::getMeshExporters(); this->enableMeshExport(ok || (!plgsex.isEmpty())); ok = meshOption->isSolidMeshEnabled(); @@ -212,9 +202,7 @@ namespace GUI _ui->SelectToolBar->setVisible(geoEnable || meshEnable); _ui->DisplayToolBar->setVisible(geoEnable || meshEnable); // qApp->processEvents(); - } - else - { + } else { // ribbon的设置方式 } _mainWindow->getControlPanel()->registerEnabledModule(); @@ -224,41 +212,39 @@ namespace GUI QString CustomizerHelper::readConfigOptions() { - QString error{}; + QString error{}; // bool ok = false; - QString path = qApp->applicationDirPath(); - ConfigOption::ConfigDataReader reader(path + "/../ConfigFiles/", ConfigOption::ConfigOption::getInstance()); + QString path = qApp->applicationDirPath(); + ConfigOption::ConfigDataReader reader(path + "/../ConfigFiles/", + ConfigOption::ConfigOption::getInstance()); error = reader.read(); - if (!error.isEmpty()) + if(!error.isEmpty()) error.resize(error.size() - 1); return error; } void CustomizerHelper::updateBasicInfo() { - ConfigOption::ConfigOption *options = ConfigOption::ConfigOption::getInstance(); - ConfigOption::GlobalConfig *globalConfig = options->getGlobalConfig(); + ConfigOption::ConfigOption* options = ConfigOption::ConfigOption::getInstance(); + ConfigOption::GlobalConfig* globalConfig = options->getGlobalConfig(); - const QString lang = Setting::BusAPI::instance()->getLanguage(); - QString softName = "FastCAE"; - if (lang.toLower() == "chinese") - { + const QString lang = Setting::BusAPI::instance()->getLanguage(); + QString softName = "FastCAE"; + if(lang.toLower() == "chinese") { QString f = globalConfig->getChineseName(); - if (!f.isEmpty()) + if(!f.isEmpty()) softName = f; - } - else - { + } else { QString f = globalConfig->getSoftName(); - if (!f.isEmpty()) + if(!f.isEmpty()) softName = f; } _mainWindow->setWindowTitle(softName); const QString logoname = globalConfig->getLogo(); - QString path = qApp->applicationDirPath(); - const QString logo = path + "/../ConfigFiles/icon/" + logoname; + QString path = qApp->applicationDirPath(); + const QString logo = path + "/../ConfigFiles/icon/" + logoname; qDebug() << logo; _mainWindow->setIcon(logo); } @@ -275,10 +261,9 @@ namespace GUI void CustomizerHelper::enableGeoSketch(bool on) { - if (isUseRibbon()) + if(isUseRibbon()) _ui->sketch_pannel_geometry->setVisible(on); - else - { + else { _ui->menuSketch->setEnabled(on); _ui->StartSketchToolBar->setVisible(on); } @@ -286,14 +271,11 @@ namespace GUI void CustomizerHelper::enableGeoFeatureModeling(bool on) { - if (isUseRibbon()) - { + if(isUseRibbon()) { _ui->cube_pannel->setVisible(on); _ui->create_point_pannel->setVisible(on); _ui->base_plate_pannel->setVisible(on); - } - else - { + } else { _ui->menuFeature_Modeling->setEnabled(on); _ui->GeomertryFeatureToolBar->setVisible(on); } @@ -301,14 +283,11 @@ namespace GUI void CustomizerHelper::enableGeoFeatureOperate(bool on) { - if (isUseRibbon()) - { + if(isUseRibbon()) { _ui->chamfer_pannel->setVisible(on); _ui->sum_pannel->setVisible(on); _ui->stretch_pannel->setVisible(on); - } - else - { + } else { _ui->menuFeature_Operation->setEnabled(on); _ui->ChamferToolBar->setVisible(on); _ui->BoolToolBar->setVisible(on); @@ -318,8 +297,7 @@ namespace GUI void CustomizerHelper::enableGeoSelectAndView(bool on) { - if (!isUseRibbon()) - { + if(!isUseRibbon()) { _ui->menuSelect_2->setEnabled(on); _ui->menuView_3->setEnabled(on); } @@ -365,8 +343,7 @@ namespace GUI void CustomizerHelper::enableMeshSelectAndView(bool on) { - if (!isUseRibbon()) - { + if(!isUseRibbon()) { _ui->menuView_2->setEnabled(on); _ui->menuSelect->setEnabled(on); } @@ -381,4 +358,4 @@ namespace GUI _ui->actionBoxMeshNode->setVisible(on); } -} +} // namespace GUI diff --git a/src/MainWindow/CustomizerHelper.h b/src/MainWindow/CustomizerHelper.h new file mode 100644 index 0000000..c61aaa1 --- /dev/null +++ b/src/MainWindow/CustomizerHelper.h @@ -0,0 +1,63 @@ +#ifndef CUSTOMIZERHELPER_H_ +#define CUSTOMIZERHELPER_H_ + +#include "MainWindowAPI.h" + +#include +#include + +class QMenu; +class QToolBar; +class SARibbonPannel; +class SARibbonCategory; + +namespace Ui { + class MainWindowRibbon; +} + +namespace GUI { + class MainWindow; + + class MAINWINDOWAPI CustomizerHelper : public QObject { + Q_OBJECT + public: + CustomizerHelper(MainWindow* m, Ui::MainWindowRibbon* ui); + ~CustomizerHelper() = default; + + void startCustomizer(); + void finishCustomizer(); + + public slots: + /*根据配置文件开放接口 */ + void registerInterface(); + + private: + bool isUseRibbon() const; + QString readConfigOptions(); + void updateBasicInfo(); + + void enableGeoImport(bool on); + void enableGeoExport(bool on); + void enableGeoSketch(bool on); + void enableGeoFeatureModeling(bool on); + void enableGeoFeatureOperate(bool on); + void enableGeoSelectAndView(bool on); + + void enableMeshImport(bool on); + void enableMeshExport(bool on); + void enableSolidMesh(bool on); + void enableSurfaceMesh(bool on); + void enableMeshCheck(bool on); + void enableMeshComponent(bool on); + void enableMeshSelectAndView(bool on); + + private: + GUI::MainWindow* _mainWindow{}; + Ui::MainWindowRibbon* _ui{}; + + QList _menuList{}; + QList _toolBarList{}; + }; +} // namespace GUI + +#endif \ No newline at end of file diff --git a/src/mainWindow/DialogAbout.cpp b/src/MainWindow/DialogAbout.cpp similarity index 100% rename from src/mainWindow/DialogAbout.cpp rename to src/MainWindow/DialogAbout.cpp diff --git a/src/mainWindow/DialogAbout.h b/src/MainWindow/DialogAbout.h similarity index 100% rename from src/mainWindow/DialogAbout.h rename to src/MainWindow/DialogAbout.h diff --git a/src/mainWindow/DialogAbout.ui b/src/MainWindow/DialogAbout.ui similarity index 100% rename from src/mainWindow/DialogAbout.ui rename to src/MainWindow/DialogAbout.ui diff --git a/src/mainWindow/mainWindow.cpp b/src/MainWindow/MainWindow.cpp similarity index 66% rename from src/mainWindow/mainWindow.cpp rename to src/MainWindow/MainWindow.cpp index 2296426..ea64cbc 100644 --- a/src/mainWindow/mainWindow.cpp +++ b/src/MainWindow/MainWindow.cpp @@ -20,83 +20,81 @@ * DISCLAIMED. * ================================================================================== */ -#include -#include -#include -#include -#include -#include -#include -#include -#include #include "MainWindow.h" -#include "signalHandler.h" -#include "translator.h" -#include "SubWindowManager.h" -#include "SARibbonMWUi.h" -#include "Settings/BusAPI.h" -#include "Settings/GraphOption.h" -#include "ModuleBase/ModuleType.h" -#include "ModuleBase/ModuleBase.h" -#include "MainWidgets/ControlPanel.h" -#include "MainWidgets/messageWindow.h" -#include "MainWidgets/ProcessWindow.h" -#include "MainWidgets/projectSolveDialog.h" -#include "MainWidgets/DialogCreateSet.h" -#include "MainWidgets/DialogCreateGeoComponent.h" -#include "MainWidgets/DialogVTKTransform.h" -#include "MainWidgets/preWindow.h" -#include "GeometryWidgets/dialogSketchPlane.h" -#include "MeshData/meshSingleton.h" -#include "MeshData/meshKernal.h" -#include "Geometry/geometryData.h" -#include "DialogAbout.h" -#include -#include -#include -#include "IO/IOConfig.h" + #include "ConfigOptions/ConfigOptions.h" -#include "ConfigOptions/GlobalConfig.h" #include "ConfigOptions/GeometryConfig.h" +#include "ConfigOptions/GlobalConfig.h" #include "ConfigOptions/MeshConfig.h" #include "ConfigOptions/PostConfig.h" #include "ConfigOptions/ProjectTreeConfig.h" +#include "CustomizerHelper.h" +#include "DialogAbout.h" +#include "Geometry/geometryData.h" +#include "GeometryWidgets/dialogSketchPlane.h" +#include "GmshModule/GmshModule.h" +#include "IO/IOConfig.h" +#include "MainWidgets/ControlPanel.h" +#include "MainWidgets/DialogCreateGeoComponent.h" +#include "MainWidgets/DialogCreateSet.h" +#include "MainWidgets/DialogFilterMesh.h" +#include "MainWidgets/DialogVTKTransform.h" +#include "MainWidgets/messageWindow.h" +#include "MainWidgets/preWindow.h" +#include "MainWidgets/ProcessWindow.h" +#include "MainWidgets/projectSolveDialog.h" +#include "MainWindowPy.h" +#include "MeshData/meshKernal.h" +#include "MeshData/meshSingleton.h" #include "ModelData/modelDataBaseExtend.h" #include "ModelData/modelDataSingleton.h" +#include "ModuleBase/ModuleBase.h" +#include "ModuleBase/ModuleType.h" +#include "ModuleBase/ThreadTaskManager.h" #include "PluginManager/PluginManager.h" #include "PythonModule/PyAgent.h" -#include "MainWindowPy.h" -#include "CustomizerHelper.h" -#include "SolverControl/DialogSolverManager.h" -#include "GmshModule/GmshModule.h" -#include "ModuleBase/ThreadTaskManager.h" -#include "MainWidgets/DialogFilterMesh.h" #include "SARibbonMWUi.h" - // ribbon +#include "Settings/BusAPI.h" +#include "Settings/GraphOption.h" +#include "SignalHandler.h" +#include "SolverControl/DialogSolverManager.h" +#include "SubWindowManager.h" +#include "Translator.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +// ribbon #include "SARibbonBar/SARibbonBar.h" #include "SARibbonBar/SARibbonCategory.h" -#include "SARibbonBar/SARibbonPannel.h" #include "SARibbonBar/SARibbonContextCategory.h" +#include "SARibbonBar/SARibbonPannel.h" #include "SARibbonBar/SARibbonTabBar.h" // Post +#include "Common/Types.h" #include "PostInterface/AnimationToolBar.h" #include "PostInterface/RenderDirector.h" -#include "Common/Types.h" -namespace GUI -{ - MainWindow::MainWindow(bool useRibbon) : SARibbonMainWindow(nullptr, useRibbon), _ui(new Ui::MainWindowRibbon) +namespace GUI { + MainWindow::MainWindow(bool useRibbon) + : SARibbonMainWindow(nullptr, useRibbon) + , _ui(new Ui::MainWindowRibbon) { - if (useRibbon) - { + if(useRibbon) { _ui->setupRibbonUi(this); // ribbon customize // MainWindow的初始化,生成QAction - //生成ribbon布局 - m_ribbonActionMgr = new SARibbonActionsManager(static_cast(this)); + // 生成ribbon布局 + m_ribbonActionMgr = new SARibbonActionsManager(static_cast(this)); m_ribbonActionMgr->setAllActionCanCustomize(true); // 设置所有管理的action可编辑 - } - else - { + } else { _ui->setupUi(this); } @@ -104,8 +102,8 @@ namespace GUI QString lang = Setting::BusAPI::instance()->getLanguage(); registerMoudel(); - _signalHandler = new SignalHandler(this); - _translator = new Translator(); + _signalHandler = new SignalHandler(this); + _translator = new Translator(); _subWindowManager = new SubWindowManager(this, _ui->mdiArea, _signalHandler, _controlPanel); setPostAnimationToolBar(useRibbon); connectSignals(); @@ -117,11 +115,11 @@ namespace GUI this->ChangeLanguage(lang); QString workingdir = Setting::BusAPI::instance()->getWorkingDir(); - if (workingdir.isEmpty()) + if(workingdir.isEmpty()) setWorkingDir(); Setting::BusAPI::instance()->setMainWindow(this); - Setting::GraphOption *gp = Setting::BusAPI::instance()->getGraphOption(); + Setting::GraphOption* gp = Setting::BusAPI::instance()->getGraphOption(); _ui->actionDisplayPoint->setChecked(gp->isShowGeoPoint()); _ui->actionDisplayCurve->setChecked(gp->isShowGeoEdge()); _ui->actionDisplayFace->setChecked(gp->isShowGeoSurface()); @@ -152,9 +150,9 @@ namespace GUI // ribbon customize // MainWindow的构造函数最后 - if (useRibbon) - { - const QString strCostomizePath = QApplication::applicationDirPath() + "/customization.xml"; + if(useRibbon) { + const QString strCostomizePath = + QApplication::applicationDirPath() + "/customization.xml"; sa_apply_customize_from_xml_file(strCostomizePath, this, m_ribbonActionMgr); } } @@ -167,39 +165,38 @@ namespace GUI ModuleBase::ThreadTaskManager::getInstance()->clearThreadTaskList(); - if (_signalHandler != nullptr) + if(_signalHandler != nullptr) delete _signalHandler; - if (_controlPanel != nullptr) + if(_controlPanel != nullptr) delete _controlPanel; - if (_messageWindow != nullptr) + if(_messageWindow != nullptr) delete _messageWindow; - if (_processWindow != nullptr) + if(_processWindow != nullptr) delete _processWindow; - if (_ui != nullptr) + if(_ui != nullptr) delete _ui; _ui = nullptr; - if (_translator != nullptr) + if(_translator != nullptr) delete _translator; - if (_viewSignalMapper != nullptr) + if(_viewSignalMapper != nullptr) delete _viewSignalMapper; - if (_selectSignalMapper != nullptr) + if(_selectSignalMapper != nullptr) delete _selectSignalMapper; // if (_displayModeSignalMapper != nullptr) delete _displayModeSignalMapper; - if (_recentFileMapper != nullptr) + if(_recentFileMapper != nullptr) delete _recentFileMapper; - if (_recentMenu != nullptr) + if(_recentMenu != nullptr) delete _recentMenu; - if (_graphRange != nullptr) + if(_graphRange != nullptr) delete _graphRange; - if (_customizerHelper != nullptr) + if(_customizerHelper != nullptr) delete _customizerHelper; - if (_postToolBar != nullptr) + if(_postToolBar != nullptr) delete _postToolBar; // ribbon customize - if (m_ribbonActionMgr != nullptr) - { + if(m_ribbonActionMgr != nullptr) { delete m_ribbonActionMgr; } } @@ -208,9 +205,12 @@ namespace GUI { connect(this, SIGNAL(closeMainWindow()), this, SLOT(closeWindow())); connect(this, SIGNAL(sendInfoToStatesBar(QString)), this, SLOT(setStatusBarInfo(QString))); - // connect(this, SIGNAL(importMeshByNamesSig(QString)), this, SLOT(importMesh(QString))); - connect(this, SIGNAL(importMeshDataSetSig(vtkDataSet *)), this, SLOT(importMeshDataset(vtkDataSet *))); - connect(this, SIGNAL(printMessageSig(Common::Message, QString)), this, SLOT(printMessage(Common::Message, QString))); + // connect(this, SIGNAL(importMeshByNamesSig(QString)), this, + //SLOT(importMesh(QString))); + connect(this, SIGNAL(importMeshDataSetSig(vtkDataSet*)), this, + SLOT(importMeshDataset(vtkDataSet*))); + connect(this, SIGNAL(printMessageSig(Common::Message, QString)), this, + SLOT(printMessage(Common::Message, QString))); connect(_ui->actionNew, SIGNAL(triggered()), this, SLOT(on_actionNew())); connect(_ui->actionOpen, SIGNAL(triggered()), this, SLOT(on_actionOpen())); @@ -229,14 +229,16 @@ namespace GUI connect(_ui->actionAbout, SIGNAL(triggered()), this, SLOT(on_about())); connect(_ui->actionUser_Manual, SIGNAL(triggered()), this, SLOT(on_userManual())); connect(_ui->actionCreate_Set, SIGNAL(triggered()), this, SLOT(on_CreateSet())); - connect(_ui->actionCreateGeoComponent, SIGNAL(triggered()), this, SLOT(on_CreateGeoComponent())); + connect(_ui->actionCreateGeoComponent, SIGNAL(triggered()), this, + SLOT(on_CreateGeoComponent())); connect(_ui->actionSave_Script, SIGNAL(triggered()), this, SLOT(on_SaveScript())); connect(_ui->actionExecute_Script, SIGNAL(triggered()), this, SLOT(on_ExecuateScript())); - connect(_ui->actionPluginManager, SIGNAL(triggered()), Plugins::PluginManager::getInstance(), SLOT(manage())); + connect(_ui->actionPluginManager, SIGNAL(triggered()), + Plugins::PluginManager::getInstance(), SLOT(manage())); connect(_ui->actionFilterMesh, SIGNAL(triggered()), this, SLOT(on_FilterMesh())); connect(_ui->actionVTKTranslation, SIGNAL(triggered()), this, SLOT(on_VTKTranslation())); - //设置视角 + // 设置视角 _viewSignalMapper = new QSignalMapper(this); connect(_ui->actionFitView, SIGNAL(triggered()), _viewSignalMapper, SLOT(map())); connect(_ui->actionViewXPlus, SIGNAL(triggered()), _viewSignalMapper, SLOT(map())); @@ -252,8 +254,9 @@ namespace GUI _viewSignalMapper->setMapping(_ui->actionViewYMinus, QString("YMinus")); _viewSignalMapper->setMapping(_ui->actionViewZPlus, QString("ZPlus")); _viewSignalMapper->setMapping(_ui->actionViewZMinus, QString("ZMinus")); - connect(_viewSignalMapper, SIGNAL(mapped(QString)), _subWindowManager, SLOT(setView(QString))); - //设置mesh选择模式 + connect(_viewSignalMapper, SIGNAL(mapped(QString)), _subWindowManager, + SLOT(setView(QString))); + // 设置mesh选择模式 _selectSignalMapper = new QSignalMapper(this); connect(_ui->actionSelectOff, SIGNAL(triggered()), _selectSignalMapper, SLOT(map())); // connect(_ui->actionSelectGeoBody, SIGNAL(triggered()), _selectSignalMapper, SLOT(map())); @@ -262,46 +265,65 @@ namespace GUI connect(_ui->actionBoxMeshNode, SIGNAL(triggered()), _selectSignalMapper, SLOT(map())); connect(_ui->actionBoxMeshCell, SIGNAL(triggered()), _selectSignalMapper, SLOT(map())); _selectSignalMapper->setMapping(_ui->actionSelectOff, (int)ModuleBase::SelectModel::None); - //_selectSignalMapper->setMapping(_ui->actionSelectGeoBody, (int)ModuleBase::SelectModel::GeometryBody); - _selectSignalMapper->setMapping(_ui->actionSelectMeshNode, (int)ModuleBase::SelectModel::MeshNode); - _selectSignalMapper->setMapping(_ui->actionSelectMeshCell, (int)ModuleBase::SelectModel::MeshCell); - _selectSignalMapper->setMapping(_ui->actionBoxMeshNode, (int)ModuleBase::SelectModel::BoxMeshNode); - _selectSignalMapper->setMapping(_ui->actionBoxMeshCell, (int)ModuleBase::SelectModel::BoxMeshCell); + //_selectSignalMapper->setMapping(_ui->actionSelectGeoBody, + //(int)ModuleBase::SelectModel::GeometryBody); + _selectSignalMapper->setMapping(_ui->actionSelectMeshNode, + (int)ModuleBase::SelectModel::MeshNode); + _selectSignalMapper->setMapping(_ui->actionSelectMeshCell, + (int)ModuleBase::SelectModel::MeshCell); + _selectSignalMapper->setMapping(_ui->actionBoxMeshNode, + (int)ModuleBase::SelectModel::BoxMeshNode); + _selectSignalMapper->setMapping(_ui->actionBoxMeshCell, + (int)ModuleBase::SelectModel::BoxMeshCell); connect(_selectSignalMapper, SIGNAL(mapped(int)), this, SIGNAL(selectModelChangedSig(int))); connect(_selectSignalMapper, SIGNAL(mapped(int)), this, SLOT(selectModelChanged(int))); - //网格显示模式 + // 网格显示模式 // _displayModeSignalMapper = new QSignalMapper(this); connect(_ui->actionDisplayNode, SIGNAL(triggered()), this, SLOT(setMeshDisplay())); connect(_ui->actionDisplayWireFrame, SIGNAL(triggered()), this, SLOT(setMeshDisplay())); connect(_ui->actionDisplaySurface, SIGNAL(triggered()), this, SLOT(setMeshDisplay())); - //几何显示模式(点、线、面) + // 几何显示模式(点、线、面) connect(_ui->actionDisplayPoint, SIGNAL(triggered()), this, SLOT(setGeometryDisplay())); connect(_ui->actionDisplayCurve, SIGNAL(triggered()), this, SLOT(setGeometryDisplay())); connect(_ui->actionDisplayFace, SIGNAL(triggered()), this, SLOT(setGeometryDisplay())); - //设置几何选取模式(点、线、面) + // 设置几何选取模式(点、线、面) _selectGeometryModeMapper = new QSignalMapper(this); connect(_ui->actionSelectOff, SIGNAL(triggered()), _selectGeometryModeMapper, SLOT(map())); - connect(_ui->actionSelectPoint, SIGNAL(triggered()), _selectGeometryModeMapper, SLOT(map())); - connect(_ui->actionSelectCurve, SIGNAL(triggered()), _selectGeometryModeMapper, SLOT(map())); + connect(_ui->actionSelectPoint, SIGNAL(triggered()), _selectGeometryModeMapper, + SLOT(map())); + connect(_ui->actionSelectCurve, SIGNAL(triggered()), _selectGeometryModeMapper, + SLOT(map())); connect(_ui->actionSelectFace, SIGNAL(triggered()), _selectGeometryModeMapper, SLOT(map())); - connect(_ui->actionSelectGeometryBody, SIGNAL(triggered()), _selectGeometryModeMapper, SLOT(map())); - _selectGeometryModeMapper->setMapping(_ui->actionSelectOff, (int)ModuleBase::SelectModel::None); - _selectGeometryModeMapper->setMapping(_ui->actionSelectPoint, (int)ModuleBase::SelectModel::GeometryWinPoint); - _selectGeometryModeMapper->setMapping(_ui->actionSelectCurve, (int)ModuleBase::SelectModel::GeometryWinCurve); - _selectGeometryModeMapper->setMapping(_ui->actionSelectFace, (int)ModuleBase::SelectModel::GeometryWinSurface); - _selectGeometryModeMapper->setMapping(_ui->actionSelectGeometryBody, (int)ModuleBase::SelectModel::GeometryWinBody); + connect(_ui->actionSelectGeometryBody, SIGNAL(triggered()), _selectGeometryModeMapper, + SLOT(map())); + _selectGeometryModeMapper->setMapping(_ui->actionSelectOff, + (int)ModuleBase::SelectModel::None); + _selectGeometryModeMapper->setMapping(_ui->actionSelectPoint, + (int)ModuleBase::SelectModel::GeometryWinPoint); + _selectGeometryModeMapper->setMapping(_ui->actionSelectCurve, + (int)ModuleBase::SelectModel::GeometryWinCurve); + _selectGeometryModeMapper->setMapping(_ui->actionSelectFace, + (int)ModuleBase::SelectModel::GeometryWinSurface); + _selectGeometryModeMapper->setMapping(_ui->actionSelectGeometryBody, + (int)ModuleBase::SelectModel::GeometryWinBody); - connect(_selectGeometryModeMapper, SIGNAL(mapped(int)), this, SLOT(selectGeometryModelChanged(int))); - connect(_selectGeometryModeMapper, SIGNAL(mapped(int)), this, SIGNAL(selectModelChangedSig(int))); + connect(_selectGeometryModeMapper, SIGNAL(mapped(int)), this, + SLOT(selectGeometryModelChanged(int))); + connect(_selectGeometryModeMapper, SIGNAL(mapped(int)), this, + SIGNAL(selectModelChangedSig(int))); - connect(_ui->actionPre_Window, SIGNAL(triggered()), _subWindowManager, SLOT(openPreWindow())); + connect(_ui->actionPre_Window, SIGNAL(triggered()), _subWindowManager, + SLOT(openPreWindow())); - connect(this, SIGNAL(importGeometrySig(QStringList)), this, SLOT(importGeometry(QStringList))); + connect(this, SIGNAL(importGeometrySig(QStringList)), this, + SLOT(importGeometry(QStringList))); connect(this, SIGNAL(exportGeometrySig(QString)), this, SLOT(exportGeometry(QString))); connect(_ui->actionCreate_Sketch, SIGNAL(triggered()), this, SLOT(on_sketchClicked())); - connect(this, SIGNAL(showGraphRangeSig(double, double)), this, SLOT(showGraphRange(double, double))); - connect(this, SIGNAL(startSketchSig(bool, double *, double *)), this, SLOT(startSketch(bool))); + connect(this, SIGNAL(showGraphRangeSig(double, double)), this, + SLOT(showGraphRange(double, double))); + connect(this, SIGNAL(startSketchSig(bool, double*, double*)), this, + SLOT(startSketch(bool))); // connect(this, SIGNAL(updateActionsStatesSig()), this, SLOT(updateActionsStates())); connect(this, SIGNAL(updatePreMeshActorSig()), this, SLOT(updatePreMeshActor())); connect(this, SIGNAL(updatePreGeometryActorSig()), this, SLOT(updatePreGeometryActor())); @@ -311,27 +333,27 @@ namespace GUI void MainWindow::registerMoudel() { - ///添加ProjectWindow + /// 添加ProjectWindow _controlPanel = new MainWidget::ControlPanel(this); _controlPanel->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea); addDockWidget(Qt::LeftDockWidgetArea, _controlPanel); this->setCorner(Qt::Corner::BottomLeftCorner, Qt::LeftDockWidgetArea); - ///添加MessageWindow + /// 添加MessageWindow _messageWindow = new MainWidget::MessageWindow(this); _messageWindow->setAllowedAreas(Qt::BottomDockWidgetArea | Qt::TopDockWidgetArea); addDockWidget(Qt::BottomDockWidgetArea, _messageWindow); - ///添加ProcessWindow + /// 添加ProcessWindow _processWindow = new MainWidget::ProcessWindow(this); _processWindow->setAllowedAreas(Qt::BottomDockWidgetArea | Qt::TopDockWidgetArea); addDockWidget(Qt::BottomDockWidgetArea, _processWindow); } - Ui::MainWindowRibbon *MainWindow::getUi() + Ui::MainWindowRibbon* MainWindow::getUi() { return _ui; } - Translator *MainWindow::GetTranslator() + Translator* MainWindow::GetTranslator() { return _translator; } @@ -341,31 +363,31 @@ namespace GUI _ui->statusbar->showMessage(info, 10000); } - void MainWindow::setMD5(const QString &md5) + void MainWindow::setMD5(const QString& md5) { _MD5 = md5; } - void MainWindow::setCurrentFile(const QString &file) + void MainWindow::setCurrentFile(const QString& file) { - if (!file.isEmpty()) - { + if(!file.isEmpty()) { QFileInfo F(file); - if (!F.exists()) + if(!F.exists()) return; _currentFile = F.absoluteFilePath(); } - QString lang = Setting::BusAPI::instance()->getLanguage(); - QString title; - ConfigOption::GlobalConfig *g = ConfigOption::ConfigOption::getInstance()->getGlobalConfig(); + QString lang = Setting::BusAPI::instance()->getLanguage(); + QString title; + ConfigOption::GlobalConfig* g = + ConfigOption::ConfigOption::getInstance()->getGlobalConfig(); title = g->getSoftName(); - if (lang.toLower() == "chinese") + if(lang.toLower() == "chinese") title = g->getChineseName(); - if (title.isEmpty()) + if(title.isEmpty()) title = "FastCAE"; - if (!_currentFile.isEmpty()) + if(!_currentFile.isEmpty()) title = QString("%1-[%2]").arg(title).arg(_currentFile); this->setWindowTitle(title); @@ -381,26 +403,26 @@ namespace GUI _subWindowManager->updatePreGeometryActor(); } - void MainWindow::closeEvent(QCloseEvent *event) + void MainWindow::closeEvent(QCloseEvent* event) { QString md5 = _signalHandler->getMD5(); - if (md5 != _MD5) - { - int nRet = QMessageBox::warning(this, tr("Save"), tr("Do you want to save before exit ?"), tr("Yes"), tr("No"), tr("Cancel")); + if(md5 != _MD5) { + int nRet = + QMessageBox::warning(this, tr("Save"), tr("Do you want to save before exit ?"), + tr("Yes"), tr("No"), tr("Cancel")); - switch (nRet) - { - case 2: - event->ignore(); - return; - case 0: - this->on_actionSave(); - case 1: - // clean data - default: - break; + switch(nRet) { + case 2: + event->ignore(); + return; + case 0: + this->on_actionSave(); + case 1: + // clean data + default: + break; } - if (nullptr != event) + if(nullptr != event) event->accept(); } // if (!_designModel) @@ -416,51 +438,46 @@ namespace GUI void MainWindow::ChangeLanguage(QString lang) { Setting::BusAPI::instance()->setLanguage(lang); - if (nullptr == _ui) + if(nullptr == _ui) return; - if (lang == "English") - { + if(lang == "English") { _ui->actionChinese->setChecked(false); _ui->actionEnglish->setChecked(true); _translator->toEnglish(); - } - else if (lang == "Chinese") - { + } else if(lang == "Chinese") { _ui->actionChinese->setChecked(true); _ui->actionEnglish->setChecked(false); _translator->toChinese(); } Plugins::PluginManager::getInstance()->reTranslate(lang); - if (isUseRibbon()) + if(isUseRibbon()) _ui->retranslateRibbonUi(this); else _ui->retranslateUi(this); - if (_recentMenu != nullptr) + if(_recentMenu != nullptr) _recentMenu->setTitle(tr("Recent")); _controlPanel->reTranslate(); _messageWindow->reTranslate(); _subWindowManager->reTranslate(); - if (_processWindow != nullptr) + if(_processWindow != nullptr) _processWindow->reTranslate(); - ConfigOption::GlobalConfig *g = ConfigOption::ConfigOption::getInstance()->getGlobalConfig(); + ConfigOption::GlobalConfig* g = + ConfigOption::ConfigOption::getInstance()->getGlobalConfig(); QString title = "FastCAE"; - if (lang.toLower() == "chinese") - { + if(lang.toLower() == "chinese") { QString f = g->getChineseName(); - if (!f.isEmpty()) + if(!f.isEmpty()) title = f; - } - else - { + } else { QString f = g->getSoftName(); - if (!f.isEmpty()) + if(!f.isEmpty()) title = f; } - if (!_currentFile.isEmpty()) + if(!_currentFile.isEmpty()) title = QString("%1-[%2]").arg(title).arg(_currentFile); this->setWindowTitle(title); @@ -476,24 +493,25 @@ namespace GUI { /* emit sig_action_open();*/ QString md5 = _signalHandler->getMD5(); - if (md5 != _MD5) - { + if(md5 != _MD5) { QMessageBox::StandardButton but; - but = QMessageBox::warning(this, tr("Warning"), tr("Do you want to save current data ?"), QMessageBox::Yes | QMessageBox::No); - if (but == QMessageBox::Yes) + but = + QMessageBox::warning(this, tr("Warning"), tr("Do you want to save current data ?"), + QMessageBox::Yes | QMessageBox::No); + if(but == QMessageBox::Yes) on_actionSave(); } // _signalHandler->clearData(); - QString dir = Setting::BusAPI::instance()->getWorkingDir(); + QString dir = Setting::BusAPI::instance()->getWorkingDir(); QString fillter = tr("Project file(*.diso);;Project file(*.xml)"); #ifdef Q_OS_LINUX fillter = tr("DISO file(*.diso);;XML file(*.xml)"); #endif - QString title = tr("Open a project"); + QString title = tr("Open a project"); QString filePath = QFileDialog::getOpenFileName(this, title, dir, fillter); - if (filePath.isEmpty()) + if(filePath.isEmpty()) return; // _signalHandler->clearData(); @@ -506,12 +524,10 @@ namespace GUI void MainWindow::on_actionSave() { - if (!_currentFile.isEmpty()) - { + if(!_currentFile.isEmpty()) { QString pycode = QString("MainWindow.saveProjectFile(\"%1\")").arg(_currentFile); Py::PythonAgent::getInstance()->submit(pycode); - } - else + } else on_actionSaveAs(); } @@ -521,40 +537,39 @@ namespace GUI #ifdef Q_OS_LINUX fillter = tr("DISO file(*.diso);;XML file(*.xml)"); #endif - QString title = tr("Save project"); - QString dir = Setting::BusAPI::instance()->getWorkingDir(); + QString title = tr("Save project"); + QString dir = Setting::BusAPI::instance()->getWorkingDir(); // QString filePath = QFileDialog::getSaveFileName(this, title, dir, fillter); QFileDialog dlg(this, title, dir, fillter); dlg.setAcceptMode(QFileDialog::AcceptSave); - if (QDialog::Accepted != dlg.exec()) + if(QDialog::Accepted != dlg.exec()) return; QString filePath = dlg.selectedFiles().at(0); - if (filePath.isEmpty()) + if(filePath.isEmpty()) return; #ifdef Q_OS_LINUX bool isproj = filePath.toLower().endsWith(".diso") || filePath.toLower().endsWith(".xml"); - if (!isproj) - { + if(!isproj) { QString suffix = dlg.selectedNameFilter(); - if (suffix.contains("diso")) + if(suffix.contains("diso")) suffix = "diso"; - else if (suffix.contains("xml")) + else if(suffix.contains("xml")) suffix = "xml"; filePath = filePath + "." + suffix; } #endif bool empty = Geometry::GeometryData::getInstance()->isEmpty(); - if (filePath.right(3).toLower() == "xml" && !empty) - { - QMessageBox::StandardButton bt = QMessageBox::warning(this, tr("Warning"), tr("Geometry will be lost! still continue?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes); - if (bt == QMessageBox::No) + if(filePath.right(3).toLower() == "xml" && !empty) { + QMessageBox::StandardButton bt = QMessageBox::warning( + this, tr("Warning"), tr("Geometry will be lost! still continue?"), + QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes); + if(bt == QMessageBox::No) return; } - if (!filePath.isEmpty()) - { + if(!filePath.isEmpty()) { QString pycode = QString("MainWindow.saveProjectFile(\"%1\")").arg(filePath); Py::PythonAgent::getInstance()->submit(pycode); } @@ -564,69 +579,71 @@ namespace GUI { QStringList suffixlist = IO::IOConfigure::getMeshImporters(); // QStringList list = IO::IOConfigure::getMeshImporters(); - if (suffixlist.isEmpty()) - { + if(suffixlist.isEmpty()) { QMessageBox::warning(this, tr("Warning"), tr("The MeshPlugin is not installed !")); return; } - QStringList meshsuffix = ConfigOption::ConfigOption::getInstance()->getMeshConfig()->getImportSuffix().split(";"); + QStringList meshsuffix = + ConfigOption::ConfigOption::getInstance()->getMeshConfig()->getImportSuffix().split( + ";"); QStringList list; - for (QString s : meshsuffix) - { - for (int i = 0; i < suffixlist.size(); i++) - { + for(QString s : meshsuffix) { + for(int i = 0; i < suffixlist.size(); i++) { QString suffix = suffixlist.at(i); - if (suffix.contains(s)) + if(suffix.contains(s)) list.append(suffix); } } std::sort(list.begin(), list.end()); - QString suffixes = list.join(";;"); + QString suffixes = list.join(";;"); QString senderName = sender()->objectName(); - int modelID = -1; - if (senderName.contains("Only INP_")) - { + int modelID = -1; + if(senderName.contains("Only INP_")) { suffixes = list.at(0); - modelID = senderName.right(1).toInt(); + modelID = senderName.right(1).toInt(); } - QString workDir = Setting::BusAPI::instance()->getWorkingDir(); + QString workDir = Setting::BusAPI::instance()->getWorkingDir(); QFileDialog dlg(this, tr("Import Mesh"), workDir, suffixes); dlg.setAcceptMode(QFileDialog::AcceptOpen); dlg.setFileMode(QFileDialog::ExistingFile); - if (dlg.exec() != QFileDialog::Accepted) + if(dlg.exec() != QFileDialog::Accepted) return; - QString aSuffix = dlg.selectedNameFilter(); + QString aSuffix = dlg.selectedNameFilter(); QString fileName = dlg.selectedFiles().join(","); - if (fileName.isEmpty()) + if(fileName.isEmpty()) return; - QString pyCode = QString("MainWindow.importMesh(\"%1\",\"%2\",%3)").arg(fileName).arg(aSuffix).arg(modelID); + QString pyCode = QString("MainWindow.importMesh(\"%1\",\"%2\",%3)") + .arg(fileName) + .arg(aSuffix) + .arg(modelID); Py::PythonAgent::getInstance()->submit(pyCode); } void MainWindow::on_exportGeometry() { - QString dir = Setting::BusAPI::instance()->getWorkingDir(); + QString dir = Setting::BusAPI::instance()->getWorkingDir(); - ConfigOption::GeometryConfig *geoconfig = ConfigOption::ConfigOption::getInstance()->getGeometryConfig(); - QString conSuffix = geoconfig->getExportSuffix().toLower(); - QStringList sl = conSuffix.split(";"); + ConfigOption::GeometryConfig* geoconfig = + ConfigOption::ConfigOption::getInstance()->getGeometryConfig(); + QString conSuffix = geoconfig->getExportSuffix().toLower(); + QStringList sl = conSuffix.split(";"); conSuffix.clear(); - for (QString s : sl) - { + for(QString s : sl) { conSuffix += " *." + s; } conSuffix = QString("Geometry Files(%1)").arg(conSuffix); QString regSuffix{}; - QString title = tr("Export Geometry"); - QString filename = QFileDialog::getSaveFileName(this, title, dir, conSuffix + regSuffix /* + ";;All Files(*.*)"*/); - if (filename.isEmpty()) + QString title = tr("Export Geometry"); + QString filename = QFileDialog::getSaveFileName( + this, title, dir, conSuffix + regSuffix /* + ";;All Files(*.*)"*/); + if(filename.isEmpty()) return; QString pycode = QString("MainWindow.exportGeometry(\"%1\")").arg(filename); @@ -637,51 +654,51 @@ namespace GUI { QStringList suffixlist = IO::IOConfigure::getMeshExporters(); // QStringList list = IO::IOConfigure::getMeshImporters(); - if (suffixlist.isEmpty()) - { + if(suffixlist.isEmpty()) { QMessageBox::warning(this, tr("Warning"), tr("The MeshPlugin is not installed !")); return; } - if (MeshData::MeshData::getInstance()->getKernalCount() == 0) - { + if(MeshData::MeshData::getInstance()->getKernalCount() == 0) { QMessageBox::warning(this, tr("Warning"), tr("No one has any grid!")); return; } - QStringList meshsuffix = ConfigOption::ConfigOption::getInstance()->getMeshConfig()->getExportSuffix().split(";"); + QStringList meshsuffix = + ConfigOption::ConfigOption::getInstance()->getMeshConfig()->getExportSuffix().split( + ";"); QStringList list; - for (QString s : meshsuffix) - { - for (int i = 0; i < suffixlist.size(); i++) - { + for(QString s : meshsuffix) { + for(int i = 0; i < suffixlist.size(); i++) { QString suffix = suffixlist.at(i); - if (suffix.contains(s)) + if(suffix.contains(s)) list.append(suffix); } } std::sort(list.begin(), list.end()); - QString suffixes = list.join(";;"); + QString suffixes = list.join(";;"); QString senderName = sender()->objectName(); - int modelID = -1; - if (senderName.contains("Only INP_")) - { + int modelID = -1; + if(senderName.contains("Only INP_")) { suffixes = list.at(0); - modelID = senderName.right(1).toInt(); + modelID = senderName.right(1).toInt(); } - QString workDir = Setting::BusAPI::instance()->getWorkingDir(); + QString workDir = Setting::BusAPI::instance()->getWorkingDir(); QFileDialog dlg(this, tr("Export Mesh"), workDir, suffixes); dlg.setAcceptMode(QFileDialog::AcceptSave); - if (dlg.exec() != QFileDialog::FileName) + if(dlg.exec() != QFileDialog::FileName) return; - QString aSuffix = dlg.selectedNameFilter(); + QString aSuffix = dlg.selectedNameFilter(); QString aFileName = dlg.selectedFiles().join(","); - if (aFileName.isEmpty()) + if(aFileName.isEmpty()) return; - QString pyCode = QString("MainWindow.exportMesh(\"%1\",\"%2\",%3)").arg(aFileName).arg(aSuffix).arg(modelID); + QString pyCode = QString("MainWindow.exportMesh(\"%1\",\"%2\",%3)") + .arg(aFileName) + .arg(aSuffix) + .arg(modelID); Py::PythonAgent::getInstance()->submit(pyCode); } @@ -690,11 +707,11 @@ namespace GUI // _signalHandler->importMesh(fileName, suffix, modelId); // } - void MainWindow::importMeshDataset(vtkDataSet *dataset) + void MainWindow::importMeshDataset(vtkDataSet* dataset) { - if (dataset == nullptr) + if(dataset == nullptr) return; - MeshData::MeshKernal *k = new MeshData::MeshKernal; + MeshData::MeshKernal* k = new MeshData::MeshKernal; k->setMeshData(dataset); MeshData::MeshData::getInstance()->appendMeshKernal(k); _subWindowManager->openPreWindow(); @@ -705,29 +722,30 @@ namespace GUI void MainWindow::on_importGeometry() { - QString dir = Setting::BusAPI::instance()->getWorkingDir(); - ConfigOption::GeometryConfig *geoconfig = ConfigOption::ConfigOption::getInstance()->getGeometryConfig(); - QString conSuffix = geoconfig->getImportSuffix().toLower(); - QStringList sl = conSuffix.split(";"); + QString dir = Setting::BusAPI::instance()->getWorkingDir(); + ConfigOption::GeometryConfig* geoconfig = + ConfigOption::ConfigOption::getInstance()->getGeometryConfig(); + QString conSuffix = geoconfig->getImportSuffix().toLower(); + QStringList sl = conSuffix.split(";"); conSuffix.clear(); - for (QString s : sl) - { + for(QString s : sl) { conSuffix += " *." + s; } conSuffix = QString("Geometry Files(%1)").arg(conSuffix); - QString regSuffix{}; + QString regSuffix{}; - QString title = tr("Import Geometry"); - QStringList filenames = QFileDialog::getOpenFileNames(this, title, dir, conSuffix + regSuffix /*+ ";;All Files(*.*)"*/); - if (filenames.isEmpty()) + QString title = tr("Import Geometry"); + QStringList filenames = QFileDialog::getOpenFileNames( + this, title, dir, conSuffix + regSuffix /*+ ";;All Files(*.*)"*/); + if(filenames.isEmpty()) return; /* QString files = filenames.join(","); - QString pycode = QString("MainWindow.importGeometry(\"%1\")").arg(files); + QString pycode = + QString("MainWindow.importGeometry(\"%1\")").arg(files); */ QStringList pyCodes; - for (int i = 0; i < filenames.size(); i++) - { + for(int i = 0; i < filenames.size(); i++) { pyCodes.append(QString("MainWindow.importGeometry(\"%1\")").arg(filenames[i])); } Py::PythonAgent::getInstance()->submit(pyCodes); @@ -736,13 +754,13 @@ namespace GUI void MainWindow::importGeometry(QStringList filenames) { _subWindowManager->openPreWindow(); - if (!_signalHandler->importGeometry(filenames)) + if(!_signalHandler->importGeometry(filenames)) return; } void MainWindow::exportGeometry(QString f) { - if (!_signalHandler->exportGeometry(f)) + if(!_signalHandler->exportGeometry(f)) return; Py::PythonAgent::getInstance()->unLock(); } @@ -757,9 +775,7 @@ namespace GUI _signalHandler->generateSurfaceMesh(); } - void MainWindow::on_genMesh() - { - } + void MainWindow::on_genMesh() {} void MainWindow::setWorkingDir() { @@ -774,17 +790,17 @@ namespace GUI void MainWindow::on_solve() { - bool showDlg = true; + bool showDlg = true; MainWidget::ProjcctSolveDialog dlg(this, showDlg); - if (showDlg) + if(showDlg) dlg.exec(); } void MainWindow::solveProject(int id) { - bool showDlg = true; + bool showDlg = true; MainWidget::ProjcctSolveDialog dlg(this, showDlg, id); - if (showDlg) + if(showDlg) dlg.exec(); } @@ -807,30 +823,29 @@ namespace GUI _ui->actionBoxMeshNode->setChecked(false); _ui->actionBoxMeshCell->setChecked(false); - switch (model) - { - case (int)ModuleBase::SelectModel::None: - _ui->actionSelectOff->setChecked(true); - break; - case (int)ModuleBase::SelectModel::MeshNode: - _ui->actionSelectMeshNode->setChecked(true); - break; - case (int)ModuleBase::SelectModel::MeshCell: - _ui->actionSelectMeshCell->setChecked(true); - break; - case (int)ModuleBase::SelectModel::BoxMeshNode: - _ui->actionBoxMeshNode->setChecked(true); - break; - case (int)ModuleBase::SelectModel::BoxMeshCell: - _ui->actionBoxMeshCell->setChecked(true); - break; + switch(model) { + case(int)ModuleBase::SelectModel::None: + _ui->actionSelectOff->setChecked(true); + break; + case(int)ModuleBase::SelectModel::MeshNode: + _ui->actionSelectMeshNode->setChecked(true); + break; + case(int)ModuleBase::SelectModel::MeshCell: + _ui->actionSelectMeshCell->setChecked(true); + break; + case(int)ModuleBase::SelectModel::BoxMeshNode: + _ui->actionBoxMeshNode->setChecked(true); + break; + case(int)ModuleBase::SelectModel::BoxMeshCell: + _ui->actionBoxMeshCell->setChecked(true); + break; - default: - break; + default: + break; } } - SubWindowManager *MainWindow::getSubWindowManager() + SubWindowManager* MainWindow::getSubWindowManager() { return _subWindowManager; } @@ -843,27 +858,23 @@ namespace GUI void MainWindow::on_userManual() { - QString file = ConfigOption::ConfigOption::getInstance()->getGlobalConfig()->GetUserManual(); + QString file = + ConfigOption::ConfigOption::getInstance()->getGlobalConfig()->GetUserManual(); QString userManulFile = QApplication::applicationDirPath() + "/../Doc/" + file; - if (file.isEmpty()) - { + if(file.isEmpty()) { QDesktopServices::openUrl(QUrl("http://www.fastcae.com/index.php?mod=document")); return; } QFile f(userManulFile); - if (!f.exists()) - { + if(!f.exists()) { ModuleBase::Message msg; - msg.type = Common::Message::Warning; + msg.type = Common::Message::Warning; msg.message = tr("Please make sure \" %1 \" file exist!").arg(userManulFile); emit printMessageToMessageWindow(msg); - } - else - { - if (!QDesktopServices::openUrl(QUrl::fromLocalFile(userManulFile))) - { + } else { + if(!QDesktopServices::openUrl(QUrl::fromLocalFile(userManulFile))) { QString mess = QString(tr("%1 not exist !")).arg(file); QMessageBox::warning(this, QString(tr("Warning")), mess); } @@ -876,7 +887,7 @@ namespace GUI bool showEdge = _ui->actionDisplayWireFrame->isChecked(); bool showFace = _ui->actionDisplaySurface->isChecked(); - auto gp = Setting::BusAPI::instance()->getGraphOption(); + auto gp = Setting::BusAPI::instance()->getGraphOption(); gp->isShowMeshNode(showNode); gp->isShowMeshEdge(showEdge); gp->isShowMeshFace(showFace); @@ -892,42 +903,40 @@ namespace GUI _ui->actionSelectCurve->setChecked(false); _ui->actionSelectFace->setChecked(false); _ui->actionSelectGeometryBody->setChecked(false); - switch (m) - { - case (int)ModuleBase::SelectModel::None: - _ui->actionSelectOff->setChecked(true); - break; - case (int)ModuleBase::SelectModel::GeometryPoint: - case (int)ModuleBase::SelectModel::GeometryWinPoint: - _ui->actionSelectPoint->setChecked(true); - break; - case (int)ModuleBase::SelectModel::GeometryCurve: - case (int)ModuleBase::SelectModel::GeometryWinCurve: - _ui->actionSelectCurve->setChecked(true); - break; - case (int)ModuleBase::SelectModel::GeometrySurface: - case (int)ModuleBase::SelectModel::GeometryWinSurface: - _ui->actionSelectFace->setChecked(true); - break; - case (int)ModuleBase::SelectModel::GeometryBody: - case (int)ModuleBase::SelectModel::GeometryWinBody: - _ui->actionSelectGeometryBody->setChecked(true); - break; - ; - default: - break; + switch(m) { + case(int)ModuleBase::SelectModel::None: + _ui->actionSelectOff->setChecked(true); + break; + case(int)ModuleBase::SelectModel::GeometryPoint: + case(int)ModuleBase::SelectModel::GeometryWinPoint: + _ui->actionSelectPoint->setChecked(true); + break; + case(int)ModuleBase::SelectModel::GeometryCurve: + case(int)ModuleBase::SelectModel::GeometryWinCurve: + _ui->actionSelectCurve->setChecked(true); + break; + case(int)ModuleBase::SelectModel::GeometrySurface: + case(int)ModuleBase::SelectModel::GeometryWinSurface: + _ui->actionSelectFace->setChecked(true); + break; + case(int)ModuleBase::SelectModel::GeometryBody: + case(int)ModuleBase::SelectModel::GeometryWinBody: + _ui->actionSelectGeometryBody->setChecked(true); + break; + ; + default: + break; } // emit selectGeoActiveSig(active); } void MainWindow::setGeometryDisplay() { + bool checkvertex = _ui->actionDisplayPoint->isChecked(); + bool checkcurve = _ui->actionDisplayCurve->isChecked(); + bool checkface = _ui->actionDisplayFace->isChecked(); - bool checkvertex = _ui->actionDisplayPoint->isChecked(); - bool checkcurve = _ui->actionDisplayCurve->isChecked(); - bool checkface = _ui->actionDisplayFace->isChecked(); - - Setting::GraphOption *gp = Setting::BusAPI::instance()->getGraphOption(); + Setting::GraphOption* gp = Setting::BusAPI::instance()->getGraphOption(); gp->isShowGeoPoint(checkvertex); gp->isShowGeoEdge(checkcurve); gp->isShowGeoSurface(checkface); @@ -937,23 +946,20 @@ namespace GUI void MainWindow::updateRecentMenu() { - if (_recentMenu == nullptr) - { + if(_recentMenu == nullptr) { _recentMenu = new QMenu(tr("Recent")); _ui->menuFile->addMenu(_recentMenu); } _recentMenu->clear(); - if (_recentFileMapper == nullptr) - { + if(_recentFileMapper == nullptr) { _recentFileMapper = new QSignalMapper; } _recentFileMapper->disconnect(); QStringList rencentFile = Setting::BusAPI::instance()->getRencetFiles(); - for (int i = 0; i < rencentFile.size(); ++i) - { - QString f = rencentFile.at(i); - QAction *action = _recentMenu->addAction(f); + for(int i = 0; i < rencentFile.size(); ++i) { + QString f = rencentFile.at(i); + QAction* action = _recentMenu->addAction(f); action->setStatusTip(f); connect(action, SIGNAL(triggered()), _recentFileMapper, SLOT(map())); _recentFileMapper->setMapping(action, f); @@ -963,11 +969,9 @@ namespace GUI void MainWindow::setActionVisible(QString objname, bool enable) { - QList acs = this->findChildren(); - for (QAction *a : acs) - { - if (a->objectName().toLower() == objname.toLower()) - { + QList acs = this->findChildren(); + for(QAction* a : acs) { + if(a->objectName().toLower() == objname.toLower()) { a->setVisible(enable); break; } @@ -977,25 +981,25 @@ namespace GUI void MainWindow::openRencentFile(QString file) { QFileInfo info(file); - if (!info.exists()) - { + if(!info.exists()) { QMessageBox::warning(this, tr("Warning"), tr("File \"%1\" is not exist !")); return; } QString md5 = _signalHandler->getMD5(); - if (md5 != _MD5) - { + if(md5 != _MD5) { QMessageBox::StandardButton but; - but = QMessageBox::warning(this, tr("Warning"), tr("Do you want to save current data ?"), QMessageBox::Yes | QMessageBox::No); - if (but == QMessageBox::Yes) + but = + QMessageBox::warning(this, tr("Warning"), tr("Do you want to save current data ?"), + QMessageBox::Yes | QMessageBox::No); + if(but == QMessageBox::Yes) on_actionSave(); } _signalHandler->clearData(false); QString dir = Setting::BusAPI::instance()->getWorkingDir(); - bool ok = _signalHandler->openProjectFile(file); - if (!ok) + bool ok = _signalHandler->openProjectFile(file); + if(!ok) return; _subWindowManager->openPreWindow(); _subWindowManager->updatePreActors(); @@ -1006,19 +1010,19 @@ namespace GUI emit updateActionStatesSig(); } - void MainWindow::keyPressEvent(QKeyEvent *e) + void MainWindow::keyPressEvent(QKeyEvent* e) { Q_UNUSED(e) - qDebug() << "press"; + qDebug() << "press"; } - void MainWindow::keyReleaseEvent(QKeyEvent *e) + void MainWindow::keyReleaseEvent(QKeyEvent* e) { Q_UNUSED(e) - qDebug() << "release"; + qDebug() << "release"; } - void MainWindow::showEvent(QShowEvent *e) + void MainWindow::showEvent(QShowEvent* e) { QMainWindow::showEvent(e); _signalHandler->showUserGuidence(true); @@ -1027,43 +1031,39 @@ namespace GUI bool MainWindow::isLoadRecordScripFile() { QFile file(qApp->applicationDirPath() + "/../temp/RecordScript.py"); - if (!file.exists() || file.size() == 0) + if(!file.exists() || file.size() == 0) return false; - QMessageBox::StandardButton result = - QMessageBox::warning(this, tr("Do you need to load?"), - tr("The program quit with an exception before, do you want to reload the contents?"), - QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes); + QMessageBox::StandardButton result = QMessageBox::warning( + this, tr("Do you need to load?"), + tr("The program quit with an exception before, do you want to reload the contents?"), + QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes); - switch (result) - { - case QMessageBox::Yes: - Py::PythonAgent::getInstance()->execScript(file.fileName()); - break; - case QMessageBox::No: - QFile::remove(qApp->applicationDirPath() + "/../temp/RecordScript.py"); - break; - default: - break; + switch(result) { + case QMessageBox::Yes: + Py::PythonAgent::getInstance()->execScript(file.fileName()); + break; + case QMessageBox::No: + QFile::remove(qApp->applicationDirPath() + "/../temp/RecordScript.py"); + break; + default: + break; } return true; } void MainWindow::setSketchPageVisible(bool visible) { - SARibbonBar *ribbon = ribbonBar(); - if (ribbon->ribbonTabBar()->currentIndex() == 0) + SARibbonBar* ribbon = ribbonBar(); + if(ribbon->ribbonTabBar()->currentIndex() == 0) return; // int index = -1; - if (visible) - { + if(visible) { ribbon->showContextCategory(_ui->sketch_tool_context); // index = ribbon->tabIndex(_ui->sketch_tool_page); ribbon->raiseCategory(_ui->sketch_tool_page); - } - else - { + } else { ribbon->hideContextCategory(_ui->sketch_tool_context); // index = ribbon->tabIndex(_ui->geometry_page); ribbon->raiseCategory(_ui->sketch_tool_page); @@ -1076,15 +1076,14 @@ namespace GUI { Setting::BusAPI::instance()->isUseRibbon(ok); bool isRibbon = this->isUseRibbon(); - if (isRibbon == ok) + if(isRibbon == ok) return; QMessageBox mbox(QMessageBox::Information, tr("Info"), tr("Restart to load the style!")); /*QPushButton *button1 = */ mbox.addButton(tr("Restart later"), QMessageBox::RejectRole); - QPushButton *button2 = mbox.addButton(tr("Restart now"), QMessageBox::YesRole); + QPushButton* button2 = mbox.addButton(tr("Restart now"), QMessageBox::YesRole); mbox.exec(); - if (mbox.clickedButton() == button2) - { + if(mbox.clickedButton() == button2) { this->closeEvent(nullptr); qApp->exit(-1000); } @@ -1095,27 +1094,24 @@ namespace GUI _postToolBar = new Post::AnimationToolBar(this, _controlPanel->getPostTreeWidget()); Post::RenderDirector::getInstance()->setAnimationToolBar(_postToolBar); - if (ribbon) - { + if(ribbon) { _postToolBar->setVisible(false); auto rBar = this->ribbonBar(); - if (rBar == nullptr) + if(rBar == nullptr) return; auto category = rBar->categoryByName(tr("3DRender")); - if (category == nullptr) + if(category == nullptr) return; - auto pannel = category->addPannel(QString()); + auto pannel = category->addPannel(QString()); auto actList = _postToolBar->actions(); - for (auto action : actList) - { + for(auto action : actList) { action->setEnabled(false); - if (action->objectName() == "QWidget") - { + if(action->objectName() == "QWidget") { auto widget = _postToolBar->widgetForAction(action); - if (widget == nullptr) + if(widget == nullptr) continue; widget->setVisible(true); pannel->addLargeWidget(widget); @@ -1123,9 +1119,7 @@ namespace GUI } pannel->addLargeAction(action); } - } - else - { + } else { _postToolBar->setVisible(true); this->addToolBar(_postToolBar); } @@ -1165,34 +1159,35 @@ namespace GUI void MainWindow::printMessage(Common::Message type, QString m) { ModuleBase::Message s(type, m); - emit printMessageToMessageWindow(s); + emit printMessageToMessageWindow(s); } void MainWindow::on_SaveScript() { - QString dir = Setting::BusAPI::instance()->getWorkingDir(); - QString suffix = "Python(*.py)"; - QString title = tr("Save Script"); + QString dir = Setting::BusAPI::instance()->getWorkingDir(); + QString suffix = "Python(*.py)"; + QString title = tr("Save Script"); QString filenames = QFileDialog::getSaveFileName(this, title, dir, suffix); - if (filenames.isEmpty()) + if(filenames.isEmpty()) return; Py::PythonAgent::getInstance()->saveScript(filenames); } void MainWindow::on_ExecuateScript() { - QString fillter = "Python(*.py)"; - QString title = tr("Execute Script"); - QString dir = Setting::BusAPI::instance()->getWorkingDir(); + QString fillter = "Python(*.py)"; + QString title = tr("Execute Script"); + QString dir = Setting::BusAPI::instance()->getWorkingDir(); QString filePath = QFileDialog::getOpenFileName(this, title, dir, fillter); - if (filePath.isEmpty()) + if(filePath.isEmpty()) return; bool ok = Py::PythonAgent::getInstance()->execScript(filePath); - if (!ok) - QMessageBox::warning(this, tr("Warning"), QString(tr("%1 execute failed !")).arg(filePath)); + if(!ok) + QMessageBox::warning(this, tr("Warning"), + QString(tr("%1 execute failed !")).arg(filePath)); } - MainWidget::ControlPanel *MainWindow::getControlPanel() + MainWidget::ControlPanel* MainWindow::getControlPanel() { return _controlPanel; } @@ -1200,16 +1195,14 @@ namespace GUI void MainWindow::on_sketchClicked() { bool ischecked = _ui->actionCreate_Sketch->isChecked(); - if (ischecked) - { - if (!_subWindowManager->isPreWindowOpened()) + if(ischecked) { + if(!_subWindowManager->isPreWindowOpened()) _subWindowManager->openPreWindow(); - auto dlg = new GeometryWidget::SketchPlanDialog(this, _subWindowManager->getPreWindow()); + auto dlg = + new GeometryWidget::SketchPlanDialog(this, _subWindowManager->getPreWindow()); dlg->show(); - } - else - { + } else { // auto p = _subWindowManager->getPreWindow(); emit startSketchSig(false, nullptr, nullptr); } @@ -1218,10 +1211,9 @@ namespace GUI void MainWindow::startSketch(bool s) { _ui->actionCreate_Sketch->setChecked(s); - if (isUseRibbon()) + if(isUseRibbon()) setSketchPageVisible(s); - else - { + else { _ui->GeomertryFeatureToolBar->setVisible(!s); _ui->ChamferToolBar->setVisible(!s); _ui->BoolToolBar->setVisible(!s); @@ -1244,8 +1236,7 @@ namespace GUI void MainWindow::showGraphRange(double w, double h) { - if (_graphRange == nullptr) - { + if(_graphRange == nullptr) { _graphRange = new QLabel(this); _ui->statusbar->addPermanentWidget(_graphRange); } @@ -1258,17 +1249,17 @@ namespace GUI // _signalHandler->updateActionsStates(); // } - CustomizerHelper *MainWindow::getCustomizerHelper() + CustomizerHelper* MainWindow::getCustomizerHelper() { return _customizerHelper; } - SignalHandler *MainWindow::getSignalHandler() + SignalHandler* MainWindow::getSignalHandler() { return _signalHandler; } - MainWidget::MessageWindow *MainWindow::getMessageWindow() + MainWidget::MessageWindow* MainWindow::getMessageWindow() { return _messageWindow; } @@ -1279,66 +1270,59 @@ namespace GUI _subWindowManager->setIcon(iconPath); } - QAction *MainWindow::getAction(QString &objName) + QAction* MainWindow::getAction(QString& objName) { - QList acs = this->findChildren(); - for (QAction *a : acs) - { - if (a->objectName().toLower() == objName.toLower()) + QList acs = this->findChildren(); + for(QAction* a : acs) { + if(a->objectName().toLower() == objName.toLower()) return a; } return nullptr; } - QToolBar *MainWindow::getToolBar(QString &objName) + QToolBar* MainWindow::getToolBar(QString& objName) { - QList tbs = this->findChildren(); - for (auto a : tbs) - { - if (a->objectName().toLower() == objName.toLower()) + QList tbs = this->findChildren(); + for(auto a : tbs) { + if(a->objectName().toLower() == objName.toLower()) return a; } return nullptr; } - QMenu *MainWindow::getMenu(QString &objName) + QMenu* MainWindow::getMenu(QString& objName) { - QList mes = this->findChildren(); - for (auto a : mes) - { - if (a->objectName().toLower() == objName.toLower()) + QList mes = this->findChildren(); + for(auto a : mes) { + if(a->objectName().toLower() == objName.toLower()) return a; } return nullptr; } - QPair> MainWindow::createWidgetAndAction(const QString &title, const QStringList &actionStrs) + QPair> + MainWindow::createWidgetAndAction(const QString& title, const QStringList& actionStrs) { - QAction *action{}; - QList actions; - QPair> value; + QAction* action{}; + QList actions; + QPair> value; - if (isUseRibbon()) - { - SARibbonCategory *page = ribbonBar()->addCategoryPage(title); + if(isUseRibbon()) { + SARibbonCategory* page = ribbonBar()->addCategoryPage(title); // 给定制的panel添加名称 - SARibbonPannel *pannel = page->addPannel(QObject::tr("Customization")); + SARibbonPannel* pannel = page->addPannel(QObject::tr("Customization")); pannel->setCanCustomize(false); // 不能编辑 - for (QString actionStr : actionStrs) - { + for(QString actionStr : actionStrs) { action = new QAction(actionStr, this); action->setObjectName(actionStr); actions.append(action); pannel->addLargeAction(action); } value.first = page; - } - else - { - QMenu *menu = new QMenu(title); - for (QString actionStr : actionStrs) - { + } else { + QMenu* menu = new QMenu(title); + for(QString actionStr : actionStrs) { action = new QAction(actionStr, this); action->setObjectName(actionStr); actions.append(action); @@ -1350,14 +1334,14 @@ namespace GUI return value; } - Post::AnimationToolBar *MainWindow::getAnimationToolBar() + Post::AnimationToolBar* MainWindow::getAnimationToolBar() { return _postToolBar; } - SARibbonActionsManager *MainWindow::getActionManager() + SARibbonActionsManager* MainWindow::getActionManager() { return m_ribbonActionMgr; } -} // end of namespace +} // namespace GUI diff --git a/src/mainWindow/mainWindow.h b/src/MainWindow/MainWindow.h similarity index 60% rename from src/mainWindow/mainWindow.h rename to src/MainWindow/MainWindow.h index c3b4686..66093f3 100644 --- a/src/mainWindow/mainWindow.h +++ b/src/MainWindow/MainWindow.h @@ -23,14 +23,15 @@ #ifndef _MAINWINDOW_H_ #define _MAINWINDOW_H_ -#include "mainWindowAPI.h" -#include +#include "Common/Types.h" +#include "MainWindowAPI.h" +#include "ModuleBase/messageWindowBase.h" +#include "SARibbonBar/SARibbonMainWindow.h" + #include +#include #include #include -#include "ModuleBase/messageWindowBase.h" -#include "Common/Types.h" -#include "SARibbonBar/SARibbonMainWindow.h" // ribbon customize #include "SARibbonBar/SARibbonActionsManager.h" #include "SARibbonBar/SARibbonCustomizeWidget.h" @@ -49,50 +50,42 @@ class SARibbonCategory; // ribbon customize class SARibbonActionsManager; -namespace Ui -{ +namespace Ui { class MainWindow; class MainWindowRibbon; -} +} // namespace Ui -namespace DataProperty -{ +namespace DataProperty { class DataBase; } -namespace MeshData -{ +namespace MeshData { class MeshSet; class MeshKernal; -} +} // namespace MeshData -namespace Geometry -{ +namespace Geometry { class GeometrySet; class GeoComponent; -} +} // namespace Geometry -namespace MainWidget -{ +namespace MainWidget { class ControlPanel; class MessageWindow; class ProcessWindow; class PreWindow; -} +} // namespace MainWidget -namespace Post -{ +namespace Post { class PostWindowBase; class RealTimeWindowBase; class AnimationToolBar; -} +} // namespace Post -namespace XReport -{ +namespace XReport { class ReportWindow; } -namespace GUI -{ +namespace GUI { class SubWindowManager; class SignalHandler; class Translator; @@ -102,8 +95,7 @@ namespace GUI * @note 该类继承自SARibbonMainWindow,具体请参考https://gitee.com/czyt1988/SARibbon * @since 2.5.0 */ - class MAINWINDOWAPI MainWindow : public SARibbonMainWindow - { + class MAINWINDOWAPI MainWindow : public SARibbonMainWindow { Q_OBJECT friend CustomizerHelper; friend SignalHandler; @@ -125,40 +117,41 @@ namespace GUI * @return Ui::MainWindowRibbon* 返回Ui * @since 2.5.0 */ - Ui::MainWindowRibbon *getUi(); - //获取翻译 - Translator *GetTranslator(); - QString getMD5(); - void setMD5(const QString &md5); - //设置当前文件 - void setCurrentFile(const QString &file); - //清空关闭所有窗口 - void clearWidgets(); - SubWindowManager *getSubWindowManager(); - CustomizerHelper *getCustomizerHelper(); - SignalHandler *getSignalHandler(); - //获取控制面板 - MainWidget::ControlPanel *getControlPanel(); - //获取控制台 - MainWidget::MessageWindow *getMessageWindow(); - //更新recentMenu - void updateRecentMenu(); + Ui::MainWindowRibbon* getUi(); + // 获取翻译 + Translator* GetTranslator(); + QString getMD5(); + void setMD5(const QString& md5); + // 设置当前文件 + void setCurrentFile(const QString& file); + // 清空关闭所有窗口 + void clearWidgets(); + SubWindowManager* getSubWindowManager(); + CustomizerHelper* getCustomizerHelper(); + SignalHandler* getSignalHandler(); + // 获取控制面板 + MainWidget::ControlPanel* getControlPanel(); + // 获取控制台 + MainWidget::MessageWindow* getMessageWindow(); + // 更新recentMenu + void updateRecentMenu(); // action状态控制 - void setActionVisible(QString objname, bool enable); - //设置图标 - void setIcon(QString iconPath); - //根据object name 获取action - QAction *getAction(QString &objName); - //根据object name 获取toolbar - QToolBar *getToolBar(QString &objName); - //根据object name 获取menu - QMenu *getMenu(QString &objName); - QPair> createWidgetAndAction(const QString &title, const QStringList &actionStrs); + void setActionVisible(QString objname, bool enable); + // 设置图标 + void setIcon(QString iconPath); + // 根据object name 获取action + QAction* getAction(QString& objName); + // 根据object name 获取toolbar + QToolBar* getToolBar(QString& objName); + // 根据object name 获取menu + QMenu* getMenu(QString& objName); + QPair> createWidgetAndAction(const QString& title, + const QStringList& actionStrs); - Post::AnimationToolBar *getAnimationToolBar(); + Post::AnimationToolBar* getAnimationToolBar(); // Ribbon Customize - SARibbonActionsManager *getActionManager(); + SARibbonActionsManager* getActionManager(); signals: /*更新注册接口*/ @@ -168,10 +161,10 @@ namespace GUI /*显示装状态栏绘图范围*/ void showGraphRangeSig(double, double); /*模型树点击事件 鼠标信号,eventType 0- 左键单机,1-右键单击,2- 左键双击 */ - void treeMouseEvent(int eventType, QTreeWidgetItem *item, int projectID); + void treeMouseEvent(int eventType, QTreeWidgetItem* item, int projectID); /*更新模型树信号 */ void updatePhysicsTreeSignal(); - //更新材料信号 + // 更新材料信号 void updateMaterialTreeSig(); /*打印输出信息 */ void printMessageToMessageWindow(QString message); @@ -188,15 +181,15 @@ namespace GUI /*暂停求解 */ void pauseSolve(); /*终止求解 */ - void stopSolve(QWidget *w); + void stopSolve(QWidget* w); /*添加进度条 */ - void addProcessBarSig(QWidget *w); - //求解进程结束 + void addProcessBarSig(QWidget* w); + // 求解进程结束 void processFinished(int pid); /****几何相关信号**** */ - void startSketchSig(bool start, double *loc, double *dir); - //清除所有高亮 + void startSketchSig(bool start, double* loc, double* dir); + // 清除所有高亮 void clearAllHighLight(); /*刷新几何树 */ void importGeometrySig(QStringList f); @@ -204,92 +197,93 @@ namespace GUI void updateGeometryTreeSig(); void updateGeoDispalyStateSig(int index, bool display); void removeGeometryActorSig(int index); - void highLightGeometrySetSig(Geometry::GeometrySet *s, bool on); + void highLightGeometrySetSig(Geometry::GeometrySet* s, bool on); /****网格相关信号***** */ void importMeshByNamesSig(QString name); - void importMeshDataSetSig(vtkDataSet *dataset); + void importMeshDataSetSig(vtkDataSet* dataset); // void exportMeshByIDSig(QString fileName, QString suffix, int kID); void editMeshSig(int dim, int kindex); void updateMeshTreeSig(); void updateSetTreeSig(); void updateMeshDispalyStateSig(int index, bool display); - void updateMeshSetVisibleSig(MeshData::MeshSet *); + void updateMeshSetVisibleSig(MeshData::MeshSet*); void removeMeshActorSig(int index); void removeSetDataSig(int index); - void highLightSetSig(MeshData::MeshSet *set); - void highLightGeoComponentSig(Geometry::GeoComponent *); - void highLightKernelSig(MeshData::MeshKernal *k); - void highLightDataSetSig(vtkDataSet *dataset); + void highLightSetSig(MeshData::MeshSet* set); + void highLightGeoComponentSig(Geometry::GeoComponent*); + void highLightKernelSig(MeshData::MeshKernal* k); + void highLightDataSetSig(vtkDataSet* dataset); void updateMeshSetColorSig(int setID); - //清空数据 + // 清空数据 void clearDataSig(); - ///更新前处理窗口所有几何网格Actor + /// 更新前处理窗口所有几何网格Actor // void updatePreActors(); /*创建物理模型 */ void createPhysiceModelSig(); /*更新属性框 */ - void updateProperty(DataProperty::DataBase *data); - //更新参数窗口 - void updateParaWidget(QWidget *w); - ///关闭前处理窗口 + void updateProperty(DataProperty::DataBase* data); + // 更新参数窗口 + void updateParaWidget(QWidget* w); + /// 关闭前处理窗口 void closePreWindowSig(); - ///打开后处理窗口 - void openPostWindowSig(Post::PostWindowBase *pw); - ///打开实时曲线窗口, - void openRealTimeWindowSig(Post::RealTimeWindowBase *w, int proID); - ///展示后处理窗口 + /// 打开后处理窗口 + void openPostWindowSig(Post::PostWindowBase* pw); + /// 打开实时曲线窗口, + void openRealTimeWindowSig(Post::RealTimeWindowBase* w, int proID); + /// 展示后处理窗口 void showPostWindowInfoSig(int id, int type); - ///关闭后处理窗口 - void closePostWindowSig(Post::PostWindowBase *w); - ///关闭实时曲线窗口 - void closeRealTimeWindowSig(Post::RealTimeWindowBase *w); - ///更新实时曲线窗口 + /// 关闭后处理窗口 + void closePostWindowSig(Post::PostWindowBase* w); + /// 关闭实时曲线窗口 + void closeRealTimeWindowSig(Post::RealTimeWindowBase* w); + /// 更新实时曲线窗口 void updateRealTimePlotSig(QString fileName); - ///切换选择模式 + /// 切换选择模式 void selectModelChangedSig(int i); - ///切换网格显示模式 + /// 切换网格显示模式 void meshDisplayModeChangedSig(); - ///切换几何显示模型 + /// 切换几何显示模型 // void displayGeometryChangedSig(QString mode); - ///求解项目 + /// 求解项目 void solveProjectSig(int proIndex, int solverIndex); - //添加新生成网格 - void appendGeneratedMesh(QString name, vtkDataSet *dataset); - //显示报告窗口 - void openReportWindowSig(XReport::ReportWindow *w); - //关闭报告窗口 - void closeReportWindowSig(XReport::ReportWindow *w); - ///设置键盘事件 + // 添加新生成网格 + void appendGeneratedMesh(QString name, vtkDataSet* dataset); + // 显示报告窗口 + void openReportWindowSig(XReport::ReportWindow* w); + // 关闭报告窗口 + void closeReportWindowSig(XReport::ReportWindow* w); + /// 设置键盘事件 void enableGraphWindowKeyBoard(bool on); - ///更新Action状态 + /// 更新Action状态 // void updateActionStatesSig(); void updatePreMeshActorSig(); - void updatePreGeometryActorSig(); //徐文强2020/6/4添加 - ///根据绘图设置更新绘图 + void updatePreGeometryActorSig(); // 徐文强2020/6/4添加 + /// 根据绘图设置更新绘图 void updateGraphOptionsSig(); - //保存图片 winType 0- 前处理窗口 1-后处理 Wintype为前处理时winhandle可任意 - void saveImageSig(QString fileName, int winType, Post::PostWindowBase *winhandle, int w, int h); + // 保存图片 winType 0- 前处理窗口 1-后处理 Wintype为前处理时winhandle可任意 + void saveImageSig(QString fileName, int winType, Post::PostWindowBase* winhandle, int w, + int h); // //面网格划分 // void surfaceMeshSig(Geometry::GeometrySet*); // //体网格划分 // void solidMeshSig(Geometry::GeometrySet*); - //保存图片 + // 保存图片 void saveImage(int w, int h, QString file); - //清除高亮 + // 清除高亮 void clearHighLightSig(); - //前处理窗口打开 - void preWindowOpenedSig(MainWidget::PreWindow *p); - //固定位置显示对话框 - void showDialogSig(QDialog *); - //记录几何显示控件状态 + // 前处理窗口打开 + void preWindowOpenedSig(MainWidget::PreWindow* p); + // 固定位置显示对话框 + void showDialogSig(QDialog*); + // 记录几何显示控件状态 void selectGeometryDisplay(bool, bool, bool); - //在几何上选取点、线、面。 + // 在几何上选取点、线、面。 void selectGeometryModelChangedSig(int); - //更新工具栏状态 + // 更新工具栏状态 void updateActionStatesSig(); - //关闭主窗口 + // 关闭主窗口 void closeMainWindow(); /** @@ -298,23 +292,23 @@ namespace GUI void updatePostTreeSig(); // - //更新二维曲线模型树 + // 更新二维曲线模型树 void updatePlotTreeSig(); // - //打开二维曲线绘制信号 + // 打开二维曲线绘制信号 void openPlot(); public slots: /*状态栏显示信息 */ void setStatusBarInfo(QString); - ///切换语言 + /// 切换语言 void ChangeLanguage(QString lang); - ///切换选择模式,改变工具栏选中状态 + /// 切换选择模式,改变工具栏选中状态 void selectModelChanged(int model); - //切换网格显示模式 + // 切换网格显示模式 void setMeshDisplay(); - //切换几何显示模式 + // 切换几何显示模式 void selectGeometryModelChanged(int m); void setGeometryDisplay(); // /// _post3DWindow{}; @@ -456,61 +450,61 @@ namespace GUI * @brief 最近文件 * @since 2.5.0 */ - QString _currentFile{}; + QString _currentFile{}; - QString _MD5{}; + QString _MD5{}; /** * @brief 控制面板窗口 * @since 2.5.0 */ - MainWidget::ControlPanel *_controlPanel{}; + MainWidget::ControlPanel* _controlPanel{}; /** * @brief 进程窗口 * @since 2.5.0 */ - MainWidget::ProcessWindow *_processWindow{}; + MainWidget::ProcessWindow* _processWindow{}; /** * @brief 消息窗口(控制台) * @since 2.5.0 */ - MainWidget::MessageWindow *_messageWindow{}; + MainWidget::MessageWindow* _messageWindow{}; /** * @brief 视角设置菜单的信号映射 * @since 2.5.0 */ - QSignalMapper *_viewSignalMapper{}; + QSignalMapper* _viewSignalMapper{}; /** * @brief 网格选择模式菜单的信号映射 * @since 2.5.0 */ - QSignalMapper *_selectSignalMapper{}; + QSignalMapper* _selectSignalMapper{}; // QSignalMapper* _displayModeSignalMapper{}; /** * @brief 几何选择模式菜单的信号映射 * @since 2.5.0 */ - QSignalMapper *_selectGeometryModeMapper{}; + QSignalMapper* _selectGeometryModeMapper{}; /** * @brief 最近文件菜单 * @since 2.5.0 */ - QMenu *_recentMenu{}; + QMenu* _recentMenu{}; /** * @brief 最近打开文件的菜单信号映射 * @since 2.5.0 */ - QSignalMapper *_recentFileMapper{}; + QSignalMapper* _recentFileMapper{}; /** * @brief 主窗口右下角显示画布大小的标签 * @since 2.5.0 */ - QLabel *_graphRange{}; + QLabel* _graphRange{}; ///< MG tool manger // MainWidget::ControlPanel* _controlPanel{}; // MainWidget::ProcessWindow* _processWindow{}; // MainWidget::MessageWindow* _messageWindow{}; - Post::AnimationToolBar *_postToolBar{}; + Post::AnimationToolBar* _postToolBar{}; // // QSignalMapper* _viewSignalMapper{}; // QSignalMapper* _selectSignalMapper{}; @@ -530,7 +524,7 @@ namespace GUI // /// _externalActions{}; // ribbon customize - SARibbonActionsManager *m_ribbonActionMgr{}; + SARibbonActionsManager* m_ribbonActionMgr{}; }; -} +} // namespace GUI #endif diff --git a/src/mainWindow/mainWindow.ui b/src/MainWindow/MainWindow.ui similarity index 100% rename from src/mainWindow/mainWindow.ui rename to src/MainWindow/MainWindow.ui diff --git a/src/mainWindow/mainWindowAPI.h b/src/MainWindow/MainWindowAPI.h similarity index 100% rename from src/mainWindow/mainWindowAPI.h rename to src/MainWindow/MainWindowAPI.h diff --git a/src/MainWindow/MainWindowPy.cpp b/src/MainWindow/MainWindowPy.cpp new file mode 100644 index 0000000..81b4672 --- /dev/null +++ b/src/MainWindow/MainWindowPy.cpp @@ -0,0 +1,2351 @@ +#include "MainWindowPy.h" + +#include "Geometry/GeoComponent.h" +#include "Geometry/geometryData.h" +#include "GeometryCommand/GeoCommandCreateComponent.h" +#include "GeometryCommand/GeoCommandList.h" +#include "GeometryCommand/GeoCommandRemove.h" +#include "IO/vtkDataRelated.h" +#include "MainWidgets/preWindow.h" +#include "MainWindow.h" +#include "MeshData/meshKernal.h" +#include "MeshData/meshSet.h" +#include "MeshData/meshSingleton.h" +#include "PostWidgets/Post3DInterface.h" +#include "PostWidgets/Post3DWidget.h" +#include "PythonModule/PyAgent.h" +#include "SignalHandler.h" +#include "SubWindowManager.h" +#include "vtkDataSet.h" + +#include +#include +#include +#include +#include +namespace GUI { + + MainWindow* MainWindowPy::_mainWindow = nullptr; + SignalHandler* MainWindowPy::_signalHander = nullptr; + SubWindowManager* MainWindowPy::_subWindowManager = nullptr; + Py::PythonAgent* MainWindowPy::_pyAgent = nullptr; + + /*void MainWindowPy::showFastCAE() + { + + }*/ + + void MainWindowPy::undo() + { + Command::GeoComandList::getInstance()->undo(); + _pyAgent->unLock(); + } + + void MainWindowPy::redo() + { + Command::GeoComandList::getInstance()->redo(); + _pyAgent->unLock(); + } + + void MainWindowPy::init(GUI::MainWindow* m, GUI::SignalHandler* sg) + { + _mainWindow = m; + _signalHander = sg; + _subWindowManager = _mainWindow->getSubWindowManager(); + _pyAgent = Py::PythonAgent::getInstance(); + } + + void MainWindowPy::clearData() + { + emit _mainWindow->clearDataSig(); + } + + void MainWindowPy::importMesh(char* f, char* s, int modelId) + { + QString file(f); + QString suffix(s); + emit _signalHander->importMeshPySig(file, suffix, modelId); + //_signalHander->importMesh(file, suffix, modelId); + //_pyAgent->unLock(); + } + + void MainWindowPy::exportMesh(char* f, char* s, int modelId) + { + QString file(f); + QString suffix(s); + emit _signalHander->exportMeshPySig(file, s, modelId); + } + + void MainWindowPy::importGeometry(char* f) + { + QString file(f); + QStringList fl = file.split(","); + emit _mainWindow->importGeometrySig(fl); + //_pyAgent->unLock(); + } + + void MainWindowPy::exportGeometry(char* f) + { + QString file(f); + emit _mainWindow->exportGeometrySig(file); + //_pyAgent->unLock(); + } + + void MainWindowPy::openProjectFile(char* f) + { + QString file(f); + + emit _signalHander->openProjectFileSig(file); + //_pyAgent->unLock(); + } + + void MainWindowPy::saveProjectFile(char* f) + { + QString file(f); + emit _signalHander->saveToProjectFileSig(file); + //_pyAgent->unLock(); + } + void MainWindowPy::openPost2D() + { + emit _signalHander->open2DPlotWindowPySig(); + //_pyAgent->unLock(); + } + void MainWindowPy::openPost3D() + { + emit _signalHander->open3DGraphWindowPySig(); + } + void MainWindowPy::openPreWindow() + { + emit _subWindowManager->openPreWindowSig(); + } + + void MainWindowPy::saveImage(int w, int h, int id, char* win, char* file) + { + QString wi(win); + QString f(file); + emit _subWindowManager->saveImageSig(w, h, id, wi, f); + //_pyAgent->unLock(); + } + + void MainWindowPy::setView(int id, char* win, char* view) + { + QString wi(win); + QString vi(view); + emit _subWindowManager->setViewSig(id, wi, vi); + // _pyAgent->unLock(); + } + + void MainWindowPy::setViewRandValue(int id, char* win, int x1, int x2, int x3, int y1, int y2, + int y3, int z1, int z2, int z3) + { + QString wi(win); + emit _subWindowManager->setViewValueSig(id, wi, x1, x2, x3, y1, y2, y3, z1, z2, z3); + //_pyAgent->unLock(); + } + void MainWindowPy::quit() + { + _subWindowManager->closeAllSubWindow(); + _signalHander->clearData(false); + _mainWindow->close(); + } + + void MainWindowPy::solveProject(int projectIndex, int solverIndex) + { + emit _signalHander->solveProjectSig(projectIndex, solverIndex); + //_pyAgent->lock(); + } + + void MainWindowPy::script_openFile(int id, char* type, char* file) + { + QString stype(type); + QString sfile(file); + qDebug() << "sfile" << sfile; + ModuleBase::GraphWindowBase* gb = _subWindowManager->getWindowByTypeID(stype, id); + if(gb == nullptr) + return; + Post::Post3DWindowInterface* p3d = dynamic_cast(gb); + if(p3d == nullptr) + return; + Post::Post3DWindow* w = p3d->getWindow(); + if(w == nullptr) + return; + // w->openFile(sfile); + emit w->openFileSig(sfile, false); + } + + void MainWindowPy::script_applyClicked(int id, char* type) + { + QString stype(type); + ModuleBase::GraphWindowBase* gb = _subWindowManager->getWindowByTypeID(stype, id); + if(gb == nullptr) + return; + Post::Post3DWindowInterface* p3d = dynamic_cast(gb); + if(p3d == nullptr) + return; + Post::Post3DWindow* w = p3d->getWindow(); + if(w == nullptr) + return; + emit w->applyClickSig(); + } + + void MainWindowPy::script_Properties_Opacity(int id, char* type, int obj_id, double mOpacity) + { + QString stype(type); + ModuleBase::GraphWindowBase* gb = _subWindowManager->getWindowByTypeID(stype, id); + if(gb == nullptr) + return; + Post::Post3DWindowInterface* p3d = dynamic_cast(gb); + if(p3d == nullptr) + return; + Post::Post3DWindow* w = p3d->getWindow(); + if(w == nullptr) + return; + emit w->Properties_OpacitySig(obj_id, mOpacity); + } + + void MainWindowPy::script_Properties_colorColumn(int id, char* type, int obj_id, + char* mColorColumnStyle) + { + QString stype(type); + ModuleBase::GraphWindowBase* gb = _subWindowManager->getWindowByTypeID(stype, id); + if(gb == nullptr) + return; + Post::Post3DWindowInterface* p3d = dynamic_cast(gb); + if(p3d == nullptr) + return; + Post::Post3DWindow* w = p3d->getWindow(); + if(w == nullptr) + return; + emit w->Properties_colorColumnSig(obj_id, mColorColumnStyle); + } + + void MainWindowPy::script_Properties_scalarBarTitle(int id, char* type, int obj_id, + char* colName, char* m_title) + { + QString stype(type); + QString scolName(colName); + QString sm_title(m_title); + ModuleBase::GraphWindowBase* gb = _subWindowManager->getWindowByTypeID(stype, id); + if(gb == nullptr) + return; + Post::Post3DWindowInterface* p3d = dynamic_cast(gb); + if(p3d == nullptr) + return; + Post::Post3DWindow* w = p3d->getWindow(); + if(w == nullptr) + return; + emit w->Properties_scalarBarTitleSig(obj_id, scolName, sm_title); + } + void MainWindowPy::script_Properties_scalarBarFontSize(int id, char* type, int obj_id, + char* colName, int m_fontSize) + { + QString stype(type); + QString scolName(colName); + ModuleBase::GraphWindowBase* gb = _subWindowManager->getWindowByTypeID(stype, id); + if(gb == nullptr) + return; + Post::Post3DWindowInterface* p3d = dynamic_cast(gb); + if(p3d == nullptr) + return; + Post::Post3DWindow* w = p3d->getWindow(); + if(w == nullptr) + return; + emit w->Properties_scalarBarFontSizeSig(obj_id, scolName, m_fontSize); + } + + void MainWindowPy::script_Properties_scalarBarNumLables(int id, char* type, int obj_id, + char* colName, int m_numLables) + { + QString stype(type); + QString scolName(colName); + ModuleBase::GraphWindowBase* gb = _subWindowManager->getWindowByTypeID(stype, id); + if(gb == nullptr) + return; + Post::Post3DWindowInterface* p3d = dynamic_cast(gb); + if(p3d == nullptr) + return; + Post::Post3DWindow* w = p3d->getWindow(); + if(w == nullptr) + return; + emit w->Properties_scalarBarNumLablesSig(obj_id, scolName, m_numLables); + } + + void MainWindowPy::script_Properties_lineWidth(int id, char* type, int obj_id, int mLineWidth) + { + QString stype(type); + ModuleBase::GraphWindowBase* gb = _subWindowManager->getWindowByTypeID(stype, id); + if(gb == nullptr) + return; + Post::Post3DWindowInterface* p3d = dynamic_cast(gb); + if(p3d == nullptr) + return; + Post::Post3DWindow* w = p3d->getWindow(); + if(w == nullptr) + return; + emit w->Properties_lineWidthSig(obj_id, mLineWidth); + } + + void MainWindowPy::script_Properties_pointSize(int id, char* type, int obj_id, int mPointSize) + { + QString stype(type); + ModuleBase::GraphWindowBase* gb = _subWindowManager->getWindowByTypeID(stype, id); + if(gb == nullptr) + return; + Post::Post3DWindowInterface* p3d = dynamic_cast(gb); + if(p3d == nullptr) + return; + Post::Post3DWindow* w = p3d->getWindow(); + if(w == nullptr) + return; + emit w->Properties_pointSizeSig(obj_id, mPointSize); + } + + void MainWindowPy::script_Properties_translate(int id, char* type, int obj_id, double x, + double y, double z) + { + QString stype(type); + ModuleBase::GraphWindowBase* gb = _subWindowManager->getWindowByTypeID(stype, id); + if(gb == nullptr) + return; + Post::Post3DWindowInterface* p3d = dynamic_cast(gb); + if(p3d == nullptr) + return; + Post::Post3DWindow* w = p3d->getWindow(); + if(w == nullptr) + return; + emit w->Properties_translateSig(obj_id, x, y, z); + } + + void MainWindowPy::script_Properties_origin(int id, char* type, int obj_id, double x, double y, + double z) + { + QString stype(type); + ModuleBase::GraphWindowBase* gb = _subWindowManager->getWindowByTypeID(stype, id); + if(gb == nullptr) + return; + Post::Post3DWindowInterface* p3d = dynamic_cast(gb); + if(p3d == nullptr) + return; + Post::Post3DWindow* w = p3d->getWindow(); + if(w == nullptr) + return; + emit w->Properties_originSig(obj_id, x, y, z); + } + + void MainWindowPy::script_Properties_scale(int id, char* type, int obj_id, double x, double y, + double z) + { + QString stype(type); + ModuleBase::GraphWindowBase* gb = _subWindowManager->getWindowByTypeID(stype, id); + if(gb == nullptr) + return; + Post::Post3DWindowInterface* p3d = dynamic_cast(gb); + if(p3d == nullptr) + return; + Post::Post3DWindow* w = p3d->getWindow(); + if(w == nullptr) + return; + emit w->Properties_scaleSig(obj_id, x, y, z); + } + + void MainWindowPy::script_Properties_orientation(int id, char* type, int obj_id, double x, + double y, double z) + { + QString stype(type); + ModuleBase::GraphWindowBase* gb = _subWindowManager->getWindowByTypeID(stype, id); + if(gb == nullptr) + return; + Post::Post3DWindowInterface* p3d = dynamic_cast(gb); + if(p3d == nullptr) + return; + Post::Post3DWindow* w = p3d->getWindow(); + if(w == nullptr) + return; + emit w->Properties_orientationSig(obj_id, x, y, z); + } + + void MainWindowPy::script_Properties_representation(int id, char* type, int obj_id, + int m_enum_representationtype) + { + QString stype(type); + ModuleBase::GraphWindowBase* gb = _subWindowManager->getWindowByTypeID(stype, id); + if(gb == nullptr) + return; + Post::Post3DWindowInterface* p3d = dynamic_cast(gb); + if(p3d == nullptr) + return; + Post::Post3DWindow* w = p3d->getWindow(); + if(w == nullptr) + return; + emit w->Properties_representationSig(obj_id, m_enum_representationtype); + } + + void MainWindowPy::script_Properties_specular(int id, char* type, int obj_id, double mSpecular) + { + QString stype(type); + ModuleBase::GraphWindowBase* gb = _subWindowManager->getWindowByTypeID(stype, id); + if(gb == nullptr) + return; + Post::Post3DWindowInterface* p3d = dynamic_cast(gb); + if(p3d == nullptr) + return; + Post::Post3DWindow* w = p3d->getWindow(); + if(w == nullptr) + return; + emit w->Properties_specularSig(obj_id, mSpecular); + } + /////////////////// + void MainWindowPy::script_Properties_diffuse(int id, char* type, int obj_id, double mDiffuse) + { + QString stype(type); + ModuleBase::GraphWindowBase* gb = _subWindowManager->getWindowByTypeID(stype, id); + if(gb == nullptr) + return; + Post::Post3DWindowInterface* p3d = dynamic_cast(gb); + if(p3d == nullptr) + return; + Post::Post3DWindow* w = p3d->getWindow(); + if(w == nullptr) + return; + emit w->Properties_diffuseSig(obj_id, mDiffuse); + } + + void MainWindowPy::script_Properties_ambient(int id, char* type, int obj_id, double mAmbient) + { + QString stype(type); + ModuleBase::GraphWindowBase* gb = _subWindowManager->getWindowByTypeID(stype, id); + if(gb == nullptr) + return; + Post::Post3DWindowInterface* p3d = dynamic_cast(gb); + if(p3d == nullptr) + return; + Post::Post3DWindow* w = p3d->getWindow(); + if(w == nullptr) + return; + emit w->Properties_ambientSig(obj_id, mAmbient); + } + + void MainWindowPy::script_Properties_specularPower(int id, char* type, int obj_id, + int mSpecularPower) + { + QString stype(type); + ModuleBase::GraphWindowBase* gb = _subWindowManager->getWindowByTypeID(stype, id); + if(gb == nullptr) + return; + Post::Post3DWindowInterface* p3d = dynamic_cast(gb); + if(p3d == nullptr) + return; + Post::Post3DWindow* w = p3d->getWindow(); + if(w == nullptr) + return; + emit w->Properties_specularPowerSig(obj_id, mSpecularPower); + } + + void MainWindowPy::script_Properties_specularColor(int id, char* type, int obj_id, int r, int g, + int b) + { + QString stype(type); + ModuleBase::GraphWindowBase* gb = _subWindowManager->getWindowByTypeID(stype, id); + if(gb == nullptr) + return; + Post::Post3DWindowInterface* p3d = dynamic_cast(gb); + if(p3d == nullptr) + return; + Post::Post3DWindow* w = p3d->getWindow(); + if(w == nullptr) + return; + emit w->Properties_specularColorSig(obj_id, r, g, b); + } + + void MainWindowPy::script_Properties_solidColor(int id, char* type, int obj_id, int r, int g, + int b) + { + QString stype(type); + ModuleBase::GraphWindowBase* gb = _subWindowManager->getWindowByTypeID(stype, id); + if(gb == nullptr) + return; + Post::Post3DWindowInterface* p3d = dynamic_cast(gb); + if(p3d == nullptr) + return; + Post::Post3DWindow* w = p3d->getWindow(); + if(w == nullptr) + return; + emit w->Properties_solidColorSig(obj_id, r, g, b); + } + + void MainWindowPy::script_Properties_edgeColor(int id, char* type, int obj_id, int r, int g, + int b) + { + QString stype(type); + ModuleBase::GraphWindowBase* gb = _subWindowManager->getWindowByTypeID(stype, id); + if(gb == nullptr) + return; + Post::Post3DWindowInterface* p3d = dynamic_cast(gb); + if(p3d == nullptr) + return; + Post::Post3DWindow* w = p3d->getWindow(); + if(w == nullptr) + return; + emit w->Properties_edgeColorSig(obj_id, r, g, b); + } + + void MainWindowPy::script_Properties_interpolation(int id, char* type, int obj_id, + int m_enum_interpolationtype) + { + QString stype(type); + ModuleBase::GraphWindowBase* gb = _subWindowManager->getWindowByTypeID(stype, id); + if(gb == nullptr) + return; + Post::Post3DWindowInterface* p3d = dynamic_cast(gb); + if(p3d == nullptr) + return; + Post::Post3DWindow* w = p3d->getWindow(); + if(w == nullptr) + return; + emit w->Properties_interpolationSig(obj_id, m_enum_interpolationtype); + } + + void MainWindowPy::script_Properties_Flag_scalarBar(int id, char* type, int obj_id, + char* mColorColumnStyle) + { + QString stype(type); + QString smColorColumnStyle(mColorColumnStyle); + ModuleBase::GraphWindowBase* gb = _subWindowManager->getWindowByTypeID(stype, id); + if(gb == nullptr) + return; + Post::Post3DWindowInterface* p3d = dynamic_cast(gb); + if(p3d == nullptr) + return; + Post::Post3DWindow* w = p3d->getWindow(); + if(w == nullptr) + return; + emit w->Properties_Flag_scalarBarSig(obj_id, smColorColumnStyle); + } + + void MainWindowPy::script_Properties_EnableOpacityMap(int id, char* type, int obj_id, bool val) + { + QString stype(type); + ModuleBase::GraphWindowBase* gb = _subWindowManager->getWindowByTypeID(stype, id); + if(gb == nullptr) + return; + Post::Post3DWindowInterface* p3d = dynamic_cast(gb); + if(p3d == nullptr) + return; + Post::Post3DWindow* w = p3d->getWindow(); + if(w == nullptr) + return; + emit w->Properties_EnableOpacityMapSig(obj_id, val); + } + + void MainWindowPy::script_Properties_visible(int id, char* type, int obj_id, + bool flag_show_actors) + { + QString stype(type); + ModuleBase::GraphWindowBase* gb = _subWindowManager->getWindowByTypeID(stype, id); + if(gb == nullptr) + return; + Post::Post3DWindowInterface* p3d = dynamic_cast(gb); + if(p3d == nullptr) + return; + Post::Post3DWindow* w = p3d->getWindow(); + if(w == nullptr) + return; + emit w->Properties_visibleSig(obj_id, flag_show_actors); + } + + void MainWindowPy::script_Properties_show_scalarBars(int id, char* type, int obj_id, + bool mScalarBarVisible) + { + QString stype(type); + ModuleBase::GraphWindowBase* gb = _subWindowManager->getWindowByTypeID(stype, id); + if(gb == nullptr) + return; + Post::Post3DWindowInterface* p3d = dynamic_cast(gb); + if(p3d == nullptr) + return; + Post::Post3DWindow* w = p3d->getWindow(); + if(w == nullptr) + return; + emit w->Properties_show_scalarBarsSig(obj_id, mScalarBarVisible); + } + + void MainWindowPy::script_Properties_show_cubeAxes(int id, char* type, int obj_id, + bool flag_cubeAxes) + { + QString stype(type); + ModuleBase::GraphWindowBase* gb = _subWindowManager->getWindowByTypeID(stype, id); + if(gb == nullptr) + return; + Post::Post3DWindowInterface* p3d = dynamic_cast(gb); + if(p3d == nullptr) + return; + Post::Post3DWindow* w = p3d->getWindow(); + if(w == nullptr) + return; + emit w->Properties_show_cubeAxesSig(obj_id, flag_cubeAxes); + } + + void MainWindowPy::script_Properties_scalarBarPosition(int id, char* type, int obj_id, + char* colName, int tep_orietation, + double pos0, double pos1, double pos2, + double pos3) + { + QString stype(type); + QString scolName(colName); + ModuleBase::GraphWindowBase* gb = _subWindowManager->getWindowByTypeID(stype, id); + if(gb == nullptr) + return; + Post::Post3DWindowInterface* p3d = dynamic_cast(gb); + if(p3d == nullptr) + return; + Post::Post3DWindow* w = p3d->getWindow(); + if(w == nullptr) + return; + emit w->Properties_scalarBarPositionSig(obj_id, scolName, tep_orietation, pos0, pos1, pos2, + pos3); + } + + void MainWindowPy::script_FilterClip(int id, char* type, int obj_id) + { + QString stype(type); + ModuleBase::GraphWindowBase* gb = _subWindowManager->getWindowByTypeID(stype, id); + if(gb == nullptr) + return; + Post::Post3DWindowInterface* p3d = dynamic_cast(gb); + if(p3d == nullptr) + return; + Post::Post3DWindow* w = p3d->getWindow(); + if(w == nullptr) + return; + emit w->FilterClipSig(obj_id); + } + + void MainWindowPy::script_FilterSlice(int id, char* type, int obj_id) + { + QString stype(type); + ModuleBase::GraphWindowBase* gb = _subWindowManager->getWindowByTypeID(stype, id); + if(gb == nullptr) + return; + Post::Post3DWindowInterface* p3d = dynamic_cast(gb); + if(p3d == nullptr) + return; + Post::Post3DWindow* w = p3d->getWindow(); + if(w == nullptr) + return; + emit w->FilterSliceSig(obj_id); + } + + void MainWindowPy::script_FilterContour(int id, char* type, int obj_id) + { + QString stype(type); + ModuleBase::GraphWindowBase* gb = _subWindowManager->getWindowByTypeID(stype, id); + if(gb == nullptr) + return; + Post::Post3DWindowInterface* p3d = dynamic_cast(gb); + if(p3d == nullptr) + return; + Post::Post3DWindow* w = p3d->getWindow(); + if(w == nullptr) + return; + emit w->FilterContourSig(obj_id); + } + + void MainWindowPy::script_FilterVector(int id, char* type, int obj_id) + { + QString stype(type); + ModuleBase::GraphWindowBase* gb = _subWindowManager->getWindowByTypeID(stype, id); + if(gb == nullptr) + return; + Post::Post3DWindowInterface* p3d = dynamic_cast(gb); + if(p3d == nullptr) + return; + Post::Post3DWindow* w = p3d->getWindow(); + if(w == nullptr) + return; + emit w->FilterVectorSig(obj_id); + } + + void MainWindowPy::script_FilterReflection(int id, char* type, int obj_id) + { + QString stype(type); + ModuleBase::GraphWindowBase* gb = _subWindowManager->getWindowByTypeID(stype, id); + if(gb == nullptr) + return; + Post::Post3DWindowInterface* p3d = dynamic_cast(gb); + if(p3d == nullptr) + return; + Post::Post3DWindow* w = p3d->getWindow(); + if(w == nullptr) + return; + emit w->FilterReflectionSig(obj_id); + } + + void MainWindowPy::script_FilterSmooth(int id, char* type, int obj_id) + { + QString stype(type); + ModuleBase::GraphWindowBase* gb = _subWindowManager->getWindowByTypeID(stype, id); + if(gb == nullptr) + return; + Post::Post3DWindowInterface* p3d = dynamic_cast(gb); + if(p3d == nullptr) + return; + Post::Post3DWindow* w = p3d->getWindow(); + if(w == nullptr) + return; + emit w->FilterSmoothSig(obj_id); + } + + void MainWindowPy::script_FilterStreamLine(int id, char* type, int obj_id) + { + QString stype(type); + ModuleBase::GraphWindowBase* gb = _subWindowManager->getWindowByTypeID(stype, id); + if(gb == nullptr) + return; + Post::Post3DWindowInterface* p3d = dynamic_cast(gb); + if(p3d == nullptr) + return; + Post::Post3DWindow* w = p3d->getWindow(); + if(w == nullptr) + return; + emit w->FilterStreamLineSig(obj_id); + } + + void MainWindowPy::script_Properties_vector_GlyphVector(int id, char* type, int obj_id, + char* val) + { + QString stype(type); + QString sval(val); + ModuleBase::GraphWindowBase* gb = _subWindowManager->getWindowByTypeID(stype, id); + if(gb == nullptr) + return; + Post::Post3DWindowInterface* p3d = dynamic_cast(gb); + if(p3d == nullptr) + return; + Post::Post3DWindow* w = p3d->getWindow(); + if(w == nullptr) + return; + emit w->Properties_vector_GlyphVectorSig(obj_id, sval); + } + + void MainWindowPy::script_Properties_vector_scalar(int id, char* type, int obj_id, char* val) + { + QString stype(type); + QString sval(val); + ModuleBase::GraphWindowBase* gb = _subWindowManager->getWindowByTypeID(stype, id); + if(gb == nullptr) + return; + Post::Post3DWindowInterface* p3d = dynamic_cast(gb); + if(p3d == nullptr) + return; + Post::Post3DWindow* w = p3d->getWindow(); + if(w == nullptr) + return; + emit w->Properties_vector_scalarSig(obj_id, sval); + } + + void MainWindowPy::script_Properties_vector_normal(int id, char* type, int obj_id, char* val) + { + QString stype(type); + QString sval(val); + ModuleBase::GraphWindowBase* gb = _subWindowManager->getWindowByTypeID(stype, id); + if(gb == nullptr) + return; + Post::Post3DWindowInterface* p3d = dynamic_cast(gb); + if(p3d == nullptr) + return; + Post::Post3DWindow* w = p3d->getWindow(); + if(w == nullptr) + return; + emit w->Properties_vector_normalSig(obj_id, sval); + } + + void MainWindowPy::script_Properties_vector_numPoints(int id, char* type, int obj_id, int val) + { + QString stype(type); + ModuleBase::GraphWindowBase* gb = _subWindowManager->getWindowByTypeID(stype, id); + if(gb == nullptr) + return; + Post::Post3DWindowInterface* p3d = dynamic_cast(gb); + if(p3d == nullptr) + return; + Post::Post3DWindow* w = p3d->getWindow(); + if(w == nullptr) + return; + emit w->Properties_vector_numPointsSig(obj_id, val); + } + + void MainWindowPy::script_Properties_vector_glyph_type(int id, char* type, int obj_id, int val) + { + QString stype(type); + ModuleBase::GraphWindowBase* gb = _subWindowManager->getWindowByTypeID(stype, id); + if(gb == nullptr) + return; + Post::Post3DWindowInterface* p3d = dynamic_cast(gb); + if(p3d == nullptr) + return; + Post::Post3DWindow* w = p3d->getWindow(); + if(w == nullptr) + return; + emit w->Properties_vector_glyph_typeSig(obj_id, val); + } + + void MainWindowPy::script_Properties_vector_glyph_tipRes(int id, char* type, int obj_id, + int val) + { + QString stype(type); + ModuleBase::GraphWindowBase* gb = _subWindowManager->getWindowByTypeID(stype, id); + if(gb == nullptr) + return; + Post::Post3DWindowInterface* p3d = dynamic_cast(gb); + if(p3d == nullptr) + return; + Post::Post3DWindow* w = p3d->getWindow(); + if(w == nullptr) + return; + emit w->Properties_vector_glyph_tipResSig(obj_id, val); + } + + void MainWindowPy::script_Properties_vector_glyph_tipRad(int id, char* type, int obj_id, + double val) + { + QString stype(type); + ModuleBase::GraphWindowBase* gb = _subWindowManager->getWindowByTypeID(stype, id); + if(gb == nullptr) + return; + Post::Post3DWindowInterface* p3d = dynamic_cast(gb); + if(p3d == nullptr) + return; + Post::Post3DWindow* w = p3d->getWindow(); + if(w == nullptr) + return; + emit w->Properties_vector_glyph_tipRadSig(obj_id, val); + } + + void MainWindowPy::script_Properties_vector_glyph_tipLen(int id, char* type, int obj_id, + double val) + { + QString stype(type); + ModuleBase::GraphWindowBase* gb = _subWindowManager->getWindowByTypeID(stype, id); + if(gb == nullptr) + return; + Post::Post3DWindowInterface* p3d = dynamic_cast(gb); + if(p3d == nullptr) + return; + Post::Post3DWindow* w = p3d->getWindow(); + if(w == nullptr) + return; + emit w->Properties_vector_glyph_tipLenSig(obj_id, val); + } + + void MainWindowPy::script_Properties_vector_glyph_shaftRes(int id, char* type, int obj_id, + int val) + { + QString stype(type); + ModuleBase::GraphWindowBase* gb = _subWindowManager->getWindowByTypeID(stype, id); + if(gb == nullptr) + return; + Post::Post3DWindowInterface* p3d = dynamic_cast(gb); + if(p3d == nullptr) + return; + Post::Post3DWindow* w = p3d->getWindow(); + if(w == nullptr) + return; + emit w->Properties_vector_glyph_shaftResSig(obj_id, val); + } + + void MainWindowPy::script_Properties_vector_glyph_shaftRad(int id, char* type, int obj_id, + double val) + { + QString stype(type); + ModuleBase::GraphWindowBase* gb = _subWindowManager->getWindowByTypeID(stype, id); + if(gb == nullptr) + return; + Post::Post3DWindowInterface* p3d = dynamic_cast(gb); + if(p3d == nullptr) + return; + Post::Post3DWindow* w = p3d->getWindow(); + if(w == nullptr) + return; + emit w->Properties_vector_glyph_shaftRadSig(obj_id, val); + } + ////////////////////////////// + void MainWindowPy::script_Properties_view_backgroundType(int id, char* type, int val) + { + QString stype(type); + ModuleBase::GraphWindowBase* gb = _subWindowManager->getWindowByTypeID(stype, id); + if(gb == nullptr) + return; + Post::Post3DWindowInterface* p3d = dynamic_cast(gb); + if(p3d == nullptr) + return; + Post::Post3DWindow* w = p3d->getWindow(); + if(w == nullptr) + return; + emit w->Properties_view_backgroundTypedSig(val); + } + + void MainWindowPy::script_Properties_view_backgroundColor(int id, char* type, int red, + int green, int blue) + { + QString stype(type); + ModuleBase::GraphWindowBase* gb = _subWindowManager->getWindowByTypeID(stype, id); + if(gb == nullptr) + return; + Post::Post3DWindowInterface* p3d = dynamic_cast(gb); + if(p3d == nullptr) + return; + Post::Post3DWindow* w = p3d->getWindow(); + if(w == nullptr) + return; + emit w->Properties_view_backgroundColorSig(red, green, blue); + } + + void MainWindowPy::script_Properties_view_background2Color(int id, char* type, int red, + int green, int blue) + { + QString stype(type); + ModuleBase::GraphWindowBase* gb = _subWindowManager->getWindowByTypeID(stype, id); + if(gb == nullptr) + return; + Post::Post3DWindowInterface* p3d = dynamic_cast(gb); + if(p3d == nullptr) + return; + Post::Post3DWindow* w = p3d->getWindow(); + if(w == nullptr) + return; + emit w->Properties_view_background2ColorSig(red, green, blue); + } + + void MainWindowPy::script_Properties_view_axesVisible(int id, char* type, int a) + { + QString stype(type); + ModuleBase::GraphWindowBase* gb = _subWindowManager->getWindowByTypeID(stype, id); + if(gb == nullptr) + return; + Post::Post3DWindowInterface* p3d = dynamic_cast(gb); + if(p3d == nullptr) + return; + Post::Post3DWindow* w = p3d->getWindow(); + if(w == nullptr) + return; + emit w->Properties_view_axesVisibleSig(a); + } + + void MainWindowPy::script_Properties_view_cameraParallel(int id, char* type, int a) + { + QString stype(type); + ModuleBase::GraphWindowBase* gb = _subWindowManager->getWindowByTypeID(stype, id); + if(gb == nullptr) + return; + Post::Post3DWindowInterface* p3d = dynamic_cast(gb); + if(p3d == nullptr) + return; + Post::Post3DWindow* w = p3d->getWindow(); + if(w == nullptr) + return; + emit w->Properties_view_cameraParallelSig(a); + } + + void MainWindowPy::script_Properties_view_interaction(int id, char* type, int a) + { + QString stype(type); + ModuleBase::GraphWindowBase* gb = _subWindowManager->getWindowByTypeID(stype, id); + if(gb == nullptr) + return; + Post::Post3DWindowInterface* p3d = dynamic_cast(gb); + if(p3d == nullptr) + return; + Post::Post3DWindow* w = p3d->getWindow(); + if(w == nullptr) + return; + emit w->Properties_view_interactionSig(a); + } + + void MainWindowPy::script_Properties_renderView(int id, char* type) + { + QString stype(type); + ModuleBase::GraphWindowBase* gb = _subWindowManager->getWindowByTypeID(stype, id); + if(gb == nullptr) + return; + Post::Post3DWindowInterface* p3d = dynamic_cast(gb); + if(p3d == nullptr) + return; + Post::Post3DWindow* w = p3d->getWindow(); + if(w == nullptr) + return; + emit w->Properties_renderViewSig(); + } + + void MainWindowPy::script_Camera_Position(int id, char* type, double pos0, double pos1, + double pos2) + { + QString stype(type); + ModuleBase::GraphWindowBase* gb = _subWindowManager->getWindowByTypeID(stype, id); + if(gb == nullptr) + return; + Post::Post3DWindowInterface* p3d = dynamic_cast(gb); + if(p3d == nullptr) + return; + Post::Post3DWindow* w = p3d->getWindow(); + if(w == nullptr) + return; + emit w->Camera_PositionSig(pos0, pos1, pos2); + } + + void MainWindowPy::script_Camera_FocalPoint(int id, char* type, double focalPoint0, + double focalPoint1, double focalPoint2) + { + QString stype(type); + ModuleBase::GraphWindowBase* gb = _subWindowManager->getWindowByTypeID(stype, id); + if(gb == nullptr) + return; + Post::Post3DWindowInterface* p3d = dynamic_cast(gb); + if(p3d == nullptr) + return; + Post::Post3DWindow* w = p3d->getWindow(); + if(w == nullptr) + return; + emit w->Camera_FocalPointSig(focalPoint0, focalPoint1, focalPoint2); + } + + void MainWindowPy::script_Camera_ClippingRange(int id, char* type, double clippingRange0, + double clippingRange1) + { + QString stype(type); + ModuleBase::GraphWindowBase* gb = _subWindowManager->getWindowByTypeID(stype, id); + if(gb == nullptr) + return; + Post::Post3DWindowInterface* p3d = dynamic_cast(gb); + if(p3d == nullptr) + return; + Post::Post3DWindow* w = p3d->getWindow(); + if(w == nullptr) + return; + emit w->Camera_ClippingRangeSig(clippingRange0, clippingRange1); + } + + void MainWindowPy::script_Camera_ViewUp(int id, char* type, double viewup0, double viewup1, + double viewup2) + { + QString stype(type); + ModuleBase::GraphWindowBase* gb = _subWindowManager->getWindowByTypeID(stype, id); + if(gb == nullptr) + return; + Post::Post3DWindowInterface* p3d = dynamic_cast(gb); + if(p3d == nullptr) + return; + Post::Post3DWindow* w = p3d->getWindow(); + if(w == nullptr) + return; + emit w->Camera_ViewUpSig(viewup0, viewup1, viewup2); + } + + void MainWindowPy::script_Camera_ViewAngle(int id, char* type, double angle) + { + QString stype(type); + ModuleBase::GraphWindowBase* gb = _subWindowManager->getWindowByTypeID(stype, id); + if(gb == nullptr) + return; + Post::Post3DWindowInterface* p3d = dynamic_cast(gb); + if(p3d == nullptr) + return; + Post::Post3DWindow* w = p3d->getWindow(); + if(w == nullptr) + return; + emit w->Camera_ViewAngleSig(angle); + } + + void MainWindowPy::script_Camera_Zoom(int id, char* type, double zoom) + { + QString stype(type); + ModuleBase::GraphWindowBase* gb = _subWindowManager->getWindowByTypeID(stype, id); + if(gb == nullptr) + return; + Post::Post3DWindowInterface* p3d = dynamic_cast(gb); + if(p3d == nullptr) + return; + Post::Post3DWindow* w = p3d->getWindow(); + if(w == nullptr) + return; + emit w->Camera_ZoomSig(zoom); + } + + void MainWindowPy::script_Camera_Reset(int id, char* type) + { + QString stype(type); + ModuleBase::GraphWindowBase* gb = _subWindowManager->getWindowByTypeID(stype, id); + if(gb == nullptr) + return; + Post::Post3DWindowInterface* p3d = dynamic_cast(gb); + if(p3d == nullptr) + return; + Post::Post3DWindow* w = p3d->getWindow(); + if(w == nullptr) + return; + emit w->Camera_ResetSig(); + } + + void MainWindowPy::script_Properties_planeOrigin(int id, char* type, int obj_id, double x, + double y, double z) + { + QString stype(type); + ModuleBase::GraphWindowBase* gb = _subWindowManager->getWindowByTypeID(stype, id); + if(gb == nullptr) + return; + Post::Post3DWindowInterface* p3d = dynamic_cast(gb); + if(p3d == nullptr) + return; + Post::Post3DWindow* w = p3d->getWindow(); + if(w == nullptr) + return; + emit w->Properties_planeOriginSig(obj_id, x, y, z); + } + + void MainWindowPy::script_Properties_planeNormal(int id, char* type, int obj_id, double x, + double y, double z) + { + QString stype(type); + ModuleBase::GraphWindowBase* gb = _subWindowManager->getWindowByTypeID(stype, id); + if(gb == nullptr) + return; + Post::Post3DWindowInterface* p3d = dynamic_cast(gb); + if(p3d == nullptr) + return; + Post::Post3DWindow* w = p3d->getWindow(); + if(w == nullptr) + return; + emit w->Properties_planeNormalSig(obj_id, x, y, z); + } + + void MainWindowPy::script_Properties_planeVisible(int id, char* type, int obj_id, int a) + { + QString stype(type); + ModuleBase::GraphWindowBase* gb = _subWindowManager->getWindowByTypeID(stype, id); + if(gb == nullptr) + return; + Post::Post3DWindowInterface* p3d = dynamic_cast(gb); + if(p3d == nullptr) + return; + Post::Post3DWindow* w = p3d->getWindow(); + if(w == nullptr) + return; + emit w->Properties_planeVisibleSig(obj_id, a); + } + + void MainWindowPy::script_Properties_insideOut(int id, char* type, int obj_id, int a) + { + QString stype(type); + ModuleBase::GraphWindowBase* gb = _subWindowManager->getWindowByTypeID(stype, id); + if(gb == nullptr) + return; + Post::Post3DWindowInterface* p3d = dynamic_cast(gb); + if(p3d == nullptr) + return; + Post::Post3DWindow* w = p3d->getWindow(); + if(w == nullptr) + return; + emit w->Properties_insideOutSig(obj_id, a); + } + + void MainWindowPy::script_Properties_contourColumn(int id, char* type, int obj_id, char* val) + { + QString stype(type); + QString sval(val); + ModuleBase::GraphWindowBase* gb = _subWindowManager->getWindowByTypeID(stype, id); + if(gb == nullptr) + return; + Post::Post3DWindowInterface* p3d = dynamic_cast(gb); + if(p3d == nullptr) + return; + Post::Post3DWindow* w = p3d->getWindow(); + if(w == nullptr) + return; + emit w->Properties_contourColumnSig(obj_id, sval); + } + + void MainWindowPy::script_Properties_contourValue(int id, char* type, int obj_id, double val) + { + QString stype(type); + ModuleBase::GraphWindowBase* gb = _subWindowManager->getWindowByTypeID(stype, id); + if(gb == nullptr) + return; + Post::Post3DWindowInterface* p3d = dynamic_cast(gb); + if(p3d == nullptr) + return; + Post::Post3DWindow* w = p3d->getWindow(); + if(w == nullptr) + return; + emit w->Properties_contourValueSig(obj_id, val); + } + + void MainWindowPy::script_Properties_contour_reflection(int id, char* type, int obj_id, int aaa) + { + QString stype(type); + ModuleBase::GraphWindowBase* gb = _subWindowManager->getWindowByTypeID(stype, id); + if(gb == nullptr) + return; + Post::Post3DWindowInterface* p3d = dynamic_cast(gb); + if(p3d == nullptr) + return; + Post::Post3DWindow* w = p3d->getWindow(); + if(w == nullptr) + return; + emit w->Properties_contour_reflectionSig(obj_id, aaa); + } + + void MainWindowPy::script_Properties_contour_reflectionAxes(int id, char* type, int obj_id, + int val) + { + QString stype(type); + ModuleBase::GraphWindowBase* gb = _subWindowManager->getWindowByTypeID(stype, id); + if(gb == nullptr) + return; + Post::Post3DWindowInterface* p3d = dynamic_cast(gb); + if(p3d == nullptr) + return; + Post::Post3DWindow* w = p3d->getWindow(); + if(w == nullptr) + return; + emit w->Properties_contour_reflectionAxesSig(obj_id, val); + } + + void MainWindowPy::script_Properties_reflectionAxes(int id, char* type, int obj_id, + int reflection_axis) + { + QString stype(type); + ModuleBase::GraphWindowBase* gb = _subWindowManager->getWindowByTypeID(stype, id); + if(gb == nullptr) + return; + Post::Post3DWindowInterface* p3d = dynamic_cast(gb); + if(p3d == nullptr) + return; + Post::Post3DWindow* w = p3d->getWindow(); + if(w == nullptr) + return; + emit w->Properties_reflectionAxesSig(obj_id, reflection_axis); + } + + void MainWindowPy::script_Properties_smooth(int id, char* type, int obj_id, int smotype, + double coef) + { + QString stype(type); + ModuleBase::GraphWindowBase* gb = _subWindowManager->getWindowByTypeID(stype, id); + if(gb == nullptr) + return; + Post::Post3DWindowInterface* p3d = dynamic_cast(gb); + if(p3d == nullptr) + return; + Post::Post3DWindow* w = p3d->getWindow(); + if(w == nullptr) + return; + emit w->Properties_smoothSig(obj_id, smotype, coef); + } + //////////////////////////////// + void MainWindowPy::script_Properties_streamline_vector(int id, char* type, int obj_id, + char* val) + { + QString stype(type); + QString sval(val); + ModuleBase::GraphWindowBase* gb = _subWindowManager->getWindowByTypeID(stype, id); + if(gb == nullptr) + return; + Post::Post3DWindowInterface* p3d = dynamic_cast(gb); + if(p3d == nullptr) + return; + Post::Post3DWindow* w = p3d->getWindow(); + if(w == nullptr) + return; + emit w->Properties_streamline_vectorSig(obj_id, sval); + } + + void MainWindowPy::script_Properties_streamline_integration_direction(int id, char* type, + int obj_id, int val) + { + QString stype(type); + ModuleBase::GraphWindowBase* gb = _subWindowManager->getWindowByTypeID(stype, id); + if(gb == nullptr) + return; + Post::Post3DWindowInterface* p3d = dynamic_cast(gb); + if(p3d == nullptr) + return; + Post::Post3DWindow* w = p3d->getWindow(); + if(w == nullptr) + return; + emit w->Properties_streamline_integration_directionSig(obj_id, val); + } + + void MainWindowPy::script_Properties_streamline_integration_type(int id, char* type, int obj_id, + int val) + { + QString stype(type); + ModuleBase::GraphWindowBase* gb = _subWindowManager->getWindowByTypeID(stype, id); + if(gb == nullptr) + return; + Post::Post3DWindowInterface* p3d = dynamic_cast(gb); + if(p3d == nullptr) + return; + Post::Post3DWindow* w = p3d->getWindow(); + if(w == nullptr) + return; + emit w->Properties_streamline_integration_typeSig(obj_id, val); + } + + void MainWindowPy::script_Properties_streamline_integration_stepUnit(int id, char* type, + int obj_id, int val) + { + QString stype(type); + ModuleBase::GraphWindowBase* gb = _subWindowManager->getWindowByTypeID(stype, id); + if(gb == nullptr) + return; + Post::Post3DWindowInterface* p3d = dynamic_cast(gb); + if(p3d == nullptr) + return; + Post::Post3DWindow* w = p3d->getWindow(); + if(w == nullptr) + return; + emit w->Properties_streamline_integration_stepUnitSig(obj_id, val); + } + + void MainWindowPy::script_Properties_streamline_integration_initStepLen(int id, char* type, + int obj_id, double val) + { + QString stype(type); + ModuleBase::GraphWindowBase* gb = _subWindowManager->getWindowByTypeID(stype, id); + if(gb == nullptr) + return; + Post::Post3DWindowInterface* p3d = dynamic_cast(gb); + if(p3d == nullptr) + return; + Post::Post3DWindow* w = p3d->getWindow(); + if(w == nullptr) + return; + emit w->Properties_streamline_integration_initStepLenSig(obj_id, val); + } + + void MainWindowPy::script_Properties_streamline_integration_miniStepLen(int id, char* type, + int obj_id, double val) + { + QString stype(type); + ModuleBase::GraphWindowBase* gb = _subWindowManager->getWindowByTypeID(stype, id); + if(gb == nullptr) + return; + Post::Post3DWindowInterface* p3d = dynamic_cast(gb); + if(p3d == nullptr) + return; + Post::Post3DWindow* w = p3d->getWindow(); + if(w == nullptr) + return; + emit w->Properties_streamline_integration_miniStepLenSig(obj_id, val); + } + + void MainWindowPy::script_Properties_streamline_integration_maxiStepLen(int id, char* type, + int obj_id, double val) + { + QString stype(type); + ModuleBase::GraphWindowBase* gb = _subWindowManager->getWindowByTypeID(stype, id); + if(gb == nullptr) + return; + Post::Post3DWindowInterface* p3d = dynamic_cast(gb); + if(p3d == nullptr) + return; + Post::Post3DWindow* w = p3d->getWindow(); + if(w == nullptr) + return; + emit w->Properties_streamline_integration_maxiStepLenSig(obj_id, val); + } + + void MainWindowPy::script_Properties_streamline_stream_maxiSteps(int id, char* type, int obj_id, + int val) + { + QString stype(type); + ModuleBase::GraphWindowBase* gb = _subWindowManager->getWindowByTypeID(stype, id); + if(gb == nullptr) + return; + Post::Post3DWindowInterface* p3d = dynamic_cast(gb); + if(p3d == nullptr) + return; + Post::Post3DWindow* w = p3d->getWindow(); + if(w == nullptr) + return; + emit w->Properties_streamline_stream_maxiStepsSig(obj_id, val); + } + + void MainWindowPy::script_Properties_streamline_stream_maxiStreamLen(int id, char* type, + int obj_id, double val) + { + QString stype(type); + ModuleBase::GraphWindowBase* gb = _subWindowManager->getWindowByTypeID(stype, id); + if(gb == nullptr) + return; + Post::Post3DWindowInterface* p3d = dynamic_cast(gb); + if(p3d == nullptr) + return; + Post::Post3DWindow* w = p3d->getWindow(); + if(w == nullptr) + return; + emit w->Properties_streamline_stream_maxiStreamLenSig(obj_id, val); + } + + void MainWindowPy::script_Properties_streamline_stream_terminalSpeed(int id, char* type, + int obj_id, double val) + { + QString stype(type); + ModuleBase::GraphWindowBase* gb = _subWindowManager->getWindowByTypeID(stype, id); + if(gb == nullptr) + return; + Post::Post3DWindowInterface* p3d = dynamic_cast(gb); + if(p3d == nullptr) + return; + Post::Post3DWindow* w = p3d->getWindow(); + if(w == nullptr) + return; + emit w->Properties_streamline_stream_terminalSpeedSig(obj_id, val); + } + + void MainWindowPy::script_Properties_streamline_stream_maxiError(int id, char* type, int obj_id, + double val) + { + QString stype(type); + ModuleBase::GraphWindowBase* gb = _subWindowManager->getWindowByTypeID(stype, id); + if(gb == nullptr) + return; + Post::Post3DWindowInterface* p3d = dynamic_cast(gb); + if(p3d == nullptr) + return; + Post::Post3DWindow* w = p3d->getWindow(); + if(w == nullptr) + return; + emit w->Properties_streamline_stream_maxiErrorSig(obj_id, val); + } + + void MainWindowPy::script_Properties_streamline_seeds_type(int id, char* type, int obj_id, + int val) + { + QString stype(type); + ModuleBase::GraphWindowBase* gb = _subWindowManager->getWindowByTypeID(stype, id); + if(gb == nullptr) + return; + Post::Post3DWindowInterface* p3d = dynamic_cast(gb); + if(p3d == nullptr) + return; + Post::Post3DWindow* w = p3d->getWindow(); + if(w == nullptr) + return; + emit w->Properties_streamline_seeds_typeSig(obj_id, val); + } + + void MainWindowPy::script_Properties_streamline_seeds_mPoint(int id, char* type, int obj_id, + double val0, double val1, + double val2) + { + QString stype(type); + ModuleBase::GraphWindowBase* gb = _subWindowManager->getWindowByTypeID(stype, id); + if(gb == nullptr) + return; + Post::Post3DWindowInterface* p3d = dynamic_cast(gb); + if(p3d == nullptr) + return; + Post::Post3DWindow* w = p3d->getWindow(); + if(w == nullptr) + return; + emit w->Properties_streamline_seeds_mPointSig(obj_id, val0, val1, val2); + } + + void MainWindowPy::script_Properties_streamline_seeds_num_points(int id, char* type, int obj_id, + int val) + { + QString stype(type); + ModuleBase::GraphWindowBase* gb = _subWindowManager->getWindowByTypeID(stype, id); + if(gb == nullptr) + return; + Post::Post3DWindowInterface* p3d = dynamic_cast(gb); + if(p3d == nullptr) + return; + Post::Post3DWindow* w = p3d->getWindow(); + if(w == nullptr) + return; + emit w->Properties_streamline_seeds_num_pointsSig(obj_id, val); + } + + void MainWindowPy::script_Properties_streamline_seeds_radius(int id, char* type, int obj_id, + double val) + { + QString stype(type); + ModuleBase::GraphWindowBase* gb = _subWindowManager->getWindowByTypeID(stype, id); + if(gb == nullptr) + return; + Post::Post3DWindowInterface* p3d = dynamic_cast(gb); + if(p3d == nullptr) + return; + Post::Post3DWindow* w = p3d->getWindow(); + if(w == nullptr) + return; + emit w->Properties_streamline_seeds_radiusSig(obj_id, val); + } + + void MainWindowPy::script_Properties_streamline_vorticity(int id, char* type, int obj_id, + bool val) + { + QString stype(type); + ModuleBase::GraphWindowBase* gb = _subWindowManager->getWindowByTypeID(stype, id); + if(gb == nullptr) + return; + Post::Post3DWindowInterface* p3d = dynamic_cast(gb); + if(p3d == nullptr) + return; + Post::Post3DWindow* w = p3d->getWindow(); + if(w == nullptr) + return; + emit w->Properties_streamline_vorticitySig(obj_id, val); + } + + void MainWindowPy::script_Properties_streamline_interpolatorType(int id, char* type, int obj_id, + int val) + { + QString stype(type); + ModuleBase::GraphWindowBase* gb = _subWindowManager->getWindowByTypeID(stype, id); + if(gb == nullptr) + return; + Post::Post3DWindowInterface* p3d = dynamic_cast(gb); + if(p3d == nullptr) + return; + Post::Post3DWindow* w = p3d->getWindow(); + if(w == nullptr) + return; + emit w->Properties_streamline_interpolatorTypeSig(obj_id, val); + } + + void MainWindowPy::script_Properties_streamline_surface_streamLines(int id, char* type, + int obj_id, bool val) + { + QString stype(type); + ModuleBase::GraphWindowBase* gb = _subWindowManager->getWindowByTypeID(stype, id); + if(gb == nullptr) + return; + Post::Post3DWindowInterface* p3d = dynamic_cast(gb); + if(p3d == nullptr) + return; + Post::Post3DWindow* w = p3d->getWindow(); + if(w == nullptr) + return; + emit w->Properties_streamline_surface_streamLinesSig(obj_id, val); + } + + void MainWindowPy::script_Properties_streamline_reflection(int id, char* type, int obj_id, + bool val) + { + QString stype(type); + ModuleBase::GraphWindowBase* gb = _subWindowManager->getWindowByTypeID(stype, id); + if(gb == nullptr) + return; + Post::Post3DWindowInterface* p3d = dynamic_cast(gb); + if(p3d == nullptr) + return; + Post::Post3DWindow* w = p3d->getWindow(); + if(w == nullptr) + return; + emit w->Properties_streamline_reflectionSig(obj_id, val); + } + + void MainWindowPy::script_Properties_streamline_reflectionAxes(int id, char* type, int obj_id, + int val) + { + QString stype(type); + ModuleBase::GraphWindowBase* gb = _subWindowManager->getWindowByTypeID(stype, id); + if(gb == nullptr) + return; + Post::Post3DWindowInterface* p3d = dynamic_cast(gb); + if(p3d == nullptr) + return; + Post::Post3DWindow* w = p3d->getWindow(); + if(w == nullptr) + return; + emit w->Properties_streamline_reflectionAxesSig(obj_id, val); + } + + void MainWindowPy::deleteGeometry(int id) + { + MainWidget::PreWindow* pre = _subWindowManager->getPreWindow(); + if(id < 0) + return; + auto geo = Geometry::GeometryData::getInstance()->getGeometrySetByID(id); + Geometry::GeometryData::getInstance()->removeTopGeometrySet(geo); + if(pre != nullptr) + emit pre->removeGemoActors(geo); + emit _mainWindow->updateGeometryTreeSig(); + emit _mainWindow->updateActionStatesSig(); + emit _mainWindow->updateGraphOptionsSig(); + _pyAgent->unLock(); + } + + void MainWindowPy::createSet(const char* name, const char* type, const char* idstring) + { + QString cname(name); + QString cidstring(idstring); + MeshData::SetType settype = MeshData::MeshSet::stringToSettype(type); + + QStringList strlist = cidstring.simplified().split(";"); + MeshData::MeshSet* s = new MeshData::MeshSet(cname, settype); + for(QString idstring : strlist) { + QStringList kids = idstring.split(":"); + int ncount = kids.size(); + if(kids.size() < 2) + continue; + bool ok = false; + const int kid = kids.at(0).toInt(&ok); + if(!ok) + continue; + kids = kids.at(1).split(" "); + ncount = kids.size(); + for(int i = 0; i < ncount; ++i) { + int id = kids.at(i).toInt(&ok); + if(!ok) + continue; + s->appendMember(kid, id); + } + } + + // s->generateDisplayDataSet(); + MeshData::MeshData* meshData = MeshData::MeshData::getInstance(); + meshData->appendMeshSet(s); + emit _mainWindow->updateSetTreeSig(); + Py::PythonAgent::getInstance()->unLock(); + } + + void MainWindowPy::createGeoComponent(char* name, char* type, char* strgIDs, char* striIDs) + { + QString sname(name); + QString stype(type); + QStringList geoIds = QString(strgIDs).split(';'); + QStringList itemIds = QString(striIDs).split(';'); + if(geoIds.size() != itemIds.size()) + return; + Command::CommandCreateComponent* command = + new Command::CommandCreateComponent(_mainWindow, _subWindowManager->getPreWindow()); + command->setName(sname); + command->setType(stype); + command->setMembers(geoIds, itemIds); + bool success = Command::GeoComandList::getInstance()->executeCommand(command); + if(!success) + QMessageBox::warning(nullptr, QObject::tr("Warning"), QObject::tr("Create failed !")); + else + emit _mainWindow->updateGeometryTreeSig(); + emit _mainWindow->clearAllHighLight(); + Py::PythonAgent::getInstance()->unLock(); + } + + void MainWindowPy::createVTKTransform(const char* componentIds, const char* rotate, + const char* moveLocation, const char* scale) + { + QStringList qCompontIds = QString(componentIds).split(','); + QStringList qRotate = QString(rotate).split(','); + QStringList qMoveLocation = QString(moveLocation).split(','); + QStringList qScale = QString(scale).split(','); + + vtkDataRelated vtkRela; + vtkRela.SetRotateWXYZ(qRotate.at(0).toDouble(), qRotate.at(1).toDouble(), + qRotate.at(2).toDouble(), qRotate.at(3).toDouble()); + vtkRela.Translate(qMoveLocation.at(0).toDouble(), qMoveLocation.at(1).toDouble(), + qMoveLocation.at(2).toDouble()); + vtkRela.Scale(qScale.at(0).toDouble(), qScale.at(1).toDouble(), qScale.at(2).toDouble()); + + MeshData::MeshSet* meshSet = NULL; + MeshData::MeshKernal* meshKernal = NULL; + MeshData::MeshData* meshData = MeshData::MeshData::getInstance(); + QString kernalName, transformedName, setType, ids; + + for(QString compontId : qCompontIds) { + meshSet = meshData->getMeshSetByID(compontId.toInt()); + if(!meshSet) + continue; + + vtkRela.SetData(meshSet->getDisplayDataSet()); + vtkSmartPointer transformed = vtkRela.StartTransform(); + + meshKernal = new MeshData::MeshKernal; + kernalName = QString("transfrom%1_%2").arg(meshSet->getName()).arg(meshKernal->getID()); + meshKernal->setName(kernalName); + meshKernal->setMeshData(transformed); + meshData->appendMeshKernal(meshKernal); + + transformedName = + QString(meshSet->getName() + "_transform%1").arg(meshSet->getMaxID() + 1); + setType = MeshData::MeshSet::setTypeToString(meshSet->getSetType()); + ids.append(QString::number(meshKernal->getID()) + ":"); + + int nCount = 0; + if(setType == "Node") + nCount = transformed->GetNumberOfPoints(); + else if(setType == "Element") + nCount = transformed->GetNumberOfCells(); + if(nCount == 0) { + emit _pyAgent->printInfo(Common::Message::Error, "Transform Failed!"); + meshData->removeKernalByID(meshKernal->getID()); + Py::PythonAgent::getInstance()->unLock(); + return; + } + for(int i = 0; i < nCount; i++) + ids.append(QString::number(i) + ' '); + + createSet(transformedName.toStdString().c_str(), setType.toStdString().c_str(), + ids.toStdString().c_str()); + ids.clear(); + } + emit _mainWindow->updatePreMeshActorSig(); + emit _mainWindow->updateMeshTreeSig(); + emit _mainWindow->updateActionStatesSig(); + Py::PythonAgent::getInstance()->unLock(); + } + + void MainWindowPy::findConplanarPorC(const char* seedType, int seedId, double minAngle, + int kernalId, const char* setName) + { + MeshData::MeshData* meshData = MeshData::MeshData::getInstance(); + vtkDataSet* data = meshData->getKernalByID(kernalId)->getMeshData(); + if(!data) + return; + vtkDataRelated vtkRela; + std::set coplanarIds; + QString error, setType(seedType); + if(setType == "Node") { + coplanarIds = vtkRela.GetCoplanarPointId(data, seedId, minAngle); + error = "No Point Coplanar With This Point"; + } else if(setType == "Element") { + coplanarIds = vtkRela.GetCoplanarCellId(data, seedId, minAngle); + error = "No Cell Coplanar With This Cell(only support lookup surface grid)"; + } + if(coplanarIds.size() == 0) { + emit _pyAgent->printInfo(Common::Message::Error, error); + Py::PythonAgent::getInstance()->unLock(); + return; + } + + std::set::const_iterator cit; + QString ids(QString::number(kernalId) + ":"); + for(cit = coplanarIds.cbegin(); cit != coplanarIds.cend(); cit++) + ids.append(QString::number(*cit) + ' '); + + createSet(setName, setType.toStdString().c_str(), ids.toStdString().c_str()); + Py::PythonAgent::getInstance()->unLock(); + } + + void MainWindowPy::updateInterface() + { + emit _mainWindow->updateInterfaces(); + } + +} // namespace GUI + +void importMesh(char* f, char* s, int modelId) +{ + GUI::MainWindowPy::importMesh(f, s, modelId); +} + +void exportMesh(char* f, char* s, int modelId) +{ + GUI::MainWindowPy::exportMesh(f, s, modelId); +} + +void importGeometry(char* f) +{ + GUI::MainWindowPy::importGeometry(f); +} + +void exportGeometry(char* f) +{ + GUI::MainWindowPy::exportGeometry(f); +} + +void openProjectFile(char* f) +{ + GUI::MainWindowPy::openProjectFile(f); +} + +void saveProjectFile(char* f) +{ + GUI::MainWindowPy::saveProjectFile(f); +} + +void saveImage(int w, int h, int id, char* win, char* file) +{ + GUI::MainWindowPy::saveImage(w, h, id, win, file); +} +void setView(int id, char* win, char* file) +{ + GUI::MainWindowPy::setView(id, win, file); +} +void setViewRandValue(int id, char* win, int x1, int x2, int x3, int y1, int y2, int y3, int z1, + int z2, int z3) +{ + GUI::MainWindowPy::setViewRandValue(id, win, x1, x2, x3, y1, y2, y3, z1, z2, z3); +} +// void setViewPostValue(int id, char*win, int x1, int x2, int x3, int y1, int y2, int y3, int z1, +// int z2, int z3) +//{ +// GUI::MainWindowPy::setViewPostValue(id, win,x1,x2,x3,y1,y2,y3,z1,z2,z3); +// } +void quit() +{ + GUI::MainWindowPy::quit(); +} +void openPost3D() +{ + GUI::MainWindowPy::openPost3D(); +} +void openPost2D() +{ + GUI::MainWindowPy::openPost2D(); +} +void openPreWindow() +{ + GUI::MainWindowPy::openPreWindow(); +} + +void solveProject(int projectIndex, int solverIndex) +{ + GUI::MainWindowPy::solveProject(projectIndex, solverIndex); +} + +void MAINWINDOWAPI script_openFile(int id, char* type, char* file) +{ + GUI::MainWindowPy::script_openFile(id, type, file); +} + +void MAINWINDOWAPI script_applyClicked(int id, char* type) +{ + GUI::MainWindowPy::script_applyClicked(id, type); +} + +void MAINWINDOWAPI createSet(char* name, char* type, char* idstring) +{ + GUI::MainWindowPy::createSet(name, type, idstring); +} + +void MAINWINDOWAPI createGeoComponent(char* name, char* type, char* strgIDs, char* striIDs) +{ + GUI::MainWindowPy::createGeoComponent(name, type, strgIDs, striIDs); +} + +void MAINWINDOWAPI script_Properties_Opacity(int id, char* type, int obj_id, double mOpacity) +{ + GUI::MainWindowPy::script_Properties_Opacity(id, type, obj_id, mOpacity); +} + +void MAINWINDOWAPI script_Properties_colorColumn(int id, char* type, int obj_id, + char* mColorColumnStyle) +{ + GUI::MainWindowPy::script_Properties_colorColumn(id, type, obj_id, mColorColumnStyle); +} + +void MAINWINDOWAPI script_Properties_scalarBarTitle(int id, char* type, int obj_id, char* colName, + char* m_title) +{ + GUI::MainWindowPy::script_Properties_scalarBarTitle(id, type, obj_id, colName, m_title); +} + +void MAINWINDOWAPI script_Properties_scalarBarFontSize(int id, char* type, int obj_id, + char* colName, int m_fontSize) +{ + GUI::MainWindowPy::script_Properties_scalarBarFontSize(id, type, obj_id, colName, m_fontSize); +} + +void MAINWINDOWAPI script_Properties_scalarBarNumLables(int id, char* type, int obj_id, + char* colName, int m_numLables) +{ + GUI::MainWindowPy::script_Properties_scalarBarNumLables(id, type, obj_id, colName, m_numLables); +} + +void MAINWINDOWAPI script_Properties_lineWidth(int id, char* type, int obj_id, int mLineWidth) +{ + GUI::MainWindowPy::script_Properties_lineWidth(id, type, obj_id, mLineWidth); +} + +void MAINWINDOWAPI script_Properties_pointSize(int id, char* type, int obj_id, int mPointSize) +{ + GUI::MainWindowPy::script_Properties_pointSize(id, type, obj_id, mPointSize); +} + +void MAINWINDOWAPI script_Properties_translate(int id, char* type, int obj_id, double x, double y, + double z) +{ + GUI::MainWindowPy::script_Properties_translate(id, type, obj_id, x, y, z); +} + +void MAINWINDOWAPI script_Properties_origin(int id, char* type, int obj_id, double x, double y, + double z) +{ + GUI::MainWindowPy::script_Properties_origin(id, type, obj_id, x, y, z); +} + +void MAINWINDOWAPI script_Properties_scale(int id, char* type, int obj_id, double x, double y, + double z) +{ + GUI::MainWindowPy::script_Properties_scale(id, type, obj_id, x, y, z); +} + +void MAINWINDOWAPI script_Properties_orientation(int id, char* type, int obj_id, double x, double y, + double z) +{ + GUI::MainWindowPy::script_Properties_orientation(id, type, obj_id, x, y, z); +} + +void MAINWINDOWAPI script_Properties_representation(int id, char* type, int obj_id, + int m_enum_representationtype) +{ + GUI::MainWindowPy::script_Properties_representation(id, type, obj_id, + m_enum_representationtype); +} + +void MAINWINDOWAPI script_Properties_specular(int id, char* type, int obj_id, double mSpecular) +{ + GUI::MainWindowPy::script_Properties_specular(id, type, obj_id, mSpecular); +} +////////////////// +void MAINWINDOWAPI script_Properties_diffuse(int id, char* type, int obj_id, double mDiffuse) +{ + GUI::MainWindowPy::script_Properties_diffuse(id, type, obj_id, mDiffuse); +} + +void MAINWINDOWAPI script_Properties_ambient(int id, char* type, int obj_id, double mAmbient) +{ + GUI::MainWindowPy::script_Properties_ambient(id, type, obj_id, mAmbient); +} + +void MAINWINDOWAPI script_Properties_specularPower(int id, char* type, int obj_id, + int mSpecularPower) +{ + GUI::MainWindowPy::script_Properties_specularPower(id, type, obj_id, mSpecularPower); +} + +void MAINWINDOWAPI script_Properties_specularColor(int id, char* type, int obj_id, int r, int g, + int b) +{ + GUI::MainWindowPy::script_Properties_specularColor(id, type, obj_id, r, g, b); +} + +void MAINWINDOWAPI script_Properties_solidColor(int id, char* type, int obj_id, int r, int g, int b) +{ + GUI::MainWindowPy::script_Properties_solidColor(id, type, obj_id, r, g, b); +} + +void MAINWINDOWAPI script_Properties_edgeColor(int id, char* type, int obj_id, int r, int g, int b) +{ + GUI::MainWindowPy::script_Properties_edgeColor(id, type, obj_id, r, g, b); +} + +void MAINWINDOWAPI script_Properties_interpolation(int id, char* type, int obj_id, + int m_enum_interpolationtype) +{ + GUI::MainWindowPy::script_Properties_interpolation(id, type, obj_id, m_enum_interpolationtype); +} + +void MAINWINDOWAPI script_Properties_Flag_scalarBar(int id, char* type, int obj_id, + char* mColorColumnStyle) +{ + GUI::MainWindowPy::script_Properties_Flag_scalarBar(id, type, obj_id, mColorColumnStyle); +} + +void MAINWINDOWAPI script_Properties_EnableOpacityMap(int id, char* type, int obj_id, bool val) +{ + GUI::MainWindowPy::script_Properties_EnableOpacityMap(id, type, obj_id, val); +} + +void MAINWINDOWAPI script_Properties_visible(int id, char* type, int obj_id, bool flag_show_actors) +{ + GUI::MainWindowPy::script_Properties_visible(id, type, obj_id, flag_show_actors); +} + +void MAINWINDOWAPI script_Properties_show_scalarBars(int id, char* type, int obj_id, + bool mScalarBarVisible) +{ + GUI::MainWindowPy::script_Properties_show_scalarBars(id, type, obj_id, mScalarBarVisible); +} + +void MAINWINDOWAPI script_Properties_show_cubeAxes(int id, char* type, int obj_id, + bool flag_cubeAxes) +{ + GUI::MainWindowPy::script_Properties_show_cubeAxes(id, type, obj_id, flag_cubeAxes); +} + +void MAINWINDOWAPI script_Properties_scalarBarPosition(int id, char* type, int obj_id, + char* colName, int tep_orietation, + double pos0, double pos1, double pos2, + double pos3) +{ + GUI::MainWindowPy::script_Properties_scalarBarPosition(id, type, obj_id, colName, + tep_orietation, pos0, pos1, pos2, pos3); +} + +void MAINWINDOWAPI script_FilterClip(int id, char* type, int obj_id) +{ + GUI::MainWindowPy::script_FilterClip(id, type, obj_id); +} + +void MAINWINDOWAPI script_FilterSlice(int id, char* type, int obj_id) +{ + GUI::MainWindowPy::script_FilterSlice(id, type, obj_id); +} + +void MAINWINDOWAPI script_FilterContour(int id, char* type, int obj_id) +{ + GUI::MainWindowPy::script_FilterContour(id, type, obj_id); +} + +void MAINWINDOWAPI script_FilterVector(int id, char* type, int obj_id) +{ + GUI::MainWindowPy::script_FilterVector(id, type, obj_id); +} + +void MAINWINDOWAPI script_FilterReflection(int id, char* type, int obj_id) +{ + GUI::MainWindowPy::script_FilterReflection(id, type, obj_id); +} + +void MAINWINDOWAPI script_FilterSmooth(int id, char* type, int obj_id) +{ + GUI::MainWindowPy::script_FilterSmooth(id, type, obj_id); +} + +void MAINWINDOWAPI script_FilterStreamLine(int id, char* type, int obj_id) +{ + GUI::MainWindowPy::script_FilterStreamLine(id, type, obj_id); +} + +void MAINWINDOWAPI script_Properties_vector_GlyphVector(int id, char* type, int obj_id, char* val) +{ + GUI::MainWindowPy::script_Properties_vector_GlyphVector(id, type, obj_id, val); +} + +void MAINWINDOWAPI script_Properties_vector_scalar(int id, char* type, int obj_id, char* val) +{ + GUI::MainWindowPy::script_Properties_vector_scalar(id, type, obj_id, val); +} + +void MAINWINDOWAPI script_Properties_vector_normal(int id, char* type, int obj_id, char* val) +{ + GUI::MainWindowPy::script_Properties_vector_normal(id, type, obj_id, val); +} + +void MAINWINDOWAPI script_Properties_vector_numPoints(int id, char* type, int obj_id, int val) +{ + GUI::MainWindowPy::script_Properties_vector_numPoints(id, type, obj_id, val); +} + +void MAINWINDOWAPI script_Properties_vector_glyph_type(int id, char* type, int obj_id, int val) +{ + GUI::MainWindowPy::script_Properties_vector_glyph_type(id, type, obj_id, val); +} + +void MAINWINDOWAPI script_Properties_vector_glyph_tipRes(int id, char* type, int obj_id, int val) +{ + GUI::MainWindowPy::script_Properties_vector_glyph_tipRes(id, type, obj_id, val); +} + +void MAINWINDOWAPI script_Properties_vector_glyph_tipRad(int id, char* type, int obj_id, double val) +{ + GUI::MainWindowPy::script_Properties_vector_glyph_tipRad(id, type, obj_id, val); +} + +void MAINWINDOWAPI script_Properties_vector_glyph_tipLen(int id, char* type, int obj_id, double val) +{ + GUI::MainWindowPy::script_Properties_vector_glyph_tipLen(id, type, obj_id, val); +} + +void MAINWINDOWAPI script_Properties_vector_glyph_shaftRes(int id, char* type, int obj_id, int val) +{ + GUI::MainWindowPy::script_Properties_vector_glyph_shaftRes(id, type, obj_id, val); +} + +void MAINWINDOWAPI script_Properties_vector_glyph_shaftRad(int id, char* type, int obj_id, + double val) +{ + GUI::MainWindowPy::script_Properties_vector_glyph_shaftRad(id, type, obj_id, val); +} + +void MAINWINDOWAPI script_Properties_view_backgroundType(int id, char* type, int val) +{ + GUI::MainWindowPy::script_Properties_view_backgroundType(id, type, val); +} + +void MAINWINDOWAPI script_Properties_view_backgroundColor(int id, char* type, int red, int green, + int blue) +{ + GUI::MainWindowPy::script_Properties_view_backgroundColor(id, type, red, green, blue); +} + +void MAINWINDOWAPI script_Properties_view_background2Color(int id, char* type, int red, int green, + int blue) +{ + GUI::MainWindowPy::script_Properties_view_background2Color(id, type, red, green, blue); +} + +void MAINWINDOWAPI script_Properties_view_axesVisible(int id, char* type, int a) +{ + GUI::MainWindowPy::script_Properties_view_axesVisible(id, type, a); +} + +void MAINWINDOWAPI script_Properties_view_cameraParallel(int id, char* type, int a) +{ + GUI::MainWindowPy::script_Properties_view_cameraParallel(id, type, a); +} + +void MAINWINDOWAPI script_Properties_view_interaction(int id, char* type, int a) +{ + GUI::MainWindowPy::script_Properties_view_interaction(id, type, a); +} + +void MAINWINDOWAPI script_Properties_renderView(int id, char* type) +{ + GUI::MainWindowPy::script_Properties_renderView(id, type); +} + +void MAINWINDOWAPI script_Camera_Position(int id, char* type, double pos0, double pos1, double pos2) +{ + GUI::MainWindowPy::script_Camera_Position(id, type, pos0, pos1, pos2); +} + +void MAINWINDOWAPI script_Camera_FocalPoint(int id, char* type, double focalPoint0, + double focalPoint1, double focalPoint2) +{ + GUI::MainWindowPy::script_Camera_FocalPoint(id, type, focalPoint0, focalPoint1, focalPoint2); +} + +void MAINWINDOWAPI script_Camera_ClippingRange(int id, char* type, double clippingRange0, + double clippingRange1) +{ + GUI::MainWindowPy::script_Camera_ClippingRange(id, type, clippingRange0, clippingRange1); +} + +void MAINWINDOWAPI script_Camera_ViewUp(int id, char* type, double viewup0, double viewup1, + double viewup2) +{ + GUI::MainWindowPy::script_Camera_ViewUp(id, type, viewup0, viewup1, viewup2); +} + +void MAINWINDOWAPI script_Camera_ViewAngle(int id, char* type, double angle) +{ + GUI::MainWindowPy::script_Camera_ViewAngle(id, type, angle); +} + +void MAINWINDOWAPI script_Camera_Zoom(int id, char* type, double zoom) +{ + GUI::MainWindowPy::script_Camera_Zoom(id, type, zoom); +} + +void MAINWINDOWAPI script_Camera_Reset(int id, char* type) +{ + GUI::MainWindowPy::script_Camera_Reset(id, type); +} + +void MAINWINDOWAPI script_Properties_planeOrigin(int id, char* type, int obj_id, double x, double y, + double z) +{ + GUI::MainWindowPy::script_Properties_planeOrigin(id, type, obj_id, x, y, z); +} + +void MAINWINDOWAPI script_Properties_planeNormal(int id, char* type, int obj_id, double x, double y, + double z) +{ + GUI::MainWindowPy::script_Properties_planeNormal(id, type, obj_id, x, y, z); +} + +void MAINWINDOWAPI script_Properties_planeVisible(int id, char* type, int obj_id, int a) +{ + GUI::MainWindowPy::script_Properties_planeVisible(id, type, obj_id, a); +} + +void MAINWINDOWAPI script_Properties_insideOut(int id, char* type, int obj_id, int a) +{ + GUI::MainWindowPy::script_Properties_insideOut(id, type, obj_id, a); +} + +void MAINWINDOWAPI script_Properties_contourColumn(int id, char* type, int obj_id, char* val) +{ + GUI::MainWindowPy::script_Properties_contourColumn(id, type, obj_id, val); +} + +void MAINWINDOWAPI script_Properties_contourValue(int id, char* type, int obj_id, double val) +{ + GUI::MainWindowPy::script_Properties_contourValue(id, type, obj_id, val); +} + +void MAINWINDOWAPI script_Properties_contour_reflection(int id, char* type, int obj_id, int aaa) +{ + GUI::MainWindowPy::script_Properties_contour_reflection(id, type, obj_id, aaa); +} + +void MAINWINDOWAPI script_Properties_contour_reflectionAxes(int id, char* type, int obj_id, int val) +{ + GUI::MainWindowPy::script_Properties_contour_reflectionAxes(id, type, obj_id, val); +} + +void MAINWINDOWAPI script_Properties_reflectionAxes(int id, char* type, int obj_id, + int reflection_axis) +{ + GUI::MainWindowPy::script_Properties_reflectionAxes(id, type, obj_id, reflection_axis); +} + +void MAINWINDOWAPI script_Properties_smooth(int id, char* type, int obj_id, int smotype, + double coef) +{ + GUI::MainWindowPy::script_Properties_smooth(id, type, obj_id, smotype, coef); +} + +void MAINWINDOWAPI script_Properties_streamline_vector(int id, char* type, int obj_id, char* val) +{ + GUI::MainWindowPy::script_Properties_streamline_vector(id, type, obj_id, val); +} + +void MAINWINDOWAPI script_Properties_streamline_integration_direction(int id, char* type, + int obj_id, int val) +{ + GUI::MainWindowPy::script_Properties_streamline_integration_direction(id, type, obj_id, val); +} + +void MAINWINDOWAPI script_Properties_streamline_integration_type(int id, char* type, int obj_id, + int val) +{ + GUI::MainWindowPy::script_Properties_streamline_integration_type(id, type, obj_id, val); +} + +void MAINWINDOWAPI script_Properties_streamline_integration_stepUnit(int id, char* type, int obj_id, + int val) +{ + GUI::MainWindowPy::script_Properties_streamline_integration_stepUnit(id, type, obj_id, val); +} + +void MAINWINDOWAPI script_Properties_streamline_integration_initStepLen(int id, char* type, + int obj_id, double val) +{ + GUI::MainWindowPy::script_Properties_streamline_integration_initStepLen(id, type, obj_id, val); +} + +void MAINWINDOWAPI script_Properties_streamline_integration_miniStepLen(int id, char* type, + int obj_id, double val) +{ + GUI::MainWindowPy::script_Properties_streamline_integration_miniStepLen(id, type, obj_id, val); +} + +void MAINWINDOWAPI script_Properties_streamline_integration_maxiStepLen(int id, char* type, + int obj_id, double val) +{ + GUI::MainWindowPy::script_Properties_streamline_integration_maxiStepLen(id, type, obj_id, val); +} + +void MAINWINDOWAPI script_Properties_streamline_stream_maxiSteps(int id, char* type, int obj_id, + int val) +{ + GUI::MainWindowPy::script_Properties_streamline_stream_maxiSteps(id, type, obj_id, val); +} + +void MAINWINDOWAPI script_Properties_streamline_stream_maxiStreamLen(int id, char* type, int obj_id, + double val) +{ + GUI::MainWindowPy::script_Properties_streamline_stream_maxiStreamLen(id, type, obj_id, val); +} + +void MAINWINDOWAPI script_Properties_streamline_stream_terminalSpeed(int id, char* type, int obj_id, + double val) +{ + GUI::MainWindowPy::script_Properties_streamline_stream_terminalSpeed(id, type, obj_id, val); +} + +void MAINWINDOWAPI script_Properties_streamline_stream_maxiError(int id, char* type, int obj_id, + double val) +{ + GUI::MainWindowPy::script_Properties_streamline_stream_maxiError(id, type, obj_id, val); +} + +void MAINWINDOWAPI script_Properties_streamline_seeds_type(int id, char* type, int obj_id, int val) +{ + GUI::MainWindowPy::script_Properties_streamline_seeds_type(id, type, obj_id, val); +} + +void MAINWINDOWAPI script_Properties_streamline_seeds_mPoint(int id, char* type, int obj_id, + double val0, double val1, double val2) +{ + GUI::MainWindowPy::script_Properties_streamline_seeds_mPoint(id, type, obj_id, val0, val1, + val2); +} + +void MAINWINDOWAPI script_Properties_streamline_seeds_num_points(int id, char* type, int obj_id, + int val) +{ + GUI::MainWindowPy::script_Properties_streamline_seeds_num_points(id, type, obj_id, val); +} + +void MAINWINDOWAPI script_Properties_streamline_seeds_radius(int id, char* type, int obj_id, + double val) +{ + GUI::MainWindowPy::script_Properties_streamline_seeds_radius(id, type, obj_id, val); +} + +void MAINWINDOWAPI script_Properties_streamline_vorticity(int id, char* type, int obj_id, bool val) +{ + GUI::MainWindowPy::script_Properties_streamline_vorticity(id, type, obj_id, val); +} + +void MAINWINDOWAPI script_Properties_streamline_interpolatorType(int id, char* type, int obj_id, + int val) +{ + GUI::MainWindowPy::script_Properties_streamline_interpolatorType(id, type, obj_id, val); +} + +void MAINWINDOWAPI script_Properties_streamline_surface_streamLines(int id, char* type, int obj_id, + bool val) +{ + GUI::MainWindowPy::script_Properties_streamline_surface_streamLines(id, type, obj_id, val); +} + +void MAINWINDOWAPI script_Properties_streamline_reflection(int id, char* type, int obj_id, bool val) +{ + GUI::MainWindowPy::script_Properties_streamline_reflection(id, type, obj_id, val); +} + +void MAINWINDOWAPI script_Properties_streamline_reflectionAxes(int id, char* type, int obj_id, + int val) +{ + GUI::MainWindowPy::script_Properties_streamline_reflectionAxes(id, type, obj_id, val); +} + +/* +void MAINWINDOWAPI showFastCAE() +{ + GUI::MainWindowPy::showFastCAE(); +}*/ + +void MAINWINDOWAPI undo() +{ + GUI::MainWindowPy::undo(); +} + +void MAINWINDOWAPI redo() +{ + GUI::MainWindowPy::redo(); +} + +void MAINWINDOWAPI clearData() +{ + GUI::MainWindowPy::clearData(); +} + +void MAINWINDOWAPI updateInterface() +{ + GUI::MainWindowPy::updateInterface(); +} + +void MAINWINDOWAPI createVTKTransform(char* componentIds, char* rotate, char* moveLocation, + char* scale) +{ + GUI::MainWindowPy::createVTKTransform(componentIds, rotate, moveLocation, scale); +} + +void MAINWINDOWAPI findConplanarPorC(const char* seedType, int seedId, double minAngle, + int kernalId, const char* setName) +{ + GUI::MainWindowPy::findConplanarPorC(seedType, seedId, minAngle, kernalId, setName); +} +void MAINWINDOWAPI deleteGeometry(int id) +{ + GUI::MainWindowPy::deleteGeometry(id); +} diff --git a/src/MainWindow/MainWindowPy.h b/src/MainWindow/MainWindowPy.h new file mode 100644 index 0000000..eb16cfd --- /dev/null +++ b/src/MainWindow/MainWindowPy.h @@ -0,0 +1,400 @@ +#ifndef _PYMAINWINDOW_H_glyph_shaftRes +#define _PYMAINWINDOW_H_ + +#include "MainWindowAPI.h" + +namespace Py { + class PythonAgent; +} + +namespace GUI { + class MainWindow; + class SignalHandler; + class SubWindowManager; + + /** + * @brief 封装C++为C函数,最后提供Python接口 + * @since 2.5.0 + */ + class MAINWINDOWAPI MainWindowPy { + public: + // static void showFastCAE(); + static void undo(); + static void redo(); + static void init(GUI::MainWindow* m, GUI::SignalHandler* sg); + static void clearData(); + static void importMesh(char* f, char* s, int modelId); + static void exportMesh(char* f, char* s, int modelId); + static void importGeometry(char* f); + static void exportGeometry(char* f); + static void openProjectFile(char* f); + static void saveProjectFile(char* f); + static void openPost2D(); + static void openPost3D(); + static void openPreWindow(); + static void saveImage(int w, int h, int id, char* win, char* file); + static void setView(int id, char* win, char* view); + static void setViewRandValue(int id, char* win, int x1, int x2, int x3, int y1, int y2, + int y3, int z1, int z2, int z3); + static void quit(); + static void solveProject(int projectIndex, int solverIndex); + static void createSet(const char* name, const char* type, const char* idstring); + static void createGeoComponent(char* name, char* type, char* strgIDs, char* striIDs); + static void createVTKTransform(const char* componentIds, const char* rotate, + const char* moveLocation, const char* scale); + static void findConplanarPorC(const char* seedType, int seedId, double minAngle, + int kernalId, const char* setName); + static void updateInterface(); + + static void script_openFile(int id, char* type, char* file); + static void script_applyClicked(int id, char* type); + static void script_Properties_Opacity(int id, char* type, int obj_id, double mOpacity); + static void script_Properties_colorColumn(int id, char* type, int obj_id, + char* mColorColumnStyle); + static void script_Properties_scalarBarTitle(int id, char* type, int obj_id, char* colName, + char* m_title); + static void script_Properties_scalarBarFontSize(int id, char* type, int obj_id, + char* colName, int m_fontSize); + static void script_Properties_scalarBarNumLables(int id, char* type, int obj_id, + char* colName, int m_numLables); + static void script_Properties_lineWidth(int id, char* type, int obj_id, int mLineWidth); + static void script_Properties_pointSize(int id, char* type, int obj_id, int mPointSize); + static void script_Properties_translate(int id, char* type, int obj_id, double x, double y, + double z); + static void script_Properties_origin(int id, char* type, int obj_id, double x, double y, + double z); + static void script_Properties_scale(int id, char* type, int obj_id, double x, double y, + double z); + static void script_Properties_orientation(int id, char* type, int obj_id, double x, + double y, double z); + static void script_Properties_representation(int id, char* type, int obj_id, + int m_enum_representationtype); + static void script_Properties_specular(int id, char* type, int obj_id, double mSpecular); + + static void script_Properties_diffuse(int id, char* type, int obj_id, double mDiffuse); + static void script_Properties_ambient(int id, char* type, int obj_id, double mAmbient); + static void script_Properties_specularPower(int id, char* type, int obj_id, + int mSpecularPower); + static void script_Properties_specularColor(int id, char* type, int obj_id, int r, int g, + int b); + static void script_Properties_solidColor(int id, char* type, int obj_id, int r, int g, + int b); + static void script_Properties_edgeColor(int id, char* type, int obj_id, int r, int g, + int b); + static void script_Properties_interpolation(int id, char* type, int obj_id, + int m_enum_interpolationtype); + static void script_Properties_Flag_scalarBar(int id, char* type, int obj_id, + char* mColorColumnStyle); + static void script_Properties_EnableOpacityMap(int id, char* type, int obj_id, bool val); + static void script_Properties_visible(int id, char* type, int obj_id, + bool flag_show_actors); + static void script_Properties_show_scalarBars(int id, char* type, int obj_id, + bool mScalarBarVisible); + static void script_Properties_show_cubeAxes(int id, char* type, int obj_id, + bool flag_cubeAxes); + static void script_Properties_scalarBarPosition(int id, char* type, int obj_id, + char* colName, int tep_orietation, + double pos0, double pos1, double pos2, + double pos3); + + static void script_FilterClip(int id, char* type, int obj_id); + static void script_FilterSlice(int id, char* type, int obj_id); + static void script_FilterContour(int id, char* type, int obj_id); + static void script_FilterVector(int id, char* type, int obj_id); + static void script_FilterReflection(int id, char* type, int obj_id); + static void script_FilterSmooth(int id, char* type, int obj_id); + static void script_FilterStreamLine(int id, char* type, int obj_id); + + static void script_Properties_vector_GlyphVector(int id, char* type, int obj_id, char* val); + static void script_Properties_vector_scalar(int id, char* type, int obj_id, char* val); + static void script_Properties_vector_normal(int id, char* type, int obj_id, char* val); + static void script_Properties_vector_numPoints(int id, char* type, int obj_id, int val); + static void script_Properties_vector_glyph_type(int id, char* type, int obj_id, int val); + static void script_Properties_vector_glyph_tipRes(int id, char* type, int obj_id, int val); + static void script_Properties_vector_glyph_tipRad(int id, char* type, int obj_id, + double val); + static void script_Properties_vector_glyph_tipLen(int id, char* type, int obj_id, + double val); + static void script_Properties_vector_glyph_shaftRes(int id, char* type, int obj_id, + int val); + static void script_Properties_vector_glyph_shaftRad(int id, char* type, int obj_id, + double val); + + /// + static void script_Properties_view_backgroundType(int id, char* type, int val); + static void script_Properties_view_backgroundColor(int id, char* type, int red, int green, + int blue); + static void script_Properties_view_background2Color(int id, char* type, int red, int green, + int blue); + static void script_Properties_view_axesVisible(int id, char* type, int a); + static void script_Properties_view_cameraParallel(int id, char* type, int a); + static void script_Properties_view_interaction(int id, char* type, int a); + static void script_Properties_renderView(int id, char* type); + + static void script_Camera_Position(int id, char* type, double pos0, double pos1, + double pos2); + static void script_Camera_FocalPoint(int id, char* type, double focalPoint0, + double focalPoint1, double focalPoint2); + static void script_Camera_ClippingRange(int id, char* type, double clippingRange0, + double clippingRange1); + static void script_Camera_ViewUp(int id, char* type, double viewup0, double viewup1, + double viewup2); + static void script_Camera_ViewAngle(int id, char* type, double angle); + static void script_Camera_Zoom(int id, char* type, double zoom); + static void script_Camera_Reset(int id, char* type); + + static void script_Properties_planeOrigin(int id, char* type, int obj_id, double x, + double y, double z); + static void script_Properties_planeNormal(int id, char* type, int obj_id, double x, + double y, double z); + static void script_Properties_planeVisible(int id, char* type, int obj_id, int a); + static void script_Properties_insideOut(int id, char* type, int obj_id, int a); + + static void script_Properties_contourColumn(int id, char* type, int obj_id, char* val); + static void script_Properties_contourValue(int id, char* type, int obj_id, double val); + static void script_Properties_contour_reflection(int id, char* type, int obj_id, int aaa); + static void script_Properties_contour_reflectionAxes(int id, char* type, int obj_id, + int val); + + static void script_Properties_reflectionAxes(int id, char* type, int obj_id, + int reflection_axis); + + static void script_Properties_smooth(int id, char* type, int obj_id, int smotype, + double coef); + + static void script_Properties_streamline_vector(int id, char* type, int obj_id, char* val); + static void script_Properties_streamline_integration_direction(int id, char* type, + int obj_id, int val); + static void script_Properties_streamline_integration_type(int id, char* type, int obj_id, + int val); + static void script_Properties_streamline_integration_stepUnit(int id, char* type, + int obj_id, int val); + static void script_Properties_streamline_integration_initStepLen(int id, char* type, + int obj_id, double val); + static void script_Properties_streamline_integration_miniStepLen(int id, char* type, + int obj_id, double val); + static void script_Properties_streamline_integration_maxiStepLen(int id, char* type, + int obj_id, double val); + static void script_Properties_streamline_stream_maxiSteps(int id, char* type, int obj_id, + int val); + static void script_Properties_streamline_stream_maxiStreamLen(int id, char* type, + int obj_id, double val); + static void script_Properties_streamline_stream_terminalSpeed(int id, char* type, + int obj_id, double val); + static void script_Properties_streamline_stream_maxiError(int id, char* type, int obj_id, + double val); + static void script_Properties_streamline_seeds_type(int id, char* type, int obj_id, + int val); + static void script_Properties_streamline_seeds_mPoint(int id, char* type, int obj_id, + double val0, double val1, + double val2); + static void script_Properties_streamline_seeds_num_points(int id, char* type, int obj_id, + int val); + static void script_Properties_streamline_seeds_radius(int id, char* type, int obj_id, + double val); + static void script_Properties_streamline_vorticity(int id, char* type, int obj_id, + bool val); + static void script_Properties_streamline_interpolatorType(int id, char* type, int obj_id, + int val); + static void script_Properties_streamline_surface_streamLines(int id, char* type, int obj_id, + bool val); + static void script_Properties_streamline_reflection(int id, char* type, int obj_id, + bool val); + static void script_Properties_streamline_reflectionAxes(int id, char* type, int obj_id, + int val); + static void deleteGeometry(int id); + + private: + static MainWindow* _mainWindow; + static SignalHandler* _signalHander; + static SubWindowManager* _subWindowManager; + static Py::PythonAgent* _pyAgent; + }; +} // namespace GUI + +// 声明为C接口,供Python脚本调用 +extern "C" { +// void MAINWINDOWAPI showFastCAE(); +void MAINWINDOWAPI undo(); +void MAINWINDOWAPI redo(); +void MAINWINDOWAPI clearData(); +void MAINWINDOWAPI importMesh(char* f, char* s, int modelId); +void MAINWINDOWAPI exportMesh(char* f, char* s, int modelId); +void MAINWINDOWAPI importGeometry(char* f); +void MAINWINDOWAPI exportGeometry(char* f); +void MAINWINDOWAPI openProjectFile(char* f); +void MAINWINDOWAPI saveProjectFile(char* f); +void MAINWINDOWAPI updateInterface(); +void MAINWINDOWAPI quit(); +void MAINWINDOWAPI saveImage(int w, int h, int id, char* win, char* file); +void MAINWINDOWAPI setView(int id, char* win, char* view); // 设置特定视角 +void MAINWINDOWAPI setViewRandValue(int id, char* win, int x1, int x2, int x3, int y1, int y2, + int y3, int z1, int z2, int z3); // 后处理自由设置视角 +// void MAINWINDOWAPI setViewPreValue(int id, char*win, int x1, int x2, int x3, int y1, int y2, int +// y3, int z1, int z2, int z3);//前处理自由设置视角 +void MAINWINDOWAPI openPost3D(); // 打开3d窗口 +void MAINWINDOWAPI openPost2D(); // 打开2d窗口 +void MAINWINDOWAPI openPreWindow(); // 打开前处理窗口 +void MAINWINDOWAPI solveProject(int projectIndex, int solverIndex); // 求解 +void MAINWINDOWAPI createSet(char* name, char* type, char* idstring); +void MAINWINDOWAPI createGeoComponent(char* name, char* type, char* strgIDs, char* striIDs); +void MAINWINDOWAPI createVTKTransform(char* componentIds, char* rotate, char* moveLocation, + char* scale); +void MAINWINDOWAPI findConplanarPorC(const char* seedType, int seedId, double minAngle, + int kernalId, const char* setName); +void MAINWINDOWAPI script_openFile(int id, char* type, char* file); +void MAINWINDOWAPI script_applyClicked(int id, char* type); +void MAINWINDOWAPI script_Properties_Opacity(int id, char* type, int obj_id, double mOpacity); +void MAINWINDOWAPI script_Properties_colorColumn(int id, char* type, int obj_id, + char* mColorColumnStyle); +void MAINWINDOWAPI script_Properties_scalarBarTitle(int id, char* type, int obj_id, char* colName, + char* m_title); +void MAINWINDOWAPI script_Properties_scalarBarFontSize(int id, char* type, int obj_id, + char* colName, int m_fontSize); +void MAINWINDOWAPI script_Properties_scalarBarNumLables(int id, char* type, int obj_id, + char* colName, int m_numLables); +void MAINWINDOWAPI script_Properties_lineWidth(int id, char* type, int obj_id, int mLineWidth); +void MAINWINDOWAPI script_Properties_pointSize(int id, char* type, int obj_id, int mPointSize); +void MAINWINDOWAPI script_Properties_translate(int id, char* type, int obj_id, double x, double y, + double z); +void MAINWINDOWAPI script_Properties_origin(int id, char* type, int obj_id, double x, double y, + double z); +void MAINWINDOWAPI script_Properties_scale(int id, char* type, int obj_id, double x, double y, + double z); +void MAINWINDOWAPI script_Properties_orientation(int id, char* type, int obj_id, double x, double y, + double z); +void MAINWINDOWAPI script_Properties_representation(int id, char* type, int obj_id, + int m_enum_representationtype); +void MAINWINDOWAPI script_Properties_specular(int id, char* type, int obj_id, double mSpecular); + +void MAINWINDOWAPI script_Properties_diffuse(int id, char* type, int obj_id, double mDiffuse); +void MAINWINDOWAPI script_Properties_ambient(int id, char* type, int obj_id, double mAmbient); +void MAINWINDOWAPI script_Properties_specularPower(int id, char* type, int obj_id, + int mSpecularPower); +void MAINWINDOWAPI script_Properties_specularColor(int id, char* type, int obj_id, int r, int g, + int b); +void MAINWINDOWAPI script_Properties_solidColor(int id, char* type, int obj_id, int r, int g, + int b); +void MAINWINDOWAPI script_Properties_edgeColor(int id, char* type, int obj_id, int r, int g, int b); +void MAINWINDOWAPI script_Properties_interpolation(int id, char* type, int obj_id, + int m_enum_interpolationtype); +void MAINWINDOWAPI script_Properties_Flag_scalarBar(int id, char* type, int obj_id, + char* mColorColumnStyle); +void MAINWINDOWAPI script_Properties_EnableOpacityMap(int id, char* type, int obj_id, bool val); +void MAINWINDOWAPI script_Properties_visible(int id, char* type, int obj_id, bool flag_show_actors); +void MAINWINDOWAPI script_Properties_show_scalarBars(int id, char* type, int obj_id, + bool mScalarBarVisible); +void MAINWINDOWAPI script_Properties_show_cubeAxes(int id, char* type, int obj_id, + bool flag_cubeAxes); +void MAINWINDOWAPI script_Properties_scalarBarPosition(int id, char* type, int obj_id, + char* colName, int tep_orietation, + double pos0, double pos1, double pos2, + double pos3); + +void MAINWINDOWAPI script_FilterClip(int id, char* type, int obj_id); +void MAINWINDOWAPI script_FilterSlice(int id, char* type, int obj_id); +void MAINWINDOWAPI script_FilterContour(int id, char* type, int obj_id); +void MAINWINDOWAPI script_FilterVector(int id, char* type, int obj_id); +void MAINWINDOWAPI script_FilterReflection(int id, char* type, int obj_id); +void MAINWINDOWAPI script_FilterSmooth(int id, char* type, int obj_id); +void MAINWINDOWAPI script_FilterStreamLine(int id, char* type, int obj_id); +// 1212 +void MAINWINDOWAPI script_Properties_vector_GlyphVector(int id, char* type, int obj_id, char* val); +void MAINWINDOWAPI script_Properties_vector_scalar(int id, char* type, int obj_id, char* val); +void MAINWINDOWAPI script_Properties_vector_normal(int id, char* type, int obj_id, char* val); +void MAINWINDOWAPI script_Properties_vector_numPoints(int id, char* type, int obj_id, int val); +void MAINWINDOWAPI script_Properties_vector_glyph_type(int id, char* type, int obj_id, int val); +void MAINWINDOWAPI script_Properties_vector_glyph_tipRes(int id, char* type, int obj_id, int val); +void MAINWINDOWAPI script_Properties_vector_glyph_tipRad(int id, char* type, int obj_id, + double val); +void MAINWINDOWAPI script_Properties_vector_glyph_tipLen(int id, char* type, int obj_id, + double val); +void MAINWINDOWAPI script_Properties_vector_glyph_shaftRes(int id, char* type, int obj_id, int val); +void MAINWINDOWAPI script_Properties_vector_glyph_shaftRad(int id, char* type, int obj_id, + double val); + +/// + +void MAINWINDOWAPI script_Properties_view_backgroundType(int id, char* type, int val); +void MAINWINDOWAPI script_Properties_view_backgroundColor(int id, char* type, int red, int green, + int blue); +void MAINWINDOWAPI script_Properties_view_background2Color(int id, char* type, int red, int green, + int blue); +void MAINWINDOWAPI script_Properties_view_axesVisible(int id, char* type, int a); +void MAINWINDOWAPI script_Properties_view_cameraParallel(int id, char* type, int a); +void MAINWINDOWAPI script_Properties_view_interaction(int id, char* type, int a); +void MAINWINDOWAPI script_Properties_renderView(int id, char* type); + +void MAINWINDOWAPI script_Camera_Position(int id, char* type, double pos0, double pos1, + double pos2); +void MAINWINDOWAPI script_Camera_FocalPoint(int id, char* type, double focalPoint0, + double focalPoint1, double focalPoint2); +void MAINWINDOWAPI script_Camera_ClippingRange(int id, char* type, double clippingRange0, + double clippingRange1); +void MAINWINDOWAPI script_Camera_ViewUp(int id, char* type, double viewup0, double viewup1, + double viewup2); +void MAINWINDOWAPI script_Camera_ViewAngle(int id, char* type, double angle); +void MAINWINDOWAPI script_Camera_Zoom(int id, char* type, double zoom); +void MAINWINDOWAPI script_Camera_Reset(int id, char* type); + +void MAINWINDOWAPI script_Properties_planeOrigin(int id, char* type, int obj_id, double x, double y, + double z); +void MAINWINDOWAPI script_Properties_planeNormal(int id, char* type, int obj_id, double x, double y, + double z); +void MAINWINDOWAPI script_Properties_planeVisible(int id, char* type, int obj_id, int a); +void MAINWINDOWAPI script_Properties_insideOut(int id, char* type, int obj_id, int a); + +void MAINWINDOWAPI script_Properties_contourColumn(int id, char* type, int obj_id, char* val); +void MAINWINDOWAPI script_Properties_contourValue(int id, char* type, int obj_id, double val); +void MAINWINDOWAPI script_Properties_contour_reflection(int id, char* type, int obj_id, int aaa); +void MAINWINDOWAPI script_Properties_contour_reflectionAxes(int id, char* type, int obj_id, + int val); +; + +void MAINWINDOWAPI script_Properties_reflectionAxes(int id, char* type, int obj_id, + int reflection_axis); + +void MAINWINDOWAPI script_Properties_smooth(int id, char* type, int obj_id, int smotype, + double coef); + +void MAINWINDOWAPI script_Properties_streamline_vector(int id, char* type, int obj_id, char* val); +void MAINWINDOWAPI script_Properties_streamline_integration_direction(int id, char* type, + int obj_id, int val); +void MAINWINDOWAPI script_Properties_streamline_integration_type(int id, char* type, int obj_id, + int val); +void MAINWINDOWAPI script_Properties_streamline_integration_stepUnit(int id, char* type, int obj_id, + int val); +void MAINWINDOWAPI script_Properties_streamline_integration_initStepLen(int id, char* type, + int obj_id, double val); +void MAINWINDOWAPI script_Properties_streamline_integration_miniStepLen(int id, char* type, + int obj_id, double val); +void MAINWINDOWAPI script_Properties_streamline_integration_maxiStepLen(int id, char* type, + int obj_id, double val); +void MAINWINDOWAPI script_Properties_streamline_stream_maxiSteps(int id, char* type, int obj_id, + int val); +void MAINWINDOWAPI script_Properties_streamline_stream_maxiStreamLen(int id, char* type, int obj_id, + double val); +void MAINWINDOWAPI script_Properties_streamline_stream_terminalSpeed(int id, char* type, int obj_id, + double val); +void MAINWINDOWAPI script_Properties_streamline_stream_maxiError(int id, char* type, int obj_id, + double val); +void MAINWINDOWAPI script_Properties_streamline_seeds_type(int id, char* type, int obj_id, int val); +void MAINWINDOWAPI script_Properties_streamline_seeds_mPoint(int id, char* type, int obj_id, + double val0, double val1, double val2); +void MAINWINDOWAPI script_Properties_streamline_seeds_num_points(int id, char* type, int obj_id, + int val); +void MAINWINDOWAPI script_Properties_streamline_seeds_radius(int id, char* type, int obj_id, + double val); +void MAINWINDOWAPI script_Properties_streamline_vorticity(int id, char* type, int obj_id, bool val); +void MAINWINDOWAPI script_Properties_streamline_interpolatorType(int id, char* type, int obj_id, + int val); +void MAINWINDOWAPI script_Properties_streamline_surface_streamLines(int id, char* type, int obj_id, + bool val); +void MAINWINDOWAPI script_Properties_streamline_reflection(int id, char* type, int obj_id, + bool val); +void MAINWINDOWAPI script_Properties_streamline_reflectionAxes(int id, char* type, int obj_id, + int val); +void MAINWINDOWAPI deleteGeometry(int id); +} + +#endif \ No newline at end of file diff --git a/src/mainWindow/SARibbonMWUi.cpp b/src/MainWindow/SARibbonMWUi.cpp similarity index 100% rename from src/mainWindow/SARibbonMWUi.cpp rename to src/MainWindow/SARibbonMWUi.cpp diff --git a/src/MainWindow/SARibbonMWUi.h b/src/MainWindow/SARibbonMWUi.h new file mode 100644 index 0000000..bf6c630 --- /dev/null +++ b/src/MainWindow/SARibbonMWUi.h @@ -0,0 +1,73 @@ +#ifndef SARIBBONMWUI_H +#define SARIBBONMWUI_H + +#include "ui_MainWindow.h" + +class SARibbonCategory; +class SARibbonPannel; +class SARibbonContextCategory; +class SARibbonMainWindow; + +namespace Ui { + class MainWindowRibbon : public MainWindow { + public: + // 每个pannel相当于一个toolbar,pannel的命名方式是“第一个action_pannel” + SARibbonCategory* home_page{}; + SARibbonPannel* new_pannel{}; + SARibbonPannel* solve_pannel{}; + SARibbonPannel* import_mesh_pannel{}; + SARibbonPannel* import_geometry_pannel{}; + SARibbonPannel* exec_script_pannel{}; + SARibbonPannel* adapt_window_pannel_home{}; + SARibbonPannel* save_picture_pannel{}; + SARibbonPannel* plugin_manager_pannel{}; + SARibbonPannel* drawing_option_pannel_home{}; + + SARibbonCategory* geometry_page{}; + SARibbonPannel* sketch_pannel_geometry{}; + SARibbonPannel* cube_pannel{}; + SARibbonPannel* create_point_pannel{}; + SARibbonPannel* base_plate_pannel{}; + SARibbonPannel* sum_pannel{}; + SARibbonPannel* stretch_pannel{}; + SARibbonPannel* display_surface_pannel{}; + SARibbonPannel* clear_choice_pannel_geometry{}; + SARibbonPannel* segmentation_pannel{}; + SARibbonPannel* chamfer_pannel{}; + SARibbonPannel* measure_pannel{}; + SARibbonPannel* undo_redo_pannel_geometry{}; + + SARibbonCategory* mesh_page{}; + SARibbonPannel* surface_mesh_subdivision_pannel{}; + SARibbonPannel* mesh_quailty_examine_pannel{}; + SARibbonPannel* clear_choice_pannel_mesh{}; + SARibbonPannel* display_node_pannel{}; + SARibbonPannel* create_set_pannel{}; + + SARibbonCategory* solve_page{}; + SARibbonPannel* solver_management_pannel{}; + + SARibbonCategory* window_page{}; + SARibbonPannel* start_page_pannel{}; + SARibbonPannel* adapt_window_pannel_window{}; + SARibbonPannel* drawing_option_pannel_window{}; + + SARibbonCategory* help_page{}; + SARibbonPannel* user_guide_pannel{}; + + SARibbonContextCategory* sketch_tool_context{}; + SARibbonCategory* sketch_tool_page{}; + SARibbonPannel* sketch_pannel_sketch_tool{}; + SARibbonPannel* draw_line_pannel{}; + SARibbonPannel* undo_redo_pannel_sketch{}; + + SARibbonCategory* post_page{}; + SARibbonPannel* post_base_pannel{}; + SARibbonPannel* post_viewer_pannel{}; + SARibbonPannel* post_editor_pannel{}; + + void setupRibbonUi(QMainWindow* MainWindow); + void retranslateRibbonUi(QMainWindow* MainWindow); + }; +} // namespace Ui +#endif \ No newline at end of file diff --git a/src/mainWindow/signalHandler.cpp b/src/MainWindow/SignalHandler.cpp similarity index 57% rename from src/mainWindow/signalHandler.cpp rename to src/MainWindow/SignalHandler.cpp index 127b9d4..7b6c990 100644 --- a/src/mainWindow/signalHandler.cpp +++ b/src/MainWindow/SignalHandler.cpp @@ -1,192 +1,252 @@ -#include "signalHandler.h" -#include "SARibbonMWUi.h" -#include "MainWindow.h" -#include "solveProcessManager.h" -#include -#include -#include -#include -#include -#include -#include -#include "Settings/BusAPI.h" -#include "Settings/GraphOption.h" -#include "MeshData/meshKernal.h" -#include "ModelData/modelDataSingleton.h" -#include "ModelData/modelDataBase.h" -#include "Geometry/geometryData.h" -#include "Geometry/geometryExporter.h" -#include "MeshData/meshSingleton.h" -#include "IO/ProjectFileIO.h" +#include "SignalHandler.h" + +#include "Common/Types.h" #include "ConfigOptions/ConfigOptions.h" #include "ConfigOptions/ProjectTreeConfig.h" #include "ConfigOptions/SolverConfig.h" #include "DataProperty/modelTreeItemType.h" -#include "IO/SolverInfoWriter.h" +#include "Geometry/geometryData.h" +#include "Geometry/geometryExporter.h" +#include "GeometryCommand/GeoCommandImport.h" +#include "GeometryCommand/GeoCommandList.h" +#include "GeometryWidgets/dialogBoolOperation.h" +#include "GeometryWidgets/dialogCreateBox.h" +#include "GeometryWidgets/dialogCreateBoxComplex.h" +#include "GeometryWidgets/dialogCreateCone.h" +#include "GeometryWidgets/dialogCreateCylinder.h" +#include "GeometryWidgets/dialogCreateCylindricalComplex.h" +#include "GeometryWidgets/dialogCreateDatumplane.h" +#include "GeometryWidgets/dialogCreateFace.h" +#include "GeometryWidgets/dialogCreateLine.h" +#include "GeometryWidgets/dialogCreatePoint.h" +#include "GeometryWidgets/dialogCreateSphere.h" +#include "GeometryWidgets/dialogGeoSplitter.h" +#include "GeometryWidgets/dialogMakeChamfer.h" +#include "GeometryWidgets/dialogMakeExtrusion.h" +#include "GeometryWidgets/dialogMakeFillet.h" +#include "GeometryWidgets/dialogMakeFillGap.h" +#include "GeometryWidgets/dialogMakeFillHole.h" +#include "GeometryWidgets/dialogMakeLoft.h" +#include "GeometryWidgets/dialogMakeMatrix.h" +#include "GeometryWidgets/dialogMakeRemoveSurface.h" +#include "GeometryWidgets/dialogMakeRevol.h" +#include "GeometryWidgets/dialogMakeSweep.h" +#include "GeometryWidgets/dialogMeasureDistance.h" +#include "GeometryWidgets/dialogMirrorFeature.h" +#include "GeometryWidgets/dialogMoveFeature.h" +#include "GeometryWidgets/dialogRotateFeature.h" +#include "GeometryWidgets/dialogVariableFillet.h" +#include "GmshModule/GmshModule.h" #include "IO/IOConfig.h" -#include "SolverControl/SolverControlerBase.h" -#include "PostWidgets/RealTimeWindowBase.h" -#include "PostWidgets/Post2DInterface.h" -#include "PostWidgets/Post3DInterface.h" -#include "SubWindowManager.h" -#include "MainWidgets/preWindow.h" -#include "Material/MaterialSingletion.h" -#include "MainWidgets/DialogSelectMesher.h" -#include "MainWidgets/DialogSavePicture.h" -#include "MainWidgets/DialogMeshChecking.h" +#include "IO/ProjectFileIO.h" +#include "IO/SolverInfoWriter.h" #include "MainWidgets/ControlPanel.h" #include "MainWidgets/DialogGeoMeshRotate.h" -#include "PythonModule/PyAgent.h" -#include "PluginManager/PluginManager.h" -#include "PluginManager/pluginBase.h" -#include -#include "GeometryCommand/GeoCommandList.h" -#include "GeometryCommand/GeoCommandImport.h" -#include "GeometryWidgets/dialogCreateBox.h" -#include "GeometryWidgets/dialogCreateCylinder.h" -#include "GeometryWidgets/dialogCreateSphere.h" -#include "GeometryWidgets/dialogCreateCone.h" -#include "GeometryWidgets/dialogMakeFillet.h" -#include "GeometryWidgets/dialogMakeChamfer.h" -#include "GeometryWidgets/dialogBoolOperation.h" -#include "GeometryWidgets/dialogMirrorFeature.h" -#include "GeometryWidgets/dialogMakeExtrusion.h" -#include "GeometryWidgets/dialogVariableFillet.h" -#include "GeometryWidgets/dialogCreatePoint.h" -#include "GeometryWidgets/dialogCreateLine.h" -#include "GeometryWidgets/dialogCreateFace.h" -#include "GeometryWidgets/dialogMoveFeature.h" -#include "GeometryWidgets/dialogMakeRevol.h" -#include "GeometryWidgets/dialogRotateFeature.h" -#include "GeometryWidgets/dialogMakeLoft.h" -#include "GeometryWidgets/dialogCreateDatumplane.h" -#include "GeometryWidgets/dialogMakeSweep.h" -#include "GeometryWidgets/dialogMakeMatrix.h" -#include "GeometryWidgets/dialogCreateCylindricalComplex.h" -#include "GeometryWidgets/dialogCreateBoxComplex.h" -#include "GeometryWidgets/dialogMeasureDistance.h" -#include "GeometryWidgets/dialogGeoSplitter.h" -#include "GeometryWidgets/dialogMakeFillHole.h" -#include "GeometryWidgets/dialogMakeRemoveSurface.h" -#include "GeometryWidgets/dialogMakeFillGap.h" -#include "GmshModule/GmshModule.h" -#include "UserGuidence/DialogUserGuidence.h" +#include "MainWidgets/DialogMeshChecking.h" +#include "MainWidgets/DialogSavePicture.h" +#include "MainWidgets/DialogSelectMesher.h" +#include "MainWidgets/preWindow.h" +#include "MainWindow.h" +#include "Material/MaterialSingletion.h" +#include "MeshData/meshKernal.h" +#include "MeshData/meshSingleton.h" +#include "ModelData/modelDataBase.h" +#include "ModelData/modelDataSingleton.h" #include "ModuleBase/ThreadControl.h" -#include "PostWidgets/Post3DWidget.h" -#include "PostWidgets/Post2DWidget.h" -#include "PostInterface/DialogFileDirectory.h" -#include "PostInterface/DialogCreateVector.h" -#include "PostInterface/DialogCreateClip.h" -#include "PostInterface/DialogCreateStreamLine.h" -#include "PostInterface/DialogCreateISO.h" +#include "PluginManager/pluginBase.h" +#include "PluginManager/PluginManager.h" #include "PostInterface/DialogCreateCalculate.h" +#include "PostInterface/DialogCreateClip.h" +#include "PostInterface/DialogCreateISO.h" #include "PostInterface/DialogCreateReflection.h" -#include "PostInterface/GraphWidget.h" +#include "PostInterface/DialogCreateStreamLine.h" +#include "PostInterface/DialogCreateVector.h" +#include "PostInterface/DialogFileDirectory.h" #include "PostInterface/DialogSaveAnimation.h" -#include "PostInterface/PostTreeWidget.h" +#include "PostInterface/GraphWidget.h" #include "PostInterface/PostProcessPy.h" +#include "PostInterface/PostTreeWidget.h" #include "PostRenderData/RenderDataImportUnSteady.h" -#include -#include "Common/Types.h" +#include "PostWidgets/Post2DInterface.h" +#include "PostWidgets/Post2DWidget.h" +#include "PostWidgets/Post3DInterface.h" +#include "PostWidgets/Post3DWidget.h" +#include "PostWidgets/RealTimeWindowBase.h" +#include "PythonModule/PyAgent.h" +#include "SARibbonMWUi.h" +#include "Settings/BusAPI.h" +#include "Settings/GraphOption.h" +#include "SolveProcessManager.h" +#include "SolverControl/SolverControlerBase.h" +#include "SubWindowManager.h" +#include "UserGuidence/DialogUserGuidence.h" -namespace GUI -{ - SignalHandler::SignalHandler(MainWindow *mainwindow) : _mainWindow(mainwindow) +#include +#include +#include +#include +#include +#include +#include + +namespace GUI { + SignalHandler::SignalHandler(MainWindow* mainwindow) + : _mainWindow(mainwindow) { - ///注册工程树鼠标事件传递给signalHandler - connect(mainwindow, SIGNAL(treeMouseEvent(int, QTreeWidgetItem *, int)), this, SLOT(handleTreeMouseEvent(int, QTreeWidgetItem *, int))); - connect(mainwindow, SIGNAL(solveProjectSig(int, int)), this, SLOT(solveProjectPy(int, int))); // liu - connect(mainwindow->getUi()->actionSurfaceMesh, SIGNAL(triggered()), this, SLOT(generateSurfaceMesh())); - connect(mainwindow->getUi()->actionSolidMesh, SIGNAL(triggered()), this, SLOT(generateSolidMesh())); - connect(mainwindow->getUi()->actionFluidMesh, SIGNAL(triggered()), this, SLOT(generateFluidMesh())); + /// 注册工程树鼠标事件传递给signalHandler + connect(mainwindow, SIGNAL(treeMouseEvent(int, QTreeWidgetItem*, int)), this, + SLOT(handleTreeMouseEvent(int, QTreeWidgetItem*, int))); + connect(mainwindow, SIGNAL(solveProjectSig(int, int)), this, + SLOT(solveProjectPy(int, int))); // liu + connect(mainwindow->getUi()->actionSurfaceMesh, SIGNAL(triggered()), this, + SLOT(generateSurfaceMesh())); + connect(mainwindow->getUi()->actionSolidMesh, SIGNAL(triggered()), this, + SLOT(generateSolidMesh())); + connect(mainwindow->getUi()->actionFluidMesh, SIGNAL(triggered()), this, + SLOT(generateFluidMesh())); connect(mainwindow->getUi()->actionGenMesh, SIGNAL(triggered()), this, SLOT(genMesh())); - connect(mainwindow, SIGNAL(appendGeneratedMesh(QString, vtkDataSet *)), this, SLOT(appendGeneratedMesh(QString, vtkDataSet *))); - connect(mainwindow->getUi()->actionEnglish, SIGNAL(triggered()), this, SLOT(on_actionEnglish())); - connect(mainwindow->getUi()->actionChinese, SIGNAL(triggered()), this, SLOT(on_actionChinese())); - connect(mainwindow->getUi()->actionRibbon, SIGNAL(triggered()), this, SLOT(on_actionRibbon())); - connect(mainwindow->getUi()->actionNormal, SIGNAL(triggered()), this, SLOT(on_actionNormal())); + connect(mainwindow, SIGNAL(appendGeneratedMesh(QString, vtkDataSet*)), this, + SLOT(appendGeneratedMesh(QString, vtkDataSet*))); + connect(mainwindow->getUi()->actionEnglish, SIGNAL(triggered()), this, + SLOT(on_actionEnglish())); + connect(mainwindow->getUi()->actionChinese, SIGNAL(triggered()), this, + SLOT(on_actionChinese())); + connect(mainwindow->getUi()->actionRibbon, SIGNAL(triggered()), this, + SLOT(on_actionRibbon())); + connect(mainwindow->getUi()->actionNormal, SIGNAL(triggered()), this, + SLOT(on_actionNormal())); connect(mainwindow, SIGNAL(updateActionStatesSig()), this, SLOT(updateActionsStates())); - connect(mainwindow->getUi()->action2DPlot, SIGNAL(triggered()), this, SLOT(open2DPlotWindow())); - connect(mainwindow->getUi()->action3DGraph, SIGNAL(triggered()), this, SLOT(open3DGraphWindow())); - connect(mainwindow, SIGNAL(closePostWindowSig(Post::PostWindowBase *)), this, SLOT(closePostWindow(Post::PostWindowBase *))); - connect(mainwindow->getUi()->actionSave_Picture, SIGNAL(triggered()), this, SLOT(saveImange())); - connect(mainwindow->getUi()->actionChecking, SIGNAL(triggered()), this, SLOT(meshChecking())); - connect(mainwindow, SIGNAL(showDialogSig(QDialog *)), this, SLOT(showDialog(QDialog *))); + connect(mainwindow->getUi()->action2DPlot, SIGNAL(triggered()), this, + SLOT(open2DPlotWindow())); + connect(mainwindow->getUi()->action3DGraph, SIGNAL(triggered()), this, + SLOT(open3DGraphWindow())); + connect(mainwindow, SIGNAL(closePostWindowSig(Post::PostWindowBase*)), this, + SLOT(closePostWindow(Post::PostWindowBase*))); + connect(mainwindow->getUi()->actionSave_Picture, SIGNAL(triggered()), this, + SLOT(saveImange())); + connect(mainwindow->getUi()->actionChecking, SIGNAL(triggered()), this, + SLOT(meshChecking())); + connect(mainwindow, SIGNAL(showDialogSig(QDialog*)), this, SLOT(showDialog(QDialog*))); connect(mainwindow, SIGNAL(clearDataSig()), this, SLOT(clearData())); - connect(this, SIGNAL(importMeshPySig(QString, QString, int)), this, SLOT(importMeshSlot(QString, QString, int))); - connect(this, SIGNAL(exportMeshPySig(QString, QString, int)), this, SLOT(exportMeshSlot(QString, QString, int))); + connect(this, SIGNAL(importMeshPySig(QString, QString, int)), this, + SLOT(importMeshSlot(QString, QString, int))); + connect(this, SIGNAL(exportMeshPySig(QString, QString, int)), this, + SLOT(exportMeshSlot(QString, QString, int))); connect(this, SIGNAL(open3DGraphWindowPySig()), this, SLOT(open3DGraphWindowPy())); connect(this, SIGNAL(open2DPlotWindowPySig()), this, SLOT(open2DPlotWindowPy())); connect(this, SIGNAL(openProjectFileSig(QString)), this, SLOT(openProjectFile(QString))); - connect(this, SIGNAL(saveToProjectFileSig(QString)), this, SLOT(saveToProjectFile(QString))); + connect(this, SIGNAL(saveToProjectFileSig(QString)), this, + SLOT(saveToProjectFile(QString))); connect(this, SIGNAL(solveProjectSig(int, int)), this, SLOT(solveProject(int, int))); - connect(this, SIGNAL(projectFileProcessedSig(QString, bool, bool)), this, SLOT(projectFileProcessed(QString, bool, bool))); + connect(this, SIGNAL(projectFileProcessedSig(QString, bool, bool)), this, + SLOT(projectFileProcessed(QString, bool, bool))); - connect(mainwindow->getUi()->actionUser_Guidance, SIGNAL(triggered()), this, SLOT(showUserGuidence())); + connect(mainwindow->getUi()->actionUser_Guidance, SIGNAL(triggered()), this, + SLOT(showUserGuidence())); - //创建几何 + // 创建几何 connect(mainwindow->getUi()->actionUndo, SIGNAL(triggered()), this, SLOT(undo())); connect(mainwindow->getUi()->actionRedo, SIGNAL(triggered()), this, SLOT(redo())); connect(mainwindow->getUi()->actionCreateBox, SIGNAL(triggered()), this, SLOT(createBox())); - connect(mainwindow->getUi()->actionCreateCylinder, SIGNAL(triggered()), this, SLOT(createCylinder())); - connect(mainwindow->getUi()->actionCreaterSphere, SIGNAL(triggered()), this, SLOT(CreateSphere())); - connect(mainwindow->getUi()->actionCreaterCone, SIGNAL(triggered()), this, SLOT(CreateCone())); + connect(mainwindow->getUi()->actionCreateCylinder, SIGNAL(triggered()), this, + SLOT(createCylinder())); + connect(mainwindow->getUi()->actionCreaterSphere, SIGNAL(triggered()), this, + SLOT(CreateSphere())); + connect(mainwindow->getUi()->actionCreaterCone, SIGNAL(triggered()), this, + SLOT(CreateCone())); connect(mainwindow->getUi()->actionFillet, SIGNAL(triggered()), this, SLOT(CreateFilet())); - connect(mainwindow->getUi()->actionVariable_Fillet, SIGNAL(triggered()), this, SLOT(CreateVariableFillet())); - connect(mainwindow->getUi()->actionChamfer, SIGNAL(triggered()), this, SLOT(CreateChamfer())); - connect(mainwindow->getUi()->actionBoolCut, SIGNAL(triggered()), this, SLOT(CreateBoolCut())); - connect(mainwindow->getUi()->actionBoolFause, SIGNAL(triggered()), this, SLOT(CreateBoolFause())); - connect(mainwindow->getUi()->actionBoolCommon, SIGNAL(triggered()), this, SLOT(CreateBoolCommon())); - connect(mainwindow->getUi()->actionMirrorFeature, SIGNAL(triggered()), this, SLOT(MirrorFeature())); - connect(mainwindow->getUi()->actionExtrude, SIGNAL(triggered()), this, SLOT(CreateExtrusion())); - connect(mainwindow->getUi()->actionCreate_Point, SIGNAL(triggered()), this, SLOT(CreatePoint())); - connect(mainwindow->getUi()->actionCreate_Line, SIGNAL(triggered()), this, SLOT(CreateEdge())); - connect(mainwindow->getUi()->actionCreate_Face, SIGNAL(triggered()), this, SLOT(CreateFace())); - connect(mainwindow->getUi()->actionMoveFeature, SIGNAL(triggered()), this, SLOT(MoveFeature())); - connect(mainwindow->getUi()->actionRotateFeature, SIGNAL(triggered()), this, SLOT(RotateFeature())); + connect(mainwindow->getUi()->actionVariable_Fillet, SIGNAL(triggered()), this, + SLOT(CreateVariableFillet())); + connect(mainwindow->getUi()->actionChamfer, SIGNAL(triggered()), this, + SLOT(CreateChamfer())); + connect(mainwindow->getUi()->actionBoolCut, SIGNAL(triggered()), this, + SLOT(CreateBoolCut())); + connect(mainwindow->getUi()->actionBoolFause, SIGNAL(triggered()), this, + SLOT(CreateBoolFause())); + connect(mainwindow->getUi()->actionBoolCommon, SIGNAL(triggered()), this, + SLOT(CreateBoolCommon())); + connect(mainwindow->getUi()->actionMirrorFeature, SIGNAL(triggered()), this, + SLOT(MirrorFeature())); + connect(mainwindow->getUi()->actionExtrude, SIGNAL(triggered()), this, + SLOT(CreateExtrusion())); + connect(mainwindow->getUi()->actionCreate_Point, SIGNAL(triggered()), this, + SLOT(CreatePoint())); + connect(mainwindow->getUi()->actionCreate_Line, SIGNAL(triggered()), this, + SLOT(CreateEdge())); + connect(mainwindow->getUi()->actionCreate_Face, SIGNAL(triggered()), this, + SLOT(CreateFace())); + connect(mainwindow->getUi()->actionMoveFeature, SIGNAL(triggered()), this, + SLOT(MoveFeature())); + connect(mainwindow->getUi()->actionRotateFeature, SIGNAL(triggered()), this, + SLOT(RotateFeature())); connect(mainwindow->getUi()->actionRevol, SIGNAL(triggered()), this, SLOT(CreateRevol())); connect(mainwindow->getUi()->actionLoft, SIGNAL(triggered()), this, SLOT(CreateLoft())); - // connect(mainwindow->getUi()->actionCreateCylindricalComplex, SIGNAL(triggered()), this, SLOT(CreateCylindricalComplex())); - // connect(mainwindow->getUi()->actionCreateBoxComplex, SIGNAL(triggered()), this, SLOT(CreateBoxComplex())); + // connect(mainwindow->getUi()->actionCreateCylindricalComplex, SIGNAL(triggered()), this, + // SLOT(CreateCylindricalComplex())); connect(mainwindow->getUi()->actionCreateBoxComplex, + // SIGNAL(triggered()), this, SLOT(CreateBoxComplex())); connect(mainwindow->getUi()->actionSweep, SIGNAL(triggered()), this, SLOT(CreateSweep())); - connect(mainwindow->getUi()->actionCreateDatumPlane, SIGNAL(triggered()), this, SLOT(CreateDatumplane())); - connect(mainwindow->getUi()->actionDrawLine, SIGNAL(triggered()), this, SLOT(DrawGraphicsLine())); - connect(mainwindow->getUi()->actionDrawRectangle, SIGNAL(triggered()), this, SLOT(DrawGraphicsRectangle())); - connect(mainwindow->getUi()->actionDrawCircle, SIGNAL(triggered()), this, SLOT(DrawGraphicsCircle())); - connect(mainwindow->getUi()->actionDrawArc, SIGNAL(triggered()), this, SLOT(DrawGraphicsArc())); - connect(mainwindow->getUi()->actionDrawPolyline, SIGNAL(triggered()), this, SLOT(DrawGraphicsPolyline())); - connect(mainwindow->getUi()->actionMakeMatrix, SIGNAL(triggered()), this, SLOT(MakeMatrix())); - connect(mainwindow->getUi()->actionDrawSpline, SIGNAL(triggered()), this, SLOT(DrawGraphSpline())); - connect(mainwindow->getUi()->actionMeasure_Distance, SIGNAL(triggered()), this, SLOT(MeasureDistance())); - connect(mainwindow->getUi()->actionGeoSplitter, SIGNAL(triggered()), this, SLOT(GeoSplitter())); + connect(mainwindow->getUi()->actionCreateDatumPlane, SIGNAL(triggered()), this, + SLOT(CreateDatumplane())); + connect(mainwindow->getUi()->actionDrawLine, SIGNAL(triggered()), this, + SLOT(DrawGraphicsLine())); + connect(mainwindow->getUi()->actionDrawRectangle, SIGNAL(triggered()), this, + SLOT(DrawGraphicsRectangle())); + connect(mainwindow->getUi()->actionDrawCircle, SIGNAL(triggered()), this, + SLOT(DrawGraphicsCircle())); + connect(mainwindow->getUi()->actionDrawArc, SIGNAL(triggered()), this, + SLOT(DrawGraphicsArc())); + connect(mainwindow->getUi()->actionDrawPolyline, SIGNAL(triggered()), this, + SLOT(DrawGraphicsPolyline())); + connect(mainwindow->getUi()->actionMakeMatrix, SIGNAL(triggered()), this, + SLOT(MakeMatrix())); + connect(mainwindow->getUi()->actionDrawSpline, SIGNAL(triggered()), this, + SLOT(DrawGraphSpline())); + connect(mainwindow->getUi()->actionMeasure_Distance, SIGNAL(triggered()), this, + SLOT(MeasureDistance())); + connect(mainwindow->getUi()->actionGeoSplitter, SIGNAL(triggered()), this, + SLOT(GeoSplitter())); - connect(mainwindow->getUi()->actionFillHole, SIGNAL(triggered()), this, SLOT(MakeFillHole())); - connect(mainwindow->getUi()->actionRemoveSurface, SIGNAL(triggered()), this, SLOT(MakeRemoveSurface())); + connect(mainwindow->getUi()->actionFillHole, SIGNAL(triggered()), this, + SLOT(MakeFillHole())); + connect(mainwindow->getUi()->actionRemoveSurface, SIGNAL(triggered()), this, + SLOT(MakeRemoveSurface())); connect(mainwindow->getUi()->actionFillGap, SIGNAL(triggered()), this, SLOT(MakeFillGap())); // connect(mainwindow->getUi()->actionDemo, SIGNAL(triggered()), this, SLOT(showDemo())); - connect(mainwindow->getUi()->actionOpenPostFile, SIGNAL(triggered()), this, SLOT(openPostFile())); - connect(mainwindow->getUi()->actionDisplayPoints, &QAction::triggered, [=] - { this->setPostDisplayMode(0); }); - connect(mainwindow->getUi()->actionDisplayWireframe, &QAction::triggered, [=] - { this->setPostDisplayMode(1); }); - connect(mainwindow->getUi()->actionDisplaySurfaceWithoutEdge, &QAction::triggered, [=] - { this->setPostDisplayMode(2); }); - connect(mainwindow->getUi()->actionDisplaySurfaceWithEdge, &QAction::triggered, [=] - { this->setPostDisplayMode(3); }); - connect(mainwindow->getUi()->actionCreateVector, SIGNAL(triggered()), this, SLOT(createPostVector())); - connect(mainwindow->getUi()->actionCreateClip, SIGNAL(triggered()), this, SLOT(createPostClip())); - connect(mainwindow->getUi()->actionCreateSlice, SIGNAL(triggered()), this, SLOT(createPostSlice())); - connect(mainwindow->getUi()->actionCreateStreamLine, SIGNAL(triggered()), this, SLOT(createPostStreamLine())); - connect(mainwindow->getUi()->actionCreateISOSurface, SIGNAL(triggered()), this, SLOT(createPostISOSurface())); - connect(mainwindow->getUi()->actionCreateISOCurve, SIGNAL(triggered()), this, SLOT(createPostISOCurve())); - connect(mainwindow->getUi()->actionCreateCalculator, SIGNAL(triggered()), this, SLOT(createPostCalculator())); - connect(mainwindow->getUi()->actionCreateReflection, SIGNAL(triggered()), this, SLOT(createPostReflection())); - connect(mainwindow->getUi()->actionSaveImage, SIGNAL(triggered()), this, SLOT(savePostPicture())); - connect(mainwindow->getUi()->actionSaveVideo, SIGNAL(triggered()), this, SLOT(savePostAnimation())); + connect(mainwindow->getUi()->actionOpenPostFile, SIGNAL(triggered()), this, + SLOT(openPostFile())); + connect(mainwindow->getUi()->actionDisplayPoints, &QAction::triggered, + [=] { this->setPostDisplayMode(0); }); + connect(mainwindow->getUi()->actionDisplayWireframe, &QAction::triggered, + [=] { this->setPostDisplayMode(1); }); + connect(mainwindow->getUi()->actionDisplaySurfaceWithoutEdge, &QAction::triggered, + [=] { this->setPostDisplayMode(2); }); + connect(mainwindow->getUi()->actionDisplaySurfaceWithEdge, &QAction::triggered, + [=] { this->setPostDisplayMode(3); }); + connect(mainwindow->getUi()->actionCreateVector, SIGNAL(triggered()), this, + SLOT(createPostVector())); + connect(mainwindow->getUi()->actionCreateClip, SIGNAL(triggered()), this, + SLOT(createPostClip())); + connect(mainwindow->getUi()->actionCreateSlice, SIGNAL(triggered()), this, + SLOT(createPostSlice())); + connect(mainwindow->getUi()->actionCreateStreamLine, SIGNAL(triggered()), this, + SLOT(createPostStreamLine())); + connect(mainwindow->getUi()->actionCreateISOSurface, SIGNAL(triggered()), this, + SLOT(createPostISOSurface())); + connect(mainwindow->getUi()->actionCreateISOCurve, SIGNAL(triggered()), this, + SLOT(createPostISOCurve())); + connect(mainwindow->getUi()->actionCreateCalculator, SIGNAL(triggered()), this, + SLOT(createPostCalculator())); + connect(mainwindow->getUi()->actionCreateReflection, SIGNAL(triggered()), this, + SLOT(createPostReflection())); + connect(mainwindow->getUi()->actionSaveImage, SIGNAL(triggered()), this, + SLOT(savePostPicture())); + connect(mainwindow->getUi()->actionSaveVideo, SIGNAL(triggered()), this, + SLOT(savePostAnimation())); - connect(mainwindow->getUi()->actionGeoMeshRotate, SIGNAL(triggered()), this, SLOT(GeoMeshRotate())); + connect(mainwindow->getUi()->actionGeoMeshRotate, SIGNAL(triggered()), this, + SLOT(GeoMeshRotate())); _solveProcessManager = new SolveProcessManager; } SignalHandler::~SignalHandler() @@ -202,7 +262,7 @@ namespace GUI emit _mainWindow->createPhysiceModelSig(); } - SolveProcessManager *SignalHandler::getSolveProcessManager() + SolveProcessManager* SignalHandler::getSolveProcessManager() { return _solveProcessManager; } @@ -211,14 +271,14 @@ namespace GUI { // add a reader QFile f(fileName); - if (!f.exists()) + if(!f.exists()) return false; this->clearData(false); - IO::ProjectFileIO *reader = new IO::ProjectFileIO(_mainWindow, this, fileName, true); - ModuleBase::ThreadControl *tc = new ModuleBase::ThreadControl(reader); - emit tc->threadStart(); + IO::ProjectFileIO* reader = new IO::ProjectFileIO(_mainWindow, this, fileName, true); + ModuleBase::ThreadControl* tc = new ModuleBase::ThreadControl(reader); + emit tc->threadStart(); return true; } @@ -226,12 +286,10 @@ namespace GUI { ModuleBase::Message m; m.type = Common::Message::Error; - if (success) + if(success) m.type = Common::Message::Normal; - if (read) - { - if (success) - { + if(read) { + if(success) { emit _mainWindow->updateGeometryTreeSig(); emit _mainWindow->updateMeshTreeSig(); emit _mainWindow->updateSetTreeSig(); @@ -243,29 +301,22 @@ namespace GUI _mainWindow->getSubWindowManager()->openPreWindow(); emit _mainWindow->updateActionStatesSig(); m.message = QString("\"%1\" has been Opened !").arg(fileName); - } - else - { + } else { clearData(false); m.message = QString("\"%1\" open failed !").arg(fileName); } Setting::BusAPI::instance()->appendRecentFile(fileName); _mainWindow->updateRecentMenu(); - } - else - { - if (success) - { + } else { + if(success) { Setting::BusAPI::instance()->appendRecentFile(fileName); _mainWindow->setCurrentFile(fileName); QString md5 = getMD5(); _mainWindow->setMD5(md5); _mainWindow->updateRecentMenu(); m.message = QString("\"%1\" has been Saved !").arg(fileName); - } - else - { + } else { m.message = QString("\"%1\" save failed !").arg(fileName); } } @@ -277,14 +328,12 @@ namespace GUI void SignalHandler::saveToProjectFile(QString filename) { // add a writer - IO::ProjectFileIO *writer = new IO::ProjectFileIO(_mainWindow, this, filename, false); - ModuleBase::ThreadControl *tc = new ModuleBase::ThreadControl(writer); - emit tc->threadStart(); + IO::ProjectFileIO* writer = new IO::ProjectFileIO(_mainWindow, this, filename, false); + ModuleBase::ThreadControl* tc = new ModuleBase::ThreadControl(writer); + emit tc->threadStart(); } - void SignalHandler::on_actionSolve() - { - } + void SignalHandler::on_actionSolve() {} void SignalHandler::on_actionEnglish() { @@ -306,34 +355,32 @@ namespace GUI _mainWindow->changeStyleToRibbon(false); } - void SignalHandler::handleTreeMouseEvent(int eventtype, QTreeWidgetItem *item, int proID) + void SignalHandler::handleTreeMouseEvent(int eventtype, QTreeWidgetItem* item, int proID) { Q_UNUSED(proID); - if (item->type() != ProjectPostSetting) + if(item->type() != ProjectPostSetting) return; - switch (eventtype) - { - case 0: - // Post3D::Post3DWindow* w = _mainWindow->getPostWindowByID(proID); - // if (w == nullptr) return; - // w->showWindow(); - break; + switch(eventtype) { + case 0: + // Post3D::Post3DWindow* w = _mainWindow->getPostWindowByID(proID); + // if (w == nullptr) return; + // w->showWindow(); + break; } } - void SignalHandler::handleSingleClickEvent(QTreeWidgetItem *item, int proID) + void SignalHandler::handleSingleClickEvent(QTreeWidgetItem* item, int proID) { Q_UNUSED(item); Q_UNUSED(proID); } - bool SignalHandler::importMeshSlot(const QString &fileName, const QString &suffix, int modelId) + bool SignalHandler::importMeshSlot(const QString& fileName, const QString& suffix, int modelId) { IMPORTMESHFUN fp = IO::IOConfigure::getMeshImporter(suffix); - if (!fp) - { + if(!fp) { ModuleBase::Message m; - m.type = Common::Message::Error; + m.type = Common::Message::Error; m.message = QString("\"%1\" interface has not been registered !").arg(suffix); emit _mainWindow->printMessageToMessageWindow(m); return false; @@ -342,13 +389,12 @@ namespace GUI return true; } - bool SignalHandler::exportMeshSlot(const QString &fileName, const QString &suffix, int modelId) + bool SignalHandler::exportMeshSlot(const QString& fileName, const QString& suffix, int modelId) { EXPORTMESHFUN fp = IO::IOConfigure::getMeshExporter(suffix); - if (!fp) - { + if(!fp) { ModuleBase::Message m; - m.type = Common::Message::Error; + m.type = Common::Message::Error; m.message = QString("\"%1\" interface has not been registered !").arg(suffix); emit _mainWindow->printMessageToMessageWindow(m); return false; @@ -358,9 +404,10 @@ namespace GUI return true; } - bool SignalHandler::importGeometry(const QStringList &filenames) + bool SignalHandler::importGeometry(const QStringList& filenames) { - Command::GeoCommandImport *c = new Command::GeoCommandImport(_mainWindow, _mainWindow->getSubWindowManager()->getPreWindow()); + Command::GeoCommandImport* c = new Command::GeoCommandImport( + _mainWindow, _mainWindow->getSubWindowManager()->getPreWindow()); c->setFileName(filenames); c->IsRead(true); bool ok = Command::GeoComandList::getInstance()->executeCommand(c); @@ -370,7 +417,8 @@ namespace GUI bool SignalHandler::exportGeometry(QString f) { - Command::GeoCommandImport *c = new Command::GeoCommandImport(_mainWindow, _mainWindow->getSubWindowManager()->getPreWindow()); + Command::GeoCommandImport* c = new Command::GeoCommandImport( + _mainWindow, _mainWindow->getSubWindowManager()->getPreWindow()); c->setExportFile(f); c->IsRead(false); bool ok = Command::GeoComandList::getInstance()->executeCommand(c); @@ -380,10 +428,10 @@ namespace GUI QString SignalHandler::getMD5() { QString md5 = ""; - QString p = ModelData::ModelDataSingleton::getinstance()->getMD5(); - QString g = Geometry::GeometryData::getInstance()->getMD5(); - QString m = MeshData::MeshData::getInstance()->getMD5(); - md5 = p + g + m; + QString p = ModelData::ModelDataSingleton::getinstance()->getMD5(); + QString g = Geometry::GeometryData::getInstance()->getMD5(); + QString m = MeshData::MeshData::getInstance()->getMD5(); + md5 = p + g + m; return md5; } @@ -401,36 +449,39 @@ namespace GUI emit _mainWindow->updateGeometryTreeSig(); emit _mainWindow->updatePhysicsTreeSignal(); emit _mainWindow->updateMaterialTreeSig(); - if (unlock) + if(unlock) Py::PythonAgent::getInstance()->unLock(); } void SignalHandler::solveProjectPy(int projectIndex, int solverIndex) { - ModelData::ModelDataSingleton *modelData = ModelData::ModelDataSingleton::getinstance(); - ModelData::ModelDataBase *model = modelData->getModelAt(projectIndex); - const int id = model->getID(); - if (_solveProcessManager->isSolving(id)) - { + ModelData::ModelDataSingleton* modelData = ModelData::ModelDataSingleton::getinstance(); + ModelData::ModelDataBase* model = modelData->getModelAt(projectIndex); + const int id = model->getID(); + if(_solveProcessManager->isSolving(id)) { QString name = model->getName(); - QMessageBox::warning(_mainWindow, QString(tr("Warning")), QString(tr("%1 is Solving , Please wait...")).arg(name)); + QMessageBox::warning(_mainWindow, QString(tr("Warning")), + QString(tr("%1 is Solving , Please wait...")).arg(name)); return; } - QString pycode = QString("MainWindow.solveProject(%1,%2)").arg(projectIndex).arg(solverIndex); + QString pycode = + QString("MainWindow.solveProject(%1,%2)").arg(projectIndex).arg(solverIndex); qDebug() << pycode; Py::PythonAgent::getInstance()->submit(pycode); } void SignalHandler::solveProject(int projectIndex, int solverIndex) { - ModelData::ModelDataSingleton *modelData = ModelData::ModelDataSingleton::getinstance(); - ModelData::ModelDataBase *model = modelData->getModelAt(projectIndex); + ModelData::ModelDataSingleton* modelData = ModelData::ModelDataSingleton::getinstance(); + ModelData::ModelDataBase* model = modelData->getModelAt(projectIndex); - ConfigOption::SolverOption *solvers = ConfigOption::ConfigOption::getInstance()->getSolverOption(); - ConfigOption::SolverInfo *solver = solvers->getSolverAt(solverIndex); + ConfigOption::SolverOption* solvers = + ConfigOption::ConfigOption::getInstance()->getSolverOption(); + ConfigOption::SolverInfo* solver = solvers->getSolverAt(solverIndex); - SolverControl::SolverControlBase *solverControl = new SolverControl::SolverControlBase(_mainWindow, solver, model); + SolverControl::SolverControlBase* solverControl = + new SolverControl::SolverControlBase(_mainWindow, solver, model); solverControl->setSolverDescription(QString(tr("Solving-%1")).arg(model->getName())); int id = model->getID(); _solveProcessManager->insertProcess(id, solverControl); @@ -440,27 +491,27 @@ namespace GUI void SignalHandler::generateSurfaceMesh() { - MainWidget::PreWindow *prewin = _mainWindow->getSubWindowManager()->getPreWindow(); + MainWidget::PreWindow* prewin = _mainWindow->getSubWindowManager()->getPreWindow(); Gmsh::GmshModule::getInstance(_mainWindow)->exec(1, prewin); } void SignalHandler::generateSolidMesh() { - MainWidget::PreWindow *prewin = _mainWindow->getSubWindowManager()->getPreWindow(); + MainWidget::PreWindow* prewin = _mainWindow->getSubWindowManager()->getPreWindow(); Gmsh::GmshModule::getInstance(_mainWindow)->exec(2, prewin); } void SignalHandler::generateFluidMesh() { - MainWidget::PreWindow *prewin = _mainWindow->getSubWindowManager()->getPreWindow(); + MainWidget::PreWindow* prewin = _mainWindow->getSubWindowManager()->getPreWindow(); Gmsh::GmshModule::getInstance(_mainWindow)->exec(0, prewin); } void SignalHandler::genMesh() { - DataProperty::DataBase *info = nullptr; + DataProperty::DataBase* info = nullptr; MainWidget::MesherDialog dlg(_mainWindow); - if (dlg.isSingleMesher() || (dlg.exec() == QDialog::Accepted)) + if(dlg.isSingleMesher() || (dlg.exec() == QDialog::Accepted)) info = dlg.getMesherInfo(); else return; @@ -468,15 +519,15 @@ namespace GUI emit _mainWindow->updateProperty(info); } - void SignalHandler::appendGeneratedMesh(QString name, vtkDataSet *dataset) + void SignalHandler::appendGeneratedMesh(QString name, vtkDataSet* dataset) { - MeshData::MeshKernal *k = new MeshData::MeshKernal; + MeshData::MeshKernal* k = new MeshData::MeshKernal; k->setName(name); k->setMeshData(dataset); MeshData::MeshData::getInstance()->appendMeshKernal(k); _mainWindow->getSubWindowManager()->updatePreMeshActor(); ModuleBase::Message m; - m.type = Common::Message::Normal; + m.type = Common::Message::Normal; m.message = tr("Mesh Generated \"%1\"").arg(name); emit _mainWindow->printMessageToMessageWindow(m); emit _mainWindow->updateMeshTreeSig(); @@ -484,13 +535,13 @@ namespace GUI void SignalHandler::updateActionsStates() { - Ui::MainWindow *ui = _mainWindow->getUi(); - SubWindowManager *subwins = _mainWindow->getSubWindowManager(); - MeshData::MeshData *meshData = MeshData::MeshData::getInstance(); - Geometry::GeometryData *geoData = Geometry::GeometryData::getInstance(); - ModelData::ModelDataSingleton *modelData = ModelData::ModelDataSingleton::getinstance(); + Ui::MainWindow* ui = _mainWindow->getUi(); + SubWindowManager* subwins = _mainWindow->getSubWindowManager(); + MeshData::MeshData* meshData = MeshData::MeshData::getInstance(); + Geometry::GeometryData* geoData = Geometry::GeometryData::getInstance(); + ModelData::ModelDataSingleton* modelData = ModelData::ModelDataSingleton::getinstance(); - //全部置灰 + // 全部置灰 ui->actionSave->setEnabled(false); ui->actionSaveAs->setEnabled(false); ui->actionSolve->setEnabled(false); @@ -547,23 +598,20 @@ namespace GUI ui->actionCreateCalculator->setEnabled(false); ui->actionCreateReflection->setEnabled(false); - //打开可用Action - const int nMesh = meshData->getKernalCount(); - const int ngeo = geoData->getGeometrySetCount(); - const int nModel = modelData->getModelCount(); - bool needSave = Plugins::PluginManager::getInstance()->hasInfoToSave(); + // 打开可用Action + const int nMesh = meshData->getKernalCount(); + const int ngeo = geoData->getGeometrySetCount(); + const int nModel = modelData->getModelCount(); + bool needSave = Plugins::PluginManager::getInstance()->hasInfoToSave(); - if (nMesh + ngeo + nModel > 0 || needSave) - { + if(nMesh + ngeo + nModel > 0 || needSave) { ui->actionSave->setEnabled(true); ui->actionSaveAs->setEnabled(true); } - if (nModel > 0 || needSave) - { + if(nModel > 0 || needSave) { ui->actionSolve->setEnabled(true); } - if (subwins->isPreWindowOpened() || subwins->isPostWindowOpened()) - { + if(subwins->isPreWindowOpened() || subwins->isPostWindowOpened()) { ui->actionViewXPlus->setEnabled(true); ui->actionViewXMinus->setEnabled(true); ui->actionViewYPlus->setEnabled(true); @@ -578,8 +626,7 @@ namespace GUI ui->actionBoxMeshNode->setEnabled(true); ui->actionBoxMeshCell->setEnabled(true); } - if (ngeo > 0 && subwins->isPreWindowOpened()) - { + if(ngeo > 0 && subwins->isPreWindowOpened()) { ui->actionSurfaceMesh->setEnabled(true); ui->actionSolidMesh->setEnabled(true); ui->actionFluidMesh->setEnabled(true); @@ -594,8 +641,7 @@ namespace GUI ui->actionCreateGeoComponent->setEnabled(true); ui->actionExportGeometry->setEnabled(true); } - if (nMesh > 0 && subwins->isPreWindowOpened()) - { + if(nMesh > 0 && subwins->isPreWindowOpened()) { ui->actionFilterMesh->setEnabled(true); ui->actionCreate_Set->setEnabled(true); ui->actionChecking->setEnabled(true); @@ -611,8 +657,7 @@ namespace GUI ui->actionDisplaySurface->setChecked(gp->isShowMeshFace()); ui->actionDisplayWireFrame->setChecked(gp->isShowMeshEdge()); } - if (subwins->isPostWindowOpened()) - { + if(subwins->isPostWindowOpened()) { ui->actionViewXPlus->setEnabled(true); ui->actionViewXMinus->setEnabled(true); ui->actionViewYPlus->setEnabled(true); @@ -621,8 +666,7 @@ namespace GUI ui->actionViewZMinus->setEnabled(true); ui->actionFitView->setEnabled(true); } - if (subwins->isPostWindowOpening()) - { + if(subwins->isPostWindowOpening()) { ui->actionOpenPostFile->setEnabled(true); ui->actionSaveImage->setEnabled(true); ui->actionSaveVideo->setEnabled(true); @@ -640,16 +684,15 @@ namespace GUI ui->actionCreateReflection->setEnabled(true); } - const int n = ConfigOption::ConfigOption::getInstance()->getSolverOption()->getSolverCount(); - if (n > 0) + const int n = + ConfigOption::ConfigOption::getInstance()->getSolverOption()->getSolverCount(); + if(n > 0) ui->actionGenMesh->setEnabled(true); // bool showGuidence = Setting::BusAPI::instance()->isEnableUserGuidence(); } - void SignalHandler::updatePostActionStates() - { - } + void SignalHandler::updatePostActionStates() {} void SignalHandler::open2DPlotWindow() { @@ -668,10 +711,10 @@ namespace GUI // QString pycode = QString("MainWindow.openNew2d()"); // Py::PythonAgent::getInstance()->submit(pycode); - QAction *act = _mainWindow->getUi()->action2DPlot; - if (!act->isEnabled()) + QAction* act = _mainWindow->getUi()->action2DPlot; + if(!act->isEnabled()) return; - Post::Post2DWindowInterface *p2w = new Post::Post2DWindowInterface(_mainWindow, -1); + Post::Post2DWindowInterface* p2w = new Post::Post2DWindowInterface(_mainWindow, -1); p2w->reTranslate(); emit _mainWindow->openPostWindowSig(p2w); emit _mainWindow->updateActionStatesSig(); @@ -680,10 +723,10 @@ namespace GUI void SignalHandler::open3DGraphWindowPy() { - QAction *act = _mainWindow->getUi()->action3DGraph; - if (!act->isEnabled()) + QAction* act = _mainWindow->getUi()->action3DGraph; + if(!act->isEnabled()) return; - Post::Post3DWindowInterface *post3d = new Post::Post3DWindowInterface(_mainWindow, -1); + Post::Post3DWindowInterface* post3d = new Post::Post3DWindowInterface(_mainWindow, -1); post3d->reTranslate(); // Post::PostProcessPy::init(_mainWindow->getControlPanel()->getPostTreeWidget()); emit _mainWindow->openPostWindowSig(post3d); @@ -691,20 +734,21 @@ namespace GUI act->setEnabled(false); } - void SignalHandler::closePostWindow(Post::PostWindowBase *p) + void SignalHandler::closePostWindow(Post::PostWindowBase* p) { int id = p->getID(); - if (id != -1) + if(id != -1) return; - if (p->getPostWindowType() == Post::D2) + if(p->getPostWindowType() == Post::D2) _mainWindow->getUi()->action2DPlot->setEnabled(true); - else if (p->getPostWindowType() == Post::D3) + else if(p->getPostWindowType() == Post::D3) _mainWindow->getUi()->action3DGraph->setEnabled(true); } void SignalHandler::saveImange() { - MainWidget::SavePictureDialog d(_mainWindow, _mainWindow->getSubWindowManager()->getCurrentWindow()); + MainWidget::SavePictureDialog d(_mainWindow, + _mainWindow->getSubWindowManager()->getCurrentWindow()); d.exec(); } @@ -716,21 +760,18 @@ namespace GUI void SignalHandler::showUserGuidence(bool start) { - bool show = false; - QAction *ac = _mainWindow->getUi()->actionUser_Guidance; - bool inis = Setting::BusAPI::instance()->isEnableUserGuidence(); - if (start) - { + bool show = false; + QAction* ac = _mainWindow->getUi()->actionUser_Guidance; + bool inis = Setting::BusAPI::instance()->isEnableUserGuidence(); + if(start) { show = inis; ac->setChecked(inis); - } - else - { + } else { bool che = ac->isChecked(); - show = che; + show = che; Setting::BusAPI::instance()->isEnableUserGuidence(show); } - if (!show) + if(!show) return; /* if (!_launched) _launched = true; @@ -758,239 +799,242 @@ namespace GUI void SignalHandler::createBox() { - SubWindowManager *sw = _mainWindow->getSubWindowManager(); - if (!sw->isPreWindowOpened()) + SubWindowManager* sw = _mainWindow->getSubWindowManager(); + if(!sw->isPreWindowOpened()) this->openPreWinPy(); - MainWidget::PreWindow *p = sw->getPreWindow(); + MainWidget::PreWindow* p = sw->getPreWindow(); - GeometryWidget::CreateBoxDialog *dlg = new GeometryWidget::CreateBoxDialog(_mainWindow, p); + GeometryWidget::CreateBoxDialog* dlg = new GeometryWidget::CreateBoxDialog(_mainWindow, p); this->showDialog(dlg); } void SignalHandler::createCylinder() { - SubWindowManager *sw = _mainWindow->getSubWindowManager(); - if (!sw->isPreWindowOpened()) + SubWindowManager* sw = _mainWindow->getSubWindowManager(); + if(!sw->isPreWindowOpened()) this->openPreWinPy(); - MainWidget::PreWindow *p = sw->getPreWindow(); + MainWidget::PreWindow* p = sw->getPreWindow(); - GeometryWidget::CreateCylinderDialog *dlg = new GeometryWidget::CreateCylinderDialog(_mainWindow, p); + GeometryWidget::CreateCylinderDialog* dlg = + new GeometryWidget::CreateCylinderDialog(_mainWindow, p); this->showDialog(dlg); } void SignalHandler::CreateCone() { - SubWindowManager *sw = _mainWindow->getSubWindowManager(); - if (!sw->isPreWindowOpened()) + SubWindowManager* sw = _mainWindow->getSubWindowManager(); + if(!sw->isPreWindowOpened()) this->openPreWinPy(); - MainWidget::PreWindow *p = sw->getPreWindow(); + MainWidget::PreWindow* p = sw->getPreWindow(); - GeometryWidget::CreateConeDialog *dlg = new GeometryWidget::CreateConeDialog(_mainWindow, p); + GeometryWidget::CreateConeDialog* dlg = + new GeometryWidget::CreateConeDialog(_mainWindow, p); this->showDialog(dlg); } void SignalHandler::CreateSphere() { - SubWindowManager *sw = _mainWindow->getSubWindowManager(); - if (!sw->isPreWindowOpened()) + SubWindowManager* sw = _mainWindow->getSubWindowManager(); + if(!sw->isPreWindowOpened()) this->openPreWinPy(); - MainWidget::PreWindow *p = sw->getPreWindow(); + MainWidget::PreWindow* p = sw->getPreWindow(); - GeometryWidget::CreateSphereDialog *dlg = new GeometryWidget::CreateSphereDialog(_mainWindow, p); + GeometryWidget::CreateSphereDialog* dlg = + new GeometryWidget::CreateSphereDialog(_mainWindow, p); this->showDialog(dlg); } void SignalHandler::CreateFilet() { - SubWindowManager *sw = _mainWindow->getSubWindowManager(); - if (!sw->isPreWindowOpened()) - { + SubWindowManager* sw = _mainWindow->getSubWindowManager(); + if(!sw->isPreWindowOpened()) { QMessageBox::warning(_mainWindow, tr("Warning"), tr("Open PreWindow First!")); return; } - MainWidget::PreWindow *p = sw->getPreWindow(); - GeometryWidget::CreateFiletDialog *dlg = new GeometryWidget::CreateFiletDialog(_mainWindow, p); + MainWidget::PreWindow* p = sw->getPreWindow(); + GeometryWidget::CreateFiletDialog* dlg = + new GeometryWidget::CreateFiletDialog(_mainWindow, p); this->showDialog(dlg); } void SignalHandler::CreateChamfer() { - SubWindowManager *sw = _mainWindow->getSubWindowManager(); - if (!sw->isPreWindowOpened()) - { + SubWindowManager* sw = _mainWindow->getSubWindowManager(); + if(!sw->isPreWindowOpened()) { QMessageBox::warning(_mainWindow, tr("Warning"), tr("Open PreWindow First!")); return; } - MainWidget::PreWindow *p = sw->getPreWindow(); - GeometryWidget::CreateChamferDialog *dlg = new GeometryWidget::CreateChamferDialog(_mainWindow, p); + MainWidget::PreWindow* p = sw->getPreWindow(); + GeometryWidget::CreateChamferDialog* dlg = + new GeometryWidget::CreateChamferDialog(_mainWindow, p); this->showDialog(dlg); } void SignalHandler::CreateBoolCut() { - SubWindowManager *sw = _mainWindow->getSubWindowManager(); - if (!sw->isPreWindowOpened()) - { + SubWindowManager* sw = _mainWindow->getSubWindowManager(); + if(!sw->isPreWindowOpened()) { QMessageBox::warning(_mainWindow, tr("Warning"), tr("Open PreWindow First!")); return; } - MainWidget::PreWindow *p = sw->getPreWindow(); - GeometryWidget::BoolOpertionDialog *dlg = new GeometryWidget::BoolOpertionDialog(_mainWindow, p); + MainWidget::PreWindow* p = sw->getPreWindow(); + GeometryWidget::BoolOpertionDialog* dlg = + new GeometryWidget::BoolOpertionDialog(_mainWindow, p); dlg->setType(BoolCut); this->showDialog(dlg); } void SignalHandler::CreateBoolFause() { - SubWindowManager *sw = _mainWindow->getSubWindowManager(); - if (!sw->isPreWindowOpened()) - { + SubWindowManager* sw = _mainWindow->getSubWindowManager(); + if(!sw->isPreWindowOpened()) { QMessageBox::warning(_mainWindow, tr("Warning"), tr("Open PreWindow First!")); return; } - MainWidget::PreWindow *p = sw->getPreWindow(); - GeometryWidget::BoolOpertionDialog *dlg = new GeometryWidget::BoolOpertionDialog(_mainWindow, p); + MainWidget::PreWindow* p = sw->getPreWindow(); + GeometryWidget::BoolOpertionDialog* dlg = + new GeometryWidget::BoolOpertionDialog(_mainWindow, p); dlg->setType(BoolFause); this->showDialog(dlg); } void SignalHandler::CreateBoolCommon() { - SubWindowManager *sw = _mainWindow->getSubWindowManager(); - if (!sw->isPreWindowOpened()) - { + SubWindowManager* sw = _mainWindow->getSubWindowManager(); + if(!sw->isPreWindowOpened()) { QMessageBox::warning(_mainWindow, tr("Warning"), tr("Open PreWindow First!")); return; } - MainWidget::PreWindow *p = sw->getPreWindow(); - GeometryWidget::BoolOpertionDialog *dlg = new GeometryWidget::BoolOpertionDialog(_mainWindow, p); + MainWidget::PreWindow* p = sw->getPreWindow(); + GeometryWidget::BoolOpertionDialog* dlg = + new GeometryWidget::BoolOpertionDialog(_mainWindow, p); dlg->setType(BoolCommon); this->showDialog(dlg); } void SignalHandler::MirrorFeature() { - SubWindowManager *sw = _mainWindow->getSubWindowManager(); - if (!sw->isPreWindowOpened()) - { + SubWindowManager* sw = _mainWindow->getSubWindowManager(); + if(!sw->isPreWindowOpened()) { QMessageBox::warning(_mainWindow, tr("Warning"), tr("Open PreWindow First!")); return; } - MainWidget::PreWindow *p = sw->getPreWindow(); + MainWidget::PreWindow* p = sw->getPreWindow(); - GeometryWidget::MirorFeatureDialog *dlg = new GeometryWidget::MirorFeatureDialog(_mainWindow, p); + GeometryWidget::MirorFeatureDialog* dlg = + new GeometryWidget::MirorFeatureDialog(_mainWindow, p); this->showDialog(dlg); } void SignalHandler::CreateExtrusion() { - SubWindowManager *sw = _mainWindow->getSubWindowManager(); - if (!sw->isPreWindowOpened()) - { + SubWindowManager* sw = _mainWindow->getSubWindowManager(); + if(!sw->isPreWindowOpened()) { QMessageBox::warning(_mainWindow, tr("Warning"), tr("Open PreWindow First!")); return; } - MainWidget::PreWindow *p = sw->getPreWindow(); - GeometryWidget::CreateExtrusionDialog *dlg = new GeometryWidget::CreateExtrusionDialog(_mainWindow, p); + MainWidget::PreWindow* p = sw->getPreWindow(); + GeometryWidget::CreateExtrusionDialog* dlg = + new GeometryWidget::CreateExtrusionDialog(_mainWindow, p); this->showDialog(dlg); } void SignalHandler::CreateVariableFillet() { - SubWindowManager *sw = _mainWindow->getSubWindowManager(); - if (!sw->isPreWindowOpened()) - { + SubWindowManager* sw = _mainWindow->getSubWindowManager(); + if(!sw->isPreWindowOpened()) { QMessageBox::warning(_mainWindow, tr("Warning"), tr("Open PreWindow First!")); return; } - MainWidget::PreWindow *p = sw->getPreWindow(); - GeometryWidget::VariableFilletDialog *dlg = new GeometryWidget::VariableFilletDialog(_mainWindow, p); + MainWidget::PreWindow* p = sw->getPreWindow(); + GeometryWidget::VariableFilletDialog* dlg = + new GeometryWidget::VariableFilletDialog(_mainWindow, p); this->showDialog(dlg); } void SignalHandler::CreatePoint() { - SubWindowManager *sw = _mainWindow->getSubWindowManager(); - if (!sw->isPreWindowOpened()) + SubWindowManager* sw = _mainWindow->getSubWindowManager(); + if(!sw->isPreWindowOpened()) this->openPreWinPy(); - MainWidget::PreWindow *p = sw->getPreWindow(); + MainWidget::PreWindow* p = sw->getPreWindow(); - GeometryWidget::CreatePointDialog *dlg = new GeometryWidget::CreatePointDialog(_mainWindow, p); + GeometryWidget::CreatePointDialog* dlg = + new GeometryWidget::CreatePointDialog(_mainWindow, p); this->showDialog(dlg); } void SignalHandler::CreateEdge() { - SubWindowManager *sw = _mainWindow->getSubWindowManager(); - if (!sw->isPreWindowOpened()) + SubWindowManager* sw = _mainWindow->getSubWindowManager(); + if(!sw->isPreWindowOpened()) this->openPreWinPy(); - MainWidget::PreWindow *p = sw->getPreWindow(); + MainWidget::PreWindow* p = sw->getPreWindow(); - GeometryWidget::CreateLineDialog *dlg = new GeometryWidget::CreateLineDialog(_mainWindow, p); + GeometryWidget::CreateLineDialog* dlg = + new GeometryWidget::CreateLineDialog(_mainWindow, p); this->showDialog(dlg); } void SignalHandler::CreateFace() { - SubWindowManager *sw = _mainWindow->getSubWindowManager(); - if (!sw->isPreWindowOpened()) + SubWindowManager* sw = _mainWindow->getSubWindowManager(); + if(!sw->isPreWindowOpened()) this->openPreWinPy(); - MainWidget::PreWindow *p = sw->getPreWindow(); + MainWidget::PreWindow* p = sw->getPreWindow(); - GeometryWidget::CreateFaceDialog *dlg = new GeometryWidget::CreateFaceDialog(_mainWindow, p); + GeometryWidget::CreateFaceDialog* dlg = + new GeometryWidget::CreateFaceDialog(_mainWindow, p); this->showDialog(dlg); } void SignalHandler::MoveFeature() { - SubWindowManager *sw = _mainWindow->getSubWindowManager(); - if (!sw->isPreWindowOpened()) - { + SubWindowManager* sw = _mainWindow->getSubWindowManager(); + if(!sw->isPreWindowOpened()) { QMessageBox::warning(_mainWindow, tr("Warning"), tr("Open PreWindow First!")); return; } - MainWidget::PreWindow *p = sw->getPreWindow(); + MainWidget::PreWindow* p = sw->getPreWindow(); - auto dlg = new GeometryWidget::MoveFeatureDialog(_mainWindow, p); + auto dlg = new GeometryWidget::MoveFeatureDialog(_mainWindow, p); this->showDialog(dlg); } void SignalHandler::RotateFeature() { - SubWindowManager *sw = _mainWindow->getSubWindowManager(); - if (!sw->isPreWindowOpened()) - { + SubWindowManager* sw = _mainWindow->getSubWindowManager(); + if(!sw->isPreWindowOpened()) { QMessageBox::warning(_mainWindow, tr("Warning"), tr("Open PreWindow First!")); return; } - MainWidget::PreWindow *p = sw->getPreWindow(); - auto dlg = new GeometryWidget::RotateFeatureDialog(_mainWindow, p); + MainWidget::PreWindow* p = sw->getPreWindow(); + auto dlg = new GeometryWidget::RotateFeatureDialog(_mainWindow, p); this->showDialog(dlg); } void SignalHandler::CreateLoft() { - SubWindowManager *sw = _mainWindow->getSubWindowManager(); - if (!sw->isPreWindowOpened()) - { + SubWindowManager* sw = _mainWindow->getSubWindowManager(); + if(!sw->isPreWindowOpened()) { QMessageBox::warning(_mainWindow, tr("Warning"), tr("Open PreWindow First!")); return; } - MainWidget::PreWindow *p = sw->getPreWindow(); - GeometryWidget::CreateLoftDialog *dlg = new GeometryWidget::CreateLoftDialog(_mainWindow, p); + MainWidget::PreWindow* p = sw->getPreWindow(); + GeometryWidget::CreateLoftDialog* dlg = + new GeometryWidget::CreateLoftDialog(_mainWindow, p); this->showDialog(dlg); } void SignalHandler::CreateSweep() { - SubWindowManager *sw = _mainWindow->getSubWindowManager(); - if (!sw->isPreWindowOpened()) - { + SubWindowManager* sw = _mainWindow->getSubWindowManager(); + if(!sw->isPreWindowOpened()) { QMessageBox::warning(_mainWindow, tr("Warning"), tr("Open PreWindow First!")); return; } - MainWidget::PreWindow *p = sw->getPreWindow(); - GeometryWidget::SweepDialog *dlg = new GeometryWidget::SweepDialog(_mainWindow, p); + MainWidget::PreWindow* p = sw->getPreWindow(); + GeometryWidget::SweepDialog* dlg = new GeometryWidget::SweepDialog(_mainWindow, p); this->showDialog(dlg); } @@ -1001,8 +1045,8 @@ namespace GUI this->openPreWinPy(); MainWidget::PreWindow* p = sw->getPreWindow(); - GeometryWidget::CreateCylindricalComplexDialog* dlg = new GeometryWidget::CreateCylindricalComplexDialog(_mainWindow, p); - this->showDialog(dlg); + GeometryWidget::CreateCylindricalComplexDialog* dlg = new + GeometryWidget::CreateCylindricalComplexDialog(_mainWindow, p); this->showDialog(dlg); } void SignalHandler::CreateBoxComplex() @@ -1012,28 +1056,27 @@ namespace GUI this->openPreWinPy(); MainWidget::PreWindow* p = sw->getPreWindow(); - GeometryWidget::CreateBoxComplexDialog* dlg = new GeometryWidget::CreateBoxComplexDialog(_mainWindow, p); - this->showDialog(dlg); + GeometryWidget::CreateBoxComplexDialog* dlg = new + GeometryWidget::CreateBoxComplexDialog(_mainWindow, p); this->showDialog(dlg); }*/ void SignalHandler::CreateDatumplane() { - SubWindowManager *sw = _mainWindow->getSubWindowManager(); - if (!sw->isPreWindowOpened()) - { + SubWindowManager* sw = _mainWindow->getSubWindowManager(); + if(!sw->isPreWindowOpened()) { QMessageBox::warning(_mainWindow, tr("Warning"), tr("Open PreWindow First!")); return; } - MainWidget::PreWindow *p = sw->getPreWindow(); - GeometryWidget::CreateDatumplaneDialog *dlg = new GeometryWidget::CreateDatumplaneDialog(_mainWindow, p); + MainWidget::PreWindow* p = sw->getPreWindow(); + GeometryWidget::CreateDatumplaneDialog* dlg = + new GeometryWidget::CreateDatumplaneDialog(_mainWindow, p); this->showDialog(dlg); } void SignalHandler::DrawGraphicsLine() { - - SubWindowManager *sw = _mainWindow->getSubWindowManager(); - MainWidget::PreWindow *p = sw->getPreWindow(); + SubWindowManager* sw = _mainWindow->getSubWindowManager(); + MainWidget::PreWindow* p = sw->getPreWindow(); // QAction* action = _mainWindow->getUi()->actionDrawLine; // if (action->isChecked()) p->setSketchType(ModuleBase::SketchLine); @@ -1043,8 +1086,8 @@ namespace GUI void SignalHandler::DrawGraphicsRectangle() { - SubWindowManager *sw = _mainWindow->getSubWindowManager(); - MainWidget::PreWindow *p = sw->getPreWindow(); + SubWindowManager* sw = _mainWindow->getSubWindowManager(); + MainWidget::PreWindow* p = sw->getPreWindow(); // QAction* action = _mainWindow->getUi()->actionDrawRectangle; // if (action->isChecked()) p->setSketchType(ModuleBase::SketchRect); @@ -1054,8 +1097,8 @@ namespace GUI void SignalHandler::DrawGraphicsCircle() { - SubWindowManager *sw = _mainWindow->getSubWindowManager(); - MainWidget::PreWindow *p = sw->getPreWindow(); + SubWindowManager* sw = _mainWindow->getSubWindowManager(); + MainWidget::PreWindow* p = sw->getPreWindow(); // QAction* action = _mainWindow->getUi()->actionDrawCircle; // if (action->isChecked()) p->setSketchType(ModuleBase::SketchCircle); @@ -1065,8 +1108,8 @@ namespace GUI void SignalHandler::DrawGraphicsArc() { - SubWindowManager *sw = _mainWindow->getSubWindowManager(); - MainWidget::PreWindow *p = sw->getPreWindow(); + SubWindowManager* sw = _mainWindow->getSubWindowManager(); + MainWidget::PreWindow* p = sw->getPreWindow(); // QAction* action = _mainWindow->getUi()->actionDrawArc; // bool l = action->isChecked(); // if (action->isChecked()) @@ -1077,31 +1120,31 @@ namespace GUI void SignalHandler::DrawGraphicsPolyline() { - SubWindowManager *sw = _mainWindow->getSubWindowManager(); - MainWidget::PreWindow *p = sw->getPreWindow(); + SubWindowManager* sw = _mainWindow->getSubWindowManager(); + MainWidget::PreWindow* p = sw->getPreWindow(); p->setSketchType(ModuleBase::SketchPolyline); } void SignalHandler::DrawGraphSpline() { - SubWindowManager *sw = _mainWindow->getSubWindowManager(); - MainWidget::PreWindow *p = sw->getPreWindow(); + SubWindowManager* sw = _mainWindow->getSubWindowManager(); + MainWidget::PreWindow* p = sw->getPreWindow(); p->setSketchType(ModuleBase::SketchSpline); } void SignalHandler::CreateRevol() { - SubWindowManager *sw = _mainWindow->getSubWindowManager(); - if (!sw->isPreWindowOpened()) - { + SubWindowManager* sw = _mainWindow->getSubWindowManager(); + if(!sw->isPreWindowOpened()) { QMessageBox::warning(_mainWindow, tr("Warning"), tr("Open PreWindow First!")); return; } - MainWidget::PreWindow *p = sw->getPreWindow(); - GeometryWidget::CreateRevolDialog *dlg = new GeometryWidget::CreateRevolDialog(_mainWindow, p); + MainWidget::PreWindow* p = sw->getPreWindow(); + GeometryWidget::CreateRevolDialog* dlg = + new GeometryWidget::CreateRevolDialog(_mainWindow, p); this->showDialog(dlg); } - void SignalHandler::showDialog(QDialog *d) + void SignalHandler::showDialog(QDialog* d) { int mx = _mainWindow->pos().x(); int my = _mainWindow->pos().y(); @@ -1111,127 +1154,125 @@ namespace GUI void SignalHandler::MakeMatrix() { - SubWindowManager *sw = _mainWindow->getSubWindowManager(); - if (!sw->isPreWindowOpened()) - { + SubWindowManager* sw = _mainWindow->getSubWindowManager(); + if(!sw->isPreWindowOpened()) { QMessageBox::warning(_mainWindow, tr("Warning"), tr("Open PreWindow First!")); return; } - MainWidget::PreWindow *p = sw->getPreWindow(); - GeometryWidget::MakeMatrixDialog *dlg = new GeometryWidget::MakeMatrixDialog(_mainWindow, p); + MainWidget::PreWindow* p = sw->getPreWindow(); + GeometryWidget::MakeMatrixDialog* dlg = + new GeometryWidget::MakeMatrixDialog(_mainWindow, p); this->showDialog(dlg); } void SignalHandler::MeasureDistance() { - SubWindowManager *sw = _mainWindow->getSubWindowManager(); - if (!sw->isPreWindowOpened()) - { + SubWindowManager* sw = _mainWindow->getSubWindowManager(); + if(!sw->isPreWindowOpened()) { QMessageBox::warning(_mainWindow, tr("Warning"), tr("Open PreWindow First!")); return; } - MainWidget::PreWindow *p = sw->getPreWindow(); - GeometryWidget::MeasureDistanceDialog *dlg = new GeometryWidget::MeasureDistanceDialog(_mainWindow, p); + MainWidget::PreWindow* p = sw->getPreWindow(); + GeometryWidget::MeasureDistanceDialog* dlg = + new GeometryWidget::MeasureDistanceDialog(_mainWindow, p); this->showDialog(dlg); } void SignalHandler::GeoSplitter() { - - SubWindowManager *sw = _mainWindow->getSubWindowManager(); - if (!sw->isPreWindowOpened()) - { + SubWindowManager* sw = _mainWindow->getSubWindowManager(); + if(!sw->isPreWindowOpened()) { QMessageBox::warning(_mainWindow, tr("Warning"), tr("Open PreWindow First!")); return; } - MainWidget::PreWindow *p = sw->getPreWindow(); - GeometryWidget::GeoSplitterDialog *dlg = new GeometryWidget::GeoSplitterDialog(_mainWindow, p); + MainWidget::PreWindow* p = sw->getPreWindow(); + GeometryWidget::GeoSplitterDialog* dlg = + new GeometryWidget::GeoSplitterDialog(_mainWindow, p); this->showDialog(dlg); } void SignalHandler::MakeFillHole() { - SubWindowManager *sw = _mainWindow->getSubWindowManager(); - if (!sw->isPreWindowOpened()) - { + SubWindowManager* sw = _mainWindow->getSubWindowManager(); + if(!sw->isPreWindowOpened()) { QMessageBox::warning(_mainWindow, tr("Warning"), tr("Open PreWindow First!")); return; } - MainWidget::PreWindow *p = sw->getPreWindow(); - GeometryWidget::MakeFillHoleDialog *dlg = new GeometryWidget::MakeFillHoleDialog(_mainWindow, p); + MainWidget::PreWindow* p = sw->getPreWindow(); + GeometryWidget::MakeFillHoleDialog* dlg = + new GeometryWidget::MakeFillHoleDialog(_mainWindow, p); this->showDialog(dlg); } void SignalHandler::MakeRemoveSurface() { - SubWindowManager *sw = _mainWindow->getSubWindowManager(); - if (!sw->isPreWindowOpened()) - { + SubWindowManager* sw = _mainWindow->getSubWindowManager(); + if(!sw->isPreWindowOpened()) { QMessageBox::warning(_mainWindow, tr("Warning"), tr("Open PreWindow First!")); return; } - MainWidget::PreWindow *p = sw->getPreWindow(); - GeometryWidget::MakeRemoveSurfaceDialog *dlg = new GeometryWidget::MakeRemoveSurfaceDialog(_mainWindow, p); + MainWidget::PreWindow* p = sw->getPreWindow(); + GeometryWidget::MakeRemoveSurfaceDialog* dlg = + new GeometryWidget::MakeRemoveSurfaceDialog(_mainWindow, p); this->showDialog(dlg); } void SignalHandler::MakeFillGap() { - SubWindowManager *sw = _mainWindow->getSubWindowManager(); - if (!sw->isPreWindowOpened()) - { + SubWindowManager* sw = _mainWindow->getSubWindowManager(); + if(!sw->isPreWindowOpened()) { QMessageBox::warning(_mainWindow, tr("Warning"), tr("Open PreWindow First!")); return; } - MainWidget::PreWindow *p = sw->getPreWindow(); - GeometryWidget::MakeFillGapDialog *dlg = new GeometryWidget::MakeFillGapDialog(_mainWindow, p); + MainWidget::PreWindow* p = sw->getPreWindow(); + GeometryWidget::MakeFillGapDialog* dlg = + new GeometryWidget::MakeFillGapDialog(_mainWindow, p); this->showDialog(dlg); } void SignalHandler::openPostFile() { - SubWindowManager *sw = _mainWindow->getSubWindowManager(); - ModuleBase::GraphWindowBase *gw = sw->getCurrentWindow(); - if (gw == nullptr) + SubWindowManager* sw = _mainWindow->getSubWindowManager(); + ModuleBase::GraphWindowBase* gw = sw->getCurrentWindow(); + if(gw == nullptr) return; - const int id = gw->getID(); - const QString type = gw->getStringGraphWindowType(); + const int id = gw->getID(); + const QString type = gw->getStringGraphWindowType(); - Post::Post3DWindowInterface *pInterface = dynamic_cast(gw); - if (pInterface == nullptr) + Post::Post3DWindowInterface* pInterface = dynamic_cast(gw); + if(pInterface == nullptr) return; - Post::Post3DWindow *pWindow = pInterface->getWindow(); - if (pWindow == nullptr) + Post::Post3DWindow* pWindow = pInterface->getWindow(); + if(pWindow == nullptr) return; FileDirectoryDialog dlg; - QStringList filterTypes = { - "VTK(*.vtk)", - "CGNS(*.cgns)", - "Plot3D(*.x)", - "Tecplot(*.szplt)"}; + QStringList filterTypes = { "VTK(*.vtk)", "CGNS(*.cgns)", "Plot3D(*.x)", + "Tecplot(*.szplt)" }; dlg.iniFileFilterType(filterTypes); - if (dlg.exec() != QDialog::Accepted) + if(dlg.exec() != QDialog::Accepted) return; QString files = dlg.getCurrentFullPath(); - if (files.isEmpty()) + if(files.isEmpty()) return; - QString pycode = QString("PostProcess.openPostFile(%1,'%2','%3')").arg(id).arg(type).arg(files); + QString pycode = + QString("PostProcess.openPostFile(%1,'%2','%3')").arg(id).arg(type).arg(files); Py::PythonAgent::getInstance()->submit(pycode); // pWindow->openFile(files); - // QString pycode = QString("MainWindow.openPostFile(%1,%2,%3)").arg(id).arg(type).arg(files); + // QString pycode = + // QString("MainWindow.openPostFile(%1,%2,%3)").arg(id).arg(type).arg(files); // Py::PythonAgent::getInstance()->submit(pycode); } void SignalHandler::openPlotFile() { - SubWindowManager *sw = _mainWindow->getSubWindowManager(); - ModuleBase::GraphWindowBase *gw = sw->getCurrentWindow(); - if (gw == nullptr) + SubWindowManager* sw = _mainWindow->getSubWindowManager(); + ModuleBase::GraphWindowBase* gw = sw->getCurrentWindow(); + if(gw == nullptr) return; - const int id = gw->getID(); - const QString type = gw->getStringGraphWindowType(); + const int id = gw->getID(); + const QString type = gw->getStringGraphWindowType(); /* FileDirectoryDialog dlg; @@ -1240,16 +1281,17 @@ namespace GUI QString files = dlg.getCurrentFullPath(); */ - QString files = QFileDialog::getOpenFileName(_mainWindow, tr("open file"), " ", tr("dat(*.dat);;Allfile(*.*)")); - if (files.isEmpty()) + QString files = QFileDialog::getOpenFileName(_mainWindow, tr("open file"), " ", + tr("dat(*.dat);;Allfile(*.*)")); + if(files.isEmpty()) return; - Post::Post2DWindowInterface *pInterface = dynamic_cast(gw); - if (pInterface == nullptr) + Post::Post2DWindowInterface* pInterface = dynamic_cast(gw); + if(pInterface == nullptr) return; - Post::Post2DWindow *pWindow = pInterface->getWindow(); - if (pWindow == nullptr) + Post::Post2DWindow* pWindow = pInterface->getWindow(); + if(pWindow == nullptr) return; pWindow->openFile(files); @@ -1257,17 +1299,17 @@ namespace GUI void SignalHandler::setPostDisplayMode(int type) { - SubWindowManager *sw = _mainWindow->getSubWindowManager(); - ModuleBase::GraphWindowBase *gw = sw->getCurrentWindow(); - if (gw == nullptr) + SubWindowManager* sw = _mainWindow->getSubWindowManager(); + ModuleBase::GraphWindowBase* gw = sw->getCurrentWindow(); + if(gw == nullptr) return; - Post::Post3DWindowInterface *pInterface = dynamic_cast(gw); - if (pInterface == nullptr) + Post::Post3DWindowInterface* pInterface = dynamic_cast(gw); + if(pInterface == nullptr) return; - Post::Post3DWindow *pWindow = pInterface->getWindow(); - if (pWindow == nullptr) + Post::Post3DWindow* pWindow = pInterface->getWindow(); + if(pWindow == nullptr) return; QString pycode = QString("PostProcess.setDisplayMode(%1,%2)").arg(gw->getID()).arg(type); @@ -1277,226 +1319,235 @@ namespace GUI void SignalHandler::createPostVector() { - SubWindowManager *sw = _mainWindow->getSubWindowManager(); - ModuleBase::GraphWindowBase *gw = sw->getCurrentWindow(); - if (gw == nullptr) + SubWindowManager* sw = _mainWindow->getSubWindowManager(); + ModuleBase::GraphWindowBase* gw = sw->getCurrentWindow(); + if(gw == nullptr) return; - Post::Post3DWindowInterface *pInterface = dynamic_cast(gw); - if (pInterface == nullptr) + Post::Post3DWindowInterface* pInterface = dynamic_cast(gw); + if(pInterface == nullptr) return; - Post::Post3DWindow *pWindow = pInterface->getWindow(); - if (pWindow == nullptr) + Post::Post3DWindow* pWindow = pInterface->getWindow(); + if(pWindow == nullptr) return; - Post::CreateVectorDialog *dlg = new Post::CreateVectorDialog(_mainWindow->getControlPanel()->getPostTreeWidget(), _mainWindow); + Post::CreateVectorDialog* dlg = new Post::CreateVectorDialog( + _mainWindow->getControlPanel()->getPostTreeWidget(), _mainWindow); dlg->show(); // pWindow->setDisplayMode(type); } void SignalHandler::createPostClip() { - SubWindowManager *sw = _mainWindow->getSubWindowManager(); - ModuleBase::GraphWindowBase *gw = sw->getCurrentWindow(); - if (gw == nullptr) + SubWindowManager* sw = _mainWindow->getSubWindowManager(); + ModuleBase::GraphWindowBase* gw = sw->getCurrentWindow(); + if(gw == nullptr) return; - Post::Post3DWindowInterface *pInterface = dynamic_cast(gw); - if (pInterface == nullptr) + Post::Post3DWindowInterface* pInterface = dynamic_cast(gw); + if(pInterface == nullptr) return; - Post::Post3DWindow *pWindow = pInterface->getWindow(); - if (pWindow == nullptr) + Post::Post3DWindow* pWindow = pInterface->getWindow(); + if(pWindow == nullptr) return; - Post::CreateClipDialog *dlg = new Post::CreateClipDialog(_mainWindow->getControlPanel()->getPostTreeWidget(), true, _mainWindow); + Post::CreateClipDialog* dlg = new Post::CreateClipDialog( + _mainWindow->getControlPanel()->getPostTreeWidget(), true, _mainWindow); dlg->show(); } void SignalHandler::createPostSlice() { - SubWindowManager *sw = _mainWindow->getSubWindowManager(); - ModuleBase::GraphWindowBase *gw = sw->getCurrentWindow(); - if (gw == nullptr) + SubWindowManager* sw = _mainWindow->getSubWindowManager(); + ModuleBase::GraphWindowBase* gw = sw->getCurrentWindow(); + if(gw == nullptr) return; - Post::Post3DWindowInterface *pInterface = dynamic_cast(gw); - if (pInterface == nullptr) + Post::Post3DWindowInterface* pInterface = dynamic_cast(gw); + if(pInterface == nullptr) return; - Post::Post3DWindow *pWindow = pInterface->getWindow(); - if (pWindow == nullptr) + Post::Post3DWindow* pWindow = pInterface->getWindow(); + if(pWindow == nullptr) return; - Post::CreateClipDialog *dlg = new Post::CreateClipDialog(_mainWindow->getControlPanel()->getPostTreeWidget(), false, _mainWindow); + Post::CreateClipDialog* dlg = new Post::CreateClipDialog( + _mainWindow->getControlPanel()->getPostTreeWidget(), false, _mainWindow); dlg->show(); } void SignalHandler::createPostStreamLine() { - SubWindowManager *sw = _mainWindow->getSubWindowManager(); - ModuleBase::GraphWindowBase *gw = sw->getCurrentWindow(); - if (gw == nullptr) + SubWindowManager* sw = _mainWindow->getSubWindowManager(); + ModuleBase::GraphWindowBase* gw = sw->getCurrentWindow(); + if(gw == nullptr) return; - Post::Post3DWindowInterface *pInterface = dynamic_cast(gw); - if (pInterface == nullptr) + Post::Post3DWindowInterface* pInterface = dynamic_cast(gw); + if(pInterface == nullptr) return; - Post::Post3DWindow *pWindow = pInterface->getWindow(); - if (pWindow == nullptr) + Post::Post3DWindow* pWindow = pInterface->getWindow(); + if(pWindow == nullptr) return; - Post::CreateStreamLineDialog *dlg = new Post::CreateStreamLineDialog(_mainWindow->getControlPanel()->getPostTreeWidget(), _mainWindow); + Post::CreateStreamLineDialog* dlg = new Post::CreateStreamLineDialog( + _mainWindow->getControlPanel()->getPostTreeWidget(), _mainWindow); dlg->show(); } void SignalHandler::createPostISOSurface() { - SubWindowManager *sw = _mainWindow->getSubWindowManager(); - ModuleBase::GraphWindowBase *gw = sw->getCurrentWindow(); - if (gw == nullptr) + SubWindowManager* sw = _mainWindow->getSubWindowManager(); + ModuleBase::GraphWindowBase* gw = sw->getCurrentWindow(); + if(gw == nullptr) return; - Post::Post3DWindowInterface *pInterface = dynamic_cast(gw); - if (pInterface == nullptr) + Post::Post3DWindowInterface* pInterface = dynamic_cast(gw); + if(pInterface == nullptr) return; - Post::Post3DWindow *pWindow = pInterface->getWindow(); - if (pWindow == nullptr) + Post::Post3DWindow* pWindow = pInterface->getWindow(); + if(pWindow == nullptr) return; - Post::CreateISODialog *dlg = new Post::CreateISODialog(_mainWindow->getControlPanel()->getPostTreeWidget(), true, _mainWindow); + Post::CreateISODialog* dlg = new Post::CreateISODialog( + _mainWindow->getControlPanel()->getPostTreeWidget(), true, _mainWindow); dlg->show(); } void SignalHandler::createPostISOCurve() { - SubWindowManager *sw = _mainWindow->getSubWindowManager(); - ModuleBase::GraphWindowBase *gw = sw->getCurrentWindow(); - if (gw == nullptr) + SubWindowManager* sw = _mainWindow->getSubWindowManager(); + ModuleBase::GraphWindowBase* gw = sw->getCurrentWindow(); + if(gw == nullptr) return; - Post::Post3DWindowInterface *pInterface = dynamic_cast(gw); - if (pInterface == nullptr) + Post::Post3DWindowInterface* pInterface = dynamic_cast(gw); + if(pInterface == nullptr) return; - Post::Post3DWindow *pWindow = pInterface->getWindow(); - if (pWindow == nullptr) + Post::Post3DWindow* pWindow = pInterface->getWindow(); + if(pWindow == nullptr) return; - Post::CreateISODialog *dlg = new Post::CreateISODialog(_mainWindow->getControlPanel()->getPostTreeWidget(), false, _mainWindow); + Post::CreateISODialog* dlg = new Post::CreateISODialog( + _mainWindow->getControlPanel()->getPostTreeWidget(), false, _mainWindow); dlg->show(); } void SignalHandler::createPostCalculator() { - SubWindowManager *sw = _mainWindow->getSubWindowManager(); - ModuleBase::GraphWindowBase *gw = sw->getCurrentWindow(); - if (gw == nullptr) + SubWindowManager* sw = _mainWindow->getSubWindowManager(); + ModuleBase::GraphWindowBase* gw = sw->getCurrentWindow(); + if(gw == nullptr) return; - Post::Post3DWindowInterface *pInterface = dynamic_cast(gw); - if (pInterface == nullptr) + Post::Post3DWindowInterface* pInterface = dynamic_cast(gw); + if(pInterface == nullptr) return; - Post::Post3DWindow *pWindow = pInterface->getWindow(); - if (pWindow == nullptr) + Post::Post3DWindow* pWindow = pInterface->getWindow(); + if(pWindow == nullptr) return; - Post::CreateCalculateDialog *dlg = new Post::CreateCalculateDialog(_mainWindow->getControlPanel()->getPostTreeWidget(), _mainWindow); + Post::CreateCalculateDialog* dlg = new Post::CreateCalculateDialog( + _mainWindow->getControlPanel()->getPostTreeWidget(), _mainWindow); dlg->show(); } void SignalHandler::createPostReflection() { - SubWindowManager *sw = _mainWindow->getSubWindowManager(); - ModuleBase::GraphWindowBase *gw = sw->getCurrentWindow(); - if (gw == nullptr) + SubWindowManager* sw = _mainWindow->getSubWindowManager(); + ModuleBase::GraphWindowBase* gw = sw->getCurrentWindow(); + if(gw == nullptr) return; - Post::Post3DWindowInterface *pInterface = dynamic_cast(gw); - if (pInterface == nullptr) + Post::Post3DWindowInterface* pInterface = dynamic_cast(gw); + if(pInterface == nullptr) return; - Post::Post3DWindow *pWindow = pInterface->getWindow(); - if (pWindow == nullptr) + Post::Post3DWindow* pWindow = pInterface->getWindow(); + if(pWindow == nullptr) return; - Post::CreateReflectionDialog *dlg = new Post::CreateReflectionDialog(_mainWindow->getControlPanel()->getPostTreeWidget(), _mainWindow); + Post::CreateReflectionDialog* dlg = new Post::CreateReflectionDialog( + _mainWindow->getControlPanel()->getPostTreeWidget(), _mainWindow); dlg->show(); } void SignalHandler::savePostPicture() { - SubWindowManager *sw = _mainWindow->getSubWindowManager(); - ModuleBase::GraphWindowBase *gw = sw->getCurrentWindow(); - if (gw == nullptr) + SubWindowManager* sw = _mainWindow->getSubWindowManager(); + ModuleBase::GraphWindowBase* gw = sw->getCurrentWindow(); + if(gw == nullptr) return; - Post::Post3DWindowInterface *pInterface = dynamic_cast(gw); - if (pInterface == nullptr) + Post::Post3DWindowInterface* pInterface = dynamic_cast(gw); + if(pInterface == nullptr) return; - Post::Post3DWindow *pWindow = pInterface->getWindow(); - if (pWindow == nullptr) + Post::Post3DWindow* pWindow = pInterface->getWindow(); + if(pWindow == nullptr) return; - QString fileName = QFileDialog::getSaveFileName(_mainWindow, tr("Select File."), qApp->applicationDirPath(), - "PNG files(*.png);;BMP files(*.bmp);;JPG files(*.jpg)"); + QString fileName = QFileDialog::getSaveFileName( + _mainWindow, tr("Select File."), qApp->applicationDirPath(), + "PNG files(*.png);;BMP files(*.bmp);;JPG files(*.jpg)"); - if (fileName.isEmpty()) + if(fileName.isEmpty()) return; - QString pycode = QString("PostProcess.savePostImage(%1,'%2')").arg(gw->getID()).arg(fileName); + QString pycode = + QString("PostProcess.savePostImage(%1,'%2')").arg(gw->getID()).arg(fileName); Py::PythonAgent::getInstance()->submit(pycode); // pWindow->saveImage(fileName); } void SignalHandler::savePostAnimation() { - SubWindowManager *sw = _mainWindow->getSubWindowManager(); - ModuleBase::GraphWindowBase *gw = sw->getCurrentWindow(); - if (gw == nullptr) + SubWindowManager* sw = _mainWindow->getSubWindowManager(); + ModuleBase::GraphWindowBase* gw = sw->getCurrentWindow(); + if(gw == nullptr) return; - Post::Post3DWindowInterface *pInterface = dynamic_cast(gw); - if (pInterface == nullptr) + Post::Post3DWindowInterface* pInterface = dynamic_cast(gw); + if(pInterface == nullptr) return; - Post::Post3DWindow *pWindow = pInterface->getWindow(); - if (pWindow == nullptr) + Post::Post3DWindow* pWindow = pInterface->getWindow(); + if(pWindow == nullptr) return; - auto tree = _mainWindow->getControlPanel()->getPostTreeWidget(); - auto obj = tree->getCurrentRenderData(); - auto unSteady = dynamic_cast(obj); - if (unSteady == nullptr) + auto tree = _mainWindow->getControlPanel()->getPostTreeWidget(); + auto obj = tree->getCurrentRenderData(); + auto unSteady = dynamic_cast(obj); + if(unSteady == nullptr) return; Post::SaveAnimationDialog dlg(_mainWindow->getAnimationToolBar(), _mainWindow); - if (dlg.exec() == QDialog::Accepted) - { + if(dlg.exec() == QDialog::Accepted) { QString file; - int id = -1, fps = -1; + int id = -1, fps = -1; dlg.getAnimationInfo(id, file, fps); - QString code = QString("PostProcess.savePostAnimation(%1,'%2',%3)").arg(id).arg(file).arg(fps); + QString code = + QString("PostProcess.savePostAnimation(%1,'%2',%3)").arg(id).arg(file).arg(fps); Py::PythonAgent::getInstance()->submit(code); } } void SignalHandler::GeoMeshRotate() { - SubWindowManager *sw = _mainWindow->getSubWindowManager(); - if (!sw->isPreWindowOpened()) - { + SubWindowManager* sw = _mainWindow->getSubWindowManager(); + if(!sw->isPreWindowOpened()) { QMessageBox::warning(_mainWindow, tr("Warning"), tr("Open PreWindow First!")); return; } - MainWidget::PreWindow *p = sw->getPreWindow(); - MainWidget::GeoMeshRotateDialog *dlg = new MainWidget::GeoMeshRotateDialog(_mainWindow, p); + MainWidget::PreWindow* p = sw->getPreWindow(); + MainWidget::GeoMeshRotateDialog* dlg = new MainWidget::GeoMeshRotateDialog(_mainWindow, p); this->showDialog(dlg); } @@ -1505,4 +1556,4 @@ namespace GUI QString pycode = QString("MainWindow.openPreWindow()"); Py::PythonAgent::getInstance()->submit(pycode); } -} +} // namespace GUI diff --git a/src/mainWindow/signalHandler.h b/src/MainWindow/SignalHandler.h similarity index 70% rename from src/mainWindow/signalHandler.h rename to src/MainWindow/SignalHandler.h index ec0970e..dd9e5ff 100644 --- a/src/mainWindow/signalHandler.h +++ b/src/MainWindow/SignalHandler.h @@ -1,26 +1,24 @@ #ifndef _SIGNALHANDLER_H_ #define _SIGNALHANDLER_H_ +#include "MainWindowAPI.h" + #include #include -#include "mainWindowAPI.h" class QDialog; class QTreeWidgetItem; class vtkDataSet; -namespace Post -{ +namespace Post { class PostWindowBase; } -namespace GUI -{ +namespace GUI { class MainWindow; class SolveProcessManager; - class MAINWINDOWAPI SignalHandler : public QObject - { + class MAINWINDOWAPI SignalHandler : public QObject { Q_OBJECT public: SignalHandler(MainWindow* mainwindow); @@ -35,25 +33,23 @@ namespace GUI void saveToProjectFileSig(QString fileName); void solveProjectSig(int projectIndex, int solverIndex); void projectFileProcessedSig(QString file, bool success, bool isread); - public: - //不要通过返回值判断 - bool importGeometry(const QStringList &filenames); - bool exportGeometry(QString f); - QString getMD5(); + // 不要通过返回值判断 + bool importGeometry(const QStringList& filenames); + bool exportGeometry(QString f); + QString getMD5(); /*创建工程 */ - void on_actionNew(); - ///获取求解管理器 + void on_actionNew(); + /// 获取求解管理器 SolveProcessManager* getSolveProcessManager(); - - + public slots: - //导入网格 - bool importMeshSlot(const QString &fileName, const QString& suffix, int modelId); - //导出网格 - bool exportMeshSlot(const QString &fileName, const QString& suffix, int modelId); - ///清除数据 + // 导入网格 + bool importMeshSlot(const QString& fileName, const QString& suffix, int modelId); + // 导出网格 + bool exportMeshSlot(const QString& fileName, const QString& suffix, int modelId); + /// 清除数据 void clearData(bool unlock = true); /*求解 */ void on_actionSolve(); @@ -61,54 +57,54 @@ namespace GUI void on_actionEnglish(); /*切换为中文 */ void on_actionChinese(); - //切换到Ribbon风格 + // 切换到Ribbon风格 void on_actionRibbon(); - //切换到正常风格 + // 切换到正常风格 void on_actionNormal(); /*处理模型树事件 */ - void handleTreeMouseEvent(int eventtype, QTreeWidgetItem*item, int proID); - ///求解 + void handleTreeMouseEvent(int eventtype, QTreeWidgetItem* item, int proID); + /// 求解 void solveProjectPy(int projectIndex, int solverIndex); void solveProject(int projectIndex, int solverIndex); - ///生成面网格 + /// 生成面网格 void generateSurfaceMesh(); - ///生成体网格 + /// 生成体网格 void generateSolidMesh(); - //生成流体域网格 + // 生成流体域网格 void generateFluidMesh(); - ///生成网格 + /// 生成网格 void genMesh(); - //添加求解器生成网格 + // 添加求解器生成网格 void appendGeneratedMesh(QString name, vtkDataSet* dataset); - ///刷新Action状态 + /// 刷新Action状态 void updateActionsStates(); void updatePostActionStates(); - //独立打开2D后处理窗口 + // 独立打开2D后处理窗口 void open2DPlotWindow(); - void open2DPlotWindowPy();//提交py代码 - //独立打开3D后处理窗口 + void open2DPlotWindowPy(); // 提交py代码 + // 独立打开3D后处理窗口 void open3DGraphWindow(); void open3DGraphWindowPy(); - //关闭后处理窗口 + // 关闭后处理窗口 void closePostWindow(Post::PostWindowBase* p); - //保存图片 + // 保存图片 void saveImange(); bool openProjectFile(QString fileName); void projectFileProcessed(QString filename, bool success, bool read); void saveToProjectFile(QString fileName); - //检查网格质量 + // 检查网格质量 void meshChecking(); - //显示用户引导 + // 显示用户引导 void showUserGuidence(bool start = false); - //创建几何 + // 创建几何 void undo(); void redo(); void createBox(); void createCylinder(); void CreateSphere(); void CreateCone(); - //void CreateCylindricalComplex(); - //void CreateBoxComplex(); + // void CreateCylindricalComplex(); + // void CreateBoxComplex(); void CreatePoint(); void CreateEdge(); void CreateFace(); @@ -144,8 +140,8 @@ namespace GUI void setPostDisplayMode(int type); void createPostVector(); - //打开二维曲线文件 - void openPlotFile(); + // 打开二维曲线文件 + void openPlotFile(); void createPostClip(); void createPostSlice(); void createPostStreamLine(); @@ -157,18 +153,18 @@ namespace GUI void savePostAnimation(); void GeoMeshRotate(); + private: - void handleSingleClickEvent(QTreeWidgetItem*item, int proID); + void handleSingleClickEvent(QTreeWidgetItem* item, int proID); void openPreWinPy(); private: - MainWindow* _mainWindow{}; - int _proID{ -1 }; + MainWindow* _mainWindow{}; + int _proID{ -1 }; SolveProcessManager* _solveProcessManager{}; - bool _launched{ false }; -// QString _currentFilePath{}; - + bool _launched{ false }; + // QString _currentFilePath{}; }; -} +} // namespace GUI #endif diff --git a/src/mainWindow/solveProcessManager.cpp b/src/MainWindow/SolveProcessManager.cpp similarity index 86% rename from src/mainWindow/solveProcessManager.cpp rename to src/MainWindow/SolveProcessManager.cpp index e597750..30a1d9a 100644 --- a/src/mainWindow/solveProcessManager.cpp +++ b/src/MainWindow/SolveProcessManager.cpp @@ -1,18 +1,16 @@ -#include "solveProcessManager.h" +#include "SolveProcessManager.h" + #include "SolverControl/SolverControlerBase.h" - -namespace GUI -{ +namespace GUI { SolveProcessManager::~SolveProcessManager() { QList ss = _solvingProcess.values(); - for (auto s : ss) + for(auto s : ss) s->stopSolver(); _solvingProcess.clear(); } - bool SolveProcessManager::isSolving(int id) { return _solvingProcess.contains(id); @@ -22,17 +20,16 @@ namespace GUI { connect(p, SIGNAL(removeSolver(int)), this, SLOT(removeSolve(int))); bool ok = connect(p, SIGNAL(processFinish(int)), this, SLOT(solveFinished(int))); - if (ok) + if(ok) _solvingProcess.insert(id, p); } - - void SolveProcessManager::solveFinished(int id) { auto p = _solvingProcess.value(id); _solvingProcess.remove(id); - if (p == nullptr) return; + if(p == nullptr) + return; p->stopSolver(); } @@ -41,4 +38,4 @@ namespace GUI _solvingProcess.remove(id); } -} \ No newline at end of file +} // namespace GUI \ No newline at end of file diff --git a/src/mainWindow/solveProcessManager.h b/src/MainWindow/SolveProcessManager.h similarity index 65% rename from src/mainWindow/solveProcessManager.h rename to src/MainWindow/SolveProcessManager.h index 75af562..30f5682 100644 --- a/src/mainWindow/solveProcessManager.h +++ b/src/MainWindow/SolveProcessManager.h @@ -1,19 +1,17 @@ #ifndef SOLVEPROCESSMANAGER_H_ #define SOLVEPROCESSMANAGER_H_ +#include "MainWindowAPI.h" + #include #include -#include "mainWindowAPI.h" -namespace SolverControl -{ +namespace SolverControl { class SolverControlBase; } -namespace GUI -{ - class MAINWINDOWAPI SolveProcessManager : public QObject - { +namespace GUI { + class MAINWINDOWAPI SolveProcessManager : public QObject { Q_OBJECT public: SolveProcessManager() = default; @@ -23,15 +21,13 @@ namespace GUI void insertProcess(int id, SolverControl::SolverControlBase* p); private slots: - void solveFinished(int id); - void removeSolve(int id); + void solveFinished(int id); + void removeSolve(int id); private: QHash _solvingProcess{}; }; -} - - +} // namespace GUI #endif \ No newline at end of file diff --git a/src/mainWindow/SubWindowManager.cpp b/src/MainWindow/SubWindowManager.cpp similarity index 52% rename from src/mainWindow/SubWindowManager.cpp rename to src/MainWindow/SubWindowManager.cpp index 3734df0..6c56f56 100644 --- a/src/mainWindow/SubWindowManager.cpp +++ b/src/MainWindow/SubWindowManager.cpp @@ -1,64 +1,79 @@ #include "SubWindowManager.h" -#include "SARibbonMWUi.h" -#include -#include -#include -#include -#include "MainWidgets/preWindow.h" -#include "MainWidgets/ControlPanel.h" -#include "MeshData/meshSingleton.h" + +#include "Common/Types.h" #include "Geometry/geometryData.h" +#include "GeometryCommand/GeoCommandPy.h" +#include "MainWidgets/ControlPanel.h" +#include "MainWidgets/preWindow.h" +#include "MainWindow.h" +#include "MeshData/meshSingleton.h" +#include "ModuleBase/graphWindowBase.h" +#include "PostInterface/PostProcessPy.h" #include "PostWidgets/PostWindowBase.h" #include "PostWidgets/RealTimeWindowBase.h" -#include "ModuleBase/graphWindowBase.h" -#include "XGenerateReport/ReportWindow.h" -#include "MainWindow.h" -#include "signalHandler.h" #include "PythonModule/PyAgent.h" -#include "GeometryCommand/GeoCommandPy.h" #include "SARibbonBar/SARibbonBar.h" -#include "PostInterface/PostProcessPy.h" -#include "Common/Types.h" -#include -#include +#include "SARibbonMWUi.h" +#include "SignalHandler.h" +#include "XGenerateReport/ReportWindow.h" -namespace GUI -{ - SubWindowManager::SubWindowManager(MainWindow *mainwindow, QMdiArea *mdiArea, SignalHandler *hander, MainWidget::ControlPanel *cp) - : _mainWindow(mainwindow), _mdiArea(mdiArea), _signalHander(hander), _controlPanel(cp) +#include +#include +#include +#include +#include +#include + +namespace GUI { + SubWindowManager::SubWindowManager(MainWindow* mainwindow, QMdiArea* mdiArea, + SignalHandler* hander, MainWidget::ControlPanel* cp) + : _mainWindow(mainwindow) + , _mdiArea(mdiArea) + , _signalHander(hander) + , _controlPanel(cp) { connect(mainwindow, SIGNAL(closePreWindowSig()), this, SLOT(closePreWindow())); - connect(mainwindow, SIGNAL(openPostWindowSig(Post::PostWindowBase *)), this, SLOT(openPostWindow(Post::PostWindowBase *))); - connect(mainwindow, SIGNAL(openRealTimeWindowSig(Post::RealTimeWindowBase *, int)), this, SLOT(openRealTimeWindow(Post::RealTimeWindowBase *))); - connect(mainwindow, SIGNAL(showPostWindowInfoSig(int, int)), this, SLOT(showPostWindowInfo(int, int))); - connect(mainwindow, SIGNAL(closePostWindowSig(Post::PostWindowBase *)), this, SLOT(closePostWindow(Post::PostWindowBase *))); - connect(_mdiArea, SIGNAL(subWindowActivated(QMdiSubWindow *)), this, SLOT(subWindowActived(QMdiSubWindow *))); - connect(mainwindow, SIGNAL(closeRealTimeWindowSig(Post::RealTimeWindowBase *)), this, SLOT(closeRealTimeWindow(Post::RealTimeWindowBase *))); - connect(mainwindow, SIGNAL(openReportWindowSig(XReport::ReportWindow *)), this, SLOT(openReportWindow(XReport::ReportWindow *))); - connect(mainwindow, SIGNAL(closeReportWindowSig(XReport::ReportWindow *)), this, SLOT(closeReportWindow(XReport::ReportWindow *))); - connect(mainwindow, SIGNAL(saveImageSig(QString, int, Post::PostWindowBase *, int, int)), this, SLOT(saveImage(QString, int, Post::PostWindowBase *, int, int))); - connect(mainwindow, SIGNAL(saveImage(int, int, QString)), this, SLOT(saveImage(int, int, QString))); + connect(mainwindow, SIGNAL(openPostWindowSig(Post::PostWindowBase*)), this, + SLOT(openPostWindow(Post::PostWindowBase*))); + connect(mainwindow, SIGNAL(openRealTimeWindowSig(Post::RealTimeWindowBase*, int)), this, + SLOT(openRealTimeWindow(Post::RealTimeWindowBase*))); + connect(mainwindow, SIGNAL(showPostWindowInfoSig(int, int)), this, + SLOT(showPostWindowInfo(int, int))); + connect(mainwindow, SIGNAL(closePostWindowSig(Post::PostWindowBase*)), this, + SLOT(closePostWindow(Post::PostWindowBase*))); + connect(_mdiArea, SIGNAL(subWindowActivated(QMdiSubWindow*)), this, + SLOT(subWindowActived(QMdiSubWindow*))); + connect(mainwindow, SIGNAL(closeRealTimeWindowSig(Post::RealTimeWindowBase*)), this, + SLOT(closeRealTimeWindow(Post::RealTimeWindowBase*))); + connect(mainwindow, SIGNAL(openReportWindowSig(XReport::ReportWindow*)), this, + SLOT(openReportWindow(XReport::ReportWindow*))); + connect(mainwindow, SIGNAL(closeReportWindowSig(XReport::ReportWindow*)), this, + SLOT(closeReportWindow(XReport::ReportWindow*))); + connect(mainwindow, SIGNAL(saveImageSig(QString, int, Post::PostWindowBase*, int, int)), + this, SLOT(saveImage(QString, int, Post::PostWindowBase*, int, int))); + connect(mainwindow, SIGNAL(saveImage(int, int, QString)), this, + SLOT(saveImage(int, int, QString))); - connect(this, SIGNAL(setViewSig(int, QString, QString)), this, SLOT(setView(int, QString, QString))); - connect(this, SIGNAL(setViewValueSig(int, QString, int, int, int, int, int, int, int, int, int)), this, SLOT(setViewValue(int, QString, int, int, int, int, int, int, int, int, int))); - connect(this, SIGNAL(saveImageSig(int, int, int, QString, QString)), this, SLOT(saveImage(int, int, int, QString, QString))); + connect(this, SIGNAL(setViewSig(int, QString, QString)), this, + SLOT(setView(int, QString, QString))); + connect(this, + SIGNAL(setViewValueSig(int, QString, int, int, int, int, int, int, int, int, int)), + this, + SLOT(setViewValue(int, QString, int, int, int, int, int, int, int, int, int))); + connect(this, SIGNAL(saveImageSig(int, int, int, QString, QString)), this, + SLOT(saveImage(int, int, int, QString, QString))); connect(this, SIGNAL(openPreWindowSig()), this, SLOT(openPreWindow())); - - } - SubWindowManager::~SubWindowManager() - { } + SubWindowManager::~SubWindowManager() {} void SubWindowManager::openPreWindow() { - if (isPreWindowOpened()) - { + if(isPreWindowOpened()) { Py::PythonAgent::getInstance()->unLock(); return; } - if (_preWindow.first == nullptr || _preWindow.second == nullptr) - { + if(_preWindow.first == nullptr || _preWindow.second == nullptr) { _preWindow.second = new MainWidget::PreWindow(_mainWindow); - _preWindow.first = _mdiArea->addSubWindow(_preWindow.second); + _preWindow.first = _mdiArea->addSubWindow(_preWindow.second); _signalHander->updateActionsStates(); Command::GeometryCommandPy::init(_mainWindow, _preWindow.second); } @@ -83,66 +98,60 @@ namespace GUI //_preWindow.first->setFocus(); } - QMdiArea *SubWindowManager::getMdiArea() const + QMdiArea* SubWindowManager::getMdiArea() const { return _mdiArea; } - void SubWindowManager::add3dRenderPage(const QList &toolbars) + void SubWindowManager::add3dRenderPage(const QList& toolbars) { - if (_threeD_render_page || toolbars.size() != 4) + if(_threeD_render_page || toolbars.size() != 4) return; - QList actions; - QAction *action{}; - SARibbonBar *ribbon = _mainWindow->ribbonBar(); - _threeD_render_page = ribbon->addCategoryPage(QObject::tr("3D Render")); + QList actions; + QAction* action{}; + SARibbonBar* ribbon = _mainWindow->ribbonBar(); + _threeD_render_page = ribbon->addCategoryPage(QObject::tr("3D Render")); - SARibbonPannel *pannel0 = _threeD_render_page->addPannel(QString()); - QToolBar *toolbar0 = toolbars.at(0); - actions = toolbar0->actions(); - for (int j = 0; j < actions.size(); j++) - { + SARibbonPannel* pannel0 = _threeD_render_page->addPannel(QString()); + QToolBar* toolbar0 = toolbars.at(0); + actions = toolbar0->actions(); + for(int j = 0; j < actions.size(); j++) { action = actions.at(j); pannel0->addLargeAction(action); } - SARibbonPannel *pannel2 = _threeD_render_page->addPannel(QString()); - QToolBar *toolbar2 = toolbars.at(2); - actions = toolbar2->actions(); - for (int j = 0; j < actions.size(); j++) - { + SARibbonPannel* pannel2 = _threeD_render_page->addPannel(QString()); + QToolBar* toolbar2 = toolbars.at(2); + actions = toolbar2->actions(); + for(int j = 0; j < actions.size(); j++) { action = actions.at(j); pannel2->addLargeAction(action); } - SARibbonPannel *pannel3 = _threeD_render_page->addPannel(QString()); - QToolBar *toolbar3 = toolbars.at(3); - actions = toolbar3->actions(); - for (int j = 0; j < actions.size(); j++) - { + SARibbonPannel* pannel3 = _threeD_render_page->addPannel(QString()); + QToolBar* toolbar3 = toolbars.at(3); + actions = toolbar3->actions(); + for(int j = 0; j < actions.size(); j++) { action = actions.at(j); pannel3->addLargeAction(action); } - SARibbonPannel *pannel1 = _threeD_render_page->addPannel(QString()); - QToolBar *toolbar1 = toolbars.at(1); - actions = toolbar1->actions(); - QList realActions; - QList comboxs; - QWidget *widget{}; - for (int j = 0; j < actions.size(); j++) - { + SARibbonPannel* pannel1 = _threeD_render_page->addPannel(QString()); + QToolBar* toolbar1 = toolbars.at(1); + actions = toolbar1->actions(); + QList realActions; + QList comboxs; + QWidget* widget{}; + for(int j = 0; j < actions.size(); j++) { action = actions.at(j); - if (action->objectName() == "QComboBox") - { + if(action->objectName() == "QComboBox") { widget = toolbar1->widgetForAction(action); widget->setVisible(true); comboxs.append(widget); - } - else if (action->objectName() == "QAction") + } else if(action->objectName() == "QAction") realActions.append(action); } - if (realActions.size() != 4 && comboxs.size() != 3) + if(realActions.size() != 4 && comboxs.size() != 3) return; pannel1->addLargeAction(realActions.at(0)); pannel1->addLargeAction(realActions.at(1)); @@ -164,16 +173,15 @@ namespace GUI void SubWindowManager::remove3dRenderPage() { - if (_threeD_render_page == nullptr) + if(_threeD_render_page == nullptr) return; auto pannels = _threeD_render_page->pannelList(); - for (SARibbonPannel *pannel : pannels) - { + for(SARibbonPannel* pannel : pannels) { _threeD_render_page->removePannel(pannel); pannel = nullptr; } - SARibbonBar *ribbon = _mainWindow->ribbonBar(); + SARibbonBar* ribbon = _mainWindow->ribbonBar(); ribbon->removeCategory(_threeD_render_page); _threeD_render_page = nullptr; @@ -188,21 +196,19 @@ namespace GUI } void SubWindowManager::updatePreMeshActor() { - if (_preWindow.second != nullptr) - { + if(_preWindow.second != nullptr) { emit _preWindow.second->updateMeshActorSig(); } } void SubWindowManager::updatePreGeometryActor() { - if (_preWindow.second != nullptr) - { + if(_preWindow.second != nullptr) { _preWindow.second->updateGeometryActor(); } } void SubWindowManager::closePreWindow() { - _preWindow.first = nullptr; + _preWindow.first = nullptr; _preWindow.second = nullptr; _mainWindow->getUi()->actionPre_Window->setEnabled(true); @@ -215,27 +221,22 @@ namespace GUI // _signalHander->clearData(); } - void SubWindowManager::openPostWindow(Post::PostWindowBase *pw) + void SubWindowManager::openPostWindow(Post::PostWindowBase* pw) { - if (pw == nullptr) - { + if(pw == nullptr) { assert(0); return; } - QMdiSubWindow *sw = nullptr; - QList pwl = _postWindow.values(); - if (pwl.contains(pw)) - { + QMdiSubWindow* sw = nullptr; + QList pwl = _postWindow.values(); + if(pwl.contains(pw)) { sw = _postWindow.key(pw); - } - else - { + } else { sw = _mdiArea->addSubWindow(pw); _mdiArea->cascadeSubWindows(); _postWindow[sw] = pw; } - if (sw != nullptr) - { + if(sw != nullptr) { sw->activateWindow(); sw->showMaximized(); sw->setFocus(); @@ -245,56 +246,51 @@ namespace GUI emit _mainWindow->updateActionStatesSig(); } - void SubWindowManager::openRealTimeWindow(Post::RealTimeWindowBase *pw) + void SubWindowManager::openRealTimeWindow(Post::RealTimeWindowBase* pw) { - QMdiSubWindow *sw = nullptr; - QList pwl = _realTimeWindow.values(); - if (pwl.contains(pw)) - { + QMdiSubWindow* sw = nullptr; + QList pwl = _realTimeWindow.values(); + if(pwl.contains(pw)) { sw = _realTimeWindow.key(pw); - } - else - { - sw = _mdiArea->addSubWindow(pw); + } else { + sw = _mdiArea->addSubWindow(pw); _realTimeWindow[sw] = pw; } - if (sw != nullptr) - { + if(sw != nullptr) { sw->showMaximized(); sw->setFocus(); } emit _mainWindow->updateActionStatesSig(); } - ModuleBase::GraphWindowBase *SubWindowManager::getCurrentWindow() + ModuleBase::GraphWindowBase* SubWindowManager::getCurrentWindow() { QMdiSubWindow* activeWindow = nullptr; - auto subWins = _mdiArea->subWindowList(); + auto subWins = _mdiArea->subWindowList(); if(subWins.size() == 1) { activeWindow = subWins.at(0); } else { activeWindow = _mdiArea->activeSubWindow(); } - if (activeWindow == nullptr) + if(activeWindow == nullptr) return nullptr; - else if (activeWindow == _preWindow.first) + else if(activeWindow == _preWindow.first) return _preWindow.second; - else if (_postWindow.contains(activeWindow)) + else if(_postWindow.contains(activeWindow)) return _postWindow[activeWindow]; else return nullptr; } - Post::PostWindowBase *SubWindowManager::getPostWindowByIDType(int id, int type) + Post::PostWindowBase* SubWindowManager::getPostWindowByIDType(int id, int type) { - QList pwl = _postWindow.values(); - for (int i = 0; i < pwl.size(); ++i) - { - Post::PostWindowBase *w = pwl.at(i); - if (w == nullptr) + QList pwl = _postWindow.values(); + for(int i = 0; i < pwl.size(); ++i) { + Post::PostWindowBase* w = pwl.at(i); + if(w == nullptr) continue; - int wid = w->getID(); + int wid = w->getID(); int wtype = (int)w->getPostWindowType(); - if (wid == id && wtype == type) + if(wid == id && wtype == type) return w; } return nullptr; @@ -302,72 +298,66 @@ namespace GUI void SubWindowManager::removeToolBars() { const int n = _currentToolBars.size(); - for (int i = 0; i < n; ++i) - { - QToolBar *t = _currentToolBars.at(i); + for(int i = 0; i < n; ++i) { + QToolBar* t = _currentToolBars.at(i); _mainWindow->removeToolBar(t); } _currentToolBars.clear(); } void SubWindowManager::showPostWindowInfo(int id, int type) { - Post::PostWindowBase *pwb = getPostWindowByIDType(id, type); - if (pwb == nullptr) + Post::PostWindowBase* pwb = getPostWindowByIDType(id, type); + if(pwb == nullptr) return; // QWidget* ptree = pwb->getTreeWidget(); // QWidget* pprop = pwb->getPropWidget(); - QMdiSubWindow *subWin = _postWindow.key(pwb); - if (subWin != nullptr) - { + QMdiSubWindow* subWin = _postWindow.key(pwb); + if(subWin != nullptr) { subWin->showMaximized(); subWin->setFocus(); } //_controlPanel->updatePostWidget(ptree, pprop); - if (type == 2) + if(type == 2) _controlPanel->updatePostWidget(); - QList toolBars = pwb->getToolBarList(); - if (_mainWindow->isUseRibbon()) - { - if (_threeD_render_page) + QList toolBars = pwb->getToolBarList(); + if(_mainWindow->isUseRibbon()) { + if(_threeD_render_page) return; add3dRenderPage(toolBars); - } - else - { + } else { this->removeToolBars(); _mainWindow->addToolBarBreak(); - for (int i = 0; i < toolBars.size(); ++i) - { + for(int i = 0; i < toolBars.size(); ++i) { _mainWindow->addToolBar(toolBars.at(i)); (toolBars.at(i))->show(); _currentToolBars.append(toolBars.at(i)); } } } - void SubWindowManager::closePostWindow(Post::PostWindowBase *w) + void SubWindowManager::closePostWindow(Post::PostWindowBase* w) { - QMdiSubWindow *subw = _postWindow.key(w); - if (subw == nullptr) + QMdiSubWindow* subw = _postWindow.key(w); + if(subw == nullptr) return; Post::PostWindowType type = w->getPostWindowType(); removeToolBars(); - if (type == Post::PostWindowType::D3 && _mainWindow->isUseRibbon()) //使用ribbon,并且关闭的是3维窗口 + if(type == Post::PostWindowType::D3 + && _mainWindow->isUseRibbon()) // 使用ribbon,并且关闭的是3维窗口 remove3dRenderPage(); - if (_controlPanel != nullptr) + if(_controlPanel != nullptr) _controlPanel->updatePostWidget(nullptr, nullptr); emit _mainWindow->updateProperty(nullptr); _postWindow.remove(subw); - QList postsubwlist = _postWindow.values(); - if (_preWindow.first != nullptr) + QList postsubwlist = _postWindow.values(); + if(_preWindow.first != nullptr) showPreWindow(); - else if (postsubwlist.size() > 0) - { - Post::PostWindowBase *w = postsubwlist.at(0); - int id = w->getID(); - Post::PostWindowType type = w->getPostWindowType(); + else if(postsubwlist.size() > 0) { + Post::PostWindowBase* w = postsubwlist.at(0); + int id = w->getID(); + Post::PostWindowType type = w->getPostWindowType(); showPostWindowInfo(id, type); } emit _mainWindow->updateActionStatesSig(); @@ -375,49 +365,46 @@ namespace GUI void SubWindowManager::showPreWindow() { removeToolBars(); - if (_controlPanel == nullptr) + if(_controlPanel == nullptr) return; _controlPanel->updatePostWidget(nullptr, nullptr); - if (_preWindow.first != nullptr) - { + if(_preWindow.first != nullptr) { _preWindow.first->showMaximized(); _preWindow.first->setFocus(); } } - void SubWindowManager::showRealTimeWindow(QMdiSubWindow *w) + void SubWindowManager::showRealTimeWindow(QMdiSubWindow* w) { removeToolBars(); _controlPanel->updatePostWidget(nullptr, nullptr); - if (_realTimeWindow.contains(w)) - { + if(_realTimeWindow.contains(w)) { w->showMaximized(); w->setFocus(); } } - void SubWindowManager::subWindowActived(QMdiSubWindow *sw) + void SubWindowManager::subWindowActived(QMdiSubWindow* sw) { - if (sw == nullptr) + if(sw == nullptr) return; - if (sw == _preWindow.first) + if(sw == _preWindow.first) showPreWindow(); - else if (_realTimeWindow.contains(sw)) + else if(_realTimeWindow.contains(sw)) showRealTimeWindow(sw); - else if (_postWindow.contains(sw)) - { - Post::PostWindowBase *pwb = _postWindow.value(sw); - int id = pwb->getID(); - Post::PostWindowType type = pwb->getPostWindowType(); + else if(_postWindow.contains(sw)) { + Post::PostWindowBase* pwb = _postWindow.value(sw); + int id = pwb->getID(); + Post::PostWindowType type = pwb->getPostWindowType(); showPostWindowInfo(id, type); } emit _mainWindow->updateActionStatesSig(); } - void SubWindowManager::closeRealTimeWindow(Post::RealTimeWindowBase *w) + void SubWindowManager::closeRealTimeWindow(Post::RealTimeWindowBase* w) { - QMdiSubWindow *subw = _realTimeWindow.key(w); - if (subw == nullptr) + QMdiSubWindow* subw = _realTimeWindow.key(w); + if(subw == nullptr) return; _realTimeWindow.remove(subw); - if (_preWindow.first != nullptr) + if(_preWindow.first != nullptr) showPreWindow(); emit _mainWindow->updateActionStatesSig(); } @@ -427,11 +414,11 @@ namespace GUI ModuleBase::GraphWindowBase* gwb = getCurrentWindow(); if (gwb == nullptr) return; gwb->setView(view);*/ - ModuleBase::GraphWindowBase *gwb = getCurrentWindow(); - if (gwb == nullptr) + ModuleBase::GraphWindowBase* gwb = getCurrentWindow(); + if(gwb == nullptr) return; - const int id = gwb->getID(); - QString win = gwb->getStringGraphWindowType(); + const int id = gwb->getID(); + QString win = gwb->getStringGraphWindowType(); qDebug() << win; QString pycode = QString("MainWindow.setView(%1,\"%2\",\"%3\")").arg(id).arg(win).arg(view); qDebug() << pycode; @@ -439,74 +426,67 @@ namespace GUI // gwb->setView(view); } - MainWidget::PreWindow *SubWindowManager::getPreWindow() + MainWidget::PreWindow* SubWindowManager::getPreWindow() { return _preWindow.second; } - void SubWindowManager::openReportWindow(XReport::ReportWindow *w) + void SubWindowManager::openReportWindow(XReport::ReportWindow* w) { - QMdiSubWindow *sw = nullptr; - QList rws = _reportWindow.values(); - if (rws.contains(w)) - { + QMdiSubWindow* sw = nullptr; + QList rws = _reportWindow.values(); + if(rws.contains(w)) { sw = _reportWindow.key(w); - } - else - { - sw = _mdiArea->addSubWindow(w); + } else { + sw = _mdiArea->addSubWindow(w); _reportWindow[sw] = w; } - if (sw != nullptr) - { + if(sw != nullptr) { sw->showMaximized(); sw->setFocus(); } emit _mainWindow->updateActionStatesSig(); } - void SubWindowManager::closeReportWindow(XReport::ReportWindow *w) + void SubWindowManager::closeReportWindow(XReport::ReportWindow* w) { - QMdiSubWindow *s = _reportWindow.key(w); - if (s != nullptr) - { + QMdiSubWindow* s = _reportWindow.key(w); + if(s != nullptr) { _reportWindow.remove(s); } } bool SubWindowManager::isPreWindowOpened() { - if (_preWindow.first == nullptr || _preWindow.second == nullptr) + if(_preWindow.first == nullptr || _preWindow.second == nullptr) return false; return true; } bool SubWindowManager::isPostWindowOpened() { - if (_postWindow.size() > 0) + if(_postWindow.size() > 0) return true; return false; } bool SubWindowManager::isPostWindowOpening() { - QMdiSubWindow *activeWindow = _mdiArea->activeSubWindow(); - if (activeWindow == nullptr) + QMdiSubWindow* activeWindow = _mdiArea->activeSubWindow(); + if(activeWindow == nullptr) return false; - else if (_postWindow.contains(activeWindow)) + else if(_postWindow.contains(activeWindow)) return true; else return false; } - void SubWindowManager::saveImage(QString fileName, int winType, Post::PostWindowBase *winhandle, int w, int h) + void SubWindowManager::saveImage(QString fileName, int winType, Post::PostWindowBase* winhandle, + int w, int h) { - if (winType == 0) - { - MainWidget::PreWindow *preW = _preWindow.second; - if (preW == nullptr) + if(winType == 0) { + MainWidget::PreWindow* preW = _preWindow.second; + if(preW == nullptr) return; preW->saveImage(fileName, w, h, false); - } - else if (winType == 1) - { - if (_postWindow.key(winhandle) == nullptr) + } else if(winType == 1) { + if(_postWindow.key(winhandle) == nullptr) return; winhandle->saveImage(fileName, w, h, false); } @@ -514,44 +494,50 @@ namespace GUI void SubWindowManager::saveImage(int w, int h, QString f) { - ModuleBase::GraphWindowBase *gw = this->getCurrentWindow(); - if (gw == nullptr) - { + ModuleBase::GraphWindowBase* gw = this->getCurrentWindow(); + if(gw == nullptr) { _mainWindow->printMessage(Common::Message::Error, tr("No GraphWindow opened!")); return; } - QString type = gw->getStringGraphWindowType(); - const int id = gw->getID(); - QString pycode = QString("MainWindow.saveImage(%1,%2,%3,\"%4\",\"%5\")").arg(w).arg(h).arg(id).arg(type).arg(f); + QString type = gw->getStringGraphWindowType(); + const int id = gw->getID(); + QString pycode = QString("MainWindow.saveImage(%1,%2,%3,\"%4\",\"%5\")") + .arg(w) + .arg(h) + .arg(id) + .arg(type) + .arg(f); qDebug() << pycode; Py::PythonAgent::getInstance()->submit(pycode); } void SubWindowManager::saveImage(int w, int h, int id, QString winType, QString file) { - ModuleBase::GraphWindowBase *win = this->getWindowByTypeID(winType, id); - if (win == nullptr) + ModuleBase::GraphWindowBase* win = this->getWindowByTypeID(winType, id); + if(win == nullptr) return; win->saveImage(file, w, h, false); Py::PythonAgent::getInstance()->unLock(); } void SubWindowManager::setView(int id, QString winType, QString view) // liu { - ModuleBase::GraphWindowBase *gwb = getWindowByTypeID(winType, id); - if (gwb == nullptr) + ModuleBase::GraphWindowBase* gwb = getWindowByTypeID(winType, id); + if(gwb == nullptr) return; gwb->setView(view); Py::PythonAgent::getInstance()->unLock(); } - void SubWindowManager::setViewValue(int id, QString win, int x1, int x2, int x3, int y1, int y2, int y3, int z1, int z2, int z3) + void SubWindowManager::setViewValue(int id, QString win, int x1, int x2, int x3, int y1, int y2, + int y3, int z1, int z2, int z3) { - ModuleBase::GraphWindowBase *gwb = getWindowByTypeID(win, id); - if (gwb == nullptr) + ModuleBase::GraphWindowBase* gwb = getWindowByTypeID(win, id); + if(gwb == nullptr) return; gwb->setViewValue(x1, x2, x3, y1, y2, y3, z1, z2, z3); Py::PythonAgent::getInstance()->unLock(); } - /*void SubWindowManager::setViewPreValue(int id, QString win, int x1, int x2, int x3, int y1, int y2, int y3, int z1, int z2, int z3) + /*void SubWindowManager::setViewPreValue(int id, QString win, int x1, int x2, int x3, int y1, + int y2, int y3, int z1, int z2, int z3) { ModuleBase::GraphWindowBase* gwb = getCurrentWindow(); if (gwb == nullptr) return; @@ -559,41 +545,38 @@ namespace GUI }*/ void SubWindowManager::reTranslate() { - MainWidget::PreWindow *prew = _preWindow.second; - if (prew != nullptr) + MainWidget::PreWindow* prew = _preWindow.second; + if(prew != nullptr) prew->reTranslate(); - int n = 0; - QList postWinList = _postWindow.values(); - n = postWinList.size(); - for (int i = 0; i < n; ++i) - { - Post::PostWindowBase *pw = postWinList.at(i); - if (pw != nullptr) + int n = 0; + QList postWinList = _postWindow.values(); + n = postWinList.size(); + for(int i = 0; i < n; ++i) { + Post::PostWindowBase* pw = postWinList.at(i); + if(pw != nullptr) pw->reTranslate(); } - QList rwList = _realTimeWindow.values(); - n = rwList.size(); - for (int i = 0; i < n; ++i) - { - Post::RealTimeWindowBase *rw = rwList.at(i); - if (rw != nullptr) + QList rwList = _realTimeWindow.values(); + n = rwList.size(); + for(int i = 0; i < n; ++i) { + Post::RealTimeWindowBase* rw = rwList.at(i); + if(rw != nullptr) rw->reTranslate(); } - QList repWin = _reportWindow.values(); - n = repWin.size(); - for (int i = 0; i < n; ++i) - { - XReport::ReportWindow *w = repWin.at(i); + QList repWin = _reportWindow.values(); + n = repWin.size(); + for(int i = 0; i < n; ++i) { + XReport::ReportWindow* w = repWin.at(i); w->reTranslate(); } - if (_threeD_render_page != nullptr) + if(_threeD_render_page != nullptr) _threeD_render_page->setWindowTitle(tr("3D Render")); } void SubWindowManager::closeGeometryWindow() { - _geometryWindow.first = nullptr; + _geometryWindow.first = nullptr; _geometryWindow.second = nullptr; _signalHander->clearData(false); @@ -603,10 +586,9 @@ namespace GUI emit _mainWindow->updateProperty(nullptr); } - GenerateGeometry::GenerateGeometryWidget *SubWindowManager::getGeometryWindow() + GenerateGeometry::GenerateGeometryWidget* SubWindowManager::getGeometryWindow() { - if (!_geometryWindow.second) - { + if(!_geometryWindow.second) { openGeometryWindow(); } return _geometryWindow.second; @@ -617,39 +599,35 @@ namespace GUI // _mdiArea->setViewMode(QMdiArea::SubWindowView); // _mdiArea->setTabPosition(QTabWidget::North); - MainWidget::PreWindow *pre = _preWindow.second; - if (pre != nullptr) - { + MainWidget::PreWindow* pre = _preWindow.second; + if(pre != nullptr) { _preWindow.first->close(); _mdiArea->removeSubWindow(pre); pre->close(); delete pre; } - QList postlist = _postWindow.values(); - for (int i = 0; i < postlist.size(); ++i) - { - Post::PostWindowBase *p = postlist.at(i); + QList postlist = _postWindow.values(); + for(int i = 0; i < postlist.size(); ++i) { + Post::PostWindowBase* p = postlist.at(i); _postWindow.key(p)->close(); _mdiArea->removeSubWindow(p); p->close(); delete p; } - QList realtimelist = _realTimeWindow.values(); - for (int i = 0; i < realtimelist.size(); ++i) - { - Post::RealTimeWindowBase *r = realtimelist.at(i); + QList realtimelist = _realTimeWindow.values(); + for(int i = 0; i < realtimelist.size(); ++i) { + Post::RealTimeWindowBase* r = realtimelist.at(i); _realTimeWindow.key(r)->close(); _mdiArea->removeSubWindow(r); r->close(); delete r; } - QList reportlist = _reportWindow.values(); - for (int i = 0; i < reportlist.size(); ++i) - { - XReport::ReportWindow *r = reportlist.at(i); + QList reportlist = _reportWindow.values(); + for(int i = 0; i < reportlist.size(); ++i) { + XReport::ReportWindow* r = reportlist.at(i); _reportWindow.key(r)->close(); _mdiArea->removeSubWindow(r); r->close(); @@ -657,51 +635,38 @@ namespace GUI } } - ModuleBase::GraphWindowBase *SubWindowManager::getWindowByTypeID(QString type, int id) + ModuleBase::GraphWindowBase* SubWindowManager::getWindowByTypeID(QString type, int id) { - ModuleBase::GraphWindowBase *g = nullptr; - type = type.toLower(); - if (type == "prewindow") - { + ModuleBase::GraphWindowBase* g = nullptr; + type = type.toLower(); + if(type == "prewindow") { g = _preWindow.second; - } - else if (type == "realtime") - { - QList wlist = _realTimeWindow.values(); - for (int i = 0; i < wlist.size(); ++i) - { - ModuleBase::GraphWindowBase *t = wlist.at(i); - const int d = t->getID(); - if (id == d) - { + } else if(type == "realtime") { + QList wlist = _realTimeWindow.values(); + for(int i = 0; i < wlist.size(); ++i) { + ModuleBase::GraphWindowBase* t = wlist.at(i); + const int d = t->getID(); + if(id == d) { g = t; break; } } - } - else if (type == "post2d") - { - QList wlist = _postWindow.values(); - for (int i = 0; i < wlist.size(); ++i) - { - ModuleBase::GraphWindowBase *t = wlist.at(i); - const int d = t->getID(); - if (id == d && t->getGraphWindowType() == ModuleBase::Post2D) - { + } else if(type == "post2d") { + QList wlist = _postWindow.values(); + for(int i = 0; i < wlist.size(); ++i) { + ModuleBase::GraphWindowBase* t = wlist.at(i); + const int d = t->getID(); + if(id == d && t->getGraphWindowType() == ModuleBase::Post2D) { g = t; break; } } - } - else if (type == "post3d") - { - QList wlist = _postWindow.values(); - for (int i = 0; i < wlist.size(); ++i) - { - ModuleBase::GraphWindowBase *t = wlist.at(i); - const int d = t->getID(); - if (id == d && t->getGraphWindowType() == ModuleBase::Post3D) - { + } else if(type == "post3d") { + QList wlist = _postWindow.values(); + for(int i = 0; i < wlist.size(); ++i) { + ModuleBase::GraphWindowBase* t = wlist.at(i); + const int d = t->getID(); + if(id == d && t->getGraphWindowType() == ModuleBase::Post3D) { g = t; break; } @@ -712,13 +677,13 @@ namespace GUI void SubWindowManager::setIcon(QString icon) { - if (_preWindow.first != nullptr) + if(_preWindow.first != nullptr) _preWindow.first->setWindowIcon(QIcon(icon)); - QList subw = _postWindow.keys() + _realTimeWindow.keys() + _reportWindow.keys(); - for (auto w : subw) - { + QList subw = + _postWindow.keys() + _realTimeWindow.keys() + _reportWindow.keys(); + for(auto w : subw) { w->setWindowIcon(QIcon(icon)); } } -} +} // namespace GUI diff --git a/src/MainWindow/SubWindowManager.h b/src/MainWindow/SubWindowManager.h new file mode 100644 index 0000000..35b44f0 --- /dev/null +++ b/src/MainWindow/SubWindowManager.h @@ -0,0 +1,163 @@ +#ifndef _SUBWINDOWMANAGER_H_ +#define _SUBWINDOWMANAGER_H_ + +#include "MainWindowAPI.h" + +#include +#include +#include + +class QMdiSubWindow; +class QMdiArea; +class QToolBar; +class SARibbonCategory; + +namespace MainWidget { + class PreWindow; + class ControlPanel; +} // namespace MainWidget +namespace Post { + class PostWindowBase; + class RealTimeWindowBase; +} // namespace Post +namespace ModuleBase { + class GraphWindowBase; +} +namespace XReport { + class ReportWindow; +} +namespace GenerateGeometry { + class GenerateGeometryWidget; +} + +namespace GUI { + class MainWindow; + class SignalHandler; + + class MAINWINDOWAPI SubWindowManager : public QObject { + Q_OBJECT + public: + SubWindowManager(MainWindow* mainwindow, QMdiArea* mdiArea, SignalHandler* hander, + MainWidget::ControlPanel* cp); + ~SubWindowManager(); + + // 更新前处理Actor + void updatePreActors(); + + // 更新前处理网格Actor + void updatePreMeshActor(); + + // 更新前处理几何Actor + void updatePreGeometryActor(); + + // 获取前处理窗口 + MainWidget::PreWindow* getPreWindow(); + + // 前处理窗口是否打开 + bool isPreWindowOpened(); + + // 后处理窗口是否打开 + bool isPostWindowOpened(); + + bool isPostWindowOpening(); + + // 更新翻译 + void reTranslate(); + + /*获取创建几何窗体*/ + GenerateGeometry::GenerateGeometryWidget* getGeometryWindow(); + + // 关闭所有窗口 + void closeAllSubWindow(); + + /// 获取当前激活的MDI子窗口 + ModuleBase::GraphWindowBase* getCurrentWindow(); + + ModuleBase::GraphWindowBase* getWindowByTypeID(QString type, int id); + + // 设置图标 + void setIcon(QString icon); + + QMdiArea* getMdiArea() const; + + signals: + void setViewSig(int, QString, QString); + void setViewValueSig(int id, QString win, int x1, int x2, int x3, int y1, int y2, int y3, + int z1, int z2, int z3); + void saveImageSig(int w, int h, int id, QString win, QString file); + void openPreWindowSig(); + void clearSelectModelSig(); + + public slots: + + /*打开前处理窗口 */ + void openPreWindow(); + + void saveImage(int w, int h, int id, QString win, QString file); + void setView(int id, QString winType, QString view); // liu + void setViewValue(int id, QString win, int x1, int x2, int x3, int y1, int y2, int y3, + int z1, int z2, int z3); // liu + // void setViewPreValue(int id, QString win, int x1, int x2, int x3, int y1, int y2, int y3, + // int z1, int z2, int z3);//liu + + private slots: + /// 关闭前处理窗口 + void closePreWindow(); + /// 打开后处理窗口 + void openPostWindow(Post::PostWindowBase* pw); + /// 打开实时曲线窗口 + void openRealTimeWindow(Post::RealTimeWindowBase* pw); + // 打开报告窗口 + void openReportWindow(XReport::ReportWindow* w); + // 关闭报告窗口 + void closeReportWindow(XReport::ReportWindow* w); + /// 显示后处理信息 + void showPostWindowInfo(int id, int type); + /// 关闭后处理窗口 + void closePostWindow(Post::PostWindowBase* w); + /// 关闭实时曲线窗口 + void closeRealTimeWindow(Post::RealTimeWindowBase* w); + /// 激活窗口发生变化 + void subWindowActived(QMdiSubWindow* sw); + /// 设置视角 + void setView(QString view); + + // 保存图片 + void saveImage(QString fileName, int winType, Post::PostWindowBase* winhandle, int w, + int h); + void saveImage(int w, int h, QString f); + + /*关闭创建几何窗体*/ + void closeGeometryWindow(); + + private: + Post::PostWindowBase* getPostWindowByIDType(int id, int type); + void removeToolBars(); + void showPreWindow(); + void showRealTimeWindow(QMdiSubWindow* w); + /*打开创建几何窗体*/ + void openGeometryWindow(); + /*ribbon:添加3D渲染的页*/ + void add3dRenderPage(const QList& toolbars); + /*ribbon:删除3D渲染的页*/ + void remove3dRenderPage(); + + private: + MainWindow* _mainWindow{}; + QMdiArea* _mdiArea{}; + SignalHandler* _signalHander{}; + MainWidget::ControlPanel* _controlPanel{}; + + QPair _preWindow{}; + QHash _postWindow{}; + QHash _realTimeWindow{}; + QHash _reportWindow{}; + QPair _geometryWindow{}; + // QHash _geometryWindow{}; + + QList _currentToolBars{}; + SARibbonCategory* _threeD_render_page{}; + }; +} // namespace GUI + +#endif diff --git a/src/MainWindow/Translator.cpp b/src/MainWindow/Translator.cpp new file mode 100644 index 0000000..930e669 --- /dev/null +++ b/src/MainWindow/Translator.cpp @@ -0,0 +1,51 @@ +#include "Translator.h" + +#include +#include +#include +#include +#include + +namespace GUI { + const static QStringList Lang_List = { + ":/translations/MainWindow_zh_CN", ":/translations/MainWidgets_zh_CN", + ":/translations/Setting_zh_CN", ":/translations/ModuleBase_zh_CN", + ":/translations/ProjectTree_zh_CN", ":/translations/PostWidgets_zh_CN", + ":/translations/Material_zh_CN", ":/translations/IO_zh_CN", + ":/translations/GeometryWidgets_zh_CN", ":/translations/PluginManager_zh_CN", + ":/translations/GmshModule_zh_CN", ":/translations/SolverControl_Zh_CN", + ":/translations/UserGuidence_zh_CN", ":/translations/SelfDefObject_zh_CN", + ":/translations/SARibbonBar_zh_CN", ":/translations/PostInterface_zh_CN", + }; + + Translator::Translator() + { + _app = static_cast(QCoreApplication::instance()); + _translatorList.clear(); + const int n = Lang_List.size(); + for(int i = 0; i < n; ++i) { + _translatorList.append(new QTranslator); + } + } + void Translator::toChinese() + { + for(int i = 0; i < Lang_List.count(); ++i) { + auto tranlator = _translatorList.at(i); + _app->removeTranslator(tranlator); + const QString lang = Lang_List.at(i); + bool ok = tranlator->load(lang); + qDebug() << lang; + assert(ok); + _app->installTranslator(tranlator); + } + } + void Translator::toEnglish() + { + assert(_translatorList.count() == Lang_List.count()); + for(int i = 0; i < Lang_List.count(); ++i) { + auto tranlator = _translatorList.at(i); + _app->removeTranslator(tranlator); + } + } + +} // namespace GUI \ No newline at end of file diff --git a/src/mainWindow/translator.h b/src/MainWindow/Translator.h similarity index 100% rename from src/mainWindow/translator.h rename to src/MainWindow/Translator.h diff --git a/src/meshData/CMakeLists.txt b/src/MeshData/CMakeLists.txt similarity index 100% rename from src/meshData/CMakeLists.txt rename to src/MeshData/CMakeLists.txt diff --git a/src/meshData/CgnsBCZone.cpp b/src/MeshData/CgnsBCZone.cpp similarity index 100% rename from src/meshData/CgnsBCZone.cpp rename to src/MeshData/CgnsBCZone.cpp diff --git a/src/meshData/CgnsBCZone.h b/src/MeshData/CgnsBCZone.h similarity index 100% rename from src/meshData/CgnsBCZone.h rename to src/MeshData/CgnsBCZone.h diff --git a/src/meshData/CgnsFamily.cpp b/src/MeshData/CgnsFamily.cpp similarity index 100% rename from src/meshData/CgnsFamily.cpp rename to src/MeshData/CgnsFamily.cpp diff --git a/src/meshData/CgnsFamily.h b/src/MeshData/CgnsFamily.h similarity index 100% rename from src/meshData/CgnsFamily.h rename to src/MeshData/CgnsFamily.h diff --git a/src/meshData/ElementType.cpp b/src/MeshData/ElementType.cpp similarity index 100% rename from src/meshData/ElementType.cpp rename to src/MeshData/ElementType.cpp diff --git a/src/meshData/ElementType.h b/src/MeshData/ElementType.h similarity index 100% rename from src/meshData/ElementType.h rename to src/MeshData/ElementType.h diff --git a/src/meshData/MeshFactory.cpp b/src/MeshData/MeshFactory.cpp similarity index 100% rename from src/meshData/MeshFactory.cpp rename to src/MeshData/MeshFactory.cpp diff --git a/src/meshData/MeshFactory.h b/src/MeshData/MeshFactory.h similarity index 100% rename from src/meshData/MeshFactory.h rename to src/MeshData/MeshFactory.h diff --git a/src/meshData/MeshPy.cpp b/src/MeshData/MeshPy.cpp similarity index 100% rename from src/meshData/MeshPy.cpp rename to src/MeshData/MeshPy.cpp diff --git a/src/meshData/MeshPy.h b/src/MeshData/MeshPy.h similarity index 100% rename from src/meshData/MeshPy.h rename to src/MeshData/MeshPy.h diff --git a/src/meshData/meshChecker.cpp b/src/MeshData/meshChecker.cpp similarity index 100% rename from src/meshData/meshChecker.cpp rename to src/MeshData/meshChecker.cpp diff --git a/src/meshData/meshChecker.h b/src/MeshData/meshChecker.h similarity index 100% rename from src/meshData/meshChecker.h rename to src/MeshData/meshChecker.h diff --git a/src/meshData/meshCommon.cpp b/src/MeshData/meshCommon.cpp similarity index 100% rename from src/meshData/meshCommon.cpp rename to src/MeshData/meshCommon.cpp diff --git a/src/meshData/meshCommon.h b/src/MeshData/meshCommon.h similarity index 100% rename from src/meshData/meshCommon.h rename to src/MeshData/meshCommon.h diff --git a/src/meshData/meshDataAPI.h b/src/MeshData/meshDataAPI.h similarity index 100% rename from src/meshData/meshDataAPI.h rename to src/MeshData/meshDataAPI.h diff --git a/src/meshData/meshKernal.cpp b/src/MeshData/meshKernal.cpp similarity index 100% rename from src/meshData/meshKernal.cpp rename to src/MeshData/meshKernal.cpp diff --git a/src/meshData/meshKernal.h b/src/MeshData/meshKernal.h similarity index 100% rename from src/meshData/meshKernal.h rename to src/MeshData/meshKernal.h diff --git a/src/meshData/meshSet.cpp b/src/MeshData/meshSet.cpp similarity index 100% rename from src/meshData/meshSet.cpp rename to src/MeshData/meshSet.cpp diff --git a/src/meshData/meshSet.h b/src/MeshData/meshSet.h similarity index 100% rename from src/meshData/meshSet.h rename to src/MeshData/meshSet.h diff --git a/src/meshData/meshSingleton.cpp b/src/MeshData/meshSingleton.cpp similarity index 100% rename from src/meshData/meshSingleton.cpp rename to src/MeshData/meshSingleton.cpp diff --git a/src/meshData/meshSingleton.h b/src/MeshData/meshSingleton.h similarity index 100% rename from src/meshData/meshSingleton.h rename to src/MeshData/meshSingleton.h diff --git a/src/meshData/setMember.cpp b/src/MeshData/setMember.cpp similarity index 100% rename from src/meshData/setMember.cpp rename to src/MeshData/setMember.cpp diff --git a/src/meshData/setMember.h b/src/MeshData/setMember.h similarity index 100% rename from src/meshData/setMember.h rename to src/MeshData/setMember.h diff --git a/src/moduleBase/CMakeLists.txt b/src/ModuleBase/CMakeLists.txt similarity index 100% rename from src/moduleBase/CMakeLists.txt rename to src/ModuleBase/CMakeLists.txt diff --git a/src/moduleBase/CommonFunctions.cpp b/src/ModuleBase/CommonFunctions.cpp similarity index 100% rename from src/moduleBase/CommonFunctions.cpp rename to src/ModuleBase/CommonFunctions.cpp diff --git a/src/moduleBase/CommonFunctions.h b/src/ModuleBase/CommonFunctions.h similarity index 100% rename from src/moduleBase/CommonFunctions.h rename to src/ModuleBase/CommonFunctions.h diff --git a/src/moduleBase/DialogBase.cpp b/src/ModuleBase/DialogBase.cpp similarity index 100% rename from src/moduleBase/DialogBase.cpp rename to src/ModuleBase/DialogBase.cpp diff --git a/src/moduleBase/DialogBase.h b/src/ModuleBase/DialogBase.h similarity index 100% rename from src/moduleBase/DialogBase.h rename to src/ModuleBase/DialogBase.h diff --git a/src/moduleBase/Frameless/CursorPosCalculator.cpp b/src/ModuleBase/Frameless/CursorPosCalculator.cpp similarity index 100% rename from src/moduleBase/Frameless/CursorPosCalculator.cpp rename to src/ModuleBase/Frameless/CursorPosCalculator.cpp diff --git a/src/moduleBase/Frameless/CursorPosCalculator.h b/src/ModuleBase/Frameless/CursorPosCalculator.h similarity index 100% rename from src/moduleBase/Frameless/CursorPosCalculator.h rename to src/ModuleBase/Frameless/CursorPosCalculator.h diff --git a/src/moduleBase/Frameless/FramelessHelper.cpp b/src/ModuleBase/Frameless/FramelessHelper.cpp similarity index 100% rename from src/moduleBase/Frameless/FramelessHelper.cpp rename to src/ModuleBase/Frameless/FramelessHelper.cpp diff --git a/src/moduleBase/Frameless/FramelessHelper.h b/src/ModuleBase/Frameless/FramelessHelper.h similarity index 100% rename from src/moduleBase/Frameless/FramelessHelper.h rename to src/ModuleBase/Frameless/FramelessHelper.h diff --git a/src/moduleBase/Frameless/FramelessHelperPrivate.h b/src/ModuleBase/Frameless/FramelessHelperPrivate.h similarity index 100% rename from src/moduleBase/Frameless/FramelessHelperPrivate.h rename to src/ModuleBase/Frameless/FramelessHelperPrivate.h diff --git a/src/moduleBase/Frameless/WidgetData.cpp b/src/ModuleBase/Frameless/WidgetData.cpp similarity index 100% rename from src/moduleBase/Frameless/WidgetData.cpp rename to src/ModuleBase/Frameless/WidgetData.cpp diff --git a/src/moduleBase/Frameless/WidgetData.h b/src/ModuleBase/Frameless/WidgetData.h similarity index 100% rename from src/moduleBase/Frameless/WidgetData.h rename to src/ModuleBase/Frameless/WidgetData.h diff --git a/src/moduleBase/IOBase.cpp b/src/ModuleBase/IOBase.cpp similarity index 100% rename from src/moduleBase/IOBase.cpp rename to src/ModuleBase/IOBase.cpp diff --git a/src/moduleBase/IOBase.h b/src/ModuleBase/IOBase.h similarity index 100% rename from src/moduleBase/IOBase.h rename to src/ModuleBase/IOBase.h diff --git a/src/moduleBase/ModuleBase.cpp b/src/ModuleBase/ModuleBase.cpp similarity index 100% rename from src/moduleBase/ModuleBase.cpp rename to src/ModuleBase/ModuleBase.cpp diff --git a/src/moduleBase/ModuleBase.h b/src/ModuleBase/ModuleBase.h similarity index 100% rename from src/moduleBase/ModuleBase.h rename to src/ModuleBase/ModuleBase.h diff --git a/src/moduleBase/ModuleType.h b/src/ModuleBase/ModuleType.h similarity index 100% rename from src/moduleBase/ModuleType.h rename to src/ModuleBase/ModuleType.h diff --git a/src/moduleBase/PreWindowInteractorStyle.cpp b/src/ModuleBase/PreWindowInteractorStyle.cpp similarity index 100% rename from src/moduleBase/PreWindowInteractorStyle.cpp rename to src/ModuleBase/PreWindowInteractorStyle.cpp diff --git a/src/moduleBase/PreWindowInteractorStyle.h b/src/ModuleBase/PreWindowInteractorStyle.h similarity index 100% rename from src/moduleBase/PreWindowInteractorStyle.h rename to src/ModuleBase/PreWindowInteractorStyle.h diff --git a/src/moduleBase/ProcessWindowBase.cpp b/src/ModuleBase/ProcessWindowBase.cpp similarity index 100% rename from src/moduleBase/ProcessWindowBase.cpp rename to src/ModuleBase/ProcessWindowBase.cpp diff --git a/src/moduleBase/ProcessWindowBase.h b/src/ModuleBase/ProcessWindowBase.h similarity index 100% rename from src/moduleBase/ProcessWindowBase.h rename to src/ModuleBase/ProcessWindowBase.h diff --git a/src/moduleBase/ProcessWindowBase.ui b/src/ModuleBase/ProcessWindowBase.ui similarity index 100% rename from src/moduleBase/ProcessWindowBase.ui rename to src/ModuleBase/ProcessWindowBase.ui diff --git a/src/moduleBase/Random.cpp b/src/ModuleBase/Random.cpp similarity index 100% rename from src/moduleBase/Random.cpp rename to src/ModuleBase/Random.cpp diff --git a/src/moduleBase/Random.h b/src/ModuleBase/Random.h similarity index 100% rename from src/moduleBase/Random.h rename to src/ModuleBase/Random.h diff --git a/src/moduleBase/RandomWidget.ui b/src/ModuleBase/RandomWidget.ui similarity index 100% rename from src/moduleBase/RandomWidget.ui rename to src/ModuleBase/RandomWidget.ui diff --git a/src/moduleBase/ThreadControl.cpp b/src/ModuleBase/ThreadControl.cpp similarity index 100% rename from src/moduleBase/ThreadControl.cpp rename to src/ModuleBase/ThreadControl.cpp diff --git a/src/moduleBase/ThreadControl.h b/src/ModuleBase/ThreadControl.h similarity index 100% rename from src/moduleBase/ThreadControl.h rename to src/ModuleBase/ThreadControl.h diff --git a/src/moduleBase/ThreadTask.cpp b/src/ModuleBase/ThreadTask.cpp similarity index 100% rename from src/moduleBase/ThreadTask.cpp rename to src/ModuleBase/ThreadTask.cpp diff --git a/src/moduleBase/ThreadTask.h b/src/ModuleBase/ThreadTask.h similarity index 100% rename from src/moduleBase/ThreadTask.h rename to src/ModuleBase/ThreadTask.h diff --git a/src/moduleBase/ThreadTaskManager.cpp b/src/ModuleBase/ThreadTaskManager.cpp similarity index 100% rename from src/moduleBase/ThreadTaskManager.cpp rename to src/ModuleBase/ThreadTaskManager.cpp diff --git a/src/moduleBase/ThreadTaskManager.h b/src/ModuleBase/ThreadTaskManager.h similarity index 100% rename from src/moduleBase/ThreadTaskManager.h rename to src/ModuleBase/ThreadTaskManager.h diff --git a/src/moduleBase/XDockTitleBarWidget.cpp b/src/ModuleBase/XDockTitleBarWidget.cpp similarity index 100% rename from src/moduleBase/XDockTitleBarWidget.cpp rename to src/ModuleBase/XDockTitleBarWidget.cpp diff --git a/src/moduleBase/XDockTitleBarWidget.h b/src/ModuleBase/XDockTitleBarWidget.h similarity index 100% rename from src/moduleBase/XDockTitleBarWidget.h rename to src/ModuleBase/XDockTitleBarWidget.h diff --git a/src/moduleBase/XRandom.cpp b/src/ModuleBase/XRandom.cpp similarity index 100% rename from src/moduleBase/XRandom.cpp rename to src/ModuleBase/XRandom.cpp diff --git a/src/moduleBase/XRandom.h b/src/ModuleBase/XRandom.h similarity index 100% rename from src/moduleBase/XRandom.h rename to src/ModuleBase/XRandom.h diff --git a/src/moduleBase/XRandomWidget.cpp b/src/ModuleBase/XRandomWidget.cpp similarity index 100% rename from src/moduleBase/XRandomWidget.cpp rename to src/ModuleBase/XRandomWidget.cpp diff --git a/src/moduleBase/XRandomWidget.h b/src/ModuleBase/XRandomWidget.h similarity index 100% rename from src/moduleBase/XRandomWidget.h rename to src/ModuleBase/XRandomWidget.h diff --git a/src/moduleBase/componentDialogBase.cpp b/src/ModuleBase/componentDialogBase.cpp similarity index 100% rename from src/moduleBase/componentDialogBase.cpp rename to src/ModuleBase/componentDialogBase.cpp diff --git a/src/moduleBase/componentDialogBase.h b/src/ModuleBase/componentDialogBase.h similarity index 100% rename from src/moduleBase/componentDialogBase.h rename to src/ModuleBase/componentDialogBase.h diff --git a/src/moduleBase/componentDialogBase.ui b/src/ModuleBase/componentDialogBase.ui similarity index 100% rename from src/moduleBase/componentDialogBase.ui rename to src/ModuleBase/componentDialogBase.ui diff --git a/src/moduleBase/dockWidgetBase.cpp b/src/ModuleBase/dockWidgetBase.cpp similarity index 100% rename from src/moduleBase/dockWidgetBase.cpp rename to src/ModuleBase/dockWidgetBase.cpp diff --git a/src/moduleBase/dockWidgetBase.h b/src/ModuleBase/dockWidgetBase.h similarity index 100% rename from src/moduleBase/dockWidgetBase.h rename to src/ModuleBase/dockWidgetBase.h diff --git a/src/moduleBase/graph3DWindow.cpp b/src/ModuleBase/graph3DWindow.cpp similarity index 100% rename from src/moduleBase/graph3DWindow.cpp rename to src/ModuleBase/graph3DWindow.cpp diff --git a/src/moduleBase/graph3DWindow.h b/src/ModuleBase/graph3DWindow.h similarity index 100% rename from src/moduleBase/graph3DWindow.h rename to src/ModuleBase/graph3DWindow.h diff --git a/src/moduleBase/graph3DWindow.ui b/src/ModuleBase/graph3DWindow.ui similarity index 100% rename from src/moduleBase/graph3DWindow.ui rename to src/ModuleBase/graph3DWindow.ui diff --git a/src/moduleBase/graphWindowBase.cpp b/src/ModuleBase/graphWindowBase.cpp similarity index 100% rename from src/moduleBase/graphWindowBase.cpp rename to src/ModuleBase/graphWindowBase.cpp diff --git a/src/moduleBase/graphWindowBase.h b/src/ModuleBase/graphWindowBase.h similarity index 100% rename from src/moduleBase/graphWindowBase.h rename to src/ModuleBase/graphWindowBase.h diff --git a/src/moduleBase/messageWindowBase.cpp b/src/ModuleBase/messageWindowBase.cpp similarity index 100% rename from src/moduleBase/messageWindowBase.cpp rename to src/ModuleBase/messageWindowBase.cpp diff --git a/src/moduleBase/messageWindowBase.h b/src/ModuleBase/messageWindowBase.h similarity index 100% rename from src/moduleBase/messageWindowBase.h rename to src/ModuleBase/messageWindowBase.h diff --git a/src/moduleBase/messageWindowBase.ui b/src/ModuleBase/messageWindowBase.ui similarity index 100% rename from src/moduleBase/messageWindowBase.ui rename to src/ModuleBase/messageWindowBase.ui diff --git a/src/moduleBase/moduleBaseAPI.h b/src/ModuleBase/moduleBaseAPI.h similarity index 100% rename from src/moduleBase/moduleBaseAPI.h rename to src/ModuleBase/moduleBaseAPI.h diff --git a/src/moduleBase/processBar.cpp b/src/ModuleBase/processBar.cpp similarity index 100% rename from src/moduleBase/processBar.cpp rename to src/ModuleBase/processBar.cpp diff --git a/src/moduleBase/processBar.h b/src/ModuleBase/processBar.h similarity index 100% rename from src/moduleBase/processBar.h rename to src/ModuleBase/processBar.h diff --git a/src/moduleBase/processBar.ui b/src/ModuleBase/processBar.ui similarity index 100% rename from src/moduleBase/processBar.ui rename to src/ModuleBase/processBar.ui diff --git a/src/PluginMeshDataExchange/BDFdataExchange.cpp b/src/PluginMeshDataExchange/BDFdataExchange.cpp index 99049a7..db13785 100644 --- a/src/PluginMeshDataExchange/BDFdataExchange.cpp +++ b/src/PluginMeshDataExchange/BDFdataExchange.cpp @@ -1,158 +1,148 @@ -#include "BDFDataExchange.h" -#include "MainWindow/MainWindow.h" -#include "MeshData/meshSingleton.h" -#include "MeshData/meshKernal.h" -#include "MeshData/meshSet.h" +#include "BDFdataExchange.h" + #include "BCBase/BCUserDef.h" -#include "ModelData/modelDataSingleton.h" -#include "ModelData/modelDataBaseExtend.h" -#include "DataProperty/ParameterGroup.h" -#include "DataProperty/ParameterDouble.h" -#include "DataProperty/ParameterString.h" -#include "DataProperty/PropertyString.h" -#include "Material/Material.h" #include "ConfigOptions/ConfigOptions.h" #include "ConfigOptions/MaterialConfig.h" +#include "DataProperty/ParameterDouble.h" +#include "DataProperty/ParameterGroup.h" +#include "DataProperty/ParameterString.h" +#include "DataProperty/PropertyString.h" +#include "MainWindow/MainWindow.h" +#include "Material/Material.h" #include "Material/MaterialFactory.h" #include "Material/MaterialSingletion.h" +#include "MeshData/meshKernal.h" +#include "MeshData/meshSet.h" +#include "MeshData/meshSingleton.h" +#include "ModelData/modelDataBaseExtend.h" +#include "ModelData/modelDataSingleton.h" #include "ModuleBase/ThreadTaskManager.h" -#include -#include -#include -#include -#include -#include -#include -#include -namespace MeshData -{ +#include +#include +#include +#include +#include +#include +#include +#include + +namespace MeshData { const QMap> allSupportElements = { std::map>::value_type("CROD", qMakePair(2, VTK_LINE)), std::map>::value_type("CBAR", qMakePair(2, VTK_LINE)), std::map>::value_type("CQUAD4", qMakePair(4, VTK_QUAD)), - std::map>::value_type("CQUAD8", qMakePair(8, VTK_QUADRATIC_QUAD)), - std::map>::value_type("CHEXA", qMakePair(8, VTK_HEXAHEDRON)), - std::map>::value_type("CTETRA", qMakePair(10, VTK_QUADRATIC_TETRA)) + std::map>::value_type("CQUAD8", + qMakePair(8, VTK_QUADRATIC_QUAD)), + std::map>::value_type("CHEXA", + qMakePair(8, VTK_HEXAHEDRON)), + std::map>::value_type("CTETRA", + qMakePair(10, VTK_QUADRATIC_TETRA)) }; - BDFDataExchange::BDFDataExchange(const QString &fileName, MeshOperation operation, GUI::MainWindow *mw, int modelId) : MeshThreadBase(fileName, operation, mw), - _fileName(fileName), - _operation(operation), - _meshData(MeshData::getInstance()), - _modelId(modelId), - _mw(mw) + BDFDataExchange::BDFDataExchange(const QString& fileName, MeshOperation operation, + GUI::MainWindow* mw, int modelId) + : MeshThreadBase(fileName, operation, mw) + , _fileName(fileName) + , _operation(operation) + , _meshData(MeshData::getInstance()) + , _modelId(modelId) + , _mw(mw) { } - void BDFDataExchange::readLine(QString &line) + void BDFDataExchange::readLine(QString& line) { - while (_threadRuning && !_stream->atEnd()) - { + while(_threadRuning && !_stream->atEnd()) { // 此处不可删除空格,包括首末位置的空格 line = _stream->readLine(); - if (line.startsWith("$")) + if(line.startsWith("$")) continue; break; } } - bool BDFDataExchange::readNodes(vtkUnstructuredGrid *g, QString &line, MeshKernal *k) + bool BDFDataExchange::readNodes(vtkUnstructuredGrid* g, QString& line, MeshKernal* k) { - if (nullptr == g || nullptr == k) - { + if(nullptr == g || nullptr == k) { return false; } vtkSmartPointer points = vtkSmartPointer::New(); - bool result = false; - do - { - if (!_threadRuning) + bool result = false; + do { + if(!_threadRuning) break; - double point[3] = {0}; - int index = 0; + double point[3] = { 0 }; + int index = 0; - if (line.startsWith("GRID*")) - { - index = line.mid(8, 16).toInt(); + if(line.startsWith("GRID*")) { + index = line.mid(8, 16).toInt(); point[0] = line.mid(40, 16).toDouble(); point[1] = line.mid(56, 16).toDouble(); readLine(line); point[2] = line.mid(8, 16).toDouble(); - } - else if (line.startsWith("GRID")) - { - index = line.mid(8, 16).toInt(); + } else if(line.startsWith("GRID")) { + index = line.mid(8, 16).toInt(); point[0] = line.mid(24, 8).toDouble(); point[1] = line.mid(32, 8).toDouble(); point[2] = line.mid(40, 8).toDouble(); - } - else - { + } else { break; } - // qDebug() << "Point : index=" << index << "; x=" << point[0] << "; y=" << point[1] << "; z=" << point[2] ; - // points->InsertPoint(index - 1, point); + // qDebug() << "Point : index=" << index << "; x=" << point[0] << "; y=" << point[1] << + // "; z=" << point[2] ; points->InsertPoint(index - 1, point); vtkIdType re = points->InsertNextPoint(point); _pointIndexMapping.insert(index, re); readLine(line); // node区域读取完毕 - if (!line.startsWith("GRID")) - { + if(!line.startsWith("GRID")) { break; } - } while (_threadRuning && !_stream->atEnd()); + } while(_threadRuning && !_stream->atEnd()); - if (points->GetNumberOfPoints() > 2) - { + if(points->GetNumberOfPoints() > 2) { g->SetPoints(points); result = true; } return result; } - bool BDFDataExchange::readElements(vtkUnstructuredGrid *g, MeshKernal *k) + bool BDFDataExchange::readElements(vtkUnstructuredGrid* g, MeshKernal* k) { - if (nullptr == g || nullptr == k || _elementList.isEmpty()) - { + if(nullptr == g || nullptr == k || _elementList.isEmpty()) { return false; } - bool result = true; - int cellPointNum = 1; + bool result = true; + int cellPointNum = 1; - QString cellType = "None"; - QString line = ""; - for (int i = 0; i < _elementList.size(); ++i) - { - line = _elementList.at(i); - cellType = line.mid(0, 8).simplified(); + QString cellType = "None"; + QString line = ""; + for(int i = 0; i < _elementList.size(); ++i) { + line = _elementList.at(i); + cellType = line.mid(0, 8).simplified(); cellPointNum = allSupportElements.value(cellType).first; - if (!_threadRuning) - { + if(!_threadRuning) { result = false; break; } vtkSmartPointer indexList = vtkSmartPointer::New(); - int index = 3; - QString s = line.mid(index * 8, 8); - do - { + int index = 3; + QString s = line.mid(index * 8, 8); + do { indexList->InsertNextId(_pointIndexMapping.value(s.toInt())); s = line.mid((++index) * 8, 8); - } while (!s.isNull()); + } while(!s.isNull()); // 是否为双行存储 - if (index == 9 && allSupportElements.value(cellType).first > 7) - { + if(index == 9 && allSupportElements.value(cellType).first > 7) { line = _elementList.at(++i); - for (int j = 1; j <= (allSupportElements.value(cellType).first - 6); ++j) - { + for(int j = 1; j <= (allSupportElements.value(cellType).first - 6); ++j) { indexList->InsertNextId(_pointIndexMapping.value(line.mid(j * 8, 8).toInt())); } } @@ -166,72 +156,61 @@ namespace MeshData bool BDFDataExchange::read() { QFileInfo info(_fileName); - if (!info.exists()) + if(!info.exists()) return false; QString name = info.fileName(); QString path = info.filePath(); - QFile file(_fileName); - if (!file.open(QIODevice::ReadOnly)) + QFile file(_fileName); + if(!file.open(QIODevice::ReadOnly)) return false; - _stream = new QTextStream(&file); - vtkUnstructuredGrid *dataset = vtkUnstructuredGrid::New(); - MeshKernal *k = new MeshKernal; - QString line; + _stream = new QTextStream(&file); + vtkUnstructuredGrid* dataset = vtkUnstructuredGrid::New(); + MeshKernal* k = new MeshKernal; + QString line; - do - { - if (!_threadRuning) - { + do { + if(!_threadRuning) { file.close(); return false; } this->readLine(line); - if (line.startsWith("GRID") && (!readNodes(dataset, line, k))) - { + if(line.startsWith("GRID") && (!readNodes(dataset, line, k))) { delete k; dataset->Delete(); file.close(); return false; - } - else - { - for (auto type : allSupportElements.keys()) - { - if (line.startsWith(type)) - { + } else { + for(auto type : allSupportElements.keys()) { + if(line.startsWith(type)) { _elementList.append(line); - if (allSupportElements.value(type).first > 7) - { + if(allSupportElements.value(type).first > 7) { readLine(line); _elementList.append(line); } } } } - if (_modelId == -1) + if(_modelId == -1) continue; - } while (_threadRuning && !_stream->atEnd()); + } while(_threadRuning && !_stream->atEnd()); // 保证先读取节点,再读取单元 - if (!readElements(dataset, k)) - { + if(!readElements(dataset, k)) { delete k; dataset->Delete(); file.close(); return false; } - if (dataset != nullptr) - { + if(dataset != nullptr) { k->setName(name); k->setPath(path); - k->setMeshData((vtkDataSet *)dataset); + k->setMeshData((vtkDataSet*)dataset); _meshData->appendMeshKernal(k); } - if (_modelId != -1) - { + if(_modelId != -1) { emit _mw->updatePhysicsTreeSignal(); } file.close(); @@ -242,18 +221,17 @@ namespace MeshData { ModuleBase::ThreadTask::run(); bool result = false; - switch (_operation) - { - case MESH_READ: - emit showInformation(tr("Import BDF Mesh File From \"%1\"").arg(_fileName)); - result = read(); - setReadResult(result); - break; - case MESH_WRITE: - emit showInformation(tr("This feature has not been implemented!")); - break; + switch(_operation) { + case MESH_READ: + emit showInformation(tr("Import BDF Mesh File From \"%1\"").arg(_fileName)); + result = read(); + setReadResult(result); + break; + case MESH_WRITE: + emit showInformation(tr("This feature has not been implemented!")); + break; } defaultMeshFinished(); } -} +} // namespace MeshData diff --git a/src/PluginMeshDataExchange/CDBdataExchange.cpp b/src/PluginMeshDataExchange/CDBdataExchange.cpp index 4a1b79d..7f67ccc 100644 --- a/src/PluginMeshDataExchange/CDBdataExchange.cpp +++ b/src/PluginMeshDataExchange/CDBdataExchange.cpp @@ -1,118 +1,108 @@ #include "CDBdataExchange.h" -#include "meshData/meshSingleton.h" -#include "meshData/meshKernal.h" -#include "meshData/meshSet.h" + +#include "MainWindow/MainWindow.h" +#include "MeshData/meshKernal.h" +#include "MeshData/meshSet.h" +#include "MeshData/meshSingleton.h" #include "meshDataExchangePlugin.h" -#include "mainWindow/mainWindow.h" #include "MeshThreadBase.h" -#include -#include -#include #include - +#include +#include +#include #include - -namespace MeshData -{ - CDBdataExchange::CDBdataExchange(const QString & filename, MeshOperation operation, GUI::MainWindow * mw, int modelId): - m_filePath(filename), - m_operation(operation), - m_meshData(MeshData::getInstance()), - MeshThreadBase(filename, operation, mw), - m_modelId(modelId) +namespace MeshData { + CDBdataExchange::CDBdataExchange(const QString& filename, MeshOperation operation, + GUI::MainWindow* mw, int modelId) + : m_filePath(filename) + , m_operation(operation) + , m_meshData(MeshData::getInstance()) + , MeshThreadBase(filename, operation, mw) + , m_modelId(modelId) { } - CDBdataExchange::~CDBdataExchange() - { - } + CDBdataExchange::~CDBdataExchange() {} void CDBdataExchange::run() { ModuleBase::ThreadTask::run(); bool result = false; - switch (m_operation) - { - case MESH_READ: - { - emit showInformation(tr("Import CDB Mesh File From \"%1\"").arg(m_filePath)); - result = read(); - setReadResult(result); - break; - } - case MESH_WRITE: - { - emit showInformation(tr("Export CDB Mesh File From \"%1\"").arg(m_filePath)); - result = write(); - setWriteResult(result); - break; - } + switch(m_operation) { + case MESH_READ: { + emit showInformation(tr("Import CDB Mesh File From \"%1\"").arg(m_filePath)); + result = read(); + setReadResult(result); + break; + } + case MESH_WRITE: { + emit showInformation(tr("Export CDB Mesh File From \"%1\"").arg(m_filePath)); + result = write(); + setWriteResult(result); + break; + } } defaultMeshFinished(); } bool CDBdataExchange::read() { - int a = m_filePath.lastIndexOf('/'); - int b = m_filePath.lastIndexOf('.'); - int nameSize = b - a; + int a = m_filePath.lastIndexOf('/'); + int b = m_filePath.lastIndexOf('.'); + int nameSize = b - a; QString fileName = m_filePath.mid(a, nameSize); - QFile file(m_filePath); + QFile file(m_filePath); - if (!file.exists()) return false; + if(!file.exists()) + return false; - if (!file.open(QIODevice::ReadOnly)) return false; + if(!file.open(QIODevice::ReadOnly)) + return false; m_grid = vtkUnstructuredGrid::New(); QTextStream in(&file); - int AllNodeNum = -1; - int AllElemNum = -1; - QString LineType; - vtkPoints* points = vtkPoints::New(); - while (!in.atEnd()) - { + int AllNodeNum = -1; + int AllElemNum = -1; + QString LineType; + vtkPoints* points = vtkPoints::New(); + while(!in.atEnd()) { QString line = in.readLine(); - if (line.isEmpty()) return false; + if(line.isEmpty()) + return false; QStringList lineList = line.split(" "); lineList.removeAll(""); - if(lineList.isEmpty()) continue; - if (lineList[0] == "NUMOFF,NODE,") - { - AllNodeNum = lineList[1].toInt(); + if(lineList.isEmpty()) + continue; + if(lineList[0] == "NUMOFF,NODE,") { + AllNodeNum = lineList[1].toInt(); continue; } - if (lineList[0] == "NUMOFF,ELEM,") - { - AllElemNum = lineList[1].toInt(); + if(lineList[0] == "NUMOFF,ELEM,") { + AllElemNum = lineList[1].toInt(); continue; } - if (AllNodeNum != -1 && AllElemNum != -1) - { - if (line.mid(0, 6) == "NBLOCK") - { + if(AllNodeNum != -1 && AllElemNum != -1) { + if(line.mid(0, 6) == "NBLOCK") { LineType = "NBLOCK"; continue; - } - else if (line.mid(0, 6) == "EBLOCK") - { + } else if(line.mid(0, 6) == "EBLOCK") { LineType = "EBLOCK"; continue; } - if (LineType == "NBLOCK") - { - if(lineList.size()<3) continue; - readNode(line,lineList ,points); - } - else if (LineType == "EBLOCK") - { - if (lineList.size() < 15) continue; + if(LineType == "NBLOCK") { + if(lineList.size() < 3) + continue; + readNode(line, lineList, points); + } else if(LineType == "EBLOCK") { + if(lineList.size() < 15) + continue; readElement(lineList); } } } - + m_grid->SetPoints(points); MeshKernal* kernal = new MeshKernal; kernal->setName(fileName); @@ -127,11 +117,11 @@ namespace MeshData } bool CDBdataExchange::readNode(QString line, QStringList lineList, vtkPoints* points) { - double point[3]; + double point[3]; QString p = line.mid(27); - point[0] = p.mid(0,20).toDouble(); - point[1] = p.mid(20,20).toDouble(); - point[2] = p.mid(40).toDouble(); + point[0] = p.mid(0, 20).toDouble(); + point[1] = p.mid(20, 20).toDouble(); + point[2] = p.mid(40).toDouble(); points->InsertNextPoint(point); m_pointHash.insert(lineList[0].toInt(), m_pointId); m_pointId++; @@ -139,9 +129,9 @@ namespace MeshData } bool CDBdataExchange::readElement(QStringList lineList) { - VTKCellType cellType = VTK_TRIANGLE; - vtkSmartPointer IdList = vtkSmartPointer::New(); - int p = m_pointHash.value(lineList[11].toInt()); + VTKCellType cellType = VTK_TRIANGLE; + vtkSmartPointer IdList = vtkSmartPointer::New(); + int p = m_pointHash.value(lineList[11].toInt()); IdList->InsertNextId(p); p = m_pointHash.value(lineList[12].toInt()); IdList->InsertNextId(p); @@ -151,4 +141,4 @@ namespace MeshData m_grid->InsertNextCell(cellType, IdList); return true; } -} \ No newline at end of file +} // namespace MeshData \ No newline at end of file diff --git a/src/PluginMeshDataExchange/FEMdataExchange.cpp b/src/PluginMeshDataExchange/FEMdataExchange.cpp index 45891d3..237aaee 100644 --- a/src/PluginMeshDataExchange/FEMdataExchange.cpp +++ b/src/PluginMeshDataExchange/FEMdataExchange.cpp @@ -1,62 +1,59 @@ -#include "meshData/meshSingleton.h" -#include "meshData/meshKernal.h" -#include "meshData/meshSet.h" -#include "mainWindow/mainWindow.h" #include "FEMdataExchange.h" + +#include "MainWindow/MainWindow.h" +#include "MeshData/meshKernal.h" +#include "MeshData/meshSet.h" +#include "MeshData/meshSingleton.h" #include "MeshThreadBase.h" + +#include #include #include -#include #include -#include -#include #include +#include +#include -namespace MeshData -{ - FEMdataExchange::FEMdataExchange(const QString & filename, MeshOperation operation, GUI::MainWindow * mw, int modelId): - m_fileName(filename), - m_operation(operation), - m_meshData(MeshData::getInstance()), - MeshThreadBase(filename, operation, mw), - m_modelId(modelId) +namespace MeshData { + FEMdataExchange::FEMdataExchange(const QString& filename, MeshOperation operation, + GUI::MainWindow* mw, int modelId) + : m_fileName(filename) + , m_operation(operation) + , m_meshData(MeshData::getInstance()) + , MeshThreadBase(filename, operation, mw) + , m_modelId(modelId) { - } - FEMdataExchange::~FEMdataExchange() - { - - } + FEMdataExchange::~FEMdataExchange() {} bool FEMdataExchange::read() { - QFile file(m_fileName); - int a = m_fileName.lastIndexOf('/'); - int b = m_fileName.lastIndexOf('.'); - int nameSize = b - a-1; - QString fileName = m_fileName.mid(a+1, nameSize); - if (!file.exists()) return false; + QFile file(m_fileName); + int a = m_fileName.lastIndexOf('/'); + int b = m_fileName.lastIndexOf('.'); + int nameSize = b - a - 1; + QString fileName = m_fileName.mid(a + 1, nameSize); + if(!file.exists()) + return false; - if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) return false; + if(!file.open(QIODevice::ReadOnly | QIODevice::Text)) + return false; QTextStream in(&file); - m_grid = vtkUnstructuredGrid::New(); + m_grid = vtkUnstructuredGrid::New(); vtkSmartPointer vtkPoint = vtkSmartPointer::New(); - - while (!in.atEnd()) - { - QString line = in.readLine(); + + while(!in.atEnd()) { + QString line = in.readLine(); QStringList lineList = line.split(" "); lineList.removeAll(QString("")); - if(lineList.isEmpty()) continue; - if (lineList[0] == "GRID") - { + if(lineList.isEmpty()) + continue; + if(lineList[0] == "GRID") { appendNode(lineList, vtkPoint); - } - else if(lineList[0]=="CTRIA3") - { + } else if(lineList[0] == "CTRIA3") { appendElement(lineList); } } @@ -78,119 +75,96 @@ namespace MeshData { ModuleBase::ThreadTask::run(); bool result = false; - switch (m_operation) - { - case MESH_READ: - emit showInformation(tr("Import FEM Mesh File From \"%1\"").arg(m_fileName)); - result = read(); - setReadResult(result); - break; - case MESH_WRITE: - emit showInformation(tr("Export FEM Mesh File From \"%1\"").arg(m_fileName)); - result = write(); - setWriteResult(result); - break; + switch(m_operation) { + case MESH_READ: + emit showInformation(tr("Import FEM Mesh File From \"%1\"").arg(m_fileName)); + result = read(); + setReadResult(result); + break; + case MESH_WRITE: + emit showInformation(tr("Export FEM Mesh File From \"%1\"").arg(m_fileName)); + result = write(); + setWriteResult(result); + break; } defaultMeshFinished(); } void FEMdataExchange::appendNode(QStringList lineList, vtkPoints* vtkPoint) { - int lineSize = lineList.size(); - //qDebug() << lineList; + int lineSize = lineList.size(); + // qDebug() << lineList; double point[3]; - switch (lineSize) - { - case 3: - { - point[0] = lineList[2].mid(0, 8).toDouble(); - point[1] = lineList[2].mid(8, 8).toDouble(); - point[2] = lineList[2].mid(16).toDouble(); - break; - } - case 4: - { - if (lineList[2].size() > 8) - { + switch(lineSize) { + case 3: { point[0] = lineList[2].mid(0, 8).toDouble(); - point[1] = lineList[2].mid(8).toDouble(); - point[2] = lineList[3].toDouble(); + point[1] = lineList[2].mid(8, 8).toDouble(); + point[2] = lineList[2].mid(16).toDouble(); + break; } - else - { + case 4: { + if(lineList[2].size() > 8) { + point[0] = lineList[2].mid(0, 8).toDouble(); + point[1] = lineList[2].mid(8).toDouble(); + point[2] = lineList[3].toDouble(); + } else { + point[0] = lineList[2].toDouble(); + point[1] = lineList[3].mid(0, 8).toDouble(); + point[2] = lineList[3].mid(8).toDouble(); + } + break; + } + case 5: { point[0] = lineList[2].toDouble(); - point[1] = lineList[3].mid(0, 8).toDouble(); - point[2] = lineList[3].mid(8).toDouble(); + point[1] = lineList[3].toDouble(); + point[2] = lineList[4].toDouble(); + break; } - break; + default: + return; } - case 5: - { - point[0] = lineList[2].toDouble(); - point[1] = lineList[3].toDouble(); - point[2] = lineList[4].toDouble(); - break; - } - default: - return; - } - //qDebug() << pointId << " " << point[0] << " " << point[1] << " " << point[2]; + // qDebug() << pointId << " " << point[0] << " " << point[1] << " " << point[2]; vtkPoint->InsertNextPoint(point); - m_pointHash.insert(lineList[1].toInt(),m_pointId); + m_pointHash.insert(lineList[1].toInt(), m_pointId); m_pointId++; } void FEMdataExchange::appendElement(QStringList lineList) { - if (lineList.size() < 6) return; + if(lineList.size() < 6) + return; - VTKCellType cellType = VTK_EMPTY_CELL; - vtkSmartPointer IdList = vtkSmartPointer::New(); + VTKCellType cellType = VTK_EMPTY_CELL; + vtkSmartPointer IdList = vtkSmartPointer::New(); elementTypeSelect(lineList[0], cellType); - if (cellType == VTK_EMPTY_CELL) return; - - for (int i = 3; i < lineList.size(); i++) - { + if(cellType == VTK_EMPTY_CELL) + return; + + for(int i = 3; i < lineList.size(); i++) { int p = m_pointHash.value(lineList[i].toInt()); IdList->InsertNextId(p); } - m_grid->InsertNextCell(cellType,IdList); - + m_grid->InsertNextCell(cellType, IdList); } - void FEMdataExchange::elementTypeSelect(QString elementName, VTKCellType &type) + void FEMdataExchange::elementTypeSelect(QString elementName, VTKCellType& type) { - if (elementName == "CTRIA3") - { + if(elementName == "CTRIA3") { type = VTK_TRIANGLE; - } - else if (elementName == "CTRIA6") - { + } else if(elementName == "CTRIA6") { type = VTK_QUADRATIC_TRIANGLE; - } - else if (elementName == "CQUAD4") - { + } else if(elementName == "CQUAD4") { type = VTK_QUAD; - } - else if (elementName == "CQUAD8") - { + } else if(elementName == "CQUAD8") { type = VTK_QUADRATIC_QUAD; - } - else if (elementName == "CTETRA") - { + } else if(elementName == "CTETRA") { type = VTK_TETRA; - } - else if (elementName == "c") - { + } else if(elementName == "c") { type = VTK_QUADRATIC_TETRA; - } - else if (elementName == "CHEXA") - { + } else if(elementName == "CHEXA") { type = VTK_HEXAHEDRON; - } - else if (elementName == "cc") - { + } else if(elementName == "cc") { type = VTK_QUADRATIC_HEXAHEDRON; } } -} \ No newline at end of file +} // namespace MeshData \ No newline at end of file diff --git a/src/PluginMeshDataExchange/FEMdataExchange.h b/src/PluginMeshDataExchange/FEMdataExchange.h index 673820c..18ba263 100644 --- a/src/PluginMeshDataExchange/FEMdataExchange.h +++ b/src/PluginMeshDataExchange/FEMdataExchange.h @@ -1,42 +1,43 @@ -#ifndef _FEMDATAEXCHANGE_H_ -#define _FEMDATAEXCHANGE_H_ +#ifndef _FEMDATAEXCHANGE_H_ +#define _FEMDATAEXCHANGE_H_ #include "meshDataExchangePlugin.h" #include "MeshThreadBase.h" + +#include #include class vtkUnstructuredGrid; class vtkPoints; -namespace MeshData -{ +namespace MeshData { class MeshData; - class MESHDATAEXCHANGEPLUGINAPI FEMdataExchange :public MeshThreadBase - { + class MESHDATAEXCHANGEPLUGINAPI FEMdataExchange : public MeshThreadBase { public: - FEMdataExchange(const QString &filename, MeshOperation operation, GUI::MainWindow *mw, int modelId = -1); + FEMdataExchange(const QString& filename, MeshOperation operation, GUI::MainWindow* mw, + int modelId = -1); ~FEMdataExchange(); bool read(); bool write(); void run(); + private: void appendNode(QStringList lineList, vtkPoints* vtkPoint); void appendElement(QStringList lineList); - void elementTypeSelect(QString elementName,VTKCellType &type); + void elementTypeSelect(QString elementName, VTKCellType& type); private: - QString m_fileName = {}; - MeshData* m_meshData = nullptr; - int m_modelId; - MeshOperation m_operation; - vtkUnstructuredGrid* m_grid = nullptr; - int Num = 0; - QHash m_pointHash = {}; - int m_pointId = 0; - + QString m_fileName = {}; + MeshData* m_meshData = nullptr; + int m_modelId; + MeshOperation m_operation; + vtkUnstructuredGrid* m_grid = nullptr; + int Num = 0; + QHash m_pointHash = {}; + int m_pointId = 0; }; -} +} // namespace MeshData #endif diff --git a/src/PluginMeshDataExchange/meshDataExchangePlugin.cpp b/src/PluginMeshDataExchange/meshDataExchangePlugin.cpp index 7ebb1c5..1166dcd 100644 --- a/src/PluginMeshDataExchange/meshDataExchangePlugin.cpp +++ b/src/PluginMeshDataExchange/meshDataExchangePlugin.cpp @@ -1,26 +1,27 @@ #include "meshDataExchangePlugin.h" + +#include "BDFdataExchange.h" #include "CGNSdataExchange.h" #include "CNTMdataExchange.h" #include "INPdataExchange.h" +#include "IO/IOConfig.h" +#include "KEYdataExchange.h" +#include "ModelData/modelDataBase.h" +#include "ModuleBase/ThreadControl.h" +#include "ModuleBase/ThreadTaskManager.h" #include "MSHdataExchange.h" #include "NEUdataExchange.h" -#include "VTKdataExchange.h" -#include "SU2dataExchange.h" -#include "KEYdataExchange.h" -#include "BDFDataExchange.h" -#include "IO/IOConfig.h" -#include "ModelData/modelDataBase.h" -#include "ModuleBase/ThreadTaskManager.h" -#include "ModuleBase/ThreadControl.h" #include "PDBdataExchange.h" +#include "SU2dataExchange.h" +#include "VTKdataExchange.h" + #include -GUI::MainWindow *MeshData::MeshDataExchangePlugin::_mainwindow = nullptr; -namespace MeshData -{ - MeshDataExchangePlugin::MeshDataExchangePlugin(GUI::MainWindow *m) +GUI::MainWindow* MeshData::MeshDataExchangePlugin::_mainwindow = nullptr; +namespace MeshData { + MeshDataExchangePlugin::MeshDataExchangePlugin(GUI::MainWindow* m) { - _describe = "MeshDataExchangePlugin Installed Successfully"; + _describe = "MeshDataExchangePlugin Installed Successfully"; _mainwindow = m; } @@ -82,132 +83,142 @@ namespace MeshData return true; } - void MeshDataExchangePlugin::reTranslate(QString) - { - } + void MeshDataExchangePlugin::reTranslate(QString) {} - GUI::MainWindow *MeshDataExchangePlugin::getMWpt() + GUI::MainWindow* MeshDataExchangePlugin::getMWpt() { return _mainwindow; } -} +} // namespace MeshData -void Register(GUI::MainWindow *m, QList *ps) +void Register(GUI::MainWindow* m, QList* ps) { - Plugins::PluginBase *p = new MeshData::MeshDataExchangePlugin(m); + Plugins::PluginBase* p = new MeshData::MeshDataExchangePlugin(m); ps->append(p); } bool CGNSimportMesh(QString AbFileName, int modelId) { - auto CGNSreader = new MeshData::CGNSdataExchange(AbFileName, MeshData::MESH_READ, MeshData::MeshDataExchangePlugin::getMWpt()); - ModuleBase::ThreadControl *tc = new ModuleBase::ThreadControl(CGNSreader); - emit tc->threadStart(); // emit CGNSreader->start(); + auto CGNSreader = new MeshData::CGNSdataExchange(AbFileName, MeshData::MESH_READ, + MeshData::MeshDataExchangePlugin::getMWpt()); + ModuleBase::ThreadControl* tc = new ModuleBase::ThreadControl(CGNSreader); + emit tc->threadStart(); // emit CGNSreader->start(); return false; } bool CGNSexportMesh(QString AbFileName, int modelId) { - auto CGNSwriter = new MeshData::CGNSdataExchange(AbFileName, MeshData::MESH_WRITE, MeshData::MeshDataExchangePlugin::getMWpt(), modelId); - ModuleBase::ThreadControl *tc = new ModuleBase::ThreadControl(CGNSwriter); - emit tc->threadStart(); // emit CGNSwriter->start(); + auto CGNSwriter = new MeshData::CGNSdataExchange( + AbFileName, MeshData::MESH_WRITE, MeshData::MeshDataExchangePlugin::getMWpt(), modelId); + ModuleBase::ThreadControl* tc = new ModuleBase::ThreadControl(CGNSwriter); + emit tc->threadStart(); // emit CGNSwriter->start(); return false; } 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); - emit tc->threadStart(); // emit MSHreader->start(); + auto MSHreader = new MeshData::MSHdataExchange(AbFileName, MeshData::MESH_READ, + MeshData::MeshDataExchangePlugin::getMWpt()); + ModuleBase::ThreadControl* tc = new ModuleBase::ThreadControl(MSHreader); + emit tc->threadStart(); // emit MSHreader->start(); return false; } bool MSHexportMesh(QString AbFileName, int modelId) { - auto MSHwriter = new MeshData::MSHdataExchange(AbFileName, MeshData::MESH_WRITE, MeshData::MeshDataExchangePlugin::getMWpt(), modelId); - ModuleBase::ThreadControl *tc = new ModuleBase::ThreadControl(MSHwriter); - emit tc->threadStart(); // emit MSHwriter->start(); + auto MSHwriter = new MeshData::MSHdataExchange( + AbFileName, MeshData::MESH_WRITE, MeshData::MeshDataExchangePlugin::getMWpt(), modelId); + ModuleBase::ThreadControl* tc = new ModuleBase::ThreadControl(MSHwriter); + emit tc->threadStart(); // emit MSHwriter->start(); return false; } bool NEUimportMesh(QString AbFileName, int modelId) { - auto NEUreader = new MeshData::NEUdataExchange(AbFileName, MeshData::MESH_READ, MeshData::MeshDataExchangePlugin::getMWpt()); - ModuleBase::ThreadControl *tc = new ModuleBase::ThreadControl(NEUreader); - emit tc->threadStart(); // emit NEUreader->start(); + auto NEUreader = new MeshData::NEUdataExchange(AbFileName, MeshData::MESH_READ, + MeshData::MeshDataExchangePlugin::getMWpt()); + ModuleBase::ThreadControl* tc = new ModuleBase::ThreadControl(NEUreader); + emit tc->threadStart(); // emit NEUreader->start(); return false; } bool NEUexportMesh(QString AbFileName, int modelId) { - auto NEUwriter = new MeshData::NEUdataExchange(AbFileName, MeshData::MESH_WRITE, MeshData::MeshDataExchangePlugin::getMWpt(), modelId); - ModuleBase::ThreadControl *tc = new ModuleBase::ThreadControl(NEUwriter); - emit tc->threadStart(); // emit NEUwriter->start(); + auto NEUwriter = new MeshData::NEUdataExchange( + AbFileName, MeshData::MESH_WRITE, MeshData::MeshDataExchangePlugin::getMWpt(), modelId); + ModuleBase::ThreadControl* tc = new ModuleBase::ThreadControl(NEUwriter); + emit tc->threadStart(); // emit NEUwriter->start(); return false; } bool VTK_DAT_STL_importMesh(QString AbFileName, int modelId) { - auto VTK_DAT_STL_reader = new MeshData::VTKdataExchange(AbFileName, MeshData::MESH_READ, MeshData::MeshDataExchangePlugin::getMWpt()); - ModuleBase::ThreadControl *tc = new ModuleBase::ThreadControl(VTK_DAT_STL_reader); - emit tc->threadStart(); // emit VTK_DAT_STL_reader->start(); + auto VTK_DAT_STL_reader = new MeshData::VTKdataExchange( + AbFileName, MeshData::MESH_READ, MeshData::MeshDataExchangePlugin::getMWpt()); + ModuleBase::ThreadControl* tc = new ModuleBase::ThreadControl(VTK_DAT_STL_reader); + emit tc->threadStart(); // emit VTK_DAT_STL_reader->start(); return false; } bool VTK_DAT_STL_exportMesh(QString AbFileName, int modelId) { - auto VTK_DAT_STL_writer = new MeshData::VTKdataExchange(AbFileName, MeshData::MESH_WRITE, MeshData::MeshDataExchangePlugin::getMWpt(), modelId); - ModuleBase::ThreadControl *tc = new ModuleBase::ThreadControl(VTK_DAT_STL_writer); - emit tc->threadStart(); // emit VTK_DAT_STL_writer->start(); + auto VTK_DAT_STL_writer = new MeshData::VTKdataExchange( + AbFileName, MeshData::MESH_WRITE, MeshData::MeshDataExchangePlugin::getMWpt(), modelId); + ModuleBase::ThreadControl* tc = new ModuleBase::ThreadControl(VTK_DAT_STL_writer); + emit tc->threadStart(); // emit VTK_DAT_STL_writer->start(); return false; } bool INPimportMesh(QString AbFileName, int modelId) { - auto INPreader = new MeshData::INPdataExchange(AbFileName, MeshData::MESH_READ, MeshData::MeshDataExchangePlugin::getMWpt(), modelId); - ModuleBase::ThreadControl *tc = new ModuleBase::ThreadControl(INPreader); - emit tc->threadStart(); // emit INPreader->start(); + auto INPreader = new MeshData::INPdataExchange( + AbFileName, MeshData::MESH_READ, MeshData::MeshDataExchangePlugin::getMWpt(), modelId); + ModuleBase::ThreadControl* tc = new ModuleBase::ThreadControl(INPreader); + emit tc->threadStart(); // emit INPreader->start(); return false; } bool INPexportMesh(QString AbFileName, int modelId) { - auto INPwriter = new MeshData::INPdataExchange(AbFileName, MeshData::MESH_WRITE, MeshData::MeshDataExchangePlugin::getMWpt(), modelId); - ModuleBase::ThreadControl *tc = new ModuleBase::ThreadControl(INPwriter); - emit tc->threadStart(); // emit INPwriter->start(); + auto INPwriter = new MeshData::INPdataExchange( + AbFileName, MeshData::MESH_WRITE, MeshData::MeshDataExchangePlugin::getMWpt(), modelId); + ModuleBase::ThreadControl* tc = new ModuleBase::ThreadControl(INPwriter); + emit tc->threadStart(); // emit INPwriter->start(); return false; } bool CNTMimportMesh(QString AbFileName, int modelId) { - auto CNTMreader = new MeshData::CNTMdataExchange(AbFileName, MeshData::MESH_READ, MeshData::MeshDataExchangePlugin::getMWpt()); - ModuleBase::ThreadControl *tc = new ModuleBase::ThreadControl(CNTMreader); - emit tc->threadStart(); // emit CNTMreader->start(); + auto CNTMreader = new MeshData::CNTMdataExchange(AbFileName, MeshData::MESH_READ, + MeshData::MeshDataExchangePlugin::getMWpt()); + ModuleBase::ThreadControl* tc = new ModuleBase::ThreadControl(CNTMreader); + emit tc->threadStart(); // emit CNTMreader->start(); return false; } bool CNTMexportMesh(QString AbFileName, int modelId) { - auto CNTMwriter = new MeshData::CNTMdataExchange(AbFileName, MeshData::MESH_WRITE, MeshData::MeshDataExchangePlugin::getMWpt(), modelId); - ModuleBase::ThreadControl *tc = new ModuleBase::ThreadControl(CNTMwriter); - emit tc->threadStart(); // emit CNTMwriter->start(); + auto CNTMwriter = new MeshData::CNTMdataExchange( + AbFileName, MeshData::MESH_WRITE, MeshData::MeshDataExchangePlugin::getMWpt(), modelId); + ModuleBase::ThreadControl* tc = new ModuleBase::ThreadControl(CNTMwriter); + emit tc->threadStart(); // emit CNTMwriter->start(); return false; } bool SU2importMesh(QString AbFileName, int modelId) { QFileInfo info(AbFileName); - QString fileName = info.fileName(); + QString fileName = info.fileName(); - if (fileName.startsWith("xxx")) // su2的另外一种格式 + if(fileName.startsWith("xxx")) // su2的另外一种格式 { AnotherSU2importMesh(AbFileName); - } - else // su2的正常格式 + } else // su2的正常格式 { - auto SU2reader = new MeshData::SU2dataExchange(AbFileName, MeshData::MESH_READ, MeshData::MeshDataExchangePlugin::getMWpt()); - ModuleBase::ThreadControl *tc = new ModuleBase::ThreadControl(SU2reader); - emit tc->threadStart(); // emit SU2reader->start(); + auto SU2reader = new MeshData::SU2dataExchange(AbFileName, MeshData::MESH_READ, + MeshData::MeshDataExchangePlugin::getMWpt()); + ModuleBase::ThreadControl* tc = new ModuleBase::ThreadControl(SU2reader); + emit tc->threadStart(); // emit SU2reader->start(); return false; } return false; @@ -215,71 +226,79 @@ bool SU2importMesh(QString AbFileName, int modelId) bool SU2exportMesh(QString AbFileName, int modelId) { - auto SU2writer = new MeshData::CNTMdataExchange(AbFileName, MeshData::MESH_WRITE, MeshData::MeshDataExchangePlugin::getMWpt(), modelId); - ModuleBase::ThreadControl *tc = new ModuleBase::ThreadControl(SU2writer); - emit tc->threadStart(); // emit SU2writer->start(); + auto SU2writer = new MeshData::CNTMdataExchange( + AbFileName, MeshData::MESH_WRITE, MeshData::MeshDataExchangePlugin::getMWpt(), modelId); + ModuleBase::ThreadControl* tc = new ModuleBase::ThreadControl(SU2writer); + emit tc->threadStart(); // emit SU2writer->start(); return false; } bool AnotherSU2importMesh(QString AbFileName) { - auto SU2reader = new MeshData::SU2dataExchange(AbFileName, MeshData::MESH_READ, MeshData::MeshDataExchangePlugin::getMWpt()); - ModuleBase::ThreadControl *tc = new ModuleBase::ThreadControl(SU2reader); - emit tc->threadStart(); + auto SU2reader = new MeshData::SU2dataExchange(AbFileName, MeshData::MESH_READ, + MeshData::MeshDataExchangePlugin::getMWpt()); + ModuleBase::ThreadControl* tc = new ModuleBase::ThreadControl(SU2reader); + emit tc->threadStart(); // emit SU2reader->start(); return false; } bool AnotherSU2exportMesh(QString AbFileName, int modelId) { - auto SU2writer = new MeshData::CNTMdataExchange(AbFileName, MeshData::MESH_WRITE, MeshData::MeshDataExchangePlugin::getMWpt(), modelId); - ModuleBase::ThreadControl *tc = new ModuleBase::ThreadControl(SU2writer); - emit tc->threadStart(); + auto SU2writer = new MeshData::CNTMdataExchange( + AbFileName, MeshData::MESH_WRITE, MeshData::MeshDataExchangePlugin::getMWpt(), modelId); + ModuleBase::ThreadControl* tc = new ModuleBase::ThreadControl(SU2writer); + emit tc->threadStart(); // emit SU2writer->start(); return false; } bool KEYimportMesh(QString AbFileName, int modelId) { - auto KEYreader = new MeshData::KEYdataExchange(AbFileName, MeshData::MESH_READ, MeshData::MeshDataExchangePlugin::getMWpt()); - ModuleBase::ThreadControl *tc = new ModuleBase::ThreadControl(KEYreader); - emit tc->threadStart(); + auto KEYreader = new MeshData::KEYdataExchange(AbFileName, MeshData::MESH_READ, + MeshData::MeshDataExchangePlugin::getMWpt()); + ModuleBase::ThreadControl* tc = new ModuleBase::ThreadControl(KEYreader); + emit tc->threadStart(); // emit KEYreader->start(); return false; } bool KEYexportMesh(QString AbFileName, int modelId) { - auto KEYwirter = new MeshData::KEYdataExchange(AbFileName, MeshData::MESH_WRITE, MeshData::MeshDataExchangePlugin::getMWpt(), modelId); - ModuleBase::ThreadControl *tc = new ModuleBase::ThreadControl(KEYwirter); - emit tc->threadStart(); + auto KEYwirter = new MeshData::KEYdataExchange( + AbFileName, MeshData::MESH_WRITE, MeshData::MeshDataExchangePlugin::getMWpt(), modelId); + ModuleBase::ThreadControl* tc = new ModuleBase::ThreadControl(KEYwirter); + emit tc->threadStart(); // emit KEYwirter->start(); return false; } bool MESHDATAEXCHANGEPLUGINAPI PDBimportMesh(QString AbFileName, int modelId) { - auto PDBReader = new MeshData::PDBdataExchange(AbFileName, MeshData::MESH_READ, MeshData::MeshDataExchangePlugin::getMWpt()); - ModuleBase::ThreadControl *tc = new ModuleBase::ThreadControl(PDBReader); - emit tc->threadStart(); + auto PDBReader = new MeshData::PDBdataExchange(AbFileName, MeshData::MESH_READ, + MeshData::MeshDataExchangePlugin::getMWpt()); + ModuleBase::ThreadControl* tc = new ModuleBase::ThreadControl(PDBReader); + emit tc->threadStart(); /*emit PDBReader->start();*/ return false; } bool MESHDATAEXCHANGEPLUGINAPI BDFimportMesh(QString AbFileName, int modelId) { - auto PDBReader = new MeshData::BDFDataExchange(AbFileName, MeshData::MESH_READ, MeshData::MeshDataExchangePlugin::getMWpt()); - ModuleBase::ThreadControl *tc = new ModuleBase::ThreadControl(PDBReader); - emit tc->threadStart(); + auto PDBReader = new MeshData::BDFDataExchange(AbFileName, MeshData::MESH_READ, + MeshData::MeshDataExchangePlugin::getMWpt()); + ModuleBase::ThreadControl* tc = new ModuleBase::ThreadControl(PDBReader); + emit tc->threadStart(); /*emit PDBReader->start();*/ return false; } bool MESHDATAEXCHANGEPLUGINAPI PDBexportMesh(QString AbFileName, int modelId) { - auto PDBWriter = new MeshData::PDBdataExchange(AbFileName, MeshData::MESH_WRITE, MeshData::MeshDataExchangePlugin::getMWpt(), modelId); - ModuleBase::ThreadControl *tc = new ModuleBase::ThreadControl(PDBWriter); - emit tc->threadStart(); + auto PDBWriter = new MeshData::PDBdataExchange( + AbFileName, MeshData::MESH_WRITE, MeshData::MeshDataExchangePlugin::getMWpt(), modelId); + ModuleBase::ThreadControl* tc = new ModuleBase::ThreadControl(PDBWriter); + emit tc->threadStart(); // emit PDBWriter->start(); return false; } diff --git a/src/PostAlgorithm/CMakeLists.txt b/src/PostAlgorithm/CMakeLists.txt index c4c41ac..3403352 100644 --- a/src/PostAlgorithm/CMakeLists.txt +++ b/src/PostAlgorithm/CMakeLists.txt @@ -26,7 +26,7 @@ add_library(PostAlgorithm # 添加接口声明宏 #----------------------------------------------------------------------------- target_compile_definitions(PostAlgorithm PRIVATE "POSTALGORITHM_API") -target_compile_definitions(PostAlgorithm PRIVATE "H5_BUILT_AS_DYNAMIC_LIB") +#target_compile_definitions(PostAlgorithm PRIVATE "H5_BUILT_AS_DYNAMIC_LIB") list(APPEND _runtimes_libraries FASTCAE::CGNS FASTCAE::HDF5 FASTCAE::HDF5CPP FASTCAE::TECIO Qt5::Core VTK::CommonColor VTK::CommonComputationalGeometry VTK::CommonCore VTK::CommonDataModel VTK::CommonExecutionModel VTK::CommonMath VTK::CommonMisc VTK::CommonSystem VTK::CommonTransforms VTK::DICOMParser VTK::FiltersCore VTK::FiltersExtraction VTK::FiltersGeneral VTK::FiltersGeometry VTK::FiltersHybrid VTK::FiltersModeling VTK::FiltersParallel VTK::FiltersSources VTK::FiltersStatistics VTK::FiltersTexture VTK::IOCore VTK::IOGeometry VTK::IOImage VTK::IOLegacy VTK::IOParallel VTK::IOXML VTK::IOXMLParser VTK::ImagingCore VTK::ImagingFourier VTK::ImagingSources VTK::ParallelCore VTK::ParallelDIY VTK::RenderingCore VTK::doubleconversion VTK::expat VTK::jpeg VTK::jsoncpp VTK::lz4 VTK::lzma VTK::metaio VTK::png VTK::pugixml VTK::sys VTK::tiff VTK::zlib diff --git a/src/PostAlgorithm/NastranH5Reader.cpp b/src/PostAlgorithm/NastranH5Reader.cpp deleted file mode 100644 index 0596399..0000000 --- a/src/PostAlgorithm/NastranH5Reader.cpp +++ /dev/null @@ -1,498 +0,0 @@ -#include "NastranH5Reader.h" -#include -#include - -Hdf5IOBase::Hdf5IOBase(std::string fileName) : m_FileName(fileName) -{ - -} - - -bool Hdf5IOBase::exists() const -{ - if (m_FileName.empty()) { - return false; - } - std::ifstream f(m_FileName.c_str()); - return f.good(); -} - -bool Hdf5IOBase::isHdf5File() const -{ - if (m_FileName.empty()) { - return false; - } - return H5::H5File::isHdf5(m_FileName); -} - -int Hdf5IOBase::getFreeSpace() const -{ - if (nullptr != m_Hdf5File) { - return m_Hdf5File->getFreeSpace(); - } - else { - return -1; - } -} - -int Hdf5IOBase::getFileSize() const -{ - if (nullptr != m_Hdf5File) { - return m_Hdf5File->getFileSize(); - } - else { - return -1; - } -} - -int Hdf5IOBase::getNumObjs() const -{ - if (nullptr != m_Hdf5File) { - return m_Hdf5File->getNumObjs(); - } - return 0; -} - -std::string Hdf5IOBase::getobjnameByIdx(int id) const -{ - if (nullptr != m_Hdf5File) { - return m_Hdf5File->getObjnameByIdx(id); - } - return ""; -} - -bool Hdf5IOBase::closeFile() -{ - if (nullptr != m_Hdf5File) { - m_Hdf5File->close(); - delete m_Hdf5File; - m_Hdf5File = nullptr; - } - return true; -} - - -Hdf5Reader::Hdf5Reader(std::string fileName) : Hdf5IOBase(fileName) -{ -} - -std::list Hdf5Reader::getGroupMemberInfo(std::string groupPath) -{ - std::list infos = {}; - bool flag = false; - if (exists() && isHdf5File()) - { - //m_Hdf5File = new H5::H5File(m_FileName, H5F_ACC_RDONLY); - flag = openFile(); - } - if (!flag) - return infos; - H5::Group group = m_Hdf5File->openGroup(groupPath); - hsize_t objes = group.getNumObjs(); - hsize_t i = 0; - while (i < objes) - { - std::string name = group.getObjnameByIdx(i); - std::string type = ""; - if (group.getObjTypeByIdx(i) == H5O_TYPE_DATASET) - type = "Dataset"; - else if (group.getObjTypeByIdx(i) == H5O_TYPE_NAMED_DATATYPE) - type = "Named_Datatype"; - else if (group.getObjTypeByIdx(i) == H5O_TYPE_NTYPES) - type = "Ntypes"; - else if (group.getObjTypeByIdx(i) == H5O_TYPE_UNKNOWN) - type = "Unknown"; - else if (group.getObjTypeByIdx(i) == H5O_TYPE_GROUP) - type = "Group"; - else - type = "Map"; - infos.push_back(new MemberInfo(name, type)); - i++; - } - group.close(); - closeFile(); - //m_Hdf5File = nullptr; - return infos; -} - -std::list Hdf5Reader::getDataSetMemberInfo(std::string groupPath, std::string dataSetName) -{ - std::list infos = {}; - std::string name = ""; - std::string type = ""; - int size = 0; - bool flag = false; - if (exists() && isHdf5File()) - { - //m_Hdf5File = new H5::H5File(m_FileName, H5F_ACC_RDONLY); - flag = openFile(); - } - if (!flag) - return infos; - H5::Group group = m_Hdf5File->openGroup(groupPath); - H5::DataSet dataset = group.openDataSet(dataSetName); - H5::EnumType enumtype = dataset.getEnumType(); - H5::CompType comptype = dataset.getCompType(); - - int num = enumtype.getNmembers(); - hsize_t i = 0; - if (num) - { - for (int i = 0; i < num; i++) - { - name = comptype.getMemberName(i); - H5::DataType m_datatype = comptype.getMemberDataType(i); - H5::CompType m_comptype = comptype.getMemberCompType(i); - H5::ArrayType m_arraytype = comptype.getMemberArrayType(i); - size = m_comptype.getSize() / 8; - - if (m_datatype.getClass() == H5T_INTEGER) - type = "64-bit integer"; - else if (m_datatype.getClass() == H5T_FLOAT) - type = "64-bit floating-point"; - else if (m_datatype.getClass() == H5T_ARRAY) - { - type = "Array ["; - type += std::to_string(size); - if (m_arraytype.detectClass(H5T_FLOAT)) - type = "] 64-bit floating-point"; - if (m_arraytype.detectClass(H5T_INTEGER)) - type += "] 64-bit integer"; - } - else - { - type = "String, length="; - type += std::to_string(size); - } - infos.push_back(new MemberInfo(name, type, size)); - m_datatype.close(); - m_comptype.close(); - } - } - enumtype.close(); - comptype.close(); - dataset.close(); - group.close(); - m_Hdf5File = nullptr; - return infos; -} - -std::string Hdf5Reader::getError() -{ - return m_ErrorMessage; -} - -bool Hdf5Reader::openFile() -{ - if (exists() && isHdf5File()) - { - m_Hdf5File = new H5::H5File(m_FileName, H5F_ACC_RDONLY); - return true; - } - else - { - return false; - } -} - -bool Hdf5Reader::getType(std::string groupPath, const std::string datasetName, H5::DataType &datatype) -{ - if (groupPath.empty() || datasetName.empty()) { - m_ErrorMessage = "组路径和数据集名称不能为空!"; - return false; - } - if (!openFile()) { - m_ErrorMessage = "打开文件失败!"; - return false; - } - H5::Group group = m_Hdf5File->openGroup(groupPath); - H5::DataSet dataSet = group.openDataSet(datasetName); - datatype = dataSet.getDataType(); - dataSet.close(); - group.close(); - closeFile(); - return true; -} - -MemberInfo::MemberInfo(std::string name, std::string type, int arraySize) - : m_Name(name), m_Type(type), m_ArraySize(arraySize) -{ - -} - -void MemberInfo::setName(std::string name) -{ - m_Name = name; -} - -std::string MemberInfo::getName() -{ - return m_Name; -} - -void MemberInfo::setType(std::string type) -{ - m_Type = type; -} - -std::string MemberInfo::getType() -{ - return m_Type; -} - -void MemberInfo::setArraySize(int size) -{ - m_ArraySize = size; -} - -int MemberInfo::getArraySize() -{ - return m_ArraySize; -} - -NastranH5Reader::NastranH5Reader(std::string fileName) : Hdf5Reader(fileName) { - -} - -std::vector NastranH5Reader::getNodes() -{ - std::vector dataVector = {}; - dataVector.clear(); - std::string groupPath = m_NodeGroupPath; - std::string dataSetName = "GRID"; - getData(groupPath, dataSetName, dataVector); - return dataVector; -} - -std::list NastranH5Reader::getElementType() -{ - std::list types = {}; - auto groupInfo = getGroupMemberInfo(m_ElementsGroupPath); - for (auto info : groupInfo) - { - types.push_back(info->getName()); - } - return types; -} - -std::vector NastranH5Reader::getElementCbar() -{ - std::vector data = {}; - if (getElements("CBAR", data)) - { - return data; - } - else - { - return data; - } -} - -std::vector NastranH5Reader::getElementCrod() -{ - std::vector data = {}; - if (getElements("CROD", data)) - { - return data; - } - else - { - return data; - } -} - -std::vector NastranH5Reader::getElementCquad4() -{ - std::vector data = {}; - if (getElements("CQUAD4", data)) - { - return data; - } - else - { - return data; - } -} - -std::vector NastranH5Reader::getElementCquad8() -{ - std::vector data = {}; - if (getElements("CQUAD8", data)) - { - return data; - } - else - { - return data; - } -} - -std::vector NastranH5Reader::getElementCtetra() -{ - std::vector data = {}; - if (getElements("CTETRA", data)) - { - return data; - } - else - { - return data; - } -} -std::vector NastranH5Reader::getElementChexa() -{ - std::vector data = {}; - if (getElements("CHEXA", data)) - { - return data; - } - else - { - return data; - } -} - -std::vector NastranH5Reader::getElementalResultBars() -{ - std::vector data = {}; - if (getElementalResult("BARS", data)) - { - return data; - } - else - { - return data; - } -} - -std::vector NastranH5Reader::getElementalResultRod() -{ - std::vector data = {}; - if (getElementalResult("ROD", data)) - { - return data; - } - else - { - return data; - } -} - -std::vector NastranH5Reader::getElementalResultQuad4() -{ - std::vector data = {}; - if (getElementalResult("QUAD_CN", data)) - { - return data; - } - else - { - return data; - } -} - -std::vector NastranH5Reader::getElementalResultQuad8() -{ - std::vector data = {}; - if (getElementalResult("QUAD8", data)) - { - return data; - } - else - { - return data; - } -} - -std::vector NastranH5Reader::getElementalResultTetra() -{ - std::vector data = {}; - if (getElementalResult("TETRA", data)) - { - return data; - } - else - { - return data; - } -} - -std::vector NastranH5Reader::getElementalResultHexa() -{ - std::vector data = {}; - if (getElementalResult("HEXA", data)) - { - return data; - } - else - { - return data; - } -} - -std::vector NastranH5Reader::getNodalResult(std::string name) -{ - std::vector dataVector = {}; - dataVector.clear(); - std::string dataSetName = name; - std::list infos = getGroupMemberInfo(m_NodalResultGroupPath); - for (auto info : infos) - { - if (info->getName() == name) - { - getData(m_NodalResultGroupPath, dataSetName, dataVector); - return dataVector; - } - - } - m_ErrorMessage = "数据集名不正确或者组内不存在该数据集!"; - return dataVector; -} - -H5::DataType NastranH5Reader::getNodesType() -{ - H5::DataType datatype = H5::DataType(); - std::string datasetName = "GRID"; - bool flag = false; - flag = getType(m_NodeGroupPath, datasetName, datatype); - if (flag) - return datatype; - else - return datatype; -} - -H5::DataType NastranH5Reader::getElementCtetraType() -{ - H5::DataType datatype = H5::DataType(); - std::string datasetName = "CTETRA"; - bool flag = false; - flag = getType(m_ElementsGroupPath, datasetName, datatype); - if (flag) - return datatype; - else - return datatype; -} - -H5::DataType NastranH5Reader::getElementalResultTetraType() -{ - H5::DataType datatype = H5::DataType(); - std::string datasetName = "TETRA"; - bool flag = false; - flag = getType(m_ElementalResultGroupPath, datasetName, datatype); - if (flag) - return datatype; - else - return datatype; -} - -H5::DataType NastranH5Reader::getNodalResultType() -{ - H5::DataType datatype = H5::DataType(); - std::string datasetName = "DISPLACEMENT"; - bool flag = false; - flag = getType(m_NodalResultGroupPath, datasetName, datatype); - if (flag) - return datatype; - else - return datatype; -} diff --git a/src/PostAlgorithm/NastranH5Reader.h b/src/PostAlgorithm/NastranH5Reader.h deleted file mode 100644 index 84fefac..0000000 --- a/src/PostAlgorithm/NastranH5Reader.h +++ /dev/null @@ -1,661 +0,0 @@ -/** - * @file NastranH5Reader.h - * @brief NastranH5Reader - * @author 闫智慧(chanyuantiandao@126.com) - * @version 1.0.0 - * @date 2022-07-18 11:38:28 - */ -#ifndef NastranH5Reader_H -#define NastranH5Reader_H - -#include "H5Cpp.h" -#include -#include - -/** - * @brief 类型定义,对应64-bit integer - * @since 1.0.0 - */ -typedef long long int Type64BitInt; -/** -* @brief 类型定义,对应64-bit floating-point -* @since 1.0.0 -*/ -typedef double Type64BitFloatPoint; -/** -* @brief 类型定义,对应String -* @since 1.0.0 -*/ -typedef char TypeString; - -/** -* @brief 单元数据基类 -* @since 1.0.0 -*/ -class InputElementBase { -public: - Type64BitInt EID; - Type64BitInt PID; -}; -/** -* @brief CROD数据单元类 -* @since 1.0.0 -*/ -class InputElementCrod : public InputElementBase { -public: - Type64BitInt G[2]; - Type64BitInt DOMAIN_ID; -}; -/** -* @brief CBAR单元数据类 -* @since 1.0.0 -*/ -class InputElementCbar : public InputElementBase { -public: - Type64BitInt GA; - Type64BitInt GB; - Type64BitInt FLAG; - Type64BitFloatPoint X1; - Type64BitFloatPoint X2; - Type64BitFloatPoint X3; - Type64BitInt GO; - Type64BitInt PA; - Type64BitInt PB; - Type64BitFloatPoint W1A; - Type64BitFloatPoint W2A; - Type64BitFloatPoint W3A; - Type64BitFloatPoint W1B; - Type64BitFloatPoint W2B; - Type64BitFloatPoint W3B; - Type64BitInt DOMAIN_ID; -}; - -/** -* @brief CQUAD4单元数据类 -* @since 1.0.0 -*/ -class InputElementCquad4 :public InputElementBase { -public: - Type64BitInt G[4]; - Type64BitFloatPoint THETA; - Type64BitFloatPoint ZOFFS; - Type64BitInt TFLAG; - Type64BitFloatPoint T[4]; - Type64BitInt MCID; - Type64BitInt DOMAIN_ID; -}; -/** -* @brief CQUAD8单元数据类 -* @since 1.0.0 -*/ -class InputElementCquad8 :public InputElementBase { -public: - Type64BitInt G[8]; - Type64BitFloatPoint T[4]; - Type64BitFloatPoint THETA; - Type64BitFloatPoint ZOFFS; - Type64BitInt TFLAG; - Type64BitInt MCID; - Type64BitInt DOMAIN_ID; -}; - -/** -* @brief CTRTRA单元数据类 -* @since 1.0.0 -*/ -class InputElementCtetra : public InputElementBase { -public: - Type64BitInt G[10]; - Type64BitInt DOMAIN_ID; -}; -/** -* @brief CHEXA单元数据类 -* @since 1.0.0 -*/ -class InputElementChexa : public InputElementBase { -public: - Type64BitInt G[20]; - Type64BitInt DOMAIN_ID; -}; - -/** -* @brief GRID节点数据类 -* @since 1.0.0 -*/ -class InputNodeGrid { -public: - Type64BitInt ID; - Type64BitInt CP; - Type64BitFloatPoint X[3]; - Type64BitInt CD; - Type64BitInt PS; - Type64BitInt SEID; - Type64BitInt DOMAIN_ID; -}; - -/** -* @brief 应力数据基类【静力分析】 -* @since 1.0.0 -*/ -class ResultElementalStressBase { -public: - Type64BitInt EID; -}; - -/** -* @brief 应用数据类【静力分析】 -* @since 1.0.0 -*/ -class ResultElementalStressBars : public ResultElementalStressBase { -public: - Type64BitFloatPoint SD; - Type64BitFloatPoint XC; - Type64BitFloatPoint XD; - Type64BitFloatPoint XE; - Type64BitFloatPoint XF; - Type64BitFloatPoint AX; - Type64BitFloatPoint MAX; - Type64BitFloatPoint MIN; - Type64BitFloatPoint MS; - Type64BitInt DOMAIN_ID; -}; -/** -* @brief 应用数据类【静力分析】 -* @since 1.0.0 -*/ -class ResultElementalStressRod : public ResultElementalStressBase { -public: - Type64BitFloatPoint A; - Type64BitFloatPoint MSA; - Type64BitFloatPoint T; - Type64BitFloatPoint MST; - Type64BitInt DOMAIN_ID; -}; -/** -* @brief 应用数据类【静力分析】 -* @since 1.0.0 -*/ -class ResultElementalStressQuad : public ResultElementalStressBase { -public: - TypeString TERM[4]; - Type64BitInt GRID[5]; - Type64BitFloatPoint FD1[5]; - Type64BitFloatPoint X1[5]; - Type64BitFloatPoint Y1[5]; - Type64BitFloatPoint TXY1[5]; - Type64BitFloatPoint FD2[5]; - Type64BitFloatPoint X2[5]; - Type64BitFloatPoint Y2[5]; - Type64BitFloatPoint TXY2[5]; - Type64BitInt DOMAIN_ID; -}; -/** -* @brief 应力数据类【静力分析】 -* @since 1.0.0 -*/ -class ResultElementalStressTetra : public ResultElementalStressBase { -public: - Type64BitInt CID; - TypeString CTYPE[4]; - Type64BitInt NODEF; - Type64BitInt GRID[5]; - Type64BitFloatPoint X[5]; - Type64BitFloatPoint Y[5]; - Type64BitFloatPoint Z[5]; - Type64BitFloatPoint TXY[5]; - Type64BitFloatPoint TYZ[5]; - Type64BitFloatPoint TZX[5]; - Type64BitInt DOMAIN_ID; -}; -/** -* @brief 应力数据类【静力分析】 -* @since 1.0.0 -*/ -class ResultElementalStressHexa : public ResultElementalStressBase { -public: - Type64BitInt CID; - TypeString CTYPE[4]; - Type64BitInt NODEF; - Type64BitInt GRID[9]; - Type64BitFloatPoint X[9]; - Type64BitFloatPoint Y[9]; - Type64BitFloatPoint Z[9]; - Type64BitFloatPoint TXY[9]; - Type64BitFloatPoint TYZ[9]; - Type64BitFloatPoint TZX[9]; - Type64BitInt DOMAIN_ID; -}; - - -/** -* @brief 位移数据类【静力分析】 -* @since 1.0.0 -*/ -class ResultNodalDisplacement { -public: - Type64BitInt ID; - Type64BitFloatPoint X; - Type64BitFloatPoint Y; - Type64BitFloatPoint Z; - Type64BitFloatPoint RX; - Type64BitFloatPoint RY; - Type64BitFloatPoint RZ; - Type64BitInt DOMAIN_ID; -}; -/** -* @brief 节点约束类【静力分析】 -* @since 1.0.0 -*/ -class ResultNodalSpc_force { -public: - Type64BitInt ID; - Type64BitFloatPoint X; - Type64BitFloatPoint Y; - Type64BitFloatPoint Z; - Type64BitFloatPoint RX; - Type64BitFloatPoint RY; - Type64BitFloatPoint RZ; - Type64BitInt DOMAIN_ID; -}; -/** -* @brief 单元类型 -* @since 1.0.0 -*/ -enum class ElementType : int -{ - UNDEFINED = 0, ///< 未定义的 - CROD, ///< CROD单元【1D】,连接两个节点,横截面的属性不变 - CTUBE, ///< CTUBE单元【1D】 - CBEND, - CBAR, - CBEAM, - CVISC, - CQUAD4, ///< 四边形壳单元【2D】 - CQUAD8, - CTRIA3, - CTRIA6, - CSHEAR, - CRAC2D, - CTETRA, ///< 【3D】 - CPENTA, - CHEXA, - CTRIAX6, - CTRIAX, - CQUADX, -}; - -class Hdf5IOBase -{ -public: - /** - * @brief 构造函数 - * @param fileName 文件的名称 - * @since 1.0.0 - */ - Hdf5IOBase(std::string fileName); - /** - * @brief 析构造函数 - * @since 1.0.0 - */ - virtual ~Hdf5IOBase() = default; - - /** - * @brief 判断文件名称的合法性 - * @return 合法返回true,不合法返回false - * @since 1.0.0 - */ - bool exists() const; - /** - * @brief 判断文件名是否为空 - * @return 空返回false,非空返回true - * @since 1.0.0 - */ - bool isHdf5File() const; - /** - * @brief 判断剩余空间 - * @return 返回剩余空间 - * @since 1.0.0 - */ - int getFreeSpace() const; - /** - * @brief 读取文件的大小 - * @return 返回文件的大小 - * @since 1.0.0 - */ - int getFileSize() const; - /** - * @brief 获取当前目录下的对象数 - * @return 返回对象数 - * @since 1.0.0 - */ - int getNumObjs() const; - /** - * @brief 通过id获取对象的名字 - * @param id 对象的相对位置 - * @return 返回id相应对象的名字 - * @since 1.0.0 - */ - std::string getobjnameByIdx(int id) const; - /** - * @brief 打开文件 - * @return 打开成功返回true,打开失败返回false - * @since 1.0.0 - */ - virtual bool openFile() = 0; - /** - * @brief 关闭文件 - * @return 关闭成功返回true,关闭失败返回false - * @since 1.0.0 - */ - virtual bool closeFile(); - - -protected: - /** - * @brief 文件名称(含路径) - * @since 1.0.0 - */ - std::string m_FileName = ""; - /** - * @brief 指向文件地址的指针 - * @since 1.0.0 - */ - H5::H5File* m_Hdf5File = nullptr; -}; - -/** - * @brief MemberInfo类,获取组或者数据集中成员的名字、类型、大小信息 - * @since 1.0.0 - */ -class MemberInfo -{ -public: - MemberInfo(std::string name, std::string type, int arraySize = 0); - ~MemberInfo() = default; - - void setName(std::string name); - std::string getName(); - void setType(std::string type); - std::string getType(); - void setArraySize(int size); - int getArraySize(); -private: - std::string m_Name = ""; - std::string m_Type = ""; - int m_ArraySize = 0; -}; - -/** - * @brief Hdf5Reader类 - * @since 1.0.0 - */ -class Hdf5Reader : public Hdf5IOBase -{ -public: - /** - * @brief 构造函数 - * @param fileName - * @since 1.0.0 - */ - Hdf5Reader(std::string fileName); - /** - * @brief 析构函数 - * @since 1.0.0 - */ - virtual ~Hdf5Reader() override = default; - - /** - * @brief 读取表格数据 - * @param groupPath 组的路径 - * @param dataSetName 数据集(表)的名称 - * @param dataVector 存储返回的数据 - * @return 成功获取数据时返回true,否则返回false - * @since 1.0.0 - */ - template - bool getData(std::string groupPath, std::string dataSetName, std::vector& dataVector) { - if (groupPath.empty() || dataSetName.empty()) { - m_ErrorMessage = "组路径和数据集名称不能为空!"; - return false; - } - if (!openFile()) { - m_ErrorMessage = "打开文件失败!"; - return false; - } - H5::Group group = m_Hdf5File->openGroup(groupPath); - H5::DataSet dataSet = group.openDataSet(dataSetName); - H5::DataSpace dataSpace = dataSet.getSpace(); - - hsize_t dims[1]; - int num = dataSpace.getSimpleExtentDims(dims); - H5::DataType dataType = dataSet.getDataType(); - dataVector.clear(); - dataVector.resize(dims[0]); - dataSet.read(dataVector.data(), dataType); - dataSet.close(); - group.close(); - closeFile(); - return true; - } - /** - * @brief 返回组下的成员信息 - * @param groupPath 组的路径 - * @return 含有组下成员信息的list地址 - * @since 1.0.0 - */ - std::list getGroupMemberInfo(std::string groupPath); - /** - * @brief 返回数据集下的数据信息 - * @param groupPath 组的路径 - * @param dataSetName 数据集的名称 - * @return 返回数据集下数据信息的list地址 - * @since 1.0.0 - */ - std::list getDataSetMemberInfo(std::string groupPath, std::string dataSetName); - /** - * @brief 当调用函数失败后返回错误信息 - * @return 返回错误信息提示 - * @since 1.0.0 - */ - std::string getError(); - /** - * @brief 打开文件 - * @return 打开成功返回true,打开失败返回false - * @since 1.0.0 - */ - bool openFile() override; - - /** - * @brief 6.15练习把得到reader提取到的数据的datatype - * @param groupPath 组的路径 - * @param datasetName 数据集的名字 - * @param datatype 返回的数据类型 - * @return - * @since 1.0.0 - */ - bool getType(std::string groupPath,const std::string datasetName, H5::DataType &datatype); - - -private: - /** - * @brief 保存错误信息 - * @since 1.0.0 - */ - std::string m_ErrorMessage = ""; -}; - -class NastranH5Reader : public Hdf5Reader -{ -public: - /** - * @brief 构造函数 - * @param fileName - * @since 1.0.0 - */ - NastranH5Reader(std::string fileName); - /** - * @brief 析构函数 - * @since 1.0.0 - */ - virtual ~NastranH5Reader() override = default; - - /** - * @brief 节点函数 - * @return vector - * @since 1.0.0 - */ - std::vector getNodes(); - /** - * @brief /INPUT/ELEMENTAL/下数据集的模板函数 - * @param name DatasetName - * @param dataVector 存储容器 - * @return 读取成功返回true,读取失败返回false - * @since 1.0.0 - */ - template - bool getElements(std::string name, std::vector& dataVector) - { - std::list infos = getGroupMemberInfo(m_ElementsGroupPath); - bool isValid = false; - for (auto info : infos) { - if (info->getName() == name) { - isValid = true; - } - } - if (!isValid) { - m_ErrorMessage = "数据集名不正确或者组内不存在该数据集!"; - return false; - } - getData(m_ElementsGroupPath, name, dataVector); - return true; - } - std::list getElementType(); - /** - * @brief 读取ELEMENT中一维单元CBAR函数 - * @return 返回数据集 - * @since 1.0.0 - */ - std::vector getElementCbar(); - /** - * @brief 读取ELEMENT中一维单元CROD函数 - * @return 返回数据集 - * @since 1.0.0 - */ - std::vector getElementCrod(); - /** - * @brief 读取ELEMENT中二维单元CQUAD4 - * @return 返回数据集 - * @since 1.0.0 - */ - std::vector getElementCquad4(); - /** - * @brief 读取ELEMENT中二维单元CQUAD8 - * @return 返回数据集 - * @since 1.0.0 - */ - std::vector getElementCquad8(); - /** - * @brief 读取ELEMENT中三维单元CTETRA - * @return 返回数据集 - * @since 1.0.0 - */ - std::vector getElementCtetra(); - /** - * @brief 读取ELEMENT中三维单元CHEXA - * @return 返回数据集 - * @since 1.0.0 - */ - std::vector getElementChexa(); - - /** - * @brief /RESULT/ELEMENTAL/STRESS下数据集的模板函数 - * @param name DatasetName - * @param dataVector 存储容器 - * @return 读取成功返回true,读取失败返回false - * @since 1.0.0 - */ - template - bool getElementalResult(std::string name, std::vector& dataVector) - { - std::list infos = getGroupMemberInfo(m_ElementalResultGroupPath); - bool isValid = false; - for (auto info : infos) { - if (info->getName() == name) { - isValid = true; - } - } - if (!isValid) { - m_ErrorMessage = "数据集名不正确或者组内不存在该数据集!"; - return false; - } - getData(m_ElementalResultGroupPath, name, dataVector); - return true; - } - /** - * @brief 一维单元CBAR压力结果函数 - * @return 返回数据集 - * @since 1.0.0 - */ - std::vector getElementalResultBars(); - /** - * @brief 一维单元CROD压力结果函数 - * @return 返回数据集 - * @since 1.0.0 - */ - std::vector getElementalResultRod(); - /** - * @brief 二维单元CQUAD4压力结果函数 - * @return 返回数据集 - * @since 1.0.0 - */ - std::vector getElementalResultQuad4(); - /** - * @brief 二维单元CQUAD8压力结果函数 - * @return 返回数据集 - * @since 1.0.0 - */ - std::vector getElementalResultQuad8(); - /** - * @brief 三维单元CTETRA压力结果函数 - * @return 返回数据集 - * @since 1.0.0 - */ - std::vector getElementalResultTetra(); - /** - * @brief 三维单元CHEXA压力结果函数 - * @return 返回数据集 - * @since 1.0.0 - */ - std::vector getElementalResultHexa(); - - /** - * @brief 位移结果函数 - * @param name DatasetName - * @return 返回数据集 - * @since 1.0.0 - */ - std::vector getNodalResult(std::string name = ""); - - /** - * @brief 节点类型函数 - * @return 返回节点数据集的数据类型 - * @since 1.0.0 - */ - H5::DataType getNodesType(); - H5::DataType getElementCtetraType(); - H5::DataType getElementalResultTetraType(); - H5::DataType getNodalResultType(); - -private: - /** - * @brief 保存错误信息 - * @since 1.0.0 - */ - std::string m_ErrorMessage = ""; - const std::string m_NodeGroupPath = "/NASTRAN/INPUT/NODE/"; - const std::string m_ElementsGroupPath = "/NASTRAN/INPUT/ELEMENT/"; - const std::string m_NodalResultGroupPath = "/NASTRAN/RESULT/NODAL/"; - const std::string m_ElementalResultGroupPath = "/NASTRAN/RESULT/ELEMENTAL/STRESS/"; -}; - -#endif // NastranH5Reader_H diff --git a/src/PostAlgorithm/NastranH5ReaderAlgorithm.cpp b/src/PostAlgorithm/NastranH5ReaderAlgorithm.cpp deleted file mode 100644 index b2f20cd..0000000 --- a/src/PostAlgorithm/NastranH5ReaderAlgorithm.cpp +++ /dev/null @@ -1,354 +0,0 @@ -#include "NastranH5ReaderAlgorithm.h" -#include -#include -#include -#include -#include "NastranH5Reader.h" -#include -#include -#include -#include - -NastranH5ReaderAlgorithm *NastranH5ReaderAlgorithm::New() -{ - auto reader = new NastranH5ReaderAlgorithm; - reader->InitializeObjectBase(); - return reader; -} - -void NastranH5ReaderAlgorithm::SetFileName(std::string name) -{ - m_FileName = name; -} - -void NastranH5ReaderAlgorithm::PrintSelf(std::ostream &os, vtkIndent indent) -{ - this->Superclass::PrintSelf(os, indent); - os << indent << "FileName:" << (this->m_FileName.empty() ? "(none)" : this->m_FileName) << "\n"; -} -int NastranH5ReaderAlgorithm::FillOutputPortInformation(int port, vtkInformation *info) -{ - Q_UNUSED(port) - info->Set(vtkUnstructuredGrid::DATA_TYPE_NAME(), "vtkUnstructuredGrid"); - return 1; -} - -NastranH5ReaderAlgorithm::NastranH5ReaderAlgorithm() -{ - this->SetNumberOfInputPorts(0); - this->SetNumberOfOutputPorts(1); -} - -NastranH5ReaderAlgorithm::~NastranH5ReaderAlgorithm() -{ -} - -int NastranH5ReaderAlgorithm::ProcessRequest(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector) -{ - if (request->Has(vtkDemandDrivenPipeline::REQUEST_INFORMATION())) - { - return this->RequestInformation(request, inputVector, outputVector); - } - if (request->Has(vtkStreamingDemandDrivenPipeline::REQUEST_UPDATE_EXTENT())) - { - return this->RequestUpdateExtent(request, inputVector, outputVector); - } - if (request->Has(vtkDemandDrivenPipeline::REQUEST_DATA())) - { - return this->RequestData(request, inputVector, outputVector); - } - return this->Superclass::ProcessRequest(request, inputVector, outputVector); -} - -int NastranH5ReaderAlgorithm::RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *outputVector) -{ - if (this->m_FileName.empty()) - { - vtkErrorMacro("A FileName must be specified."); - return 0; - } - - //vtkUnstructuredGrid* grid = vtkUnstructuredGrid::GetData(outputVector); - vtkNew grid; - - // std::map<旧ID, 新ID> - std::map nodeIndexmaps = {}; - std::map eleIndexmaps = {}; - // 节点遍历转换 - auto fileReader = new NastranH5Reader(m_FileName); - auto data = fileReader->getNodes(); - vtkNew points; - for (InputNodeGrid node : data) - { - double ids[3] = { node.X[0] , node.X[1] , node.X[2] }; - nodeIndexmaps[node.ID] = points->InsertNextPoint(ids); - } - grid->SetPoints(points); - - // 节点平移形变 - auto displacementTranslational = vtkSmartPointer::New(); - displacementTranslational->SetNumberOfComponents(3); - displacementTranslational->SetName("Displacement Translational"); - displacementTranslational->SetComponentName(0, "X"); - displacementTranslational->SetComponentName(1, "Y"); - displacementTranslational->SetComponentName(2, "Z"); - - // 节点旋转形变 - auto displacementRotational = vtkSmartPointer::New(); - displacementRotational->SetNumberOfComponents(3); - displacementRotational->SetName("Displacement Rotational"); - displacementRotational->SetComponentName(0, "RX"); - displacementRotational->SetComponentName(1, "RY"); - displacementRotational->SetComponentName(2, "RZ"); - - auto displacements = fileReader->getNodalResult("DISPLACEMENT"); - for (auto dis : displacements) - { - displacementTranslational->InsertTuple3(nodeIndexmaps[dis.ID], dis.X, dis.Y, dis.Z); - displacementRotational->InsertTuple3(nodeIndexmaps[dis.ID], dis.RX, dis.RY, dis.RZ); - } - - grid->GetPointData()->AddArray(displacementRotational); - grid->GetPointData()->AddArray(displacementTranslational); - - // 单元遍历转换 - auto eleTypes = fileReader->getElementType(); - eleIndexmaps.clear(); - for (auto type : eleTypes) - { - if (type == "CROD") { - auto elements = fileReader->getElementCrod(); - vtkIdType ids[2] = { 0 }; - for (InputElementCrod ele : elements) - { - for (int i = 0; i < 2; i++) - { - ids[i] = nodeIndexmaps[ele.G[i]]; - } - eleIndexmaps[ele.EID] = grid->InsertNextCell(VTK_LINE, 2, ids); - } - // 单元总应力 - auto totalStress = vtkSmartPointer::New(); - totalStress->SetNumberOfComponents(1); - totalStress->SetName("Total Stress"); - totalStress->SetComponentName(0, "T"); - auto axialStress = vtkSmartPointer::New(); - axialStress->SetNumberOfComponents(1); - axialStress->SetName("Axial Stress"); - axialStress->SetComponentName(0, "A"); - - - auto stresses = fileReader->getElementalResultRod(); - for (auto stress : stresses) - { - totalStress->InsertTuple1(eleIndexmaps[stress.EID], stress.T); - axialStress->InsertTuple1(eleIndexmaps[stress.EID], stress.A); - } - - grid->GetCellData()->AddArray(totalStress); - grid->GetCellData()->AddArray(axialStress); - } - else if (type == "CBAR") { - auto elements = fileReader->getElementCbar(); - for (InputElementCbar ele : elements) - { - Type64BitInt ids[2] = { nodeIndexmaps[ele.GA], nodeIndexmaps[ele.GB] }; - eleIndexmaps[ele.EID] = grid->InsertNextCell(VTK_LINE, 2, ids); - } - - auto cStress = vtkSmartPointer::New(); - cStress->SetNumberOfComponents(1); - cStress->SetName("Stress At Point C"); - cStress->SetComponentName(0, "XC"); - - auto dStress = vtkSmartPointer::New(); - dStress->SetNumberOfComponents(1); - dStress->SetName("Stress At Point D"); - dStress->SetComponentName(0, "XD"); - - auto eStress = vtkSmartPointer::New(); - eStress->SetNumberOfComponents(1); - eStress->SetName("Stress At Point E"); - eStress->SetComponentName(0, "XE"); - - auto fStress = vtkSmartPointer::New(); - fStress->SetNumberOfComponents(1); - fStress->SetName("Stress At Point F"); - fStress->SetComponentName(0, "XF"); - - auto stresses = fileReader->getElementalResultBars(); - for (auto stress : stresses) - { - cStress->InsertTuple1(eleIndexmaps[stress.EID], stress.XC); - dStress->InsertTuple1(eleIndexmaps[stress.EID], stress.XD); - eStress->InsertTuple1(eleIndexmaps[stress.EID], stress.XE); - fStress->InsertTuple1(eleIndexmaps[stress.EID], stress.XF); - } - - grid->GetCellData()->AddArray(cStress); - grid->GetCellData()->AddArray(dStress); - grid->GetCellData()->AddArray(eStress); - grid->GetCellData()->AddArray(fStress); - } - else if (type == "CQUAD4") { - auto elements = fileReader->getElementCquad4(); - vtkIdType ids[4] = { 0 }; - for (InputElementCquad4 ele : elements) - { - for (int i = 0; i < 4; i++) - { - ids[i] = nodeIndexmaps[ele.G[i]]; - } - eleIndexmaps[ele.EID] = grid->InsertNextCell(VTK_QUAD, 4, ids); - } - - // 单元应力 - auto normalStress = vtkSmartPointer::New(); - normalStress->SetNumberOfComponents(2); - normalStress->SetName("Normal Stress"); - normalStress->SetComponentName(0, "X"); - normalStress->SetComponentName(1, "Y"); - - // 单元切应力 - auto shearStress = vtkSmartPointer::New(); - shearStress->SetNumberOfComponents(1); - shearStress->SetName("Shear Stress"); - shearStress->SetComponentName(0, "TXY"); - - auto stresses = fileReader->getElementalResultQuad4(); - for (auto stress : stresses) - { - normalStress->InsertTuple2(eleIndexmaps[stress.EID], stress.X1[0], stress.Y1[0]); - shearStress->InsertTuple1(eleIndexmaps[stress.EID], stress.TXY1[0]); - } - - grid->GetCellData()->AddArray(normalStress); - grid->GetCellData()->AddArray(shearStress); - } - else if (type == "CQUAD8") { - auto elements = fileReader->getElementCquad8(); - vtkIdType ids[8] = { 0 }; - for (InputElementCquad8 ele : elements) - { - for (int i = 0; i < 8; i++) - { - ids[i] = nodeIndexmaps[ele.G[i]]; - } - eleIndexmaps[ele.EID] = grid->InsertNextCell(VTK_QUADRATIC_QUAD, 8, ids); - } - // 单元应力 - auto normalStress = vtkSmartPointer::New(); - normalStress->SetNumberOfComponents(2); - normalStress->SetName("Normal Stress"); - normalStress->SetComponentName(0, "X"); - normalStress->SetComponentName(1, "Y"); - - // 单元切应力 - auto shearStress = vtkSmartPointer::New(); - shearStress->SetNumberOfComponents(1); - shearStress->SetName("Shear Stress"); - shearStress->SetComponentName(0, "TXY"); - - auto stresses = fileReader->getElementalResultQuad8(); - for (auto stress : stresses) - { - normalStress->InsertTuple2(eleIndexmaps[stress.EID], stress.X1[0], stress.Y1[0]); - shearStress->InsertTuple1(eleIndexmaps[stress.EID], stress.TXY1[0]); - } - - grid->GetCellData()->AddArray(normalStress); - grid->GetCellData()->AddArray(shearStress); - } - else if (type == "CHEXA") { - auto elements = fileReader->getElementChexa(); - vtkIdType ids[8] = { 0 }; - for (InputElementChexa ele : elements) - { - for (int i = 0; i < 8; i++) - { - ids[i] = nodeIndexmaps[ele.G[i]]; - } - eleIndexmaps[ele.EID] = grid->InsertNextCell(VTK_HEXAHEDRON, 8, ids); - } - // 单元应力 - auto normalStress = vtkSmartPointer::New(); - normalStress->SetNumberOfComponents(3); - normalStress->SetName("Normal Stress"); - normalStress->SetComponentName(0, "X"); - normalStress->SetComponentName(1, "Y"); - normalStress->SetComponentName(2, "Z"); - - // 单元切应力 - auto shearStress = vtkSmartPointer::New(); - shearStress->SetNumberOfComponents(3); - shearStress->SetName("Shear Stress"); - shearStress->SetComponentName(0, "TXY"); - shearStress->SetComponentName(1, "TYZ"); - shearStress->SetComponentName(2, "TZX"); - - auto stresses = fileReader->getElementalResultHexa(); - for (auto stress : stresses) - { - normalStress->InsertTuple3(eleIndexmaps[stress.EID], stress.X[0], stress.Y[0], stress.Z[0]); - shearStress->InsertTuple3(eleIndexmaps[stress.EID], stress.TXY[0], stress.TYZ[0], stress.TZX[0]); - } - - grid->GetCellData()->AddArray(normalStress); - grid->GetCellData()->AddArray(shearStress); - } - else if (type == "CTETRA") { - auto elements = fileReader->getElementCtetra(); - vtkIdType ids[10] = { 0 }; - for (InputElementCtetra ele : elements) - { - for (int i = 0; i < 10; i++) - { - ids[i] = nodeIndexmaps[ele.G[i]]; - } - eleIndexmaps[ele.EID] = grid->InsertNextCell(VTK_QUADRATIC_TETRA, 10, ids); - } - // 单元应力 - auto normalStress = vtkSmartPointer::New(); - normalStress->SetNumberOfComponents(3); - normalStress->SetName("Normal Stress"); - normalStress->SetComponentName(0, "X"); - normalStress->SetComponentName(1, "Y"); - normalStress->SetComponentName(2, "Z"); - - // 单元切应力 - auto shearStress = vtkSmartPointer::New(); - shearStress->SetNumberOfComponents(3); - shearStress->SetName("Shear Stress"); - shearStress->SetComponentName(0, "TXY"); - shearStress->SetComponentName(1, "TYZ"); - shearStress->SetComponentName(2, "TZX"); - - auto stresses = fileReader->getElementalResultTetra(); - for (auto stress : stresses) - { - normalStress->InsertTuple3(eleIndexmaps[stress.EID], stress.X[0], stress.Y[0], stress.Z[0]); - shearStress->InsertTuple3(eleIndexmaps[stress.EID], stress.TXY[0], stress.TYZ[0], stress.TZX[0]); - } - - grid->GetCellData()->AddArray(normalStress); - grid->GetCellData()->AddArray(shearStress); - } - else { - vtkErrorMacro("Unknown Element Type: " + type); - return 0; - } - } - - vtkUnstructuredGrid* uGrid = vtkUnstructuredGrid::GetData(outputVector); - uGrid->CopyStructure(grid); - uGrid->GetPointData()->PassData(grid->GetPointData()); - uGrid->GetCellData()->PassData(grid->GetCellData()); - - return 1; -} - -void NastranH5ReaderAlgorithm::operator=(const NastranH5ReaderAlgorithm &other) -{ - this->m_FileName = other.m_FileName; -} - diff --git a/src/PostAlgorithm/NastranH5ReaderAlgorithm.h b/src/PostAlgorithm/NastranH5ReaderAlgorithm.h deleted file mode 100644 index d574bae..0000000 --- a/src/PostAlgorithm/NastranH5ReaderAlgorithm.h +++ /dev/null @@ -1,54 +0,0 @@ -/** - * @file NastranH5ReaderAlgorithm.h - * @brief NastranH5ReaderAlgorithm - * @author 闫智慧(chanyuantiandao@126.com) - * @version 1.0.0 - * @date 2022-07-18 08:54:53 - */ -#ifndef NastranH5ReaderAlgorithm_H -#define NastranH5ReaderAlgorithm_H - -#include "PostAlgorithmAPI.h" -#include -#include -#include - - /** - * @brief NastranH5ReaderAlgorithm类 - * @since 1.0.0 - */ -class POSTALGORITHMAPI NastranH5ReaderAlgorithm : public vtkUnstructuredGridAlgorithm -{ -public: - static NastranH5ReaderAlgorithm* New(); - vtkTypeMacro(NastranH5ReaderAlgorithm, vtkUnstructuredGridAlgorithm) - void SetFileName(std::string name); - /** - * @brief 打印信息 - */ - void PrintSelf(ostream& os, vtkIndent indent) override; - /** - * @brief 设置输出端口信息 - */ - int FillOutputPortInformation(int port, vtkInformation* info) override; - -protected: - NastranH5ReaderAlgorithm(); - ~NastranH5ReaderAlgorithm(); - /** - * @brief 进程实现---数据获取函数调用入口 - */ - int ProcessRequest(vtkInformation* request, vtkInformationVector** inputVector, vtkInformationVector* outputVector); - /** - * @brief 数据获取---读取实现函数 - */ - int RequestData(vtkInformation*, vtkInformationVector**, vtkInformationVector*); -private: - NastranH5ReaderAlgorithm(const NastranH5ReaderAlgorithm&); - void operator=(const NastranH5ReaderAlgorithm&); - -private: - std::string m_FileName = ""; -}; - -#endif // NastranH5ReaderAlgorithm_H diff --git a/src/PostRenderData/RenderDataImportSteady.cpp b/src/PostRenderData/RenderDataImportSteady.cpp index 970b2d8..b01c34a 100644 --- a/src/PostRenderData/RenderDataImportSteady.cpp +++ b/src/PostRenderData/RenderDataImportSteady.cpp @@ -2,7 +2,7 @@ #include "PostAlgorithm/CGNSReaderAlgorithm.h" #include "PostAlgorithm/Plot3DReaderAlgorithm.h" #include "PostAlgorithm/TecSzpltReaderAlgorithm.h" -#include "PostAlgorithm/NastranH5ReaderAlgorithm.h" +//#include "PostAlgorithm/NastranH5ReaderAlgorithm.h" #include "RenderProperty.h" #include #include diff --git a/src/settings/busAPI.cpp b/src/Settings/BusAPI.cpp similarity index 100% rename from src/settings/busAPI.cpp rename to src/Settings/BusAPI.cpp diff --git a/src/settings/busAPI.h b/src/Settings/BusAPI.h similarity index 100% rename from src/settings/busAPI.h rename to src/Settings/BusAPI.h diff --git a/src/settings/CMakeLists.txt b/src/Settings/CMakeLists.txt similarity index 100% rename from src/settings/CMakeLists.txt rename to src/Settings/CMakeLists.txt diff --git a/src/settings/ColorCombobox.cpp b/src/Settings/ColorCombobox.cpp similarity index 100% rename from src/settings/ColorCombobox.cpp rename to src/Settings/ColorCombobox.cpp diff --git a/src/settings/ColorCombobox.h b/src/Settings/ColorCombobox.h similarity index 100% rename from src/settings/ColorCombobox.h rename to src/Settings/ColorCombobox.h diff --git a/src/settings/DialogGraphOption.cpp b/src/Settings/DialogGraphOption.cpp similarity index 100% rename from src/settings/DialogGraphOption.cpp rename to src/Settings/DialogGraphOption.cpp diff --git a/src/settings/DialogGraphOption.h b/src/Settings/DialogGraphOption.h similarity index 100% rename from src/settings/DialogGraphOption.h rename to src/Settings/DialogGraphOption.h diff --git a/src/settings/DialogGraphOption.ui b/src/Settings/DialogGraphOption.ui similarity index 100% rename from src/settings/DialogGraphOption.ui rename to src/Settings/DialogGraphOption.ui diff --git a/src/settings/DialogWorkingDir.cpp b/src/Settings/DialogWorkingDir.cpp similarity index 100% rename from src/settings/DialogWorkingDir.cpp rename to src/Settings/DialogWorkingDir.cpp diff --git a/src/settings/DialogWorkingDir.h b/src/Settings/DialogWorkingDir.h similarity index 100% rename from src/settings/DialogWorkingDir.h rename to src/Settings/DialogWorkingDir.h diff --git a/src/settings/DialogWorkingDir.ui b/src/Settings/DialogWorkingDir.ui similarity index 100% rename from src/settings/DialogWorkingDir.ui rename to src/Settings/DialogWorkingDir.ui diff --git a/src/settings/ecolorcombobox.cpp b/src/Settings/Ecolorcombobox.cpp similarity index 85% rename from src/settings/ecolorcombobox.cpp rename to src/Settings/Ecolorcombobox.cpp index d3158b8..323813e 100644 --- a/src/settings/ecolorcombobox.cpp +++ b/src/Settings/Ecolorcombobox.cpp @@ -23,12 +23,14 @@ // -*- Mode: c++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- //--------------------------------------------------------------------------- -#include -#include -#include -#include "ecolorcombobox.h" +#include "Ecolorcombobox.h" -EColorComboBox::EColorComboBox(QWidget *parent) : QComboBox(parent) +#include +#include +#include + +EColorComboBox::EColorComboBox(QWidget* parent) + : QComboBox(parent) { setEditable(false); _colorDialogEnabled = false; @@ -38,29 +40,29 @@ EColorComboBox::EColorComboBox(QWidget *parent) : QComboBox(parent) void EColorComboBox::enableColorDialog(bool enabled) { - if (_colorDialogEnabled == enabled) + if(_colorDialogEnabled == enabled) return; - if (enabled) + if(enabled) addItem(tr("More ...")); else removeItem(count() - 1); _colorDialogEnabled = enabled; } -bool EColorComboBox::hasColor(const QColor &c) +bool EColorComboBox::hasColor(const QColor& c) { int num = count(); - if (_colorDialogEnabled) + if(_colorDialogEnabled) num--; - for (int i = 0; i < num; i++) - if (color(i) == c) + for(int i = 0; i < num; i++) + if(color(i) == c) return true; return false; } -void EColorComboBox::appendColor(const QColor &c, const QString &n) +void EColorComboBox::appendColor(const QColor& c, const QString& n) { - if (!c.isValid() || hasColor(c)) + if(!c.isValid() || hasColor(c)) return; // 准备位图 QPixmap pix(16, 16); @@ -70,9 +72,9 @@ void EColorComboBox::appendColor(const QColor &c, const QString &n) painter.setBrush(QBrush(c)); painter.drawRect(1, 1, 13, 13); // 添加到列表末尾 - int i = count(); + int i = count(); QString tn = n.isEmpty() ? c.name().toUpper() : n; - if (!_colorDialogEnabled) + if(!_colorDialogEnabled) addItem(tn, QVariant(c.name())); else insertItem(--i, tn, QVariant(c.name())); @@ -105,7 +107,7 @@ void EColorComboBox::appendOtherColor() // setCurrentIndex(i); } // Added by jingzhe tao. 2013/07/25 -void EColorComboBox::updateOtherColor(const QColor &color) +void EColorComboBox::updateOtherColor(const QColor& color) { QPixmap pix(16, 16); pix.fill(Qt::transparent); @@ -120,16 +122,15 @@ void EColorComboBox::updateOtherColor(const QColor &color) setItemIcon(i, QIcon(pix)); setCurrentIndex(i); } -void EColorComboBox::insertColor(const QColor &c, const QString &n, int i) +void EColorComboBox::insertColor(const QColor& c, const QString& n, int i) { - if (!c.isValid() || hasColor(c)) + if(!c.isValid() || hasColor(c)) return; int num = count(); - if (_colorDialogEnabled) + if(_colorDialogEnabled) num--; - if (i >= 0 && i < num) - { - QPixmap pix(18, 18); + if(i >= 0 && i < num) { + QPixmap pix(18, 18); QPainter painter(&pix); painter.setPen(Qt::gray); painter.setBrush(QBrush(c)); @@ -138,8 +139,7 @@ void EColorComboBox::insertColor(const QColor &c, const QString &n, int i) insertItem(i, tn, QVariant(c.name())); setItemIcon(i, QIcon(pix)); setCurrentIndex(i); - } - else + } else appendColor(c, n); } @@ -149,21 +149,18 @@ QColor EColorComboBox::currentColor() const return color(index); } -void EColorComboBox::setCurrentColor(const QColor &c) +void EColorComboBox::setCurrentColor(const QColor& c) { bool existed = false; - for (int i = 0; i < (int)count(); i++) - { - if (color(i) == c) - { + for(int i = 0; i < (int)count(); i++) { + if(color(i) == c) { setCurrentIndex(i); _lastActivated = c; - existed = true; + existed = true; break; } } - if (!existed) - { + if(!existed) { _lastActivated = c; updateOtherColor(c); } @@ -171,9 +168,9 @@ void EColorComboBox::setCurrentColor(const QColor &c) QColor EColorComboBox::color(int index) const { - if (_colorDialogEnabled && index >= count() - 1) + if(_colorDialogEnabled && index >= count() - 1) return QColor(); - else if (index < 0) + else if(index < 0) return QColor(); else return QColor(itemData(index).toString()); @@ -202,29 +199,24 @@ void EColorComboBox::emitActivatedColor(int index) _lastActivated=QColor(itemData(index).toString()); emit activated(_lastActivated); }*/ - if (index == count() - 1) - { + if(index == count() - 1) { QColor color = QColorDialog::getColor(_lastActivated, this, tr("Custom Color")); - if (color.isValid()) - { + if(color.isValid()) { this->updateOtherColor(color); _lastActivated = QColor(itemData(index).toString()); - } - else - { + } else { setCurrentColor(_lastActivated); } /*if (color != _lastActivated) this->updateOtherColor(color);*/ - } - else + } else _lastActivated = QColor(itemData(index).toString()); emit activated(_lastActivated); } void EColorComboBox::emitHighlightedColor(int index) { - if (!_colorDialogEnabled || index != count() - 1) + if(!_colorDialogEnabled || index != count() - 1) emit highlighted(color(index)); } @@ -264,7 +256,7 @@ void EColorComboBox::appendBackgroundColors() void EColorComboBox::clearAllColors() { clear(); - if (_colorDialogEnabled) + if(_colorDialogEnabled) addItem(tr("More ...")); } diff --git a/src/settings/ecolorcombobox.h b/src/Settings/Ecolorcombobox.h similarity index 100% rename from src/settings/ecolorcombobox.h rename to src/Settings/Ecolorcombobox.h diff --git a/src/settings/GraphOption.cpp b/src/Settings/GraphOption.cpp similarity index 100% rename from src/settings/GraphOption.cpp rename to src/Settings/GraphOption.cpp diff --git a/src/settings/GraphOption.h b/src/Settings/GraphOption.h similarity index 100% rename from src/settings/GraphOption.h rename to src/Settings/GraphOption.h diff --git a/src/settings/mainSetting.cpp b/src/Settings/MainSetting.cpp similarity index 100% rename from src/settings/mainSetting.cpp rename to src/Settings/MainSetting.cpp diff --git a/src/settings/mainSetting.h b/src/Settings/MainSetting.h similarity index 100% rename from src/settings/mainSetting.h rename to src/Settings/MainSetting.h diff --git a/src/settings/MessageSetting.cpp b/src/Settings/MessageSetting.cpp similarity index 100% rename from src/settings/MessageSetting.cpp rename to src/Settings/MessageSetting.cpp diff --git a/src/settings/MessageSetting.h b/src/Settings/MessageSetting.h similarity index 100% rename from src/settings/MessageSetting.h rename to src/Settings/MessageSetting.h diff --git a/src/settings/settingAPI.h b/src/Settings/SettingAPI.h similarity index 100% rename from src/settings/settingAPI.h rename to src/Settings/SettingAPI.h diff --git a/src/geometry/geometrySet.cpp b/src/geometry/geometrySet.cpp deleted file mode 100644 index 173e70e..0000000 --- a/src/geometry/geometrySet.cpp +++ /dev/null @@ -1,520 +0,0 @@ -/** - * @file geometrySet.cpp - * @brief 几何形状表示类源文件 - * @author FastCAE研发小组(fastcae@diso.cn) - * @version 2.5.0 - * @date 2022-03-24 11:03 - * @copyright Copyright (c) Since 2020 青岛数智船海科技有限公司 All rights reserved. - * - * ============================================================================ - * Program: FastCAE - * - * Copyright (c) Since 2020 青岛数智船海科技有限公司 All rights reserved. - * See License or http://www.fastcae.com/ for details. - * - * BSD 3-Clause License - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. - * ================================================================================== - */ -#include "geometrySet.h" -#include "geometryModelParaBase.h" -#include "geometry/geometryModelParaBase.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace Geometry -{ -int GeometrySet::idOffset = 0; -TopoDS_Shape* GeometrySet::tempShape = new TopoDS_Shape; - -int GeometrySet::getMaxID() -{ - return idOffset; -} -GeometrySet::GeometrySet(GeometryType type, bool need) -{ - _type = type; - if (need) - { - idOffset++; - setID(idOffset); - } - appendProperty(QString("Visible"), _visible); -} -GeometrySet::~GeometrySet() -{ - if (_shape != nullptr) delete _shape; - - if (_parameter != nullptr) delete _parameter; -} -void GeometrySet::dataToStream(QDataStream* s) -{ - *s << _id << _name<<_visible; -} -// void GeometrySet::setFilePath(const QString& filepath) -// { -// _filePath = filepath; -// appendProperty(QString("Path"), _filePath); -// } -// QString GeometrySet::getFilePath() -// { -// return _filePath; -// } -void GeometrySet::setVisible(bool v) -{ - _visible = v; - appendProperty(QString("Visible"), _visible); -} -bool GeometrySet::isVisible() -{ - return _visible; -} -void GeometrySet::setType(GeometryType t) -{ - _type = t; -} -GeometryType GeometrySet::getType() -{ - return _type; -} -void GeometrySet::setShape(TopoDS_Shape* shape) -{ - _shape = shape; - int i = 0; - for (TopExp_Explorer faceExp(*shape, TopAbs_FACE); faceExp.More(); faceExp.Next()) ++i; - appendProperty(QObject::tr("Surfaces"), i); -} -TopoDS_Shape* GeometrySet::getShape() -{ - return _shape; -} - -void GeometrySet::setPoly(vtkPolyData * poly) -{ - _polyData = poly; -} - -vtkPolyData * GeometrySet::getPoly() -{ - return _polyData; -} - -TopoDS_Shape* GeometrySet::getShape(int type, int index) -{ - *tempShape = TopoDS_Shape(); - TopAbs_ShapeEnum shapeType; - switch (type) - { - case 1: shapeType = TopAbs_VERTEX; break; - case 2: shapeType = TopAbs_EDGE; break; - case 3: shapeType = TopAbs_FACE; break; - case 4: shapeType = TopAbs_SOLID; break; - default: return tempShape; - } - TopExp_Explorer ptExp(*_shape, shapeType); - for (int i = 0; ptExp.More(); ptExp.Next(), ++i) - { - if (i == index) - { - *tempShape = ptExp.Current(); - break; - } - - } - return tempShape; - -} - -const TopoDS_Shape& GeometrySet::getRealShape(int type, int index) -{ - *tempShape = TopoDS_Shape(); - TopAbs_ShapeEnum shapeType; - switch (type) - { - case 1: shapeType = TopAbs_VERTEX; break; - case 2: shapeType = TopAbs_EDGE; break; - case 3: shapeType = TopAbs_FACE; break; - case 4: shapeType = TopAbs_SOLID; break; - default: return *tempShape; - } - TopExp_Explorer ptExp(*_shape, shapeType); - for (int i = 0; ptExp.More(); ptExp.Next(), ++i) - { - if (i == index) - *tempShape = ptExp.Current(); - } - return *tempShape; -} - -// void GeometrySet::setStlDataSet(vtkSmartPointer polyData) -// { -// _polyData = polyData; -// appendProperty(QObject::tr("Triangles"), (int)polyData->GetNumberOfCells()); -// } -// vtkDataSet* GeometrySet::getStlDataSet() -// { -// return _polyData; -// } -QDomElement& GeometrySet::writeToProjectFile(QDomDocument* doc, QDomElement* ele, bool isDiso) -{ - QDomElement element = doc->createElement("GeoSet"); //创建子节点 - QDomAttr idattr = doc->createAttribute("ID"); - idattr.setValue(QString::number(_id)); - element.setAttributeNode(idattr); - QDomAttr visible = doc->createAttribute("Visible"); - visible.setValue("True"); - if (!_visible) visible.setValue("False"); - element.setAttributeNode(visible); - - QDomAttr isSTL = doc->createAttribute("ISSTL"); - isSTL.setValue("True"); - if (_type!= STL) isSTL.setValue("False"); - element.setAttributeNode(isSTL); - - QDomElement nameele = doc->createElement("Name"); - QDomText nameText = doc->createTextNode(_name); - nameele.appendChild(nameText); - element.appendChild(nameele); - // QDomElement pathele = doc->createElement("Path"); - // QDomText pathtext = doc->createTextNode(_filePath); - // pathele.appendChild(pathtext); - // element.appendChild(pathele); - - ele->appendChild(element); //子节点挂载 - if (_parameter != nullptr) - _parameter->writeToProjectFile(doc, &element); - - if (isDiso) - { - QString exelPath = QCoreApplication::applicationDirPath(); - const QString tempPath = exelPath + "/../tempIO/" + QString("%1.brep").arg(_id); - if (_type != STL) - this->writeBrep(tempPath); - else - this->writePoly(tempPath); - - } - - for (int i = 0; i < _subSetList.size(); ++i) - { - GeometrySet* subset = _subSetList.at(i); - subset->writeSubSet(doc, &element, isDiso); - } - - return element; -} -void GeometrySet::setID(int id) -{ - DataBase::setID(id); - if (id > idOffset) - idOffset = id; -} -void GeometrySet::resetMaxID() -{ - idOffset = 0; -} -void GeometrySet::readDataFromProjectFile(QDomElement* element, bool isDiso) -{ - QDomNodeList subNodeList = element->elementsByTagName("SubSet"); - const int nsub = subNodeList.size(); - for (int i = 0; i < nsub; ++i) - { - QDomElement subele = subNodeList.at(0).toElement(); - GeometrySet* subset = new GeometrySet; - subset->readSubSet(&subele, isDiso); - _subSetList.append(subset); - element->removeChild(subele); - } - - int id = element->attribute("ID").toInt(); - this->setID(id); - bool visible = true; - QString vis = element->attribute("Visible"); - if (vis.toLower() == "false") visible = false; - this->setVisible(visible); - QString isSTL = element->attribute("ISSTL"); - if (isSTL.toLower() == "true") this->setType(STL); - QDomNodeList nameNode = element->elementsByTagName("Name"); - - if (nameNode.size() != 1) return; - QString name = nameNode.at(0).toElement().text(); - // qDebug() << name; - this->setName(name); - - QDomNodeList paraList = element->elementsByTagName("Parameter"); - if (paraList.size() == 1) - { - QDomElement paraele = paraList.at(0).toElement(); - QString type = paraele.attribute("Type"); - //qDebug() << type; - _parameter = GeometryModelParaBase::createParaByString(type); - if (_parameter != nullptr) - _parameter->readDataFromProjectFile(¶ele); - } - - if (isDiso) - { - QString exelPath = QCoreApplication::applicationDirPath(); - const QString tempPath = exelPath + "/../tempIO/" + QString("%1.brep").arg(_id); - - if (_type != STL) - this->readBrep(tempPath); - else - this->readPoly(tempPath); - } - - -} - -void GeometrySet::removeSubSet(GeometrySet* set) -{ - _subSetList.removeOne(set); -} - -void GeometrySet::appendSubSet(GeometrySet* set) -{ - _subSetList.append(set); -} - -int GeometrySet::getSubSetCount() -{ - return _subSetList.size(); -} - -GeometrySet* GeometrySet::getSubSetAt(int index) -{ - if (index >=0 && index <_subSetList.size()) - { - return _subSetList.at(index); - } - return nullptr; -} - -bool GeometrySet::writeBrep(QString name) -{ - QByteArray arr = name.toLatin1(); - char* ch = arr.data(); - - TopoDS_Compound aRes; - BRep_Builder aBuilder; - aBuilder.MakeCompound(aRes); - - if (_shape == nullptr) return false; - aBuilder.Add(aRes, *_shape); - - return BRepTools::Write(aRes, ch); -} - -bool GeometrySet::writePoly(QString name) -{ - QByteArray arr = name.toLatin1(); - char* ch = arr.data(); - - vtkDataSetWriter* w = vtkDataSetWriter::New(); - w->SetInputData(_polyData); - w->SetFileName(ch); - w->SetFileTypeToBinary(); - w->Update(); - w->Delete(); - - return true; -} - -void GeometrySet::setParameter(GeometryModelParaBase* p) -{ - _parameter = p; -} - -GeometryModelParaBase* GeometrySet::getParameter() -{ - return _parameter; -} - -bool GeometrySet::isEditable() -{ - return _parameter != nullptr; -} - -bool GeometrySet::readBrep(QString name) -{ - QByteArray arr = name.toLatin1(); - char* ch = arr.data(); - TopoDS_Shape* ashape = new TopoDS_Shape; - BRep_Builder builder; - BRepTools::Read(*ashape, (const Standard_CString)ch, builder); - if (ashape->IsNull()) - { - delete ashape; - return false; - } - _shape = ashape; - return true; -} - -bool GeometrySet::readPoly(QString name) -{ - QByteArray arr = name.toLatin1(); - char* ch = arr.data(); - _polyData = vtkPolyData::New(); - auto reader = vtkPolyDataReader::New(); - reader->SetFileName(ch); - reader->Update(); - auto poly = reader->GetOutput(); - int n = poly->GetNumberOfCells(); - _polyData->DeepCopy(reader->GetOutput()); - reader->Delete(); - return true; -} - -void GeometrySet::writeSubSet(QDomDocument* doc, QDomElement* parent, bool isdiso) -{ - QDomElement element = doc->createElement("SubSet"); //创建子节点 - QDomAttr idattr = doc->createAttribute("ID"); - idattr.setValue(QString::number(_id)); - element.setAttributeNode(idattr); - QDomAttr visible = doc->createAttribute("Visible"); - visible.setValue("True"); - if (!_visible) visible.setValue("False"); - element.setAttributeNode(visible); - QDomAttr isSTL = doc->createAttribute("ISSTL"); - isSTL.setValue("True"); - if (_type != STL) isSTL.setValue("False"); - element.setAttributeNode(isSTL); - QDomElement nameele = doc->createElement("Name"); - QDomText nameText = doc->createTextNode(_name); - nameele.appendChild(nameText); - element.appendChild(nameele); - - parent->appendChild(element); //子节点挂载 - if (_parameter != nullptr) - _parameter->writeToProjectFile(doc, &element); - - if (isdiso) - { - QString exelPath = QCoreApplication::applicationDirPath(); - const QString tempPath = exelPath + "/../tempIO/" + QString("%1.brep").arg(_id); - if (_type != STL) - this->writeBrep(tempPath); - else - this->writePoly(tempPath); - } - -} - -void GeometrySet::readSubSet(QDomElement* element, bool isDiso /*= false*/) -{ - int id = element->attribute("ID").toInt(); - this->setID(id); - bool visible = true; - QString vis = element->attribute("Visible"); - if (vis.toLower() == "false") visible = false; - this->setVisible(visible); - QString isSTL = element->attribute("ISSTL"); - if (isSTL.toLower() == "true") this->setType(STL); - QDomNodeList nameNode = element->elementsByTagName("Name"); - if (nameNode.size() != 1) return; - QString name = nameNode.at(0).toElement().text(); - //qDebug() << name; - this->setName(name); - - QDomNodeList paraList = element->elementsByTagName("Parameter"); - if (paraList.size() == 1) - { - QDomElement paraele = paraList.at(0).toElement(); - QString type = paraele.attribute("Type"); - _parameter = GeometryModelParaBase::createParaByString(type); - if (_parameter != nullptr) - _parameter->readDataFromProjectFile(¶ele); - } - - if (isDiso) - { - QString exelPath = QCoreApplication::applicationDirPath(); - const QString tempPath = exelPath + "/../tempIO/" + QString("%1.brep").arg(_id); - - if (_type != STL) - this->readBrep(tempPath); - else - this->readPoly(tempPath); - } -} - -GeometrySet* GeometrySet::getSetByID(int id) -{ - GeometrySet* s = nullptr; - if (id == _id) - s = this; - else - { - const int n = _subSetList.size(); - for (int i = 0; i < n; ++i) - { - GeometrySet* temp = _subSetList.at(i); - if (id == temp->getID()) - { - s = temp; - break; - } - - } - } - return s; - -} - -int GeometrySet::getGeoMemberCount(int type) -{ - TopAbs_ShapeEnum shapeType; - switch (type) - { - case 1: shapeType = TopAbs_VERTEX; break; - case 2: shapeType = TopAbs_EDGE; break; - case 3: shapeType = TopAbs_FACE; break; - case 4: shapeType = TopAbs_SOLID; break; - default: return -1; - } - TopExp_Explorer ptExp(*_shape, shapeType); - QList tshapelist; - for (int index = 0; ptExp.More(); ptExp.Next(), ++index) - { - TopoDS_Shape s = ptExp.Current(); - Handle(TopoDS_TShape) ts = s.TShape(); - if (tshapelist.contains(ts)) continue; - tshapelist.append(ts); - } - return tshapelist.size(); -} - -void GeometrySet::releaseSubSet() -{ - for (int i = 0; i < _subSetList.size(); ++i) - { - delete _subSetList.at(i); - } - _subSetList.clear(); -} - - - - - -} diff --git a/src/mainWindow/CustomizerHelper.h b/src/mainWindow/CustomizerHelper.h deleted file mode 100644 index a808527..0000000 --- a/src/mainWindow/CustomizerHelper.h +++ /dev/null @@ -1,67 +0,0 @@ -#ifndef CUSTOMIZERHELPER_H_ -#define CUSTOMIZERHELPER_H_ - -#include "mainWindowAPI.h" -#include -#include - -class QMenu; -class QToolBar; -class SARibbonPannel; -class SARibbonCategory; - -namespace Ui -{ - class MainWindowRibbon; -} - -namespace GUI -{ - class MainWindow; - - class MAINWINDOWAPI CustomizerHelper : public QObject - { - Q_OBJECT - public: - CustomizerHelper(MainWindow* m, Ui::MainWindowRibbon* ui); - ~CustomizerHelper() = default; - - void startCustomizer(); - void finishCustomizer(); - - public slots: - /*根据配置文件开放接口 */ - void registerInterface(); - - private: - bool isUseRibbon() const; - QString readConfigOptions(); - void updateBasicInfo(); - - void enableGeoImport(bool on); - void enableGeoExport(bool on); - void enableGeoSketch(bool on); - void enableGeoFeatureModeling(bool on); - void enableGeoFeatureOperate(bool on); - void enableGeoSelectAndView(bool on); - - void enableMeshImport(bool on); - void enableMeshExport(bool on); - void enableSolidMesh(bool on); - void enableSurfaceMesh(bool on); - void enableMeshCheck(bool on); - void enableMeshComponent(bool on); - void enableMeshSelectAndView(bool on); - - private: - GUI::MainWindow* _mainWindow{}; - Ui::MainWindowRibbon* _ui{}; - - QList _menuList{}; - QList _toolBarList{}; - }; -} - - - -#endif \ No newline at end of file diff --git a/src/mainWindow/MainWindowPy.cpp b/src/mainWindow/MainWindowPy.cpp deleted file mode 100644 index af74894..0000000 --- a/src/mainWindow/MainWindowPy.cpp +++ /dev/null @@ -1,2240 +0,0 @@ -#include "MainWindowPy.h" -#include -#include -#include -#include "MainWindow.h" -#include "signalHandler.h" -#include "SubWindowManager.h" -#include "PythonModule/PyAgent.h" -#include "PostWidgets/Post3DInterface.h" -#include "PostWidgets/Post3DWidget.h" -#include -#include -#include "MeshData/meshSingleton.h" -#include "MeshData/meshSet.h" -#include "GeometryCommand/GeoCommandList.h" -#include "Geometry/GeoComponent.h" -#include "Geometry/geometryData.h" -#include "IO/vtkDataRelated.h" -#include "MeshData/meshKernal.h" -#include "vtkDataSet.h" -#include "GeometryCommand/GeoCommandList.h" -#include "GeometryCommand/GeoCommandRemove.h" -#include "MainWidgets/preWindow.h" -#include "GeometryCommand/GeoCommandCreateComponent.h" -namespace GUI -{ - - MainWindow *MainWindowPy::_mainWindow = nullptr; - SignalHandler *MainWindowPy::_signalHander = nullptr; - SubWindowManager *MainWindowPy::_subWindowManager = nullptr; - Py::PythonAgent *MainWindowPy::_pyAgent = nullptr; - - /*void MainWindowPy::showFastCAE() - { - - }*/ - - void MainWindowPy::undo() - { - Command::GeoComandList::getInstance()->undo(); - _pyAgent->unLock(); - } - - void MainWindowPy::redo() - { - Command::GeoComandList::getInstance()->redo(); - _pyAgent->unLock(); - } - - void MainWindowPy::init(GUI::MainWindow *m, GUI::SignalHandler *sg) - { - _mainWindow = m; - _signalHander = sg; - _subWindowManager = _mainWindow->getSubWindowManager(); - _pyAgent = Py::PythonAgent::getInstance(); - } - - void MainWindowPy::clearData() - { - emit _mainWindow->clearDataSig(); - } - - void MainWindowPy::importMesh(char *f, char *s, int modelId) - { - QString file(f); - QString suffix(s); - emit _signalHander->importMeshPySig(file, suffix, modelId); - //_signalHander->importMesh(file, suffix, modelId); - //_pyAgent->unLock(); - } - - void MainWindowPy::exportMesh(char *f, char *s, int modelId) - { - QString file(f); - QString suffix(s); - emit _signalHander->exportMeshPySig(file, s, modelId); - } - - void MainWindowPy::importGeometry(char *f) - { - QString file(f); - QStringList fl = file.split(","); - emit _mainWindow->importGeometrySig(fl); - //_pyAgent->unLock(); - } - - void MainWindowPy::exportGeometry(char *f) - { - QString file(f); - emit _mainWindow->exportGeometrySig(file); - //_pyAgent->unLock(); - } - - void MainWindowPy::openProjectFile(char *f) - { - QString file(f); - - emit _signalHander->openProjectFileSig(file); - //_pyAgent->unLock(); - } - - void MainWindowPy::saveProjectFile(char *f) - { - QString file(f); - emit _signalHander->saveToProjectFileSig(file); - //_pyAgent->unLock(); - } - void MainWindowPy::openPost2D() - { - emit _signalHander->open2DPlotWindowPySig(); - //_pyAgent->unLock(); - } - void MainWindowPy::openPost3D() - { - emit _signalHander->open3DGraphWindowPySig(); - } - void MainWindowPy::openPreWindow() - { - emit _subWindowManager->openPreWindowSig(); - } - - void MainWindowPy::saveImage(int w, int h, int id, char *win, char *file) - { - QString wi(win); - QString f(file); - emit _subWindowManager->saveImageSig(w, h, id, wi, f); - //_pyAgent->unLock(); - } - - void MainWindowPy::setView(int id, char *win, char *view) - { - QString wi(win); - QString vi(view); - emit _subWindowManager->setViewSig(id, wi, vi); - // _pyAgent->unLock(); - } - - void MainWindowPy::setViewRandValue(int id, char *win, int x1, int x2, int x3, int y1, int y2, int y3, int z1, int z2, int z3) - { - QString wi(win); - emit _subWindowManager->setViewValueSig(id, wi, x1, x2, x3, y1, y2, y3, z1, z2, z3); - //_pyAgent->unLock(); - } - void MainWindowPy::quit() - { - _subWindowManager->closeAllSubWindow(); - _signalHander->clearData(false); - _mainWindow->close(); - } - - void MainWindowPy::solveProject(int projectIndex, int solverIndex) - { - emit _signalHander->solveProjectSig(projectIndex, solverIndex); - //_pyAgent->lock(); - } - - void MainWindowPy::script_openFile(int id, char *type, char *file) - { - QString stype(type); - QString sfile(file); - qDebug() << "sfile" << sfile; - ModuleBase::GraphWindowBase *gb = _subWindowManager->getWindowByTypeID(stype, id); - if (gb == nullptr) - return; - Post::Post3DWindowInterface *p3d = dynamic_cast(gb); - if (p3d == nullptr) - return; - Post::Post3DWindow *w = p3d->getWindow(); - if (w == nullptr) - return; - // w->openFile(sfile); - emit w->openFileSig(sfile, false); - } - - void MainWindowPy::script_applyClicked(int id, char *type) - { - QString stype(type); - ModuleBase::GraphWindowBase *gb = _subWindowManager->getWindowByTypeID(stype, id); - if (gb == nullptr) - return; - Post::Post3DWindowInterface *p3d = dynamic_cast(gb); - if (p3d == nullptr) - return; - Post::Post3DWindow *w = p3d->getWindow(); - if (w == nullptr) - return; - emit w->applyClickSig(); - } - - void MainWindowPy::script_Properties_Opacity(int id, char *type, int obj_id, double mOpacity) - { - QString stype(type); - ModuleBase::GraphWindowBase *gb = _subWindowManager->getWindowByTypeID(stype, id); - if (gb == nullptr) - return; - Post::Post3DWindowInterface *p3d = dynamic_cast(gb); - if (p3d == nullptr) - return; - Post::Post3DWindow *w = p3d->getWindow(); - if (w == nullptr) - return; - emit w->Properties_OpacitySig(obj_id, mOpacity); - } - - void MainWindowPy::script_Properties_colorColumn(int id, char *type, int obj_id, char *mColorColumnStyle) - { - QString stype(type); - ModuleBase::GraphWindowBase *gb = _subWindowManager->getWindowByTypeID(stype, id); - if (gb == nullptr) - return; - Post::Post3DWindowInterface *p3d = dynamic_cast(gb); - if (p3d == nullptr) - return; - Post::Post3DWindow *w = p3d->getWindow(); - if (w == nullptr) - return; - emit w->Properties_colorColumnSig(obj_id, mColorColumnStyle); - } - - void MainWindowPy::script_Properties_scalarBarTitle(int id, char *type, int obj_id, char *colName, char *m_title) - { - QString stype(type); - QString scolName(colName); - QString sm_title(m_title); - ModuleBase::GraphWindowBase *gb = _subWindowManager->getWindowByTypeID(stype, id); - if (gb == nullptr) - return; - Post::Post3DWindowInterface *p3d = dynamic_cast(gb); - if (p3d == nullptr) - return; - Post::Post3DWindow *w = p3d->getWindow(); - if (w == nullptr) - return; - emit w->Properties_scalarBarTitleSig(obj_id, scolName, sm_title); - } - void MainWindowPy::script_Properties_scalarBarFontSize(int id, char *type, int obj_id, char *colName, int m_fontSize) - { - QString stype(type); - QString scolName(colName); - ModuleBase::GraphWindowBase *gb = _subWindowManager->getWindowByTypeID(stype, id); - if (gb == nullptr) - return; - Post::Post3DWindowInterface *p3d = dynamic_cast(gb); - if (p3d == nullptr) - return; - Post::Post3DWindow *w = p3d->getWindow(); - if (w == nullptr) - return; - emit w->Properties_scalarBarFontSizeSig(obj_id, scolName, m_fontSize); - } - - void MainWindowPy::script_Properties_scalarBarNumLables(int id, char *type, int obj_id, char *colName, int m_numLables) - { - QString stype(type); - QString scolName(colName); - ModuleBase::GraphWindowBase *gb = _subWindowManager->getWindowByTypeID(stype, id); - if (gb == nullptr) - return; - Post::Post3DWindowInterface *p3d = dynamic_cast(gb); - if (p3d == nullptr) - return; - Post::Post3DWindow *w = p3d->getWindow(); - if (w == nullptr) - return; - emit w->Properties_scalarBarNumLablesSig(obj_id, scolName, m_numLables); - } - - void MainWindowPy::script_Properties_lineWidth(int id, char *type, int obj_id, int mLineWidth) - { - QString stype(type); - ModuleBase::GraphWindowBase *gb = _subWindowManager->getWindowByTypeID(stype, id); - if (gb == nullptr) - return; - Post::Post3DWindowInterface *p3d = dynamic_cast(gb); - if (p3d == nullptr) - return; - Post::Post3DWindow *w = p3d->getWindow(); - if (w == nullptr) - return; - emit w->Properties_lineWidthSig(obj_id, mLineWidth); - } - - void MainWindowPy::script_Properties_pointSize(int id, char *type, int obj_id, int mPointSize) - { - QString stype(type); - ModuleBase::GraphWindowBase *gb = _subWindowManager->getWindowByTypeID(stype, id); - if (gb == nullptr) - return; - Post::Post3DWindowInterface *p3d = dynamic_cast(gb); - if (p3d == nullptr) - return; - Post::Post3DWindow *w = p3d->getWindow(); - if (w == nullptr) - return; - emit w->Properties_pointSizeSig(obj_id, mPointSize); - } - - void MainWindowPy::script_Properties_translate(int id, char *type, int obj_id, double x, double y, double z) - { - QString stype(type); - ModuleBase::GraphWindowBase *gb = _subWindowManager->getWindowByTypeID(stype, id); - if (gb == nullptr) - return; - Post::Post3DWindowInterface *p3d = dynamic_cast(gb); - if (p3d == nullptr) - return; - Post::Post3DWindow *w = p3d->getWindow(); - if (w == nullptr) - return; - emit w->Properties_translateSig(obj_id, x, y, z); - } - - void MainWindowPy::script_Properties_origin(int id, char *type, int obj_id, double x, double y, double z) - { - QString stype(type); - ModuleBase::GraphWindowBase *gb = _subWindowManager->getWindowByTypeID(stype, id); - if (gb == nullptr) - return; - Post::Post3DWindowInterface *p3d = dynamic_cast(gb); - if (p3d == nullptr) - return; - Post::Post3DWindow *w = p3d->getWindow(); - if (w == nullptr) - return; - emit w->Properties_originSig(obj_id, x, y, z); - } - - void MainWindowPy::script_Properties_scale(int id, char *type, int obj_id, double x, double y, double z) - { - QString stype(type); - ModuleBase::GraphWindowBase *gb = _subWindowManager->getWindowByTypeID(stype, id); - if (gb == nullptr) - return; - Post::Post3DWindowInterface *p3d = dynamic_cast(gb); - if (p3d == nullptr) - return; - Post::Post3DWindow *w = p3d->getWindow(); - if (w == nullptr) - return; - emit w->Properties_scaleSig(obj_id, x, y, z); - } - - void MainWindowPy::script_Properties_orientation(int id, char *type, int obj_id, double x, double y, double z) - { - QString stype(type); - ModuleBase::GraphWindowBase *gb = _subWindowManager->getWindowByTypeID(stype, id); - if (gb == nullptr) - return; - Post::Post3DWindowInterface *p3d = dynamic_cast(gb); - if (p3d == nullptr) - return; - Post::Post3DWindow *w = p3d->getWindow(); - if (w == nullptr) - return; - emit w->Properties_orientationSig(obj_id, x, y, z); - } - - void MainWindowPy::script_Properties_representation(int id, char *type, int obj_id, int m_enum_representationtype) - { - QString stype(type); - ModuleBase::GraphWindowBase *gb = _subWindowManager->getWindowByTypeID(stype, id); - if (gb == nullptr) - return; - Post::Post3DWindowInterface *p3d = dynamic_cast(gb); - if (p3d == nullptr) - return; - Post::Post3DWindow *w = p3d->getWindow(); - if (w == nullptr) - return; - emit w->Properties_representationSig(obj_id, m_enum_representationtype); - } - - void MainWindowPy::script_Properties_specular(int id, char *type, int obj_id, double mSpecular) - { - QString stype(type); - ModuleBase::GraphWindowBase *gb = _subWindowManager->getWindowByTypeID(stype, id); - if (gb == nullptr) - return; - Post::Post3DWindowInterface *p3d = dynamic_cast(gb); - if (p3d == nullptr) - return; - Post::Post3DWindow *w = p3d->getWindow(); - if (w == nullptr) - return; - emit w->Properties_specularSig(obj_id, mSpecular); - } - /////////////////// - void MainWindowPy::script_Properties_diffuse(int id, char *type, int obj_id, double mDiffuse) - { - QString stype(type); - ModuleBase::GraphWindowBase *gb = _subWindowManager->getWindowByTypeID(stype, id); - if (gb == nullptr) - return; - Post::Post3DWindowInterface *p3d = dynamic_cast(gb); - if (p3d == nullptr) - return; - Post::Post3DWindow *w = p3d->getWindow(); - if (w == nullptr) - return; - emit w->Properties_diffuseSig(obj_id, mDiffuse); - } - - void MainWindowPy::script_Properties_ambient(int id, char *type, int obj_id, double mAmbient) - { - QString stype(type); - ModuleBase::GraphWindowBase *gb = _subWindowManager->getWindowByTypeID(stype, id); - if (gb == nullptr) - return; - Post::Post3DWindowInterface *p3d = dynamic_cast(gb); - if (p3d == nullptr) - return; - Post::Post3DWindow *w = p3d->getWindow(); - if (w == nullptr) - return; - emit w->Properties_ambientSig(obj_id, mAmbient); - } - - void MainWindowPy::script_Properties_specularPower(int id, char *type, int obj_id, int mSpecularPower) - { - QString stype(type); - ModuleBase::GraphWindowBase *gb = _subWindowManager->getWindowByTypeID(stype, id); - if (gb == nullptr) - return; - Post::Post3DWindowInterface *p3d = dynamic_cast(gb); - if (p3d == nullptr) - return; - Post::Post3DWindow *w = p3d->getWindow(); - if (w == nullptr) - return; - emit w->Properties_specularPowerSig(obj_id, mSpecularPower); - } - - void MainWindowPy::script_Properties_specularColor(int id, char *type, int obj_id, int r, int g, int b) - { - QString stype(type); - ModuleBase::GraphWindowBase *gb = _subWindowManager->getWindowByTypeID(stype, id); - if (gb == nullptr) - return; - Post::Post3DWindowInterface *p3d = dynamic_cast(gb); - if (p3d == nullptr) - return; - Post::Post3DWindow *w = p3d->getWindow(); - if (w == nullptr) - return; - emit w->Properties_specularColorSig(obj_id, r, g, b); - } - - void MainWindowPy::script_Properties_solidColor(int id, char *type, int obj_id, int r, int g, int b) - { - QString stype(type); - ModuleBase::GraphWindowBase *gb = _subWindowManager->getWindowByTypeID(stype, id); - if (gb == nullptr) - return; - Post::Post3DWindowInterface *p3d = dynamic_cast(gb); - if (p3d == nullptr) - return; - Post::Post3DWindow *w = p3d->getWindow(); - if (w == nullptr) - return; - emit w->Properties_solidColorSig(obj_id, r, g, b); - } - - void MainWindowPy::script_Properties_edgeColor(int id, char *type, int obj_id, int r, int g, int b) - { - QString stype(type); - ModuleBase::GraphWindowBase *gb = _subWindowManager->getWindowByTypeID(stype, id); - if (gb == nullptr) - return; - Post::Post3DWindowInterface *p3d = dynamic_cast(gb); - if (p3d == nullptr) - return; - Post::Post3DWindow *w = p3d->getWindow(); - if (w == nullptr) - return; - emit w->Properties_edgeColorSig(obj_id, r, g, b); - } - - void MainWindowPy::script_Properties_interpolation(int id, char *type, int obj_id, int m_enum_interpolationtype) - { - QString stype(type); - ModuleBase::GraphWindowBase *gb = _subWindowManager->getWindowByTypeID(stype, id); - if (gb == nullptr) - return; - Post::Post3DWindowInterface *p3d = dynamic_cast(gb); - if (p3d == nullptr) - return; - Post::Post3DWindow *w = p3d->getWindow(); - if (w == nullptr) - return; - emit w->Properties_interpolationSig(obj_id, m_enum_interpolationtype); - } - - void MainWindowPy::script_Properties_Flag_scalarBar(int id, char *type, int obj_id, char *mColorColumnStyle) - { - QString stype(type); - QString smColorColumnStyle(mColorColumnStyle); - ModuleBase::GraphWindowBase *gb = _subWindowManager->getWindowByTypeID(stype, id); - if (gb == nullptr) - return; - Post::Post3DWindowInterface *p3d = dynamic_cast(gb); - if (p3d == nullptr) - return; - Post::Post3DWindow *w = p3d->getWindow(); - if (w == nullptr) - return; - emit w->Properties_Flag_scalarBarSig(obj_id, smColorColumnStyle); - } - - void MainWindowPy::script_Properties_EnableOpacityMap(int id, char *type, int obj_id, bool val) - { - QString stype(type); - ModuleBase::GraphWindowBase *gb = _subWindowManager->getWindowByTypeID(stype, id); - if (gb == nullptr) - return; - Post::Post3DWindowInterface *p3d = dynamic_cast(gb); - if (p3d == nullptr) - return; - Post::Post3DWindow *w = p3d->getWindow(); - if (w == nullptr) - return; - emit w->Properties_EnableOpacityMapSig(obj_id, val); - } - - void MainWindowPy::script_Properties_visible(int id, char *type, int obj_id, bool flag_show_actors) - { - QString stype(type); - ModuleBase::GraphWindowBase *gb = _subWindowManager->getWindowByTypeID(stype, id); - if (gb == nullptr) - return; - Post::Post3DWindowInterface *p3d = dynamic_cast(gb); - if (p3d == nullptr) - return; - Post::Post3DWindow *w = p3d->getWindow(); - if (w == nullptr) - return; - emit w->Properties_visibleSig(obj_id, flag_show_actors); - } - - void MainWindowPy::script_Properties_show_scalarBars(int id, char *type, int obj_id, bool mScalarBarVisible) - { - QString stype(type); - ModuleBase::GraphWindowBase *gb = _subWindowManager->getWindowByTypeID(stype, id); - if (gb == nullptr) - return; - Post::Post3DWindowInterface *p3d = dynamic_cast(gb); - if (p3d == nullptr) - return; - Post::Post3DWindow *w = p3d->getWindow(); - if (w == nullptr) - return; - emit w->Properties_show_scalarBarsSig(obj_id, mScalarBarVisible); - } - - void MainWindowPy::script_Properties_show_cubeAxes(int id, char *type, int obj_id, bool flag_cubeAxes) - { - QString stype(type); - ModuleBase::GraphWindowBase *gb = _subWindowManager->getWindowByTypeID(stype, id); - if (gb == nullptr) - return; - Post::Post3DWindowInterface *p3d = dynamic_cast(gb); - if (p3d == nullptr) - return; - Post::Post3DWindow *w = p3d->getWindow(); - if (w == nullptr) - return; - emit w->Properties_show_cubeAxesSig(obj_id, flag_cubeAxes); - } - - void MainWindowPy::script_Properties_scalarBarPosition(int id, char *type, int obj_id, char *colName, int tep_orietation, double pos0, double pos1, double pos2, double pos3) - { - QString stype(type); - QString scolName(colName); - ModuleBase::GraphWindowBase *gb = _subWindowManager->getWindowByTypeID(stype, id); - if (gb == nullptr) - return; - Post::Post3DWindowInterface *p3d = dynamic_cast(gb); - if (p3d == nullptr) - return; - Post::Post3DWindow *w = p3d->getWindow(); - if (w == nullptr) - return; - emit w->Properties_scalarBarPositionSig(obj_id, scolName, tep_orietation, pos0, pos1, pos2, pos3); - } - - void MainWindowPy::script_FilterClip(int id, char *type, int obj_id) - { - QString stype(type); - ModuleBase::GraphWindowBase *gb = _subWindowManager->getWindowByTypeID(stype, id); - if (gb == nullptr) - return; - Post::Post3DWindowInterface *p3d = dynamic_cast(gb); - if (p3d == nullptr) - return; - Post::Post3DWindow *w = p3d->getWindow(); - if (w == nullptr) - return; - emit w->FilterClipSig(obj_id); - } - - void MainWindowPy::script_FilterSlice(int id, char *type, int obj_id) - { - QString stype(type); - ModuleBase::GraphWindowBase *gb = _subWindowManager->getWindowByTypeID(stype, id); - if (gb == nullptr) - return; - Post::Post3DWindowInterface *p3d = dynamic_cast(gb); - if (p3d == nullptr) - return; - Post::Post3DWindow *w = p3d->getWindow(); - if (w == nullptr) - return; - emit w->FilterSliceSig(obj_id); - } - - void MainWindowPy::script_FilterContour(int id, char *type, int obj_id) - { - QString stype(type); - ModuleBase::GraphWindowBase *gb = _subWindowManager->getWindowByTypeID(stype, id); - if (gb == nullptr) - return; - Post::Post3DWindowInterface *p3d = dynamic_cast(gb); - if (p3d == nullptr) - return; - Post::Post3DWindow *w = p3d->getWindow(); - if (w == nullptr) - return; - emit w->FilterContourSig(obj_id); - } - - void MainWindowPy::script_FilterVector(int id, char *type, int obj_id) - { - QString stype(type); - ModuleBase::GraphWindowBase *gb = _subWindowManager->getWindowByTypeID(stype, id); - if (gb == nullptr) - return; - Post::Post3DWindowInterface *p3d = dynamic_cast(gb); - if (p3d == nullptr) - return; - Post::Post3DWindow *w = p3d->getWindow(); - if (w == nullptr) - return; - emit w->FilterVectorSig(obj_id); - } - - void MainWindowPy::script_FilterReflection(int id, char *type, int obj_id) - { - QString stype(type); - ModuleBase::GraphWindowBase *gb = _subWindowManager->getWindowByTypeID(stype, id); - if (gb == nullptr) - return; - Post::Post3DWindowInterface *p3d = dynamic_cast(gb); - if (p3d == nullptr) - return; - Post::Post3DWindow *w = p3d->getWindow(); - if (w == nullptr) - return; - emit w->FilterReflectionSig(obj_id); - } - - void MainWindowPy::script_FilterSmooth(int id, char *type, int obj_id) - { - QString stype(type); - ModuleBase::GraphWindowBase *gb = _subWindowManager->getWindowByTypeID(stype, id); - if (gb == nullptr) - return; - Post::Post3DWindowInterface *p3d = dynamic_cast(gb); - if (p3d == nullptr) - return; - Post::Post3DWindow *w = p3d->getWindow(); - if (w == nullptr) - return; - emit w->FilterSmoothSig(obj_id); - } - - void MainWindowPy::script_FilterStreamLine(int id, char *type, int obj_id) - { - QString stype(type); - ModuleBase::GraphWindowBase *gb = _subWindowManager->getWindowByTypeID(stype, id); - if (gb == nullptr) - return; - Post::Post3DWindowInterface *p3d = dynamic_cast(gb); - if (p3d == nullptr) - return; - Post::Post3DWindow *w = p3d->getWindow(); - if (w == nullptr) - return; - emit w->FilterStreamLineSig(obj_id); - } - - void MainWindowPy::script_Properties_vector_GlyphVector(int id, char *type, int obj_id, char *val) - { - QString stype(type); - QString sval(val); - ModuleBase::GraphWindowBase *gb = _subWindowManager->getWindowByTypeID(stype, id); - if (gb == nullptr) - return; - Post::Post3DWindowInterface *p3d = dynamic_cast(gb); - if (p3d == nullptr) - return; - Post::Post3DWindow *w = p3d->getWindow(); - if (w == nullptr) - return; - emit w->Properties_vector_GlyphVectorSig(obj_id, sval); - } - - void MainWindowPy::script_Properties_vector_scalar(int id, char *type, int obj_id, char *val) - { - QString stype(type); - QString sval(val); - ModuleBase::GraphWindowBase *gb = _subWindowManager->getWindowByTypeID(stype, id); - if (gb == nullptr) - return; - Post::Post3DWindowInterface *p3d = dynamic_cast(gb); - if (p3d == nullptr) - return; - Post::Post3DWindow *w = p3d->getWindow(); - if (w == nullptr) - return; - emit w->Properties_vector_scalarSig(obj_id, sval); - } - - void MainWindowPy::script_Properties_vector_normal(int id, char *type, int obj_id, char *val) - { - QString stype(type); - QString sval(val); - ModuleBase::GraphWindowBase *gb = _subWindowManager->getWindowByTypeID(stype, id); - if (gb == nullptr) - return; - Post::Post3DWindowInterface *p3d = dynamic_cast(gb); - if (p3d == nullptr) - return; - Post::Post3DWindow *w = p3d->getWindow(); - if (w == nullptr) - return; - emit w->Properties_vector_normalSig(obj_id, sval); - } - - void MainWindowPy::script_Properties_vector_numPoints(int id, char *type, int obj_id, int val) - { - QString stype(type); - ModuleBase::GraphWindowBase *gb = _subWindowManager->getWindowByTypeID(stype, id); - if (gb == nullptr) - return; - Post::Post3DWindowInterface *p3d = dynamic_cast(gb); - if (p3d == nullptr) - return; - Post::Post3DWindow *w = p3d->getWindow(); - if (w == nullptr) - return; - emit w->Properties_vector_numPointsSig(obj_id, val); - } - - void MainWindowPy::script_Properties_vector_glyph_type(int id, char *type, int obj_id, int val) - { - QString stype(type); - ModuleBase::GraphWindowBase *gb = _subWindowManager->getWindowByTypeID(stype, id); - if (gb == nullptr) - return; - Post::Post3DWindowInterface *p3d = dynamic_cast(gb); - if (p3d == nullptr) - return; - Post::Post3DWindow *w = p3d->getWindow(); - if (w == nullptr) - return; - emit w->Properties_vector_glyph_typeSig(obj_id, val); - } - - void MainWindowPy::script_Properties_vector_glyph_tipRes(int id, char *type, int obj_id, int val) - { - QString stype(type); - ModuleBase::GraphWindowBase *gb = _subWindowManager->getWindowByTypeID(stype, id); - if (gb == nullptr) - return; - Post::Post3DWindowInterface *p3d = dynamic_cast(gb); - if (p3d == nullptr) - return; - Post::Post3DWindow *w = p3d->getWindow(); - if (w == nullptr) - return; - emit w->Properties_vector_glyph_tipResSig(obj_id, val); - } - - void MainWindowPy::script_Properties_vector_glyph_tipRad(int id, char *type, int obj_id, double val) - { - QString stype(type); - ModuleBase::GraphWindowBase *gb = _subWindowManager->getWindowByTypeID(stype, id); - if (gb == nullptr) - return; - Post::Post3DWindowInterface *p3d = dynamic_cast(gb); - if (p3d == nullptr) - return; - Post::Post3DWindow *w = p3d->getWindow(); - if (w == nullptr) - return; - emit w->Properties_vector_glyph_tipRadSig(obj_id, val); - } - - void MainWindowPy::script_Properties_vector_glyph_tipLen(int id, char *type, int obj_id, double val) - { - QString stype(type); - ModuleBase::GraphWindowBase *gb = _subWindowManager->getWindowByTypeID(stype, id); - if (gb == nullptr) - return; - Post::Post3DWindowInterface *p3d = dynamic_cast(gb); - if (p3d == nullptr) - return; - Post::Post3DWindow *w = p3d->getWindow(); - if (w == nullptr) - return; - emit w->Properties_vector_glyph_tipLenSig(obj_id, val); - } - - void MainWindowPy::script_Properties_vector_glyph_shaftRes(int id, char *type, int obj_id, int val) - { - QString stype(type); - ModuleBase::GraphWindowBase *gb = _subWindowManager->getWindowByTypeID(stype, id); - if (gb == nullptr) - return; - Post::Post3DWindowInterface *p3d = dynamic_cast(gb); - if (p3d == nullptr) - return; - Post::Post3DWindow *w = p3d->getWindow(); - if (w == nullptr) - return; - emit w->Properties_vector_glyph_shaftResSig(obj_id, val); - } - - void MainWindowPy::script_Properties_vector_glyph_shaftRad(int id, char *type, int obj_id, double val) - { - QString stype(type); - ModuleBase::GraphWindowBase *gb = _subWindowManager->getWindowByTypeID(stype, id); - if (gb == nullptr) - return; - Post::Post3DWindowInterface *p3d = dynamic_cast(gb); - if (p3d == nullptr) - return; - Post::Post3DWindow *w = p3d->getWindow(); - if (w == nullptr) - return; - emit w->Properties_vector_glyph_shaftRadSig(obj_id, val); - } - ////////////////////////////// - void MainWindowPy::script_Properties_view_backgroundType(int id, char *type, int val) - { - QString stype(type); - ModuleBase::GraphWindowBase *gb = _subWindowManager->getWindowByTypeID(stype, id); - if (gb == nullptr) - return; - Post::Post3DWindowInterface *p3d = dynamic_cast(gb); - if (p3d == nullptr) - return; - Post::Post3DWindow *w = p3d->getWindow(); - if (w == nullptr) - return; - emit w->Properties_view_backgroundTypedSig(val); - } - - void MainWindowPy::script_Properties_view_backgroundColor(int id, char *type, int red, int green, int blue) - { - QString stype(type); - ModuleBase::GraphWindowBase *gb = _subWindowManager->getWindowByTypeID(stype, id); - if (gb == nullptr) - return; - Post::Post3DWindowInterface *p3d = dynamic_cast(gb); - if (p3d == nullptr) - return; - Post::Post3DWindow *w = p3d->getWindow(); - if (w == nullptr) - return; - emit w->Properties_view_backgroundColorSig(red, green, blue); - } - - void MainWindowPy::script_Properties_view_background2Color(int id, char *type, int red, int green, int blue) - { - QString stype(type); - ModuleBase::GraphWindowBase *gb = _subWindowManager->getWindowByTypeID(stype, id); - if (gb == nullptr) - return; - Post::Post3DWindowInterface *p3d = dynamic_cast(gb); - if (p3d == nullptr) - return; - Post::Post3DWindow *w = p3d->getWindow(); - if (w == nullptr) - return; - emit w->Properties_view_background2ColorSig(red, green, blue); - } - - void MainWindowPy::script_Properties_view_axesVisible(int id, char *type, int a) - { - QString stype(type); - ModuleBase::GraphWindowBase *gb = _subWindowManager->getWindowByTypeID(stype, id); - if (gb == nullptr) - return; - Post::Post3DWindowInterface *p3d = dynamic_cast(gb); - if (p3d == nullptr) - return; - Post::Post3DWindow *w = p3d->getWindow(); - if (w == nullptr) - return; - emit w->Properties_view_axesVisibleSig(a); - } - - void MainWindowPy::script_Properties_view_cameraParallel(int id, char *type, int a) - { - QString stype(type); - ModuleBase::GraphWindowBase *gb = _subWindowManager->getWindowByTypeID(stype, id); - if (gb == nullptr) - return; - Post::Post3DWindowInterface *p3d = dynamic_cast(gb); - if (p3d == nullptr) - return; - Post::Post3DWindow *w = p3d->getWindow(); - if (w == nullptr) - return; - emit w->Properties_view_cameraParallelSig(a); - } - - void MainWindowPy::script_Properties_view_interaction(int id, char *type, int a) - { - QString stype(type); - ModuleBase::GraphWindowBase *gb = _subWindowManager->getWindowByTypeID(stype, id); - if (gb == nullptr) - return; - Post::Post3DWindowInterface *p3d = dynamic_cast(gb); - if (p3d == nullptr) - return; - Post::Post3DWindow *w = p3d->getWindow(); - if (w == nullptr) - return; - emit w->Properties_view_interactionSig(a); - } - - void MainWindowPy::script_Properties_renderView(int id, char *type) - { - QString stype(type); - ModuleBase::GraphWindowBase *gb = _subWindowManager->getWindowByTypeID(stype, id); - if (gb == nullptr) - return; - Post::Post3DWindowInterface *p3d = dynamic_cast(gb); - if (p3d == nullptr) - return; - Post::Post3DWindow *w = p3d->getWindow(); - if (w == nullptr) - return; - emit w->Properties_renderViewSig(); - } - - void MainWindowPy::script_Camera_Position(int id, char *type, double pos0, double pos1, double pos2) - { - QString stype(type); - ModuleBase::GraphWindowBase *gb = _subWindowManager->getWindowByTypeID(stype, id); - if (gb == nullptr) - return; - Post::Post3DWindowInterface *p3d = dynamic_cast(gb); - if (p3d == nullptr) - return; - Post::Post3DWindow *w = p3d->getWindow(); - if (w == nullptr) - return; - emit w->Camera_PositionSig(pos0, pos1, pos2); - } - - void MainWindowPy::script_Camera_FocalPoint(int id, char *type, double focalPoint0, double focalPoint1, double focalPoint2) - { - QString stype(type); - ModuleBase::GraphWindowBase *gb = _subWindowManager->getWindowByTypeID(stype, id); - if (gb == nullptr) - return; - Post::Post3DWindowInterface *p3d = dynamic_cast(gb); - if (p3d == nullptr) - return; - Post::Post3DWindow *w = p3d->getWindow(); - if (w == nullptr) - return; - emit w->Camera_FocalPointSig(focalPoint0, focalPoint1, focalPoint2); - } - - void MainWindowPy::script_Camera_ClippingRange(int id, char *type, double clippingRange0, double clippingRange1) - { - QString stype(type); - ModuleBase::GraphWindowBase *gb = _subWindowManager->getWindowByTypeID(stype, id); - if (gb == nullptr) - return; - Post::Post3DWindowInterface *p3d = dynamic_cast(gb); - if (p3d == nullptr) - return; - Post::Post3DWindow *w = p3d->getWindow(); - if (w == nullptr) - return; - emit w->Camera_ClippingRangeSig(clippingRange0, clippingRange1); - } - - void MainWindowPy::script_Camera_ViewUp(int id, char *type, double viewup0, double viewup1, double viewup2) - { - QString stype(type); - ModuleBase::GraphWindowBase *gb = _subWindowManager->getWindowByTypeID(stype, id); - if (gb == nullptr) - return; - Post::Post3DWindowInterface *p3d = dynamic_cast(gb); - if (p3d == nullptr) - return; - Post::Post3DWindow *w = p3d->getWindow(); - if (w == nullptr) - return; - emit w->Camera_ViewUpSig(viewup0, viewup1, viewup2); - } - - void MainWindowPy::script_Camera_ViewAngle(int id, char *type, double angle) - { - QString stype(type); - ModuleBase::GraphWindowBase *gb = _subWindowManager->getWindowByTypeID(stype, id); - if (gb == nullptr) - return; - Post::Post3DWindowInterface *p3d = dynamic_cast(gb); - if (p3d == nullptr) - return; - Post::Post3DWindow *w = p3d->getWindow(); - if (w == nullptr) - return; - emit w->Camera_ViewAngleSig(angle); - } - - void MainWindowPy::script_Camera_Zoom(int id, char *type, double zoom) - { - QString stype(type); - ModuleBase::GraphWindowBase *gb = _subWindowManager->getWindowByTypeID(stype, id); - if (gb == nullptr) - return; - Post::Post3DWindowInterface *p3d = dynamic_cast(gb); - if (p3d == nullptr) - return; - Post::Post3DWindow *w = p3d->getWindow(); - if (w == nullptr) - return; - emit w->Camera_ZoomSig(zoom); - } - - void MainWindowPy::script_Camera_Reset(int id, char *type) - { - QString stype(type); - ModuleBase::GraphWindowBase *gb = _subWindowManager->getWindowByTypeID(stype, id); - if (gb == nullptr) - return; - Post::Post3DWindowInterface *p3d = dynamic_cast(gb); - if (p3d == nullptr) - return; - Post::Post3DWindow *w = p3d->getWindow(); - if (w == nullptr) - return; - emit w->Camera_ResetSig(); - } - - void MainWindowPy::script_Properties_planeOrigin(int id, char *type, int obj_id, double x, double y, double z) - { - QString stype(type); - ModuleBase::GraphWindowBase *gb = _subWindowManager->getWindowByTypeID(stype, id); - if (gb == nullptr) - return; - Post::Post3DWindowInterface *p3d = dynamic_cast(gb); - if (p3d == nullptr) - return; - Post::Post3DWindow *w = p3d->getWindow(); - if (w == nullptr) - return; - emit w->Properties_planeOriginSig(obj_id, x, y, z); - } - - void MainWindowPy::script_Properties_planeNormal(int id, char *type, int obj_id, double x, double y, double z) - { - QString stype(type); - ModuleBase::GraphWindowBase *gb = _subWindowManager->getWindowByTypeID(stype, id); - if (gb == nullptr) - return; - Post::Post3DWindowInterface *p3d = dynamic_cast(gb); - if (p3d == nullptr) - return; - Post::Post3DWindow *w = p3d->getWindow(); - if (w == nullptr) - return; - emit w->Properties_planeNormalSig(obj_id, x, y, z); - } - - void MainWindowPy::script_Properties_planeVisible(int id, char *type, int obj_id, int a) - { - QString stype(type); - ModuleBase::GraphWindowBase *gb = _subWindowManager->getWindowByTypeID(stype, id); - if (gb == nullptr) - return; - Post::Post3DWindowInterface *p3d = dynamic_cast(gb); - if (p3d == nullptr) - return; - Post::Post3DWindow *w = p3d->getWindow(); - if (w == nullptr) - return; - emit w->Properties_planeVisibleSig(obj_id, a); - } - - void MainWindowPy::script_Properties_insideOut(int id, char *type, int obj_id, int a) - { - QString stype(type); - ModuleBase::GraphWindowBase *gb = _subWindowManager->getWindowByTypeID(stype, id); - if (gb == nullptr) - return; - Post::Post3DWindowInterface *p3d = dynamic_cast(gb); - if (p3d == nullptr) - return; - Post::Post3DWindow *w = p3d->getWindow(); - if (w == nullptr) - return; - emit w->Properties_insideOutSig(obj_id, a); - } - - void MainWindowPy::script_Properties_contourColumn(int id, char *type, int obj_id, char *val) - { - QString stype(type); - QString sval(val); - ModuleBase::GraphWindowBase *gb = _subWindowManager->getWindowByTypeID(stype, id); - if (gb == nullptr) - return; - Post::Post3DWindowInterface *p3d = dynamic_cast(gb); - if (p3d == nullptr) - return; - Post::Post3DWindow *w = p3d->getWindow(); - if (w == nullptr) - return; - emit w->Properties_contourColumnSig(obj_id, sval); - } - - void MainWindowPy::script_Properties_contourValue(int id, char *type, int obj_id, double val) - { - QString stype(type); - ModuleBase::GraphWindowBase *gb = _subWindowManager->getWindowByTypeID(stype, id); - if (gb == nullptr) - return; - Post::Post3DWindowInterface *p3d = dynamic_cast(gb); - if (p3d == nullptr) - return; - Post::Post3DWindow *w = p3d->getWindow(); - if (w == nullptr) - return; - emit w->Properties_contourValueSig(obj_id, val); - } - - void MainWindowPy::script_Properties_contour_reflection(int id, char *type, int obj_id, int aaa) - { - QString stype(type); - ModuleBase::GraphWindowBase *gb = _subWindowManager->getWindowByTypeID(stype, id); - if (gb == nullptr) - return; - Post::Post3DWindowInterface *p3d = dynamic_cast(gb); - if (p3d == nullptr) - return; - Post::Post3DWindow *w = p3d->getWindow(); - if (w == nullptr) - return; - emit w->Properties_contour_reflectionSig(obj_id, aaa); - } - - void MainWindowPy::script_Properties_contour_reflectionAxes(int id, char *type, int obj_id, int val) - { - QString stype(type); - ModuleBase::GraphWindowBase *gb = _subWindowManager->getWindowByTypeID(stype, id); - if (gb == nullptr) - return; - Post::Post3DWindowInterface *p3d = dynamic_cast(gb); - if (p3d == nullptr) - return; - Post::Post3DWindow *w = p3d->getWindow(); - if (w == nullptr) - return; - emit w->Properties_contour_reflectionAxesSig(obj_id, val); - } - - void MainWindowPy::script_Properties_reflectionAxes(int id, char *type, int obj_id, int reflection_axis) - { - QString stype(type); - ModuleBase::GraphWindowBase *gb = _subWindowManager->getWindowByTypeID(stype, id); - if (gb == nullptr) - return; - Post::Post3DWindowInterface *p3d = dynamic_cast(gb); - if (p3d == nullptr) - return; - Post::Post3DWindow *w = p3d->getWindow(); - if (w == nullptr) - return; - emit w->Properties_reflectionAxesSig(obj_id, reflection_axis); - } - - void MainWindowPy::script_Properties_smooth(int id, char *type, int obj_id, int smotype, double coef) - { - QString stype(type); - ModuleBase::GraphWindowBase *gb = _subWindowManager->getWindowByTypeID(stype, id); - if (gb == nullptr) - return; - Post::Post3DWindowInterface *p3d = dynamic_cast(gb); - if (p3d == nullptr) - return; - Post::Post3DWindow *w = p3d->getWindow(); - if (w == nullptr) - return; - emit w->Properties_smoothSig(obj_id, smotype, coef); - } - //////////////////////////////// - void MainWindowPy::script_Properties_streamline_vector(int id, char *type, int obj_id, char *val) - { - QString stype(type); - QString sval(val); - ModuleBase::GraphWindowBase *gb = _subWindowManager->getWindowByTypeID(stype, id); - if (gb == nullptr) - return; - Post::Post3DWindowInterface *p3d = dynamic_cast(gb); - if (p3d == nullptr) - return; - Post::Post3DWindow *w = p3d->getWindow(); - if (w == nullptr) - return; - emit w->Properties_streamline_vectorSig(obj_id, sval); - } - - void MainWindowPy::script_Properties_streamline_integration_direction(int id, char *type, int obj_id, int val) - { - QString stype(type); - ModuleBase::GraphWindowBase *gb = _subWindowManager->getWindowByTypeID(stype, id); - if (gb == nullptr) - return; - Post::Post3DWindowInterface *p3d = dynamic_cast(gb); - if (p3d == nullptr) - return; - Post::Post3DWindow *w = p3d->getWindow(); - if (w == nullptr) - return; - emit w->Properties_streamline_integration_directionSig(obj_id, val); - } - - void MainWindowPy::script_Properties_streamline_integration_type(int id, char *type, int obj_id, int val) - { - QString stype(type); - ModuleBase::GraphWindowBase *gb = _subWindowManager->getWindowByTypeID(stype, id); - if (gb == nullptr) - return; - Post::Post3DWindowInterface *p3d = dynamic_cast(gb); - if (p3d == nullptr) - return; - Post::Post3DWindow *w = p3d->getWindow(); - if (w == nullptr) - return; - emit w->Properties_streamline_integration_typeSig(obj_id, val); - } - - void MainWindowPy::script_Properties_streamline_integration_stepUnit(int id, char *type, int obj_id, int val) - { - QString stype(type); - ModuleBase::GraphWindowBase *gb = _subWindowManager->getWindowByTypeID(stype, id); - if (gb == nullptr) - return; - Post::Post3DWindowInterface *p3d = dynamic_cast(gb); - if (p3d == nullptr) - return; - Post::Post3DWindow *w = p3d->getWindow(); - if (w == nullptr) - return; - emit w->Properties_streamline_integration_stepUnitSig(obj_id, val); - } - - void MainWindowPy::script_Properties_streamline_integration_initStepLen(int id, char *type, int obj_id, double val) - { - QString stype(type); - ModuleBase::GraphWindowBase *gb = _subWindowManager->getWindowByTypeID(stype, id); - if (gb == nullptr) - return; - Post::Post3DWindowInterface *p3d = dynamic_cast(gb); - if (p3d == nullptr) - return; - Post::Post3DWindow *w = p3d->getWindow(); - if (w == nullptr) - return; - emit w->Properties_streamline_integration_initStepLenSig(obj_id, val); - } - - void MainWindowPy::script_Properties_streamline_integration_miniStepLen(int id, char *type, int obj_id, double val) - { - QString stype(type); - ModuleBase::GraphWindowBase *gb = _subWindowManager->getWindowByTypeID(stype, id); - if (gb == nullptr) - return; - Post::Post3DWindowInterface *p3d = dynamic_cast(gb); - if (p3d == nullptr) - return; - Post::Post3DWindow *w = p3d->getWindow(); - if (w == nullptr) - return; - emit w->Properties_streamline_integration_miniStepLenSig(obj_id, val); - } - - void MainWindowPy::script_Properties_streamline_integration_maxiStepLen(int id, char *type, int obj_id, double val) - { - QString stype(type); - ModuleBase::GraphWindowBase *gb = _subWindowManager->getWindowByTypeID(stype, id); - if (gb == nullptr) - return; - Post::Post3DWindowInterface *p3d = dynamic_cast(gb); - if (p3d == nullptr) - return; - Post::Post3DWindow *w = p3d->getWindow(); - if (w == nullptr) - return; - emit w->Properties_streamline_integration_maxiStepLenSig(obj_id, val); - } - - void MainWindowPy::script_Properties_streamline_stream_maxiSteps(int id, char *type, int obj_id, int val) - { - QString stype(type); - ModuleBase::GraphWindowBase *gb = _subWindowManager->getWindowByTypeID(stype, id); - if (gb == nullptr) - return; - Post::Post3DWindowInterface *p3d = dynamic_cast(gb); - if (p3d == nullptr) - return; - Post::Post3DWindow *w = p3d->getWindow(); - if (w == nullptr) - return; - emit w->Properties_streamline_stream_maxiStepsSig(obj_id, val); - } - - void MainWindowPy::script_Properties_streamline_stream_maxiStreamLen(int id, char *type, int obj_id, double val) - { - QString stype(type); - ModuleBase::GraphWindowBase *gb = _subWindowManager->getWindowByTypeID(stype, id); - if (gb == nullptr) - return; - Post::Post3DWindowInterface *p3d = dynamic_cast(gb); - if (p3d == nullptr) - return; - Post::Post3DWindow *w = p3d->getWindow(); - if (w == nullptr) - return; - emit w->Properties_streamline_stream_maxiStreamLenSig(obj_id, val); - } - - void MainWindowPy::script_Properties_streamline_stream_terminalSpeed(int id, char *type, int obj_id, double val) - { - QString stype(type); - ModuleBase::GraphWindowBase *gb = _subWindowManager->getWindowByTypeID(stype, id); - if (gb == nullptr) - return; - Post::Post3DWindowInterface *p3d = dynamic_cast(gb); - if (p3d == nullptr) - return; - Post::Post3DWindow *w = p3d->getWindow(); - if (w == nullptr) - return; - emit w->Properties_streamline_stream_terminalSpeedSig(obj_id, val); - } - - void MainWindowPy::script_Properties_streamline_stream_maxiError(int id, char *type, int obj_id, double val) - { - QString stype(type); - ModuleBase::GraphWindowBase *gb = _subWindowManager->getWindowByTypeID(stype, id); - if (gb == nullptr) - return; - Post::Post3DWindowInterface *p3d = dynamic_cast(gb); - if (p3d == nullptr) - return; - Post::Post3DWindow *w = p3d->getWindow(); - if (w == nullptr) - return; - emit w->Properties_streamline_stream_maxiErrorSig(obj_id, val); - } - - void MainWindowPy::script_Properties_streamline_seeds_type(int id, char *type, int obj_id, int val) - { - QString stype(type); - ModuleBase::GraphWindowBase *gb = _subWindowManager->getWindowByTypeID(stype, id); - if (gb == nullptr) - return; - Post::Post3DWindowInterface *p3d = dynamic_cast(gb); - if (p3d == nullptr) - return; - Post::Post3DWindow *w = p3d->getWindow(); - if (w == nullptr) - return; - emit w->Properties_streamline_seeds_typeSig(obj_id, val); - } - - void MainWindowPy::script_Properties_streamline_seeds_mPoint(int id, char *type, int obj_id, double val0, double val1, double val2) - { - QString stype(type); - ModuleBase::GraphWindowBase *gb = _subWindowManager->getWindowByTypeID(stype, id); - if (gb == nullptr) - return; - Post::Post3DWindowInterface *p3d = dynamic_cast(gb); - if (p3d == nullptr) - return; - Post::Post3DWindow *w = p3d->getWindow(); - if (w == nullptr) - return; - emit w->Properties_streamline_seeds_mPointSig(obj_id, val0, val1, val2); - } - - void MainWindowPy::script_Properties_streamline_seeds_num_points(int id, char *type, int obj_id, int val) - { - QString stype(type); - ModuleBase::GraphWindowBase *gb = _subWindowManager->getWindowByTypeID(stype, id); - if (gb == nullptr) - return; - Post::Post3DWindowInterface *p3d = dynamic_cast(gb); - if (p3d == nullptr) - return; - Post::Post3DWindow *w = p3d->getWindow(); - if (w == nullptr) - return; - emit w->Properties_streamline_seeds_num_pointsSig(obj_id, val); - } - - void MainWindowPy::script_Properties_streamline_seeds_radius(int id, char *type, int obj_id, double val) - { - QString stype(type); - ModuleBase::GraphWindowBase *gb = _subWindowManager->getWindowByTypeID(stype, id); - if (gb == nullptr) - return; - Post::Post3DWindowInterface *p3d = dynamic_cast(gb); - if (p3d == nullptr) - return; - Post::Post3DWindow *w = p3d->getWindow(); - if (w == nullptr) - return; - emit w->Properties_streamline_seeds_radiusSig(obj_id, val); - } - - void MainWindowPy::script_Properties_streamline_vorticity(int id, char *type, int obj_id, bool val) - { - QString stype(type); - ModuleBase::GraphWindowBase *gb = _subWindowManager->getWindowByTypeID(stype, id); - if (gb == nullptr) - return; - Post::Post3DWindowInterface *p3d = dynamic_cast(gb); - if (p3d == nullptr) - return; - Post::Post3DWindow *w = p3d->getWindow(); - if (w == nullptr) - return; - emit w->Properties_streamline_vorticitySig(obj_id, val); - } - - void MainWindowPy::script_Properties_streamline_interpolatorType(int id, char *type, int obj_id, int val) - { - QString stype(type); - ModuleBase::GraphWindowBase *gb = _subWindowManager->getWindowByTypeID(stype, id); - if (gb == nullptr) - return; - Post::Post3DWindowInterface *p3d = dynamic_cast(gb); - if (p3d == nullptr) - return; - Post::Post3DWindow *w = p3d->getWindow(); - if (w == nullptr) - return; - emit w->Properties_streamline_interpolatorTypeSig(obj_id, val); - } - - void MainWindowPy::script_Properties_streamline_surface_streamLines(int id, char *type, int obj_id, bool val) - { - QString stype(type); - ModuleBase::GraphWindowBase *gb = _subWindowManager->getWindowByTypeID(stype, id); - if (gb == nullptr) - return; - Post::Post3DWindowInterface *p3d = dynamic_cast(gb); - if (p3d == nullptr) - return; - Post::Post3DWindow *w = p3d->getWindow(); - if (w == nullptr) - return; - emit w->Properties_streamline_surface_streamLinesSig(obj_id, val); - } - - void MainWindowPy::script_Properties_streamline_reflection(int id, char *type, int obj_id, bool val) - { - QString stype(type); - ModuleBase::GraphWindowBase *gb = _subWindowManager->getWindowByTypeID(stype, id); - if (gb == nullptr) - return; - Post::Post3DWindowInterface *p3d = dynamic_cast(gb); - if (p3d == nullptr) - return; - Post::Post3DWindow *w = p3d->getWindow(); - if (w == nullptr) - return; - emit w->Properties_streamline_reflectionSig(obj_id, val); - } - - void MainWindowPy::script_Properties_streamline_reflectionAxes(int id, char *type, int obj_id, int val) - { - QString stype(type); - ModuleBase::GraphWindowBase *gb = _subWindowManager->getWindowByTypeID(stype, id); - if (gb == nullptr) - return; - Post::Post3DWindowInterface *p3d = dynamic_cast(gb); - if (p3d == nullptr) - return; - Post::Post3DWindow *w = p3d->getWindow(); - if (w == nullptr) - return; - emit w->Properties_streamline_reflectionAxesSig(obj_id, val); - } - - void MainWindowPy::deleteGeometry(int id) - { - MainWidget::PreWindow *pre = _subWindowManager->getPreWindow(); - if (id < 0) - return; - auto geo = Geometry::GeometryData::getInstance()->getGeometrySetByID(id); - Geometry::GeometryData::getInstance()->removeTopGeometrySet(geo); - if (pre != nullptr) - emit pre->removeGemoActors(geo); - emit _mainWindow->updateGeometryTreeSig(); - emit _mainWindow->updateActionStatesSig(); - emit _mainWindow->updateGraphOptionsSig(); - _pyAgent->unLock(); - } - - void MainWindowPy::createSet(const char *name, const char *type, const char *idstring) - { - QString cname(name); - QString cidstring(idstring); - MeshData::SetType settype = MeshData::MeshSet::stringToSettype(type); - - QStringList strlist = cidstring.simplified().split(";"); - MeshData::MeshSet *s = new MeshData::MeshSet(cname, settype); - for (QString idstring : strlist) - { - QStringList kids = idstring.split(":"); - int ncount = kids.size(); - if (kids.size() < 2) - continue; - bool ok = false; - const int kid = kids.at(0).toInt(&ok); - if (!ok) - continue; - kids = kids.at(1).split(" "); - ncount = kids.size(); - for (int i = 0; i < ncount; ++i) - { - int id = kids.at(i).toInt(&ok); - if (!ok) - continue; - s->appendMember(kid, id); - } - } - - // s->generateDisplayDataSet(); - MeshData::MeshData *meshData = MeshData::MeshData::getInstance(); - meshData->appendMeshSet(s); - emit _mainWindow->updateSetTreeSig(); - Py::PythonAgent::getInstance()->unLock(); - } - - void MainWindowPy::createGeoComponent(char *name, char *type, char *strgIDs, char *striIDs) - { - QString sname(name); - QString stype(type); - QStringList geoIds = QString(strgIDs).split(';'); - QStringList itemIds = QString(striIDs).split(';'); - if (geoIds.size() != itemIds.size()) - return; - Command::CommandCreateComponent *command = new Command::CommandCreateComponent(_mainWindow, _subWindowManager->getPreWindow()); - command->setName(sname); - command->setType(stype); - command->setMembers(geoIds, itemIds); - bool success = Command::GeoComandList::getInstance()->executeCommand(command); - if (!success) - QMessageBox::warning(nullptr, QObject::tr("Warning"), QObject::tr("Create failed !")); - else - emit _mainWindow->updateGeometryTreeSig(); - emit _mainWindow->clearAllHighLight(); - Py::PythonAgent::getInstance()->unLock(); - } - - void MainWindowPy::createVTKTransform(const char *componentIds, const char *rotate, const char *moveLocation, const char *scale) - { - QStringList qCompontIds = QString(componentIds).split(','); - QStringList qRotate = QString(rotate).split(','); - QStringList qMoveLocation = QString(moveLocation).split(','); - QStringList qScale = QString(scale).split(','); - - vtkDataRelated vtkRela; - vtkRela.SetRotateWXYZ(qRotate.at(0).toDouble(), qRotate.at(1).toDouble(), qRotate.at(2).toDouble(), qRotate.at(3).toDouble()); - vtkRela.Translate(qMoveLocation.at(0).toDouble(), qMoveLocation.at(1).toDouble(), qMoveLocation.at(2).toDouble()); - vtkRela.Scale(qScale.at(0).toDouble(), qScale.at(1).toDouble(), qScale.at(2).toDouble()); - - MeshData::MeshSet *meshSet = NULL; - MeshData::MeshKernal *meshKernal = NULL; - MeshData::MeshData *meshData = MeshData::MeshData::getInstance(); - QString kernalName, transformedName, setType, ids; - - for (QString compontId : qCompontIds) - { - meshSet = meshData->getMeshSetByID(compontId.toInt()); - if (!meshSet) - continue; - - vtkRela.SetData(meshSet->getDisplayDataSet()); - vtkSmartPointer transformed = vtkRela.StartTransform(); - - meshKernal = new MeshData::MeshKernal; - kernalName = QString("transfrom%1_%2").arg(meshSet->getName()).arg(meshKernal->getID()); - meshKernal->setName(kernalName); - meshKernal->setMeshData(transformed); - meshData->appendMeshKernal(meshKernal); - - transformedName = QString(meshSet->getName() + "_transform%1").arg(meshSet->getMaxID() + 1); - setType = MeshData::MeshSet::setTypeToString(meshSet->getSetType()); - ids.append(QString::number(meshKernal->getID()) + ":"); - - int nCount = 0; - if (setType == "Node") - nCount = transformed->GetNumberOfPoints(); - else if (setType == "Element") - nCount = transformed->GetNumberOfCells(); - if (nCount == 0) - { - emit _pyAgent->printInfo(Common::Message::Error, "Transform Failed!"); - meshData->removeKernalByID(meshKernal->getID()); - Py::PythonAgent::getInstance()->unLock(); - return; - } - for (int i = 0; i < nCount; i++) - ids.append(QString::number(i) + ' '); - - createSet(transformedName.toStdString().c_str(), setType.toStdString().c_str(), ids.toStdString().c_str()); - ids.clear(); - } - emit _mainWindow->updatePreMeshActorSig(); - emit _mainWindow->updateMeshTreeSig(); - emit _mainWindow->updateActionStatesSig(); - Py::PythonAgent::getInstance()->unLock(); - } - - void MainWindowPy::findConplanarPorC(const char *seedType, int seedId, double minAngle, int kernalId, const char *setName) - { - MeshData::MeshData *meshData = MeshData::MeshData::getInstance(); - vtkDataSet *data = meshData->getKernalByID(kernalId)->getMeshData(); - if (!data) - return; - vtkDataRelated vtkRela; - std::set coplanarIds; - QString error, setType(seedType); - if (setType == "Node") - { - coplanarIds = vtkRela.GetCoplanarPointId(data, seedId, minAngle); - error = "No Point Coplanar With This Point"; - } - else if (setType == "Element") - { - coplanarIds = vtkRela.GetCoplanarCellId(data, seedId, minAngle); - error = "No Cell Coplanar With This Cell(only support lookup surface grid)"; - } - if (coplanarIds.size() == 0) - { - emit _pyAgent->printInfo(Common::Message::Error, error); - Py::PythonAgent::getInstance()->unLock(); - return; - } - - std::set::const_iterator cit; - QString ids(QString::number(kernalId) + ":"); - for (cit = coplanarIds.cbegin(); cit != coplanarIds.cend(); cit++) - ids.append(QString::number(*cit) + ' '); - - createSet(setName, setType.toStdString().c_str(), ids.toStdString().c_str()); - Py::PythonAgent::getInstance()->unLock(); - } - - void MainWindowPy::updateInterface() - { - emit _mainWindow->updateInterfaces(); - } - -} - -void importMesh(char *f, char *s, int modelId) -{ - GUI::MainWindowPy::importMesh(f, s, modelId); -} - -void exportMesh(char *f, char *s, int modelId) -{ - GUI::MainWindowPy::exportMesh(f, s, modelId); -} - -void importGeometry(char *f) -{ - GUI::MainWindowPy::importGeometry(f); -} - -void exportGeometry(char *f) -{ - GUI::MainWindowPy::exportGeometry(f); -} - -void openProjectFile(char *f) -{ - GUI::MainWindowPy::openProjectFile(f); -} - -void saveProjectFile(char *f) -{ - GUI::MainWindowPy::saveProjectFile(f); -} - -void saveImage(int w, int h, int id, char *win, char *file) -{ - GUI::MainWindowPy::saveImage(w, h, id, win, file); -} -void setView(int id, char *win, char *file) -{ - GUI::MainWindowPy::setView(id, win, file); -} -void setViewRandValue(int id, char *win, int x1, int x2, int x3, int y1, int y2, int y3, int z1, int z2, int z3) -{ - GUI::MainWindowPy::setViewRandValue(id, win, x1, x2, x3, y1, y2, y3, z1, z2, z3); -} -// void setViewPostValue(int id, char*win, int x1, int x2, int x3, int y1, int y2, int y3, int z1, int z2, int z3) -//{ -// GUI::MainWindowPy::setViewPostValue(id, win,x1,x2,x3,y1,y2,y3,z1,z2,z3); -// } -void quit() -{ - GUI::MainWindowPy::quit(); -} -void openPost3D() -{ - GUI::MainWindowPy::openPost3D(); -} -void openPost2D() -{ - GUI::MainWindowPy::openPost2D(); -} -void openPreWindow() -{ - GUI::MainWindowPy::openPreWindow(); -} - -void solveProject(int projectIndex, int solverIndex) -{ - GUI::MainWindowPy::solveProject(projectIndex, solverIndex); -} - -void MAINWINDOWAPI script_openFile(int id, char *type, char *file) -{ - GUI::MainWindowPy::script_openFile(id, type, file); -} - -void MAINWINDOWAPI script_applyClicked(int id, char *type) -{ - GUI::MainWindowPy::script_applyClicked(id, type); -} - -void MAINWINDOWAPI createSet(char *name, char *type, char *idstring) -{ - GUI::MainWindowPy::createSet(name, type, idstring); -} - -void MAINWINDOWAPI createGeoComponent(char *name, char *type, char *strgIDs, char *striIDs) -{ - GUI::MainWindowPy::createGeoComponent(name, type, strgIDs, striIDs); -} - -void MAINWINDOWAPI script_Properties_Opacity(int id, char *type, int obj_id, double mOpacity) -{ - GUI::MainWindowPy::script_Properties_Opacity(id, type, obj_id, mOpacity); -} - -void MAINWINDOWAPI script_Properties_colorColumn(int id, char *type, int obj_id, char *mColorColumnStyle) -{ - GUI::MainWindowPy::script_Properties_colorColumn(id, type, obj_id, mColorColumnStyle); -} - -void MAINWINDOWAPI script_Properties_scalarBarTitle(int id, char *type, int obj_id, char *colName, char *m_title) -{ - GUI::MainWindowPy::script_Properties_scalarBarTitle(id, type, obj_id, colName, m_title); -} - -void MAINWINDOWAPI script_Properties_scalarBarFontSize(int id, char *type, int obj_id, char *colName, int m_fontSize) -{ - GUI::MainWindowPy::script_Properties_scalarBarFontSize(id, type, obj_id, colName, m_fontSize); -} - -void MAINWINDOWAPI script_Properties_scalarBarNumLables(int id, char *type, int obj_id, char *colName, int m_numLables) -{ - GUI::MainWindowPy::script_Properties_scalarBarNumLables(id, type, obj_id, colName, m_numLables); -} - -void MAINWINDOWAPI script_Properties_lineWidth(int id, char *type, int obj_id, int mLineWidth) -{ - GUI::MainWindowPy::script_Properties_lineWidth(id, type, obj_id, mLineWidth); -} - -void MAINWINDOWAPI script_Properties_pointSize(int id, char *type, int obj_id, int mPointSize) -{ - GUI::MainWindowPy::script_Properties_pointSize(id, type, obj_id, mPointSize); -} - -void MAINWINDOWAPI script_Properties_translate(int id, char *type, int obj_id, double x, double y, double z) -{ - GUI::MainWindowPy::script_Properties_translate(id, type, obj_id, x, y, z); -} - -void MAINWINDOWAPI script_Properties_origin(int id, char *type, int obj_id, double x, double y, double z) -{ - GUI::MainWindowPy::script_Properties_origin(id, type, obj_id, x, y, z); -} - -void MAINWINDOWAPI script_Properties_scale(int id, char *type, int obj_id, double x, double y, double z) -{ - GUI::MainWindowPy::script_Properties_scale(id, type, obj_id, x, y, z); -} - -void MAINWINDOWAPI script_Properties_orientation(int id, char *type, int obj_id, double x, double y, double z) -{ - GUI::MainWindowPy::script_Properties_orientation(id, type, obj_id, x, y, z); -} - -void MAINWINDOWAPI script_Properties_representation(int id, char *type, int obj_id, int m_enum_representationtype) -{ - GUI::MainWindowPy::script_Properties_representation(id, type, obj_id, m_enum_representationtype); -} - -void MAINWINDOWAPI script_Properties_specular(int id, char *type, int obj_id, double mSpecular) -{ - GUI::MainWindowPy::script_Properties_specular(id, type, obj_id, mSpecular); -} -////////////////// -void MAINWINDOWAPI script_Properties_diffuse(int id, char *type, int obj_id, double mDiffuse) -{ - GUI::MainWindowPy::script_Properties_diffuse(id, type, obj_id, mDiffuse); -} - -void MAINWINDOWAPI script_Properties_ambient(int id, char *type, int obj_id, double mAmbient) -{ - GUI::MainWindowPy::script_Properties_ambient(id, type, obj_id, mAmbient); -} - -void MAINWINDOWAPI script_Properties_specularPower(int id, char *type, int obj_id, int mSpecularPower) -{ - GUI::MainWindowPy::script_Properties_specularPower(id, type, obj_id, mSpecularPower); -} - -void MAINWINDOWAPI script_Properties_specularColor(int id, char *type, int obj_id, int r, int g, int b) -{ - GUI::MainWindowPy::script_Properties_specularColor(id, type, obj_id, r, g, b); -} - -void MAINWINDOWAPI script_Properties_solidColor(int id, char *type, int obj_id, int r, int g, int b) -{ - GUI::MainWindowPy::script_Properties_solidColor(id, type, obj_id, r, g, b); -} - -void MAINWINDOWAPI script_Properties_edgeColor(int id, char *type, int obj_id, int r, int g, int b) -{ - GUI::MainWindowPy::script_Properties_edgeColor(id, type, obj_id, r, g, b); -} - -void MAINWINDOWAPI script_Properties_interpolation(int id, char *type, int obj_id, int m_enum_interpolationtype) -{ - GUI::MainWindowPy::script_Properties_interpolation(id, type, obj_id, m_enum_interpolationtype); -} - -void MAINWINDOWAPI script_Properties_Flag_scalarBar(int id, char *type, int obj_id, char *mColorColumnStyle) -{ - GUI::MainWindowPy::script_Properties_Flag_scalarBar(id, type, obj_id, mColorColumnStyle); -} - -void MAINWINDOWAPI script_Properties_EnableOpacityMap(int id, char *type, int obj_id, bool val) -{ - GUI::MainWindowPy::script_Properties_EnableOpacityMap(id, type, obj_id, val); -} - -void MAINWINDOWAPI script_Properties_visible(int id, char *type, int obj_id, bool flag_show_actors) -{ - GUI::MainWindowPy::script_Properties_visible(id, type, obj_id, flag_show_actors); -} - -void MAINWINDOWAPI script_Properties_show_scalarBars(int id, char *type, int obj_id, bool mScalarBarVisible) -{ - GUI::MainWindowPy::script_Properties_show_scalarBars(id, type, obj_id, mScalarBarVisible); -} - -void MAINWINDOWAPI script_Properties_show_cubeAxes(int id, char *type, int obj_id, bool flag_cubeAxes) -{ - GUI::MainWindowPy::script_Properties_show_cubeAxes(id, type, obj_id, flag_cubeAxes); -} - -void MAINWINDOWAPI script_Properties_scalarBarPosition(int id, char *type, int obj_id, char *colName, int tep_orietation, double pos0, double pos1, double pos2, double pos3) -{ - GUI::MainWindowPy::script_Properties_scalarBarPosition(id, type, obj_id, colName, tep_orietation, pos0, pos1, pos2, pos3); -} - -void MAINWINDOWAPI script_FilterClip(int id, char *type, int obj_id) -{ - GUI::MainWindowPy::script_FilterClip(id, type, obj_id); -} - -void MAINWINDOWAPI script_FilterSlice(int id, char *type, int obj_id) -{ - GUI::MainWindowPy::script_FilterSlice(id, type, obj_id); -} - -void MAINWINDOWAPI script_FilterContour(int id, char *type, int obj_id) -{ - GUI::MainWindowPy::script_FilterContour(id, type, obj_id); -} - -void MAINWINDOWAPI script_FilterVector(int id, char *type, int obj_id) -{ - GUI::MainWindowPy::script_FilterVector(id, type, obj_id); -} - -void MAINWINDOWAPI script_FilterReflection(int id, char *type, int obj_id) -{ - GUI::MainWindowPy::script_FilterReflection(id, type, obj_id); -} - -void MAINWINDOWAPI script_FilterSmooth(int id, char *type, int obj_id) -{ - GUI::MainWindowPy::script_FilterSmooth(id, type, obj_id); -} - -void MAINWINDOWAPI script_FilterStreamLine(int id, char *type, int obj_id) -{ - GUI::MainWindowPy::script_FilterStreamLine(id, type, obj_id); -} - -void MAINWINDOWAPI script_Properties_vector_GlyphVector(int id, char *type, int obj_id, char *val) -{ - GUI::MainWindowPy::script_Properties_vector_GlyphVector(id, type, obj_id, val); -} - -void MAINWINDOWAPI script_Properties_vector_scalar(int id, char *type, int obj_id, char *val) -{ - GUI::MainWindowPy::script_Properties_vector_scalar(id, type, obj_id, val); -} - -void MAINWINDOWAPI script_Properties_vector_normal(int id, char *type, int obj_id, char *val) -{ - GUI::MainWindowPy::script_Properties_vector_normal(id, type, obj_id, val); -} - -void MAINWINDOWAPI script_Properties_vector_numPoints(int id, char *type, int obj_id, int val) -{ - GUI::MainWindowPy::script_Properties_vector_numPoints(id, type, obj_id, val); -} - -void MAINWINDOWAPI script_Properties_vector_glyph_type(int id, char *type, int obj_id, int val) -{ - GUI::MainWindowPy::script_Properties_vector_glyph_type(id, type, obj_id, val); -} - -void MAINWINDOWAPI script_Properties_vector_glyph_tipRes(int id, char *type, int obj_id, int val) -{ - GUI::MainWindowPy::script_Properties_vector_glyph_tipRes(id, type, obj_id, val); -} - -void MAINWINDOWAPI script_Properties_vector_glyph_tipRad(int id, char *type, int obj_id, double val) -{ - GUI::MainWindowPy::script_Properties_vector_glyph_tipRad(id, type, obj_id, val); -} - -void MAINWINDOWAPI script_Properties_vector_glyph_tipLen(int id, char *type, int obj_id, double val) -{ - GUI::MainWindowPy::script_Properties_vector_glyph_tipLen(id, type, obj_id, val); -} - -void MAINWINDOWAPI script_Properties_vector_glyph_shaftRes(int id, char *type, int obj_id, int val) -{ - GUI::MainWindowPy::script_Properties_vector_glyph_shaftRes(id, type, obj_id, val); -} - -void MAINWINDOWAPI script_Properties_vector_glyph_shaftRad(int id, char *type, int obj_id, double val) -{ - GUI::MainWindowPy::script_Properties_vector_glyph_shaftRad(id, type, obj_id, val); -} - -void MAINWINDOWAPI script_Properties_view_backgroundType(int id, char *type, int val) -{ - GUI::MainWindowPy::script_Properties_view_backgroundType(id, type, val); -} - -void MAINWINDOWAPI script_Properties_view_backgroundColor(int id, char *type, int red, int green, int blue) -{ - GUI::MainWindowPy::script_Properties_view_backgroundColor(id, type, red, green, blue); -} - -void MAINWINDOWAPI script_Properties_view_background2Color(int id, char *type, int red, int green, int blue) -{ - GUI::MainWindowPy::script_Properties_view_background2Color(id, type, red, green, blue); -} - -void MAINWINDOWAPI script_Properties_view_axesVisible(int id, char *type, int a) -{ - GUI::MainWindowPy::script_Properties_view_axesVisible(id, type, a); -} - -void MAINWINDOWAPI script_Properties_view_cameraParallel(int id, char *type, int a) -{ - GUI::MainWindowPy::script_Properties_view_cameraParallel(id, type, a); -} - -void MAINWINDOWAPI script_Properties_view_interaction(int id, char *type, int a) -{ - GUI::MainWindowPy::script_Properties_view_interaction(id, type, a); -} - -void MAINWINDOWAPI script_Properties_renderView(int id, char *type) -{ - GUI::MainWindowPy::script_Properties_renderView(id, type); -} - -void MAINWINDOWAPI script_Camera_Position(int id, char *type, double pos0, double pos1, double pos2) -{ - GUI::MainWindowPy::script_Camera_Position(id, type, pos0, pos1, pos2); -} - -void MAINWINDOWAPI script_Camera_FocalPoint(int id, char *type, double focalPoint0, double focalPoint1, double focalPoint2) -{ - GUI::MainWindowPy::script_Camera_FocalPoint(id, type, focalPoint0, focalPoint1, focalPoint2); -} - -void MAINWINDOWAPI script_Camera_ClippingRange(int id, char *type, double clippingRange0, double clippingRange1) -{ - GUI::MainWindowPy::script_Camera_ClippingRange(id, type, clippingRange0, clippingRange1); -} - -void MAINWINDOWAPI script_Camera_ViewUp(int id, char *type, double viewup0, double viewup1, double viewup2) -{ - GUI::MainWindowPy::script_Camera_ViewUp(id, type, viewup0, viewup1, viewup2); -} - -void MAINWINDOWAPI script_Camera_ViewAngle(int id, char *type, double angle) -{ - GUI::MainWindowPy::script_Camera_ViewAngle(id, type, angle); -} - -void MAINWINDOWAPI script_Camera_Zoom(int id, char *type, double zoom) -{ - GUI::MainWindowPy::script_Camera_Zoom(id, type, zoom); -} - -void MAINWINDOWAPI script_Camera_Reset(int id, char *type) -{ - GUI::MainWindowPy::script_Camera_Reset(id, type); -} - -void MAINWINDOWAPI script_Properties_planeOrigin(int id, char *type, int obj_id, double x, double y, double z) -{ - GUI::MainWindowPy::script_Properties_planeOrigin(id, type, obj_id, x, y, z); -} - -void MAINWINDOWAPI script_Properties_planeNormal(int id, char *type, int obj_id, double x, double y, double z) -{ - GUI::MainWindowPy::script_Properties_planeNormal(id, type, obj_id, x, y, z); -} - -void MAINWINDOWAPI script_Properties_planeVisible(int id, char *type, int obj_id, int a) -{ - GUI::MainWindowPy::script_Properties_planeVisible(id, type, obj_id, a); -} - -void MAINWINDOWAPI script_Properties_insideOut(int id, char *type, int obj_id, int a) -{ - GUI::MainWindowPy::script_Properties_insideOut(id, type, obj_id, a); -} - -void MAINWINDOWAPI script_Properties_contourColumn(int id, char *type, int obj_id, char *val) -{ - GUI::MainWindowPy::script_Properties_contourColumn(id, type, obj_id, val); -} - -void MAINWINDOWAPI script_Properties_contourValue(int id, char *type, int obj_id, double val) -{ - GUI::MainWindowPy::script_Properties_contourValue(id, type, obj_id, val); -} - -void MAINWINDOWAPI script_Properties_contour_reflection(int id, char *type, int obj_id, int aaa) -{ - GUI::MainWindowPy::script_Properties_contour_reflection(id, type, obj_id, aaa); -} - -void MAINWINDOWAPI script_Properties_contour_reflectionAxes(int id, char *type, int obj_id, int val) -{ - GUI::MainWindowPy::script_Properties_contour_reflectionAxes(id, type, obj_id, val); -} - -void MAINWINDOWAPI script_Properties_reflectionAxes(int id, char *type, int obj_id, int reflection_axis) -{ - GUI::MainWindowPy::script_Properties_reflectionAxes(id, type, obj_id, reflection_axis); -} - -void MAINWINDOWAPI script_Properties_smooth(int id, char *type, int obj_id, int smotype, double coef) -{ - GUI::MainWindowPy::script_Properties_smooth(id, type, obj_id, smotype, coef); -} - -void MAINWINDOWAPI script_Properties_streamline_vector(int id, char *type, int obj_id, char *val) -{ - GUI::MainWindowPy::script_Properties_streamline_vector(id, type, obj_id, val); -} - -void MAINWINDOWAPI script_Properties_streamline_integration_direction(int id, char *type, int obj_id, int val) -{ - GUI::MainWindowPy::script_Properties_streamline_integration_direction(id, type, obj_id, val); -} - -void MAINWINDOWAPI script_Properties_streamline_integration_type(int id, char *type, int obj_id, int val) -{ - GUI::MainWindowPy::script_Properties_streamline_integration_type(id, type, obj_id, val); -} - -void MAINWINDOWAPI script_Properties_streamline_integration_stepUnit(int id, char *type, int obj_id, int val) -{ - GUI::MainWindowPy::script_Properties_streamline_integration_stepUnit(id, type, obj_id, val); -} - -void MAINWINDOWAPI script_Properties_streamline_integration_initStepLen(int id, char *type, int obj_id, double val) -{ - GUI::MainWindowPy::script_Properties_streamline_integration_initStepLen(id, type, obj_id, val); -} - -void MAINWINDOWAPI script_Properties_streamline_integration_miniStepLen(int id, char *type, int obj_id, double val) -{ - GUI::MainWindowPy::script_Properties_streamline_integration_miniStepLen(id, type, obj_id, val); -} - -void MAINWINDOWAPI script_Properties_streamline_integration_maxiStepLen(int id, char *type, int obj_id, double val) -{ - GUI::MainWindowPy::script_Properties_streamline_integration_maxiStepLen(id, type, obj_id, val); -} - -void MAINWINDOWAPI script_Properties_streamline_stream_maxiSteps(int id, char *type, int obj_id, int val) -{ - GUI::MainWindowPy::script_Properties_streamline_stream_maxiSteps(id, type, obj_id, val); -} - -void MAINWINDOWAPI script_Properties_streamline_stream_maxiStreamLen(int id, char *type, int obj_id, double val) -{ - GUI::MainWindowPy::script_Properties_streamline_stream_maxiStreamLen(id, type, obj_id, val); -} - -void MAINWINDOWAPI script_Properties_streamline_stream_terminalSpeed(int id, char *type, int obj_id, double val) -{ - GUI::MainWindowPy::script_Properties_streamline_stream_terminalSpeed(id, type, obj_id, val); -} - -void MAINWINDOWAPI script_Properties_streamline_stream_maxiError(int id, char *type, int obj_id, double val) -{ - GUI::MainWindowPy::script_Properties_streamline_stream_maxiError(id, type, obj_id, val); -} - -void MAINWINDOWAPI script_Properties_streamline_seeds_type(int id, char *type, int obj_id, int val) -{ - GUI::MainWindowPy::script_Properties_streamline_seeds_type(id, type, obj_id, val); -} - -void MAINWINDOWAPI script_Properties_streamline_seeds_mPoint(int id, char *type, int obj_id, double val0, double val1, double val2) -{ - GUI::MainWindowPy::script_Properties_streamline_seeds_mPoint(id, type, obj_id, val0, val1, val2); -} - -void MAINWINDOWAPI script_Properties_streamline_seeds_num_points(int id, char *type, int obj_id, int val) -{ - GUI::MainWindowPy::script_Properties_streamline_seeds_num_points(id, type, obj_id, val); -} - -void MAINWINDOWAPI script_Properties_streamline_seeds_radius(int id, char *type, int obj_id, double val) -{ - GUI::MainWindowPy::script_Properties_streamline_seeds_radius(id, type, obj_id, val); -} - -void MAINWINDOWAPI script_Properties_streamline_vorticity(int id, char *type, int obj_id, bool val) -{ - GUI::MainWindowPy::script_Properties_streamline_vorticity(id, type, obj_id, val); -} - -void MAINWINDOWAPI script_Properties_streamline_interpolatorType(int id, char *type, int obj_id, int val) -{ - GUI::MainWindowPy::script_Properties_streamline_interpolatorType(id, type, obj_id, val); -} - -void MAINWINDOWAPI script_Properties_streamline_surface_streamLines(int id, char *type, int obj_id, bool val) -{ - GUI::MainWindowPy::script_Properties_streamline_surface_streamLines(id, type, obj_id, val); -} - -void MAINWINDOWAPI script_Properties_streamline_reflection(int id, char *type, int obj_id, bool val) -{ - GUI::MainWindowPy::script_Properties_streamline_reflection(id, type, obj_id, val); -} - -void MAINWINDOWAPI script_Properties_streamline_reflectionAxes(int id, char *type, int obj_id, int val) -{ - GUI::MainWindowPy::script_Properties_streamline_reflectionAxes(id, type, obj_id, val); -} - -/* -void MAINWINDOWAPI showFastCAE() -{ - GUI::MainWindowPy::showFastCAE(); -}*/ - -void MAINWINDOWAPI undo() -{ - GUI::MainWindowPy::undo(); -} - -void MAINWINDOWAPI redo() -{ - GUI::MainWindowPy::redo(); -} - -void MAINWINDOWAPI clearData() -{ - GUI::MainWindowPy::clearData(); -} - -void MAINWINDOWAPI updateInterface() -{ - GUI::MainWindowPy::updateInterface(); -} - -void MAINWINDOWAPI createVTKTransform(char *componentIds, char *rotate, char *moveLocation, char *scale) -{ - GUI::MainWindowPy::createVTKTransform(componentIds, rotate, moveLocation, scale); -} - -void MAINWINDOWAPI findConplanarPorC(const char *seedType, int seedId, double minAngle, int kernalId, const char *setName) -{ - GUI::MainWindowPy::findConplanarPorC(seedType, seedId, minAngle, kernalId, setName); -} -void MAINWINDOWAPI deleteGeometry(int id) -{ - GUI::MainWindowPy::deleteGeometry(id); -} diff --git a/src/mainWindow/MainWindowPy.h b/src/mainWindow/MainWindowPy.h deleted file mode 100644 index a52a2c2..0000000 --- a/src/mainWindow/MainWindowPy.h +++ /dev/null @@ -1,291 +0,0 @@ -#ifndef _PYMAINWINDOW_H_glyph_shaftRes -#define _PYMAINWINDOW_H_ - -#include "mainWindowAPI.h" - -namespace Py -{ - class PythonAgent; -} - -namespace GUI -{ - class MainWindow; - class SignalHandler; - class SubWindowManager; - - /** - * @brief 封装C++为C函数,最后提供Python接口 - * @since 2.5.0 - */ - class MAINWINDOWAPI MainWindowPy - { - public: - // static void showFastCAE(); - static void undo(); - static void redo(); - static void init(GUI::MainWindow *m, GUI::SignalHandler *sg); - static void clearData(); - static void importMesh(char *f, char *s, int modelId); - static void exportMesh(char *f, char *s, int modelId); - static void importGeometry(char *f); - static void exportGeometry(char *f); - static void openProjectFile(char *f); - static void saveProjectFile(char *f); - static void openPost2D(); - static void openPost3D(); - static void openPreWindow(); - static void saveImage(int w, int h, int id, char *win, char *file); - static void setView(int id, char *win, char *view); - static void setViewRandValue(int id, char *win, int x1, int x2, int x3, int y1, int y2, int y3, int z1, int z2, int z3); - static void quit(); - static void solveProject(int projectIndex, int solverIndex); - static void createSet(const char *name, const char *type, const char *idstring); - static void createGeoComponent(char *name, char *type, char *strgIDs, char *striIDs); - static void createVTKTransform(const char *componentIds, const char *rotate, const char *moveLocation, const char *scale); - static void findConplanarPorC(const char *seedType, int seedId, double minAngle, int kernalId, const char *setName); - static void updateInterface(); - - static void script_openFile(int id, char *type, char *file); - static void script_applyClicked(int id, char *type); - static void script_Properties_Opacity(int id, char *type, int obj_id, double mOpacity); - static void script_Properties_colorColumn(int id, char *type, int obj_id, char *mColorColumnStyle); - static void script_Properties_scalarBarTitle(int id, char *type, int obj_id, char *colName, char *m_title); - static void script_Properties_scalarBarFontSize(int id, char *type, int obj_id, char *colName, int m_fontSize); - static void script_Properties_scalarBarNumLables(int id, char *type, int obj_id, char *colName, int m_numLables); - static void script_Properties_lineWidth(int id, char *type, int obj_id, int mLineWidth); - static void script_Properties_pointSize(int id, char *type, int obj_id, int mPointSize); - static void script_Properties_translate(int id, char *type, int obj_id, double x, double y, double z); - static void script_Properties_origin(int id, char *type, int obj_id, double x, double y, double z); - static void script_Properties_scale(int id, char *type, int obj_id, double x, double y, double z); - static void script_Properties_orientation(int id, char *type, int obj_id, double x, double y, double z); - static void script_Properties_representation(int id, char *type, int obj_id, int m_enum_representationtype); - static void script_Properties_specular(int id, char *type, int obj_id, double mSpecular); - - static void script_Properties_diffuse(int id, char *type, int obj_id, double mDiffuse); - static void script_Properties_ambient(int id, char *type, int obj_id, double mAmbient); - static void script_Properties_specularPower(int id, char *type, int obj_id, int mSpecularPower); - static void script_Properties_specularColor(int id, char *type, int obj_id, int r, int g, int b); - static void script_Properties_solidColor(int id, char *type, int obj_id, int r, int g, int b); - static void script_Properties_edgeColor(int id, char *type, int obj_id, int r, int g, int b); - static void script_Properties_interpolation(int id, char *type, int obj_id, int m_enum_interpolationtype); - static void script_Properties_Flag_scalarBar(int id, char *type, int obj_id, char *mColorColumnStyle); - static void script_Properties_EnableOpacityMap(int id, char *type, int obj_id, bool val); - static void script_Properties_visible(int id, char *type, int obj_id, bool flag_show_actors); - static void script_Properties_show_scalarBars(int id, char *type, int obj_id, bool mScalarBarVisible); - static void script_Properties_show_cubeAxes(int id, char *type, int obj_id, bool flag_cubeAxes); - static void script_Properties_scalarBarPosition(int id, char *type, int obj_id, char *colName, int tep_orietation, double pos0, double pos1, double pos2, double pos3); - - static void script_FilterClip(int id, char *type, int obj_id); - static void script_FilterSlice(int id, char *type, int obj_id); - static void script_FilterContour(int id, char *type, int obj_id); - static void script_FilterVector(int id, char *type, int obj_id); - static void script_FilterReflection(int id, char *type, int obj_id); - static void script_FilterSmooth(int id, char *type, int obj_id); - static void script_FilterStreamLine(int id, char *type, int obj_id); - - static void script_Properties_vector_GlyphVector(int id, char *type, int obj_id, char *val); - static void script_Properties_vector_scalar(int id, char *type, int obj_id, char *val); - static void script_Properties_vector_normal(int id, char *type, int obj_id, char *val); - static void script_Properties_vector_numPoints(int id, char *type, int obj_id, int val); - static void script_Properties_vector_glyph_type(int id, char *type, int obj_id, int val); - static void script_Properties_vector_glyph_tipRes(int id, char *type, int obj_id, int val); - static void script_Properties_vector_glyph_tipRad(int id, char *type, int obj_id, double val); - static void script_Properties_vector_glyph_tipLen(int id, char *type, int obj_id, double val); - static void script_Properties_vector_glyph_shaftRes(int id, char *type, int obj_id, int val); - static void script_Properties_vector_glyph_shaftRad(int id, char *type, int obj_id, double val); - - /// - static void script_Properties_view_backgroundType(int id, char *type, int val); - static void script_Properties_view_backgroundColor(int id, char *type, int red, int green, int blue); - static void script_Properties_view_background2Color(int id, char *type, int red, int green, int blue); - static void script_Properties_view_axesVisible(int id, char *type, int a); - static void script_Properties_view_cameraParallel(int id, char *type, int a); - static void script_Properties_view_interaction(int id, char *type, int a); - static void script_Properties_renderView(int id, char *type); - - static void script_Camera_Position(int id, char *type, double pos0, double pos1, double pos2); - static void script_Camera_FocalPoint(int id, char *type, double focalPoint0, double focalPoint1, double focalPoint2); - static void script_Camera_ClippingRange(int id, char *type, double clippingRange0, double clippingRange1); - static void script_Camera_ViewUp(int id, char *type, double viewup0, double viewup1, double viewup2); - static void script_Camera_ViewAngle(int id, char *type, double angle); - static void script_Camera_Zoom(int id, char *type, double zoom); - static void script_Camera_Reset(int id, char *type); - - static void script_Properties_planeOrigin(int id, char *type, int obj_id, double x, double y, double z); - static void script_Properties_planeNormal(int id, char *type, int obj_id, double x, double y, double z); - static void script_Properties_planeVisible(int id, char *type, int obj_id, int a); - static void script_Properties_insideOut(int id, char *type, int obj_id, int a); - - static void script_Properties_contourColumn(int id, char *type, int obj_id, char *val); - static void script_Properties_contourValue(int id, char *type, int obj_id, double val); - static void script_Properties_contour_reflection(int id, char *type, int obj_id, int aaa); - static void script_Properties_contour_reflectionAxes(int id, char *type, int obj_id, int val); - - static void script_Properties_reflectionAxes(int id, char *type, int obj_id, int reflection_axis); - - static void script_Properties_smooth(int id, char *type, int obj_id, int smotype, double coef); - - static void script_Properties_streamline_vector(int id, char *type, int obj_id, char *val); - static void script_Properties_streamline_integration_direction(int id, char *type, int obj_id, int val); - static void script_Properties_streamline_integration_type(int id, char *type, int obj_id, int val); - static void script_Properties_streamline_integration_stepUnit(int id, char *type, int obj_id, int val); - static void script_Properties_streamline_integration_initStepLen(int id, char *type, int obj_id, double val); - static void script_Properties_streamline_integration_miniStepLen(int id, char *type, int obj_id, double val); - static void script_Properties_streamline_integration_maxiStepLen(int id, char *type, int obj_id, double val); - static void script_Properties_streamline_stream_maxiSteps(int id, char *type, int obj_id, int val); - static void script_Properties_streamline_stream_maxiStreamLen(int id, char *type, int obj_id, double val); - static void script_Properties_streamline_stream_terminalSpeed(int id, char *type, int obj_id, double val); - static void script_Properties_streamline_stream_maxiError(int id, char *type, int obj_id, double val); - static void script_Properties_streamline_seeds_type(int id, char *type, int obj_id, int val); - static void script_Properties_streamline_seeds_mPoint(int id, char *type, int obj_id, double val0, double val1, double val2); - static void script_Properties_streamline_seeds_num_points(int id, char *type, int obj_id, int val); - static void script_Properties_streamline_seeds_radius(int id, char *type, int obj_id, double val); - static void script_Properties_streamline_vorticity(int id, char *type, int obj_id, bool val); - static void script_Properties_streamline_interpolatorType(int id, char *type, int obj_id, int val); - static void script_Properties_streamline_surface_streamLines(int id, char *type, int obj_id, bool val); - static void script_Properties_streamline_reflection(int id, char *type, int obj_id, bool val); - static void script_Properties_streamline_reflectionAxes(int id, char *type, int obj_id, int val); - static void deleteGeometry(int id); - - private: - static MainWindow *_mainWindow; - static SignalHandler *_signalHander; - static SubWindowManager *_subWindowManager; - static Py::PythonAgent *_pyAgent; - }; -} - -//声明为C接口,供Python脚本调用 -extern "C" -{ - // void MAINWINDOWAPI showFastCAE(); - void MAINWINDOWAPI undo(); - void MAINWINDOWAPI redo(); - void MAINWINDOWAPI clearData(); - void MAINWINDOWAPI importMesh(char *f, char *s, int modelId); - void MAINWINDOWAPI exportMesh(char *f, char *s, int modelId); - void MAINWINDOWAPI importGeometry(char *f); - void MAINWINDOWAPI exportGeometry(char *f); - void MAINWINDOWAPI openProjectFile(char *f); - void MAINWINDOWAPI saveProjectFile(char *f); - void MAINWINDOWAPI updateInterface(); - void MAINWINDOWAPI quit(); - void MAINWINDOWAPI saveImage(int w, int h, int id, char *win, char *file); - void MAINWINDOWAPI setView(int id, char *win, char *view); //设置特定视角 - void MAINWINDOWAPI setViewRandValue(int id, char *win, int x1, int x2, int x3, int y1, int y2, int y3, int z1, int z2, int z3); //后处理自由设置视角 - // void MAINWINDOWAPI setViewPreValue(int id, char*win, int x1, int x2, int x3, int y1, int y2, int y3, int z1, int z2, int z3);//前处理自由设置视角 - void MAINWINDOWAPI openPost3D(); //打开3d窗口 - void MAINWINDOWAPI openPost2D(); //打开2d窗口 - void MAINWINDOWAPI openPreWindow(); //打开前处理窗口 - void MAINWINDOWAPI solveProject(int projectIndex, int solverIndex); //求解 - void MAINWINDOWAPI createSet(char *name, char *type, char *idstring); - void MAINWINDOWAPI createGeoComponent(char *name, char *type, char *strgIDs, char *striIDs); - void MAINWINDOWAPI createVTKTransform(char *componentIds, char *rotate, char *moveLocation, char *scale); - void MAINWINDOWAPI findConplanarPorC(const char *seedType, int seedId, double minAngle, int kernalId, const char *setName); - void MAINWINDOWAPI script_openFile(int id, char *type, char *file); - void MAINWINDOWAPI script_applyClicked(int id, char *type); - void MAINWINDOWAPI script_Properties_Opacity(int id, char *type, int obj_id, double mOpacity); - void MAINWINDOWAPI script_Properties_colorColumn(int id, char *type, int obj_id, char *mColorColumnStyle); - void MAINWINDOWAPI script_Properties_scalarBarTitle(int id, char *type, int obj_id, char *colName, char *m_title); - void MAINWINDOWAPI script_Properties_scalarBarFontSize(int id, char *type, int obj_id, char *colName, int m_fontSize); - void MAINWINDOWAPI script_Properties_scalarBarNumLables(int id, char *type, int obj_id, char *colName, int m_numLables); - void MAINWINDOWAPI script_Properties_lineWidth(int id, char *type, int obj_id, int mLineWidth); - void MAINWINDOWAPI script_Properties_pointSize(int id, char *type, int obj_id, int mPointSize); - void MAINWINDOWAPI script_Properties_translate(int id, char *type, int obj_id, double x, double y, double z); - void MAINWINDOWAPI script_Properties_origin(int id, char *type, int obj_id, double x, double y, double z); - void MAINWINDOWAPI script_Properties_scale(int id, char *type, int obj_id, double x, double y, double z); - void MAINWINDOWAPI script_Properties_orientation(int id, char *type, int obj_id, double x, double y, double z); - void MAINWINDOWAPI script_Properties_representation(int id, char *type, int obj_id, int m_enum_representationtype); - void MAINWINDOWAPI script_Properties_specular(int id, char *type, int obj_id, double mSpecular); - - void MAINWINDOWAPI script_Properties_diffuse(int id, char *type, int obj_id, double mDiffuse); - void MAINWINDOWAPI script_Properties_ambient(int id, char *type, int obj_id, double mAmbient); - void MAINWINDOWAPI script_Properties_specularPower(int id, char *type, int obj_id, int mSpecularPower); - void MAINWINDOWAPI script_Properties_specularColor(int id, char *type, int obj_id, int r, int g, int b); - void MAINWINDOWAPI script_Properties_solidColor(int id, char *type, int obj_id, int r, int g, int b); - void MAINWINDOWAPI script_Properties_edgeColor(int id, char *type, int obj_id, int r, int g, int b); - void MAINWINDOWAPI script_Properties_interpolation(int id, char *type, int obj_id, int m_enum_interpolationtype); - void MAINWINDOWAPI script_Properties_Flag_scalarBar(int id, char *type, int obj_id, char *mColorColumnStyle); - void MAINWINDOWAPI script_Properties_EnableOpacityMap(int id, char *type, int obj_id, bool val); - void MAINWINDOWAPI script_Properties_visible(int id, char *type, int obj_id, bool flag_show_actors); - void MAINWINDOWAPI script_Properties_show_scalarBars(int id, char *type, int obj_id, bool mScalarBarVisible); - void MAINWINDOWAPI script_Properties_show_cubeAxes(int id, char *type, int obj_id, bool flag_cubeAxes); - void MAINWINDOWAPI script_Properties_scalarBarPosition(int id, char *type, int obj_id, char *colName, int tep_orietation, double pos0, double pos1, double pos2, double pos3); - - void MAINWINDOWAPI script_FilterClip(int id, char *type, int obj_id); - void MAINWINDOWAPI script_FilterSlice(int id, char *type, int obj_id); - void MAINWINDOWAPI script_FilterContour(int id, char *type, int obj_id); - void MAINWINDOWAPI script_FilterVector(int id, char *type, int obj_id); - void MAINWINDOWAPI script_FilterReflection(int id, char *type, int obj_id); - void MAINWINDOWAPI script_FilterSmooth(int id, char *type, int obj_id); - void MAINWINDOWAPI script_FilterStreamLine(int id, char *type, int obj_id); - // 1212 - void MAINWINDOWAPI script_Properties_vector_GlyphVector(int id, char *type, int obj_id, char *val); - void MAINWINDOWAPI script_Properties_vector_scalar(int id, char *type, int obj_id, char *val); - void MAINWINDOWAPI script_Properties_vector_normal(int id, char *type, int obj_id, char *val); - void MAINWINDOWAPI script_Properties_vector_numPoints(int id, char *type, int obj_id, int val); - void MAINWINDOWAPI script_Properties_vector_glyph_type(int id, char *type, int obj_id, int val); - void MAINWINDOWAPI script_Properties_vector_glyph_tipRes(int id, char *type, int obj_id, int val); - void MAINWINDOWAPI script_Properties_vector_glyph_tipRad(int id, char *type, int obj_id, double val); - void MAINWINDOWAPI script_Properties_vector_glyph_tipLen(int id, char *type, int obj_id, double val); - void MAINWINDOWAPI script_Properties_vector_glyph_shaftRes(int id, char *type, int obj_id, int val); - void MAINWINDOWAPI script_Properties_vector_glyph_shaftRad(int id, char *type, int obj_id, double val); - - /// - - void MAINWINDOWAPI script_Properties_view_backgroundType(int id, char *type, int val); - void MAINWINDOWAPI script_Properties_view_backgroundColor(int id, char *type, int red, int green, int blue); - void MAINWINDOWAPI script_Properties_view_background2Color(int id, char *type, int red, int green, int blue); - void MAINWINDOWAPI script_Properties_view_axesVisible(int id, char *type, int a); - void MAINWINDOWAPI script_Properties_view_cameraParallel(int id, char *type, int a); - void MAINWINDOWAPI script_Properties_view_interaction(int id, char *type, int a); - void MAINWINDOWAPI script_Properties_renderView(int id, char *type); - - void MAINWINDOWAPI script_Camera_Position(int id, char *type, double pos0, double pos1, double pos2); - void MAINWINDOWAPI script_Camera_FocalPoint(int id, char *type, double focalPoint0, double focalPoint1, double focalPoint2); - void MAINWINDOWAPI script_Camera_ClippingRange(int id, char *type, double clippingRange0, double clippingRange1); - void MAINWINDOWAPI script_Camera_ViewUp(int id, char *type, double viewup0, double viewup1, double viewup2); - void MAINWINDOWAPI script_Camera_ViewAngle(int id, char *type, double angle); - void MAINWINDOWAPI script_Camera_Zoom(int id, char *type, double zoom); - void MAINWINDOWAPI script_Camera_Reset(int id, char *type); - - void MAINWINDOWAPI script_Properties_planeOrigin(int id, char *type, int obj_id, double x, double y, double z); - void MAINWINDOWAPI script_Properties_planeNormal(int id, char *type, int obj_id, double x, double y, double z); - void MAINWINDOWAPI script_Properties_planeVisible(int id, char *type, int obj_id, int a); - void MAINWINDOWAPI script_Properties_insideOut(int id, char *type, int obj_id, int a); - - void MAINWINDOWAPI script_Properties_contourColumn(int id, char *type, int obj_id, char *val); - void MAINWINDOWAPI script_Properties_contourValue(int id, char *type, int obj_id, double val); - void MAINWINDOWAPI script_Properties_contour_reflection(int id, char *type, int obj_id, int aaa); - void MAINWINDOWAPI script_Properties_contour_reflectionAxes(int id, char *type, int obj_id, int val); - ; - - void MAINWINDOWAPI script_Properties_reflectionAxes(int id, char *type, int obj_id, int reflection_axis); - - void MAINWINDOWAPI script_Properties_smooth(int id, char *type, int obj_id, int smotype, double coef); - - void MAINWINDOWAPI script_Properties_streamline_vector(int id, char *type, int obj_id, char *val); - void MAINWINDOWAPI script_Properties_streamline_integration_direction(int id, char *type, int obj_id, int val); - void MAINWINDOWAPI script_Properties_streamline_integration_type(int id, char *type, int obj_id, int val); - void MAINWINDOWAPI script_Properties_streamline_integration_stepUnit(int id, char *type, int obj_id, int val); - void MAINWINDOWAPI script_Properties_streamline_integration_initStepLen(int id, char *type, int obj_id, double val); - void MAINWINDOWAPI script_Properties_streamline_integration_miniStepLen(int id, char *type, int obj_id, double val); - void MAINWINDOWAPI script_Properties_streamline_integration_maxiStepLen(int id, char *type, int obj_id, double val); - void MAINWINDOWAPI script_Properties_streamline_stream_maxiSteps(int id, char *type, int obj_id, int val); - void MAINWINDOWAPI script_Properties_streamline_stream_maxiStreamLen(int id, char *type, int obj_id, double val); - void MAINWINDOWAPI script_Properties_streamline_stream_terminalSpeed(int id, char *type, int obj_id, double val); - void MAINWINDOWAPI script_Properties_streamline_stream_maxiError(int id, char *type, int obj_id, double val); - void MAINWINDOWAPI script_Properties_streamline_seeds_type(int id, char *type, int obj_id, int val); - void MAINWINDOWAPI script_Properties_streamline_seeds_mPoint(int id, char *type, int obj_id, double val0, double val1, double val2); - void MAINWINDOWAPI script_Properties_streamline_seeds_num_points(int id, char *type, int obj_id, int val); - void MAINWINDOWAPI script_Properties_streamline_seeds_radius(int id, char *type, int obj_id, double val); - void MAINWINDOWAPI script_Properties_streamline_vorticity(int id, char *type, int obj_id, bool val); - void MAINWINDOWAPI script_Properties_streamline_interpolatorType(int id, char *type, int obj_id, int val); - void MAINWINDOWAPI script_Properties_streamline_surface_streamLines(int id, char *type, int obj_id, bool val); - void MAINWINDOWAPI script_Properties_streamline_reflection(int id, char *type, int obj_id, bool val); - void MAINWINDOWAPI script_Properties_streamline_reflectionAxes(int id, char *type, int obj_id, int val); - void MAINWINDOWAPI deleteGeometry(int id); -} - -#endif \ No newline at end of file diff --git a/src/mainWindow/SARibbonMWUi.h b/src/mainWindow/SARibbonMWUi.h deleted file mode 100644 index 5fa4500..0000000 --- a/src/mainWindow/SARibbonMWUi.h +++ /dev/null @@ -1,75 +0,0 @@ -#ifndef SARIBBONMWUI_H -#define SARIBBONMWUI_H - -#include "ui_mainWindow.h" - -class SARibbonCategory; -class SARibbonPannel; -class SARibbonContextCategory; -class SARibbonMainWindow; - -namespace Ui -{ - class MainWindowRibbon : public MainWindow - { - public: - //每个pannel相当于一个toolbar,pannel的命名方式是“第一个action_pannel” - SARibbonCategory* home_page{}; - SARibbonPannel* new_pannel{}; - SARibbonPannel* solve_pannel{}; - SARibbonPannel* import_mesh_pannel{}; - SARibbonPannel* import_geometry_pannel{}; - SARibbonPannel* exec_script_pannel{}; - SARibbonPannel* adapt_window_pannel_home{}; - SARibbonPannel* save_picture_pannel{}; - SARibbonPannel* plugin_manager_pannel{}; - SARibbonPannel* drawing_option_pannel_home{}; - - SARibbonCategory* geometry_page{}; - SARibbonPannel* sketch_pannel_geometry{}; - SARibbonPannel* cube_pannel{}; - SARibbonPannel* create_point_pannel{}; - SARibbonPannel* base_plate_pannel{}; - SARibbonPannel* sum_pannel{}; - SARibbonPannel* stretch_pannel{}; - SARibbonPannel* display_surface_pannel{}; - SARibbonPannel* clear_choice_pannel_geometry{}; - SARibbonPannel* segmentation_pannel{}; - SARibbonPannel* chamfer_pannel{}; - SARibbonPannel* measure_pannel{}; - SARibbonPannel* undo_redo_pannel_geometry{}; - - SARibbonCategory* mesh_page{}; - SARibbonPannel* surface_mesh_subdivision_pannel{}; - SARibbonPannel* mesh_quailty_examine_pannel{}; - SARibbonPannel* clear_choice_pannel_mesh{}; - SARibbonPannel* display_node_pannel{}; - SARibbonPannel* create_set_pannel{}; - - SARibbonCategory* solve_page{}; - SARibbonPannel* solver_management_pannel{}; - - SARibbonCategory* window_page{}; - SARibbonPannel* start_page_pannel{}; - SARibbonPannel* adapt_window_pannel_window{}; - SARibbonPannel* drawing_option_pannel_window{}; - - SARibbonCategory* help_page{}; - SARibbonPannel* user_guide_pannel{}; - - SARibbonContextCategory* sketch_tool_context{}; - SARibbonCategory* sketch_tool_page{}; - SARibbonPannel* sketch_pannel_sketch_tool{}; - SARibbonPannel* draw_line_pannel{}; - SARibbonPannel* undo_redo_pannel_sketch{}; - - SARibbonCategory* post_page{}; - SARibbonPannel* post_base_pannel{}; - SARibbonPannel* post_viewer_pannel{}; - SARibbonPannel* post_editor_pannel{}; - - void setupRibbonUi(QMainWindow *MainWindow); - void retranslateRibbonUi(QMainWindow *MainWindow); - }; -} -#endif \ No newline at end of file diff --git a/src/mainWindow/SubWindowManager.h b/src/mainWindow/SubWindowManager.h deleted file mode 100644 index fcce7c0..0000000 --- a/src/mainWindow/SubWindowManager.h +++ /dev/null @@ -1,169 +0,0 @@ -#ifndef _SUBWINDOWMANAGER_H_ -#define _SUBWINDOWMANAGER_H_ - -#include -#include -#include -#include "mainWindowAPI.h" - -class QMdiSubWindow; -class QMdiArea; -class QToolBar; -class SARibbonCategory; - -namespace MainWidget -{ - class PreWindow; - class ControlPanel; -} -namespace Post -{ - class PostWindowBase; - class RealTimeWindowBase; -} -namespace ModuleBase -{ - class GraphWindowBase; -} -namespace XReport -{ - class ReportWindow; -} -namespace GenerateGeometry -{ - class GenerateGeometryWidget; -} - -namespace GUI -{ - class MainWindow; - class SignalHandler; - - class MAINWINDOWAPI SubWindowManager : public QObject - { - Q_OBJECT - public: - SubWindowManager(MainWindow* mainwindow, QMdiArea* mdiArea, SignalHandler* hander, MainWidget::ControlPanel* cp); - ~SubWindowManager(); - - - //更新前处理Actor - void updatePreActors(); - - //更新前处理网格Actor - void updatePreMeshActor(); - - //更新前处理几何Actor - void updatePreGeometryActor(); - - //获取前处理窗口 - MainWidget::PreWindow* getPreWindow(); - - //前处理窗口是否打开 - bool isPreWindowOpened(); - - //后处理窗口是否打开 - bool isPostWindowOpened(); - - bool isPostWindowOpening(); - - //更新翻译 - void reTranslate(); - - /*获取创建几何窗体*/ - GenerateGeometry::GenerateGeometryWidget* getGeometryWindow(); - - //关闭所有窗口 - void closeAllSubWindow(); - - ///获取当前激活的MDI子窗口 - ModuleBase::GraphWindowBase* getCurrentWindow(); - - ModuleBase::GraphWindowBase* getWindowByTypeID(QString type, int id); - - //设置图标 - void setIcon(QString icon); - - QMdiArea *getMdiArea() const; - - signals: - void setViewSig(int, QString, QString); - void setViewValueSig(int id, QString win, int x1, int x2, int x3, int y1, int y2, int y3, int z1, int z2, int z3); - void saveImageSig(int w, int h, int id, QString win, QString file); - void openPreWindowSig(); - void clearSelectModelSig(); - - public slots: - - /*打开前处理窗口 */ - void openPreWindow(); - - void saveImage(int w, int h, int id, QString win, QString file); - void setView(int id, QString winType, QString view);//liu - void setViewValue(int id, QString win, int x1, int x2, int x3, int y1, int y2, int y3, int z1, int z2, int z3);//liu - //void setViewPreValue(int id, QString win, int x1, int x2, int x3, int y1, int y2, int y3, int z1, int z2, int z3);//liu - - private slots: - ///关闭前处理窗口 - void closePreWindow(); - ///打开后处理窗口 - void openPostWindow(Post::PostWindowBase* pw); - ///打开实时曲线窗口 - void openRealTimeWindow(Post::RealTimeWindowBase* pw); - //打开报告窗口 - void openReportWindow(XReport::ReportWindow* w); - //关闭报告窗口 - void closeReportWindow(XReport::ReportWindow* w); - ///显示后处理信息 - void showPostWindowInfo(int id, int type); - ///关闭后处理窗口 - void closePostWindow(Post::PostWindowBase* w); - ///关闭实时曲线窗口 - void closeRealTimeWindow(Post::RealTimeWindowBase* w); - ///激活窗口发生变化 - void subWindowActived(QMdiSubWindow* sw); - ///设置视角 - void setView(QString view); - - //保存图片 - void saveImage(QString fileName, int winType, Post::PostWindowBase*winhandle, int w, int h); - void saveImage(int w, int h, QString f); - - - /*关闭创建几何窗体*/ - void closeGeometryWindow(); - - - private: - - Post::PostWindowBase* getPostWindowByIDType(int id, int type); - void removeToolBars(); - void showPreWindow(); - void showRealTimeWindow(QMdiSubWindow* w); - /*打开创建几何窗体*/ - void openGeometryWindow(); - /*ribbon:添加3D渲染的页*/ - void add3dRenderPage(const QList& toolbars); - /*ribbon:删除3D渲染的页*/ - void remove3dRenderPage(); - - private: - MainWindow* _mainWindow{}; - QMdiArea* _mdiArea{}; - SignalHandler* _signalHander{}; - MainWidget::ControlPanel* _controlPanel{}; - - QPair _preWindow{}; - QHash _postWindow{}; - QHash _realTimeWindow{}; - QHash _reportWindow{}; - QPair _geometryWindow{}; - // QHash _geometryWindow{}; - - QList _currentToolBars{}; - SARibbonCategory* _threeD_render_page{}; - }; -} - - -#endif diff --git a/src/mainWindow/translator.cpp b/src/mainWindow/translator.cpp deleted file mode 100644 index f09eba3..0000000 --- a/src/mainWindow/translator.cpp +++ /dev/null @@ -1,64 +0,0 @@ -#include "translator.h" -#include -#include -#include -#include -#include - -namespace GUI -{ - const static QStringList Lang_List = - { - ":/translations/MainWindow_zh_CN", - ":/translations/MainWidgets_zh_CN", - ":/translations/Setting_zh_CN", - ":/translations/ModuleBase_zh_CN", - ":/translations/ProjectTree_zh_CN", - ":/translations/PostWidgets_zh_CN", - ":/translations/Material_zh_CN", - ":/translations/IO_zh_CN", - ":/translations/GeometryWidgets_zh_CN", - ":/translations/PluginManager_zh_CN", - ":/translations/GmshModule_zh_CN", - ":/translations/SolverControl_Zh_CN", - ":/translations/UserGuidence_zh_CN", - ":/translations/SelfDefObject_zh_CN", - ":/translations/SARibbonBar_zh_CN", - ":/translations/PostInterface_zh_CN", - }; - - Translator::Translator() - { - _app = static_cast(QCoreApplication::instance()); - _translatorList.clear(); - const int n = Lang_List.size(); - for (int i = 0; i < n; ++i) - { - _translatorList.append(new QTranslator); - } - } - void Translator::toChinese() - { - for (int i = 0; i < Lang_List.count(); ++i) - { - auto tranlator = _translatorList.at(i); - _app->removeTranslator(tranlator); - const QString lang = Lang_List.at(i); - bool ok = tranlator->load(lang); - qDebug() << lang; - assert(ok); - _app->installTranslator(tranlator); - } - } - void Translator::toEnglish() - { - assert(_translatorList.count() == Lang_List.count()); - for (int i = 0; i < Lang_List.count(); ++i) - { - auto tranlator = _translatorList.at(i); - _app->removeTranslator(tranlator); - } - } - - -} \ No newline at end of file