mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-16 18:44:47 +00:00
Work towards v1.0 data model with encapsulated weak_ptr as basis for instances
This commit is contained in:
@@ -25,17 +25,17 @@ using namespace ifcopenshell::geometry;
|
||||
|
||||
#ifdef SCHEMA_HAS_IfcSegmentedReferenceCurve
|
||||
|
||||
taxonomy::ptr mapping::map_impl(const IfcSchema::IfcSegmentedReferenceCurve* inst) {
|
||||
if (!inst->BaseCurve()->as<IfcSchema::IfcGradientCurve>())
|
||||
taxonomy::ptr mapping::map_impl(const IfcSchema::IfcSegmentedReferenceCurve& inst) {
|
||||
if (!inst.BaseCurve().as<IfcSchema::IfcGradientCurve>())
|
||||
Logger::Warning("Expected IfcSegmentedReferenceCurve.BaseCurve to be IfcGradient", inst); // CT 4.1.7.1.1.3
|
||||
|
||||
auto segments = inst->Segments();
|
||||
auto segments = inst.Segments();
|
||||
|
||||
taxonomy::piecewise_function::spans_t spans;
|
||||
for (auto& segment : *segments) {
|
||||
if (segment->as<IfcSchema::IfcCurveSegment>()) {
|
||||
for (auto& segment : segments) {
|
||||
if (auto cseg = segment.as<IfcSchema::IfcCurveSegment>()) {
|
||||
// @todo check that we don't get a mixture of implicit and explicit definitions
|
||||
auto crv = map(segment->as<IfcSchema::IfcCurveSegment>());
|
||||
auto crv = map(cseg);
|
||||
if (auto fi = taxonomy::dcast<taxonomy::function_item>(crv); crv && fi /*crv->kind() == taxonomy::FUNCTION_ITEM*/) {
|
||||
// crv->kind() is polymorphic and the kind of the actual function_item is returned. PWF can have spans of any FUNCTION_ITEM
|
||||
// for this reason, a dynamic cast is used and if crv is a function_item it is added to the span
|
||||
@@ -52,10 +52,10 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcSegmentedReferenceCurve* ins
|
||||
|
||||
// Get starting position of cant curve, relative to the gradient curve.
|
||||
// The cant curve can start before or after the start of the gradient curve
|
||||
auto first_segment = *(segments->begin());
|
||||
auto& first_segment = segments.front();
|
||||
taxonomy::matrix4::ptr p;
|
||||
#ifdef SCHEMA_IfcCurveSegment_HAS_Placement
|
||||
p = taxonomy::cast<taxonomy::matrix4>(map(first_segment->as<IfcSchema::IfcCurveSegment>()->Placement()));
|
||||
p = taxonomy::cast<taxonomy::matrix4>(map(first_segment.as<IfcSchema::IfcCurveSegment>().Placement()));
|
||||
#else
|
||||
throw std::runtime_error("Unsupported schema");
|
||||
#endif
|
||||
@@ -63,7 +63,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcSegmentedReferenceCurve* ins
|
||||
double cant_start = m(0, 3); // start of cant curve
|
||||
|
||||
auto cant = taxonomy::make<taxonomy::piecewise_function>(cant_start,spans);
|
||||
auto gradient = taxonomy::cast<taxonomy::gradient_function>(map(inst->BaseCurve()));
|
||||
auto gradient = taxonomy::cast<taxonomy::gradient_function>(map(inst.BaseCurve()));
|
||||
|
||||
auto cant_function = taxonomy::make<taxonomy::cant_function>(gradient, cant, inst);
|
||||
if (!(0 < cant_function->length())) {
|
||||
|
||||
Reference in New Issue
Block a user