Skip to content

Commit

Permalink
Change reflection
Browse files Browse the repository at this point in the history
  • Loading branch information
adamhathcock committed Jun 20, 2024
1 parent f9cfe6c commit f019f7c
Showing 1 changed file with 24 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,31 @@ public CurveToSpeckleConverter(
/// This is the main converter when the type of curve you input or output does not matter to the caller.<br/>
/// ⚠️ If an unsupported type of Curve is input, it will be converted to NURBS.
/// </remarks>
public ICurve Convert(IRhinoCurve target) =>
target switch
public ICurve Convert(IRhinoCurve target)
{
var polyline = target.ToPolylineCurve();
if (polyline is not null)
{
return _polylineConverter.Convert(polyline);
}
var arcCurve = target.ToArcCurve();
if (arcCurve is not null)
{
return _arcCurveConverter.Convert(arcCurve);
}
var polyCurve = target.ToPolyCurve();
if (polyCurve is not null)
{
IRhinoPolyCurve polyCurve => _polyCurveConverter.Convert(polyCurve),
IRhinoArcCurve arcCurve => _arcCurveConverter.Convert(arcCurve),
IRhinoPolylineCurve polylineCurve => _polylineConverter.Convert(polylineCurve),
IRhinoLineCurve lineCurve => _lineCurveConverter.Convert(lineCurve),
_ => _nurbsCurveConverter.Convert(target.ToNurbsCurve())
};
return _polyCurveConverter.Convert(polyCurve);
}
var lineCurve = target.ToLineCurve();
if (lineCurve is not null)
{
return _lineCurveConverter.Convert(lineCurve);
}
var nurbsCurve = target.ToNurbsCurve();
return _nurbsCurveConverter.Convert(nurbsCurve);
}

Base ITypedConverter<IRhinoCurve, Base>.Convert(IRhinoCurve target) => (Base)Convert(target);
}

0 comments on commit f019f7c

Please sign in to comment.