适配linux环境
parent
30609c2bb0
commit
9f40c3b7c5
|
@ -1,199 +1,8 @@
|
||||||
# Prerequisites
|
.vscode
|
||||||
*.d
|
.vs
|
||||||
|
.idea
|
||||||
# Compiled Object files
|
/build
|
||||||
*.slo
|
/install
|
||||||
*.lo
|
/extlib
|
||||||
*.o
|
/cmake-build-debug
|
||||||
*.obj
|
/cmake-build-release
|
||||||
|
|
||||||
# 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
|
|
||||||
|
|
|
@ -44,7 +44,7 @@ endif()
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
# 测试环境定义(如果在支持cmake系统的IDE中编写代码,可以打开以下注释,并将路径修改为自己的Qt路径)
|
# 测试环境定义(如果在支持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}")
|
message(STATUS "${PROJECT_NAME} will be installed to ${CMAKE_INSTALL_PREFIX}")
|
||||||
|
|
||||||
if (NOT DEFINED Qt5_DIR)
|
if (NOT DEFINED Qt5_DIR)
|
||||||
|
@ -53,7 +53,7 @@ if (NOT DEFINED Qt5_DIR)
|
||||||
elseif(FASTCAE_WIN)
|
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)
|
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()]]
|
endif()
|
||||||
|
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
# 编译选项设置
|
# 编译选项设置
|
||||||
|
|
|
@ -72,21 +72,26 @@ add_library(FASTCAE::HDF5HL SHARED IMPORTED)
|
||||||
add_library(FASTCAE::HDF5HLCPP SHARED IMPORTED)
|
add_library(FASTCAE::HDF5HLCPP SHARED IMPORTED)
|
||||||
add_library(FASTCAE::HDF5TOOLS 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 PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${HDF5_INCLUDE_DIRS})
|
||||||
set_property(TARGET FASTCAE::HDF5 APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
|
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 PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${HDF5_INCLUDE_DIRS})
|
||||||
set_property(TARGET FASTCAE::HDF5CPP APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
|
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::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 PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${HDF5_INCLUDE_DIRS})
|
||||||
set_property(TARGET FASTCAE::HDF5HL APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
|
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::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 PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${HDF5_INCLUDE_DIRS})
|
||||||
set_property(TARGET FASTCAE::HDF5HLCPP APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
|
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::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 PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${HDF5_INCLUDE_DIRS})
|
||||||
set_property(TARGET FASTCAE::HDF5TOOLS APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
|
set_property(TARGET FASTCAE::HDF5TOOLS APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
|
||||||
set_property(TARGET FASTCAE::HDF5TOOLS PROPERTY INTERFACE_LINK_LIBRARIES FASTCAE::HDF5)
|
set_property(TARGET FASTCAE::HDF5TOOLS PROPERTY INTERFACE_LINK_LIBRARIES FASTCAE::HDF5)
|
||||||
|
|
|
@ -36,9 +36,8 @@ if(_WIN_)
|
||||||
#list(APPEND _depend_library XGenerateReport License)
|
#list(APPEND _depend_library XGenerateReport License)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
list(APPEND _runtimes_libraries
|
list(APPEND _runtimes_libraries
|
||||||
Qt5::Core Qt5::Gui Qt5::Widgets
|
Qt5::Core Qt5::Gui Qt5::Widgets FASTCAE::HDF5 FASTCAE::HDF5CPP
|
||||||
)
|
)
|
||||||
|
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
|
|
|
@ -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 <BRep_Builder.hxx>
|
||||||
|
#include <BRepTools.hxx>
|
||||||
|
#include <QCoreApplication>
|
||||||
|
#include <QDataStream>
|
||||||
|
#include <QDebug>
|
||||||
|
#include <QDomAttr>
|
||||||
|
#include <QDomDocument>
|
||||||
|
#include <QDomElement>
|
||||||
|
#include <QDomText>
|
||||||
|
#include <QString>
|
||||||
|
#include <TopExp_Explorer.hxx>
|
||||||
|
#include <TopoDS_Compound.hxx>
|
||||||
|
#include <TopoDS_Shape.hxx>
|
||||||
|
#include <vtkDataSet.h>
|
||||||
|
#include <vtkDataSetWriter.h>
|
||||||
|
#include <vtkPolyData.h>
|
||||||
|
#include <vtkPolyDataReader.h>
|
||||||
|
|
||||||
|
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<vtkDataSet> 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<Handle(TopoDS_TShape)> 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
|
|
@ -1,6 +1,6 @@
|
||||||
#include "STLdataExchange.h"
|
#include "STLdataExchange.h"
|
||||||
#include "geometry/geometrySet.h"
|
#include "Geometry/geometrySet.h"
|
||||||
#include "geometry/geometryData.h"
|
#include "Geometry/geometryData.h"
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
#include <vtkSTLReader.h>
|
#include <vtkSTLReader.h>
|
||||||
|
|
||||||
|
|
|
@ -1,54 +1,56 @@
|
||||||
#include "ProjectFileIO.h"
|
#include "ProjectFileIO.h"
|
||||||
#include <QDomDocument>
|
|
||||||
#include <QTextStream>
|
#include "DataProperty/modelTreeItemType.h"
|
||||||
#include "Geometry/geometryData.h"
|
#include "Geometry/geometryData.h"
|
||||||
|
#include "Geometry/geometrySet.h"
|
||||||
|
#include "MainWindow/SignalHandler.h"
|
||||||
|
#include "Material/MaterialSingletion.h"
|
||||||
#include "MeshData/meshSingleton.h"
|
#include "MeshData/meshSingleton.h"
|
||||||
#include "ModelData/modelDataSingleton.h"
|
|
||||||
#include "ModelData/modelDataBase.h"
|
#include "ModelData/modelDataBase.h"
|
||||||
#include "ModelData/modelDataBaseExtend.h"
|
#include "ModelData/modelDataBaseExtend.h"
|
||||||
#include "ModelData/modelDataFactory.h"
|
#include "ModelData/modelDataFactory.h"
|
||||||
#include "DataProperty/modelTreeItemType.h"
|
#include "ModelData/modelDataSingleton.h"
|
||||||
#include "Material/MaterialSingletion.h"
|
|
||||||
#include "Geometry/geometrySet.h"
|
|
||||||
#include "ModuleBase/CommonFunctions.h"
|
#include "ModuleBase/CommonFunctions.h"
|
||||||
#include "PluginManager/PluginManager.h"
|
#include "PluginManager/PluginManager.h"
|
||||||
#include "MainWindow/signalHandler.h"
|
|
||||||
#include <QDebug>
|
|
||||||
#include <QDomNodeList>
|
|
||||||
#include <QDomElement>
|
|
||||||
#include <QDomText>
|
|
||||||
#include <QDomAttr>
|
|
||||||
#include <QCoreApplication>
|
|
||||||
#include <QDir>
|
|
||||||
#include <BRep_Builder.hxx>
|
#include <BRep_Builder.hxx>
|
||||||
#include <BRepTools.hxx>
|
#include <BRepTools.hxx>
|
||||||
#include <TopoDS_Shape.hxx>
|
|
||||||
#include <JlCompress.h>
|
#include <JlCompress.h>
|
||||||
|
#include <QCoreApplication>
|
||||||
|
#include <QDebug>
|
||||||
|
#include <QDir>
|
||||||
|
#include <QDomAttr>
|
||||||
|
#include <QDomDocument>
|
||||||
|
#include <QDomElement>
|
||||||
|
#include <QDomNodeList>
|
||||||
|
#include <QDomText>
|
||||||
|
#include <QTextStream>
|
||||||
|
#include <TopoDS_Shape.hxx>
|
||||||
|
|
||||||
namespace IO
|
namespace IO {
|
||||||
{
|
ProjectFileIO::ProjectFileIO(GUI::MainWindow* mw, GUI::SignalHandler* sh,
|
||||||
ProjectFileIO::ProjectFileIO(GUI::MainWindow *mw, GUI::SignalHandler *sh, const QString &fileName, bool read)
|
const QString& fileName, bool read)
|
||||||
: IOBase(fileName), ModuleBase::ThreadTask(mw), _read(read)
|
: IOBase(fileName)
|
||||||
|
, ModuleBase::ThreadTask(mw)
|
||||||
|
, _read(read)
|
||||||
{
|
{
|
||||||
_geoData = Geometry::GeometryData::getInstance();
|
_geoData = Geometry::GeometryData::getInstance();
|
||||||
_meshData = MeshData::MeshData::getInstance();
|
_meshData = MeshData::MeshData::getInstance();
|
||||||
_modelData = ModelData::ModelDataSingleton::getinstance();
|
_modelData = ModelData::ModelDataSingleton::getinstance();
|
||||||
_materialData = Material::MaterialSingleton::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()
|
void ProjectFileIO::run()
|
||||||
{
|
{
|
||||||
bool success = false;
|
bool success = false;
|
||||||
if (_read)
|
if(_read) {
|
||||||
{
|
|
||||||
emit showInformation(tr("Opening Project File: \"%1\"").arg(_filename));
|
emit showInformation(tr("Opening Project File: \"%1\"").arg(_filename));
|
||||||
success = this->read();
|
success = this->read();
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
emit showInformation(tr("Saving Project File: \"%1\"").arg(_filename));
|
emit showInformation(tr("Saving Project File: \"%1\"").arg(_filename));
|
||||||
success = this->write();
|
success = this->write();
|
||||||
}
|
}
|
||||||
|
@ -58,15 +60,15 @@ namespace IO
|
||||||
|
|
||||||
bool ProjectFileIO::write(QString s)
|
bool ProjectFileIO::write(QString s)
|
||||||
{
|
{
|
||||||
if (s.isEmpty())
|
if(s.isEmpty())
|
||||||
s = _filename;
|
s = _filename;
|
||||||
|
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
QString suffix = s.right(4).toLower();
|
QString suffix = s.right(4).toLower();
|
||||||
qDebug() << s << suffix;
|
qDebug() << s << suffix;
|
||||||
if (suffix == ".xml")
|
if(suffix == ".xml")
|
||||||
ok = writeXml(s);
|
ok = writeXml(s);
|
||||||
else if (suffix == "diso")
|
else if(suffix == "diso")
|
||||||
ok = writeDiso(s);
|
ok = writeDiso(s);
|
||||||
|
|
||||||
return ok;
|
return ok;
|
||||||
|
@ -74,44 +76,45 @@ namespace IO
|
||||||
|
|
||||||
bool ProjectFileIO::writeDiso(QString fileName)
|
bool ProjectFileIO::writeDiso(QString fileName)
|
||||||
{
|
{
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
QString exelPath = QCoreApplication::applicationDirPath();
|
QString exelPath = QCoreApplication::applicationDirPath();
|
||||||
const QString tempPath = exelPath + "/../tempIO/";
|
const QString tempPath = exelPath + "/../tempIO/";
|
||||||
|
|
||||||
/*bool okremove = */ RemoveDir(tempPath);
|
/*bool okremove = */ RemoveDir(tempPath);
|
||||||
|
|
||||||
QDir dir = QDir(tempPath);
|
QDir dir = QDir(tempPath);
|
||||||
if (!dir.exists())
|
if(!dir.exists())
|
||||||
dir.mkdir(tempPath);
|
dir.mkdir(tempPath);
|
||||||
|
|
||||||
bool isEmpty = true;
|
bool isEmpty = true;
|
||||||
_doc = new QDomDocument;
|
_doc = new QDomDocument;
|
||||||
QDomProcessingInstruction instruction = _doc->createProcessingInstruction("xml", "version=\"1.0\" encoding=\"UTF-8\"");
|
QDomProcessingInstruction instruction =
|
||||||
|
_doc->createProcessingInstruction("xml", "version=\"1.0\" encoding=\"UTF-8\"");
|
||||||
_doc->appendChild(instruction);
|
_doc->appendChild(instruction);
|
||||||
QDomElement root = _doc->createElement("DISO_FILE_1.0");
|
QDomElement root = _doc->createElement("DISO_FILE_1.0");
|
||||||
_doc->appendChild(root);
|
_doc->appendChild(root);
|
||||||
|
|
||||||
const int geoCount = _geoData->getGeometrySetCount();
|
const int geoCount = _geoData->getGeometrySetCount();
|
||||||
if (geoCount > 0) //写出几何
|
if(geoCount > 0) // 写出几何
|
||||||
{
|
{
|
||||||
isEmpty = false;
|
isEmpty = false;
|
||||||
_geoData->writeToProjectFile(_doc, &root, true);
|
_geoData->writeToProjectFile(_doc, &root, true);
|
||||||
}
|
}
|
||||||
const int meshCount = _meshData->getKernalCount();
|
const int meshCount = _meshData->getKernalCount();
|
||||||
if (meshCount > 0) //写出网格
|
if(meshCount > 0) // 写出网格
|
||||||
{
|
{
|
||||||
isEmpty = false;
|
isEmpty = false;
|
||||||
// _meshData->writeToProjectFile(_doc, &root);
|
// _meshData->writeToProjectFile(_doc, &root);
|
||||||
}
|
}
|
||||||
const int nMaterial = _materialData->getMaterialCount();
|
const int nMaterial = _materialData->getMaterialCount();
|
||||||
if (nMaterial > 0) //写出材料
|
if(nMaterial > 0) // 写出材料
|
||||||
{
|
{
|
||||||
isEmpty = false;
|
isEmpty = false;
|
||||||
_materialData->writeToProjectFile(_doc, &root);
|
_materialData->writeToProjectFile(_doc, &root);
|
||||||
}
|
}
|
||||||
|
|
||||||
const int modelCount = _modelData->getModelCount();
|
const int modelCount = _modelData->getModelCount();
|
||||||
if (modelCount > 0) //写出物理模型
|
if(modelCount > 0) // 写出物理模型
|
||||||
{
|
{
|
||||||
isEmpty = false;
|
isEmpty = false;
|
||||||
_modelData->writeToProjectFile(_doc, &root);
|
_modelData->writeToProjectFile(_doc, &root);
|
||||||
|
@ -120,17 +123,16 @@ namespace IO
|
||||||
_plugins->writeToProjectFile(_doc, &root);
|
_plugins->writeToProjectFile(_doc, &root);
|
||||||
// if (isEmpty) return false; //数据为空 不写文件
|
// if (isEmpty) return false; //数据为空 不写文件
|
||||||
QFile file(tempPath + "case.xml");
|
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;
|
return false;
|
||||||
_stream = new QTextStream(&file);
|
_stream = new QTextStream(&file);
|
||||||
_doc->save(*_stream, 4);
|
_doc->save(*_stream, 4);
|
||||||
file.close();
|
file.close();
|
||||||
//写网格
|
// 写网格
|
||||||
|
|
||||||
if (meshCount > 0)
|
if(meshCount > 0) {
|
||||||
{
|
|
||||||
QFile mhFile(tempPath + "mesh.mh");
|
QFile mhFile(tempPath + "mesh.mh");
|
||||||
if (!mhFile.open(QIODevice::WriteOnly))
|
if(!mhFile.open(QIODevice::WriteOnly))
|
||||||
return false;
|
return false;
|
||||||
_dataStream = new QDataStream(&mhFile);
|
_dataStream = new QDataStream(&mhFile);
|
||||||
_meshData->writeBinaryFile(_dataStream);
|
_meshData->writeBinaryFile(_dataStream);
|
||||||
|
@ -144,39 +146,40 @@ namespace IO
|
||||||
bool ProjectFileIO::writeXml(QString fileName)
|
bool ProjectFileIO::writeXml(QString fileName)
|
||||||
{
|
{
|
||||||
bool isEmpty = true;
|
bool isEmpty = true;
|
||||||
_doc = new QDomDocument;
|
_doc = new QDomDocument;
|
||||||
QDomProcessingInstruction instruction = _doc->createProcessingInstruction("xml", "version=\"1.0\" encoding=\"UTF-8\"");
|
QDomProcessingInstruction instruction =
|
||||||
|
_doc->createProcessingInstruction("xml", "version=\"1.0\" encoding=\"UTF-8\"");
|
||||||
_doc->appendChild(instruction);
|
_doc->appendChild(instruction);
|
||||||
QDomElement root = _doc->createElement("DISO_FILE_1.0");
|
QDomElement root = _doc->createElement("DISO_FILE_1.0");
|
||||||
_doc->appendChild(root);
|
_doc->appendChild(root);
|
||||||
const int geoCount = _geoData->getGeometrySetCount();
|
const int geoCount = _geoData->getGeometrySetCount();
|
||||||
if (geoCount > 0) //写出几何
|
if(geoCount > 0) // 写出几何
|
||||||
{
|
{
|
||||||
isEmpty = false;
|
isEmpty = false;
|
||||||
_geoData->writeToProjectFile(_doc, &root);
|
_geoData->writeToProjectFile(_doc, &root);
|
||||||
}
|
}
|
||||||
const int meshCount = _meshData->getKernalCount();
|
const int meshCount = _meshData->getKernalCount();
|
||||||
if (meshCount > 0) //写出网格
|
if(meshCount > 0) // 写出网格
|
||||||
{
|
{
|
||||||
isEmpty = false;
|
isEmpty = false;
|
||||||
_meshData->writeToProjectFile(_doc, &root);
|
_meshData->writeToProjectFile(_doc, &root);
|
||||||
}
|
}
|
||||||
const int nMaterial = _materialData->getMaterialCount();
|
const int nMaterial = _materialData->getMaterialCount();
|
||||||
if (nMaterial > 0) //写出材料
|
if(nMaterial > 0) // 写出材料
|
||||||
{
|
{
|
||||||
isEmpty = false;
|
isEmpty = false;
|
||||||
_materialData->writeToProjectFile(_doc, &root);
|
_materialData->writeToProjectFile(_doc, &root);
|
||||||
}
|
}
|
||||||
|
|
||||||
const int modelCount = _modelData->getModelCount();
|
const int modelCount = _modelData->getModelCount();
|
||||||
if (modelCount > 0) //写出物理模型
|
if(modelCount > 0) // 写出物理模型
|
||||||
{
|
{
|
||||||
isEmpty = false;
|
isEmpty = false;
|
||||||
_modelData->writeToProjectFile(_doc, &root);
|
_modelData->writeToProjectFile(_doc, &root);
|
||||||
}
|
}
|
||||||
_plugins->writeToProjectFile(_doc, &root);
|
_plugins->writeToProjectFile(_doc, &root);
|
||||||
// if (isEmpty) return false; //数据为空 不写文件
|
// if (isEmpty) return false; //数据为空 不写文件
|
||||||
if (!_file.open(QIODevice::WriteOnly | QIODevice::Truncate | QIODevice::Text))
|
if(!_file.open(QIODevice::WriteOnly | QIODevice::Truncate | QIODevice::Text))
|
||||||
return false;
|
return false;
|
||||||
_stream = new QTextStream(&_file);
|
_stream = new QTextStream(&_file);
|
||||||
_doc->save(*_stream, 4);
|
_doc->save(*_stream, 4);
|
||||||
|
@ -187,35 +190,34 @@ namespace IO
|
||||||
|
|
||||||
bool ProjectFileIO::read()
|
bool ProjectFileIO::read()
|
||||||
{
|
{
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
QString f = _filename;
|
QString f = _filename;
|
||||||
// qDebug() << f;
|
// qDebug() << f;
|
||||||
QString suffix = f.right(4);
|
QString suffix = f.right(4);
|
||||||
if (suffix == ".xml")
|
if(suffix == ".xml")
|
||||||
ok = readXml(f);
|
ok = readXml(f);
|
||||||
else if (suffix == "diso")
|
else if(suffix == "diso")
|
||||||
ok = readDiso(f);
|
ok = readDiso(f);
|
||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ProjectFileIO::readXml(QString fileName)
|
bool ProjectFileIO::readXml(QString fileName)
|
||||||
{
|
{
|
||||||
if (!_file.open(QIODevice::ReadOnly | QFile::Text))
|
if(!_file.open(QIODevice::ReadOnly | QFile::Text))
|
||||||
return false;
|
return false;
|
||||||
_doc = new QDomDocument;
|
_doc = new QDomDocument;
|
||||||
int row{0}, col{0};
|
int row{ 0 }, col{ 0 };
|
||||||
QString errstr{};
|
QString errstr{};
|
||||||
if (!_doc->setContent(&_file, true, &errstr, &row, &col))
|
if(!_doc->setContent(&_file, true, &errstr, &row, &col)) {
|
||||||
{
|
|
||||||
qDebug() << errstr << "line: " << row << "col: " << col;
|
qDebug() << errstr << "line: " << row << "col: " << col;
|
||||||
_file.close();
|
_file.close();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
QDomNodeList modelNodeList = _doc->elementsByTagName("ModelData");
|
QDomNodeList modelNodeList = _doc->elementsByTagName("ModelData");
|
||||||
QDomNodeList geoNodeList = _doc->elementsByTagName("Geometry");
|
QDomNodeList geoNodeList = _doc->elementsByTagName("Geometry");
|
||||||
QDomNodeList meshNodeList = _doc->elementsByTagName("Mesh");
|
QDomNodeList meshNodeList = _doc->elementsByTagName("Mesh");
|
||||||
QDomNodeList materialList = _doc->elementsByTagName("Materials");
|
QDomNodeList materialList = _doc->elementsByTagName("Materials");
|
||||||
QDomNodeList pluginList = _doc->elementsByTagName("Plugins");
|
QDomNodeList pluginList = _doc->elementsByTagName("Plugins");
|
||||||
// if (modelNodeList.size() + geoNodeList.size() + meshNodeList.size() <= 0)
|
// if (modelNodeList.size() + geoNodeList.size() + meshNodeList.size() <= 0)
|
||||||
// {
|
// {
|
||||||
// _file.close();
|
// _file.close();
|
||||||
|
@ -233,35 +235,33 @@ namespace IO
|
||||||
|
|
||||||
bool ProjectFileIO::readDiso(QString fileName)
|
bool ProjectFileIO::readDiso(QString fileName)
|
||||||
{
|
{
|
||||||
QString exelPath = QCoreApplication::applicationDirPath();
|
QString exelPath = QCoreApplication::applicationDirPath();
|
||||||
const QString tempPath = exelPath + "/../tempIO/";
|
const QString tempPath = exelPath + "/../tempIO/";
|
||||||
|
|
||||||
bool okremove = RemoveDir(tempPath);
|
bool okremove = RemoveDir(tempPath);
|
||||||
if (okremove)
|
if(okremove) {
|
||||||
{
|
|
||||||
QDir dir = QDir(tempPath);
|
QDir dir = QDir(tempPath);
|
||||||
if (!dir.exists())
|
if(!dir.exists())
|
||||||
dir.mkdir(tempPath);
|
dir.mkdir(tempPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList files = JlCompress::extractDir(fileName, tempPath);
|
QStringList files = JlCompress::extractDir(fileName, tempPath);
|
||||||
if (files.size() == 0)
|
if(files.size() == 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
QFile file(tempPath + "case.xml");
|
QFile file(tempPath + "case.xml");
|
||||||
if (!file.open(QIODevice::ReadOnly | QFile::Text))
|
if(!file.open(QIODevice::ReadOnly | QFile::Text))
|
||||||
return false;
|
return false;
|
||||||
_doc = new QDomDocument;
|
_doc = new QDomDocument;
|
||||||
if (!_doc->setContent(&file))
|
if(!_doc->setContent(&file)) {
|
||||||
{
|
|
||||||
file.close();
|
file.close();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
QDomNodeList modelNodeList = _doc->elementsByTagName("ModelData");
|
QDomNodeList modelNodeList = _doc->elementsByTagName("ModelData");
|
||||||
QDomNodeList geoNodeList = _doc->elementsByTagName("Geometry");
|
QDomNodeList geoNodeList = _doc->elementsByTagName("Geometry");
|
||||||
// QDomNodeList meshNodeList = _doc->elementsByTagName("Mesh");
|
// QDomNodeList meshNodeList = _doc->elementsByTagName("Mesh");
|
||||||
QDomNodeList materialList = _doc->elementsByTagName("Materials");
|
QDomNodeList materialList = _doc->elementsByTagName("Materials");
|
||||||
QDomNodeList pluginList = _doc->elementsByTagName("Plugins");
|
QDomNodeList pluginList = _doc->elementsByTagName("Plugins");
|
||||||
// if (modelNodeList.size() + geoNodeList.size() /*+ meshNodeList.size()*/ <= 0)
|
// if (modelNodeList.size() + geoNodeList.size() /*+ meshNodeList.size()*/ <= 0)
|
||||||
// {
|
// {
|
||||||
// _file.close();
|
// _file.close();
|
||||||
|
@ -271,8 +271,7 @@ namespace IO
|
||||||
// readMeshData(&meshNodeList);
|
// readMeshData(&meshNodeList);
|
||||||
|
|
||||||
QFile mhFile(tempPath + "mesh.mh");
|
QFile mhFile(tempPath + "mesh.mh");
|
||||||
if (mhFile.open(QIODevice::ReadOnly))
|
if(mhFile.open(QIODevice::ReadOnly)) {
|
||||||
{
|
|
||||||
_dataStream = new QDataStream(&mhFile);
|
_dataStream = new QDataStream(&mhFile);
|
||||||
_meshData->readBinaryFile(_dataStream);
|
_meshData->readBinaryFile(_dataStream);
|
||||||
_meshData->generateDisplayDataSet();
|
_meshData->generateDisplayDataSet();
|
||||||
|
@ -287,55 +286,54 @@ namespace IO
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProjectFileIO::readGeoData(QDomNodeList *nodeList, bool isdiso)
|
void ProjectFileIO::readGeoData(QDomNodeList* nodeList, bool isdiso)
|
||||||
{
|
{
|
||||||
const int nodeCount = nodeList->size();
|
const int nodeCount = nodeList->size();
|
||||||
if (nodeCount != 1)
|
if(nodeCount != 1)
|
||||||
return;
|
return;
|
||||||
_geoData->readFromProjectFile(nodeList, isdiso);
|
_geoData->readFromProjectFile(nodeList, isdiso);
|
||||||
}
|
}
|
||||||
void ProjectFileIO::readMeshData(QDomNodeList *nodeList)
|
void ProjectFileIO::readMeshData(QDomNodeList* nodeList)
|
||||||
{
|
{
|
||||||
const int nodeCount = nodeList->size();
|
const int nodeCount = nodeList->size();
|
||||||
if (nodeCount != 1)
|
if(nodeCount != 1)
|
||||||
return;
|
return;
|
||||||
_meshData->readFromProjectFile(nodeList);
|
_meshData->readFromProjectFile(nodeList);
|
||||||
_meshData->generateDisplayDataSet();
|
_meshData->generateDisplayDataSet();
|
||||||
}
|
}
|
||||||
void ProjectFileIO::readMaterialData(QDomNodeList *nodelist)
|
void ProjectFileIO::readMaterialData(QDomNodeList* nodelist)
|
||||||
{
|
{
|
||||||
const int nodeCount = nodelist->size();
|
const int nodeCount = nodelist->size();
|
||||||
if (nodeCount != 1)
|
if(nodeCount != 1)
|
||||||
return;
|
return;
|
||||||
QDomElement ele = nodelist->at(0).toElement();
|
QDomElement ele = nodelist->at(0).toElement();
|
||||||
_materialData->readDataFromProjectFile(&ele);
|
_materialData->readDataFromProjectFile(&ele);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProjectFileIO::readPluginData(QDomNodeList *nodeList)
|
void ProjectFileIO::readPluginData(QDomNodeList* nodeList)
|
||||||
{
|
{
|
||||||
const int nodeCount = nodeList->size();
|
const int nodeCount = nodeList->size();
|
||||||
if (nodeCount != 1)
|
if(nodeCount != 1)
|
||||||
return;
|
return;
|
||||||
QDomElement ele = nodeList->at(0).toElement();
|
QDomElement ele = nodeList->at(0).toElement();
|
||||||
_plugins->readDataFromProjectFile(&ele);
|
_plugins->readDataFromProjectFile(&ele);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProjectFileIO::readModelData(QDomNodeList *nodeList)
|
void ProjectFileIO::readModelData(QDomNodeList* nodeList)
|
||||||
{
|
{
|
||||||
const int nodeCount = nodeList->size();
|
const int nodeCount = nodeList->size();
|
||||||
if (nodeCount != 1)
|
if(nodeCount != 1)
|
||||||
return;
|
return;
|
||||||
QDomElement root = nodeList->at(0).toElement();
|
QDomElement root = nodeList->at(0).toElement();
|
||||||
QDomNodeList modelList = root.elementsByTagName("Model");
|
QDomNodeList modelList = root.elementsByTagName("Model");
|
||||||
const int modelCount = modelList.size();
|
const int modelCount = modelList.size();
|
||||||
for (int i = 0; i < modelCount; ++i)
|
for(int i = 0; i < modelCount; ++i) {
|
||||||
{
|
QDomElement model = modelList.at(i).toElement();
|
||||||
QDomElement model = modelList.at(i).toElement();
|
QString stype = model.attribute("Type");
|
||||||
QString stype = model.attribute("Type");
|
ProjectTreeType type = getTreeTypeByString(stype);
|
||||||
ProjectTreeType type = getTreeTypeByString(stype);
|
ModelData::ModelDataBase* modelData = nullptr;
|
||||||
ModelData::ModelDataBase *modelData = nullptr;
|
modelData = ModelData::ModelDataFactory::createModel(type);
|
||||||
modelData = ModelData::ModelDataFactory::createModel(type);
|
if(modelData == nullptr)
|
||||||
if (modelData == nullptr)
|
|
||||||
continue;
|
continue;
|
||||||
QThread::msleep(100);
|
QThread::msleep(100);
|
||||||
|
|
||||||
|
@ -347,4 +345,4 @@ namespace IO
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
} // namespace IO
|
||||||
|
|
|
@ -1,36 +1,37 @@
|
||||||
#include "CustomizerHelper.h"
|
#include "CustomizerHelper.h"
|
||||||
#include "MainWindow.h"
|
|
||||||
#include "signalHandler.h"
|
#include "ConfigOptions/ConfigDataReader.h"
|
||||||
#include "SubWindowManager.h"
|
#include "ConfigOptions/ConfigOptions.h"
|
||||||
#include "ConfigOptions/GeometryConfig.h"
|
#include "ConfigOptions/GeometryConfig.h"
|
||||||
|
#include "ConfigOptions/GlobalConfig.h"
|
||||||
#include "ConfigOptions/MeshConfig.h"
|
#include "ConfigOptions/MeshConfig.h"
|
||||||
#include "ConfigOptions/PostConfig.h"
|
#include "ConfigOptions/PostConfig.h"
|
||||||
#include "ConfigOptions/ProjectTreeConfig.h"
|
#include "ConfigOptions/ProjectTreeConfig.h"
|
||||||
#include "ConfigOptions/ConfigOptions.h"
|
#include "IO/IOConfig.h"
|
||||||
#include "ConfigOptions/ConfigDataReader.h"
|
|
||||||
#include "ConfigOptions/GlobalConfig.h"
|
|
||||||
#include "MainWidgets/ControlPanel.h"
|
#include "MainWidgets/ControlPanel.h"
|
||||||
#include "MainWidgets/messageWindow.h"
|
#include "MainWidgets/messageWindow.h"
|
||||||
|
#include "MainWindow.h"
|
||||||
|
#include "MainWindow/SARibbonMWUi.h"
|
||||||
#include "PythonModule/PyAgent.h"
|
#include "PythonModule/PyAgent.h"
|
||||||
|
#include "SARibbonBar/SARibbonBar.h"
|
||||||
|
#include "SARibbonBar/SARibbonCategory.h"
|
||||||
|
#include "SARibbonBar/SARibbonMainWindow.h"
|
||||||
#include "Settings/BusAPI.h"
|
#include "Settings/BusAPI.h"
|
||||||
#include "IO/IOConfig.h"
|
#include "SignalHandler.h"
|
||||||
|
#include "SubWindowManager.h"
|
||||||
|
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
#include <QToolBar>
|
#include <QDebug>
|
||||||
#include <QMenuBar>
|
#include <QMenuBar>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QDebug>
|
#include <QToolBar>
|
||||||
#include "SARibbonBar/SARibbonMainWindow.h"
|
|
||||||
#include "SARibbonBar/SARibbonCategory.h"
|
|
||||||
#include "MainWindow/SARibbonMWUi.h"
|
|
||||||
#include "SARibbonBar/SARibbonBar.h"
|
|
||||||
|
|
||||||
namespace GUI
|
namespace GUI {
|
||||||
{
|
CustomizerHelper::CustomizerHelper(MainWindow* m, Ui::MainWindowRibbon* ui)
|
||||||
CustomizerHelper::CustomizerHelper(MainWindow *m, Ui::MainWindowRibbon *ui)
|
: _mainWindow(m)
|
||||||
: _mainWindow(m), _ui(ui)
|
, _ui(ui)
|
||||||
{
|
{
|
||||||
if (!isUseRibbon())
|
if(!isUseRibbon()) {
|
||||||
{
|
|
||||||
_menuList.append(_ui->menuFile);
|
_menuList.append(_ui->menuFile);
|
||||||
_menuList.append(_ui->menuView);
|
_menuList.append(_ui->menuView);
|
||||||
_menuList.append(_ui->menuGeometry);
|
_menuList.append(_ui->menuGeometry);
|
||||||
|
@ -67,28 +68,23 @@ namespace GUI
|
||||||
void CustomizerHelper::startCustomizer()
|
void CustomizerHelper::startCustomizer()
|
||||||
{
|
{
|
||||||
qDebug() << "mainWindow start cus";
|
qDebug() << "mainWindow start cus";
|
||||||
if (!isUseRibbon())
|
if(!isUseRibbon()) {
|
||||||
{
|
for(QToolBar* tb : _toolBarList)
|
||||||
for (QToolBar *tb : _toolBarList)
|
|
||||||
tb->setVisible(false);
|
tb->setVisible(false);
|
||||||
|
|
||||||
for (QMenu *me : _menuList)
|
for(QMenu* me : _menuList) {
|
||||||
{
|
QList<QAction*> acs = me->findChildren<QAction*>();
|
||||||
QList<QAction *> acs = me->findChildren<QAction *>();
|
for(auto a : acs)
|
||||||
for (auto a : acs)
|
|
||||||
a->setVisible(false);
|
a->setVisible(false);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
QList<SARibbonPannel*> pannels = _ui->home_page->pannelList();
|
||||||
{
|
|
||||||
QList<SARibbonPannel *> pannels = _ui->home_page->pannelList();
|
|
||||||
pannels += _ui->geometry_page->pannelList();
|
pannels += _ui->geometry_page->pannelList();
|
||||||
pannels += _ui->mesh_page->pannelList();
|
pannels += _ui->mesh_page->pannelList();
|
||||||
pannels += _ui->solve_page->pannelList();
|
pannels += _ui->solve_page->pannelList();
|
||||||
pannels += _ui->window_page->pannelList();
|
pannels += _ui->window_page->pannelList();
|
||||||
pannels += _ui->help_page->pannelList();
|
pannels += _ui->help_page->pannelList();
|
||||||
for (SARibbonPannel *pannel : pannels)
|
for(SARibbonPannel* pannel : pannels) {
|
||||||
{
|
|
||||||
// modify false -> true
|
// modify false -> true
|
||||||
pannel->setVisible(true);
|
pannel->setVisible(true);
|
||||||
}
|
}
|
||||||
|
@ -103,28 +99,24 @@ namespace GUI
|
||||||
void CustomizerHelper::finishCustomizer()
|
void CustomizerHelper::finishCustomizer()
|
||||||
{
|
{
|
||||||
qDebug() << "mainWindow finish cus";
|
qDebug() << "mainWindow finish cus";
|
||||||
if (!isUseRibbon())
|
if(!isUseRibbon()) {
|
||||||
{
|
for(QToolBar* tb : _toolBarList)
|
||||||
for (QToolBar *tb : _toolBarList)
|
|
||||||
tb->setVisible(true);
|
tb->setVisible(true);
|
||||||
|
|
||||||
for (QMenu *me : _menuList)
|
for(QMenu* me : _menuList) {
|
||||||
{
|
QList<QAction*> acs = me->findChildren<QAction*>();
|
||||||
QList<QAction *> acs = me->findChildren<QAction *>();
|
for(auto a : acs)
|
||||||
for (auto a : acs)
|
|
||||||
a->setVisible(true);
|
a->setVisible(true);
|
||||||
}
|
}
|
||||||
_ui->SketchToolBar->setVisible(false);
|
_ui->SketchToolBar->setVisible(false);
|
||||||
}
|
} else {
|
||||||
else
|
QList<SARibbonPannel*> pannels = _ui->home_page->pannelList();
|
||||||
{
|
|
||||||
QList<SARibbonPannel *> pannels = _ui->home_page->pannelList();
|
|
||||||
pannels += _ui->geometry_page->pannelList();
|
pannels += _ui->geometry_page->pannelList();
|
||||||
pannels += _ui->mesh_page->pannelList();
|
pannels += _ui->mesh_page->pannelList();
|
||||||
pannels += _ui->solve_page->pannelList();
|
pannels += _ui->solve_page->pannelList();
|
||||||
pannels += _ui->window_page->pannelList();
|
pannels += _ui->window_page->pannelList();
|
||||||
pannels += _ui->help_page->pannelList();
|
pannels += _ui->help_page->pannelList();
|
||||||
for (SARibbonPannel *pannel : pannels)
|
for(SARibbonPannel* pannel : pannels)
|
||||||
pannel->setVisible(true);
|
pannel->setVisible(true);
|
||||||
}
|
}
|
||||||
_mainWindow->getControlPanel()->setVisible(true);
|
_mainWindow->getControlPanel()->setVisible(true);
|
||||||
|
@ -135,8 +127,7 @@ namespace GUI
|
||||||
bool CustomizerHelper::isUseRibbon() const
|
bool CustomizerHelper::isUseRibbon() const
|
||||||
{
|
{
|
||||||
// SARibbonMainWindow* ribbonwindow = qobject_cast<SARibbonMainWindow*>(_mainWindow);
|
// SARibbonMainWindow* ribbonwindow = qobject_cast<SARibbonMainWindow*>(_mainWindow);
|
||||||
if (_mainWindow != nullptr)
|
if(_mainWindow != nullptr) {
|
||||||
{
|
|
||||||
return _mainWindow->isUseRibbon();
|
return _mainWindow->isUseRibbon();
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -145,20 +136,19 @@ namespace GUI
|
||||||
void CustomizerHelper::registerInterface()
|
void CustomizerHelper::registerInterface()
|
||||||
{
|
{
|
||||||
QString error = this->readConfigOptions();
|
QString error = this->readConfigOptions();
|
||||||
if (!error.isEmpty())
|
if(!error.isEmpty()) {
|
||||||
{
|
// QMessageBox::StandardButton b = QMessageBox::critical(_mainWindow, "Error",
|
||||||
// QMessageBox::StandardButton b = QMessageBox::critical(_mainWindow, "Error", QObject::tr("Error Occured %1 ! still continue?").arg(error), QMessageBox::Yes | QMessageBox::No);
|
// QObject::tr("Error Occured %1 ! still continue?").arg(error), QMessageBox::Yes |
|
||||||
// if (b == QMessageBox::No) return;
|
// QMessageBox::No); if (b == QMessageBox::No) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this->updateBasicInfo();
|
this->updateBasicInfo();
|
||||||
|
|
||||||
ConfigOption::ConfigOption *option = ConfigOption::ConfigOption::getInstance();
|
ConfigOption::ConfigOption* option = ConfigOption::ConfigOption::getInstance();
|
||||||
ConfigOption::GeometryConfig *geometryOption = option->getGeometryConfig();
|
ConfigOption::GeometryConfig* geometryOption = option->getGeometryConfig();
|
||||||
ConfigOption::MeshConfig *meshOption = option->getMeshConfig();
|
ConfigOption::MeshConfig* meshOption = option->getMeshConfig();
|
||||||
|
|
||||||
if (!isUseRibbon())
|
if(!isUseRibbon()) {
|
||||||
{
|
|
||||||
bool ok = geometryOption->isImportGeometryEnabled();
|
bool ok = geometryOption->isImportGeometryEnabled();
|
||||||
this->enableGeoImport(ok);
|
this->enableGeoImport(ok);
|
||||||
ok = geometryOption->isExportGeometryEnabled();
|
ok = geometryOption->isExportGeometryEnabled();
|
||||||
|
@ -176,10 +166,10 @@ namespace GUI
|
||||||
ok = geometryOption->isGeometryCreateSetEnabled();
|
ok = geometryOption->isGeometryCreateSetEnabled();
|
||||||
_ui->actionCreateGeoComponent->setVisible(ok);
|
_ui->actionCreateGeoComponent->setVisible(ok);
|
||||||
|
|
||||||
ok = meshOption->isImportMeshEnabled();
|
ok = meshOption->isImportMeshEnabled();
|
||||||
const QStringList plgsin = IO::IOConfigure::getMeshImporters();
|
const QStringList plgsin = IO::IOConfigure::getMeshImporters();
|
||||||
this->enableMeshImport(ok || (!plgsin.isEmpty()));
|
this->enableMeshImport(ok || (!plgsin.isEmpty()));
|
||||||
ok = meshOption->isExportMeshEnabled();
|
ok = meshOption->isExportMeshEnabled();
|
||||||
const QStringList plgsex = IO::IOConfigure::getMeshExporters();
|
const QStringList plgsex = IO::IOConfigure::getMeshExporters();
|
||||||
this->enableMeshExport(ok || (!plgsex.isEmpty()));
|
this->enableMeshExport(ok || (!plgsex.isEmpty()));
|
||||||
ok = meshOption->isSolidMeshEnabled();
|
ok = meshOption->isSolidMeshEnabled();
|
||||||
|
@ -212,9 +202,7 @@ namespace GUI
|
||||||
_ui->SelectToolBar->setVisible(geoEnable || meshEnable);
|
_ui->SelectToolBar->setVisible(geoEnable || meshEnable);
|
||||||
_ui->DisplayToolBar->setVisible(geoEnable || meshEnable);
|
_ui->DisplayToolBar->setVisible(geoEnable || meshEnable);
|
||||||
// qApp->processEvents();
|
// qApp->processEvents();
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
// ribbon的设置方式
|
// ribbon的设置方式
|
||||||
}
|
}
|
||||||
_mainWindow->getControlPanel()->registerEnabledModule();
|
_mainWindow->getControlPanel()->registerEnabledModule();
|
||||||
|
@ -224,41 +212,39 @@ namespace GUI
|
||||||
|
|
||||||
QString CustomizerHelper::readConfigOptions()
|
QString CustomizerHelper::readConfigOptions()
|
||||||
{
|
{
|
||||||
QString error{};
|
QString error{};
|
||||||
// bool ok = false;
|
// bool ok = false;
|
||||||
QString path = qApp->applicationDirPath();
|
QString path = qApp->applicationDirPath();
|
||||||
ConfigOption::ConfigDataReader reader(path + "/../ConfigFiles/", ConfigOption::ConfigOption::getInstance());
|
ConfigOption::ConfigDataReader reader(path + "/../ConfigFiles/",
|
||||||
|
ConfigOption::ConfigOption::getInstance());
|
||||||
error = reader.read();
|
error = reader.read();
|
||||||
|
|
||||||
if (!error.isEmpty())
|
if(!error.isEmpty())
|
||||||
error.resize(error.size() - 1);
|
error.resize(error.size() - 1);
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CustomizerHelper::updateBasicInfo()
|
void CustomizerHelper::updateBasicInfo()
|
||||||
{
|
{
|
||||||
ConfigOption::ConfigOption *options = ConfigOption::ConfigOption::getInstance();
|
ConfigOption::ConfigOption* options = ConfigOption::ConfigOption::getInstance();
|
||||||
ConfigOption::GlobalConfig *globalConfig = options->getGlobalConfig();
|
ConfigOption::GlobalConfig* globalConfig = options->getGlobalConfig();
|
||||||
|
|
||||||
const QString lang = Setting::BusAPI::instance()->getLanguage();
|
const QString lang = Setting::BusAPI::instance()->getLanguage();
|
||||||
QString softName = "FastCAE";
|
QString softName = "FastCAE";
|
||||||
if (lang.toLower() == "chinese")
|
if(lang.toLower() == "chinese") {
|
||||||
{
|
|
||||||
QString f = globalConfig->getChineseName();
|
QString f = globalConfig->getChineseName();
|
||||||
if (!f.isEmpty())
|
if(!f.isEmpty())
|
||||||
softName = f;
|
softName = f;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
QString f = globalConfig->getSoftName();
|
QString f = globalConfig->getSoftName();
|
||||||
if (!f.isEmpty())
|
if(!f.isEmpty())
|
||||||
softName = f;
|
softName = f;
|
||||||
}
|
}
|
||||||
_mainWindow->setWindowTitle(softName);
|
_mainWindow->setWindowTitle(softName);
|
||||||
|
|
||||||
const QString logoname = globalConfig->getLogo();
|
const QString logoname = globalConfig->getLogo();
|
||||||
QString path = qApp->applicationDirPath();
|
QString path = qApp->applicationDirPath();
|
||||||
const QString logo = path + "/../ConfigFiles/icon/" + logoname;
|
const QString logo = path + "/../ConfigFiles/icon/" + logoname;
|
||||||
qDebug() << logo;
|
qDebug() << logo;
|
||||||
_mainWindow->setIcon(logo);
|
_mainWindow->setIcon(logo);
|
||||||
}
|
}
|
||||||
|
@ -275,10 +261,9 @@ namespace GUI
|
||||||
|
|
||||||
void CustomizerHelper::enableGeoSketch(bool on)
|
void CustomizerHelper::enableGeoSketch(bool on)
|
||||||
{
|
{
|
||||||
if (isUseRibbon())
|
if(isUseRibbon())
|
||||||
_ui->sketch_pannel_geometry->setVisible(on);
|
_ui->sketch_pannel_geometry->setVisible(on);
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
_ui->menuSketch->setEnabled(on);
|
_ui->menuSketch->setEnabled(on);
|
||||||
_ui->StartSketchToolBar->setVisible(on);
|
_ui->StartSketchToolBar->setVisible(on);
|
||||||
}
|
}
|
||||||
|
@ -286,14 +271,11 @@ namespace GUI
|
||||||
|
|
||||||
void CustomizerHelper::enableGeoFeatureModeling(bool on)
|
void CustomizerHelper::enableGeoFeatureModeling(bool on)
|
||||||
{
|
{
|
||||||
if (isUseRibbon())
|
if(isUseRibbon()) {
|
||||||
{
|
|
||||||
_ui->cube_pannel->setVisible(on);
|
_ui->cube_pannel->setVisible(on);
|
||||||
_ui->create_point_pannel->setVisible(on);
|
_ui->create_point_pannel->setVisible(on);
|
||||||
_ui->base_plate_pannel->setVisible(on);
|
_ui->base_plate_pannel->setVisible(on);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
_ui->menuFeature_Modeling->setEnabled(on);
|
_ui->menuFeature_Modeling->setEnabled(on);
|
||||||
_ui->GeomertryFeatureToolBar->setVisible(on);
|
_ui->GeomertryFeatureToolBar->setVisible(on);
|
||||||
}
|
}
|
||||||
|
@ -301,14 +283,11 @@ namespace GUI
|
||||||
|
|
||||||
void CustomizerHelper::enableGeoFeatureOperate(bool on)
|
void CustomizerHelper::enableGeoFeatureOperate(bool on)
|
||||||
{
|
{
|
||||||
if (isUseRibbon())
|
if(isUseRibbon()) {
|
||||||
{
|
|
||||||
_ui->chamfer_pannel->setVisible(on);
|
_ui->chamfer_pannel->setVisible(on);
|
||||||
_ui->sum_pannel->setVisible(on);
|
_ui->sum_pannel->setVisible(on);
|
||||||
_ui->stretch_pannel->setVisible(on);
|
_ui->stretch_pannel->setVisible(on);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
_ui->menuFeature_Operation->setEnabled(on);
|
_ui->menuFeature_Operation->setEnabled(on);
|
||||||
_ui->ChamferToolBar->setVisible(on);
|
_ui->ChamferToolBar->setVisible(on);
|
||||||
_ui->BoolToolBar->setVisible(on);
|
_ui->BoolToolBar->setVisible(on);
|
||||||
|
@ -318,8 +297,7 @@ namespace GUI
|
||||||
|
|
||||||
void CustomizerHelper::enableGeoSelectAndView(bool on)
|
void CustomizerHelper::enableGeoSelectAndView(bool on)
|
||||||
{
|
{
|
||||||
if (!isUseRibbon())
|
if(!isUseRibbon()) {
|
||||||
{
|
|
||||||
_ui->menuSelect_2->setEnabled(on);
|
_ui->menuSelect_2->setEnabled(on);
|
||||||
_ui->menuView_3->setEnabled(on);
|
_ui->menuView_3->setEnabled(on);
|
||||||
}
|
}
|
||||||
|
@ -365,8 +343,7 @@ namespace GUI
|
||||||
|
|
||||||
void CustomizerHelper::enableMeshSelectAndView(bool on)
|
void CustomizerHelper::enableMeshSelectAndView(bool on)
|
||||||
{
|
{
|
||||||
if (!isUseRibbon())
|
if(!isUseRibbon()) {
|
||||||
{
|
|
||||||
_ui->menuView_2->setEnabled(on);
|
_ui->menuView_2->setEnabled(on);
|
||||||
_ui->menuSelect->setEnabled(on);
|
_ui->menuSelect->setEnabled(on);
|
||||||
}
|
}
|
||||||
|
@ -381,4 +358,4 @@ namespace GUI
|
||||||
_ui->actionBoxMeshNode->setVisible(on);
|
_ui->actionBoxMeshNode->setVisible(on);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
} // namespace GUI
|
|
@ -0,0 +1,63 @@
|
||||||
|
#ifndef CUSTOMIZERHELPER_H_
|
||||||
|
#define CUSTOMIZERHELPER_H_
|
||||||
|
|
||||||
|
#include "MainWindowAPI.h"
|
||||||
|
|
||||||
|
#include <QList>
|
||||||
|
#include <QObject>
|
||||||
|
|
||||||
|
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<QMenu*> _menuList{};
|
||||||
|
QList<QToolBar*> _toolBarList{};
|
||||||
|
};
|
||||||
|
} // namespace GUI
|
||||||
|
|
||||||
|
#endif
|
File diff suppressed because it is too large
Load Diff
|
@ -23,14 +23,15 @@
|
||||||
#ifndef _MAINWINDOW_H_
|
#ifndef _MAINWINDOW_H_
|
||||||
#define _MAINWINDOW_H_
|
#define _MAINWINDOW_H_
|
||||||
|
|
||||||
#include "mainWindowAPI.h"
|
#include "Common/Types.h"
|
||||||
#include <QMainWindow>
|
#include "MainWindowAPI.h"
|
||||||
|
#include "ModuleBase/messageWindowBase.h"
|
||||||
|
#include "SARibbonBar/SARibbonMainWindow.h"
|
||||||
|
|
||||||
#include <QHash>
|
#include <QHash>
|
||||||
|
#include <QMainWindow>
|
||||||
#include <QPair>
|
#include <QPair>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include "ModuleBase/messageWindowBase.h"
|
|
||||||
#include "Common/Types.h"
|
|
||||||
#include "SARibbonBar/SARibbonMainWindow.h"
|
|
||||||
// ribbon customize
|
// ribbon customize
|
||||||
#include "SARibbonBar/SARibbonActionsManager.h"
|
#include "SARibbonBar/SARibbonActionsManager.h"
|
||||||
#include "SARibbonBar/SARibbonCustomizeWidget.h"
|
#include "SARibbonBar/SARibbonCustomizeWidget.h"
|
||||||
|
@ -49,50 +50,42 @@ class SARibbonCategory;
|
||||||
// ribbon customize
|
// ribbon customize
|
||||||
class SARibbonActionsManager;
|
class SARibbonActionsManager;
|
||||||
|
|
||||||
namespace Ui
|
namespace Ui {
|
||||||
{
|
|
||||||
class MainWindow;
|
class MainWindow;
|
||||||
class MainWindowRibbon;
|
class MainWindowRibbon;
|
||||||
}
|
} // namespace Ui
|
||||||
|
|
||||||
namespace DataProperty
|
namespace DataProperty {
|
||||||
{
|
|
||||||
class DataBase;
|
class DataBase;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace MeshData
|
namespace MeshData {
|
||||||
{
|
|
||||||
class MeshSet;
|
class MeshSet;
|
||||||
class MeshKernal;
|
class MeshKernal;
|
||||||
}
|
} // namespace MeshData
|
||||||
|
|
||||||
namespace Geometry
|
namespace Geometry {
|
||||||
{
|
|
||||||
class GeometrySet;
|
class GeometrySet;
|
||||||
class GeoComponent;
|
class GeoComponent;
|
||||||
}
|
} // namespace Geometry
|
||||||
|
|
||||||
namespace MainWidget
|
namespace MainWidget {
|
||||||
{
|
|
||||||
class ControlPanel;
|
class ControlPanel;
|
||||||
class MessageWindow;
|
class MessageWindow;
|
||||||
class ProcessWindow;
|
class ProcessWindow;
|
||||||
class PreWindow;
|
class PreWindow;
|
||||||
}
|
} // namespace MainWidget
|
||||||
|
|
||||||
namespace Post
|
namespace Post {
|
||||||
{
|
|
||||||
class PostWindowBase;
|
class PostWindowBase;
|
||||||
class RealTimeWindowBase;
|
class RealTimeWindowBase;
|
||||||
class AnimationToolBar;
|
class AnimationToolBar;
|
||||||
}
|
} // namespace Post
|
||||||
|
|
||||||
namespace XReport
|
namespace XReport {
|
||||||
{
|
|
||||||
class ReportWindow;
|
class ReportWindow;
|
||||||
}
|
}
|
||||||
namespace GUI
|
namespace GUI {
|
||||||
{
|
|
||||||
class SubWindowManager;
|
class SubWindowManager;
|
||||||
class SignalHandler;
|
class SignalHandler;
|
||||||
class Translator;
|
class Translator;
|
||||||
|
@ -102,8 +95,7 @@ namespace GUI
|
||||||
* @note 该类继承自SARibbonMainWindow,具体请参考https://gitee.com/czyt1988/SARibbon
|
* @note 该类继承自SARibbonMainWindow,具体请参考https://gitee.com/czyt1988/SARibbon
|
||||||
* @since 2.5.0
|
* @since 2.5.0
|
||||||
*/
|
*/
|
||||||
class MAINWINDOWAPI MainWindow : public SARibbonMainWindow
|
class MAINWINDOWAPI MainWindow : public SARibbonMainWindow {
|
||||||
{
|
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
friend CustomizerHelper;
|
friend CustomizerHelper;
|
||||||
friend SignalHandler;
|
friend SignalHandler;
|
||||||
|
@ -125,40 +117,41 @@ namespace GUI
|
||||||
* @return Ui::MainWindowRibbon* 返回Ui
|
* @return Ui::MainWindowRibbon* 返回Ui
|
||||||
* @since 2.5.0
|
* @since 2.5.0
|
||||||
*/
|
*/
|
||||||
Ui::MainWindowRibbon *getUi();
|
Ui::MainWindowRibbon* getUi();
|
||||||
//获取翻译
|
// 获取翻译
|
||||||
Translator *GetTranslator();
|
Translator* GetTranslator();
|
||||||
QString getMD5();
|
QString getMD5();
|
||||||
void setMD5(const QString &md5);
|
void setMD5(const QString& md5);
|
||||||
//设置当前文件
|
// 设置当前文件
|
||||||
void setCurrentFile(const QString &file);
|
void setCurrentFile(const QString& file);
|
||||||
//清空关闭所有窗口
|
// 清空关闭所有窗口
|
||||||
void clearWidgets();
|
void clearWidgets();
|
||||||
SubWindowManager *getSubWindowManager();
|
SubWindowManager* getSubWindowManager();
|
||||||
CustomizerHelper *getCustomizerHelper();
|
CustomizerHelper* getCustomizerHelper();
|
||||||
SignalHandler *getSignalHandler();
|
SignalHandler* getSignalHandler();
|
||||||
//获取控制面板
|
// 获取控制面板
|
||||||
MainWidget::ControlPanel *getControlPanel();
|
MainWidget::ControlPanel* getControlPanel();
|
||||||
//获取控制台
|
// 获取控制台
|
||||||
MainWidget::MessageWindow *getMessageWindow();
|
MainWidget::MessageWindow* getMessageWindow();
|
||||||
//更新recentMenu
|
// 更新recentMenu
|
||||||
void updateRecentMenu();
|
void updateRecentMenu();
|
||||||
// action状态控制
|
// action状态控制
|
||||||
void setActionVisible(QString objname, bool enable);
|
void setActionVisible(QString objname, bool enable);
|
||||||
//设置图标
|
// 设置图标
|
||||||
void setIcon(QString iconPath);
|
void setIcon(QString iconPath);
|
||||||
//根据object name 获取action
|
// 根据object name 获取action
|
||||||
QAction *getAction(QString &objName);
|
QAction* getAction(QString& objName);
|
||||||
//根据object name 获取toolbar
|
// 根据object name 获取toolbar
|
||||||
QToolBar *getToolBar(QString &objName);
|
QToolBar* getToolBar(QString& objName);
|
||||||
//根据object name 获取menu
|
// 根据object name 获取menu
|
||||||
QMenu *getMenu(QString &objName);
|
QMenu* getMenu(QString& objName);
|
||||||
QPair<QWidget *, QList<QAction *>> createWidgetAndAction(const QString &title, const QStringList &actionStrs);
|
QPair<QWidget*, QList<QAction*>> createWidgetAndAction(const QString& title,
|
||||||
|
const QStringList& actionStrs);
|
||||||
|
|
||||||
Post::AnimationToolBar *getAnimationToolBar();
|
Post::AnimationToolBar* getAnimationToolBar();
|
||||||
|
|
||||||
// Ribbon Customize
|
// Ribbon Customize
|
||||||
SARibbonActionsManager *getActionManager();
|
SARibbonActionsManager* getActionManager();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
/*更新注册接口*/
|
/*更新注册接口*/
|
||||||
|
@ -168,10 +161,10 @@ namespace GUI
|
||||||
/*显示装状态栏绘图范围*/
|
/*显示装状态栏绘图范围*/
|
||||||
void showGraphRangeSig(double, double);
|
void showGraphRangeSig(double, double);
|
||||||
/*模型树点击事件 鼠标信号,eventType 0- 左键单机,1-右键单击,2- 左键双击 */
|
/*模型树点击事件 鼠标信号,eventType 0- 左键单机,1-右键单击,2- 左键双击 */
|
||||||
void treeMouseEvent(int eventType, QTreeWidgetItem *item, int projectID);
|
void treeMouseEvent(int eventType, QTreeWidgetItem* item, int projectID);
|
||||||
/*更新模型树信号 */
|
/*更新模型树信号 */
|
||||||
void updatePhysicsTreeSignal();
|
void updatePhysicsTreeSignal();
|
||||||
//更新材料信号
|
// 更新材料信号
|
||||||
void updateMaterialTreeSig();
|
void updateMaterialTreeSig();
|
||||||
/*打印输出信息 */
|
/*打印输出信息 */
|
||||||
void printMessageToMessageWindow(QString message);
|
void printMessageToMessageWindow(QString message);
|
||||||
|
@ -188,15 +181,15 @@ namespace GUI
|
||||||
/*暂停求解 */
|
/*暂停求解 */
|
||||||
void pauseSolve();
|
void pauseSolve();
|
||||||
/*终止求解 */
|
/*终止求解 */
|
||||||
void stopSolve(QWidget *w);
|
void stopSolve(QWidget* w);
|
||||||
/*添加进度条 */
|
/*添加进度条 */
|
||||||
void addProcessBarSig(QWidget *w);
|
void addProcessBarSig(QWidget* w);
|
||||||
//求解进程结束
|
// 求解进程结束
|
||||||
void processFinished(int pid);
|
void processFinished(int pid);
|
||||||
|
|
||||||
/****几何相关信号**** */
|
/****几何相关信号**** */
|
||||||
void startSketchSig(bool start, double *loc, double *dir);
|
void startSketchSig(bool start, double* loc, double* dir);
|
||||||
//清除所有高亮
|
// 清除所有高亮
|
||||||
void clearAllHighLight();
|
void clearAllHighLight();
|
||||||
/*刷新几何树 */
|
/*刷新几何树 */
|
||||||
void importGeometrySig(QStringList f);
|
void importGeometrySig(QStringList f);
|
||||||
|
@ -204,92 +197,93 @@ namespace GUI
|
||||||
void updateGeometryTreeSig();
|
void updateGeometryTreeSig();
|
||||||
void updateGeoDispalyStateSig(int index, bool display);
|
void updateGeoDispalyStateSig(int index, bool display);
|
||||||
void removeGeometryActorSig(int index);
|
void removeGeometryActorSig(int index);
|
||||||
void highLightGeometrySetSig(Geometry::GeometrySet *s, bool on);
|
void highLightGeometrySetSig(Geometry::GeometrySet* s, bool on);
|
||||||
/****网格相关信号***** */
|
/****网格相关信号***** */
|
||||||
void importMeshByNamesSig(QString name);
|
void importMeshByNamesSig(QString name);
|
||||||
void importMeshDataSetSig(vtkDataSet *dataset);
|
void importMeshDataSetSig(vtkDataSet* dataset);
|
||||||
// void exportMeshByIDSig(QString fileName, QString suffix, int kID);
|
// void exportMeshByIDSig(QString fileName, QString suffix, int kID);
|
||||||
void editMeshSig(int dim, int kindex);
|
void editMeshSig(int dim, int kindex);
|
||||||
void updateMeshTreeSig();
|
void updateMeshTreeSig();
|
||||||
void updateSetTreeSig();
|
void updateSetTreeSig();
|
||||||
void updateMeshDispalyStateSig(int index, bool display);
|
void updateMeshDispalyStateSig(int index, bool display);
|
||||||
void updateMeshSetVisibleSig(MeshData::MeshSet *);
|
void updateMeshSetVisibleSig(MeshData::MeshSet*);
|
||||||
void removeMeshActorSig(int index);
|
void removeMeshActorSig(int index);
|
||||||
void removeSetDataSig(int index);
|
void removeSetDataSig(int index);
|
||||||
void highLightSetSig(MeshData::MeshSet *set);
|
void highLightSetSig(MeshData::MeshSet* set);
|
||||||
void highLightGeoComponentSig(Geometry::GeoComponent *);
|
void highLightGeoComponentSig(Geometry::GeoComponent*);
|
||||||
void highLightKernelSig(MeshData::MeshKernal *k);
|
void highLightKernelSig(MeshData::MeshKernal* k);
|
||||||
void highLightDataSetSig(vtkDataSet *dataset);
|
void highLightDataSetSig(vtkDataSet* dataset);
|
||||||
|
|
||||||
void updateMeshSetColorSig(int setID);
|
void updateMeshSetColorSig(int setID);
|
||||||
|
|
||||||
//清空数据
|
// 清空数据
|
||||||
void clearDataSig();
|
void clearDataSig();
|
||||||
///更新前处理窗口所有几何网格Actor
|
/// 更新前处理窗口所有几何网格Actor
|
||||||
// void updatePreActors();
|
// void updatePreActors();
|
||||||
/*创建物理模型 */
|
/*创建物理模型 */
|
||||||
void createPhysiceModelSig();
|
void createPhysiceModelSig();
|
||||||
/*更新属性框 */
|
/*更新属性框 */
|
||||||
void updateProperty(DataProperty::DataBase *data);
|
void updateProperty(DataProperty::DataBase* data);
|
||||||
//更新参数窗口
|
// 更新参数窗口
|
||||||
void updateParaWidget(QWidget *w);
|
void updateParaWidget(QWidget* w);
|
||||||
///关闭前处理窗口
|
/// 关闭前处理窗口
|
||||||
void closePreWindowSig();
|
void closePreWindowSig();
|
||||||
///打开后处理窗口
|
/// 打开后处理窗口
|
||||||
void openPostWindowSig(Post::PostWindowBase *pw);
|
void openPostWindowSig(Post::PostWindowBase* pw);
|
||||||
///打开实时曲线窗口,
|
/// 打开实时曲线窗口,
|
||||||
void openRealTimeWindowSig(Post::RealTimeWindowBase *w, int proID);
|
void openRealTimeWindowSig(Post::RealTimeWindowBase* w, int proID);
|
||||||
///展示后处理窗口
|
/// 展示后处理窗口
|
||||||
void showPostWindowInfoSig(int id, int type);
|
void showPostWindowInfoSig(int id, int type);
|
||||||
///关闭后处理窗口
|
/// 关闭后处理窗口
|
||||||
void closePostWindowSig(Post::PostWindowBase *w);
|
void closePostWindowSig(Post::PostWindowBase* w);
|
||||||
///关闭实时曲线窗口
|
/// 关闭实时曲线窗口
|
||||||
void closeRealTimeWindowSig(Post::RealTimeWindowBase *w);
|
void closeRealTimeWindowSig(Post::RealTimeWindowBase* w);
|
||||||
///更新实时曲线窗口
|
/// 更新实时曲线窗口
|
||||||
void updateRealTimePlotSig(QString fileName);
|
void updateRealTimePlotSig(QString fileName);
|
||||||
///切换选择模式
|
/// 切换选择模式
|
||||||
void selectModelChangedSig(int i);
|
void selectModelChangedSig(int i);
|
||||||
///切换网格显示模式
|
/// 切换网格显示模式
|
||||||
void meshDisplayModeChangedSig();
|
void meshDisplayModeChangedSig();
|
||||||
///切换几何显示模型
|
/// 切换几何显示模型
|
||||||
// void displayGeometryChangedSig(QString mode);
|
// void displayGeometryChangedSig(QString mode);
|
||||||
///求解项目
|
/// 求解项目
|
||||||
void solveProjectSig(int proIndex, int solverIndex);
|
void solveProjectSig(int proIndex, int solverIndex);
|
||||||
//添加新生成网格
|
// 添加新生成网格
|
||||||
void appendGeneratedMesh(QString name, vtkDataSet *dataset);
|
void appendGeneratedMesh(QString name, vtkDataSet* dataset);
|
||||||
//显示报告窗口
|
// 显示报告窗口
|
||||||
void openReportWindowSig(XReport::ReportWindow *w);
|
void openReportWindowSig(XReport::ReportWindow* w);
|
||||||
//关闭报告窗口
|
// 关闭报告窗口
|
||||||
void closeReportWindowSig(XReport::ReportWindow *w);
|
void closeReportWindowSig(XReport::ReportWindow* w);
|
||||||
///设置键盘事件
|
/// 设置键盘事件
|
||||||
void enableGraphWindowKeyBoard(bool on);
|
void enableGraphWindowKeyBoard(bool on);
|
||||||
///更新Action状态
|
/// 更新Action状态
|
||||||
// void updateActionStatesSig();
|
// void updateActionStatesSig();
|
||||||
void updatePreMeshActorSig();
|
void updatePreMeshActorSig();
|
||||||
void updatePreGeometryActorSig(); //徐文强2020/6/4添加
|
void updatePreGeometryActorSig(); // 徐文强2020/6/4添加
|
||||||
///根据绘图设置更新绘图
|
/// 根据绘图设置更新绘图
|
||||||
void updateGraphOptionsSig();
|
void updateGraphOptionsSig();
|
||||||
//保存图片 winType 0- 前处理窗口 1-后处理 Wintype为前处理时winhandle可任意
|
// 保存图片 winType 0- 前处理窗口 1-后处理 Wintype为前处理时winhandle可任意
|
||||||
void saveImageSig(QString fileName, int winType, Post::PostWindowBase *winhandle, int w, int h);
|
void saveImageSig(QString fileName, int winType, Post::PostWindowBase* winhandle, int w,
|
||||||
|
int h);
|
||||||
// //面网格划分
|
// //面网格划分
|
||||||
// void surfaceMeshSig(Geometry::GeometrySet*);
|
// void surfaceMeshSig(Geometry::GeometrySet*);
|
||||||
// //体网格划分
|
// //体网格划分
|
||||||
// void solidMeshSig(Geometry::GeometrySet*);
|
// void solidMeshSig(Geometry::GeometrySet*);
|
||||||
//保存图片
|
// 保存图片
|
||||||
void saveImage(int w, int h, QString file);
|
void saveImage(int w, int h, QString file);
|
||||||
//清除高亮
|
// 清除高亮
|
||||||
void clearHighLightSig();
|
void clearHighLightSig();
|
||||||
//前处理窗口打开
|
// 前处理窗口打开
|
||||||
void preWindowOpenedSig(MainWidget::PreWindow *p);
|
void preWindowOpenedSig(MainWidget::PreWindow* p);
|
||||||
//固定位置显示对话框
|
// 固定位置显示对话框
|
||||||
void showDialogSig(QDialog *);
|
void showDialogSig(QDialog*);
|
||||||
//记录几何显示控件状态
|
// 记录几何显示控件状态
|
||||||
void selectGeometryDisplay(bool, bool, bool);
|
void selectGeometryDisplay(bool, bool, bool);
|
||||||
//在几何上选取点、线、面。
|
// 在几何上选取点、线、面。
|
||||||
void selectGeometryModelChangedSig(int);
|
void selectGeometryModelChangedSig(int);
|
||||||
//更新工具栏状态
|
// 更新工具栏状态
|
||||||
void updateActionStatesSig();
|
void updateActionStatesSig();
|
||||||
//关闭主窗口
|
// 关闭主窗口
|
||||||
void closeMainWindow();
|
void closeMainWindow();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -298,23 +292,23 @@ namespace GUI
|
||||||
void updatePostTreeSig();
|
void updatePostTreeSig();
|
||||||
|
|
||||||
//
|
//
|
||||||
//更新二维曲线模型树
|
// 更新二维曲线模型树
|
||||||
void updatePlotTreeSig();
|
void updatePlotTreeSig();
|
||||||
|
|
||||||
//
|
//
|
||||||
//打开二维曲线绘制信号
|
// 打开二维曲线绘制信号
|
||||||
void openPlot();
|
void openPlot();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
/*状态栏显示信息 */
|
/*状态栏显示信息 */
|
||||||
void setStatusBarInfo(QString);
|
void setStatusBarInfo(QString);
|
||||||
///切换语言
|
/// 切换语言
|
||||||
void ChangeLanguage(QString lang);
|
void ChangeLanguage(QString lang);
|
||||||
///切换选择模式,改变工具栏选中状态
|
/// 切换选择模式,改变工具栏选中状态
|
||||||
void selectModelChanged(int model);
|
void selectModelChanged(int model);
|
||||||
//切换网格显示模式
|
// 切换网格显示模式
|
||||||
void setMeshDisplay();
|
void setMeshDisplay();
|
||||||
//切换几何显示模式
|
// 切换几何显示模式
|
||||||
void selectGeometryModelChanged(int m);
|
void selectGeometryModelChanged(int m);
|
||||||
void setGeometryDisplay();
|
void setGeometryDisplay();
|
||||||
// ///<MG 显示/隐藏 工具栏/菜单栏 中的某一菜单/某一项
|
// ///<MG 显示/隐藏 工具栏/菜单栏 中的某一菜单/某一项
|
||||||
|
@ -322,79 +316,79 @@ namespace GUI
|
||||||
|
|
||||||
void updatePreGeometryActor();
|
void updatePreGeometryActor();
|
||||||
void updatePreMeshActor();
|
void updatePreMeshActor();
|
||||||
///导入几何
|
/// 导入几何
|
||||||
void on_importGeometry();
|
void on_importGeometry();
|
||||||
///导出几何
|
/// 导出几何
|
||||||
void on_exportGeometry();
|
void on_exportGeometry();
|
||||||
//生成体网格
|
// 生成体网格
|
||||||
void on_solidMesh();
|
void on_solidMesh();
|
||||||
//生成面网格
|
// 生成面网格
|
||||||
void on_surfaceMesh();
|
void on_surfaceMesh();
|
||||||
//生成网格
|
// 生成网格
|
||||||
void on_genMesh();
|
void on_genMesh();
|
||||||
//打印信息
|
// 打印信息
|
||||||
void printMessage(Common::Message type, QString m);
|
void printMessage(Common::Message type, QString m);
|
||||||
//导入网格
|
// 导入网格
|
||||||
// void importMesh(QString fileName, QString s, int modelId);
|
// void importMesh(QString fileName, QString s, int modelId);
|
||||||
//导入几何
|
// 导入几何
|
||||||
void importGeometry(QStringList f);
|
void importGeometry(QStringList f);
|
||||||
//导出几何
|
// 导出几何
|
||||||
void exportGeometry(QString f);
|
void exportGeometry(QString f);
|
||||||
//更新工具栏信息
|
// 更新工具栏信息
|
||||||
// void updateActionsStates();
|
// void updateActionsStates();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
/*关闭主窗口 */
|
/*关闭主窗口 */
|
||||||
void closeWindow();
|
void closeWindow();
|
||||||
///新建项目
|
/// 新建项目
|
||||||
void on_actionNew();
|
void on_actionNew();
|
||||||
///打开工程文件
|
/// 打开工程文件
|
||||||
void on_actionOpen();
|
void on_actionOpen();
|
||||||
///保存工程文件
|
/// 保存工程文件
|
||||||
void on_actionSave();
|
void on_actionSave();
|
||||||
///工程文件另存为
|
/// 工程文件另存为
|
||||||
void on_actionSaveAs();
|
void on_actionSaveAs();
|
||||||
///导入网格
|
/// 导入网格
|
||||||
void on_importMesh();
|
void on_importMesh();
|
||||||
|
|
||||||
//导入网格
|
// 导入网格
|
||||||
void importMeshDataset(vtkDataSet *dataset);
|
void importMeshDataset(vtkDataSet* dataset);
|
||||||
//导出网格
|
// 导出网格
|
||||||
void on_exportMesh();
|
void on_exportMesh();
|
||||||
///设置工作目录
|
/// 设置工作目录
|
||||||
void setWorkingDir();
|
void setWorkingDir();
|
||||||
///启动求解器
|
/// 启动求解器
|
||||||
void on_solve();
|
void on_solve();
|
||||||
//单独工程求解
|
// 单独工程求解
|
||||||
void solveProject(int id);
|
void solveProject(int id);
|
||||||
///管理求解器
|
/// 管理求解器
|
||||||
void on_solverManager();
|
void on_solverManager();
|
||||||
///设置求解选项
|
/// 设置求解选项
|
||||||
void on_solveOption();
|
void on_solveOption();
|
||||||
//设置绘图选项
|
// 设置绘图选项
|
||||||
void on_graphOption();
|
void on_graphOption();
|
||||||
// About对话框
|
// About对话框
|
||||||
void on_about();
|
void on_about();
|
||||||
//打开用户手册
|
// 打开用户手册
|
||||||
void on_userManual();
|
void on_userManual();
|
||||||
//打开最近文件
|
// 打开最近文件
|
||||||
void openRencentFile(QString file);
|
void openRencentFile(QString file);
|
||||||
//创建组件(Set)
|
// 创建组件(Set)
|
||||||
void on_CreateSet();
|
void on_CreateSet();
|
||||||
void on_CreateGeoComponent();
|
void on_CreateGeoComponent();
|
||||||
//保存脚本
|
// 保存脚本
|
||||||
void on_SaveScript();
|
void on_SaveScript();
|
||||||
//执行脚本
|
// 执行脚本
|
||||||
void on_ExecuateScript();
|
void on_ExecuateScript();
|
||||||
//草绘点击
|
// 草绘点击
|
||||||
void on_sketchClicked();
|
void on_sketchClicked();
|
||||||
//显示窗口范围
|
// 显示窗口范围
|
||||||
void showGraphRange(double, double);
|
void showGraphRange(double, double);
|
||||||
//开始草绘
|
// 开始草绘
|
||||||
void startSketch(bool s);
|
void startSketch(bool s);
|
||||||
//网格过滤
|
// 网格过滤
|
||||||
void on_FilterMesh();
|
void on_FilterMesh();
|
||||||
//创建VTK空间变换窗口
|
// 创建VTK空间变换窗口
|
||||||
void on_VTKTranslation();
|
void on_VTKTranslation();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -405,20 +399,20 @@ namespace GUI
|
||||||
void connectSignals();
|
void connectSignals();
|
||||||
/*注册模块 */
|
/*注册模块 */
|
||||||
void registerMoudel();
|
void registerMoudel();
|
||||||
///初始化工具栏
|
/// 初始化工具栏
|
||||||
void initToolBar();
|
void initToolBar();
|
||||||
/*重写QWidget虚函数 关闭主窗口事件 */
|
/*重写QWidget虚函数 关闭主窗口事件 */
|
||||||
void closeEvent(QCloseEvent *event) override;
|
void closeEvent(QCloseEvent* event) override;
|
||||||
|
|
||||||
//键盘按下事件
|
// 键盘按下事件
|
||||||
void keyPressEvent(QKeyEvent *e) override;
|
void keyPressEvent(QKeyEvent* e) override;
|
||||||
void keyReleaseEvent(QKeyEvent *e) override;
|
void keyReleaseEvent(QKeyEvent* e) override;
|
||||||
void showEvent(QShowEvent *e) override;
|
void showEvent(QShowEvent* e) override;
|
||||||
|
|
||||||
bool isLoadRecordScripFile();
|
bool isLoadRecordScripFile();
|
||||||
// ribbon
|
// ribbon
|
||||||
void setSketchPageVisible(bool visible);
|
void setSketchPageVisible(bool visible);
|
||||||
//切换到Ribbon 若ok为false则为一般模式
|
// 切换到Ribbon 若ok为false则为一般模式
|
||||||
void changeStyleToRibbon(bool ok);
|
void changeStyleToRibbon(bool ok);
|
||||||
//
|
//
|
||||||
void setPostAnimationToolBar(bool ribbon);
|
void setPostAnimationToolBar(bool ribbon);
|
||||||
|
@ -428,27 +422,27 @@ namespace GUI
|
||||||
* @brief ui
|
* @brief ui
|
||||||
* @since 2.5.0
|
* @since 2.5.0
|
||||||
*/
|
*/
|
||||||
Ui::MainWindowRibbon *_ui{};
|
Ui::MainWindowRibbon* _ui{};
|
||||||
/**
|
/**
|
||||||
* @brief 界面翻译对象
|
* @brief 界面翻译对象
|
||||||
* @since 2.5.0
|
* @since 2.5.0
|
||||||
*/
|
*/
|
||||||
Translator *_translator{};
|
Translator* _translator{};
|
||||||
/**
|
/**
|
||||||
* @brief 信号处理对象
|
* @brief 信号处理对象
|
||||||
* @since 2.5.0
|
* @since 2.5.0
|
||||||
*/
|
*/
|
||||||
SignalHandler *_signalHandler{};
|
SignalHandler* _signalHandler{};
|
||||||
/**
|
/**
|
||||||
* @brief 子窗口部件管理器对象
|
* @brief 子窗口部件管理器对象
|
||||||
* @since 2.5.0
|
* @since 2.5.0
|
||||||
*/
|
*/
|
||||||
SubWindowManager *_subWindowManager{};
|
SubWindowManager* _subWindowManager{};
|
||||||
/**
|
/**
|
||||||
* @brief 可视化定向对象
|
* @brief 可视化定向对象
|
||||||
* @since 2.5.0
|
* @since 2.5.0
|
||||||
*/
|
*/
|
||||||
CustomizerHelper *_customizerHelper{};
|
CustomizerHelper* _customizerHelper{};
|
||||||
// bool _designModel{ false };
|
// bool _designModel{ false };
|
||||||
|
|
||||||
// QHash<int, Post3D::Post3DWindow*> _post3DWindow{};
|
// QHash<int, Post3D::Post3DWindow*> _post3DWindow{};
|
||||||
|
@ -456,61 +450,61 @@ namespace GUI
|
||||||
* @brief 最近文件
|
* @brief 最近文件
|
||||||
* @since 2.5.0
|
* @since 2.5.0
|
||||||
*/
|
*/
|
||||||
QString _currentFile{};
|
QString _currentFile{};
|
||||||
|
|
||||||
QString _MD5{};
|
QString _MD5{};
|
||||||
/**
|
/**
|
||||||
* @brief 控制面板窗口
|
* @brief 控制面板窗口
|
||||||
* @since 2.5.0
|
* @since 2.5.0
|
||||||
*/
|
*/
|
||||||
MainWidget::ControlPanel *_controlPanel{};
|
MainWidget::ControlPanel* _controlPanel{};
|
||||||
/**
|
/**
|
||||||
* @brief 进程窗口
|
* @brief 进程窗口
|
||||||
* @since 2.5.0
|
* @since 2.5.0
|
||||||
*/
|
*/
|
||||||
MainWidget::ProcessWindow *_processWindow{};
|
MainWidget::ProcessWindow* _processWindow{};
|
||||||
/**
|
/**
|
||||||
* @brief 消息窗口(控制台)
|
* @brief 消息窗口(控制台)
|
||||||
* @since 2.5.0
|
* @since 2.5.0
|
||||||
*/
|
*/
|
||||||
MainWidget::MessageWindow *_messageWindow{};
|
MainWidget::MessageWindow* _messageWindow{};
|
||||||
/**
|
/**
|
||||||
* @brief 视角设置菜单的信号映射
|
* @brief 视角设置菜单的信号映射
|
||||||
* @since 2.5.0
|
* @since 2.5.0
|
||||||
*/
|
*/
|
||||||
QSignalMapper *_viewSignalMapper{};
|
QSignalMapper* _viewSignalMapper{};
|
||||||
/**
|
/**
|
||||||
* @brief 网格选择模式菜单的信号映射
|
* @brief 网格选择模式菜单的信号映射
|
||||||
* @since 2.5.0
|
* @since 2.5.0
|
||||||
*/
|
*/
|
||||||
QSignalMapper *_selectSignalMapper{};
|
QSignalMapper* _selectSignalMapper{};
|
||||||
// QSignalMapper* _displayModeSignalMapper{};
|
// QSignalMapper* _displayModeSignalMapper{};
|
||||||
/**
|
/**
|
||||||
* @brief 几何选择模式菜单的信号映射
|
* @brief 几何选择模式菜单的信号映射
|
||||||
* @since 2.5.0
|
* @since 2.5.0
|
||||||
*/
|
*/
|
||||||
QSignalMapper *_selectGeometryModeMapper{};
|
QSignalMapper* _selectGeometryModeMapper{};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 最近文件菜单
|
* @brief 最近文件菜单
|
||||||
* @since 2.5.0
|
* @since 2.5.0
|
||||||
*/
|
*/
|
||||||
QMenu *_recentMenu{};
|
QMenu* _recentMenu{};
|
||||||
/**
|
/**
|
||||||
* @brief 最近打开文件的菜单信号映射
|
* @brief 最近打开文件的菜单信号映射
|
||||||
* @since 2.5.0
|
* @since 2.5.0
|
||||||
*/
|
*/
|
||||||
QSignalMapper *_recentFileMapper{};
|
QSignalMapper* _recentFileMapper{};
|
||||||
/**
|
/**
|
||||||
* @brief 主窗口右下角显示画布大小的标签
|
* @brief 主窗口右下角显示画布大小的标签
|
||||||
* @since 2.5.0
|
* @since 2.5.0
|
||||||
*/
|
*/
|
||||||
QLabel *_graphRange{};
|
QLabel* _graphRange{};
|
||||||
///< MG tool manger
|
///< MG tool manger
|
||||||
// MainWidget::ControlPanel* _controlPanel{};
|
// MainWidget::ControlPanel* _controlPanel{};
|
||||||
// MainWidget::ProcessWindow* _processWindow{};
|
// MainWidget::ProcessWindow* _processWindow{};
|
||||||
// MainWidget::MessageWindow* _messageWindow{};
|
// MainWidget::MessageWindow* _messageWindow{};
|
||||||
Post::AnimationToolBar *_postToolBar{};
|
Post::AnimationToolBar* _postToolBar{};
|
||||||
//
|
//
|
||||||
// QSignalMapper* _viewSignalMapper{};
|
// QSignalMapper* _viewSignalMapper{};
|
||||||
// QSignalMapper* _selectSignalMapper{};
|
// QSignalMapper* _selectSignalMapper{};
|
||||||
|
@ -530,7 +524,7 @@ namespace GUI
|
||||||
// ///<MG external action
|
// ///<MG external action
|
||||||
// QMap<QString, QAction*> _externalActions{};
|
// QMap<QString, QAction*> _externalActions{};
|
||||||
// ribbon customize
|
// ribbon customize
|
||||||
SARibbonActionsManager *m_ribbonActionMgr{};
|
SARibbonActionsManager* m_ribbonActionMgr{};
|
||||||
};
|
};
|
||||||
}
|
} // namespace GUI
|
||||||
#endif
|
#endif
|
File diff suppressed because it is too large
Load Diff
|
@ -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
|
|
@ -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
|
File diff suppressed because it is too large
Load Diff
|
@ -1,26 +1,24 @@
|
||||||
#ifndef _SIGNALHANDLER_H_
|
#ifndef _SIGNALHANDLER_H_
|
||||||
#define _SIGNALHANDLER_H_
|
#define _SIGNALHANDLER_H_
|
||||||
|
|
||||||
|
#include "MainWindowAPI.h"
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
#include "mainWindowAPI.h"
|
|
||||||
|
|
||||||
class QDialog;
|
class QDialog;
|
||||||
class QTreeWidgetItem;
|
class QTreeWidgetItem;
|
||||||
class vtkDataSet;
|
class vtkDataSet;
|
||||||
|
|
||||||
namespace Post
|
namespace Post {
|
||||||
{
|
|
||||||
class PostWindowBase;
|
class PostWindowBase;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace GUI
|
namespace GUI {
|
||||||
{
|
|
||||||
class MainWindow;
|
class MainWindow;
|
||||||
class SolveProcessManager;
|
class SolveProcessManager;
|
||||||
|
|
||||||
class MAINWINDOWAPI SignalHandler : public QObject
|
class MAINWINDOWAPI SignalHandler : public QObject {
|
||||||
{
|
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
SignalHandler(MainWindow* mainwindow);
|
SignalHandler(MainWindow* mainwindow);
|
||||||
|
@ -35,25 +33,23 @@ namespace GUI
|
||||||
void saveToProjectFileSig(QString fileName);
|
void saveToProjectFileSig(QString fileName);
|
||||||
void solveProjectSig(int projectIndex, int solverIndex);
|
void solveProjectSig(int projectIndex, int solverIndex);
|
||||||
void projectFileProcessedSig(QString file, bool success, bool isread);
|
void projectFileProcessedSig(QString file, bool success, bool isread);
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
//不要通过返回值判断
|
// 不要通过返回值判断
|
||||||
bool importGeometry(const QStringList &filenames);
|
bool importGeometry(const QStringList& filenames);
|
||||||
bool exportGeometry(QString f);
|
bool exportGeometry(QString f);
|
||||||
QString getMD5();
|
QString getMD5();
|
||||||
/*创建工程 */
|
/*创建工程 */
|
||||||
void on_actionNew();
|
void on_actionNew();
|
||||||
///获取求解管理器
|
/// 获取求解管理器
|
||||||
SolveProcessManager* getSolveProcessManager();
|
SolveProcessManager* getSolveProcessManager();
|
||||||
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
//导入网格
|
// 导入网格
|
||||||
bool importMeshSlot(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);
|
bool exportMeshSlot(const QString& fileName, const QString& suffix, int modelId);
|
||||||
///清除数据
|
/// 清除数据
|
||||||
void clearData(bool unlock = true);
|
void clearData(bool unlock = true);
|
||||||
/*求解 */
|
/*求解 */
|
||||||
void on_actionSolve();
|
void on_actionSolve();
|
||||||
|
@ -61,54 +57,54 @@ namespace GUI
|
||||||
void on_actionEnglish();
|
void on_actionEnglish();
|
||||||
/*切换为中文 */
|
/*切换为中文 */
|
||||||
void on_actionChinese();
|
void on_actionChinese();
|
||||||
//切换到Ribbon风格
|
// 切换到Ribbon风格
|
||||||
void on_actionRibbon();
|
void on_actionRibbon();
|
||||||
//切换到正常风格
|
// 切换到正常风格
|
||||||
void on_actionNormal();
|
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 solveProjectPy(int projectIndex, int solverIndex);
|
||||||
void solveProject(int projectIndex, int solverIndex);
|
void solveProject(int projectIndex, int solverIndex);
|
||||||
///生成面网格
|
/// 生成面网格
|
||||||
void generateSurfaceMesh();
|
void generateSurfaceMesh();
|
||||||
///生成体网格
|
/// 生成体网格
|
||||||
void generateSolidMesh();
|
void generateSolidMesh();
|
||||||
//生成流体域网格
|
// 生成流体域网格
|
||||||
void generateFluidMesh();
|
void generateFluidMesh();
|
||||||
///生成网格
|
/// 生成网格
|
||||||
void genMesh();
|
void genMesh();
|
||||||
//添加求解器生成网格
|
// 添加求解器生成网格
|
||||||
void appendGeneratedMesh(QString name, vtkDataSet* dataset);
|
void appendGeneratedMesh(QString name, vtkDataSet* dataset);
|
||||||
///刷新Action状态
|
/// 刷新Action状态
|
||||||
void updateActionsStates();
|
void updateActionsStates();
|
||||||
void updatePostActionStates();
|
void updatePostActionStates();
|
||||||
//独立打开2D后处理窗口
|
// 独立打开2D后处理窗口
|
||||||
void open2DPlotWindow();
|
void open2DPlotWindow();
|
||||||
void open2DPlotWindowPy();//提交py代码
|
void open2DPlotWindowPy(); // 提交py代码
|
||||||
//独立打开3D后处理窗口
|
// 独立打开3D后处理窗口
|
||||||
void open3DGraphWindow();
|
void open3DGraphWindow();
|
||||||
void open3DGraphWindowPy();
|
void open3DGraphWindowPy();
|
||||||
//关闭后处理窗口
|
// 关闭后处理窗口
|
||||||
void closePostWindow(Post::PostWindowBase* p);
|
void closePostWindow(Post::PostWindowBase* p);
|
||||||
//保存图片
|
// 保存图片
|
||||||
void saveImange();
|
void saveImange();
|
||||||
bool openProjectFile(QString fileName);
|
bool openProjectFile(QString fileName);
|
||||||
void projectFileProcessed(QString filename, bool success, bool read);
|
void projectFileProcessed(QString filename, bool success, bool read);
|
||||||
void saveToProjectFile(QString fileName);
|
void saveToProjectFile(QString fileName);
|
||||||
//检查网格质量
|
// 检查网格质量
|
||||||
void meshChecking();
|
void meshChecking();
|
||||||
//显示用户引导
|
// 显示用户引导
|
||||||
void showUserGuidence(bool start = false);
|
void showUserGuidence(bool start = false);
|
||||||
//创建几何
|
// 创建几何
|
||||||
void undo();
|
void undo();
|
||||||
void redo();
|
void redo();
|
||||||
void createBox();
|
void createBox();
|
||||||
void createCylinder();
|
void createCylinder();
|
||||||
void CreateSphere();
|
void CreateSphere();
|
||||||
void CreateCone();
|
void CreateCone();
|
||||||
//void CreateCylindricalComplex();
|
// void CreateCylindricalComplex();
|
||||||
//void CreateBoxComplex();
|
// void CreateBoxComplex();
|
||||||
void CreatePoint();
|
void CreatePoint();
|
||||||
void CreateEdge();
|
void CreateEdge();
|
||||||
void CreateFace();
|
void CreateFace();
|
||||||
|
@ -144,8 +140,8 @@ namespace GUI
|
||||||
void setPostDisplayMode(int type);
|
void setPostDisplayMode(int type);
|
||||||
void createPostVector();
|
void createPostVector();
|
||||||
|
|
||||||
//打开二维曲线文件
|
// 打开二维曲线文件
|
||||||
void openPlotFile();
|
void openPlotFile();
|
||||||
void createPostClip();
|
void createPostClip();
|
||||||
void createPostSlice();
|
void createPostSlice();
|
||||||
void createPostStreamLine();
|
void createPostStreamLine();
|
||||||
|
@ -157,18 +153,18 @@ namespace GUI
|
||||||
void savePostAnimation();
|
void savePostAnimation();
|
||||||
|
|
||||||
void GeoMeshRotate();
|
void GeoMeshRotate();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void handleSingleClickEvent(QTreeWidgetItem*item, int proID);
|
void handleSingleClickEvent(QTreeWidgetItem* item, int proID);
|
||||||
void openPreWinPy();
|
void openPreWinPy();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
MainWindow* _mainWindow{};
|
MainWindow* _mainWindow{};
|
||||||
int _proID{ -1 };
|
int _proID{ -1 };
|
||||||
SolveProcessManager* _solveProcessManager{};
|
SolveProcessManager* _solveProcessManager{};
|
||||||
bool _launched{ false };
|
bool _launched{ false };
|
||||||
// QString _currentFilePath{};
|
// QString _currentFilePath{};
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
} // namespace GUI
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -1,18 +1,16 @@
|
||||||
#include "solveProcessManager.h"
|
#include "SolveProcessManager.h"
|
||||||
|
|
||||||
#include "SolverControl/SolverControlerBase.h"
|
#include "SolverControl/SolverControlerBase.h"
|
||||||
|
|
||||||
|
namespace GUI {
|
||||||
namespace GUI
|
|
||||||
{
|
|
||||||
SolveProcessManager::~SolveProcessManager()
|
SolveProcessManager::~SolveProcessManager()
|
||||||
{
|
{
|
||||||
QList<SolverControl::SolverControlBase*> ss = _solvingProcess.values();
|
QList<SolverControl::SolverControlBase*> ss = _solvingProcess.values();
|
||||||
for (auto s : ss)
|
for(auto s : ss)
|
||||||
s->stopSolver();
|
s->stopSolver();
|
||||||
_solvingProcess.clear();
|
_solvingProcess.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool SolveProcessManager::isSolving(int id)
|
bool SolveProcessManager::isSolving(int id)
|
||||||
{
|
{
|
||||||
return _solvingProcess.contains(id);
|
return _solvingProcess.contains(id);
|
||||||
|
@ -22,17 +20,16 @@ namespace GUI
|
||||||
{
|
{
|
||||||
connect(p, SIGNAL(removeSolver(int)), this, SLOT(removeSolve(int)));
|
connect(p, SIGNAL(removeSolver(int)), this, SLOT(removeSolve(int)));
|
||||||
bool ok = connect(p, SIGNAL(processFinish(int)), this, SLOT(solveFinished(int)));
|
bool ok = connect(p, SIGNAL(processFinish(int)), this, SLOT(solveFinished(int)));
|
||||||
if (ok)
|
if(ok)
|
||||||
_solvingProcess.insert(id, p);
|
_solvingProcess.insert(id, p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void SolveProcessManager::solveFinished(int id)
|
void SolveProcessManager::solveFinished(int id)
|
||||||
{
|
{
|
||||||
auto p = _solvingProcess.value(id);
|
auto p = _solvingProcess.value(id);
|
||||||
_solvingProcess.remove(id);
|
_solvingProcess.remove(id);
|
||||||
if (p == nullptr) return;
|
if(p == nullptr)
|
||||||
|
return;
|
||||||
p->stopSolver();
|
p->stopSolver();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,4 +38,4 @@ namespace GUI
|
||||||
_solvingProcess.remove(id);
|
_solvingProcess.remove(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
} // namespace GUI
|
|
@ -1,19 +1,17 @@
|
||||||
#ifndef SOLVEPROCESSMANAGER_H_
|
#ifndef SOLVEPROCESSMANAGER_H_
|
||||||
#define SOLVEPROCESSMANAGER_H_
|
#define SOLVEPROCESSMANAGER_H_
|
||||||
|
|
||||||
|
#include "MainWindowAPI.h"
|
||||||
|
|
||||||
#include <QHash>
|
#include <QHash>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include "mainWindowAPI.h"
|
|
||||||
|
|
||||||
namespace SolverControl
|
namespace SolverControl {
|
||||||
{
|
|
||||||
class SolverControlBase;
|
class SolverControlBase;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace GUI
|
namespace GUI {
|
||||||
{
|
class MAINWINDOWAPI SolveProcessManager : public QObject {
|
||||||
class MAINWINDOWAPI SolveProcessManager : public QObject
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
SolveProcessManager() = default;
|
SolveProcessManager() = default;
|
||||||
|
@ -23,15 +21,13 @@ namespace GUI
|
||||||
void insertProcess(int id, SolverControl::SolverControlBase* p);
|
void insertProcess(int id, SolverControl::SolverControlBase* p);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void solveFinished(int id);
|
void solveFinished(int id);
|
||||||
void removeSolve(int id);
|
void removeSolve(int id);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QHash<int, SolverControl::SolverControlBase*> _solvingProcess{};
|
QHash<int, SolverControl::SolverControlBase*> _solvingProcess{};
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
} // namespace GUI
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -1,64 +1,79 @@
|
||||||
#include "SubWindowManager.h"
|
#include "SubWindowManager.h"
|
||||||
#include "SARibbonMWUi.h"
|
|
||||||
#include <QMdiArea>
|
#include "Common/Types.h"
|
||||||
#include <QMdiSubWindow>
|
|
||||||
#include <QList>
|
|
||||||
#include <QToolBar>
|
|
||||||
#include "MainWidgets/preWindow.h"
|
|
||||||
#include "MainWidgets/ControlPanel.h"
|
|
||||||
#include "MeshData/meshSingleton.h"
|
|
||||||
#include "Geometry/geometryData.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/PostWindowBase.h"
|
||||||
#include "PostWidgets/RealTimeWindowBase.h"
|
#include "PostWidgets/RealTimeWindowBase.h"
|
||||||
#include "ModuleBase/graphWindowBase.h"
|
|
||||||
#include "XGenerateReport/ReportWindow.h"
|
|
||||||
#include "MainWindow.h"
|
|
||||||
#include "signalHandler.h"
|
|
||||||
#include "PythonModule/PyAgent.h"
|
#include "PythonModule/PyAgent.h"
|
||||||
#include "GeometryCommand/GeoCommandPy.h"
|
|
||||||
#include "SARibbonBar/SARibbonBar.h"
|
#include "SARibbonBar/SARibbonBar.h"
|
||||||
#include "PostInterface/PostProcessPy.h"
|
#include "SARibbonMWUi.h"
|
||||||
#include "Common/Types.h"
|
#include "SignalHandler.h"
|
||||||
#include <QDebug>
|
#include "XGenerateReport/ReportWindow.h"
|
||||||
#include <assert.h>
|
|
||||||
|
|
||||||
namespace GUI
|
#include <assert.h>
|
||||||
{
|
#include <QDebug>
|
||||||
SubWindowManager::SubWindowManager(MainWindow *mainwindow, QMdiArea *mdiArea, SignalHandler *hander, MainWidget::ControlPanel *cp)
|
#include <QList>
|
||||||
: _mainWindow(mainwindow), _mdiArea(mdiArea), _signalHander(hander), _controlPanel(cp)
|
#include <QMdiArea>
|
||||||
|
#include <QMdiSubWindow>
|
||||||
|
#include <QToolBar>
|
||||||
|
|
||||||
|
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(closePreWindowSig()), this, SLOT(closePreWindow()));
|
||||||
connect(mainwindow, SIGNAL(openPostWindowSig(Post::PostWindowBase *)), this, SLOT(openPostWindow(Post::PostWindowBase *)));
|
connect(mainwindow, SIGNAL(openPostWindowSig(Post::PostWindowBase*)), this,
|
||||||
connect(mainwindow, SIGNAL(openRealTimeWindowSig(Post::RealTimeWindowBase *, int)), this, SLOT(openRealTimeWindow(Post::RealTimeWindowBase *)));
|
SLOT(openPostWindow(Post::PostWindowBase*)));
|
||||||
connect(mainwindow, SIGNAL(showPostWindowInfoSig(int, int)), this, SLOT(showPostWindowInfo(int, int)));
|
connect(mainwindow, SIGNAL(openRealTimeWindowSig(Post::RealTimeWindowBase*, int)), this,
|
||||||
connect(mainwindow, SIGNAL(closePostWindowSig(Post::PostWindowBase *)), this, SLOT(closePostWindow(Post::PostWindowBase *)));
|
SLOT(openRealTimeWindow(Post::RealTimeWindowBase*)));
|
||||||
connect(_mdiArea, SIGNAL(subWindowActivated(QMdiSubWindow *)), this, SLOT(subWindowActived(QMdiSubWindow *)));
|
connect(mainwindow, SIGNAL(showPostWindowInfoSig(int, int)), this,
|
||||||
connect(mainwindow, SIGNAL(closeRealTimeWindowSig(Post::RealTimeWindowBase *)), this, SLOT(closeRealTimeWindow(Post::RealTimeWindowBase *)));
|
SLOT(showPostWindowInfo(int, int)));
|
||||||
connect(mainwindow, SIGNAL(openReportWindowSig(XReport::ReportWindow *)), this, SLOT(openReportWindow(XReport::ReportWindow *)));
|
connect(mainwindow, SIGNAL(closePostWindowSig(Post::PostWindowBase*)), this,
|
||||||
connect(mainwindow, SIGNAL(closeReportWindowSig(XReport::ReportWindow *)), this, SLOT(closeReportWindow(XReport::ReportWindow *)));
|
SLOT(closePostWindow(Post::PostWindowBase*)));
|
||||||
connect(mainwindow, SIGNAL(saveImageSig(QString, int, Post::PostWindowBase *, int, int)), this, SLOT(saveImage(QString, int, Post::PostWindowBase *, int, int)));
|
connect(_mdiArea, SIGNAL(subWindowActivated(QMdiSubWindow*)), this,
|
||||||
connect(mainwindow, SIGNAL(saveImage(int, int, QString)), this, SLOT(saveImage(int, int, QString)));
|
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(setViewSig(int, QString, QString)), this,
|
||||||
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)));
|
SLOT(setView(int, QString, QString)));
|
||||||
connect(this, SIGNAL(saveImageSig(int, int, int, QString, QString)), this, SLOT(saveImage(int, int, 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()));
|
connect(this, SIGNAL(openPreWindowSig()), this, SLOT(openPreWindow()));
|
||||||
|
|
||||||
}
|
|
||||||
SubWindowManager::~SubWindowManager()
|
|
||||||
{
|
|
||||||
}
|
}
|
||||||
|
SubWindowManager::~SubWindowManager() {}
|
||||||
void SubWindowManager::openPreWindow()
|
void SubWindowManager::openPreWindow()
|
||||||
{
|
{
|
||||||
if (isPreWindowOpened())
|
if(isPreWindowOpened()) {
|
||||||
{
|
|
||||||
Py::PythonAgent::getInstance()->unLock();
|
Py::PythonAgent::getInstance()->unLock();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (_preWindow.first == nullptr || _preWindow.second == nullptr)
|
if(_preWindow.first == nullptr || _preWindow.second == nullptr) {
|
||||||
{
|
|
||||||
_preWindow.second = new MainWidget::PreWindow(_mainWindow);
|
_preWindow.second = new MainWidget::PreWindow(_mainWindow);
|
||||||
_preWindow.first = _mdiArea->addSubWindow(_preWindow.second);
|
_preWindow.first = _mdiArea->addSubWindow(_preWindow.second);
|
||||||
_signalHander->updateActionsStates();
|
_signalHander->updateActionsStates();
|
||||||
Command::GeometryCommandPy::init(_mainWindow, _preWindow.second);
|
Command::GeometryCommandPy::init(_mainWindow, _preWindow.second);
|
||||||
}
|
}
|
||||||
|
@ -83,66 +98,60 @@ namespace GUI
|
||||||
//_preWindow.first->setFocus();
|
//_preWindow.first->setFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
QMdiArea *SubWindowManager::getMdiArea() const
|
QMdiArea* SubWindowManager::getMdiArea() const
|
||||||
{
|
{
|
||||||
return _mdiArea;
|
return _mdiArea;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SubWindowManager::add3dRenderPage(const QList<QToolBar *> &toolbars)
|
void SubWindowManager::add3dRenderPage(const QList<QToolBar*>& toolbars)
|
||||||
{
|
{
|
||||||
if (_threeD_render_page || toolbars.size() != 4)
|
if(_threeD_render_page || toolbars.size() != 4)
|
||||||
return;
|
return;
|
||||||
QList<QAction *> actions;
|
QList<QAction*> actions;
|
||||||
QAction *action{};
|
QAction* action{};
|
||||||
SARibbonBar *ribbon = _mainWindow->ribbonBar();
|
SARibbonBar* ribbon = _mainWindow->ribbonBar();
|
||||||
_threeD_render_page = ribbon->addCategoryPage(QObject::tr("3D Render"));
|
_threeD_render_page = ribbon->addCategoryPage(QObject::tr("3D Render"));
|
||||||
|
|
||||||
SARibbonPannel *pannel0 = _threeD_render_page->addPannel(QString());
|
SARibbonPannel* pannel0 = _threeD_render_page->addPannel(QString());
|
||||||
QToolBar *toolbar0 = toolbars.at(0);
|
QToolBar* toolbar0 = toolbars.at(0);
|
||||||
actions = toolbar0->actions();
|
actions = toolbar0->actions();
|
||||||
for (int j = 0; j < actions.size(); j++)
|
for(int j = 0; j < actions.size(); j++) {
|
||||||
{
|
|
||||||
action = actions.at(j);
|
action = actions.at(j);
|
||||||
pannel0->addLargeAction(action);
|
pannel0->addLargeAction(action);
|
||||||
}
|
}
|
||||||
|
|
||||||
SARibbonPannel *pannel2 = _threeD_render_page->addPannel(QString());
|
SARibbonPannel* pannel2 = _threeD_render_page->addPannel(QString());
|
||||||
QToolBar *toolbar2 = toolbars.at(2);
|
QToolBar* toolbar2 = toolbars.at(2);
|
||||||
actions = toolbar2->actions();
|
actions = toolbar2->actions();
|
||||||
for (int j = 0; j < actions.size(); j++)
|
for(int j = 0; j < actions.size(); j++) {
|
||||||
{
|
|
||||||
action = actions.at(j);
|
action = actions.at(j);
|
||||||
pannel2->addLargeAction(action);
|
pannel2->addLargeAction(action);
|
||||||
}
|
}
|
||||||
|
|
||||||
SARibbonPannel *pannel3 = _threeD_render_page->addPannel(QString());
|
SARibbonPannel* pannel3 = _threeD_render_page->addPannel(QString());
|
||||||
QToolBar *toolbar3 = toolbars.at(3);
|
QToolBar* toolbar3 = toolbars.at(3);
|
||||||
actions = toolbar3->actions();
|
actions = toolbar3->actions();
|
||||||
for (int j = 0; j < actions.size(); j++)
|
for(int j = 0; j < actions.size(); j++) {
|
||||||
{
|
|
||||||
action = actions.at(j);
|
action = actions.at(j);
|
||||||
pannel3->addLargeAction(action);
|
pannel3->addLargeAction(action);
|
||||||
}
|
}
|
||||||
|
|
||||||
SARibbonPannel *pannel1 = _threeD_render_page->addPannel(QString());
|
SARibbonPannel* pannel1 = _threeD_render_page->addPannel(QString());
|
||||||
QToolBar *toolbar1 = toolbars.at(1);
|
QToolBar* toolbar1 = toolbars.at(1);
|
||||||
actions = toolbar1->actions();
|
actions = toolbar1->actions();
|
||||||
QList<QAction *> realActions;
|
QList<QAction*> realActions;
|
||||||
QList<QWidget *> comboxs;
|
QList<QWidget*> comboxs;
|
||||||
QWidget *widget{};
|
QWidget* widget{};
|
||||||
for (int j = 0; j < actions.size(); j++)
|
for(int j = 0; j < actions.size(); j++) {
|
||||||
{
|
|
||||||
action = actions.at(j);
|
action = actions.at(j);
|
||||||
if (action->objectName() == "QComboBox")
|
if(action->objectName() == "QComboBox") {
|
||||||
{
|
|
||||||
widget = toolbar1->widgetForAction(action);
|
widget = toolbar1->widgetForAction(action);
|
||||||
widget->setVisible(true);
|
widget->setVisible(true);
|
||||||
comboxs.append(widget);
|
comboxs.append(widget);
|
||||||
}
|
} else if(action->objectName() == "QAction")
|
||||||
else if (action->objectName() == "QAction")
|
|
||||||
realActions.append(action);
|
realActions.append(action);
|
||||||
}
|
}
|
||||||
if (realActions.size() != 4 && comboxs.size() != 3)
|
if(realActions.size() != 4 && comboxs.size() != 3)
|
||||||
return;
|
return;
|
||||||
pannel1->addLargeAction(realActions.at(0));
|
pannel1->addLargeAction(realActions.at(0));
|
||||||
pannel1->addLargeAction(realActions.at(1));
|
pannel1->addLargeAction(realActions.at(1));
|
||||||
|
@ -164,16 +173,15 @@ namespace GUI
|
||||||
|
|
||||||
void SubWindowManager::remove3dRenderPage()
|
void SubWindowManager::remove3dRenderPage()
|
||||||
{
|
{
|
||||||
if (_threeD_render_page == nullptr)
|
if(_threeD_render_page == nullptr)
|
||||||
return;
|
return;
|
||||||
auto pannels = _threeD_render_page->pannelList();
|
auto pannels = _threeD_render_page->pannelList();
|
||||||
for (SARibbonPannel *pannel : pannels)
|
for(SARibbonPannel* pannel : pannels) {
|
||||||
{
|
|
||||||
_threeD_render_page->removePannel(pannel);
|
_threeD_render_page->removePannel(pannel);
|
||||||
pannel = nullptr;
|
pannel = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
SARibbonBar *ribbon = _mainWindow->ribbonBar();
|
SARibbonBar* ribbon = _mainWindow->ribbonBar();
|
||||||
ribbon->removeCategory(_threeD_render_page);
|
ribbon->removeCategory(_threeD_render_page);
|
||||||
_threeD_render_page = nullptr;
|
_threeD_render_page = nullptr;
|
||||||
|
|
||||||
|
@ -188,21 +196,19 @@ namespace GUI
|
||||||
}
|
}
|
||||||
void SubWindowManager::updatePreMeshActor()
|
void SubWindowManager::updatePreMeshActor()
|
||||||
{
|
{
|
||||||
if (_preWindow.second != nullptr)
|
if(_preWindow.second != nullptr) {
|
||||||
{
|
|
||||||
emit _preWindow.second->updateMeshActorSig();
|
emit _preWindow.second->updateMeshActorSig();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void SubWindowManager::updatePreGeometryActor()
|
void SubWindowManager::updatePreGeometryActor()
|
||||||
{
|
{
|
||||||
if (_preWindow.second != nullptr)
|
if(_preWindow.second != nullptr) {
|
||||||
{
|
|
||||||
_preWindow.second->updateGeometryActor();
|
_preWindow.second->updateGeometryActor();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void SubWindowManager::closePreWindow()
|
void SubWindowManager::closePreWindow()
|
||||||
{
|
{
|
||||||
_preWindow.first = nullptr;
|
_preWindow.first = nullptr;
|
||||||
_preWindow.second = nullptr;
|
_preWindow.second = nullptr;
|
||||||
_mainWindow->getUi()->actionPre_Window->setEnabled(true);
|
_mainWindow->getUi()->actionPre_Window->setEnabled(true);
|
||||||
|
|
||||||
|
@ -215,27 +221,22 @@ namespace GUI
|
||||||
|
|
||||||
// _signalHander->clearData();
|
// _signalHander->clearData();
|
||||||
}
|
}
|
||||||
void SubWindowManager::openPostWindow(Post::PostWindowBase *pw)
|
void SubWindowManager::openPostWindow(Post::PostWindowBase* pw)
|
||||||
{
|
{
|
||||||
if (pw == nullptr)
|
if(pw == nullptr) {
|
||||||
{
|
|
||||||
assert(0);
|
assert(0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QMdiSubWindow *sw = nullptr;
|
QMdiSubWindow* sw = nullptr;
|
||||||
QList<Post::PostWindowBase *> pwl = _postWindow.values();
|
QList<Post::PostWindowBase*> pwl = _postWindow.values();
|
||||||
if (pwl.contains(pw))
|
if(pwl.contains(pw)) {
|
||||||
{
|
|
||||||
sw = _postWindow.key(pw);
|
sw = _postWindow.key(pw);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
sw = _mdiArea->addSubWindow(pw);
|
sw = _mdiArea->addSubWindow(pw);
|
||||||
_mdiArea->cascadeSubWindows();
|
_mdiArea->cascadeSubWindows();
|
||||||
_postWindow[sw] = pw;
|
_postWindow[sw] = pw;
|
||||||
}
|
}
|
||||||
if (sw != nullptr)
|
if(sw != nullptr) {
|
||||||
{
|
|
||||||
sw->activateWindow();
|
sw->activateWindow();
|
||||||
sw->showMaximized();
|
sw->showMaximized();
|
||||||
sw->setFocus();
|
sw->setFocus();
|
||||||
|
@ -245,56 +246,51 @@ namespace GUI
|
||||||
emit _mainWindow->updateActionStatesSig();
|
emit _mainWindow->updateActionStatesSig();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SubWindowManager::openRealTimeWindow(Post::RealTimeWindowBase *pw)
|
void SubWindowManager::openRealTimeWindow(Post::RealTimeWindowBase* pw)
|
||||||
{
|
{
|
||||||
QMdiSubWindow *sw = nullptr;
|
QMdiSubWindow* sw = nullptr;
|
||||||
QList<Post::RealTimeWindowBase *> pwl = _realTimeWindow.values();
|
QList<Post::RealTimeWindowBase*> pwl = _realTimeWindow.values();
|
||||||
if (pwl.contains(pw))
|
if(pwl.contains(pw)) {
|
||||||
{
|
|
||||||
sw = _realTimeWindow.key(pw);
|
sw = _realTimeWindow.key(pw);
|
||||||
}
|
} else {
|
||||||
else
|
sw = _mdiArea->addSubWindow(pw);
|
||||||
{
|
|
||||||
sw = _mdiArea->addSubWindow(pw);
|
|
||||||
_realTimeWindow[sw] = pw;
|
_realTimeWindow[sw] = pw;
|
||||||
}
|
}
|
||||||
if (sw != nullptr)
|
if(sw != nullptr) {
|
||||||
{
|
|
||||||
sw->showMaximized();
|
sw->showMaximized();
|
||||||
sw->setFocus();
|
sw->setFocus();
|
||||||
}
|
}
|
||||||
emit _mainWindow->updateActionStatesSig();
|
emit _mainWindow->updateActionStatesSig();
|
||||||
}
|
}
|
||||||
ModuleBase::GraphWindowBase *SubWindowManager::getCurrentWindow()
|
ModuleBase::GraphWindowBase* SubWindowManager::getCurrentWindow()
|
||||||
{
|
{
|
||||||
QMdiSubWindow* activeWindow = nullptr;
|
QMdiSubWindow* activeWindow = nullptr;
|
||||||
|
|
||||||
auto subWins = _mdiArea->subWindowList();
|
auto subWins = _mdiArea->subWindowList();
|
||||||
if(subWins.size() == 1) {
|
if(subWins.size() == 1) {
|
||||||
activeWindow = subWins.at(0);
|
activeWindow = subWins.at(0);
|
||||||
} else {
|
} else {
|
||||||
activeWindow = _mdiArea->activeSubWindow();
|
activeWindow = _mdiArea->activeSubWindow();
|
||||||
}
|
}
|
||||||
if (activeWindow == nullptr)
|
if(activeWindow == nullptr)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
else if (activeWindow == _preWindow.first)
|
else if(activeWindow == _preWindow.first)
|
||||||
return _preWindow.second;
|
return _preWindow.second;
|
||||||
else if (_postWindow.contains(activeWindow))
|
else if(_postWindow.contains(activeWindow))
|
||||||
return _postWindow[activeWindow];
|
return _postWindow[activeWindow];
|
||||||
else
|
else
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
Post::PostWindowBase *SubWindowManager::getPostWindowByIDType(int id, int type)
|
Post::PostWindowBase* SubWindowManager::getPostWindowByIDType(int id, int type)
|
||||||
{
|
{
|
||||||
QList<Post::PostWindowBase *> pwl = _postWindow.values();
|
QList<Post::PostWindowBase*> pwl = _postWindow.values();
|
||||||
for (int i = 0; i < pwl.size(); ++i)
|
for(int i = 0; i < pwl.size(); ++i) {
|
||||||
{
|
Post::PostWindowBase* w = pwl.at(i);
|
||||||
Post::PostWindowBase *w = pwl.at(i);
|
if(w == nullptr)
|
||||||
if (w == nullptr)
|
|
||||||
continue;
|
continue;
|
||||||
int wid = w->getID();
|
int wid = w->getID();
|
||||||
int wtype = (int)w->getPostWindowType();
|
int wtype = (int)w->getPostWindowType();
|
||||||
if (wid == id && wtype == type)
|
if(wid == id && wtype == type)
|
||||||
return w;
|
return w;
|
||||||
}
|
}
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@ -302,72 +298,66 @@ namespace GUI
|
||||||
void SubWindowManager::removeToolBars()
|
void SubWindowManager::removeToolBars()
|
||||||
{
|
{
|
||||||
const int n = _currentToolBars.size();
|
const int n = _currentToolBars.size();
|
||||||
for (int i = 0; i < n; ++i)
|
for(int i = 0; i < n; ++i) {
|
||||||
{
|
QToolBar* t = _currentToolBars.at(i);
|
||||||
QToolBar *t = _currentToolBars.at(i);
|
|
||||||
_mainWindow->removeToolBar(t);
|
_mainWindow->removeToolBar(t);
|
||||||
}
|
}
|
||||||
_currentToolBars.clear();
|
_currentToolBars.clear();
|
||||||
}
|
}
|
||||||
void SubWindowManager::showPostWindowInfo(int id, int type)
|
void SubWindowManager::showPostWindowInfo(int id, int type)
|
||||||
{
|
{
|
||||||
Post::PostWindowBase *pwb = getPostWindowByIDType(id, type);
|
Post::PostWindowBase* pwb = getPostWindowByIDType(id, type);
|
||||||
if (pwb == nullptr)
|
if(pwb == nullptr)
|
||||||
return;
|
return;
|
||||||
// QWidget* ptree = pwb->getTreeWidget();
|
// QWidget* ptree = pwb->getTreeWidget();
|
||||||
// QWidget* pprop = pwb->getPropWidget();
|
// QWidget* pprop = pwb->getPropWidget();
|
||||||
QMdiSubWindow *subWin = _postWindow.key(pwb);
|
QMdiSubWindow* subWin = _postWindow.key(pwb);
|
||||||
if (subWin != nullptr)
|
if(subWin != nullptr) {
|
||||||
{
|
|
||||||
subWin->showMaximized();
|
subWin->showMaximized();
|
||||||
subWin->setFocus();
|
subWin->setFocus();
|
||||||
}
|
}
|
||||||
//_controlPanel->updatePostWidget(ptree, pprop);
|
//_controlPanel->updatePostWidget(ptree, pprop);
|
||||||
if (type == 2)
|
if(type == 2)
|
||||||
_controlPanel->updatePostWidget();
|
_controlPanel->updatePostWidget();
|
||||||
|
|
||||||
QList<QToolBar *> toolBars = pwb->getToolBarList();
|
QList<QToolBar*> toolBars = pwb->getToolBarList();
|
||||||
if (_mainWindow->isUseRibbon())
|
if(_mainWindow->isUseRibbon()) {
|
||||||
{
|
if(_threeD_render_page)
|
||||||
if (_threeD_render_page)
|
|
||||||
return;
|
return;
|
||||||
add3dRenderPage(toolBars);
|
add3dRenderPage(toolBars);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
this->removeToolBars();
|
this->removeToolBars();
|
||||||
_mainWindow->addToolBarBreak();
|
_mainWindow->addToolBarBreak();
|
||||||
for (int i = 0; i < toolBars.size(); ++i)
|
for(int i = 0; i < toolBars.size(); ++i) {
|
||||||
{
|
|
||||||
_mainWindow->addToolBar(toolBars.at(i));
|
_mainWindow->addToolBar(toolBars.at(i));
|
||||||
(toolBars.at(i))->show();
|
(toolBars.at(i))->show();
|
||||||
_currentToolBars.append(toolBars.at(i));
|
_currentToolBars.append(toolBars.at(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void SubWindowManager::closePostWindow(Post::PostWindowBase *w)
|
void SubWindowManager::closePostWindow(Post::PostWindowBase* w)
|
||||||
{
|
{
|
||||||
QMdiSubWindow *subw = _postWindow.key(w);
|
QMdiSubWindow* subw = _postWindow.key(w);
|
||||||
if (subw == nullptr)
|
if(subw == nullptr)
|
||||||
return;
|
return;
|
||||||
Post::PostWindowType type = w->getPostWindowType();
|
Post::PostWindowType type = w->getPostWindowType();
|
||||||
removeToolBars();
|
removeToolBars();
|
||||||
if (type == Post::PostWindowType::D3 && _mainWindow->isUseRibbon()) //使用ribbon,并且关闭的是3维窗口
|
if(type == Post::PostWindowType::D3
|
||||||
|
&& _mainWindow->isUseRibbon()) // 使用ribbon,并且关闭的是3维窗口
|
||||||
remove3dRenderPage();
|
remove3dRenderPage();
|
||||||
|
|
||||||
if (_controlPanel != nullptr)
|
if(_controlPanel != nullptr)
|
||||||
_controlPanel->updatePostWidget(nullptr, nullptr);
|
_controlPanel->updatePostWidget(nullptr, nullptr);
|
||||||
emit _mainWindow->updateProperty(nullptr);
|
emit _mainWindow->updateProperty(nullptr);
|
||||||
|
|
||||||
_postWindow.remove(subw);
|
_postWindow.remove(subw);
|
||||||
QList<Post::PostWindowBase *> postsubwlist = _postWindow.values();
|
QList<Post::PostWindowBase*> postsubwlist = _postWindow.values();
|
||||||
if (_preWindow.first != nullptr)
|
if(_preWindow.first != nullptr)
|
||||||
showPreWindow();
|
showPreWindow();
|
||||||
else if (postsubwlist.size() > 0)
|
else if(postsubwlist.size() > 0) {
|
||||||
{
|
Post::PostWindowBase* w = postsubwlist.at(0);
|
||||||
Post::PostWindowBase *w = postsubwlist.at(0);
|
int id = w->getID();
|
||||||
int id = w->getID();
|
Post::PostWindowType type = w->getPostWindowType();
|
||||||
Post::PostWindowType type = w->getPostWindowType();
|
|
||||||
showPostWindowInfo(id, type);
|
showPostWindowInfo(id, type);
|
||||||
}
|
}
|
||||||
emit _mainWindow->updateActionStatesSig();
|
emit _mainWindow->updateActionStatesSig();
|
||||||
|
@ -375,49 +365,46 @@ namespace GUI
|
||||||
void SubWindowManager::showPreWindow()
|
void SubWindowManager::showPreWindow()
|
||||||
{
|
{
|
||||||
removeToolBars();
|
removeToolBars();
|
||||||
if (_controlPanel == nullptr)
|
if(_controlPanel == nullptr)
|
||||||
return;
|
return;
|
||||||
_controlPanel->updatePostWidget(nullptr, nullptr);
|
_controlPanel->updatePostWidget(nullptr, nullptr);
|
||||||
if (_preWindow.first != nullptr)
|
if(_preWindow.first != nullptr) {
|
||||||
{
|
|
||||||
_preWindow.first->showMaximized();
|
_preWindow.first->showMaximized();
|
||||||
_preWindow.first->setFocus();
|
_preWindow.first->setFocus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void SubWindowManager::showRealTimeWindow(QMdiSubWindow *w)
|
void SubWindowManager::showRealTimeWindow(QMdiSubWindow* w)
|
||||||
{
|
{
|
||||||
removeToolBars();
|
removeToolBars();
|
||||||
_controlPanel->updatePostWidget(nullptr, nullptr);
|
_controlPanel->updatePostWidget(nullptr, nullptr);
|
||||||
if (_realTimeWindow.contains(w))
|
if(_realTimeWindow.contains(w)) {
|
||||||
{
|
|
||||||
w->showMaximized();
|
w->showMaximized();
|
||||||
w->setFocus();
|
w->setFocus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void SubWindowManager::subWindowActived(QMdiSubWindow *sw)
|
void SubWindowManager::subWindowActived(QMdiSubWindow* sw)
|
||||||
{
|
{
|
||||||
if (sw == nullptr)
|
if(sw == nullptr)
|
||||||
return;
|
return;
|
||||||
if (sw == _preWindow.first)
|
if(sw == _preWindow.first)
|
||||||
showPreWindow();
|
showPreWindow();
|
||||||
else if (_realTimeWindow.contains(sw))
|
else if(_realTimeWindow.contains(sw))
|
||||||
showRealTimeWindow(sw);
|
showRealTimeWindow(sw);
|
||||||
else if (_postWindow.contains(sw))
|
else if(_postWindow.contains(sw)) {
|
||||||
{
|
Post::PostWindowBase* pwb = _postWindow.value(sw);
|
||||||
Post::PostWindowBase *pwb = _postWindow.value(sw);
|
int id = pwb->getID();
|
||||||
int id = pwb->getID();
|
Post::PostWindowType type = pwb->getPostWindowType();
|
||||||
Post::PostWindowType type = pwb->getPostWindowType();
|
|
||||||
showPostWindowInfo(id, type);
|
showPostWindowInfo(id, type);
|
||||||
}
|
}
|
||||||
emit _mainWindow->updateActionStatesSig();
|
emit _mainWindow->updateActionStatesSig();
|
||||||
}
|
}
|
||||||
void SubWindowManager::closeRealTimeWindow(Post::RealTimeWindowBase *w)
|
void SubWindowManager::closeRealTimeWindow(Post::RealTimeWindowBase* w)
|
||||||
{
|
{
|
||||||
QMdiSubWindow *subw = _realTimeWindow.key(w);
|
QMdiSubWindow* subw = _realTimeWindow.key(w);
|
||||||
if (subw == nullptr)
|
if(subw == nullptr)
|
||||||
return;
|
return;
|
||||||
_realTimeWindow.remove(subw);
|
_realTimeWindow.remove(subw);
|
||||||
if (_preWindow.first != nullptr)
|
if(_preWindow.first != nullptr)
|
||||||
showPreWindow();
|
showPreWindow();
|
||||||
emit _mainWindow->updateActionStatesSig();
|
emit _mainWindow->updateActionStatesSig();
|
||||||
}
|
}
|
||||||
|
@ -427,11 +414,11 @@ namespace GUI
|
||||||
ModuleBase::GraphWindowBase* gwb = getCurrentWindow();
|
ModuleBase::GraphWindowBase* gwb = getCurrentWindow();
|
||||||
if (gwb == nullptr) return;
|
if (gwb == nullptr) return;
|
||||||
gwb->setView(view);*/
|
gwb->setView(view);*/
|
||||||
ModuleBase::GraphWindowBase *gwb = getCurrentWindow();
|
ModuleBase::GraphWindowBase* gwb = getCurrentWindow();
|
||||||
if (gwb == nullptr)
|
if(gwb == nullptr)
|
||||||
return;
|
return;
|
||||||
const int id = gwb->getID();
|
const int id = gwb->getID();
|
||||||
QString win = gwb->getStringGraphWindowType();
|
QString win = gwb->getStringGraphWindowType();
|
||||||
qDebug() << win;
|
qDebug() << win;
|
||||||
QString pycode = QString("MainWindow.setView(%1,\"%2\",\"%3\")").arg(id).arg(win).arg(view);
|
QString pycode = QString("MainWindow.setView(%1,\"%2\",\"%3\")").arg(id).arg(win).arg(view);
|
||||||
qDebug() << pycode;
|
qDebug() << pycode;
|
||||||
|
@ -439,74 +426,67 @@ namespace GUI
|
||||||
// gwb->setView(view);
|
// gwb->setView(view);
|
||||||
}
|
}
|
||||||
|
|
||||||
MainWidget::PreWindow *SubWindowManager::getPreWindow()
|
MainWidget::PreWindow* SubWindowManager::getPreWindow()
|
||||||
{
|
{
|
||||||
return _preWindow.second;
|
return _preWindow.second;
|
||||||
}
|
}
|
||||||
void SubWindowManager::openReportWindow(XReport::ReportWindow *w)
|
void SubWindowManager::openReportWindow(XReport::ReportWindow* w)
|
||||||
{
|
{
|
||||||
QMdiSubWindow *sw = nullptr;
|
QMdiSubWindow* sw = nullptr;
|
||||||
QList<XReport::ReportWindow *> rws = _reportWindow.values();
|
QList<XReport::ReportWindow*> rws = _reportWindow.values();
|
||||||
if (rws.contains(w))
|
if(rws.contains(w)) {
|
||||||
{
|
|
||||||
sw = _reportWindow.key(w);
|
sw = _reportWindow.key(w);
|
||||||
}
|
} else {
|
||||||
else
|
sw = _mdiArea->addSubWindow(w);
|
||||||
{
|
|
||||||
sw = _mdiArea->addSubWindow(w);
|
|
||||||
_reportWindow[sw] = w;
|
_reportWindow[sw] = w;
|
||||||
}
|
}
|
||||||
if (sw != nullptr)
|
if(sw != nullptr) {
|
||||||
{
|
|
||||||
sw->showMaximized();
|
sw->showMaximized();
|
||||||
sw->setFocus();
|
sw->setFocus();
|
||||||
}
|
}
|
||||||
emit _mainWindow->updateActionStatesSig();
|
emit _mainWindow->updateActionStatesSig();
|
||||||
}
|
}
|
||||||
void SubWindowManager::closeReportWindow(XReport::ReportWindow *w)
|
void SubWindowManager::closeReportWindow(XReport::ReportWindow* w)
|
||||||
{
|
{
|
||||||
QMdiSubWindow *s = _reportWindow.key(w);
|
QMdiSubWindow* s = _reportWindow.key(w);
|
||||||
if (s != nullptr)
|
if(s != nullptr) {
|
||||||
{
|
|
||||||
_reportWindow.remove(s);
|
_reportWindow.remove(s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bool SubWindowManager::isPreWindowOpened()
|
bool SubWindowManager::isPreWindowOpened()
|
||||||
{
|
{
|
||||||
if (_preWindow.first == nullptr || _preWindow.second == nullptr)
|
if(_preWindow.first == nullptr || _preWindow.second == nullptr)
|
||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
bool SubWindowManager::isPostWindowOpened()
|
bool SubWindowManager::isPostWindowOpened()
|
||||||
{
|
{
|
||||||
if (_postWindow.size() > 0)
|
if(_postWindow.size() > 0)
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SubWindowManager::isPostWindowOpening()
|
bool SubWindowManager::isPostWindowOpening()
|
||||||
{
|
{
|
||||||
QMdiSubWindow *activeWindow = _mdiArea->activeSubWindow();
|
QMdiSubWindow* activeWindow = _mdiArea->activeSubWindow();
|
||||||
if (activeWindow == nullptr)
|
if(activeWindow == nullptr)
|
||||||
return false;
|
return false;
|
||||||
else if (_postWindow.contains(activeWindow))
|
else if(_postWindow.contains(activeWindow))
|
||||||
return true;
|
return true;
|
||||||
else
|
else
|
||||||
return false;
|
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)
|
if(winType == 0) {
|
||||||
{
|
MainWidget::PreWindow* preW = _preWindow.second;
|
||||||
MainWidget::PreWindow *preW = _preWindow.second;
|
if(preW == nullptr)
|
||||||
if (preW == nullptr)
|
|
||||||
return;
|
return;
|
||||||
preW->saveImage(fileName, w, h, false);
|
preW->saveImage(fileName, w, h, false);
|
||||||
}
|
} else if(winType == 1) {
|
||||||
else if (winType == 1)
|
if(_postWindow.key(winhandle) == nullptr)
|
||||||
{
|
|
||||||
if (_postWindow.key(winhandle) == nullptr)
|
|
||||||
return;
|
return;
|
||||||
winhandle->saveImage(fileName, w, h, false);
|
winhandle->saveImage(fileName, w, h, false);
|
||||||
}
|
}
|
||||||
|
@ -514,44 +494,50 @@ namespace GUI
|
||||||
|
|
||||||
void SubWindowManager::saveImage(int w, int h, QString f)
|
void SubWindowManager::saveImage(int w, int h, QString f)
|
||||||
{
|
{
|
||||||
ModuleBase::GraphWindowBase *gw = this->getCurrentWindow();
|
ModuleBase::GraphWindowBase* gw = this->getCurrentWindow();
|
||||||
if (gw == nullptr)
|
if(gw == nullptr) {
|
||||||
{
|
|
||||||
_mainWindow->printMessage(Common::Message::Error, tr("No GraphWindow opened!"));
|
_mainWindow->printMessage(Common::Message::Error, tr("No GraphWindow opened!"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QString type = gw->getStringGraphWindowType();
|
QString type = gw->getStringGraphWindowType();
|
||||||
const int id = gw->getID();
|
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 pycode = QString("MainWindow.saveImage(%1,%2,%3,\"%4\",\"%5\")")
|
||||||
|
.arg(w)
|
||||||
|
.arg(h)
|
||||||
|
.arg(id)
|
||||||
|
.arg(type)
|
||||||
|
.arg(f);
|
||||||
qDebug() << pycode;
|
qDebug() << pycode;
|
||||||
Py::PythonAgent::getInstance()->submit(pycode);
|
Py::PythonAgent::getInstance()->submit(pycode);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SubWindowManager::saveImage(int w, int h, int id, QString winType, QString file)
|
void SubWindowManager::saveImage(int w, int h, int id, QString winType, QString file)
|
||||||
{
|
{
|
||||||
ModuleBase::GraphWindowBase *win = this->getWindowByTypeID(winType, id);
|
ModuleBase::GraphWindowBase* win = this->getWindowByTypeID(winType, id);
|
||||||
if (win == nullptr)
|
if(win == nullptr)
|
||||||
return;
|
return;
|
||||||
win->saveImage(file, w, h, false);
|
win->saveImage(file, w, h, false);
|
||||||
Py::PythonAgent::getInstance()->unLock();
|
Py::PythonAgent::getInstance()->unLock();
|
||||||
}
|
}
|
||||||
void SubWindowManager::setView(int id, QString winType, QString view) // liu
|
void SubWindowManager::setView(int id, QString winType, QString view) // liu
|
||||||
{
|
{
|
||||||
ModuleBase::GraphWindowBase *gwb = getWindowByTypeID(winType, id);
|
ModuleBase::GraphWindowBase* gwb = getWindowByTypeID(winType, id);
|
||||||
if (gwb == nullptr)
|
if(gwb == nullptr)
|
||||||
return;
|
return;
|
||||||
gwb->setView(view);
|
gwb->setView(view);
|
||||||
Py::PythonAgent::getInstance()->unLock();
|
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);
|
ModuleBase::GraphWindowBase* gwb = getWindowByTypeID(win, id);
|
||||||
if (gwb == nullptr)
|
if(gwb == nullptr)
|
||||||
return;
|
return;
|
||||||
gwb->setViewValue(x1, x2, x3, y1, y2, y3, z1, z2, z3);
|
gwb->setViewValue(x1, x2, x3, y1, y2, y3, z1, z2, z3);
|
||||||
Py::PythonAgent::getInstance()->unLock();
|
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();
|
ModuleBase::GraphWindowBase* gwb = getCurrentWindow();
|
||||||
if (gwb == nullptr) return;
|
if (gwb == nullptr) return;
|
||||||
|
@ -559,41 +545,38 @@ namespace GUI
|
||||||
}*/
|
}*/
|
||||||
void SubWindowManager::reTranslate()
|
void SubWindowManager::reTranslate()
|
||||||
{
|
{
|
||||||
MainWidget::PreWindow *prew = _preWindow.second;
|
MainWidget::PreWindow* prew = _preWindow.second;
|
||||||
if (prew != nullptr)
|
if(prew != nullptr)
|
||||||
prew->reTranslate();
|
prew->reTranslate();
|
||||||
|
|
||||||
int n = 0;
|
int n = 0;
|
||||||
QList<Post::PostWindowBase *> postWinList = _postWindow.values();
|
QList<Post::PostWindowBase*> postWinList = _postWindow.values();
|
||||||
n = postWinList.size();
|
n = postWinList.size();
|
||||||
for (int i = 0; i < n; ++i)
|
for(int i = 0; i < n; ++i) {
|
||||||
{
|
Post::PostWindowBase* pw = postWinList.at(i);
|
||||||
Post::PostWindowBase *pw = postWinList.at(i);
|
if(pw != nullptr)
|
||||||
if (pw != nullptr)
|
|
||||||
pw->reTranslate();
|
pw->reTranslate();
|
||||||
}
|
}
|
||||||
QList<Post::RealTimeWindowBase *> rwList = _realTimeWindow.values();
|
QList<Post::RealTimeWindowBase*> rwList = _realTimeWindow.values();
|
||||||
n = rwList.size();
|
n = rwList.size();
|
||||||
for (int i = 0; i < n; ++i)
|
for(int i = 0; i < n; ++i) {
|
||||||
{
|
Post::RealTimeWindowBase* rw = rwList.at(i);
|
||||||
Post::RealTimeWindowBase *rw = rwList.at(i);
|
if(rw != nullptr)
|
||||||
if (rw != nullptr)
|
|
||||||
rw->reTranslate();
|
rw->reTranslate();
|
||||||
}
|
}
|
||||||
QList<XReport::ReportWindow *> repWin = _reportWindow.values();
|
QList<XReport::ReportWindow*> repWin = _reportWindow.values();
|
||||||
n = repWin.size();
|
n = repWin.size();
|
||||||
for (int i = 0; i < n; ++i)
|
for(int i = 0; i < n; ++i) {
|
||||||
{
|
XReport::ReportWindow* w = repWin.at(i);
|
||||||
XReport::ReportWindow *w = repWin.at(i);
|
|
||||||
w->reTranslate();
|
w->reTranslate();
|
||||||
}
|
}
|
||||||
if (_threeD_render_page != nullptr)
|
if(_threeD_render_page != nullptr)
|
||||||
_threeD_render_page->setWindowTitle(tr("3D Render"));
|
_threeD_render_page->setWindowTitle(tr("3D Render"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void SubWindowManager::closeGeometryWindow()
|
void SubWindowManager::closeGeometryWindow()
|
||||||
{
|
{
|
||||||
_geometryWindow.first = nullptr;
|
_geometryWindow.first = nullptr;
|
||||||
_geometryWindow.second = nullptr;
|
_geometryWindow.second = nullptr;
|
||||||
|
|
||||||
_signalHander->clearData(false);
|
_signalHander->clearData(false);
|
||||||
|
@ -603,10 +586,9 @@ namespace GUI
|
||||||
emit _mainWindow->updateProperty(nullptr);
|
emit _mainWindow->updateProperty(nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
GenerateGeometry::GenerateGeometryWidget *SubWindowManager::getGeometryWindow()
|
GenerateGeometry::GenerateGeometryWidget* SubWindowManager::getGeometryWindow()
|
||||||
{
|
{
|
||||||
if (!_geometryWindow.second)
|
if(!_geometryWindow.second) {
|
||||||
{
|
|
||||||
openGeometryWindow();
|
openGeometryWindow();
|
||||||
}
|
}
|
||||||
return _geometryWindow.second;
|
return _geometryWindow.second;
|
||||||
|
@ -617,39 +599,35 @@ namespace GUI
|
||||||
// _mdiArea->setViewMode(QMdiArea::SubWindowView);
|
// _mdiArea->setViewMode(QMdiArea::SubWindowView);
|
||||||
// _mdiArea->setTabPosition(QTabWidget::North);
|
// _mdiArea->setTabPosition(QTabWidget::North);
|
||||||
|
|
||||||
MainWidget::PreWindow *pre = _preWindow.second;
|
MainWidget::PreWindow* pre = _preWindow.second;
|
||||||
if (pre != nullptr)
|
if(pre != nullptr) {
|
||||||
{
|
|
||||||
_preWindow.first->close();
|
_preWindow.first->close();
|
||||||
_mdiArea->removeSubWindow(pre);
|
_mdiArea->removeSubWindow(pre);
|
||||||
pre->close();
|
pre->close();
|
||||||
delete pre;
|
delete pre;
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<Post::PostWindowBase *> postlist = _postWindow.values();
|
QList<Post::PostWindowBase*> postlist = _postWindow.values();
|
||||||
for (int i = 0; i < postlist.size(); ++i)
|
for(int i = 0; i < postlist.size(); ++i) {
|
||||||
{
|
Post::PostWindowBase* p = postlist.at(i);
|
||||||
Post::PostWindowBase *p = postlist.at(i);
|
|
||||||
_postWindow.key(p)->close();
|
_postWindow.key(p)->close();
|
||||||
_mdiArea->removeSubWindow(p);
|
_mdiArea->removeSubWindow(p);
|
||||||
p->close();
|
p->close();
|
||||||
delete p;
|
delete p;
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<Post::RealTimeWindowBase *> realtimelist = _realTimeWindow.values();
|
QList<Post::RealTimeWindowBase*> realtimelist = _realTimeWindow.values();
|
||||||
for (int i = 0; i < realtimelist.size(); ++i)
|
for(int i = 0; i < realtimelist.size(); ++i) {
|
||||||
{
|
Post::RealTimeWindowBase* r = realtimelist.at(i);
|
||||||
Post::RealTimeWindowBase *r = realtimelist.at(i);
|
|
||||||
_realTimeWindow.key(r)->close();
|
_realTimeWindow.key(r)->close();
|
||||||
_mdiArea->removeSubWindow(r);
|
_mdiArea->removeSubWindow(r);
|
||||||
r->close();
|
r->close();
|
||||||
delete r;
|
delete r;
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<XReport::ReportWindow *> reportlist = _reportWindow.values();
|
QList<XReport::ReportWindow*> reportlist = _reportWindow.values();
|
||||||
for (int i = 0; i < reportlist.size(); ++i)
|
for(int i = 0; i < reportlist.size(); ++i) {
|
||||||
{
|
XReport::ReportWindow* r = reportlist.at(i);
|
||||||
XReport::ReportWindow *r = reportlist.at(i);
|
|
||||||
_reportWindow.key(r)->close();
|
_reportWindow.key(r)->close();
|
||||||
_mdiArea->removeSubWindow(r);
|
_mdiArea->removeSubWindow(r);
|
||||||
r->close();
|
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;
|
ModuleBase::GraphWindowBase* g = nullptr;
|
||||||
type = type.toLower();
|
type = type.toLower();
|
||||||
if (type == "prewindow")
|
if(type == "prewindow") {
|
||||||
{
|
|
||||||
g = _preWindow.second;
|
g = _preWindow.second;
|
||||||
}
|
} else if(type == "realtime") {
|
||||||
else if (type == "realtime")
|
QList<Post::RealTimeWindowBase*> wlist = _realTimeWindow.values();
|
||||||
{
|
for(int i = 0; i < wlist.size(); ++i) {
|
||||||
QList<Post::RealTimeWindowBase *> wlist = _realTimeWindow.values();
|
ModuleBase::GraphWindowBase* t = wlist.at(i);
|
||||||
for (int i = 0; i < wlist.size(); ++i)
|
const int d = t->getID();
|
||||||
{
|
if(id == d) {
|
||||||
ModuleBase::GraphWindowBase *t = wlist.at(i);
|
|
||||||
const int d = t->getID();
|
|
||||||
if (id == d)
|
|
||||||
{
|
|
||||||
g = t;
|
g = t;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else if(type == "post2d") {
|
||||||
else if (type == "post2d")
|
QList<Post::PostWindowBase*> wlist = _postWindow.values();
|
||||||
{
|
for(int i = 0; i < wlist.size(); ++i) {
|
||||||
QList<Post::PostWindowBase *> wlist = _postWindow.values();
|
ModuleBase::GraphWindowBase* t = wlist.at(i);
|
||||||
for (int i = 0; i < wlist.size(); ++i)
|
const int d = t->getID();
|
||||||
{
|
if(id == d && t->getGraphWindowType() == ModuleBase::Post2D) {
|
||||||
ModuleBase::GraphWindowBase *t = wlist.at(i);
|
|
||||||
const int d = t->getID();
|
|
||||||
if (id == d && t->getGraphWindowType() == ModuleBase::Post2D)
|
|
||||||
{
|
|
||||||
g = t;
|
g = t;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else if(type == "post3d") {
|
||||||
else if (type == "post3d")
|
QList<Post::PostWindowBase*> wlist = _postWindow.values();
|
||||||
{
|
for(int i = 0; i < wlist.size(); ++i) {
|
||||||
QList<Post::PostWindowBase *> wlist = _postWindow.values();
|
ModuleBase::GraphWindowBase* t = wlist.at(i);
|
||||||
for (int i = 0; i < wlist.size(); ++i)
|
const int d = t->getID();
|
||||||
{
|
if(id == d && t->getGraphWindowType() == ModuleBase::Post3D) {
|
||||||
ModuleBase::GraphWindowBase *t = wlist.at(i);
|
|
||||||
const int d = t->getID();
|
|
||||||
if (id == d && t->getGraphWindowType() == ModuleBase::Post3D)
|
|
||||||
{
|
|
||||||
g = t;
|
g = t;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -712,13 +677,13 @@ namespace GUI
|
||||||
|
|
||||||
void SubWindowManager::setIcon(QString icon)
|
void SubWindowManager::setIcon(QString icon)
|
||||||
{
|
{
|
||||||
if (_preWindow.first != nullptr)
|
if(_preWindow.first != nullptr)
|
||||||
_preWindow.first->setWindowIcon(QIcon(icon));
|
_preWindow.first->setWindowIcon(QIcon(icon));
|
||||||
QList<QMdiSubWindow *> subw = _postWindow.keys() + _realTimeWindow.keys() + _reportWindow.keys();
|
QList<QMdiSubWindow*> subw =
|
||||||
for (auto w : subw)
|
_postWindow.keys() + _realTimeWindow.keys() + _reportWindow.keys();
|
||||||
{
|
for(auto w : subw) {
|
||||||
w->setWindowIcon(QIcon(icon));
|
w->setWindowIcon(QIcon(icon));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
} // namespace GUI
|
|
@ -0,0 +1,163 @@
|
||||||
|
#ifndef _SUBWINDOWMANAGER_H_
|
||||||
|
#define _SUBWINDOWMANAGER_H_
|
||||||
|
|
||||||
|
#include "MainWindowAPI.h"
|
||||||
|
|
||||||
|
#include <QHash>
|
||||||
|
#include <QObject>
|
||||||
|
#include <QPair>
|
||||||
|
|
||||||
|
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<QToolBar*>& toolbars);
|
||||||
|
/*ribbon:删除3D渲染的页*/
|
||||||
|
void remove3dRenderPage();
|
||||||
|
|
||||||
|
private:
|
||||||
|
MainWindow* _mainWindow{};
|
||||||
|
QMdiArea* _mdiArea{};
|
||||||
|
SignalHandler* _signalHander{};
|
||||||
|
MainWidget::ControlPanel* _controlPanel{};
|
||||||
|
|
||||||
|
QPair<QMdiSubWindow*, MainWidget::PreWindow*> _preWindow{};
|
||||||
|
QHash<QMdiSubWindow*, Post::PostWindowBase*> _postWindow{};
|
||||||
|
QHash<QMdiSubWindow*, Post::RealTimeWindowBase*> _realTimeWindow{};
|
||||||
|
QHash<QMdiSubWindow*, XReport::ReportWindow*> _reportWindow{};
|
||||||
|
QPair<QMdiSubWindow*, GenerateGeometry::GenerateGeometryWidget*> _geometryWindow{};
|
||||||
|
// QHash<QMdiSubWindow*, GenerateGeometry::GenerateGeometryWidget*> _geometryWindow{};
|
||||||
|
|
||||||
|
QList<QToolBar*> _currentToolBars{};
|
||||||
|
SARibbonCategory* _threeD_render_page{};
|
||||||
|
};
|
||||||
|
} // namespace GUI
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,51 @@
|
||||||
|
#include "Translator.h"
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
|
#include <QApplication>
|
||||||
|
#include <QDebug>
|
||||||
|
#include <QStringList>
|
||||||
|
#include <QTranslator>
|
||||||
|
|
||||||
|
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<QApplication*>(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
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue