OpenTwin 0.1
OpenTwin
 
Loading...
Searching...
No Matches
EdgesOperationBase.h
Go to the documentation of this file.
1#pragma once
2
3#include "OldTreeIcon.h"
4#include "ShapesBase.h"
5
6#include "TopoDS_TShape.hxx"
7#include "TopTools_ListOfShape.hxx"
8
9class Model;
10class EntityGeometry;
11class EntityBrep;
12class UpdateManager;
13
14class TopoDS_Shape;
15class TopoDS_Vertex;
16class BRepTools_History;
17
19{
20public:
21 EdgesData() : entityID(0) {}
22 virtual ~EdgesData() {}
23
24 void setEntityID(ot::UID id) { entityID = id; }
25
26 ot::UID getEntityID(void) { return entityID; }
27
28 void setEdgeName(const std::string& name) { edgeName = name; }
29 std::string getEdgeName(void) { return edgeName; }
30
31private:
32 ot::UID entityID;
33 std::string edgeName;
34};
35
36
38{
39public:
40 EdgesOperationBase(ot::components::UiComponent *_uiComponent, ot::components::ModelComponent *_modelComponent, ot::serviceID_t _serviceID, const std::string &_serviceName, EntityCache *_entityCache, ClassFactory *_classFactory)
41 : ShapesBase(_uiComponent, _modelComponent, _serviceID, _serviceName, _entityCache, _classFactory), updateManager(nullptr) {};
43
44 void setUpdateManager(UpdateManager *_updateManager) { updateManager = _updateManager; };
45
46 void enterSelectEdgesMode(void);
47 void performOperation(const std::string &selectionInfo);
48
49 void updateShape(EntityGeometry* geometryEntity, TopoDS_Shape& shape, std::map< const opencascade::handle<TopoDS_TShape>, std::string>& resultFaceNames);
50
51private:
52 UpdateManager *getUpdateManager(void) { assert(updateManager != nullptr); return updateManager; }
53 void storeEdgeListInProperties(std::list<EdgesData>& edgeList, EntityProperties& properties);
54 std::list<EdgesData> readEdgeListFromProperties(EntityProperties& properties);
55 void performOperation(EntityGeometry* geometryEntity, EntityBrep* baseBrep, TopoDS_Shape& shape, std::map< const opencascade::handle<TopoDS_TShape>, std::string>& resultFaceNames);
56 void storeInputShapeFaceNames(EntityBrep* baseBrep, std::map< const opencascade::handle<TopoDS_TShape>, std::string>& allFaceNames);
57 void getAllEdgesFromInputShape(EntityBrep* baseBrep, std::map< std::string, const opencascade::handle<TopoDS_TShape>>& allEdges, std::map<const opencascade::handle<TopoDS_TShape>, std::string>& allEdgesFace1, std::map<const opencascade::handle<TopoDS_TShape>, std::string>& allEdgesFace2);
58 void getAllEdgesForOperation(std::list<EdgesData>& edgeList, std::map< std::string, const opencascade::handle<TopoDS_TShape>>& allEdges, std::map< const opencascade::handle<TopoDS_TShape>, std::string>& allEdgesForOperation);
59 void getAllEdgesForVertex(EntityBrep* baseBrep, TopoDS_Vertex& aVertex, std::map< const opencascade::handle<TopoDS_TShape>, std::string>& allEdgesForOperation, std::list<opencascade::handle<TopoDS_TShape>>& allEdgesForVertex);
60 std::string getVertexNameFromEdges(std::list<opencascade::handle<TopoDS_TShape>>& allEdgesForVertex, std::map<const opencascade::handle<TopoDS_TShape>, std::string>& allEdgesFace1, std::map<const opencascade::handle<TopoDS_TShape>, std::string>& allEdgesFace2);
61
62protected:
63 void addParametricProperty(EntityGeometry* geometryEntity, const std::string& name, double value);
64
65 virtual void addSpecificProperties(EntityGeometry* geometryEntity) = 0;
67 virtual std::string getOperationDescription() = 0;
68 virtual std::string getVisibleTreeItemName() = 0;
69 virtual std::string getHiddenTreeItemName() = 0;
70 virtual std::string getShapeType() = 0;
71 virtual bool operationActive(EntityGeometry* geometryEntity) = 0;
72 virtual bool performActualOperation(EntityGeometry* geometryEntity, EntityBrep* baseBrep, std::map< const opencascade::handle<TopoDS_TShape>, std::string>& allEdgesForOperation, TopoDS_Shape& shape, TopTools_ListOfShape& listOfProcessedEdges, BRepTools_History*& history) = 0;
73
75};
bsoncxx::types::value value
Definition DocumentManager.h:16
Definition EdgesOperationBase.h:19
EdgesData()
Definition EdgesOperationBase.h:21
virtual ~EdgesData()
Definition EdgesOperationBase.h:22
ot::UID getEntityID(void)
Definition EdgesOperationBase.h:26
void setEdgeName(const std::string &name)
Definition EdgesOperationBase.h:28
void setEntityID(ot::UID id)
Definition EdgesOperationBase.h:24
std::string getEdgeName(void)
Definition EdgesOperationBase.h:29
Definition EdgesOperationBase.h:38
EdgesOperationBase(ot::components::UiComponent *_uiComponent, ot::components::ModelComponent *_modelComponent, ot::serviceID_t _serviceID, const std::string &_serviceName, EntityCache *_entityCache, ClassFactory *_classFactory)
Definition EdgesOperationBase.h:40
void performOperation(const std::string &selectionInfo)
Definition EdgesOperationBase.cpp:44
void addParametricProperty(EntityGeometry *geometryEntity, const std::string &name, double value)
Definition EdgesOperationBase.cpp:34
UpdateManager * updateManager
Definition EdgesOperationBase.h:74
void setUpdateManager(UpdateManager *_updateManager)
Definition EdgesOperationBase.h:44
void enterSelectEdgesMode(void)
Definition EdgesOperationBase.cpp:27
virtual bool operationActive(EntityGeometry *geometryEntity)=0
virtual std::string getShapeType()=0
virtual std::string getHiddenTreeItemName()=0
virtual std::string getVisibleTreeItemName()=0
virtual bool performActualOperation(EntityGeometry *geometryEntity, EntityBrep *baseBrep, std::map< const opencascade::handle< TopoDS_TShape >, std::string > &allEdgesForOperation, TopoDS_Shape &shape, TopTools_ListOfShape &listOfProcessedEdges, BRepTools_History *&history)=0
virtual ~EdgesOperationBase()
Definition EdgesOperationBase.h:42
void updateShape(EntityGeometry *geometryEntity, TopoDS_Shape &shape, std::map< const opencascade::handle< TopoDS_TShape >, std::string > &resultFaceNames)
Definition EdgesOperationBase.cpp:237
virtual void addSpecificProperties(EntityGeometry *geometryEntity)=0
virtual ot::components::UiComponent::entitySelectionAction getSelectionAction()=0
virtual std::string getOperationDescription()=0
Definition EntityCache.h:26
The Model class is the main interface to the model. There may be multiple instances of this class....
Definition Model.h:94
Definition ShapesBase.h:19
Definition UpdateManager.h:30
Definition ModelComponent.h:42
Definition UiComponent.h:31
entitySelectionAction
Definition UiComponent.h:40
unsigned long UID
Unique identifier (32 bit unsigned integer)
Definition CoreTypes.h:27
unsigned short serviceID_t
ID type used to identify a service (16 bit unsigned integer).
Definition CoreTypes.h:14