| 939 | |
| 940 | template <typename Schema> |
| 941 | typename 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 | |
| 982 | template <typename Schema> |
| 983 | typename Schema::IfcProductDefinitionShape* IfcHierarchyHelper<Schema>::addMappedItem( |