using System;
using System.ComponentModel;
using Deltares.Geotechnics;
using Deltares.Standard;
using Deltares.Standard.Attributes;
using Deltares.Standard.EventPublisher;
using Deltares.Standard.Extensions;
using Deltares.Standard.Language;
using Deltares.Standard.Units;
using Deltares.Standard.Validation;
namespace Deltares.DeltaModel
{
///
/// Basic material description.
///
public class BlockRevetmentMaterial : IVisibleEnabled, IName, ICloneable
{
private ClayPosition clayPosition;
private double diameterD15 = double.NaN;
private double diameterD50 = double.NaN;
private double diameterD90 = double.NaN;
private MaterialType materialType;
private string name = string.Empty;
private double permeabKx = double.NaN;
private double porosity;
public BlockRevetmentMaterial()
{
ShowMaterialType = true;
ShowPorosity = true;
ShowD90 = true;
}
///
/// Type of material
///
[PropertyOrder(0, 1)]
[Label("MaterialType")]
[Description("MaterialType")]
public MaterialType MaterialType
{
get
{
return materialType;
}
set
{
if (materialType != value)
{
this.SetAndNotify2(out materialType, value, x => x.MaterialType);
}
}
}
///
/// Permeability X
///
[Unit(UnitType.Permeability)]
[PropertyOrder(1, 1)]
[Label("Permeability X")]
[Description("Permeability X")]
[Minimum(1.0E-12)]
[Maximum(1000.0)]
[Format("F4")]
[Clearable]
public double PermeabKx
{
get
{
return permeabKx;
}
set
{
if (!permeabKx.AlmostEquals(value))
{
this.SetAndNotify2(out permeabKx, value, x => x.PermeabKx);
}
}
}
[Description("Porosity")]
[PropertyOrder(1, 2)]
[Unit(UnitType.Fractions)]
[Minimum(0.3)]
[Maximum(0.6)]
[Format("F3")]
public double Porosity
{
get
{
return porosity;
}
set
{
this.SetAndNotify2(out porosity, value, x => x.Porosity);
}
}
[Unit(UnitType.TinyLength)]
[PropertyOrder(1, 2)]
[Label("D15")]
[Description("Fine diameter D15")]
[Minimum(0.0, false)]
[Format("F2")]
[Clearable]
public double DiameterD15
{
get
{
return diameterD15;
}
set
{
if (!diameterD15.AlmostEquals(value))
{
this.SetAndNotify2(out diameterD15, value, x => x.DiameterD15);
}
}
}
[Unit(UnitType.TinyLength)]
[PropertyOrder(1, 3)]
[Label("D50")]
[Description("Median diameter D50")]
[Minimum(0.0, false)]
[Format("F2")]
[Clearable]
public double DiameterD50
{
get
{
return diameterD50;
}
set
{
if (!diameterD50.AlmostEquals(value))
{
this.SetAndNotify2(out diameterD50, value, x => x.DiameterD50);
}
}
}
[Unit(UnitType.TinyLength)]
[PropertyOrder(1, 4)]
[Label("Diameter D90")]
[Description("Diameter D90")]
[Minimum(0.0, false)]
[Format("F2")]
[Clearable]
public double DiameterD90
{
get
{
return diameterD90;
}
set
{
if (!diameterD90.AlmostEquals(value))
{
this.SetAndNotify2(out diameterD90, value, x => x.DiameterD90);
}
}
}
///
/// Gets or sets the clay position.
/// kl = kleilaag tussen het zand van de dijkkern en de bekleding
/// zs = zandscheg (zand tussen de bekleding en een dieper gelegen kleilaag of kleikern)
///
///
/// The clay position.
///
public ClayPosition ClayPosition
{
get
{
return clayPosition;
}
set
{
this.SetAndNotify2(out clayPosition, value, x => x.ClayPosition);
}
}
# region Visibility
///
/// Gets or sets a value indicating whether [show porosity property].
///
///
/// true if [show porosity]; otherwise, false.
///
public bool ShowPorosity { get; set; }
///
/// Gets or sets a value indicating whether [show material type property].
///
///
/// true if [show material type]; otherwise, false.
///
public bool ShowMaterialType { get; set; }
///
/// Gets or sets a value indicating whether [show D90 property].
///
///
/// true if [show D90]; otherwise, false.
///
public bool ShowD90 { get; set; }
///
/// Gets or sets a value indicating whether [show clay position].
///
///
/// true if [show clay position]; otherwise, false.
///
public bool ShowClayPosition { get; set; }
public bool IsVisible(string propertyName)
{
if (propertyName == "MaterialType")
{
return ShowMaterialType;
}
if (propertyName == "Porosity")
{
return ShowPorosity;
}
if (propertyName == "DiameterD90")
{
return ShowD90;
}
if (propertyName == "ClayPosition")
{
return ShowClayPosition;
}
return true;
}
public bool IsEnabled(string propertyName)
{
return true;
}
# endregion
public string Name
{
get
{
if (!string.IsNullOrWhiteSpace(name))
{
return name;
}
return LocalizationManager.GetTranslatedText(this, MaterialType.ToString());
}
set
{
name = value;
}
}
public object Clone()
{
return new BlockRevetmentMaterial
{
materialType = materialType,
permeabKx = permeabKx,
porosity = porosity,
diameterD15 = diameterD15,
diameterD50 = diameterD50,
diameterD90 = diameterD90,
name = name,
clayPosition = clayPosition,
ShowPorosity = ShowPorosity,
ShowMaterialType = ShowMaterialType,
ShowD90 = ShowD90,
ShowClayPosition = ShowClayPosition
};
}
}
}