/// <summary> /// Read the <see cref="SurfaceLineEntity"/> and use the information to construct /// a <see cref="PipingSurfaceLine"/>. /// </summary> /// <param name="entity">The <see cref="SurfaceLineEntity"/> to create /// <see cref="PipingSurfaceLine"/> for.</param> /// <param name="collector">The object keeping track of read operations.</param> /// <returns>A new <see cref="PipingSurfaceLine"/>.</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 PipingSurfaceLine ReadAsPipingSurfaceLine(this SurfaceLineEntity entity, ReadConversionCollector collector) { if (entity == null) { throw new ArgumentNullException(nameof(entity)); } if (collector == null) { throw new ArgumentNullException(nameof(collector)); } if (collector.ContainsPipingSurfaceLine(entity)) { return(collector.GetPipingSurfaceLine(entity)); } var surfaceLine = new PipingSurfaceLine(entity.Name) { ReferenceLineIntersectionWorldPoint = GetReferenceLineIntersectionWorldPoint(entity) }; surfaceLine.SetGeometry(ReadGeometryPoints(entity.PointsXml)); entity.ReadCharacteristicPoints(surfaceLine); collector.Read(entity, surfaceLine); return(surfaceLine); }