------------------------------------------------------------------------------------------------
| 626 | |
| 627 | // ------------------------------------------------------------------------------------------------ |
| 628 | aiNode *ProcessSpatialStructure(aiNode *parent, const Schema_2x3::IfcProduct &el, ConversionData &conv, |
| 629 | std::vector<TempOpening> *collect_openings = nullptr) { |
| 630 | const STEP::DB::RefMap &refs = conv.db.GetRefs(); |
| 631 | |
| 632 | // skip over space and annotation nodes - usually, these have no meaning in Assimp's context |
| 633 | bool skipGeometry = false; |
| 634 | if (conv.settings.skipSpaceRepresentations) { |
| 635 | if (el.ToPtr<Schema_2x3::IfcSpace>()) { |
| 636 | IFCImporter::LogVerboseDebug("skipping IfcSpace entity due to importer settings"); |
| 637 | skipGeometry = true; |
| 638 | } |
| 639 | } |
| 640 | |
| 641 | if (conv.settings.skipAnnotations) { |
| 642 | if (el.ToPtr<Schema_2x3::IfcAnnotation>()) { |
| 643 | IFCImporter::LogVerboseDebug("skipping IfcAnnotation entity due to importer settings"); |
| 644 | return nullptr; |
| 645 | } |
| 646 | } |
| 647 | |
| 648 | // add an output node for this spatial structure |
| 649 | aiNode *nd(new aiNode); |
| 650 | nd->mName.Set(el.GetClassName() + "_" + (el.Name ? el.Name.Get() : "Unnamed") + "_" + el.GlobalId); |
| 651 | nd->mParent = parent; |
| 652 | |
| 653 | conv.already_processed.insert(el.GetID()); |
| 654 | |
| 655 | // check for node metadata |
| 656 | STEP::DB::RefMapRange children = refs.equal_range(el.GetID()); |
| 657 | if (children.first != refs.end()) { |
| 658 | Metadata properties; |
| 659 | if (children.first == children.second) { |
| 660 | // handles single property set |
| 661 | ProcessMetadata((*children.first).second, conv, properties); |
| 662 | } else { |
| 663 | // handles multiple property sets (currently all property sets are merged, |
| 664 | // which may not be the best solution in the long run) |
| 665 | for (STEP::DB::RefMap::const_iterator it = children.first; it != children.second; ++it) { |
| 666 | ProcessMetadata((*it).second, conv, properties); |
| 667 | } |
| 668 | } |
| 669 | |
| 670 | if (!properties.empty()) { |
| 671 | aiMetadata *data = aiMetadata::Alloc(static_cast<unsigned int>(properties.size())); |
| 672 | unsigned int index(0); |
| 673 | for (const Metadata::value_type &kv : properties) { |
| 674 | data->Set(index++, kv.first, aiString(kv.second)); |
| 675 | } |
| 676 | nd->mMetaData = data; |
| 677 | } |
| 678 | } |
| 679 | |
| 680 | if (el.ObjectPlacement) { |
| 681 | ResolveObjectPlacement(nd->mTransformation, el.ObjectPlacement.Get(), conv); |
| 682 | } |
| 683 | |
| 684 | std::vector<TempOpening> openings; |
| 685 |
no test coverage detected