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
+14 -17
View File
@@ -23,14 +23,14 @@ using namespace ifcopenshell::geometry;
#ifdef SCHEMA_HAS_IfcIndexedPolyCurve
taxonomy::ptr mapping::map_impl(const IfcSchema::IfcIndexedPolyCurve* inst) {
taxonomy::ptr mapping::map_impl(const IfcSchema::IfcIndexedPolyCurve& inst) {
IfcSchema::IfcCartesianPointList* point_list = inst->Points();
auto point_list = inst.Points();
std::vector< std::vector<double> > coordinates;
if (point_list->as<IfcSchema::IfcCartesianPointList2D>()) {
coordinates = point_list->as<IfcSchema::IfcCartesianPointList2D>()->CoordList();
} else if (point_list->as<IfcSchema::IfcCartesianPointList3D>()) {
coordinates = point_list->as<IfcSchema::IfcCartesianPointList3D>()->CoordList();
if (point_list.as<IfcSchema::IfcCartesianPointList2D>()) {
coordinates = point_list.as<IfcSchema::IfcCartesianPointList2D>().CoordList();
} else if (point_list.as<IfcSchema::IfcCartesianPointList3D>()) {
coordinates = point_list.as<IfcSchema::IfcCartesianPointList3D>().CoordList();
}
std::vector<taxonomy::point3::ptr> points;
@@ -50,13 +50,11 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcIndexedPolyCurve* inst) {
auto loop = taxonomy::make<taxonomy::loop>();
if(inst->Segments()) {
auto segments = *inst->Segments();
for (auto it = segments->begin(); it != segments->end(); ++it) {
auto segment = *it;
if (segment->as<IfcSchema::IfcLineIndex>()) {
IfcSchema::IfcLineIndex* line = segment->as<IfcSchema::IfcLineIndex>();
std::vector<int> indices = *line;
if(inst.Segments()) {
auto segments = inst.Segments();
for (auto& segment : *segments) {
if (auto line = segment.as<IfcSchema::IfcLineIndex>()) {
std::vector<int> indices = line;
taxonomy::point3::ptr previous;
for (std::vector<int>::const_iterator jt = indices.begin(); jt != indices.end(); ++jt) {
if (*jt < 1 || *jt > max_index) {
@@ -68,9 +66,8 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcIndexedPolyCurve* inst) {
}
previous = current;
}
} else if (segment->as<IfcSchema::IfcArcIndex>()) {
IfcSchema::IfcArcIndex* arc = segment->as<IfcSchema::IfcArcIndex>();
std::vector<int> indices = *arc;
} else if (auto arc = segment.as<IfcSchema::IfcArcIndex>()) {
std::vector<int> indices = arc;
if (indices.size() != 3) {
throw IfcParse::IfcException("Invalid IfcArcIndex encountered");
}
@@ -93,7 +90,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcIndexedPolyCurve* inst) {
Logger::Warning("Ignoring segment on", inst);
}
} else {
throw IfcParse::IfcException("Unexpected IfcIndexedPolyCurve segment of type " + segment->as<IfcUtil::IfcBaseClass>()->declaration().name());
throw IfcParse::IfcException("Unexpected IfcIndexedPolyCurve segment of type " + segment.concrete().declaration().name());
}
}
} else if (points.begin() < points.end()) {