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

Method addMappedItem

src/ifcparse/IfcHierarchyHelper.cpp:941–980  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

939
940template <typename Schema>
941typename Schema::IfcProductDefinitionShape* IfcHierarchyHelper<Schema>::addMappedItem(
942 typename Schema::IfcShapeRepresentation* rep,
943 typename Schema::IfcCartesianTransformationOperator3D* transform,
944 typename Schema::IfcProductDefinitionShape* def) {
945 typename Schema::IfcRepresentationMap::list::ptr maps = rep->RepresentationMap();
946 typename Schema::IfcRepresentationMap* map;
947 if (maps->size() == 1) {
948 map = *maps->begin();
949 } else {
950 map = new typename Schema::IfcRepresentationMap(addPlacement3d(), rep);
951 addEntity(map);
952 }
953
954 typename Schema::IfcRepresentation::list::ptr representations(new typename Schema::IfcRepresentation::list);
955 if (def) {
956 representations = def->Representations();
957 }
958
959 if (!transform) {
960 transform = new typename Schema::IfcCartesianTransformationOperator3D(0, 0, addTriplet<typename Schema::IfcCartesianPoint>(0, 0, 0), boost::none, 0);
961 addEntity(transform);
962 }
963 typename Schema::IfcMappedItem* item = new typename Schema::IfcMappedItem(map, transform);
964 typename Schema::IfcRepresentationItem::list::ptr items(new typename Schema::IfcRepresentationItem::list);
965 items->push(item);
966 typename Schema::IfcRepresentation* new_rep = new typename Schema::IfcShapeRepresentation(rep->ContextOfItems(), boost::none, std::string("MappedRepresentation"), items);
967 if (rep->RepresentationIdentifier()) {
968 new_rep->setRepresentationIdentifier(rep->RepresentationIdentifier());
969 }
970 addEntity(item);
971 addEntity(new_rep);
972 representations->push(new_rep);
973 if (!def) {
974 def = new typename Schema::IfcProductDefinitionShape(boost::none, boost::none, representations);
975 addEntity(def);
976 } else {
977 def->setRepresentations(representations);
978 }
979 return def;
980}
981
982template <typename Schema>
983typename Schema::IfcProductDefinitionShape* IfcHierarchyHelper<Schema>::addMappedItem(

Callers 1

mainFunction · 0.80

Calls 4

sizeMethod · 0.45
beginMethod · 0.45
pushMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected