#include "GeometryWidgetBase.h" #include "GUIFrame/MainWindow.h" #include "OperatorsInterface/GraphEventOperator.h" #include "OperatorsInterface/GraphInteractionOperator.h" #include "FITK_Kernel/FITKCore/FITKOperatorRepo.h" #include "FITK_Kernel/FITKAppFramework/FITKAppFramework.h" #include "FITK_Kernel/FITKAppFramework/FITKGlobalData.h" #include "FITK_Interface/FITKInterfaceGeometry/FITKAbsGeoCommand.h" #include "FITK_Interface/FITKInterfaceMeshGen/FITKAbstractMeshSizeInfoGenerator.h" #include "FITK_Interface/FITKInterfaceMeshGen/FITKGeometryMeshSize.h" #include "FITK_Interface/FITKInterfaceMeshGen/FITKMeshGenInterface.h" #include "FITK_Interface/FITKInterfaceMeshGen/FITKRegionMeshSizeGeom.h" namespace GUI { GeometryWidgetBase::GeometryWidgetBase(Interface::FITKAbsGeoCommand * obj, EventOper::ParaWidgetInterfaceOperator * oper, QWidget * parent) : Core::FITKWidget(parent), _obj(obj), _oper(oper) { _mainWin = FITKAPP->getGlobalData()->getMainWindowT(); } GeometryWidgetBase::~GeometryWidgetBase() { } QList GeometryWidgetBase::getDefaultFaceGroup(Interface::FITKAbsGeoCommand* geoObj) { QList defaultFaceIDs = {}; if (geoObj == nullptr)return defaultFaceIDs; Interface::FITKAbsGeoShapeAgent* geoShapeAgent = geoObj->getShapeAgent(); if (geoShapeAgent == nullptr)return defaultFaceIDs; Interface::FITKVirtualTopoManager* geoTopoManager = geoShapeAgent->getVirtualTopoManager(); if (geoTopoManager == nullptr)return defaultFaceIDs; Interface::FITKShapeVirtualTopoManager* shapTopeManager = geoTopoManager->getShapeVirtualTopoManager(Interface::FITKGeoEnum::VTopoShapeType::VSFace); if (shapTopeManager == nullptr)return defaultFaceIDs; for (int i = 0; i < shapTopeManager->getDataCount(); i++) { Interface::FITKAbsVirtualTopo* faceTopo = shapTopeManager->getDataByIndex(i); if (faceTopo == nullptr)continue; defaultFaceIDs.append(faceTopo->getDataObjectID()); } return defaultFaceIDs; } void GeometryWidgetBase::createDefaultFaceGroup(Interface::FITKAbsGeoCommand* geoObj) { if (geoObj == nullptr)return; Interface::FITKAbsGeoShapeAgent* geoShapeAgent = geoObj->getShapeAgent(); if (geoShapeAgent == nullptr)return; Interface::FITKGeoComponentManager* commanger = geoShapeAgent->getGeoComponentManager(); if (commanger == nullptr)return; QList defaultFaceIDs = getDefaultFaceGroup(geoObj); //创建面组对象 Interface::FITKGeoComponent* geoCom = new Interface::FITKGeoComponent(Interface::FITKModelEnum::FITKModelSetType::FMSSurface); geoCom->setDataObjectName("Default"); geoCom->setMember(defaultFaceIDs); commanger->appendDataObj(geoCom); } Interface::FITKAbsGeoCommand * GeometryWidgetBase::getCurrentGeoCommand() { return _obj; } void GeometryWidgetBase::showEvent(QShowEvent * event) { transparency(); } void GeometryWidgetBase::closeEvent(QCloseEvent * event) { transparency(false, false); } void GeometryWidgetBase::transparency(bool geo, bool mesh) { //EventOper::GraphEventOperator* graphOper = FITKOPERREPO->getOperatorT("GraphPreprocess"); //if (graphOper == nullptr)return; //graphOper->setEnableModelTransparent(geo); //graphOper->setEnableMeshTransparent(mesh); //graphOper->reRender(); } void GeometryWidgetBase::createMeshSizeGeo() { //auto meshSizeGen = Interface::FITKMeshGenInterface::getInstance()->getMeshSizeGenerator(); //auto meshSizeManager = Interface::FITKMeshGenInterface::getInstance()->getRegionMeshSizeMgr(); //if (meshSizeGen&&meshSizeManager) { // auto meshSizeGeo = dynamic_cast // (meshSizeGen->createRegionMeshSize(Interface::FITKAbstractRegionMeshSize::RegionType::RigonGeom)); // if (meshSizeGeo) { // meshSizeGeo->setGeomID(_obj->getDataObjectID()); // meshSizeManager->appendDataObj(meshSizeGeo); // } //} } }