mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-22 12:07:59 +00:00
This commit is contained in:
+32
-9
@@ -385,29 +385,52 @@ public:
|
|||||||
const SurfaceStyle* get_style(const IfcSchema::IfcMaterial*);
|
const SurfaceStyle* get_style(const IfcSchema::IfcMaterial*);
|
||||||
|
|
||||||
template <typename T> std::pair<IfcSchema::IfcSurfaceStyle*, T*> _get_surface_style(const IfcSchema::IfcStyledItem* si) {
|
template <typename T> std::pair<IfcSchema::IfcSurfaceStyle*, T*> _get_surface_style(const IfcSchema::IfcStyledItem* si) {
|
||||||
|
std::vector<IfcSchema::IfcPresentationStyle*> prs_styles;
|
||||||
|
|
||||||
#ifdef SCHEMA_HAS_IfcStyleAssignmentSelect
|
#ifdef SCHEMA_HAS_IfcStyleAssignmentSelect
|
||||||
IfcEntityList::ptr style_assignments = si->Styles();
|
IfcEntityList::ptr style_assignments = si->Styles();
|
||||||
for (IfcEntityList::it kt = style_assignments->begin(); kt != style_assignments->end(); ++kt) {
|
for (IfcEntityList::it kt = style_assignments->begin(); kt != style_assignments->end(); ++kt) {
|
||||||
|
|
||||||
|
// Using IfcPresentationStyleAssignment is deprecated, use the direct assignment of a subtype of IfcPresentationStyle instead.
|
||||||
|
auto style_k = (*kt)->as<IfcSchema::IfcPresentationStyle>();
|
||||||
|
if (style_k) {
|
||||||
|
prs_styles.push_back(style_k);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (!(*kt)->declaration().is(IfcSchema::IfcPresentationStyleAssignment::Class())) {
|
if (!(*kt)->declaration().is(IfcSchema::IfcPresentationStyleAssignment::Class())) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
IfcSchema::IfcPresentationStyleAssignment* style_assignment = (IfcSchema::IfcPresentationStyleAssignment*) *kt;
|
IfcSchema::IfcPresentationStyleAssignment* style_assignment = (IfcSchema::IfcPresentationStyleAssignment*) *kt;
|
||||||
|
|
||||||
|
Logger::Warning("Deprecated usage of", style_assignment);
|
||||||
#else
|
#else
|
||||||
IfcSchema::IfcPresentationStyleAssignment::list::ptr style_assignments = si->Styles();
|
IfcSchema::IfcPresentationStyleAssignment::list::ptr style_assignments = si->Styles();
|
||||||
for (IfcSchema::IfcPresentationStyleAssignment::list::it kt = style_assignments->begin(); kt != style_assignments->end(); ++kt) {
|
for (IfcSchema::IfcPresentationStyleAssignment::list::it kt = style_assignments->begin(); kt != style_assignments->end(); ++kt) {
|
||||||
IfcSchema::IfcPresentationStyleAssignment* style_assignment = *kt;
|
IfcSchema::IfcPresentationStyleAssignment* style_assignment = *kt;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Only in case of 2x3 or old style IfcPresentationStyleAssignment
|
||||||
|
|
||||||
IfcEntityList::ptr styles = style_assignment->Styles();
|
IfcEntityList::ptr styles = style_assignment->Styles();
|
||||||
|
|
||||||
for (IfcEntityList::it lt = styles->begin(); lt != styles->end(); ++lt) {
|
for (IfcEntityList::it lt = styles->begin(); lt != styles->end(); ++lt) {
|
||||||
IfcUtil::IfcBaseClass* style = *lt;
|
auto style_l = (*lt)->as<IfcSchema::IfcPresentationStyle>();
|
||||||
if (style->declaration().is(IfcSchema::IfcSurfaceStyle::Class())) {
|
if (style_l) {
|
||||||
IfcSchema::IfcSurfaceStyle* surface_style = (IfcSchema::IfcSurfaceStyle*) style;
|
prs_styles.push_back(style_l);
|
||||||
if (surface_style->Side() != IfcSchema::IfcSurfaceSide::IfcSurfaceSide_NEGATIVE) {
|
}
|
||||||
IfcEntityList::ptr styles_elements = surface_style->Styles();
|
}
|
||||||
for (IfcEntityList::it mt = styles_elements->begin(); mt != styles_elements->end(); ++mt) {
|
}
|
||||||
if ((*mt)->declaration().is(T::Class())) {
|
|
||||||
return std::make_pair(surface_style, (T*) *mt);
|
for (auto& style : prs_styles) {
|
||||||
}
|
if (style->declaration().is(IfcSchema::IfcSurfaceStyle::Class())) {
|
||||||
|
IfcSchema::IfcSurfaceStyle* surface_style = (IfcSchema::IfcSurfaceStyle*) style;
|
||||||
|
if (surface_style->Side() != IfcSchema::IfcSurfaceSide::IfcSurfaceSide_NEGATIVE) {
|
||||||
|
IfcEntityList::ptr styles_elements = surface_style->Styles();
|
||||||
|
for (IfcEntityList::it mt = styles_elements->begin(); mt != styles_elements->end(); ++mt) {
|
||||||
|
if ((*mt)->declaration().is(T::Class())) {
|
||||||
|
return std::make_pair(surface_style, (T*) *mt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user