/// <summary> /// Creates a new instance of a <see cref="IllustrationPointBase"/> based on the /// <paramref name="data"/>. /// </summary> /// <param name="data">The <see cref="HydraRingIIllustrationPoint"/> to base the /// <see cref="IllustrationPointBase"/> to create on.</param> /// <returns>A <see cref="IllustrationPointBase"/>.</returns> /// <exception cref="IllustrationPointConversionException">Thrown when <paramref name="data"/> /// could not be converted.</exception> /// <exception cref="NotSupportedException">Thrown when no suitable conversion for <paramref name="data"/> /// was found.</exception> private static IllustrationPointBase ConvertIllustrationPointTreeNodeData(HydraRingIIllustrationPoint data) { var faultTreeIllustrationPoint = data as HydraRingFaultTreeIllustrationPoint; if (faultTreeIllustrationPoint != null) { return(FaultTreeIllustrationPointConverter.Convert(faultTreeIllustrationPoint)); } var subMechanismIllustrationPoint = data as HydraRingSubMechanismIllustrationPoint; if (subMechanismIllustrationPoint != null) { return(SubMechanismIllustrationPointConverter.Convert(subMechanismIllustrationPoint)); } throw new NotSupportedException($"Cannot convert {data.GetType()}."); }
/// <summary> /// Creates a new instance of <see cref="TopLevelSubMechanismIllustrationPoint"/> /// based on the information of <paramref name="hydraRingWindDirectionClosingSituation"/> /// and <paramref name="hydraRingSubMechanismIllustrationPoint"/>. /// </summary> /// <param name="hydraRingWindDirectionClosingSituation">The <see cref="HydraRingWindDirectionClosingSituation"/> /// to base the <see cref="TopLevelSubMechanismIllustrationPoint"/> on.</param> /// <param name="hydraRingSubMechanismIllustrationPoint">The <see cref="HydraRingSubMechanismIllustrationPoint"/> /// to base the <see cref="TopLevelSubMechanismIllustrationPoint"/> on.</param> /// <returns>A <see cref="TopLevelSubMechanismIllustrationPoint"/>.</returns> /// <exception cref="ArgumentNullException">Thrown when any parameter is <c>null</c>.</exception> public static TopLevelSubMechanismIllustrationPoint Convert(HydraRingWindDirectionClosingSituation hydraRingWindDirectionClosingSituation, HydraRingSubMechanismIllustrationPoint hydraRingSubMechanismIllustrationPoint) { if (hydraRingWindDirectionClosingSituation == null) { throw new ArgumentNullException(nameof(hydraRingWindDirectionClosingSituation)); } if (hydraRingSubMechanismIllustrationPoint == null) { throw new ArgumentNullException(nameof(hydraRingSubMechanismIllustrationPoint)); } WindDirection windDirection = WindDirectionConverter.Convert(hydraRingWindDirectionClosingSituation.WindDirection); SubMechanismIllustrationPoint subMechanismIllustrationPoint = SubMechanismIllustrationPointConverter.Convert(hydraRingSubMechanismIllustrationPoint); return(new TopLevelSubMechanismIllustrationPoint(windDirection, hydraRingWindDirectionClosingSituation.ClosingSituation, subMechanismIllustrationPoint)); }