| 99 | constexpr double meterToFoot = 1.0 / 0.3048; |
| 100 | |
| 101 | pugi::xml_node elementByTagNameAndIndex(const pugi::xml_node& root, const std::string& tagName, boost::optional<int> _index) { |
| 102 | |
| 103 | pugi::xml_node result; |
| 104 | if (_index) { |
| 105 | |
| 106 | for (const pugi::xml_node& e : root.children(tagName.c_str())) { |
| 107 | // Check if the node has an attribute 'id' that is an int *and* matches the one we seek |
| 108 | boost::optional<int> _thisIndex = lexicalCastToInt(e.attribute("index")); |
| 109 | if (_thisIndex && (_thisIndex.get() == _index.get())) { |
| 110 | result = e; |
| 111 | break; |
| 112 | } |
| 113 | } |
| 114 | } else { |
| 115 | // return first child (should be unique) |
| 116 | result = root.child(tagName.c_str()); |
| 117 | } |
| 118 | return result; |
| 119 | } |
| 120 | |
| 121 | boost::optional<model::ModelObject> ReverseTranslator::translateBuilding(const pugi::xml_node& element, openstudio::model::Model& model) { |
| 122 | openstudio::model::Building building = model.getUniqueModelObject<openstudio::model::Building>(); |
no test coverage detected