MCPcopy Create free account
hub / github.com/NatLabRockies/OpenStudio / getDefaultConstructionWithSearchDistance

Method getDefaultConstructionWithSearchDistance

src/model/Space.cpp:497–562  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

495 }
496
497 boost::optional<std::pair<ConstructionBase, int>> Space_Impl::getDefaultConstructionWithSearchDistance(const PlanarSurface& planarSurface) const {
498 boost::optional<ConstructionBase> result;
499 boost::optional<DefaultConstructionSet> defaultConstructionSet;
500 boost::optional<SpaceType> spaceType;
501 boost::optional<BuildingStory> buildingStory;
502 boost::optional<Building> building;
503
504 // first check this object
505 defaultConstructionSet = this->defaultConstructionSet();
506 if (defaultConstructionSet) {
507 result = defaultConstructionSet->getDefaultConstruction(planarSurface);
508 if (result) {
509 return std::make_pair(*result, 1);
510 }
511 }
512
513 // then check space type
514 spaceType = this->spaceType();
515 if (spaceType && !this->isSpaceTypeDefaulted()) {
516 defaultConstructionSet = spaceType->defaultConstructionSet();
517 if (defaultConstructionSet) {
518 result = defaultConstructionSet->getDefaultConstruction(planarSurface);
519 if (result) {
520 return std::make_pair(*result, 2);
521 }
522 }
523 }
524
525 // then check building story
526 buildingStory = this->buildingStory();
527 if (buildingStory) {
528 defaultConstructionSet = buildingStory->defaultConstructionSet();
529 if (defaultConstructionSet) {
530 result = defaultConstructionSet->getDefaultConstruction(planarSurface);
531 if (result) {
532 return std::make_pair(*result, 3);
533 }
534 }
535 }
536
537 // then check building
538 building = this->model().building();
539 if (building) {
540 defaultConstructionSet = building->defaultConstructionSet();
541 if (defaultConstructionSet) {
542 result = defaultConstructionSet->getDefaultConstruction(planarSurface);
543 if (result) {
544 return std::make_pair(*result, 4);
545 }
546 }
547
548 // then check building's space type
549 spaceType = building->spaceType();
550 if (spaceType) {
551 defaultConstructionSet = spaceType->defaultConstructionSet();
552 if (defaultConstructionSet) {
553 result = defaultConstructionSet->getDefaultConstruction(planarSurface);
554 if (result) {

Calls 7

spaceTypeMethod · 0.95
isSpaceTypeDefaultedMethod · 0.95
buildingStoryMethod · 0.95
buildingMethod · 0.45
modelMethod · 0.45

Tested by

no test coverage detected