@@ -42,13 +42,15 @@ namespace IfcGeom
4242
4343 struct filter
4444 {
45- filter () : include(false ), traverse(false ) {}
46- filter (bool incl, bool trav) : include(incl), traverse(trav) {}
45+ filter () : include(false ), traverse(false ), traverse_openings( false ) {}
46+ filter (bool incl, bool trav, bool trav_openings = false ) : include(incl), traverse(trav), traverse_openings(trav_openings ) {}
4747 // / Should the product be included (true) or excluded (false).
4848 bool include;
4949 // / If traversal requested, traverse to the parents to see if they satisfy the criteria. E.g. we might be looking for
5050 // / children of a storey named "Level 20", or children of entities that have no representation, e.g. IfcCurtainWall.
5151 bool traverse;
52+ // / Include opening relationships as part of traversal.
53+ bool traverse_openings;
5254 // / Optional description for the filtering criteria of this filter.
5355 std::string description;
5456
@@ -61,10 +63,10 @@ namespace IfcGeom
6163 return is_match == include;
6264 }
6365
64- static bool traverse_match (IfcSchema::IfcProduct* prod, const filter_t & pred)
66+ bool traverse_match (IfcSchema::IfcProduct* prod, const filter_t & pred) const
6567 {
6668 IfcSchema::IfcProduct* parent, *current = prod;
67- while ((parent = dynamic_cast <IfcSchema::IfcProduct*>(IfcGeom::Kernel::get_decomposing_entity (current))) != 0 ) {
69+ while ((parent = dynamic_cast <IfcSchema::IfcProduct*>(IfcGeom::Kernel::get_decomposing_entity (current, traverse_openings ))) != 0 ) {
6870 if (pred (parent)) {
6971 return true ;
7072 }
@@ -248,11 +250,9 @@ namespace IfcGeom
248250 struct entity_filter : public filter
249251 {
250252 entity_filter () {}
251- entity_filter (bool include, bool traverse/* , const std::set<std::string>& types */ )
253+ entity_filter (bool include, bool traverse)
252254 : filter(include, traverse)
253- {
254- // populate(types);
255- }
255+ {}
256256
257257 std::set<IfcSchema::Type::Enum> values;
258258
0 commit comments