mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-29 00:03:17 +00:00
Work towards v1.0 data model with encapsulated weak_ptr as basis for instances
This commit is contained in:
@@ -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()) {
|
||||
|
||||
Reference in New Issue
Block a user