MCPcopy Create free account
hub / github.com/assimp/assimp / ProcessSpatialStructure

Function ProcessSpatialStructure

code/AssetLib/IFC/IFCLoader.cpp:628–822  ·  view source on GitHub ↗

------------------------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

626
627// ------------------------------------------------------------------------------------------------
628aiNode *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

Callers 1

ProcessSpatialStructuresFunction · 0.85

Calls 15

ProcessMetadataFunction · 0.85
ResolveObjectPlacementFunction · 0.85
aiMatrix4x4Class · 0.85
GetClassNameMethod · 0.80
eraseMethod · 0.80
aiStringClass · 0.50
SetMethod · 0.45
GetMethod · 0.45
GetIDMethod · 0.45
endMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected