Index: dam engine/branches/Initial Source/Deltares.DamEngine.Data/General/LocationJob.cs =================================================================== diff -u -r303 -r316 --- dam engine/branches/Initial Source/Deltares.DamEngine.Data/General/LocationJob.cs (.../LocationJob.cs) (revision 303) +++ dam engine/branches/Initial Source/Deltares.DamEngine.Data/General/LocationJob.cs (.../LocationJob.cs) (revision 316) @@ -21,11 +21,14 @@ using System; using System.Collections.Generic; -using System.ComponentModel; +using System.Linq; using System.Xml.Serialization; using Deltares.DamEngine.Data.Design; +using Deltares.DamEngine.Data.General.Results; +using Deltares.DamEngine.Data.General.TimeSeries; using Deltares.DamEngine.Data.RWScenarios; using Deltares.DamEngine.Data.Standard.Calculation; +using Deltares.DamEngine.Data.Standard.Validation; namespace Deltares.DamEngine.Data.General { @@ -85,13 +88,10 @@ get { return waterLevelTimeSerie; } set { - DataEventPublisher.BeforeChange(this, "WaterLevelTimeSerie"); - waterLevelTimeSerie = value; - DataEventPublisher.AfterChange(this, "WaterLevelTimeSerie"); + waterLevelTimeSerie = value; } } - [XmlOldName("ScenarioResults")] public virtual IEnumerable RWScenarioResults { get @@ -127,9 +127,7 @@ get { return locationResult; } set { - DataEventPublisher.BeforeChange(this, "LocationResult"); - locationResult = value; - DataEventPublisher.AfterChange(this, "LocationResult"); + locationResult = value; } } @@ -231,6 +229,7 @@ } return null; } + /// /// Return the result of the profile with highest probability of occurrence /// @@ -384,10 +383,7 @@ return res; } - [Data] - [Label("Safety factor")] [XmlIgnore] - [Format("F3")] public double SafetyFactor { get @@ -436,9 +432,6 @@ } } - [Data] - [Label("Detriment factor")] - [Format("F3")] public double DetrimentFactor { get @@ -459,10 +452,7 @@ } } - [Data] - [Label("Failure probability")] [XmlIgnore] - [Format("F3")] public double FailureProbability { get @@ -486,9 +476,6 @@ } } - [Data] - [Label("Required probability")] - [Format("F3")] [XmlIgnore] public double RequiredProbability { @@ -531,9 +518,7 @@ return false; } - [Data] [XmlIgnore] - [Label("Result")] public JobResult Result { get @@ -554,102 +539,68 @@ } [XmlIgnore] - [Browsable(false)] public double X { get { return this.Location.XRd; } set { this.Location.XRd = value; } } [XmlIgnore] - [Browsable(false)] public double Y { get { return this.Location.YRd; } set { this.Location.YRd = value; } } [XmlIgnore] - [Browsable(false)] public static ScenarioType CurrentScenarioType { get { return currentScenarioType; } set { currentScenarioType = value; } } [XmlIgnore] - [Browsable(false)] public static string CurrentProfileName { get { return currentProfileName; } set { currentProfileName = value; } } [XmlIgnore] - [Browsable(false)] public static string CurrentScenarioName { get { return currentScenarioName; } set { currentScenarioName = value; } } [XmlIgnore] - [Browsable(false)] public static string CurrentCalculation { get { return currentCalculation; } set { currentCalculation = value; } } [XmlIgnore] - [Browsable(false)] public static DateTime CurrentTime { get { return currentTime; } set { currentTime = value; } } [XmlIgnore] - [Browsable(false)] public static DamProjectType DamProjectType { get { return damProjectType; } set { damProjectType = value; } } [XmlIgnore] - [Browsable(false)] public static ProbabilisticType ProbabilisticType { get { return probabilisticType; } set { probabilisticType = value; } } - public bool IsEnabled(string property) - { - return true; - } - - public bool IsVisible(string property) - { - switch (property) - { - case "SafetyFactor": return this.Result != JobResult.NoRun && this.Result != JobResult.Failed && - ProbabilisticType == ProbabilisticType.Deterministic; - case "DetrimentFactor": return this.Result != JobResult.NoRun && this.Result != JobResult.Failed && - ProbabilisticType == ProbabilisticType.Deterministic; - case "RequiredProbability": return this.Result != JobResult.NoRun && this.Result != JobResult.Failed && - ProbabilisticType != ProbabilisticType.Deterministic; - case "FailureProbability": return this.Result != JobResult.NoRun && this.Result != JobResult.Failed && - ProbabilisticType != ProbabilisticType.Deterministic; - case "WaterLevelTimeSerie": - return HasLocationResults; - case "RWScenarioResults": - return HasRWScenarioResults; - default: return true; - } - } - public override string ToString() { return this.Location != null ? this.Location.ToString() : ""; Index: dam engine/branches/Initial Source/Deltares.DamEngine.Data/General/DamProjectData.cs =================================================================== diff -u -r303 -r316 --- dam engine/branches/Initial Source/Deltares.DamEngine.Data/General/DamProjectData.cs (.../DamProjectData.cs) (revision 303) +++ dam engine/branches/Initial Source/Deltares.DamEngine.Data/General/DamProjectData.cs (.../DamProjectData.cs) (revision 316) @@ -26,27 +26,29 @@ using System.Linq; using System.Xml.Serialization; using Deltares.DamEngine.Data.Design; +using Deltares.DamEngine.Data.General.Results; +using Deltares.DamEngine.Data.General.SchematizationFactor; +using Deltares.DamEngine.Data.General.Sensors; using Deltares.DamEngine.Data.RWScenarios; using Deltares.DamEngine.Data.Standard.Calculation; +using Deltares.DamEngine.Data.Standard.Language; +using Deltares.DamEngine.Data.Standard.Validation; namespace Deltares.DamEngine.Data.General { - public class DamProjectData : Project, IDisposable + public class DamProjectData { public readonly double MissValStabilitySafetyFactor = -1.0; private WaterBoard waterBoard; private DamProjectCalculationSpecification damProjectCalculationSpecification; private WaterBoardJob waterBoardJob = null; private DamProjectType damProjectType = DamProjectType.Calamity; private ProgramType programType = ProgramType.MStab; - private string damDataSourceFileName = ""; private List jobs = new List(); private SchematizationFactorData schematizationFactorData = new SchematizationFactorData(); private List calculations = null; // will be created and initialized in property private List designCalculations = null; private List schematizationFactors = null; - private List dataSources = new List(); - private string dataSourceEsriProjection = null; private SensorData sensorData; /// @@ -103,8 +105,7 @@ set { damProjectCalculationSpecification = value; } } - - [Child] + public virtual DamJob WaterBoardJob { get @@ -132,16 +133,11 @@ set { waterBoardJob = value as WaterBoardJob; } } - [ReadOnly(true)] - [Label("Calculation type")] - [Description("Indicates the purpose of the calculations")] public virtual DamProjectType DamProjectType { get { return damProjectType; } set { - DataEventPublisher.BeforeChange(this, "DamProjectType"); - bool modified = damProjectType != value; damProjectType = value; @@ -150,28 +146,11 @@ if (modified) { - LocationJob.DamProjectType = damProjectType; - DataEventPublisher.DataListModified(this.LocationJobs); - } - - DataEventPublisher.AfterChange(this, "DamProjectType"); + LocationJob.DamProjectType = damProjectType; + } } } - [Label("DAM datasource file")] - [Description("Indicates which \".defx\" import definition file to use")] - public virtual string DamDataSourceFileName - { - get { return damDataSourceFileName; } - set - { - DataEventPublisher.BeforeChange(this, "DamDataSourceFileName"); - damDataSourceFileName = value; - DataEventPublisher.AfterChange(this, "DamDataSourceFileName"); - } - } - - [ReadOnly(true)] [XmlIgnore] public List Calculations { @@ -217,9 +196,7 @@ calculations.AddRange(locationResult.RWScenarioProfileResults); } } - } - - DataEventPublisher.DataListModified(this.calculations); + } } } @@ -275,12 +252,10 @@ { designCalculations.AddRange(scenario.CalculationResults); } - } - DataEventPublisher.DataListModified(designCalculations); + } } [XmlIgnore] - [ReadOnly(true)] public List DesignCalculations { get @@ -294,7 +269,6 @@ } } - [ReadOnly(true)] [XmlIgnore] public List SchematizationFactors { @@ -327,9 +301,7 @@ schematizationFactors.Add(rwSchematizationFactorResult); } } - } - - DataEventPublisher.DataListModified(this.schematizationFactors); + } } } @@ -338,9 +310,7 @@ get { return schematizationFactorData; } set { - DataEventPublisher.BeforeChange(this, "SchematizationFactorData"); - schematizationFactorData = value; - DataEventPublisher.AfterChange(this, "SchematizationFactorData"); + schematizationFactorData = value; } } @@ -375,8 +345,6 @@ } [XmlIgnore] - [ReadOnly(true)] - [Browsable(false)] public List LocationJobs { get @@ -434,8 +402,6 @@ } [XmlIgnore] - [ReadOnly(true)] - [Browsable(false)] [Validate] public List SelectedLocationJobs { @@ -473,28 +439,11 @@ } [XmlIgnore] - [Browsable(false)] - [ReadOnly(true)] - [Label("Locations")] public List Locations { get { return this.WaterBoard.Locations; } } - [Browsable(false)] - public List DataSources - { - get { return dataSources; } - set { dataSources = value; } - } - - [Browsable(false)] - public string DataSourceEsriProjection - { - get { return this.dataSourceEsriProjection; } - set { this.dataSourceEsriProjection = value; } - } - public ProgramType ProgramType { // For now, only MStab (= default value) allowed so ReadOnly. Add setter when needed. @@ -554,7 +503,6 @@ public void DeleteResults() { - LogManager.Messages.Clear(); if (waterBoardJob != null && waterBoardJob.Jobs != null) { waterBoardJob.Jobs.Clear(); @@ -645,49 +593,21 @@ if (!IsDesignWithGeometryAdaptionAllowed()) { return new[]{ new ValidationResult(ValidationResultType.Error, LocalizationManager.GetTranslatedText(this, "DesignAndAdaptionNotAllowedForStabilityOutside"), - this, "DamCalculationSpecifications", "DamCalculationSpecifications", null)}; + this)}; } else { return new ValidationResult[0]; } } - - public override bool IsVisible(string property) - { - switch (property) - { - case "SensorData": return damProjectType == DamProjectType.DamLiveConfiguration; - case "SchematizationFactors": return false; - //Bka: for now (release 1.4.1), do not show SchematizationFactors return this.HasResults() && this.DamProjectType == Data.DamProjectType.Assessment; - case "Calculations": return this.HasResults() && this.DamProjectType == DamProjectType.Assessment; - case "DesignCalculations": return this.HasResults() && this.DamProjectType == DamProjectType.Design; - case "DamProjectCalculationSpecification": - return damProjectCalculationSpecification.DamCalculationSpecifications.Count > 0; - default: return true; - } - } - - public ICollection GetDomain(string property) - { - switch (property) - { - default: return null; - } - } - + public override string ToString() { return this.WaterBoard != null ? this.WaterBoard.Name : ""; } + - public void Dispose() - { - WaterBoard.Dispose(); - DamProjectCalculationSpecification.Dispose(); - } - public void FillOverallSensorData() { if (sensorData != null) Index: dam engine/branches/Initial Source/Deltares.DamEngine.Data/General/Sensors/SensorData.cs =================================================================== diff -u --- dam engine/branches/Initial Source/Deltares.DamEngine.Data/General/Sensors/SensorData.cs (revision 0) +++ dam engine/branches/Initial Source/Deltares.DamEngine.Data/General/Sensors/SensorData.cs (revision 316) @@ -0,0 +1,111 @@ +// Copyright (C) Stichting Deltares 2017. All rights reserved. +// +// This file is part of the DAM Engine. +// +// The DAM Engine is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero 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 Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero 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; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; + +namespace Deltares.DamEngine.Data.General.Sensors +{ + /// + /// Class to hold the collected sensor data + /// + public class SensorData + { + private List sensors = new List(); + private List sensorGroups = new List(); + private List sensorLocations = new List(); + + /// + /// Updates the pick sensors for groups. + /// + public void UpdatePickSensorsForGroups() + { + foreach (var sensorGroup in sensorGroups) + { + sensorGroup.PickSensors = sensors; + } + } + + /// + /// Gets or sets the sensors. + /// + /// + /// The sensors. + /// + public List Sensors + { + get { return sensors; } + set { sensors = value; } + } + + /// + /// Gets or sets the sensor groups. + /// + /// + /// The sensor groups. + /// + public List SensorGroups + { + get { return sensorGroups; } + set { sensorGroups = value; } + } + + /// + /// Gets or sets the sensor locations. + /// + /// + /// The sensor locations. + /// + public List SensorLocations + { + get { return sensorLocations; } + } + + public Sensor GetSensorById(int id) + { + return sensors.FirstOrDefault(sensor => sensor.ID == id); + } + + public Group GetGroupById(int id) + { + return sensorGroups.FirstOrDefault(sensorGroup => sensorGroup.ID == id); + } + + public SensorLocation GetSensorLocationByLocationName(string name) + { + return sensorLocations.FirstOrDefault(sensorLocation => sensorLocation.LocationName == name); + } + + /// + /// Gets the groups for use in selection lists in de UI. + /// + /// The sensoLocation. + /// + public IEnumerable GetGroups(SensorLocation sensorLocation) + { + var list = new List(); + list.AddRange(sensorGroups); + return list; + } + } +} Index: dam engine/branches/Initial Source/Deltares.DamEngine.Data/Standard/IClonable.cs =================================================================== diff -u --- dam engine/branches/Initial Source/Deltares.DamEngine.Data/Standard/IClonable.cs (revision 0) +++ dam engine/branches/Initial Source/Deltares.DamEngine.Data/Standard/IClonable.cs (revision 316) @@ -0,0 +1,35 @@ +// Copyright (C) Stichting Deltares 2017. All rights reserved. +// +// This file is part of the DAM Engine. +// +// The DAM Engine is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero 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 Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero 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.Runtime.InteropServices; + +namespace Deltares.DamEngine.Data.Standard +{ + [ComVisible(true)] + public interface ICloneable + { + /// + /// Clones the current object. + /// + /// A clone of the current object. + T Clone(); + } +} \ No newline at end of file Index: dam engine/branches/Initial Source/Deltares.DamEngine.Data/General/MStabParameters.cs =================================================================== diff -u -r303 -r316 --- dam engine/branches/Initial Source/Deltares.DamEngine.Data/General/MStabParameters.cs (.../MStabParameters.cs) (revision 303) +++ dam engine/branches/Initial Source/Deltares.DamEngine.Data/General/MStabParameters.cs (.../MStabParameters.cs) (revision 316) @@ -21,6 +21,7 @@ using System.ComponentModel; using System.Xml.Serialization; +using Deltares.DamEngine.Data.Standard; using Deltares.DamEngine.Data.Standard.Validation; namespace Deltares.DamEngine.Data.General @@ -389,16 +390,16 @@ { public MStabGeometryCreationOptions() { - SoilGeometryType = this.SoilGeometryType.SoilGeometry1D; + SoilGeometryType = SoilGeometryType.SoilGeometry1D; SoilGeometry2DFilename = ""; XOffsetSoilGeometry2DOrigin = 0.0; MaterialForDike = ""; MaterialForShoulder = ""; IsUseOriginalPLLineAssignments = false; IsUseOriginalCalculationOptions = false; IsDrySituation = false; - PLLineAssignment = this.PLLineAssignment.ExpertKnowledge; - IntrusionVerticalWaterPressureType = this.IntrusionVerticalWaterPressureType.Standard; + PLLineAssignment = PLLineAssignment.ExpertKnowledge; + IntrusionVerticalWaterPressureType = IntrusionVerticalWaterPressureType.Standard; PenetrationLength = 0.0; IsDesign = false; } @@ -467,7 +468,7 @@ { this.IsCalculateAllStabilityProjectsAtOnce = true; this.IsOverrulePLLineCreationMethod = false; - this.PLLineCreationMethod = this.PLLineCreationMethod.ExpertKnowledgeRRD; + this.PLLineCreationMethod = PLLineCreationMethod.ExpertKnowledgeRRD; this.Model = MStabModelType.Bishop; this.SearchMethod = MStabSearchMethod.Grid; this.ZoneAreas = null; Index: dam engine/branches/Initial Source/Deltares.DamEngine.Data/General/DamFailureMechanismeCalculationSpecification.cs =================================================================== diff -u -r303 -r316 --- dam engine/branches/Initial Source/Deltares.DamEngine.Data/General/DamFailureMechanismeCalculationSpecification.cs (.../DamFailureMechanismeCalculationSpecification.cs) (revision 303) +++ dam engine/branches/Initial Source/Deltares.DamEngine.Data/General/DamFailureMechanismeCalculationSpecification.cs (.../DamFailureMechanismeCalculationSpecification.cs) (revision 316) @@ -20,8 +20,6 @@ // All rights reserved. using System; -using System.Collections; -using System.ComponentModel; using System.Xml.Serialization; using Deltares.DamEngine.Data.Standard.Validation; @@ -64,16 +62,15 @@ { if (failureMechanismSystemType != value) { - DataEventPublisher.BeforeChange(this, "FailureMechanismSystemType"); failureMechanismSystemType = value; // To solve MWDAM-592, remember the current pipingmodeltype as this gets reset by setting the // calculationmodel. Only switch it back when needed. var oldPipingModelType = pipingModelType; - foreach (Enum possibleModel in this.GetDomain("CalculationModel")) - { - this.CalculationModel = possibleModel; - break; - } +// foreach (Enum possibleModel in this.GetDomain("CalculationModel")) +// { +// this.CalculationModel = possibleModel; +// break; +// } #Bka: I think this is only needed for the UI. switch (failureMechanismSystemType) { case FailureMechanismSystemType.StabilityInside: @@ -85,13 +82,12 @@ case FailureMechanismSystemType.Piping: PipingModelType = oldPipingModelType; break; - } - DataEventPublisher.AfterChange(this, "FailureMechanismSystemType"); + } } } } - [Browsable(false)] + public PipingModelType PipingModelType { get { return pipingModelType; } @@ -105,14 +101,12 @@ } } - [Browsable(false)] public static DamProjectType DamProjectType { get { return damProjectType; } set { damProjectType = value; } } - [Browsable(false)] public static ProbabilisticType ProbabilisticType { get { return probabilisticType; } @@ -125,14 +119,11 @@ /// mechanisme instead of the fixed types per mechanisme. /// [XmlIgnore] - [Label("Model")] - [PropertyOrder(1, 1)] public Enum CalculationModel { get { return calculationModel; } set { - DataEventPublisher.BeforeChange(this, "CalculationModel"); calculationModel = value; if (value is PipingModelType) { @@ -141,12 +132,10 @@ else { failureMechanismeParamatersMStab.MStabParameters.Model = (MStabModelType)value; - } - DataEventPublisher.AfterChange(this, "CalculationModel"); + } } } - [Browsable(false)] public MStabModelType StabilityModelType { get { return failureMechanismeParamatersMStab.MStabParameters.Model; } @@ -160,7 +149,6 @@ } } - [Browsable(false)] public StabilityKernelType StabilityKernelType { get { return stabilityKernelType; } @@ -198,51 +186,6 @@ return description; } - public ICollection GetDomain(string property) - { - switch (property) - { - case "CalculationModel": - return (ConfigurationManager.Instance.GetAvailableMechanismModels(StabilityKernelType, DamProjectType, - ProbabilisticType, failureMechanismSystemType)); - - case "PipingModelType": - return (ConfigurationManager.Instance.GetAvailableMechanismModels(StabilityKernelType, DamProjectType, - ProbabilisticType, FailureMechanismSystemType.Piping)); - - case "FailureMechanismSystemType": - return (ConfigurationManager.Instance.GetAvailableFailureMechanisms(StabilityKernelType, DamProjectType, - ProbabilisticType)); - case "StabilityKernelType": - return (ConfigurationManager.Instance.GetAvailableFailureMechanisms(StabilityKernelType, DamProjectType, - ProbabilisticType)); - default: return null; - } - } - - - public bool IsEnabled(string property) - { - return true; - } - - public bool IsVisible(string property) - { - switch (property) - { - case "FailureMechanismeParamatersMStab": - switch (this.FailureMechanismSystemType) - { - case FailureMechanismSystemType.StabilityInside: return true; - case FailureMechanismSystemType.StabilityOutside: return true; - case FailureMechanismSystemType.HorizontalBalance: return false; - case FailureMechanismSystemType.Piping: return false; - default: return true; - } - default: return true; - } - } - /// /// Determines whether slip circle definition is undefined. /// Index: dam engine/branches/Initial Source/Deltares.DamEngine.Data/Geotechnics/SoilProfile1D.cs =================================================================== diff -u -r303 -r316 --- dam engine/branches/Initial Source/Deltares.DamEngine.Data/Geotechnics/SoilProfile1D.cs (.../SoilProfile1D.cs) (revision 303) +++ dam engine/branches/Initial Source/Deltares.DamEngine.Data/Geotechnics/SoilProfile1D.cs (.../SoilProfile1D.cs) (revision 316) @@ -319,6 +319,18 @@ } /// + /// Make sure the last layer has a height + /// + public void EnsureLastLayerHasHeight() + { + var bottomLayer = Layers.Last(); + if (bottomLayer.Height.IsZero()) + { + BottomLevel -= defaultBottomLayerHeight; + } + } + + /// /// Validates this instance (using validator mechanism). /// /// Index: dam engine/branches/Initial Source/Deltares.DamEngine.Data/General/TimeSeries/TimeStep.cs =================================================================== diff -u --- dam engine/branches/Initial Source/Deltares.DamEngine.Data/General/TimeSeries/TimeStep.cs (revision 0) +++ dam engine/branches/Initial Source/Deltares.DamEngine.Data/General/TimeSeries/TimeStep.cs (revision 316) @@ -0,0 +1,58 @@ +// Copyright (C) Stichting Deltares 2017. All rights reserved. +// +// This file is part of the DAM Engine. +// +// The DAM Engine is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero 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 Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero 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. + +namespace Deltares.DamEngine.Data.General.TimeSeries +{ + public class TimeStep + { + public TimeStep() + { + DividerSpecified = false; + } + + public TimeStepUnit Unit { get; set; } + + private uint divider; + public uint Divider + { + get { return divider; } + set + { + divider = value; + DividerSpecified = true; + } + } + + public bool DividerSpecified { get; set; } + public bool MultiplierSpecified { get; set; } + + private uint multiplier; + public uint Multiplier + { + get { return multiplier; } + set + { + multiplier = value; + MultiplierSpecified = true; + } + } + } +} \ No newline at end of file Index: dam engine/branches/Initial Source/Deltares.DamEngine.Data/General/TimeSeries/TimeSerie.cs =================================================================== diff -u --- dam engine/branches/Initial Source/Deltares.DamEngine.Data/General/TimeSeries/TimeSerie.cs (revision 0) +++ dam engine/branches/Initial Source/Deltares.DamEngine.Data/General/TimeSeries/TimeSerie.cs (revision 316) @@ -0,0 +1,239 @@ +// Copyright (C) Stichting Deltares 2017. All rights reserved. +// +// This file is part of the DAM Engine. +// +// The DAM Engine is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero 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 Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero 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; +using System.Collections.Generic; + +namespace Deltares.DamEngine.Data.General.TimeSeries +{ + public class TimeSerie + { + /// + /// List of parameter identifiers used in Fews timeseries + /// + public const string WaterLevelParameterId = "Waterlevel"; + public const string WaterLevelMeanParameterId = "WaterlevelMean"; + public const string WaterLevelStdParameterId = "WaterlevelStdev"; + public const string WaterLevelDistParameterId = "WaterlevelDistribution"; + public const string WaterPressureParameterId = "Waterpressure"; + public const string PiezoMetricHeadId = "PiezoMetricHead"; + + private readonly TimeStep timeStep; + //Bka: read only not possible to serialize to DB private readonly List entries; + private IList entries; + + public const double DefaultMissingValue = -999.0; + + public TimeSerie() + { + timeStep = new TimeStep(); + entries = new List(); + ForecastDateTime = DateTime.MinValue; + } + + public string Type { get; set; } + public string LocationId { get; set; } + public string ParameterId { get; set; } + public TimeStep TimeStep { get { return timeStep; } } + public DateTime StartDateTime { get; set; } + public DateTime EndDateTime { get; set; } + public DateTime ForecastDateTime { get; set; } + public double MissVal { get; set; } + public string LongName { get; set; } + public string StationName { get; set; } + public string Units { get; set; } + public string SourceOrganisation { get; set; } + public string SourceSystem { get; set; } + public string FileDescription { get; set; } + public DateTime? CreationDateTime { get; set; } + public string Region { get; set; } + + public virtual IList Entries + { + get { return entries; } + set { entries = value; } + } + + public string Comment { get; set; } + + /// + /// Creates a shallow copy of the current time serie and applies the map function to each of its entries + /// + /// The time serie entry function which maps uses the current value as input + /// Time serie (clone) with new calculated entries + public TimeSerie Map(Func function) + { + return Map(ParameterId, function); + } + + /// + /// Creates a shallow copy of the current time serie and applies the map function to each of its entries + /// + /// The (new) id of the parameter in the cloned time serie + /// The (new) location id of the cloned time serie + /// The time serie entry function which maps uses the current value as input + /// Time serie (clone) with new calculated entries + public TimeSerie Map(string parameterId, string locationId, Func function) + { + return Map(this, parameterId, locationId, function); + } + + /// + /// Creates a shallow copy of the current time serie and applies the map function to each of its entries + /// + /// The (new) id of the parameter in the cloned time serie + /// The time serie entry function which maps uses the current value as input + /// Time serie (clone) with new calculated entries + public TimeSerie Map(string parameterId, Func function) + { + return Map(this, parameterId, function); + } + + /// + /// Creates a shallow copy of the current time serie and applies the map function to each of its entries + /// + /// The time serie to map from + /// The (new) id of the parameter in the cloned time serie + /// The time serie entry function which maps uses the current value as input + /// Time serie (clone) with new calculated entries + public static TimeSerie Map(TimeSerie timeSerie, string parameterId, Func function) + { + return Map(timeSerie, parameterId, null, function); + } + + /// + /// Creates a shallow copy of the current time serie and applies the map function to each of its entries + /// + /// The time serie to map from + /// The (new) id of the parameter in the cloned time serie + /// The (new) location id of the cloned time serie + /// The time serie entry function which maps uses the current value as input + /// Time serie (clone) with new calculated entries + public static TimeSerie Map(TimeSerie timeSerie, string parameterId, string locationId, Func function) + { + var result = CreateTimeSerie(timeSerie, parameterId); + if (!(string.IsNullOrEmpty(locationId) || locationId.Trim() == "")) + result.LocationId = locationId; + + foreach (var entry in timeSerie.Entries) + result.Entries.Add(function(entry)); + return result; + } + + /// + /// Gets a shallow copy of the time serie without the time serie entries + /// + /// A copy of this time serie + public TimeSerie GetShallowCopy() + { + var serie = new TimeSerie + { + Type = Type, + ParameterId = ParameterId, + LocationId = LocationId, + StartDateTime = StartDateTime, + EndDateTime = EndDateTime, + ForecastDateTime = ForecastDateTime, + MissVal = MissVal, + LongName = LongName, + StationName = StationName, + SourceOrganisation = SourceOrganisation, + SourceSystem = SourceSystem, + FileDescription = FileDescription, + CreationDateTime = CreationDateTime, + Region = Region, + Units = Units, + TimeStep = + { + Multiplier = TimeStep.Multiplier, + Divider = TimeStep.Divider, + Unit = TimeStep.Unit + } + }; + + serie.Entries.Clear(); + return serie; + } + + public static TimeSerie CreateTimeSerie(string locationId) + { + var timeSerie = new TimeSerie + { + MissVal = DefaultMissingValue, + ParameterId = WaterLevelParameterId, + LocationId = locationId, + StationName = locationId, + Type = "instantaneous", + Units = "m", + Comment = "" + }; + + return timeSerie; + } + + + /// + /// Creates a time serie by copying data from the source time serie without + /// time serie entries (shallow copy) + /// + /// The source time serie used to copy from + /// The new parameter ID + /// A time serie copy without time entries + public static TimeSerie CreateTimeSerie(TimeSerie source, string parameterId) + { + var serie = source.GetShallowCopy(); + serie.ParameterId = parameterId; + serie.Units = "-"; + serie.Comment = ""; + return serie; + } + + public double GetValue(DateTime dateTime) + { + foreach (TimeSerieEntry entry in Entries) + { + if (entry.DateTime >= dateTime) + { + return entry.Value; + } + } + + return -1; + } + + public string GetNearestBasisFileName(DateTime dateTime) + { + string res = ""; + double mindiff = 1e99; + double diff; + foreach (TimeSerieEntry entry in Entries) + { + diff = Math.Abs(entry.DateTime.ToFileTimeUtc() - dateTime.ToFileTimeUtc()); + if (diff < mindiff) + { + res = entry.BasisFileName; + mindiff = diff; + } + } + return res; + } + } +} \ No newline at end of file Index: dam engine/branches/Initial Source/Deltares.DamEngine.Data/Geotechnics/SoilSurfaceProfile.cs =================================================================== diff -u -r303 -r316 --- dam engine/branches/Initial Source/Deltares.DamEngine.Data/Geotechnics/SoilSurfaceProfile.cs (.../SoilSurfaceProfile.cs) (revision 303) +++ dam engine/branches/Initial Source/Deltares.DamEngine.Data/Geotechnics/SoilSurfaceProfile.cs (.../SoilSurfaceProfile.cs) (revision 316) @@ -216,7 +216,7 @@ // Otherwise, create and configure a new soil profile soilProfile1D = new SoilProfile1D(); - double top = SurfaceLine.GetZAtX(x); + double top = SurfaceLine.GetZatX(x); soilProfile1D.BottomLevel = soilProfile.BottomLevel; if (top > soilProfile.TopLevel) @@ -234,16 +234,13 @@ if (layer.BottomLevel < top) { // Perform without publishing events because otherwise the soil profile cache would get lost - DataEventPublisher.InvokeWithoutPublishingEvents(() => + var newLayer = new SoilLayer1D(layer.Soil, Math.Min(layer.TopLevel, top)) { - var newLayer = new SoilLayer1D(layer.Soil, Math.Min(layer.TopLevel, top)) - { - IsAquifer = layer.IsAquifer, - WaterpressureInterpolationModel = layer.WaterpressureInterpolationModel, - SoilProfile = soilProfile1D - }; - soilProfile1D.Layers.Add(newLayer); - }); + IsAquifer = layer.IsAquifer, + WaterpressureInterpolationModel = layer.WaterpressureInterpolationModel, + SoilProfile = soilProfile1D + }; + soilProfile1D.Layers.Add(newLayer); } } @@ -287,106 +284,8 @@ return soilProfile2D; } - - #region IDisposable - - public override void Dispose() - { - DataEventPublisher.OnAfterChange -= DataEventPublisherListener; - // TODO: Base also subscribed to this event: reuse? - DataEventPublisher.OnDataListModified -= DataEventPublisherListener; - // TODO: Base also subscribed to this event: reuse? - DataEventPublisher.OnActionCompleted -= DataEventPublisher_OnActionCompleted; - - var disposableSurfaceLine = surfaceLine as IDisposable; - if (disposableSurfaceLine != null) - { - disposableSurfaceLine.Dispose(); - } - - base.Dispose(); - } - - #endregion - + /// - /// Handles the events of the DataEventPublisher control: - /// sets dirty to true if sender is SoilLayer1D and Properties[0] is SoilProfile - /// - /// The source of the event. - /// The instance containing the event data. - private void DataEventPublisherListener(object sender, PublishEventArgs e) - { - if (!dirty && NeedsUpdate(sender)) - { - if (!(sender is SoilLayer1D && e.Properties.Length > 0 && e.Properties[0].Equals("SoilProfile"))) - { - dirty = true; - } - } - if (orgSoilProfile != null && ReferenceEquals(sender, orgSoilProfile.Layers) && e is DataListModifiedArgs) - { - UpdateLayers(); - } - } - - /// - /// Handles the OnActionCompleted event of the DataEventPublisher control: Updates layers. - /// - /// The source of the event. - /// The instance containing the event data. - private void DataEventPublisher_OnActionCompleted(object sender, PublishEventArgs e) - { - if (dirty && !initial) - { - UpdateLayers(); - } - } - - /// - /// Checks whether an update is necessary - /// - /// - /// true if an update is necessary; otherwise, false. - /// - private bool NeedsUpdate(object sender) - { - if (sender == null) - { - return false; - } - - // check surface line - if (sender == surfaceLine - || (surfaceLine != null && sender == surfaceLine.Points)) - { - return true; - } - - // check soil profile - if (sender == orgSoilProfile) - { - return true; - } - - // check soil layers in soil profile - if (sender is SoilLayer1D - && orgSoilProfile != null - && orgSoilProfile.Layers.Any(layer => layer == sender)) - { - return true; - } - - // check points in surface line - if (sender is GeometryPoint && surfaceLine != null) - { - return surfaceLine.Points.Any(point => point == sender); - } - - return false; - } - - /// /// Updates the dike material. /// private void UpdateDikeMaterial() @@ -442,10 +341,10 @@ bottom = data.Bottom; } - var bottomLeft = new GeometryPoint(minX, 0, bottom); - var bottomRight = new GeometryPoint(maxX, 0, bottom); - var topLeft = new GeometryPoint(minX, 0, top); - var topRight = new GeometryPoint(maxX, 0, top); + var bottomLeft = new Point2D(minX, bottom); + var bottomRight = new Point2D(maxX,bottom); + var topLeft = new Point2D(minX, top); + var topRight = new Point2D(maxX, top); data.Points.Add(bottomLeft); data.Points.Add(bottomRight); @@ -460,12 +359,12 @@ private void AddSurfaceLineGeometry(GeometryData data) { - var current = surfaceLine.Points[0]; + var current = new Point2D(surfaceLine.Points[0].X, surfaceLine.Points[0].Z); data.Points.Add(current); for (int i = 1; i < surfaceLine.Points.Count; ++i) { var previous = current; - current = surfaceLine.Points[i]; + current = new Point2D(surfaceLine.Points[i].X, surfaceLine.Points[i].Z); data.Points.Add(current); data.Curves.Add(new GeometryCurve(previous, current)); @@ -493,9 +392,9 @@ private void AddVerticalAt(GeometryData aGeometry, double x) { - const double ymax = 100000.0; - var topX = new GeometryPoint(x, 0, ymax); - var bottomX = new GeometryPoint(x, 0, -ymax); + const double zMax = 100000.0; + var topX = new Point2D(x, zMax); + var bottomX = new Point2D(x, -zMax); aGeometry.Points.Add(topX); aGeometry.Points.Add(bottomX); aGeometry.Curves.Add(new GeometryCurve(topX, bottomX)); Index: dam engine/branches/Initial Source/Deltares.DamEngine.Data/Standard/ComputeDoubles.cs =================================================================== diff -u -r303 -r316 --- dam engine/branches/Initial Source/Deltares.DamEngine.Data/Standard/ComputeDoubles.cs (.../ComputeDoubles.cs) (revision 303) +++ dam engine/branches/Initial Source/Deltares.DamEngine.Data/Standard/ComputeDoubles.cs (.../ComputeDoubles.cs) (revision 316) @@ -96,5 +96,19 @@ return false; } + + /// + /// Determines whether the specified value is nearly zero. + /// + /// Uses a tolerance of 1e-3. + public static bool IsZero(this double aValue1) + { + if (Math.Abs(aValue1 - 0.0) < cEpsilon) + { + return true; + } + + return false; + } } } \ No newline at end of file Index: dam engine/branches/Initial Source/Deltares.DamEngine.Data/General/FailureMechanismeParamatersMStab.cs =================================================================== diff -u -r303 -r316 --- dam engine/branches/Initial Source/Deltares.DamEngine.Data/General/FailureMechanismeParamatersMStab.cs (.../FailureMechanismeParamatersMStab.cs) (revision 303) +++ dam engine/branches/Initial Source/Deltares.DamEngine.Data/General/FailureMechanismeParamatersMStab.cs (.../FailureMechanismeParamatersMStab.cs) (revision 316) @@ -19,7 +19,9 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. +using Deltares.DamEngine.Data.General.PlLines; using Deltares.DamEngine.Data.Geotechnics; +using Deltares.DamEngine.Data.Standard; using Deltares.DamEngine.Data.Standard.Validation; namespace Deltares.DamEngine.Data.General Index: dam engine/branches/Initial Source/Deltares.DamEngine.Data/General/Results/LocationResult.cs =================================================================== diff -u --- dam engine/branches/Initial Source/Deltares.DamEngine.Data/General/Results/LocationResult.cs (revision 0) +++ dam engine/branches/Initial Source/Deltares.DamEngine.Data/General/Results/LocationResult.cs (revision 316) @@ -0,0 +1,74 @@ +// Copyright (C) Stichting Deltares 2017. All rights reserved. +// +// This file is part of the DAM Engine. +// +// The DAM Engine is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero 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 Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero 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 Deltares.DamEngine.Data.General.TimeSeries; +using Deltares.DamEngine.Data.RWScenarios; + +namespace Deltares.DamEngine.Data.General.Results +{ + public class LocationResult + { + private TimeSerie stabilityTimeSerie = new TimeSerie(); + private TimeSerie pipingTimeSerie = new TimeSerie(); + private RWScenariosResult rwScenariosResult = null; + private RWSchematizationFactorsResult schematizationFactorsResult = null; + + public LocationResult() + { + } + + public virtual TimeSerie StabilityTimeSerie + { + get { return stabilityTimeSerie; } + set + { + stabilityTimeSerie = value; + } + } + + public TimeSerie PipingTimeSerie + { + get { return pipingTimeSerie; } + set + { + pipingTimeSerie = value; + } + } + + public virtual RWScenariosResult RWScenariosResult + { + get { return rwScenariosResult; } + set + { + rwScenariosResult = value; + } + } + + public RWSchematizationFactorsResult SchematizationFactorsResult + { + get { return schematizationFactorsResult; } + set + { + schematizationFactorsResult = value; + } + } + } +} Index: dam engine/branches/Initial Source/Deltares.DamEngine.Data/General/TimeSeries/TimeSerieEntry.cs =================================================================== diff -u --- dam engine/branches/Initial Source/Deltares.DamEngine.Data/General/TimeSeries/TimeSerieEntry.cs (revision 0) +++ dam engine/branches/Initial Source/Deltares.DamEngine.Data/General/TimeSeries/TimeSerieEntry.cs (revision 316) @@ -0,0 +1,85 @@ +// Copyright (C) Stichting Deltares 2017. All rights reserved. +// +// This file is part of the DAM Engine. +// +// The DAM Engine is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero 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 Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero 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; +using Deltares.DamEngine.Data.Standard; + +namespace Deltares.DamEngine.Data.General.TimeSeries +{ + public class TimeSerieEntry + { + public TimeSerieEntry() + { + } + + public TimeSerieEntry(DateTime dateTime, double value) + { + this.DateTime = dateTime; + this.Value = value; + } + + public virtual DateTime DateTime { get; set; } + public virtual double Value { get; set; } + public virtual string BasisFileName { get; set; } + public string RelativeCalculationPathName { get; set; } + + //public Stochast StochastValue { get; set; } #Bka: for now just disable. + public int Flag { get; set; } + + public TimeSerieEntry GetShallowCopy() + { + return new TimeSerieEntry + { + DateTime = DateTime, + Flag = Flag, + }; + } + + public TimeSerieEntry Map(Func function) + { + return Map(0, function); + } + + public TimeSerieEntry Map(double missingValue, Func function) + { + var entry = this.GetShallowCopy(); + try + { + entry.Value = !this.Value.AlmostEquals(missingValue) ? function(this) : missingValue; + } + catch + { + entry.Value = missingValue; + } + return entry; + } + + public void Assign(TimeSerieEntry entry) + { + this.DateTime = entry.DateTime; + this.Value = entry.Value; + this.BasisFileName = entry.BasisFileName; + //this.StochastValue = entry.StochastValue; #Bka: for now just disable + this.Flag = entry.Flag; + } + + } +} \ No newline at end of file Index: dam engine/branches/Initial Source/Deltares.DamEngine.Data/Geotechnics/SoilProfile2D.cs =================================================================== diff -u -r303 -r316 --- dam engine/branches/Initial Source/Deltares.DamEngine.Data/Geotechnics/SoilProfile2D.cs (.../SoilProfile2D.cs) (revision 303) +++ dam engine/branches/Initial Source/Deltares.DamEngine.Data/Geotechnics/SoilProfile2D.cs (.../SoilProfile2D.cs) (revision 316) @@ -31,9 +31,9 @@ /// public class SoilProfile2D : SoilProfile { - private readonly Dictionary cachedSoilProfiles1D = new Dictionary(); - private GeometryData geometry = new GeometryData(); - private readonly List surfaces = new List(); + protected readonly Dictionary cachedSoilProfiles1D = new Dictionary(); + protected GeometryData geometry = new GeometryData(); + protected readonly List surfaces = new List(); /// /// Initializes a new instance of the class. @@ -50,7 +50,7 @@ /// The surfaces. /// [Validate] - public IList Surfaces + public virtual IList Surfaces { get { @@ -81,7 +81,7 @@ /// /// The x. /// Soil Profile 1D - public SoilProfile1D GetSoilProfile1D(double x) + public virtual SoilProfile1D GetSoilProfile1D(double x) { const double diff = 0.001; SoilProfile1D soilProfile = GetCachedSoilProfile1D(x); @@ -176,7 +176,7 @@ /// /// The x. /// - private SoilProfile1D GetCachedSoilProfile1D(double x) + protected SoilProfile1D GetCachedSoilProfile1D(double x) { if (cachedSoilProfiles1D.ContainsKey(x)) { Index: dam engine/branches/Initial Source/Deltares.DamEngine.Data/General/PlLines/PLLine.cs =================================================================== diff -u --- dam engine/branches/Initial Source/Deltares.DamEngine.Data/General/PlLines/PLLine.cs (revision 0) +++ dam engine/branches/Initial Source/Deltares.DamEngine.Data/General/PlLines/PLLine.cs (revision 316) @@ -0,0 +1,129 @@ +// Copyright (C) Stichting Deltares 2017. All rights reserved. +// +// This file is part of the DAM Engine. +// +// The DAM Engine is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero 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 Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero 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; +using System.Collections.Generic; +using System.Linq; +using System.Xml.Serialization; +using Deltares.DamEngine.Data.Geometry; +using Deltares.DamEngine.Data.Standard; + +namespace Deltares.DamEngine.Data.General.PlLines +{ + public class PLLinePoint : GeometryPoint + { + public PLLinePoint() : this (0, 0) { } + + public PLLinePoint(double aX, double aZ) : base(aX, aZ) + { + } + } + + public class PLLine : PolyLine, ICloneable + { + private PLLineType plLineType; + + [XmlIgnore] + public PLLineType PLLineType + { + get { return plLineType; } + set + { + plLineType = value; + PLLineTypeSpecified = true; + } + } + + [XmlIgnore] + public bool PLLineTypeSpecified { get; private set; } + + + public bool IsPhreatic { get; set; } + + public int BoundaryLayer { get; set; } + + public PLLine Clone() + { + PLLine plLine = new PLLine() { IsPhreatic = this.IsPhreatic, BoundaryLayer = this.BoundaryLayer }; + foreach (PLLinePoint point in this.Points) + { + PLLinePoint newPoint = new PLLinePoint() { X = point.X, Y = point.Y, Z = point.Z }; + plLine.Points.Add(newPoint); + } + return plLine; + } + + /// + /// Gets the points in the segment between starting x and ending x + /// + /// + /// + /// + /// + /// + public IEnumerable GetPointSegmentBetween(double startX, double endX) + { + if (endX < startX) + throw new ArgumentException("End value is smaller then the start value"); + + return from point in this.PointsOrderdByX + where point != null && (point.X > startX && point.X < endX) + orderby point.X ascending + select point; + } + + /// + /// Determines whether the given point is above, beneath or on the surfaceline. + /// + /// + /// + public PLLinePointPositionXzType PositionXzOfPointRelatedToPLLine(GeometryPoint point) + { + // if point is out of scope of the surface line, return beyond + if ((point.X < points[0].X) || (point.X > points[points.Count - 1].X)) + return PLLinePointPositionXzType.BeyondPLLine; + + double z = ZFromX(point.X); + if (Math.Abs(point.Z - z) < GeometryPoint.Precision) + { + return PLLinePointPositionXzType.OnPLLine; + } + else + { + if (point.Z > z) + { + return PLLinePointPositionXzType.AbovePLLine; + } + else + { + return PLLinePointPositionXzType.BelowPLLine; + } + } + } + + private IEnumerable PointsOrderdByX + { + get { return this.Points.OrderBy(p => p.X); } + } + + } + +} Index: dam engine/branches/Initial Source/Deltares.DamEngine.Data/General/PlLines/PLLines.cs =================================================================== diff -u --- dam engine/branches/Initial Source/Deltares.DamEngine.Data/General/PlLines/PLLines.cs (revision 0) +++ dam engine/branches/Initial Source/Deltares.DamEngine.Data/General/PlLines/PLLines.cs (revision 316) @@ -0,0 +1,46 @@ +// Copyright (C) Stichting Deltares 2017. All rights reserved. +// +// This file is part of the DAM Engine. +// +// The DAM Engine is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero 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 Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero 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; + +namespace Deltares.DamEngine.Data.General.PlLines +{ + public class PLLines + { + IDictionary lines; + public PLLines() + { + lines = new Dictionary(); + foreach (PLLineType plLineType in PLLineType.GetValues(typeof(PLLineType))) + { + this.Lines[plLineType] = new PLLine(); + } + } + + public IDictionary Lines + { + get { return this.lines; } + private set { this.lines = value; } + } + public int PLLineCount { get { return PLLineType.GetValues(typeof(PLLineType)).GetLength(0); } } + + } +} Index: dam engine/branches/Initial Source/Deltares.DamEngine.Data/General/DamProjectCalculationSpecification.cs =================================================================== diff -u --- dam engine/branches/Initial Source/Deltares.DamEngine.Data/General/DamProjectCalculationSpecification.cs (revision 0) +++ dam engine/branches/Initial Source/Deltares.DamEngine.Data/General/DamProjectCalculationSpecification.cs (revision 316) @@ -0,0 +1,153 @@ +// Copyright (C) Stichting Deltares 2017. All rights reserved. +// +// This file is part of the DAM Engine. +// +// The DAM Engine is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero 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 Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero 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.Xml.Serialization; +using Deltares.DamEngine.Data.Standard.Language; +using Deltares.DamEngine.Data.Standard.Validation; + +namespace Deltares.DamEngine.Data.General +{ + /// + /// Represents the calculation specifications at project level for DAM. + /// These are the main choices that specify the calculation + /// + public class DamProjectCalculationSpecification + { + private readonly List damCalculationSpecifications; + + private static AnalysisType selectedAnalysisType = AnalysisType.AdaptGeometry; + private ProbabilisticType selectedProbabilisticType; + private DamFailureMechanismeCalculationSpecification currentSpecification; + private StabilityKernelType selectedStabilityKernelType; + + public DamProjectCalculationSpecification() + { + damCalculationSpecifications = new List(); + //waterLevelTimeSeriesFileName = @"d:\src\delftgeosystems\trunk\data\Dam\RRD\Groot Salland\DAM UI Testdata\inputshortstart_dam.xml"; + } + + [Validate] + public List DamCalculationSpecifications + { + get + { + + if (currentSpecification != null && currentSpecification.FailureMechanismSystemType != FailureMechanismSystemType.Piping) + { + selectedProbabilisticType = ProbabilisticType.Deterministic; + } + return damCalculationSpecifications; + } + } + + /// + /// Gets or sets the analysis type for serialization purpose only. + /// This "dummy" property is and must be only used for serialization/deserialization purposes as the real static property + /// SelectedAnalysisType is NOT serialized. This is way its name is deliberately strange. + /// + /// + /// The analysis type for serialization purpose only. + /// + public AnalysisType AnalysisTypeForSerializationPurposeOnly + { + get + { + return selectedAnalysisType; + } + set + { + selectedAnalysisType = value; + } + + } + + /// + /// Gets or sets the type of the selected analysis. + /// + /// + /// The type of the selected analysis. + /// + public static AnalysisType SelectedAnalysisType + { + get { return selectedAnalysisType; } + set + { + selectedAnalysisType = value; + } + } + + public ProbabilisticType SelectedProbabilisticType + { + get { return selectedProbabilisticType; } + set + { + selectedProbabilisticType = value; + DamFailureMechanismeCalculationSpecification.ProbabilisticType = selectedProbabilisticType; + } + } + + [XmlIgnore] + public DamFailureMechanismeCalculationSpecification CurrentSpecification + { + get + { + if (currentSpecification == null && damCalculationSpecifications.Count > 0) + { + currentSpecification = damCalculationSpecifications[0]; + } + + return currentSpecification; + } + set + { + currentSpecification = value; + } + } + + public StabilityKernelType SelectedStabilityKernelType + { + get { return selectedStabilityKernelType; } + set + { + selectedStabilityKernelType = value; + if (currentSpecification != null) + { + currentSpecification.StabilityKernelType = selectedStabilityKernelType; + } + } + } + + [Validate] + public ValidationResult[] Validate() + { + if (damCalculationSpecifications.Count > 1) + { + return new[]{ new ValidationResult(ValidationResultType.Error, LocalizationManager.GetTranslatedText(this, "MaxOneCalculationSpecification"), + this)}; + } + else + { + return new ValidationResult[0]; + } + } + } +} Index: dam engine/branches/Initial Source/Deltares.DamEngine.Data/Deltares.DamEngine.Data.csproj =================================================================== diff -u -r303 -r316 --- dam engine/branches/Initial Source/Deltares.DamEngine.Data/Deltares.DamEngine.Data.csproj (.../Deltares.DamEngine.Data.csproj) (revision 303) +++ dam engine/branches/Initial Source/Deltares.DamEngine.Data/Deltares.DamEngine.Data.csproj (.../Deltares.DamEngine.Data.csproj) (revision 316) @@ -67,27 +67,39 @@ + + + - + + + + + + + + + + @@ -145,6 +157,7 @@ + Index: dam engine/branches/Initial Source/Deltares.DamEngine.Data/General/Results/RWSchematizationFactorsResult.cs =================================================================== diff -u --- dam engine/branches/Initial Source/Deltares.DamEngine.Data/General/Results/RWSchematizationFactorsResult.cs (revision 0) +++ dam engine/branches/Initial Source/Deltares.DamEngine.Data/General/Results/RWSchematizationFactorsResult.cs (revision 316) @@ -0,0 +1,116 @@ +// Copyright (C) Stichting Deltares 2017. All rights reserved. +// +// This file is part of the DAM Engine. +// +// The DAM Engine is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero 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 Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero 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 Deltares.DamEngine.Data.Standard.Calculation; + +namespace Deltares.DamEngine.Data.General.Results +{ + public class RWSchematizationFactorsResult + { + private List schematizationFactorResults = new List(); + + public List SchematizationFactorResults + { + get { return schematizationFactorResults; } + set { schematizationFactorResults = value; } + } + } + + public class RWSchematizationFactorResult + { + private Location location; + private SchematizationType schematizationType; + private string soilProfileName; + private double schematizationFactor; + private double summedProfileProbability; + private CalculationResult calculationResult; + private ScenarioType decisiveScenarioName; + private string originalDecisiveSoilProfileName; + private double detrimentFactor; + private double safetyFactor; + + public virtual Location Location + { + get { return location; } + set { location = value; } + } + + public string LocationName + { + get { return this.Location != null ? this.Location.Name : ""; } + } + + public SchematizationType SchematizationType + { + get { return schematizationType; } + set { schematizationType = value; } + } + + public string SoilProfileName + { + get { return soilProfileName; } + set { soilProfileName = value; } + } + + public string OriginalDecisiveSoilProfileName + { + get { return originalDecisiveSoilProfileName; } + set { originalDecisiveSoilProfileName = value; } + } + + public double SchematizationFactor + { + get { return schematizationFactor; } + set { schematizationFactor = value; } + } + + public double SummedProfileProbability + { + get { return summedProfileProbability; } + set { summedProfileProbability = value; } + } + + public ScenarioType DecisiveScenarioName + { + get { return decisiveScenarioName; } + set { decisiveScenarioName = value; } + } + + public double DetrimentFactor + { + get { return detrimentFactor; } + set { detrimentFactor = value; } + } + + public double SafetyFactor + { + get { return safetyFactor; } + set { safetyFactor = value; } + } + + public CalculationResult CalculationResult + { + get { return calculationResult; } + set { calculationResult = value; } + } + } +} Index: dam engine/branches/Initial Source/Deltares.DamEngine.Data/General/Results/JobResultInterpreter.cs =================================================================== diff -u --- dam engine/branches/Initial Source/Deltares.DamEngine.Data/General/Results/JobResultInterpreter.cs (revision 0) +++ dam engine/branches/Initial Source/Deltares.DamEngine.Data/General/Results/JobResultInterpreter.cs (revision 316) @@ -0,0 +1,60 @@ +// Copyright (C) Stichting Deltares 2017. All rights reserved. +// +// This file is part of the DAM Engine. +// +// The DAM Engine is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero 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 Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero 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. + +namespace Deltares.DamEngine.Data.General.Results +{ + public class JobResultInterpreter + { + public static JobResult GetJobResult(double result, double demand, bool smaller) + { + if (result >= DamGlobalConstants.NoRunValue) + { + return JobResult.NoRun; + } + else if (result < 0 || double.IsNaN(result)) + { + return JobResult.Failed; + } + else if (smaller) + { + if (result < demand) + { + return JobResult.Bad; + } + else + { + return JobResult.Good; + } + } + else + { + if (result > demand) + { + return JobResult.Bad; + } + else + { + return JobResult.Good; + } + } + } + } +} Index: dam engine/branches/Initial Source/Deltares.DamEngine.Data/General/IAssignable.cs =================================================================== diff -u --- dam engine/branches/Initial Source/Deltares.DamEngine.Data/General/IAssignable.cs (revision 0) +++ dam engine/branches/Initial Source/Deltares.DamEngine.Data/General/IAssignable.cs (revision 316) @@ -0,0 +1,31 @@ +// Copyright (C) Stichting Deltares 2017. All rights reserved. +// +// This file is part of the DAM Engine. +// +// The DAM Engine is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero 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 Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero 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.Runtime.InteropServices; + +namespace Deltares.DamEngine.Data.General +{ + [ComVisible(true)] + public interface IAssignable + { + void Assign(T t); + } +} \ No newline at end of file Fisheye: Tag 316 refers to a dead (removed) revision in file `dam engine/branches/Initial Source/Deltares.DamEngine.Data/General/PlLines/PLLinesCreator.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: dam engine/branches/Initial Source/Deltares.DamEngine.Controllers/PLLinesCreator.cs =================================================================== diff -u -r303 -r316 --- dam engine/branches/Initial Source/Deltares.DamEngine.Controllers/PLLinesCreator.cs (.../Deltares.DamEngine.Data/General/PlLines/PLLinesCreator.cs) (revision 303) +++ dam engine/branches/Initial Source/Deltares.DamEngine.Controllers/PLLinesCreator.cs (.../Deltares.DamEngine.Controllers/PLLinesCreator.cs) (revision 316) @@ -23,12 +23,14 @@ using System.Collections.Generic; using System.Linq; using System.Runtime.Serialization; +using Deltares.DamEngine.Data.General; using Deltares.DamEngine.Data.General.Gauges; +using Deltares.DamEngine.Data.General.PlLines; using Deltares.DamEngine.Data.Geometry; using Deltares.DamEngine.Data.Geotechnics; using Deltares.DamEngine.Data.Standard; -namespace Deltares.DamEngine.Data.General.PlLines +namespace Deltares.DamEngine.Controllers { [Serializable] public class PLLinesCreatorException : Exception Index: dam engine/branches/Initial Source/Deltares.DamEngine.Data/General/PlLines/DupuitPLLines.cs =================================================================== diff -u --- dam engine/branches/Initial Source/Deltares.DamEngine.Data/General/PlLines/DupuitPLLines.cs (revision 0) +++ dam engine/branches/Initial Source/Deltares.DamEngine.Data/General/PlLines/DupuitPLLines.cs (revision 316) @@ -0,0 +1,36 @@ +// Copyright (C) Stichting Deltares 2017. All rights reserved. +// +// This file is part of the DAM Engine. +// +// The DAM Engine is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero 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 Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero 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; + +namespace Deltares.DamEngine.Data.General.PlLines +{ + public class DupuitPLLines + { + private List plLines = new List(); + + public List PLLines + { + get { return plLines; } + set { plLines = value; } + } + } +} Index: dam engine/branches/Initial Source/Deltares.DamEngine.Data/Geotechnics/SoilProfile.cs =================================================================== diff -u -r303 -r316 --- dam engine/branches/Initial Source/Deltares.DamEngine.Data/Geotechnics/SoilProfile.cs (.../SoilProfile.cs) (revision 303) +++ dam engine/branches/Initial Source/Deltares.DamEngine.Data/Geotechnics/SoilProfile.cs (.../SoilProfile.cs) (revision 316) @@ -52,7 +52,7 @@ /// List of Preconsolidation stresses related to a soil profile /// [Validate] - public List PreconsolidationStresses + public virtual List PreconsolidationStresses { get { Index: dam engine/branches/Initial Source/Deltares.DamEngine.Data/Geometry/GeometryData.cs =================================================================== diff -u -r303 -r316 --- dam engine/branches/Initial Source/Deltares.DamEngine.Data/Geometry/GeometryData.cs (.../GeometryData.cs) (revision 303) +++ dam engine/branches/Initial Source/Deltares.DamEngine.Data/Geometry/GeometryData.cs (.../GeometryData.cs) (revision 316) @@ -301,8 +301,20 @@ #endregion #region remove functions - + /// + /// Clears this instance. + /// + public void Clear() + { + pointDataList.Clear(); + curveDataList.Clear(); + surfaceDataList.Clear(); + + newlyEffectedPoints.Clear(); + newlyEffectedCurves.Clear(); + } + /// /// deletes all the Loop from IGeometryLoop. /// private void DeleteAllLoops() Index: dam engine/branches/Initial Source/Deltares.DamEngine.Data/General/SchematizationFactor/SchematizationFactorData.cs =================================================================== diff -u --- dam engine/branches/Initial Source/Deltares.DamEngine.Data/General/SchematizationFactor/SchematizationFactorData.cs (revision 0) +++ dam engine/branches/Initial Source/Deltares.DamEngine.Data/General/SchematizationFactor/SchematizationFactorData.cs (revision 316) @@ -0,0 +1,67 @@ +// Copyright (C) Stichting Deltares 2017. All rights reserved. +// +// This file is part of the DAM Engine. +// +// The DAM Engine is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero 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 Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero 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. + +namespace Deltares.DamEngine.Data.General.SchematizationFactor +{ + public class SchematizationFactorData + { + private double schematizationFactorMin = 1.05; + private double schematizationFactorMax = 1.25; + private double schematizationFactorDelta = 0.025; + private double requiredProbability = 70.0; + + public double SchematizationFactorMin + { + get { return schematizationFactorMin; } + set + { + schematizationFactorMin = value; + } + } + + public double SchematizationFactorMax + { + get { return schematizationFactorMax; } + set + { + schematizationFactorMax = value; + } + } + + public double SchematizationFactorDelta + { + get { return schematizationFactorDelta; } + set + { + schematizationFactorDelta = value; + } + } + + public double RequiredProbability + { + get { return requiredProbability; } + set + { + requiredProbability = value; + } + } + } +} Index: dam engine/branches/Initial Source/Deltares.DamEngine.Data/Geotechnics/SurfaceLine2Extensions.cs =================================================================== diff -u -r303 -r316 --- dam engine/branches/Initial Source/Deltares.DamEngine.Data/Geotechnics/SurfaceLine2Extensions.cs (.../SurfaceLine2Extensions.cs) (revision 303) +++ dam engine/branches/Initial Source/Deltares.DamEngine.Data/Geotechnics/SurfaceLine2Extensions.cs (.../SurfaceLine2Extensions.cs) (revision 316) @@ -119,5 +119,20 @@ } return null; } + + /// + /// Checks if a surfaceline has all characteristic point types required to describe + /// a dike. + /// + /// Surfaceline to be checked. + /// True if there are characteristic points defined that describe a dike; + /// False otherwise. + public static bool HasDike(this SurfaceLine2 line) + { + return IsDefined(line, CharacteristicPointType.DikeToeAtRiver) && + IsDefined(line, CharacteristicPointType.DikeTopAtRiver) && + IsDefined(line, CharacteristicPointType.DikeTopAtPolder) && + IsDefined(line, CharacteristicPointType.DikeToeAtPolder); + } } } \ No newline at end of file Index: dam engine/branches/Initial Source/Deltares.DamEngine.Controllers/Deltares.DamEngine.Controllers.csproj =================================================================== diff -u -r303 -r316 --- dam engine/branches/Initial Source/Deltares.DamEngine.Controllers/Deltares.DamEngine.Controllers.csproj (.../Deltares.DamEngine.Controllers.csproj) (revision 303) +++ dam engine/branches/Initial Source/Deltares.DamEngine.Controllers/Deltares.DamEngine.Controllers.csproj (.../Deltares.DamEngine.Controllers.csproj) (revision 316) @@ -60,6 +60,7 @@ +