using System;
using System.ComponentModel;
using System.Xml.Serialization;
using Deltares.Geotechnics;
using Deltares.Geotechnics.GeotechnicalGeometry;
using Deltares.Standard;
using Deltares.Standard.Attributes;
using Deltares.Standard.EventPublisher;
using Deltares.Standard.Units;
using Deltares.Standard.Validation;
namespace Deltares.DeltaModel
{
///
/// Segment for block revetment
///
public class BlockRevetmentSegment : RevetmentSegment, IComparable, ICloneable
{
#region private backing fields
private YesNoQuestionMark accordingToGuideLines = YesNoQuestionMark.QuestionMark;
private double clayLayerThickness;
private ClayQualityType clayQuality = ClayQualityType.MODERATE;
private ControllerJudgementType controllerJudgement;
private bool isHavendam;
private string opmerking = string.Empty;
private BlockRevetmentProfile blockRevetmentProfile = new BlockRevetmentProfile();
private UpperTransitionConstructionType upperTransitionConstruction = UpperTransitionConstructionType.a0;
private object owner;
#endregion
#region properties
[Browsable(false)]
[XmlIgnore]
public object Owner
{
get
{
return owner;
}
set
{
owner = value;
}
}
///
/// Havendam of lage dijk (ja/blanco)
/// TODO: Comment
///
[Label("Havendam")]
[Description("Havendam")]
[Clearable]
[Category("Properties")]
[PropertyOrder(3, 1)]
public bool IsHavendam
{
get
{
return isHavendam;
}
set
{
this.SetAndNotify2(out isHavendam, value, x => x.IsHavendam);
}
}
///
/// Het type van de bovenste overgang of
/// overgangsconstructie is toegelicht in het werkblad "Info".
/// TODO: Comment
///
[Label("UpperTransitionConstruction")]
[Description("UpperTransitionConstruction")]
[Clearable]
[Category("Properties")]
[PropertyOrder(3, 2)]
public UpperTransitionConstructionType UpperTransitionConstruction
{
get
{
return upperTransitionConstruction;
}
set
{
this.SetAndNotify2(out upperTransitionConstruction, value, x => x.UpperTransitionConstruction);
}
}
///
/// Container of different revetment layers, toplayer, filter, geotextile, sand, clay.
///
[Browsable(true)]
[Validate]
public BlockRevetmentProfile BlockRevetmentProfile
{
get
{
return blockRevetmentProfile;
}
set
{
this.SetAndNotify2(out blockRevetmentProfile, value, x => x.BlockRevetmentProfile);
}
}
///
/// Gebruiker kan opmkering plaatsen bij elk revetment segment.
///
[Label("Opmerking")]
[Description("Opmerking")]
[PropertyOrder(4, 0)]
public string Opmerking
{
get
{
return opmerking;
}
set
{
this.SetAndNotify2(out opmerking, value, x => x.Opmerking);
}
}
///
/// Dikte van de klei laag. Vul 3 m in er een klei kern is.
///
[Unit(UnitType.Length, GeometryLengthUnit.m)]
[Minimum(0)]
[Maximum(1E9)]
[Label("Clay Layer Thickness")]
[Description("Clay Layer Thickness")]
[Format("F3")]
[Category("Sand")]
public double ClayLayerThickness
{
get
{
return clayLayerThickness;
}
set
{
this.SetAndNotify2(out clayLayerThickness, value, x => x.ClayLayerThickness);
}
}
///
/// Erosiebestendigheid van de klei.
/// Zie het Technisch Rapport Steenzettingen op blz. 189.
///
[Label("KleiKwaliteit")]
[Description("KleiKwaliteit")]
[Category("Clay")]
public ClayQualityType ClayQuality
{
get
{
return clayQuality;
}
set
{
this.SetAndNotify2(out clayQuality, value, x => x.ClayQuality);
}
}
///
/// Whether or not the experience is according to the guidelines.
///
public YesNoQuestionMark AccordingToGuideLines
{
get
{
return accordingToGuideLines;
}
set
{
this.SetAndNotify2(out accordingToGuideLines, value, x => x.AccordingToGuideLines);
}
}
///
/// Gets or sets the controller judgement.
///
///
/// The controller judgement.
///
public ControllerJudgementType ControllerJudgement
{
get
{
return controllerJudgement;
}
set
{
this.SetAndNotify2(out controllerJudgement, value, x => x.ControllerJudgement);
}
}
///
/// Gets or sets the casted.
/// TODO: Comment
///
///
/// The casted.
///
public BlockRevetmentCastedType Casted { get; set; }
///
/// Gets or sets the start z coordinate.
///
///
/// The start z coordinate.
///
[Format("F2")]
[Unit(UnitType.Length)]
[Category("Position")]
[PropertyOrder(1, 2)]
[XmlIgnore]
public double StartZ
{
get
{
return firstPoint.Z;
}
set
{
DataEventPublisher.BeforeChange(this, s => s.StartZ);
firstPoint.Z = value;
DataEventPublisher.AfterChange(this, s => s.StartZ);
}
}
///
/// Gets or sets the end z coordinate.
///
[Format("F2")]
[Unit(UnitType.Length)]
[Category("Position")]
[PropertyOrder(1, 4)]
[XmlIgnore]
public double EndZ
{
get
{
return lastPoint.Z;
}
set
{
DataEventPublisher.BeforeChange(this, s => s.EndZ);
lastPoint.Z = value;
DataEventPublisher.AfterChange(this, s => s.EndZ);
}
}
///
/// The data attached to the section, being the block revetment profile.
///
[Browsable(false)]
public override ISegmentDescription SegmentDescription
{
get
{
return BlockRevetmentProfile;
}
set
{
if (value is BlockRevetmentProfile)
{
BlockRevetmentProfile = (BlockRevetmentProfile) value;
}
}
}
#endregion
///
/// Copies all property values from the current block revetment segment to the provided block revetment segment.
///
/// The block revetment segment to copy to the current block revetment segment properties to.
/// The property will be copied as clone.
public void CopyTo(BlockRevetmentSegment target)
{
target.StartX = StartX;
target.StartZ = StartZ;
target.EndX = EndX;
target.EndZ = EndZ;
target.blockRevetmentProfile = blockRevetmentProfile.Clone() as BlockRevetmentProfile;
target.isHavendam = isHavendam;
target.upperTransitionConstruction = upperTransitionConstruction;
target.opmerking = opmerking;
target.clayLayerThickness = clayLayerThickness;
target.clayQuality = clayQuality;
target.accordingToGuideLines = accordingToGuideLines;
target.controllerJudgement = controllerJudgement;
target.Casted = Casted;
}
public BlockRevetmentSegment Clone()
{
var clone = new BlockRevetmentSegment();
CopyTo(clone);
return clone;
}
public int CompareTo(BlockRevetmentSegment other)
{
return StartX.CompareTo(other.StartX);
}
internal void AddTo(LocalizedGeometryPointString surfaceLine)
{
if (surfaceLine.Points.Count == 0)
{
surfaceLine.Points.Add(firstPoint);
}
surfaceLine.Points.Add(lastPoint);
}
}
}