2#pragma warning(disable : 4251)
7#include <bsoncxx/builder/stream/document.hpp>
8#include <bsoncxx/json.hpp>
9#include <bsoncxx/builder/basic/document.hpp>
16class ClassFactoryHandler;
18class __declspec(dllexport) EntityObserver
22 virtual ~EntityObserver() {};
24 virtual void entityRemoved(EntityBase *entity) {};
25 virtual void entityModified(EntityBase *entity) {};
27 virtual void sendMessageToViewer(
ot::JsonDocument& doc) { std::list<std::pair<ot::UID, ot::UID>> prefetchIds; sendMessageToViewer(doc, prefetchIds); };
28 virtual void sendMessageToViewer(
ot::JsonDocument& doc, std::list<std::pair<ot::UID, ot::UID>> &prefetchIds) {};
33class __declspec(dllexport) EntityBase
36 EntityBase(
ot::UID _ID, EntityBase* _parent, EntityObserver* _obs, ModelState* _ms, ClassFactoryHandler* _factory,
const std::string& _owner);
37 virtual ~EntityBase();
42 void setName(std::string n) { m_name = n; setModified(); };
43 std::string getName(
void)
const {
return m_name; };
47 std::string getNameOnly()
const;
49 void setEntityID(
ot::UID id) { m_entityID = id; setModified(); };
50 ot::UID getEntityID(
void)
const {
return m_entityID; };
52 ot::UID getEntityStorageVersion(
void)
const {
return m_entityStorageVersion; };
54 void setInitiallyHidden(
bool flag) { m_initiallyHidden =
flag; };
55 bool getInitiallyHidden(
void) {
return m_initiallyHidden; };
57 void setEditable(
bool flag) { m_isEditable =
flag; }
58 bool getEditable(
void) {
return m_isEditable; }
60 void setSelectChildren(
bool flag) { m_selectChildren =
flag; }
61 bool getSelectChildren(
void) {
return m_selectChildren; }
63 void setManageParentVisibility(
bool flag) { m_manageParentVisibility =
flag; }
64 bool getManageParentVisibility(
void) {
return m_manageParentVisibility; }
66 void setManageChildVisibility(
bool flag) { m_manageChildVisibility =
flag; }
67 bool getManageChildVisibility(
void) {
return m_manageChildVisibility; }
69 virtual bool getEntityBox(
double &xmin,
double &xmax,
double &ymin,
double &ymax,
double &zmin,
double &zmax) = 0;
71 virtual void removeChild(EntityBase *child) {};
73 virtual bool updateFromProperties(
void);
75 void setModelState(ModelState *ms) { m_modelState = ms; };
76 ModelState *getModelState(
void) {
return m_modelState; };
78 EntityBase *getParent(
void) {
return m_parentEntity; };
79 void setParent(EntityBase *parent) { m_parentEntity = parent; };
81 void setObserver(EntityObserver *obs) { m_observer = obs; };
82 EntityObserver *getObserver(
void) {
return m_observer; };
84 ClassFactoryHandler *getClassFactory(
void) {
return m_classFactory; };
86 EntityProperties &getProperties(
void) {
return m_properties; };
88 virtual EntityBase *getEntityFromName(
const std::string &n) {
if (m_name == n)
return this;
return nullptr; };
90 virtual bool considerForPropertyFilter(
void) {
return true; };
91 virtual bool considerChildrenForPropertyFilter(
void) {
return true; };
93 virtual void StoreToDataBase(
void);
94 virtual void StoreToDataBase(
ot::UID givenEntityVersion);
96 void setModified(
void);
97 void resetModified(
void) { m_isModified =
false; };
98 bool getModified(
void) {
return (m_isModified || m_properties.anyPropertyNeedsUpdate()); };
100 void restoreFromDataBase(EntityBase *parent, EntityObserver *obs, ModelState *ms, bsoncxx::document::view &doc_view, std::map<ot::UID, EntityBase *> &entityMap);
102 virtual void addVisualizationNodes(
void) {};
104 virtual std::string getClassName(
void) {
return "EntityBase"; };
106 virtual void addPrefetchingRequirementsForTopology(std::list<ot::UID> &prefetchIds);
108 enum entityType {TOPOLOGY, DATA};
109 virtual entityType getEntityType(
void) = 0;
111 void setOwningService(
const std::string &owner) { m_owningService = owner; };
112 const std::string &getOwningService(
void) {
return m_owningService; };
114 virtual void detachFromHierarchy(
void);
116 void setDeletable(
bool deletable) { m_isDeletable = deletable; };
117 const bool deletable()
const {
return m_isDeletable; }
120 virtual int getSchemaVersion(
void) {
return 1; };
121 virtual void AddStorageData(bsoncxx::builder::basic::document &storage) {};
122 virtual void readSpecificDataFromDataBase(bsoncxx::document::view &doc_view, std::map<ot::UID, EntityBase *> &entityMap);
125 EntityBase *readEntityFromEntityID(EntityBase *parent,
ot::UID entityID, std::map<ot::UID, EntityBase *> &entityMap);
126 EntityBase *readEntityFromEntityIDAndVersion(EntityBase *parent,
ot::UID entityID,
ot::UID version, std::map<ot::UID, EntityBase *> &entityMap, ClassFactoryHandler* factory =
nullptr);
128 void entityIsStored(
void);
134 ot::UID m_entityStorageVersion;
135 bool m_initiallyHidden;
138 bool m_selectChildren;
139 bool m_manageParentVisibility;
140 bool m_manageChildVisibility;
141 EntityProperties m_properties;
142 std::string m_owningService;
145 EntityBase* m_parentEntity;
146 EntityObserver* m_observer;
148 ModelState* m_modelState;
149 ClassFactoryHandler* m_classFactory;
Definition UniqueUIDGenerator.h:8
JSON document.
Definition JSON.h:276
__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