| 547 | } |
| 548 | |
| 549 | taxonomy::ptr mapping::map_impl(const IfcSchema::IfcMaterial* material) { |
| 550 | IfcSchema::IfcMaterialDefinitionRepresentation::list::ptr defs = material->HasRepresentation(); |
| 551 | for (IfcSchema::IfcMaterialDefinitionRepresentation::list::it jt = defs->begin(); jt != defs->end(); ++jt) { |
| 552 | IfcSchema::IfcRepresentation::list::ptr reps = (*jt)->Representations(); |
| 553 | IfcSchema::IfcStyledItem::list::ptr styles(new IfcSchema::IfcStyledItem::list); |
| 554 | for (IfcSchema::IfcRepresentation::list::it it = reps->begin(); it != reps->end(); ++it) { |
| 555 | styles->push((**it).Items()->as<IfcSchema::IfcStyledItem>()); |
| 556 | } |
| 557 | if (styles->size() == 1) { |
| 558 | IfcSchema::IfcStyledItem *styled_item = *styles->begin(); |
| 559 | auto mapped_item = map(styled_item); |
| 560 | if (mapped_item) { |
| 561 | return mapped_item; |
| 562 | } |
| 563 | // Check if it's failed or just some unsupported case. |
| 564 | if (failed_on_purpose_.find(styled_item) == failed_on_purpose_.end()) { |
| 565 | return nullptr; |
| 566 | } |
| 567 | Logger::Warning("Skipping unsupported material style for material: ", material); |
| 568 | } |
| 569 | } |
| 570 | |
| 571 | // When material does not have a representation we don't create a style from it |
| 572 | return nullptr; |
| 573 | |
| 574 | /* |
| 575 | taxonomy::style::ptr material_style = taxonomy::make<taxonomy::style>(); |
| 576 | material_style->instance = material; |
| 577 | if (settings_.get<settings::UseMaterialNames>().get()) { |
| 578 | material_style->name = material->Name(); |
| 579 | } else { |
| 580 | std::ostringstream oss; |
| 581 | oss << material->declaration().name() << "-" << material->id(); |
| 582 | material_style->name = oss.str(); |
| 583 | } |
| 584 | return material_style; |
| 585 | */ |
| 586 | |
| 587 | // @todo |
| 588 | // IfcGeom::SurfaceStyle material_style = IfcGeom::SurfaceStyle(material->data().id(), material->Name()); |
| 589 | // return &(style_cache[material->data().id()] = material_style); |
| 590 | } |
| 591 | |
| 592 | taxonomy::ptr mapping::map_impl(const IfcSchema::IfcStyledItem* inst) { |
| 593 | auto style_pair = get_surface_style<IfcSchema::IfcSurfaceStyleShading>(inst); |