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

Method mergeSpaceType

src/model/ModelMerger.cpp:644–723  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

642 }
643
644 void ModelMerger::mergeSpaceType(SpaceType& currentSpaceType, const SpaceType& newSpaceType) {
645 if (m_newMergedHandles.find(newSpaceType.handle()) != m_newMergedHandles.end()) {
646 // already merged
647 return;
648 }
649 m_newMergedHandles.insert(newSpaceType.handle());
650
651 currentSpaceType.setName(newSpaceType.nameString());
652
653 //default construction set.
654 if (boost::optional<DefaultConstructionSet> newDefaultConstructionSet = newSpaceType.defaultConstructionSet()) {
655 boost::optional<WorkspaceObject> currentObject = getCurrentModelObject(*newDefaultConstructionSet);
656 if (currentObject) {
657 auto currentDefaultConstructionSet = currentObject->cast<DefaultConstructionSet>();
658 currentSpaceType.setDefaultConstructionSet(currentDefaultConstructionSet);
659 } else {
660 // DLM: this is an error
661 //currentSpaceType.resetDefaultConstructionSet();
662 }
663 } else {
664 // DLM: TODO: add option as this might have been intentionally reset on other model
665 //currentSpaceType.resetDefaultConstructionSet();
666 }
667
668 // default schedule set
669 if (boost::optional<DefaultScheduleSet> newDefaultScheduleSet = newSpaceType.defaultScheduleSet()) {
670 boost::optional<WorkspaceObject> currentObject = getCurrentModelObject(*newDefaultScheduleSet);
671 if (currentObject) {
672 auto currentDefaultScheduleSet = currentObject->cast<DefaultScheduleSet>();
673 currentSpaceType.setDefaultScheduleSet(currentDefaultScheduleSet);
674 } else {
675 // DLM: this is an error
676 //currentSpaceType.resetDefaultScheduleSet();
677 }
678 } else {
679 // DLM: TODO: add option as this might have been intentionally reset on other model
680 //currentSpaceType.resetDefaultScheduleSet();
681 }
682
683 // rendering color
684 boost::optional<RenderingColor> newColor = newSpaceType.renderingColor();
685 if (newColor) {
686 boost::optional<RenderingColor> currentColor = currentSpaceType.renderingColor();
687 if (currentColor) {
688 currentColor->setRenderingRedValue(newColor->renderingRedValue());
689 currentColor->setRenderingGreenValue(newColor->renderingGreenValue());
690 currentColor->setRenderingBlueValue(newColor->renderingBlueValue());
691 currentColor->setRenderingAlphaValue(newColor->renderingAlphaValue());
692 } else {
693 currentColor = RenderingColor::fromColorString(newColor->colorString(), currentSpaceType.model());
694 OS_ASSERT(currentColor);
695 currentSpaceType.setRenderingColor(*currentColor);
696 }
697 }
698
699 // standardsBuildingType
700 boost::optional<std::string> newStandardsBuildingType = newSpaceType.standardsBuildingType();
701 if (newStandardsBuildingType) {

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
standardsSpaceTypeMethod · 0.80
setStandardsSpaceTypeMethod · 0.80

Tested by

no test coverage detected