适配linux环境
parent
30609c2bb0
commit
9f40c3b7c5
|
@ -1,199 +1,8 @@
|
|||
# Prerequisites
|
||||
*.d
|
||||
|
||||
# Compiled Object files
|
||||
*.slo
|
||||
*.lo
|
||||
*.o
|
||||
*.obj
|
||||
|
||||
# Precompiled Headers
|
||||
*.gch
|
||||
*.pch
|
||||
|
||||
# Compiled Dynamic libraries
|
||||
*.so
|
||||
*.dylib
|
||||
*.dll
|
||||
|
||||
# Fortran module files
|
||||
*.mod
|
||||
*.smod
|
||||
|
||||
# Compiled Static libraries
|
||||
*.lai
|
||||
*.la
|
||||
*.a
|
||||
*.lib
|
||||
|
||||
# Executables
|
||||
*.exe
|
||||
*.out
|
||||
*.app
|
||||
python37
|
||||
Build
|
||||
Code/.vs
|
||||
|
||||
output/*
|
||||
Code/*/debug
|
||||
Code/*/release
|
||||
Code/*/Makefile*
|
||||
Code/Makefile*
|
||||
Code/PluginFluent/*
|
||||
cgns/*
|
||||
cgns00/*
|
||||
*.vcxproj
|
||||
*.vcxproj.filters
|
||||
*.vcxproj.user
|
||||
*.stash
|
||||
*.bat
|
||||
/Doxygen
|
||||
/DoxyConfig
|
||||
/*.nsi
|
||||
/.vscode
|
||||
/Code/*.user
|
||||
/Code/*.sln
|
||||
/build-FastCAE-Desktop_Qt_5_14_2_MSVC2017_64bit-Debug
|
||||
Code/FastCAE.pro.user.4f627ea
|
||||
/src/Copy_Pys.bat
|
||||
/src/Copy_Pys.sh
|
||||
/src/Copy_SOs.sh
|
||||
/src/Create_Linux64_Project.sh
|
||||
/src/Create_X64_Project.bat
|
||||
/src/FastCAE.pro
|
||||
/src/hdf5.pri
|
||||
/src/occ.pri
|
||||
/src/python.pri
|
||||
/src/qwt.pri
|
||||
/src/Run_MSVC.bat
|
||||
/src/tecio.pri
|
||||
/src/Translate.bat
|
||||
/src/vtk.pri
|
||||
/src/cgns.pri
|
||||
/src/Copy_DLLs.bat
|
||||
/src/BCBase/BCBase.pro
|
||||
/src/BCBase/_Create_Project.bat
|
||||
/src/BCBase/_Create_project.sh
|
||||
/src/BCBase/BCBase.pri
|
||||
/src/ConfigOptions/ConfigOptions.pro
|
||||
/src/ConfigOptions/_Create_Project.bat
|
||||
/src/ConfigOptions/_Create_project.sh
|
||||
/src/ConfigOptions/ConfigOptions.pri
|
||||
/src/DataProperty/DataProperty.pro
|
||||
/src/DataProperty/_Create_Project.bat
|
||||
/src/DataProperty/_Create_project.sh
|
||||
/src/DataProperty/DataProperty.pri
|
||||
/src/geometry/geometry.pro
|
||||
/src/geometry/_Create_Project.bat
|
||||
/src/geometry/_Create_project.sh
|
||||
/src/geometry/geometry.pri
|
||||
/src/GeometryCommand/GeometryCommand.pro
|
||||
/src/GeometryCommand/_Create_Project.bat
|
||||
/src/GeometryCommand/_Create_project.sh
|
||||
/src/GeometryCommand/GeometryCommand.pri
|
||||
/src/GeometryDataExchange/GeometryDataExchange.pro
|
||||
/src/GeometryDataExchange/_Create_Project.bat
|
||||
/src/GeometryDataExchange/_Create_project.sh
|
||||
/src/GeometryDataExchange/GeometryDataExchange.pri
|
||||
/src/GeometryWidgets/GeometryWidgets.pri
|
||||
/src/GeometryWidgets/GeometryWidgets.pro
|
||||
/src/GeometryWidgets/_Create_project.sh
|
||||
/src/GeometryWidgets/_Create_Project.bat
|
||||
/src/GmshModule/GmshModule.pri
|
||||
/src/GmshModule/GmshModule.pro
|
||||
/src/GmshModule/_Create_Project.bat
|
||||
/src/GmshModule/_Create_project.sh
|
||||
/src/IO/IO.pri
|
||||
/src/IO/IO.pro
|
||||
/src/IO/_Create_Project.bat
|
||||
/src/IO/_Create_project.sh
|
||||
/src/License/License.pri
|
||||
/src/License/License.pro
|
||||
/src/License/_Create_Project.bat
|
||||
/src/License/_Create_project.sh
|
||||
/src/MainWidgets/MainWidgets.pri
|
||||
/src/MainWidgets/MainWidgets.pro
|
||||
/src/MainWidgets/_Create_Project.bat
|
||||
/src/MainWidgets/_Create_project.sh
|
||||
/src/mainWindow/mainWindow.pri
|
||||
/src/mainWindow/mainWindow.pro
|
||||
/src/mainWindow/_Create_Project.bat
|
||||
/src/mainWindow/_Create_project.sh
|
||||
/src/Material/Material.pri
|
||||
/src/Material/Material.pro
|
||||
/src/Material/_Create_Project.bat
|
||||
/src/Material/_Create_project.sh
|
||||
/src/meshData/meshData.pro
|
||||
/src/meshData/_Create_Project.bat
|
||||
/src/meshData/_Create_project.sh
|
||||
/src/meshData/meshData.pri
|
||||
/src/ModelData/ModelData.pri
|
||||
/src/ModelData/ModelData.pro
|
||||
/src/ModelData/_Create_Project.bat
|
||||
/src/ModelData/_Create_project.sh
|
||||
/src/moduleBase/moduleBase.pri
|
||||
/src/moduleBase/moduleBase.pro
|
||||
/src/moduleBase/_Create_Project.bat
|
||||
/src/moduleBase/_Create_project.sh
|
||||
/src/ParaClassFactory/ParaClassFactory.pro
|
||||
/src/ParaClassFactory/_Create_Project.bat
|
||||
/src/ParaClassFactory/_Create_project.sh
|
||||
/src/ParaClassFactory/ParaClassFactory.pri
|
||||
/src/PluginCustomizer/PluginCustomizer.pri
|
||||
/src/PluginCustomizer/PluginCustomizer.pro
|
||||
/src/PluginCustomizer/_Create_Project.bat
|
||||
/src/PluginCustomizer/_Create_project.sh
|
||||
/src/PluginManager/PluginManager.pri
|
||||
/src/PluginManager/PluginManager.pro
|
||||
/src/PluginManager/_Create_Project.bat
|
||||
/src/PluginManager/_Create_project.sh
|
||||
/src/PluginMeshDataExchange/PluginMeshDataExchange.pro
|
||||
/src/PluginMeshDataExchange/_Create_Project.bat
|
||||
/src/PluginMeshDataExchange/_Create_project.sh
|
||||
/src/PluginMeshDataExchange/PluginMeshDataExchange.pri
|
||||
/src/PostAlgorithm/PostAlgorithm.pri
|
||||
/src/PostAlgorithm/PostAlgorithm.pro
|
||||
/src/PostAlgorithm/_Create_Project.bat
|
||||
/src/PostCurveDataManager/PostCurveDataManager.pri
|
||||
/src/PostCurveDataManager/PostCurveDataManager.pro
|
||||
/src/PostInterface/PostInterface.pri
|
||||
/src/PostInterface/PostInterface.pro
|
||||
/src/PostInterface/_Create_Project.bat
|
||||
/src/PostPlotWidget/PostPlotWidget.pri
|
||||
/src/PostPlotWidget/PostPlotWidget.pro
|
||||
/src/PostRenderData/PostRenderData.pri
|
||||
/src/PostRenderData/PostRenderData.pro
|
||||
/src/PostRenderData/_Create_Project.bat
|
||||
/src/PostWidgets/PostWidgets.pri
|
||||
/src/PostWidgets/PostWidgets.pro
|
||||
/src/PostWidgets/_Create_Project.bat
|
||||
/src/PostWidgets/_Create_project.sh
|
||||
/src/ProjectTree/ProjectTree.pri
|
||||
/src/ProjectTree/ProjectTree.pro
|
||||
/src/ProjectTree/_Create_Project.bat
|
||||
/src/ProjectTree/_Create_project.sh
|
||||
/src/ProjectTreeExtend/ProjectTreeExtend.pro
|
||||
/src/ProjectTreeExtend/_Create_Project.bat
|
||||
/src/ProjectTreeExtend/_Create_project.sh
|
||||
/src/ProjectTreeExtend/ProjectTreeExtend.pri
|
||||
/src/SARibbonBar/_Create_Project.bat
|
||||
/src/SelfDefObject/SelfDefObject.pri
|
||||
/src/SelfDefObject/SelfDefObject.pro
|
||||
/src/SelfDefObject/_Create_Project.bat
|
||||
/src/SelfDefObject/_Create_project.sh
|
||||
/src/settings/settings.pro
|
||||
/src/settings/_Create_Project.bat
|
||||
/src/settings/_Create_project.sh
|
||||
/src/settings/settings.pri
|
||||
/src/SolverControl/SolverControl.pri
|
||||
/src/SolverControl/SolverControl.pro
|
||||
/src/SolverControl/_Create_Project.bat
|
||||
/src/SolverControl/_Create_project.sh
|
||||
/src/UserGuidence/UserGuidence.pro
|
||||
/src/UserGuidence/_Create_Project.bat
|
||||
/src/UserGuidence/_Create_project.sh
|
||||
/src/UserGuidence/UserGuidence.pri
|
||||
/src/XGenerateReport/XGenerateReport.pri
|
||||
/src/XGenerateReport/XGenerateReport.pro
|
||||
/src/XGenerateReport/_Create_Project.bat
|
||||
/src/XGenerateReport/_Create_project.sh
|
||||
.vscode
|
||||
.vs
|
||||
.idea
|
||||
/build
|
||||
/install
|
||||
/extlib
|
||||
/cmake-build-debug
|
||||
/cmake-build-release
|
||||
|
|
|
@ -44,7 +44,7 @@ endif()
|
|||
#-----------------------------------------------------------------------------
|
||||
# 测试环境定义(如果在支持cmake系统的IDE中编写代码,可以打开以下注释,并将路径修改为自己的Qt路径)
|
||||
#-----------------------------------------------------------------------------
|
||||
#[[set(CMAKE_INSTALL_PREFIX "${CMAKE_SOURCE_DIR}/install")
|
||||
set(CMAKE_INSTALL_PREFIX "${CMAKE_SOURCE_DIR}/install")
|
||||
message(STATUS "${PROJECT_NAME} will be installed to ${CMAKE_INSTALL_PREFIX}")
|
||||
|
||||
if (NOT DEFINED Qt5_DIR)
|
||||
|
@ -53,7 +53,7 @@ if (NOT DEFINED Qt5_DIR)
|
|||
elseif(FASTCAE_WIN)
|
||||
set(Qt5_DIR "D:/software/Qt/Qt5.14.2/5.14.2/msvc2017_64/lib/cmake/Qt5" CACHE PATH "Qt5Config.cmake所在目录" FORCE)
|
||||
endif()
|
||||
endif()]]
|
||||
endif()
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# 编译选项设置
|
||||
|
|
|
@ -72,21 +72,26 @@ add_library(FASTCAE::HDF5HL SHARED IMPORTED)
|
|||
add_library(FASTCAE::HDF5HLCPP SHARED IMPORTED)
|
||||
add_library(FASTCAE::HDF5TOOLS SHARED IMPORTED)
|
||||
|
||||
set_property(TARGET FASTCAE::HDF5 PROPERTY INTERFACE_COMPILE_DEFINITIONS "H5_BUILT_AS_DYNAMIC_LIB")
|
||||
set_property(TARGET FASTCAE::HDF5 PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${HDF5_INCLUDE_DIRS})
|
||||
set_property(TARGET FASTCAE::HDF5 APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
|
||||
|
||||
set_property(TARGET FASTCAE::HDF5CPP PROPERTY INTERFACE_COMPILE_DEFINITIONS "H5_BUILT_AS_DYNAMIC_LIB")
|
||||
set_property(TARGET FASTCAE::HDF5CPP PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${HDF5_INCLUDE_DIRS})
|
||||
set_property(TARGET FASTCAE::HDF5CPP APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
|
||||
set_property(TARGET FASTCAE::HDF5CPP PROPERTY INTERFACE_LINK_LIBRARIES FASTCAE::HDF5)
|
||||
|
||||
set_property(TARGET FASTCAE::HDF5HL PROPERTY INTERFACE_COMPILE_DEFINITIONS "H5_BUILT_AS_DYNAMIC_LIB")
|
||||
set_property(TARGET FASTCAE::HDF5HL PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${HDF5_INCLUDE_DIRS})
|
||||
set_property(TARGET FASTCAE::HDF5HL APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
|
||||
set_property(TARGET FASTCAE::HDF5HL PROPERTY INTERFACE_LINK_LIBRARIES FASTCAE::HDF5)
|
||||
|
||||
set_property(TARGET FASTCAE::HDF5HLCPP PROPERTY INTERFACE_COMPILE_DEFINITIONS "H5_BUILT_AS_DYNAMIC_LIB")
|
||||
set_property(TARGET FASTCAE::HDF5HLCPP PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${HDF5_INCLUDE_DIRS})
|
||||
set_property(TARGET FASTCAE::HDF5HLCPP APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
|
||||
set_property(TARGET FASTCAE::HDF5HLCPP PROPERTY INTERFACE_LINK_LIBRARIES FASTCAE::HDF5HL)
|
||||
|
||||
set_property(TARGET FASTCAE::HDF5TOOLS PROPERTY INTERFACE_COMPILE_DEFINITIONS "H5_BUILT_AS_DYNAMIC_LIB")
|
||||
set_property(TARGET FASTCAE::HDF5TOOLS PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${HDF5_INCLUDE_DIRS})
|
||||
set_property(TARGET FASTCAE::HDF5TOOLS APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
|
||||
set_property(TARGET FASTCAE::HDF5TOOLS PROPERTY INTERFACE_LINK_LIBRARIES FASTCAE::HDF5)
|
||||
|
|
|
@ -36,9 +36,8 @@ if(_WIN_)
|
|||
#list(APPEND _depend_library XGenerateReport License)
|
||||
endif()
|
||||
|
||||
|
||||
list(APPEND _runtimes_libraries
|
||||
Qt5::Core Qt5::Gui Qt5::Widgets
|
||||
Qt5::Core Qt5::Gui Qt5::Widgets FASTCAE::HDF5 FASTCAE::HDF5CPP
|
||||
)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
|
|
|
@ -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 "geometry/geometrySet.h"
|
||||
#include "geometry/geometryData.h"
|
||||
#include "Geometry/geometrySet.h"
|
||||
#include "Geometry/geometryData.h"
|
||||
#include <QFileInfo>
|
||||
#include <vtkSTLReader.h>
|
||||
|
||||
|
|
|
@ -1,34 +1,38 @@
|
|||
#include "ProjectFileIO.h"
|
||||
#include <QDomDocument>
|
||||
#include <QTextStream>
|
||||
|
||||
#include "DataProperty/modelTreeItemType.h"
|
||||
#include "Geometry/geometryData.h"
|
||||
#include "Geometry/geometrySet.h"
|
||||
#include "MainWindow/SignalHandler.h"
|
||||
#include "Material/MaterialSingletion.h"
|
||||
#include "MeshData/meshSingleton.h"
|
||||
#include "ModelData/modelDataSingleton.h"
|
||||
#include "ModelData/modelDataBase.h"
|
||||
#include "ModelData/modelDataBaseExtend.h"
|
||||
#include "ModelData/modelDataFactory.h"
|
||||
#include "DataProperty/modelTreeItemType.h"
|
||||
#include "Material/MaterialSingletion.h"
|
||||
#include "Geometry/geometrySet.h"
|
||||
#include "ModelData/modelDataSingleton.h"
|
||||
#include "ModuleBase/CommonFunctions.h"
|
||||
#include "PluginManager/PluginManager.h"
|
||||
#include "MainWindow/signalHandler.h"
|
||||
#include <QDebug>
|
||||
#include <QDomNodeList>
|
||||
#include <QDomElement>
|
||||
#include <QDomText>
|
||||
#include <QDomAttr>
|
||||
#include <QCoreApplication>
|
||||
#include <QDir>
|
||||
|
||||
#include <BRep_Builder.hxx>
|
||||
#include <BRepTools.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#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
|
||||
{
|
||||
ProjectFileIO::ProjectFileIO(GUI::MainWindow *mw, GUI::SignalHandler *sh, const QString &fileName, bool read)
|
||||
: IOBase(fileName), ModuleBase::ThreadTask(mw), _read(read)
|
||||
namespace IO {
|
||||
ProjectFileIO::ProjectFileIO(GUI::MainWindow* mw, GUI::SignalHandler* sh,
|
||||
const QString& fileName, bool read)
|
||||
: IOBase(fileName)
|
||||
, ModuleBase::ThreadTask(mw)
|
||||
, _read(read)
|
||||
{
|
||||
_geoData = Geometry::GeometryData::getInstance();
|
||||
_meshData = MeshData::MeshData::getInstance();
|
||||
|
@ -36,19 +40,17 @@ namespace IO
|
|||
_materialData = Material::MaterialSingleton::getInstance();
|
||||
_plugins = Plugins::PluginManager::getInstance();
|
||||
|
||||
connect(this, SIGNAL(processFinished(QString, bool, bool)), sh, SIGNAL(projectFileProcessedSig(QString, bool, bool)));
|
||||
connect(this, SIGNAL(processFinished(QString, bool, bool)), sh,
|
||||
SIGNAL(projectFileProcessedSig(QString, bool, bool)));
|
||||
}
|
||||
|
||||
void ProjectFileIO::run()
|
||||
{
|
||||
bool success = false;
|
||||
if (_read)
|
||||
{
|
||||
if(_read) {
|
||||
emit showInformation(tr("Opening Project File: \"%1\"").arg(_filename));
|
||||
success = this->read();
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
emit showInformation(tr("Saving Project File: \"%1\"").arg(_filename));
|
||||
success = this->write();
|
||||
}
|
||||
|
@ -86,7 +88,8 @@ namespace IO
|
|||
|
||||
bool isEmpty = true;
|
||||
_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);
|
||||
QDomElement root = _doc->createElement("DISO_FILE_1.0");
|
||||
_doc->appendChild(root);
|
||||
|
@ -127,8 +130,7 @@ namespace IO
|
|||
file.close();
|
||||
// 写网格
|
||||
|
||||
if (meshCount > 0)
|
||||
{
|
||||
if(meshCount > 0) {
|
||||
QFile mhFile(tempPath + "mesh.mh");
|
||||
if(!mhFile.open(QIODevice::WriteOnly))
|
||||
return false;
|
||||
|
@ -145,7 +147,8 @@ namespace IO
|
|||
{
|
||||
bool isEmpty = true;
|
||||
_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);
|
||||
QDomElement root = _doc->createElement("DISO_FILE_1.0");
|
||||
_doc->appendChild(root);
|
||||
|
@ -205,8 +208,7 @@ namespace IO
|
|||
_doc = new QDomDocument;
|
||||
int row{ 0 }, col{ 0 };
|
||||
QString errstr{};
|
||||
if (!_doc->setContent(&_file, true, &errstr, &row, &col))
|
||||
{
|
||||
if(!_doc->setContent(&_file, true, &errstr, &row, &col)) {
|
||||
qDebug() << errstr << "line: " << row << "col: " << col;
|
||||
_file.close();
|
||||
return false;
|
||||
|
@ -237,8 +239,7 @@ namespace IO
|
|||
const QString tempPath = exelPath + "/../tempIO/";
|
||||
|
||||
bool okremove = RemoveDir(tempPath);
|
||||
if (okremove)
|
||||
{
|
||||
if(okremove) {
|
||||
QDir dir = QDir(tempPath);
|
||||
if(!dir.exists())
|
||||
dir.mkdir(tempPath);
|
||||
|
@ -252,8 +253,7 @@ namespace IO
|
|||
if(!file.open(QIODevice::ReadOnly | QFile::Text))
|
||||
return false;
|
||||
_doc = new QDomDocument;
|
||||
if (!_doc->setContent(&file))
|
||||
{
|
||||
if(!_doc->setContent(&file)) {
|
||||
file.close();
|
||||
return false;
|
||||
}
|
||||
|
@ -271,8 +271,7 @@ namespace IO
|
|||
// readMeshData(&meshNodeList);
|
||||
|
||||
QFile mhFile(tempPath + "mesh.mh");
|
||||
if (mhFile.open(QIODevice::ReadOnly))
|
||||
{
|
||||
if(mhFile.open(QIODevice::ReadOnly)) {
|
||||
_dataStream = new QDataStream(&mhFile);
|
||||
_meshData->readBinaryFile(_dataStream);
|
||||
_meshData->generateDisplayDataSet();
|
||||
|
@ -328,8 +327,7 @@ namespace IO
|
|||
QDomElement root = nodeList->at(0).toElement();
|
||||
QDomNodeList modelList = root.elementsByTagName("Model");
|
||||
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();
|
||||
QString stype = model.attribute("Type");
|
||||
ProjectTreeType type = getTreeTypeByString(stype);
|
||||
|
@ -347,4 +345,4 @@ namespace IO
|
|||
}
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace IO
|
||||
|
|
|
@ -1,36 +1,37 @@
|
|||
#include "CustomizerHelper.h"
|
||||
#include "MainWindow.h"
|
||||
#include "signalHandler.h"
|
||||
#include "SubWindowManager.h"
|
||||
|
||||
#include "ConfigOptions/ConfigDataReader.h"
|
||||
#include "ConfigOptions/ConfigOptions.h"
|
||||
#include "ConfigOptions/GeometryConfig.h"
|
||||
#include "ConfigOptions/GlobalConfig.h"
|
||||
#include "ConfigOptions/MeshConfig.h"
|
||||
#include "ConfigOptions/PostConfig.h"
|
||||
#include "ConfigOptions/ProjectTreeConfig.h"
|
||||
#include "ConfigOptions/ConfigOptions.h"
|
||||
#include "ConfigOptions/ConfigDataReader.h"
|
||||
#include "ConfigOptions/GlobalConfig.h"
|
||||
#include "IO/IOConfig.h"
|
||||
#include "MainWidgets/ControlPanel.h"
|
||||
#include "MainWidgets/messageWindow.h"
|
||||
#include "MainWindow.h"
|
||||
#include "MainWindow/SARibbonMWUi.h"
|
||||
#include "PythonModule/PyAgent.h"
|
||||
#include "SARibbonBar/SARibbonBar.h"
|
||||
#include "SARibbonBar/SARibbonCategory.h"
|
||||
#include "SARibbonBar/SARibbonMainWindow.h"
|
||||
#include "Settings/BusAPI.h"
|
||||
#include "IO/IOConfig.h"
|
||||
#include "SignalHandler.h"
|
||||
#include "SubWindowManager.h"
|
||||
|
||||
#include <QAction>
|
||||
#include <QToolBar>
|
||||
#include <QDebug>
|
||||
#include <QMenuBar>
|
||||
#include <QMessageBox>
|
||||
#include <QDebug>
|
||||
#include "SARibbonBar/SARibbonMainWindow.h"
|
||||
#include "SARibbonBar/SARibbonCategory.h"
|
||||
#include "MainWindow/SARibbonMWUi.h"
|
||||
#include "SARibbonBar/SARibbonBar.h"
|
||||
#include <QToolBar>
|
||||
|
||||
namespace GUI
|
||||
{
|
||||
namespace GUI {
|
||||
CustomizerHelper::CustomizerHelper(MainWindow* m, Ui::MainWindowRibbon* ui)
|
||||
: _mainWindow(m), _ui(ui)
|
||||
{
|
||||
if (!isUseRibbon())
|
||||
: _mainWindow(m)
|
||||
, _ui(ui)
|
||||
{
|
||||
if(!isUseRibbon()) {
|
||||
_menuList.append(_ui->menuFile);
|
||||
_menuList.append(_ui->menuView);
|
||||
_menuList.append(_ui->menuGeometry);
|
||||
|
@ -67,28 +68,23 @@ namespace GUI
|
|||
void CustomizerHelper::startCustomizer()
|
||||
{
|
||||
qDebug() << "mainWindow start cus";
|
||||
if (!isUseRibbon())
|
||||
{
|
||||
if(!isUseRibbon()) {
|
||||
for(QToolBar* tb : _toolBarList)
|
||||
tb->setVisible(false);
|
||||
|
||||
for (QMenu *me : _menuList)
|
||||
{
|
||||
for(QMenu* me : _menuList) {
|
||||
QList<QAction*> acs = me->findChildren<QAction*>();
|
||||
for(auto a : acs)
|
||||
a->setVisible(false);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
QList<SARibbonPannel*> pannels = _ui->home_page->pannelList();
|
||||
pannels += _ui->geometry_page->pannelList();
|
||||
pannels += _ui->mesh_page->pannelList();
|
||||
pannels += _ui->solve_page->pannelList();
|
||||
pannels += _ui->window_page->pannelList();
|
||||
pannels += _ui->help_page->pannelList();
|
||||
for (SARibbonPannel *pannel : pannels)
|
||||
{
|
||||
for(SARibbonPannel* pannel : pannels) {
|
||||
// modify false -> true
|
||||
pannel->setVisible(true);
|
||||
}
|
||||
|
@ -103,21 +99,17 @@ namespace GUI
|
|||
void CustomizerHelper::finishCustomizer()
|
||||
{
|
||||
qDebug() << "mainWindow finish cus";
|
||||
if (!isUseRibbon())
|
||||
{
|
||||
if(!isUseRibbon()) {
|
||||
for(QToolBar* tb : _toolBarList)
|
||||
tb->setVisible(true);
|
||||
|
||||
for (QMenu *me : _menuList)
|
||||
{
|
||||
for(QMenu* me : _menuList) {
|
||||
QList<QAction*> acs = me->findChildren<QAction*>();
|
||||
for(auto a : acs)
|
||||
a->setVisible(true);
|
||||
}
|
||||
_ui->SketchToolBar->setVisible(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
QList<SARibbonPannel*> pannels = _ui->home_page->pannelList();
|
||||
pannels += _ui->geometry_page->pannelList();
|
||||
pannels += _ui->mesh_page->pannelList();
|
||||
|
@ -135,8 +127,7 @@ namespace GUI
|
|||
bool CustomizerHelper::isUseRibbon() const
|
||||
{
|
||||
// SARibbonMainWindow* ribbonwindow = qobject_cast<SARibbonMainWindow*>(_mainWindow);
|
||||
if (_mainWindow != nullptr)
|
||||
{
|
||||
if(_mainWindow != nullptr) {
|
||||
return _mainWindow->isUseRibbon();
|
||||
}
|
||||
return false;
|
||||
|
@ -145,10 +136,10 @@ namespace GUI
|
|||
void CustomizerHelper::registerInterface()
|
||||
{
|
||||
QString error = this->readConfigOptions();
|
||||
if (!error.isEmpty())
|
||||
{
|
||||
// QMessageBox::StandardButton b = QMessageBox::critical(_mainWindow, "Error", QObject::tr("Error Occured %1 ! still continue?").arg(error), QMessageBox::Yes | QMessageBox::No);
|
||||
// if (b == QMessageBox::No) return;
|
||||
if(!error.isEmpty()) {
|
||||
// QMessageBox::StandardButton b = QMessageBox::critical(_mainWindow, "Error",
|
||||
// QObject::tr("Error Occured %1 ! still continue?").arg(error), QMessageBox::Yes |
|
||||
// QMessageBox::No); if (b == QMessageBox::No) return;
|
||||
}
|
||||
|
||||
this->updateBasicInfo();
|
||||
|
@ -157,8 +148,7 @@ namespace GUI
|
|||
ConfigOption::GeometryConfig* geometryOption = option->getGeometryConfig();
|
||||
ConfigOption::MeshConfig* meshOption = option->getMeshConfig();
|
||||
|
||||
if (!isUseRibbon())
|
||||
{
|
||||
if(!isUseRibbon()) {
|
||||
bool ok = geometryOption->isImportGeometryEnabled();
|
||||
this->enableGeoImport(ok);
|
||||
ok = geometryOption->isExportGeometryEnabled();
|
||||
|
@ -212,9 +202,7 @@ namespace GUI
|
|||
_ui->SelectToolBar->setVisible(geoEnable || meshEnable);
|
||||
_ui->DisplayToolBar->setVisible(geoEnable || meshEnable);
|
||||
// qApp->processEvents();
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
// ribbon的设置方式
|
||||
}
|
||||
_mainWindow->getControlPanel()->registerEnabledModule();
|
||||
|
@ -227,7 +215,8 @@ namespace GUI
|
|||
QString error{};
|
||||
// bool ok = false;
|
||||
QString path = qApp->applicationDirPath();
|
||||
ConfigOption::ConfigDataReader reader(path + "/../ConfigFiles/", ConfigOption::ConfigOption::getInstance());
|
||||
ConfigOption::ConfigDataReader reader(path + "/../ConfigFiles/",
|
||||
ConfigOption::ConfigOption::getInstance());
|
||||
error = reader.read();
|
||||
|
||||
if(!error.isEmpty())
|
||||
|
@ -242,14 +231,11 @@ namespace GUI
|
|||
|
||||
const QString lang = Setting::BusAPI::instance()->getLanguage();
|
||||
QString softName = "FastCAE";
|
||||
if (lang.toLower() == "chinese")
|
||||
{
|
||||
if(lang.toLower() == "chinese") {
|
||||
QString f = globalConfig->getChineseName();
|
||||
if(!f.isEmpty())
|
||||
softName = f;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
QString f = globalConfig->getSoftName();
|
||||
if(!f.isEmpty())
|
||||
softName = f;
|
||||
|
@ -277,8 +263,7 @@ namespace GUI
|
|||
{
|
||||
if(isUseRibbon())
|
||||
_ui->sketch_pannel_geometry->setVisible(on);
|
||||
else
|
||||
{
|
||||
else {
|
||||
_ui->menuSketch->setEnabled(on);
|
||||
_ui->StartSketchToolBar->setVisible(on);
|
||||
}
|
||||
|
@ -286,14 +271,11 @@ namespace GUI
|
|||
|
||||
void CustomizerHelper::enableGeoFeatureModeling(bool on)
|
||||
{
|
||||
if (isUseRibbon())
|
||||
{
|
||||
if(isUseRibbon()) {
|
||||
_ui->cube_pannel->setVisible(on);
|
||||
_ui->create_point_pannel->setVisible(on);
|
||||
_ui->base_plate_pannel->setVisible(on);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
_ui->menuFeature_Modeling->setEnabled(on);
|
||||
_ui->GeomertryFeatureToolBar->setVisible(on);
|
||||
}
|
||||
|
@ -301,14 +283,11 @@ namespace GUI
|
|||
|
||||
void CustomizerHelper::enableGeoFeatureOperate(bool on)
|
||||
{
|
||||
if (isUseRibbon())
|
||||
{
|
||||
if(isUseRibbon()) {
|
||||
_ui->chamfer_pannel->setVisible(on);
|
||||
_ui->sum_pannel->setVisible(on);
|
||||
_ui->stretch_pannel->setVisible(on);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
_ui->menuFeature_Operation->setEnabled(on);
|
||||
_ui->ChamferToolBar->setVisible(on);
|
||||
_ui->BoolToolBar->setVisible(on);
|
||||
|
@ -318,8 +297,7 @@ namespace GUI
|
|||
|
||||
void CustomizerHelper::enableGeoSelectAndView(bool on)
|
||||
{
|
||||
if (!isUseRibbon())
|
||||
{
|
||||
if(!isUseRibbon()) {
|
||||
_ui->menuSelect_2->setEnabled(on);
|
||||
_ui->menuView_3->setEnabled(on);
|
||||
}
|
||||
|
@ -365,8 +343,7 @@ namespace GUI
|
|||
|
||||
void CustomizerHelper::enableMeshSelectAndView(bool on)
|
||||
{
|
||||
if (!isUseRibbon())
|
||||
{
|
||||
if(!isUseRibbon()) {
|
||||
_ui->menuView_2->setEnabled(on);
|
||||
_ui->menuSelect->setEnabled(on);
|
||||
}
|
||||
|
@ -381,4 +358,4 @@ namespace GUI
|
|||
_ui->actionBoxMeshNode->setVisible(on);
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace GUI
|
|
@ -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
|
|
@ -20,83 +20,81 @@
|
|||
* DISCLAIMED.
|
||||
* ==================================================================================
|
||||
*/
|
||||
#include <QMdiSubWindow>
|
||||
#include <QDebug>
|
||||
#include <QList>
|
||||
#include <QTreeWidgetItem>
|
||||
#include <QFileDialog>
|
||||
#include <QMessageBox>
|
||||
#include <QCloseEvent>
|
||||
#include <QSignalMapper>
|
||||
#include <QLabel>
|
||||
#include "MainWindow.h"
|
||||
#include "signalHandler.h"
|
||||
#include "translator.h"
|
||||
#include "SubWindowManager.h"
|
||||
#include "SARibbonMWUi.h"
|
||||
#include "Settings/BusAPI.h"
|
||||
#include "Settings/GraphOption.h"
|
||||
#include "ModuleBase/ModuleType.h"
|
||||
#include "ModuleBase/ModuleBase.h"
|
||||
#include "MainWidgets/ControlPanel.h"
|
||||
#include "MainWidgets/messageWindow.h"
|
||||
#include "MainWidgets/ProcessWindow.h"
|
||||
#include "MainWidgets/projectSolveDialog.h"
|
||||
#include "MainWidgets/DialogCreateSet.h"
|
||||
#include "MainWidgets/DialogCreateGeoComponent.h"
|
||||
#include "MainWidgets/DialogVTKTransform.h"
|
||||
#include "MainWidgets/preWindow.h"
|
||||
#include "GeometryWidgets/dialogSketchPlane.h"
|
||||
#include "MeshData/meshSingleton.h"
|
||||
#include "MeshData/meshKernal.h"
|
||||
#include "Geometry/geometryData.h"
|
||||
#include "DialogAbout.h"
|
||||
#include <QDesktopServices>
|
||||
#include <QMessageBox>
|
||||
#include <QApplication>
|
||||
#include "IO/IOConfig.h"
|
||||
|
||||
#include "ConfigOptions/ConfigOptions.h"
|
||||
#include "ConfigOptions/GlobalConfig.h"
|
||||
#include "ConfigOptions/GeometryConfig.h"
|
||||
#include "ConfigOptions/GlobalConfig.h"
|
||||
#include "ConfigOptions/MeshConfig.h"
|
||||
#include "ConfigOptions/PostConfig.h"
|
||||
#include "ConfigOptions/ProjectTreeConfig.h"
|
||||
#include "CustomizerHelper.h"
|
||||
#include "DialogAbout.h"
|
||||
#include "Geometry/geometryData.h"
|
||||
#include "GeometryWidgets/dialogSketchPlane.h"
|
||||
#include "GmshModule/GmshModule.h"
|
||||
#include "IO/IOConfig.h"
|
||||
#include "MainWidgets/ControlPanel.h"
|
||||
#include "MainWidgets/DialogCreateGeoComponent.h"
|
||||
#include "MainWidgets/DialogCreateSet.h"
|
||||
#include "MainWidgets/DialogFilterMesh.h"
|
||||
#include "MainWidgets/DialogVTKTransform.h"
|
||||
#include "MainWidgets/messageWindow.h"
|
||||
#include "MainWidgets/preWindow.h"
|
||||
#include "MainWidgets/ProcessWindow.h"
|
||||
#include "MainWidgets/projectSolveDialog.h"
|
||||
#include "MainWindowPy.h"
|
||||
#include "MeshData/meshKernal.h"
|
||||
#include "MeshData/meshSingleton.h"
|
||||
#include "ModelData/modelDataBaseExtend.h"
|
||||
#include "ModelData/modelDataSingleton.h"
|
||||
#include "ModuleBase/ModuleBase.h"
|
||||
#include "ModuleBase/ModuleType.h"
|
||||
#include "ModuleBase/ThreadTaskManager.h"
|
||||
#include "PluginManager/PluginManager.h"
|
||||
#include "PythonModule/PyAgent.h"
|
||||
#include "MainWindowPy.h"
|
||||
#include "CustomizerHelper.h"
|
||||
#include "SolverControl/DialogSolverManager.h"
|
||||
#include "GmshModule/GmshModule.h"
|
||||
#include "ModuleBase/ThreadTaskManager.h"
|
||||
#include "MainWidgets/DialogFilterMesh.h"
|
||||
#include "SARibbonMWUi.h"
|
||||
#include "Settings/BusAPI.h"
|
||||
#include "Settings/GraphOption.h"
|
||||
#include "SignalHandler.h"
|
||||
#include "SolverControl/DialogSolverManager.h"
|
||||
#include "SubWindowManager.h"
|
||||
#include "Translator.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QCloseEvent>
|
||||
#include <QDebug>
|
||||
#include <QDesktopServices>
|
||||
#include <QFileDialog>
|
||||
#include <QLabel>
|
||||
#include <QList>
|
||||
#include <QMdiSubWindow>
|
||||
#include <QMessageBox>
|
||||
#include <QSignalMapper>
|
||||
#include <QTreeWidgetItem>
|
||||
// ribbon
|
||||
#include "SARibbonBar/SARibbonBar.h"
|
||||
#include "SARibbonBar/SARibbonCategory.h"
|
||||
#include "SARibbonBar/SARibbonPannel.h"
|
||||
#include "SARibbonBar/SARibbonContextCategory.h"
|
||||
#include "SARibbonBar/SARibbonPannel.h"
|
||||
#include "SARibbonBar/SARibbonTabBar.h"
|
||||
// Post
|
||||
#include "Common/Types.h"
|
||||
#include "PostInterface/AnimationToolBar.h"
|
||||
#include "PostInterface/RenderDirector.h"
|
||||
#include "Common/Types.h"
|
||||
namespace GUI
|
||||
{
|
||||
MainWindow::MainWindow(bool useRibbon) : SARibbonMainWindow(nullptr, useRibbon), _ui(new Ui::MainWindowRibbon)
|
||||
{
|
||||
if (useRibbon)
|
||||
namespace GUI {
|
||||
MainWindow::MainWindow(bool useRibbon)
|
||||
: SARibbonMainWindow(nullptr, useRibbon)
|
||||
, _ui(new Ui::MainWindowRibbon)
|
||||
{
|
||||
if(useRibbon) {
|
||||
_ui->setupRibbonUi(this);
|
||||
// ribbon customize
|
||||
// MainWindow的初始化,生成QAction
|
||||
// 生成ribbon布局
|
||||
m_ribbonActionMgr = new SARibbonActionsManager(static_cast<SARibbonMainWindow*>(this));
|
||||
m_ribbonActionMgr->setAllActionCanCustomize(true); // 设置所有管理的action可编辑
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
_ui->setupUi(this);
|
||||
}
|
||||
|
||||
|
@ -152,9 +150,9 @@ namespace GUI
|
|||
|
||||
// ribbon customize
|
||||
// MainWindow的构造函数最后
|
||||
if (useRibbon)
|
||||
{
|
||||
const QString strCostomizePath = QApplication::applicationDirPath() + "/customization.xml";
|
||||
if(useRibbon) {
|
||||
const QString strCostomizePath =
|
||||
QApplication::applicationDirPath() + "/customization.xml";
|
||||
sa_apply_customize_from_xml_file(strCostomizePath, this, m_ribbonActionMgr);
|
||||
}
|
||||
}
|
||||
|
@ -198,8 +196,7 @@ namespace GUI
|
|||
delete _postToolBar;
|
||||
|
||||
// ribbon customize
|
||||
if (m_ribbonActionMgr != nullptr)
|
||||
{
|
||||
if(m_ribbonActionMgr != nullptr) {
|
||||
delete m_ribbonActionMgr;
|
||||
}
|
||||
}
|
||||
|
@ -208,9 +205,12 @@ namespace GUI
|
|||
{
|
||||
connect(this, SIGNAL(closeMainWindow()), this, SLOT(closeWindow()));
|
||||
connect(this, SIGNAL(sendInfoToStatesBar(QString)), this, SLOT(setStatusBarInfo(QString)));
|
||||
// connect(this, SIGNAL(importMeshByNamesSig(QString)), this, SLOT(importMesh(QString)));
|
||||
connect(this, SIGNAL(importMeshDataSetSig(vtkDataSet *)), this, SLOT(importMeshDataset(vtkDataSet *)));
|
||||
connect(this, SIGNAL(printMessageSig(Common::Message, QString)), this, SLOT(printMessage(Common::Message, QString)));
|
||||
// connect(this, SIGNAL(importMeshByNamesSig(QString)), this,
|
||||
//SLOT(importMesh(QString)));
|
||||
connect(this, SIGNAL(importMeshDataSetSig(vtkDataSet*)), this,
|
||||
SLOT(importMeshDataset(vtkDataSet*)));
|
||||
connect(this, SIGNAL(printMessageSig(Common::Message, QString)), this,
|
||||
SLOT(printMessage(Common::Message, QString)));
|
||||
|
||||
connect(_ui->actionNew, SIGNAL(triggered()), this, SLOT(on_actionNew()));
|
||||
connect(_ui->actionOpen, SIGNAL(triggered()), this, SLOT(on_actionOpen()));
|
||||
|
@ -229,10 +229,12 @@ namespace GUI
|
|||
connect(_ui->actionAbout, SIGNAL(triggered()), this, SLOT(on_about()));
|
||||
connect(_ui->actionUser_Manual, SIGNAL(triggered()), this, SLOT(on_userManual()));
|
||||
connect(_ui->actionCreate_Set, SIGNAL(triggered()), this, SLOT(on_CreateSet()));
|
||||
connect(_ui->actionCreateGeoComponent, SIGNAL(triggered()), this, SLOT(on_CreateGeoComponent()));
|
||||
connect(_ui->actionCreateGeoComponent, SIGNAL(triggered()), this,
|
||||
SLOT(on_CreateGeoComponent()));
|
||||
connect(_ui->actionSave_Script, SIGNAL(triggered()), this, SLOT(on_SaveScript()));
|
||||
connect(_ui->actionExecute_Script, SIGNAL(triggered()), this, SLOT(on_ExecuateScript()));
|
||||
connect(_ui->actionPluginManager, SIGNAL(triggered()), Plugins::PluginManager::getInstance(), SLOT(manage()));
|
||||
connect(_ui->actionPluginManager, SIGNAL(triggered()),
|
||||
Plugins::PluginManager::getInstance(), SLOT(manage()));
|
||||
connect(_ui->actionFilterMesh, SIGNAL(triggered()), this, SLOT(on_FilterMesh()));
|
||||
connect(_ui->actionVTKTranslation, SIGNAL(triggered()), this, SLOT(on_VTKTranslation()));
|
||||
|
||||
|
@ -252,7 +254,8 @@ namespace GUI
|
|||
_viewSignalMapper->setMapping(_ui->actionViewYMinus, QString("YMinus"));
|
||||
_viewSignalMapper->setMapping(_ui->actionViewZPlus, QString("ZPlus"));
|
||||
_viewSignalMapper->setMapping(_ui->actionViewZMinus, QString("ZMinus"));
|
||||
connect(_viewSignalMapper, SIGNAL(mapped(QString)), _subWindowManager, SLOT(setView(QString)));
|
||||
connect(_viewSignalMapper, SIGNAL(mapped(QString)), _subWindowManager,
|
||||
SLOT(setView(QString)));
|
||||
// 设置mesh选择模式
|
||||
_selectSignalMapper = new QSignalMapper(this);
|
||||
connect(_ui->actionSelectOff, SIGNAL(triggered()), _selectSignalMapper, SLOT(map()));
|
||||
|
@ -262,11 +265,16 @@ namespace GUI
|
|||
connect(_ui->actionBoxMeshNode, SIGNAL(triggered()), _selectSignalMapper, SLOT(map()));
|
||||
connect(_ui->actionBoxMeshCell, SIGNAL(triggered()), _selectSignalMapper, SLOT(map()));
|
||||
_selectSignalMapper->setMapping(_ui->actionSelectOff, (int)ModuleBase::SelectModel::None);
|
||||
//_selectSignalMapper->setMapping(_ui->actionSelectGeoBody, (int)ModuleBase::SelectModel::GeometryBody);
|
||||
_selectSignalMapper->setMapping(_ui->actionSelectMeshNode, (int)ModuleBase::SelectModel::MeshNode);
|
||||
_selectSignalMapper->setMapping(_ui->actionSelectMeshCell, (int)ModuleBase::SelectModel::MeshCell);
|
||||
_selectSignalMapper->setMapping(_ui->actionBoxMeshNode, (int)ModuleBase::SelectModel::BoxMeshNode);
|
||||
_selectSignalMapper->setMapping(_ui->actionBoxMeshCell, (int)ModuleBase::SelectModel::BoxMeshCell);
|
||||
//_selectSignalMapper->setMapping(_ui->actionSelectGeoBody,
|
||||
//(int)ModuleBase::SelectModel::GeometryBody);
|
||||
_selectSignalMapper->setMapping(_ui->actionSelectMeshNode,
|
||||
(int)ModuleBase::SelectModel::MeshNode);
|
||||
_selectSignalMapper->setMapping(_ui->actionSelectMeshCell,
|
||||
(int)ModuleBase::SelectModel::MeshCell);
|
||||
_selectSignalMapper->setMapping(_ui->actionBoxMeshNode,
|
||||
(int)ModuleBase::SelectModel::BoxMeshNode);
|
||||
_selectSignalMapper->setMapping(_ui->actionBoxMeshCell,
|
||||
(int)ModuleBase::SelectModel::BoxMeshCell);
|
||||
connect(_selectSignalMapper, SIGNAL(mapped(int)), this, SIGNAL(selectModelChangedSig(int)));
|
||||
connect(_selectSignalMapper, SIGNAL(mapped(int)), this, SLOT(selectModelChanged(int)));
|
||||
// 网格显示模式
|
||||
|
@ -281,27 +289,41 @@ namespace GUI
|
|||
// 设置几何选取模式(点、线、面)
|
||||
_selectGeometryModeMapper = new QSignalMapper(this);
|
||||
connect(_ui->actionSelectOff, SIGNAL(triggered()), _selectGeometryModeMapper, SLOT(map()));
|
||||
connect(_ui->actionSelectPoint, SIGNAL(triggered()), _selectGeometryModeMapper, SLOT(map()));
|
||||
connect(_ui->actionSelectCurve, SIGNAL(triggered()), _selectGeometryModeMapper, SLOT(map()));
|
||||
connect(_ui->actionSelectPoint, SIGNAL(triggered()), _selectGeometryModeMapper,
|
||||
SLOT(map()));
|
||||
connect(_ui->actionSelectCurve, SIGNAL(triggered()), _selectGeometryModeMapper,
|
||||
SLOT(map()));
|
||||
connect(_ui->actionSelectFace, SIGNAL(triggered()), _selectGeometryModeMapper, SLOT(map()));
|
||||
connect(_ui->actionSelectGeometryBody, SIGNAL(triggered()), _selectGeometryModeMapper, SLOT(map()));
|
||||
_selectGeometryModeMapper->setMapping(_ui->actionSelectOff, (int)ModuleBase::SelectModel::None);
|
||||
_selectGeometryModeMapper->setMapping(_ui->actionSelectPoint, (int)ModuleBase::SelectModel::GeometryWinPoint);
|
||||
_selectGeometryModeMapper->setMapping(_ui->actionSelectCurve, (int)ModuleBase::SelectModel::GeometryWinCurve);
|
||||
_selectGeometryModeMapper->setMapping(_ui->actionSelectFace, (int)ModuleBase::SelectModel::GeometryWinSurface);
|
||||
_selectGeometryModeMapper->setMapping(_ui->actionSelectGeometryBody, (int)ModuleBase::SelectModel::GeometryWinBody);
|
||||
connect(_ui->actionSelectGeometryBody, SIGNAL(triggered()), _selectGeometryModeMapper,
|
||||
SLOT(map()));
|
||||
_selectGeometryModeMapper->setMapping(_ui->actionSelectOff,
|
||||
(int)ModuleBase::SelectModel::None);
|
||||
_selectGeometryModeMapper->setMapping(_ui->actionSelectPoint,
|
||||
(int)ModuleBase::SelectModel::GeometryWinPoint);
|
||||
_selectGeometryModeMapper->setMapping(_ui->actionSelectCurve,
|
||||
(int)ModuleBase::SelectModel::GeometryWinCurve);
|
||||
_selectGeometryModeMapper->setMapping(_ui->actionSelectFace,
|
||||
(int)ModuleBase::SelectModel::GeometryWinSurface);
|
||||
_selectGeometryModeMapper->setMapping(_ui->actionSelectGeometryBody,
|
||||
(int)ModuleBase::SelectModel::GeometryWinBody);
|
||||
|
||||
connect(_selectGeometryModeMapper, SIGNAL(mapped(int)), this, SLOT(selectGeometryModelChanged(int)));
|
||||
connect(_selectGeometryModeMapper, SIGNAL(mapped(int)), this, SIGNAL(selectModelChangedSig(int)));
|
||||
connect(_selectGeometryModeMapper, SIGNAL(mapped(int)), this,
|
||||
SLOT(selectGeometryModelChanged(int)));
|
||||
connect(_selectGeometryModeMapper, SIGNAL(mapped(int)), this,
|
||||
SIGNAL(selectModelChangedSig(int)));
|
||||
|
||||
connect(_ui->actionPre_Window, SIGNAL(triggered()), _subWindowManager, SLOT(openPreWindow()));
|
||||
connect(_ui->actionPre_Window, SIGNAL(triggered()), _subWindowManager,
|
||||
SLOT(openPreWindow()));
|
||||
|
||||
connect(this, SIGNAL(importGeometrySig(QStringList)), this, SLOT(importGeometry(QStringList)));
|
||||
connect(this, SIGNAL(importGeometrySig(QStringList)), this,
|
||||
SLOT(importGeometry(QStringList)));
|
||||
connect(this, SIGNAL(exportGeometrySig(QString)), this, SLOT(exportGeometry(QString)));
|
||||
|
||||
connect(_ui->actionCreate_Sketch, SIGNAL(triggered()), this, SLOT(on_sketchClicked()));
|
||||
connect(this, SIGNAL(showGraphRangeSig(double, double)), this, SLOT(showGraphRange(double, double)));
|
||||
connect(this, SIGNAL(startSketchSig(bool, double *, double *)), this, SLOT(startSketch(bool)));
|
||||
connect(this, SIGNAL(showGraphRangeSig(double, double)), this,
|
||||
SLOT(showGraphRange(double, double)));
|
||||
connect(this, SIGNAL(startSketchSig(bool, double*, double*)), this,
|
||||
SLOT(startSketch(bool)));
|
||||
// connect(this, SIGNAL(updateActionsStatesSig()), this, SLOT(updateActionsStates()));
|
||||
connect(this, SIGNAL(updatePreMeshActorSig()), this, SLOT(updatePreMeshActor()));
|
||||
connect(this, SIGNAL(updatePreGeometryActorSig()), this, SLOT(updatePreGeometryActor()));
|
||||
|
@ -348,8 +370,7 @@ namespace GUI
|
|||
|
||||
void MainWindow::setCurrentFile(const QString& file)
|
||||
{
|
||||
if (!file.isEmpty())
|
||||
{
|
||||
if(!file.isEmpty()) {
|
||||
QFileInfo F(file);
|
||||
if(!F.exists())
|
||||
return;
|
||||
|
@ -358,7 +379,8 @@ namespace GUI
|
|||
|
||||
QString lang = Setting::BusAPI::instance()->getLanguage();
|
||||
QString title;
|
||||
ConfigOption::GlobalConfig *g = ConfigOption::ConfigOption::getInstance()->getGlobalConfig();
|
||||
ConfigOption::GlobalConfig* g =
|
||||
ConfigOption::ConfigOption::getInstance()->getGlobalConfig();
|
||||
|
||||
title = g->getSoftName();
|
||||
if(lang.toLower() == "chinese")
|
||||
|
@ -384,12 +406,12 @@ namespace GUI
|
|||
void MainWindow::closeEvent(QCloseEvent* event)
|
||||
{
|
||||
QString md5 = _signalHandler->getMD5();
|
||||
if (md5 != _MD5)
|
||||
{
|
||||
int nRet = QMessageBox::warning(this, tr("Save"), tr("Do you want to save before exit ?"), tr("Yes"), tr("No"), tr("Cancel"));
|
||||
if(md5 != _MD5) {
|
||||
int nRet =
|
||||
QMessageBox::warning(this, tr("Save"), tr("Do you want to save before exit ?"),
|
||||
tr("Yes"), tr("No"), tr("Cancel"));
|
||||
|
||||
switch (nRet)
|
||||
{
|
||||
switch(nRet) {
|
||||
case 2:
|
||||
event->ignore();
|
||||
return;
|
||||
|
@ -418,14 +440,11 @@ namespace GUI
|
|||
Setting::BusAPI::instance()->setLanguage(lang);
|
||||
if(nullptr == _ui)
|
||||
return;
|
||||
if (lang == "English")
|
||||
{
|
||||
if(lang == "English") {
|
||||
_ui->actionChinese->setChecked(false);
|
||||
_ui->actionEnglish->setChecked(true);
|
||||
_translator->toEnglish();
|
||||
}
|
||||
else if (lang == "Chinese")
|
||||
{
|
||||
} else if(lang == "Chinese") {
|
||||
_ui->actionChinese->setChecked(true);
|
||||
_ui->actionEnglish->setChecked(false);
|
||||
_translator->toChinese();
|
||||
|
@ -446,16 +465,14 @@ namespace GUI
|
|||
if(_processWindow != nullptr)
|
||||
_processWindow->reTranslate();
|
||||
|
||||
ConfigOption::GlobalConfig *g = ConfigOption::ConfigOption::getInstance()->getGlobalConfig();
|
||||
ConfigOption::GlobalConfig* g =
|
||||
ConfigOption::ConfigOption::getInstance()->getGlobalConfig();
|
||||
QString title = "FastCAE";
|
||||
if (lang.toLower() == "chinese")
|
||||
{
|
||||
if(lang.toLower() == "chinese") {
|
||||
QString f = g->getChineseName();
|
||||
if(!f.isEmpty())
|
||||
title = f;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
QString f = g->getSoftName();
|
||||
if(!f.isEmpty())
|
||||
title = f;
|
||||
|
@ -476,10 +493,11 @@ namespace GUI
|
|||
{
|
||||
/* emit sig_action_open();*/
|
||||
QString md5 = _signalHandler->getMD5();
|
||||
if (md5 != _MD5)
|
||||
{
|
||||
if(md5 != _MD5) {
|
||||
QMessageBox::StandardButton but;
|
||||
but = QMessageBox::warning(this, tr("Warning"), tr("Do you want to save current data ?"), QMessageBox::Yes | QMessageBox::No);
|
||||
but =
|
||||
QMessageBox::warning(this, tr("Warning"), tr("Do you want to save current data ?"),
|
||||
QMessageBox::Yes | QMessageBox::No);
|
||||
if(but == QMessageBox::Yes)
|
||||
on_actionSave();
|
||||
}
|
||||
|
@ -506,12 +524,10 @@ namespace GUI
|
|||
|
||||
void MainWindow::on_actionSave()
|
||||
{
|
||||
if (!_currentFile.isEmpty())
|
||||
{
|
||||
if(!_currentFile.isEmpty()) {
|
||||
QString pycode = QString("MainWindow.saveProjectFile(\"%1\")").arg(_currentFile);
|
||||
Py::PythonAgent::getInstance()->submit(pycode);
|
||||
}
|
||||
else
|
||||
} else
|
||||
on_actionSaveAs();
|
||||
}
|
||||
|
||||
|
@ -535,8 +551,7 @@ namespace GUI
|
|||
return;
|
||||
#ifdef Q_OS_LINUX
|
||||
bool isproj = filePath.toLower().endsWith(".diso") || filePath.toLower().endsWith(".xml");
|
||||
if (!isproj)
|
||||
{
|
||||
if(!isproj) {
|
||||
QString suffix = dlg.selectedNameFilter();
|
||||
if(suffix.contains("diso"))
|
||||
suffix = "diso";
|
||||
|
@ -547,14 +562,14 @@ namespace GUI
|
|||
#endif
|
||||
|
||||
bool empty = Geometry::GeometryData::getInstance()->isEmpty();
|
||||
if (filePath.right(3).toLower() == "xml" && !empty)
|
||||
{
|
||||
QMessageBox::StandardButton bt = QMessageBox::warning(this, tr("Warning"), tr("Geometry will be lost! still continue?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);
|
||||
if(filePath.right(3).toLower() == "xml" && !empty) {
|
||||
QMessageBox::StandardButton bt = QMessageBox::warning(
|
||||
this, tr("Warning"), tr("Geometry will be lost! still continue?"),
|
||||
QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);
|
||||
if(bt == QMessageBox::No)
|
||||
return;
|
||||
}
|
||||
if (!filePath.isEmpty())
|
||||
{
|
||||
if(!filePath.isEmpty()) {
|
||||
QString pycode = QString("MainWindow.saveProjectFile(\"%1\")").arg(filePath);
|
||||
Py::PythonAgent::getInstance()->submit(pycode);
|
||||
}
|
||||
|
@ -564,19 +579,18 @@ namespace GUI
|
|||
{
|
||||
QStringList suffixlist = IO::IOConfigure::getMeshImporters();
|
||||
// QStringList list = IO::IOConfigure::getMeshImporters();
|
||||
if (suffixlist.isEmpty())
|
||||
{
|
||||
if(suffixlist.isEmpty()) {
|
||||
QMessageBox::warning(this, tr("Warning"), tr("The MeshPlugin is not installed !"));
|
||||
return;
|
||||
}
|
||||
|
||||
QStringList meshsuffix = ConfigOption::ConfigOption::getInstance()->getMeshConfig()->getImportSuffix().split(";");
|
||||
QStringList meshsuffix =
|
||||
ConfigOption::ConfigOption::getInstance()->getMeshConfig()->getImportSuffix().split(
|
||||
";");
|
||||
QStringList list;
|
||||
|
||||
for (QString s : meshsuffix)
|
||||
{
|
||||
for (int i = 0; i < suffixlist.size(); i++)
|
||||
{
|
||||
for(QString s : meshsuffix) {
|
||||
for(int i = 0; i < suffixlist.size(); i++) {
|
||||
QString suffix = suffixlist.at(i);
|
||||
if(suffix.contains(s))
|
||||
list.append(suffix);
|
||||
|
@ -587,8 +601,7 @@ namespace GUI
|
|||
QString suffixes = list.join(";;");
|
||||
QString senderName = sender()->objectName();
|
||||
int modelID = -1;
|
||||
if (senderName.contains("Only INP_"))
|
||||
{
|
||||
if(senderName.contains("Only INP_")) {
|
||||
suffixes = list.at(0);
|
||||
modelID = senderName.right(1).toInt();
|
||||
}
|
||||
|
@ -604,7 +617,10 @@ namespace GUI
|
|||
QString fileName = dlg.selectedFiles().join(",");
|
||||
if(fileName.isEmpty())
|
||||
return;
|
||||
QString pyCode = QString("MainWindow.importMesh(\"%1\",\"%2\",%3)").arg(fileName).arg(aSuffix).arg(modelID);
|
||||
QString pyCode = QString("MainWindow.importMesh(\"%1\",\"%2\",%3)")
|
||||
.arg(fileName)
|
||||
.arg(aSuffix)
|
||||
.arg(modelID);
|
||||
Py::PythonAgent::getInstance()->submit(pyCode);
|
||||
}
|
||||
|
||||
|
@ -612,20 +628,21 @@ namespace GUI
|
|||
{
|
||||
QString dir = Setting::BusAPI::instance()->getWorkingDir();
|
||||
|
||||
ConfigOption::GeometryConfig *geoconfig = ConfigOption::ConfigOption::getInstance()->getGeometryConfig();
|
||||
ConfigOption::GeometryConfig* geoconfig =
|
||||
ConfigOption::ConfigOption::getInstance()->getGeometryConfig();
|
||||
QString conSuffix = geoconfig->getExportSuffix().toLower();
|
||||
QStringList sl = conSuffix.split(";");
|
||||
|
||||
conSuffix.clear();
|
||||
for (QString s : sl)
|
||||
{
|
||||
for(QString s : sl) {
|
||||
conSuffix += " *." + s;
|
||||
}
|
||||
conSuffix = QString("Geometry Files(%1)").arg(conSuffix);
|
||||
QString regSuffix{};
|
||||
|
||||
QString title = tr("Export Geometry");
|
||||
QString filename = QFileDialog::getSaveFileName(this, title, dir, conSuffix + regSuffix /* + ";;All Files(*.*)"*/);
|
||||
QString filename = QFileDialog::getSaveFileName(
|
||||
this, title, dir, conSuffix + regSuffix /* + ";;All Files(*.*)"*/);
|
||||
if(filename.isEmpty())
|
||||
return;
|
||||
|
||||
|
@ -637,25 +654,23 @@ namespace GUI
|
|||
{
|
||||
QStringList suffixlist = IO::IOConfigure::getMeshExporters();
|
||||
// QStringList list = IO::IOConfigure::getMeshImporters();
|
||||
if (suffixlist.isEmpty())
|
||||
{
|
||||
if(suffixlist.isEmpty()) {
|
||||
QMessageBox::warning(this, tr("Warning"), tr("The MeshPlugin is not installed !"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (MeshData::MeshData::getInstance()->getKernalCount() == 0)
|
||||
{
|
||||
if(MeshData::MeshData::getInstance()->getKernalCount() == 0) {
|
||||
QMessageBox::warning(this, tr("Warning"), tr("No one has any grid!"));
|
||||
return;
|
||||
}
|
||||
|
||||
QStringList meshsuffix = ConfigOption::ConfigOption::getInstance()->getMeshConfig()->getExportSuffix().split(";");
|
||||
QStringList meshsuffix =
|
||||
ConfigOption::ConfigOption::getInstance()->getMeshConfig()->getExportSuffix().split(
|
||||
";");
|
||||
QStringList list;
|
||||
|
||||
for (QString s : meshsuffix)
|
||||
{
|
||||
for (int i = 0; i < suffixlist.size(); i++)
|
||||
{
|
||||
for(QString s : meshsuffix) {
|
||||
for(int i = 0; i < suffixlist.size(); i++) {
|
||||
QString suffix = suffixlist.at(i);
|
||||
if(suffix.contains(s))
|
||||
list.append(suffix);
|
||||
|
@ -666,8 +681,7 @@ namespace GUI
|
|||
QString suffixes = list.join(";;");
|
||||
QString senderName = sender()->objectName();
|
||||
int modelID = -1;
|
||||
if (senderName.contains("Only INP_"))
|
||||
{
|
||||
if(senderName.contains("Only INP_")) {
|
||||
suffixes = list.at(0);
|
||||
modelID = senderName.right(1).toInt();
|
||||
}
|
||||
|
@ -681,7 +695,10 @@ namespace GUI
|
|||
QString aFileName = dlg.selectedFiles().join(",");
|
||||
if(aFileName.isEmpty())
|
||||
return;
|
||||
QString pyCode = QString("MainWindow.exportMesh(\"%1\",\"%2\",%3)").arg(aFileName).arg(aSuffix).arg(modelID);
|
||||
QString pyCode = QString("MainWindow.exportMesh(\"%1\",\"%2\",%3)")
|
||||
.arg(aFileName)
|
||||
.arg(aSuffix)
|
||||
.arg(modelID);
|
||||
Py::PythonAgent::getInstance()->submit(pyCode);
|
||||
}
|
||||
|
||||
|
@ -706,28 +723,29 @@ namespace GUI
|
|||
void MainWindow::on_importGeometry()
|
||||
{
|
||||
QString dir = Setting::BusAPI::instance()->getWorkingDir();
|
||||
ConfigOption::GeometryConfig *geoconfig = ConfigOption::ConfigOption::getInstance()->getGeometryConfig();
|
||||
ConfigOption::GeometryConfig* geoconfig =
|
||||
ConfigOption::ConfigOption::getInstance()->getGeometryConfig();
|
||||
QString conSuffix = geoconfig->getImportSuffix().toLower();
|
||||
QStringList sl = conSuffix.split(";");
|
||||
conSuffix.clear();
|
||||
for (QString s : sl)
|
||||
{
|
||||
for(QString s : sl) {
|
||||
conSuffix += " *." + s;
|
||||
}
|
||||
conSuffix = QString("Geometry Files(%1)").arg(conSuffix);
|
||||
QString regSuffix{};
|
||||
|
||||
QString title = tr("Import Geometry");
|
||||
QStringList filenames = QFileDialog::getOpenFileNames(this, title, dir, conSuffix + regSuffix /*+ ";;All Files(*.*)"*/);
|
||||
QStringList filenames = QFileDialog::getOpenFileNames(
|
||||
this, title, dir, conSuffix + regSuffix /*+ ";;All Files(*.*)"*/);
|
||||
if(filenames.isEmpty())
|
||||
return;
|
||||
/*
|
||||
QString files = filenames.join(",");
|
||||
QString pycode = QString("MainWindow.importGeometry(\"%1\")").arg(files);
|
||||
QString pycode =
|
||||
QString("MainWindow.importGeometry(\"%1\")").arg(files);
|
||||
*/
|
||||
QStringList pyCodes;
|
||||
for (int i = 0; i < filenames.size(); i++)
|
||||
{
|
||||
for(int i = 0; i < filenames.size(); i++) {
|
||||
pyCodes.append(QString("MainWindow.importGeometry(\"%1\")").arg(filenames[i]));
|
||||
}
|
||||
Py::PythonAgent::getInstance()->submit(pyCodes);
|
||||
|
@ -757,9 +775,7 @@ namespace GUI
|
|||
_signalHandler->generateSurfaceMesh();
|
||||
}
|
||||
|
||||
void MainWindow::on_genMesh()
|
||||
{
|
||||
}
|
||||
void MainWindow::on_genMesh() {}
|
||||
|
||||
void MainWindow::setWorkingDir()
|
||||
{
|
||||
|
@ -807,8 +823,7 @@ namespace GUI
|
|||
_ui->actionBoxMeshNode->setChecked(false);
|
||||
_ui->actionBoxMeshCell->setChecked(false);
|
||||
|
||||
switch (model)
|
||||
{
|
||||
switch(model) {
|
||||
case(int)ModuleBase::SelectModel::None:
|
||||
_ui->actionSelectOff->setChecked(true);
|
||||
break;
|
||||
|
@ -843,27 +858,23 @@ namespace GUI
|
|||
|
||||
void MainWindow::on_userManual()
|
||||
{
|
||||
QString file = ConfigOption::ConfigOption::getInstance()->getGlobalConfig()->GetUserManual();
|
||||
QString file =
|
||||
ConfigOption::ConfigOption::getInstance()->getGlobalConfig()->GetUserManual();
|
||||
QString userManulFile = QApplication::applicationDirPath() + "/../Doc/" + file;
|
||||
|
||||
if (file.isEmpty())
|
||||
{
|
||||
if(file.isEmpty()) {
|
||||
QDesktopServices::openUrl(QUrl("http://www.fastcae.com/index.php?mod=document"));
|
||||
return;
|
||||
}
|
||||
|
||||
QFile f(userManulFile);
|
||||
if (!f.exists())
|
||||
{
|
||||
if(!f.exists()) {
|
||||
ModuleBase::Message msg;
|
||||
msg.type = Common::Message::Warning;
|
||||
msg.message = tr("Please make sure \" %1 \" file exist!").arg(userManulFile);
|
||||
emit printMessageToMessageWindow(msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!QDesktopServices::openUrl(QUrl::fromLocalFile(userManulFile)))
|
||||
{
|
||||
} else {
|
||||
if(!QDesktopServices::openUrl(QUrl::fromLocalFile(userManulFile))) {
|
||||
QString mess = QString(tr("%1 not exist !")).arg(file);
|
||||
QMessageBox::warning(this, QString(tr("Warning")), mess);
|
||||
}
|
||||
|
@ -892,8 +903,7 @@ namespace GUI
|
|||
_ui->actionSelectCurve->setChecked(false);
|
||||
_ui->actionSelectFace->setChecked(false);
|
||||
_ui->actionSelectGeometryBody->setChecked(false);
|
||||
switch (m)
|
||||
{
|
||||
switch(m) {
|
||||
case(int)ModuleBase::SelectModel::None:
|
||||
_ui->actionSelectOff->setChecked(true);
|
||||
break;
|
||||
|
@ -922,7 +932,6 @@ namespace GUI
|
|||
|
||||
void MainWindow::setGeometryDisplay()
|
||||
{
|
||||
|
||||
bool checkvertex = _ui->actionDisplayPoint->isChecked();
|
||||
bool checkcurve = _ui->actionDisplayCurve->isChecked();
|
||||
bool checkface = _ui->actionDisplayFace->isChecked();
|
||||
|
@ -937,21 +946,18 @@ namespace GUI
|
|||
|
||||
void MainWindow::updateRecentMenu()
|
||||
{
|
||||
if (_recentMenu == nullptr)
|
||||
{
|
||||
if(_recentMenu == nullptr) {
|
||||
_recentMenu = new QMenu(tr("Recent"));
|
||||
_ui->menuFile->addMenu(_recentMenu);
|
||||
}
|
||||
_recentMenu->clear();
|
||||
|
||||
if (_recentFileMapper == nullptr)
|
||||
{
|
||||
if(_recentFileMapper == nullptr) {
|
||||
_recentFileMapper = new QSignalMapper;
|
||||
}
|
||||
_recentFileMapper->disconnect();
|
||||
QStringList rencentFile = Setting::BusAPI::instance()->getRencetFiles();
|
||||
for (int i = 0; i < rencentFile.size(); ++i)
|
||||
{
|
||||
for(int i = 0; i < rencentFile.size(); ++i) {
|
||||
QString f = rencentFile.at(i);
|
||||
QAction* action = _recentMenu->addAction(f);
|
||||
action->setStatusTip(f);
|
||||
|
@ -964,10 +970,8 @@ namespace GUI
|
|||
void MainWindow::setActionVisible(QString objname, bool enable)
|
||||
{
|
||||
QList<QAction*> acs = this->findChildren<QAction*>();
|
||||
for (QAction *a : acs)
|
||||
{
|
||||
if (a->objectName().toLower() == objname.toLower())
|
||||
{
|
||||
for(QAction* a : acs) {
|
||||
if(a->objectName().toLower() == objname.toLower()) {
|
||||
a->setVisible(enable);
|
||||
break;
|
||||
}
|
||||
|
@ -977,17 +981,17 @@ namespace GUI
|
|||
void MainWindow::openRencentFile(QString file)
|
||||
{
|
||||
QFileInfo info(file);
|
||||
if (!info.exists())
|
||||
{
|
||||
if(!info.exists()) {
|
||||
QMessageBox::warning(this, tr("Warning"), tr("File \"%1\" is not exist !"));
|
||||
return;
|
||||
}
|
||||
|
||||
QString md5 = _signalHandler->getMD5();
|
||||
if (md5 != _MD5)
|
||||
{
|
||||
if(md5 != _MD5) {
|
||||
QMessageBox::StandardButton but;
|
||||
but = QMessageBox::warning(this, tr("Warning"), tr("Do you want to save current data ?"), QMessageBox::Yes | QMessageBox::No);
|
||||
but =
|
||||
QMessageBox::warning(this, tr("Warning"), tr("Do you want to save current data ?"),
|
||||
QMessageBox::Yes | QMessageBox::No);
|
||||
if(but == QMessageBox::Yes)
|
||||
on_actionSave();
|
||||
}
|
||||
|
@ -1030,13 +1034,12 @@ namespace GUI
|
|||
if(!file.exists() || file.size() == 0)
|
||||
return false;
|
||||
|
||||
QMessageBox::StandardButton result =
|
||||
QMessageBox::warning(this, tr("Do you need to load?"),
|
||||
QMessageBox::StandardButton result = QMessageBox::warning(
|
||||
this, tr("Do you need to load?"),
|
||||
tr("The program quit with an exception before, do you want to reload the contents?"),
|
||||
QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);
|
||||
|
||||
switch (result)
|
||||
{
|
||||
switch(result) {
|
||||
case QMessageBox::Yes:
|
||||
Py::PythonAgent::getInstance()->execScript(file.fileName());
|
||||
break;
|
||||
|
@ -1056,14 +1059,11 @@ namespace GUI
|
|||
return;
|
||||
|
||||
// int index = -1;
|
||||
if (visible)
|
||||
{
|
||||
if(visible) {
|
||||
ribbon->showContextCategory(_ui->sketch_tool_context);
|
||||
// index = ribbon->tabIndex(_ui->sketch_tool_page);
|
||||
ribbon->raiseCategory(_ui->sketch_tool_page);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
ribbon->hideContextCategory(_ui->sketch_tool_context);
|
||||
// index = ribbon->tabIndex(_ui->geometry_page);
|
||||
ribbon->raiseCategory(_ui->sketch_tool_page);
|
||||
|
@ -1083,8 +1083,7 @@ namespace GUI
|
|||
mbox.addButton(tr("Restart later"), QMessageBox::RejectRole);
|
||||
QPushButton* button2 = mbox.addButton(tr("Restart now"), QMessageBox::YesRole);
|
||||
mbox.exec();
|
||||
if (mbox.clickedButton() == button2)
|
||||
{
|
||||
if(mbox.clickedButton() == button2) {
|
||||
this->closeEvent(nullptr);
|
||||
qApp->exit(-1000);
|
||||
}
|
||||
|
@ -1095,8 +1094,7 @@ namespace GUI
|
|||
_postToolBar = new Post::AnimationToolBar(this, _controlPanel->getPostTreeWidget());
|
||||
Post::RenderDirector::getInstance()->setAnimationToolBar(_postToolBar);
|
||||
|
||||
if (ribbon)
|
||||
{
|
||||
if(ribbon) {
|
||||
_postToolBar->setVisible(false);
|
||||
auto rBar = this->ribbonBar();
|
||||
if(rBar == nullptr)
|
||||
|
@ -1109,11 +1107,9 @@ namespace GUI
|
|||
auto pannel = category->addPannel(QString());
|
||||
|
||||
auto actList = _postToolBar->actions();
|
||||
for (auto action : actList)
|
||||
{
|
||||
for(auto action : actList) {
|
||||
action->setEnabled(false);
|
||||
if (action->objectName() == "QWidget")
|
||||
{
|
||||
if(action->objectName() == "QWidget") {
|
||||
auto widget = _postToolBar->widgetForAction(action);
|
||||
if(widget == nullptr)
|
||||
continue;
|
||||
|
@ -1123,9 +1119,7 @@ namespace GUI
|
|||
}
|
||||
pannel->addLargeAction(action);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
_postToolBar->setVisible(true);
|
||||
this->addToolBar(_postToolBar);
|
||||
}
|
||||
|
@ -1189,7 +1183,8 @@ namespace GUI
|
|||
return;
|
||||
bool ok = Py::PythonAgent::getInstance()->execScript(filePath);
|
||||
if(!ok)
|
||||
QMessageBox::warning(this, tr("Warning"), QString(tr("%1 execute failed !")).arg(filePath));
|
||||
QMessageBox::warning(this, tr("Warning"),
|
||||
QString(tr("%1 execute failed !")).arg(filePath));
|
||||
}
|
||||
|
||||
MainWidget::ControlPanel* MainWindow::getControlPanel()
|
||||
|
@ -1200,16 +1195,14 @@ namespace GUI
|
|||
void MainWindow::on_sketchClicked()
|
||||
{
|
||||
bool ischecked = _ui->actionCreate_Sketch->isChecked();
|
||||
if (ischecked)
|
||||
{
|
||||
if(ischecked) {
|
||||
if(!_subWindowManager->isPreWindowOpened())
|
||||
_subWindowManager->openPreWindow();
|
||||
|
||||
auto dlg = new GeometryWidget::SketchPlanDialog(this, _subWindowManager->getPreWindow());
|
||||
auto dlg =
|
||||
new GeometryWidget::SketchPlanDialog(this, _subWindowManager->getPreWindow());
|
||||
dlg->show();
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
// auto p = _subWindowManager->getPreWindow();
|
||||
emit startSketchSig(false, nullptr, nullptr);
|
||||
}
|
||||
|
@ -1220,8 +1213,7 @@ namespace GUI
|
|||
_ui->actionCreate_Sketch->setChecked(s);
|
||||
if(isUseRibbon())
|
||||
setSketchPageVisible(s);
|
||||
else
|
||||
{
|
||||
else {
|
||||
_ui->GeomertryFeatureToolBar->setVisible(!s);
|
||||
_ui->ChamferToolBar->setVisible(!s);
|
||||
_ui->BoolToolBar->setVisible(!s);
|
||||
|
@ -1244,8 +1236,7 @@ namespace GUI
|
|||
|
||||
void MainWindow::showGraphRange(double w, double h)
|
||||
{
|
||||
if (_graphRange == nullptr)
|
||||
{
|
||||
if(_graphRange == nullptr) {
|
||||
_graphRange = new QLabel(this);
|
||||
_ui->statusbar->addPermanentWidget(_graphRange);
|
||||
}
|
||||
|
@ -1282,8 +1273,7 @@ namespace GUI
|
|||
QAction* MainWindow::getAction(QString& objName)
|
||||
{
|
||||
QList<QAction*> acs = this->findChildren<QAction*>();
|
||||
for (QAction *a : acs)
|
||||
{
|
||||
for(QAction* a : acs) {
|
||||
if(a->objectName().toLower() == objName.toLower())
|
||||
return a;
|
||||
}
|
||||
|
@ -1293,8 +1283,7 @@ namespace GUI
|
|||
QToolBar* MainWindow::getToolBar(QString& objName)
|
||||
{
|
||||
QList<QToolBar*> tbs = this->findChildren<QToolBar*>();
|
||||
for (auto a : tbs)
|
||||
{
|
||||
for(auto a : tbs) {
|
||||
if(a->objectName().toLower() == objName.toLower())
|
||||
return a;
|
||||
}
|
||||
|
@ -1304,41 +1293,36 @@ namespace GUI
|
|||
QMenu* MainWindow::getMenu(QString& objName)
|
||||
{
|
||||
QList<QMenu*> mes = this->findChildren<QMenu*>();
|
||||
for (auto a : mes)
|
||||
{
|
||||
for(auto a : mes) {
|
||||
if(a->objectName().toLower() == objName.toLower())
|
||||
return a;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
QPair<QWidget *, QList<QAction *>> MainWindow::createWidgetAndAction(const QString &title, const QStringList &actionStrs)
|
||||
QPair<QWidget*, QList<QAction*>>
|
||||
MainWindow::createWidgetAndAction(const QString& title, const QStringList& actionStrs)
|
||||
{
|
||||
QAction* action{};
|
||||
QList<QAction*> actions;
|
||||
QPair<QWidget*, QList<QAction*>> value;
|
||||
|
||||
if (isUseRibbon())
|
||||
{
|
||||
if(isUseRibbon()) {
|
||||
SARibbonCategory* page = ribbonBar()->addCategoryPage(title);
|
||||
// 给定制的panel添加名称
|
||||
SARibbonPannel* pannel = page->addPannel(QObject::tr("Customization"));
|
||||
pannel->setCanCustomize(false); // 不能编辑
|
||||
|
||||
for (QString actionStr : actionStrs)
|
||||
{
|
||||
for(QString actionStr : actionStrs) {
|
||||
action = new QAction(actionStr, this);
|
||||
action->setObjectName(actionStr);
|
||||
actions.append(action);
|
||||
pannel->addLargeAction(action);
|
||||
}
|
||||
value.first = page;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
QMenu* menu = new QMenu(title);
|
||||
for (QString actionStr : actionStrs)
|
||||
{
|
||||
for(QString actionStr : actionStrs) {
|
||||
action = new QAction(actionStr, this);
|
||||
action->setObjectName(actionStr);
|
||||
actions.append(action);
|
||||
|
@ -1360,4 +1344,4 @@ namespace GUI
|
|||
return m_ribbonActionMgr;
|
||||
}
|
||||
|
||||
} // end of namespace
|
||||
} // namespace GUI
|
|
@ -23,14 +23,15 @@
|
|||
#ifndef _MAINWINDOW_H_
|
||||
#define _MAINWINDOW_H_
|
||||
|
||||
#include "mainWindowAPI.h"
|
||||
#include <QMainWindow>
|
||||
#include "Common/Types.h"
|
||||
#include "MainWindowAPI.h"
|
||||
#include "ModuleBase/messageWindowBase.h"
|
||||
#include "SARibbonBar/SARibbonMainWindow.h"
|
||||
|
||||
#include <QHash>
|
||||
#include <QMainWindow>
|
||||
#include <QPair>
|
||||
#include <QString>
|
||||
#include "ModuleBase/messageWindowBase.h"
|
||||
#include "Common/Types.h"
|
||||
#include "SARibbonBar/SARibbonMainWindow.h"
|
||||
// ribbon customize
|
||||
#include "SARibbonBar/SARibbonActionsManager.h"
|
||||
#include "SARibbonBar/SARibbonCustomizeWidget.h"
|
||||
|
@ -49,50 +50,42 @@ class SARibbonCategory;
|
|||
// ribbon customize
|
||||
class SARibbonActionsManager;
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
namespace Ui {
|
||||
class MainWindow;
|
||||
class MainWindowRibbon;
|
||||
}
|
||||
} // namespace Ui
|
||||
|
||||
namespace DataProperty
|
||||
{
|
||||
namespace DataProperty {
|
||||
class DataBase;
|
||||
}
|
||||
|
||||
namespace MeshData
|
||||
{
|
||||
namespace MeshData {
|
||||
class MeshSet;
|
||||
class MeshKernal;
|
||||
}
|
||||
} // namespace MeshData
|
||||
|
||||
namespace Geometry
|
||||
{
|
||||
namespace Geometry {
|
||||
class GeometrySet;
|
||||
class GeoComponent;
|
||||
}
|
||||
} // namespace Geometry
|
||||
|
||||
namespace MainWidget
|
||||
{
|
||||
namespace MainWidget {
|
||||
class ControlPanel;
|
||||
class MessageWindow;
|
||||
class ProcessWindow;
|
||||
class PreWindow;
|
||||
}
|
||||
} // namespace MainWidget
|
||||
|
||||
namespace Post
|
||||
{
|
||||
namespace Post {
|
||||
class PostWindowBase;
|
||||
class RealTimeWindowBase;
|
||||
class AnimationToolBar;
|
||||
}
|
||||
} // namespace Post
|
||||
|
||||
namespace XReport
|
||||
{
|
||||
namespace XReport {
|
||||
class ReportWindow;
|
||||
}
|
||||
namespace GUI
|
||||
{
|
||||
namespace GUI {
|
||||
class SubWindowManager;
|
||||
class SignalHandler;
|
||||
class Translator;
|
||||
|
@ -102,8 +95,7 @@ namespace GUI
|
|||
* @note 该类继承自SARibbonMainWindow,具体请参考https://gitee.com/czyt1988/SARibbon
|
||||
* @since 2.5.0
|
||||
*/
|
||||
class MAINWINDOWAPI MainWindow : public SARibbonMainWindow
|
||||
{
|
||||
class MAINWINDOWAPI MainWindow : public SARibbonMainWindow {
|
||||
Q_OBJECT
|
||||
friend CustomizerHelper;
|
||||
friend SignalHandler;
|
||||
|
@ -153,7 +145,8 @@ namespace GUI
|
|||
QToolBar* getToolBar(QString& objName);
|
||||
// 根据object name 获取menu
|
||||
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();
|
||||
|
||||
|
@ -270,7 +263,8 @@ namespace GUI
|
|||
/// 根据绘图设置更新绘图
|
||||
void updateGraphOptionsSig();
|
||||
// 保存图片 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*);
|
||||
// //体网格划分
|
||||
|
@ -532,5 +526,5 @@ namespace GUI
|
|||
// ribbon customize
|
||||
SARibbonActionsManager* m_ribbonActionMgr{};
|
||||
};
|
||||
}
|
||||
} // namespace GUI
|
||||
#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_
|
||||
#define _SIGNALHANDLER_H_
|
||||
|
||||
#include "MainWindowAPI.h"
|
||||
|
||||
#include <QObject>
|
||||
#include <QStringList>
|
||||
#include "mainWindowAPI.h"
|
||||
|
||||
class QDialog;
|
||||
class QTreeWidgetItem;
|
||||
class vtkDataSet;
|
||||
|
||||
namespace Post
|
||||
{
|
||||
namespace Post {
|
||||
class PostWindowBase;
|
||||
}
|
||||
|
||||
namespace GUI
|
||||
{
|
||||
namespace GUI {
|
||||
class MainWindow;
|
||||
class SolveProcessManager;
|
||||
|
||||
class MAINWINDOWAPI SignalHandler : public QObject
|
||||
{
|
||||
class MAINWINDOWAPI SignalHandler : public QObject {
|
||||
Q_OBJECT
|
||||
public:
|
||||
SignalHandler(MainWindow* mainwindow);
|
||||
|
@ -36,7 +34,6 @@ namespace GUI
|
|||
void solveProjectSig(int projectIndex, int solverIndex);
|
||||
void projectFileProcessedSig(QString file, bool success, bool isread);
|
||||
|
||||
|
||||
public:
|
||||
// 不要通过返回值判断
|
||||
bool importGeometry(const QStringList& filenames);
|
||||
|
@ -47,7 +44,6 @@ namespace GUI
|
|||
/// 获取求解管理器
|
||||
SolveProcessManager* getSolveProcessManager();
|
||||
|
||||
|
||||
public slots:
|
||||
// 导入网格
|
||||
bool importMeshSlot(const QString& fileName, const QString& suffix, int modelId);
|
||||
|
@ -157,6 +153,7 @@ namespace GUI
|
|||
void savePostAnimation();
|
||||
|
||||
void GeoMeshRotate();
|
||||
|
||||
private:
|
||||
void handleSingleClickEvent(QTreeWidgetItem* item, int proID);
|
||||
void openPreWinPy();
|
||||
|
@ -167,8 +164,7 @@ namespace GUI
|
|||
SolveProcessManager* _solveProcessManager{};
|
||||
bool _launched{ false };
|
||||
// QString _currentFilePath{};
|
||||
|
||||
};
|
||||
}
|
||||
} // namespace GUI
|
||||
|
||||
#endif
|
|
@ -1,9 +1,8 @@
|
|||
#include "solveProcessManager.h"
|
||||
#include "SolveProcessManager.h"
|
||||
|
||||
#include "SolverControl/SolverControlerBase.h"
|
||||
|
||||
|
||||
namespace GUI
|
||||
{
|
||||
namespace GUI {
|
||||
SolveProcessManager::~SolveProcessManager()
|
||||
{
|
||||
QList<SolverControl::SolverControlBase*> ss = _solvingProcess.values();
|
||||
|
@ -12,7 +11,6 @@ namespace GUI
|
|||
_solvingProcess.clear();
|
||||
}
|
||||
|
||||
|
||||
bool SolveProcessManager::isSolving(int id)
|
||||
{
|
||||
return _solvingProcess.contains(id);
|
||||
|
@ -26,13 +24,12 @@ namespace GUI
|
|||
_solvingProcess.insert(id, p);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SolveProcessManager::solveFinished(int id)
|
||||
{
|
||||
auto p = _solvingProcess.value(id);
|
||||
_solvingProcess.remove(id);
|
||||
if (p == nullptr) return;
|
||||
if(p == nullptr)
|
||||
return;
|
||||
p->stopSolver();
|
||||
}
|
||||
|
||||
|
@ -41,4 +38,4 @@ namespace GUI
|
|||
_solvingProcess.remove(id);
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace GUI
|
|
@ -1,19 +1,17 @@
|
|||
#ifndef SOLVEPROCESSMANAGER_H_
|
||||
#define SOLVEPROCESSMANAGER_H_
|
||||
|
||||
#include "MainWindowAPI.h"
|
||||
|
||||
#include <QHash>
|
||||
#include <QObject>
|
||||
#include "mainWindowAPI.h"
|
||||
|
||||
namespace SolverControl
|
||||
{
|
||||
namespace SolverControl {
|
||||
class SolverControlBase;
|
||||
}
|
||||
|
||||
namespace GUI
|
||||
{
|
||||
class MAINWINDOWAPI SolveProcessManager : public QObject
|
||||
{
|
||||
namespace GUI {
|
||||
class MAINWINDOWAPI SolveProcessManager : public QObject {
|
||||
Q_OBJECT
|
||||
public:
|
||||
SolveProcessManager() = default;
|
||||
|
@ -30,8 +28,6 @@ namespace GUI
|
|||
QHash<int, SolverControl::SolverControlBase*> _solvingProcess{};
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
} // namespace GUI
|
||||
|
||||
#endif
|
|
@ -1,62 +1,77 @@
|
|||
#include "SubWindowManager.h"
|
||||
#include "SARibbonMWUi.h"
|
||||
#include <QMdiArea>
|
||||
#include <QMdiSubWindow>
|
||||
#include <QList>
|
||||
#include <QToolBar>
|
||||
#include "MainWidgets/preWindow.h"
|
||||
#include "MainWidgets/ControlPanel.h"
|
||||
#include "MeshData/meshSingleton.h"
|
||||
|
||||
#include "Common/Types.h"
|
||||
#include "Geometry/geometryData.h"
|
||||
#include "GeometryCommand/GeoCommandPy.h"
|
||||
#include "MainWidgets/ControlPanel.h"
|
||||
#include "MainWidgets/preWindow.h"
|
||||
#include "MainWindow.h"
|
||||
#include "MeshData/meshSingleton.h"
|
||||
#include "ModuleBase/graphWindowBase.h"
|
||||
#include "PostInterface/PostProcessPy.h"
|
||||
#include "PostWidgets/PostWindowBase.h"
|
||||
#include "PostWidgets/RealTimeWindowBase.h"
|
||||
#include "ModuleBase/graphWindowBase.h"
|
||||
#include "XGenerateReport/ReportWindow.h"
|
||||
#include "MainWindow.h"
|
||||
#include "signalHandler.h"
|
||||
#include "PythonModule/PyAgent.h"
|
||||
#include "GeometryCommand/GeoCommandPy.h"
|
||||
#include "SARibbonBar/SARibbonBar.h"
|
||||
#include "PostInterface/PostProcessPy.h"
|
||||
#include "Common/Types.h"
|
||||
#include <QDebug>
|
||||
#include <assert.h>
|
||||
#include "SARibbonMWUi.h"
|
||||
#include "SignalHandler.h"
|
||||
#include "XGenerateReport/ReportWindow.h"
|
||||
|
||||
namespace GUI
|
||||
{
|
||||
SubWindowManager::SubWindowManager(MainWindow *mainwindow, QMdiArea *mdiArea, SignalHandler *hander, MainWidget::ControlPanel *cp)
|
||||
: _mainWindow(mainwindow), _mdiArea(mdiArea), _signalHander(hander), _controlPanel(cp)
|
||||
#include <assert.h>
|
||||
#include <QDebug>
|
||||
#include <QList>
|
||||
#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(openPostWindowSig(Post::PostWindowBase *)), this, SLOT(openPostWindow(Post::PostWindowBase *)));
|
||||
connect(mainwindow, SIGNAL(openRealTimeWindowSig(Post::RealTimeWindowBase *, int)), this, SLOT(openRealTimeWindow(Post::RealTimeWindowBase *)));
|
||||
connect(mainwindow, SIGNAL(showPostWindowInfoSig(int, int)), this, SLOT(showPostWindowInfo(int, int)));
|
||||
connect(mainwindow, SIGNAL(closePostWindowSig(Post::PostWindowBase *)), this, SLOT(closePostWindow(Post::PostWindowBase *)));
|
||||
connect(_mdiArea, SIGNAL(subWindowActivated(QMdiSubWindow *)), this, SLOT(subWindowActived(QMdiSubWindow *)));
|
||||
connect(mainwindow, SIGNAL(closeRealTimeWindowSig(Post::RealTimeWindowBase *)), this, SLOT(closeRealTimeWindow(Post::RealTimeWindowBase *)));
|
||||
connect(mainwindow, SIGNAL(openReportWindowSig(XReport::ReportWindow *)), this, SLOT(openReportWindow(XReport::ReportWindow *)));
|
||||
connect(mainwindow, SIGNAL(closeReportWindowSig(XReport::ReportWindow *)), this, SLOT(closeReportWindow(XReport::ReportWindow *)));
|
||||
connect(mainwindow, SIGNAL(saveImageSig(QString, int, Post::PostWindowBase *, int, int)), this, SLOT(saveImage(QString, int, Post::PostWindowBase *, int, int)));
|
||||
connect(mainwindow, SIGNAL(saveImage(int, int, QString)), this, SLOT(saveImage(int, int, QString)));
|
||||
connect(mainwindow, SIGNAL(openPostWindowSig(Post::PostWindowBase*)), this,
|
||||
SLOT(openPostWindow(Post::PostWindowBase*)));
|
||||
connect(mainwindow, SIGNAL(openRealTimeWindowSig(Post::RealTimeWindowBase*, int)), this,
|
||||
SLOT(openRealTimeWindow(Post::RealTimeWindowBase*)));
|
||||
connect(mainwindow, SIGNAL(showPostWindowInfoSig(int, int)), this,
|
||||
SLOT(showPostWindowInfo(int, int)));
|
||||
connect(mainwindow, SIGNAL(closePostWindowSig(Post::PostWindowBase*)), this,
|
||||
SLOT(closePostWindow(Post::PostWindowBase*)));
|
||||
connect(_mdiArea, SIGNAL(subWindowActivated(QMdiSubWindow*)), this,
|
||||
SLOT(subWindowActived(QMdiSubWindow*)));
|
||||
connect(mainwindow, SIGNAL(closeRealTimeWindowSig(Post::RealTimeWindowBase*)), this,
|
||||
SLOT(closeRealTimeWindow(Post::RealTimeWindowBase*)));
|
||||
connect(mainwindow, SIGNAL(openReportWindowSig(XReport::ReportWindow*)), this,
|
||||
SLOT(openReportWindow(XReport::ReportWindow*)));
|
||||
connect(mainwindow, SIGNAL(closeReportWindowSig(XReport::ReportWindow*)), this,
|
||||
SLOT(closeReportWindow(XReport::ReportWindow*)));
|
||||
connect(mainwindow, SIGNAL(saveImageSig(QString, int, Post::PostWindowBase*, int, int)),
|
||||
this, SLOT(saveImage(QString, int, Post::PostWindowBase*, int, int)));
|
||||
connect(mainwindow, SIGNAL(saveImage(int, int, QString)), this,
|
||||
SLOT(saveImage(int, int, QString)));
|
||||
|
||||
connect(this, SIGNAL(setViewSig(int, QString, QString)), this, SLOT(setView(int, QString, QString)));
|
||||
connect(this, SIGNAL(setViewValueSig(int, QString, int, int, int, int, int, int, int, int, int)), this, SLOT(setViewValue(int, QString, int, int, int, int, int, int, int, int, int)));
|
||||
connect(this, SIGNAL(saveImageSig(int, int, int, QString, QString)), this, SLOT(saveImage(int, int, int, QString, QString)));
|
||||
connect(this, SIGNAL(setViewSig(int, QString, QString)), this,
|
||||
SLOT(setView(int, QString, QString)));
|
||||
connect(this,
|
||||
SIGNAL(setViewValueSig(int, QString, int, int, int, int, int, int, int, int, int)),
|
||||
this,
|
||||
SLOT(setViewValue(int, QString, int, int, int, int, int, int, int, int, int)));
|
||||
connect(this, SIGNAL(saveImageSig(int, int, int, QString, QString)), this,
|
||||
SLOT(saveImage(int, int, int, QString, QString)));
|
||||
connect(this, SIGNAL(openPreWindowSig()), this, SLOT(openPreWindow()));
|
||||
|
||||
}
|
||||
SubWindowManager::~SubWindowManager()
|
||||
{
|
||||
}
|
||||
SubWindowManager::~SubWindowManager() {}
|
||||
void SubWindowManager::openPreWindow()
|
||||
{
|
||||
if (isPreWindowOpened())
|
||||
{
|
||||
if(isPreWindowOpened()) {
|
||||
Py::PythonAgent::getInstance()->unLock();
|
||||
return;
|
||||
}
|
||||
if (_preWindow.first == nullptr || _preWindow.second == nullptr)
|
||||
{
|
||||
if(_preWindow.first == nullptr || _preWindow.second == nullptr) {
|
||||
_preWindow.second = new MainWidget::PreWindow(_mainWindow);
|
||||
_preWindow.first = _mdiArea->addSubWindow(_preWindow.second);
|
||||
_signalHander->updateActionsStates();
|
||||
|
@ -100,8 +115,7 @@ namespace GUI
|
|||
SARibbonPannel* pannel0 = _threeD_render_page->addPannel(QString());
|
||||
QToolBar* toolbar0 = toolbars.at(0);
|
||||
actions = toolbar0->actions();
|
||||
for (int j = 0; j < actions.size(); j++)
|
||||
{
|
||||
for(int j = 0; j < actions.size(); j++) {
|
||||
action = actions.at(j);
|
||||
pannel0->addLargeAction(action);
|
||||
}
|
||||
|
@ -109,8 +123,7 @@ namespace GUI
|
|||
SARibbonPannel* pannel2 = _threeD_render_page->addPannel(QString());
|
||||
QToolBar* toolbar2 = toolbars.at(2);
|
||||
actions = toolbar2->actions();
|
||||
for (int j = 0; j < actions.size(); j++)
|
||||
{
|
||||
for(int j = 0; j < actions.size(); j++) {
|
||||
action = actions.at(j);
|
||||
pannel2->addLargeAction(action);
|
||||
}
|
||||
|
@ -118,8 +131,7 @@ namespace GUI
|
|||
SARibbonPannel* pannel3 = _threeD_render_page->addPannel(QString());
|
||||
QToolBar* toolbar3 = toolbars.at(3);
|
||||
actions = toolbar3->actions();
|
||||
for (int j = 0; j < actions.size(); j++)
|
||||
{
|
||||
for(int j = 0; j < actions.size(); j++) {
|
||||
action = actions.at(j);
|
||||
pannel3->addLargeAction(action);
|
||||
}
|
||||
|
@ -130,16 +142,13 @@ namespace GUI
|
|||
QList<QAction*> realActions;
|
||||
QList<QWidget*> comboxs;
|
||||
QWidget* widget{};
|
||||
for (int j = 0; j < actions.size(); j++)
|
||||
{
|
||||
for(int j = 0; j < actions.size(); j++) {
|
||||
action = actions.at(j);
|
||||
if (action->objectName() == "QComboBox")
|
||||
{
|
||||
if(action->objectName() == "QComboBox") {
|
||||
widget = toolbar1->widgetForAction(action);
|
||||
widget->setVisible(true);
|
||||
comboxs.append(widget);
|
||||
}
|
||||
else if (action->objectName() == "QAction")
|
||||
} else if(action->objectName() == "QAction")
|
||||
realActions.append(action);
|
||||
}
|
||||
if(realActions.size() != 4 && comboxs.size() != 3)
|
||||
|
@ -167,8 +176,7 @@ namespace GUI
|
|||
if(_threeD_render_page == nullptr)
|
||||
return;
|
||||
auto pannels = _threeD_render_page->pannelList();
|
||||
for (SARibbonPannel *pannel : pannels)
|
||||
{
|
||||
for(SARibbonPannel* pannel : pannels) {
|
||||
_threeD_render_page->removePannel(pannel);
|
||||
pannel = nullptr;
|
||||
}
|
||||
|
@ -188,15 +196,13 @@ namespace GUI
|
|||
}
|
||||
void SubWindowManager::updatePreMeshActor()
|
||||
{
|
||||
if (_preWindow.second != nullptr)
|
||||
{
|
||||
if(_preWindow.second != nullptr) {
|
||||
emit _preWindow.second->updateMeshActorSig();
|
||||
}
|
||||
}
|
||||
void SubWindowManager::updatePreGeometryActor()
|
||||
{
|
||||
if (_preWindow.second != nullptr)
|
||||
{
|
||||
if(_preWindow.second != nullptr) {
|
||||
_preWindow.second->updateGeometryActor();
|
||||
}
|
||||
}
|
||||
|
@ -217,25 +223,20 @@ namespace GUI
|
|||
}
|
||||
void SubWindowManager::openPostWindow(Post::PostWindowBase* pw)
|
||||
{
|
||||
if (pw == nullptr)
|
||||
{
|
||||
if(pw == nullptr) {
|
||||
assert(0);
|
||||
return;
|
||||
}
|
||||
QMdiSubWindow* sw = nullptr;
|
||||
QList<Post::PostWindowBase*> pwl = _postWindow.values();
|
||||
if (pwl.contains(pw))
|
||||
{
|
||||
if(pwl.contains(pw)) {
|
||||
sw = _postWindow.key(pw);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
sw = _mdiArea->addSubWindow(pw);
|
||||
_mdiArea->cascadeSubWindows();
|
||||
_postWindow[sw] = pw;
|
||||
}
|
||||
if (sw != nullptr)
|
||||
{
|
||||
if(sw != nullptr) {
|
||||
sw->activateWindow();
|
||||
sw->showMaximized();
|
||||
sw->setFocus();
|
||||
|
@ -249,17 +250,13 @@ namespace GUI
|
|||
{
|
||||
QMdiSubWindow* sw = nullptr;
|
||||
QList<Post::RealTimeWindowBase*> pwl = _realTimeWindow.values();
|
||||
if (pwl.contains(pw))
|
||||
{
|
||||
if(pwl.contains(pw)) {
|
||||
sw = _realTimeWindow.key(pw);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
sw = _mdiArea->addSubWindow(pw);
|
||||
_realTimeWindow[sw] = pw;
|
||||
}
|
||||
if (sw != nullptr)
|
||||
{
|
||||
if(sw != nullptr) {
|
||||
sw->showMaximized();
|
||||
sw->setFocus();
|
||||
}
|
||||
|
@ -287,8 +284,7 @@ namespace GUI
|
|||
Post::PostWindowBase* SubWindowManager::getPostWindowByIDType(int id, int type)
|
||||
{
|
||||
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);
|
||||
if(w == nullptr)
|
||||
continue;
|
||||
|
@ -302,8 +298,7 @@ namespace GUI
|
|||
void SubWindowManager::removeToolBars()
|
||||
{
|
||||
const int n = _currentToolBars.size();
|
||||
for (int i = 0; i < n; ++i)
|
||||
{
|
||||
for(int i = 0; i < n; ++i) {
|
||||
QToolBar* t = _currentToolBars.at(i);
|
||||
_mainWindow->removeToolBar(t);
|
||||
}
|
||||
|
@ -317,8 +312,7 @@ namespace GUI
|
|||
// QWidget* ptree = pwb->getTreeWidget();
|
||||
// QWidget* pprop = pwb->getPropWidget();
|
||||
QMdiSubWindow* subWin = _postWindow.key(pwb);
|
||||
if (subWin != nullptr)
|
||||
{
|
||||
if(subWin != nullptr) {
|
||||
subWin->showMaximized();
|
||||
subWin->setFocus();
|
||||
}
|
||||
|
@ -327,18 +321,14 @@ namespace GUI
|
|||
_controlPanel->updatePostWidget();
|
||||
|
||||
QList<QToolBar*> toolBars = pwb->getToolBarList();
|
||||
if (_mainWindow->isUseRibbon())
|
||||
{
|
||||
if(_mainWindow->isUseRibbon()) {
|
||||
if(_threeD_render_page)
|
||||
return;
|
||||
add3dRenderPage(toolBars);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
this->removeToolBars();
|
||||
_mainWindow->addToolBarBreak();
|
||||
for (int i = 0; i < toolBars.size(); ++i)
|
||||
{
|
||||
for(int i = 0; i < toolBars.size(); ++i) {
|
||||
_mainWindow->addToolBar(toolBars.at(i));
|
||||
(toolBars.at(i))->show();
|
||||
_currentToolBars.append(toolBars.at(i));
|
||||
|
@ -352,7 +342,8 @@ namespace GUI
|
|||
return;
|
||||
Post::PostWindowType type = w->getPostWindowType();
|
||||
removeToolBars();
|
||||
if (type == Post::PostWindowType::D3 && _mainWindow->isUseRibbon()) //使用ribbon,并且关闭的是3维窗口
|
||||
if(type == Post::PostWindowType::D3
|
||||
&& _mainWindow->isUseRibbon()) // 使用ribbon,并且关闭的是3维窗口
|
||||
remove3dRenderPage();
|
||||
|
||||
if(_controlPanel != nullptr)
|
||||
|
@ -363,8 +354,7 @@ namespace GUI
|
|||
QList<Post::PostWindowBase*> postsubwlist = _postWindow.values();
|
||||
if(_preWindow.first != nullptr)
|
||||
showPreWindow();
|
||||
else if (postsubwlist.size() > 0)
|
||||
{
|
||||
else if(postsubwlist.size() > 0) {
|
||||
Post::PostWindowBase* w = postsubwlist.at(0);
|
||||
int id = w->getID();
|
||||
Post::PostWindowType type = w->getPostWindowType();
|
||||
|
@ -378,8 +368,7 @@ namespace GUI
|
|||
if(_controlPanel == nullptr)
|
||||
return;
|
||||
_controlPanel->updatePostWidget(nullptr, nullptr);
|
||||
if (_preWindow.first != nullptr)
|
||||
{
|
||||
if(_preWindow.first != nullptr) {
|
||||
_preWindow.first->showMaximized();
|
||||
_preWindow.first->setFocus();
|
||||
}
|
||||
|
@ -388,8 +377,7 @@ namespace GUI
|
|||
{
|
||||
removeToolBars();
|
||||
_controlPanel->updatePostWidget(nullptr, nullptr);
|
||||
if (_realTimeWindow.contains(w))
|
||||
{
|
||||
if(_realTimeWindow.contains(w)) {
|
||||
w->showMaximized();
|
||||
w->setFocus();
|
||||
}
|
||||
|
@ -402,8 +390,7 @@ namespace GUI
|
|||
showPreWindow();
|
||||
else if(_realTimeWindow.contains(sw))
|
||||
showRealTimeWindow(sw);
|
||||
else if (_postWindow.contains(sw))
|
||||
{
|
||||
else if(_postWindow.contains(sw)) {
|
||||
Post::PostWindowBase* pwb = _postWindow.value(sw);
|
||||
int id = pwb->getID();
|
||||
Post::PostWindowType type = pwb->getPostWindowType();
|
||||
|
@ -447,17 +434,13 @@ namespace GUI
|
|||
{
|
||||
QMdiSubWindow* sw = nullptr;
|
||||
QList<XReport::ReportWindow*> rws = _reportWindow.values();
|
||||
if (rws.contains(w))
|
||||
{
|
||||
if(rws.contains(w)) {
|
||||
sw = _reportWindow.key(w);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
sw = _mdiArea->addSubWindow(w);
|
||||
_reportWindow[sw] = w;
|
||||
}
|
||||
if (sw != nullptr)
|
||||
{
|
||||
if(sw != nullptr) {
|
||||
sw->showMaximized();
|
||||
sw->setFocus();
|
||||
}
|
||||
|
@ -466,8 +449,7 @@ namespace GUI
|
|||
void SubWindowManager::closeReportWindow(XReport::ReportWindow* w)
|
||||
{
|
||||
QMdiSubWindow* s = _reportWindow.key(w);
|
||||
if (s != nullptr)
|
||||
{
|
||||
if(s != nullptr) {
|
||||
_reportWindow.remove(s);
|
||||
}
|
||||
}
|
||||
|
@ -495,17 +477,15 @@ namespace GUI
|
|||
return false;
|
||||
}
|
||||
|
||||
void SubWindowManager::saveImage(QString fileName, int winType, Post::PostWindowBase *winhandle, int w, int h)
|
||||
{
|
||||
if (winType == 0)
|
||||
void SubWindowManager::saveImage(QString fileName, int winType, Post::PostWindowBase* winhandle,
|
||||
int w, int h)
|
||||
{
|
||||
if(winType == 0) {
|
||||
MainWidget::PreWindow* preW = _preWindow.second;
|
||||
if(preW == nullptr)
|
||||
return;
|
||||
preW->saveImage(fileName, w, h, false);
|
||||
}
|
||||
else if (winType == 1)
|
||||
{
|
||||
} else if(winType == 1) {
|
||||
if(_postWindow.key(winhandle) == nullptr)
|
||||
return;
|
||||
winhandle->saveImage(fileName, w, h, false);
|
||||
|
@ -515,14 +495,18 @@ namespace GUI
|
|||
void SubWindowManager::saveImage(int w, int h, QString f)
|
||||
{
|
||||
ModuleBase::GraphWindowBase* gw = this->getCurrentWindow();
|
||||
if (gw == nullptr)
|
||||
{
|
||||
if(gw == nullptr) {
|
||||
_mainWindow->printMessage(Common::Message::Error, tr("No GraphWindow opened!"));
|
||||
return;
|
||||
}
|
||||
QString type = gw->getStringGraphWindowType();
|
||||
const int id = gw->getID();
|
||||
QString pycode = QString("MainWindow.saveImage(%1,%2,%3,\"%4\",\"%5\")").arg(w).arg(h).arg(id).arg(type).arg(f);
|
||||
QString pycode = QString("MainWindow.saveImage(%1,%2,%3,\"%4\",\"%5\")")
|
||||
.arg(w)
|
||||
.arg(h)
|
||||
.arg(id)
|
||||
.arg(type)
|
||||
.arg(f);
|
||||
qDebug() << pycode;
|
||||
Py::PythonAgent::getInstance()->submit(pycode);
|
||||
}
|
||||
|
@ -543,7 +527,8 @@ namespace GUI
|
|||
gwb->setView(view);
|
||||
Py::PythonAgent::getInstance()->unLock();
|
||||
}
|
||||
void SubWindowManager::setViewValue(int id, QString win, int x1, int x2, int x3, int y1, int y2, int y3, int z1, int z2, int z3)
|
||||
void SubWindowManager::setViewValue(int id, QString win, int x1, int x2, int x3, int y1, int y2,
|
||||
int y3, int z1, int z2, int z3)
|
||||
{
|
||||
ModuleBase::GraphWindowBase* gwb = getWindowByTypeID(win, id);
|
||||
if(gwb == nullptr)
|
||||
|
@ -551,7 +536,8 @@ namespace GUI
|
|||
gwb->setViewValue(x1, x2, x3, y1, y2, y3, z1, z2, z3);
|
||||
Py::PythonAgent::getInstance()->unLock();
|
||||
}
|
||||
/*void SubWindowManager::setViewPreValue(int id, QString win, int x1, int x2, int x3, int y1, int y2, int y3, int z1, int z2, int z3)
|
||||
/*void SubWindowManager::setViewPreValue(int id, QString win, int x1, int x2, int x3, int y1,
|
||||
int y2, int y3, int z1, int z2, int z3)
|
||||
{
|
||||
ModuleBase::GraphWindowBase* gwb = getCurrentWindow();
|
||||
if (gwb == nullptr) return;
|
||||
|
@ -566,24 +552,21 @@ namespace GUI
|
|||
int n = 0;
|
||||
QList<Post::PostWindowBase*> postWinList = _postWindow.values();
|
||||
n = postWinList.size();
|
||||
for (int i = 0; i < n; ++i)
|
||||
{
|
||||
for(int i = 0; i < n; ++i) {
|
||||
Post::PostWindowBase* pw = postWinList.at(i);
|
||||
if(pw != nullptr)
|
||||
pw->reTranslate();
|
||||
}
|
||||
QList<Post::RealTimeWindowBase*> rwList = _realTimeWindow.values();
|
||||
n = rwList.size();
|
||||
for (int i = 0; i < n; ++i)
|
||||
{
|
||||
for(int i = 0; i < n; ++i) {
|
||||
Post::RealTimeWindowBase* rw = rwList.at(i);
|
||||
if(rw != nullptr)
|
||||
rw->reTranslate();
|
||||
}
|
||||
QList<XReport::ReportWindow*> repWin = _reportWindow.values();
|
||||
n = repWin.size();
|
||||
for (int i = 0; i < n; ++i)
|
||||
{
|
||||
for(int i = 0; i < n; ++i) {
|
||||
XReport::ReportWindow* w = repWin.at(i);
|
||||
w->reTranslate();
|
||||
}
|
||||
|
@ -605,8 +588,7 @@ namespace GUI
|
|||
|
||||
GenerateGeometry::GenerateGeometryWidget* SubWindowManager::getGeometryWindow()
|
||||
{
|
||||
if (!_geometryWindow.second)
|
||||
{
|
||||
if(!_geometryWindow.second) {
|
||||
openGeometryWindow();
|
||||
}
|
||||
return _geometryWindow.second;
|
||||
|
@ -618,8 +600,7 @@ namespace GUI
|
|||
// _mdiArea->setTabPosition(QTabWidget::North);
|
||||
|
||||
MainWidget::PreWindow* pre = _preWindow.second;
|
||||
if (pre != nullptr)
|
||||
{
|
||||
if(pre != nullptr) {
|
||||
_preWindow.first->close();
|
||||
_mdiArea->removeSubWindow(pre);
|
||||
pre->close();
|
||||
|
@ -627,8 +608,7 @@ namespace GUI
|
|||
}
|
||||
|
||||
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);
|
||||
_postWindow.key(p)->close();
|
||||
_mdiArea->removeSubWindow(p);
|
||||
|
@ -637,8 +617,7 @@ namespace GUI
|
|||
}
|
||||
|
||||
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);
|
||||
_realTimeWindow.key(r)->close();
|
||||
_mdiArea->removeSubWindow(r);
|
||||
|
@ -647,8 +626,7 @@ namespace GUI
|
|||
}
|
||||
|
||||
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);
|
||||
_reportWindow.key(r)->close();
|
||||
_mdiArea->removeSubWindow(r);
|
||||
|
@ -661,47 +639,34 @@ namespace GUI
|
|||
{
|
||||
ModuleBase::GraphWindowBase* g = nullptr;
|
||||
type = type.toLower();
|
||||
if (type == "prewindow")
|
||||
{
|
||||
if(type == "prewindow") {
|
||||
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)
|
||||
{
|
||||
for(int i = 0; i < wlist.size(); ++i) {
|
||||
ModuleBase::GraphWindowBase* t = wlist.at(i);
|
||||
const int d = t->getID();
|
||||
if (id == d)
|
||||
{
|
||||
if(id == d) {
|
||||
g = t;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (type == "post2d")
|
||||
{
|
||||
} else if(type == "post2d") {
|
||||
QList<Post::PostWindowBase*> wlist = _postWindow.values();
|
||||
for (int i = 0; i < wlist.size(); ++i)
|
||||
{
|
||||
for(int i = 0; i < wlist.size(); ++i) {
|
||||
ModuleBase::GraphWindowBase* t = wlist.at(i);
|
||||
const int d = t->getID();
|
||||
if (id == d && t->getGraphWindowType() == ModuleBase::Post2D)
|
||||
{
|
||||
if(id == d && t->getGraphWindowType() == ModuleBase::Post2D) {
|
||||
g = t;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (type == "post3d")
|
||||
{
|
||||
} else if(type == "post3d") {
|
||||
QList<Post::PostWindowBase*> wlist = _postWindow.values();
|
||||
for (int i = 0; i < wlist.size(); ++i)
|
||||
{
|
||||
for(int i = 0; i < wlist.size(); ++i) {
|
||||
ModuleBase::GraphWindowBase* t = wlist.at(i);
|
||||
const int d = t->getID();
|
||||
if (id == d && t->getGraphWindowType() == ModuleBase::Post3D)
|
||||
{
|
||||
if(id == d && t->getGraphWindowType() == ModuleBase::Post3D) {
|
||||
g = t;
|
||||
break;
|
||||
}
|
||||
|
@ -714,11 +679,11 @@ namespace GUI
|
|||
{
|
||||
if(_preWindow.first != nullptr)
|
||||
_preWindow.first->setWindowIcon(QIcon(icon));
|
||||
QList<QMdiSubWindow *> subw = _postWindow.keys() + _realTimeWindow.keys() + _reportWindow.keys();
|
||||
for (auto w : subw)
|
||||
{
|
||||
QList<QMdiSubWindow*> subw =
|
||||
_postWindow.keys() + _realTimeWindow.keys() + _reportWindow.keys();
|
||||
for(auto w : subw) {
|
||||
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