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

Method mergeBuildingStory

src/model/ModelMerger.cpp:725–803  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

723 }
724
725 void ModelMerger::mergeBuildingStory(BuildingStory& currentBuildingStory, const BuildingStory& newBuildingStory) {
726 if (m_newMergedHandles.find(newBuildingStory.handle()) != m_newMergedHandles.end()) {
727 // already merged
728 return;
729 }
730 m_newMergedHandles.insert(newBuildingStory.handle());
731
732 currentBuildingStory.setName(newBuildingStory.nameString());
733
734 // rendering color
735 boost::optional<RenderingColor> newColor = newBuildingStory.renderingColor();
736 if (newColor) {
737 boost::optional<RenderingColor> currentColor = currentBuildingStory.renderingColor();
738 if (currentColor) {
739 currentColor->setRenderingRedValue(newColor->renderingRedValue());
740 currentColor->setRenderingGreenValue(newColor->renderingGreenValue());
741 currentColor->setRenderingBlueValue(newColor->renderingBlueValue());
742 currentColor->setRenderingAlphaValue(newColor->renderingAlphaValue());
743 } else {
744 currentColor = RenderingColor::fromColorString(newColor->colorString(), currentBuildingStory.model());
745 OS_ASSERT(currentColor);
746 currentBuildingStory.setRenderingColor(*currentColor);
747 }
748 }
749
750 // nominalZCoordinate
751 boost::optional<double> newNominalZCoordinate = newBuildingStory.nominalZCoordinate();
752 if (newNominalZCoordinate) {
753 currentBuildingStory.setNominalZCoordinate(*newNominalZCoordinate);
754 } else {
755 currentBuildingStory.resetNominalZCoordinate();
756 }
757
758 // nominalFloortoFloorHeight
759 boost::optional<double> newNominalFloortoFloorHeight = newBuildingStory.nominalFloortoFloorHeight();
760 if (newNominalFloortoFloorHeight) {
761 currentBuildingStory.setNominalFloortoFloorHeight(*newNominalFloortoFloorHeight);
762 } else {
763 currentBuildingStory.resetNominalFloortoFloorHeight();
764 }
765
766 // nominalFloortoCeilingHeight
767 boost::optional<double> newNominalFloortoCeilingHeight = newBuildingStory.nominalFloortoCeilingHeight();
768 if (newNominalFloortoCeilingHeight) {
769 currentBuildingStory.setNominalFloortoCeilingHeight(*newNominalFloortoCeilingHeight);
770 } else {
771 currentBuildingStory.resetNominalFloortoCeilingHeight();
772 }
773
774 //default construction set.
775 if (boost::optional<DefaultConstructionSet> newDefaultConstructionSet = newBuildingStory.defaultConstructionSet()) {
776 boost::optional<WorkspaceObject> currentObject = getCurrentModelObject(*newDefaultConstructionSet);
777 if (currentObject) {
778 auto currentDefaultConstructionSet = currentObject->cast<DefaultConstructionSet>();
779 currentBuildingStory.setDefaultConstructionSet(currentDefaultConstructionSet);
780 } else {
781 // DLM: this is an error
782 //currentBuildingStory.resetDefaultConstructionSet();

Callers

nothing calls this directly

Calls 15

nameStringMethod · 0.80
setRenderingRedValueMethod · 0.80
renderingRedValueMethod · 0.80
renderingGreenValueMethod · 0.80
setRenderingBlueValueMethod · 0.80
renderingBlueValueMethod · 0.80
renderingAlphaValueMethod · 0.80
colorStringMethod · 0.80
findMethod · 0.45
handleMethod · 0.45

Tested by

no test coverage detected