// Copyright (c) 2020 OPEN CASCADE SAS // // This file is part of the examples of the Open CASCADE Technology software library. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE #ifndef DOCUMENT_COMMON_OVERVIEW_H #define DOCUMENT_COMMON_OVERVIEW_H #include "WBFZExchangePluginAPI.h" #include "AllHead.h" #include #include "TaskTreeClass.h" #include "TaskNodeList.h" /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // 文件模型控制 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //! Implements visualization of samples content class DocumentCommon : public QTreeWidget { Q_OBJECT public: Q_INVOKABLE DocumentCommon(QWidget*); ~DocumentCommon() { } //========================================= // 任务节点管理 //========================================= public: // 数据管理层次 QTreeWidgetItem* dataRoot; // 根节点 QTreeWidgetItem* taskRoot; QTreeWidgetItem* modelRoot; // 数据类型 QTreeWidgetItem* imageRoot; QTreeWidgetItem* pointCloudRoot; QTreeWidgetItem* atriTableRoot; QTreeWidgetItem* fekoSimulationRoot; // 任务类型 QTreeWidgetItem* exportScatteringRoot; QTreeWidgetItem* fekoScatteringRoot; QMap dataMap; // 数据名-节点项绑定 public slots: void initTaskTreeRootNode(); //初始化任务树 TaskNode* getItemByName(QString name);// 场景节点 void addTaskNode(TaskNode*); // 添加节点 void removeTaskNode(QString itemName); // 移除节点 bool addUniqueNode(QTreeWidgetItem* item); // 添加唯一性节点 QTreeWidgetItem* newQTaskTreeWidgetItem(TaskNode* node); // 创建任务节点 void renameTaskNode(QString olditemName,QString newitemName); // 重命名节点 void copyNewNode(TaskNode* newNode); void UpdateItemParantNode(QTreeWidgetItem* n, QTreeWidgetItem* p = nullptr);// 更变父节点,如果是空指针,标识提升为根节点 public slots: // 添加 文件节点分布 void addOCCTObjectItem(TaskNode*); // 加载数据 void addImageObjectItem(TaskNode*); void addPointCloudObjectItem(TaskNode*); // 功能待实现 void addAtriTableObjectItem(TaskNode*); // 功能待实现 void addScatterSettingTaskItem(TaskNode*); // 加载任务 void addFEKOResultDataConvertItem(TaskNode*); void addFEKOSimulationImageSettingItem(TaskNode*); void addOCCTObjItem(TopoDS_Shape shape, QString name, bool ishow = true);// 添加模型 void addShapeDsItem(QString filepath); // 加载模型 public slots: // 移除节点 void removeTaskNode(QTreeWidgetItem*); public slots: // 任务节点,共有内容 void ContentListContextMenu_UndoAction(); // 撤销 void ContentListContextMenu_RedoAction(); // 重做 void ContentListContextMenu_BatchExportAction(); public slots: void initDocumentCommonContextMenu(); // 初始化右键菜单 void ShowContentListContextMenu(QPoint p); //========================================= // 模型操作 //========================================= private:// 私有变量 bool isActivateGridMesh ; bool isActivateAxisGrid; Graphic3d_GraduatedTrihedron aTrihedron_aixs; public:// 公开变量 Handle(V3d_Viewer) myViewer; Handle(AIS_InteractiveContext) myContext; bool myContextIsEmpty; NCollection_Vector myObject3d; // 控制器列表 QUndoStack* m_undoStack; QSet ItemSets; QMenu* ContentListContextMenu; OCCTopoShapeTreeViewer* ShapeInfomationWindows; //展示被选择的模型 public: Handle(AIS_InteractiveObject) ShowTopoDS_Shape(TopoDS_Shape& shape); // 显示模型 bool HideTopoDS_Shape(Handle(AIS_InteractiveObject) aShape); // 隐藏模型 bool ShowTopoDs_ShapeAIS(Handle(AIS_InteractiveObject) aShape); // 显示模型 bool RemoveTopoDS_Shape(Handle(AIS_InteractiveObject) aShape); // 移除模型 const Handle(AIS_InteractiveContext)& getContext() { return myContext; } const Handle(V3d_Viewer)& getViewer() { return myViewer; } void setViewer(const Handle(V3d_Viewer)& theViewer) { myViewer = theViewer; } void SetObjects(const NCollection_Vector& theObjects, Standard_Boolean theDisplayShaded = Standard_False); void ClearShape(); // 清除模型 bool IsEmpty() const { return myContextIsEmpty; } void AppendCube(); // 增加视觉立方体 void InitAixs(); // 增加三维坐标轴 std::shared_ptr getSenceExtend(); // 场景数据获取 std::shared_ptr getSenceExtend(QString name); signals: void selectionChanged(); void sendCloseDocument(DocumentCommon*); private: Handle(V3d_Viewer) Viewer(const Standard_ExtString theName, const Standard_CString theDomain, const Standard_Real theViewSize, const V3d_TypeOfOrientation theViewProj, const Standard_Boolean theComputedMode, const Standard_Boolean theDefaultComputedMode); public slots: void ShowOrHideActivateGridMesh(); void ShowOrHideActivateAxisGris(); bool getActivateGridMesh(); bool getActivateAxisGrid(); void VerticesSelect3dSample(); void EdgesSelect3dSample(); void FacesSelect3dSample(); void NeutralPointSelect3dSample(); //void ShapeModifyShape(OCCTShapeModelNode* dataItem); // 模型修改 public: void OpenOCCTShapeFile(); void SaveModelFile(); void oncheckBoxStateChanged(int state); TopoDS_Shape MergeCOntextAllModels(); public slots: // 模型窗口右键菜单 /////////////////////////////////////////////////// // 获取view窗体中的 选择模型 /////////////////////////////////////////////////// signals: void SelectObjectList(const TopoDS_Shape& selectShape); void ShowSelectItemFullExtend(const TopoDS_Shape& shape); public slots: void ViewerMousePressEvent(QMouseEvent* theEvent); void ViewerMouseReleaseEvent(QMouseEvent* theEvent); void SelectItemFullShow(const TopoDS_Shape& shape); void setShapeInfomationWindows(OCCTopoShapeTreeViewer* ShapeInfomationWindows); public: TopoDS_Shape getTopoDSShape(const Handle(AIS_InteractiveObject)& aisObject); void showSelectShape(const TopoDS_Shape& selectShape); }; #endif