MCPcopy Create free account
hub / github.com/IfcOpenShell/IfcOpenShell / visit_2

Function visit_2

src/ifcgeom/taxonomy.h:1649–1680  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1647
1648 template <typename T, typename U, typename Fn>
1649 void visit_2(const typename U::ptr& collection, const Fn& fn) {
1650 static_assert(std::is_same<T, taxonomy::point3>::value, "@todo Only implemented for point3");
1651 for (auto& child : collection->children) {
1652 // @todo Sad... now that we have templated collection members,
1653 // we can't generally use collection_base anymore as a cast target.
1654 if (auto col = std::dynamic_pointer_cast<taxonomy::collection>(child)) {
1655 visit_2<T, taxonomy::collection>(col, fn);
1656 } else if (auto loop = std::dynamic_pointer_cast<taxonomy::loop>(child)) {
1657 visit_2<T, taxonomy::loop>(loop, fn);
1658 } else if (auto face = std::dynamic_pointer_cast<taxonomy::face>(child)) {
1659 visit_2<T, taxonomy::face>(face, fn);
1660 } else if (auto shell = std::dynamic_pointer_cast<taxonomy::shell>(child)) {
1661 visit_2<T, taxonomy::shell>(shell, fn);
1662 } else if (auto solid = std::dynamic_pointer_cast<taxonomy::solid>(child)) {
1663 visit_2<T, taxonomy::solid>(solid, fn);
1664 } else if (auto loft = std::dynamic_pointer_cast<taxonomy::loft>(child)) {
1665 visit_2<T, taxonomy::loft>(loft, fn);
1666 } else if (auto bl = std::dynamic_pointer_cast<taxonomy::boolean_result>(child)) {
1667 visit_2<T, taxonomy::boolean_result>(bl, fn);
1668 } else if (auto pt = std::dynamic_pointer_cast<taxonomy::point3>(child)) {
1669 fn(pt);
1670 } else if (auto ed = std::dynamic_pointer_cast<taxonomy::edge>(child)) {
1671 // @todo maybe make edge a collection then as well?
1672 if (ed->start.which() == 1) {
1673 fn(boost::get<taxonomy::point3::ptr>(ed->start));
1674 }
1675 if (ed->end.which() == 1) {
1676 fn(boost::get<taxonomy::point3::ptr>(ed->end));
1677 }
1678 }
1679 }
1680 }
1681
1682 IFC_GEOM_API taxonomy::collection::ptr flatten(const taxonomy::collection::ptr& deep);
1683

Callers

nothing calls this directly

Calls 1

fnFunction · 0.85

Tested by

no test coverage detected