using System;
using System.ComponentModel;
using Deltares.Probabilistic;
using Deltares.Standard;
using Deltares.Standard.Attributes;
using Deltares.Standard.Reflection;
using Deltares.Standard.Units;
namespace Deltares.DeltaModel
{
///
/// Design Value Object
/// TODO: Comment
///
public class DesignValue : ProbabilityDefinition, IVisibleEnabled
{
private double crestLevel = Double.NaN;
private double overtoppingVolume = Double.NaN;
private double waterLevel = Double.NaN;
public DesignValue()
{
OvertoppingVolumeDesignPoint = null;
CrestLevelDesignPoint = null;
WaterLevelDesignPoint = null;
}
///
/// Gets or sets the water level.
///
///
/// The water level.
///
[Label("Water level")]
[Unit(UnitType.Length)]
[Format("F2")]
[PropertyOrder(1, 1)]
[ReadOnly(true)]
public double WaterLevel
{
get
{
return waterLevel;
}
set
{
waterLevel = value;
}
}
///
/// Gets or sets the crest level.
///
///
/// The crest level.
///
[Label("Crest level")]
[Unit(UnitType.Length)]
[Format("F2")]
[PropertyOrder(1, 2)]
[ReadOnly(true)]
public double CrestLevel
{
get
{
return crestLevel;
}
set
{
crestLevel = value;
}
}
///
/// Gets or sets the overtopping volume.
///
///
/// The overtopping volume.
///
[Label("Overtopping volume")]
[Unit(UnitType.VolumePerLength)]
[Format("F2")]
[PropertyOrder(1, 3)]
[ReadOnly(true)]
public double OvertoppingVolume
{
get
{
return overtoppingVolume;
}
set
{
overtoppingVolume = value;
}
}
///
/// Gets or sets the water level design point.
///
///
/// The water level design point.
///
[Browsable(false)]
public Realization WaterLevelDesignPoint { get; set; }
///
/// Gets or sets the crest level design point.
///
///
/// The crest level design point.
///
[Browsable(false)]
public Realization CrestLevelDesignPoint { get; set; }
///
/// Gets or sets the overtopping volume design point.
///
///
/// The overtopping volume design point.
///
[Browsable(false)]
public Realization OvertoppingVolumeDesignPoint { get; set; }
#region IVisibleEnabled Members
///
/// Determines whether the specified property is enabled.
///
/// The property.
///
/// true
///
public bool IsEnabled(string property)
{
return true;
}
///
/// Determines whether the specified property is visible.
///
/// The property.
///
/// for WaterLevel, CrestLevel & OvertoppingVolume: false if respective value is NaN, else true
///
public bool IsVisible(string property)
{
if (property == this.GetMemberName(dv => dv.WaterLevel))
{
return Double.IsNaN(WaterLevel) == false;
}
if (property == this.GetMemberName(dv => dv.CrestLevel))
{
return Double.IsNaN(CrestLevel) == false;
}
if (property == this.GetMemberName(dv => dv.OvertoppingVolume))
{
return Double.IsNaN(OvertoppingVolume) == false;
}
return true;
}
#endregion
///
/// Gets or sets the probability.
///
///
/// The probability.
///
[ReadOnly(true)]
[Format("F2", true)]
[Unit(UnitType.ProbabilityPerYear)]
public override double Probability
{
get
{
return base.Probability;
}
set
{
base.Probability = value;
}
}
}
}