------------------------------------------------------------------------------------------------
| 521 | |
| 522 | // ------------------------------------------------------------------------------------------------ |
| 523 | void 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 | |
| 558 | typedef std::map<std::string, std::string> Metadata; |
| 559 |
no test coverage detected