コード例 #1
0
        /// <summary>
        /// Reads the <see cref="StochasticSoilModelEntity"/> and use the information to construct
        /// a <see cref="MacroStabilityInwardsStochasticSoilModel"/>.
        /// </summary>
        /// <param name="entity">The <see cref="StochasticSoilModelEntity"/> to create <see cref="MacroStabilityInwardsStochasticSoilModel"/> for.</param>
        /// <param name="collector">The object keeping track of read operations.</param>
        /// <returns>A new <see cref="MacroStabilityInwardsStochasticSoilModel"/>.</returns>
        /// <exception cref="ArgumentNullException">Thrown when any input parameter is <c>null</c>.</exception>
        /// <exception cref="ArgumentException">Thrown when <see cref="StochasticSoilModelEntity.StochasticSoilModelSegmentPointXml"/>
        /// of <paramref name="entity"/> is empty.</exception>
        public static MacroStabilityInwardsStochasticSoilModel ReadAsMacroStabilityInwardsStochasticSoilModel(this StochasticSoilModelEntity entity,
                                                                                                              ReadConversionCollector collector)
        {
            if (entity == null)
            {
                throw new ArgumentNullException(nameof(entity));
            }

            if (collector == null)
            {
                throw new ArgumentNullException(nameof(collector));
            }

            if (collector.ContainsMacroStabilityInwardsStochasticSoilModel(entity))
            {
                return(collector.GetMacroStabilityInwardsStochasticSoilModel(entity));
            }

            Point2D[] geometry = ReadSegmentPoints(entity.StochasticSoilModelSegmentPointXml).ToArray();
            MacroStabilityInwardsStochasticSoilProfile[] stochasticSoilProfiles = entity.ReadMacroStabilityInwardsStochasticSoilProfiles(collector)
                                                                                  .ToArray();
            var model = new MacroStabilityInwardsStochasticSoilModel(entity.Name, geometry, stochasticSoilProfiles);

            collector.Read(entity, model);

            return(model);
        }