diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 75d7fe5fa6..3eaa9833a0 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -27,6 +27,8 @@ if(CCACHE_FOUND) set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache) endif() +add_definitions(-D_DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR) + cmake_policy(SET CMP0048 NEW) cmake_policy(SET CMP0074 NEW) cmake_policy(SET CMP0078 NEW) diff --git a/src/ifcgeom/mapping/mapping.cpp b/src/ifcgeom/mapping/mapping.cpp index 7c0235cfa3..1907c47024 100644 --- a/src/ifcgeom/mapping/mapping.cpp +++ b/src/ifcgeom/mapping/mapping.cpp @@ -430,10 +430,8 @@ namespace { } #endif - IfcSchema::IfcSurfaceStyle *surface_style = nullptr; for (auto& style : prs_styles) { - if (style->declaration().is(IfcSchema::IfcSurfaceStyle::Class())) { - surface_style = (IfcSchema::IfcSurfaceStyle*)style; + if (auto surface_style = style->as()) { if (surface_style->Side() != IfcSchema::IfcSurfaceSide::IfcSurfaceSide_NEGATIVE) { auto styles_elements = surface_style->Styles(); for (auto mt = styles_elements->begin(); mt != styles_elements->end(); ++mt) { @@ -444,7 +442,7 @@ namespace { } } } - return std::make_pair(surface_style, nullptr); + return std::make_pair(nullptr, nullptr); } bool process_colour(IfcSchema::IfcColourRgb* colour, double* rgb) { @@ -546,6 +544,21 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcStyledItem* inst) { return nullptr; } + // map and not map_impl otherwise no caching + return map(style); +} + +taxonomy::ptr mapping::map_impl(const IfcSchema::IfcSurfaceStyle* style) { + auto styles = style->Styles(); + IfcSchema::IfcSurfaceStyleShading* shading = nullptr; + for (auto& s : *styles) { + if (shading = s->as()) { + break; + } + } + if (shading == nullptr) { + return nullptr; + } taxonomy::style::ptr surface_style = taxonomy::make(); surface_style->instance = style; if (settings_.get().get() && style->Name()) { @@ -611,7 +624,6 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcStyledItem* inst) { return surface_style; } - taxonomy::ptr mapping::map(const IfcBaseInterface* inst) { auto iden = inst->as()->identity(); if (use_caching_) { diff --git a/src/ifcgeom/mapping/mapping.i b/src/ifcgeom/mapping/mapping.i index 51e001f05d..adc2e3c10b 100644 --- a/src/ifcgeom/mapping/mapping.i +++ b/src/ifcgeom/mapping/mapping.i @@ -171,6 +171,7 @@ BIND(IfcVector); // BIND(IfcColourRgb); BIND(IfcMaterial); // -> style BIND(IfcStyledItem); // -> style +BIND(IfcSurfaceStyle); // -> style #ifdef SCHEMA_HAS_IfcCurveSegment BIND(IfcCurveSegment);