mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-14 19:34:34 +00:00
Unify variant storage (#5118)
This commit is contained in:
@@ -1486,7 +1486,7 @@ namespace latebound_access {
|
||||
enum_type->enumeration_items().end(),
|
||||
t);
|
||||
|
||||
return set(inst, attr, IfcWrite::IfcWriteArgument::EnumerationReference(it - enum_type->enumeration_items().begin(), it->c_str()));
|
||||
return set(inst, attr, EnumerationReference(enum_type, it - enum_type->enumeration_items().begin()));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
@@ -1495,19 +1495,17 @@ namespace latebound_access {
|
||||
auto i = decl->attribute_index(attr);
|
||||
|
||||
auto attr_type = decl->attribute_by_index(i)->type_of_attribute();
|
||||
if (attr_type->as_named_type() && attr_type->as_named_type()->declared_type()->as_enumeration_type() && !std::is_same<T, IfcWrite::IfcWriteArgument::EnumerationReference>::value) {
|
||||
if (attr_type->as_named_type() && attr_type->as_named_type()->declared_type()->as_enumeration_type() && !std::is_same<T, EnumerationReference>::value) {
|
||||
set_enumeration(inst, attr, attr_type->as_named_type()->declared_type()->as_enumeration_type(), t);
|
||||
} else {
|
||||
IfcWrite::IfcWriteArgument* a = new IfcWrite::IfcWriteArgument;
|
||||
a->set(t);
|
||||
inst->data().attributes()[i] = a;
|
||||
inst->set_attribute_value(i, t);
|
||||
}
|
||||
}
|
||||
|
||||
IfcUtil::IfcBaseClass* create(IfcParse::IfcFile& f, const std::string& entity) {
|
||||
auto decl = f.schema()->declaration_by_name(entity);
|
||||
auto data = new IfcEntityInstanceData(decl);
|
||||
auto inst = f.schema()->instantiate(data);
|
||||
auto data = IfcEntityInstanceData(storage_t(decl->as_entity()->attribute_count()));
|
||||
auto inst = f.schema()->instantiate(decl, std::move(data));
|
||||
if (decl->is("IfcRoot")) {
|
||||
IfcParse::IfcGlobalId guid;
|
||||
latebound_access::set(inst, "GlobalId", (std::string) guid);
|
||||
@@ -1547,7 +1545,7 @@ void fix_quantities(IfcParse::IfcFile& f, bool no_progress, bool quiet, bool std
|
||||
auto IfcRelDefinesByProperties = f.schema()->declaration_by_name("IfcRelDefinesByProperties");
|
||||
if (element_quantities) {
|
||||
for (auto& eq : *element_quantities) {
|
||||
auto rels = eq->data().getInverse(IfcRelDefinesByProperties, -1);
|
||||
auto rels = eq->file_->getInverse(eq->id(), IfcRelDefinesByProperties, -1);
|
||||
for (auto& rel : *rels) {
|
||||
relationships.push_back(rel);
|
||||
}
|
||||
|
||||
+1
-1
Submodule src/ifcconvert/cityjson updated: ca39a6d81e...9e0bc8c2a8
@@ -471,7 +471,7 @@ struct intersection_validator {
|
||||
}
|
||||
|
||||
std::stringstream ss;
|
||||
ss << geom_object->product()->data().toString();
|
||||
geom_object->product()->toString(ss);
|
||||
auto sss = ss.str();
|
||||
std::wcout << sss.c_str() << std::endl;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user