// Copyright (C) Stichting Deltares 2024. All rights reserved.
//
// This file is part of the Dam Engine.
//
// The Dam Engine is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see .
//
// All names, logos, and references to "Deltares" are registered trademarks of
// Stichting Deltares and remain full property of Stichting Deltares at all times.
// All rights reserved.
using System;
using Deltares.DamEngine.Data.Geotechnics;
namespace Deltares.DamEngine.Data.General;
///
/// Class holding the soilprofile (either 1D or 2D) and its probability
///
public class SoilGeometryProbability
{
///
/// Gets or sets the name of the soil profile 1D.
///
///
/// The name of the soil profile 1D.
///
public virtual string SoilProfile1DName { get; set; }
///
/// Gets or sets the soil profile 1D.
///
///
/// The soil profile 1D.
///
public virtual SoilProfile1D SoilProfile1D { get; set; }
///
/// Gets or sets the name of the soil profile 2D.
///
///
/// The name of the soil profile 2D.
///
public virtual string SoilProfile2DName { get; set; }
///
/// Gets or sets the soil profile 2D.
///
///
/// The soil profile 2D.
///
public virtual SoilProfile2D SoilProfile2D { get; set; }
///
/// Gets or sets the type of the segment failure mechanism.
///
///
/// The type of the segment failure mechanism.
///
public virtual SegmentFailureMechanismType? SegmentFailureMechanismType { get; set; }
///
/// Gets or sets the probability of occurrence; number between 0.0 and 100.0.
///
///
/// The probability.
///
public virtual double Probability { get; set; }
///
/// Gets the type of the soil geometry.
///
///
/// The type of the soil geometry.
///
public SoilProfileType SoilProfileType { get; set; }
///
/// Determines the soilProfile1D at x coordinate, regardless of the soil profile type (1D or 2D).
///
/// The x coordinate.
///
///
///
///
public SoilProfile1D DetermineSoilProfile1DAtX(double xCoordinate, SurfaceLine2 surfaceLine, Soil dikeEmbankmentMaterial)
{
SoilProfile1D soilProfile1D;
switch (SoilProfileType)
{
case SoilProfileType.ProfileType1D:
soilProfile1D = SoilProfileHelper.DetermineForSurfaceLineCorrected1DProfileAtX(SoilProfile1D, surfaceLine, xCoordinate, dikeEmbankmentMaterial);
break;
case SoilProfileType.ProfileType2D:
soilProfile1D = SoilProfile2D.GetSoilProfile1D(xCoordinate);
break;
default:
throw new NotSupportedException($"{SoilProfileType} not supported");
}
return soilProfile1D;
}
///
/// Returns a that represents this instance.
///
///
/// A that represents this instance.
///
public override string ToString()
{
var name = SoilProfileType switch
{
SoilProfileType.ProfileType1D => SoilProfile1D != null ? SoilProfile1D.Name : SoilProfile1DName ?? "",
SoilProfileType.ProfileType2D => SoilProfile2D != null ? SoilProfile2D.Name : SoilProfile2DName ?? "",
_ => ""
};
return name;
}
}