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

Function ProcessProductRepresentation

code/AssetLib/IFC/IFCLoader.cpp:523–556  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

521
522// ------------------------------------------------------------------------------------------------
523void ProcessProductRepresentation(const Schema_2x3::IfcProduct &el, aiNode *nd, std::vector<aiNode *> &subnodes, ConversionData &conv) {
524 if (!el.Representation) {
525 return;
526 }
527
528 // extract Color from metadata, if present
529 unsigned int matid = ProcessMaterials(el.GetID(), std::numeric_limits<uint32_t>::max(), conv, false);
530 std::set<unsigned int> meshes;
531
532 // we want only one representation type, so bring them in a suitable order (i.e try those
533 // that look as if we could read them quickly at first). This way of reading
534 // representation is relatively generic and allows the concrete implementations
535 // for the different representation types to make some sensible choices what
536 // to load and what not to load.
537 const STEP::ListOf<STEP::Lazy<Schema_2x3::IfcRepresentation>, 1, 0> &src = el.Representation.Get()->Representations;
538 std::vector<const Schema_2x3::IfcRepresentation *> repr_ordered(src.size());
539 std::copy(src.begin(), src.end(), repr_ordered.begin());
540 std::sort(repr_ordered.begin(), repr_ordered.end(), RateRepresentationPredicate());
541 for (const Schema_2x3::IfcRepresentation *repr : repr_ordered) {
542 bool res = false;
543 for (const Schema_2x3::IfcRepresentationItem &item : repr->Items) {
544 if (const Schema_2x3::IfcMappedItem *const geo = item.ToPtr<Schema_2x3::IfcMappedItem>()) {
545 res = ProcessMappedItem(*geo, nd, subnodes, matid, conv) || res;
546 } else {
547 res = ProcessRepresentationItem(item, matid, meshes, conv) || res;
548 }
549 }
550 // if we got something meaningful at this point, skip any further representations
551 if (res) {
552 break;
553 }
554 }
555 AssignAddedMeshes(meshes, nd, conv);
556}
557
558typedef std::map<std::string, std::string> Metadata;
559

Callers 1

ProcessSpatialStructureFunction · 0.85

Calls 12

ProcessMaterialsFunction · 0.85
sortFunction · 0.85
ProcessMappedItemFunction · 0.85
AssignAddedMeshesFunction · 0.85
maxFunction · 0.50
GetIDMethod · 0.45
GetMethod · 0.45
sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected