using System;
using System.ComponentModel;
using System.Xml.Serialization;
using Deltares.Geotechnics;
using Deltares.Standard;
using Deltares.Standard.Attributes;
using Deltares.Standard.EventPublisher;
using Deltares.Standard.Reflection;
using Deltares.Standard.Validation;
namespace Deltares.DeltaModel
{
///
/// Description of roughness
///
public class RoughnessDescription : ISegmentDescription
{
private string name = "Unknown roughness";
private double roughness;
private RoughnessType roughnessType;
private bool useStandardRoughness;
///
/// Gets or sets the textual representation for .
///
[Browsable(false)]
[XmlIgnore]
public string RevetmentString
{
get
{
return roughnessType.ToString();
}
set
{
DataEventPublisher.BeforeChange(this, x => x.RevetmentString);
switch (value)
{
case "Grass":
case "Gras, gezaaid":
roughnessType = RoughnessType.GrassSown;
break;
case "Doorgroeisteen, beton":
roughnessType = RoughnessType.GrowthEnablingStoneConcrete;
break;
case "Breuksteen, gepenetreerd met asfalt (patroonpenetratie)":
roughnessType = RoughnessType.ArmourRockWithPatternPenetrationOfCementConcreteOrColloidalConcrete;
break;
case "Paved":
roughnessType = RoughnessType.BasaltSet;
break;
case "Asphalt":
roughnessType = RoughnessType.AsphaltConcrete;
break;
default:
{
var enumVal = EnumSupport.StringToEnum(value, typeof(RoughnessType));
if (enumVal == null)
{
throw new ArgumentException("value " + value + " is not recoqnized as a roughnesstype");
}
roughnessType = (RoughnessType) enumVal;
}
break;
}
DataEventPublisher.AfterChange(this, x => x.RevetmentString);
}
}
///
/// Gets or sets the RoughnessType of the Revetment.
///
///
/// The RoughnessType.
///
[Data]
[Label("Revetment type")]
[Description("Revetment type")]
[PropertyOrder(1, 3)]
public RoughnessType RoughnessType
{
get
{
return roughnessType;
}
set
{
DataEventPublisher.BeforeChange(this, x => x.RoughnessType);
roughnessType = value;
if (useStandardRoughness)
{
Roughness = GetStandardRoughnessValue();
}
DataEventPublisher.AfterChange(this, x => x.RoughnessType);
}
}
///
/// Gets or sets the roughness of the Revetment.
///
///
/// The roughness.
///
[Format("F2")]
[PropertyOrder(1, 2)]
[Minimum(0.0)]
[Maximum(1.0)]
public double Roughness
{
get
{
return roughness;
}
set
{
this.SetAndNotify2(out roughness, value, rd => rd.Roughness);
}
}
///
/// Gets or sets a value indicating whether the standard roughness will be used.
///
///
/// true if use standard roughness; otherwise, false.
///
[Browsable(false)]
[XmlIgnore]
public bool UseStandardRoughness
{
get
{
return useStandardRoughness;
}
set
{
useStandardRoughness = value;
}
}
///
/// Gets or sets the name of the Revetment.
///
///
/// The name.
///
[Label("Name")]
[Description("Name")]
[PropertyOrder(0)]
public string Name
{
get
{
return name;
}
set
{
if ((name != null || value == null) && name == value)
{
return;
}
DataEventPublisher.BeforeChange(this, x => x.Name);
name = value;
DataEventPublisher.AfterChange(this, x => x.Name);
}
}
public ISegmentDescription Clone()
{
return new RoughnessDescription
{
RoughnessType = RoughnessType,
Roughness = Roughness
};
}
///
/// Gets the standard roughness value. Values set to the roughness values described in
/// 'TR_23 Technisch Rapport Golfoploop en Golfoverslag bij Dijken.pdf'
///
/// The standard roughness value belonging to the revetment type
private double GetStandardRoughnessValue()
{
double standardRoughness;
switch (RoughnessType)
{
case RoughnessType.AsphaltConcrete:
standardRoughness = 1.0;
break;
case RoughnessType.MasticAsphalt:
standardRoughness = 1.0;
break;
case RoughnessType.ImpermeableStoneAsphalt:
standardRoughness = 1.0;
break;
case RoughnessType.OpenPrefabricatedStoneAsphaltMats:
standardRoughness = 0.9;
break;
case RoughnessType.OpenStoneAsphalt:
standardRoughness = 0.9;
break;
case RoughnessType.SandAsphaltTtemporaryOrInUnderLayer:
standardRoughness = 1.0;
break;
case RoughnessType.ArmourRockImpregnatedWithAsphaltFullAndSaturated:
standardRoughness = 0.8;
break;
case RoughnessType.BrickAndConcreteImpregnatedWithAsphaltFullAndSaturated:
standardRoughness = 1.0;
break;
case RoughnessType.ArmourRockImpregnatedWithAsphaltPatternPenetration:
standardRoughness = 0.7;
break;
case RoughnessType.ConcreteBlocksWithAngledCornersOrHoles:
standardRoughness = 0.9;
break;
case RoughnessType.ConcreteBlocksWithoutOpenings:
standardRoughness = 1.0;
break;
case RoughnessType.HaringmanBlocks:
standardRoughness = 0.9;
break;
case RoughnessType.DiabolBlocks:
standardRoughness = 0.8;
break;
case RoughnessType.OpenBlockMatsFilledWithGranularMaterial:
standardRoughness = 0.9;
break;
case RoughnessType.BlockMatsWithoutOpenings:
standardRoughness = 0.95;
break;
case RoughnessType.ConcreteSheetsOfCementConcreteOrClosedColloidalConcretePpouredInsStu:
standardRoughness = 1.0;
break;
case RoughnessType.ColloidalConcreteOpenStructure:
standardRoughness = 1.0;
break;
case RoughnessType.ConcreteSheetsPrefab:
standardRoughness = 1.0;
break;
case RoughnessType.GrowthEnablingStoneConcrete:
standardRoughness = 0.95;
break;
case RoughnessType.ArmourRockImpregnatedWithCementConcreteOrColloidalConcreteFullAndSaturated:
standardRoughness = 0.8;
break;
case RoughnessType.ArmourRockWithPatternPenetrationOfCementConcreteOrColloidalConcrete:
standardRoughness = 0.7;
break;
case RoughnessType.GrassSown:
standardRoughness = 1.0;
break;
case RoughnessType.GrassSodsOrSownInArtificialMats:
standardRoughness = 1.0;
break;
case RoughnessType.RubbleOfCoarseGravelAndOtherGranularMaterials:
standardRoughness = 0.8;
break;
case RoughnessType.CoarseGranularMaterialsQuarryStonePackedInMetalGauze:
standardRoughness = 0.7;
break;
case RoughnessType.FineGranularMaterialsSandGravelPackedInGeotextile:
standardRoughness = 0.9;
break;
case RoughnessType.ArmourRockRubbleMound:
standardRoughness = 0.55;
break;
case RoughnessType.BasaltSet:
standardRoughness = 0.9;
break;
case RoughnessType.BasaltSetImpregnatedWithPouredAsphalt:
standardRoughness = 0.95;
break;
case RoughnessType.BasaltSetImpregnatedWithColloidalConcreteOrCementConcrete:
standardRoughness = 0.95;
break;
case RoughnessType.Basalton:
standardRoughness = 0.9;
break;
case RoughnessType.PITPolygonPiles:
standardRoughness = 0.9;
break;
case RoughnessType.Hydroblock:
standardRoughness = 0.9;
break;
case RoughnessType.ConcretePilesOrOtherNonRectangularBlocksImpregnatedWithPouredAsphalt:
standardRoughness = 1.0;
break;
case RoughnessType.BasaltonImpregnatedWithPouredAsphalt:
standardRoughness = 1.0;
break;
case RoughnessType.PITPolygonPilesImpregnatedWithPouredAsphalt:
standardRoughness = 1.0;
break;
case RoughnessType.HydroblockImpregnatedWithPouredAsphalt:
standardRoughness = 1.0;
break;
case RoughnessType.ConcretePilesOrOtherNonRectangularBlocksImpregnatedWithConcrete:
standardRoughness = 1.0;
break;
case RoughnessType.BasaltonImpregnatedWithConcrete:
standardRoughness = 1.0;
break;
case RoughnessType.NaturalStoneSetNoordseOrDrentseStone:
standardRoughness = 0.75;
break;
case RoughnessType.Vilvoordse:
standardRoughness = 0.85;
break;
case RoughnessType.Lessinische:
standardRoughness = 0.85;
break;
case RoughnessType.Doornikse:
standardRoughness = 0.9;
break;
case RoughnessType.SmallGranite:
standardRoughness = 0.9;
break;
case RoughnessType.Granite:
standardRoughness = 0.95;
break;
case RoughnessType.NaturalStoneSetAndImpregnatedWithPouredAsphalt:
standardRoughness = 0.85;
break;
case RoughnessType.VilvoordseImpregnatedWithPouredAsphalt:
standardRoughness = 0.95;
break;
case RoughnessType.LessinischeImpregnatedWithPouredAsphalt:
standardRoughness = 1.0;
break;
case RoughnessType.DoornikseImpregnatedWithPouredAsphalt:
standardRoughness = 1.0;
break;
case RoughnessType.SmallGraniteImpregnatedWithPouredAsphalt:
standardRoughness = 1.0;
break;
case RoughnessType.GraniteImpregnatedWithPouredAsphalt:
standardRoughness = 1.0;
break;
case RoughnessType.NaturalStoneSetAndImpregnatedWithConcrete:
standardRoughness = 0.85;
break;
case RoughnessType.VilvoordseImpregnatedWithConcrete:
standardRoughness = 0.95;
break;
case RoughnessType.LessinischeImpregnatedWithConcrete:
standardRoughness = 1.0;
break;
case RoughnessType.DoornikseImpregnatedWithConcrete:
standardRoughness = 1.0;
break;
case RoughnessType.PetitGranietImpregnatedWithConcrete:
standardRoughness = 1.0;
break;
case RoughnessType.GranietImpregnatedWithConcrete:
standardRoughness = 1.0;
break;
case RoughnessType.KoperslakBlocks:
standardRoughness = 1.0;
break;
case RoughnessType.NaturalRubbleMoundOfRock:
standardRoughness = 0.55;
break;
case RoughnessType.KlinkersConcreteOrBrick:
standardRoughness = 1.0;
break;
default:
standardRoughness = 0;
break;
}
return standardRoughness;
}
}
}