Skip to content

IfcNonNegativeLengthMeasure not is castable to IfcLengthMeasure #591

Open
@andyward

Description

@andyward

IfcNonNegativeLengthMeasure is defined as being of type IfcLengthMeasure which is itself an Express REAL type.

We implement IfcMeasures as value types (i.e. structs not classes). As a struct means they cannot derive from a class, only implement interfaces.

The issue this raises is that for 'derived' measures such as IfcNonNegativeLengthMeasure - which are backed by IfcLengthMeasure in the spec, (rather than a native Real/Double) - we cannot treat the NonNegative measure as a IfcLengthMeasure without special treatment, because IfcNonNegativeLengthMeasure is not a subclass of the base type.

A good example of the problem this creates is in Ifc4.3's IfcCurveSegment, where SegmentStart & SegmentLength are backed by IfcCurveMeasureSelect but have an informal proposition that only IfcLengthMeasure's should be used (not IfcParameterValue). However that will often include IfcNonNegativeLengthMeasure but a naïve type check will not be treat them as equivalent. Consequently implementing that rule will incorrectly treat NonNegative measures as invalid.

A secondary issue is that Selects such as IfcCurveMeasureSelect don't then include derived measures. The result of this is we can't parse an IfcCurveSegment using an IfcNonNegativeLengthMeasure

One solution for the first issue would be to implement a IIfcLengthMeasure that IfcLengthMeasure and all derived measures can implement - similar to how we implement Express Selects.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions