Esempio n. 1
0
 private bool Equals(PipingSoilLayer other)
 {
     return(string.Equals(materialName, other.materialName) &&
            Top.Equals(other.Top) &&
            IsAquifer == other.IsAquifer &&
            BelowPhreaticLevel.Equals(other.BelowPhreaticLevel) &&
            DiameterD70.Equals(other.DiameterD70) &&
            Permeability.Equals(other.Permeability) &&
            Color.ToArgb().Equals(other.Color.ToArgb()));
 }
Esempio n. 2
0
        /// <summary>
        /// Gets the thickness of the given layer in the <see cref="PipingSoilProfile"/>.
        /// Thickness of a layer is determined by its top and the top of the layer below it.
        /// </summary>
        /// <param name="layer">The <see cref="PipingSoilLayer"/> to determine the thickness of.</param>
        /// <returns>The thickness of the <paramref name="layer"/>.</returns>
        /// <exception cref="ArgumentException"><see cref="Layers"/> does not contain <paramref name="layer"/>.</exception>
        public double GetLayerThickness(PipingSoilLayer layer)
        {
            IEnumerable <PipingSoilLayer> layersOrderedByTopAscending = layers.Reverse();
            double previousLevel = Bottom;

            foreach (PipingSoilLayer oLayer in layersOrderedByTopAscending)
            {
                if (ReferenceEquals(layer, oLayer))
                {
                    return(layer.Top - previousLevel);
                }

                previousLevel = oLayer.Top;
            }

            throw new ArgumentException("Layer not found in profile.");
        }