// Copyright (C) Stichting Deltares 2016. All rights reserved.
//
// This file is part of Ringtoets.
//
// Ringtoets is free software: you can redistribute it and/or modify
// it under the terms of the GNU 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 General Public License for more details.
//
// You should have received a copy of the GNU 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.Collections.Generic;
using System.Linq;
using Core.Common.Base;
using Core.Common.Base.Data;
using Core.Common.Base.Geometry;
using Ringtoets.Common.Data.Calculation;
using Ringtoets.Common.Data.Probabilistics;
using Ringtoets.HydraRing.Data;
namespace Ringtoets.GrassCoverErosionInwards.Data
{
///
/// Class that holds all grass cover erosion inwards calculation specific input parameters.
///
public class GrassCoverErosionInwardsInput : Observable, ICalculationInput
{
private readonly LogNormalDistribution criticalFlowRate;
private RoundedDouble orientation;
private RoundedDouble dikeHeight;
private DikeProfile dikeProfile;
///
/// Creates a new instance of .
///
public GrassCoverErosionInwardsInput()
{
orientation = new RoundedDouble(2);
dikeHeight = new RoundedDouble(2);
UpdateProfileParameters();
criticalFlowRate = new LogNormalDistribution(4)
{
Mean = (RoundedDouble) 0.004,
StandardDeviation = (RoundedDouble) 0.0006
};
}
///
/// Gets or set the dike profile.
///
public DikeProfile DikeProfile
{
get
{
return dikeProfile;
}
set
{
dikeProfile = value;
UpdateProfileParameters();
}
}
///
/// Gets or sets the orientation of the dike profile geometry with respect to North
/// in degrees. A positive value equals a clockwise rotation.
///
public RoundedDouble Orientation
{
get
{
return orientation;
}
set
{
orientation = value.ToPrecision(orientation.NumberOfDecimalPlaces);
}
}
///
/// Gets or sets if needs to be taken into account.
///
public bool UseBreakWater { get; set; }
///
/// Gets the .
///
public BreakWater BreakWater { get; private set; }
///
/// Gets or sets if the needs to be taken into account.
///
public bool UseForeshore { get; set; }
///
/// Gets the geometry of the foreshore.
///
public IEnumerable ForeshoreGeometry
{
get
{
return dikeProfile != null
? dikeProfile.ForeshoreGeometry
: new List();
}
}
///
/// Gets the geometry of the dike with roughness data.
///
///
/// The roughness of a in the collection represents
/// the roughness of the section between this
/// and the succeeding . The roughness of the last
/// point is irrelevant.
///
public IEnumerable DikeGeometry
{
get
{
return dikeProfile != null
? dikeProfile.DikeGeometry
: new List();
}
}
///
/// Gets or sets the height of the dike [m+NAP].
///
public RoundedDouble DikeHeight
{
get
{
return dikeHeight;
}
set
{
dikeHeight = value.ToPrecision(dikeHeight.NumberOfDecimalPlaces);
}
}
///
/// Gets or sets the critical flow rate.
///
public LogNormalDistribution CriticalFlowRate
{
get
{
return criticalFlowRate;
}
set
{
criticalFlowRate.Mean = value.Mean;
criticalFlowRate.StandardDeviation = value.StandardDeviation;
}
}
///
/// Gets or set the hydraulic boundary location from which to use the assessment level.
///
public HydraulicBoundaryLocation HydraulicBoundaryLocation { get; set; }
private void UpdateProfileParameters()
{
if (dikeProfile == null)
{
Orientation = (RoundedDouble) 0.0;
UseForeshore = false;
UseBreakWater = false;
BreakWater = GetDefaultBreakWater();
DikeHeight = (RoundedDouble) 0.0;
}
else
{
Orientation = dikeProfile.Orientation;
UseForeshore = dikeProfile.ForeshoreGeometry.Any();
UseBreakWater = dikeProfile.HasBreakWater;
BreakWater = dikeProfile.HasBreakWater
? new BreakWater(dikeProfile.BreakWater.Type, dikeProfile.BreakWater.Height)
: GetDefaultBreakWater();
DikeHeight = dikeProfile.CrestLevel;
}
}
private static BreakWater GetDefaultBreakWater()
{
return new BreakWater(BreakWaterType.Dam, 0.0);
}
}
}