예제 #1
0
        /// <summary>
        /// Converts <see cref="MacroStabilityInwardsSoilLayer2D"/> objects into <see cref="SoilLayer"/> objects.
        /// </summary>
        /// <param name="layers">The layers to convert.</param>
        /// <returns>The converted <see cref="SoilLayer"/>.</returns>
        /// <exception cref="InvalidEnumArgumentException">Thrown when
        /// <see cref="MacroStabilityInwardsSoilLayerData.ShearStrengthModel"/>
        /// is an invalid value.</exception>
        /// <exception cref="NotSupportedException">Thrown when
        /// <see cref="MacroStabilityInwardsSoilLayerData.ShearStrengthModel"/>
        /// is a valid value, but unsupported.</exception>
        private static IEnumerable <SoilLayer> ConvertLayers(IEnumerable <MacroStabilityInwardsSoilLayer2D> layers)
        {
            return(layers.Select(l =>
            {
                MacroStabilityInwardsSoilLayerData data = l.Data;

                return new SoilLayer(RingToPoints(l.OuterRing),
                                     new SoilLayer.ConstructionProperties
                {
                    MaterialName = SoilLayerDataHelper.GetValidName(data.MaterialName),
                    UsePop = data.UsePop,
                    IsAquifer = data.IsAquifer,
                    ShearStrengthModel = ConvertShearStrengthModel(data.ShearStrengthModel),
                    AbovePhreaticLevel = MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetAbovePhreaticLevel(data).GetDesignValue(),
                    BelowPhreaticLevel = MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetBelowPhreaticLevel(data).GetDesignValue(),
                    Cohesion = MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetCohesion(data).GetDesignValue(),
                    FrictionAngle = MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetFrictionAngle(data).GetDesignValue(),
                    ShearStrengthRatio = MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetShearStrengthRatio(data).GetDesignValue(),
                    StrengthIncreaseExponent = MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetStrengthIncreaseExponent(data).GetDesignValue(),
                    Pop = MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetPop(data).GetDesignValue(),
                    Dilatancy = 0.0,
                    WaterPressureInterpolationModel = WaterPressureInterpolationModel.Automatic
                },
                                     ConvertLayers(l.NestedLayers));
            }).ToArray());
        }
예제 #2
0
        public void GetValidColor_ColorEmpty_ReturnColorWhite()
        {
            // Call
            Color validColor = SoilLayerDataHelper.GetValidColor(Color.Empty);

            // Assert
            Assert.AreEqual(Color.White, validColor);
        }
예제 #3
0
        public void GetValidName_InvalidName_ReturnValidName(string invalidName)
        {
            // Call
            string validName = SoilLayerDataHelper.GetValidName(invalidName);

            // Assert
            Assert.AreEqual("Onbekend", validName);
        }
예제 #4
0
        public void GetValidName_ValidName_ReturnName()
        {
            // Setup
            const string name = "Test";

            // Call
            string validName = SoilLayerDataHelper.GetValidName(name);

            // Assert
            Assert.AreEqual(name, validName);
        }
예제 #5
0
        public void GetValidColor_ValidColor_ReturnColor()
        {
            // Setup
            var   random = new Random(21);
            Color color  = Color.FromKnownColor(random.NextEnumValue <KnownColor>());

            // Call
            Color validColor = SoilLayerDataHelper.GetValidColor(color);

            // Assert
            Assert.AreEqual(color, validColor);
        }
예제 #6
0
 public FormattedPipingSoilLayerRow(PipingSoilLayer layer)
 {
     MaterialName     = SoilLayerDataHelper.GetValidName(layer.MaterialName);
     Color            = SoilLayerDataHelper.GetValidColor(layer.Color);
     Top              = new RoundedDouble(2, layer.Top);
     IsAquifer        = layer.IsAquifer;
     PermeabilityMean = layer.Permeability.Mean;
     PermeabilityCoefficientOfVariation = layer.Permeability.CoefficientOfVariation;
     DiameterD70Mean = layer.DiameterD70.Mean;
     DiameterD70CoefficientOfVariation = layer.DiameterD70.CoefficientOfVariation;
     BelowPhreaticLevelMean            = layer.BelowPhreaticLevel.Mean;
     BelowPhreaticLevelDeviation       = layer.BelowPhreaticLevel.StandardDeviation;
     BelowPhreaticLevelShift           = layer.BelowPhreaticLevel.Shift;
 }
예제 #7
0
        /// <summary>
        /// Create <see cref="ChartMultipleAreaData"/> for a <see cref="PipingSoilLayer"/> based
        /// on its name and fill color.
        /// </summary>
        /// <param name="layer">The layer to create the <see cref="ChartMultipleAreaData"/> for.</param>
        /// <returns>The created <see cref="ChartMultipleAreaData"/>.</returns>
        /// <exception cref="ArgumentNullException">Thrown when <paramref name="layer"/> is <c>null</c>.</exception>
        public static ChartMultipleAreaData CreateSoilLayerChartData(PipingSoilLayer layer)
        {
            if (layer == null)
            {
                throw new ArgumentNullException(nameof(layer));
            }

            return(new ChartMultipleAreaData(SoilLayerDataHelper.GetValidName(layer.MaterialName),
                                             new ChartAreaStyle
            {
                FillColor = SoilLayerDataHelper.GetValidColor(layer.Color),
                StrokeColor = Color.Black,
                StrokeThickness = 1
            }));
        }
        /// <summary>
        /// Create <see cref="ChartMultipleAreaData"/> for a <see cref="MacroStabilityInwardsSoilLayer2D"/>.
        /// </summary>
        /// <param name="layer">The layer to create the <see cref="ChartMultipleAreaData"/> for.</param>
        /// <returns>The created <see cref="ChartMultipleAreaData"/>.</returns>
        /// <exception cref="ArgumentNullException">Thrown when <paramref name="layer"/> is <c>null</c>.</exception>
        public static ChartMultipleAreaData CreateSoilLayerChartData(MacroStabilityInwardsSoilLayer2D layer)
        {
            if (layer == null)
            {
                throw new ArgumentNullException(nameof(layer));
            }

            MacroStabilityInwardsSoilLayerData data = layer.Data;

            return(new ChartMultipleAreaData(SoilLayerDataHelper.GetValidName(data.MaterialName),
                                             new ChartAreaStyle
            {
                FillColor = SoilLayerDataHelper.GetValidColor(data.Color),
                StrokeColor = Color.Black,
                StrokeThickness = 1
            }));
        }
예제 #9
0
        /// <summary>
        /// Creates a new instance of <see cref="MacroStabilityInwardsFormattedSoilLayerDataRow"/>.
        /// </summary>
        /// <param name="layerData">The <see cref="MacroStabilityInwardsSoilLayerData"/> to format.</param>
        /// <exception cref="ArgumentNullException">Thrown when <paramref name="layerData"/>
        /// is <c>null</c>.</exception>
        public MacroStabilityInwardsFormattedSoilLayerDataRow(MacroStabilityInwardsSoilLayerData layerData)
        {
            if (layerData == null)
            {
                throw new ArgumentNullException(nameof(layerData));
            }

            MaterialName             = SoilLayerDataHelper.GetValidName(layerData.MaterialName);
            Color                    = SoilLayerDataHelper.GetValidColor(layerData.Color);
            IsAquifer                = layerData.IsAquifer;
            AbovePhreaticLevel       = FormatVariationCoefficientDesignVariableWithShift(MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetAbovePhreaticLevel(layerData));
            BelowPhreaticLevel       = FormatVariationCoefficientDesignVariableWithShift(MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetBelowPhreaticLevel(layerData));
            ShearStrengthModel       = layerData.ShearStrengthModel;
            Cohesion                 = FormatVariationCoefficientDesignVariable(MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetCohesion(layerData));
            FrictionAngle            = FormatVariationCoefficientDesignVariable(MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetFrictionAngle(layerData));
            ShearStrengthRatio       = FormatVariationCoefficientDesignVariable(MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetShearStrengthRatio(layerData));
            StrengthIncreaseExponent = FormatVariationCoefficientDesignVariable(MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetStrengthIncreaseExponent(layerData));
            UsePop                   = layerData.UsePop;
            Pop = FormatVariationCoefficientDesignVariable(MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetPop(layerData));
        }