using System.ComponentModel;
using Deltares.Geotechnics;
using Deltares.Standard;
using Deltares.Standard.Attributes;
using Deltares.Standard.EventPublisher;
namespace Deltares.DeltaModel
{
///
/// RoughnessSegment are part of a crossection which describes the roughness
/// The distance is related to crest axis. Such a path is expected to be close to the dike line, but not necessariliy so.
/// A path is a line consisiting of points. The actual top and bottom at a certain location become clear in combination
/// with a (schematized) surface line (intersections revetement paths with surface line).
/// The user can select, add, edit and remove revetment zones. Revetment types: grass, stone, asphalt, with sub-types.
/// Revetment has physical revetment properties such as size and parameters for mechanism models.
/// The model parameters are different per revetment type and sub-type. Input for each property the mean value,
/// statistical standard deviation and standard deviation used for mechanism.
/// There can be more than one revetment zones in one cross section (profile sections or revetment zone sections on the surface line).
///
[XmlOldName("Deltares.Geotechnics.Revetment")]
public class RoughnessSegment : SurfaceLineRevetmentSegment, ICloneable
{
private RoughnessDescription roughnessDescription;
///
/// Constructor
///
///
public RoughnessSegment(IHasSurfaceLine surfacelineProvider) : this(surfacelineProvider, new RoughnessDescription()) {}
private RoughnessSegment() {}
private RoughnessSegment(IHasSurfaceLine surfacelineProvider, RoughnessDescription roughnessDescription) : base(surfacelineProvider)
{
this.roughnessDescription = roughnessDescription;
DataEventPublisher.OnAfterChange += DataEventPublisher_OnAfterChange;
}
[Browsable(false)]
public RoughnessDescription RoughnessDescription
{
get
{
return roughnessDescription;
}
private set
{
roughnessDescription = value;
}
}
[Browsable(false)]
public override ISegmentDescription SegmentDescription
{
get
{
return RoughnessDescription;
}
set
{
if (value is RoughnessDescription)
{
RoughnessDescription = (RoughnessDescription) value;
}
}
}
public override string ToString()
{
return Name ?? "null" + "|" + RoughnessDescription.RevetmentString + "|" + RoughnessDescription.Roughness;
}
public RoughnessSegment Clone()
{
return new RoughnessSegment(SurfaceLineProvider, roughnessDescription.Clone() as RoughnessDescription)
{
StartX = StartX,
EndX = EndX
};
}
private void DataEventPublisher_OnAfterChange(object sender, PublishEventArgs e)
{
if (sender == RoughnessDescription)
{
DataEventPublisher.AfterChange(this);
}
}
}
}