MCPcopy Create free account
hub / github.com/IfcOpenShell/IfcOpenShell / getRepresentationSubContext

Method getRepresentationSubContext

src/ifcparse/IfcHierarchyHelper.cpp:1039–1059  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1037
1038template <typename Schema>
1039typename Schema::IfcGeometricRepresentationSubContext* IfcHierarchyHelper<Schema>::getRepresentationSubContext(const std::string& ident, const std::string& type) {
1040 auto geometric_representation_context = getRepresentationContext(type); // creates the representation context if it doesn't already exist
1041
1042 // search for a subcontext that matches the ContextIdentifier
1043 auto subcontexts = geometric_representation_context->HasSubContexts();
1044 typename Schema::IfcGeometricRepresentationSubContext* rep_subcontext = nullptr;
1045 for (auto subcontext : *subcontexts) {
1046 if (subcontext->ContextIdentifier().get_value_or("") == ident) {
1047 rep_subcontext = subcontext;
1048 break; // found it, break out of the loop
1049 }
1050 }
1051
1052 if (rep_subcontext == nullptr) {
1053 // didn't find the subcontext, create it
1054 rep_subcontext = new typename Schema::IfcGeometricRepresentationSubContext(ident, type, geometric_representation_context, boost::none, Schema::IfcGeometricProjectionEnum::IfcGeometricProjection_MODEL_VIEW, boost::none);
1055 addEntity(rep_subcontext);
1056 }
1057
1058 return rep_subcontext;
1059}
1060
1061#ifdef HAS_SCHEMA_2x3
1062template IFC_PARSE_API class IfcHierarchyHelper<Ifc2x3>;

Callers 2

addHorizontalAlignmentFunction · 0.80
addAlignmentFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected