Index: dam engine/branches/Initial Source/Deltares.DamEngine.Calculators/General/ThrowHelper.cs
===================================================================
diff -u
--- dam engine/branches/Initial Source/Deltares.DamEngine.Calculators/General/ThrowHelper.cs (revision 0)
+++ dam engine/branches/Initial Source/Deltares.DamEngine.Calculators/General/ThrowHelper.cs (revision 330)
@@ -0,0 +1,281 @@
+// 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.Globalization;
+using System.IO;
+using System.Linq;
+using System.Reflection;
+using System.Resources;
+using Deltares.DamEngine.Data.General;
+
+namespace Deltares.DamEngine.Calculators.General
+{
+ ///
+ /// Declares the string resource names
+ ///
+ internal enum StringResourceNames
+ {
+ CsvFileNotFound,
+ CsvFileNotValid,
+ CsvHeaderEmptyOrNull,
+ CsvHeaderNotValid,
+ CsvObjectMaterializerNotValid,
+ CsvSplitterPatternNotValid,
+ DataImportArgumentNull,
+ EntityAlreadyExist,
+ EntityFactoryArgumentNull,
+ ImportFileNotExist,
+ ImportFolderNotExist,
+ ImportFolderNullOrEmpty,
+ MStabExecutableFileNameNotFound,
+ SlopeWExecutableFileNameNotFound,
+ OutputFileNotExist,
+ OutputFileHasNoContent,
+ OutputFileNameNotValid,
+ ProjectFileNameNullOrEmpty,
+ ProjectFileNotExist,
+ SegmentIdArgumentNullOrEmpty,
+ SoilProfileIdArgumentNullOrEmpty,
+ SurfaceLineIdArgumentNullOrEmpty,
+ RequiredEntityDoesNotExist,
+ ImportFilesNotValidated,
+ RequiredParameterMissing,
+ SurfacelineIsNotInsideSoilprofile,
+ TopLayerToBeEvaluatedNotInsideSoilprofile,
+ SoilAttachedToLayerNotValid,
+ ImportDataNotValid,
+ ImportedLocationDoesntHaveValidSurfaceLines,
+ ImportedLocationDoesntHaveValidPL1Lines,
+ SurfaceLinePointNotExtists,
+ NonExistentLocation,
+ TwoSandlayersRequiredInSoilProfile,
+ CsvColumnIndexAlreadyExists,
+ WaterLevelInputFileNullOrEmpty,
+ NoSoilProfileDefinedForLocation,
+ LocationHasNoSegment,
+ FileNameNotValid,
+ GaugeIdArgumentNullOrEmpty,
+ LocationIdArgumentNullOrEmpty,
+ ImportedLocationDoesntHaveSoilprofile,
+ SoildatabaseNotFound,
+ SurfaceLineNotAssigned,
+ SoilProfileNotAssigned,
+ SoilListIsNull,
+ PL1NotCreated,
+ NonWaterRetainingObjectCategoryArgumentNullOrEmpty,
+ NonWaterRetainingObjectTypeArgumentNullOrEmpty
+ }
+
+ ///
+ /// Defines a helper class for getting string resources
+ ///
+ ///
+ /// The class implements a singleton pattern
+ ///
+ internal class StringResources
+ {
+ ///
+ /// Holds a single reference to this class
+ ///
+ private static StringResources instance;
+
+ ///
+ /// The sync method for making this class thread safe
+ ///
+ private static readonly object sync = new object();
+
+ ///
+ /// The actual resource manager
+ ///
+ private readonly ResourceManager resources;
+
+ // Methods
+ internal StringResources()
+ {
+ this.resources = new ResourceManager("Deltares.Dam.Data.Properties.Resources", Assembly.GetExecutingAssembly());
+ }
+
+ ///
+ /// Gets the sinlgeton instance
+ ///
+ /// A reference to this class instance
+ private static StringResources GetInstance()
+ {
+ if (instance == null)
+ {
+ lock (sync)
+ {
+ if (instance == null)
+ {
+ instance = new StringResources();
+ }
+ }
+ }
+ return instance;
+ }
+
+ ///
+ /// Getst the string from the from the resource manager
+ ///
+ /// The name of the resource
+ /// The resource string
+ public static string GetString(string name)
+ {
+ var loader = GetInstance();
+ if (loader == null)
+ {
+ return null;
+ }
+ return loader.resources.GetString(name, CultureInfo.CurrentCulture);
+ }
+ }
+
+ ///
+ ///
+ ///
+ internal static class ThrowHelper
+ {
+ internal static string GetResourceString(StringResourceNames resourceNames)
+ {
+ return StringResources.GetString(resourceNames.ToString());
+ }
+
+ internal static void ThrowIfArgumentNull(object value, StringResourceNames resourceNamesName)
+ {
+ if (value == null)
+ throw new ArgumentNullException(StringResources.GetString(GetResourceString(resourceNamesName)));
+ }
+
+ internal static void ThrowIfStringArgumentNullOrEmpty(string value, StringResourceNames resourceNamesName)
+ {
+ if (string.IsNullOrEmpty(value) || value.Trim() == "")
+ throw new ArgumentException(GetResourceString(resourceNamesName));
+ }
+
+ internal static void ThrowIfFileNameNullOrEmpty(string fileName)
+ {
+ ThrowIfFileNameNullOrEmpty(fileName, StringResourceNames.FileNameNotValid);
+ }
+
+ internal static void ThrowIfFileNameNullOrEmpty(string fileName, StringResourceNames resourceName)
+ {
+ ThrowIfFileNameNullOrEmpty(fileName, resourceName);
+ }
+
+ internal static void ThrowIfFileNameNullOrEmpty(string fileName, StringResourceNames resourceName)
+ where TException : Exception
+ {
+ ThrowWhenConditionIsTrue(resourceName,
+ () => string.IsNullOrEmpty(fileName) || fileName.Trim() == "");
+ }
+
+ internal static void ThrowIfFileNotExist(string fileName, StringResourceNames resourceNamesName)
+ {
+ if (!File.Exists(fileName))
+ throw new FileNotFoundException(string.Format(GetResourceString(resourceNamesName), String.Format("{0} in {1}", (fileName ?? ""), DamProjectData.ProjectWorkingPath)));
+ }
+
+ internal static void ThrowIfDirectoryNotExist(string dirName, StringResourceNames resourceNamesName)
+ {
+ if (!Directory.Exists(dirName))
+ throw new DirectoryNotFoundException(string.Format(GetResourceString(resourceNamesName), dirName ?? "supplied"));
+ }
+
+ internal static void ThrowWhenConditionIsTrue(Func condition, Func exceptionFactory)
+ where TException : Exception
+ {
+ if (condition())
+ throw exceptionFactory();
+ }
+
+ public static void ThrowWhenConditionIsTrue(string message, Func condition)
+ where TException : Exception
+ {
+ var exception = (Exception)Activator.CreateInstance(typeof(TException), new object[] { message });
+
+ if (condition())
+ throw exception;
+ }
+
+ internal static void ThrowWhenConditionIsTrue(StringResourceNames resourceName, Func condition)
+ where TException : Exception
+ {
+ var exception = (Exception)Activator.CreateInstance(
+ typeof(TException), new object[] { GetResourceString(resourceName) });
+
+ if (condition())
+ throw exception;
+ }
+
+ internal static void ThrowWhenConditionIsTrue(TArgument arg, StringResourceNames resourceName,
+ Func condition, Func exceptionFactory)
+ where TException : Exception
+ {
+ var exception = exceptionFactory(resourceName);
+ if (condition(arg))
+ throw exception;
+ }
+
+ public static void ThrowWhenParameterIsMissing(object owner, string parameterName, object parameterValue)
+ {
+ if (parameterValue == null)
+ {
+ throw new ParameterMissingException(
+ string.Format(GetResourceString(StringResourceNames.RequiredParameterMissing), parameterName, owner.GetType().Name));
+ }
+ }
+
+ public static void ThrowWhenParameterIsMissing(object owner, string propertyName)
+ {
+ var pi = owner.GetType().GetProperty(propertyName);
+ var propertyValue = pi.GetValue(owner, null);
+
+ if (propertyValue == null)
+ {
+ throw new ParameterMissingException(
+ string.Format(GetResourceString(StringResourceNames.RequiredParameterMissing), propertyName, owner.GetType().Name));
+ }
+ }
+
+ public static void ThrowWhenRequiredEntityDoesntExistInLookup(object id) where T : new()
+ {
+ throw new RequiredEntityNotExistException(
+ GetResourceString(StringResourceNames.RequiredEntityDoesNotExist),
+ typeof(T),
+ id);
+ }
+
+ public static T ThrowWhenRequiredEntityDoesntExistInLookup(IEnumerable lookup, object id, Func predicate) where T : new()
+ {
+ var entity = lookup.FirstOrDefault(predicate);
+ if (Equals(entity, default(T)))
+ {
+ throw new RequiredEntityNotExistException(
+ GetResourceString(StringResourceNames.RequiredEntityDoesNotExist),
+ typeof(T),
+ id);
+ }
+ return entity;
+ }
+ }
+}
Index: dam engine/branches/Initial Source/Deltares.DamEngine.Data/Geotechnics/Soil.cs
===================================================================
diff -u -r303 -r330
--- dam engine/branches/Initial Source/Deltares.DamEngine.Data/Geotechnics/Soil.cs (.../Soil.cs) (revision 303)
+++ dam engine/branches/Initial Source/Deltares.DamEngine.Data/Geotechnics/Soil.cs (.../Soil.cs) (revision 330)
@@ -38,6 +38,7 @@
private ShearStrengthModel shearStrengthModel = ShearStrengthModel.CPhi;
private double belowPhreaticLevel = double.NaN;
private double abovePhreaticLevel = double.NaN;
+ private double dryUnitWeight = double.NaN;
private double cohesion = double.NaN;
private double frictionAngle = double.NaN;
private double poP = double.NaN;
@@ -167,9 +168,31 @@
return abovePhreaticLevel;
}
}
-
+
#endregion
+ #region property DryUnitWeight
+
+ ///
+ /// Ovendry unit weight [kN/m3]
+ ///
+ public double DryUnitWeight
+ {
+ get
+ {
+ return dryUnitWeight;
+ }
+ set
+ {
+ if (!dryUnitWeight.Equals(value))
+ {
+ dryUnitWeight = value;
+ }
+ }
+ }
+
+ #endregion property DryUnitWeight
+
#region property Cohesion
///
Index: dam engine/branches/Initial Source/Deltares.DamEngine.Data/Standard/StaticReflection.cs
===================================================================
diff -u -r303 -r330
--- dam engine/branches/Initial Source/Deltares.DamEngine.Data/Standard/StaticReflection.cs (.../StaticReflection.cs) (revision 303)
+++ dam engine/branches/Initial Source/Deltares.DamEngine.Data/Standard/StaticReflection.cs (.../StaticReflection.cs) (revision 330)
@@ -42,7 +42,7 @@
return GetMemberName(expression);
}
- private static string GetMemberName(Expression> expression)
+ public static string GetMemberName(Expression> expression)
{
return GetMemberName(expression);
}
Index: dam engine/branches/Initial Source/Deltares.DamEngine.Calculators/General/DAMFailureMechanismeCalculatorException.cs
===================================================================
diff -u -r303 -r330
--- dam engine/branches/Initial Source/Deltares.DamEngine.Calculators/General/DAMFailureMechanismeCalculatorException.cs (.../DAMFailureMechanismeCalculatorException.cs) (revision 303)
+++ dam engine/branches/Initial Source/Deltares.DamEngine.Calculators/General/DAMFailureMechanismeCalculatorException.cs (.../DAMFailureMechanismeCalculatorException.cs) (revision 330)
@@ -21,6 +21,7 @@
using System;
using System.Runtime.Serialization;
+using Deltares.DamEngine.Data.Design;
namespace Deltares.DamEngine.Calculators
{
Index: dam engine/branches/Initial Source/Deltares.DamEngine.Data/Geotechnics/SoilSurfaceProfile.cs
===================================================================
diff -u -r316 -r330
--- dam engine/branches/Initial Source/Deltares.DamEngine.Data/Geotechnics/SoilSurfaceProfile.cs (.../SoilSurfaceProfile.cs) (revision 316)
+++ dam engine/branches/Initial Source/Deltares.DamEngine.Data/Geotechnics/SoilSurfaceProfile.cs (.../SoilSurfaceProfile.cs) (revision 330)
@@ -398,7 +398,7 @@
aGeometry.Points.Add(topX);
aGeometry.Points.Add(bottomX);
aGeometry.Curves.Add(new GeometryCurve(topX, bottomX));
- aGeometry.NewlyEffectedCurves.Add(aGeometry.Curves.Last());
+ //aGeometry.NewlyEffectedCurves.Add(aGeometry.Curves.Last());##Bka
}
private void BuildGeometryModel()
@@ -436,65 +436,61 @@
{
AddSettlementZones(Geometry);
}
- Geometry.NewlyEffectedPoints.AddRange(Geometry.Points);
- Geometry.NewlyEffectedCurves.AddRange(Geometry.Curves);
- Geometry.RegenerateGeometry();
- Geometry.DeleteLooseCurves();
+// Geometry.NewlyEffectedPoints.AddRange(Geometry.Points);
+// Geometry.NewlyEffectedCurves.AddRange(Geometry.Curves);
+// Geometry.RegenerateGeometry();
+// Geometry.DeleteLooseCurves();##Bka
}
private void RebuildSurfaces(GeometryData locGeometry)
{
- Surfaces.Clear();
- if (locGeometry == null || surfaceLine == null)
- {
- return;
- }
- var gu = new GeotechnicsUtilities();
- gu.RemoveGeometryDataAboveSurfaceLine(ref locGeometry, surfaceLine);
- foreach (var geometrySurface in locGeometry.Surfaces)
- {
- var bounds = geometrySurface.GetGeometryBounds();
- var z = (bounds.Top + bounds.Bottom) * 0.5;
-
- var soilLayer = soilProfile.GetLayerAt(z);
-
- if (soilLayer != null)
- {
- Surfaces.Add(new SoilLayer2D
- {
- GeometrySurface = geometrySurface,
- IsAquifer = soilLayer.IsAquifer,
- WaterpressureInterpolationModel = soilLayer.WaterpressureInterpolationModel,
- Soil = soilLayer.Soil,
- SoilProfile = this
- });
- }
- }
+// Surfaces.Clear();
+// if (locGeometry == null || surfaceLine == null)
+// {
+// return;
+// }
+// var gu = new GeotechnicsUtilities();
+// gu.RemoveGeometryDataAboveSurfaceLine(ref locGeometry, surfaceLine);
+// foreach (var geometrySurface in locGeometry.Surfaces)
+// {
+// var bounds = geometrySurface.GetGeometryBounds();
+// var z = (bounds.Top + bounds.Bottom) * 0.5;
+//
+// var soilLayer = soilProfile.GetLayerAt(z);
+//
+// if (soilLayer != null)
+// {
+// Surfaces.Add(new SoilLayer2D
+// {
+// GeometrySurface = geometrySurface,
+// IsAquifer = soilLayer.IsAquifer,
+// WaterpressureInterpolationModel = soilLayer.WaterpressureInterpolationModel,
+// Soil = soilLayer.Soil,
+// SoilProfile = this
+// });
+// }
+// } ##Bka
}
///
/// Updates the layers.
///
private void UpdateLayers()
{
- dirty = false;
- initial = false;
-
- // Clear all cached soil profiles
- cachedSoilProfiles1D.Clear();
-
- DataEventPublisher.InvokeWithoutPublishingEvents(() =>
- {
- if (orgSoilProfile != null)
- {
- soilProfile = (SoilProfile1D)orgSoilProfile.Clone();
-
- UpdateDikeMaterial();
- BuildGeometryModel();
- RebuildSurfaces(Geometry);
- }
- });
- DataEventPublisher.DataListModified(Surfaces);
+// dirty = false;
+// initial = false;
+//
+// // Clear all cached soil profiles
+// cachedSoilProfiles1D.Clear();
+//
+// if (orgSoilProfile != null)
+// {
+// soilProfile = (SoilProfile1D)orgSoilProfile.Clone();
+//
+// UpdateDikeMaterial();
+// BuildGeometryModel();
+// RebuildSurfaces(Geometry);
+// } ##Bka
}
}
}
\ No newline at end of file
Index: dam engine/branches/Initial Source/Deltares.DamEngine.Data/Standard/ConversionException.cs
===================================================================
diff -u
--- dam engine/branches/Initial Source/Deltares.DamEngine.Data/Standard/ConversionException.cs (revision 0)
+++ dam engine/branches/Initial Source/Deltares.DamEngine.Data/Standard/ConversionException.cs (revision 330)
@@ -0,0 +1,45 @@
+// 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.Runtime.Serialization;
+
+namespace Deltares.DamEngine.Data.Standard
+{
+ public class ConversionException: Exception
+ {
+ private const string MessagePattern = "Couldn't convert '{0}' to type {1}";
+
+ public ConversionException() { }
+
+ public ConversionException(Type type, object value)
+ : base(string.Format(MessagePattern, value, type.Name)) { }
+
+ public ConversionException(Type type, object value, Exception inner)
+ : base(string.Format(MessagePattern, value, type.Name), inner) { }
+
+ public ConversionException(string message, Exception inner)
+ : base(message, inner) { }
+
+ protected ConversionException(SerializationInfo info, StreamingContext context)
+ : base(info, context) { }
+ }
+}
Index: dam engine/branches/Initial Source/Deltares.DamEngine.Controllers/Deltares.DamEngine.Controllers.csproj
===================================================================
diff -u -r316 -r330
--- dam engine/branches/Initial Source/Deltares.DamEngine.Controllers/Deltares.DamEngine.Controllers.csproj (.../Deltares.DamEngine.Controllers.csproj) (revision 316)
+++ dam engine/branches/Initial Source/Deltares.DamEngine.Controllers/Deltares.DamEngine.Controllers.csproj (.../Deltares.DamEngine.Controllers.csproj) (revision 330)
@@ -60,12 +60,13 @@
-
-
-
+
+ {e943b1d5-fafa-4afe-9071-f8b22cf612ea}
+ Deltares.DamEngine.Calculators
+
{b7a49c1a-1c91-4d72-aba9-9fbac2509d8e}
Deltares.DamEngine.Data
Index: dam engine/branches/Initial Source/Deltares.DamEngine.Calculators/Stability/StabilityFileParseException.cs
===================================================================
diff -u
--- dam engine/branches/Initial Source/Deltares.DamEngine.Calculators/Stability/StabilityFileParseException.cs (revision 0)
+++ dam engine/branches/Initial Source/Deltares.DamEngine.Calculators/Stability/StabilityFileParseException.cs (revision 330)
@@ -0,0 +1,49 @@
+// 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.Runtime.Serialization;
+
+namespace Deltares.DamEngine.Calculators.Stability
+{
+ [Serializable]
+ public class StabilityFileParseException : Exception
+ {
+
+ public StabilityFileParseException()
+ {
+ }
+
+ public StabilityFileParseException(string message) : base(message)
+ {
+ }
+
+ public StabilityFileParseException(string message, Exception inner) : base(message, inner)
+ {
+ }
+
+ protected StabilityFileParseException(
+ SerializationInfo info,
+ StreamingContext context) : base(info, context)
+ {
+ }
+ }
+}
\ No newline at end of file
Index: dam engine/branches/Initial Source/Deltares.DamEngine.Data/General/Sensors/SensorLocation.cs
===================================================================
diff -u -r303 -r330
--- dam engine/branches/Initial Source/Deltares.DamEngine.Data/General/Sensors/SensorLocation.cs (.../SensorLocation.cs) (revision 303)
+++ dam engine/branches/Initial Source/Deltares.DamEngine.Data/General/Sensors/SensorLocation.cs (.../SensorLocation.cs) (revision 330)
@@ -313,35 +313,35 @@
///
/// Type of the pl line.
///
- internal SortedDictionary GetSensorsSortedByRelativeLocationAlongProfile(PLLineType plLineType)
- {
- var calculatedRelativeLocations = BuildRelativeLocationTable();
+// internal SortedDictionary GetSensorsSortedByRelativeLocationAlongProfile(PLLineType plLineType)
+// {
+// var calculatedRelativeLocations = BuildRelativeLocationTable();
+//
+// var table = new SortedDictionary();
+//
+// // leave out the water level and polder level sensors
+// var candidateSensors =
+// Sensors.GetBySpecification(new PiezometricHeadSensorSpecification());
+//
+// foreach (var sensor in candidateSensors)
+// {
+// if (sensor.PLLineMappings.Contains(plLineType))
+// {
+// double relativeLocation = sensor.RelativeLocationSpecified ?
+// sensor.RelativeLocation : calculatedRelativeLocations[sensor];
+//
+// if (table.ContainsKey(relativeLocation))
+// {
+// throw new InvalidOperationException(
+// "Error creating lookup table with sensors sorted by relative location along profile. The x-location " + relativeLocation + " already exists. Sensor " + sensor);
+// }
+//
+// table.Add(relativeLocation, sensor);
+// }
+// }
+// return table;
+// } ##Bka
- var table = new SortedDictionary();
-
- // leave out the water level and polder level sensors
- var candidateSensors =
- Sensors.GetBySpecification(new PiezometricHeadSensorSpecification());
-
- foreach (var sensor in candidateSensors)
- {
- if (sensor.PLLineMappings.Contains(plLineType))
- {
- double relativeLocation = sensor.RelativeLocationSpecified ?
- sensor.RelativeLocation : calculatedRelativeLocations[sensor];
-
- if (table.ContainsKey(relativeLocation))
- {
- throw new InvalidOperationException(
- "Error creating lookup table with sensors sorted by relative location along profile. The x-location " + relativeLocation + " already exists. Sensor " + sensor);
- }
-
- table.Add(relativeLocation, sensor);
- }
- }
- return table;
- }
-
///
/// Builds the relative location table.
///
@@ -365,7 +365,7 @@
internal static class MemberNames
{
- internal static readonly string OffsetBelowDikeToeAtPolder = StaticReflection.GetMemberName(this, x => x.PL1PLLineOffsetBelowDikeToeAtPolder);
+ internal static readonly string OffsetBelowDikeToeAtPolder = StaticReflection.GetMemberName(x => x.PL1PLLineOffsetBelowDikeToeAtPolder);
internal static readonly string OffsetBelowDikeTopAtPolder = StaticReflection.GetMemberName(x => x.PL1PLLineOffsetBelowDikeTopAtPolder);
internal static readonly string OffsetBelowDikeTopAtRiver = StaticReflection.GetMemberName(x => x.PL1PLLineOffsetBelowDikeTopAtRiver);
internal static readonly string OffsetBelowShoulderBaseInside = StaticReflection.GetMemberName(x => x.PL1PLLineOffsetBelowShoulderBaseInside);
Index: dam engine/branches/Initial Source/Deltares.DamEngine.Data/General/SoilGeometry.cs
===================================================================
diff -u
--- dam engine/branches/Initial Source/Deltares.DamEngine.Data/General/SoilGeometry.cs (revision 0)
+++ dam engine/branches/Initial Source/Deltares.DamEngine.Data/General/SoilGeometry.cs (revision 330)
@@ -0,0 +1,91 @@
+// 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.Geotechnics;
+
+namespace Deltares.DamEngine.Data.General
+{
+ ///
+ /// Exception class for SoilGeometry
+ ///
+ public class SoilGeometryException : ApplicationException
+ {
+ public SoilGeometryException(string message) : base(message)
+ {
+ }
+ }
+
+ public class SoilGeometryBase
+ {
+ public virtual SoilGeometryType SoilGeometryType { get; set; }
+ public virtual string SoilGeometryName { get; set; }
+ }
+
+ ///
+ /// Super class to contain 1D and 2D soil geometry
+ ///
+ public class SoilGeometry : SoilGeometryBase
+ {
+ private SoilProfile1D soilProfile;
+ private string soilGeometry2DName;
+
+ ///
+ /// Constructor
+ ///
+ public SoilGeometry(SoilProfile1D soilProfile, string soilGeometry2DName)
+ {
+ this.SoilProfile = soilProfile;
+ this.SoilGeometry2DName = soilGeometry2DName;
+ }
+
+ #region PublicPropteries
+ public override SoilGeometryType SoilGeometryType
+ {
+ get
+ {
+ SoilGeometryType soilGeometryType = SoilGeometryType.SoilGeometry2D;
+ if (soilProfile != null)
+ {
+ soilGeometryType = SoilGeometryType.SoilGeometry1D;
+ }
+ if ((SoilProfile == null) && ((SoilGeometry2DName == null) || SoilGeometry2DName == ""))
+ {
+ throw new SoilGeometryException("No geometry assigned");
+ }
+ return soilGeometryType;
+ }
+ }
+
+ public SoilProfile1D SoilProfile
+ {
+ get { return soilProfile; }
+ set { soilProfile = value; }
+ }
+
+ public string SoilGeometry2DName
+ {
+ get { return soilGeometry2DName; }
+ set { soilGeometry2DName = value; }
+ }
+ #endregion PublicPropteries
+ }
+}
Index: dam engine/branches/Initial Source/Deltares.DamEngine.Calculators/PlLinesCreator/PLLinesCreator.cs
===================================================================
diff -u -r316 -r330
--- dam engine/branches/Initial Source/Deltares.DamEngine.Calculators/PlLinesCreator/PLLinesCreator.cs (.../Deltares.DamEngine.Controllers/PLLinesCreator.cs) (revision 316)
+++ dam engine/branches/Initial Source/Deltares.DamEngine.Calculators/PlLinesCreator/PLLinesCreator.cs (.../Deltares.DamEngine.Calculators/PlLinesCreator/PLLinesCreator.cs) (revision 330)
@@ -23,14 +23,15 @@
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
+using Deltares.DamEngine.Calculators.Uplift;
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.Controllers
+namespace Deltares.DamEngine.Calculators.PlLinesCreator
{
[Serializable]
public class PLLinesCreatorException : Exception
@@ -69,7 +70,7 @@
public SoilProfile1D SoilProfile { get; set; }
public string SoilGeometry2DName { get; set; }
public Soil DikeEmbankmentMaterial { get; set; }
- public SoilbaseDB SoilBaseDB { get; set; }
+ //public SoilbaseDB SoilBaseDB { get; set; }
public SoilList SoilList { get; set; }
public double? HeadInPLLine2 { get; set; }
private double? headInPLLine3 { get; set; }
@@ -135,7 +136,7 @@
// If hydraulic shortcut then use waterlevel for headPL3
if (IsHydraulicShortcut)
{
- if (SoilGeometryType == this.SoilGeometryType.SoilGeometry1D)
+ if (SoilGeometryType == SoilGeometryType.SoilGeometry1D)
{
if (SoilProfile.InBetweenAquiferLayer == null)
{
@@ -182,7 +183,7 @@
}
}
- private GeometryPointString currentPL1Line = null; // is needed when calculating uplift reduction for PL3 and Pl4
+ private PLLine currentPL1Line = null; // is needed when calculating uplift reduction for PL3 and Pl4
// Output
private double pl3MinUplift;
@@ -204,7 +205,7 @@
///
public PLLinesCreator()
{
- SoilGeometryType = this.SoilGeometryType.SoilGeometry1D;
+ SoilGeometryType = SoilGeometryType.SoilGeometry1D;
PlLineOffsetBelowDikeTopAtRiver = 0.5; // Default value
PlLineOffsetBelowDikeTopAtPolder = 1.5; // Default value
PlLineOffsetBelowShoulderBaseInside = 0.1; // Default value
@@ -219,15 +220,15 @@
///
private SoilProfile1D GetSoilProfileBelowPoint(double xCoordinate)
{
- switch (this.SoilGeometryType)
+ switch (SoilGeometryType)
{
- case this.SoilGeometryType.SoilGeometry1D:
+ case SoilGeometryType.SoilGeometry1D:
var soilProfile = new SoilProfile1D();
soilProfile.Assign(this.SoilProfile);
return soilProfile;
- case this.SoilGeometryType.SoilGeometry2D:
- var geometry2DTo1DConverter = new Geometry2DTo1DConverter(this.SoilGeometry2DName, this.SurfaceLine, this.DikeEmbankmentMaterial, this.SoilBaseDB, this.SoilList, -this.XSoilGeometry2DOrigin);
- return geometry2DTo1DConverter.Convert(xCoordinate);
+// case SoilGeometryType.SoilGeometry2D:
+// var geometry2DTo1DConverter = new Geometry2DTo1DConverter(this.SoilGeometry2DName, this.SurfaceLine, this.DikeEmbankmentMaterial, this.SoilBaseDB, this.SoilList, -this.XSoilGeometry2DOrigin);
+// return geometry2DTo1DConverter.Convert(xCoordinate); ##Bka
default:
return null;
}
@@ -250,8 +251,8 @@
///
private void ThrowIfInsufficientSoilGeometryData()
{
- bool hasNoGeometry1DData = (SoilGeometryType == this.SoilGeometryType.SoilGeometry1D) && SoilProfile == null;
- bool hasNoGeometry2DData = (SoilGeometryType == this.SoilGeometryType.SoilGeometry2D) && (SoilGeometry2DName == null || DikeEmbankmentMaterial == null || SoilBaseDB == null);
+ bool hasNoGeometry1DData = (SoilGeometryType == SoilGeometryType.SoilGeometry1D) && SoilProfile == null;
+ bool hasNoGeometry2DData = (SoilGeometryType == SoilGeometryType.SoilGeometry2D) && (SoilGeometry2DName == null || DikeEmbankmentMaterial == null);
if (hasNoGeometry1DData && hasNoGeometry2DData)
{
throw new PLLinesCreatorException("PLLinesCreator contains not enough soil geometry information (SoilProfile, SoilGeometry2DName, dikeEmbankmentMaterial or soilBase)");
@@ -281,12 +282,12 @@
ThrowIfNoSurfaceLine();
ThrowIfSurfaceLineContainsNoPoints();
- switch (this.SoilGeometryType)
+ switch (SoilGeometryType)
{
- case this.SoilGeometryType.SoilGeometry1D:
+ case SoilGeometryType.SoilGeometry1D:
plLine = CreatePlLine2ByExpertKnowledgeFor1DGeometry(penetrationLength, headInPLLine2);
break;
- case this.SoilGeometryType.SoilGeometry2D:
+ case SoilGeometryType.SoilGeometry2D:
plLine = CreatePlLine2ByExpertKnowledgeFor2DGeometry(penetrationLength, headInPLLine2);
break;
}
@@ -361,7 +362,7 @@
// Split layer at separation level
var extraLayer = new SoilLayer1D();
extraLayer.Assign(separationLayer);
- extraLayer.Id = this.SoilProfile.GetNewUniqueLayerId();
+ //extraLayer.Id = this.SoilProfile.GetNewUniqueLayerId(); ##Bka
extraLayer.TopLevel = separationLevel;
this.SoilProfile.Layers.Insert(this.SoilProfile.Layers.IndexOf(separationLayer) + 1, extraLayer);
}
@@ -484,14 +485,14 @@
double headAtLastPlPoint = plLine.Points.Last().Z;
double headAtEnd = plLine.Points.Last().Z - slopeGradient * lengthFromLastPlPointToEnd;
- Line waterLevelPolderLine =
- new Line(new GeometryPoint(this.surfaceLine.Geometry.Points.First().X, 0, this.WaterLevelPolder),
- new GeometryPoint(this.surfaceLine.Geometry.Points.Last().X, 0, this.WaterLevelPolder));
- Line slopeLine =
- new Line(
- new GeometryPoint(this.surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder).X, 0, headAtLastPlPoint),
- new GeometryPoint(this.surfaceLine.Geometry.Points.Last().X, 0, headAtEnd));
- GeometryPoint intersectionPoint = new GeometryPoint();
+ Line waterLevelPolderLine =
+ new Line(new Point2D(this.surfaceLine.Geometry.Points.First().X, this.WaterLevelPolder),
+ new Point2D(this.surfaceLine.Geometry.Points.Last().X, WaterLevelPolder));
+ Line slopeLine =
+ new Line(
+ new Point2D(this.surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder).X, headAtLastPlPoint),
+ new Point2D(this.surfaceLine.Geometry.Points.Last().X, headAtEnd));
+ var intersectionPoint = new Point2D();
if (waterLevelPolderLine.IntersectsZ(slopeLine, out intersectionPoint))
{
@@ -941,447 +942,447 @@
///
///
///
- private PLLines CreateAllPLLinesWithExpertKnowledge(Location location)
- {
- PLLines plLines = new PLLines();
- foreach (PLLineType plLineType in Enum.GetValues(typeof(PLLineType)))
- {
- bool isPL1LineDefinedForLocation = (location != null) && (location.LocalXZPL1Line != null) && (location.LocalXZPL1Line.Points.Count > 1);
- if ((plLineType == PLLineType.PL1) && isPL1LineDefinedForLocation)
- {
- PLLine plLine = plLines.Lines[plLineType];
- CopyPointsInPLLine(ref plLine, location.LocalXZPL1Line);
- }
- else
- {
- plLines.Lines[plLineType] = CreatePLLineByExpertKnowledge(plLineType, location.DamType, location.SlopeDampingPiezometricHeightPolderSide);
- }
+// private PLLines CreateAllPLLinesWithExpertKnowledge(Location location)
+// {
+// PLLines plLines = new PLLines();
+// foreach (PLLineType plLineType in Enum.GetValues(typeof(PLLineType)))
+// {
+// bool isPL1LineDefinedForLocation = (location != null) && (location.LocalXZPL1Line != null) && (location.LocalXZPL1Line.Points.Count > 1);
+// if ((plLineType == PLLineType.PL1) && isPL1LineDefinedForLocation)
+// {
+// PLLine plLine = plLines.Lines[plLineType];
+// CopyPointsInPLLine(ref plLine, location.LocalXZPL1Line);
+// }
+// else
+// {
+// plLines.Lines[plLineType] = CreatePLLineByExpertKnowledge(plLineType, location.DamType, location.SlopeDampingPiezometricHeightPolderSide);
+// }
+//
+// // currentPL1Line is needed when calculating uplift reduction for PL3 and Pl4
+// if (plLineType == PLLineType.PL1)
+// {
+// // var plLine = plLines.Lines[plLineType];
+// // AdaptPL1ForNonWaterRetainingObject(ref plLine);
+// // plLines.Lines[plLineType] = plLine;
+// currentPL1Line = plLines.Lines[plLineType];
+// }
+// }
+// return plLines;
+// }
- // currentPL1Line is needed when calculating uplift reduction for PL3 and Pl4
- if (plLineType == PLLineType.PL1)
- {
- // var plLine = plLines.Lines[plLineType];
- // AdaptPL1ForNonWaterRetainingObject(ref plLine);
- // plLines.Lines[plLineType] = plLine;
- currentPL1Line = plLines.Lines[plLineType];
- }
- }
- return plLines;
- }
+// private IEnumerable FindAllPlLinePointsAtNWOLocation(PLLine pl1Line)
+// {
+// IEnumerable results = pl1Line.GetPointSegmentBetween(this.surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.NonWaterRetainingObjectPoint1).X - cOffsetPhreaticLineBelowSurface,
+// this.surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.NonWaterRetainingObjectPoint4).X + cOffsetPhreaticLineBelowSurface);
+//
+// return results;
+// }
- private IEnumerable FindAllPlLinePointsAtNWOLocation(PLLine pl1Line)
- {
- IEnumerable results = pl1Line.GetPointSegmentBetween(this.surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.NonWaterRetainingObjectPoint1).X - cOffsetPhreaticLineBelowSurface,
- this.surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.NonWaterRetainingObjectPoint4).X + cOffsetPhreaticLineBelowSurface);
+// private void AdaptPL1ForNonWaterRetainingObject(ref PLLine pl1Line)
+// {
+// // check if nwo points are available as CharacteristicPoints
+// var nwo1 = this.surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.NonWaterRetainingObjectPoint1);
+// var nwo2 = this.surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.NonWaterRetainingObjectPoint2);
+// var nwo3 = this.surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.NonWaterRetainingObjectPoint3);
+// var nwo4 = this.surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.NonWaterRetainingObjectPoint4);
+// if ((nwo1 != null) && (nwo2 != null) && (nwo3 != null) && (nwo4 != null))
+// {
+//
+// // Find all points in the Pl line that (might) coincide with the NWO
+// IEnumerable plPointsToBeMoved = FindAllPlLinePointsAtNWOLocation(pl1Line);
+//
+// PLLinePoint nwo1Pl = null;
+// PLLinePoint nwo2Pl = null;
+// PLLinePoint nwo3Pl = null;
+// PLLinePoint nwo4Pl = null;
+//
+// // For NWO point, determine whether a pl point has to be added
+// if (pl1Line.PositionXzOfPointRelatedToPLLine(nwo1) != PLLinePointPositionXzType.AbovePLLine)
+// {
+// nwo1Pl = new PLLinePoint(nwo1.X, nwo1.Z - cOffsetPhreaticLineBelowSurface);
+// }
+// if (pl1Line.PositionXzOfPointRelatedToPLLine(nwo2) != PLLinePointPositionXzType.AbovePLLine)
+// {
+// nwo2Pl = new PLLinePoint(nwo2.X, nwo2.Z - cOffsetPhreaticLineBelowSurface);
+// }
+// if (pl1Line.PositionXzOfPointRelatedToPLLine(nwo3) != PLLinePointPositionXzType.AbovePLLine)
+// {
+// nwo3Pl = new PLLinePoint(nwo3.X, nwo3.Z - cOffsetPhreaticLineBelowSurface);
+// }
+// if (pl1Line.PositionXzOfPointRelatedToPLLine(nwo4) != PLLinePointPositionXzType.AbovePLLine)
+// {
+// nwo4Pl = new PLLinePoint(nwo4.X, nwo4.Z - cOffsetPhreaticLineBelowSurface);
+// }
+//
+// // Find the intersections of pl line and NWO and handle these
+// // Intersection between nwo point1 and nwo point2 only when nwo point1 is above pl line and nwo point2 is below plLine
+// PLLinePoint intersection1 = null;
+// if ((nwo1Pl == null) && (nwo2Pl != null))
+// {
+// var lineNWO = new Deltares.Geometry.Line { BeginPoint = new GeometryPoint(nwo1.X, 0, nwo1.Z), EndPoint = new GeometryPoint(nwo2.X, 0, nwo2.Z) };
+// var ips = pl1Line.IntersectionPointsXzWithLineXz(lineNWO);
+// if (ips.Count > 0)
+// {
+// intersection1 = new PLLinePoint(ips.First().X, ips.First().Z);
+// }
+// }
+// // Intersection between nwo point3 and nwo point4 only when nwo point3 is below pl line and nwo point4 is above plLine
+// PLLinePoint intersection2 = null;
+// if ((nwo3Pl != null) && (nwo4Pl == null))
+// {
+// var lineNWO = new Deltares.Geometry.Line { BeginPoint = new GeometryPoint(nwo3.X, 0, nwo3.Z), EndPoint = new GeometryPoint(nwo4.X, 0, nwo4.Z) };
+// var ips = pl1Line.IntersectionPointsXzWithLineXz(lineNWO);
+// if (ips.Count > 0)
+// {
+// intersection2 = new PLLinePoint(ips.Last().X, ips.Last().Z);
+// }
+// }
+//
+// // Handle making the NWO empty
+// if ((NWOPhreaticAdaption != null) && (NWOPhreaticAdaption == PhreaticAdaptionType.MakeEmpty))
+// {
+// // for the polderside, the pl line is always allowed to be adapted. For the riverside, the pl line may only be adapted when the original waterlevel is runs through the nwo.
+// RemoveAllWaterFromNonWaterRetainingObject(nwo1, pl1Line, nwo1Pl, nwo2Pl, nwo3Pl, nwo4Pl, intersection1, intersection2, plPointsToBeMoved);
+// }
+// // Handle making the waterlevel horizontal in the NWO at the Riverside when needed (Polderside is already done when needed, see CreatePhreaticLineSegmentsInShoulderAndPolder.
+// if ((NWOPhreaticAdaption != null) && (NWOPhreaticAdaption == PhreaticAdaptionType.None))
+// {
+// // For the riverside, the pl line may only be adapted when the original waterlevel is runs through the nwo and is not already level.
+// if ((nwo1.X <= this.surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtRiver).X) && ((intersection1 != null) || (intersection2 != null)))
+// {
+// double requiredWaterLevel;
+// // Check whether adaption of intersection points is needed
+// if (intersection2 == null)
+// {
+// // only intersection 1 avaialable so add intersection 2
+// // first see if nwo3/4 intersects, if not try nwo2/3. If still no intersection found valid level not possible, raise error
+// MakeWaterLevelHorizontalInNWOAtRiverSideUsingInterSection1(nwo2, nwo3, nwo4, pl1Line, nwo3Pl, nwo4Pl, intersection1);
+// requiredWaterLevel = intersection1.Z;
+// }
+// else
+// {
+// if (intersection1 == null)
+// {
+// // only intersection 2 avaialable so add intersection 1
+// // first see if nwo1/2 intersects, if not try nwo2/3. If still no intersection found valid level not possible, raise error
+// MakeWaterLevelHorizontalInNWOAtRiverSideUsingInterSection2(nwo1, nwo2, nwo3, pl1Line, nwo1Pl, nwo2Pl, nwo3Pl, intersection2);
+// requiredWaterLevel = intersection2.Z;
+// }
+// else
+// {
+// // intersection 1 and intersection 2 available. Only act when levels were different.
+// requiredWaterLevel = Math.Min(intersection1.Z, intersection2.Z);
+// if ((Math.Abs(intersection1.Z - intersection2.Z) > GeometryPoint.Precision))
+// {
+// if (intersection1.Z < intersection2.Z)
+// {
+// // make level in NWO intersection1.Z
+// MakeWaterLevelHorizontalInNWOAtRiverSideUsingInterSection1And2(nwo2, nwo3, nwo4, pl1Line, nwo3Pl, intersection1, intersection2);
+// }
+// else
+// {
+// // make level in NWO intersection2.Z
+// MakeWaterLevelHorizontalInNWOAtRiverSideUsingInterSection2And1(nwo1, nwo2, nwo3, pl1Line, nwo2Pl, intersection1, intersection2);
+// }
+//
+// }
+// }
+// }
+//
+// // Move all the points in the pl line itself that need to be moved to the horizontal proper level.
+// foreach (var plLinePoint in plPointsToBeMoved)
+// {
+// plLinePoint.Z = requiredWaterLevel;
+// }
+// pl1Line.DeleteCoinsidingPoints(GeometryPoint.Precision);
+// }
+// }
+// }
+// }
- return results;
- }
+// private void MakeWaterLevelHorizontalInNWOAtRiverSideUsingInterSection2And1(GeometryPoint nwo1, GeometryPoint nwo2, GeometryPoint nwo3, PLLine pl1Line, PLLinePoint nwo2Pl, PLLinePoint intersection1, PLLinePoint intersection2)
+// {
+// var lineNWO = new Line { BeginPoint = new Point2D(nwo1.X, nwo1.Z), EndPoint = new Point2D(nwo2.X, nwo2.Z) };
+// var linePL = new Line { BeginPoint = new Point2D(nwo1.X, intersection2.Z), EndPoint = new Point2D(intersection2.X, intersection2.Z) };
+// var isp = new GeometryPoint();
+// if (LineHelper.GetStrictIntersectionPoint(lineNWO, linePL, ref isp))
+// {
+// var newP1 = pl1Line.EnsurePointAtX(intersection2.X, GeometryPoint.Precision);
+// newP1.Z = intersection2.Z;
+// var newP2 = pl1Line.EnsurePointAtX(isp.X - cOffsetPhreaticLineBelowSurface, GeometryPoint.Precision);
+// newP2.Z = intersection2.Z;
+// var newP3 = pl1Line.EnsurePointAtX(intersection1.X - cOffsetPhreaticLineBelowSurface, GeometryPoint.Precision);
+// newP3.Z = intersection1.Z;
+// }
+// else
+// {
+// var lineNWOb = new Line { BeginPoint = new Point2D(nwo2.X, nwo2.Z), EndPoint = new Point2D(nwo3.X, nwo3.Z) };
+// if (LineHelper.GetStrictIntersectionPoint(lineNWOb, linePL, ref isp))
+// {
+// var newP1 = pl1Line.EnsurePointAtX(intersection2.X, GeometryPoint.Precision);
+// newP1.Z = intersection2.Z;
+// var newP2 = pl1Line.EnsurePointAtX(isp.X - cOffsetPhreaticLineBelowSurface, GeometryPoint.Precision);
+// newP2.Z = intersection2.Z;
+// var newP3 = pl1Line.EnsurePointAtX(nwo2Pl.X, GeometryPoint.Precision);
+// newP3.Z = nwo2Pl.Z;
+// if (nwo2Pl.X > intersection1.X)
+// {
+// var newP4 = pl1Line.EnsurePointAtX(intersection1.X - cOffsetPhreaticLineBelowSurface, GeometryPoint.Precision);
+// newP4.Z = intersection1.Z;
+// }
+//
+// }
+// else
+// {
+// throw new PLLinesCreatorException("Could not create the intersectionsection points between NWO and Phreatic line to create horizontal level.");
+// }
+// }
+// }
- private void AdaptPL1ForNonWaterRetainingObject(ref PLLine pl1Line)
- {
- // check if nwo points are available as CharacteristicPoints
- var nwo1 = this.surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.NonWaterRetainingObjectPoint1);
- var nwo2 = this.surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.NonWaterRetainingObjectPoint2);
- var nwo3 = this.surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.NonWaterRetainingObjectPoint3);
- var nwo4 = this.surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.NonWaterRetainingObjectPoint4);
- if ((nwo1 != null) && (nwo2 != null) && (nwo3 != null) && (nwo4 != null))
- {
+// private void MakeWaterLevelHorizontalInNWOAtRiverSideUsingInterSection1And2(GeometryPoint nwo2, GeometryPoint nwo3, GeometryPoint nwo4, PLLine pl1Line, PLLinePoint nwo3Pl, PLLinePoint intersection1, PLLinePoint intersection2)
+// {
+// var lineNWO = new Deltares.Geometry.Line { BeginPoint = new GeometryPoint(nwo3.X, 0, nwo3.Z), EndPoint = new GeometryPoint(nwo4.X, 0, nwo4.Z) };
+// var linePL = new Deltares.Geometry.Line { BeginPoint = new GeometryPoint(intersection1.X, 0, intersection1.Z), EndPoint = new GeometryPoint(nwo4.X, 0, intersection1.Z) };
+// var isp = new GeometryPoint();
+// if (LineHelper.GetStrictIntersectionPoint(lineNWO, linePL, ref isp))
+// {
+// var newP1 = pl1Line.EnsurePointAtX(intersection1.X, GeometryPoint.Precision);
+// newP1.Z = intersection1.Z;
+// var newP2 = pl1Line.EnsurePointAtX(isp.X + cOffsetPhreaticLineBelowSurface, GeometryPoint.Precision);
+// newP2.Z = intersection1.Z;
+// var newP3 = pl1Line.EnsurePointAtX(intersection2.X + cOffsetPhreaticLineBelowSurface, GeometryPoint.Precision);
+// newP3.Z = intersection2.Z;
+// }
+// else
+// {
+// var lineNWOb = new Deltares.Geometry.Line { BeginPoint = new GeometryPoint(nwo2.X, 0, nwo2.Z), EndPoint = new GeometryPoint(nwo3.X, 0, nwo3.Z) };
+// if (LineHelper.GetStrictIntersectionPoint(lineNWOb, linePL, ref isp))
+// {
+// var newP1 = pl1Line.EnsurePointAtX(intersection1.X, GeometryPoint.Precision);
+// newP1.Z = intersection1.Z;
+// var newP2 = pl1Line.EnsurePointAtX(isp.X + cOffsetPhreaticLineBelowSurface, GeometryPoint.Precision);
+// newP2.Z = intersection1.Z;
+// var newP3 = pl1Line.EnsurePointAtX(nwo3Pl.X, GeometryPoint.Precision);
+// newP3.Z = nwo3Pl.Z;
+// if (nwo3Pl.X < intersection2.X)
+// {
+// var newP4 = pl1Line.EnsurePointAtX(intersection2.X + cOffsetPhreaticLineBelowSurface, GeometryPoint.Precision);
+// newP4.Z = intersection2.Z;
+// }
+// }
+// else
+// {
+// throw new PLLinesCreatorException("Could not create the intersectionsection points between NWO and Phreatic line to create horizontal level.");
+// }
+// }
+// }
- // Find all points in the Pl line that (might) coincide with the NWO
- IEnumerable plPointsToBeMoved = FindAllPlLinePointsAtNWOLocation(pl1Line);
+// private void RemoveAllWaterFromNonWaterRetainingObject(GeometryPoint nwo1, PLLine pl1Line, PLLinePoint nwo1Pl, PLLinePoint nwo2Pl, PLLinePoint nwo3Pl, PLLinePoint nwo4Pl, PLLinePoint intersection1, PLLinePoint intersection2, IEnumerable plPointsToBeMoved)
+// {
+// if ((nwo1.X >= this.surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder).X) ||
+// ((intersection1 != null) && (intersection2 != null)))
+// {
+// // Move all the points in the pl line itself that need to be moved to below the surfaceline.
+// MoveSelectedPLLinePointsBelowSurfaceLine(plPointsToBeMoved);
+//
+// // now add all extra points to the pl line
+// if (nwo1Pl != null)
+// {
+// var newP = pl1Line.EnsurePointAtX(nwo1Pl.X, GeometryPoint.Precision);
+// newP.Z = nwo1Pl.Z;
+// }
+// if (nwo2Pl != null)
+// {
+// var newP = pl1Line.EnsurePointAtX(nwo2Pl.X, GeometryPoint.Precision);
+// newP.Z = nwo2Pl.Z;
+// }
+// if (nwo3Pl != null)
+// {
+// var newP = pl1Line.EnsurePointAtX(nwo3Pl.X, GeometryPoint.Precision);
+// newP.Z = nwo3Pl.Z;
+// }
+// if (nwo4Pl != null)
+// {
+// var newP = pl1Line.EnsurePointAtX(nwo4Pl.X, GeometryPoint.Precision);
+// newP.Z = nwo4Pl.Z;
+// }
+// // Note: for intersection points, apply offset in X direction not in Z.
+// if (intersection1 != null)
+// {
+// var newP = pl1Line.EnsurePointAtX(intersection1.X - cOffsetPhreaticLineBelowSurface, GeometryPoint.Precision);
+// newP.Z = intersection1.Z;
+// }
+// if (intersection2 != null)
+// {
+// var newP = pl1Line.EnsurePointAtX(intersection2.X + cOffsetPhreaticLineBelowSurface, GeometryPoint.Precision);
+// newP.Z = intersection2.Z;
+// }
+// pl1Line.DeleteCoinsidingPoints(GeometryPoint.Precision);
+// }
+// }
- PLLinePoint nwo1Pl = null;
- PLLinePoint nwo2Pl = null;
- PLLinePoint nwo3Pl = null;
- PLLinePoint nwo4Pl = null;
+// private void MakeWaterLevelHorizontalInNWOAtRiverSideUsingInterSection2(GeometryPoint nwo1, GeometryPoint nwo2, GeometryPoint nwo3, PLLine pl1Line, PLLinePoint nwo1Pl, PLLinePoint nwo2Pl, PLLinePoint nwo3Pl, PLLinePoint intersection2)
+// {
+// var lineNWO = new Deltares.Geometry.Line { BeginPoint = new GeometryPoint(nwo1.X, 0, nwo1.Z), EndPoint = new GeometryPoint(nwo2.X, 0, nwo2.Z) };
+// var linePL = new Deltares.Geometry.Line { BeginPoint = new GeometryPoint(nwo1.X, 0, intersection2.Z), EndPoint = new GeometryPoint(intersection2.X, 0, intersection2.Z) };
+// var isp = new GeometryPoint();
+// if (LineHelper.GetStrictIntersectionPoint(lineNWO, linePL, ref isp))
+// {
+// var newP1 = pl1Line.EnsurePointAtX(intersection2.X, GeometryPoint.Precision);
+// newP1.Z = intersection2.Z;
+// var newP2 = pl1Line.EnsurePointAtX(isp.X - cOffsetPhreaticLineBelowSurface, GeometryPoint.Precision);
+// newP2.Z = intersection2.Z;
+// if (nwo1Pl != null)
+// {
+// var newP3 = pl1Line.EnsurePointAtX(nwo1Pl.X, GeometryPoint.Precision);
+// newP3.Z = nwo1Pl.Z;
+// }
+// }
+// else
+// {
+// var lineNWOb = new Deltares.Geometry.Line { BeginPoint = new GeometryPoint(nwo2.X, 0, nwo2.Z), EndPoint = new GeometryPoint(nwo3.X, 0, nwo3.Z) };
+// if (LineHelper.GetStrictIntersectionPoint(lineNWOb, linePL, ref isp))
+// {
+// var newP1 = pl1Line.EnsurePointAtX(intersection2.X, GeometryPoint.Precision);
+// newP1.Z = intersection2.Z;
+// var newP2 = pl1Line.EnsurePointAtX(isp.X - cOffsetPhreaticLineBelowSurface, GeometryPoint.Precision);
+// newP2.Z = intersection2.Z;
+// if (nwo2Pl != null)
+// {
+// var newP3 = pl1Line.EnsurePointAtX(nwo2Pl.X, GeometryPoint.Precision);
+// newP3.Z = nwo2Pl.Z;
+// if ((nwo1Pl != null) && (nwo2Pl.X > nwo1Pl.X))
+// {
+// var newP4 = pl1Line.EnsurePointAtX(nwo1Pl.X, GeometryPoint.Precision);
+// newP4.Z = nwo1Pl.Z;
+// }
+// }
+// }
+// else
+// {
+// throw new PLLinesCreatorException("Could not create the intersectionsection points between NWO and Phreatic line to create horizontal level.");
+// }
+// }
+// }
- // For NWO point, determine whether a pl point has to be added
- if (pl1Line.PositionXzOfPointRelatedToPLLine(nwo1) != PLLinePointPositionXzType.AbovePLLine)
- {
- nwo1Pl = new PLLinePoint(nwo1.X, nwo1.Z - cOffsetPhreaticLineBelowSurface);
- }
- if (pl1Line.PositionXzOfPointRelatedToPLLine(nwo2) != PLLinePointPositionXzType.AbovePLLine)
- {
- nwo2Pl = new PLLinePoint(nwo2.X, nwo2.Z - cOffsetPhreaticLineBelowSurface);
- }
- if (pl1Line.PositionXzOfPointRelatedToPLLine(nwo3) != PLLinePointPositionXzType.AbovePLLine)
- {
- nwo3Pl = new PLLinePoint(nwo3.X, nwo3.Z - cOffsetPhreaticLineBelowSurface);
- }
- if (pl1Line.PositionXzOfPointRelatedToPLLine(nwo4) != PLLinePointPositionXzType.AbovePLLine)
- {
- nwo4Pl = new PLLinePoint(nwo4.X, nwo4.Z - cOffsetPhreaticLineBelowSurface);
- }
+// private void MakeWaterLevelHorizontalInNWOAtRiverSideUsingInterSection1(GeometryPoint nwo2, GeometryPoint nwo3, GeometryPoint nwo4, PLLine pl1Line, PLLinePoint nwo3Pl, PLLinePoint nwo4Pl, PLLinePoint intersection1)
+// {
+// var lineNWO = new Deltares.Geometry.Line { BeginPoint = new GeometryPoint(nwo3.X, 0, nwo3.Z), EndPoint = new GeometryPoint(nwo4.X, 0, nwo4.Z) };
+// var linePL = new Deltares.Geometry.Line { BeginPoint = new GeometryPoint(intersection1.X, 0, intersection1.Z), EndPoint = new GeometryPoint(nwo4.X, 0, intersection1.Z) };
+// var isp = new GeometryPoint();
+// if (LineHelper.GetStrictIntersectionPoint(lineNWO, linePL, ref isp))
+// {
+// var newP1 = pl1Line.EnsurePointAtX(intersection1.X, GeometryPoint.Precision);
+// newP1.Z = intersection1.Z;
+// var newP2 = pl1Line.EnsurePointAtX(isp.X + cOffsetPhreaticLineBelowSurface, GeometryPoint.Precision);
+// newP2.Z = intersection1.Z;
+// if (nwo4Pl != null)
+// {
+// var newP3 = pl1Line.EnsurePointAtX(nwo4Pl.X, GeometryPoint.Precision);
+// newP3.Z = nwo4Pl.Z;
+// }
+// }
+// else
+// {
+// var lineNWOb = new Deltares.Geometry.Line { BeginPoint = new GeometryPoint(nwo2.X, 0, nwo2.Z), EndPoint = new GeometryPoint(nwo3.X, 0, nwo3.Z) };
+// if (LineHelper.GetStrictIntersectionPoint(lineNWOb, linePL, ref isp))
+// {
+// var newP1 = pl1Line.EnsurePointAtX(intersection1.X, GeometryPoint.Precision);
+// newP1.Z = intersection1.Z;
+// var newP2 = pl1Line.EnsurePointAtX(isp.X + cOffsetPhreaticLineBelowSurface, GeometryPoint.Precision);
+// newP2.Z = intersection1.Z;
+// if (nwo3Pl != null)
+// {
+// var newP3 = pl1Line.EnsurePointAtX(nwo3Pl.X, GeometryPoint.Precision);
+// newP3.Z = nwo3Pl.Z;
+// if ((nwo4Pl != null) && (nwo4Pl.X > nwo3Pl.X))
+// {
+// var newP4 = pl1Line.EnsurePointAtX(nwo4Pl.X, GeometryPoint.Precision);
+// newP4.Z = nwo4Pl.Z;
+// }
+// }
+// }
+// else
+// {
+// throw new PLLinesCreatorException("Could not create the intersectionsection points between NWO and Phreatic line to create horizontal level.");
+// }
+// }
+// }
- // Find the intersections of pl line and NWO and handle these
- // Intersection between nwo point1 and nwo point2 only when nwo point1 is above pl line and nwo point2 is below plLine
- PLLinePoint intersection1 = null;
- if ((nwo1Pl == null) && (nwo2Pl != null))
- {
- var lineNWO = new Deltares.Geometry.Line { BeginPoint = new GeometryPoint(nwo1.X, 0, nwo1.Z), EndPoint = new GeometryPoint(nwo2.X, 0, nwo2.Z) };
- var ips = pl1Line.IntersectionPointsXzWithLineXz(lineNWO);
- if (ips.Count > 0)
- {
- intersection1 = new PLLinePoint(ips.First().X, ips.First().Z);
- }
- }
- // Intersection between nwo point3 and nwo point4 only when nwo point3 is below pl line and nwo point4 is above plLine
- PLLinePoint intersection2 = null;
- if ((nwo3Pl != null) && (nwo4Pl == null))
- {
- var lineNWO = new Deltares.Geometry.Line { BeginPoint = new GeometryPoint(nwo3.X, 0, nwo3.Z), EndPoint = new GeometryPoint(nwo4.X, 0, nwo4.Z) };
- var ips = pl1Line.IntersectionPointsXzWithLineXz(lineNWO);
- if (ips.Count > 0)
- {
- intersection2 = new PLLinePoint(ips.Last().X, ips.Last().Z);
- }
- }
+// private void MoveSelectedPLLinePointsBelowSurfaceLine(IEnumerable plPointsToBeMoved)
+// {
+// foreach (var plLinePoint in plPointsToBeMoved)
+// {
+// // Determine which of these points must be moved and move them
+// if (this.surfaceLine.Geometry.PositionXzOfPointRelatedToExtrapolatedLine(plLinePoint) !=
+// RelativeXzPosition.BelowGeometricLine)
+// {
+// plLinePoint.Z = this.surfaceLine.Geometry.GetZatX(plLinePoint.X) - cOffsetPhreaticLineBelowSurface;
+// }
+// }
+// }
- // Handle making the NWO empty
- if ((NWOPhreaticAdaption != null) && (NWOPhreaticAdaption == PhreaticAdaptionType.MakeEmpty))
- {
- // for the polderside, the pl line is always allowed to be adapted. For the riverside, the pl line may only be adapted when the original waterlevel is runs through the nwo.
- RemoveAllWaterFromNonWaterRetainingObject(nwo1, pl1Line, nwo1Pl, nwo2Pl, nwo3Pl, nwo4Pl, intersection1, intersection2, plPointsToBeMoved);
- }
- // Handle making the waterlevel horizontal in the NWO at the Riverside when needed (Polderside is already done when needed, see CreatePhreaticLineSegmentsInShoulderAndPolder.
- if ((NWOPhreaticAdaption != null) && (NWOPhreaticAdaption == PhreaticAdaptionType.None))
- {
- // For the riverside, the pl line may only be adapted when the original waterlevel is runs through the nwo and is not already level.
- if ((nwo1.X <= this.surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtRiver).X) && ((intersection1 != null) || (intersection2 != null)))
- {
- double requiredWaterLevel;
- // Check whether adaption of intersection points is needed
- if (intersection2 == null)
- {
- // only intersection 1 avaialable so add intersection 2
- // first see if nwo3/4 intersects, if not try nwo2/3. If still no intersection found valid level not possible, raise error
- MakeWaterLevelHorizontalInNWOAtRiverSideUsingInterSection1(nwo2, nwo3, nwo4, pl1Line, nwo3Pl, nwo4Pl, intersection1);
- requiredWaterLevel = intersection1.Z;
- }
- else
- {
- if (intersection1 == null)
- {
- // only intersection 2 avaialable so add intersection 1
- // first see if nwo1/2 intersects, if not try nwo2/3. If still no intersection found valid level not possible, raise error
- MakeWaterLevelHorizontalInNWOAtRiverSideUsingInterSection2(nwo1, nwo2, nwo3, pl1Line, nwo1Pl, nwo2Pl, nwo3Pl, intersection2);
- requiredWaterLevel = intersection2.Z;
- }
- else
- {
- // intersection 1 and intersection 2 available. Only act when levels were different.
- requiredWaterLevel = Math.Min(intersection1.Z, intersection2.Z);
- if ((Math.Abs(intersection1.Z - intersection2.Z) > GeometryPoint.Precision))
- {
- if (intersection1.Z < intersection2.Z)
- {
- // make level in NWO intersection1.Z
- MakeWaterLevelHorizontalInNWOAtRiverSideUsingInterSection1And2(nwo2, nwo3, nwo4, pl1Line, nwo3Pl, intersection1, intersection2);
- }
- else
- {
- // make level in NWO intersection2.Z
- MakeWaterLevelHorizontalInNWOAtRiverSideUsingInterSection2And1(nwo1, nwo2, nwo3, pl1Line, nwo2Pl, intersection1, intersection2);
- }
-
- }
- }
- }
-
- // Move all the points in the pl line itself that need to be moved to the horizontal proper level.
- foreach (var plLinePoint in plPointsToBeMoved)
- {
- plLinePoint.Z = requiredWaterLevel;
- }
- pl1Line.DeleteCoinsidingPoints(GeometryPoint.Precision);
- }
- }
- }
- }
-
- private void MakeWaterLevelHorizontalInNWOAtRiverSideUsingInterSection2And1(GeometryPoint nwo1, GeometryPoint nwo2, GeometryPoint nwo3, PLLine pl1Line, PLLinePoint nwo2Pl, PLLinePoint intersection1, PLLinePoint intersection2)
- {
- var lineNWO = new Deltares.Geometry.Line { BeginPoint = new GeometryPoint(nwo1.X, 0, nwo1.Z), EndPoint = new GeometryPoint(nwo2.X, 0, nwo2.Z) };
- var linePL = new Deltares.Geometry.Line { BeginPoint = new GeometryPoint(nwo1.X, 0, intersection2.Z), EndPoint = new GeometryPoint(intersection2.X, 0, intersection2.Z) };
- var isp = new GeometryPoint();
- if (LineHelper.GetStrictIntersectionPoint(lineNWO, linePL, ref isp))
- {
- var newP1 = pl1Line.EnsurePointAtX(intersection2.X, GeometryPoint.Precision);
- newP1.Z = intersection2.Z;
- var newP2 = pl1Line.EnsurePointAtX(isp.X - cOffsetPhreaticLineBelowSurface, GeometryPoint.Precision);
- newP2.Z = intersection2.Z;
- var newP3 = pl1Line.EnsurePointAtX(intersection1.X - cOffsetPhreaticLineBelowSurface, GeometryPoint.Precision);
- newP3.Z = intersection1.Z;
- }
- else
- {
- var lineNWOb = new Deltares.Geometry.Line { BeginPoint = new GeometryPoint(nwo2.X, 0, nwo2.Z), EndPoint = new GeometryPoint(nwo3.X, 0, nwo3.Z) };
- if (LineHelper.GetStrictIntersectionPoint(lineNWOb, linePL, ref isp))
- {
- var newP1 = pl1Line.EnsurePointAtX(intersection2.X, GeometryPoint.Precision);
- newP1.Z = intersection2.Z;
- var newP2 = pl1Line.EnsurePointAtX(isp.X - cOffsetPhreaticLineBelowSurface, GeometryPoint.Precision);
- newP2.Z = intersection2.Z;
- var newP3 = pl1Line.EnsurePointAtX(nwo2Pl.X, GeometryPoint.Precision);
- newP3.Z = nwo2Pl.Z;
- if (nwo2Pl.X > intersection1.X)
- {
- var newP4 = pl1Line.EnsurePointAtX(intersection1.X - cOffsetPhreaticLineBelowSurface, GeometryPoint.Precision);
- newP4.Z = intersection1.Z;
- }
-
- }
- else
- {
- throw new PLLinesCreatorException("Could not create the intersectionsection points between NWO and Phreatic line to create horizontal level.");
- }
- }
- }
-
- private void MakeWaterLevelHorizontalInNWOAtRiverSideUsingInterSection1And2(GeometryPoint nwo2, GeometryPoint nwo3, GeometryPoint nwo4, PLLine pl1Line, PLLinePoint nwo3Pl, PLLinePoint intersection1, PLLinePoint intersection2)
- {
- var lineNWO = new Deltares.Geometry.Line { BeginPoint = new GeometryPoint(nwo3.X, 0, nwo3.Z), EndPoint = new GeometryPoint(nwo4.X, 0, nwo4.Z) };
- var linePL = new Deltares.Geometry.Line { BeginPoint = new GeometryPoint(intersection1.X, 0, intersection1.Z), EndPoint = new GeometryPoint(nwo4.X, 0, intersection1.Z) };
- var isp = new GeometryPoint();
- if (LineHelper.GetStrictIntersectionPoint(lineNWO, linePL, ref isp))
- {
- var newP1 = pl1Line.EnsurePointAtX(intersection1.X, GeometryPoint.Precision);
- newP1.Z = intersection1.Z;
- var newP2 = pl1Line.EnsurePointAtX(isp.X + cOffsetPhreaticLineBelowSurface, GeometryPoint.Precision);
- newP2.Z = intersection1.Z;
- var newP3 = pl1Line.EnsurePointAtX(intersection2.X + cOffsetPhreaticLineBelowSurface, GeometryPoint.Precision);
- newP3.Z = intersection2.Z;
- }
- else
- {
- var lineNWOb = new Deltares.Geometry.Line { BeginPoint = new GeometryPoint(nwo2.X, 0, nwo2.Z), EndPoint = new GeometryPoint(nwo3.X, 0, nwo3.Z) };
- if (LineHelper.GetStrictIntersectionPoint(lineNWOb, linePL, ref isp))
- {
- var newP1 = pl1Line.EnsurePointAtX(intersection1.X, GeometryPoint.Precision);
- newP1.Z = intersection1.Z;
- var newP2 = pl1Line.EnsurePointAtX(isp.X + cOffsetPhreaticLineBelowSurface, GeometryPoint.Precision);
- newP2.Z = intersection1.Z;
- var newP3 = pl1Line.EnsurePointAtX(nwo3Pl.X, GeometryPoint.Precision);
- newP3.Z = nwo3Pl.Z;
- if (nwo3Pl.X < intersection2.X)
- {
- var newP4 = pl1Line.EnsurePointAtX(intersection2.X + cOffsetPhreaticLineBelowSurface, GeometryPoint.Precision);
- newP4.Z = intersection2.Z;
- }
- }
- else
- {
- throw new PLLinesCreatorException("Could not create the intersectionsection points between NWO and Phreatic line to create horizontal level.");
- }
- }
- }
-
- private void RemoveAllWaterFromNonWaterRetainingObject(GeometryPoint nwo1, PLLine pl1Line, PLLinePoint nwo1Pl, PLLinePoint nwo2Pl, PLLinePoint nwo3Pl, PLLinePoint nwo4Pl, PLLinePoint intersection1, PLLinePoint intersection2, IEnumerable plPointsToBeMoved)
- {
- if ((nwo1.X >= this.surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder).X) ||
- ((intersection1 != null) && (intersection2 != null)))
- {
- // Move all the points in the pl line itself that need to be moved to below the surfaceline.
- MoveSelectedPLLinePointsBelowSurfaceLine(plPointsToBeMoved);
-
- // now add all extra points to the pl line
- if (nwo1Pl != null)
- {
- var newP = pl1Line.EnsurePointAtX(nwo1Pl.X, GeometryPoint.Precision);
- newP.Z = nwo1Pl.Z;
- }
- if (nwo2Pl != null)
- {
- var newP = pl1Line.EnsurePointAtX(nwo2Pl.X, GeometryPoint.Precision);
- newP.Z = nwo2Pl.Z;
- }
- if (nwo3Pl != null)
- {
- var newP = pl1Line.EnsurePointAtX(nwo3Pl.X, GeometryPoint.Precision);
- newP.Z = nwo3Pl.Z;
- }
- if (nwo4Pl != null)
- {
- var newP = pl1Line.EnsurePointAtX(nwo4Pl.X, GeometryPoint.Precision);
- newP.Z = nwo4Pl.Z;
- }
- // Note: for intersection points, apply offset in X direction not in Z.
- if (intersection1 != null)
- {
- var newP = pl1Line.EnsurePointAtX(intersection1.X - cOffsetPhreaticLineBelowSurface, GeometryPoint.Precision);
- newP.Z = intersection1.Z;
- }
- if (intersection2 != null)
- {
- var newP = pl1Line.EnsurePointAtX(intersection2.X + cOffsetPhreaticLineBelowSurface, GeometryPoint.Precision);
- newP.Z = intersection2.Z;
- }
- pl1Line.DeleteCoinsidingPoints(GeometryPoint.Precision);
- }
- }
-
- private void MakeWaterLevelHorizontalInNWOAtRiverSideUsingInterSection2(GeometryPoint nwo1, GeometryPoint nwo2, GeometryPoint nwo3, PLLine pl1Line, PLLinePoint nwo1Pl, PLLinePoint nwo2Pl, PLLinePoint nwo3Pl, PLLinePoint intersection2)
- {
- var lineNWO = new Deltares.Geometry.Line { BeginPoint = new GeometryPoint(nwo1.X, 0, nwo1.Z), EndPoint = new GeometryPoint(nwo2.X, 0, nwo2.Z) };
- var linePL = new Deltares.Geometry.Line { BeginPoint = new GeometryPoint(nwo1.X, 0, intersection2.Z), EndPoint = new GeometryPoint(intersection2.X, 0, intersection2.Z) };
- var isp = new GeometryPoint();
- if (LineHelper.GetStrictIntersectionPoint(lineNWO, linePL, ref isp))
- {
- var newP1 = pl1Line.EnsurePointAtX(intersection2.X, GeometryPoint.Precision);
- newP1.Z = intersection2.Z;
- var newP2 = pl1Line.EnsurePointAtX(isp.X - cOffsetPhreaticLineBelowSurface, GeometryPoint.Precision);
- newP2.Z = intersection2.Z;
- if (nwo1Pl != null)
- {
- var newP3 = pl1Line.EnsurePointAtX(nwo1Pl.X, GeometryPoint.Precision);
- newP3.Z = nwo1Pl.Z;
- }
- }
- else
- {
- var lineNWOb = new Deltares.Geometry.Line { BeginPoint = new GeometryPoint(nwo2.X, 0, nwo2.Z), EndPoint = new GeometryPoint(nwo3.X, 0, nwo3.Z) };
- if (LineHelper.GetStrictIntersectionPoint(lineNWOb, linePL, ref isp))
- {
- var newP1 = pl1Line.EnsurePointAtX(intersection2.X, GeometryPoint.Precision);
- newP1.Z = intersection2.Z;
- var newP2 = pl1Line.EnsurePointAtX(isp.X - cOffsetPhreaticLineBelowSurface, GeometryPoint.Precision);
- newP2.Z = intersection2.Z;
- if (nwo2Pl != null)
- {
- var newP3 = pl1Line.EnsurePointAtX(nwo2Pl.X, GeometryPoint.Precision);
- newP3.Z = nwo2Pl.Z;
- if ((nwo1Pl != null) && (nwo2Pl.X > nwo1Pl.X))
- {
- var newP4 = pl1Line.EnsurePointAtX(nwo1Pl.X, GeometryPoint.Precision);
- newP4.Z = nwo1Pl.Z;
- }
- }
- }
- else
- {
- throw new PLLinesCreatorException("Could not create the intersectionsection points between NWO and Phreatic line to create horizontal level.");
- }
- }
- }
-
- private void MakeWaterLevelHorizontalInNWOAtRiverSideUsingInterSection1(GeometryPoint nwo2, GeometryPoint nwo3, GeometryPoint nwo4, PLLine pl1Line, PLLinePoint nwo3Pl, PLLinePoint nwo4Pl, PLLinePoint intersection1)
- {
- var lineNWO = new Deltares.Geometry.Line { BeginPoint = new GeometryPoint(nwo3.X, 0, nwo3.Z), EndPoint = new GeometryPoint(nwo4.X, 0, nwo4.Z) };
- var linePL = new Deltares.Geometry.Line { BeginPoint = new GeometryPoint(intersection1.X, 0, intersection1.Z), EndPoint = new GeometryPoint(nwo4.X, 0, intersection1.Z) };
- var isp = new GeometryPoint();
- if (LineHelper.GetStrictIntersectionPoint(lineNWO, linePL, ref isp))
- {
- var newP1 = pl1Line.EnsurePointAtX(intersection1.X, GeometryPoint.Precision);
- newP1.Z = intersection1.Z;
- var newP2 = pl1Line.EnsurePointAtX(isp.X + cOffsetPhreaticLineBelowSurface, GeometryPoint.Precision);
- newP2.Z = intersection1.Z;
- if (nwo4Pl != null)
- {
- var newP3 = pl1Line.EnsurePointAtX(nwo4Pl.X, GeometryPoint.Precision);
- newP3.Z = nwo4Pl.Z;
- }
- }
- else
- {
- var lineNWOb = new Deltares.Geometry.Line { BeginPoint = new GeometryPoint(nwo2.X, 0, nwo2.Z), EndPoint = new GeometryPoint(nwo3.X, 0, nwo3.Z) };
- if (LineHelper.GetStrictIntersectionPoint(lineNWOb, linePL, ref isp))
- {
- var newP1 = pl1Line.EnsurePointAtX(intersection1.X, GeometryPoint.Precision);
- newP1.Z = intersection1.Z;
- var newP2 = pl1Line.EnsurePointAtX(isp.X + cOffsetPhreaticLineBelowSurface, GeometryPoint.Precision);
- newP2.Z = intersection1.Z;
- if (nwo3Pl != null)
- {
- var newP3 = pl1Line.EnsurePointAtX(nwo3Pl.X, GeometryPoint.Precision);
- newP3.Z = nwo3Pl.Z;
- if ((nwo4Pl != null) && (nwo4Pl.X > nwo3Pl.X))
- {
- var newP4 = pl1Line.EnsurePointAtX(nwo4Pl.X, GeometryPoint.Precision);
- newP4.Z = nwo4Pl.Z;
- }
- }
- }
- else
- {
- throw new PLLinesCreatorException("Could not create the intersectionsection points between NWO and Phreatic line to create horizontal level.");
- }
- }
- }
-
- private void MoveSelectedPLLinePointsBelowSurfaceLine(IEnumerable plPointsToBeMoved)
- {
- foreach (var plLinePoint in plPointsToBeMoved)
- {
- // Determine which of these points must be moved and move them
- if (this.surfaceLine.Geometry.PositionXzOfPointRelatedToExtrapolatedLine(plLinePoint) !=
- RelativeXzPosition.BelowGeometricLine)
- {
- plLinePoint.Z = this.surfaceLine.Geometry.GetZAtX(plLinePoint.X) - cOffsetPhreaticLineBelowSurface;
- }
- }
- }
-
///
///
///
///
///
- private PLLines CreateAllPLLinesWithGaugesWithFallbackToExpertKnowledgeRRD(Location location)
- {
- var plLines = new PLLines();
+// private PLLines CreateAllPLLinesWithGaugesWithFallbackToExpertKnowledgeRRD(Location location)
+// {
+// var plLines = new PLLines();
+//
+// foreach (PLLineType plLineType in Enum.GetValues(typeof(PLLineType)))
+// {
+// GaugePLLine gaugePLLine = (this.GaugePLLines != null) ? (this.GaugePLLines.FirstOrDefault(x => x.PLLineType == plLineType)) : null;
+// if (gaugePLLine != null && location != null)
+// {
+// Boolean isUseWaterLevel = ((plLineType == PLLineType.PL1) || (plLineType == PLLineType.PL2));
+// plLines.Lines[plLineType] = CreatePLLineFromGauges(gaugePLLine, this.Gauges, location, isUseWaterLevel);
+// }
+// else
+// plLines.Lines[plLineType] = CreatePLLineByExpertKnowledge(plLineType, location.DamType, location.SlopeDampingPiezometricHeightPolderSide);
+//
+// // currentPL1Line is needed when calculating uplift reduction for PL3 and Pl4
+// if (plLineType == PLLineType.PL1)
+// {
+// currentPL1Line = plLines.Lines[plLineType];
+// }
+// }
+// return plLines;
+// }
- foreach (PLLineType plLineType in Enum.GetValues(typeof(PLLineType)))
- {
- GaugePLLine gaugePLLine = (this.GaugePLLines != null) ? (this.GaugePLLines.FirstOrDefault(x => x.PLLineType == plLineType)) : null;
- if (gaugePLLine != null && location != null)
- {
- Boolean isUseWaterLevel = ((plLineType == PLLineType.PL1) || (plLineType == PLLineType.PL2));
- plLines.Lines[plLineType] = CreatePLLineFromGauges(gaugePLLine, this.Gauges, location, isUseWaterLevel);
- }
- else
- plLines.Lines[plLineType] = CreatePLLineByExpertKnowledge(plLineType, location.DamType, location.SlopeDampingPiezometricHeightPolderSide);
-
- // currentPL1Line is needed when calculating uplift reduction for PL3 and Pl4
- if (plLineType == PLLineType.PL1)
- {
- currentPL1Line = plLines.Lines[plLineType];
- }
- }
- return plLines;
- }
-
///
/// Create all PLLines
///
///
- public PLLines CreateAllPLLines(Location location)
- {
+// public PLLines CreateAllPLLines(Location location)
+// {
+//
+// PLLines plLines = new PLLines();
+// switch (modelParametersForPLLines.PLLineCreationMethod)
+// {
+// case PLLineCreationMethod.ExpertKnowledgeLinearInDike:
+// case PLLineCreationMethod.ExpertKnowledgeRRD: plLines = CreateAllPLLinesWithExpertKnowledge(location);
+// break;
+// case PLLineCreationMethod.GaugesWithFallbackToExpertKnowledgeRRD: plLines = CreateAllPLLinesWithGaugesWithFallbackToExpertKnowledgeRRD(location);
+// break;
+// }
+//
+//
+// // If PL Line2 does not exists, make it equal to PL line 4
+// if (!plLines.Lines[PLLineType.PL2].Exists())
+// {
+// plLines.Lines[PLLineType.PL2] = plLines.Lines[PLLineType.PL4].Clone();
+// }
+//
+// if (!plLines.Lines[PLLineType.PL1].IsXAscending())
+// {
+// throw new PLLinesCreatorException("PLLine 1 not an X-ascending polyline");
+// }
+//
+// return plLines;
+// }
- PLLines plLines = new PLLines();
- switch (modelParametersForPLLines.PLLineCreationMethod)
- {
- case PLLineCreationMethod.ExpertKnowledgeLinearInDike:
- case PLLineCreationMethod.ExpertKnowledgeRRD: plLines = CreateAllPLLinesWithExpertKnowledge(location);
- break;
- case PLLineCreationMethod.GaugesWithFallbackToExpertKnowledgeRRD: plLines = CreateAllPLLinesWithGaugesWithFallbackToExpertKnowledgeRRD(location);
- break;
- }
-
-
- // If PL Line2 does not exists, make it equal to PL line 4
- if (!plLines.Lines[PLLineType.PL2].Exists())
- {
- plLines.Lines[PLLineType.PL2] = plLines.Lines[PLLineType.PL4].Clone();
- }
-
- if (!plLines.Lines[PLLineType.PL1].IsXAscending())
- {
- throw new PLLinesCreatorException("PLLine 1 not an X-ascending polyline");
- }
-
- return plLines;
- }
-
///
///
///
@@ -1429,102 +1430,102 @@
///
///
///
- private PLLine CreatePLLineFromGauges(GaugePLLine gaugePLLine, IEnumerable gauges, Location location, Boolean useWaterLevel)
- {
- PLLine plLine = new PLLine();
+// private PLLine CreatePLLineFromGauges(GaugePLLine gaugePLLine, IEnumerable gauges, Location location, Boolean useWaterLevel)
+// {
+// PLLine plLine = new PLLine();
+//
+// double? gaugeWaterLevelRiver = null;
+// double? leftMostXAtRiverLevel = null;
+//
+// int pointIndex = 0;
+// foreach (GaugePLLinePoint gaugePLLinePoint in gaugePLLine.Points)
+// {
+//
+// double? localX = gaugePLLinePoint.X;
+// double? localZ = gaugePLLinePoint.Z;
+//
+// if (gauges != null)
+// {
+// if (gaugePLLinePoint.GaugeIDX != null && gaugePLLinePoint.GaugeIDX != "")
+// {
+// Gauge gauge = (gauges.Where(x => x.Name == gaugePLLinePoint.GaugeIDX && x.Location == location)).FirstOrDefault();
+// if (gauge != null)
+// localX = gauge.LocalX;
+// else
+// {
+// throw new PLLinesCreatorException(String.Format("Gauge PL line {0} refers to an unknown gauge named '{1}' at X coordinate #{2}.",
+// gaugePLLine.PLLineType.ToString(), gaugePLLinePoint.GaugeIDX, pointIndex));
+// }
+// }
+// if (gaugePLLinePoint.GaugeIDZ != null && gaugePLLinePoint.GaugeIDZ != "")
+// {
+// Gauge gauge = (gauges.Where(x => x.Name == gaugePLLinePoint.GaugeIDZ && x.Location == location)).FirstOrDefault();
+// if (gauge != null)
+// {
+// if ((!gauge.Value.HasValue) || (gauge.Value == GaugeMissVal))
+// throw new PLLinesCreatorException(String.Format("Value of gauge {0} at location {1} in gauge PL line of type {2} is undefined.",
+// gauge.Name, location.Name, gaugePLLine.PLLineType.ToString()));
+// localZ = gauge.Value;
+// }
+// else
+// {
+// throw new PLLinesCreatorException(String.Format("Gauge PL line {0} refers to an unknown gauge named '{1}' at Z coordinate #{2}.",
+// gaugePLLine.PLLineType.ToString(), gaugePLLinePoint.GaugeIDZ, pointIndex));
+// }
+// }
+// }
+//
+// if (!localX.HasValue)
+// throw new PLLinesCreatorException(String.Format("Gauge PL line {0}'s X coordinate #{1} is undefined.", gaugePLLine.PLLineType.ToString(), pointIndex));
+// else if (!localZ.HasValue)
+// throw new PLLinesCreatorException(String.Format("Gauge PL line {0}'s value #{1} is undefined.", gaugePLLine.PLLineType.ToString(), pointIndex));
+// else
+// {
+// if (!leftMostXAtRiverLevel.HasValue || localX > leftMostXAtRiverLevel)
+// {
+// plLine.Points.Add(new PLLinePoint(localX.Value, localZ.Value));
+// if (useWaterLevel)
+// {
+// // Have to account for waterlevel
+// if (!gaugeWaterLevelRiver.HasValue)
+// {
+// // Use first gauge as waterlevel
+// gaugeWaterLevelRiver = localZ.Value;
+// IList intersectionsAtX = this.surfaceLine.Geometry.IntersectionsXAtZ(gaugeWaterLevelRiver.Value);
+// if (intersectionsAtX.Count() > 0)
+// {
+// // this is where the waterlevel intersects with the dike
+// leftMostXAtRiverLevel = intersectionsAtX.First();
+// plLine.Points.Add(new PLLinePoint(leftMostXAtRiverLevel.Value, gaugeWaterLevelRiver.Value));
+// }
+// else
+// {
+// // No intersection with dike; polder is flooded
+// leftMostXAtRiverLevel = this.surfaceLine.Geometry.Points.Last().X;
+// plLine.Points.Add(new PLLinePoint(this.surfaceLine.Geometry.Points.Last().X, gaugeWaterLevelRiver.Value));
+// }
+// }
+// }
+// else
+// {
+// // In this case no intersection for this Plline with the dike will be considered
+// leftMostXAtRiverLevel = this.surfaceLine.Geometry.Points.First().X;
+// }
+// }
+// }
+//
+// pointIndex++;
+// }
+//
+// if (plLine.Points.Count() > 0)
+// {
+// plLine.Points.First().X = this.surfaceLine.Geometry.Points.First().X;
+// plLine.Points.Last().X = this.surfaceLine.Geometry.Points.Last().X;
+// }
+//
+// return plLine;
+// }
- double? gaugeWaterLevelRiver = null;
- double? leftMostXAtRiverLevel = null;
-
- int pointIndex = 0;
- foreach (GaugePLLinePoint gaugePLLinePoint in gaugePLLine.Points)
- {
-
- double? localX = gaugePLLinePoint.X;
- double? localZ = gaugePLLinePoint.Z;
-
- if (gauges != null)
- {
- if (gaugePLLinePoint.GaugeIDX != null && gaugePLLinePoint.GaugeIDX != "")
- {
- Gauge gauge = (gauges.Where(x => x.Name == gaugePLLinePoint.GaugeIDX && x.Location == location)).FirstOrDefault();
- if (gauge != null)
- localX = gauge.LocalX;
- else
- {
- throw new PLLinesCreatorException(String.Format("Gauge PL line {0} refers to an unknown gauge named '{1}' at X coordinate #{2}.",
- gaugePLLine.PLLineType.ToString(), gaugePLLinePoint.GaugeIDX, pointIndex));
- }
- }
- if (gaugePLLinePoint.GaugeIDZ != null && gaugePLLinePoint.GaugeIDZ != "")
- {
- Gauge gauge = (gauges.Where(x => x.Name == gaugePLLinePoint.GaugeIDZ && x.Location == location)).FirstOrDefault();
- if (gauge != null)
- {
- if ((!gauge.Value.HasValue) || (gauge.Value == GaugeMissVal))
- throw new PLLinesCreatorException(String.Format("Value of gauge {0} at location {1} in gauge PL line of type {2} is undefined.",
- gauge.Name, location.Name, gaugePLLine.PLLineType.ToString()));
- localZ = gauge.Value;
- }
- else
- {
- throw new PLLinesCreatorException(String.Format("Gauge PL line {0} refers to an unknown gauge named '{1}' at Z coordinate #{2}.",
- gaugePLLine.PLLineType.ToString(), gaugePLLinePoint.GaugeIDZ, pointIndex));
- }
- }
- }
-
- if (!localX.HasValue)
- throw new PLLinesCreatorException(String.Format("Gauge PL line {0}'s X coordinate #{1} is undefined.", gaugePLLine.PLLineType.ToString(), pointIndex));
- else if (!localZ.HasValue)
- throw new PLLinesCreatorException(String.Format("Gauge PL line {0}'s value #{1} is undefined.", gaugePLLine.PLLineType.ToString(), pointIndex));
- else
- {
- if (!leftMostXAtRiverLevel.HasValue || localX > leftMostXAtRiverLevel)
- {
- plLine.Points.Add(new PLLinePoint(localX.Value, localZ.Value));
- if (useWaterLevel)
- {
- // Have to account for waterlevel
- if (!gaugeWaterLevelRiver.HasValue)
- {
- // Use first gauge as waterlevel
- gaugeWaterLevelRiver = localZ.Value;
- IList intersectionsAtX = this.surfaceLine.Geometry.IntersectionsXAtZ(gaugeWaterLevelRiver.Value);
- if (intersectionsAtX.Count() > 0)
- {
- // this is where the waterlevel intersects with the dike
- leftMostXAtRiverLevel = intersectionsAtX.First();
- plLine.Points.Add(new PLLinePoint(leftMostXAtRiverLevel.Value, gaugeWaterLevelRiver.Value));
- }
- else
- {
- // No intersection with dike; polder is flooded
- leftMostXAtRiverLevel = this.surfaceLine.Geometry.Points.Last().X;
- plLine.Points.Add(new PLLinePoint(this.surfaceLine.Geometry.Points.Last().X, gaugeWaterLevelRiver.Value));
- }
- }
- }
- else
- {
- // In this case no intersection for this Plline with the dike will be considered
- leftMostXAtRiverLevel = this.surfaceLine.Geometry.Points.First().X;
- }
- }
- }
-
- pointIndex++;
- }
-
- if (plLine.Points.Count() > 0)
- {
- plLine.Points.First().X = this.surfaceLine.Geometry.Points.First().X;
- plLine.Points.Last().X = this.surfaceLine.Geometry.Points.Last().X;
- }
-
- return plLine;
- }
-
///
/// Validate of all required characteristic points exists
///
@@ -1583,34 +1584,34 @@
phreaticLine.Points.Add(pointBelowHighLevel);
break;
- case PLLineCreationMethod.ExpertKnowledgeRRD:
- //Add points below surface of dike talud riverside until toe of dike riverside
- foreach (GeometryPoint point in SurfaceLine.Geometry.Points.Where(
- point => point.X > intersectionLowWaterLevelWithDike.X &&
- point.X <= pointDikeToeAtRiver.X))
- {
- if (!surfaceLine.IsNonWaterRetainingObjectPoint(point))
- {
- phreaticLine.Points.Add(new PLLinePoint(point.X, point.Z - cPLLineOffsetBelowSurface));
- }
- }
-
- // Add points below crest of dike
- double offsetDikeTopAtRiver = this.waterLevelRiverHigh - PlLineOffsetBelowDikeTopAtRiver;
- double offsetDikeTopAtPolder = this.waterLevelRiverHigh - PlLineOffsetBelowDikeTopAtPolder;
- GeometryPoint pointDikeTopAtRiver = surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtRiver);
- GeometryPoint pointDikeTopAtPolder = surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder);
- if (pointDikeTopAtRiver != null)
- phreaticLine.Points.Add(new PLLinePoint(pointDikeTopAtRiver.X, offsetDikeTopAtRiver));
-
- if (pointDikeTopAtRiver != null && pointDikeTopAtPolder != null)
- {
- CreateOptionalPointAtDikeCrestMiddle(phreaticLine, pointDikeTopAtRiver, pointDikeTopAtPolder);
- }
-
- if (pointDikeTopAtPolder != null)
- phreaticLine.Points.Add(new PLLinePoint(pointDikeTopAtPolder.X, offsetDikeTopAtPolder));
- break;
+// case PLLineCreationMethod.ExpertKnowledgeRRD:
+// //Add points below surface of dike talud riverside until toe of dike riverside
+// foreach (GeometryPoint point in SurfaceLine.Geometry.Points.Where(
+// point => point.X > intersectionLowWaterLevelWithDike.X &&
+// point.X <= pointDikeToeAtRiver.X))
+// {
+// if (!surfaceLine.IsNonWaterRetainingObjectPoint(point))
+// {
+// phreaticLine.Points.Add(new PLLinePoint(point.X, point.Z - cPLLineOffsetBelowSurface));
+// }
+// }
+//
+// // Add points below crest of dike
+// double offsetDikeTopAtRiver = this.waterLevelRiverHigh - PlLineOffsetBelowDikeTopAtRiver;
+// double offsetDikeTopAtPolder = this.waterLevelRiverHigh - PlLineOffsetBelowDikeTopAtPolder;
+// GeometryPoint pointDikeTopAtRiver = surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtRiver);
+// GeometryPoint pointDikeTopAtPolder = surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder);
+// if (pointDikeTopAtRiver != null)
+// phreaticLine.Points.Add(new PLLinePoint(pointDikeTopAtRiver.X, offsetDikeTopAtRiver));
+//
+// if (pointDikeTopAtRiver != null && pointDikeTopAtPolder != null)
+// {
+// CreateOptionalPointAtDikeCrestMiddle(phreaticLine, pointDikeTopAtRiver, pointDikeTopAtPolder);
+// }
+//
+// if (pointDikeTopAtPolder != null)
+// phreaticLine.Points.Add(new PLLinePoint(pointDikeTopAtPolder.X, offsetDikeTopAtPolder));
+// break;
}
}
@@ -1676,183 +1677,183 @@
///
///
///
- private void CreatePhreaticLineSegmentsInShoulderAndPolder(PLLine phreaticLine)
- {
- PLLinePoint intersectionPolderLevelWithDike = DetermineIntersectionBetweenPolderLevelAndDike(this.WaterLevelPolder);
- GeometryPoint dikeToeAtPolderPoint = surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder);
+// private void CreatePhreaticLineSegmentsInShoulderAndPolder(PLLine phreaticLine)
+// {
+// PLLinePoint intersectionPolderLevelWithDike = DetermineIntersectionBetweenPolderLevelAndDike(this.WaterLevelPolder);
+// GeometryPoint dikeToeAtPolderPoint = surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder);
+//
+// double maxXCoordinateSurface = surfaceLine.Geometry.Points.Max(x => x.X);
+// if (modelParametersForPLLines.PLLineCreationMethod != PLLineCreationMethod.ExpertKnowledgeLinearInDike)
+// {
+// // Points created below are points starting at shoulder point to the right
+// GeometryPoint shoulderBaseInsidePoint = surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.ShoulderBaseInside);
+// if (shoulderBaseInsidePoint != null)
+// {
+// double zLevel = Math.Min(phreaticLine.Points.Last().Z,
+// shoulderBaseInsidePoint.Z -
+// Math.Max(cOffsetPhreaticLineBelowSurface, PlLineOffsetBelowShoulderBaseInside));
+// zLevel = Math.Max(zLevel, this.WaterLevelPolder);
+// // Add point if it lies left of intersection of polderlevel with dike)
+// if ((intersectionPolderLevelWithDike == null) ||
+// (intersectionPolderLevelWithDike.X > shoulderBaseInsidePoint.X))
+// {
+// phreaticLine.Points.Add(new PLLinePoint(shoulderBaseInsidePoint.X, zLevel));
+// }
+//
+// if (UsePlLineOffsetFactorBelowShoulderCrest.HasValue && UsePlLineOffsetFactorBelowShoulderCrest.Value &&
+// PlLineOffsetFactorBelowShoulderCrest != null && dikeToeAtPolderPoint != null)
+// {
+// GeometryPoint shoulderTopInsidePoint =
+// surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.ShoulderTopInside);
+// if (shoulderTopInsidePoint != null)
+// {
+// zLevel = dikeToeAtPolderPoint.Z + (PlLineOffsetFactorBelowShoulderCrest.Value*
+// (shoulderTopInsidePoint.Z - dikeToeAtPolderPoint.Z));
+// zLevel = Math.Min(zLevel, shoulderTopInsidePoint.Z - cOffsetPhreaticLineBelowSurface);
+// zLevel = Math.Min(zLevel, phreaticLine.Points.Last().Z);
+// zLevel = Math.Max(zLevel, this.WaterLevelPolder);
+// phreaticLine.Points.Add(new PLLinePoint(shoulderTopInsidePoint.X, zLevel));
+// }
+// }
+// }
+// }
+//
+// GeometryPoint ditchDikeSidePoint = surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DitchDikeSide);
+// if (dikeToeAtPolderPoint != null)
+// {
+//
+// double zLevel = Math.Min(phreaticLine.Points.Last().Z, dikeToeAtPolderPoint.Z - Math.Max(cOffsetPhreaticLineBelowSurface, PlLineOffsetBelowDikeToeAtPolder));
+// if (ditchDikeSidePoint != null)
+// {
+// if (ditchDikeSidePoint.LocationEquals(dikeToeAtPolderPoint))
+// {
+// // If DikeToeAtPolder is same as DitchDikeSide pl1 should always go to polderlevel at this point
+// zLevel = this.WaterLevelPolder;
+// }
+// }
+// zLevel = Math.Max(zLevel, this.WaterLevelPolder);
+// // Add point if it lies left of intersection of polderlevel with dike
+// if ((intersectionPolderLevelWithDike == null) || (intersectionPolderLevelWithDike.X > dikeToeAtPolderPoint.X))
+// {
+// phreaticLine.Points.Add(new PLLinePoint(dikeToeAtPolderPoint.X, zLevel));
+// }
+// }
+//
+// if (intersectionPolderLevelWithDike != null)
+// {
+// phreaticLine.Points.Add(intersectionPolderLevelWithDike);
+// }
+//
+// var isDitchPresent = (ditchDikeSidePoint != null);
+// var isNonWaterRetainingOjectPresent = ((NWOPhreaticAdaption != null) && surfaceLine.HasAnnotation(CharacteristicPointType.NonWaterRetainingObjectPoint1));
+// var adjustDitch = false;
+// // Handle making the waterlevel horizontal in the NWO at the Polderside when needed (For Riverside see AdaptPL1ForNonWaterRetainingObject).
+// var nonWaterRetainingGeometryPoint = surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.NonWaterRetainingObjectPoint1);
+// if (isNonWaterRetainingOjectPresent && (NWOPhreaticAdaption != PhreaticAdaptionType.Fill) &&
+// (nonWaterRetainingGeometryPoint.X >= surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder).X))
+// {
+// // if there is a ditch and it is to the left of the NWO, then only the ditch needs to be adjusted and the NWO will be correct automatically.
+// // if there is a ditch but it is to the right of the NWO, the NWO needs adjusting and the Ditch will be correct automatically.
+// // if there is no ditch then the NWO needs adjusting.
+// if (isDitchPresent)
+// {
+// adjustDitch = (nonWaterRetainingGeometryPoint.X >= surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DitchPolderSide).X);
+// }
+// if (!adjustDitch)
+// {
+// GeometryPoint nw1 = nonWaterRetainingGeometryPoint;
+// int surfacePointIndex = surfaceLine.Geometry.Points.IndexOf(nw1);
+// AdjustForDitchAndOrNonWaterRetainingObjectatPolderSide(phreaticLine, surfacePointIndex);
+// }
+// }
+// else
+// {
+// // No (relevant) NWO so enable handling of ditch.
+// // If there is a ditch but there is also a NWO to the right of it at polder side, then do not adjust the ditch. Do in all other cases.
+// // First see if there is a NWO.
+// adjustDitch = !isNonWaterRetainingOjectPresent;
+// if (!adjustDitch)
+// {
+// // there is a NWO, check the position
+// adjustDitch =
+// !((isDitchPresent) &&
+// (surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.NonWaterRetainingObjectPoint1).X >=
+// surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder).X) &&
+// (surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.NonWaterRetainingObjectPoint4).X <=
+// surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DitchDikeSide).X));
+// }
+// }
+// // if the NWO is not there or irrelevant and there is a ditch, then adjust it.
+// if ((adjustDitch) && (isDitchPresent))
+// {
+// int surfacePointIndex = surfaceLine.Geometry.Points.IndexOf(ditchDikeSidePoint);
+// AdjustForDitchAndOrNonWaterRetainingObjectatPolderSide(phreaticLine, surfacePointIndex);
+// }
+// else
+// {
+// // if no ditch then the PL1 will continue horizontally until the end of the profile
+// // another choice could be to let the PL1 go to polderlevel at the end of the profile, but that could be too optimistic for uplift.
+// // Discussion about this was done between Vastenburg, Knoeff and The.
+// // After a renewed discussion with Vastenburg, Van der Zwan and Bka, it has been decided that the PL1 should follow the
+// // surfaceline (with offset) until either end of surface line or polder level. Note: this is only needed when the phreatic level
+// // at dike toe is above polder level.
+// if ((!isNonWaterRetainingOjectPresent) && (!isDitchPresent))
+// {
+// if (phreaticLine.Points[phreaticLine.Points.Count - 1].Z > WaterLevelPolder)
+// {
+// AddPhreaticLineAlongSurfaceLevel(phreaticLine);
+// }
+// }
+// }
+//
+// //Validate if endpoint surface has reached
+// if (phreaticLine.Points.Last().X != maxXCoordinateSurface)
+// {
+// PLLinePoint endPoint = new PLLinePoint(maxXCoordinateSurface, phreaticLine.Points.Last().Z);
+// phreaticLine.Points.Add(endPoint);
+// }
+// }
- double maxXCoordinateSurface = surfaceLine.Geometry.Points.Max(x => x.X);
- if (modelParametersForPLLines.PLLineCreationMethod != PLLineCreationMethod.ExpertKnowledgeLinearInDike)
- {
- // Points created below are points starting at shoulder point to the right
- GeometryPoint shoulderBaseInsidePoint = surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.ShoulderBaseInside);
- if (shoulderBaseInsidePoint != null)
- {
- double zLevel = Math.Min(phreaticLine.Points.Last().Z,
- shoulderBaseInsidePoint.Z -
- Math.Max(cOffsetPhreaticLineBelowSurface, PlLineOffsetBelowShoulderBaseInside));
- zLevel = Math.Max(zLevel, this.WaterLevelPolder);
- // Add point if it lies left of intersection of polderlevel with dike)
- if ((intersectionPolderLevelWithDike == null) ||
- (intersectionPolderLevelWithDike.X > shoulderBaseInsidePoint.X))
- {
- phreaticLine.Points.Add(new PLLinePoint(shoulderBaseInsidePoint.X, zLevel));
- }
+// private void AddPhreaticLineAlongSurfaceLevel(PLLine phreaticLine)
+// {
+// // Add phreatic point at offset below every surface line point as long as depth > polder level. Else determine the
+// // proper position of the point at polder level (intersection) and stop.
+// var surfacePointIndex = surfaceLine.Geometry.Points.IndexOf(surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder)) + 1;
+// bool intersected = false;
+// for (int i = surfacePointIndex; i < surfaceLine.Geometry.Points.Count; i++)
+// {
+// double z = Math.Max(waterLevelPolder, surfaceLine.Geometry.Points[i].Z - PlLineOffsetBelowDikeToeAtPolder);
+// double x = surfaceLine.Geometry.Points[i].X;
+// if (waterLevelPolder > surfaceLine.Geometry.Points[i].Z - PlLineOffsetBelowDikeToeAtPolder)
+// {
+// // Determine intersection between would be phreatic segment and polderlevel. Add that as next point.
+// Line waterLevelPolderLine = new Line(new GeometryPoint(surfaceLine.Geometry.Points.First().X, WaterLevelPolder),
+// new GeometryPoint(surfaceLine.Geometry.Points.Last().X, 0, WaterLevelPolder));
+// Line slopeLine = new Line(new GeometryPoint(phreaticLine.Points[phreaticLine.Points.Count - 1].X, phreaticLine.Points[phreaticLine.Points.Count - 1].Z),
+// new GeometryPoint(surfaceLine.Geometry.Points[i].X, surfaceLine.Geometry.Points[i].Z - PlLineOffsetBelowDikeToeAtPolder));
+// GeometryPoint intersectionPoint = new GeometryPoint();
+// if (waterLevelPolderLine.IntersectsZ(slopeLine, out intersectionPoint))
+// {
+// x = intersectionPoint.X;
+// }
+// intersected = true;
+// }
+// PLLinePoint point = new PLLinePoint(x, z);
+// phreaticLine.Points.Add(point);
+// if (intersected)
+// {
+// break;
+// }
+// }
+// }
- if (UsePlLineOffsetFactorBelowShoulderCrest.HasValue && UsePlLineOffsetFactorBelowShoulderCrest.Value &&
- PlLineOffsetFactorBelowShoulderCrest != null && dikeToeAtPolderPoint != null)
- {
- GeometryPoint shoulderTopInsidePoint =
- surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.ShoulderTopInside);
- if (shoulderTopInsidePoint != null)
- {
- zLevel = dikeToeAtPolderPoint.Z + (PlLineOffsetFactorBelowShoulderCrest.Value*
- (shoulderTopInsidePoint.Z - dikeToeAtPolderPoint.Z));
- zLevel = Math.Min(zLevel, shoulderTopInsidePoint.Z - cOffsetPhreaticLineBelowSurface);
- zLevel = Math.Min(zLevel, phreaticLine.Points.Last().Z);
- zLevel = Math.Max(zLevel, this.WaterLevelPolder);
- phreaticLine.Points.Add(new PLLinePoint(shoulderTopInsidePoint.X, zLevel));
- }
- }
- }
- }
-
- GeometryPoint ditchDikeSidePoint = surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DitchDikeSide);
- if (dikeToeAtPolderPoint != null)
- {
-
- double zLevel = Math.Min(phreaticLine.Points.Last().Z, dikeToeAtPolderPoint.Z - Math.Max(cOffsetPhreaticLineBelowSurface, PlLineOffsetBelowDikeToeAtPolder));
- if (ditchDikeSidePoint != null)
- {
- if (ditchDikeSidePoint.LocationEquals(dikeToeAtPolderPoint))
- {
- // If DikeToeAtPolder is same as DitchDikeSide pl1 should always go to polderlevel at this point
- zLevel = this.WaterLevelPolder;
- }
- }
- zLevel = Math.Max(zLevel, this.WaterLevelPolder);
- // Add point if it lies left of intersection of polderlevel with dike
- if ((intersectionPolderLevelWithDike == null) || (intersectionPolderLevelWithDike.X > dikeToeAtPolderPoint.X))
- {
- phreaticLine.Points.Add(new PLLinePoint(dikeToeAtPolderPoint.X, zLevel));
- }
- }
-
- if (intersectionPolderLevelWithDike != null)
- {
- phreaticLine.Points.Add(intersectionPolderLevelWithDike);
- }
-
- var isDitchPresent = (ditchDikeSidePoint != null);
- var isNonWaterRetainingOjectPresent = ((NWOPhreaticAdaption != null) && surfaceLine.HasAnnotation(CharacteristicPointType.NonWaterRetainingObjectPoint1));
- var adjustDitch = false;
- // Handle making the waterlevel horizontal in the NWO at the Polderside when needed (For Riverside see AdaptPL1ForNonWaterRetainingObject).
- var nonWaterRetainingGeometryPoint = surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.NonWaterRetainingObjectPoint1);
- if (isNonWaterRetainingOjectPresent && (NWOPhreaticAdaption != PhreaticAdaptionType.Fill) &&
- (nonWaterRetainingGeometryPoint.X >= surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder).X))
- {
- // if there is a ditch and it is to the left of the NWO, then only the ditch needs to be adjusted and the NWO will be correct automatically.
- // if there is a ditch but it is to the right of the NWO, the NWO needs adjusting and the Ditch will be correct automatically.
- // if there is no ditch then the NWO needs adjusting.
- if (isDitchPresent)
- {
- adjustDitch = (nonWaterRetainingGeometryPoint.X >= surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DitchPolderSide).X);
- }
- if (!adjustDitch)
- {
- GeometryPoint nw1 = nonWaterRetainingGeometryPoint;
- int surfacePointIndex = surfaceLine.Geometry.Points.IndexOf(nw1);
- AdjustForDitchAndOrNonWaterRetainingObjectatPolderSide(phreaticLine, surfacePointIndex);
- }
- }
- else
- {
- // No (relevant) NWO so enable handling of ditch.
- // If there is a ditch but there is also a NWO to the right of it at polder side, then do not adjust the ditch. Do in all other cases.
- // First see if there is a NWO.
- adjustDitch = !isNonWaterRetainingOjectPresent;
- if (!adjustDitch)
- {
- // there is a NWO, check the position
- adjustDitch =
- !((isDitchPresent) &&
- (surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.NonWaterRetainingObjectPoint1).X >=
- surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder).X) &&
- (surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.NonWaterRetainingObjectPoint4).X <=
- surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DitchDikeSide).X));
- }
- }
- // if the NWO is not there or irrelevant and there is a ditch, then adjust it.
- if ((adjustDitch) && (isDitchPresent))
- {
- int surfacePointIndex = surfaceLine.Geometry.Points.IndexOf(ditchDikeSidePoint);
- AdjustForDitchAndOrNonWaterRetainingObjectatPolderSide(phreaticLine, surfacePointIndex);
- }
- else
- {
- // if no ditch then the PL1 will continue horizontally until the end of the profile
- // another choice could be to let the PL1 go to polderlevel at the end of the profile, but that could be too optimistic for uplift.
- // Discussion about this was done between Vastenburg, Knoeff and The.
- // After a renewed discussion with Vastenburg, Van der Zwan and Bka, it has been decided that the PL1 should follow the
- // surfaceline (with offset) until either end of surface line or polder level. Note: this is only needed when the phreatic level
- // at dike toe is above polder level.
- if ((!isNonWaterRetainingOjectPresent) && (!isDitchPresent))
- {
- if (phreaticLine.Points[phreaticLine.Points.Count - 1].Z > WaterLevelPolder)
- {
- AddPhreaticLineAlongSurfaceLevel(phreaticLine);
- }
- }
- }
-
- //Validate if endpoint surface has reached
- if (phreaticLine.Points.Last().X != maxXCoordinateSurface)
- {
- PLLinePoint endPoint = new PLLinePoint(maxXCoordinateSurface, phreaticLine.Points.Last().Z);
- phreaticLine.Points.Add(endPoint);
- }
- }
-
- private void AddPhreaticLineAlongSurfaceLevel(PLLine phreaticLine)
- {
- // Add phreatic point at offset below every surface line point as long as depth > polder level. Else determine the
- // proper position of the point at polder level (intersection) and stop.
- var surfacePointIndex = surfaceLine.Geometry.Points.IndexOf(surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder)) + 1;
- bool intersected = false;
- for (int i = surfacePointIndex; i < surfaceLine.Geometry.Points.Count; i++)
- {
- double z = Math.Max(waterLevelPolder, surfaceLine.Geometry.Points[i].Z - PlLineOffsetBelowDikeToeAtPolder);
- double x = surfaceLine.Geometry.Points[i].X;
- if (waterLevelPolder > surfaceLine.Geometry.Points[i].Z - PlLineOffsetBelowDikeToeAtPolder)
- {
- // Determine intersection between would be phreatic segment and polderlevel. Add that as next point.
- Line waterLevelPolderLine = new Line(new GeometryPoint(surfaceLine.Geometry.Points.First().X, 0, WaterLevelPolder),
- new GeometryPoint(surfaceLine.Geometry.Points.Last().X, 0, WaterLevelPolder));
- Line slopeLine = new Line(new GeometryPoint(phreaticLine.Points[phreaticLine.Points.Count - 1].X, 0, phreaticLine.Points[phreaticLine.Points.Count - 1].Z),
- new GeometryPoint(surfaceLine.Geometry.Points[i].X, 0, surfaceLine.Geometry.Points[i].Z - PlLineOffsetBelowDikeToeAtPolder));
- GeometryPoint intersectionPoint = new GeometryPoint();
- if (waterLevelPolderLine.IntersectsZ(slopeLine, out intersectionPoint))
- {
- x = intersectionPoint.X;
- }
- intersected = true;
- }
- PLLinePoint point = new PLLinePoint(x, z);
- phreaticLine.Points.Add(point);
- if (intersected)
- {
- break;
- }
- }
- }
-
private void AdjustForDitchAndOrNonWaterRetainingObjectatPolderSide(PLLine phreaticLine, int surfacePointIndex)
{
const double maxDouble = 99999.999;
- var phreaticPolderPartialLine = new Deltares.Geometry.Line();
+ var phreaticPolderPartialLine = new Line();
//#bka: hier niet langer ook starten met waterlevel als waterlevel onder bottomditch zit!
- phreaticPolderPartialLine.SetBeginAndEndPoints(new GeometryPoint(phreaticLine.Points[0].X, 0, waterLevelPolder),
- new GeometryPoint(maxDouble, 0, waterLevelPolder));
+ phreaticPolderPartialLine.SetBeginAndEndPoints(new Point2D(phreaticLine.Points[0].X, waterLevelPolder),
+ new Point2D(maxDouble, waterLevelPolder));
AddIntersectionDitchDikeSegmentPolderLevelToPhreatic(phreaticLine, surfacePointIndex, phreaticPolderPartialLine);
AddIntersectionDitchPolderSegmentPolderLevelToPhreatic(phreaticLine, phreaticPolderPartialLine);
}
@@ -1864,16 +1865,17 @@
///
///
///
- private void AddIntersectionDitchPolderSegmentPolderLevelToPhreatic(PLLine phreaticLine, Deltares.Geometry.Line phreaticPolderPartialLine)
+ private void AddIntersectionDitchPolderSegmentPolderLevelToPhreatic(PLLine phreaticLine, Line phreaticPolderPartialLine)
{
GeometryPoint pointDitchPolder = surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DitchPolderSide);
if (pointDitchPolder != null)
{
int indexatDitchPolder = surfaceLine.Geometry.Points.IndexOf(pointDitchPolder);
- var lineDitchPolderSide = new Deltares.Geometry.Line();
+ var lineDitchPolderSide = new Line();
if (indexatDitchPolder > 1)
{
- lineDitchPolderSide.SetBeginAndEndPoints(new GeometryPoint(surfaceLine.Geometry.Points[indexatDitchPolder - 1].X, 0, surfaceLine.Geometry.Points[indexatDitchPolder - 1].Z), new GeometryPoint(surfaceLine.Geometry.Points[indexatDitchPolder].X, 0, surfaceLine.Geometry.Points[indexatDitchPolder].Z));
+ lineDitchPolderSide.SetBeginAndEndPoints(new Point2D(surfaceLine.Geometry.Points[indexatDitchPolder - 1].X, surfaceLine.Geometry.Points[indexatDitchPolder - 1].Z),
+ new Point2D(surfaceLine.Geometry.Points[indexatDitchPolder].X, surfaceLine.Geometry.Points[indexatDitchPolder].Z));
GeometryPoint intersectDitchPolderPhreatic = new GeometryPoint();
if (LineHelper.GetStrictIntersectionPoint(lineDitchPolderSide, phreaticPolderPartialLine, ref intersectDitchPolderPhreatic))
@@ -1899,12 +1901,13 @@
///
///
///
- private void AddIntersectionDitchDikeSegmentPolderLevelToPhreatic(PLLine phreaticLine, int surfacePointIndex, Deltares.Geometry.Line phreaticPolderPartialLine)
+ private void AddIntersectionDitchDikeSegmentPolderLevelToPhreatic(PLLine phreaticLine, int surfacePointIndex, Line phreaticPolderPartialLine)
{
if (surfacePointIndex + 1 < surfaceLine.Geometry.Points.Count)
{
- var lineDitchDikeSide = new Deltares.Geometry.Line();
- lineDitchDikeSide.SetBeginAndEndPoints(new GeometryPoint(surfaceLine.Geometry.Points[surfacePointIndex].X, 0, surfaceLine.Geometry.Points[surfacePointIndex].Z), new GeometryPoint(surfaceLine.Geometry.Points[surfacePointIndex + 1].X, 0, surfaceLine.Geometry.Points[surfacePointIndex + 1].Z));
+ var lineDitchDikeSide = new Line();
+ lineDitchDikeSide.SetBeginAndEndPoints(new Point2D(surfaceLine.Geometry.Points[surfacePointIndex].X, surfaceLine.Geometry.Points[surfacePointIndex].Z),
+ new Point2D(surfaceLine.Geometry.Points[surfacePointIndex + 1].X, surfaceLine.Geometry.Points[surfacePointIndex + 1].Z));
GeometryPoint intersectDitchDikePhreatic = new GeometryPoint();
if (LineHelper.GetStrictIntersectionPoint(lineDitchDikeSide, phreaticPolderPartialLine, ref intersectDitchDikePhreatic))
@@ -1944,10 +1947,11 @@
private PLLinePoint DetermineIntersectionBetweenPolderLevelAndDike(double polderLevel)
{
- var polderlevelLine = new Deltares.Geometry.Line();
+ var polderlevelLine = new Line();
double startXCoordinate = this.surfaceLine.Geometry.Points.OrderBy(p => p.X).First().X;
GeometryPoint pointEndOfprofile = SurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.SurfaceLevelInside);
- polderlevelLine.SetBeginAndEndPoints(new GeometryPoint(startXCoordinate, 0, polderLevel), new GeometryPoint(pointEndOfprofile.X, 0, polderLevel));
+ polderlevelLine.SetBeginAndEndPoints(new Point2D(startXCoordinate, polderLevel),
+ new Point2D(pointEndOfprofile.X, polderLevel));
ThrowWhenWaterLevelAboveDike(polderLevel, SurfaceLine);
@@ -1957,8 +1961,9 @@
endPosition = SurfaceLine.Geometry.Points.IndexOf(SurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder));
for (int surfacePointIndex = startPosition; surfacePointIndex < endPosition; surfacePointIndex++)
{
- var surfaceLineSegment = new Deltares.Geometry.Line();
- surfaceLineSegment.SetBeginAndEndPoints(new GeometryPoint(SurfaceLine.Geometry.Points[surfacePointIndex].X, 0, SurfaceLine.Geometry.Points[surfacePointIndex].Z), new GeometryPoint(SurfaceLine.Geometry.Points[surfacePointIndex + 1].X, 0, SurfaceLine.Geometry.Points[surfacePointIndex + 1].Z));
+ var surfaceLineSegment = new Line();
+ surfaceLineSegment.SetBeginAndEndPoints(new Point2D(SurfaceLine.Geometry.Points[surfacePointIndex].X, SurfaceLine.Geometry.Points[surfacePointIndex].Z),
+ new Point2D(SurfaceLine.Geometry.Points[surfacePointIndex + 1].X, SurfaceLine.Geometry.Points[surfacePointIndex + 1].Z));
GeometryPoint intersectPoint = new GeometryPoint();
if (LineHelper.GetStrictIntersectionPoint(surfaceLineSegment, polderlevelLine, ref intersectPoint))
{
@@ -1989,15 +1994,22 @@
bool foundIntersect = false;
for (int phreaticPointIndex = 0; phreaticPointIndex < phreaticLine.Points.Count - 1; phreaticPointIndex++)
{
- var phreaticLineSegment = new Deltares.Geometry.Line();
- phreaticLineSegment.SetBeginAndEndPoints(phreaticLine.Points[phreaticPointIndex], phreaticLine.Points[phreaticPointIndex + 1]);
+ var phreaticLineSegment = new Line();
+ phreaticLineSegment.SetBeginAndEndPoints(
+ new Point2D(phreaticLine.Points[phreaticPointIndex].X, phreaticLine.Points[phreaticPointIndex].Z),
+ new Point2D(phreaticLine.Points[phreaticPointIndex + 1].X, phreaticLine.Points[phreaticPointIndex + 1].Z));
for (int surfacePointIndex = startIndex; surfacePointIndex < stopIndex; surfacePointIndex++)
{
- var surfaceLineSegment = new Deltares.Geometry.Line();
- surfaceLineSegment.SetBeginAndEndPoints(SurfaceLine.Geometry.Points[surfacePointIndex], SurfaceLine.Geometry.Points[surfacePointIndex + 1]);
- GeometryPoint intersectPoint = new GeometryPoint();
- if (LineHelper.GetStrictIntersectionPoint(phreaticLineSegment, surfaceLineSegment, ref intersectPoint))
+ var surfaceLineSegment = new Line();
+ surfaceLineSegment.SetBeginAndEndPoints(
+ new Point2D(SurfaceLine.Geometry.Points[surfacePointIndex].X, SurfaceLine.Geometry.Points[surfacePointIndex].Z),
+ new Point2D(SurfaceLine.Geometry.Points[surfacePointIndex + 1].X, SurfaceLine.Geometry.Points[surfacePointIndex + 1].Z));
+ var intersectGeoPoint = new GeometryPoint();
+ var intersectPoint = new Point2D();
+ if (LineHelper.GetStrictIntersectionPoint(phreaticLineSegment, surfaceLineSegment, ref intersectGeoPoint))
{
+ intersectPoint.X = intersectGeoPoint.X;
+ intersectPoint.Z = intersectGeoPoint.Z;
// Prevent any adding when intersectPoint is already on Pl
if (!intersectPoint.LocationEquals(phreaticLineSegment.BeginPoint) &&
!intersectPoint.LocationEquals(phreaticLineSegment.EndPoint))
@@ -2104,15 +2116,15 @@
{
CreatePhreaticLineSegmentsInsideDikeForHighRiverLevel(phreaticLine);
}
- CreatePhreaticLineSegmentsInShoulderAndPolder(phreaticLine);
+ //CreatePhreaticLineSegmentsInShoulderAndPolder(phreaticLine); ##Bka
//Check if phreatic line is above
ValidatePhreaticAboveWaterLevelPolder(phreaticLine);
//Check if phreatic line is below the surface line
ValidatePhreaticBelowDike(phreaticLine);
// currentPL1Line is needed when calculating uplift reduction for PL3 and Pl4
- AdaptPL1ForNonWaterRetainingObject(ref phreaticLine);
+ //AdaptPL1ForNonWaterRetainingObject(ref phreaticLine); ##Bka
currentPL1Line = phreaticLine;
return phreaticLine;
}
Index: dam engine/branches/Initial Source/Deltares.DamEngine.Calculators/General/Parallel.cs
===================================================================
diff -u
--- dam engine/branches/Initial Source/Deltares.DamEngine.Calculators/General/Parallel.cs (revision 0)
+++ dam engine/branches/Initial Source/Deltares.DamEngine.Calculators/General/Parallel.cs (revision 330)
@@ -0,0 +1,306 @@
+// 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;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Threading;
+using Deltares.DamEngine.Data.Standard.Calculation;
+//using Deltares.Standard.Logging;
+using ThreadState = System.Threading.ThreadState;
+
+namespace Deltares.DamEngine.Calculators.General
+{
+ ///
+ /// Utility to run tasks in parallel
+ ///
+ public class Parallel
+ {
+ private static Queue queue = new Queue();
+ private static TaskDelegate task = null;
+ private static ProgressDelegate progress = null;
+ private static int total = 0;
+ private static int executed = 0;
+ private static List threads = new List();
+ private static List processes = new List();
+ private static bool stopPressed = false;
+ private static bool errorOccured = false;
+ private static bool limitToAvailableProcessors = true;
+
+ ///
+ /// Runs a number of tasks in parallel. Returns when all tasks have been executed.
+ ///
+ /// The objects on which the task is to be performed
+ /// The task to be executed
+ public static void Run(IList list, TaskDelegate parallelTask)
+ {
+ Run(list, parallelTask, null, -1);
+ }
+
+ ///
+ /// Runs a number of tasks in parallel. Returns when all tasks have been executed.
+ ///
+ /// The objects on which the task is to be performed
+ /// The task to be executed
+ /// The maximum number of processes, will be equal to the number of cores if omitted
+ public static void Run(IList list, TaskDelegate parallelTask, int maxProcesses)
+ {
+ Run(list, parallelTask, null, maxProcesses);
+ }
+
+ ///
+ /// Runs a number of tasks in parallel. Returns when all tasks have been executed.
+ ///
+ /// The objects on which the task is to be performed
+ /// The task to be executed
+ /// Optional delegate indicating the progress of the tasks
+ public static void Run(IList list, TaskDelegate parallelTask, ProgressDelegate progress)
+ {
+ Run(list, parallelTask, progress, -1);
+ }
+
+ ///
+ /// Runs a number of tasks in parallel. Returns when all tasks have been executed.
+ ///
+ /// The objects on which the task is to be performed
+ /// The task to be executed
+ /// The maximum number of processes, will be equal to the number of cores if omitted
+ /// Optional delegate indicating the progress of the tasks
+ public static void Run(IList list, TaskDelegate parallelTask, ProgressDelegate progressDelegate, int maxProcesses)
+ {
+ if (list.Count == 0)
+ {
+ return;
+ }
+
+ stopPressed = false;
+ processes.Clear();
+
+ if (maxProcesses <= 0)
+ {
+ maxProcesses = Int32.MaxValue;
+ }
+
+ maxProcesses = Math.Min(list.Count, maxProcesses);
+
+ if (limitToAvailableProcessors)
+ {
+ maxProcesses = Math.Min(Environment.ProcessorCount, maxProcesses);
+ }
+
+ //DateTime start = DateTime.Now;
+
+ if (progressDelegate != null)
+ {
+ progressDelegate(0);
+ }
+
+ if (maxProcesses == 1)
+ {
+ total = list.Count;
+ RunSequential(list, parallelTask, progressDelegate);
+ }
+ else
+ {
+ try
+ {
+ queue.Clear();
+ task = parallelTask;
+ progress = progressDelegate;
+
+ foreach (var argument in list)
+ {
+ queue.Enqueue(argument);
+ }
+
+ total = queue.Count;
+ executed = 0;
+
+ threads.Clear();
+ for (int i = 0; i < maxProcesses; i++)
+ {
+ var thread = new Thread(RunTask);
+ threads.Add(thread);
+
+ thread.Start(Context.CurrentContext); // Pass the current context as task context
+ }
+
+ foreach (var thread in threads)
+ {
+ thread.Join();
+ }
+ }
+ catch (ThreadAbortException)
+ {
+ Abort();
+ }
+ }
+
+ if (errorOccured)
+ {
+ throw new Exception("Error occured in one of the parallel runs.");
+ }
+ //DateTime end = DateTime.Now;
+ //TimeSpan period = end - start;
+
+ //if (period.TotalMilliseconds > 0)
+ //{
+ // string msg = (maxProcesses == 1 ? "Duration of tasks: " : "Parallel duration: ");
+ // Console.WriteLine(msg + period.TotalMilliseconds + " ms");
+ //}
+ }
+
+ ///
+ /// Kills all running and queued tasks
+ ///
+ public static void Abort()
+ {
+ stopPressed = true;
+
+ foreach (var process in processes.ToArray())
+ {
+ if (!process.HasExited)
+ {
+ process.Kill();
+ }
+ }
+
+ foreach (var thread in threads)
+ {
+ switch (thread.ThreadState)
+ {
+ case ThreadState.Running:
+ try
+ {
+ thread.Abort();
+ }
+ catch (ThreadAbortException)
+ {
+ // ignore
+ }
+ break;
+ case ThreadState.WaitSleepJoin:
+ thread.Interrupt();
+ break;
+ }
+ }
+
+ threads.Clear();
+ processes.Clear();
+ }
+
+ ///
+ /// Registers a process which should be killed too when the method is called
+ ///
+ /// The process
+ public static void KillOnAbort(Process process)
+ {
+ processes.Add(process);
+ }
+
+ private static void RunSequential(IList list, TaskDelegate parallelTask, ProgressDelegate progressDelegate)
+ {
+ for (int i = 0; i < list.Count; i++)
+ {
+ parallelTask(list[i]);
+
+ if (progressDelegate != null)
+ {
+ progressDelegate(Convert.ToDouble(i + 1)/Convert.ToDouble(total));
+ }
+ }
+ }
+
+ private static void RunTask(object context)
+ {
+ object argument = null;
+
+ // Set the context of the task thread
+ Context.CurrentContext = context as IContext;
+
+ while (true)
+ {
+ lock (queue)
+ {
+ if (!stopPressed && queue.Count > 0)
+ {
+ argument = queue.Dequeue();
+ }
+ else
+ {
+ return;
+ }
+ }
+
+ try
+ {
+ if (!stopPressed)
+ {
+ task(argument);
+ }
+ }
+ catch (ThreadAbortException)
+ {
+ stopPressed = true;
+ }
+ catch (Exception e)
+ {
+ // most errors already reported to logfile
+ while (e != null) // Extra instrumentation to trace errors occurring during parallel executions
+ {
+// LogManager.Add(new LogMessage(LogMessageType.Trace, task, "Exception occurred in parallel run: " + e.Message + Environment.NewLine +
+// "Stacktrace: " + Environment.NewLine
+// + e.StackTrace)); ##BKA: replace with some other mechanism!?
+ e = e.InnerException;
+ }
+ errorOccured = true;
+ return;
+ }
+ finally
+ {
+ if (progress != null && !stopPressed)
+ {
+ lock (queue)
+ {
+ progress(Convert.ToDouble(++executed)/Convert.ToDouble(total));
+ }
+ }
+ }
+ }
+ }
+
+ ///
+ /// Indicates whether the number of parallel processes is limited to the number of available cores
+ ///
+ public static bool LimitToAvailableProcessors
+ {
+ get
+ {
+ return limitToAvailableProcessors;
+ }
+ set
+ {
+ limitToAvailableProcessors = value;
+ }
+ }
+ }
+}
\ No newline at end of file
Index: dam engine/branches/Initial Source/Deltares.DamEngine.Calculators/Interfaces/DGSDAMSlopeWInterface.cs
===================================================================
diff -u
--- dam engine/branches/Initial Source/Deltares.DamEngine.Calculators/Interfaces/DGSDAMSlopeWInterface.cs (revision 0)
+++ dam engine/branches/Initial Source/Deltares.DamEngine.Calculators/Interfaces/DGSDAMSlopeWInterface.cs (revision 330)
@@ -0,0 +1,70 @@
+// 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.Calculators.Interfaces
+{
+ public class DGSDAMSlopeWInterface : DgsStandardDllInterface
+ {
+ private const string DllFileName = @"DGSDAMSlopeW.dll";
+
+ [DllImport(DllFileName)]
+ static extern int DllGetVersion(out DllVersionInfoStructure dllVersionInfoStructure);
+ [DllImport(DllFileName)]
+ static extern string GetDescription();
+ [DllImport(DllFileName)]
+ static extern string GetErrorMessage();
+ [DllImport(DllFileName)]
+ static extern int CreateSlopeWProject(string inputXmlString);
+
+ ///
+ /// GetDllVersion
+ ///
+ /// version as string
+ new public string GetDllVersion()
+ {
+ DllVersionInfoStructure dllInfo;
+ var returnValue = DllGetVersion(out dllInfo);
+ return dllInfo.DwBuildNumber.ToString();
+ }
+
+ ///
+ /// CreateProjectFile
+ ///
+ /// Error number
+ public int CreateProjectFile(string inputXmlString)
+ {
+ return (CreateSlopeWProject(inputXmlString));
+ }
+
+ ///
+ /// ErrorMessage
+ ///
+ /// Error as string
+ new public string ErrorMessage()
+ {
+ return (GetErrorMessage());
+ }
+
+
+ }
+}
Index: dam engine/branches/Initial Source/Deltares.DamEngine.Calculators/Stability/MStabProject.cs
===================================================================
diff -u
--- dam engine/branches/Initial Source/Deltares.DamEngine.Calculators/Stability/MStabProject.cs (revision 0)
+++ dam engine/branches/Initial Source/Deltares.DamEngine.Calculators/Stability/MStabProject.cs (revision 330)
@@ -0,0 +1,448 @@
+// 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;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Net.Mime;
+using System.Xml.Serialization;
+using Deltares.DamEngine.Data.Geometry;
+using Deltares.DamEngine.Data.Geotechnics;
+using Deltares.DamEngine.Data.Standard;
+using Deltares.DamEngine.Data.Standard.Calculation;
+using Deltares.DamEngine.Data.Standard.Language;
+using Deltares.DamEngine.Data.Standard.Logging;
+using Deltares.DamEngine.Data.Standard.Validation;
+//using XmlSerializer = Deltares.Standard.IO.Xml.XmlSerializer;
+
+namespace Deltares.DamEngine.Calculators.Stability
+{
+ public class MStabProject : ICloneable, IDisposable
+ {
+ public MStabProject Clone()
+ {
+ throw new NotImplementedException();
+ }
+
+ public void Dispose()
+ {
+ throw new NotImplementedException();
+ }
+ }
+
+// public class MStabProject : Project, ICloneable, IDisposable
+// {
+// public bool IsApplicationCreated;
+// private List messages = new List();
+//
+// private string originalStiFileName;
+// private CalculationResult result = CalculationResult.NoRun;
+// private StabilityModel stabilityModel; //Object of DefinitionModel
+//
+// public Func GetGeometryImage;
+//
+// //public MStabProject(ICoordinateSystem coordinateSystem)
+// public MStabProject()
+// {
+// originalStiFileName = "";
+//
+// Stability = new StabilityModel();
+//
+// DataEventPublisher.OnAfterChange += DataEventPublisher_OnAfterChange;
+// }
+//
+//
+// [Label("GeometryPicture")]
+// [Description("GeometryPicture")]
+// public MediaTypeNames.Image GeometryPicture
+// {
+// get
+// {
+// return GetGeometryImage();
+// }
+// }
+//
+// [XmlCategory("Identification")]
+// public string OriginalStiFileName
+// {
+// get
+// {
+// return originalStiFileName;
+// }
+// set
+// {
+// originalStiFileName = value;
+// }
+// }
+//
+// ///
+// /// //Object of SoilModel
+// ///
+// [XmlCategory("Input")]
+// [XmlElement("Soils")]
+// [Validate]
+// public SoilModel SoilModel
+// {
+// get
+// {
+// return stabilityModel.SoilModel;
+// }
+// }
+//
+// ///
+// /// Object of GeometryData
+// ///
+// [XmlCategory("Input")]
+// public GeometryData Geometry
+// {
+// get
+// {
+// return stabilityModel != null && stabilityModel.SoilProfile != null ? stabilityModel.SoilProfile.Geometry : null;
+// }
+// }
+//
+// ///
+// /// Object of WaternetData
+// ///
+// [XmlCategory("Input")]
+// [XmlElement("WaternetData")]
+// public GeotechnicsModel Geotechnics
+// {
+// get
+// {
+// return stabilityModel.GeotechnicsData;
+// }
+// }
+//
+// ///
+// /// Object of DefinitionModel
+// ///
+// [XmlCategory("Input")]
+// [XmlElement("Definitions")]
+// [Validate]
+// public StabilityModel Stability
+// {
+// get
+// {
+// return stabilityModel;
+// }
+// set
+// {
+// if (stabilityModel != null && !ReferenceEquals(stabilityModel, value) &&
+// value != null) // Hack: StabilityCalculation sets this property to null so it can claim owner ship of StabilityModel
+// {
+// Stability.Dispose();
+// }
+// stabilityModel = value;
+//
+// Soil.SoilPropertyManager = stabilityModel;
+// }
+// }
+//
+// public void SetStabilityModel(StabilityModel newStabilityModel)
+// {
+// stabilityModel = newStabilityModel;
+//
+// Soil.SoilPropertyManager = stabilityModel;
+// }
+//
+// ///
+// /// Units manager object
+// ///
+// [XmlCategory("Input")]
+// public UnitsManager Units
+// {
+// get
+// {
+// return UnitsManager.Units;
+// }
+// }
+//
+// [XmlCategory("Output")]
+// public CalculationResult Result
+// {
+// get
+// {
+// return result;
+// }
+// set
+// {
+// if (result != value)
+// {
+// DataEventPublisher.BeforeChange(this, "Result");
+// result = value;
+// DataEventPublisher.AfterChange(this, "Result");
+// }
+// }
+// }
+//
+// [XmlCategory("Output")]
+// [Impact(Impact.Descriptive)]
+// [XmlIgnore]
+// public SlidingModel SlidingData
+// {
+// get
+// {
+// return stabilityModel != null ? stabilityModel.SlidingModel : null;
+// }
+// set
+// {
+// if (stabilityModel != null)
+// {
+// if (value != stabilityModel.SlidingModel)
+// {
+// DataEventPublisher.BeforeChange(this, "SlidingData");
+//
+// stabilityModel.SlidingModel = value;
+//
+// if (stabilityModel.SlidingModel == null)
+// {
+// Result = CalculationResult.NoRun;
+// }
+//
+// DataEventPublisher.AfterChange(this, "SlidingCurve"); // to force update in UI
+// DataEventPublisher.AfterChange(this, "SlidingData");
+// DataEventPublisher.AfterChange(this, "RestProfile");
+// DataEventPublisher.AfterChange(this, "SafeProfile");
+// }
+// }
+// }
+// }
+//
+// [XmlIgnore]
+// [Browsable(false)]
+// [Impact(Impact.None)]
+// public SlidingCurve SlidingCurve
+// {
+// get
+// {
+// return SlidingData != null ? MinimumSafetyCurve : null;
+// }
+// }
+//
+// [Impact(Impact.None)]
+// public RestProfile RestProfile
+// {
+// get
+// {
+// return SlidingData != null ? SlidingData.RestProfile : null;
+// }
+// }
+//
+// [Impact(Impact.None)]
+// public SafeProfile SafeProfile
+// {
+// get
+// {
+// return SlidingData != null ? SlidingData.SafeProfile : null;
+// }
+// }
+//
+// [XmlIgnore]
+// [ReadOnly(true)]
+// [Translation("Slices")]
+// public IList MinimumSafetySlices
+// {
+// get
+// {
+// if (SlidingData != null && SlidingData.CurrentZone != null && MinimumSafetyCurve != null)
+// {
+// return MinimumSafetyCurve.Slices;
+// }
+// else
+// {
+// return new List();
+// }
+// }
+// }
+//
+// [Validate]
+// public IGeometryModel GeometryDataModel
+// {
+// get
+// {
+// return Geometry;
+// }
+// }
+//
+// [Validate]
+// public IGeometryModel WaternetDataModel
+// {
+// get
+// {
+// return stabilityModel.GeotechnicsData;
+// }
+// }
+//
+// public List Messages
+// {
+// get
+// {
+// return messages;
+// }
+// }
+//
+// public List