| 115 | |
| 116 | template <typename Schema, typename T> |
| 117 | void process_pset(element_properties& props, const T* inst) { |
| 118 | // Process an individual Property or Quantity set. |
| 119 | if (auto pset = inst->template as<typename Schema::IfcPropertySet>()) { |
| 120 | if (!pset->Name()) { |
| 121 | return; |
| 122 | } |
| 123 | auto ps = pset->HasProperties(); |
| 124 | for (auto it = ps->begin(); it != ps->end(); ++it) { |
| 125 | auto& p = *it; |
| 126 | if (auto singleval = p->template as<typename Schema::IfcPropertySingleValue>()) { |
| 127 | std::string propname, propvalue; |
| 128 | if constexpr (is_ifc4_or_higher<Schema>::value) { |
| 129 | if (!singleval->Name()) { |
| 130 | continue; |
| 131 | } |
| 132 | propname = *singleval->Name(); |
| 133 | } |
| 134 | if constexpr (!is_ifc4_or_higher<Schema>::value) { |
| 135 | propname = singleval->Name(); |
| 136 | } |
| 137 | if (!singleval->NominalValue()) { |
| 138 | propvalue = "-"; |
| 139 | } else { |
| 140 | props[*pset->Name()][propname] = format_string(singleval->NominalValue()->template as<IfcUtil::IfcBaseClass>()->get_attribute_value(0)); |
| 141 | } |
| 142 | } |
| 143 | } |
| 144 | } |
| 145 | if (auto qset = inst->template as<typename Schema::IfcElementQuantity>()) { |
| 146 | if (!qset->Name()) { |
| 147 | return; |
| 148 | } |
| 149 | auto qs = qset->Quantities(); |
| 150 | for (auto it = qs->begin(); it != qs->end(); ++it) { |
| 151 | auto& q = *it; |
| 152 | if (q->template as<typename Schema::IfcPhysicalSimpleQuantity>() && q->get_attribute_value(3).type() == IfcUtil::Argument_DOUBLE) { |
| 153 | double v = q->get_attribute_value(3); |
| 154 | props[*qset->Name()][q->Name()] = std::to_string(v); |
| 155 | } |
| 156 | } |
| 157 | } |
| 158 | if constexpr (is_ifc4_or_higher<Schema>::value) { |
| 159 | if (auto extprops = inst->template as<typename Schema::IfcExtendedProperties>()) { |
| 160 | // @todo |
| 161 | } |
| 162 | } |
| 163 | } |
| 164 | |
| 165 | template <typename Schema> |
| 166 | void get_psets_s(element_properties& props, const typename Schema::IfcObjectDefinition* inst) { |
no test coverage detected