/** * * @file FITKOCCVirtualTopoCreator.h * @brief OCC虚拟拓扑创建器 * @author libaojun (libaojunqd@foxmail.com) * @date 2024-08-09 * */ #ifndef _FITK_VIRTUALTOPO_CREATOR_H___ #define _FITK_VIRTUALTOPO_CREATOR_H___ #include "FITKGeoCompOCCAPI.h" #include "FITK_Interface/FITKInterfaceGeometry/FITKAbsVirtualTopo.h" #include "FITK_Kernel/FITKCore/FITKThreadTask.h" #include class TopoDS_Shape; namespace Interface { class FITKVirtualTopoManager; } namespace OCC { /** * @brief OCC几何形状 * @author libaojun (libaojunqd@foxmail.com) * @date 2024-08-09 */ class FITKGeoCompOCCAPI FITKOCCTopoShape : public Interface::FITKAbsVirtualTopoShape { public: /** * @brief Construct a new FITKOCCTopoShape object * @param[i] shape OCC形状对象 * @author libaojun (libaojunqd@foxmail.com) * @date 2024-08-09 */ explicit FITKOCCTopoShape(const TopoDS_Shape & shape); /** * @brief Destroy the FITKOCCTopoShape object * @author libaojun (libaojunqd@foxmail.com) * @date 2024-08-09 */ virtual ~FITKOCCTopoShape() = default; /** * @brief 判断两个形状是否相同 * @param[i] shape OCC形状对象 * @return true 相同 * @return false 不同 * @author libaojun (libaojunqd@foxmail.com) * @date 2024-08-09 */ bool isSameShape(void* shape) override; /** * @brief 获取OCC形状对象 * @return const TopoDS_Shape& OCC形状对象 * @author libaojun (libaojunqd@foxmail.com) * @date 2024-08-09 */ const TopoDS_Shape& getTopoShape() const; private: /** * @brief occ形状 * @author libaojun (libaojunqd@foxmail.com) * @date 2024-08-09 */ TopoDS_Shape* _shape; }; /** * @brief 几何拓扑创建 * @author libaojun (libaojunqd@foxmail.com) * @date 2024-08-09 */ class FITKOCCVirtualTopoCreator : public Core::FITKThreadTask { public: /** * @brief Construct a new FITKOCCVirtualTopoCreator object * @author libaojun (libaojunqd@foxmail.com) * @date 2024-08-09 */ explicit FITKOCCVirtualTopoCreator(const TopoDS_Shape& shape, Interface::FITKVirtualTopoManager* topo, const QString& mode, bool& runLabel ); /** * @brief Destroy the FITKOCCVirtualTopoCreator object * @author libaojun (libaojunqd@foxmail.com) * @date 2024-08-09 */ virtual ~FITKOCCVirtualTopoCreator() ; /** * @brief 在线程中执行 * @author LiBaojun (libaojunqd@foxmail.com) * @date 2024-08-15 */ void run() override; /** * @brief 创建几何拓扑 * @param[i] shape OCC形状 * @param[o] topo 几何拓扑管理器 * @author libaojun (libaojunqd@foxmail.com) * @date 2024-08-09 */ void createOCCTopos(); private: /** * @brief 创建几何拓扑树形结构,递归调用 * @param[i] shape OCC形状 * @param[o] topo 几何拓扑管理器 * @param[i] parent 父几何拓扑 * @author libaojun (libaojunqd@foxmail.com) * @date 2024-08-09 */ void buildTopoTree(const TopoDS_Shape& shape, Interface::FITKVirtualTopoManager* topo, Interface::FITKAbsVirtualTopo* parent); private: /** * @brief 根节点形状 * @author LiBaojun (libaojunqd@foxmail.com) * @date 2024-08-15 */ const TopoDS_Shape& _shape; /** * @brief 对应的管理器 * @author LiBaojun (libaojunqd@foxmail.com) * @date 2024-08-15 */ Interface::FITKVirtualTopoManager* _topoMgr{}; /** * @brief 名称 * @author LiBaojun (libaojunqd@foxmail.com) * @date 2024-08-15 */ QString _modelName{}; /** * @brief 临时存储的虚拓扑hash * @author LiBaojun (libaojunqd@foxmail.com) * @date 2024-08-15 */ QHash > _virtualTopoHash{}; /** * @brief 是否在执行创建操作 * @author LiBaojun (libaojunqd@foxmail.com) * @date 2024-08-15 */ bool& _runLabel; }; /** * @brief 几何拓扑创建 * @author libaojun (libaojunqd@foxmail.com) * @date 2024-08-09 */ class FITKOCCVirtualTopoMapper : public Core::FITKThreadTask { public: /** * @brief Construct a new FITKOCCVirtualTopoMapper object * @param[i] shape 形状 * @param[i] topomgr 管理器 * @param[i] topo 该类型的几何拓扑 * @param[i] shapeTypeIndex 类型索引 * @author LiBaojun (libaojunqd@foxmail.com) * @date 2024-08-19 */ explicit FITKOCCVirtualTopoMapper(const TopoDS_Shape& shape, Interface::FITKVirtualTopoManager* topomgr, QHash> & topos, int shapeTypeIndex); /** * @brief Destroy the FITKOCCVirtualTopoMapper object * @author LiBaojun (libaojunqd@foxmail.com) * @date 2024-08-19 */ virtual ~FITKOCCVirtualTopoMapper() = default; /** * @brief 执行创建操作 * @author LiBaojun (libaojunqd@foxmail.com) * @date 2024-08-19 */ void run() override; private: /** * @brief 形状 * @author LiBaojun (libaojunqd@foxmail.com) * @date 2024-08-19 */ const TopoDS_Shape& _shape; /** * @brief 管理器 * @author LiBaojun (libaojunqd@foxmail.com) * @date 2024-08-19 */ Interface::FITKVirtualTopoManager* _topoMgr{}; /** * @brief 该类型的几何拓扑 * @author LiBaojun (libaojunqd@foxmail.com) * @date 2024-08-19 */ QHash>& _topos; /** * @brief 类型索引 * @author LiBaojun (libaojunqd@foxmail.com) * @date 2024-08-19 */ int _shapeTypeIndex{ -1 }; QList _topoList{}; }; } #endif