| 973 | } |
| 974 | |
| 975 | bool mapping::get_layerset_information(const IfcUtil::IfcBaseInterface* p, layerset_information& info, int &) |
| 976 | { |
| 977 | const IfcSchema::IfcProduct* product = p->as<IfcSchema::IfcProduct>(); |
| 978 | |
| 979 | if (!product) { |
| 980 | return false; |
| 981 | } |
| 982 | |
| 983 | IfcSchema::IfcMaterialLayerSetUsage* usage = 0; |
| 984 | // Handle_Geom_Surface reference_surface; |
| 985 | |
| 986 | IfcSchema::IfcRelAssociates::list::ptr associations = product->HasAssociations(); |
| 987 | for (IfcSchema::IfcRelAssociates::list::it it = associations->begin(); it != associations->end(); ++it) { |
| 988 | IfcSchema::IfcRelAssociatesMaterial* associates_material = (**it).as<IfcSchema::IfcRelAssociatesMaterial>(); |
| 989 | if (associates_material) { |
| 990 | usage = associates_material->RelatingMaterial()->as<IfcSchema::IfcMaterialLayerSetUsage>(); |
| 991 | break; |
| 992 | } |
| 993 | } |
| 994 | |
| 995 | if (!usage) { |
| 996 | return false; |
| 997 | } |
| 998 | |
| 999 | IfcSchema::IfcRepresentation* body_representation = find_representation(product, "Body"); |
| 1000 | |
| 1001 | if (!body_representation) { |
| 1002 | Logger::Warning("No body representation for product", product); |
| 1003 | return false; |
| 1004 | } |
| 1005 | |
| 1006 | const IfcSchema::IfcMaterialLayerSet* layerset = usage->ForLayerSet(); |
| 1007 | const bool positive = usage->DirectionSense() == IfcSchema::IfcDirectionSenseEnum::IfcDirectionSense_POSITIVE; |
| 1008 | double offset = usage->OffsetFromReferenceLine() * this->length_unit_; |
| 1009 | |
| 1010 | IfcSchema::IfcMaterialLayer::list::ptr material_layers = layerset->MaterialLayers(); |
| 1011 | |
| 1012 | if (product->declaration().is(IfcSchema::IfcWall::Class())) { |
| 1013 | IfcSchema::IfcRepresentation* axis_representation = find_representation(product, "Axis"); |
| 1014 | |
| 1015 | if (!axis_representation) { |
| 1016 | Logger::Message(Logger::LOG_WARNING, "No axis representation for:", product); |
| 1017 | return false; |
| 1018 | } |
| 1019 | |
| 1020 | auto curve = map(axis_representation); |
| 1021 | auto product_node = taxonomy::cast<taxonomy::geom_item>(map(product)); |
| 1022 | |
| 1023 | auto& m4 = product_node->matrix; |
| 1024 | auto c2 = flatten(taxonomy::cast<taxonomy::collection>(curve)); |
| 1025 | if (c2->children.empty()) { |
| 1026 | return false; |
| 1027 | } |
| 1028 | |
| 1029 | #ifdef TAXONOMY_USE_NAKED_PTR |
| 1030 | delete curve; |
| 1031 | delete product_node; |
| 1032 | #endif |