GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 76.1% 220 / 0 / 289
Functions: 78.9% 45 / 0 / 57
Branches: 61.7% 201 / 0 / 326

src/model/ShadingSurfaceGroup.cpp
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 #include "ShadingSurfaceGroup.hpp"
7 #include "ShadingSurfaceGroup_Impl.hpp"
8
9 #include "Model.hpp"
10 #include "Model_Impl.hpp"
11 #include "ShadingSurface.hpp"
12 #include "ShadingSurface_Impl.hpp"
13 #include "Site.hpp"
14 #include "Site_Impl.hpp"
15 #include "Building.hpp"
16 #include "Building_Impl.hpp"
17 #include "Space.hpp"
18 #include "Space_Impl.hpp"
19 #include "Surface.hpp"
20 #include "Surface_Impl.hpp"
21 #include "SubSurface.hpp"
22 #include "SubSurface_Impl.hpp"
23
24 #include <utilities/idd/IddFactory.hxx>
25
26 #include <utilities/idd/OS_ShadingSurfaceGroup_FieldEnums.hxx>
27 #include <utilities/idd/IddEnums.hxx>
28
29 #include "../utilities/geometry/Transformation.hpp"
30 #include "../utilities/geometry/Vector3d.hpp"
31 #include "../utilities/geometry/Point3d.hpp"
32 #include "../utilities/geometry/EulerAngles.hpp"
33 #include "../utilities/geometry/Geometry.hpp"
34 #include "../utilities/geometry/BoundingBox.hpp"
35
36 #include "../utilities/core/Assert.hpp"
37
38 namespace openstudio {
39 namespace model {
40
41 namespace detail {
42
43 884 ShadingSurfaceGroup_Impl::ShadingSurfaceGroup_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle)
44 884 : PlanarSurfaceGroup_Impl(idfObject, model, keepHandle) {
45
4/6
✓ Branch 1 taken 884 times.
✓ Branch 4 taken 884 times.
✓ Branch 7 taken 884 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 884 times.
✗ Branch 13 not taken.
884 OS_ASSERT(idfObject.iddObject().type() == ShadingSurfaceGroup::iddObjectType());
46 884 }
47
48 118 ShadingSurfaceGroup_Impl::ShadingSurfaceGroup_Impl(const openstudio::detail::WorkspaceObject_Impl& other, Model_Impl* model, bool keepHandle)
49 118 : PlanarSurfaceGroup_Impl(other, model, keepHandle) {
50
4/6
✓ Branch 1 taken 118 times.
✓ Branch 4 taken 118 times.
✓ Branch 7 taken 118 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 118 times.
✗ Branch 13 not taken.
118 OS_ASSERT(other.iddObject().type() == ShadingSurfaceGroup::iddObjectType());
51 118 }
52
53 388 ShadingSurfaceGroup_Impl::ShadingSurfaceGroup_Impl(const ShadingSurfaceGroup_Impl& other, Model_Impl* model, bool keepHandle)
54 388 : PlanarSurfaceGroup_Impl(other, model, keepHandle) {}
55
56 17 boost::optional<ParentObject> ShadingSurfaceGroup_Impl::parent() const {
57 17 boost::optional<ParentObject> result;
58
59
1/1
✓ Branch 1 taken 17 times.
17 std::string shadingSurfaceType = this->shadingSurfaceType();
60
4/4
✓ Branch 1 taken 17 times.
✓ Branch 4 taken 17 times.
✓ Branch 7 taken 4 times.
✓ Branch 8 taken 13 times.
34 if (istringEqual("Site", shadingSurfaceType)) {
61
3/3
✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 4 times.
4 result = this->model().getOptionalUniqueModelObject<Site>();
62
4/4
✓ Branch 1 taken 13 times.
✓ Branch 4 taken 13 times.
✓ Branch 7 taken 7 times.
✓ Branch 8 taken 6 times.
26 } else if (istringEqual("Building", shadingSurfaceType)) {
63
3/3
✓ Branch 1 taken 7 times.
✓ Branch 4 taken 7 times.
✓ Branch 7 taken 7 times.
7 result = this->model().building();
64
3/4
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
✗ Branch 8 not taken.
12 } else if (istringEqual("Space", shadingSurfaceType)) {
65
2/2
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
6 result = this->space();
66 }
67 34 return result;
68 17 }
69
70 8 bool ShadingSurfaceGroup_Impl::setParent(ParentObject& newParent) {
71 8 bool result = false;
72
3/3
✓ Branch 1 taken 8 times.
✓ Branch 4 taken 1 time.
✓ Branch 5 taken 7 times.
16 if (newParent.optionalCast<Site>()) {
73
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
2 result = this->setShadingSurfaceType("Site");
74
3/3
✓ Branch 1 taken 7 times.
✓ Branch 4 taken 1 time.
✓ Branch 5 taken 6 times.
14 } else if (newParent.optionalCast<Building>()) {
75
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
2 result = this->setShadingSurfaceType("Building");
76
2/3
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✗ Branch 5 not taken.
12 } else if (newParent.optionalCast<Space>()) {
77
2/2
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
6 result = this->setSpace(newParent.cast<Space>());
78 }
79 8 return result;
80 }
81
82 483 std::vector<ModelObject> ShadingSurfaceGroup_Impl::children() const {
83 483 std::vector<ModelObject> result;
84
85
1/1
✓ Branch 1 taken 483 times.
483 std::vector<ShadingSurface> shadingSurfaces = this->shadingSurfaces();
86
1/1
✓ Branch 5 taken 483 times.
483 result.insert(result.end(), shadingSurfaces.begin(), shadingSurfaces.end());
87
88 966 return result;
89 483 }
90
91 ✗ std::vector<IddObjectType> ShadingSurfaceGroup_Impl::allowableChildTypes() const {
92 ✗ std::vector<IddObjectType> result;
93 ✗ result.push_back(IddObjectType::OS_ShadingSurface);
94 ✗ return result;
95 ✗ }
96
97 3 const std::vector<std::string>& ShadingSurfaceGroup_Impl::outputVariableNames() const {
98
3/4
✓ Branch 0 taken 1 time.
✓ Branch 1 taken 2 times.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
3 static const std::vector<std::string> result;
99 3 return result;
100 }
101
102 3 IddObjectType ShadingSurfaceGroup_Impl::iddObjectType() const {
103 3 return ShadingSurfaceGroup::iddObjectType();
104 }
105
106 397 openstudio::Transformation ShadingSurfaceGroup_Impl::buildingTransformation() const {
107
1/1
✓ Branch 1 taken 397 times.
397 Transformation transformation;
108
109
1/1
✓ Branch 1 taken 397 times.
397 auto shadingSurfaceType = this->shadingSurfaceType();
110
4/4
✓ Branch 1 taken 397 times.
✓ Branch 4 taken 397 times.
✓ Branch 7 taken 80 times.
✓ Branch 8 taken 317 times.
794 if (istringEqual("Space", shadingSurfaceType)) {
111
112
1/1
✓ Branch 1 taken 80 times.
80 boost::optional<Space> space = this->space();
113
1/2
✓ Branch 0 taken 80 times.
✗ Branch 1 not taken.
80 if (space) {
114
4/4
✓ Branch 1 taken 80 times.
✓ Branch 4 taken 80 times.
✓ Branch 7 taken 80 times.
✓ Branch 10 taken 80 times.
80 transformation = space->transformation() * this->transformation();
115 } else {
116 ✗ transformation = this->transformation();
117 }
118
119
4/4
✓ Branch 2 taken 317 times.
✓ Branch 5 taken 317 times.
✓ Branch 8 taken 293 times.
✓ Branch 9 taken 24 times.
714 } else if (istringEqual("Building", shadingSurfaceType)) {
120
121
1/1
✓ Branch 1 taken 293 times.
293 transformation = this->transformation();
122
123
3/4
✓ Branch 1 taken 24 times.
✓ Branch 4 taken 24 times.
✓ Branch 7 taken 24 times.
✗ Branch 8 not taken.
48 } else if (istringEqual("Site", shadingSurfaceType)) {
124
125
2/2
✓ Branch 1 taken 24 times.
✓ Branch 4 taken 24 times.
24 boost::optional<Building> building = this->model().building();
126
1/2
✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
24 if (building) {
127
5/5
✓ Branch 1 taken 24 times.
✓ Branch 4 taken 24 times.
✓ Branch 7 taken 24 times.
✓ Branch 10 taken 24 times.
✓ Branch 13 taken 24 times.
24 transformation = building->transformation().inverse() * this->transformation();
128 } else {
129 ✗ transformation = this->transformation();
130 }
131 24 }
132
133 794 return transformation;
134 397 }
135
136 ✗ bool ShadingSurfaceGroup_Impl::changeTransformation(const openstudio::Transformation& transformation) {
137 ✗ Transformation oldTransformation = this->transformation();
138 ✗ if (!setTransformation(transformation)) {
139 ✗ return false;
140 }
141
142 // go through and update all child points and transformations so that:
143 // (Tnew^-1 * Told) * xold = childTransformation * xold = xnew
144
145 ✗ Transformation childTransformation = transformation.inverse() * oldTransformation;
146
147 ✗ for (ShadingSurface& shadingSurface : this->shadingSurfaces()) {
148 ✗ bool test = shadingSurface.setVertices(childTransformation * shadingSurface.vertices());
149 ✗ if (!test) {
150 ✗ LOG(Error, "Could not transform vertices for ShadingSurface '" << shadingSurface.name().get() << "'.");
151 }
152 ✗ }
153
154 ✗ return true;
155 ✗ }
156
157 916 openstudio::BoundingBox ShadingSurfaceGroup_Impl::boundingBox() const {
158 916 BoundingBox result;
159
3/3
✓ Branch 1 taken 916 times.
✓ Branch 7 taken 1248 times.
✓ Branch 8 taken 916 times.
2164 for (ShadingSurface& shadingSurface : this->shadingSurfaces()) {
160
2/2
✓ Branch 1 taken 1248 times.
✓ Branch 4 taken 1248 times.
1248 result.addPoints(shadingSurface.vertices());
161 916 }
162 916 return result;
163 }
164
165 3713 std::string ShadingSurfaceGroup_Impl::shadingSurfaceType() const {
166
1/1
✓ Branch 1 taken 3713 times.
3713 boost::optional<std::string> value = getString(OS_ShadingSurfaceGroupFields::ShadingSurfaceType, true);
167
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 3713 times.
✗ Branch 4 not taken.
3713 OS_ASSERT(value);
168
2/2
✓ Branch 1 taken 3713 times.
✓ Branch 4 taken 3713 times.
7426 return value.get();
169 3713 }
170
171 545 double ShadingSurfaceGroup_Impl::directionofRelativeNorth() const {
172
1/1
✓ Branch 1 taken 545 times.
545 boost::optional<double> value = getDouble(OS_ShadingSurfaceGroupFields::DirectionofRelativeNorth, true);
173
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 545 times.
✗ Branch 4 not taken.
545 OS_ASSERT(value);
174
1/1
✓ Branch 1 taken 545 times.
1090 return value.get();
175 }
176
177 2 bool ShadingSurfaceGroup_Impl::isDirectionofRelativeNorthDefaulted() const {
178 2 return isEmpty(OS_ShadingSurfaceGroupFields::DirectionofRelativeNorth);
179 }
180
181 545 double ShadingSurfaceGroup_Impl::xOrigin() const {
182
1/1
✓ Branch 1 taken 545 times.
545 boost::optional<double> value = getDouble(OS_ShadingSurfaceGroupFields::XOrigin, true);
183
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 545 times.
✗ Branch 4 not taken.
545 OS_ASSERT(value);
184
1/1
✓ Branch 1 taken 545 times.
1090 return value.get();
185 }
186
187 2 bool ShadingSurfaceGroup_Impl::isXOriginDefaulted() const {
188 2 return isEmpty(OS_ShadingSurfaceGroupFields::XOrigin);
189 }
190
191 545 double ShadingSurfaceGroup_Impl::yOrigin() const {
192
1/1
✓ Branch 1 taken 545 times.
545 boost::optional<double> value = getDouble(OS_ShadingSurfaceGroupFields::YOrigin, true);
193
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 545 times.
✗ Branch 4 not taken.
545 OS_ASSERT(value);
194
1/1
✓ Branch 1 taken 545 times.
1090 return value.get();
195 }
196
197 2 bool ShadingSurfaceGroup_Impl::isYOriginDefaulted() const {
198 2 return isEmpty(OS_ShadingSurfaceGroupFields::YOrigin);
199 }
200
201 545 double ShadingSurfaceGroup_Impl::zOrigin() const {
202
1/1
✓ Branch 1 taken 545 times.
545 boost::optional<double> value = getDouble(OS_ShadingSurfaceGroupFields::ZOrigin, true);
203
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 545 times.
✗ Branch 4 not taken.
545 OS_ASSERT(value);
204
1/1
✓ Branch 1 taken 545 times.
1090 return value.get();
205 }
206
207 2 bool ShadingSurfaceGroup_Impl::isZOriginDefaulted() const {
208 2 return isEmpty(OS_ShadingSurfaceGroupFields::ZOrigin);
209 }
210
211 1216 bool ShadingSurfaceGroup_Impl::setShadingSurfaceType(const std::string& shadingSurfaceType) {
212 1216 bool result = false;
213
214
4/4
✓ Branch 1 taken 1216 times.
✓ Branch 4 taken 1216 times.
✓ Branch 7 taken 181 times.
✓ Branch 8 taken 1035 times.
2432 if (istringEqual("Site", shadingSurfaceType)) {
215 181 resetSpace();
216 181 result = setString(OS_ShadingSurfaceGroupFields::ShadingSurfaceType, shadingSurfaceType);
217
4/4
✓ Branch 1 taken 1035 times.
✓ Branch 4 taken 1035 times.
✓ Branch 7 taken 997 times.
✓ Branch 8 taken 38 times.
2070 } else if (istringEqual("Building", shadingSurfaceType)) {
218 997 resetSpace();
219 997 result = setString(OS_ShadingSurfaceGroupFields::ShadingSurfaceType, shadingSurfaceType);
220
3/4
✓ Branch 1 taken 38 times.
✓ Branch 4 taken 38 times.
✓ Branch 7 taken 38 times.
✗ Branch 8 not taken.
76 } else if (istringEqual("Space", shadingSurfaceType)) {
221
1/1
✓ Branch 1 taken 38 times.
38 result = this->space().has_value();
222
2/2
✓ Branch 0 taken 37 times.
✓ Branch 1 taken 1 time.
38 if (result) {
223 37 bool test = setString(OS_ShadingSurfaceGroupFields::ShadingSurfaceType, shadingSurfaceType);
224
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 37 times.
37 OS_ASSERT(test);
225 }
226 }
227
228 1216 return result;
229 }
230
231 78 bool ShadingSurfaceGroup_Impl::setDirectionofRelativeNorth(double directionofRelativeNorth, bool driverMethod) {
232 78 bool result = setDouble(OS_ShadingSurfaceGroupFields::DirectionofRelativeNorth, directionofRelativeNorth, driverMethod);
233
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 78 times.
78 OS_ASSERT(result);
234 78 return result;
235 }
236
237 2 void ShadingSurfaceGroup_Impl::resetDirectionofRelativeNorth() {
238
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
4 bool result = setString(OS_ShadingSurfaceGroupFields::DirectionofRelativeNorth, "");
239
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
2 OS_ASSERT(result);
240 2 }
241
242 78 bool ShadingSurfaceGroup_Impl::setXOrigin(double xOrigin, bool driverMethod) {
243 78 bool result = setDouble(OS_ShadingSurfaceGroupFields::XOrigin, xOrigin, driverMethod);
244
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 78 times.
78 OS_ASSERT(result);
245 78 return result;
246 }
247
248 2 void ShadingSurfaceGroup_Impl::resetXOrigin() {
249
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
4 bool result = setString(OS_ShadingSurfaceGroupFields::XOrigin, "");
250
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
2 OS_ASSERT(result);
251 2 }
252
253 78 bool ShadingSurfaceGroup_Impl::setYOrigin(double yOrigin, bool driverMethod) {
254 78 bool result = setDouble(OS_ShadingSurfaceGroupFields::YOrigin, yOrigin, driverMethod);
255
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 78 times.
78 OS_ASSERT(result);
256 78 return result;
257 }
258
259 2 void ShadingSurfaceGroup_Impl::resetYOrigin() {
260
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
4 bool result = setString(OS_ShadingSurfaceGroupFields::YOrigin, "");
261
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
2 OS_ASSERT(result);
262 2 }
263
264 78 bool ShadingSurfaceGroup_Impl::setZOrigin(double zOrigin, bool driverMethod) {
265 78 bool result = setDouble(OS_ShadingSurfaceGroupFields::ZOrigin, zOrigin, driverMethod);
266
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 78 times.
78 OS_ASSERT(result);
267 78 return result;
268 }
269
270 2 void ShadingSurfaceGroup_Impl::resetZOrigin() {
271
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
4 bool result = setString(OS_ShadingSurfaceGroupFields::ZOrigin, "");
272
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
2 OS_ASSERT(result);
273 2 }
274
275 3016 boost::optional<Space> ShadingSurfaceGroup_Impl::space() const {
276 3016 boost::optional<Space> result;
277
1/1
✓ Branch 1 taken 3016 times.
3016 OptionalWorkspaceObject space = getTarget(OS_ShadingSurfaceGroupFields::SpaceName);
278
2/2
✓ Branch 0 taken 880 times.
✓ Branch 1 taken 2136 times.
3016 if (space) {
279
2/2
✓ Branch 1 taken 880 times.
✓ Branch 4 taken 880 times.
880 result = space->optionalCast<Space>();
280 }
281 6032 return result;
282 3016 }
283
284 287 bool ShadingSurfaceGroup_Impl::setSpace(const Space& space) {
285
2/2
✓ Branch 1 taken 287 times.
✓ Branch 4 taken 287 times.
287 bool result = setPointer(OS_ShadingSurfaceGroupFields::SpaceName, space.handle());
286
1/2
✓ Branch 0 taken 287 times.
✗ Branch 1 not taken.
287 if (result) {
287
2/2
✓ Branch 1 taken 287 times.
✓ Branch 4 taken 287 times.
574 bool test = setString(OS_ShadingSurfaceGroupFields::ShadingSurfaceType, "Space");
288
1/3
✗ Branch 0 not taken.
✓ Branch 1 taken 287 times.
✗ Branch 3 not taken.
287 OS_ASSERT(test);
289
290
1/1
✓ Branch 1 taken 287 times.
287 boost::optional<SubSurface> shadedSubSurface = this->shadedSubSurface();
291
2/2
✓ Branch 0 taken 3 times.
✓ Branch 1 taken 284 times.
287 if (shadedSubSurface) {
292
2/2
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
3 boost::optional<Space> otherSpace = shadedSubSurface->space();
293
1/2
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
3 if (otherSpace) {
294
5/6
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
✓ Branch 10 taken 3 times.
✓ Branch 12 taken 3 times.
✗ Branch 13 not taken.
3 if (space.handle() == otherSpace->handle()) {
295 // ok
296 } else {
297
1/1
✓ Branch 1 taken 3 times.
3 resetShadedObject();
298 }
299 } else {
300 ✗ resetShadedObject();
301 }
302 3 }
303 287 }
304 287 return result;
305 }
306
307 1178 void ShadingSurfaceGroup_Impl::resetSpace() {
308
3/3
✓ Branch 1 taken 1178 times.
✓ Branch 4 taken 1 time.
✓ Branch 5 taken 1177 times.
2356 if (space()) {
309 1 resetShadedObject();
310
311 // do not call setShadingSurfaceType("Building"), infinite recursion issue
312
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
2 bool ok = setString(OS_ShadingSurfaceGroupFields::ShadingSurfaceType, "Building", false);
313
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
1 OS_ASSERT(ok);
314
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
2 ok = setString(OS_ShadingSurfaceGroupFields::SpaceName, "", false);
315
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
1 OS_ASSERT(ok);
316
317 1 this->emitChangeSignals();
318 } else {
319
2/4
✓ Branch 1 taken 1177 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 1177 times.
✗ Branch 7 not taken.
1177 OS_ASSERT(!shadedSubSurface());
320
2/4
✓ Branch 1 taken 1177 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 1177 times.
✗ Branch 7 not taken.
1177 OS_ASSERT(!shadedSurface());
321 }
322 1178 }
323
324 2359 ShadingSurfaceVector ShadingSurfaceGroup_Impl::shadingSurfaces() const {
325
3/3
✓ Branch 1 taken 2359 times.
✓ Branch 4 taken 2359 times.
✓ Branch 7 taken 2359 times.
2359 return getObject<ModelObject>().getModelObjectSources<ShadingSurface>(ShadingSurface::iddObjectType());
326 }
327
328 1464 boost::optional<SubSurface> ShadingSurfaceGroup_Impl::shadedSubSurface() const {
329 1464 boost::optional<SubSurface> result;
330
1/1
✓ Branch 1 taken 1464 times.
1464 OptionalWorkspaceObject subSurface = getTarget(OS_ShadingSurfaceGroupFields::ShadedObjectName);
331
2/2
✓ Branch 0 taken 3 times.
✓ Branch 1 taken 1461 times.
1464 if (subSurface) {
332
2/2
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
3 result = subSurface->optionalCast<SubSurface>();
333 }
334 2928 return result;
335 1464 }
336
337 1177 boost::optional<Surface> ShadingSurfaceGroup_Impl::shadedSurface() const {
338 1177 boost::optional<Surface> result;
339
1/1
✓ Branch 1 taken 1177 times.
1177 OptionalWorkspaceObject surface = getTarget(OS_ShadingSurfaceGroupFields::ShadedObjectName);
340
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1177 times.
1177 if (surface) {
341 ✗ result = surface->optionalCast<Surface>();
342 }
343 2354 return result;
344 1177 }
345
346 243 bool ShadingSurfaceGroup_Impl::setShadedSubSurface(const SubSurface& subSurface) {
347
1/1
✓ Branch 1 taken 243 times.
243 boost::optional<Space> space = this->space();
348
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 243 times.
243 if (!space) {
349 ✗ return false;
350 }
351
352
1/1
✓ Branch 1 taken 243 times.
243 boost::optional<Space> otherSpace = subSurface.space();
353
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 243 times.
243 if (!otherSpace) {
354 ✗ return false;
355 }
356
357
6/7
✓ Branch 1 taken 243 times.
✓ Branch 4 taken 243 times.
✓ Branch 7 taken 243 times.
✓ Branch 10 taken 243 times.
✓ Branch 13 taken 243 times.
✗ Branch 15 not taken.
✓ Branch 16 taken 243 times.
243 if (space->handle() != otherSpace->handle()) {
358 ✗ return false;
359 }
360
361
2/2
✓ Branch 1 taken 243 times.
✓ Branch 4 taken 243 times.
243 bool test = setPointer(OS_ShadingSurfaceGroupFields::ShadedObjectName, subSurface.handle());
362
1/3
✗ Branch 0 not taken.
✓ Branch 1 taken 243 times.
✗ Branch 3 not taken.
243 OS_ASSERT(test);
363
364 243 return test;
365 243 }
366
367 ✗ bool ShadingSurfaceGroup_Impl::setShadedSurface(const Surface& surface) {
368 ✗ boost::optional<Space> space = this->space();
369 ✗ if (!space) {
370 ✗ return false;
371 }
372
373 ✗ boost::optional<Space> otherSpace = surface.space();
374 ✗ if (!otherSpace) {
375 ✗ return false;
376 }
377
378 ✗ if (space->handle() != otherSpace->handle()) {
379 ✗ return false;
380 }
381
382 ✗ bool test = setPointer(OS_ShadingSurfaceGroupFields::ShadedObjectName, surface.handle());
383 ✗ OS_ASSERT(test);
384
385 ✗ return test;
386 ✗ }
387
388 4 void ShadingSurfaceGroup_Impl::resetShadedObject() {
389
2/2
✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
8 bool test = setString(OS_ShadingSurfaceGroupFields::ShadedObjectName, "");
390
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 OS_ASSERT(test);
391 4 }
392
393 ✗ boost::optional<ModelObject> ShadingSurfaceGroup_Impl::spaceAsModelObject() const {
394 ✗ OptionalModelObject result;
395 ✗ OptionalSpace intermediate = space();
396 ✗ if (intermediate) {
397 ✗ result = *intermediate;
398 }
399 ✗ return result;
400 ✗ }
401
402 ✗ std::vector<ModelObject> ShadingSurfaceGroup_Impl::shadingSurfacesAsModelObjects() const {
403 ✗ ModelObjectVector result = castVector<ModelObject>(shadingSurfaces());
404 ✗ return result;
405 }
406
407 ✗ bool ShadingSurfaceGroup_Impl::setSpaceAsModelObject(const boost::optional<ModelObject>& modelObject) {
408 ✗ if (modelObject) {
409 ✗ OptionalSpace intermediate = modelObject->optionalCast<Space>();
410 ✗ if (intermediate) {
411 ✗ return setSpace(*intermediate);
412 } else {
413 ✗ return false;
414 }
415 ✗ } else {
416 ✗ resetSpace();
417 }
418 ✗ return true;
419 }
420
421 } // namespace detail
422
423 763 ShadingSurfaceGroup::ShadingSurfaceGroup(const Model& model) : PlanarSurfaceGroup(ShadingSurfaceGroup::iddObjectType(), model) {
424
1/3
✗ Branch 2 not taken.
✓ Branch 3 taken 763 times.
✗ Branch 5 not taken.
763 OS_ASSERT(getImpl<detail::ShadingSurfaceGroup_Impl>());
425
2/2
✓ Branch 1 taken 763 times.
✓ Branch 4 taken 763 times.
763 bool ok = this->setShadingSurfaceType("Building");
426
1/3
✗ Branch 0 not taken.
✓ Branch 1 taken 763 times.
✗ Branch 3 not taken.
763 OS_ASSERT(ok);
427 763 }
428
429 54327 IddObjectType ShadingSurfaceGroup::iddObjectType() {
430
1/1
✓ Branch 1 taken 54327 times.
54327 IddObjectType result(IddObjectType::OS_ShadingSurfaceGroup);
431 54327 return result;
432 }
433
434 ✗ std::vector<std::string> ShadingSurfaceGroup::validShadingSurfaceTypeValues() {
435 ✗ return getIddKeyNames(IddFactory::instance().getObject(iddObjectType()).get(), OS_ShadingSurfaceGroupFields::ShadingSurfaceType);
436 }
437
438 3299 std::string ShadingSurfaceGroup::shadingSurfaceType() const {
439
1/1
✓ Branch 3 taken 3299 times.
3299 return getImpl<detail::ShadingSurfaceGroup_Impl>()->shadingSurfaceType();
440 }
441
442 1214 bool ShadingSurfaceGroup::setShadingSurfaceType(const std::string& shadingSurfaceType) {
443
1/1
✓ Branch 3 taken 1214 times.
1214 return getImpl<detail::ShadingSurfaceGroup_Impl>()->setShadingSurfaceType(shadingSurfaceType);
444 }
445
446 1471 boost::optional<Space> ShadingSurfaceGroup::space() const {
447
1/1
✓ Branch 3 taken 1471 times.
1471 return getImpl<detail::ShadingSurfaceGroup_Impl>()->space();
448 }
449
450 281 bool ShadingSurfaceGroup::setSpace(const Space& space) {
451
1/1
✓ Branch 3 taken 281 times.
281 return getImpl<detail::ShadingSurfaceGroup_Impl>()->setSpace(space);
452 }
453
454 ✗ void ShadingSurfaceGroup::resetSpace() {
455 ✗ getImpl<detail::ShadingSurfaceGroup_Impl>()->resetSpace();
456 ✗ }
457
458 960 ShadingSurfaceVector ShadingSurfaceGroup::shadingSurfaces() const {
459
1/1
✓ Branch 3 taken 960 times.
960 return getImpl<detail::ShadingSurfaceGroup_Impl>()->shadingSurfaces();
460 }
461
462 ✗ boost::optional<SubSurface> ShadingSurfaceGroup::shadedSubSurface() const {
463 ✗ return getImpl<detail::ShadingSurfaceGroup_Impl>()->shadedSubSurface();
464 }
465
466 ✗ boost::optional<Surface> ShadingSurfaceGroup::shadedSurface() const {
467 ✗ return getImpl<detail::ShadingSurfaceGroup_Impl>()->shadedSurface();
468 }
469
470 243 bool ShadingSurfaceGroup::setShadedSubSurface(const SubSurface& subSurface) {
471
1/1
✓ Branch 3 taken 243 times.
243 return getImpl<detail::ShadingSurfaceGroup_Impl>()->setShadedSubSurface(subSurface);
472 }
473
474 ✗ bool ShadingSurfaceGroup::setShadedSurface(const Surface& surface) {
475 ✗ return getImpl<detail::ShadingSurfaceGroup_Impl>()->setShadedSurface(surface);
476 }
477
478 ✗ void ShadingSurfaceGroup::resetShadedObject() {
479 ✗ return getImpl<detail::ShadingSurfaceGroup_Impl>()->resetShadedObject();
480 }
481
482 /// @cond
483
1/1
✓ Branch 3 taken 6857 times.
6857 ShadingSurfaceGroup::ShadingSurfaceGroup(std::shared_ptr<detail::ShadingSurfaceGroup_Impl> impl) : PlanarSurfaceGroup(std::move(impl)) {}
484 /// @endcond
485
486 } // namespace model
487 } // namespace openstudio
488