mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-16 13:46:54 +00:00
use basic casts to prevent needless item upgrades #7738
This commit is contained in:
@@ -543,8 +543,8 @@ piecewise_function::const_ptr offset_function::get_offset() const { return offse
|
|||||||
ifcopenshell::geometry::taxonomy::collection::ptr ifcopenshell::geometry::flatten(const taxonomy::collection::ptr& deep) {
|
ifcopenshell::geometry::taxonomy::collection::ptr ifcopenshell::geometry::flatten(const taxonomy::collection::ptr& deep) {
|
||||||
auto flat = make<taxonomy::collection>();
|
auto flat = make<taxonomy::collection>();
|
||||||
ifcopenshell::geometry::visit<taxonomy::collection>(deep, [&flat](taxonomy::ptr i) {
|
ifcopenshell::geometry::visit<taxonomy::collection>(deep, [&flat](taxonomy::ptr i) {
|
||||||
flat->children.push_back(taxonomy::cast<taxonomy::geom_item>(clone(i)));
|
flat->children.push_back(std::static_pointer_cast<taxonomy::geom_item>(clone(i)));
|
||||||
});
|
});
|
||||||
return flat;
|
return flat;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+7
-13
@@ -1622,25 +1622,19 @@ typedef item const* ptr;
|
|||||||
for (auto& i : deep->children) {
|
for (auto& i : deep->children) {
|
||||||
// @todo Sad... now that we have templated collection members,
|
// @todo Sad... now that we have templated collection members,
|
||||||
// we can't generally use collection_base anymore as a cast target.
|
// we can't generally use collection_base anymore as a cast target.
|
||||||
if (auto s = taxonomy::dcast<taxonomy::collection>(i)) {
|
if (auto s = std::dynamic_pointer_cast<taxonomy::collection>(i)) {
|
||||||
visit<taxonomy::collection>(s, fn);
|
visit<taxonomy::collection>(s, fn);
|
||||||
}
|
} else if (auto s = std::dynamic_pointer_cast<taxonomy::loop>(i)) {
|
||||||
else if (auto s = taxonomy::dcast<taxonomy::loop>(i)) {
|
|
||||||
visit<taxonomy::loop>(s, fn);
|
visit<taxonomy::loop>(s, fn);
|
||||||
}
|
} else if (auto s = std::dynamic_pointer_cast<taxonomy::face>(i)) {
|
||||||
else if (auto s = taxonomy::dcast<taxonomy::face>(i)) {
|
|
||||||
visit<taxonomy::face>(s, fn);
|
visit<taxonomy::face>(s, fn);
|
||||||
}
|
} else if (auto s = std::dynamic_pointer_cast<taxonomy::shell>(i)) {
|
||||||
else if (auto s = taxonomy::dcast<taxonomy::shell>(i)) {
|
|
||||||
visit<taxonomy::shell>(s, fn);
|
visit<taxonomy::shell>(s, fn);
|
||||||
}
|
} else if (auto s = std::dynamic_pointer_cast<taxonomy::solid>(i)) {
|
||||||
else if (auto s = taxonomy::dcast<taxonomy::solid>(i)) {
|
|
||||||
visit<taxonomy::solid>(s, fn);
|
visit<taxonomy::solid>(s, fn);
|
||||||
}
|
} else if (auto s = std::dynamic_pointer_cast<taxonomy::loft>(i)) {
|
||||||
else if (auto s = taxonomy::dcast<taxonomy::loft>(i)) {
|
|
||||||
visit<taxonomy::loft>(s, fn);
|
visit<taxonomy::loft>(s, fn);
|
||||||
}
|
} else if (auto s = std::dynamic_pointer_cast<taxonomy::boolean_result>(i)) {
|
||||||
else if (auto s = taxonomy::dcast<taxonomy::boolean_result>(i)) {
|
|
||||||
visit<taxonomy::boolean_result>(s, fn);
|
visit<taxonomy::boolean_result>(s, fn);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
Reference in New Issue
Block a user