GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 100.0% 0 / 1 / 1
Functions: -% 0 / 1 / 1
Branches: -% 0 / 1 / 1

src/gltf/GltfUserData.hpp
Line Branch Exec Source
1 /***********************************************************************************************************************
2 * OpenStudio(R), Copyright (c) Alliance for Energy Innovation, LLC.
3 * See also https://openstudio.net/license
4 ***********************************************************************************************************************/
5
6 #ifndef GLTF_GLTFUSERDATA_HPP
7 #define GLTF_GLTFUSERDATA_HPP
8
9 #include "GltfAPI.hpp"
10
11 #include "../utilities/core/Logger.hpp"
12
13 #include <map>
14 #include <string>
15 #include <vector>
16
17 namespace tinygltf {
18 class Value;
19 }
20
21 namespace openstudio {
22 namespace model {
23
24 class PlanarSurface;
25 }
26
27 namespace gltf {
28 class GltfForwardTranslator;
29
30 // TODO: rename to GltfPlanarSurfaceData!
31 /** GltfUserData is an Interface class between a PlanarSurface and an glTF Node's `extras`.
32 *
33 * It stores attributes such as surfaceType, its construction, the Space and SpaceType and ThermalZone it belongs to, etc.
34 **/
35 class GLTF_API GltfUserData
36 {
37 public:
38 GltfUserData(); // Default constructor (TODO: remove?)
39
40 /** @name Interface with Model and ModelObjects */
41 //@{
42 GltfUserData(const model::PlanarSurface& planarSurface);
43 //@}
44
45 /** @name Getters & Setters */
46 //@{
47
48 std::string handle() const;
49 void setHandle(const std::string& handle);
50
51 std::string name() const;
52 void setName(const std::string& name);
53
54 std::string surfaceType() const;
55 void setSurfaceType(const std::string& surfaceType);
56
57 std::string constructionName() const;
58 void setConstructionName(const std::string& constructionName);
59
60 std::string constructionHandle() const;
61 void setConstructionHandle(const std::string& constructionHandle);
62
63 std::string constructionMaterialName() const;
64 void setConstructionMaterialName(const std::string& constructionMaterialName);
65
66 std::string surfaceName() const;
67 void setSurfaceName(const std::string& surfaceName);
68
69 std::string surfaceHandle() const;
70 void setSurfaceHandle(const std::string& surfaceHandle);
71
72 std::string subSurfaceName() const;
73 void setSubSurfaceName(const std::string& subSurfaceName);
74
75 std::string subSurfaceHandle() const;
76 void setSubSurfaceHandle(const std::string& subSurfaceHandle);
77
78 std::string spaceName() const;
79 void setSpaceName(const std::string& spaceName);
80
81 std::string spaceHandle() const;
82 void setSpaceHandle(const std::string& spaceHandle);
83
84 std::string shadingName() const;
85 void setShadingName(const std::string& shadingName);
86
87 std::string shadingHandle() const;
88 void setShadingHandle(const std::string& shadingHandle);
89
90 std::string thermalZoneName() const;
91 void setThermalZoneName(const std::string& thermalZoneName);
92
93 std::string thermalZoneHandle() const;
94 void setThermalZoneHandle(const std::string& thermalZoneHandle);
95
96 std::string thermalZoneMaterialName() const;
97 void setThermalZoneMaterialName(const std::string& thermalZoneMaterialName);
98
99 std::string spaceTypeName() const;
100 void setSpaceTypeName(const std::string& spaceTypeName);
101
102 std::string spaceTypeHandle() const;
103 void setSpaceTypeHandle(const std::string& spaceTypeHandle);
104
105 std::string spaceTypeMaterialName() const;
106 void setSpaceTypeMaterialName(const std::string& spaceTypeMaterialName);
107
108 std::string buildingStoryName() const;
109 void setBuildingStoryName(const std::string& buildingStoryName);
110
111 std::string buildingStoryHandle() const;
112 void setBuildingStoryHandle(const std::string& buildingStoryHandle);
113
114 std::string buildingStoryMaterialName() const;
115 void setBuildingStoryMaterialName(const std::string& buildingStoryMaterialName);
116
117 std::string buildingUnitName() const;
118 void setBuildingUnitName(const std::string& buildingUnitName);
119
120 std::string buildingUnitHandle() const;
121 void setBuildingUnitHandle(const std::string& buildingUnitHandle);
122
123 std::string buildingUnitMaterialName() const;
124 void setBuildingUnitMaterialName(const std::string& buildingUnitMaterialName);
125
126 std::string constructionSetName() const;
127 void setConstructionSetName(const std::string& constructionSetName);
128
129 std::string constructionSetHandle() const;
130 void setConstructionSetHandle(const std::string& constructionSetHandle);
131
132 std::string constructionSetMaterialName() const;
133 void setConstructionSetMaterialName(const std::string& constructionSetMaterialName);
134
135 std::string outsideBoundaryCondition() const;
136 void setOutsideBoundaryCondition(const std::string& outsideBoundaryCondition);
137
138 std::string outsideBoundaryConditionObjectName() const;
139 void setOutsideBoundaryConditionObjectName(const std::string& outsideBoundaryConditionObjectName);
140
141 std::string outsideBoundaryConditionObjectHandle() const;
142 void setOutsideBoundaryConditionObjectHandle(const std::string& outsideBoundaryConditionObjectHandle);
143
144 bool coincidentWithOutsideObject() const;
145 void setCoincidentWithOutsideObject(bool coincidentWithOutsideObject);
146
147 std::string sunExposure() const;
148 void setSunExposure(const std::string& sunExposure);
149
150 std::string windExposure() const;
151 void setWindExposure(const std::string& windExposure);
152
153 double illuminanceSetpoint() const;
154 void setIlluminanceSetpoint(double illuminanceSetpoint);
155
156 bool airWall() const;
157 void setAirWall(bool airWall);
158
159 std::vector<std::string> airLoopHVACNames() const;
160 void setAirLoopHVACNames(const std::vector<std::string>& airLoopHVACNames);
161 void addAirLoopHVACName(std::string airLoopHVACName);
162
163 std::vector<std::string> airLoopHVACHandles() const;
164 void setAirLoopHVACHandles(const std::vector<std::string>& airLoopHVACHandles);
165 void addAirLoopHVACHandle(std::string airLoopHVACHandle);
166
167 std::vector<std::string> airLoopHVACMaterialNames() const;
168 void setAirLoopHVACMaterialNames(const std::vector<std::string>& airLoopHVACMaterialNames);
169 void addAirLoopHVACMaterialName(std::string airLoopHVACMaterialName);
170
171 //@}
172 /** @name Other */
173 //@{
174
175 // // Gets GLTF Material name on the basis of Surface Type
176 std::string surfaceTypeMaterialName() const;
177 // Gets GLTF Material name on the basis of Surface Outside Boundary Condition, Wind Exposure, Sun Exposure
178 std::string boundaryMaterialName() const;
179
180 //@}
181
182 protected:
183 /** @name Protected */
184 //@{
185 /** Interface with an existing GLTF file */
186 GltfUserData(const tinygltf::Value& userDataObj);
187
188 // TODO: change to return a tinygltf::Node instead
189 std::map<std::string, tinygltf::Value> toExtras() const;
190 //@}
191 friend class GltfForwardTranslator;
192
193 private:
194 − REGISTER_LOGGER("openstudio.gltf.GltfUserData");
195
196 std::string m_handle;
197 std::string m_name;
198 std::string m_surfaceType;
199 std::string m_constructionName;
200 std::string m_constructionHandle;
201 std::string m_constructionMaterialName;
202 std::string m_surfaceName;
203 std::string m_surfaceHandle;
204 std::string m_subSurfaceName;
205 std::string m_subSurfaceHandle;
206 std::string m_spaceName;
207 std::string m_spaceHandle;
208 std::string m_shadingName;
209 std::string m_shadingHandle;
210 std::string m_thermalZoneName;
211 std::string m_thermalZoneHandle;
212 std::string m_thermalZoneMaterialName;
213 std::string m_spaceTypeName;
214 std::string m_spaceTypeHandle;
215 std::string m_spaceTypeMaterialName;
216 std::string m_buildingStoryName;
217 std::string m_buildingStoryHandle;
218 std::string m_buildingStoryMaterialName;
219 std::string m_buildingUnitName;
220 std::string m_buildingUnitHandle;
221 std::string m_buildingUnitMaterialName;
222 std::string m_constructionSetName;
223 std::string m_constructionSetHandle;
224 std::string m_constructionSetMaterialName;
225 std::string m_outsideBoundaryCondition;
226 std::string m_outsideBoundaryConditionObjectName;
227 std::string m_outsideBoundaryConditionObjectHandle;
228 bool m_coincidentWithOutsideObject = false;
229 std::string m_sunExposure;
230 std::string m_windExposure;
231 double m_illuminanceSetpoint = 0.0;
232 bool m_airWall = false;
233
234 // TODO: replace with a struct to avoid having to keep indices in line?
235 std::vector<std::string> m_airLoopHVACNames;
236 std::vector<std::string> m_airLoopHVACHandles;
237 std::vector<std::string> m_airLoopHVACMaterialNames;
238 };
239
240 using GltfUserDataVector = std::vector<GltfUserData>;
241
242 } // namespace gltf
243 } // namespace openstudio
244
245 #endif // GLTF_GLTFUSERDATA_HPP
246