IfcGeomIterator: optimize filtering by performing it prior to geometry reuse inspections.

Improves the iteration speed immensely, especially on very large files when only a fraction of the content is wanted to be converted.
This commit is contained in:
Stinkfist0
2018-08-21 13:52:09 +03:00
committed by Thomas Krijnen
parent 58759cf365
commit fbc0215ef1
+12 -8
View File
@@ -416,6 +416,18 @@ namespace IfcGeom {
if (!ifcproducts) {
ifcproducts = IfcSchema::IfcProduct::list::ptr(new IfcSchema::IfcProduct::list);
IfcSchema::IfcProduct::list::ptr unfiltered_products = kernel.products_represented_by(representation);
// Filter the products based on the set of entities and/or names being included or excluded for processing.
for (IfcSchema::IfcProduct::list::it jt = unfiltered_products->begin(); jt != unfiltered_products->end(); ++jt) {
IfcSchema::IfcProduct* prod = *jt;
if (boost::all(filters_, filter_match(prod))) {
ifcproducts->push(prod);
}
}
if (ifcproducts->size() == 0) {
_nextShape();
continue;
}
geometry_reuse_ok_for_current_representation_ = reuse_ok_(unfiltered_products);
@@ -450,14 +462,6 @@ namespace IfcGeom {
continue;
}
// Filter the products based on the set of entities and/or names being included or excluded for processing.
for (IfcSchema::IfcProduct::list::it jt = unfiltered_products->begin(); jt != unfiltered_products->end(); ++jt) {
IfcSchema::IfcProduct* prod = *jt;
if (boost::all(filters_, filter_match(prod))) {
ifcproducts->push(prod);
}
}
ifcproduct_iterator = ifcproducts->begin();
}