mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 17:31:45 +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) {
|
||||
auto flat = make<taxonomy::collection>();
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
+7
-13
@@ -1622,25 +1622,19 @@ typedef item const* ptr;
|
||||
for (auto& i : deep->children) {
|
||||
// @todo Sad... now that we have templated collection members,
|
||||
// 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);
|
||||
}
|
||||
else if (auto s = taxonomy::dcast<taxonomy::loop>(i)) {
|
||||
} else if (auto s = std::dynamic_pointer_cast<taxonomy::loop>(i)) {
|
||||
visit<taxonomy::loop>(s, fn);
|
||||
}
|
||||
else if (auto s = taxonomy::dcast<taxonomy::face>(i)) {
|
||||
} else if (auto s = std::dynamic_pointer_cast<taxonomy::face>(i)) {
|
||||
visit<taxonomy::face>(s, fn);
|
||||
}
|
||||
else if (auto s = taxonomy::dcast<taxonomy::shell>(i)) {
|
||||
} else if (auto s = std::dynamic_pointer_cast<taxonomy::shell>(i)) {
|
||||
visit<taxonomy::shell>(s, fn);
|
||||
}
|
||||
else if (auto s = taxonomy::dcast<taxonomy::solid>(i)) {
|
||||
} else if (auto s = std::dynamic_pointer_cast<taxonomy::solid>(i)) {
|
||||
visit<taxonomy::solid>(s, fn);
|
||||
}
|
||||
else if (auto s = taxonomy::dcast<taxonomy::loft>(i)) {
|
||||
} else if (auto s = std::dynamic_pointer_cast<taxonomy::loft>(i)) {
|
||||
visit<taxonomy::loft>(s, fn);
|
||||
}
|
||||
else if (auto s = taxonomy::dcast<taxonomy::boolean_result>(i)) {
|
||||
} else if (auto s = std::dynamic_pointer_cast<taxonomy::boolean_result>(i)) {
|
||||
visit<taxonomy::boolean_result>(s, fn);
|
||||
}
|
||||
else {
|
||||
|
||||
Reference in New Issue
Block a user