| 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) { |
nothing calls this directly
no test coverage detected