Work towards v1.0 data model with encapsulated weak_ptr as basis for instances

This commit is contained in:
Thomas Krijnen
2026-01-04 10:40:02 +01:00
parent f09ca658f1
commit 7098beb819
210 changed files with 28269 additions and 26471 deletions
+18 -18
View File
@@ -21,45 +21,45 @@
#define mapping POSTFIX_SCHEMA(mapping)
using namespace ifcopenshell::geometry;
taxonomy::ptr mapping::map_impl(const IfcSchema::IfcObjectPlacement* inst) {
const IfcSchema::IfcObjectPlacement* relative_to = nullptr;
const IfcUtil::IfcBaseInterface* transform;
taxonomy::ptr mapping::map_impl(const IfcSchema::IfcObjectPlacement& inst) {
IfcSchema::IfcObjectPlacement relative_to;
express::Base transform;
const IfcSchema::IfcAxis2Placement3D* fallback = nullptr;
IfcSchema::IfcAxis2Placement3D fallback;
if (inst->as<IfcSchema::IfcLocalPlacement>()) {
transform = inst->as<IfcSchema::IfcLocalPlacement>()->RelativePlacement();
if (inst.as<IfcSchema::IfcLocalPlacement>()) {
transform = inst.as<IfcSchema::IfcLocalPlacement>().RelativePlacement();
}
#ifdef SCHEMA_HAS_IfcLinearPlacement
else if (inst->as<IfcSchema::IfcLinearPlacement>()) {
else if (inst.as<IfcSchema::IfcLinearPlacement>()) {
#ifdef SCHEMA_IfcLinearPlacement_HAS_RelativePlacement
transform = inst->as<IfcSchema::IfcLinearPlacement>()->RelativePlacement();
fallback = inst->as<IfcSchema::IfcLinearPlacement>()->CartesianPosition();
transform = inst.as<IfcSchema::IfcLinearPlacement>().RelativePlacement();
fallback = inst.as<IfcSchema::IfcLinearPlacement>().CartesianPosition();
#else
// @todo Ifc4x1 and Ifc4x2 don't have RelativePlacement
return nullptr;
#endif
}
#endif
else if (inst->as<IfcSchema::IfcGridPlacement>()) {
else if (inst.as<IfcSchema::IfcGridPlacement>()) {
// @todo a bit harder to map without kernel
return nullptr;
}
#ifdef SCHEMA_IfcObjectPlacement_HAS_PlacementRelTo
relative_to = inst->PlacementRelTo();
relative_to = inst.PlacementRelTo();
#else
if (inst->as<IfcSchema::IfcLocalPlacement>()) {
relative_to = inst->as<IfcSchema::IfcLocalPlacement>()->PlacementRelTo();
if (inst.as<IfcSchema::IfcLocalPlacement>()) {
relative_to = inst.as<IfcSchema::IfcLocalPlacement>()->PlacementRelTo();
}
#endif
bool parent_placement_ignored = false;
if (relative_to && (placement_rel_to_type_ || placement_rel_to_instance_)) {
IfcSchema::IfcProduct::list::ptr parent_places = relative_to->PlacesObject();
for (auto iter = parent_places->begin(); iter != parent_places->end(); ++iter) {
if ((placement_rel_to_type_ && (*iter)->declaration().is(*placement_rel_to_type_)) ||
(placement_rel_to_instance_ && (*iter)->as<IfcUtil::IfcBaseEntity>() == placement_rel_to_instance_)) {
std::vector<IfcSchema::IfcProduct> parent_places = relative_to.PlacesObject();
for (auto& pp : parent_places) {
if ((placement_rel_to_type_ && pp.declaration().is(*placement_rel_to_type_)) ||
(placement_rel_to_instance_ && pp == placement_rel_to_instance_)) {
parent_placement_ignored = true;
}
}
@@ -108,7 +108,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcObjectPlacement* inst) {
/*
// @todo
if (gridp = inst->as<IfcSchema::IfcGridPlacement>()) {
if (gridp = inst.as<IfcSchema::IfcGridPlacement>()) {
gp_Trsf grid_position;
auto axes = gridp->PlacementLocation()->IntersectingAxes();