| 343 | } |
| 344 | |
| 345 | void IfcGeom::Iterator::create_element_(ifcopenshell::geometry::Converter* kernel, ifcopenshell::geometry::Settings settings, geometry_conversion_result* rep) |
| 346 | { |
| 347 | if (!settings_.get<ifcopenshell::geometry::settings::NoParallelMapping>().get()) { |
| 348 | rep->item = kernel->mapping()->map(rep->representation); |
| 349 | if (!rep->item) { |
| 350 | return; |
| 351 | } |
| 352 | std::transform(rep->products_2->begin(), rep->products_2->end(), std::back_inserter(rep->products), [this, &rep, kernel](IfcUtil::IfcBaseClass* prod) { |
| 353 | auto prod_item = kernel->mapping()->map(prod); |
| 354 | return std::make_pair(prod->as<IfcUtil::IfcBaseEntity>(), ifcopenshell::geometry::taxonomy::cast<ifcopenshell::geometry::taxonomy::geom_item>(prod_item)->matrix); |
| 355 | }); |
| 356 | } else { |
| 357 | } |
| 358 | |
| 359 | auto product_node = rep->products.front(); |
| 360 | const IfcUtil::IfcBaseEntity* product = product_node.first; |
| 361 | const auto& place = product_node.second; |
| 362 | |
| 363 | Logger::SetProduct(product); |
| 364 | |
| 365 | IfcGeom::BRepElement* brep = static_cast<IfcGeom::BRepElement*>(decorate_with_cache_(GeometrySerializer::READ_BREP, (std::string)product->get("GlobalId"), std::to_string(rep->item->instance->as<IfcUtil::IfcBaseEntity>()->id()), [kernel, settings, product, place, rep]() { |
| 366 | return kernel->create_brep_for_representation_and_product(rep->item, product, place); |
| 367 | })); |
| 368 | |
| 369 | if (!brep) { |
| 370 | Logger::SetProduct(boost::none); |
| 371 | return; |
| 372 | } |
| 373 | |
| 374 | auto elem = process_based_on_settings(settings, brep); |
| 375 | if (!elem) { |
| 376 | Logger::SetProduct(boost::none); |
| 377 | return; |
| 378 | } |
| 379 | |
| 380 | rep->breps = { brep }; |
| 381 | rep->elements = { elem }; |
| 382 | |
| 383 | for (auto it = rep->products.begin() + 1; it != rep->products.end(); ++it) { |
| 384 | const auto& p = *it; |
| 385 | const IfcUtil::IfcBaseEntity* product2 = p.first; |
| 386 | const auto& place2 = p.second; |
| 387 | |
| 388 | IfcGeom::BRepElement* brep2 = static_cast<IfcGeom::BRepElement*>(decorate_with_cache_(GeometrySerializer::READ_BREP, (std::string)product2->get("GlobalId"), std::to_string(rep->item->instance->as<IfcUtil::IfcBaseEntity>()->id()), [kernel, settings, product2, place2, brep]() { |
| 389 | return kernel->create_brep_for_processed_representation(product2, place2, brep); |
| 390 | })); |
| 391 | if (brep2) { |
| 392 | auto elem2 = process_based_on_settings(settings, brep2, dynamic_cast<IfcGeom::TriangulationElement*>(elem)); |
| 393 | if (elem2) { |
| 394 | rep->breps.push_back(brep2); |
| 395 | rep->elements.push_back(elem2); |
| 396 | } |
| 397 | } |
| 398 | } |
| 399 | |
| 400 | Logger::SetProduct(boost::none); |
| 401 | } |
| 402 |
no test coverage detected