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
14#include "OTCore/JSON.h"
17
18#include "EntityProperties.h"
19
20#include "UniqueUIDGenerator.h"
21
22#include "EntityResult1DPlot.h"
23#include "EntityResult1DCurve.h"
24
25// C++ header
26#include <string>
27#include <list>
28#include <vector>
29
30class EntityBase;
31class EntityResult1D;
32class EntityPlot1D;
33class ClassFactoryHandler;
34class EntityResultText;
35class EntityGeometry;
36
37namespace ot {
38
39 class ApplicationBase;
40
41 namespace components {
42
44 public:
46 const std::string & _name,
47 const std::string & _type,
48 const std::string & _url,
49 serviceID_t _id,
50 ApplicationBase * _application
51 );
52 virtual ~ModelComponent();
53
54 UID createEntityUID(void);
55
56 // Convenience wrapper
57 EntityResult1DPlot * addResult1DPlotEntity(const std::string &name, const std::string &title, const std::list<std::pair<UID, std::string>> &curves);
58 EntityResult1DCurve * addResult1DCurveEntity(const std::string &name, const std::vector<double> &xdata,
59 const std::vector<double> &ydataRe, const std::vector<double> &ydataIm,
60 const std::string &xlabel, const std::string &xunit,
61 const std::string &ylabel, const std::string &yunit, int colorID, bool visible);
62 EntityResultText *addResultTextEntity(const std::string &name, const std::string &text);
63 void facetAndStoreGeometryEntity(EntityGeometry *entityGeom, bool forceVisible);
64
65 void importTableFile(const std::string &itemName);
66
67 bool sendMessage(bool _queue, JsonDocument& _doc, std::string& _response);
68
69 void clearNewEntityList(void);
70 void addNewTopologyEntity(UID entityID, UID entityVersion, bool forceVisible);
71 void addNewDataEntity(UID entityID, UID entityVersion, UID entityParentID);
72 void storeNewEntities(const std::string &description, bool askForBranchCreation = true, bool storeModel = true);
73
74 void loadMaterialInformation();
75 std::string getCurrentMaterialName(EntityPropertiesEntityList* material);
76
77 private:
78
79 ApplicationBase * m_application = nullptr;
80
81 virtual const std::string& getModelServiceURL() override;
82 virtual const std::string& getThisServiceURL() override;
83
84 ModelComponent() = delete;
85 ModelComponent(const ModelComponent &) = delete;
86 ModelComponent & operator = (const ModelComponent &) = delete;
87
88 DataStorageAPI::UniqueUIDGenerator *uniqueUIDGenerator;
89 DataStorageAPI::UniqueUIDGenerator* getUniqueUIDGenerator(void);
90
91 std::list<UID> topologyEntityIDList;
92 std::list<UID> topologyEntityVersionList;
93 std::list<bool> topologyEntityForceVisible;
94 std::list<UID> dataEntityIDList;
95 std::list<UID> dataEntityVersionList;
96 std::list<UID> dataEntityParentList;
97
98 std::map<ot::UID, std::string> materialIDToNameMap;
99 std::map<std::string, ot::UID> materialNameToIDMap;
100 };
101 } // namespace components
102} // 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
Definition ModelServiceAPI.h:12
General service information. The ServiceBase class is used to store the general service information.
Definition ServiceBase.h:23
Definition ModelComponent.h:43
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