OpenTwin 0.1
OpenTwin
 
Loading...
Searching...
No Matches
EntityGeometry.h
Go to the documentation of this file.
1#pragma once
2#pragma warning(disable : 4251)
3
4#include "EntityContainer.h"
5#include "EntityBrep.h"
6#include "EntityFacetData.h"
7#include "OldTreeIcon.h"
8
9#include <string>
10
11#include "TopoDS_Shape.hxx"
12
14class __declspec(dllexport) EntityGeometry : public EntityContainer
15{
16public:
17 EntityGeometry(ot::UID ID, EntityBase *parent, EntityObserver *obs, ModelState *ms, ClassFactoryHandler* factory, const std::string &owner);
18 virtual ~EntityGeometry();
19
20 void setBrep(TopoDS_Shape shape);
21 TopoDS_Shape &getBrep(void);
22
23 EntityFacetData* getFacets(void);
24 EntityBrep* getBrepEntity(void);
25
26 long long getBrepStorageObjectID(void) { assert(brepStorageID != -1); return brepStorageID; }
27 long long getFacetsStorageObjectID(void) { assert(facetsStorageID != -1); return facetsStorageID; }
28
29 virtual bool getEntityBox(double &xmin, double &xmax, double &ymin, double &ymax, double &zmin, double &zmax) override;
30
31 virtual bool updateFromProperties(void) override;
32
33 virtual void StoreToDataBase(void) override;
34
35 virtual void addVisualizationNodes(void) override;
36
37 void releaseBrep(void);
38 void releaseFacets(void);
39
40 void resetBrep(void);
41 void resetFacets(void);
42
43 virtual std::string getClassName(void) override { return "EntityGeometry"; };
44
45 void addPrefetchingRequirementsForBrep(std::list<ot::UID> &prefetchIds);
46 void addPrefetchingRequirementsForFacets(std::list<ot::UID> &prefetchIds);
47
48 virtual entityType getEntityType(void) override { return TOPOLOGY; };
49 virtual void removeChild(EntityBase *child) override;
50
51 long long getBrepPrefetchID(void);
52 long long getFacetsPrefetchID(void);
53
54 void createProperties(int colorR, int colorG, int colorB, const std::string materialsFolder, ot::UID materialsFolderID);
55 void createMaterialPropertiesOnly(int colorR, int colorG, int colorB, const std::string materialsFolder, ot::UID materialsFolderID);
56 void createNonMaterialProperties(void);
57
58 void facetEntity(bool isHidden);
59
60 void setData(void *data) { tmpData = data; }
61 void *getData(void) { return tmpData; }
62
63 void replaceBrepStorageID(ot::UID id) { assert(brep == nullptr); brepStorageID = id; setModified(); }
64 void replaceFacetsStorageID(ot::UID id) { assert(facets == nullptr); facetsStorageID = id; setModified(); }
65
66 double evaluateExpressionDouble(const std::string &expr);
67
68 virtual bool considerForPropertyFilter(void) override { return true; };
69 virtual bool considerChildrenForPropertyFilter(void) override { return false; };
70
71 void setOldTreeIcons(const std::string &visible, const std::string &hidden) { treeIcons.visibleIcon = visible; treeIcons.hiddenIcon = hidden; }
72 void getOldTreeIcons(std::string &visible, std::string &hidden) { visible = treeIcons.visibleIcon; hidden = treeIcons.hiddenIcon; }
73
74 bool isTextureReflective(const std::string textureType);
75
76 void storeBrep(void);
77 void detachBrep(void);
78
79 void storeFacets(void);
80
81 void setShowWhenSelected(bool flag) { showWhenSelected = flag; }
82 bool getShowWhenSelected(void) { return showWhenSelected; }
83
84 void resetTransformation(void);
85 void getTransformation(std::vector<double> &transformation);
86 void setTransformation(const std::vector<double> &transformation);
87
88 void setFacetEntity(EntityFacetData *entity) { assert(facets == nullptr); facets = entity; }
89 void setBrepEntity(EntityBrep *entity) { assert(brep == nullptr); brep = entity; }
90
91private:
92 virtual int getSchemaVersion(void) override { return 1; };
93 virtual void AddStorageData(bsoncxx::builder::basic::document &storage) override;
94 virtual void readSpecificDataFromDataBase(bsoncxx::document::view &doc_view, std::map<ot::UID, EntityBase *> &entityMap) override;
95 void EnsureBrepIsLoaded(void);
96 void EnsureFacetsAreLoaded(void);
97 bool updatePropertyVisibilities(void);
98 void updateDimensionProperties(void);
99 bool isTransformProperty(const std::string &propName);
100 void createTransformProperty(const std::string &propName, double value);
101
102 // Persistent data
103 EntityBrep *brep;
104 EntityFacetData *facets;
105
106 long long brepStorageID;
107 long long facetsStorageID;
108
109 OldTreeIcon treeIcons;
110
111 bool showWhenSelected;
112
113 // Temporary raw pointer which can be used for some algorithms temporarily (we do not take care of this data at all)
114 void *tmpData;
115};
116
117
118
bsoncxx::types::value value
Definition DocumentManager.h:16
bool facetEntity(TopoDS_Shape &shape, double deflection, std::vector< Geometry::Node > &nodes, std::list< Geometry::Triangle > &triangles, std::list< Geometry::Edge > &edges, std::string &errors)
EntityBrep * brep
Definition GeometryOperations.h:21
__declspec(dllexport) void setHoverTreeItem(ot __declspec(dllexport) void addNodeFromFacetData(ot __declspec(dllexport) void addNodeFromFacetDataBase(ot __declspec(dllexport) void addVisualizationContainerNode(ot __declspec(dllexport) void addVisualizationNode(ot __declspec(dllexport) void addVTKNode(ot __declspec(dllexport) void updateVTKNode(ot __declspec(dllexport) void addVisualizationAnnotationNode(ot __declspec(dllexport) void addVisualizationAnnotationNodeDataBase(ot __declspec(dllexport) void addVisualizationMeshNodeFromFacetDataBase(ot __declspec(dllexport) void addVisualizationMeshItemNodeFromFacetDataBase(ot __declspec(dllexport) void addVisualizationCartesianMeshNode(ot __declspec(dllexport) void visualizationCartesianMeshNodeShowLines(ot __declspec(dllexport) void addVisualizationCartesianMeshItemNode(ot __declspec(dllexport) void visualizationTetMeshNodeTetEdges(ot __declspec(dllexport) void notifySceneNodeAboutViewChange(ot __declspec(dllexport) std __declspec(dllexport) void removeSelectedCurveNodes(ot __declspec(dllexport) void addVisualizationPlot1DNode(ot __declspec(dllexport) void visualizationResult1DPropertiesChanged(ot __declspec(dllexport) void visualizationPlot1DPropertiesChanged(ot __declspec(dllexport) void setEntityName(ot __declspec(dllexport) void renameEntityPath(const std __declspec(dllexport) void updateObjectColor(ot __declspec(dllexport) void updateMeshColor(ot __declspec(dllexport) void updateObjectFacetsFromDataBase(ot __declspec(dllexport) void setClearColor(ot __declspec(dllexport) void setDataModel(ot __declspec(dllexport) void getSelectedModelEntityIDs(std __declspec(dllexport) void getSelectedVisibleModelEntityIDs(std __declspec(dllexport) ot __declspec(dllexport) ot __declspec(dllexport) void removeShapes(ot __declspec(dllexport) void setShapeVisibility(ot __declspec(dllexport) void hideEntities(ot __declspec(dllexport) void showBranch(ot __declspec(dllexport) void hideBranch(ot __declspec(dllexport) void enterEntitySelectionMode(ot __declspec(dllexport) void setFontPath(const std __declspec(dllexport) void setDataBaseConnection(const std __declspec(dllexport) void prefetchDocumentsFromStorage(const std __declspec(dllexport) void setTabNames(ot __declspec(dllexport) ot __declspec(dllexport) void viewerTabChanged(const std __declspec(dllexport) void viewDataModifiedChanged(const std __declspec(dllexport) void shortcutActivated(const std __declspec(dllexport) void createRubberband(ot __declspec(dllexport) void settingsItemChanged(ot __declspec(dllexport) bool propertyGridValueChanged(ot bool flag
Definition ViewerAPI.h:147
unsigned long UID
Unique identifier (32 bit unsigned integer)
Definition CoreTypes.h:27