/// <summary> /// Read the <see cref="SurfaceLineEntity"/> and use the information to construct /// a <see cref="MacroStabilityInwardsSurfaceLine"/>. /// </summary> /// <param name="entity">The <see cref="SurfaceLineEntity"/> to create /// <see cref="MacroStabilityInwardsSurfaceLine"/> for.</param> /// <param name="collector">The object keeping track of read operations.</param> /// <returns>A new <see cref="MacroStabilityInwardsSurfaceLine"/>.</returns> /// <exception cref="ArgumentNullException">Thrown when any input parameter is <c>null</c>.</exception> /// <exception cref="ArgumentException">Thrown when <see cref="SurfaceLineEntity.PointsXml"/> /// of <paramref name="entity"/> is empty.</exception> /// <exception cref="InvalidEnumArgumentException">Thrown when the <paramref name="entity"/> /// contains an invalid type of characteristic point.</exception> /// <exception cref="NotSupportedException">Thrown when the <paramref name="entity"/> contains a /// characteristic point that is not supported.</exception> public static MacroStabilityInwardsSurfaceLine ReadAsMacroStabilityInwardsSurfaceLine( this SurfaceLineEntity entity, ReadConversionCollector collector) { if (entity == null) { throw new ArgumentNullException(nameof(entity)); } if (collector == null) { throw new ArgumentNullException(nameof(collector)); } if (collector.ContainsMacroStabilityInwardsSurfaceLine(entity)) { return(collector.GetMacroStabilityInwardsSurfaceLine(entity)); } var surfaceLine = new MacroStabilityInwardsSurfaceLine(entity.Name) { ReferenceLineIntersectionWorldPoint = GetReferenceLineIntersectionWorldPoint(entity) }; surfaceLine.SetGeometry(ReadGeometryPoints(entity.PointsXml)); entity.ReadCharacteristicPoints(surfaceLine); collector.Read(entity, surfaceLine); return(surfaceLine); }