| 699 | } |
| 700 | |
| 701 | boost::optional<pugi::xml_node> ForwardTranslator::translateBuildingStory(const openstudio::model::BuildingStory& story, pugi::xml_node& parent) { |
| 702 | boost::optional<double> zLevel = story.nominalZCoordinate(); |
| 703 | |
| 704 | // z-level not set, attempt to find it |
| 705 | if (!zLevel) { |
| 706 | for (const auto& space : story.spaces()) { |
| 707 | Transformation t = space.buildingTransformation(); |
| 708 | for (const auto& surface : space.surfaces()) { |
| 709 | for (const auto& vertex : surface.vertices()) { |
| 710 | if (zLevel) { |
| 711 | zLevel = std::min(*zLevel, vertex.z()); |
| 712 | } else { |
| 713 | zLevel = vertex.z(); |
| 714 | } |
| 715 | } |
| 716 | } |
| 717 | } |
| 718 | } |
| 719 | |
| 720 | if (!zLevel) { |
| 721 | zLevel = 0; |
| 722 | } |
| 723 | |
| 724 | auto result = parent.append_child("BuildingStorey"); |
| 725 | m_translatedObjects[story.handle()] = result; |
| 726 | |
| 727 | translateId(story, result); |
| 728 | translateName(story, result); |
| 729 | |
| 730 | // append level |
| 731 | auto levelElement = result.append_child("Level"); |
| 732 | levelElement.text() = openstudio::string_conversions::number(*zLevel, FloatFormat::fixed).c_str(); |
| 733 | |
| 734 | return result; |
| 735 | } |
| 736 | |
| 737 | boost::optional<pugi::xml_node> ForwardTranslator::translateSurface(const openstudio::model::Surface& surface, pugi::xml_node& parent) { |
| 738 | // return if already translated |
nothing calls this directly
no test coverage detected