| 2313 | } |
| 2314 | |
| 2315 | void SvgSerializer::setFile(IfcParse::IfcFile* f) { |
| 2316 | file = f; |
| 2317 | |
| 2318 | auto storeys = f->instances_by_type("IfcBuildingStorey"); |
| 2319 | if (!storeys || storeys->size() == 0) { |
| 2320 | auto mapping = ifcopenshell::geometry::impl::mapping_implementations().construct(file, geometry_settings_); |
| 2321 | |
| 2322 | std::vector<const IfcParse::declaration*> to_derive_from; |
| 2323 | to_derive_from.push_back(f->schema()->declaration_by_name("IfcBuilding")); |
| 2324 | to_derive_from.push_back(f->schema()->declaration_by_name("IfcSite")); |
| 2325 | for (auto it = to_derive_from.begin(); it != to_derive_from.end(); ++it) { |
| 2326 | aggregate_of_instance::ptr insts = f->instances_by_type(*it); |
| 2327 | if (insts) { |
| 2328 | for (auto jt = insts->begin(); jt != insts->end(); ++jt) { |
| 2329 | IfcUtil::IfcBaseEntity* product = (IfcUtil::IfcBaseEntity*) *jt; |
| 2330 | if (!product->get("ObjectPlacement").isNull()) { |
| 2331 | auto item = mapping->map(product->get("ObjectPlacement")); |
| 2332 | auto matrix = ifcopenshell::geometry::taxonomy::cast<ifcopenshell::geometry::taxonomy::matrix4>(item); |
| 2333 | gp_Trsf trsf; |
| 2334 | if (matrix) { |
| 2335 | // @todo shouldn't this take into account configurable section height? |
| 2336 | setSectionHeight(matrix->translation_part()(2) + 1.); |
| 2337 | #ifdef TAXONOMY_USE_NAKED_PTR |
| 2338 | delete matrix; |
| 2339 | #endif |
| 2340 | Logger::Warning("No building storeys encountered, used for reference:", product); |
| 2341 | return; |
| 2342 | } |
| 2343 | } |
| 2344 | } |
| 2345 | } |
| 2346 | } |
| 2347 | |
| 2348 | delete mapping; |
| 2349 | |
| 2350 | Logger::Warning("No building storeys encountered, output might be invalid or missing"); |
| 2351 | } |
| 2352 | } |
| 2353 | |
| 2354 | void SvgSerializer::setSectionHeight(double h, const IfcUtil::IfcBaseEntity* storey) { |
| 2355 | section_data_.emplace(); |
no test coverage detected