OpenTwin 0.1
OpenTwin
 
Loading...
Searching...
No Matches
ModelComponent.h
Go to the documentation of this file.
1/*
2 * modelComponent.h
3 *
4 * Created on: 08/02/2021
5 * Author: Alexander Kuester, Peter Thoma
6 * Copyright (c) 2021, OpenTwin
7 */
8
9#pragma once
10
11 // OpenTwin header
12#include "OTCore/ServiceBase.h" // Base class
13#include "OTCore/JSON.h"
15
16#include "EntityInformation.h"
17#include "EntityProperties.h"
18
19#include "UniqueUIDGenerator.h"
20
21#include "EntityResult1DPlot.h"
22#include "EntityResult1DCurve.h"
23
24// C++ header
25#include <string>
26#include <list>
27#include <vector>
28
29class EntityBase;
30class EntityResult1D;
31class EntityPlot1D;
32class ClassFactoryHandler;
33class EntityResultText;
34class EntityGeometry;
35
36namespace ot {
37
38 class ApplicationBase;
39
40 namespace components {
41
43 public:
45 const std::string & _name,
46 const std::string & _type,
47 const std::string & _url,
48 serviceID_t _id,
49 ApplicationBase * _application
50 );
51 virtual ~ModelComponent();
52
53 UID createEntityUID(void);
54
55 // Convenience wrapper
56 EntityResult1DPlot * addResult1DPlotEntity(const std::string &name, const std::string &title, const std::list<std::pair<UID, std::string>> &curves);
57 EntityResult1DCurve * addResult1DCurveEntity(const std::string &name, const std::vector<double> &xdata,
58 const std::vector<double> &ydataRe, const std::vector<double> &ydataIm,
59 const std::string &xlabel, const std::string &xunit,
60 const std::string &ylabel, const std::string &yunit, int colorID, bool visible);
61 EntityResultText *addResultTextEntity(const std::string &name, const std::string &text);
62 void facetAndStoreGeometryEntity(EntityGeometry *entityGeom, bool forceVisible);
63
64 void importTableFile(const std::string &itemName);
65
66 bool sendMessage(bool _queue, JsonDocument& _doc, std::string& _response);
67
68 void clearNewEntityList(void);
69 void addNewTopologyEntity(UID entityID, UID entityVersion, bool forceVisible);
70 void addNewDataEntity(UID entityID, UID entityVersion, UID entityParentID);
71 void storeNewEntities(const std::string &description, bool askForBranchCreation = true, bool storeModel = true);
72
73 void loadMaterialInformation();
74 std::string getCurrentMaterialName(EntityPropertiesEntityList* material);
75
76 private:
77
78 ApplicationBase * m_application = nullptr;
79
80 ModelComponent() = delete;
81 ModelComponent(const ModelComponent &) = delete;
82 ModelComponent & operator = (const ModelComponent &) = delete;
83
84 DataStorageAPI::UniqueUIDGenerator *uniqueUIDGenerator;
85 DataStorageAPI::UniqueUIDGenerator* getUniqueUIDGenerator(void);
86
87 std::list<UID> topologyEntityIDList;
88 std::list<UID> topologyEntityVersionList;
89 std::list<bool> topologyEntityForceVisible;
90 std::list<UID> dataEntityIDList;
91 std::list<UID> dataEntityVersionList;
92 std::list<UID> dataEntityParentList;
93
94 std::map<ot::UID, std::string> materialIDToNameMap;
95 std::map<std::string, ot::UID> materialNameToIDMap;
96 };
97 } // namespace components
98} // namespace ot
#define OT_SERVICEFOUNDATION_API_EXPORT
Definition FoundationAPIExport.h:7
Definition UniqueUIDGenerator.h:8
Definition ApplicationBase.h:45
JSON document.
Definition JSON.h:276
General service information. The ServiceBase class is used to store the general service information.
Definition ServiceBase.h:24
Definition ModelComponent.h:42
Definition Connector.h:8
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
Definition PHREECMeshExport.h:35