OpenTwin 0.1
OpenTwin
 
Loading...
Searching...
No Matches
ViewerAPI.h
Go to the documentation of this file.
1#pragma once
2
3#include "Geometry.h"
4#include "OldTreeIcon.h"
5
6#include "OTCore/Color.h"
7#include "OTCore/CoreTypes.h"
13#include "OTGui/TableRange.h"
14#include "ViewChangedStates.h"
15
16#include <list>
17#include <vector>
18#include <string>
19
20#include <qcolor.h>
21
22class Model;
23class QPen;
24namespace ot { class Property; }
25namespace ot { class WidgetView; }
26
27namespace ViewerAPI
28{
29 class __declspec(dllexport) Notifier
30 {
31 public:
32 Notifier() {};
33 virtual ~Notifier() {};
34
35 virtual void createTree(void) {};
36 virtual void clearTree(void) {};
37 virtual ot::UID addTreeItem(const std::string &treePath, bool editable, bool selectChildren) { return 0; };
38 virtual void removeTreeItems(std::list<ot::UID> treeItemIDList) {};
39 virtual void selectTreeItem(ot::UID treeItemID) {};
40 virtual void selectSingleTreeItem(ot::UID treeItemID) {};
41 virtual void expandSingleTreeItem(ot::UID treeItemID) {};
42 virtual bool isTreeItemExpanded(ot::UID treeItemID) { return false; };
43 virtual void toggleTreeItemSelection(ot::UID treeItemID, bool considerChilds) {};
44 virtual void clearTreeSelection(void) {};
45 virtual void setTreeItemIcon(ot::UID treeItemID, int iconSize, const std::string &iconName) {};
46 virtual void setTreeItemText(ot::UID treeItemID, const std::string &text) {};
47 virtual void refreshSelection(void) {};
48 virtual void addKeyShortcut(const std::string &keySequence) {};
49 virtual void fillPropertyGrid(const ot::PropertyGridCfg& _configuration) {};
50 virtual void setDoublePropertyValue(const std::string& _groupName, const std::string& _itemName, double value) {};
51 virtual double getDoublePropertyValue(const std::string& _groupName, const std::string& _itemName) { return 0.0; };
52 virtual void lockSelectionAndModification(bool flag) {};
53 virtual void removeViewer(ot::UID viewerID) {};
54
55 virtual void closeView(const std::string& _entityName, ot::WidgetViewBase::ViewType _viewType) {};
56
57 virtual unsigned long long addMenuPage(const std::string &pageName) { return 0; };
58 virtual unsigned long long addMenuGroup(unsigned long long menuPageID, const std::string &groupName) { return 0; };
59 virtual unsigned long long addMenuPushButton(unsigned long long menuGroupID, const std::string &buttonName, const std::string &iconName) { return 0; };
60 virtual unsigned long long addMenuPushButton(unsigned long long menuGroupID, const std::string &buttonName, const std::string &iconName, const std::string &keySequence) { return 0; };
61
62 virtual void removeUIElements(std::list<unsigned long long> &itemIDList) {};
63 virtual void removeGraphicsElements(ot::UID _modelID) {};
64
65 virtual void displayText(const std::string &text) { };
66
67 virtual void setCurrentVisualizationTabFromEntityName(const std::string& _entityName, ot::WidgetViewBase::ViewType _viewType) {};
68 virtual void setCurrentVisualizationTabFromTitle(const std::string& _tabTitle) {};
69 virtual std::string getCurrentVisualizationTabTitle(void) { return ""; };
70
71 virtual void enableDisableControls(const ot::UIDList& _enabledControls, const ot::UIDList& _disabledControls) {};
72
73 virtual void entitiesSelected(ot::serviceID_t replyTo, const std::string &selectionAction, const std::string &selectionInfo, std::list<std::string> &optionNames, std::list<std::string> &optionValues) {};
74
75 virtual void fatalError(const std::string &message) {};
76
77 virtual void rubberbandFinished(ot::serviceID_t creatorId, const std::string &note, const std::string &pointJson, const std::vector<double> &transform) {}
78
79 virtual void updateSettings(const ot::PropertyGridCfg& _config) {};
80
81 virtual void loadSettings(ot::PropertyGridCfg& _config) {};
82
83 virtual void saveSettings(const ot::PropertyGridCfg& _config) {};
84
85 virtual void updateVTKEntity(unsigned long long modelEntityID) {};
86
87 virtual void messageModelService(const std::string& _message) {};
88 };
89
90 __declspec(dllexport) void registerNotifier(Notifier *notifier);
91
92 __declspec(dllexport) ot::UID createModel(void);
93 __declspec(dllexport) void activateModel(ot::UID osgModelID);
94 __declspec(dllexport) void deactivateCurrentlyActiveModel(void);
95 __declspec(dllexport) void deleteModel(ot::UID osgModelID);
96
97 __declspec(dllexport) ot::UID getActiveDataModel(void);
98 __declspec(dllexport) ot::UID getActiveViewerModel(void);
99
100 __declspec(dllexport) ot::UID createViewer(ot::UID osgModelID, double scaleWidth, double scaleHeight, int backgroundR, int backgroundG, int backgroundB, int overlayTextR, int overlayTextG, int overlayTextB);
101 __declspec(dllexport) ot::WidgetView* getViewerWidget(ot::UID viewer);
102
103 __declspec(dllexport) void resetAllViews1D(ot::UID osgModelID);
104 __declspec(dllexport) void resetAllViews3D(ot::UID osgModelID);
105 __declspec(dllexport) void refreshAllViews(ot::UID osgModelID);
106 __declspec(dllexport) void clearSelection(ot::UID osgModelID);
107 __declspec(dllexport) void refreshSelection(ot::UID osgModelID);
108 __declspec(dllexport) void selectObject(ot::UID osgModelID, ot::UID entityID);
109
110 __declspec(dllexport) void setTreeStateRecording(ot::UID osgModelID, bool flag);
111
112 __declspec(dllexport) void setSelectedTreeItems(const std::list<ot::UID>& _selectedTreeItems, std::list<unsigned long long>& _selectedModelItems, std::list<unsigned long long>& _selectedVisibleModelItems, bool _selectionFromTree);
113 __declspec(dllexport) void executeAction(unsigned long long buttonID);
114
115 __declspec(dllexport) void setHoverTreeItem(ot::UID hoverItemID);
116
117 __declspec(dllexport) void addNodeFromFacetData(ot::UID osgModelID, const std::string &treeName, double surfaceColorRGB[3], double edgeColorRGB[3], unsigned long long modelEntityID, const OldTreeIcon &treeIcons, bool backFaceCulling,
118 double offsetFactor, bool isEditable, std::vector<Geometry::Node> &nodes, std::list<Geometry::Triangle> &triangles, std::list<Geometry::Edge> &edges, std::map<ot::UID, std::string>& faceNameMap, std::string &errors,
119 bool selectChildren, bool manageParentVisibility, bool manageChildVisibility, bool showWhenSelected);
120 __declspec(dllexport) void addNodeFromFacetDataBase(ot::UID osgModelID, const std::string &treeName, double surfaceColorRGB[3], double edgeColorRGB[3], const std::string &materialType, const std::string &textureType, bool reflective, unsigned long long modelEntityID, const OldTreeIcon &treeIcons, bool backFaceCulling,
121 double offsetFactor, bool isHidden, bool isEditable, const std::string &projectName, unsigned long long entityID, unsigned long long entityVersion,
122 bool selectChildren, bool manageParentVisibility, bool manageChildVisibility, bool showWhenSelected, std::vector<double> &transformation);
123 __declspec(dllexport) void addMeshNodeFromDataBase(ot::UID osgModelID, const std::string &treeName, double surfaceColorRGB[3], double edgeColorRGB[3], unsigned long long modelEntityID, const OldTreeIcon &treeIcons,
124 bool isHidden, const std::string &projectName, unsigned long long entityID, unsigned long long entityVersion);
125 __declspec(dllexport) void addMeshItemNodeFromDataBase(ot::UID osgModelID, const std::string &treeName, double surfaceColorRGB[3], double edgeColorRGB[3], unsigned long long modelEntityID, const OldTreeIcon &treeIcons,
126 bool isHidden, const std::string &projectName, unsigned long long entityID, unsigned long long entityVersion);
127
128 __declspec(dllexport) void addVisualizationContainerNode(ot::UID osgModelID, const std::string &treeName, unsigned long long modelEntityID, const OldTreeIcon &treeIcons, bool editable);
129
130 __declspec(dllexport) void addVisualizationNode(ot::UID osgModelID, const std::string &treeName, unsigned long long modelEntityID, const OldTreeIcon &treeIcons, bool editable, ot::VisualisationTypes _visualisationTypes);
131 __declspec(dllexport) void addVTKNode(ot::UID osgModelID, const std::string &treeName, unsigned long long modelEntityID, const OldTreeIcon &treeIcons, bool isHidden, bool editable, const std::string &projectName, unsigned long long visualizationDataID, unsigned long long visualizationDataVersion);
132 __declspec(dllexport) void updateVTKNode(ot::UID osgModelID, unsigned long long modelEntityID, const std::string &projectName, unsigned long long visualizationDataID, unsigned long long visualizationDataVersion);
133
134 __declspec(dllexport) void addVisualizationAnnotationNode(ot::UID osgModelID, const std::string &name, unsigned long long modelEntityID,
135 const OldTreeIcon &treeIcons, bool isHidden,
136 const double edgeColorRGB[3],
137 const std::vector<std::array<double, 3>> &points,
138 const std::vector<std::array<double, 3>> &points_rgb,
139 const std::vector<std::array<double, 3>> &triangle_p1,
140 const std::vector<std::array<double, 3>> &triangle_p2,
141 const std::vector<std::array<double, 3>> &triangle_p3,
142 const std::vector<std::array<double, 3>> &triangle_rgb);
143 __declspec(dllexport) void addVisualizationAnnotationNodeDataBase(ot::UID osgModelID, const std::string &name, unsigned long long modelEntityID, const OldTreeIcon &treeIcons, bool isHidden, const std::string &projectName, unsigned long long entityID, unsigned long long entityVersion);
144 __declspec(dllexport) void addVisualizationMeshNodeFromFacetDataBase(ot::UID osgModelID, const std::string &name, unsigned long long modelEntityID, const OldTreeIcon &treeIcons, double edgeColorRGB[3], bool displayTetEdges, const std::string &projectName, unsigned long long entityID, unsigned long long entityVersion);
145 __declspec(dllexport) void addVisualizationMeshItemNodeFromFacetDataBase(ot::UID osgModelID, const std::string &name, unsigned long long modelEntityID, const OldTreeIcon &treeIcons, bool isHidden, const std::string &projectName, unsigned long long entityID, unsigned long long entityVersion, long long tetEdgesID, long long tetEdgesVersion);
146 __declspec(dllexport) void addVisualizationCartesianMeshNode(ot::UID osgModelID, const std::string &name, unsigned long long modelEntityID, const OldTreeIcon &treeIcons, bool isHidden, double edgeColorRGB[3], double meshLineColorRGB[3], bool showMeshLines, const std::vector<double> &meshCoordsX, const std::vector<double> &meshCoordsY, const std::vector<double> &meshCoordsZ,
147 const std::string &projectName, unsigned long long faceListEntityID, unsigned long long faceListEntityVersion, unsigned long long nodeListEntityID, unsigned long long nodeListEntityVersion);
148 __declspec(dllexport) void visualizationCartesianMeshNodeShowLines(ot::UID osgModelID, unsigned long long modelEntityID, bool showMeshLines);
149 __declspec(dllexport) void addVisualizationCartesianMeshItemNode(ot::UID osgModelID, const std::string &name, unsigned long long modelEntityID, const OldTreeIcon &treeIcons, bool isHidden, std::vector<int> &facesList, double color[3]);
150 __declspec(dllexport) void visualizationTetMeshNodeTetEdges(ot::UID osgModelID, unsigned long long modelEntityID, bool displayTetEdges);
151
152 __declspec(dllexport) void notifySceneNodeAboutViewChange(ot::UID osgModelID, const std::string& _sceneNodeName, const ot::ViewChangedStates& _state, const ot::WidgetViewBase::ViewType& _viewType);
153
154 __declspec(dllexport) std::list<std::string> getSelectedCurves(ot::UID osgModelID);
155 __declspec(dllexport) void removeSelectedCurveNodes(ot::UID osgModelID);
156
157 __declspec(dllexport) void addVisualizationPlot1DNode(ot::UID _osgModelID, const ot::Plot1DDataBaseCfg& _config);
158
159 __declspec(dllexport) void visualizationResult1DPropertiesChanged(ot::UID _osgModelID, ot::UID _entityID, ot::UID _version);
160 __declspec(dllexport) void visualizationPlot1DPropertiesChanged(ot::UID osgModelID, const ot::Plot1DCfg& _config);
161
162 __declspec(dllexport) void setEntityName(ot::UID modelEntityID, const std::string &newName);
163 __declspec(dllexport) void renameEntityPath(const std::string &oldPath, const std::string &newPath);
164
165 __declspec(dllexport) void updateObjectColor(ot::UID osgModelID, unsigned long long modelEntityID, double surfaceColorRGB[3], double edgeColorRGB[3], const std::string& materialType, const std::string& textureType, bool reflective);
166 __declspec(dllexport) void updateMeshColor(ot::UID osgModelID, unsigned long long modelEntityID, double colorRGB[3]);
167 __declspec(dllexport) void updateObjectFacetsFromDataBase(ot::UID osgModelID, unsigned long long modelEntityID, unsigned long long entityID, unsigned long long entityVersion);
168
169 __declspec(dllexport) void setClearColor(ot::UID viewrID, int backgroundR, int backgroundG, int backgroundB, int overlayTextR, int overlayTextG, int overlayTextB);
170
171 __declspec(dllexport) void setDataModel(ot::UID osgModelID, ot::UID dataModelID);
172
173 __declspec(dllexport) void getSelectedModelEntityIDs(std::list<unsigned long long> &selected);
174 __declspec(dllexport) void getSelectedVisibleModelEntityIDs(std::list<unsigned long long> &selected);
175 __declspec(dllexport) ot::UID getModelEntityIDFromTreeID(ot::UID treeID);
176 __declspec(dllexport) ot::UID getTreeIDFromModelEntityID(ot::UID treeID);
177
178 __declspec(dllexport) void removeShapes(ot::UID osgModelID, std::list<unsigned long long> modelEntityID);
179 __declspec(dllexport) void setShapeVisibility(ot::UID osgModelID, std::list<unsigned long long> visibleID, std::list<unsigned long long> hiddenID);
180 __declspec(dllexport) void hideEntities(ot::UID osgModelID, std::list<unsigned long long> hiddenID);
181
182 __declspec(dllexport) void showBranch(ot::UID osgModelID, const std::string &branchName);
183 __declspec(dllexport) void hideBranch(ot::UID osgModelID, const std::string &branchName);
184
185 __declspec(dllexport) void enterEntitySelectionMode(ot::UID osgModelID, ot::serviceID_t replyTo, const std::string &selectionType, bool allowMultipleSelection, const std::string &selectionFilter, const std::string &selectionAction, const std::string &selectionMessage, std::list<std::string> &optionNames, std::list<std::string> &optionValues);
186
187 __declspec(dllexport) void setFontPath(const std::string &fontPath);
188
189 __declspec(dllexport) void setDataBaseConnection(const std::string &databaseURL, const std::string &userName, const std::string &password);
190
191 __declspec(dllexport) void prefetchDocumentsFromStorage(const std::string &projectName, std::list<std::pair<unsigned long long, unsigned long long>> &prefetchIDs);
192
193 __declspec(dllexport) void setTabNames(ot::UID _viewerID, const std::string & _osgViewTabName, const std::string & _plotTabName, const std::string & _versionGraphTabName);
194
195 __declspec(dllexport) ot::WidgetView* getPlotWidget(ot::UID _viewerID);
196
197 /********************************************************************************************/
198
199 __declspec(dllexport) void viewerTabChanged(const std::string& _tabTitle, ot::WidgetViewBase::ViewType _type);
200
201 __declspec(dllexport) void shortcutActivated(const std::string & _keySequence);
202
203 __declspec(dllexport) void createRubberband(ot::UID _viewerID, ot::serviceID_t _senderId, std::string & _note, const std::string & _configurationJson);
204
205 __declspec(dllexport) void settingsItemChanged(ot::UID _viewerID, const ot::Property* _property);
206
207 __declspec(dllexport) bool propertyGridValueChanged(ot::UID _viewerID, const ot::Property* _property);
208
209 __declspec(dllexport) void freeze3DView(unsigned long long osgModelID, bool flag);
210
211 Model *getModelFromID(ot::UID osgModelID);
212}
bsoncxx::types::value value
Definition DocumentManager.h:16
@ nodes
Definition MonitorSettings.h:17
@ edges
Definition MonitorSettings.h:17
The Model class is the main interface to the model. There may be multiple instances of this class....
Definition Model.h:131
Definition Plot1DCfg.h:19
Definition Plot1DDataBaseCfg.h:14
Definition PropertyGridCfg.h:21
The Property class is used as a base class for all Properties that can be displayed and modified in t...
Definition Property.h:21
Definition VisualisationTypes.h:13
ViewType
Definition WidgetViewBase.h:49
The WidgetView class is used to integrate the Qt-ADS functionallity into open twin.
Definition WidgetView.h:32
Definition ViewerAPI.h:28
class __declspec(dllexport) Notifier
Definition ViewerAPI.h:29
Model * getModelFromID(ot::UID osgModelID)
Definition ViewerAPI.cpp:526
__declspec(dllexport) void setHoverTreeItem(ot __declspec(dllexport) void addNodeFromFacetData(ot __declspec(dllexport) void addNodeFromFacetDataBase(ot __declspec(dllexport) void addMeshNodeFromDataBase(ot __declspec(dllexport) void addMeshItemNodeFromDataBase(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 shortcutActivated(const std __declspec(dllexport) void createRubberband(ot __declspec(dllexport) void settingsItemChanged(ot __declspec(dllexport) bool propertyGridValueChanged(ot bool flag
Definition ViewerAPI.h:209
Definition Connector.h:8
unsigned long UID
Unique identifier (32 bit unsigned integer)
Definition CoreTypes.h:27
std::list< UID > UIDList
Unique identifier list.
Definition CoreTypes.h:31
unsigned short serviceID_t
ID type used to identify a service (16 bit unsigned integer).
Definition CoreTypes.h:14
ViewChangedStates
Definition ViewChangedStates.h:6