mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-22 01:20:52 +00:00
Reapply skip type bitmap after field reordering changes
This commit is contained in:
@@ -112,6 +112,7 @@ private:
|
|||||||
std::vector<bool> types_to_bypass_materialized_;
|
std::vector<bool> types_to_bypass_materialized_;
|
||||||
|
|
||||||
void initialize_header();
|
void initialize_header();
|
||||||
|
void materialize_bypass_types();
|
||||||
spf_header& ensure_header();
|
spf_header& ensure_header();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|||||||
+23
-15
@@ -1938,6 +1938,27 @@ spf_header& ifcopenshell::instance_streamer<Reader>::ensure_header() {
|
|||||||
return *owned_header_;
|
return *owned_header_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename Reader>
|
||||||
|
void ifcopenshell::instance_streamer<Reader>::materialize_bypass_types() {
|
||||||
|
if (!schema_) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
types_to_bypass_materialized_.assign(schema_->declarations().size(), false);
|
||||||
|
for (auto& bp : types_to_bypass_) {
|
||||||
|
std::function<void(const ifcopenshell::entity*)> mark;
|
||||||
|
mark = [&](const ifcopenshell::entity* e) {
|
||||||
|
types_to_bypass_materialized_[e->index_in_schema()] = true;
|
||||||
|
for (auto& subtype : e->subtypes()) {
|
||||||
|
mark(subtype);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
if (auto* e = bp->as_entity()) {
|
||||||
|
mark(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
template <typename Reader>
|
template <typename Reader>
|
||||||
void ifcopenshell::instance_streamer<Reader>::initialize_header() {
|
void ifcopenshell::instance_streamer<Reader>::initialize_header() {
|
||||||
storage_.file = owner_;
|
storage_.file = owner_;
|
||||||
@@ -1959,21 +1980,7 @@ void ifcopenshell::instance_streamer<Reader>::initialize_header() {
|
|||||||
|
|
||||||
storage_.schema = schema_;
|
storage_.schema = schema_;
|
||||||
|
|
||||||
if (schema_) {
|
materialize_bypass_types();
|
||||||
types_to_bypass_materialized_.resize(schema_->declarations().size(), false);
|
|
||||||
for (auto& bp : types_to_bypass_) {
|
|
||||||
std::function<void(const ifcopenshell::entity*)> mark;
|
|
||||||
mark = [&](const ifcopenshell::entity* e) {
|
|
||||||
types_to_bypass_materialized_[e->index_in_schema()] = true;
|
|
||||||
for (auto& subtype : e->subtypes()) {
|
|
||||||
mark(subtype);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
if (auto* e = bp->as_entity()) {
|
|
||||||
mark(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Reader>
|
template <typename Reader>
|
||||||
@@ -2132,6 +2139,7 @@ void ifcopenshell::instance_streamer<Reader>::bypass_types(const std::set<std::s
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
materialize_bypass_types();
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Reader>
|
template <typename Reader>
|
||||||
|
|||||||
@@ -25,3 +25,13 @@ TEST_CASE("IfcPropertySetDefinitionSet references are resolved without replacing
|
|||||||
CHECK(definitions[0].id() == 136);
|
CHECK(definitions[0].id() == 136);
|
||||||
CHECK(definitions[1].id() == 138);
|
CHECK(definitions[1].id() == 138);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_CASE("Bypassed entity types include their subtypes", "[ifcparse]") {
|
||||||
|
const std::string fixture = std::string(IFCOPENSHELL_TEST_FIXTURES) + "/ColumnPSetsOfSets.ifc";
|
||||||
|
ifcopenshell::file file(ifcopenshell::uninitialized_tag{});
|
||||||
|
file.bypass_type("IfcRepresentationItem");
|
||||||
|
|
||||||
|
REQUIRE(file.initialize(fixture));
|
||||||
|
CHECK(file.instances_by_type("IfcRepresentationItem").empty());
|
||||||
|
CHECK(file.instances_by_type("IfcCartesianPoint").empty());
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user