Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/SoilGeometry2DName.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/SoilGeometry2DName.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/SoilGeometry2DName.cs (revision 3305) @@ -0,0 +1,34 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +namespace Deltares.Dam.Data +{ + public class SoilGeometry2DName + { + private string geometry2DName; + + public virtual string Geometry2DName + { + get { return geometry2DName; } + set { geometry2DName = value; } + } + } +} Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/CsvParserException.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/CsvParserException.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/CsvParserException.cs (revision 3305) @@ -0,0 +1,52 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU 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.Dam.Data +{ + + [Serializable] + public class CsvParserException : Exception + { + public CsvParserException() + { + } + + public CsvParserException(string message) + : base(message) + { + } + + public CsvParserException(string message, Exception inner) + : base(message, inner) + { + } + + protected CsvParserException( + SerializationInfo info, + StreamingContext context) + : base(info, context) + { + } + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/TimeSerieCollection.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/TimeSerieCollection.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/TimeSerieCollection.cs (revision 3305) @@ -0,0 +1,276 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Xml.Linq; +using System.IO; +using Deltares.Dam.Data.Assemblers; +using Deltares.Standard.Extensions; + +namespace Deltares.Dam.Data +{ + + public class TimeSerieCollection + { + /// + /// Initializes a new instance of the class. + /// + public TimeSerieCollection() + { + this.Series = new List(); + } + + /// + /// Gets or sets the series. + /// + /// + /// The series. + /// + public List Series { get; set; } + + /// + /// Gets or sets the version. + /// + /// + /// The version. + /// + public string Version { get; set; } + + /// + /// Gets or sets the time zone. + /// + /// + /// The time zone. + /// + public double TimeZone { get; set; } + + /// + /// Loads a time serie collection from file and validates the file with the resource embedded XSD + /// + /// The file info object containing the file to load + /// When valid a loaded time serie collection + /// + public static TimeSerieCollection LoadFromFile(FileInfo fileInfo) + { + return LoadFromFile(fileInfo.FullName, true); + } + + /// + /// Loads a time serie collection from file and validates the file with the resource embedded XSD + /// + /// The file to load + /// When valid a loaded time serie collection + /// + public static TimeSerieCollection LoadFromFile(string fileName) + { + return LoadFromFile(fileName, true); + } + + /// + /// Loads a time serie collection from file. + /// + /// The file name of the time serie + /// The value indicating if the file needs to be validated + /// The loaded time serie collection + public static TimeSerieCollection LoadFromFile(string fileName, bool validateWithEmbeddedXsd) + { + try + { + string message; + var assembler = new TimeSeriesAssembler(); + var doc = XDocument.Load(fileName); + if (validateWithEmbeddedXsd) + if (!assembler.ValidateSchema(doc, out message)) + throw new TimeSerieSchemaValidationException(message); + return assembler.CreateDomainObject(doc); + } + catch (Exception e) + { + throw new TimeSerieSchemaValidationException(fileName + ": " + e.Message); + } + } + + /// + /// Saves the time serie collection to a specified file using the time serie assembler + /// + /// The name of the file + public void Save(string fileName) + { + ThrowHelper.ThrowIfFileNameNullOrEmpty(fileName, StringResourceNames.FileNameNotValid); + + var timeSerieAssembler = new TimeSeriesAssembler(); + XDocument doc = timeSerieAssembler.CreateDataTransferDocument(this); + doc.Save(fileName); + FileWriterUtil.RemoveThreeBytesFromXml(fileName); // apply this fix for FEWS! + } + + /// + /// Updates the time serie entries with new values by applying the function to each value entry + /// + /// The parameter ID of the time serie to update + /// The function to apply to each entry + public void UpdateAllEntryValues(string parameterId, Func function) + { + foreach (var timeSerie in this.GetSeriesByParameterId(parameterId)) + { + foreach (var sourceEntry in timeSerie.Entries) + { + if (!sourceEntry.Value.AlmostEquals(timeSerie.MissVal)) + { + sourceEntry.Value = function(sourceEntry.Value); + } + } + } + } + + /// + /// Creates a shallow copy of the current time serie collection and applies the map function to each of its entries + /// + public IEnumerable Map(IEnumerable locations, string parameterId, IEnumerable> functionList) + { + return from locationId in locations + from timeSerie in this.GetSeriesByLocationId(locationId).Where(x => x.ParameterId.Equals(parameterId)) + from function in functionList + select function(timeSerie); + } + + /// + /// Creates a shallow copy of the current time serie collection and applies the map function to each of its entries + /// + /// The locations to look for in this collection + /// The parameter to look for in this collection + /// The function to apply + /// A sequence of new time series with the applied function to its entries + public IEnumerable Map(IEnumerable locations, string parameterId, Func function) + { + return Map(locations, parameterId, new List> { function }); + } + + /// + /// Creates a shallow copy of the current time serie collection and applies the map function to each of its entries + /// + public IEnumerable Map(string locationId, string parameterId, Func function) + { + return Map(new List { locationId }, parameterId, function); + } + + /// + /// Searches for a time series matching the location and parameter id. There should be only 1 or none (null) + /// + /// The parameter id. + /// The location id. + /// The time series matching the criterium + public TimeSerie FindSerie(string parameterId, string locationId) + { + return (from series in this.Series + where series.ParameterId.Equals(parameterId, StringComparison.InvariantCultureIgnoreCase) && + series.LocationId.Equals(locationId, StringComparison.InvariantCultureIgnoreCase) + select series).SingleOrDefault(); + } + + /// + /// Gets all the time series with the given parameter id. + /// + /// The parameter id. + /// The time series matching the criteria + public IEnumerable GetSeriesByParameterId(string parameterId) + { + return from series in this.Series + where series.ParameterId.Equals(parameterId, StringComparison.InvariantCultureIgnoreCase) + select series; + } + + /// + /// Gets all the series with the given location id. + /// + /// The location id. + /// The time series matching the criteria + public IEnumerable GetSeriesByLocationId(string locationId) + { + return from series in this.Series + where series.LocationId.Equals(locationId, StringComparison.InvariantCultureIgnoreCase) + select series; + } + + + /// + /// Gets the series containing location id and parameter id. + /// + /// The location id. + /// The parameter id. + /// The time series matching the criteria + public IEnumerable GetSeriesByLocationIdAndParameterId(string locationId, string parameterId) + { + return from series in this.Series + where series.LocationId.Equals(locationId, StringComparison.InvariantCultureIgnoreCase) && + series.ParameterId.Equals(parameterId, StringComparison.InvariantCultureIgnoreCase) + select series; + } + + /// + /// Gets all the series containing the combined gage and location id. (using the gage_id/location_id pattern) + /// + /// The combined gage and location id. + /// + public IEnumerable GetSeriesByGageIdAndLocationId(string combinedGageAndLocationId) + { + var resultSeries = new List(); + foreach (var serie in this.Series) + { + string gaugeLocationId = serie.LocationId.Split('/')[0]; + if (combinedGageAndLocationId.Equals(gaugeLocationId, StringComparison.InvariantCultureIgnoreCase)) + { + resultSeries.Add(serie); + } + } + return resultSeries; + } + + public TimeSerieCollection GetShallowCopy() + { + var copy = new TimeSerieCollection + { + Version = Version, + TimeZone = TimeZone + }; + + copy.Series.Clear(); + return copy; + } + + /// + /// Clears the time series. + /// + public void Clear() + { + Series.Clear(); + } + + public TimeSerie AddNewSeries(string locationId) + { + var series = TimeSerie.CreateTimeSerie(locationId); + this.Series.Add(series); + return series; + } + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/AttributeMissingException.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/AttributeMissingException.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/AttributeMissingException.cs (revision 3305) @@ -0,0 +1,43 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU 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.Maps +{ + [Serializable] + public class AttributeMissingException : Exception + { + private const string MessagePattern = + "Attribute {0} is missing or not supported. Check the mapping with the column in the ShapeFile"; + + public AttributeMissingException(string attributeName) : base(string.Format(MessagePattern, attributeName)) + { + } + + protected AttributeMissingException( + SerializationInfo info, + StreamingContext context) : base(info, context) + { + } + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/CalculationParameters.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/CalculationParameters.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/CalculationParameters.cs (revision 3305) @@ -0,0 +1,70 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU 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.IO; +using System.Xml.Linq; +using Deltares.Dam.Data.Assemblers; + +namespace Deltares.Dam.Data +{ + using System; + + public class CalculationModules + { + public bool StabilityInside { get; set; } + public bool StabilityOutside { get; set; } + public bool PipingWti { get; set; } + public bool PipingBligh { get; set; } + public bool PipingSellmeijer { get; set; } + } + + public class CalculationParameters + { + public string WorkingPath { get; set; } + public string StabilityWorkingPath { get; set; } + public string PipingWorkingPath { get; set; } + public string StabilityExePath { get; set; } + + public bool CalculateAllAtOnce + { + get { return MStabParameters == null || MStabParameters.IsCalculateAllStabilityProjectsAtOnce; } + set { MStabParameters.IsCalculateAllStabilityProjectsAtOnce = value; } + } + + public static CalculationParameters LoadFromFile(FileInfo xmlFile) + { + return LoadFromFile(xmlFile.FullName); + } + + public static CalculationParameters LoadFromFile(string xmlFileName) + { + if (string.IsNullOrWhiteSpace(xmlFileName)) throw new ArgumentException("xmlFileName"); + + XDocument calculationParametersFileDocument = XDocument.Load(xmlFileName); + var assembler = new CalculationParametersAssembler(); + assembler.FileName = xmlFileName; + return assembler.CreateDomainObject(calculationParametersFileDocument); + } + + public CalculationModules CalculationModules { get; set; } + public MStabParameters MStabParameters { get; set; } + } +} Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Specifications/GreaterThanOrEqualToSpecification.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Specifications/GreaterThanOrEqualToSpecification.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Specifications/GreaterThanOrEqualToSpecification.cs (revision 3305) @@ -0,0 +1,56 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU 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; + +namespace Deltares.Standard.Specifications +{ + /// + /// Defines a greater then of equal to specification + /// + /// The type of the candidate. + /// The type of the value. + public class GreaterThanOrEqualToSpecification : ValueBoundSpecification where TValue : IComparable + { + /// + /// Initializes a new instance of the class. + /// + /// Name of the attribute. + /// The attribute value. + public GreaterThanOrEqualToSpecification(string attributeName, TValue attributeValue) + : base(attributeName, attributeValue) + { + } + + /// + /// Determines whether the candidate satisfies the specification. + /// + /// The candidate to test. + /// + /// true if the candidate satisfies the specification otherwise, false. + /// + public override bool IsSatisfiedBy(TCandidate candidate) + { + var actual = this.GetCandidateTValue(candidate) as IComparable; + return (actual.CompareTo(this.AttributeValue) >= 0); + } + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DamHelperFunctions.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DamHelperFunctions.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DamHelperFunctions.cs (revision 3305) @@ -0,0 +1,110 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU 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.Globalization; +using System.IO; +using System.Reflection; +using System.Text.RegularExpressions; + +namespace Deltares.Dam.Data +{ + public class DamHelperFunctions + { + /// + /// Determine a filename based on the different inout parameters + /// + /// Name of the location. + /// Name of the scenario. + /// Name of the soil geometry. + /// Index of the iteration. + /// + public static string DetermineCalculationFilename(string locationName, string scenarioName, + string soilGeometryName, int iterationIndex) + { + string calculationName; + if (iterationIndex < 0) + { + calculationName = String.Format("Loc({0})_Sce({1})_Pro({2})", locationName, scenarioName, + soilGeometryName); + } + else + { + calculationName = String.Format("Loc({0})_Sce({1})_Pro({2})_Ite({3})", locationName, scenarioName, + soilGeometryName, iterationIndex); + } + return Regex.Replace(calculationName, @"[\\\/:\*\?""'<>|.]", "_"); + } + + /// + /// Convert Date to time stamp as needed by TNO AnySense. + /// + /// The date time. + /// + public static string DateToTimeStamp(DateTime dateTime) + { + // Following 2 lines is an example how to handle customization of this format. + // TNO at the last moment decided they did not need this change so we change it back to + // the default format + // string customFormat = "yyyy-MM-dd_HH-mm-ss"; + // return dateTime.ToString(customFormat); + return dateTime.ToString("s", DateTimeFormatInfo.InvariantInfo); + } + + /// + /// Determine name of Stability project file + /// + internal static string GetProjectFileName(string dikeName, Location location, int? jobCount, MStabModelType? model, string stabilityWorkingPath, DateTime? dateTime) + { + string calculationName = String.Format("Dik({0})_Loc({1})", dikeName, location.Name); + if (jobCount != null) + { + calculationName = calculationName + String.Format("_Stp({0})", jobCount); + } + if (model != null) + { + calculationName = calculationName + String.Format("_Mdl({0})", model); + } + if (dateTime != null) + { + calculationName = calculationName + "_" + DateToTimeStamp(dateTime.Value); + } + calculationName = Regex.Replace(calculationName, @"[\\\/:\*\?""'<>|.]", "_"); + // assemble the target project file name + return Path.Combine(stabilityWorkingPath, calculationName + ".sti"); + } + + /// + /// Gets the D-GeoStability executable path. + /// + /// + /// The m stab executable path. + /// + public static string MStabExePath + { + get + { + return Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), + @"DGeoStability.exe"); + } + } + } +} Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Xsd/SoilProfileDataSet.xss =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Xsd/SoilProfileDataSet.xss (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Xsd/SoilProfileDataSet.xss (revision 3305) @@ -0,0 +1,65 @@ + + + + + + + + + + + + + + + 254 + 283 + + + 280 + 283 + + + + + + + 554 + 275 + + + 507 + 275 + + + + + + + 659 + 347 + + + 659 + 420 + + + + + + + 685 + 596 + + + 685 + 559 + + + + + \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Gauge.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Gauge.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Gauge.cs (revision 3305) @@ -0,0 +1,40 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU 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; + +namespace Deltares.Dam.Data +{ + + public class Gauge + { + public virtual string Name { get; set; } + public virtual Location Location{ get; set; } + public virtual double LocalX { get; set; } + + public double? Value { get; set; } + + public override string ToString() + { + return String.Format("{0} @ Location {1} | Local X={2}", this.Name, this.Location != null ? this.Location.Name : "?", this.LocalX); + } + } +} Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/LocationResult.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/LocationResult.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/LocationResult.cs (revision 3305) @@ -0,0 +1,58 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using Deltares.Standard.Attributes; +using Deltares.Standard.EventPublisher; + +namespace Deltares.Dam.Data +{ + public class LocationResult + { + private TimeSerie stabilityTimeSerie = new TimeSerie(); + private TimeSerie pipingTimeSerie = new TimeSerie(); + + public LocationResult() + { + } + + public virtual TimeSerie StabilityTimeSerie + { + get { return stabilityTimeSerie; } + set + { + DataEventPublisher.BeforeChange(this, "StabilityTimeSerie"); + stabilityTimeSerie = value; + DataEventPublisher.AfterChange(this, "StabilityTimeSerie"); + } + } + + public TimeSerie PipingTimeSerie + { + get { return pipingTimeSerie; } + set + { + DataEventPublisher.BeforeChange(this, "PipingTimeSerie"); + pipingTimeSerie = value; + DataEventPublisher.AfterChange(this, "PipingTimeSerie"); + } + } + } +} Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Importers/LocationPropertyImporter.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Importers/LocationPropertyImporter.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Importers/LocationPropertyImporter.cs (revision 3305) @@ -0,0 +1,334 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU 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.Diagnostics; +using System.IO; +using System.Linq; +using Deltares.Dam.Data.CsvImporters; +using Deltares.Maps; +using Deltares.Standard; +using NetTopologySuite.Geometries; +using DataAttribute = Deltares.Dam.Data.DataPlugins.Configuration.DataAttribute; + +namespace Deltares.Dam.Data.Importers +{ + public class LocationPropertyImporterException : Exception + { + public LocationPropertyImporterException(string message) + : base(message) + { + } + } + + // ReSharper disable ClassWithVirtualMembersNeverInherited.Global + public class LocationPropertyImporter + // ReSharper restore ClassWithVirtualMembersNeverInherited.Global + { + private readonly IDictionary> filesToImportFrom; + private readonly PolygonAttributeImporter polygonAttributeImporter; + private readonly LineAttributeImporter lineAttributeImporter; + private List improperAttributeMessages = new List(); + private IEnumerable targets; + + public LocationPropertyImporter() + { + this.filesToImportFrom = new Dictionary>(); + + this.polygonAttributeImporter = new PolygonAttributeImporter + { + XGetter = (t) => t.GeoX.Value, + YGetter = (t) => t.GeoY.Value + }; + + this.lineAttributeImporter = new LineAttributeImporter(); + } + + public List ImproperAttributeMessages + { + get { return improperAttributeMessages; } + } + + public LocationPropertyImporter(string dataLocation, IEnumerable dataAttributes) : this() + { + this.DataFileLocation = dataLocation; + improperAttributeMessages.Clear(); + // Register configured property attributes + foreach (var dataAttribute in dataAttributes) + { + if (LocationShapeFileAttributeMap.IsPropertyAttribute(dataAttribute.AttributeId)) + RegisterAttributeMapping(dataAttribute.AttributeId, dataAttribute.AttributeName, dataAttribute.DataSource); + } + + if (improperAttributeMessages.Count > 0) + { + var message = Environment.NewLine + "The following attribute id's are supported:" + Environment.NewLine + + string.Join(", ", LocationShapeFileAttributeMap.AttributePropertyMap.Keys.OrderBy(k => k).ToArray()); + + message += Environment.NewLine + "Please change the id in the shape file or remove the shape for this attribute from the defx."; + improperAttributeMessages.Add(message); + } + // Should throw an exception when more then one crosssection is defined.. + RegisterCrossSectionAttribute(dataAttributes); + } + + public string DataFileLocation { private get; set; } + + public IEnumerable ImportErrors + { + get { return this.polygonAttributeImporter.Errors.Concat(this.lineAttributeImporter.Errors); } + } + + public IEnumerable Targets + { + set { this.targets = value; } + } + + private void RegisterCrossSectionAttribute(IEnumerable dataAttributes) + { + DataAttribute crossSectionConfig = dataAttributes.SingleOrDefault(a => a.AttributeId.Equals(LocationShapeFileAttributeMap.CrossSectionAttributId, StringComparison.InvariantCultureIgnoreCase)); + + LocationAttributeMapping mapping = crossSectionConfig != null ? + LocationShapeFileAttributeMap.GetAttributeMapping(crossSectionConfig) : + LocationShapeFileAttributeMap.GetAttributeMapping(LocationShapeFileAttributeMap.CrossSectionAttributId); + + RegisterCrossSectionAttribute(mapping.Name, mapping.File); + } + + /// + /// + /// + /// + /// + public void RegisterCrossSectionAttribute(string customAttributeName, string customFileName) + { + if (!IsValidString(customAttributeName)) + throw new ArgumentException("customAttributeName"); + + if (!IsValidString(customFileName)) + throw new ArgumentException("customFileName"); + + var file = GetFile(customFileName); + this.lineAttributeImporter.CrossSectionRepository = GetCrossSectionRepository(file); + this.lineAttributeImporter.LocationIDAttributeName = GetAttributeName(customAttributeName); + } + + // method is used for test purpose + // a cleaner class design should not have this method public + // todo: fix this + public virtual string GetAttributeName(string name) + { + return name; + } + + // method is used for test purpose + // a cleaner class design should not have this method public + // todo: fix this + public virtual IFeatureRepository GetCrossSectionRepository(ShapeFileLocation file) + { + return FeatureRepository.CreateFromShapeFile(file.FullPath); + } + + // for now this method is only used for test purposes + internal void RegisterAttributeMapping(string attributeId) + { + RegisterAttributeMapping(attributeId, null); + } + + /// + /// Registers a shape file attribute/column mapping to local id's. The attribute names are set to default names. + /// + /// Required argument. Use this argument to refer to a known attribute in the set of supported attributes (declared in this class). For example: TRAFLOAD. + /// The name of the Shape file that contains the data attribute + /// When the attribute id is unknown (not in the set declared here) this exception is thrown + /// When the attribute id is null or empty this exception is thrown + public void RegisterAttributeMapping(string attributeId, string dataFileName) + { + RegisterAttributeMapping(attributeId, null, dataFileName); + } + + /// + /// Registers a shape file attribute to local id's + /// + /// + /// The Shape file attributes/columns are in the Dbf file + /// + /// Required argument. Use this argument to refer to a known attribute in the set of supported attributes (declared in this class). For example: TRAFLOAD. + /// The name of the attribute in the Shape file to map to. For example TRAFLOAD can be mapped to the TrafficLoad column in the Shape file. If the name is null or Empty the default name will be used. For TRAFLOAD this will be TRAFLOAD. + /// The name of the Shape file that contains the data attribute + /// If the attribute id is unknown (not in the set declared here) this exception is thrown + /// If the attribute id is null or empty this exception is thrown + /// If the file is not found this exceptions will be thrown + public void RegisterAttributeMapping(string attributeId, string customAttributeName, string dataFileName) + { + if (!IsValidString(attributeId)) + throw new ArgumentException("attributeId"); + + if (!LocationShapeFileAttributeMap.IsAttributeIdSupported(attributeId)) + { + string message = string.Format("The attribute id '{0}' is not supported by this importer.", + attributeId); + improperAttributeMessages.Add(message); + } + else + { + LocationAttributeMapping mapping = LocationShapeFileAttributeMap.GetAttributeMapping(attributeId); + string attrName = string.IsNullOrEmpty(customAttributeName) || customAttributeName.Trim() == "" + ? mapping.Name // return the default shape file colum name + : customAttributeName; + + if (!IsValidString(dataFileName)) // not a valid file location? use the default file + dataFileName = mapping.File; + + Action action = mapping.Action; + + // Build a map to data (shape) files and attributes contained in the dbf file + // if a file is already added to the map a new attribute will be added + // to support the concept that multiple attributes can be contained in a single (shape) file + // ie. { somedatashapefile.shp, { TRAFFLOAD, PENLENGTH, .. } } + + ShapeFileLocation file = GetFile(dataFileName); + + string key = file.FullPath; + + if (!this.filesToImportFrom.ContainsKey(key)) + this.filesToImportFrom.Add(key, new List()); + + this.filesToImportFrom[key].Add(new LocationAttributeMapping + { + Action = action, + Name = attrName + }); + } + } + + // used for testing purposes... + public virtual ShapeFileLocation GetFile(string dataFileName) + { + var file = new ShapeFileLocation(this.DataFileLocation, dataFileName); + if (!file.Exists) + throw new FileNotFoundException(string.Format("The file '{0}' is not found", file.FullPath)); + return file; + } + + // used for testing purposes... + + // ReSharper disable MemberCanBeProtected.Global + public virtual IFeatureRepository CreateFromShapeFile(string fileName) + // ReSharper restore MemberCanBeProtected.Global + { + return FeatureRepository.CreateFromShapeFile(new ShapeFileLocation(fileName)); + } + + /// + /// Imports the specified progress. + /// + /// The progress. + /// No target locations set + /// + /// + /// The file " + fileName + " does not exist so can not be imported. + /// or + /// Had problems reading attribute values from file: " + fileName + /// + public void Import(DamEngine.Data.Standard.Calculation.ProgressDelegate progress) + { + if (this.targets == null) + throw new InvalidOperationException("No target locations set"); + + try + { + this.polygonAttributeImporter.Targets = this.targets; + this.lineAttributeImporter.Targets = this.targets; + } + catch (LineAttributeImporterException e) + { + throw new LocationPropertyImporterException(String.Format("Error finding locations in crossections, {0}", e.Message)); + } + +#if DEBUG + int targetCount = targets.Count(); + int crossSectionCount = lineAttributeImporter != null && lineAttributeImporter.CrossSectionRepository != null ? lineAttributeImporter.CrossSectionRepository.Count : 0; +#endif + // use the file / name attribute mapping table to retrieve the + // the actual value from the data (shape) file + var progressStep = 0.6*(1.0 /this.filesToImportFrom.Count); + var curProgress = 0.30; + + foreach (var file in this.filesToImportFrom) + { + string fileName = file.Key; + if (!File.Exists(fileName)) + { + throw new ImportException("The file " + fileName + " does not exist so can not be imported."); + } + +#if DEBUG + Debug.WriteLine(new string('=', 80)); + Debug.WriteLine(fileName); + var stopwatch = new Stopwatch(); + stopwatch.Start(); +#endif + + IFeatureRepository attributeRepository = CreateFromShapeFile(fileName); + var feature = attributeRepository.Features.FirstOrDefault(); + bool isPolygonTypeRepository = false; + if (feature != null) + { + isPolygonTypeRepository = feature.Geometry is Polygon || feature.Geometry is MultiPolygon; + IAttributeImporter importer = isPolygonTypeRepository ? + this.polygonAttributeImporter as IAttributeImporter : + this.lineAttributeImporter as IAttributeImporter; + importer.FileName = fileName; + importer.AttributeRepository = attributeRepository; + importer.AttributeMappings = file.Value.OfType>(); + + try + { + importer.Import(); + } + catch (AttributeMissingException attributeMissingException) + { + importer.AddError(attributeMissingException); + } + catch(Exception e) + { + throw new ImportException("Had problems reading attribute values from file: " + fileName, e); + } + } + curProgress += progressStep; + if (progress != null) progress(curProgress); +#if DEBUG + stopwatch.Stop(); + Debug.WriteLine(string.Format("Number of source features: {0}", isPolygonTypeRepository ? targetCount : crossSectionCount)); + Debug.WriteLine(string.Format("Number of target features: {0}", attributeRepository.Count)); + Debug.WriteLine(string.Format("Time elapsed: {0}s", stopwatch.Elapsed.TotalSeconds)); +#endif + } + } + + private static bool IsValidString(string value) + { + return !(string.IsNullOrEmpty(value) || value.Trim() == string.Empty); + } + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/Test/Domain/FeatureTest.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/Test/Domain/FeatureTest.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/Test/Domain/FeatureTest.cs (revision 3305) @@ -0,0 +1,105 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of the application DAM - UI. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU 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 NetTopologySuite.Geometries; + +using NUnit.Framework; + +namespace Deltares.Maps.Tests.Domain +{ + [TestFixture] + public class FeatureTest + { + private Feature feature; + + #region Setup + + [TestFixtureSetUp] + public void FixtureSetup() + { + } + + [TestFixtureTearDown] + public void FixtureTearDown() + { + } + + [SetUp] + public void TestSetup() + { + } + + [TearDown] + public void TestTearDown() + { + } + + #endregion + + [Test] + public void FeatureCreation_NormalScenario_CreatesFeatureInstance() + { + const string geometryWkt = "POINT (0.1 0.2)"; + feature = Feature.Create(geometryWkt); + Assert.IsNotNull(feature); + Assert.AreEqual(geometryWkt, feature.WktFormat); + + feature = Feature.Create(geometryWkt); + Assert.IsNotNull(feature); + Assert.AreEqual(geometryWkt, feature.WktFormat); + Assert.IsInstanceOf(typeof(Point), feature.Geometry); + } + + [Test] + //[ExpectedException(typeof(ArgumentException), ExpectedMessage = "There was an error parsing the WKT geometry string, maybe due to an incorrect culture format conversion")] + // NB This test fails when you change the decimal separator to a point in Dutch regional settings on your computer + [ExpectedException(typeof(ArgumentException))] + public void FeatueCreation_DutchCultureWktStringFormat_Throws() + { + Action test = + () => + { + string geometryWkt = string.Format("MULTIPOINT ({0} {1},{2} {3})", 0.1, 0.2, 0.3, 0.4); + feature = Feature.Create(geometryWkt); + }; + + CultureHelper.InvokeWithDutchCulture(test); + } + + [Test] + public void FeatureCreation_DutchCulture_FeatureIsCreatedWithoutExceptions() + { + Action test = + () => + { + const string geometryWkt = "MULTIPOINT (0.0 0.1,0.2 0.3)"; + feature = Feature.Create(geometryWkt); + Assert.IsNotNull(feature); + Assert.AreEqual(geometryWkt, feature.WktFormat); + Assert.IsInstanceOf(typeof(MultiPoint), feature.Geometry); + }; + + CultureHelper.InvokeWithDutchCulture(test); + } + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/JobResultInterpreter.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/JobResultInterpreter.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/JobResultInterpreter.cs (revision 3305) @@ -0,0 +1,86 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU 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.Drawing; + +namespace Deltares.Dam.Data +{ + public class JobResultInterpreter + { + public static JobResult GetJobResult(double result, double demand, bool smaller) + { + if (result >= DamGlobalConstants.NoRunValue) + { + return JobResult.NoRun; + } + else if (result < 0 || double.IsNaN(result)) + { + return JobResult.Failed; + } + else if (smaller) + { + if (result < demand) + { + return JobResult.Bad; + } + else + { + return JobResult.Good; + } + } + else + { + if (result > demand) + { + return JobResult.Bad; + } + else + { + return JobResult.Good; + } + } + } + + public static Color GetJobResultColor(double result, double demand, bool smaller) + { + switch (GetJobResult(result, demand, smaller)) + { + case JobResult.NoRun: return Color.Gray; + case JobResult.Failed: return Color.White; + case JobResult.Good: return Color.Lime; + case JobResult.Bad: return Color.Red; + default: return Color.Pink; + } + } + + public static Color GetJobResultColor(JobResult jobResult) + { + switch (jobResult) + { + case JobResult.NoRun: return Color.Gray; + case JobResult.Failed: return Color.White; + case JobResult.Good: return Color.Lime; + case JobResult.Bad: return Color.Red; + default: return Color.Pink; + } + } + } +} Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DtoAssembler/Assemblers/FileIdentificationAssembler.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DtoAssembler/Assemblers/FileIdentificationAssembler.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DtoAssembler/Assemblers/FileIdentificationAssembler.cs (revision 3305) @@ -0,0 +1,130 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU 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.Xml.Linq; +using Deltares.Standard.IO.DtoAssembler; + +namespace Deltares.Standard +{ + public class FileIdentificationAssembler : IDtoAssembler + { + private const string elementName = "FileIdentification"; + private const string elementNamespace = "http://deltares.nl/2008/FileIdentificationDefinition"; + + private readonly DtoPropertyAttributeMap map = new DtoPropertyAttributeMap(); + + public FileIdentificationAssembler() + { + const string attApplication = "Application"; + this.map.Add(attApplication, new DtoPropertyAttriubteMapping() + { + PropertyName = attApplication, + AttributeName = attApplication, + Importance = DtoPropertyImportance.Required + }); + + const string attVersion = "Version"; + this.map.Add(attVersion, new DtoPropertyAttriubteMapping() + { + PropertyName = attVersion, + AttributeName = attVersion, + Importance = DtoPropertyImportance.Required + }); + + const string attCreated = "Created"; + this.map.Add(attCreated, new DtoPropertyAttriubteMapping() + { + PropertyName = attCreated, + AttributeName = attCreated, + Importance = DtoPropertyImportance.Required + }); + + const string attCompany = "Company"; + this.map.Add(attCompany, new DtoPropertyAttriubteMapping() + { + PropertyName = attCompany, + AttributeName = attCompany, + Importance = DtoPropertyImportance.Required + }); + + const string attLicense = "License"; + this.map.Add(attLicense, new DtoPropertyAttriubteMapping() + { + PropertyName = attLicense, + AttributeName = attLicense, + Importance = DtoPropertyImportance.Optional + }); + + const string attDescription = "Description"; + this.map.Add(attDescription, new DtoPropertyAttriubteMapping() + { + PropertyName = attDescription, + AttributeName = attDescription, + Importance = DtoPropertyImportance.Optional + }); + } + + /// + /// Gets or sets the namespace value for the element + /// + public string ElementNamespace + { + get { return elementNamespace; } + } + + #region IDtoAssembler Members + + /// + /// Gets the xml element name + /// + public string ElementName + { + get { return elementName; } + } + + /// + /// Assembles a FieldIdentification object from an Dto (XElement) + /// + /// The data transfer object + /// The materialized domain object + public FileIdentification CreateDomainObject(XElement dtoObj) + { + return new FileIdentification() + .Materialize(dtoObj); + } + + public XElement CreateDataTransferObject(FileIdentification domainObj) + { + XElement el = new XElement(elementName) + .Materialize(domainObj, this.map); + + return el; + } + + #endregion + + public XElement CreateDataTransferObject(FileIdentification domainObj, XNamespace elementNamespace) + { + return new XElement(elementNamespace + elementName) + .Materialize(domainObj, this.map); + } + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Specifications/ParameterizedSpecification.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Specifications/ParameterizedSpecification.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Specifications/ParameterizedSpecification.cs (revision 3305) @@ -0,0 +1,33 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +namespace Deltares.Standard.Specifications +{ + public abstract class ParameterSpecification : SpecificationBase + { + protected readonly TParameter ParameterValue; + + protected ParameterSpecification(TParameter parameterValue) + { + this.ParameterValue = parameterValue; + } + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/app.config =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/app.config (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/app.config (revision 3305) @@ -0,0 +1,125 @@ + + + + + +
+ + + + + + segments + + + locations + + + soilprofiles + + + surfacelines + + + characteristicpoints + + + csv + + + Soilbase\soilbase.mdb + + + modelparameters + + + 0.66 + + + pl1lines + + + gauges + + + .\DGeoStability.exe + + + .\GeoStudio.exe + + + Automatic + + + 36 + + + 2 + + + 14 + + + 2 + + + 3 + + + 2 + + + 6 + + + 2 + + + 10 + + + 2.5 + + + 10 + + + 2.5 + + + OnBoundaryLines + + + 0.25 + + + OnBoundaryLines + + + 0.25 + + + + + Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DamEngineIo/ConversionHelper.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DamEngineIo/ConversionHelper.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DamEngineIo/ConversionHelper.cs (revision 3305) @@ -0,0 +1,1375 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System.Collections.Generic; +using System.Configuration; +using Deltares.DamEngine.Io.XmlInput; +using Deltares.DamEngine.Io.XmlOutput; +using Deltares.Geotechnics; +using Deltares.Geotechnics.Soils; +using Deltares.Standard; +using Deltares.Standard.Extensions; +using Deltares.Standard.Logging; +using CharacteristicPointType = Deltares.Geotechnics.SurfaceLines.CharacteristicPointType; + +namespace Deltares.Dam.Data.DamEngineIo +{ + /// + /// Converts types from Dam Engine class to Input serializer class and vice versa + /// + public static class ConversionHelper + { + /// + /// Converts the type DamProjectType from input object type to Dam Engine type. + /// + /// Type of the input object. + /// Dam Engine type + public static DamProjectType ConvertToDamProjectType(InputDamProjectType inputDamProjectType) + { + var translationTable = new Dictionary() + { + {InputDamProjectType.Design, DamProjectType.Design}, + {InputDamProjectType.Operational, DamProjectType.Calamity} + }; + return translationTable[inputDamProjectType]; + } + + /// + /// Converts the type DamProjectType from Dam Engine type to input object type. + /// + /// Type of the dam project. + /// Type of the input object. + public static InputDamProjectType ConvertToInputDamProjectType(DamProjectType damProjectType) + { + if (damProjectType == DamProjectType.DamLiveConfiguration) + damProjectType = DamProjectType.Calamity; + var translationTable = new Dictionary() + { + {DamProjectType.Design, InputDamProjectType.Design}, + {DamProjectType.Calamity, InputDamProjectType.Operational}, + }; + return translationTable[damProjectType]; + } + + /// + /// Converts the type PLLineCreationMethod from Dam Engine type to input object type. + /// + /// Type of the dam project. + /// + /// Type of the input object. + /// + public static LocationWaternetOptionsPhreaticLineCreationMethod ConvertToInputPhreaticLineCreationMethod(PLLineCreationMethod plLineCreationMethod) + { + var translationTable = new Dictionary() + { + {PLLineCreationMethod.ExpertKnowledgeLinearInDike, LocationWaternetOptionsPhreaticLineCreationMethod.ExpertKnowledgeLinearInDike}, + {PLLineCreationMethod.ExpertKnowledgeRRD, LocationWaternetOptionsPhreaticLineCreationMethod.ExpertKnowledgeRRD}, + {PLLineCreationMethod.GaugesWithFallbackToExpertKnowledgeRRD, LocationWaternetOptionsPhreaticLineCreationMethod.GaugesWithFallbackToExpertKnowledgeRRD}, + {PLLineCreationMethod.Sensors, LocationWaternetOptionsPhreaticLineCreationMethod.Sensors}, + {PLLineCreationMethod.None, LocationWaternetOptionsPhreaticLineCreationMethod.None} + }; + return translationTable[plLineCreationMethod]; + } + + /// + /// Converts the type PLLineCreationMethod from input object type to Dam Engine type. + /// + /// Type of the input object. + /// + /// Type of the dam object. + /// + public static PLLineCreationMethod ConvertToPhreaticLineCreationMethod(LocationWaternetOptionsPhreaticLineCreationMethod inputPhreaticLineCreationMethod) + { + var translationTable = new Dictionary() + { + {LocationWaternetOptionsPhreaticLineCreationMethod.ExpertKnowledgeLinearInDike,PLLineCreationMethod.ExpertKnowledgeLinearInDike}, + {LocationWaternetOptionsPhreaticLineCreationMethod.ExpertKnowledgeRRD, PLLineCreationMethod.ExpertKnowledgeRRD}, + {LocationWaternetOptionsPhreaticLineCreationMethod.GaugesWithFallbackToExpertKnowledgeRRD, PLLineCreationMethod.GaugesWithFallbackToExpertKnowledgeRRD}, + {LocationWaternetOptionsPhreaticLineCreationMethod.Sensors, PLLineCreationMethod.Sensors}, + {LocationWaternetOptionsPhreaticLineCreationMethod.None, PLLineCreationMethod.None} + }; + return translationTable[inputPhreaticLineCreationMethod]; + } + + /// + /// Converts the type IntrusionVerticalWaterPressureType from Dam Engine type to input object type. + /// + /// Type of the dam project. + /// + /// Type of the input object. + /// + public static LocationWaternetOptionsIntrusionVerticalWaterPressure ConvertToInputIntrusionVerticalWaterPressure(IntrusionVerticalWaterPressureType intrusionVerticalWaterPressureType) + { + var translationTable = new Dictionary() + { + {IntrusionVerticalWaterPressureType.FullHydroStatic, LocationWaternetOptionsIntrusionVerticalWaterPressure.FullHydroStatic}, + {IntrusionVerticalWaterPressureType.HydroStatic, LocationWaternetOptionsIntrusionVerticalWaterPressure.HydroStatic}, + {IntrusionVerticalWaterPressureType.Linear, LocationWaternetOptionsIntrusionVerticalWaterPressure.Linear}, + {IntrusionVerticalWaterPressureType.SemiTimeDependent, LocationWaternetOptionsIntrusionVerticalWaterPressure.SemiTimeDependent}, + {IntrusionVerticalWaterPressureType.Standard, LocationWaternetOptionsIntrusionVerticalWaterPressure.Standard} + }; + return translationTable[intrusionVerticalWaterPressureType]; + } + + /// + /// Converts the type IntrusionVerticalWaterPressureType from input object type to Dam Engine type. + /// + /// Type of the input object. + /// + /// Type of the dam object. + /// + public static IntrusionVerticalWaterPressureType ConvertToIntrusionVerticalWaterPressure(LocationWaternetOptionsIntrusionVerticalWaterPressure inputIntrusionVerticalWaterPressure) + { + var translationTable = new Dictionary() + { + {LocationWaternetOptionsIntrusionVerticalWaterPressure.FullHydroStatic, IntrusionVerticalWaterPressureType.FullHydroStatic}, + {LocationWaternetOptionsIntrusionVerticalWaterPressure.HydroStatic, IntrusionVerticalWaterPressureType.HydroStatic}, + {LocationWaternetOptionsIntrusionVerticalWaterPressure.Linear, IntrusionVerticalWaterPressureType.Linear}, + {LocationWaternetOptionsIntrusionVerticalWaterPressure.SemiTimeDependent, IntrusionVerticalWaterPressureType.SemiTimeDependent}, + {LocationWaternetOptionsIntrusionVerticalWaterPressure.Standard, IntrusionVerticalWaterPressureType.Standard} + }; + return translationTable[inputIntrusionVerticalWaterPressure]; + } + + public const int CpNone = 0;// + public const int CpSurfaceLevelOutside = 1; // Maaiveld buitenwaarts + public const int CpDikeToeAtRiver = 5; // Teen dijk buitenwaarts + public const int CpShoulderTopOutside = 6; // Kruin buitenberm + public const int CpShoulderBaseOutside = 7; // Insteek buitenberm + public const int CpDikeTopAtRiver = 8; // Kruin buitentalud + public const int CpDikeLine = 9; // referentielijn + public const int CpTrafficLoadOutside = 10; // Verkeersbelasting kant buitenwaarts + public const int CpTrafficLoadInside = 11; // Verkeersbelasting kant binnenwaarts + public const int CpDikeTopAtPolder = 12; // Kruin binnentalud + public const int CpShoulderBaseInside = 13; // Insteek binnenberm + public const int CpShoulderTopInside = 14; // Kruin binnenberm + public const int CpDikeToeAtPolder = 15; // Teen dijk binnenwaarts + public const int CpDitchDikeSide = 16; // Insteek sloot dijkzijde + public const int CpBottomDitchDikeSide = 17; // Slootbodem dijkzijde + public const int CpBottomDitchPolderSide = 18; // Slootbodem polderzijde + public const int CpDitchPolderSide = 19; // Insteek sloot polderzijde + public const int CpSurfaceLevelInside = 25; // Maaiveld binnenwaarts + + /// + /// Converts the type of to dam point. + /// + /// Type of the input point. + /// + public static CharacteristicPointType ConvertToDamPointType(int inputPointType) + { + var translationTable = new Dictionary() + { + {CpNone, CharacteristicPointType.None}, + {CpSurfaceLevelOutside, CharacteristicPointType.SurfaceLevelOutside}, + {CpDikeToeAtRiver, CharacteristicPointType.DikeToeAtRiver}, + {CpShoulderTopOutside, CharacteristicPointType.ShoulderTopOutside}, + {CpShoulderBaseOutside, CharacteristicPointType.ShoulderBaseOutside}, + {CpDikeTopAtRiver, CharacteristicPointType.DikeTopAtRiver}, + {CpDikeLine, CharacteristicPointType.DikeLine}, + {CpTrafficLoadOutside, CharacteristicPointType.TrafficLoadOutside}, + {CpTrafficLoadInside, CharacteristicPointType.TrafficLoadInside}, + {CpDikeTopAtPolder, CharacteristicPointType.DikeTopAtPolder}, + {CpShoulderBaseInside, CharacteristicPointType.ShoulderBaseInside}, + {CpShoulderTopInside, CharacteristicPointType.ShoulderTopInside}, + {CpDikeToeAtPolder, CharacteristicPointType.DikeToeAtPolder}, + {CpDitchDikeSide, CharacteristicPointType.DitchDikeSide}, + {CpBottomDitchDikeSide, CharacteristicPointType.BottomDitchDikeSide}, + {CpBottomDitchPolderSide, CharacteristicPointType.BottomDitchPolderSide}, + {CpDitchPolderSide, CharacteristicPointType.DitchPolderSide}, + {CpSurfaceLevelInside, CharacteristicPointType.SurfaceLevelInside} + }; + return translationTable[inputPointType]; + } + + /// + /// Converts the type of to input point. + /// + /// Type of the characteristic point. + /// + public static int ConvertToInputPointType(CharacteristicPointType characteristicPointType) + { + var translationTable = new Dictionary() + { + // The following types do not have a meaning in DAM, so should be mapped to CpNone + {CharacteristicPointType.BottomRiverChannel, CpNone}, + {CharacteristicPointType.InsertRiverChannel, CpNone}, + {CharacteristicPointType.ForelandStart, CpNone}, + {CharacteristicPointType.DunesBoundaryProfile, CpNone}, + {CharacteristicPointType.DunesTransectLocation, CpNone}, + // The following types are DAM related, so should be translated + {CharacteristicPointType.None, CpNone}, + {CharacteristicPointType.SurfaceLevelOutside, CpSurfaceLevelOutside}, + {CharacteristicPointType.DikeToeAtRiver, CpDikeToeAtRiver}, + {CharacteristicPointType.ShoulderTopOutside, CpShoulderTopOutside}, + {CharacteristicPointType.ShoulderBaseOutside, CpShoulderBaseOutside}, + {CharacteristicPointType.DikeTopAtRiver, CpDikeTopAtRiver}, + {CharacteristicPointType.DikeLine, CpDikeLine}, + {CharacteristicPointType.TrafficLoadOutside, CpTrafficLoadOutside}, + {CharacteristicPointType.TrafficLoadInside, CpTrafficLoadInside}, + {CharacteristicPointType.DikeTopAtPolder, CpDikeTopAtPolder}, + {CharacteristicPointType.ShoulderBaseInside, CpShoulderBaseInside}, + {CharacteristicPointType.ShoulderTopInside, CpShoulderTopInside}, + {CharacteristicPointType.DikeToeAtPolder, CpDikeToeAtPolder}, + {CharacteristicPointType.DitchDikeSide, CpDitchDikeSide}, + {CharacteristicPointType.BottomDitchDikeSide, CpBottomDitchDikeSide}, + {CharacteristicPointType.BottomDitchPolderSide, CpBottomDitchPolderSide}, + {CharacteristicPointType.DitchPolderSide, CpDitchPolderSide}, + {CharacteristicPointType.SurfaceLevelInside, CpSurfaceLevelInside} + }; + return translationTable[characteristicPointType]; + } + + /// + /// Converts to calculation result. + /// + /// The calculation result. + /// + public static CalculationResult ConvertToCalculationResult(int calculationResult) + { + var translationTable = new Dictionary() + { + {0, CalculationResult.NoRun}, + {1, CalculationResult.Succeeded}, + {2, CalculationResult.NoInput}, + {3, CalculationResult.NoLicense}, + {4, CalculationResult.UserAbort}, + {5, CalculationResult.InvalidInputStructure}, + {6, CalculationResult.InvalidInputData}, + {7, CalculationResult.RunFailed}, + {8, CalculationResult.UnexpectedError} + }; + return translationTable[calculationResult]; + } + + /// + /// Converts to output calculation result. + /// + /// Type of the dam project. + /// + public static int ConvertToOutputCalculationResult(CalculationResult calculationResult) + { + var translationTable = new Dictionary() + { + {CalculationResult.NoRun, 0}, + {CalculationResult.Succeeded, 1}, + {CalculationResult.NoInput, 2}, + {CalculationResult.NoLicense, 3}, + {CalculationResult.UserAbort, 4}, + {CalculationResult.InvalidInputStructure, 5}, + {CalculationResult.InvalidInputData, 6}, + {CalculationResult.RunFailed, 7}, + {CalculationResult.UnexpectedError, 8} + }; + return translationTable[calculationResult]; + } + + /// + /// Converts to waterpressure interpolation model. + /// + /// The input waterpressure interpolation model. + /// + public static WaterpressureInterpolationModel ConvertToWaterpressureInterpolationModel(int inputWaterpressureInterpolationModel) + { + var translationTable = new Dictionary() + { + {0, WaterpressureInterpolationModel.Automatic}, + {1, WaterpressureInterpolationModel.Hydrostatic} + }; + return translationTable[inputWaterpressureInterpolationModel]; + } + + /// + /// Converts to input waterpressure interpolation model. + /// + /// The waterpressure interpolation model. + /// + public static int ConvertToInputWaterpressureInterpolationModel(WaterpressureInterpolationModel waterpressureInterpolationModel) + { + var translationTable = new Dictionary() + { + {WaterpressureInterpolationModel.Automatic, 0}, + {WaterpressureInterpolationModel.Hydrostatic, 1} + }; + return translationTable[waterpressureInterpolationModel]; + } + + /// + /// Converts the Dam profile type to the input profile type + /// + /// Type of the soil geometry. + /// + public static int ConvertToInputSoilProfileType(SoilProfileType soilProfileType) + { + var translationTable = new Dictionary() + { + {SoilProfileType.SoilProfile1D, 0}, + {SoilProfileType.SoilProfile2D, 1}, + {SoilProfileType.SoilGeometryStiFile, 2} + }; + return translationTable[soilProfileType]; + } + + /// + /// Converts the input profile type to the Dam profile type + /// + /// Type of the soil geometry. + /// + public static SoilProfileType ConvertToSoilProfileType(int soilProfileType) + { + var translationTable = new Dictionary() + { + {0, SoilProfileType.SoilProfile1D}, + {1, SoilProfileType.SoilProfile2D}, + {2, SoilProfileType.SoilGeometryStiFile} + }; + return translationTable[soilProfileType]; + } + + /// The enumerated constants for input failure mechanism stability inside + public const int InputFailureMechanismStabilityInside = 0; + public const int InputFailureMechanismStabilityOutside = 1; + public const int InputFailureMechanismPiping = 2; + public const int InputFailureMechanismHorizontalBalance = 3; + public const int InputFailureMechanismFlowSlide = 4; + + /// + /// Converts the Dam failure mechanism type to the input failure mechanism type . + /// + /// Type of the segment failure mechanism. + /// + public static int ConvertToInputFailureMechanismSystemType(FailureMechanismSystemType segmentFailureMechanismType) + { + var translationTable = new Dictionary() + { + {FailureMechanismSystemType.StabilityInside, InputFailureMechanismStabilityInside}, + {FailureMechanismSystemType.StabilityOutside, InputFailureMechanismStabilityOutside}, + {FailureMechanismSystemType.Piping, InputFailureMechanismPiping}, + {FailureMechanismSystemType.HorizontalBalance, InputFailureMechanismHorizontalBalance}, + {FailureMechanismSystemType.FlowSlide, InputFailureMechanismFlowSlide} + }; + return translationTable[segmentFailureMechanismType]; + } + + /// + /// Converts the input failure mechanism type to the Dam failure mechanism type . + /// + /// Type of the failure mechanism system. + /// + public static FailureMechanismSystemType ConvertToFailureMechanismSystemType(int failureMechanismSystemType) + { + var translationTable = new Dictionary() + { + {InputFailureMechanismStabilityInside, FailureMechanismSystemType.StabilityInside}, + {InputFailureMechanismStabilityOutside, FailureMechanismSystemType.StabilityOutside}, + {InputFailureMechanismPiping, FailureMechanismSystemType.Piping}, + {InputFailureMechanismHorizontalBalance, FailureMechanismSystemType.HorizontalBalance}, + {InputFailureMechanismFlowSlide, FailureMechanismSystemType.FlowSlide}, + }; + return translationTable[failureMechanismSystemType]; + } + + /// The enumerated constants for input segment failure mechanism stability inside + public const int InputSegmentFailureMechanismAll = 0; + public const int InputSegmentFailureMechanismStability = 1; + public const int InputSegmentFailureMechanismPiping = 2; + public const int InputSegmentFailureMechanismLiquefaction = 3; + + /// + /// Converts the Dam segment failure mechanism type to the input segment failure mechanism type . + /// + /// Type of the segment failure mechanism. + /// + public static int ConvertToInputSegmentFailureMechanismType(FailureMechanismSystemType segmentFailureMechanismType) + { + var translationTable = new Dictionary() + { + {FailureMechanismSystemType.StabilityInside, InputSegmentFailureMechanismStability}, + {FailureMechanismSystemType.StabilityOutside, InputSegmentFailureMechanismStability}, + {FailureMechanismSystemType.Piping, InputSegmentFailureMechanismPiping}, + {FailureMechanismSystemType.FlowSlide, InputSegmentFailureMechanismLiquefaction}, + {FailureMechanismSystemType.HorizontalBalance, InputSegmentFailureMechanismStability} + }; + return translationTable[segmentFailureMechanismType]; + } + + /// + /// Converts the input segment failure mechanism type to the Dam segment failure mechanism type . + /// + /// Type of the failure mechanism system. + /// + public static FailureMechanismSystemType ConvertToSegmentFailureMechanismType(int failureMechanismSystemType) + { + if (failureMechanismSystemType == InputSegmentFailureMechanismAll) + { + throw new ConversionException(typeof(FailureMechanismSystemType), failureMechanismSystemType); + } + var translationTable = new Dictionary() + { + {InputSegmentFailureMechanismStability, FailureMechanismSystemType.StabilityInside}, + {InputSegmentFailureMechanismPiping, FailureMechanismSystemType.Piping}, + {InputSegmentFailureMechanismLiquefaction, FailureMechanismSystemType.FlowSlide}, + }; + return translationTable[failureMechanismSystemType]; + } + + /// + /// Converts the Dam piping model to the input piping model. + /// + /// Type of the piping model. + /// + public static InputPipingModelType ConvertToInputPipingModelType(PipingModelType pipingModelType) + { + var translationTable = new Dictionary() + { + {PipingModelType.Bligh, InputPipingModelType.Bligh}, + {PipingModelType.Sellmeijer, InputPipingModelType.SellmeijerVnk}, + {PipingModelType.Sellmeijer4Forces, InputPipingModelType.Sellmeijer4Forces}, + {PipingModelType.Wti2017, InputPipingModelType.WtiSellmeijerRevised} + }; + return translationTable[pipingModelType]; + } + + /// + /// Converts the input piping model to the Dam piping model. + /// + /// Type of the input piping model. + /// + public static PipingModelType ConvertToPipingModelType(InputPipingModelType inputPipingModelType) + { + var translationTable = new Dictionary() + { + {InputPipingModelType.Bligh, PipingModelType.Bligh}, + {InputPipingModelType.SellmeijerVnk, PipingModelType.Sellmeijer}, + {InputPipingModelType.Sellmeijer4Forces, PipingModelType.Sellmeijer4Forces}, + {InputPipingModelType.WtiSellmeijerRevised, PipingModelType.Wti2017} + }; + return translationTable[inputPipingModelType]; + } + + /// + /// Converts the Dam stability model to the input stability model. + /// + /// Type of the stability model. + /// + public static InputStabilityModelType ConvertToInputStabilityModelType(MStabModelType stabilityModelType) + { + var translationTable = new Dictionary() + { + {MStabModelType.Bishop, InputStabilityModelType.Bishop}, + {MStabModelType.UpliftVan, InputStabilityModelType.UpliftVan}, + {MStabModelType.BishopUpliftVan,InputStabilityModelType.BishopUpliftVan} + }; + return translationTable[stabilityModelType]; + } + + /// + /// Converts the input stability model to the Dam stability model. + /// + /// Type of the input stability model. + /// + public static MStabModelType ConvertToStabilityModelType(InputStabilityModelType inputStabilityModelType) + { + var translationTable = new Dictionary() + { + {InputStabilityModelType.Bishop, MStabModelType.Bishop}, + {InputStabilityModelType.UpliftVan, MStabModelType.UpliftVan}, + {InputStabilityModelType.BishopUpliftVan, MStabModelType.BishopUpliftVan} + }; + return translationTable[inputStabilityModelType]; + } + + /// + /// Converts the Dam stability model to the output stability model. + /// + /// Type of the stability model. + /// + public static DesignResultStabilityDesignResultsStabilityModelType ConvertToOutputStabilityModelType(MStabModelType stabilityModelType) + { + var translationTable = new Dictionary() + { + {MStabModelType.Bishop, DesignResultStabilityDesignResultsStabilityModelType.Bishop}, + {MStabModelType.UpliftVan, DesignResultStabilityDesignResultsStabilityModelType.UpliftVan}, + {MStabModelType.BishopUpliftVan, DesignResultStabilityDesignResultsStabilityModelType.BishopUpliftVan} + }; + return translationTable[stabilityModelType]; + } + + /// + /// Converts the output stability model to the Dam stability model. + /// + /// Type of the output stability model. + /// + public static MStabModelType ConvertToStabilityModelType(DesignResultStabilityDesignResultsStabilityModelType outputStabilityModelType) + { + var translationTable = new Dictionary() + { + {DesignResultStabilityDesignResultsStabilityModelType.Bishop, MStabModelType.Bishop}, + {DesignResultStabilityDesignResultsStabilityModelType.UpliftVan, MStabModelType.UpliftVan}, + {DesignResultStabilityDesignResultsStabilityModelType.BishopUpliftVan, MStabModelType.BishopUpliftVan} + }; + return translationTable[outputStabilityModelType]; + } + + /// + /// Converts the Dam analysis type to the input analysis type. + /// + /// Type of the analysis. + /// + public static InputAnalysisType ConvertToInputAnalysisType(AnalysisType analysisType) + { + var translationTable = new Dictionary() + { + {AnalysisType.NoAdaption, InputAnalysisType.NoAdaption}, + {AnalysisType.AdaptGeometry, InputAnalysisType.AdaptGeometry} + }; + return translationTable[analysisType]; + } + + /// + /// Converts the input analysis type to the Dam analysis type. + /// + /// Type of the input analysis. + /// + public static AnalysisType ConvertToAnalysisType(InputAnalysisType inputAnalysisType) + { + var translationTable = new Dictionary() + { + {InputAnalysisType.NoAdaption, AnalysisType.NoAdaption}, + {InputAnalysisType.AdaptGeometry, AnalysisType.AdaptGeometry} + }; + return translationTable[inputAnalysisType]; + } + + /// + /// The input zone type no zones + /// + public const int InputZoneTypeNoZones = 0; + /// + /// The input zone type zone areas + /// + public const int InputZoneTypeZoneAreas = 1; + /// + /// The input zone types forbidden zones + /// + public const int InputZoneTypesForbiddenZones = 2; + + /// + /// Converts the type of to input zone. + /// + /// Type of the zone. + /// + public static int ConvertToInputZoneType(MStabZonesType zoneType) + { + var translationTable = new Dictionary() + { + {MStabZonesType.NoZones, InputZoneTypeNoZones}, + {MStabZonesType.ZoneAreas, InputZoneTypeZoneAreas}, + {MStabZonesType.ForbiddenZone, InputZoneTypesForbiddenZones} + }; + return translationTable[zoneType]; + } + + /// + /// Converts the type of to zone. + /// + /// Type of the input zone. + /// + public static MStabZonesType ConvertToZoneType(int inputZoneType) + { + var translationTable = new Dictionary() + { + {InputZoneTypeNoZones, MStabZonesType.NoZones}, + {InputZoneTypeZoneAreas, MStabZonesType.ZoneAreas}, + {InputZoneTypesForbiddenZones, MStabZonesType.ForbiddenZone} + }; + return translationTable[inputZoneType]; + } + + /// + /// Converts the Dam message type to the input message type. + /// + /// Type of the message. + /// + public static MessageMessageType ConvertToInputMessageType(LogMessageType messageType) + { + var translationTable = new Dictionary() + { + {LogMessageType.Warning, MessageMessageType.Warning}, + {LogMessageType.Debug, MessageMessageType.Info}, + {LogMessageType.Error, MessageMessageType.Error}, + {LogMessageType.FatalError, MessageMessageType.Error}, + {LogMessageType.Info, MessageMessageType.Info}, + {LogMessageType.Trace, MessageMessageType.Info} + }; + return translationTable[messageType]; + } + + /// + /// Converts the input message type to the Dam message type. + /// + /// Type of the validation result message. + /// + public static LogMessageType ConvertToMessageType(MessageMessageType validationResultMessageType) + { + var translationTable = new Dictionary() + { + {MessageMessageType.Warning, LogMessageType.Warning}, + {MessageMessageType.Error, LogMessageType.Error}, + {MessageMessageType.Info, LogMessageType.Info} + }; + return translationTable[validationResultMessageType]; + } + + /// + /// The input search method grid + /// + public const int InputSearchMethodGrid = 0; + + /// + /// The input search method genetic + /// + public const int InputSearchMethodGenetic = 1; + + /// + /// Converts to input search method. + /// + /// The search method. + /// + public static int ConvertToInputSearchMethod(MStabSearchMethod searchMethod) + { + var translationTable = new Dictionary() + { + { + MStabSearchMethod.Grid, InputSearchMethodGrid + }, + { + MStabSearchMethod.GeneticAlgorithm, InputSearchMethodGenetic + } + }; + return translationTable[searchMethod]; + } + + /// + /// Converts to search method. + /// + /// The search method. + /// + public static MStabSearchMethod ConvertToSearchMethod(int searchMethod) + { + var translationTable = new Dictionary() + { + { + InputSearchMethodGrid, MStabSearchMethod.Grid + }, + { + InputSearchMethodGenetic, MStabSearchMethod.GeneticAlgorithm + } + }; + return translationTable[searchMethod]; + } + + /// + /// The input grid type automatic + /// + public const int InputGridTypeAutomatic = 0; + + /// + /// The input grid type specified + /// + public const int InputGridTypeSpecified = 1; + + /// + /// Converts to input grid determination. + /// + /// Type of the grid. + /// + public static int ConvertToInputGridDetermination(GridSizeDetermination gridType) + { + var translationTable = new Dictionary() + { + { + GridSizeDetermination.Automatic, InputGridTypeAutomatic + }, + { + GridSizeDetermination.Specified, InputGridTypeSpecified + } + }; + + return translationTable[gridType]; + } + + /// + /// Converts to grid determination. + /// + /// Type of the grid. + /// + public static GridSizeDetermination ConvertToGridDetermination(int gridType) + { + var translationTable = new Dictionary() + { + { + InputGridTypeAutomatic, GridSizeDetermination.Automatic + }, + { + InputGridTypeSpecified, GridSizeDetermination.Specified + } + }; + return translationTable[gridType]; + } + + /// + /// The input tangent lines on boundaty lines + /// + public const int InputTangentLinesOnBoundatyLines = 0; + + /// + /// The input tangent lines specified + /// + public const int InputTangentLinesSpecified = 1; + + /// + /// Converts to input tangent lines definition. + /// + /// Type of the tangent line. + /// + public static int ConvertToInputTangentLinesDefinition(TangentLinesDefinition tangentLineType) + { + var translationTable = new Dictionary() + { + { + TangentLinesDefinition.OnBoundaryLines, InputGridTypeAutomatic + }, + { + TangentLinesDefinition.Specified, InputGridTypeSpecified + } + }; + return translationTable[tangentLineType]; + } + + /// + /// Converts to tangent lines definition. + /// + /// Type of the tangent line. + /// + public static TangentLinesDefinition ConvertToTangentLinesDefinition(int tangentLineType) + { + var translationTable = new Dictionary() + { + { + InputGridTypeAutomatic, TangentLinesDefinition.OnBoundaryLines + }, + { + InputGridTypeSpecified, TangentLinesDefinition.Specified + } + }; + return translationTable[tangentLineType]; + } + + /// + /// Converts the shear strength model to soil shear strength model. + /// + /// The shear strength model. + /// + public static SoilShearStrengthModel ConvertToSoilShearStrengthModel(ShearStrengthModel shearStrengthModel) + { + var translationTable = new Dictionary() + { + {ShearStrengthModel.None, SoilShearStrengthModel.None}, + {ShearStrengthModel.CPhi, SoilShearStrengthModel.CPhi}, + {ShearStrengthModel.StressTable, SoilShearStrengthModel.StressTable}, + {ShearStrengthModel.PseudoValues, SoilShearStrengthModel.PseudoValues}, + {ShearStrengthModel.CuMeasured, SoilShearStrengthModel.SuMeasured}, + {ShearStrengthModel.CuCalculated, SoilShearStrengthModel.SuCalculated}, + {ShearStrengthModel.CuGradient, SoilShearStrengthModel.SuGradient}, + {ShearStrengthModel.CuCalculatedYield, SoilShearStrengthModel.SuCalculatedWithYield}, + {ShearStrengthModel.CPhiOrCuCalculated, SoilShearStrengthModel.CPhiOrSuCalculated}, + }; + return translationTable[shearStrengthModel]; + } + + /// + /// Converts the soil shear strength model to shear strength model. + /// + /// The soil shear strength model. + /// + public static ShearStrengthModel ConvertToShearStrengthModel(SoilShearStrengthModel soilShearStrengthModel) + { + var translationTable = new Dictionary() + { + {SoilShearStrengthModel.None, ShearStrengthModel.None}, + {SoilShearStrengthModel.CPhi, ShearStrengthModel.CPhi}, + {SoilShearStrengthModel.StressTable, ShearStrengthModel.StressTable}, + {SoilShearStrengthModel.PseudoValues, ShearStrengthModel.PseudoValues}, + {SoilShearStrengthModel.SuMeasured, ShearStrengthModel.CuMeasured}, + {SoilShearStrengthModel.SuCalculated, ShearStrengthModel.CuCalculated}, + {SoilShearStrengthModel.SuGradient, ShearStrengthModel.CuGradient}, + {SoilShearStrengthModel.SuCalculatedWithYield, ShearStrengthModel.CuCalculatedYield}, + {SoilShearStrengthModel.CPhiOrSuCalculated, ShearStrengthModel.CPhiOrCuCalculated}, + }; + return translationTable[soilShearStrengthModel]; + } + + /// + /// Converts the dilatancy type to soil dilatancy dilatancy. + /// + /// Type of the dilatancy. + /// + public static SoilDilatancyType ConvertToSoilDilatancyType(DilatancyType dilatancyType) + { + var translationTable = new Dictionary() + { + {DilatancyType.Zero, SoilDilatancyType.Zero}, + {DilatancyType.Phi, SoilDilatancyType.Phi}, + {DilatancyType.MinusPhi, SoilDilatancyType.MinusPhi}, + }; + return translationTable[dilatancyType]; + } + + /// + /// Converts the soil dilatancy type to dilatancy type. + /// + /// Type of the soil dilatancy. + /// + public static DilatancyType ConvertToDilatancyType(SoilDilatancyType soilDilatancyType) + { + var translationTable = new Dictionary() + { + {SoilDilatancyType.Zero, DilatancyType.Zero}, + {SoilDilatancyType.Phi, DilatancyType.Phi}, + {SoilDilatancyType.MinusPhi, DilatancyType.MinusPhi}, + }; + return translationTable[soilDilatancyType]; + } + + /// + /// Converts the input StabilityDesignMethod to the Dam StabilityDesignMethod. + /// + /// The stability design method. + /// + public static StabilityDesignMethod ConvertToDamStabilityDesignMethod(LocationDesignOptionsStabilityDesignMethod stabilityDesignMethod) + { + var translationTable = new Dictionary() + { + {LocationDesignOptionsStabilityDesignMethod.OptimizedSlopeAndShoulderAdaption, StabilityDesignMethod.OptimizedSlopeAndShoulderAdaption}, + {LocationDesignOptionsStabilityDesignMethod.SlopeAdaptionBeforeShoulderAdaption, StabilityDesignMethod.SlopeAdaptionBeforeShoulderAdaption} + }; + return translationTable[stabilityDesignMethod]; + } + + /// + /// Converts the Dam StabilityDesignMethod to the input StabilityDesignMethod. + /// + /// The stability design method. + /// + public static LocationDesignOptionsStabilityDesignMethod ConvertToInputStabilityDesignMethod(StabilityDesignMethod stabilityDesignMethod) + { + var translationTable = new Dictionary() + { + {StabilityDesignMethod.OptimizedSlopeAndShoulderAdaption, LocationDesignOptionsStabilityDesignMethod.OptimizedSlopeAndShoulderAdaption}, + {StabilityDesignMethod.SlopeAdaptionBeforeShoulderAdaption, LocationDesignOptionsStabilityDesignMethod.SlopeAdaptionBeforeShoulderAdaption} + }; + return translationTable[stabilityDesignMethod]; + } + + /// + /// The load situation dry + /// + public const int LoadSituationDry = 0; + + /// + /// The load situation wet + /// + public const int LoadSituationWet = 1; + + /// + /// Converts to Load Situation. + /// + /// The input Load Situation. + /// + public static LoadSituation ConvertToLoadSituation(int inputLoadSituation) + { + var translationTable = new Dictionary() + { + {LoadSituationDry, LoadSituation.Dry}, + {LoadSituationWet, LoadSituation.Wet} + }; + return translationTable[inputLoadSituation]; + } + + /// + /// Converts to output LoadSituation. + /// + /// The Load Situation. + /// + public static int ConvertToOutputLoadSituation(LoadSituation loadSituation) + { + var translationTable = new Dictionary() + { + {LoadSituation.Dry, LoadSituationDry}, + {LoadSituation.Wet, LoadSituationWet} + }; + return translationTable[loadSituation]; + } + + /// + /// The dike dry sensitivity none + /// + public const int DikeDrySensitivityNone = 0; + + /// + /// The dike dry sensitivity dry + /// + public const int DikeDrySensitivityDry = 1; + + /// + /// The hydraulic shortcut type hydraulic shortcut + /// + public const int HydraulicShortcutTypeHydraulicShortcut = 0; + + /// + /// The hydraulic shortcut type no hydraulic shortcut + /// + public const int HydraulicShortcutTypeNoHydraulicShortcut = 1; + + /// + /// The uplift type uplift + /// + public const int UpliftTypeUplift = 0; + + /// + /// The uplift type no uplift + /// + public const int UpliftTypeNoUplift = 1; + + /// + /// Converts to Uplift Type. + /// + /// The input UpliftType. + /// + public static UpliftType ConvertToUpliftType(int inputUpliftType) + { + var translationTable = new Dictionary() + { + {UpliftTypeUplift, UpliftType.Uplift}, + {UpliftTypeNoUplift, UpliftType.NoUplift} + }; + return translationTable[inputUpliftType]; + } + + /// + /// Converts to output Uplift Type. + /// + /// The UpliftType. + /// + public static int ConvertToOutputUpliftType(UpliftType upliftType) + { + var translationTable = new Dictionary() + { + {UpliftType.Uplift, UpliftTypeUplift}, + {UpliftType.NoUplift, UpliftTypeNoUplift} + }; + return translationTable[upliftType]; + } + + /// + /// The m stab model type bishop + /// + public const int MStabModelTypeBishop = 0; + + /// + /// The m stab model type spencer + /// + public const int MStabModelTypeSpencer = 1; + + /// + /// The m stab model type fellenius + /// + public const int MStabModelTypeFellenius = 2; + + /// + /// The m stab model type uplift van + /// + public const int MStabModelTypeUpliftVan = 3; + + /// + /// The m stab model type uplift spencer + /// + public const int MStabModelTypeUpliftSpencer = 4; + + /// + /// The m stab model type bishop random field + /// + public const int MStabModelTypeBishopRandomField = 5; + + /// + /// The m stab model type horizontal balance + /// + public const int MStabModelTypeHorizontalBalance = 6; + + /// + /// The m stab model type bishop uplift van + /// + public const int MStabModelTypeBishopUpliftVan = 7; + + /// + /// The m stab model type spencer high + /// + public const int MStabModelTypeSpencerHigh = 8; + + /// + /// The m stab model type spencer low + /// + public const int MStabModelTypeSpencerLow = 9; + + /// + /// Converts to MStab Model Type. + /// + /// The input MStabModelType. + /// + public static MStabModelType ConvertToMStabModelType(int inputMStabModelType) + { + var translationTable = new Dictionary() + { + {MStabModelTypeBishop, MStabModelType.Bishop}, + {MStabModelTypeSpencer, MStabModelType.Spencer}, + {MStabModelTypeFellenius, MStabModelType.Fellenius}, + {MStabModelTypeUpliftVan, MStabModelType.UpliftVan}, + {MStabModelTypeUpliftSpencer, MStabModelType.UpliftSpencer}, + {MStabModelTypeBishopRandomField, MStabModelType.BishopRandomField}, + {MStabModelTypeHorizontalBalance, MStabModelType.HorizontalBalance}, + {MStabModelTypeBishopUpliftVan, MStabModelType.BishopUpliftVan}, + {MStabModelTypeSpencerHigh, MStabModelType.SpencerHigh}, + {MStabModelTypeSpencerLow, MStabModelType.SpencerLow} + }; + return translationTable[inputMStabModelType]; + } + + /// + /// Converts to output MStabModelType. + /// + /// The UpliftType. + /// + public static int ConvertToOutputMStabModelType(MStabModelType mStabModelType) + { + var translationTable = new Dictionary() + { + {MStabModelType.Bishop, MStabModelTypeBishop}, + {MStabModelType.Spencer, MStabModelTypeSpencer}, + {MStabModelType.Fellenius, MStabModelTypeFellenius}, + {MStabModelType.UpliftVan, MStabModelTypeUpliftVan}, + {MStabModelType.UpliftSpencer, MStabModelTypeUpliftSpencer}, + {MStabModelType.BishopRandomField, MStabModelTypeBishopRandomField}, + {MStabModelType.HorizontalBalance, MStabModelTypeHorizontalBalance}, + {MStabModelType.BishopUpliftVan, MStabModelTypeBishopUpliftVan}, + {MStabModelType.SpencerHigh, MStabModelTypeSpencerHigh}, + {MStabModelType.SpencerLow, MStabModelTypeSpencerLow} + }; + return translationTable[mStabModelType]; + } + + /// + /// The scenario type scenario01 + /// + public const int ScenarioTypeScenario01 = 0; + + /// + /// The scenario type scenario02 + /// + public const int ScenarioTypeScenario02 = 1; + + /// + /// The scenario type scenario03 + /// + public const int ScenarioTypeScenario03 = 2; + + /// + /// The scenario type scenario04 + /// + public const int ScenarioTypeScenario04 = 3; + + /// + /// The scenario type scenario05 + /// + public const int ScenarioTypeScenario05 = 4; + + /// + /// The scenario type scenario06 + /// + public const int ScenarioTypeScenario06 = 5; + + /// + /// The scenario type scenario07 + /// + public const int ScenarioTypeScenario07 = 6; + + /// + /// The scenario type scenario08 + /// + public const int ScenarioTypeScenario08 = 7; + + /// + /// The scenario type scenario09 + /// + public const int ScenarioTypeScenario09 = 8; + + /// + /// The scenario type scenario10 + /// + public const int ScenarioTypeScenario10 = 9; + + /// + /// The scenario type scenario11 + /// + public const int ScenarioTypeScenario11 = 10; + + /// + /// The piping model type bligh + /// + public const int PipingModelTypeBligh = 0; + + /// + /// The piping model type sellmeijer + /// + public const int PipingModelTypeSellmeijer = 1; + + /// + /// The piping model type sellmeijer4 forces + /// + public const int PipingModelTypeSellmeijer4Forces = 2; + + /// + /// The piping model type wti2017 + /// + public const int PipingModelTypeWti2017 = 3; + + /// + /// Converts to Piping Model Type. + /// + /// The input PipingModelType. + /// + public static PipingModelType ConvertToPipingModelType(int inputPipingModelType) + { + var translationTable = new Dictionary() + { + {PipingModelTypeBligh, PipingModelType.Bligh}, + {PipingModelTypeSellmeijer, PipingModelType.Sellmeijer}, + {PipingModelTypeSellmeijer4Forces, PipingModelType.Sellmeijer4Forces}, + {PipingModelTypeWti2017, PipingModelType.Wti2017} + }; + return translationTable[inputPipingModelType]; + } + + /// + /// Converts to output PipingModelType. + /// + /// The UpliftType. + /// + public static int ConvertToOutputPipingModelType(PipingModelType pipingModelType) + { + var translationTable = new Dictionary() + { + {PipingModelType.Bligh, PipingModelTypeBligh}, + {PipingModelType.Sellmeijer, PipingModelTypeSellmeijer}, + {PipingModelType.Sellmeijer4Forces, PipingModelTypeSellmeijer4Forces}, + {PipingModelType.Wti2017, PipingModelTypeWti2017} + }; + return translationTable[pipingModelType]; + } + + /// + /// Constants for translating to Enums TimeStepUnit + /// + public const uint TimeStepUnitSecond = 0; + public const uint TimeStepUnitMinute = 1; + public const uint TimeStepUnitHour = 2; + public const uint TimeStepUnitDay = 3; + public const uint TimeStepUnitMonth = 4; + public const uint TimeStepUnitWeek = 5; + public const uint TimeStepUnitYear = 6; + public const uint TimeStepUnitNonequidistant = 7; + + /// + /// Converts the input TimeStepUnit to the TimeStepUnit. + /// + /// The time step unit. + /// + public static TimeStepUnit ConvertToTimeStepUnit(uint timeStepUnit) + { + var translationTable = new Dictionary() + { + {TimeStepUnitSecond, TimeStepUnit.Second}, + {TimeStepUnitMinute, TimeStepUnit.Minute}, + {TimeStepUnitHour, TimeStepUnit.Hour}, + {TimeStepUnitDay, TimeStepUnit.Day}, + {TimeStepUnitMonth, TimeStepUnit.Month}, + {TimeStepUnitWeek, TimeStepUnit.Week}, + {TimeStepUnitYear, TimeStepUnit.Year}, + {TimeStepUnitNonequidistant, TimeStepUnit.Nonequidistant}, + }; + return translationTable[timeStepUnit]; + } + + /// + /// Converts the TimeStepUnit to the input TimeStepUnit. + /// + /// The time step unit. + /// + public static uint ConvertToInputTimeStepUnit(TimeStepUnit timeStepUnit) + { + var translationTable = new Dictionary() + { + {TimeStepUnit.Second, TimeStepUnitSecond}, + {TimeStepUnit.Minute, TimeStepUnitMinute}, + {TimeStepUnit.Hour, TimeStepUnitHour}, + {TimeStepUnit.Day, TimeStepUnitDay}, + {TimeStepUnit.Month, TimeStepUnitMonth}, + {TimeStepUnit.Week, TimeStepUnitWeek}, + {TimeStepUnit.Year, TimeStepUnitYear}, + {TimeStepUnit.Nonequidistant, TimeStepUnitNonequidistant}, + }; + return translationTable[timeStepUnit]; + } + + /// + /// Constants for translating to Enums PlLineType + /// + public const uint PlLineTypePl1 = 1; + public const uint PlLineTypePl2 = 2; + public const uint PlLineTypePl3 = 3; + public const uint PlLineTypePl4 = 4; + + /// + /// Converts the input plLineType to Dam plLineType. + /// + /// Type of the pl line. + /// plLineType + public static PLLineType ConvertToPlLineType(uint plLineType) + { + var translationTable = new Dictionary() + { + {PlLineTypePl1, PLLineType.PL1}, + {PlLineTypePl2, PLLineType.PL2}, + {PlLineTypePl3, PLLineType.PL3}, + {PlLineTypePl4, PLLineType.PL4} + }; + return translationTable[plLineType]; + } + + /// + /// Converts the Dam plLineType to input plLineType. + /// + /// Type of the pl line. + /// plLineType as integer + public static uint ConvertToInputPlLineType(PLLineType plLineType) + { + var translationTable = new Dictionary() + { + {PLLineType.PL1, PlLineTypePl1}, + {PLLineType.PL2, PlLineTypePl2}, + {PLLineType.PL3, PlLineTypePl3}, + {PLLineType.PL4, PlLineTypePl4} + }; + return translationTable[plLineType]; + } + + /// + /// Constants for translating to Enums SensorType + /// + public const uint SensorTypePiezometricHead = 0; + public const uint SensorTypeWaterLevel = 1; + public const uint SensorTypePolderLevel = 2; + + /// + /// Converts the Dam sensorType to input sensorType. + /// + /// Type of the sensor. + /// sensorType + public static SensorType ConvertToSensorType(uint sensorType) + { + var translationTable = new Dictionary() + { + {SensorTypePiezometricHead, SensorType.PiezometricHead}, + {SensorTypePolderLevel, SensorType.PolderLevel}, + {SensorTypeWaterLevel, SensorType.WaterLevel} + }; + return translationTable[sensorType]; + } + + /// + /// Converts the Dam sensorType to input sensorType. + /// + /// Type of the sensor. + /// sensorType as integer + public static uint ConvertToInputSensorType(SensorType sensorType) + { + var translationTable = new Dictionary() + { + {SensorType.PiezometricHead, SensorTypePiezometricHead}, + {SensorType.PolderLevel, SensorTypePolderLevel}, + {SensorType.WaterLevel, SensorTypeWaterLevel} + }; + return translationTable[sensorType]; + } + + /// + /// Constants for translating to Enums DataSourceTypeSensors + /// + public const uint DataSourceTypeSensorsIgnore = 0; + public const uint DataSourceTypeSensorsLocationData = 1; + public const uint DataSourceTypeSensorsSensor = 2; + + /// + /// Converts the Dam DataSourceTypeSensors to input DataSourceTypeSensors. + /// + /// The data source type sensors. + /// + /// DataSourceTypeSensors + /// + public static DataSourceTypeSensors ConvertToDataSourceTypeSensors(uint dataSourceTypeSensors) + { + var translationTable = new Dictionary() + { + {DataSourceTypeSensorsIgnore, DataSourceTypeSensors.Ignore}, + {DataSourceTypeSensorsLocationData, DataSourceTypeSensors.LocationData}, + {DataSourceTypeSensorsSensor, DataSourceTypeSensors.Sensor} + }; + return translationTable[dataSourceTypeSensors]; + } + + /// + /// Converts the Dam DataSourceType to input DataSourceType. + /// + /// The data source type sensors. + /// + /// DataSourceType as integer + /// + public static uint ConvertToInputDataSourceTypeSensors(DataSourceTypeSensors dataSourceTypeSensors) + { + var translationTable = new Dictionary() + { + {DataSourceTypeSensors.Ignore, DataSourceTypeSensorsIgnore}, + {DataSourceTypeSensors.LocationData, DataSourceTypeSensorsLocationData}, + {DataSourceTypeSensors.Sensor, DataSourceTypeSensorsSensor} + }; + return translationTable[dataSourceTypeSensors]; + } + } +} Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/IO/FailureMechanismeParamatersMStabXmlHandler.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/IO/FailureMechanismeParamatersMStabXmlHandler.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/IO/FailureMechanismeParamatersMStabXmlHandler.cs (revision 3305) @@ -0,0 +1,99 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU 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.Geotechnics; +using Deltares.Geotechnics.Converter; +using Deltares.Geotechnics.SurfaceLines; +using Deltares.Standard.IO.Xml; +using Deltares.Standard.Reflection; + +namespace Deltares.Dam.Data.IO +{ + /// + /// This handler is responsible for handling an object which has been created with the SurfaceLine type. + /// Since the old SurfaceLine has been refactored, this handler will convert the old SurfaceLine to a SurfaceLine2. + /// + public class FailureMechanismeParamatersMStabXmlHandler : IXmlHandler + { + public void SetVersion(string version) + { + } + + + /// + /// This method returns true for a type and the + /// property. + /// + /// The type to check for. + /// The property of the type to check for + /// True if type is and property is "SurfaceLine" + public bool CanHandle(Type type, string property) + { + return type == typeof(FailureMechanismeParamatersMStab) && property == StaticReflection.GetMemberName(x => x.SurfaceLine); + } + + /// + /// Not implemented for this class. + /// + /// + /// + /// + public void Handle(object target, string value, object[] objects) + { + throw new NotImplementedException(); + } + + /// + /// If the is an old and the is a + /// , the will be converted to the new + /// and the property is set for the target. + /// + /// The target to set the handle the value for + /// The value to handle + public void HandleObject(object target, object value) + { + var oldSurfaceLine = value as BaseSurfaceLine; + if (null != oldSurfaceLine) + { + ((FailureMechanismeParamatersMStab)target).SurfaceLine = (new OldSurfaceLineToNewConverter()).Convert(oldSurfaceLine); + } + } + + public bool CanHandle(Type type) + { + return false; + } + + public Type GetFormerPropertyType(Type type, string property) + { + return null; + } + + public void Handle(object target, string property, object value, object[] objects) + { + } + + public void Upgrade(object[] targets) + { + } + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/AttributeWrongValueException.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/AttributeWrongValueException.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/AttributeWrongValueException.cs (revision 3305) @@ -0,0 +1,44 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU 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.Maps +{ + [Serializable] + public class AttributeWrongValueException : Exception + { + private const string MessagePattern = + "The value {0} of attribute {1} is wrong (beyond its limits ({2} - {3})). Please check the specified value(s)."; + + public AttributeWrongValueException(string attributeName, double value, double min, double max) : + base(string.Format(MessagePattern, value, attributeName, min, max)) + { + } + + protected AttributeWrongValueException( + SerializationInfo info, + StreamingContext context) : base(info, context) + { + } + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/NonExistentLocationException.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/NonExistentLocationException.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/NonExistentLocationException.cs (revision 3305) @@ -0,0 +1,39 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU 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; + +namespace Deltares.Dam.Data +{ + + [Serializable] + public class NonExistentLocationException : Exception + { + public NonExistentLocationException() + { + } + + public NonExistentLocationException(string locationId, string messageFormat) + : base(string.Format(messageFormat, locationId)) + { + } + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DataPlugins/Configuration/DataAttribute.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DataPlugins/Configuration/DataAttribute.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DataPlugins/Configuration/DataAttribute.cs (revision 3305) @@ -0,0 +1,46 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Xml.Serialization; + +namespace Deltares.Dam.Data.DataPlugins.Configuration +{ + public class DataAttribute + { + [XmlAttribute("Id")] + public string AttributeId { get; set; } + + [XmlAttribute("Name")] + public string AttributeName { get; set; } + + [XmlAttribute("DataSource")] + public string DataSource { get; set; } + + public override string ToString() + { + return AttributeId + "|" + AttributeName + "|" + DataSource; + } + } +} Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/IFeatureCollection.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/IFeatureCollection.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/IFeatureCollection.cs (revision 3305) @@ -0,0 +1,49 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System.Collections.Generic; + +namespace Deltares.Maps +{ + public interface IFeatureCollection + { + void Add(IFeature feature); + + void Add(IEnumerable features); + + void Remove(IFeature feature); + + void Clear(); + + // Gets the feature count + int Count { get; } + } + + public interface IFeatureCollection : IFeatureCollection + where T : IFeature + { + void Add(T feature); + + void Add(IEnumerable features); + + void Remove(T feature); + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/ParameterMissingException.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/ParameterMissingException.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/ParameterMissingException.cs (revision 3305) @@ -0,0 +1,48 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU 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.Dam.Data +{ + + [Serializable] + public class ParameterMissingException : Exception + { + public ParameterMissingException(string messageFormat) + : base(messageFormat, null) + { + } + + public ParameterMissingException(string messageFormat, Exception inner) + : base(string.Format(messageFormat), inner) + { + } + + protected ParameterMissingException( + SerializationInfo info, + StreamingContext context) + : base(info, context) + { + } + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/CsvParser.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/CsvParser.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/CsvParser.cs (revision 3305) @@ -0,0 +1,237 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Collections.Generic; +using System.Linq; +using System.IO; +using System.Text.RegularExpressions; + +namespace Deltares.Dam.Data +{ + + public static class CsvParser + { + /// + /// Parses the header of an csv import file + /// + /// The header string + /// The regular expression + /// An array of strings containing the header names + public static string[] ParseHeader(string header, Regex splitter) + { + ThrowHelper.ThrowIfStringArgumentNullOrEmpty(header, StringResourceNames.CsvHeaderNullOrEmpty); + ThrowHelper.ThrowIfArgumentNull(splitter, "splitter", StringResourceNames.CsvSplitterPatternNotValid); + ThrowHelper.ThrowIfStringArgumentNullOrEmpty(splitter.ToString(), StringResourceNames.CsvSplitterPatternNotValid); + + return splitter.Split(header); + } + + /// + /// This regex splits comma or semicolon separated lists of optionally quoted strings. It handles quoted delimiters and escaped quotes. + /// Whitespace inside quotes is preserved, outside is eaten. + /// See: http://regexlib.com/REDetails.aspx?regexp_id=1325 + /// + public static string CsvSplitPatternCommaAndSemicolonCombined = + @"\s*[;,]\s*(?!(?<=(?:^|[;,])\s*""(?:[^""]|""""|\\"")*[;,]\s*)(?:[^""]|""""|\\"")*""\s*(?:[;,]|$))"; + + public static string CsvSplitPatternSemicolonOnly = + @"\s*[;]\s*(?!(?<=(?:^|[;])\s*""(?:[^""]|""""|\\"")*[;]\s*)(?:[^""]|""""|\\"")*""\s*(?:[;]|$))"; + + public static string CsvSplitPatternCommaOnly = + @"\s*[,]\s*(?!(?<=(?:^|[,])\s*""(?:[^""]|""""|\\"")*[,]\s*)(?:[^""]|""""|\\"")*""\s*(?:[,]|$))"; + + /// + /// Loads entities of an specific type from a csv file + /// + /// The type to construct + /// The object materializer (property setters) + /// The file name to parse + /// A sequance containing materialized intances of the type to construct from the csv data + public static IEnumerable LoadFromCsvFile(this ObjectMaterializer setter, string fileName) + where T : new() + { + return LoadFromCsvFile(setter, fileName, true); + } + + /// + /// Loads entities of an specific type from a csv file. Also returns the parsed headers + /// + /// The type to construct + /// The object materializer (property setters) + /// The file name to parse + /// A sequance containing materialized intances of the type to construct from the csv data + public static IEnumerable LoadFromCsvFile(this ObjectMaterializer setter, string fileName, ref string[] headers) + where T : new() + { + // Assemble headers that are available in headerline + headers = new string[] { }; + var headerInfoHasBeenParsed = false; + var splitter = new Regex(CsvSplitPatternSemicolonOnly, RegexOptions.IgnoreCase | RegexOptions.Compiled); + using (var sr = new StreamReader(fileName)) + { + while (!sr.EndOfStream && !headerInfoHasBeenParsed) + { + if (!headerInfoHasBeenParsed) + { + headers = ParseHeader(sr.ReadLine(), splitter); + headerInfoHasBeenParsed = true; + continue; + } + } + } + + // Do the actual load of the data + return LoadFromCsvFile(setter, fileName, true); + } + + /// + /// Loads entities of an specific type from a csv file + /// + /// The type to construct + /// The object materializer (property setters) + /// The file name to parse + /// The regular expression for splitting the items in a string + /// A sequance containing materialized intances of the type to construct from the csv data + public static IEnumerable LoadFromCsvFile(this ObjectMaterializer setter, string fileName, string splitPattern) + where T : new() + { + return LoadFromCsvFile(setter, fileName, true, splitPattern); + } + + /// + /// Loads entities of an specific type from a csv file + /// + /// The type to construct + /// The object materializer (property setters) + /// The file name to parse + /// Indicates if the first line in the csv file contains the header info + /// A sequance containing materialized intances of the type to construct from the csv data + public static IEnumerable LoadFromCsvFile(this ObjectMaterializer setter, string fileName, bool headerInfoInFirstLine) + where T : new() + { + return LoadFromCsvFile(setter, fileName, true, CsvSplitPatternSemicolonOnly); + } + + /// + /// Loads entities of an specific type from a csv file + /// + /// The type to construct + /// The object materializer (property setters) + /// The file name to parse + /// Indicates if the first line in the csv file contains the header info + /// The regular expression for splitting the items in a string + /// A sequance containing materialized intances of the type to construct from the csv data + public static IEnumerable LoadFromCsvFile(this ObjectMaterializer materializer, string fileName, bool headerInfoInFirstLine, string splitPattern) + where T : new() + { + ThrowHelper.ThrowIfStringArgumentNullOrEmpty(fileName, StringResourceNames.CsvFileNotValid); + ThrowHelper.ThrowIfFileNotExist(fileName, StringResourceNames.CsvFileNotFound); + ThrowHelper.ThrowIfStringArgumentNullOrEmpty(splitPattern, StringResourceNames.CsvSplitterPatternNotValid); + ThrowHelper.ThrowIfArgumentNull(materializer, nameof(materializer), StringResourceNames.CsvObjectMaterializerNotValid); + ThrowHelper.ThrowWhenConditionIsTrue( + materializer, + StringResourceNames.CsvObjectMaterializerNotValid, + c => materializer.Count == 0, + r => new CsvParserException(ThrowHelper.GetResourceString(r))); + + + var splitter = new Regex(splitPattern, RegexOptions.IgnoreCase | RegexOptions.Compiled); + + using (var sr = new StreamReader(fileName)) + { + var headers = new string[] { }; + var headerInfoHasBeenParsed = false; + + // the first line item count will be used as an extra check for each + // next row to parse. If the count doesn match + var firstLineItemCount = 0; + while (!sr.EndOfStream) + { + if (headerInfoInFirstLine && !headerInfoHasBeenParsed) + { + headers = ParseHeader(sr.ReadLine(), splitter); + headerInfoHasBeenParsed = true; + firstLineItemCount = headers.Length; + + foreach (string key in materializer.MappingKeys) + { + if (materializer.IsRequired(key) && !headers.Contains(key)) + throw new CsvParserException(string.Format("The mapped key '{0}' doesn't exist in the header of csv file '{1}'", key, fileName)); + } + + continue; + } + + var items = splitter.Split(sr.ReadLine()); + if (firstLineItemCount == 0) + firstLineItemCount = items.Length; + + // TODO: Add a message to some log that this line could not be parsed + // For now just throw an exception + if (items.Length != firstLineItemCount) + throw new CsvParserException(string.Format("The number of items parsed in the current line don't match with the number of the first line in csv file '{0}'", fileName)); + + var entity = new T(); + try + { + if (headers.Length > 0) + { + for (var i = 0; i < items.Length; i++) + { + // Only call the materializer when the is a match between the + // columns declared in the csv and the materializer + if (materializer.MappingKeys.Contains(headers[i])) + materializer[headers[i]](entity, items[i]); + } + } + else + { + for (var i = 0; i < items.Length; i++) + { + materializer[i](entity, items[i]); + } + } + } + catch (Exception e) + { + throw new CsvParserException(String.Format("Error parsing CSV file. Check if no empty lines or columns are defined in file '{0}. (Parser error is: '{1}')", fileName, e.Message)); + } + + yield return entity; + } + } + } + + public static IEnumerable Lines(this StreamReader source) + { + string line; + + if (source == null) + throw new ArgumentNullException("source"); + + while ((line = source.ReadLine()) != null) + { + yield return line; + } + } + } +} Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/ModelFactors.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/ModelFactors.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/ModelFactors.cs (revision 3305) @@ -0,0 +1,53 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU 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.Xml.Serialization; + +namespace Deltares.Dam.Data +{ + public class ModelFactors + { + private double defaultSafetyFactorStabilityInnerSlope = 1.0; + private double defaultSafetyFactorStabilityOuterSlope = 1.0; + private double defaultSafetyFactorPiping = 1.0; + private double defaultUpliftCriterionStability = 1.2; + private double defaultUpliftCriterionPiping = 1.2; + + /// + /// Constructor + /// + public ModelFactors() + { + RequiredSafetyFactorStabilityInnerSlope = defaultSafetyFactorStabilityInnerSlope; + RequiredSafetyFactorStabilityOuterSlope = defaultSafetyFactorStabilityOuterSlope; + RequiredSafetyFactorPiping = defaultSafetyFactorPiping; + UpliftCriterionStability = defaultUpliftCriterionStability; + UpliftCriterionPiping = defaultUpliftCriterionPiping; + } + + public double RequiredSafetyFactorStabilityInnerSlope { get; set; } + public double RequiredSafetyFactorStabilityOuterSlope { get; set; } + public double RequiredSafetyFactorPiping { get; set; } + public double UpliftCriterionStability { get; set; } + public double UpliftCriterionPiping { get; set; } + + } +} Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/Test/TestData/Gemeenten.prj =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/Test/TestData/Gemeenten.prj (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/Test/TestData/Gemeenten.prj (revision 3305) @@ -0,0 +1 @@ +PROJCS["Rijksdriehoekstelsel_New",GEOGCS["GCS_Amersfoort",DATUM["D_Amersfoort",SPHEROID["Bessel_1841",6377397.155,299.1528128]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Double_Stereographic"],PARAMETER["False_Easting",155000.0],PARAMETER["False_Northing",463000.0],PARAMETER["Central_Meridian",5.38763888888889],PARAMETER["Scale_Factor",0.9999079],PARAMETER["Latitude_Of_Origin",52.15616055555555],UNIT["Meter",1.0]] \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/CsvImporters/SurfaceLineCsvColumnNames.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/CsvImporters/SurfaceLineCsvColumnNames.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/CsvImporters/SurfaceLineCsvColumnNames.cs (revision 3305) @@ -0,0 +1,37 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +namespace Deltares.Dam.Data.CsvImporters +{ + /// + /// Defines column name definitions used for importing csv data surfacelines + /// + public static class SurfaceLineCsvColumnNames + { + // The following 2 fields point to the same data + // location_id is the preferred columnname + // Profielnaam is used for backward compatiblity + public const string LocationColumnName = "LocationId"; + public const string ProfileNameColumnName = "Profielnaam"; + + public const string FirstXColumnName = "X1"; + } +} Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Properties/AssemblyInfo.cs.svn =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Properties/AssemblyInfo.cs.svn (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Properties/AssemblyInfo.cs.svn (revision 3305) @@ -0,0 +1,16 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +[assembly: AssemblyTitle("Deltares.Dam.Data")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] + +[assembly: ComVisible(false)] +[assembly: Guid("a6184ba6-b126-4783-b437-e987b511e09b")] + +[assembly: AssemblyVersion("17.1.0.SVNREV")] +[assembly: AssemblyFileVersion("17.1.0.SVNREV")] + +[assembly: InternalsVisibleTo("Deltares.Dam.Tests")] +[assembly: InternalsVisibleTo("Deltares.Dam.IntegrationTests")] \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/ShapeFileCreator.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/ShapeFileCreator.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/ShapeFileCreator.cs (revision 3305) @@ -0,0 +1,101 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU 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.IO; +using System.Linq; + +using NetTopologySuite.IO; + +namespace Deltares.Maps +{ + /// + /// Wrapper class for writing repository data to ShapeFiles. + /// + public static class ShapeFileCreator + { + /// + /// Creates the three (mandatory) files (.dbf, .shx, .shp) belonging to shape files + /// and writes the feature data contained in the repository + /// + /// The output folder + /// The name of the file/layer (without extension) + /// The repository containing all data to be written to shapefiles + /// + /// If the files already exist they will be overriden + /// + /// + /// + /// When the name is empty or null. A valid name is required. + /// + /// + /// When the repository does not contain features. + /// + /// + /// When more then one geometry types is found in the repository + /// When the repository contains types which are currently not supported: + /// OgcGeometryType.Curve + /// OgcGeometryType.MultiCurve + /// OgcGeometryType.Surface + /// OgcGeometryType.MultiSurface + /// OgcGeometryType.Polygon + /// OgcGeometryType.MultiPolygon + /// OgcGeometryType.Geometry + /// OgcGeometryType.GeometryCollection + /// + public static void Create(string path, string name, IFeatureRepository repository) + { + if (string.IsNullOrEmpty(name) || name.Trim() == string.Empty) + { + throw new ArgumentNullException("name"); + } + + path = string.IsNullOrEmpty(path) || path.Trim() == "" || path.Trim() == "." + ? Directory.GetCurrentDirectory() + : path; + + if (!Directory.Exists(path)) + { + throw new DirectoryNotFoundException(path); + } + + if (repository.Features.Count() == 0) + { + throw new ArgumentException( + "The feature repository doesn't contain features. It should contain at least one feature"); + } + + IFeature firstFeature = repository.Features.First(); + var feature = new NetTopologySuite.Features.Feature(firstFeature.Geometry, firstFeature.Attributes); + List coll = repository.Features + .Select(f => new NetTopologySuite.Features.Feature(f.Geometry, f.Attributes)) + .ToList(); + + DbaseFileHeader header = ShapefileDataWriter.GetHeader(feature, repository.Count); + var writer = new ShapefileDataWriter(path + name) + { + Header = header + }; + writer.Write(coll); + } + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Properties/Resources.Designer.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Properties/Resources.Designer.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Properties/Resources.Designer.cs (revision 3305) @@ -0,0 +1,639 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Deltares.Dam.Data.Properties { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Deltares.Dam.Data.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Looks up a localized string similar to The column index of {0} defined on property {1} in the CSV export object class already exists. + /// + internal static string CsvColumnIndexAlreadyExists { + get { + return ResourceManager.GetString("CsvColumnIndexAlreadyExists", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Couldn't find the csv data file {0}. + /// + internal static string CsvFileNotFound { + get { + return ResourceManager.GetString("CsvFileNotFound", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The file name is not valid or empty. + /// + internal static string CsvFileNotValid { + get { + return ResourceManager.GetString("CsvFileNotValid", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The header in the import file is not valid. + /// + internal static string CsvHeaderNotValid { + get { + return ResourceManager.GetString("CsvHeaderNotValid", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The header in the import file is not valid. + /// + internal static string CsvHeaderNullOrEmpty { + get { + return ResourceManager.GetString("CsvHeaderNullOrEmpty", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The object materializer is not valid. + /// + internal static string CsvObjectMaterializerNotValid { + get { + return ResourceManager.GetString("CsvObjectMaterializerNotValid", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The given pattern to split the data values of the CSV files is not valid. + /// + internal static string CsvSplitterPatternNotValid { + get { + return ResourceManager.GetString("CsvSplitterPatternNotValid", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The data import argument is not valid. + /// + internal static string DataImportArgumentNull { + get { + return ResourceManager.GetString("DataImportArgumentNull", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The project should contain exactly 1 dike. + /// + internal static string DikeShouldContainExactly1Dike { + get { + return ResourceManager.GetString("DikeShouldContainExactly1Dike", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Cannot create or add the entity with the the given id because it already exist. + /// + internal static string EntityAlreadyExist { + get { + return ResourceManager.GetString("EntityAlreadyExist", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The factory argument is null but is a required. + /// + internal static string EntityFactoryArgumentNull { + get { + return ResourceManager.GetString("EntityFactoryArgumentNull", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The file name is not valid. Maybe due to a null or empty string and or invalid characters. Please use a valid file name. + /// + internal static string FileNameNotValid { + get { + return ResourceManager.GetString("FileNameNotValid", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The gauge id value is null or empty which is not allowed. + /// + internal static string GaugeIdArgumentNullOrEmpty { + get { + return ResourceManager.GetString("GaugeIdArgumentNullOrEmpty", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The imported data is not valid. Reason: {0}. + /// + internal static string ImportDataNotValid { + get { + return ResourceManager.GetString("ImportDataNotValid", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to This location does not have a soilprofile. + /// + internal static string ImportedLocationDoesntHaveSoilprofile { + get { + return ResourceManager.GetString("ImportedLocationDoesntHaveSoilprofile", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to No points in location PL1 line. Please check if the PL1 line ID defined in the locations import file matches the ID's in the PL1 line import file. + /// + internal static string ImportedLocationDoesntHaveValidPL1Lines { + get { + return ResourceManager.GetString("ImportedLocationDoesntHaveValidPL1Lines", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to No dike points in location surface line. Please check if the surface line ID defined in the locations import file matches the ID's in the surface line import file. + /// + internal static string ImportedLocationDoesntHaveValidSurfaceLines { + get { + return ResourceManager.GetString("ImportedLocationDoesntHaveValidSurfaceLines", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The import file {0} couldn't be found. This file is required.. + /// + internal static string ImportFileNotExist { + get { + return ResourceManager.GetString("ImportFileNotExist", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The file which are required for the import are not validated. + /// + internal static string ImportFilesNotValidated { + get { + return ResourceManager.GetString("ImportFilesNotValidated", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The import folder {0} does not exist. + /// + internal static string ImportFolderNotExist { + get { + return ResourceManager.GetString("ImportFolderNotExist", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The import folder is not valid. + /// + internal static string ImportFolderNullOrEmpty { + get { + return ResourceManager.GetString("ImportFolderNullOrEmpty", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Location '{0}' has no segment.. + /// + internal static string LocationHasNoSegment { + get { + return ResourceManager.GetString("LocationHasNoSegment", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The location id value is null or empty which is not allowed. + /// + internal static string LocationIdArgumentNullOrEmpty { + get { + return ResourceManager.GetString("LocationIdArgumentNullOrEmpty", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Location has an invalid name {0}. + /// + internal static string LocationInvalidName { + get { + return ResourceManager.GetString("LocationInvalidName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Couldn't find the MStab executable at location {0}. + /// + internal static string MStabExecutableFileNameNotFound { + get { + return ResourceManager.GetString("MStabExecutableFileNameNotFound", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to No calculation type specified. + /// + internal static string NoCalculationTypeSpecified { + get { + return ResourceManager.GetString("NoCalculationTypeSpecified", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to No dike defined in this project. + /// + internal static string NoDikeDefined { + get { + return ResourceManager.GetString("NoDikeDefined", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to No locations defined in this project. + /// + internal static string NoLocationsDefined { + get { + return ResourceManager.GetString("NoLocationsDefined", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Location '{0}' does not exist in the location collection.. + /// + internal static string NonExistentLocation { + get { + return ResourceManager.GetString("NonExistentLocation", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Location '{0}', scenario '{1}' has no river level. + /// + internal static string NoRiverLevel { + get { + return ResourceManager.GetString("NoRiverLevel", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Location '{0}', scenario '{1}' has no river level low. + /// + internal static string NoRiverLevelLow { + get { + return ResourceManager.GetString("NoRiverLevelLow", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to No scenarios defined in location. + /// + internal static string NoScenariosDefinedInLocation { + get { + return ResourceManager.GetString("NoScenariosDefinedInLocation", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to No soil profiles have been defined for location '{0}'.. + /// + internal static string NoSoilProfileDefinedForLocation { + get { + return ResourceManager.GetString("NoSoilProfileDefinedForLocation", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to No soilprofiles1D defined in this project. + /// + internal static string NoSoilprofiles1DDefinedInProject { + get { + return ResourceManager.GetString("NoSoilprofiles1DDefinedInProject", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to No soils defined in this project. + /// + internal static string NoSoilsDefinedInProject { + get { + return ResourceManager.GetString("NoSoilsDefinedInProject", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to No surfacelines defined in this project. + /// + internal static string NoSurfaceLines { + get { + return ResourceManager.GetString("NoSurfaceLines", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Couldn't parse the file because it has no valid content. + /// + internal static string OutputFileHasNoContent { + get { + return ResourceManager.GetString("OutputFileHasNoContent", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The file name is not valid. + /// + internal static string OutputFileNameNotValid { + get { + return ResourceManager.GetString("OutputFileNameNotValid", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Couldn't find the output file {0}. + /// + internal static string OutputFileNotExist { + get { + return ResourceManager.GetString("OutputFileNotExist", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to PL1 has not been created. + /// + internal static string PL1NotCreated { + get { + return ResourceManager.GetString("PL1NotCreated", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Project file name is not valid. + /// + internal static string ProjectFileNameNullOrEmpty { + get { + return ResourceManager.GetString("ProjectFileNameNullOrEmpty", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Project file not found . + /// + internal static string ProjectFileNotExist { + get { + return ResourceManager.GetString("ProjectFileNotExist", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The required entity '{0}' with ID '{1}' doesn't exist. + /// + internal static string RequiredEntityDoesNotExist { + get { + return ResourceManager.GetString("RequiredEntityDoesNotExist", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The required parameter {0} which should be contained in object {1} is missing. + /// + internal static string RequiredParameterMissing { + get { + return ResourceManager.GetString("RequiredParameterMissing", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The segment id value is null or empty which is not allowed. + /// + internal static string SegmentIdArgumentNullOrEmpty { + get { + return ResourceManager.GetString("SegmentIdArgumentNullOrEmpty", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Segment has an invalid name {0}. + /// + internal static string SegmentInvalidName { + get { + return ResourceManager.GetString("SegmentInvalidName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Couldn't find the SlopeW (GeoStudio) executable at location {0}. + /// + internal static string SlopeWExecutableFileNameNotFound { + get { + return ResourceManager.GetString("SlopeWExecutableFileNameNotFound", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The soil material in the layer could not be converted to local type. + /// + internal static string SoilAttachedToLayerNotValid { + get { + return ResourceManager.GetString("SoilAttachedToLayerNotValid", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Soildatabase '{0}' is not found. + /// + internal static string SoildatabaseNotFound { + get { + return ResourceManager.GetString("SoildatabaseNotFound", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Soil has an invalid name {0}. + /// + internal static string SoilInvalidName { + get { + return ResourceManager.GetString("SoilInvalidName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The soil list is not yet created.. + /// + internal static string SoilListIsNull { + get { + return ResourceManager.GetString("SoilListIsNull", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The soil profile name or id value is null or empty which is not allowed. + /// + internal static string SoilProfileIdArgumentNullOrEmpty { + get { + return ResourceManager.GetString("SoilProfileIdArgumentNullOrEmpty", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Soilprofile has an invalid name {0}. + /// + internal static string SoilProfileInvalidName { + get { + return ResourceManager.GetString("SoilProfileInvalidName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The soilprofile is not assigned. + /// + internal static string SoilProfileNotAssigned { + get { + return ResourceManager.GetString("SoilProfileNotAssigned", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Surfaceline '{0}' has no characteristic points. + /// + internal static string SurfaceLineHasNoCharacteristicPoints { + get { + return ResourceManager.GetString("SurfaceLineHasNoCharacteristicPoints", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Surfaceline '{0}' has no points. + /// + internal static string SurfaceLineHasNoPoints { + get { + return ResourceManager.GetString("SurfaceLineHasNoPoints", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The surface line id argument is null or empty but it is required. + /// + internal static string SurfaceLineIdArgumentNullOrEmpty { + get { + return ResourceManager.GetString("SurfaceLineIdArgumentNullOrEmpty", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Surfaceline has an invalid name {0}. + /// + internal static string SurfaceLineInvalidName { + get { + return ResourceManager.GetString("SurfaceLineInvalidName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Surfaceline is not inside soil profile. + /// + internal static string SurfacelineIsNotInsideSoilprofile { + get { + return ResourceManager.GetString("SurfacelineIsNotInsideSoilprofile", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The surfaceline is not assigned. + /// + internal static string SurfaceLineNotAssigned { + get { + return ResourceManager.GetString("SurfaceLineNotAssigned", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The required characteristic point type '{0}' with coordinate '{1}' does not exist in the point collection of surfaceline '{2}'. + /// + internal static string SurfaceLinePointNotExtists { + get { + return ResourceManager.GetString("SurfaceLinePointNotExtists", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The top layer to be evaluated is not inside the soil profile. + /// + internal static string TopLayerToBeEvaluatedNotInsideSoilprofile { + get { + return ResourceManager.GetString("TopLayerToBeEvaluatedNotInsideSoilprofile", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Two sandlayers are mandatory in soil profile. + /// + internal static string TwoSandlayersRequiredInSoilProfile { + get { + return ResourceManager.GetString("TwoSandlayersRequiredInSoilProfile", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The water level input file is not null or empty. + /// + internal static string WaterLevelInputFileNullOrEmpty { + get { + return ResourceManager.GetString("WaterLevelInputFileNullOrEmpty", resourceCulture); + } + } + } +} Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Specifications/NotEqualSpecification.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Specifications/NotEqualSpecification.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Specifications/NotEqualSpecification.cs (revision 3305) @@ -0,0 +1,44 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +namespace Deltares.Standard.Specifications +{ + public class NotEqualSpecification : ValueBoundSpecification + { + public NotEqualSpecification(string attributeName, TValue attributeValue) + : base(attributeName, attributeValue) + { + } + + /// + /// Determines whether the candidate satisfies the specification. + /// + /// The candidate to test. + /// + /// true if the candidate satisfies the specification otherwise, false. + /// + public override bool IsSatisfiedBy(TCandidate candidate) + { + TValue actual = this.GetCandidateTValue(candidate); + return !(actual.Equals(this.AttributeValue)); + } + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/CoverageFunction.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/CoverageFunction.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/CoverageFunction.cs (revision 3305) @@ -0,0 +1,143 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Collections.Generic; +using System.Linq; + +using NetTopologySuite.Geometries; + +namespace Deltares.Maps +{ + public static class CoverageFunction + { + public static IEnumerable GetFeaturesCovering(this IFeatureRepository repository, double x, double y) + { + var pointToTest = new Point(x, y); + /* + return (from feature in repository.Features + let target = feature.Geometry + where (pointToTest.Within(target) || pointToTest.Touches(target)) || pointToTest.Intersects(target) + select feature); +*/ + + /* + var e = pointToTest.EnvelopeInternal; + const int delta = 1; + var bbox = new Envelope(e.MinX - delta, e.MinY - delta, e.MaxX + delta, e.MaxY + delta); + + var possibleMatches = repository.Query(bbox); + + foreach (var feature in possibleMatches) + { + if (pointToTest.Within(feature.Geometry) || pointToTest.Touches(feature.Geometry) || pointToTest.Intersects(feature.Geometry)) + { + yield return feature; + } + } +*/ + + return repository + .Query(pointToTest) + .Where(feature => + pointToTest.Within(feature.Geometry) || + pointToTest.Touches(feature.Geometry) || + pointToTest.Intersects(feature.Geometry)); + } + + public static Func GetCoverageFunc(this IFeatureRepository repository) + { + return GetCoverageFunc(repository, repository.SupportedAttributes); + } + + public static Func GetCoverageFunc(this IFeatureRepository repository, string attributeName) + { + return GetCoverageFunc(repository, attributeName, repository.SupportedAttributes); + } + + public static Func GetCoverageFunc(this IFeatureRepository repository, string attributeName, + IEnumerable supportedAttributeNames) + { + Func func = GetCoverageFunc(repository, supportedAttributeNames); + return (x, y) => func(attributeName, x, y); + } + + public static Func GetCoverageFunc(IFeatureRepository repository, + IEnumerable supportedAttributeNames) + { + if (repository == null) + { + throw new ArgumentNullException("repository"); + } + + if (supportedAttributeNames == null) + { + throw new ArgumentNullException("supportedAttributeNames"); + } + + if (!supportedAttributeNames.Any()) + { + throw new ArgumentException("The supported attribute list should at least contain one attribute", + "supportedAttributeNames"); + } + + int index = 0; + foreach (string attributeName in supportedAttributeNames) + { + if (string.IsNullOrEmpty(attributeName)) + { + throw new ArgumentException(string.Format("An invalid attribute found at index {0}", index)); + } + index++; + } + + IEnumerable supportedAttributes = supportedAttributeNames.Select(a => a.ToLowerInvariant()); + + return (attributeName, x, y) => + { + if (string.IsNullOrEmpty(attributeName)) + { + throw new ArgumentNullException("attributeName"); + } + + string attrName = attributeName.ToLowerInvariant(); + if (!supportedAttributes.Contains(attrName)) + { + throw new AttributeMissingException(attributeName); + } + + IEnumerable matches = GetFeaturesCovering(repository, x, y); + + if (!matches.Any()) + { + throw new FeatureCoverageException(string.Format("No geometries found covering point ({0} {1})", x, y)); + } + + if (matches.Count() > 1) + { + throw new FeatureCoverageException(string.Format("Multiple geometries found covering point ({0} {1})", x, y)); + } + + return matches.First().Attributes[attrName]; + }; + } + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/Test/TestData/Gemeenten.qix =================================================================== diff -u Binary files differ Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/Test/TestData/Gemeenten.sbx =================================================================== diff -u Binary files differ Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Location.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Location.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Location.cs (revision 3305) @@ -0,0 +1,2393 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU 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.Globalization; +using System.IO; +using System.Linq; +using System.Xml.Serialization; +using Deltares.Dam.Data.Sensors; +using Deltares.Geographic; +using Deltares.Geometry; +using Deltares.Geotechnics.Converter; +using Deltares.Geotechnics.Soils; +using Deltares.Geotechnics.SurfaceLines; +using Deltares.Geotechnics.Validation; +using Deltares.Soilbase; +using Deltares.Standard; +using Deltares.Standard.Attributes; +using Deltares.Standard.EventPublisher; +using Deltares.Standard.Language; +using Deltares.Standard.Units; +using Deltares.Standard.Validation; + +namespace Deltares.Dam.Data +{ + internal static class LocationParameterNames + { + public const string DikeRingId = "DikeRingId"; + public const string Description = "Description"; + public const string XRd = "XRd"; + public const string YRd = "YRd"; + public const string SegmentId = "SegmentId"; + public const string SurfaceLineId = "SurfaceLineId"; + public const string PL1LineId = "PL1LineId"; + public const string XSoilGeometry2DOrigin = "XSoilGeometry2DOrigin"; + public const string DikeEmbankmentMaterial = "DikeEmbankmentMaterial"; + public const string ShoulderEmbankmentMaterial = "ShoulderEmbankmentMaterial"; + public const string DampingFactorPL3 = "DampingFactorPL3"; + public const string DampingFactorPL4 = "DampingFactorPL4"; + public const string PenetrationLength = "PenetrationLength"; + public const string TrafficLoad = "TrafficLoad"; + public const string TL_DegreeOfConsolidation = "TL_DegreeOfConsolidation"; + public const string PLLineCreationMethod = "PLLineCreationMethod"; + public const string StabilityShoulderGrowSlope = "StabilityShoulderGrowSlope"; + public const string StabilityShoulderGrowDeltaX = "StabilityShoulderGrowDeltaX"; + public const string StabilitySlopeAdaptionDeltaX = "StabilitySlopeAdaptionDeltaX"; + public const string MinimalCircleDepth = "MinimalCircleDepth"; + public const string DistanceToEntryPoint = "DistanceToEntryPoint"; + public const string StabilityZoneType = "StabilityZoneType"; + public const string ForbiddenZoneFactor = "ForbiddenZoneFactor"; + public const string ZoneAreaRestSlopeCrestWidth = "ZoneAreaRestSlopeCrestWidth"; + public const string StabilityDesignMethod = "StabilityDesignMethod"; + public const string SlopeAdaptionStartCotangent = "SlopeAdaptionStartCotangent"; + public const string SlopeAdaptionEndCotangent = "SlopeAdaptionEndCotangent"; + public const string SlopeAdaptionStepCotangent = "SlopeAdaptionStepCotangent"; + public const string SlopeDampingPiezometricHeightPolderSide = "SlopeDampingPiezometricHeightPolderSide"; + public const string NewDepthDitch = "NewDepthDitch"; + public const string NewDikeSlopeInside = "NewDikeSlopeInside"; + public const string NewDikeSlopeOutside = "NewDikeSlopeOutside"; + public const string NewDikeTopWidth = "NewDikeTopWidth"; + public const string NewMaxHeightShoulderAsFraction = "NewMaxHeightShoulderAsFraction"; + public const string NewMinDistanceDikeToeStartDitch = "NewMinDistanceDikeToeStartDitch"; + public const string NewShoulderBaseSlope = "NewShoulderBaseSlope"; + public const string NewShoulderTopSlope = "NewShoulderTopSlope"; + public const string NewSlopeAngleDitch = "NewSlopeAngleDitch"; + public const string NewWidthDitchBottom = "NewWidthDitchBottom"; + public const string UseNewDikeSlopeInside = "UseNewDikeSlopeInside"; + public const string UseNewDikeSlopeOutside = "UseNewDikeSlopeOutside"; + public const string UseNewDikeTopWidth = "UseNewDikeTopWidth"; + public const string UseNewDitchDefinition = "UseNewDitchDefinition"; + public const string UseNewMaxHeightShoulderAsFraction = "UseNewMaxHeightShoulderAsFraction"; + public const string UseNewMinDistanceDikeToeStartDitch = "UseNewMinDistanceDikeToeStartDitch"; + public const string UseNewShoulderBaseSlope = "UseNewShoulderBaseSlope"; + public const string UseNewShoulderTopSlope = "UseNewShoulderTopSlope"; + public const string IntrusionVerticalWaterPressure = "IntrusionVerticalWaterPressure"; + } + + [TrackChanges] + public class Location : IVisibleEnabled, IGeographicPoint, IRepairer, IDomain, IDisposable + { + // Added initial value as these properties must be tested for real values on import + public const string AllCategory = "MainItems"; + public const string DikeCategory = "Dike"; + public const string WaterCategory = "Water levels"; + public const string DesignCategory = "Design"; + private const double newDikeTopWidthMinValue = 0.1; + private const double newDikeSlopeInsideMinValue = 0.01; + private const double newDikeSlopeOutsideMinValue = 0.01; + private const double penetrationLenghtMinValue = 0.00; + private static DamProjectType damProjectType = DamProjectType.Calamity; + private readonly List scenarios = new List(); + private bool areLocalXZObjectsCreated = false; + + // ATTENTION !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + // + // When adding properties below do not forget to add these properties to SetParameterFromNameValuePair and GetParametersAsNameValuePairs + // + // ATTENTION !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + private double dampingFactorPL3 = 0; + private double dampingFactorPL4 = 0; + private string description = ""; + private string dikeEmbankmentMaterial = ""; + private string dikeRingId = ""; + private double distanceToEntryPoint = 0; + private double forbiddenZoneFactor = 1.0; + private IList gaugePLLines = new List(); + private IList gauges = new List(); + // Start of parameters that are also defined in modelparameters + private PL1Line localXZPL1Line; + private SurfaceLine2 localXzSurfaceLine; + private string mapForSoilGeometries2D = ""; + private double minimalCircleDepth = 0; + private string name = ""; + private double newDepthDitch = 1.0; + private double newDikeSlopeInside = 1.0/3.0; // as tangent + private double newDikeSlopeOutside = 1.0/3.0; // as tangent + private double newDikeTopWidth = 5.0; + private double newMaxHeightShoulderAsFraction = 2.0/3.0; // as tangent + private double newMinDistanceDikeToeStartDitch = 5.0; + private double newShoulderBaseSlope = 1.0/3.0; // as tangent + private double newShoulderTopSlope = 1.0/20.0; // as tangent + private double newSlopeAngleDitch = 1.0/0.5; // as tangent + private double newWidthDitchBottom = 1.0; + private PL1Line pL1Line; + private PLLineCreationMethod pLLineCreationMethod = PLLineCreationMethod.ExpertKnowledgeRRD; + private double penetrationLength = 0; + private bool redesignDikeHeight = true; + private bool redesignDikeShoulder = true; + private Segment segment; + private SensorLocation sensorLocation; + private string shoulderEmbankmentMaterial = ""; + private double slopeAdaptionEndCotangent = 6.0; + private double slopeAdaptionStartCotangent = 3.0; + private double slopeAdaptionStepCotangent = 0.5; + private double slopeDampingPiezometricHeightPolderSide = 0.0; + private SoilSurfaceProfile soilSurfaceProfile = null; + private string soildatabaseName = ""; + private StabilityDesignMethod stabilityDesignMethod = StabilityDesignMethod.OptimizedSlopeAndShoulderAdaption; + private double stabilityShoulderGrowDeltaX = 2.0; + private double stabilityShoulderGrowSlope = 1.0/3; + private double stabilitySlopeAdaptionDeltaX = 2.0; + private MStabZonesType stabilityZoneType = MStabZonesType.NoZones; + + private SurfaceLine2 surfaceLine2; + private string surfaceLineId = ""; + private double trafficLoad = 0; + private double? degreeOfConsolidation; + private bool useNewDikeSlopeInside; + private bool useNewDikeSlopeOutside; + private bool useNewDikeTopWidth; + private bool useNewDitchDefinition; + private bool useNewMaxHeightShoulderAsFraction; + private bool useNewMinDistanceDikeToeStartDitch; + private bool useNewShoulderBaseSlope; + private bool useNewShoulderTopSlope; + private double xRdDikeLine; + private double xSoilGeometry2DOrigin = 0; + private double xrd = 0; + private double yrd = 0; + private double zoneAreaRestSlopeCrestWidth = 3.0; + + private IntrusionVerticalWaterPressureType? intrusionVerticalWaterPressure = IntrusionVerticalWaterPressureType.Standard; + + public Location() + { + SoilList = null; + } + + /// + /// Initializes a new instance of the class. + /// + /// The name. + public Location(string name) : this() + { + this.name = name; + } + + public bool HasSensorData + { + get + { + return sensorLocation != null; + } + } + + [Browsable(false)] + [XmlOldName("SensorData")] + public virtual SensorLocation SensorLocation + { + get + { + return sensorLocation; + } + set + { + sensorLocation = value; + sensorLocation.Location = this; + } + } + + [Browsable(false)] + public virtual bool AreLocalXZObjectsCreated + { + get + { + return areLocalXZObjectsCreated; + } + set + { + DataEventPublisher.BeforeChange(this, "AreLocalXZObjectsCreated"); + areLocalXZObjectsCreated = value; + DataEventPublisher.AfterChange(this, "AreLocalXZObjectsCreated"); + } + } + + [Label("Name")] + [PropertyOrder(0, 1)] + [ReadOnly(true)] + [Category(AllCategory)] + public virtual string Name + { + get + { + return name; + } + set + { + DataEventPublisher.BeforeChange(this, "Name"); + name = value; + DataEventPublisher.AfterChange(this, "Name"); + } + } + + [Label("Description")] + [Category(DikeCategory)] + [PropertyOrder(1, 10)] + public virtual string Description + { + get + { + return description; + } + set + { + DataEventPublisher.BeforeChange(this, "Description"); + description = value; + DataEventPublisher.AfterChange(this, "Description"); + } + } + + [Unit(UnitType.Length)] + [Label("X location (RDS)")] + [Description("Location according to Rijksdriehoekstelsel")] + [Format("F3")] + [ReadOnly(true)] + [PropertyOrder(1, 1)] + [Category(AllCategory)] + public virtual double XRd + { + get + { + return xrd; + } + set + { + DataEventPublisher.BeforeChange(this, "XRd"); + xrd = value; + DataEventPublisher.AfterChange(this, "XRd"); + } + } + + [Unit(UnitType.Length)] + [Label("Y location (RDS)")] + [Description("Location according to Rijksdriehoekstelsel")] + [Format("F3")] + [ReadOnly(true)] + [PropertyOrder(1, 1)] + [Category(AllCategory)] + public virtual double YRd + { + get + { + return yrd; + } + set + { + DataEventPublisher.BeforeChange(this, "YRd"); + yrd = value; + DataEventPublisher.AfterChange(this, "YRd"); + } + } + + public virtual double XRdDikeLine + { + get + { + return xRdDikeLine; + } + set + { + this.SetAndNotify2(out xRdDikeLine, value, x => x.XRdDikeLine); + } + } + + [Browsable(false)] + public virtual double XSoilGeometry2DOrigin + { + get + { + return xSoilGeometry2DOrigin; + } + set + { + DataEventPublisher.BeforeChange(this, "XSoilGeometry2DOrigin"); + xSoilGeometry2DOrigin = value; + DataEventPublisher.AfterChange(this, "XSoilGeometry2DOrigin"); + } + } + + [Unit(UnitType.PressurePerLength)] + [Label("Traffic load")] + [Description("Traffic load")] + [Format("F3")] + [Category(DikeCategory)] + [PropertyOrder(1, 20)] + public virtual double TrafficLoad + { + get + { + return trafficLoad; + } + set + { + DataEventPublisher.BeforeChange(this, "TrafficLoad"); + trafficLoad = value; + DataEventPublisher.AfterChange(this, "TrafficLoad"); + } + } + + [Unit(UnitType.Percentage)] + [Format("F3")] + [Category(DikeCategory)] + [PropertyOrder(1, 21)] + public virtual double? TL_DegreeOfConsolidation + { + get + { + return degreeOfConsolidation; + } + set + { + DataEventPublisher.BeforeChange(this, "TL_DegreeOfConsolidation"); + degreeOfConsolidation = value; + DataEventPublisher.AfterChange(this, "TL_DegreeOfConsolidation"); + } + } + + [Browsable(false)] + public virtual PL1Line PL1Line + { + get + { + return pL1Line; + } + set + { + DataEventPublisher.BeforeChange(this, "PL1Line"); + pL1Line = value; + DataEventPublisher.AfterChange(this, "PL1Line"); + } + } + + [Browsable(false)] + public virtual PL1Line LocalXZPL1Line + { + get + { + return localXZPL1Line; + } + set + { + DataEventPublisher.BeforeChange(this, "LocalXZPL1Line"); + localXZPL1Line = value; + DataEventPublisher.AfterChange(this, "LocalXZPL1Line"); + } + } + + /// + /// TODO + /// + /// Composite relationship. + [Validate] + public virtual SurfaceLine2 LocalXZSurfaceLine2 + { + get + { + return localXzSurfaceLine; + } + set + { + this.SetAndNotify2(out localXzSurfaceLine, value, l => l.LocalXZSurfaceLine2); + } + } + + /// + /// Gets or sets the Segment + /// + [PropertyOrder(1, 6)] + [Label("Segment")] + [Category(DikeCategory)] + [ReadOnly(true)] + public virtual string SegmentId { get; set; } + + /// + /// Gets or sets the Segment + /// + [Browsable(false)] + public virtual Segment Segment + { + get + { + return segment; + } + set + { + DataEventPublisher.BeforeChange(this, "Segment"); + segment = value; + DataEventPublisher.AfterChange(this, "Segment"); + } + } + + /// + /// Gets or sets the surface line + /// + [Browsable(false)] + public virtual SurfaceLine2 SurfaceLine2 + { + get + { + return surfaceLine2; + } + set + { + this.SetAndNotify2(out surfaceLine2, value, l => l.SurfaceLine2); + } + } + + /// + /// + /// + [Unit(UnitType.Length)] + [Label("Minimum circle depth")] + [Format("F2")] + [PropertyOrder(4, 4)] + [Minimum(0)] + [Maximum(10000)] + [Category(DikeCategory)] + public virtual double MinimalCircleDepth + { + get + { + return minimalCircleDepth; + } + set + { + DataEventPublisher.BeforeChange(this, "MinimalCircleDepth"); + minimalCircleDepth = value; + DataEventPublisher.AfterChange(this, "MinimalCircleDepth"); + } + } + + [Unit(UnitType.Length)] + [Label("Distance to Entrypoint")] + [Description("Distance from toe of dike to entry point of river in deep sandlayer")] + [Format("F2")] + [PropertyOrder(2, 12)] + public virtual double DistanceToEntryPoint + { + get + { + return distanceToEntryPoint; + } + set + { + DataEventPublisher.BeforeChange(this, "DistanceToEntryPoint"); + distanceToEntryPoint = value; + DataEventPublisher.AfterChange(this, "DistanceToEntryPoint"); + } + } + + [Label("Slope damping factor")] + [Description("The tangent of the slope damping for piezometric height polderSide (for PL3 and PL4)")] + [Format("F3")] + [Category(WaterCategory)] + [PropertyOrder(2, 14)] + public virtual double SlopeDampingPiezometricHeightPolderSide + { + get + { + return slopeDampingPiezometricHeightPolderSide; + } + set + { + DataEventPublisher.BeforeChange(this, "SlopeDampingPiezometricHeightPolderSide"); + slopeDampingPiezometricHeightPolderSide = value; + DataEventPublisher.AfterChange(this, "SlopeDampingPiezometricHeightPolderSide"); + } + } + + [Label("Dike")] + [ReadOnly(true)] + [Category(DikeCategory)] + [PropertyOrder(1, 4)] + public string DikeRingId + { + get + { + return dikeRingId; + } + set + { + dikeRingId = value; + } + } + + [Browsable(false)] + public string SurfaceLineId + { + get + { + return surfaceLineId; + } + set + { + surfaceLineId = value; + } + } + + [Browsable(false)] + public string SoildatabaseName + { + get + { + return soildatabaseName; + } + set + { + soildatabaseName = value; + } + } + + [Browsable(false)] + public SoilList SoilList { get; set; } + + [Browsable(false)] + [XmlIgnore] + public SoilbaseDB SoilbaseDB + { + get + { + if (SoildatabaseName == null || !File.Exists(SoildatabaseName)) + { + throw new DikeException(String.Format("The soil database '{0}' cannot be found", SoildatabaseName)); + } + return SoilbaseDB.Create(SoildatabaseName); + } + } + + [Browsable(false)] + public string MapForSoilGeometries2D + { + get + { + return mapForSoilGeometries2D; + } + set + { + mapForSoilGeometries2D = value; + } + } + + [Browsable(false)] + public virtual IList Gauges + { + get + { + return gauges; + } + set + { + gauges = value; + } + } + + [Browsable(false)] + public virtual IList GaugePLLines + { + get + { + return gaugePLLines; + } + set + { + gaugePLLines = value; + } + } + + [Browsable(false)] + public bool UsesGauges + { + get + { + return GaugePLLines != null && GaugePLLines.Count > 0 && Gauges != null; + } + } + + [Browsable(false)] + public double GaugeMissVal { get; set; } + + [Label("Redesign dike height")] + [PropertyOrder(7, 1)] + [Category(DesignCategory)] + public bool RedesignDikeHeight + { + get + { + return redesignDikeHeight; + } + set + { + DataEventPublisher.BeforeChange(this, "RedesignDikeHeight"); + redesignDikeHeight = value; + DataEventPublisher.AfterChange(this, "RedesignDikeHeight"); + } + } + + [Label("Redesign dike shoulder")] + [PropertyOrder(7, 2)] + [Category(DesignCategory)] + public bool RedesignDikeShoulder + { + get + { + return redesignDikeShoulder; + } + set + { + DataEventPublisher.BeforeChange(this, "RedesignDikeShoulder"); + redesignDikeShoulder = value; + DataEventPublisher.AfterChange(this, "RedesignDikeShoulder"); + } + } + + [Label("Stability design method")] + [PropertyOrder(7, 3)] + [Category(DesignCategory)] + public StabilityDesignMethod StabilityDesignMethod + { + get + { + return stabilityDesignMethod; + } + set + { + DataEventPublisher.BeforeChange(this, "StabilityDesignMethod"); + stabilityDesignMethod = value; + DataEventPublisher.AfterChange(this, "StabilityDesignMethod"); + } + } + + [Label("Start value for design of slope")] + [PropertyOrder(7, 4)] + [Format("F2")] + [Category(DesignCategory)] + public double SlopeAdaptionStartCotangent + { + get + { + return slopeAdaptionStartCotangent; + } + set + { + DataEventPublisher.BeforeChange(this, "SlopeAdaptionStartCotangent"); + slopeAdaptionStartCotangent = value; + DataEventPublisher.AfterChange(this, "SlopeAdaptionStartCotangent"); + } + } + + [Label("End value for design of slope")] + [PropertyOrder(7, 5)] + [Format("F2")] + [Category(DesignCategory)] + public double SlopeAdaptionEndCotangent + { + get + { + return slopeAdaptionEndCotangent; + } + set + { + DataEventPublisher.BeforeChange(this, "SlopeAdaptionEndCotangent"); + slopeAdaptionEndCotangent = value; + DataEventPublisher.AfterChange(this, "SlopeAdaptionEndCotangent"); + } + } + + [Label("Step value for design of slope")] + [PropertyOrder(7, 6)] + [Format("F2")] + [Category(DesignCategory)] + public double SlopeAdaptionStepCotangent + { + get + { + return slopeAdaptionStepCotangent; + } + set + { + DataEventPublisher.BeforeChange(this, "SlopeAdaptionStepCotangent"); + slopeAdaptionStepCotangent = value; + DataEventPublisher.AfterChange(this, "SlopeAdaptionStepCotangent"); + } + } + + [Description("Use the value for new width of dike top")] + [PropertyOrder(7, 7)] + [Format("F2")] + [Category(DesignCategory)] + public bool UseNewDikeTopWidth + { + get + { + return useNewDikeTopWidth; + } + set + { + DataEventPublisher.BeforeChange(this, "UseNewDikeTopWidth"); + useNewDikeTopWidth = value; + DataEventPublisher.AfterChange(this, "UseNewDikeTopWidth"); + } + } + + [Description("Value for new width of dike top")] + [PropertyOrder(7, 8)] + [Format("F2")] + [Category(DesignCategory)] + public double NewDikeTopWidth + { + get + { + return newDikeTopWidth; + } + set + { + DataEventPublisher.BeforeChange(this, "NewDikeTopWidth"); + newDikeTopWidth = value; + DataEventPublisher.AfterChange(this, "NewDikeTopWidth"); + } + } + + [Description("Use the value for new angle of the inside slope")] + [PropertyOrder(7, 9)] + [Format("F2")] + [Category(DesignCategory)] + public bool UseNewDikeSlopeInside + { + get + { + return useNewDikeSlopeInside; + } + set + { + DataEventPublisher.BeforeChange(this, "UseNewDikeSlopeInside"); + useNewDikeSlopeInside = value; + DataEventPublisher.AfterChange(this, "UseNewDikeSlopeInside"); + } + } + + [Description("Value for new angle of the inside slope")] + [PropertyOrder(7, 10)] + [Format("F2")] + [Category(DesignCategory)] + public double NewDikeSlopeInside + { + get + { + return newDikeSlopeInside; + } + set + { + DataEventPublisher.BeforeChange(this, "NewDikeSlopeInside"); + newDikeSlopeInside = value; + DataEventPublisher.AfterChange(this, "NewDikeSlopeInside"); + } + } + + [Description("Use the value for new angle of the outside slope")] + [PropertyOrder(7, 11)] + [Format("F2")] + [Category(DesignCategory)] + public bool UseNewDikeSlopeOutside + { + get + { + return useNewDikeSlopeOutside; + } + set + { + DataEventPublisher.BeforeChange(this, "UseNewDikeSlopeOutside"); + useNewDikeSlopeOutside = value; + DataEventPublisher.AfterChange(this, "UseNewDikeSlopeOutside"); + } + } + + [Description("Value for new angle of the outside slope")] + [PropertyOrder(7, 12)] + [Format("F2")] + [Category(DesignCategory)] + public double NewDikeSlopeOutside + { + get + { + return newDikeSlopeOutside; + } + set + { + DataEventPublisher.BeforeChange(this, "NewDikeSlopeOutside"); + newDikeSlopeOutside = value; + DataEventPublisher.AfterChange(this, "NewDikeSlopeOutside"); + } + } + + [Description("Use the value for new angle of the top slope of shoulder")] + [PropertyOrder(7, 13)] + [Format("F2")] + [Category(DesignCategory)] + public bool UseNewShoulderTopSlope + { + get + { + return useNewShoulderTopSlope; + } + set + { + DataEventPublisher.BeforeChange(this, "UseNewShoulderTopSlope"); + useNewShoulderTopSlope = value; + DataEventPublisher.AfterChange(this, "UseNewShoulderTopSlope"); + } + } + + [Description("Value for new angle of the top slope of shoulder")] + [PropertyOrder(7, 14)] + [Format("F2")] + [Category(DesignCategory)] + public double NewShoulderTopSlope + { + get + { + return newShoulderTopSlope; + } + set + { + DataEventPublisher.BeforeChange(this, "NewShoulderTopSlope"); + newShoulderTopSlope = value; + DataEventPublisher.AfterChange(this, "NewShoulderTopSlope"); + } + } + + [Description("Use the value for new angle of the base slope of shoulder")] + [PropertyOrder(7, 15)] + [Format("F2")] + [Category(DesignCategory)] + public bool UseNewShoulderBaseSlope + { + get + { + return useNewShoulderBaseSlope; + } + set + { + DataEventPublisher.BeforeChange(this, "UseNewShoulderBaseSlope"); + useNewShoulderBaseSlope = value; + DataEventPublisher.AfterChange(this, "UseNewShoulderBaseSlope"); + } + } + + [Description("Value for new angle of the base slope of shoulder")] + [PropertyOrder(7, 16)] + [Format("F2")] + [Category(DesignCategory)] + public double NewShoulderBaseSlope + { + get + { + return newShoulderBaseSlope; + } + set + { + DataEventPublisher.BeforeChange(this, "NewShoulderBaseSlope"); + newShoulderBaseSlope = value; + DataEventPublisher.AfterChange(this, "NewShoulderBaseSlope"); + } + } + + [Label("Use the value for new allowed height of shoulder as fraction of dike height")] + [PropertyOrder(7, 17)] + [Format("F2")] + [Category(DesignCategory)] + public bool UseNewMaxHeightShoulderAsFraction + { + get + { + return useNewMaxHeightShoulderAsFraction; + } + set + { + DataEventPublisher.BeforeChange(this, "UseNewMaxHeightShoulderAsFraction"); + useNewMaxHeightShoulderAsFraction = value; + DataEventPublisher.AfterChange(this, "UseNewMaxHeightShoulderAsFraction"); + } + } + + [Description("Value for new allowed height of shoulder as fraction of dike height")] + [PropertyOrder(7, 18)] + [Format("F2")] + [Category(DesignCategory)] + public double NewMaxHeightShoulderAsFraction + { + get + { + return newMaxHeightShoulderAsFraction; + } + set + { + DataEventPublisher.BeforeChange(this, "NewMaxHeightShoulderAsFraction"); + newMaxHeightShoulderAsFraction = value; + DataEventPublisher.AfterChange(this, "NewMaxHeightShoulderAsFraction"); + } + } + + [Description("Use the value for new minimum distance dike toe - start ditch")] + [PropertyOrder(7, 19)] + [Format("F2")] + [Category(DesignCategory)] + public bool UseNewMinDistanceDikeToeStartDitch + { + get + { + return useNewMinDistanceDikeToeStartDitch; + } + set + { + DataEventPublisher.BeforeChange(this, "UseNewMinDistanceDikeToeStartDitch"); + useNewMinDistanceDikeToeStartDitch = value; + DataEventPublisher.AfterChange(this, "UseNewMinDistanceDikeToeStartDitch"); + } + } + + [Description("Value for new minimum distance dike toe - start ditch")] + [PropertyOrder(7, 20)] + [Format("F2")] + [Category(DesignCategory)] + public double NewMinDistanceDikeToeStartDitch + { + get + { + return newMinDistanceDikeToeStartDitch; + } + set + { + DataEventPublisher.BeforeChange(this, "NewMinDistanceDikeToeStartDitch"); + newMinDistanceDikeToeStartDitch = value; + DataEventPublisher.AfterChange(this, "NewMinDistanceDikeToeStartDitch"); + } + } + + [Description("Use the values for new ditch definition")] + [PropertyOrder(7, 21)] + [Format("F2")] + [Category(DesignCategory)] + public bool UseNewDitchDefinition + { + get + { + return useNewDitchDefinition; + } + set + { + DataEventPublisher.BeforeChange(this, "UseNewDitchDefinition"); + useNewDitchDefinition = value; + DataEventPublisher.AfterChange(this, "UseNewDitchDefinition"); + } + } + + [Description("Value for new width of ditch bottom")] + [PropertyOrder(7, 22)] + [Format("F2")] + [Category(DesignCategory)] + public double NewWidthDitchBottom + { + get + { + return newWidthDitchBottom; + } + set + { + DataEventPublisher.BeforeChange(this, "NewWidthDitchBottom"); + newWidthDitchBottom = value; + DataEventPublisher.AfterChange(this, "NewWidthDitchBottom"); + } + } + + [Description("Value for new angle of ditch slopes")] + [PropertyOrder(7, 23)] + [Format("F2")] + [Category(DesignCategory)] + public double NewSlopeAngleDitch + { + get + { + return newSlopeAngleDitch; + } + set + { + DataEventPublisher.BeforeChange(this, "newSlopeAngleDitch"); + newSlopeAngleDitch = value; + DataEventPublisher.AfterChange(this, "newSlopeAngleDitch"); + } + } + + [Description("Value for new depth of ditch bottom")] + [PropertyOrder(7, 24)] + [Format("F2")] + [Category(DesignCategory)] + public double NewDepthDitch + { + get + { + return newDepthDitch; + } + set + { + DataEventPublisher.BeforeChange(this, "NewDepthDitch"); + newDepthDitch = value; + DataEventPublisher.AfterChange(this, "NewDepthDitch"); + } + } + + [ReadOnly(true)] + [Validate] + public List Scenarios + { + get + { + return scenarios; + } + } + + [Browsable(false)] + [XmlIgnore] + public static DamProjectType DamProjectType + { + get + { + return damProjectType; + } + set + { + damProjectType = value; + } + } + + #region IGeographic Members + + [Label("Zone type")] + [Description("Type of zone to be used in stability calculations")] + [PropertyOrder(4, 10)] + [Category(AllCategory)] + public MStabZonesType StabilityZoneType + { + get + { + return stabilityZoneType; + } + set + { + DataEventPublisher.BeforeChange(this, "StabilityZoneType"); + stabilityZoneType = value; + DataEventPublisher.AfterChange(this, "StabilityZoneType"); + } + } + + [Label("Forbidden Zone Factor")] + [Description("Factor of zone to be used in stability calculations")] + [Format("F2")] + [Unit(UnitType.None)] + [Minimum(0.0)] + [Maximum(1.0)] + [PropertyOrder(4, 11)] + [Category(AllCategory)] + public double ForbiddenZoneFactor + { + get + { + return forbiddenZoneFactor; + } + set + { + DataEventPublisher.BeforeChange(this, "ForbiddenZoneFactor"); + forbiddenZoneFactor = value; + DataEventPublisher.AfterChange(this, "ForbiddenZoneFactor"); + } + } + + [Label("Zone Area Rest Slope Crest Width")] + [Description("Zone Area Rest Slope Crest Width")] + [Format("F2")] + [Unit(UnitType.Length)] + [Minimum(0.1)] + [PropertyOrder(4, 12)] + [Category(AllCategory)] + public double ZoneAreaRestSlopeCrestWidth + { + get + { + return zoneAreaRestSlopeCrestWidth; + } + set + { + DataEventPublisher.BeforeChange(this, "ZoneAreaRestSlopeCrestWidth"); + zoneAreaRestSlopeCrestWidth = value; + DataEventPublisher.AfterChange(this, "ZoneAreaRestSlopeCrestWidth"); + } + } + + [XmlIgnore] + [Browsable(false)] + public double X + { + get + { + return XRd; + } + set + { + XRd = value; + } + } + + [XmlIgnore] + [Browsable(false)] + public double Y + { + get + { + return YRd; + } + set + { + YRd = value; + } + } + + /// + /// Checks whether the required safety (stability inner slope) is given as that is needed to work with zone areas. + /// + /// + [Validate] + public ValidationResult[] IsRequiredSafetySetForZoneTypeArea() + { + if (stabilityZoneType == MStabZonesType.ZoneAreas) + { + // For design projects, the safetey must be defined per scenario, not per location + if (DamProjectType == DamProjectType.Design && scenarios != null && scenarios.Count > 0) + { + foreach (var scenario in scenarios) + { + if (scenario.RequiredSafetyFactorStabilityInnerSlope == null) + return new[] + { + new ValidationResult(ValidationResultType.Error, + LocalizationManager.GetTranslatedText(this, "NoRequiredSafetyForZonesScenario"), + scenario, "StabilityZoneType", "ZoneTypeSafety", null) + }; + } + } + } + return new ValidationResult[0]; + } + + [Validate] + public ValidationResult[] ValidateDikeEmbankmentMaterial() + { + if (DamProjectType == DamProjectType.Design && + DamProjectCalculationSpecification.SelectedAnalysisType == AnalysisType.AdaptGeometry && + !HasValidDikeEmbankmentMaterial()) + { + return new[] + { + new ValidationResult(ValidationResultType.Error, + LocalizationManager.GetTranslatedText(this, "NoDikeEmbankmentMaterial"), + this) + }; + } + else + { + return new ValidationResult[0]; + } + } + + [Validate] + public ValidationResult[] ValidateLocationNewDikeTopWidth() + { + if (DamProjectType == DamProjectType.Design) + { + if ((UseNewDikeTopWidth) && (NewDikeTopWidth < newDikeTopWidthMinValue)) + { + return new[] + { + new ValidationResult(ValidationResultType.Error, + String.Format(LocalizationManager.GetTranslatedText(this, "NewDikeTopWidthRangeError"), newDikeTopWidthMinValue), this, "NewDikeTopWidth", "AssignMinValue", this) + }; + } + } + return new ValidationResult[0]; + } + + [Validate] + public ValidationResult[] ValidateLocationNewDikeSlopeInside() + { + if (DamProjectType == DamProjectType.Design) + { + if ((UseNewDikeSlopeInside) && (NewDikeSlopeInside < newDikeSlopeInsideMinValue)) + { + return new[] + { + new ValidationResult(ValidationResultType.Error, + String.Format(LocalizationManager.GetTranslatedText(this, "NewDikeSlopeInsideRangeError"), newDikeSlopeInsideMinValue), this, "NewDikeSlopeInside", "AssignMinValue", this) + }; + } + } + return new ValidationResult[0]; + } + + + [Validate] + public ValidationResult[] ValidateLocationNewDikeSlopeOutside() + { + if (DamProjectType == DamProjectType.Design) + { + if ((UseNewDikeSlopeOutside) && (NewDikeSlopeOutside < newDikeSlopeOutsideMinValue)) + { + return new[] + { + new ValidationResult(ValidationResultType.Error, + String.Format(LocalizationManager.GetTranslatedText(this, "NewDikeSlopeOutsideRangeError"), newDikeSlopeOutsideMinValue), this, "NewDikeSlopeOutside", "AssignMinValue", this) + }; + } + } + return new ValidationResult[0]; + } + + /// + /// Validates the use of the penetration length. + /// + /// Validation result + [Validate] + public ValidationResult[] ValidateLocationUseOfPenetrationLength() + { + if (PenetrationLength > 0) + { + // It may be used on 1D geometries + if (!String.IsNullOrEmpty(this.Segment.GetMostProbableGeometry2DName(FailureMechanismSystemType.StabilityInside))) + { + // It may be used on 2D geometries only if condition below is true + if (this.IntrusionVerticalWaterPressure != IntrusionVerticalWaterPressureType.SemiTimeDependent) + { + return new[] + { + new ValidationResult(ValidationResultType.Error, String.Format(LocalizationManager.GetTranslatedText(this, "UseOfPenetrationLengthError"), penetrationLenghtMinValue), this, "PenetrationLength", "AssignMinValue", this) + }; + } + } + } + return new ValidationResult[0]; + } + + [Validate] + public ValidationResult[] ValidateShoulderEmbankmentMaterial() + { + if (DamProjectType == DamProjectType.Design && + DamProjectCalculationSpecification.SelectedAnalysisType == AnalysisType.AdaptGeometry && + !HasValidShoulderEmbankmentMaterial()) + { + return new[] + { + new ValidationResult(ValidationResultType.Error, LocalizationManager.GetTranslatedText(this, "NoShoulderEmbankmentMaterial"), this) + }; + } + else + { + return new ValidationResult[0]; + } + } + + /// + /// Validates the location has segment. + /// + /// + [Validate] + public ValidationResult[] ValidateLocationHasSegment() + { + if (Segment == null) + { + return new[] + { + new ValidationResult(ValidationResultType.Error, + LocalizationManager.GetTranslatedText(this, "LocationHasNoSegment"), + this) + }; + } + else + { + return new ValidationResult[0]; + } + } + + [Validate] + public ValidationResult[] ValidateDikeEmbankmentMaterialDefinedIfSurfacelineAboveSoilProfile() + { + if (IsSurfaceLineAboveSoilProfile() && !HasValidDikeEmbankmentMaterial()) + { + return new[] + { + new ValidationResult(ValidationResultType.Error, + LocalizationManager.GetTranslatedText(this, "NoDikeEmbankmentMaterialAndNeeded"), + this) + }; + } + else + { + return new ValidationResult[0]; + } + } + + /// + /// Check if DikeEmbankmentMaterial is defined and is available as soil + /// + /// + private bool HasValidDikeEmbankmentMaterial() + { + return !String.IsNullOrEmpty(DikeEmbankmentMaterial) && GetDikeEmbankmentSoil() != null; + } + + /// + /// Check if ShoulderEmbankmentMaterial is defined and is available as soil + /// + /// + private bool HasValidShoulderEmbankmentMaterial() + { + return !String.IsNullOrEmpty(ShoulderEmbankmentMaterial) && GetShoulderEmbankmentSoil() != null; + } + + /// + /// Determine if surfaceline is higher than any of the 1D soilprofiles + /// + /// + private bool IsSurfaceLineAboveSoilProfile() + { + bool isSurfaceLineAboveSoilProfile = false; + if (Segment != null) + { + foreach (var soilGeometryProbability in Segment.SoilProfileProbabilities) + { + SoilProfile1D soilProfile = soilGeometryProbability.SoilProfile; + if (soilProfile != null) + { + isSurfaceLineAboveSoilProfile = isSurfaceLineAboveSoilProfile || (LocalXZSurfaceLine2.Geometry.GetMaxZ() > soilGeometryProbability.SoilProfile.TopLevel); + } + } + } + return isSurfaceLineAboveSoilProfile; + } + + #endregion + + #region Design parameters + + [Label("Dike emb. material")] + [Description("Dike embankment material")] + [Category(AllCategory)] + [PropertyOrder(5, 1)] + public virtual string DikeEmbankmentMaterial + { + get + { + return dikeEmbankmentMaterial; + } + set + { + DataEventPublisher.BeforeChange(this, "DikeEmbankmentMaterial"); + dikeEmbankmentMaterial = value; + DataEventPublisher.AfterChange(this, "DikeEmbankmentMaterial"); + } + } + + [Label("Shoulder emb. material")] + [Description("Shoulder embankment material")] + [Category(DesignCategory)] + [PropertyOrder(5, 2)] + public virtual string ShoulderEmbankmentMaterial + { + get + { + return shoulderEmbankmentMaterial; + } + set + { + DataEventPublisher.BeforeChange(this, "ShoulderEmbankmentMaterial"); + shoulderEmbankmentMaterial = value; + DataEventPublisher.AfterChange(this, "ShoulderEmbankmentMaterial"); + } + } + + [Unit(UnitType.None)] + [Label("Shoulder growth slope")] + [Description("Shoulder growth slope for stability design")] + [Format("F4")] + [Category(DesignCategory)] + [PropertyOrder(5, 3)] + public virtual double StabilityShoulderGrowSlope + { + get + { + return stabilityShoulderGrowSlope; + } + set + { + DataEventPublisher.BeforeChange(this, "StabilityShoulderGrowSlope"); + stabilityShoulderGrowSlope = value; + DataEventPublisher.AfterChange(this, "StabilityShoulderGrowSlope"); + } + } + + [Unit(UnitType.Length)] + [Label("Shoulder growth delta X")] + [Description("Shoulder growth delta X for stability design")] + [Format("F2")] + [Category(DesignCategory)] + [PropertyOrder(5, 4)] + public virtual double StabilityShoulderGrowDeltaX + { + get + { + return stabilityShoulderGrowDeltaX; + } + set + { + DataEventPublisher.BeforeChange(this, "StabilityShoulderGrowDeltaX"); + stabilityShoulderGrowDeltaX = value + ; + DataEventPublisher.AfterChange(this, "StabilityShoulderGrowDeltaX"); + } + } + + [Unit(UnitType.Length)] + [Label("Slope adaption delta X")] + [Description("Slope adaption delta X for stability design")] + [Format("F2")] + [Category(DesignCategory)] + [PropertyOrder(5, 5)] + public virtual double StabilitySlopeAdaptionDeltaX + { + get + { + return stabilitySlopeAdaptionDeltaX; + } + set + { + DataEventPublisher.BeforeChange(this, "StabilitySlopeAdaptionDeltaX"); + stabilitySlopeAdaptionDeltaX = value; + DataEventPublisher.AfterChange(this, "StabilitySlopeAdaptionDeltaX"); + } + } + + #endregion + + #region PLLine creation parameters + + /// + /// Gets or sets the pl line creation method. + /// + /// + /// The pl line creation method. + /// + [Unit(UnitType.None)] + [Label("PL-Line creation")] + [Description("PL-Line creation method")] + [Format("F3")] + [Category(WaterCategory)] + [PropertyOrder(3, 1)] + public virtual PLLineCreationMethod PLLineCreationMethod + { + get + { + return pLLineCreationMethod; + } + set + { + DataEventPublisher.BeforeChange(this, "PLLineCreationMethod"); + pLLineCreationMethod = value; + DataEventPublisher.AfterChange(this, "PLLineCreationMethod"); + } + } + + /// + /// Gets or sets the damping factor pl 3. + /// + /// + /// The damping factor pl 3. + /// + [Unit(UnitType.None)] + [Label("Damping factor PL3")] + [Description("Damping factor PL3")] + [Format("F3")] + [Category(WaterCategory)] + [PropertyOrder(2, 11)] + [Minimum(0.0)] + [Maximum(1.0)] + public virtual double DampingFactorPL3 + { + get + { + return dampingFactorPL3; + } + set + { + DataEventPublisher.BeforeChange(this, "DampingFactorPL3"); + dampingFactorPL3 = value; + DataEventPublisher.AfterChange(this, "DampingFactorPL3"); + } + } + + /// + /// Gets or sets the damping factor pl 4. + /// + /// + /// The damping factor pl 4. + /// + [Unit(UnitType.None)] + [Label("Damping factor PL4")] + [Description("Damping factor PL4")] + [Format("F3")] + [Category(WaterCategory)] + [PropertyOrder(2, 12)] + [Minimum(0.0)] + [Maximum(1.0)] + public virtual double DampingFactorPL4 + { + get + { + return dampingFactorPL4; + } + set + { + DataEventPublisher.BeforeChange(this, "DampingFactorPL4"); + dampingFactorPL4 = value; + DataEventPublisher.AfterChange(this, "DampingFactorPL4"); + } + } + + /// + /// Gets or sets the length of the penetration. + /// + /// + /// The length of the penetration. + /// + [Unit(UnitType.Length)] + [Label("Penetration length")] + [Description("Penetration Length (for PL4)")] + [Format("F3")] + [Category(WaterCategory)] + [Minimum(0.0)] + [PropertyOrder(2, 13)] + public virtual double PenetrationLength + { + get + { + return penetrationLength; + } + set + { + DataEventPublisher.BeforeChange(this, "PenetrationLength"); + penetrationLength = value; + DataEventPublisher.AfterChange(this, "PenetrationLength"); + } + } + + /// + /// Gets or sets the intrusion vertical water pressure. + /// + /// + /// The intrusion vertical water pressure. + /// + [Category(WaterCategory)] + [PropertyOrder(3, 18)] + public IntrusionVerticalWaterPressureType? IntrusionVerticalWaterPressure + { + get { return intrusionVerticalWaterPressure; } + set + { + DataEventPublisher.BeforeChange(this, x => x.IntrusionVerticalWaterPressure); + intrusionVerticalWaterPressure = value; + DataEventPublisher.AfterChange(this, x => x.IntrusionVerticalWaterPressure); + } + } + #endregion + + /// + /// Sets the default values + /// + public void SetDefaultValues() + { + zoneAreaRestSlopeCrestWidth = 3.0; + } + + /// + /// Assemble a list of key/value pairs with the relevant parameters for the location + /// + /// + public Dictionary GetParametersAsNameValuePairs() + { + var numberFormatInfo = new NumberFormatInfo(); + numberFormatInfo.NumberDecimalSeparator = "."; + var nameValuePairs = new Dictionary(); + nameValuePairs.Add(LocationParameterNames.DikeRingId, DikeRingId); + nameValuePairs.Add(LocationParameterNames.SurfaceLineId, SurfaceLineId); + nameValuePairs.Add(LocationParameterNames.Description, Description); + nameValuePairs.Add(LocationParameterNames.XRd, XRd.ToString(numberFormatInfo)); + nameValuePairs.Add(LocationParameterNames.YRd, YRd.ToString(numberFormatInfo)); + if (Segment != null) + { + nameValuePairs.Add(LocationParameterNames.SegmentId, Segment.Name); + } + else + { + nameValuePairs.Add(LocationParameterNames.SegmentId, SegmentId); + } + if (SurfaceLine2 != null) + { + nameValuePairs[LocationParameterNames.SurfaceLineId] = SurfaceLine2.Name; + } + if (PL1Line != null) + { + nameValuePairs.Add(LocationParameterNames.PL1LineId, PL1Line.Name); + } + nameValuePairs.Add(LocationParameterNames.XSoilGeometry2DOrigin, XSoilGeometry2DOrigin.ToString(numberFormatInfo)); + nameValuePairs.Add(LocationParameterNames.DikeEmbankmentMaterial, DikeEmbankmentMaterial); + nameValuePairs.Add(LocationParameterNames.ShoulderEmbankmentMaterial, ShoulderEmbankmentMaterial); + nameValuePairs.Add(LocationParameterNames.DampingFactorPL3, DampingFactorPL3.ToString(numberFormatInfo)); + nameValuePairs.Add(LocationParameterNames.DampingFactorPL4, DampingFactorPL4.ToString(numberFormatInfo)); + nameValuePairs.Add(LocationParameterNames.PenetrationLength, PenetrationLength.ToString(numberFormatInfo)); + nameValuePairs.Add(LocationParameterNames.PLLineCreationMethod, PLLineCreationMethod.ToString()); + if (IntrusionVerticalWaterPressure.HasValue) + { + nameValuePairs.Add(LocationParameterNames.IntrusionVerticalWaterPressure, + IntrusionVerticalWaterPressure.Value.ToString()); + } + nameValuePairs.Add(LocationParameterNames.StabilityShoulderGrowSlope, StabilityShoulderGrowSlope.ToString(numberFormatInfo)); + nameValuePairs.Add(LocationParameterNames.StabilityShoulderGrowDeltaX, StabilityShoulderGrowDeltaX.ToString(numberFormatInfo)); + nameValuePairs.Add(LocationParameterNames.StabilitySlopeAdaptionDeltaX, StabilitySlopeAdaptionDeltaX.ToString(numberFormatInfo)); + nameValuePairs.Add(LocationParameterNames.TrafficLoad, TrafficLoad.ToString(numberFormatInfo)); + if (TL_DegreeOfConsolidation.HasValue) + { + nameValuePairs.Add(LocationParameterNames.TL_DegreeOfConsolidation, TL_DegreeOfConsolidation.Value.ToString(numberFormatInfo)); + } + nameValuePairs.Add(LocationParameterNames.MinimalCircleDepth, MinimalCircleDepth.ToString(numberFormatInfo)); + nameValuePairs.Add(LocationParameterNames.DistanceToEntryPoint, DistanceToEntryPoint.ToString(numberFormatInfo)); + nameValuePairs.Add(LocationParameterNames.StabilityZoneType, StabilityZoneType.ToString()); + nameValuePairs.Add(LocationParameterNames.ForbiddenZoneFactor, ForbiddenZoneFactor.ToString(numberFormatInfo)); + nameValuePairs.Add(LocationParameterNames.ZoneAreaRestSlopeCrestWidth, ZoneAreaRestSlopeCrestWidth.ToString(numberFormatInfo)); + + nameValuePairs.Add(LocationParameterNames.SlopeDampingPiezometricHeightPolderSide, SlopeDampingPiezometricHeightPolderSide.ToString(numberFormatInfo)); + + nameValuePairs.Add(LocationParameterNames.StabilityDesignMethod, StabilityDesignMethod.ToString()); + nameValuePairs.Add(LocationParameterNames.SlopeAdaptionStartCotangent, SlopeAdaptionStartCotangent.ToString(numberFormatInfo)); + nameValuePairs.Add(LocationParameterNames.SlopeAdaptionEndCotangent, SlopeAdaptionEndCotangent.ToString(numberFormatInfo)); + nameValuePairs.Add(LocationParameterNames.SlopeAdaptionStepCotangent, SlopeAdaptionStepCotangent.ToString(numberFormatInfo)); + nameValuePairs.Add(LocationParameterNames.NewDepthDitch, NewDepthDitch.ToString(numberFormatInfo)); + nameValuePairs.Add(LocationParameterNames.NewDikeSlopeInside, NewDikeSlopeInside.ToString(numberFormatInfo)); + nameValuePairs.Add(LocationParameterNames.NewDikeSlopeOutside, NewDikeSlopeOutside.ToString(numberFormatInfo)); + nameValuePairs.Add(LocationParameterNames.NewDikeTopWidth, NewDikeTopWidth.ToString(numberFormatInfo)); + nameValuePairs.Add(LocationParameterNames.NewMaxHeightShoulderAsFraction, NewMaxHeightShoulderAsFraction.ToString(numberFormatInfo)); + nameValuePairs.Add(LocationParameterNames.NewMinDistanceDikeToeStartDitch, NewMinDistanceDikeToeStartDitch.ToString(numberFormatInfo)); + nameValuePairs.Add(LocationParameterNames.NewShoulderBaseSlope, NewShoulderBaseSlope.ToString(numberFormatInfo)); + nameValuePairs.Add(LocationParameterNames.NewShoulderTopSlope, NewShoulderTopSlope.ToString(numberFormatInfo)); + nameValuePairs.Add(LocationParameterNames.NewSlopeAngleDitch, NewSlopeAngleDitch.ToString(numberFormatInfo)); + nameValuePairs.Add(LocationParameterNames.NewWidthDitchBottom, NewWidthDitchBottom.ToString(numberFormatInfo)); + nameValuePairs.Add(LocationParameterNames.UseNewDikeSlopeInside, UseNewDikeSlopeInside.ToString()); + nameValuePairs.Add(LocationParameterNames.UseNewDikeSlopeOutside, UseNewDikeSlopeOutside.ToString()); + nameValuePairs.Add(LocationParameterNames.UseNewDikeTopWidth, UseNewDikeTopWidth.ToString()); + nameValuePairs.Add(LocationParameterNames.UseNewDitchDefinition, UseNewDitchDefinition.ToString()); + nameValuePairs.Add(LocationParameterNames.UseNewMaxHeightShoulderAsFraction, UseNewMaxHeightShoulderAsFraction.ToString()); + nameValuePairs.Add(LocationParameterNames.UseNewMinDistanceDikeToeStartDitch, UseNewMinDistanceDikeToeStartDitch.ToString()); + nameValuePairs.Add(LocationParameterNames.UseNewShoulderBaseSlope, UseNewShoulderBaseSlope.ToString()); + nameValuePairs.Add(LocationParameterNames.UseNewShoulderTopSlope, UseNewShoulderTopSlope.ToString()); + return nameValuePairs; + } + + public void AddNewSensorData() + { + var factory = new SensorFactory(); + SensorLocation = factory.CreateSensorLocation(this); + } + + [Validate] + public ValidationResult[] AscendingLocalXZSurfaceLine() + { + if (LocalXZSurfaceLine2 != null) + { + return new SurfaceLine2Validator().ValidateCharacteristicPointsAreOrdered(LocalXZSurfaceLine2).ToArray(); + } + else + { + return new ValidationResult[0]; + } + } + + /// + /// Gets the dike embankment soil. + /// + /// + public Soil GetDikeEmbankmentSoil() + { + if (String.IsNullOrEmpty(SoildatabaseName) || String.IsNullOrEmpty(DikeEmbankmentMaterial)) + { + return null; + } + else + { + return SoilList.GetSoilByName(DikeEmbankmentMaterial); + } + } + + /// + /// Gets the shoulder embankment soil. + /// + /// + public Soil GetShoulderEmbankmentSoil() + { + if (String.IsNullOrEmpty(SoildatabaseName) || String.IsNullOrEmpty(ShoulderEmbankmentMaterial)) + { + return null; + } + else + { + return SoilList.GetSoilByName(ShoulderEmbankmentMaterial); + } + } + + /// + /// Gets the most probable profile. If there are no elements in the it returns null + /// and leave the handling over to the caller + /// + /// The soil profile + public SoilProfile1D GetMostProbableProfile(FailureMechanismSystemType? segmentFailureMechanismType) + { + if (Segment == null) + { + throw new ArgumentNullException(String.Format(ThrowHelper.GetResourceString(StringResourceNames.LocationHasNoSegment), Name)); + } + + return Segment.GetMostProbableProfile(segmentFailureMechanismType); + } + + /// + /// Gets the most probable profile. If there are no elements in the it returns null + /// and leave the handling over to the caller + /// + /// The soil profile + public string GetMostProbableGeometry2DName(FailureMechanismSystemType? segmentFailureMechanismType) + { + if (Segment == null) + { + throw new ArgumentNullException(String.Format(ThrowHelper.GetResourceString(StringResourceNames.LocationHasNoSegment), Name)); + } + + return Segment.GetMostProbableGeometry2DName(segmentFailureMechanismType); + } + + /// + /// Gets the soil profile probability. + /// + /// The soil profile. + /// Type of the segment failure mechanism. + /// + /// + public double? GetSoilProfileProbability(SoilProfile1D soilProfile, FailureMechanismSystemType? segmentFailureMechanismType) + { + if (Segment == null) + { + throw new ArgumentNullException(String.Format(ThrowHelper.GetResourceString(StringResourceNames.LocationHasNoSegment), Name)); + } + + return Segment.GetSoilProfileProbability(soilProfile, segmentFailureMechanismType); + } + + /// + /// Gets the soil geometry2 d probability. + /// + /// Name of the soil geometry2 d. + /// Type of the segment failure mechanism. + /// + /// + public double? GetSoilGeometry2DProbability(string soilGeometry2DName, FailureMechanismSystemType? segmentFailureMechanismType) + { + if (Segment == null) + { + throw new ArgumentNullException(String.Format(ThrowHelper.GetResourceString(StringResourceNames.LocationHasNoSegment), Name)); + } + + return Segment.GetSoilGeometry2DProbability(soilGeometry2DName, segmentFailureMechanismType); + } + + /// + /// Gets a sorted list of soil geometry probabilities for a certain failure mechanism type + /// + /// The failure mechanism type + /// List of geometry probabilities + public List GetGeometryProbabilities(FailureMechanismSystemType failureMechanismType) + { + var geometryProbabilities = new List(); + if (Segment != null) + { + foreach (var existingGeometryProbability in Segment.SoilProfileProbabilities) + { + if (existingGeometryProbability.SegmentFailureMechanismType.HasValue && existingGeometryProbability.SegmentFailureMechanismType.Value == failureMechanismType) + { + geometryProbabilities.Add(existingGeometryProbability); + } + } + + geometryProbabilities.Sort(); + } + return geometryProbabilities; + } + + /// + /// Gets the combination of the surface line and soil profile for a given failure mechanism and index + /// + /// Failure mechanism type + /// The index indicates the ranking in probability + /// The probability of the soil surface profile + /// The soil surface profile + public SoilSurfaceProfile GetSoilSurfaceProfile(FailureMechanismSystemType failureMechanismType, int index, out double probability) + { + List soilGeometryProbabilities = GetGeometryProbabilities(failureMechanismType); + SoilGeometryProbability soilGeometryProbability = index < soilGeometryProbabilities.Count ? soilGeometryProbabilities[index] : null; + + SoilProfile1D originalProfile = soilGeometryProbability != null ? soilGeometryProbability.SoilProfile : null; + probability = soilGeometryProbability != null ? soilGeometryProbability.Probability : 0; + + if (soilSurfaceProfile == null || originalProfile == null || + !(soilSurfaceProfile.SoilProfile.Name == originalProfile.Name && + soilSurfaceProfile.SoilProfile.LayerCount == originalProfile.LayerCount) || + !(soilSurfaceProfile.SurfaceLine2.Name == LocalXZSurfaceLine2.Name && + soilSurfaceProfile.SurfaceLine2.CharacteristicPoints.Count == LocalXZSurfaceLine2.CharacteristicPoints.Count)) + { + Soil dikeSoil = SoilList.GetSoilByName(DikeEmbankmentMaterial); + + if (soilSurfaceProfile == null) + { + soilSurfaceProfile = new SoilSurfaceProfile(); + } + // Do not assign the orginal soilprofile, because it will be changed in the class SoilSurfaceProfile + SoilProfile1D soilProfile1D; + if (originalProfile == null) + { + soilProfile1D = new SoilProfile1D(SurfaceLine2.Geometry.GetMaxZ(), -10, dikeSoil); + } + else + { + soilProfile1D = new SoilProfile1D(); + soilProfile1D.Assign(originalProfile); + } + soilSurfaceProfile.SoilProfile = soilProfile1D; + soilSurfaceProfile.SurfaceLine2 = LocalXZSurfaceLine2; + soilSurfaceProfile.DikeEmbankmentMaterial = GetDikeEmbankmentSoil(); + + foreach (SoilLayer2D layer in soilSurfaceProfile.Surfaces) + { + if (layer.Soil == null) + { + layer.Soil = dikeSoil; + } + } + } + + return soilSurfaceProfile; + } + + public void AlignBoundaryPointsOfPL1LineWithAdaptedSurfaceLine(SurfaceLine2 adaptedSurfaceLine) + { + if ((LocalXZPL1Line != null) && (LocalXZPL1Line.Points.Count > 1)) + { + GeometryPoint lastPointPL1Line = LocalXZPL1Line.Points.Last(); + GeometryPoint lastPointSurfaceLine = adaptedSurfaceLine.Geometry.Points.Last(); + lastPointPL1Line.X = lastPointSurfaceLine.X; + GeometryPoint firstPointPL1Line = LocalXZPL1Line.Points.First(); + GeometryPoint firstPointSurfaceLine = adaptedSurfaceLine.Geometry.Points.First(); + firstPointPL1Line.X = firstPointSurfaceLine.X; + } + } + + public void SetParameterFromNameValuePair(string parameterName, string parameterValue) + { + var numberFormatInfo = new NumberFormatInfo(); + numberFormatInfo.NumberDecimalSeparator = "."; + if (parameterName.Equals(LocationParameterNames.DikeRingId)) + { + DikeRingId = parameterValue; + } + if (parameterName.Equals(LocationParameterNames.Description)) + { + Description = parameterValue; + } + if (parameterName.Equals(LocationParameterNames.XRd)) + { + XRd = Convert.ToDouble(parameterValue, numberFormatInfo); + } + if (parameterName.Equals(LocationParameterNames.YRd)) + { + YRd = Convert.ToDouble(parameterValue, numberFormatInfo); + } + if (parameterName.Equals(LocationParameterNames.SegmentId)) + { + SegmentId = parameterValue; + } + if (parameterName.Equals(LocationParameterNames.SurfaceLineId)) + { + SurfaceLineId = parameterValue; + } + if (parameterName.Equals(LocationParameterNames.XSoilGeometry2DOrigin)) + { + XSoilGeometry2DOrigin = Convert.ToDouble(parameterValue, numberFormatInfo); + } + if (parameterName.Equals(LocationParameterNames.DikeEmbankmentMaterial)) + { + DikeEmbankmentMaterial = parameterValue; + } + if (parameterName.Equals(LocationParameterNames.ShoulderEmbankmentMaterial)) + { + ShoulderEmbankmentMaterial = parameterValue; + } + if (parameterName.Equals(LocationParameterNames.DampingFactorPL3)) + { + DampingFactorPL3 = Convert.ToDouble(parameterValue, numberFormatInfo); + } + if (parameterName.Equals(LocationParameterNames.DampingFactorPL4)) + { + DampingFactorPL4 = Convert.ToDouble(parameterValue, numberFormatInfo); + } + if (parameterName.Equals(LocationParameterNames.PenetrationLength)) + { + PenetrationLength = Convert.ToDouble(parameterValue, numberFormatInfo); + } + if (parameterName.Equals(LocationParameterNames.PLLineCreationMethod)) + { + PLLineCreationMethod = (PLLineCreationMethod) Enum.Parse(typeof(PLLineCreationMethod), parameterValue); + } + if (parameterName.Equals(LocationParameterNames.IntrusionVerticalWaterPressure)) + { + IntrusionVerticalWaterPressure = + (IntrusionVerticalWaterPressureType) + Enum.Parse(typeof (IntrusionVerticalWaterPressureType), parameterValue); + + } + if (parameterName.Equals(LocationParameterNames.StabilityShoulderGrowSlope)) + { + StabilityShoulderGrowSlope = Convert.ToDouble(parameterValue, numberFormatInfo); + } + if (parameterName.Equals(LocationParameterNames.StabilityShoulderGrowDeltaX)) + { + StabilityShoulderGrowDeltaX = Convert.ToDouble(parameterValue, numberFormatInfo); + } + if (parameterName.Equals(LocationParameterNames.StabilitySlopeAdaptionDeltaX)) + { + StabilitySlopeAdaptionDeltaX = Convert.ToDouble(parameterValue, numberFormatInfo); + } + if (parameterName.Equals(LocationParameterNames.TrafficLoad)) + { + TrafficLoad = Convert.ToDouble(parameterValue, numberFormatInfo); + } + if (parameterName.Equals(LocationParameterNames.TL_DegreeOfConsolidation)) + { + TL_DegreeOfConsolidation = Convert.ToDouble(parameterValue, numberFormatInfo); + } + if (parameterName.Equals(LocationParameterNames.MinimalCircleDepth)) + { + MinimalCircleDepth = Convert.ToDouble(parameterValue, numberFormatInfo); + } + if (parameterName.Equals(LocationParameterNames.DistanceToEntryPoint)) + { + DistanceToEntryPoint = Convert.ToDouble(parameterValue, numberFormatInfo); + } + if (parameterName.Equals(LocationParameterNames.StabilityZoneType)) + { + StabilityZoneType = (MStabZonesType) Enum.Parse(typeof(MStabZonesType), parameterValue); + } + if (parameterName.Equals(LocationParameterNames.ForbiddenZoneFactor)) + { + ForbiddenZoneFactor = Convert.ToDouble(parameterValue, numberFormatInfo); + } + if (parameterName.Equals(LocationParameterNames.ZoneAreaRestSlopeCrestWidth)) + { + ZoneAreaRestSlopeCrestWidth = Convert.ToDouble(parameterValue, numberFormatInfo); + } + + if (parameterName.Equals(LocationParameterNames.SlopeDampingPiezometricHeightPolderSide)) + { + SlopeDampingPiezometricHeightPolderSide = Convert.ToDouble(parameterValue, numberFormatInfo); + } + + if (parameterName.Equals(LocationParameterNames.StabilityDesignMethod)) + { + StabilityDesignMethod = (StabilityDesignMethod) Enum.Parse(typeof(StabilityDesignMethod), parameterValue); + } + if (parameterName.Equals(LocationParameterNames.SlopeAdaptionStartCotangent)) + { + SlopeAdaptionStartCotangent = Convert.ToDouble(parameterValue, numberFormatInfo); + } + if (parameterName.Equals(LocationParameterNames.SlopeAdaptionEndCotangent)) + { + SlopeAdaptionEndCotangent = Convert.ToDouble(parameterValue, numberFormatInfo); + } + if (parameterName.Equals(LocationParameterNames.SlopeAdaptionStepCotangent)) + { + SlopeAdaptionStepCotangent = Convert.ToDouble(parameterValue, numberFormatInfo); + } + + if (parameterName.Equals(LocationParameterNames.NewDepthDitch)) + { + NewDepthDitch = Convert.ToDouble(parameterValue, numberFormatInfo); + } + if (parameterName.Equals(LocationParameterNames.NewDikeSlopeInside)) + { + NewDikeSlopeInside = Convert.ToDouble(parameterValue, numberFormatInfo); + } + if (parameterName.Equals(LocationParameterNames.NewDikeSlopeOutside)) + { + NewDikeSlopeOutside = Convert.ToDouble(parameterValue, numberFormatInfo); + } + if (parameterName.Equals(LocationParameterNames.NewDikeTopWidth)) + { + NewDikeTopWidth = Convert.ToDouble(parameterValue, numberFormatInfo); + } + if (parameterName.Equals(LocationParameterNames.NewMaxHeightShoulderAsFraction)) + { + NewMaxHeightShoulderAsFraction = Convert.ToDouble(parameterValue, numberFormatInfo); + } + if (parameterName.Equals(LocationParameterNames.NewMinDistanceDikeToeStartDitch)) + { + NewMinDistanceDikeToeStartDitch = Convert.ToDouble(parameterValue, numberFormatInfo); + } + if (parameterName.Equals(LocationParameterNames.NewShoulderBaseSlope)) + { + NewShoulderBaseSlope = Convert.ToDouble(parameterValue, numberFormatInfo); + } + if (parameterName.Equals(LocationParameterNames.NewShoulderTopSlope)) + { + NewShoulderTopSlope = Convert.ToDouble(parameterValue, numberFormatInfo); + } + if (parameterName.Equals(LocationParameterNames.NewSlopeAngleDitch)) + { + NewSlopeAngleDitch = Convert.ToDouble(parameterValue, numberFormatInfo); + } + if (parameterName.Equals(LocationParameterNames.NewWidthDitchBottom)) + { + NewWidthDitchBottom = Convert.ToDouble(parameterValue, numberFormatInfo); + } + if (parameterName.Equals(LocationParameterNames.UseNewDikeSlopeInside)) + { + UseNewDikeSlopeInside = Convert.ToBoolean(parameterValue, numberFormatInfo); + } + if (parameterName.Equals(LocationParameterNames.UseNewDikeSlopeOutside)) + { + UseNewDikeSlopeOutside = Convert.ToBoolean(parameterValue, numberFormatInfo); + } + if (parameterName.Equals(LocationParameterNames.UseNewDikeTopWidth)) + { + UseNewDikeTopWidth = Convert.ToBoolean(parameterValue, numberFormatInfo); + } + if (parameterName.Equals(LocationParameterNames.UseNewDitchDefinition)) + { + UseNewDitchDefinition = Convert.ToBoolean(parameterValue, numberFormatInfo); + } + if (parameterName.Equals(LocationParameterNames.UseNewMaxHeightShoulderAsFraction)) + { + UseNewMaxHeightShoulderAsFraction = Convert.ToBoolean(parameterValue, numberFormatInfo); + } + if (parameterName.Equals(LocationParameterNames.UseNewMinDistanceDikeToeStartDitch)) + { + UseNewMinDistanceDikeToeStartDitch = Convert.ToBoolean(parameterValue, numberFormatInfo); + } + if (parameterName.Equals(LocationParameterNames.UseNewShoulderBaseSlope)) + { + UseNewShoulderBaseSlope = Convert.ToBoolean(parameterValue, numberFormatInfo); + } + if (parameterName.Equals(LocationParameterNames.UseNewShoulderTopSlope)) + { + UseNewShoulderTopSlope = Convert.ToBoolean(parameterValue, numberFormatInfo); + } + } + + #region IVisibleEnabled Members + + public bool IsEnabled(string property) + { + return true; + } + + public bool IsVisible(string property) + { + var isDesign = IsDesign(); + + // TODO: These string literals below should be replaced with the constants defined in LocationParameterNames + switch (property) + { + case "ShoulderEmbankmentMaterial": + return isDesign; + case "StabilityShoulderGrowSlope": + return isDesign; + case "StabilityShoulderGrowDeltaX": + return isDesign; + case "StabilitySlopeAdaptionDeltaX": + return isDesign; + case "IntrusionVerticalWaterPressure": + return true; + case "RedesignDikeHeight": + return isDesign; + case "RedesignDikeShoulder": + return isDesign; + + // these will always be shown + case "StabilityDesignMethod": + return true; + case "SlopeAdaptionStartCotangent": + return true; + case "SlopeAdaptionEndCotangent": + return true; + case "SlopeAdaptionStepCotangent": + return true; + case "Name": + return true; + case "XRd": + return true; + case "YRd": + return true; + case "DikeRingId": + return true; + case "SegmentId": + return true; + case "Description": + return true; + case "TrafficLoad": + return true; + case "TL_DegreeOfConsolidation": + return true; + case "DampingFactorPL3": + return true; + case "DampingFactorPL4": + return true; + case "PenetrationLength": + return true; + case "SlopeDampingPiezometricHeightPolderSide": + return true; + case "PLLineCreationMethod": + return true; + case "MinimalCircleDepth": + return true; + case "StabilityZoneType": + return true; + case "DikeEmbankmentMaterial": + return true; + + case "DistanceToEntryPoint": + return isDesign; + case "HasSensorData": + return false; + case "XRdDikeLine": + return false; + // The following design parameters are only visible for design option and when that design option does not involve the special Rijnland option. + case "NewDikeTopWidth": + case "UseNewDikeTopWidth": + case "NewDikeSlopeInside": + case "UseNewDikeSlopeInside": + case "NewDikeSlopeOutside": + case "UseNewDikeSlopeOutside": + case "NewShoulderTopSlope": + case "UseNewShoulderTopSlope": + case "NewShoulderBaseSlope": + case "UseNewShoulderBaseSlope": + case "NewMaxHeightShoulderAsFraction": + case "UseNewMaxHeightShoulderAsFraction": + case "NewMinDistanceDikeToeStartDitch": + case "UseNewMinDistanceDikeToeStartDitch": + case "UseNewDitchDefinition": + case "NewWidthDitchBottom": + case "NewDepthDitch": + case "NewSlopeAngleDitch": + return isDesign && StabilityDesignMethod != StabilityDesignMethod.SlopeAdaptionBeforeShoulderAdaption; + default: + return true; + } + } + + private bool IsDesign() + { + bool isDesign = (DamProjectType == DamProjectType.Design); + return isDesign; + } + + private bool ArePlLineCreationExpertKnowledgeParametersNeeded() + { + bool arePlLineCreationExpertKnowledgeParametersNeeded = PLLineCreationMethod == + PLLineCreationMethod.ExpertKnowledgeRRD || + PLLineCreationMethod == + PLLineCreationMethod.GaugesWithFallbackToExpertKnowledgeRRD; + return arePlLineCreationExpertKnowledgeParametersNeeded; + } + + #endregion + + public override string ToString() + { + return Name; + } + + public void Dispose() + { + if (surfaceLine != null) + { + surfaceLine.Dispose(); + } + if (LocalXZSurfaceLine2 != null) + { + LocalXZSurfaceLine2.Dispose(); + } + } + + public ICollection GetDomain(string property) + { + switch (property) + { + case "PLLineCreationMethod": + return new[] + { + PLLineCreationMethod.ExpertKnowledgeRRD, + PLLineCreationMethod.ExpertKnowledgeLinearInDike, + }; + case "IntrusionVerticalWaterPressure": + return new[] + { + this.Translate("Standard"), + this.Translate("Linear"), + this.Translate("FullHydroStatic"), + this.Translate("HydroStatic"), + this.Translate("SemiTimeDependent") + }; + default: + return null; + } + } + + public void Repair(object subject, string property, string id) + { + if (subject is Location) + { + if (id == "AssignMinValue" && property == "NewDikeTopWidth") + { + NewDikeTopWidth = newDikeTopWidthMinValue; + } + if (id == "AssignMinValue" && property == "NewDikeSlopeInside") + { + NewDikeSlopeInside = newDikeSlopeInsideMinValue; + } + if (id == "AssignMinValue" && property == "NewDikeSlopeOutside") + { + NewDikeSlopeOutside = newDikeSlopeOutsideMinValue; + } + if (id == "AssignMinValue" && property == "PenetrationLength") + { + PenetrationLength = penetrationLenghtMinValue; + } + } + } + + public string GetRepairDescription(object subject, string property, string id) + { + if (id == "ZoneTypeSafety" && property == "StabilityZoneType") + { + return LocalizationManager.GetTranslatedText(this, "NoRequiredSafetyForZonesRepair"); + } + if (id == "AssignMinValue") + { + return LocalizationManager.GetTranslatedText(this, "AssignMinValue"); + } + if (id == "AssignMaxValue") + { + return LocalizationManager.GetTranslatedText(this, "AssignMaxValue"); + } + return ""; + } + + #region Backwards compatibility + + private SurfaceLine surfaceLine; + + [Obsolete("Do not use this property; Only exists for backwards compatibility.", true)] + [Browsable(false)] + public virtual SurfaceLine LocalXZSurfaceLine + { + get + { + return null; + } + set + { + // Convert persisted 'old style surfaceline' into the new format, and discard the old one. + LocalXZSurfaceLine2 = new OldSurfaceLineToNewConverter().Convert(value); + value.Dispose(); + } + } + + /// + /// Gets or sets the surface line + /// + /// Aggregate relationship from . + [Browsable(false)] + [Obsolete("Do not use this property; Exists only for backwards compatibility.", true)] + public virtual SurfaceLine SurfaceLine + { + get + { + return surfaceLine; + } + set + { + surfaceLine = value; + } + } + + /// + /// Allows this location instance to update its + /// property if an old-style surfaceline was persisted. + /// + /// The potential replacement candidate for a persisted + /// old-style surfaceline. + public void SetNewSurfaceLineIfMatchesWithOldPersistedSurfaceLine(SurfaceLine2 otherSurfaceline) + { + if (surfaceLine != null && Equals(otherSurfaceline.Name, surfaceLine.Name)) + { + SurfaceLine2 = otherSurfaceline; + + surfaceLine.Dispose(); + surfaceLine = null; + } + } + + #endregion + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/TimeSeriesProcessor.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/TimeSeriesProcessor.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/TimeSeriesProcessor.cs (revision 3305) @@ -0,0 +1,199 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU 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 Deltares.Standard.Application; + +namespace Deltares.Dam.Data +{ + public abstract class TimeSeriesProcessor + { + internal readonly static LogHelper Logger = LogHelper.Create("Time Series Processor"); + + #region Constants + + /// + /// Defines the default output file + /// + private const string DefaultOutputFileName = "output.xml"; + + /// e + /// Defines the water level location id used in the FEWS time serie + /// + public const string WaterLevelInputLocationID = "outside"; + + /// + /// Defines the parameter id of the water level defined in the FEWS time serie + /// + public const string WaterLevelInputParameterID = "Waterlevel"; + + /// + /// Defines the parameter id for water pressure used in the FEWS time serie + /// + public const string WaterPressureParameterID = "Waterpressure"; + + /// + /// Defines the sensor state missing value + /// + internal const double MissingValue = -999; + + #endregion + + public ICalculator Calculator { protected get; set; } + + /// + /// Gets or sets the output parameter ID. + /// + /// This name or ID is used in the output (FEWS) time series + /// + /// The output parameter ID. + /// + public IEnumerable OutputParameters { get; set; } + + /// + /// Sets the input time series, used in the calculations + /// + public TimeSerieCollection InputTimeSeriesCollection { protected get; set; } + + /// + /// Gets or sets the output location ID colletion used for creating the output time series + /// + public virtual IEnumerable OutputLocations { get; set; } + + /// + /// Gets or the output time series + /// + public TimeSerieCollection OutputTimeSeriesCollection { get; set; } + + /// + /// Resets the monitoring point list + /// + public virtual void Initialize() + { + if (OutputTimeSeriesCollection == null) + OutputTimeSeriesCollection = InputTimeSeriesCollection.GetShallowCopy(); + else + OutputTimeSeriesCollection.Clear(); + } + + /// + /// Loads the input time series. + /// + /// Name of the file. + public void LoadInputTimeSeries(string fileName) + { + ThrowHelper.ThrowIfFileNameNullOrEmpty(fileName); + try + { + // load the input time serie containing all water levels + InputTimeSeriesCollection = TimeSerieCollection.LoadFromFile(fileName); + } + catch (Exception e) + { + throw new InvalidOperationException("There was an error loading the input time series", e); + } + } + + /// + /// Saves the output time series to the specified file + /// + /// + /// The output file that will contain the monitored and calculated results for each time entry + public void SaveResultsToFile(string fileName) + { + if (OutputTimeSeriesCollection == null) + throw new InvalidOperationException("No output time series collection to write"); + + if (string.IsNullOrWhiteSpace(fileName)) + { + fileName = DefaultOutputFileName; + } + + // save the time serie to the output file + OutputTimeSeriesCollection.Save(fileName); + } + + /// + /// Processes the FEWS input time series files to ouput + /// time series + /// + public virtual void Process() + { + if (InputTimeSeriesCollection == null) + return; + + if (OutputTimeSeriesCollection == null) + throw new InvalidOperationException("No output time series set to write the results to"); + + if (OutputLocations == null) + throw new InvalidOperationException("No output locations set. Set or override OutputLocations"); + + if (OutputParameters == null) + throw new InvalidOperationException("No output parameters set. Set or override OutputParameters"); + + try + { + // Process the time series entries for each sensor and set the + // value in the output time series + CreateOutputSeries(); + } + catch (Exception e) + { + const string message = "There was an error processing the time series"; + Logger.LogFatal(message, e); + throw new InvalidOperationException(message, e); + } + } + + /// + /// Processes the actual input to the output collection. This is a template method which will + /// be called in the public ProcessSeries() method (if not overriden) + /// + protected virtual void CreateOutputSeries() + { + foreach (var timeSeries in InputTimeSeriesCollection.Series) + { + foreach (var location in OutputLocations) + { + foreach (var parameter in OutputParameters) + { + var copyOfSeries = timeSeries.GetShallowCopy(); + foreach (var entry in timeSeries.Entries) + { + // get copy of the input entry + var copyOfEntry = entry.GetShallowCopy(); + // calculate its value + copyOfEntry.Value = Calculator.Calculate(location, parameter) ?? MissingValue; + + // set parameter and location id's and add the projected entry to the output + copyOfSeries.LocationId = location; + copyOfSeries.ParameterId = parameter; + copyOfSeries.Entries.Add(copyOfEntry); + } + // add the output series to the output collection + OutputTimeSeriesCollection.Series.Add(copyOfSeries); + } + } + } + } + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Xsd/CalculationParametersDefinition.xsd =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Xsd/CalculationParametersDefinition.xsd (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Xsd/CalculationParametersDefinition.xsd (revision 3305) @@ -0,0 +1,78 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Scenario.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Scenario.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Scenario.cs (revision 3305) @@ -0,0 +1,1204 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU 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.ComponentModel; +using System.Globalization; +using Deltares.Standard; +using Deltares.Standard.EventPublisher; +using Deltares.Standard.Language; +using System.Collections.Generic; +using System; +using System.Collections.Specialized; +using System.Linq.Expressions; +using Deltares.Geotechnics.Soils; +using Deltares.Geotechnics.SurfaceLines; +using Deltares.Standard.Attributes; +using Deltares.Standard.Units; +using Deltares.Standard.Validation; + +namespace Deltares.Dam.Data +{ + + /// + /// Does uplift occur or not + /// + public struct UpliftSituation + { + public bool IsUplift; + public double Pl3MinUplift; + public double Pl3HeadAdjusted; + public double Pl3LocationXMinUplift; + public double Pl4MinUplift; + public double Pl4HeadAdjusted; + public double Pl4LocationXMinUplift; + } + + [Serializable] + public class ScenarioException : Exception + { + public ScenarioException(string message) : base(message) + { + } + } + + /// + /// Calculation scenario class + /// + public class Scenario : IVisibleEnabled, IRepairer + { + #region Performance optimization: Extract expression so it only has to be generated once. + + private static readonly Expression> ExpressionLocationScenarioId = x => x.LocationScenarioID; + private static readonly Expression> ExpressionRiverLevel = x => x.RiverLevel; + private static readonly Expression> ExpressionRiverLevelLow = x => x.RiverLevelLow; + private static readonly Expression> ExpressionDikeTableHeight = x => x.DikeTableHeight; + private static readonly Expression> ExpressionRequiredSafetyFactorStabilityInnerSlope = x => x.RequiredSafetyFactorStabilityInnerSlope; + private static readonly Expression> ExpressionRequiredSafetyFactorStabilityOuterSlope = x => x.RequiredSafetyFactorStabilityOuterSlope; + private static readonly Expression> ExpressionRequiredSafetyFactorPiping = x => x.RequiredSafetyFactorPiping; + private static readonly Expression> ExpressionUpliftCriterionPiping = x => x.UpliftCriterionPiping; + private static readonly Expression> ExpressionUpliftCriterionStability = x => x.UpliftCriterionStability; + private static readonly Expression> ExpressionPlLineOffsetBelowDikeTopAtRiver = x => x.PlLineOffsetBelowDikeTopAtRiver; + private static readonly Expression> ExpressionPlLineOffsetBelowDikeTopAtPolder = x => x.PlLineOffsetBelowDikeTopAtPolder; + private static readonly Expression> ExpressionPlLineOffsetBelowShoulderBaseInside = x => x.PlLineOffsetBelowShoulderBaseInside; + private static readonly Expression> ExpressionPlLineOffsetBelowDikeToeAtPolder = x => x.PlLineOffsetBelowDikeToeAtPolder; + private static readonly Expression> ExpressionUsePlLineOffsetBelowDikeCrestMiddle = x => x.UsePlLineOffsetBelowDikeCrestMiddle; + private static readonly Expression> ExpressionPlLineOffsetBelowDikeCrestMiddle = x => x.PlLineOffsetBelowDikeCrestMiddle; + private static readonly Expression> ExpressionUsePlLineOffsetFactorBelowShoulderCrest = x => x.UsePlLineOffsetFactorBelowShoulderCrest; + private static readonly Expression> ExpressionPlLineOffsetFactorBelowShoulderCrest = x => x.PlLineOffsetFactorBelowShoulderCrest; + private static readonly Expression> ExpressionHeadPl3 = x => x.HeadPl3; + private static readonly Expression> ExpressionHeadPl4 = x => x.HeadPl4; + private static readonly Expression> ExpressionPolderLevel = x => x.PolderLevel; + private static readonly Expression> ExpressionHeadPl2 = x => x.HeadPl2; + + #endregion + + private CalculationResult calculationResult = CalculationResult.NoRun; + private Location location = null; + private readonly List calculationResults = new List(); + + private Dictionary stabilityUpliftSituations; + private Dictionary pipingResults; + private Dictionary safetyFactorsPiping; + private Dictionary redesignedSurfaceLines; + private Dictionary resultMessages; + + private string locationScenarioId; + private double? riverLevel; + private double? riverLevelLow; + private double? dikeTableHeight; + private double plLineOffsetBelowDikeTopAtRiver = 0.5; + private double plLineOffsetBelowDikeTopAtPolder = 1.5; + private double plLineOffsetBelowShoulderBaseInside = 0.1; + private double plLineOffsetBelowDikeToeAtPolder = 0.1; + private bool? usePlLineOffsetBelowDikeCrestMiddle; + private double? plLineOffsetBelowDikeCrestMiddle; + private bool? usePlLineOffsetFactorBelowShoulderCrest; + private double? plLineOffsetFactorBelowShoulderCrest; + private double? headPl2; + private double? headPl3; + private double? headPl4; + private double polderLevel; + + [Browsable(false)] + public CalculationResult CalculationResult + { + get { return calculationResult; } + set { calculationResult = value; } + } + + [Browsable(false)] + public List CalculationResults + { + get { return calculationResults; } + } + + /// + /// Constructor + /// + public Scenario() + { + ClearResults(); + ClearErrors(); + ClearstabilityUpliftSituations(); + ModelFactors = new ModelFactors(); + } + + /// + /// Clears the results + /// + public void ClearstabilityUpliftSituations() + { + stabilityUpliftSituations = new Dictionary(); + } + + /// + /// Clears the errors. + /// + public void ClearErrors() + { + Errors = new StringCollection(); + } + /// + /// Clears the results + /// + public void ClearResults() + { + calculationResult = CalculationResult.NoRun; + pipingResults = new Dictionary(); + safetyFactorsPiping = new Dictionary(); + resultMessages = new Dictionary(); + redesignedSurfaceLines = new Dictionary(); + calculationResults.Clear(); + } + + /// + /// Gets or sets the location scenario identifier. + /// + /// + /// The location scenario identifier. + /// + [Browsable(true)] + [PropertyOrder(0, 1)] + [ReadOnly(true)] + public string LocationScenarioID + { + get + { + return locationScenarioId; + } + set + { + DataEventPublisher.BeforeChange(this, ExpressionLocationScenarioId); + locationScenarioId = value; + DataEventPublisher.AfterChange(this, ExpressionLocationScenarioId); + } + } + + [Browsable(false)] + public StringCollection Errors { get; private set; } + + /// + /// Gets or sets the river level. + /// + /// + /// The river level. + /// + [PropertyOrder(1, 1)] + [Unit(UnitType.Length)] + [Format("F2")] + [Label("River level")] + [Description("River level")] + public double? RiverLevel + { + get + { + return riverLevel; + } + set + { + DataEventPublisher.BeforeChange(this, ExpressionRiverLevel); + riverLevel = value; + DataEventPublisher.AfterChange(this, ExpressionRiverLevel); + } + } + + /// + /// Gets or sets the river level low. + /// + /// + /// The river level low. + /// + [PropertyOrder(1, 2)] + [Unit(UnitType.Length)] + [Format("F2")] + [Label("River level low")] + [Description("River level low")] + public double? RiverLevelLow + { + get + { + return riverLevelLow; + } + set + { + DataEventPublisher.BeforeChange(this, ExpressionRiverLevelLow); + riverLevelLow = value; + DataEventPublisher.AfterChange(this, ExpressionRiverLevelLow); + } + } + + /// + /// Gets or sets the height of the dike table. + /// + /// + /// The height of the dike table. + /// + [PropertyOrder(1, 3)] + [Unit(UnitType.Length)] + [Format("F2")] + [Label("Dike table height")] + [Description("Dike table height")] + public double? DikeTableHeight + { + get + { + return dikeTableHeight; + } + set + { + DataEventPublisher.BeforeChange(this, ExpressionDikeTableHeight); + dikeTableHeight = value; + DataEventPublisher.AfterChange(this, ExpressionDikeTableHeight); + } + } + + /// + /// Gets or sets the polder level. + /// + /// + /// The polder level. + /// + [PropertyOrder(1, 4)] + [Unit(UnitType.Length)] + [Format("F2")] + public double PolderLevel + { + get + { + return polderLevel; + } + set + { + DataEventPublisher.BeforeChange(this, ExpressionPolderLevel); + polderLevel = value; + DataEventPublisher.AfterChange(this, ExpressionPolderLevel); + } + } + + /// + /// Gets or sets the uplift criterion piping. + /// + /// + /// The uplift criterion piping. + /// + [PropertyOrder(1, 5)] + [Format("F2")] + [Label("Uplift criterion piping")] + [Description("Uplift criterion piping")] + public double UpliftCriterionPiping + { + get { return ModelFactors.UpliftCriterionPiping; } + set + { + DataEventPublisher.BeforeChange(this, ExpressionUpliftCriterionPiping); + ModelFactors.UpliftCriterionPiping = value; + DataEventPublisher.AfterChange(this, ExpressionUpliftCriterionPiping); + } + } + + /// + /// Gets or sets the uplift criterion stability. + /// + /// + /// The uplift criterion stability. + /// + [PropertyOrder(1, 6)] + [Format("F2")] + [Label("Uplift criterion stability")] + [Description("Uplift criterion stability")] + public double UpliftCriterionStability + { + get { return ModelFactors.UpliftCriterionStability; } + set + { + DataEventPublisher.BeforeChange(this, ExpressionUpliftCriterionStability); + ModelFactors.UpliftCriterionStability = value; + DataEventPublisher.AfterChange(this, ExpressionUpliftCriterionStability); + } + } + + [PropertyOrder(1, 7)] + [Unit(UnitType.Length)] + [Format("F2")] + public double PlLineOffsetBelowDikeTopAtRiver + { + get + { + return plLineOffsetBelowDikeTopAtRiver; + } + set + { + DataEventPublisher.BeforeChange(this, ExpressionPlLineOffsetBelowDikeTopAtRiver); + plLineOffsetBelowDikeTopAtRiver = value; + DataEventPublisher.AfterChange(this, ExpressionPlLineOffsetBelowDikeTopAtRiver); + } + } + + /// + /// Gets or sets the pl line offset below dike top at polder. + /// + /// + /// The pl line offset below dike top at polder. + /// + [PropertyOrder(1, 8)] + [Unit(UnitType.Length)] + [Format("F2")] + public double PlLineOffsetBelowDikeTopAtPolder + { + get + { + return plLineOffsetBelowDikeTopAtPolder; + } + set + { + DataEventPublisher.BeforeChange(this, ExpressionPlLineOffsetBelowDikeTopAtPolder); + plLineOffsetBelowDikeTopAtPolder = value; + DataEventPublisher.AfterChange(this, ExpressionPlLineOffsetBelowDikeTopAtPolder); + } + } + + /// + /// Gets or sets the pl line offset below shoulder base inside. + /// + /// + /// The pl line offset below shoulder base inside. + /// + [PropertyOrder(1, 9)] + [Unit(UnitType.Length)] + [Format("F2")] + public double PlLineOffsetBelowShoulderBaseInside + { + get + { + return plLineOffsetBelowShoulderBaseInside; + } + set + { + DataEventPublisher.BeforeChange(this, ExpressionPlLineOffsetBelowShoulderBaseInside); + plLineOffsetBelowShoulderBaseInside = value; + DataEventPublisher.AfterChange(this, ExpressionPlLineOffsetBelowShoulderBaseInside); + } + } + + /// + /// Gets or sets the pl line offset below dike toe at polder. + /// + /// + /// The pl line offset below dike toe at polder. + /// + [PropertyOrder(1, 10)] + [Unit(UnitType.Length)] + [Format("F2")] + public double PlLineOffsetBelowDikeToeAtPolder + { + get + { + return plLineOffsetBelowDikeToeAtPolder; + } + set + { + DataEventPublisher.BeforeChange(this, ExpressionPlLineOffsetBelowDikeToeAtPolder); + plLineOffsetBelowDikeToeAtPolder = value; + DataEventPublisher.AfterChange(this, ExpressionPlLineOffsetBelowDikeToeAtPolder); + } + } + + /// + /// Gets or sets the use pl line offset below dike crest middle. + /// + /// + /// The use pl line offset below dike crest middle. + /// + [PropertyOrder(1, 11)] + [Unit(UnitType.None)] + [Clearable] + public bool? UsePlLineOffsetBelowDikeCrestMiddle + { + get + { + return usePlLineOffsetBelowDikeCrestMiddle; + } + set + { + DataEventPublisher.BeforeChange(this, ExpressionUsePlLineOffsetBelowDikeCrestMiddle); + usePlLineOffsetBelowDikeCrestMiddle = value; + DataEventPublisher.AfterChange(this, ExpressionUsePlLineOffsetBelowDikeCrestMiddle); + } + } + + /// + /// Gets or sets the pl line offset below dike crest middle. + /// + /// + /// The pl line offset below dike crest middle. + /// + [PropertyOrder(1, 12)] + [Unit(UnitType.Length)] + [Format("F2")] + public double? PlLineOffsetBelowDikeCrestMiddle + { + get { return plLineOffsetBelowDikeCrestMiddle; } + set + { + DataEventPublisher.BeforeChange(this, ExpressionPlLineOffsetBelowDikeCrestMiddle); + plLineOffsetBelowDikeCrestMiddle = value; + DataEventPublisher.AfterChange(this, ExpressionPlLineOffsetBelowDikeCrestMiddle); + } + } + + /// + /// Gets or sets the use pl line offset factor below shoulder crest. + /// + /// + /// The use pl line offset factor below shoulder crest. + /// + [PropertyOrder(1, 13)] + [Unit(UnitType.None)] + [Clearable] + public bool? UsePlLineOffsetFactorBelowShoulderCrest + { + get + { + return usePlLineOffsetFactorBelowShoulderCrest; + } + set + { + DataEventPublisher.BeforeChange(this, ExpressionUsePlLineOffsetFactorBelowShoulderCrest); + usePlLineOffsetFactorBelowShoulderCrest = value; + DataEventPublisher.AfterChange(this, ExpressionUsePlLineOffsetFactorBelowShoulderCrest); + } + } + + /// + /// Gets or sets the pl line offset factor below shoulder crest. + /// + /// + /// The pl line offset factor below shoulder crest. + /// + [PropertyOrder(1, 14)] + [Unit(UnitType.Fractions)] + [Format("F2")] + public double? PlLineOffsetFactorBelowShoulderCrest + { + get { return plLineOffsetFactorBelowShoulderCrest; } + set + { + DataEventPublisher.BeforeChange(this, ExpressionPlLineOffsetFactorBelowShoulderCrest); + plLineOffsetFactorBelowShoulderCrest = value; + DataEventPublisher.AfterChange(this, ExpressionPlLineOffsetFactorBelowShoulderCrest); + } + } + + /// + /// Gets or sets the head PL2. + /// + /// + /// The head PL2. + /// + [PropertyOrder(1, 15)] + [Unit(UnitType.Length)] + [Format("F2")] + public double? HeadPl2 { + get { return headPl2; } + set + { + DataEventPublisher.BeforeChange(this, ExpressionHeadPl2); + headPl2 = value; + DataEventPublisher.AfterChange(this, ExpressionHeadPl2); + } + } + + /// + /// Gets or sets the head PL3. + /// + /// + /// The head PL3. + /// + [PropertyOrder(1, 16)] + [Unit(UnitType.Length)] + [Format("F2")] + public double? HeadPl3 + { + get + { + return headPl3; + } + set + { + DataEventPublisher.BeforeChange(this, ExpressionHeadPl3); + headPl3 = value; + DataEventPublisher.AfterChange(this, ExpressionHeadPl3); + } + } + + /// + /// Gets or sets the head PL4. + /// + /// + /// The head PL4. + /// + [PropertyOrder(1, 17)] + [Unit(UnitType.Length)] + [Format("F2")] + public double? HeadPl4 + { + get + { + return headPl4; + } + set + { + DataEventPublisher.BeforeChange(this, ExpressionHeadPl4); + headPl4 = value; + DataEventPublisher.AfterChange(this, ExpressionHeadPl4); + } + } + + /// + /// Gets or sets the required safety factor stability inner slope. + /// + /// + /// The required safety factor stability inner slope. + /// + [PropertyOrder(1, 18)] + [Format("F2")] + [Label("Required safety factor stability inner slope")] + [Description("Required safety factor stability inner slope")] + public double RequiredSafetyFactorStabilityInnerSlope + { + get { return ModelFactors.RequiredSafetyFactorStabilityInnerSlope; } + set + { + DataEventPublisher.BeforeChange(this, ExpressionRequiredSafetyFactorStabilityInnerSlope); + ModelFactors.RequiredSafetyFactorStabilityInnerSlope = value; + DataEventPublisher.AfterChange(this, ExpressionRequiredSafetyFactorStabilityInnerSlope); + } + } + + /// + /// Gets or sets the required safety factor stability outer slope. + /// + /// + /// The required safety factor stability outer slope. + /// + [PropertyOrder(1, 19)] + [Format("F2")] + [Label("Required safety factor stability outer slope")] + [Description("Required safety factor stability outer slope")] + public double RequiredSafetyFactorStabilityOuterSlope + { + get { return ModelFactors.RequiredSafetyFactorStabilityOuterSlope; } + set + { + DataEventPublisher.BeforeChange(this, ExpressionRequiredSafetyFactorStabilityOuterSlope); + ModelFactors.RequiredSafetyFactorStabilityOuterSlope = value; + DataEventPublisher.AfterChange(this, ExpressionRequiredSafetyFactorStabilityOuterSlope); + } + } + + /// + /// Gets or sets the required safety factor piping. + /// + /// + /// The required safety factor piping. + /// + [PropertyOrder(1, 20)] + [Format("F2")] + [Label("Required safety factor piping")] + [Description("Required safety factor piping")] + public double RequiredSafetyFactorPiping + { + get { return ModelFactors.RequiredSafetyFactorPiping; } + set + { + DataEventPublisher.BeforeChange(this, ExpressionRequiredSafetyFactorPiping); + ModelFactors.RequiredSafetyFactorPiping = value; + DataEventPublisher.AfterChange(this, ExpressionRequiredSafetyFactorPiping); + } + } + + [Browsable(false)] + public ModelFactors ModelFactors { get; set; } + + /// Aggregation relationship. + [Browsable(false)] + public Location Location + { + get { return location; } + set { location = value; } + } + + /// + /// Get uplift criterion for this scenario; return default value if not available + /// + /// default value if not available + /// uplift criterion for this scenario + public double GetUpliftCriterionStability(double? defaultUpliftCriterionStability) + { + if ((defaultUpliftCriterionStability == null) && (ModelFactors.UpliftCriterionStability == null)) + { + throw new ScenarioException(String.Format(LocalizationManager.GetTranslatedText(this, "NoUpliftCriterionForStability"), Location.Name, ToString())); + + } + return (ModelFactors.UpliftCriterionStability == null ? defaultUpliftCriterionStability.Value + : ModelFactors.UpliftCriterionStability); + } + + /// + /// Get uplift criterion for this scenario; return default value if not available + /// + /// default value if not available + /// uplift criterion for this scenario + public double GetUpliftCriterionPiping(double? defaultUpliftCriterionPiping) + { + if ((defaultUpliftCriterionPiping == null) && (ModelFactors.UpliftCriterionPiping == null)) + { + throw new ScenarioException(String.Format(LocalizationManager.GetTranslatedText(this, "NoUpliftCriterionForPiping"), Location.Name, ToString())); + } + return (ModelFactors.UpliftCriterionPiping == null ? defaultUpliftCriterionPiping.Value : ModelFactors.UpliftCriterionPiping); + } + + /// + /// Get required safety factor for this scenario; return default value if not available + /// + /// default value if not available + /// uplift criterion for this scenario + public double GetRequiredSafetyFactorPiping(double? defaultRequiredSafetyFactorPiping) + { + if ((defaultRequiredSafetyFactorPiping == null) && (ModelFactors.RequiredSafetyFactorPiping == null)) + { + throw new ScenarioException(String.Format(LocalizationManager.GetTranslatedText(this, "NoRequiredSafetyFactorPiping"), Location.Name, ToString())); + } + return (ModelFactors.RequiredSafetyFactorPiping == null ? defaultRequiredSafetyFactorPiping.Value : ModelFactors.RequiredSafetyFactorPiping); + } + + /// + /// Determines whether [is pl line offset factor below shoulder crest valid]. + /// + /// + [Validate] + public ValidationResult[] IsPlLineOffsetFactorBelowShoulderCrestValid() + { + if (UsePlLineOffsetFactorBelowShoulderCrest.HasValue && UsePlLineOffsetFactorBelowShoulderCrest.Value && + PlLineOffsetFactorBelowShoulderCrest.HasValue) + { + if (PlLineOffsetFactorBelowShoulderCrest.Value < DamGlobalConstants.PlLineOffsetFactorBelowShoulderCrestMinValue) + { + return new[] + { + new ValidationResult(ValidationResultType.Error, + LocalizationManager.GetTranslatedText(this, "PlLineOffsetFactorBelowShoulderCrestTooSmall"), + this, "PlLineOffsetFactorBelowShoulderCrest", "AssignMinValue", (IRepairer) this) + }; + } + if (PlLineOffsetFactorBelowShoulderCrest.Value > DamGlobalConstants.PlLineOffsetFactorBelowShoulderCrestMaxValue) + { + return new[] + { + new ValidationResult(ValidationResultType.Error, + LocalizationManager.GetTranslatedText(this, "PlLineOffsetFactorBelowShoulderCrestTooLarge"), + this, "PlLineOffsetFactorBelowShoulderCrest", "AssignMaxValue", (IRepairer) this) + }; + } + } + return new ValidationResult[0]; + } + + /// + /// Get stability uplift situation + /// + /// + /// + private UpliftSituation? GetStabilityUpliftSituation(Object objectAsKey) + { + return objectAsKey != null && stabilityUpliftSituations.ContainsKey(objectAsKey) ? stabilityUpliftSituations[objectAsKey] : null; + } + + /// + /// Get stability uplift situation + /// + /// + /// + /// + public UpliftSituation? GetStabilityUpliftSituation(SoilProfile1D soilProfile, string soilGeometry2DName) + { + Object objectAsKey = GetObjectAsKey(soilProfile, soilGeometry2DName); + return GetStabilityUpliftSituation(objectAsKey); + } + + /// + /// Set stability uplift situation + /// + /// + /// + private void SetStabilityUpliftSituation(Object objectAsKey, UpliftSituation upliftSituation) + { + stabilityUpliftSituations[objectAsKey] = upliftSituation; + } + + /// + /// Set stability uplift situation + /// + /// + /// + /// + public void SetStabilityUpliftSituation(SoilProfile1D soilProfile, string soilGeometry2DName, UpliftSituation upliftSituation) + { + Object objectAsKey = GetObjectAsKey(soilProfile, soilGeometry2DName); + SetStabilityUpliftSituation(objectAsKey, upliftSituation); + } + + /// + /// Get PipingResults + /// + /// + /// + private PipingResults? GetPipingResults(Object objectAsKey) + { + if (objectAsKey != null) + { + return pipingResults.ContainsKey(objectAsKey) ? pipingResults[objectAsKey] : null; + } + return null; + } + + /// + /// Get PipingResults + /// + /// + /// + /// + public PipingResults? GetPipingResults(SoilProfile1D soilProfile, string soilGeometry2DName) + { + Object objectAsKey = GetObjectAsKey(soilProfile, soilGeometry2DName); + return GetPipingResults(objectAsKey); + } + + /// + /// Set PipingResults + /// + /// + /// + private void SetPipingResults(Object objectAsKey, PipingResults? pipingResults) + { + this.pipingResults[objectAsKey] = pipingResults; + } + + /// + /// Set PipingResults + /// + /// + /// + /// + public void SetPipingResults(SoilProfile1D soilProfile, string soilGeometry2DName, PipingResults? pipingResults) + { + Object objectAsKey = GetObjectAsKey(soilProfile, soilGeometry2DName); + SetPipingResults(objectAsKey, pipingResults); + } + + /// + /// Get Safety Factor Piping + /// + /// + /// + private double? GetSafetyFactorPiping(Object objectAsKey) + { + if (objectAsKey != null) + { + return safetyFactorsPiping.ContainsKey(objectAsKey) ? safetyFactorsPiping[objectAsKey] : null; + } + return null; + } + + /// + /// Get Safety Factor Piping + /// + /// + /// + /// + public double? GetSafetyFactorPiping(SoilProfile1D soilProfile, string soilGeometry2DName) + { + Object objectAsKey = GetObjectAsKey(soilProfile, soilGeometry2DName); + return GetSafetyFactorPiping(objectAsKey); + } + + /// + /// Get Result Message + /// + /// + /// + private string GetResultMessage(Object objectAsKey) + { + if (objectAsKey != null) + { + return resultMessages.ContainsKey(objectAsKey) ? resultMessages[objectAsKey] : null; + } + return null; + } + + /// + /// Get Result Message + /// + /// + /// + /// + public string GetResultMessage(SoilProfile1D soilProfile, string soilGeometry2DName) + { + Object objectAsKey = GetObjectAsKey(soilProfile, soilGeometry2DName); + return GetResultMessage(objectAsKey); + } + + /// + /// Set Result Message + /// + /// + /// + private void SetResultMessage(Object objectAsKey, string resultMessage) + { + resultMessages[objectAsKey] = resultMessage; + } + + /// + /// Set Result Message + /// + /// + /// + /// + public void SetResultMessage(SoilProfile1D soilProfile, string soilGeometry2DName, string resultMessage) + { + Object objectAsKey = GetObjectAsKey(soilProfile, soilGeometry2DName); + SetResultMessage(objectAsKey, resultMessage); + } + + /// + /// Get Redesigned surfaceline + /// + /// + /// + private SurfaceLine2 GetRedesignedSurfaceLine(Object objectAsKey) + { + if (objectAsKey != null) + { + return redesignedSurfaceLines.ContainsKey(objectAsKey) ? redesignedSurfaceLines[objectAsKey] : null; + } + return null; + } + + /// + /// Get Redesigned surfaceline + /// + /// + /// + /// + public SurfaceLine2 GetRedesignedSurfaceLine(SoilProfile1D soilProfile, string soilGeometry2DName) + { + Object objectAsKey = GetObjectAsKey(soilProfile, soilGeometry2DName); + return GetRedesignedSurfaceLine(objectAsKey); + } + + /// + /// Set Redesigned surfaceline + /// + /// + /// + private void SetRedesignedSurfaceLine(Object objectAsKey, SurfaceLine2 surfaceLine) + { + redesignedSurfaceLines[objectAsKey] = surfaceLine; + } + + /// + /// Set Redesigned surfaceline + /// + /// + /// + /// + public void SetRedesignedSurfaceLine(SoilProfile1D soilProfile, string soilGeometry2DName, SurfaceLine2 surfaceLine) + { + Object objectAsKey = GetObjectAsKey(soilProfile, soilGeometry2DName); + SetRedesignedSurfaceLine(objectAsKey, surfaceLine); + } + + /// + /// Get Most recent surfaceline + /// + /// + /// + private SurfaceLine2 GetMostRecentSurfaceLine(Object objectAsKey) + { + if (objectAsKey != null) + { + return redesignedSurfaceLines.ContainsKey(objectAsKey) ? redesignedSurfaceLines[objectAsKey] ?? Location.LocalXZSurfaceLine2 : Location.LocalXZSurfaceLine2; + } + return null; + } + + /// + /// Get Most recent surfaceline + /// + /// + /// + /// + public SurfaceLine2 GetMostRecentSurfaceLine(SoilProfile soilProfile, string soilGeometry2DName) + { + var profile1D = soilProfile as SoilProfile1D; + Object objectAsKey = GetObjectAsKey(profile1D, soilGeometry2DName); + return GetMostRecentSurfaceLine(objectAsKey); + } + + /// + /// Determine object key based on either 1d-soilprofile or 2d-geometry + /// + /// + /// + /// + /// + private Object GetObjectAsKey(SoilProfile1D soilProfile, string soilGeometry2DName) + { + if (soilProfile != null) + { + return soilProfile; + } + return soilGeometry2DName; + } + + /// + /// Implementation of ToString + /// + /// + public override string ToString() + { + return String.Format("Location={0}, ID={1} RiverLevel={2} RiverLevelLow={3} DikeTableHeight={4} RequiredSafetyFactorStabilityInnerSlope={5} RequiredSafetyFactorStabilityOuterSlope={6} PlLineOffsetBelowDikeTopAtRiver={7} PlLineOffsetBelowDikeToeAtPolder={8} PlLineOffsetBelowDikeTopAtPolder={9} PlLineOffsetBelowShoulderBaseInside={10} UsePlLineOffsetBelowDikeCrestMiddle {11} PlLineOffsetBelowDikeCrestMiddle {12} UsePlLineOffsetFactorBelowShoulderCrest {13} PlLineOffsetFactorBelowShoulderCrest {14} HeadPl3={15} HeadPl4={16} PolderLevel={17} HeadPl2={18}", + Location.Name, LocationScenarioID, RiverLevel, + RiverLevelLow.HasValue ? RiverLevelLow.Value.ToString(CultureInfo.InvariantCulture) : "?", + DikeTableHeight.HasValue ? DikeTableHeight.Value.ToString(CultureInfo.InvariantCulture) : "?", + ModelFactors.RequiredSafetyFactorStabilityInnerSlope.ToString(CultureInfo.InvariantCulture), + ModelFactors.RequiredSafetyFactorStabilityOuterSlope.ToString(CultureInfo.InvariantCulture), + PlLineOffsetBelowDikeTopAtRiver.ToString(CultureInfo.InvariantCulture), + PlLineOffsetBelowDikeToeAtPolder.ToString(CultureInfo.InvariantCulture), + PlLineOffsetBelowDikeTopAtPolder.ToString(CultureInfo.InvariantCulture), + PlLineOffsetBelowShoulderBaseInside.ToString(CultureInfo.InvariantCulture), + UsePlLineOffsetBelowDikeCrestMiddle.HasValue ? + UsePlLineOffsetBelowDikeCrestMiddle.Value.ToString(CultureInfo.InvariantCulture) : "?", + PlLineOffsetBelowDikeCrestMiddle.HasValue ? + PlLineOffsetBelowDikeCrestMiddle.Value.ToString(CultureInfo.InvariantCulture) : "?", + UsePlLineOffsetFactorBelowShoulderCrest.HasValue ? + UsePlLineOffsetFactorBelowShoulderCrest.Value.ToString(CultureInfo.InvariantCulture) : "?", + PlLineOffsetFactorBelowShoulderCrest.HasValue ? + PlLineOffsetFactorBelowShoulderCrest.Value.ToString(CultureInfo.InvariantCulture) : "?", + HeadPl3.HasValue ? HeadPl3.Value.ToString(CultureInfo.InvariantCulture) : "?", + HeadPl4.HasValue ? HeadPl4.Value.ToString(CultureInfo.InvariantCulture) : "?", + PolderLevel.ToString(CultureInfo.InvariantCulture), + HeadPl2.HasValue ? HeadPl2.Value.ToString(CultureInfo.InvariantCulture) : "?"); + } + + public Dictionary GetParametersAsNameValuePairs() + { + var numberFormatInfo = new NumberFormatInfo(); + numberFormatInfo.NumberDecimalSeparator = "."; + var nameValuePairs = new Dictionary(); + nameValuePairs.Add(ScenarioParameterNames.LocationScenarioId, LocationScenarioID); + if (RiverLevel != null) + { + nameValuePairs.Add(ScenarioParameterNames.RiverLevel, RiverLevel.Value.ToString(numberFormatInfo)); + } + if (RiverLevelLow != null) + { + nameValuePairs.Add(ScenarioParameterNames.RiverLevelLow, RiverLevelLow.Value.ToString(numberFormatInfo)); + } + if (DikeTableHeight != null) + { + nameValuePairs.Add(ScenarioParameterNames.DikeTableHeight, DikeTableHeight.Value.ToString(numberFormatInfo)); + } + if (ModelFactors != null) + { + nameValuePairs.Add(ScenarioParameterNames.RequiredSafetyFactorStabilityInnerSlope, ModelFactors.RequiredSafetyFactorStabilityInnerSlope.ToString(numberFormatInfo)); + nameValuePairs.Add(ScenarioParameterNames.RequiredSafetyFactorStabilityOuterSlope, ModelFactors.RequiredSafetyFactorStabilityOuterSlope.ToString(numberFormatInfo)); + nameValuePairs.Add(ScenarioParameterNames.RequiredSafetyFactorPiping, ModelFactors.RequiredSafetyFactorPiping.ToString(numberFormatInfo)); + nameValuePairs.Add(ScenarioParameterNames.UpliftCriterionPiping, ModelFactors.UpliftCriterionPiping.ToString(numberFormatInfo)); + nameValuePairs.Add(ScenarioParameterNames.UpliftCriterionStability, ModelFactors.UpliftCriterionStability.ToString(numberFormatInfo)); + } + nameValuePairs.Add(ScenarioParameterNames.PlLineOffsetBelowDikeTopAtRiver, PlLineOffsetBelowDikeTopAtRiver.ToString(numberFormatInfo)); + nameValuePairs.Add(ScenarioParameterNames.PlLineOffsetBelowDikeTopAtPolder, PlLineOffsetBelowDikeTopAtPolder.ToString(numberFormatInfo)); + nameValuePairs.Add(ScenarioParameterNames.PlLineOffsetBelowShoulderBaseInside, PlLineOffsetBelowShoulderBaseInside.ToString(numberFormatInfo)); + nameValuePairs.Add(ScenarioParameterNames.PlLineOffsetBelowDikeToeAtPolder, PlLineOffsetBelowDikeToeAtPolder.ToString(numberFormatInfo)); + if (PlLineOffsetBelowDikeCrestMiddle != null) + { + nameValuePairs.Add(ScenarioParameterNames.PlLineOffsetBelowDikeCrestMiddle, PlLineOffsetBelowDikeCrestMiddle.Value.ToString(numberFormatInfo)); + } + if (PlLineOffsetFactorBelowShoulderCrest != null) + { + nameValuePairs.Add(ScenarioParameterNames.PlLineOffsetFactorBelowShoulderCrest, PlLineOffsetFactorBelowShoulderCrest.Value.ToString(numberFormatInfo)); + } + if (UsePlLineOffsetBelowDikeCrestMiddle != null) + { + nameValuePairs.Add(ScenarioParameterNames.UsePlLineOffsetBelowDikeCrestMiddle, UsePlLineOffsetBelowDikeCrestMiddle.Value.ToString()); + } + if (UsePlLineOffsetFactorBelowShoulderCrest != null) + { + nameValuePairs.Add(ScenarioParameterNames.UsePlLineOffsetFactorBelowShoulderCrest, UsePlLineOffsetFactorBelowShoulderCrest.Value.ToString()); + } + if (HeadPl3 != null) + { + nameValuePairs.Add(ScenarioParameterNames.HeadPl3, HeadPl3.Value.ToString(numberFormatInfo)); + } + if (HeadPl4 != null) + { + nameValuePairs.Add(ScenarioParameterNames.HeadPl4, HeadPl4.Value.ToString(numberFormatInfo)); + } + nameValuePairs.Add(ScenarioParameterNames.PolderLevel, PolderLevel.ToString(numberFormatInfo)); + + if (HeadPl2 != null) + { + nameValuePairs.Add(ScenarioParameterNames.HeadPl2, HeadPl2.Value.ToString(numberFormatInfo)); + } + + return nameValuePairs; + } + + public void SetParameterFromNameValuePair(string parameterName, string parameterValue) + { + var numberFormatInfo = new NumberFormatInfo(); + numberFormatInfo.NumberDecimalSeparator = "."; + if (parameterName.Equals(ScenarioParameterNames.LocationScenarioId)) + LocationScenarioID = parameterValue; + if (parameterName.Equals(ScenarioParameterNames.RiverLevel)) + RiverLevel = Convert.ToDouble(parameterValue, numberFormatInfo); + if (parameterName.Equals(ScenarioParameterNames.RiverLevelLow)) + RiverLevelLow = Convert.ToDouble(parameterValue, numberFormatInfo); + if (parameterName.Equals(ScenarioParameterNames.DikeTableHeight)) + DikeTableHeight = Convert.ToDouble(parameterValue, numberFormatInfo); + if (parameterName.Equals(ScenarioParameterNames.RequiredSafetyFactorStabilityInnerSlope)) + ModelFactors.RequiredSafetyFactorStabilityInnerSlope = Convert.ToDouble(parameterValue, numberFormatInfo); + if (parameterName.Equals(ScenarioParameterNames.RequiredSafetyFactorStabilityOuterSlope)) + ModelFactors.RequiredSafetyFactorStabilityOuterSlope = Convert.ToDouble(parameterValue, numberFormatInfo); + if (parameterName.Equals(ScenarioParameterNames.RequiredSafetyFactorPiping)) + ModelFactors.RequiredSafetyFactorPiping = Convert.ToDouble(parameterValue, numberFormatInfo); + if (parameterName.Equals(ScenarioParameterNames.UpliftCriterionPiping)) + ModelFactors.UpliftCriterionPiping = Convert.ToDouble(parameterValue, numberFormatInfo); + if (parameterName.Equals(ScenarioParameterNames.UpliftCriterionStability)) + ModelFactors.UpliftCriterionStability = Convert.ToDouble(parameterValue, numberFormatInfo); + if (parameterName.Equals(ScenarioParameterNames.PlLineOffsetBelowDikeTopAtRiver)) + PlLineOffsetBelowDikeTopAtRiver = Convert.ToDouble(parameterValue, numberFormatInfo); + if (parameterName.Equals(ScenarioParameterNames.PlLineOffsetBelowDikeTopAtPolder)) + PlLineOffsetBelowDikeTopAtPolder = Convert.ToDouble(parameterValue, numberFormatInfo); + if (parameterName.Equals(ScenarioParameterNames.PlLineOffsetBelowShoulderBaseInside)) + PlLineOffsetBelowShoulderBaseInside = Convert.ToDouble(parameterValue, numberFormatInfo); + if (parameterName.Equals(ScenarioParameterNames.PlLineOffsetBelowDikeToeAtPolder)) + PlLineOffsetBelowDikeToeAtPolder = Convert.ToDouble(parameterValue, numberFormatInfo); + if (parameterName.Equals(ScenarioParameterNames.PlLineOffsetBelowDikeCrestMiddle)) + PlLineOffsetBelowDikeCrestMiddle = Convert.ToDouble(parameterValue, numberFormatInfo); + if (parameterName.Equals(ScenarioParameterNames.PlLineOffsetFactorBelowShoulderCrest)) + PlLineOffsetFactorBelowShoulderCrest = Convert.ToDouble(parameterValue, numberFormatInfo); + if (parameterName.Equals(ScenarioParameterNames.UsePlLineOffsetBelowDikeCrestMiddle)) + UsePlLineOffsetBelowDikeCrestMiddle = Convert.ToBoolean(parameterValue); + if (parameterName.Equals(ScenarioParameterNames.UsePlLineOffsetFactorBelowShoulderCrest)) + UsePlLineOffsetFactorBelowShoulderCrest = Convert.ToBoolean(parameterValue); + if (parameterName.Equals(ScenarioParameterNames.HeadPl3)) + HeadPl3 = Convert.ToDouble(parameterValue, numberFormatInfo); + if (parameterName.Equals(ScenarioParameterNames.HeadPl4)) + HeadPl4 = Convert.ToDouble(parameterValue, numberFormatInfo); + if (parameterName.Equals(ScenarioParameterNames.PolderLevel)) + PolderLevel = Convert.ToDouble(parameterValue, numberFormatInfo); + if (parameterName.Equals(ScenarioParameterNames.HeadPl2)) + HeadPl2 = Convert.ToDouble(parameterValue, numberFormatInfo); + } + + public bool IsVisible(string property) + { + switch (property) + { + default: return true; + } + } + + public bool IsEnabled(string property) + { + return true; + } + + /// + /// Repairs the specified subject. + /// + /// The subject. + /// The property. + /// The identifier. + public void Repair(object subject, string property, string id) + { + if (subject is Scenario) + { + if (id == "AssignMinValue" && property == "PlLineOffsetFactorBelowShoulderCrest") + { + PlLineOffsetFactorBelowShoulderCrest = DamGlobalConstants.PlLineOffsetFactorBelowShoulderCrestMinValue; + } + if (id == "AssignMaxValue" && property == "PlLineOffsetFactorBelowShoulderCrest") + { + PlLineOffsetFactorBelowShoulderCrest = DamGlobalConstants.PlLineOffsetFactorBelowShoulderCrestMaxValue; + } + } + } + + /// + /// Gets the repair description. + /// + /// The subject. + /// The property. + /// The identifier. + /// + public string GetRepairDescription(object subject, string property, string id) + { + if (id == "AssignMinValue") + { + return LocalizationManager.GetTranslatedText(this, "AssignMinValue"); + } + if (id == "AssignMaxValue") + { + return LocalizationManager.GetTranslatedText(this, "AssignMaxValue"); + } + return ""; + } + } + + public static class ScenarioParameterNames + { + public const string LocationScenarioId = "LocationScenarioId"; + public const string RiverLevel = "RiverLevel"; + public const string RiverLevelLow = "RiverLevelLow"; + public const string DikeTableHeight = "DikeTableHeight"; + + public const string RequiredSafetyFactorStabilityInnerSlope = "RequiredSafetyFactorStabilityInnerSlope"; + public const string RequiredSafetyFactorStabilityOuterSlope = "RequiredSafetyFactorStabilityOuterSlope"; + public const string RequiredSafetyFactorPiping = "RequiredSafetyFactorPiping"; + public const string UpliftCriterionPiping = "UpliftCriterionPiping"; + public const string UpliftCriterionStability = "UpliftCriterionStability"; + public const string PlLineOffsetBelowDikeTopAtRiver = "PlLineOffsetBelowDikeTopAtRiver"; + public const string PlLineOffsetBelowDikeTopAtPolder = "PlLineOffsetBelowDikeTopAtPolder"; + public const string PlLineOffsetBelowShoulderBaseInside = "PlLineOffsetBelowShoulderBaseInside"; + public const string PlLineOffsetBelowDikeToeAtPolder = "PlLineOffsetBelowDikeToeAtPolder"; + public const string PlLineOffsetBelowDikeCrestMiddle = "PlLineOffsetBelowDikeCrestMiddle"; + public const string PlLineOffsetFactorBelowShoulderCrest = "PlLineOffsetFactorBelowShoulderCrest"; + public const string UsePlLineOffsetBelowDikeCrestMiddle = "UsePlLineOffsetBelowDikeCrestMiddle"; + public const string UsePlLineOffsetFactorBelowShoulderCrest = "UsePlLineOffsetFactorBelowShoulderCrest"; + public const string HeadPl3 = "HeadPL3"; + public const string HeadPl4 = "HeadPL4"; + public const string PolderLevel = "PolderLevel"; + public const string HeadPl2 = "HeadPL2"; + } +} Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Geometry2DSectionParameters.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Geometry2DSectionParameters.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Geometry2DSectionParameters.cs (revision 3305) @@ -0,0 +1,57 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using Deltares.Standard; +using Deltares.Geotechnics.Soils; + +namespace Deltares.Dam.Data +{ + + + /// + /// + /// + public class Geometry2DSectionParameters : ICloneable + { + public Geometry2DSectionParameters() + { + } + + public string SoilGeometry2DName { get; set; } + public double XCoordinateSection { get; set; } + public SoilProfile1D SoilProfile { get; set; } + + public void Assign(Geometry2DSectionParameters geometry2DSectionParameters) + { + this.SoilGeometry2DName = geometry2DSectionParameters.SoilGeometry2DName; + this.XCoordinateSection = geometry2DSectionParameters.XCoordinateSection; + } + + public Geometry2DSectionParameters Clone() + { + Geometry2DSectionParameters geometry2DSectionParameters = new Geometry2DSectionParameters(); + + geometry2DSectionParameters.Assign(this); + + return geometry2DSectionParameters; + } + } +} Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/IO/DamProjectVersionXmlHandler.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/IO/DamProjectVersionXmlHandler.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/IO/DamProjectVersionXmlHandler.cs (revision 3305) @@ -0,0 +1,134 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU 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.Standard.IO.Xml; + +namespace Deltares.Dam.Data.IO +{ + /// + /// This class is added to be able to retrieve the proper version from the damx xml file via the xmlHandler interface. + /// So the only useful methods are GetDamProjectVersion and SetVersion (interface). + /// + /// + public class DamProjectVersionXmlHandler: IXmlHandler + { + private string damProjectVersion; + + /// + /// Gets the dam project version. + /// + /// + public string GetDamProjectVersion() + { + return damProjectVersion; + } + + /// + /// Sets the version of the file to be deserialized + /// + /// Version of the xml file + public void SetVersion(string version) + { + damProjectVersion = version; + } + + /// + /// This method returns true if the can be handled by this XmlHandler + /// + /// Type of the objects + /// + /// True if the type can be handled, false otherwise + /// + public bool CanHandle(Type type) + { + return false; + } + + /// + /// This method returns true if the and property can be handled by this XmlHandler + /// + /// Type of the objects + /// Indicates whether the property can be handled + /// + /// True if the type can be handled, false otherwise + /// + public bool CanHandle(Type type, string property) + { + return false; + } + + /// + /// Indicates the type of the property which should be created + /// + /// The type in which the property is or was defined + /// The name of the property + /// + /// The type of the property + /// + /// + /// + /// If null is returned, the property type is left over to reflection + /// + public Type GetFormerPropertyType(Type type, string property) + { + throw new NotImplementedException(); + } + + /// + /// When the handler can handle the property, this method can be called to actually perform + /// the handling of the value for a specific target. + /// + /// The object for which the value is handled + /// The property which should be handled + /// The value which is handled + /// The deserialized objects list + /// + public void Handle(object target, string property, object value, object[] objects) + { + throw new NotImplementedException(); + } + + /// + /// When the handler can handle the property, this method can be called to actually perform + /// the handling of the value of the specific target. The value, in this case, can be + /// altered before it is set to the target. It is the implementing class' responsibility + /// to assign the value to the correct property of the target. + /// + /// The target object to assign the value for. + /// The value to assign to the target + /// + public void HandleObject(object target, object value) + { + throw new NotImplementedException(); + } + + /// + /// Allows the xml handler to post process each created object, which it can handle + /// + /// The object to be post processed + /// + public void Upgrade(object[] target) + { + throw new NotImplementedException(); + } + } +} Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/FeatureImporter.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/FeatureImporter.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/FeatureImporter.cs (revision 3305) @@ -0,0 +1,93 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU 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; + +namespace Deltares.Maps +{ + public class FeatureImporter : IFeatureImporter + { + private readonly IFeatureRepository repository; + private IReader reader; + + public FeatureImporter(IFeatureRepository repository, IReader reader) + { + if (repository == null) + { + throw new ArgumentNullException("repository"); + } + if (reader == null) + { + throw new ArgumentNullException("reader"); + } + + this.repository = repository; + this.reader = reader; + } + + #region Implementation of IGeometryRepositoryImporter + + public IFeatureRepository Repository + { + get { return repository; } + } + + public IReader Reader + { + set { reader = value; } + } + + public void Import() + { + repository.Add(reader.Read()); + } + + #endregion + + public static void ImportFromShapeFile(ShapeFileLocation shapeFileLocation, IFeatureRepository featureRepository, + bool ignoreAttributeData = false) + { + if (shapeFileLocation == null) + { + throw new ArgumentNullException("shapeFileLocation"); + } + if (featureRepository == null) + { + throw new ArgumentNullException("featureRepository"); + } + + try + { + IReader reader = new ShapeFileReader(shapeFileLocation) + { + IgnoreAttributeData = ignoreAttributeData + }; + + IFeatureImporter importer = new FeatureImporter(featureRepository, reader); + importer.Import(); + } + catch (Exception e) + { + throw new FeatureImportException(shapeFileLocation.FullPath, e); + } + } + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DtoAssembler/DtoCollectionAssembler.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DtoAssembler/DtoCollectionAssembler.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DtoAssembler/DtoCollectionAssembler.cs (revision 3305) @@ -0,0 +1,186 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System.Collections.Generic; +using System.Linq; +using System.Xml.Linq; +using Deltares.Standard.IO.DtoAssembler; + +namespace Deltares.Standard +{ + /// + /// Base class for a data transfer collection assembler + /// + /// The type of class to be assembled + public abstract class DtoCollectionAssembler : IDtoCollectionAssembler + where TDomainObject : new() + { + /// + /// Holds a reference to the entity assembler + /// + private DtoAssembler entityAssembler; + + public DtoCollectionAssembler(DtoAssembler entityAssembler, string elementName) + { + this.entityAssembler = entityAssembler; + this.ElementName = elementName; + } + + #region IDtoCollectionAssembler Members + + /// + /// Gets the entity assembler + /// + public IDtoAssembler EntityAssembler + { + get { return this.entityAssembler; } + } + + /// + /// Gets or sets the xml element name + /// + public string ElementName { get; private set; } + + /// + /// + /// + /// + /// + public virtual IEnumerable CreateDomainObjectCollection(XElement dtoSequenceElement) + { + IEnumerable dto = from x in dtoSequenceElement.Descendants() + where x.Name.LocalName == this.EntityAssembler.ElementName && x.Parent.Name.LocalName == this.ElementName + select x; + + return dto.ToDomainObjectIterator(this.entityAssembler); + } + + /// + /// + /// + /// + /// + public virtual XElement CreateDataTransferObject(IEnumerable domainObjColl) + { + if (!this.ElementName.HasValidStringValue()) + throw new DtoAssemblerException("There is no element name specified"); + + if (this.entityAssembler == null) + { + // TODO: need to support serialization based on reflection + } + + // is there a schema attached to the assembler so we can + // validate the collection? + XDocument schema = this.entityAssembler.Schema; + if (schema != null) + { + if (this.entityAssembler == null) + { + // TODO: need to support serialization based on reflection + } + else + { + // get the collection rules (min and max requirements) (if any) + var collRules = from x in schema.Descendants() + where x.Name.LocalName == "element" && x.Attribute("name").Value == this.entityAssembler.ElementName + select new + { + MinOccurs = x.AttributeAs("minOccurs") == "unbounded" ? 0 : x.AttributeAs("minOccurs"), + MaxOccurs = x.AttributeAs("maxOccurs") == "unbounded" ? -1 : x.AttributeAs("maxOccurs") + }; + + if (collRules.Any()) + { + var rules = collRules.Single(); + // validate the min and max values of the collection according to the xsd + int count = domainObjColl.Count(); + if (domainObjColl == null || (count == 0 && rules.MinOccurs > 0) + || (count > 0 & rules.MaxOccurs >= 0 && count > rules.MaxOccurs)) + { + throw new CollectionRequirementsNotSatisfiedException(this.ElementName, this.EntityAssembler.ElementName, domainObjColl); + } + } + } + } + else if (domainObjColl == null) + { + return null; // Use empty sequence instead? + } + + return new XElement(this.ElementName, domainObjColl.ToDtoIterator(this.entityAssembler).ToArray()); + } + + #endregion + + /// + /// Creates a domain object collection from an xml document + /// + /// + /// + public IEnumerable CreateDomainObjectCollection(string xmlString) + { + XDocument doc = XDocument.Parse(xmlString); + + // assemble the collection + return this.CreateDomainObjectCollection(doc); + } + + /// + /// Creates a domain object collection from an xml document + /// + /// + /// + public IEnumerable CreateDomainObjectCollection(XDocument doc) + { + IEnumerable dto = from x in doc.Descendants() + where x.Name.LocalName == this.EntityAssembler.ElementName && x.Parent.Name.LocalName == this.ElementName + select x; + + // assemble the collection + return this.CreateDomainObjectCollection(dto); + } + + /// + /// + /// + /// + /// + public IEnumerable CreateDomainObjectCollection(IEnumerable dtoObjColl) + { + return dtoObjColl.ToDomainObjectIterator(this.entityAssembler); + } + + /// + /// + /// + /// + /// + public XElement CreateDataTransferObject(IEnumerable domainObjColl, XNamespace elementNamespace) + { + XElement el = this.CreateDataTransferObject(domainObjColl); + var nel = new XElement(elementNamespace + this.ElementName); + el.Name = nel.Name; + + return el; + } + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Specifications/ValidationResult.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Specifications/ValidationResult.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Specifications/ValidationResult.cs (revision 3305) @@ -0,0 +1,71 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU 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.Drawing; +using Deltares.Standard.EventPublisher; +using Deltares.Standard.Validation; + +namespace Deltares.Dam.Data.Specifications +{ + public class ValidationResult : IValidationResult + { + public ValidationResult() + { + MessageType = ValidationResultType.Error; + } + + public ValidationResultType MessageType { get; set; } + + public List InvalidProperties { get { return new List();} } + + public Image Severity { get; set; } + + string IValidationResult.Text { get; set; } + + public object Subject { get; set; } + + public List ID { get { return new List(); } } + + public IRepairer Repairer + { + get; set; + } + + public void Select() + { + DataEventPublisher.SelectionChanged(Subject); + } + + public void Repair() + { + } + + public void ClearValidationResult() + { + } + + public Exception Error { get; set; } + + public string Text { get { return Error.Message; } } + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Importers/ImportFilesNotValidatedException.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Importers/ImportFilesNotValidatedException.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Importers/ImportFilesNotValidatedException.cs (revision 3305) @@ -0,0 +1,48 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU 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.Dam.Data.Importers +{ + [Serializable] + public class ImportFilesNotValidatedException : Exception + { + public ImportFilesNotValidatedException() + { + } + + public ImportFilesNotValidatedException(string message) : base(message) + { + } + + public ImportFilesNotValidatedException(string message, Exception inner) : base(message, inner) + { + } + + protected ImportFilesNotValidatedException( + SerializationInfo info, + StreamingContext context) : base(info, context) + { + } + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DataPlugins/Configuration/DataSource.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DataPlugins/Configuration/DataSource.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DataPlugins/Configuration/DataSource.cs (revision 3305) @@ -0,0 +1,37 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +namespace Deltares.Dam.Data.DataPlugins.Configuration +{ + public class DataSource + { + public DataSourceType DataSourceType { get; set; } + public string DataLocation { get; set; } + public string DikeRingId { get; set; } + + public override string ToString() + { + return DataSourceType.ToString() + "|" + + (string.IsNullOrWhiteSpace(DikeRingId) ? "" : DikeRingId) + + "|" + DataLocation; + } + } +} Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/PipingResults.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/PipingResults.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/PipingResults.cs (revision 3305) @@ -0,0 +1,42 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +namespace Deltares.Dam.Data +{ + public struct PipingResults + { + public string CalculationName { get; set; } + public string CalculationSubDir { get; set; } + public double? BlighPipingFactor { get; set; } + public double? BlighHCritical { get; set; } + public double? Sellmeijer2ForcesPipingFactor { get; set; } + public double? Sellmeijer2ForcesHCritical { get; set; } + public double? Sellmeijer4ForcesPipingFactor { get; set; } + public double? Sellmeijer4ForcesHCritical { get; set; } + public double? SellmeijerPipingFactor { get; set; } + public double? SellmeijerHCritical { get; set; } + public double? Wti2017PipingFactor { get; set; } + public double? Wti2017HCritical { get; set; } + public double? PipingExitPointX { get; set; } + public double? UpliftFactor { get; set; } + public double? HeaveFactor { get; set; } + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DtoAssembler/Assemblers/InputOutputDocumentAssembler.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DtoAssembler/Assemblers/InputOutputDocumentAssembler.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DtoAssembler/Assemblers/InputOutputDocumentAssembler.cs (revision 3305) @@ -0,0 +1,33 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +namespace Deltares.Standard +{ + public class InputOutputDocumentAssembler : DtoDocumentAssembler + where TInput : new() + where TOutput : new() + { + public InputOutputDocumentAssembler(string elementName, string elementNamespace, string xsdEmbeddedResourcePath, DtoAssembler inputAssembler, DtoAssembler outputAssembler) : + base(elementName, elementNamespace, xsdEmbeddedResourcePath, inputAssembler, outputAssembler) + { + } + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/PLLine.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/PLLine.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/PLLine.cs (revision 3305) @@ -0,0 +1,130 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System.Collections.Generic; +using System; +using System.Linq; +using System.Xml.Serialization; +using Deltares.Standard; +using Deltares.Geometry; + +namespace Deltares.Dam.Data +{ + + public class PLLinePoint : GeometryPoint + { + public PLLinePoint() : this (0, 0) { } + + public PLLinePoint(double aX, double aZ) : base(aX, 0, aZ) + { + } + } + + public class PLLine : PolyLine, ICloneable + { + private PLLineType plLineType; + + [XmlIgnore] + public PLLineType PLLineType + { + get { return plLineType; } + set + { + plLineType = value; + PLLineTypeSpecified = true; + } + } + + [XmlIgnore] + public bool PLLineTypeSpecified { get; private set; } + + + public bool IsPhreatic { get; set; } + + public int BoundaryLayer { get; set; } + + public PLLine Clone() + { + PLLine plLine = new PLLine() { IsPhreatic = this.IsPhreatic, BoundaryLayer = this.BoundaryLayer }; + foreach (PLLinePoint point in this.Points) + { + PLLinePoint newPoint = new PLLinePoint() { X = point.X, Y = point.Y, Z = point.Z }; + plLine.Points.Add(newPoint); + } + return plLine; + } + + /// + /// Gets the points in the segment between starting x and ending x + /// + /// + /// + /// + /// + /// + public IEnumerable GetPointSegmentBetween(double startX, double endX) + { + if (endX < startX) + throw new ArgumentException("End value is smaller then the start value"); + + return from point in this.PointsOrderdByX + where point != null && (point.X > startX && point.X < endX) + orderby point.X ascending + select point; + } + + /// + /// Determines whether the given point is above, beneath or on the surfaceline. + /// + /// + /// + public PLLinePointPositionXzType PositionXzOfPointRelatedToPLLine(GeometryPoint point) + { + // if point is out of scope of the surface line, return beyond + if ((point.X < points[0].X) || (point.X > points[points.Count - 1].X)) + return PLLinePointPositionXzType.BeyondPLLine; + + double z = ZFromX(point.X); + if (Math.Abs(point.Z - z) < GeometryPoint.Precision) + { + return PLLinePointPositionXzType.OnPLLine; + } + else + { + if (point.Z > z) + { + return PLLinePointPositionXzType.AbovePLLine; + } + else + { + return PLLinePointPositionXzType.BelowPLLine; + } + } + } + + private IEnumerable PointsOrderdByX + { + get { return this.Points.OrderBy(p => p.X); } + } + + } + +} Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/RequiredImportFileNotExistException.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/RequiredImportFileNotExistException.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/RequiredImportFileNotExistException.cs (revision 3305) @@ -0,0 +1,48 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU 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.Dam.Data +{ + + [Serializable] + public class RequiredImportFileNotExistException : Exception + { + public RequiredImportFileNotExistException(string message) + : base(message) + { + } + + public RequiredImportFileNotExistException(string message, Exception inner) + : base(message, inner) + { + } + + protected RequiredImportFileNotExistException( + SerializationInfo info, + StreamingContext context) + : base(info, context) + { + } + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/FeatureImportException.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/FeatureImportException.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/FeatureImportException.cs (revision 3305) @@ -0,0 +1,55 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU 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.Maps +{ + [Serializable] + public class FeatureImportException : Exception + { + // + // For guidelines regarding the creation of new exception types, see + // http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpgenref/html/cpconerrorraisinghandlingguidelines.asp + // and + // http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dncscol/html/csharp07192001.asp + // + + public FeatureImportException() + { + } + + public FeatureImportException(string message) : base(message) + { + } + + public FeatureImportException(string message, Exception inner) : base(message, inner) + { + } + + protected FeatureImportException( + SerializationInfo info, + StreamingContext context) : base(info, context) + { + } + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DtoAssembler/DtoAssemblerConversionException.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DtoAssembler/DtoAssemblerConversionException.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DtoAssembler/DtoAssemblerConversionException.cs (revision 3305) @@ -0,0 +1,56 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU 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.Standard +{ + [Serializable] + public class DtoAssemblerConversionException : Exception + { + // + // For guidelines regarding the creation of new exception types, see + // http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpgenref/html/cpconerrorraisinghandlingguidelines.asp + // and + // http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dncscol/html/csharp07192001.asp + // + + public DtoAssemblerConversionException() + { + } + + public DtoAssemblerConversionException(string message) : base(message) + { + } + + public DtoAssemblerConversionException(string message, Exception inner) : base(message, inner) + { + } + + protected DtoAssemblerConversionException( + SerializationInfo info, + StreamingContext context) + : base(info, context) + { + } + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/TimeSerieEntry.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/TimeSerieEntry.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/TimeSerieEntry.cs (revision 3305) @@ -0,0 +1,86 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU 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.Standard.Extensions; + +namespace Deltares.Dam.Data +{ + + + public class TimeSerieEntry + { + public TimeSerieEntry() + { + } + + public TimeSerieEntry(DateTime dateTime, double value) + { + this.DateTime = dateTime; + this.Value = value; + } + + public virtual DateTime DateTime { get; set; } + public virtual double Value { get; set; } + public virtual string BasisFileName { get; set; } + public string RelativeCalculationPathName { get; set; } + public Stochast StochastValue { get; set; } + public int Flag { get; set; } + + public TimeSerieEntry GetShallowCopy() + { + return new TimeSerieEntry + { + DateTime = DateTime, + Flag = Flag, + }; + } + + public TimeSerieEntry Map(Func function) + { + return Map(0, function); + } + + public TimeSerieEntry Map(double missingValue, Func function) + { + var entry = this.GetShallowCopy(); + try + { + entry.Value = !this.Value.AlmostEquals(missingValue) ? function(this) : missingValue; + } + catch + { + entry.Value = missingValue; + } + return entry; + } + + public void Assign(TimeSerieEntry entry) + { + this.DateTime = entry.DateTime; + this.Value = entry.Value; + this.BasisFileName = entry.BasisFileName; + this.StochastValue = entry.StochastValue; + this.Flag = entry.Flag; + } + + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Xsd/SoilbaseDataSet.xsc =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Xsd/SoilbaseDataSet.xsc (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Xsd/SoilbaseDataSet.xsc (revision 3305) @@ -0,0 +1 @@ + \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/CsvExportSurfaceLine.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/CsvExportSurfaceLine.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/CsvExportSurfaceLine.cs (revision 3305) @@ -0,0 +1,79 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU 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.Globalization; +using System.Text; +using Deltares.Dam.Data.CsvImporters; +using Deltares.Geometry; +using Deltares.Geotechnics.SurfaceLines; + +namespace Deltares.Dam.Data +{ + public class CsvExportSurfaceLine + { + + SurfaceLine2 surfaceLine; + CsvExportSurfaceLineIdentifiers csvExportSurfaceLineIdentifiers; + public CsvExportSurfaceLine(CsvExportSurfaceLineIdentifiers csvExportSurfaceLineIdentifiers, SurfaceLine2 surfaceLine) + { + this.surfaceLine = surfaceLine; + this.csvExportSurfaceLineIdentifiers = csvExportSurfaceLineIdentifiers; + } + + // The following 5 properties are identifiers and should be the first columns. + // Use negative identifers to add them as the first columns + [CsvExportColumn(SurfaceLineCsvColumnNames.LocationColumnName, -4)] + public string LocationId { get { return (csvExportSurfaceLineIdentifiers == null) ? "" : csvExportSurfaceLineIdentifiers.LocationId; } } + + [CsvExportColumn(CsvExportSurfaceLineIdentifiers.CsvHeaderSoilProfileId, -3)] + public string SoilProfileId { get { return (csvExportSurfaceLineIdentifiers == null) ? "" : csvExportSurfaceLineIdentifiers.SoilProfileId; } } + + [CsvExportColumn(CsvExportSurfaceLineIdentifiers.CsvHeaderScenario, -2)] + public string Scenario { get { return (csvExportSurfaceLineIdentifiers == null) ? "" : csvExportSurfaceLineIdentifiers.Scenario; } } + + [CsvExportColumn(CsvExportSurfaceLineIdentifiers.CsvHeaderCalculationMechanism, -1)] + public string CalculationMechanism { get { return (csvExportSurfaceLineIdentifiers == null) ? "" : csvExportSurfaceLineIdentifiers.CalculationMechanism; } } + + [CsvExportColumn(CsvExportSurfaceLineIdentifiers.CsvHeaderCalculationModel, 0)] + public string CalculationModel { get { return (csvExportSurfaceLineIdentifiers == null) ? "" : csvExportSurfaceLineIdentifiers.CalculationModel; } } + + // The following properties are the real surfaceline data + + [CsvExportColumn("X1;Y1;Z1;.....;Xn;Yn;Zn;(Profiel)", 6)] + public string SurfaceLines + { + get + { + StringBuilder sb = new StringBuilder(); + foreach (GeometryPoint point in surfaceLine.Geometry.Points) + { + sb.Append(point.X.ToString("F3", CultureInfo.InvariantCulture)); + sb.Append(";"); + sb.Append(point.Y.ToString("F3", CultureInfo.InvariantCulture)); + sb.Append(";"); + sb.Append(point.Z.ToString("F3", CultureInfo.InvariantCulture)); + sb.Append(";"); + } + return sb.ToString(); + } + } + } +} Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/AttributesDictionary.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/AttributesDictionary.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/AttributesDictionary.cs (revision 3305) @@ -0,0 +1,124 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Collections.Generic; +using System.Linq; + +using NetTopologySuite.Features; + +namespace Deltares.Maps +{ + public class AttributesDictionary : IAttributesTable + { + private readonly Dictionary attributes; + + public AttributesDictionary() + { + attributes = new Dictionary(); + } + + #region Implementation of IAttributesTable + + static void ThrowArgumentNullExceptionWhenAttributeIsNullOrEmpty(string attributeName) + { + if (string.IsNullOrEmpty(attributeName)) + { + throw new ArgumentNullException("attributeName"); + } + } + + public void AddAttribute(string attributeName, object value) + { + ThrowArgumentNullExceptionWhenAttributeIsNullOrEmpty(attributeName); + + if (value == null) + { + throw new ArgumentNullException("value"); + } + + string attrName = attributeName.ToUpper(); + attributes.Add(attrName, value); + } + + public void DeleteAttribute(string attributeName) + { + ThrowArgumentNullExceptionWhenAttributeIsNullOrEmpty(attributeName); + + string attrName = attributeName.ToUpper(); + if (attributes.ContainsKey(attrName)) + { + attributes.Remove(attrName); + } + } + + public Type GetType(string attributeName) + { + ThrowArgumentNullExceptionWhenAttributeIsNullOrEmpty(attributeName); + + string attrName = attributeName.ToUpper(); + return this[attrName].GetType(); + } + + public bool Exists(string attributeName) + { + ThrowArgumentNullExceptionWhenAttributeIsNullOrEmpty(attributeName); + + string attrName = attributeName.ToUpper(); + return attributes.ContainsKey(attrName); + } + + public string[] GetNames() + { + return attributes.Keys.Select(key => key.ToUpper()).ToArray(); + } + + public object[] GetValues() + { + return attributes.Values.ToArray(); + } + + public object this[string attributeName] + { + get + { + ThrowArgumentNullExceptionWhenAttributeIsNullOrEmpty(attributeName); + + string attrName = attributeName.ToUpper(); + return attributes[attrName]; + } + set + { + ThrowArgumentNullExceptionWhenAttributeIsNullOrEmpty(attributeName); + + string attrName = attributeName.ToUpper(); + attributes[attrName] = value; + } + } + + public int Count + { + get { return attributes.Count; } + } + + #endregion + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Sensors/SensorCalculationArgument.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Sensors/SensorCalculationArgument.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Sensors/SensorCalculationArgument.cs (revision 3305) @@ -0,0 +1,29 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +namespace Deltares.Dam.Data.Sensors +{ + public class SensorCalculationArgument + { + public string StabilityWorkingPath { get; set; } + public string StabilityExePath { get; set; } + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/TimeSerieSchemaValidationException.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/TimeSerieSchemaValidationException.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/TimeSerieSchemaValidationException.cs (revision 3305) @@ -0,0 +1,47 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU 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.Dam.Data +{ + + [Serializable] + public class TimeSerieSchemaValidationException : Exception + { + public TimeSerieSchemaValidationException() + { + } + + public TimeSerieSchemaValidationException(string message) + : base("Schema validation: " + message) + { + } + + protected TimeSerieSchemaValidationException( + SerializationInfo info, + StreamingContext context) + : base(info, context) + { + } + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Xsd/SoilbaseDataSet.xsd =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Xsd/SoilbaseDataSet.xsd (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Xsd/SoilbaseDataSet.xsd (revision 3305) @@ -0,0 +1,273 @@ + + + + + + + + + + + + + + + + DELETE FROM `MATERIALS` WHERE ((`MA_NR` = ?) AND ((? = 1 AND `MA_NAME` IS NULL) OR (`MA_NAME` = ?)) AND ((? = 1 AND `MA_DESCR` IS NULL) OR (`MA_DESCR` = ?)) AND ((? = 1 AND `MA_INDEX` IS NULL) OR (`MA_INDEX` = ?))) + + + + + + + + + + + + + + INSERT INTO `MATERIALS` (`MA_NAME`, `MA_DESCR`, `MA_INDEX`) VALUES (?, ?, ?) + + + + + + + + + + SELECT MA_NR, MA_NAME, MA_DESCR, MA_INDEX FROM MATERIALS + + + + + + UPDATE `MATERIALS` SET `MA_NAME` = ?, `MA_DESCR` = ?, `MA_INDEX` = ? WHERE ((`MA_NR` = ?) AND ((? = 1 AND `MA_NAME` IS NULL) OR (`MA_NAME` = ?)) AND ((? = 1 AND `MA_DESCR` IS NULL) OR (`MA_DESCR` = ?)) AND ((? = 1 AND `MA_INDEX` IS NULL) OR (`MA_INDEX` = ?))) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + DELETE FROM `PARAMETERVALUES` WHERE ((`PV_NR` = ?) AND ((? = 1 AND `MA_NR` IS NULL) OR (`MA_NR` = ?)) AND ((? = 1 AND `PN_NR` IS NULL) OR (`PN_NR` = ?)) AND ((? = 1 AND `PV_VALUE` IS NULL) OR (`PV_VALUE` = ?))) + + + + + + + + + + + + + + INSERT INTO `PARAMETERVALUES` (`MA_NR`, `PN_NR`, `PV_VALUE`) VALUES (?, ?, ?) + + + + + + + + + + SELECT PV_NR, MA_NR, PN_NR, PV_VALUE FROM PARAMETERVALUES + + + + + + UPDATE `PARAMETERVALUES` SET `MA_NR` = ?, `PN_NR` = ?, `PV_VALUE` = ? WHERE ((`PV_NR` = ?) AND ((? = 1 AND `MA_NR` IS NULL) OR (`MA_NR` = ?)) AND ((? = 1 AND `PN_NR` IS NULL) OR (`PN_NR` = ?)) AND ((? = 1 AND `PV_VALUE` IS NULL) OR (`PV_VALUE` = ?))) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + DELETE FROM `PARAMETERNAMES` WHERE ((`PN_NR` = ?) AND ((? = 1 AND `PN_NAME` IS NULL) OR (`PN_NAME` = ?))) + + + + + + + + + + INSERT INTO `PARAMETERNAMES` (`PN_NAME`) VALUES (?) + + + + + + + + SELECT PN_NR, PN_NAME FROM PARAMETERNAMES + + + + + + UPDATE `PARAMETERNAMES` SET `PN_NAME` = ? WHERE ((`PN_NR` = ?) AND ((? = 1 AND `PN_NAME` IS NULL) OR (`PN_NAME` = ?))) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/Test/Deltares.Maps.Tests.csproj =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/Test/Deltares.Maps.Tests.csproj (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/Test/Deltares.Maps.Tests.csproj (revision 3305) @@ -0,0 +1,144 @@ + + + + Debug + x86 + 9.0.30729 + 2.0 + {E0820F33-3929-493D-821D-95E755F87D0B} + Library + Properties + Deltares.Maps.Tests + Deltares.Maps.Tests + v4.5 + 512 + + + 3.5 + + + ..\..\ + true + + + true + ..\..\..\bin\Debug\ + DEBUG;TRACE + full + x86 + prompt + false + + + ..\..\..\bin\Release\ + TRACE + true + pdbonly + x86 + prompt + false + + + + False + ..\..\..\lib\DSL-Core\Deltares.Standard.dll + + + ..\..\..\packages\GeoAPI.1.7.1.1\lib\net40-client\GeoAPI.dll + + + ..\..\..\packages\NetTopologySuite.1.13.1\lib\net40-client\NetTopologySuite.dll + + + ..\..\..\packages\NetTopologySuite.IO.1.13.1\lib\net40-client\NetTopologySuite.IO.GeoTools.dll + + + ..\..\..\packages\NetTopologySuite.IO.1.13.1\lib\net40-client\NetTopologySuite.IO.MsSqlSpatial.dll + + + ..\..\..\packages\NetTopologySuite.IO.1.13.1\lib\net40-client\NetTopologySuite.IO.PostGis.dll + + + False + ..\..\..\packages\NUnit.2.6.2\lib\nunit.framework.dll + + + ..\..\..\packages\NetTopologySuite.1.13.1\lib\net40-client\PowerCollections.dll + + + ..\..\..\packages\RhinoMocks.3.6.1\lib\net\Rhino.Mocks.dll + + + + 3.5 + + + + + + + + + + + + + + + + + {17F76A8E-C9F4-415F-8D4B-0E8A3B36E665} + Deltares.Maps + + + + + Copying.GPL.licenseheader + + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + + + PreserveNewest + + + + + + + This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Assemblers/TimeSeriesAssembler.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Assemblers/TimeSeriesAssembler.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Assemblers/TimeSeriesAssembler.cs (revision 3305) @@ -0,0 +1,332 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU 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 Deltares.Standard; +using System.Reflection; +using System.Xml.Linq; +using System.Xml.Schema; +using System.IO; +using System.Xml; +using System.Globalization; +using Deltares.Standard.IO.DtoAssembler; + + +namespace Deltares.Dam.Data.Assemblers +{ + using Standard.Extensions; + + public class TimeSeriesAssembler : DtoAssembler + { + #region Constant declarations + + /// + /// Holds the xml element name + /// + private const string XmlElementName = "TimeSeries"; + + /// + /// Holds the name of the xml schema + /// + private const string XmlSchemaName = "pi_timeseries"; + + private const string XmlSchemaNameSharedTypes = "pi_sharedtypes"; + + /// + /// Holds the xml namespace + /// + private const string XmlElementNamespace = "http://www.wldelft.nl/fews/PI"; + + /// + /// Holds the common part of the path to the embedded resource + /// + private const string EmbeddedResourcePath = "Deltares.Dam.Data.Xsd"; + + /// + /// Holds the xsd resource path + /// + private const string XsdEmbeddedResourcePath = EmbeddedResourcePath + "." + XmlSchemaName + ".xsd"; + + private const string XsdEmbeddedResourcePathSharedTypes = EmbeddedResourcePath + "." + XmlSchemaNameSharedTypes + ".xsd"; + + public const string XmlVersionAttributeName = "version"; + public const string XmlTimeZoneElementName = "timeZone"; + public const string XmlSeriesElementName = "series"; + public const string XmlHeaderElementName = "header"; + public const string XmlTypeElementName = "type"; + public const string XmlLocationIdElementName = "locationId"; + public const string XmlParameterIdElementName = "parameterId"; + public const string XmlTimeStepElementName = "timeStep"; + public const string XmlStartDateElementName = "startDate"; + public const string XmlEndDateElementName = "endDate"; + public const string XmlForecastDateElementName = "forecastDate"; + public const string XmlMissValElementName = "missVal"; + public const string XmlLongNameElementName = "longName"; + public const string XmlStationNameElementName = "stationName"; + public const string XmlUnitsElementName = "units"; + public const string XmlSourceOrganisationElementName = "sourceOrganisation"; + public const string XmlSourceSystemElementName = "sourceSystem"; + public const string XmlFileDescriptionElementName = "fileDescription"; + public const string XmlCreationDateElementName = "creationDate"; + public const string XmlCreationTimeElementName = "creationTime"; + public const string XmlRegionElementName = "region"; + public const string XmlUnitAttributeName = "unit"; + public const string XmlDividerAttributeName = "divider"; + public const string XmlMultiplierAttributeName = "multiplier"; + public const string XmlDateAttributeName = "date"; + public const string XmlTimeAttributeName = "time"; + public const string XmlEntryElementName = "event"; + public const string XmlValueAttributeName = "value"; + public const string XmlFlagAttributeName = "flag"; + public const string XMLCommentElementName = "comment"; + + + #endregion + + public TimeSeriesAssembler() + : base(XmlElementName, XmlElementNamespace, Assembly.GetExecutingAssembly().GetEmbeddedFile(XsdEmbeddedResourcePath)) + { + AddOrUpdateMapping("Version", XmlVersionAttributeName); + } + + public override TimeSerieCollection CreateDomainObject(XElement dtoObj) + { + TimeSerieCollection timeSerieCollection = base.CreateDomainObject(dtoObj); + + XNamespace tns = this.ElementNamespace; + + // Time zone + XElement timeZoneElement = dtoObj.Element(tns + TimeSeriesAssembler.XmlTimeZoneElementName); + if (timeZoneElement != null) + { + timeSerieCollection.TimeZone = Double.Parse(timeZoneElement.Value, CultureInfo.InvariantCulture); + } + + // Series + IEnumerable serieElementCollection = dtoObj.Elements(tns + TimeSeriesAssembler.XmlSeriesElementName); + + foreach (XElement serieElement in serieElementCollection) + { + var timeSerie = new TimeSerie(); + + // Header + XElement headerElement = serieElement.Element(tns + TimeSeriesAssembler.XmlHeaderElementName); + + timeSerie.Type = GetElementValue(headerElement, tns + XmlTypeElementName); + timeSerie.LocationId = GetElementValue(headerElement, tns + XmlLocationIdElementName); + timeSerie.ParameterId = GetElementValue(headerElement, tns + XmlParameterIdElementName); + + XElement timeStepElement = headerElement.Element(tns + TimeSeriesAssembler.XmlTimeStepElementName); + timeSerie.TimeStep.Unit = (TimeStepUnit)Enum.Parse(typeof(TimeStepUnit), timeStepElement.AttributeAs(TimeSeriesAssembler.XmlUnitAttributeName), true); + + timeSerie.TimeStep.Divider = timeStepElement.AttributeAs(TimeSeriesAssembler.XmlDividerAttributeName); + + timeSerie.TimeStep.Multiplier = timeStepElement.AttributeAs(TimeSeriesAssembler.XmlMultiplierAttributeName); + XElement startDateElement = headerElement.Element(tns + TimeSeriesAssembler.XmlStartDateElementName); + timeSerie.StartDateTime = startDateElement.AttributeAs(TimeSeriesAssembler.XmlDateAttributeName).Date + + startDateElement.AttributeAs(TimeSeriesAssembler.XmlTimeAttributeName).TimeOfDay; + XElement endDateElement = headerElement.Element(tns + TimeSeriesAssembler.XmlEndDateElementName); + timeSerie.EndDateTime = endDateElement.AttributeAs(TimeSeriesAssembler.XmlDateAttributeName).Date + + endDateElement.AttributeAs(TimeSeriesAssembler.XmlTimeAttributeName).TimeOfDay; + XElement forecastDateElement = headerElement.Element(tns + TimeSeriesAssembler.XmlForecastDateElementName); + + if (forecastDateElement != null) + { + timeSerie.ForecastDateTime = forecastDateElement.AttributeAs(TimeSeriesAssembler.XmlDateAttributeName).Date + + forecastDateElement.AttributeAs(TimeSeriesAssembler.XmlTimeAttributeName).TimeOfDay; + } + + timeSerie.MissVal = GetElementValue(headerElement, tns + XmlMissValElementName); + timeSerie.LongName = GetElementValue(headerElement, tns + XmlLongNameElementName); + timeSerie.StationName = GetElementValue(headerElement, tns + XmlStationNameElementName); + timeSerie.Units = GetElementValue(headerElement, tns + XmlUnitsElementName); + timeSerie.SourceOrganisation = GetElementValue(headerElement, tns + XmlSourceOrganisationElementName); + timeSerie.SourceSystem = GetElementValue(headerElement, tns + XmlSourceSystemElementName); + timeSerie.FileDescription = GetElementValue(headerElement, tns + XmlFileDescriptionElementName); + + XElement creationDateElement = headerElement.Element(tns + XmlCreationDateElementName); + XElement creationTimeElement = headerElement.Element(tns + XmlCreationTimeElementName); + if (creationDateElement != null) + { + timeSerie.CreationDateTime = creationDateElement.Value.ToType().Date; + if (creationTimeElement != null) + { + timeSerie.CreationDateTime += creationTimeElement.Value.ToType().TimeOfDay; + } + } + + timeSerie.Region = GetElementValue(headerElement, tns + XmlRegionElementName); + + // Entries + IEnumerable entryElementCollection = serieElement.Elements(tns + TimeSeriesAssembler.XmlEntryElementName); + + foreach (XElement entryElement in entryElementCollection) + { + TimeSerieEntry entry = new TimeSerieEntry(); + entry.DateTime = entryElement.AttributeAs(XmlDateAttributeName).Date + + entryElement.AttributeAs(XmlTimeAttributeName).TimeOfDay; + entry.Value = entryElement.AttributeAs(XmlValueAttributeName); + entry.Flag = entryElement.AttributeAs(XmlFlagAttributeName); + + timeSerie.Entries.Add(entry); + } + + // Comment + XElement commentElement = serieElement.Element(tns + XMLCommentElementName); + if (commentElement != null) + timeSerie.Comment = commentElement.Value; + + timeSerieCollection.Series.Add(timeSerie); + } + + return timeSerieCollection; + } + + private static T GetElementValue(XContainer parent, XName name) + { + var element = parent.Element(name); + if (element != null) + return element.Value.ToType(); + + return default(T); + } + + public override XElement CreateDataTransferObject(TimeSerieCollection timeSerieCollection) + { + XElement rootElement = base.CreateDataTransferObject(timeSerieCollection); + + XNamespace tns = ElementNamespace; + + // Time zone + rootElement.Add(new XElement(tns + XmlTimeZoneElementName, timeSerieCollection.TimeZone)); + + // Series + foreach (TimeSerie timeSerie in timeSerieCollection.Series) + { + XElement serieElement = new XElement(tns + XmlSeriesElementName); + + XElement headerElement = new XElement(tns + XmlHeaderElementName); + headerElement.Add(new XElement(tns + XmlTypeElementName, timeSerie.Type)); + headerElement.Add(new XElement(tns + XmlLocationIdElementName, timeSerie.LocationId)); + headerElement.Add(new XElement(tns + XmlParameterIdElementName, timeSerie.ParameterId)); + + headerElement.Add(new XElement(tns + XmlTimeStepElementName, + new XAttribute(XmlUnitAttributeName, timeSerie.TimeStep.Unit.ToString().ToLower()), + (timeSerie.TimeStep.MultiplierSpecified ? new XAttribute(XmlMultiplierAttributeName, timeSerie.TimeStep.Multiplier) : null), + (timeSerie.TimeStep.DividerSpecified ? new XAttribute(XmlDividerAttributeName, timeSerie.TimeStep.Divider) : null) + )); + + headerElement.Add(new XElement(tns + XmlStartDateElementName, + new XAttribute(XmlDateAttributeName, timeSerie.StartDateTime.ToString("yyyy-MM-dd")), + new XAttribute(XmlTimeAttributeName, timeSerie.StartDateTime.ToString("HH:mm:ss")))); + headerElement.Add(new XElement(tns + XmlEndDateElementName, + new XAttribute(XmlDateAttributeName, timeSerie.EndDateTime.ToString("yyyy-MM-dd")), + new XAttribute(XmlTimeAttributeName, timeSerie.EndDateTime.ToString("HH:mm:ss")))); + + if (!timeSerie.ForecastDateTime.Equals(DateTime.MinValue)) + headerElement.Add(new XElement(tns + XmlForecastDateElementName, + new XAttribute(XmlDateAttributeName, timeSerie.ForecastDateTime.ToString("yyyy-MM-dd")), + new XAttribute(XmlTimeAttributeName, timeSerie.ForecastDateTime.ToString("HH:mm:ss")))); + + headerElement.Add(new XElement(tns + XmlMissValElementName, timeSerie.MissVal)); + if (timeSerie.LongName != null) + headerElement.Add(new XElement(tns + XmlLongNameElementName, timeSerie.LongName)); + if (timeSerie.StationName != null) + headerElement.Add(new XElement(tns + XmlStationNameElementName, timeSerie.StationName)); + if (timeSerie.Units != null) + headerElement.Add(new XElement(tns + XmlUnitsElementName, timeSerie.Units)); + if (timeSerie.SourceOrganisation != null) + headerElement.Add(new XElement(tns + XmlSourceOrganisationElementName, timeSerie.SourceOrganisation)); + if (timeSerie.SourceSystem != null) + headerElement.Add(new XElement(tns + XmlSourceSystemElementName, timeSerie.SourceSystem)); + if (timeSerie.FileDescription != null) + headerElement.Add(new XElement(tns + XmlFileDescriptionElementName, timeSerie.FileDescription)); + if (timeSerie.CreationDateTime != null) + { + headerElement.Add(new XElement(tns + XmlCreationDateElementName, timeSerie.CreationDateTime.Value.ToString("yyyy-MM-dd"))); + headerElement.Add(new XElement(tns + XmlCreationTimeElementName, timeSerie.CreationDateTime.Value.ToString("HH:mm:ss"))); + } + if (timeSerie.Region != null) + headerElement.Add(new XElement(tns + XmlRegionElementName, timeSerie.Region)); + + serieElement.Add(headerElement); + + // Entries + foreach (var entry in timeSerie.Entries) + { + XElement entryElement = new XElement(tns + XmlEntryElementName, + new XAttribute(XmlDateAttributeName, entry.DateTime.ToString("yyyy-MM-dd")), + new XAttribute(XmlTimeAttributeName, entry.DateTime.ToString("HH:mm:ss")), + new XAttribute(XmlValueAttributeName, entry.Value), + new XAttribute(XmlFlagAttributeName, entry.Flag)); + serieElement.Add(entryElement); + } + + // Comment + if (timeSerie.Comment != null) + { + XElement commentElement = new XElement(tns + XMLCommentElementName, timeSerie.Comment); + serieElement.Add(commentElement); + } + + rootElement.Add(serieElement); + } + + return rootElement; + } + + public XDocument CreateDataTransferDocument(TimeSerieCollection timeSerieCollection) + { + XDocument doc = new XDocument(new XDeclaration("1.0", "utf-8", "yes")); + + XNamespace xsi = "http://www.w3.org/2001/XMLSchema-instance"; + + + XElement root = CreateDataTransferObject(timeSerieCollection); + + doc.Add(root); + + root.Add(new XAttribute(XNamespace.Xmlns + "xsi", xsi.NamespaceName)); + + return doc; + } + + public bool ValidateSchema(XDocument doc, out string message) + { + bool result = true; + string errorMessage = String.Empty; + + XmlSchemaSet schemas = new XmlSchemaSet(); + + Stream xsdStream = Assembly.GetExecutingAssembly().GetEmbeddedFile(XsdEmbeddedResourcePath); + schemas.Add(XmlElementNamespace, XmlReader.Create(xsdStream)); + xsdStream = Assembly.GetExecutingAssembly().GetEmbeddedFile(XsdEmbeddedResourcePathSharedTypes); + schemas.Add(XmlElementNamespace, XmlReader.Create(xsdStream)); + + doc.Validate(schemas, (o, e) => { result = false; errorMessage = e.Message; }, true); + + message = errorMessage; + + return result; + } + } +} Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/CsvExportSurfaceLineIdentifiers.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/CsvExportSurfaceLineIdentifiers.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/CsvExportSurfaceLineIdentifiers.cs (revision 3305) @@ -0,0 +1,37 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +namespace Deltares.Dam.Data +{ + public class CsvExportSurfaceLineIdentifiers + { + public const string CsvHeaderSoilProfileId = "soilprofile_id"; + public const string CsvHeaderScenario = "location_scenario_id"; + public const string CsvHeaderCalculationMechanism = "calculation_mechanism"; + public const string CsvHeaderCalculationModel = "calculation_model"; + + public string LocationId { get; set; } + public string SoilProfileId { get; set; } + public string Scenario { get; set; } + public string CalculationMechanism { get; set; } + public string CalculationModel { get; set; } + } +} Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/CsvImporters/CsvImporterHelper.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/CsvImporters/CsvImporterHelper.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/CsvImporters/CsvImporterHelper.cs (revision 3305) @@ -0,0 +1,49 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU 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.Standard.Language; +using LumenWorks.Framework.IO.Csv; + +namespace Deltares.Dam.Data.CsvImporters +{ + public class CsvImporterHelper + { + /// + /// Read field headers of csv file with improved error messages + /// + /// the calling object + /// the scv reader + /// + static public string[] GetFieldHeaders(Object caller, CsvReader csvReader) + { + try + { + return csvReader.GetFieldHeaders(); + } + catch (Exception exception) + { + string message = String.Format(LocalizationManager.GetTranslatedText(caller, "ErrorReadingCsvColumnNames"), exception.Message, caller.GetType()); + throw new CsvImporterException(message); + } + } + } +} Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DamFailureMechanismeCalculationSpecification.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DamFailureMechanismeCalculationSpecification.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DamFailureMechanismeCalculationSpecification.cs (revision 3305) @@ -0,0 +1,291 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System.Collections; +using System.ComponentModel; +using System.Xml.Serialization; +using Deltares.Dam.Data.UISupport; +using Deltares.Standard; +using Deltares.Standard.Attributes; +using Deltares.Standard.EventPublisher; +using Deltares.Standard.Validation; + +namespace Deltares.Dam.Data +{ + using System; + + /// + /// + /// + public class DamFailureMechanismeCalculationSpecification: IDomain, IVisibleEnabled + { + private FailureMechanismSystemType failureMechanismSystemType; + private PipingModelType pipingModelType = PipingModelType.Sellmeijer4Forces; + private Enum calculationModel; + private FailureMechanismeParamatersMStab failureMechanismeParamatersMStab; + private static DamProjectType damProjectType; + private StabilityKernelType stabilityKernelType = StabilityKernelType.DamClassicStability; + private Boolean firstTime = true; + + public DamFailureMechanismeCalculationSpecification() + { + //Todo interface + failureMechanismSystemType = FailureMechanismSystemType.StabilityInside; + failureMechanismeParamatersMStab = new FailureMechanismeParamatersMStab(); + CalculationModel = failureMechanismeParamatersMStab.MStabParameters.Model; + FailureMechanismeParamatersMStab.MStabParameters.GridPosition = MStabGridPosition.Right; + ReadUserSettingsSlipCircleDefinition(); + } + + [Browsable(false)] + [Validate] + public FailureMechanismeParamatersMStab FailureMechanismeParamatersMStab + { + get { return failureMechanismeParamatersMStab; } + set { failureMechanismeParamatersMStab = value; } + } + + [Label("Failure mechanism")] + [PropertyOrder(1, 0)] + public FailureMechanismSystemType FailureMechanismSystemType + { + get { return failureMechanismSystemType; } + set + { + // Make sure the set is done for the very first time too even when the value has not changed (MWDAM-1199). + if (failureMechanismSystemType != value || firstTime) + { + firstTime = false; + DataEventPublisher.BeforeChange(this, "FailureMechanismSystemType"); + failureMechanismSystemType = value; + // To solve MWDAM-592, remember the current pipingmodeltype as this gets reset by setting the + // calculationmodel. Only switch it back when needed. + var oldPipingModelType = pipingModelType; + foreach (Enum possibleModel in this.GetDomain("CalculationModel")) + { + this.CalculationModel = possibleModel; + break; + } + switch (failureMechanismSystemType) + { + case FailureMechanismSystemType.StabilityInside: + failureMechanismeParamatersMStab.MStabParameters.GridPosition = MStabGridPosition.Right; + break; + case FailureMechanismSystemType.StabilityOutside: + failureMechanismeParamatersMStab.MStabParameters.GridPosition = MStabGridPosition.Left; + break; + case FailureMechanismSystemType.Piping: + PipingModelType = oldPipingModelType; + break; + } + DataEventPublisher.AfterChange(this, "FailureMechanismSystemType"); + } + } + } + + [Browsable(false)] + public PipingModelType PipingModelType + { + get { return pipingModelType; } + set + { + pipingModelType = value; + if (failureMechanismSystemType == FailureMechanismSystemType.Piping) + { + CalculationModel = pipingModelType; + } + } + } + + [Browsable(false)] + public static DamProjectType DamProjectType + { + get { return damProjectType; } + set { damProjectType = value; } + } + + /// + /// The calculationmodel is only needed to support the selection of the modeltype in the UI. The dropdownlist + /// in the UI depends on this. This set can be filled with any proper types (for piping, stabilty etc) for any + /// mechanisme instead of the fixed types per mechanisme. + /// + [XmlIgnore] + [Label("Model")] + [PropertyOrder(1, 1)] + public Enum CalculationModel + { + get { return calculationModel; } + set + { + DataEventPublisher.BeforeChange(this, "CalculationModel"); + calculationModel = value; + if (value is PipingModelType) + { + pipingModelType = (PipingModelType) value; + } + else + { + failureMechanismeParamatersMStab.MStabParameters.Model = (MStabModelType)value; + } + DataEventPublisher.AfterChange(this, "CalculationModel"); + } + } + + [Browsable(false)] + public MStabModelType StabilityModelType + { + get { return failureMechanismeParamatersMStab.MStabParameters.Model; } + set + { + failureMechanismeParamatersMStab.MStabParameters.Model = value; + if (failureMechanismSystemType != FailureMechanismSystemType.Piping) + { + CalculationModel = value; + } + } + } + + [Browsable(false)] + public StabilityKernelType StabilityKernelType + { + get { return stabilityKernelType; } + set { stabilityKernelType = value; } + } + + public void Assign(DamFailureMechanismeCalculationSpecification damFailureMechanismeCalculation) + { + failureMechanismSystemType = damFailureMechanismeCalculation.FailureMechanismSystemType; + calculationModel = damFailureMechanismeCalculation.CalculationModel; + pipingModelType = damFailureMechanismeCalculation.pipingModelType; + failureMechanismeParamatersMStab.Assign(damFailureMechanismeCalculation.FailureMechanismeParamatersMStab); + StabilityModelType = damFailureMechanismeCalculation.StabilityModelType; + stabilityKernelType = damFailureMechanismeCalculation.StabilityKernelType; + //assign interface + } + + public DamFailureMechanismeCalculationSpecification Clone() + { + DamFailureMechanismeCalculationSpecification damFailureMechanismeCalculation = new DamFailureMechanismeCalculationSpecification(); + + damFailureMechanismeCalculation.Assign(this); + + return damFailureMechanismeCalculation; + } + + public override string ToString() + { + string description = ""; + description += String.Format("{0}", StabilityKernelType); + description += String.Format("{0}", this.FailureMechanismSystemType); + if ((this.FailureMechanismSystemType == FailureMechanismSystemType.StabilityInside) || + (this.FailureMechanismSystemType == FailureMechanismSystemType.StabilityOutside)) + { + //interface? + description += String.Format(" ({0})", this.FailureMechanismeParamatersMStab.MStabParameters.Model); + } + + return description; + } + + public ICollection GetDomain(string property) + { + switch (property) + { + case "CalculationModel": + return (ConfigurationManager.Instance.GetAvailableMechanismModels(StabilityKernelType, DamProjectType, failureMechanismSystemType)); + case "PipingModelType": + return (ConfigurationManager.Instance.GetAvailableMechanismModels(StabilityKernelType, DamProjectType, FailureMechanismSystemType.Piping)); + case "FailureMechanismSystemType": + return (ConfigurationManager.Instance.GetAvailableFailureMechanisms(StabilityKernelType, DamProjectType)); + case "StabilityKernelType": + return (ConfigurationManager.Instance.GetAvailableFailureMechanisms(StabilityKernelType, DamProjectType)); + default: return null; + } + } + + + public bool IsEnabled(string property) + { + return true; + } + + public bool IsVisible(string property) + { + switch (property) + { + case "FailureMechanismeParamatersMStab": + switch (this.FailureMechanismSystemType) + { + case Data.FailureMechanismSystemType.StabilityInside: return true; + case Data.FailureMechanismSystemType.StabilityOutside: return true; + case Data.FailureMechanismSystemType.HorizontalBalance: return false; + case Data.FailureMechanismSystemType.Piping: return false; + default: return true; + } + default: return true; + } + } + + /// + /// Determines whether slip circle definition is undefined. + /// + /// + /// true if [is slip circle definition undefined]; otherwise, false. + /// + public bool IsSlipCircleDefinitionUndefined() + { + bool isSlipCircleDefinitionUndefined = (failureMechanismeParamatersMStab.MStabParameters.SlipCircleDefinition == null); + if (!isSlipCircleDefinitionUndefined) + { + isSlipCircleDefinitionUndefined = (failureMechanismeParamatersMStab.MStabParameters.SlipCircleDefinition.UpliftVanLeftGridHorizontalPointCount == 0); + } + return isSlipCircleDefinitionUndefined; + } + + /// + /// Reads the user settings. + /// + public void ReadUserSettingsSlipCircleDefinition() + { + if (failureMechanismeParamatersMStab.MStabParameters.SlipCircleDefinition == null) + { + failureMechanismeParamatersMStab.MStabParameters.SlipCircleDefinition = new SlipCircleDefinition(); + } + failureMechanismeParamatersMStab.MStabParameters.SlipCircleDefinition.UpliftVanTangentLinesDefinition = Properties.Settings.Default.SlipCircleUpliftVanTangentLinesDefinition; + failureMechanismeParamatersMStab.MStabParameters.SlipCircleDefinition.UpliftVanTangentLinesDistance = Properties.Settings.Default.SlipCircleUpliftVanTangentLinesDistance; + failureMechanismeParamatersMStab.MStabParameters.SlipCircleDefinition.BishopTangentLinesDefinition = Properties.Settings.Default.SlipCircleBishopTangentLinesDefinition; + failureMechanismeParamatersMStab.MStabParameters.SlipCircleDefinition.BishopTangentLinesDistance = Properties.Settings.Default.SlipCircleBishopTangentLinesDistance; + failureMechanismeParamatersMStab.MStabParameters.SlipCircleDefinition.GridSizeDetermination = Properties.Settings.Default.SlipCircleGridSizeDetermination; + failureMechanismeParamatersMStab.MStabParameters.SlipCircleDefinition.UpliftVanLeftGridVerticalPointCount = Properties.Settings.Default.SlipCircleUpliftVanLeftGridVerticalPointCount; + failureMechanismeParamatersMStab.MStabParameters.SlipCircleDefinition.UpliftVanLeftGridVerticalPointDistance = Properties.Settings.Default.SlipCircleUpliftVanLeftGridVerticalPointDistance; + failureMechanismeParamatersMStab.MStabParameters.SlipCircleDefinition.UpliftVanLeftGridHorizontalPointCount = Properties.Settings.Default.SlipCircleUpliftVanLeftGridHorizontalPointCount; + failureMechanismeParamatersMStab.MStabParameters.SlipCircleDefinition.UpliftVanLeftGridHorizontalPointDistance = Properties.Settings.Default.SlipCircleUpliftVanLeftGridHorizontalPointDistance; + failureMechanismeParamatersMStab.MStabParameters.SlipCircleDefinition.UpliftVanRightGridVerticalPointCount = Properties.Settings.Default.SlipCircleUpliftVanRightGridVerticalPointCount; + failureMechanismeParamatersMStab.MStabParameters.SlipCircleDefinition.UpliftVanRightGridVerticalPointDistance = Properties.Settings.Default.SlipCircleUpliftVanRightGridVerticalPointDistance; + failureMechanismeParamatersMStab.MStabParameters.SlipCircleDefinition.UpliftVanRightGridHorizontalPointCount = Properties.Settings.Default.SlipCircleUpliftVanRightGridHorizontalPointCount; + failureMechanismeParamatersMStab.MStabParameters.SlipCircleDefinition.UpliftVanRightGridHorizontalPointDistance = Properties.Settings.Default.SlipCircleUpliftVanRightGridHorizontalPointDistance; + failureMechanismeParamatersMStab.MStabParameters.SlipCircleDefinition.BishopGridVerticalPointCount = Properties.Settings.Default.SlipCircleBishopGridVerticalPointCount; + failureMechanismeParamatersMStab.MStabParameters.SlipCircleDefinition.BishopGridVerticalPointDistance = Properties.Settings.Default.SlipCircleBishopGridVerticalPointDistance; + failureMechanismeParamatersMStab.MStabParameters.SlipCircleDefinition.BishopGridHorizontalPointCount = Properties.Settings.Default.SlipCircleBishopGridHorizontalPointCount; + failureMechanismeParamatersMStab.MStabParameters.SlipCircleDefinition.BishopGridHorizontalPointDistance = Properties.Settings.Default.SlipCircleBishopGridHorizontalPointDistance; + } + } +} Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.DamClientsLibrary.Version/GlobalAssembly.cs.svn =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.DamClientsLibrary.Version/GlobalAssembly.cs.svn (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.DamClientsLibrary.Version/GlobalAssembly.cs.svn (revision 3305) @@ -0,0 +1,13 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Deltares")] +[assembly: AssemblyCopyright("Copyright © Deltares 2019")] +[assembly: AssemblyProduct("DAM (Dijksterkte Analyse Module)")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +[assembly: AssemblyVersion("19.1.0.SVNREV")] +[assembly: AssemblyFileVersion("19.1.0.SVNREV")] \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/Test/TestData/Gemeenten.fix =================================================================== diff -u Binary files differ Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/EntityFactory.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/EntityFactory.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/EntityFactory.cs (revision 3305) @@ -0,0 +1,785 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using Deltares.Geometry; +using Deltares.Geotechnics.GeotechnicalGeometry; +using Deltares.Standard.Extensions; +using System; +using System.Collections.Generic; +using System.Linq; +using Deltares.Geotechnics.Soils; +using Deltares.Geotechnics.SurfaceLines; +using Deltares.Soilbase; + +namespace Deltares.Dam.Data +{ + public class EntityFactory + { + #region Private lookup tables (lists) + + /// + /// Holds a reference to the (concrete) Location list + /// + private readonly IList locations = new List(); + + /// + /// Holds a reference to the (concrete) Segment list + /// + private readonly IList segments = new List(); + + /// + /// Holds a reference to the (concrete) SoilProfile list + /// + private readonly IList soilProfiles = new List(); + + /// + /// Holds a reference to the (concrete) SurfaceLine list + /// + private readonly IList surfaceLines = new List(); + + /// + /// Holds a reference to the (concrete) pl1Line list + /// + private readonly IList pl1Lines = new List(); + + private readonly IList gauges = new List(); + + /// + /// Holds a reference to the (concrete) SurfaceLine list + /// + private readonly IList scenarios = new List(); + + #endregion + + #region Constructors + + public EntityFactory() + : this(null, null, null, null, null, null) + { + } + + /// + /// + /// + /// The surface lines look up table + public EntityFactory(IEnumerable surfaceLines) + : this(null, null, null, surfaceLines, null, null) + { + + } + + /// + /// + /// + /// The segment look up table + /// The surface lines look up table + public EntityFactory(IEnumerable segments, IEnumerable surfaceLines) + : this(null, null, segments, surfaceLines, null, null) + { + + } + + /// + /// + /// + /// A soil profiles + /// The location look up table + /// The segment look up table + public EntityFactory(IEnumerable locations, IEnumerable soilProfiles, IEnumerable segments) + : this(locations, soilProfiles, segments, null, null, null) + { + } + + /// + /// + /// + /// A soil profiles + /// The location look up table + /// The segment look up table + /// The surface lines look up table + /// The pl1Lines look up table + /// The gauges look up table + public EntityFactory(IEnumerable locations, IEnumerable soilProfiles, IEnumerable segments, IEnumerable surfaceLines, + IEnumerable pl1Lines, IEnumerable gauges) + { + if (soilProfiles != null) + { + this.soilProfiles = soilProfiles as IList; + if (this.soilProfiles == null) + { + this.soilProfiles = new List(); + this.soilProfiles.AddRangeLeavingNullElementsOut(soilProfiles); + } + else + { + this.soilProfiles.RemoveNullElements(); + } + } + + if (segments != null) + { + this.segments = segments as IList; + if (this.segments == null) + { + this.segments = new List(); + this.segments.AddRangeLeavingNullElementsOut(segments); + } + else + { + this.segments.RemoveNullElements(); + } + } + + + if (locations != null) + { + this.locations = locations as IList; + if (this.locations == null) + { + this.locations = new List(); + this.locations.AddRangeLeavingNullElementsOut(locations); + } + else + { + this.locations.RemoveNullElements(); + } + } + + if (surfaceLines != null) + { + this.surfaceLines = surfaceLines as IList; + if (this.surfaceLines == null) + { + this.surfaceLines = new List(); + this.surfaceLines.AddRangeLeavingNullElementsOut(surfaceLines); + } + else + { + this.surfaceLines.RemoveNullElements(); + } + } + + if (pl1Lines != null) + { + this.pl1Lines = pl1Lines as IList; + if (this.pl1Lines == null) + { + this.pl1Lines = new List(); + this.pl1Lines.AddRangeLeavingNullElementsOut(pl1Lines); + } + else + { + this.pl1Lines.RemoveNullElements(); + } + } + + if (gauges != null) + { + this.gauges = gauges as IList; + if (this.gauges == null) + { + this.gauges = new List(); + this.gauges.AddRangeLeavingNullElementsOut(gauges); + } + else + { + this.gauges.RemoveNullElements(); + } + } + + if (scenarios != null) + { + this.scenarios = scenarios as IList; + if (this.scenarios == null) + { + this.scenarios = new List(); + this.scenarios.AddRangeLeavingNullElementsOut(scenarios); + } + else + { + this.scenarios.RemoveNullElements(); + } + } + + } + + #endregion + + #region Public lookup tables (IEnumarable collections) + + /// + /// Gets a reference to the locations list through the interface + /// + public IList Locations + { + get { return locations; } + } + + + /// + /// Gets a reference to the segments list through the interface + /// + public IEnumerable Segments + { + get { return segments; } + } + + /// + /// Gets a reference to the soilProfiles list through the interface + /// + public IEnumerable SoilProfiles + { + get { return soilProfiles; } + } + + /// + /// Gets a reference to the surfaceLines list through the interface + /// + public IEnumerable SurfaceLines + { + get { return surfaceLines; } + } + + + /// + /// Gets a reference to the scenarios list through the interface + /// + public IList Scenarios + { + get { return scenarios; } + } + + #endregion + + #region Factory / Creational Methods + + public Dike CreateDike(string dikeId) + { + return new Dike { Name = dikeId }; + } + + public Dike CreateDummyDike(string dikeId) + { + var dike = new Dike(); + dike.Name = dikeId; + dike.ShearStrengthModel = MStabShearStrength.CuGradient; + dike.SoilDatabaseName = SoilbaseDB.DefaultDatabaseName; + // PlLine + GeometryPoint plp1 = new GeometryPoint(); + plp1.X = 1; + plp1.Y = 2; + plp1.Z = 3; + GeometryPoint plp2 = new GeometryPoint(); + plp2.X = 4; + plp2.Y = 5; + plp2.Z = 6; + PL1Line pL1Line = new PL1Line(); + pL1Line.Points.Add(plp1); + pL1Line.Points.Add(plp2); + dike.PL1Lines.Add(pL1Line); + // Locations + Location location1 = new Location(); + location1.DampingFactorPL3 = 0.3; + location1.DampingFactorPL4 = 0.4; + location1.PL1Line = pL1Line; + location1.Name = "Location1"; + location1.XRd = 45782; + location1.YRd = 143090; + location1.DikeEmbankmentMaterial = "clay"; + location1.ShoulderEmbankmentMaterial = "sand"; + location1.StabilityShoulderGrowSlope = 3.1; + location1.StabilityShoulderGrowDeltaX = 3.2; + location1.StabilitySlopeAdaptionDeltaX = 3.3; + location1.IntrusionVerticalWaterPressure = IntrusionVerticalWaterPressureType.FullHydroStatic; + location1.PenetrationLength = 3.6; + location1.TrafficLoad = 3.7; + location1.TL_DegreeOfConsolidation = 3.8; + location1.MinimalCircleDepth = 1.11; + location1.DistanceToEntryPoint = 1.16; + + dike.Locations.Add(location1); + Location location2 = new Location(); + location2.Name = "Location2"; + dike.Locations.Add(location2); + Location location3 = new Location(); + location3.Name = "Location3"; + dike.Locations.Add(location3); + Location location4 = new Location(); + location4.Name = "Location4"; + dike.Locations.Add(location4); + Location location5 = new Location(); + location5.Name = "Location5"; + dike.Locations.Add(location5); + + // Segments + Segment segment1 = new Segment(); + segment1.Name = "Segment1"; + Segment segment2 = new Segment(); + segment2.Name = "Segment2"; + + // Surface lines + var surfaceLine1 = new SurfaceLine2 + { + Geometry = new LocalizedGeometryPointString(), + CharacteristicPoints = { GeometryMustContainPoint = true }, + Name = "SurfaceLine1" + }; + dike.SurfaceLines2.Add(surfaceLine1); + var surfaceLine2 = new SurfaceLine2 + { + Geometry = new LocalizedGeometryPointString(), + CharacteristicPoints = { GeometryMustContainPoint = true }, + Name = "SurfaceLine2" + }; + dike.SurfaceLines2.Add(surfaceLine2); + + //Soils + Soil soilClay1 = new Soil(); + soilClay1.UseDefaultProbabilisticValues = false; + soilClay1.Name = "HW-OBO"; + soilClay1.AbovePhreaticLevel = 15.00; + soilClay1.BelowPhreaticLevel = 16.00; + soilClay1.DiameterD70 = 0.000013; + soilClay1.WhitesConstant = 1.0; + soilClay1.BeddingAngle = 1.0; + soilClay1.PermeabKx = 1.0; + soilClay1.ExcessPorePressure = 21.0; + soilClay1.PorePressureFactor = 0.8; + soilClay1.Cohesion = 12.7; + soilClay1.FrictionAngle = 11.1; + //soilClay1.StressTableName = "strtab"; + //soilClay1.StressTableNr = 3; + //soilClay1.BondStressTableName = "bondstrtab"; + //soilClay1.BondStressTableNr = 2; + soilClay1.ShearStrengthModel = ShearStrengthModel.CPhi; + soilClay1.UseDefaultProbabilisticValues = false; + soilClay1.CorrelationCPhi = 0.5; + soilClay1.POP = 4.2; + soilClay1.SoilGroup = 11; + soilClay1.RRatio = 5.5; + dike.SoilList.Soils.Add(soilClay1); + + Soil soilPeat1 = new Soil(); + soilPeat1.UseDefaultProbabilisticValues = false; + soilPeat1.Name = "HW-DUN"; + soilPeat1.AbovePhreaticLevel = 11.00; + soilPeat1.BelowPhreaticLevel = 13.00; + dike.SoilList.Soils.Add(soilPeat1); + Soil soilSand1 = new Soil(); + soilSand1.UseDefaultProbabilisticValues = false; + soilSand1.Name = "Alg-zand (0-30)"; + soilSand1.AbovePhreaticLevel = 18.50; + soilSand1.BelowPhreaticLevel = 21.75; + dike.SoilList.Soils.Add(soilSand1); + + Soil soilClay2 = new Soil(); + soilClay2.UseDefaultProbabilisticValues = false; + soilClay2.Name = "HW-OBO1"; + soilClay2.AbovePhreaticLevel = 14.67; + soilClay2.BelowPhreaticLevel = 16.45; + dike.SoilList.Soils.Add(soilClay2); + Soil soilPeat2 = new Soil(); + soilPeat2.UseDefaultProbabilisticValues = false; + soilPeat2.Name = "HW-DUN1"; + soilPeat2.AbovePhreaticLevel = 11.13; + soilPeat2.BelowPhreaticLevel = 12.64; + dike.SoilList.Soils.Add(soilPeat2); + Soil soilSand2 = new Soil(); + soilSand2.UseDefaultProbabilisticValues = false; + soilSand2.Name = "Alg-zand (0-30)1"; + soilSand2.AbovePhreaticLevel = 17.92; + soilSand2.BelowPhreaticLevel = 22.08; + dike.SoilList.Soils.Add(soilSand2); + + // Soil profiles + SoilProfile1D soilProfile1 = new SoilProfile1D(); + soilProfile1.Name = "SoilProfile1"; + soilProfile1.X = 34534.34; + soilProfile1.Y = 49453.68; + soilProfile1.BottomLevel = -25.3; + soilProfile1.HasPhreaticLevel = true; + soilProfile1.PhreaticLevel = -3.54; + + SoilLayer1D layer = new SoilLayer1D(); + layer.Id = "L1"; + layer.Name = "Layer 1"; + layer.TopLevel = -1.52; + layer.Soil = soilClay1; + layer.IsAquifer = true; + soilProfile1.Layers.Add(layer); + layer = new SoilLayer1D(); + layer.Id = "L2"; + layer.Name = "Layer 2"; + layer.TopLevel = -3.18; + layer.Soil = soilPeat1; + soilProfile1.Layers.Add(layer); + layer = new SoilLayer1D(); + layer.Id = "L3"; + layer.Name = "Layer 3"; + layer.TopLevel = -7.37; + layer.Soil = soilClay1; + layer.IsAquifer = true; + soilProfile1.Layers.Add(layer); + layer = new SoilLayer1D(); + layer.Id = "L4"; + layer.Name = "Layer 4"; + layer.TopLevel = -12.28; + layer.Soil = soilPeat1; + soilProfile1.Layers.Add(layer); + layer = new SoilLayer1D(); + layer.Id = "L5"; + layer.Name = "Layer 5"; + layer.TopLevel = -18.39; + layer.Soil = soilSand1; + soilProfile1.Layers.Add(layer); + dike.SoilProfiles.Add(soilProfile1); + + SoilProfile1D soilProfile2 = new SoilProfile1D(); + soilProfile2.Name = "SoilProfile2"; + soilProfile2.X = 37212.54; + soilProfile2.Y = 48363.17; + soilProfile2.BottomLevel = -31.07; + soilProfile2.HasPhreaticLevel = true; + soilProfile2.PhreaticLevel = -5.92; + + layer = new SoilLayer1D(); + layer.Id = "L1"; + layer.Name = "Layer 1"; + layer.TopLevel = -3.17; + layer.Soil = soilPeat2; + soilProfile2.Layers.Add(layer); + layer = new SoilLayer1D(); + layer.Id = "L2"; + layer.Name = "Layer 2"; + layer.TopLevel = -5.22; + layer.Soil = soilClay2; + soilProfile2.Layers.Add(layer); + layer = new SoilLayer1D(); + layer.Id = "L3"; + layer.Name = "Layer 3"; + layer.TopLevel = -8.42; + layer.Soil = soilClay2; + soilProfile2.Layers.Add(layer); + layer = new SoilLayer1D(); + layer.Id = "L4"; + layer.Name = "Layer 4"; + layer.TopLevel = -11.16; + layer.Soil = soilPeat2; + soilProfile2.Layers.Add(layer); + layer = new SoilLayer1D(); + layer.Id = "L5"; + layer.Name = "Layer 5"; + layer.TopLevel = -17.23; + layer.Soil = soilClay2; + soilProfile2.Layers.Add(layer); + layer = new SoilLayer1D(); + layer.Id = "L6"; + layer.Name = "Layer 6"; + layer.TopLevel = -25.78; + layer.Soil = soilSand2; + soilProfile2.Layers.Add(layer); + dike.SoilProfiles.Add(soilProfile2); + + // Locations' Segment + location1.Segment = segment1; + location3.Segment = segment1; + location4.Segment = segment1; + location2.Segment = segment2; + location5.Segment = segment2; + + // Locations' surface lines + location1.SurfaceLine2 = surfaceLine1; + location2.SurfaceLine2 = surfaceLine2; + location3.SurfaceLine2 = surfaceLine2; + location4.SurfaceLine2 = surfaceLine1; + location5.SurfaceLine2 = surfaceLine2; + + // Segments' Soil profile probabilities + segment1.AddSoilProfileProbability(soilProfile1, 100.0, null); + segment2.AddSoilProfileProbability(soilProfile1, 32.4, null); + segment2.AddSoilProfileProbability(soilProfile2, 67.6, null); + + // Surface lines' points + surfaceLine1.EnsurePointOfType(15.3, -3.52, CharacteristicPointType.SurfaceLevelOutside); + surfaceLine1.EnsurePointOfType(19.4, -1.46, CharacteristicPointType.DikeToeAtRiver); + surfaceLine1.EnsurePointOfType(27.4, 8.56, CharacteristicPointType.DikeTopAtRiver); + surfaceLine1.EnsurePointOfType(35.2, 8.62, CharacteristicPointType.DikeTopAtPolder); + surfaceLine1.EnsurePointOfType(41.5, -3.76, CharacteristicPointType.DikeToeAtPolder); + surfaceLine1.EnsurePointOfType(85.4, -3.61, CharacteristicPointType.SurfaceLevelInside); + + surfaceLine2.EnsurePointOfType(0.0, -1.46, CharacteristicPointType.SurfaceLevelOutside); + surfaceLine2.EnsurePointOfType(19.4, -1.46, CharacteristicPointType.DikeToeAtRiver); + surfaceLine2.EnsurePointOfType(35.2, 8.62, CharacteristicPointType.DikeTopAtPolder); + surfaceLine2.EnsurePointOfType(41.5, -3.76, CharacteristicPointType.DikeToeAtPolder); + surfaceLine2.EnsurePoint(46.7, -3.82); + surfaceLine2.EnsurePoint(47.5, -4.78); + surfaceLine2.EnsurePoint(51.2, -4.82); + surfaceLine2.EnsurePoint(53.1, -3.78); + surfaceLine2.EnsurePointOfType(85.4, -3.61, CharacteristicPointType.SurfaceLevelInside); + + // Gauges + Gauge gauge1 = new Gauge() + { + Name = "G1", + Location = location1, + LocalX = 1.5, + }; + dike.Gauges.Add(gauge1); + Gauge gauge2 = new Gauge() + { + Name = "G2", + Location = location4, + LocalX = 3.1, + }; + dike.Gauges.Add(gauge2); + Gauge gauge3 = new Gauge() + { + Name = "G1", + Location = location3, + LocalX = 2.5, + }; + dike.Gauges.Add(gauge3); + + // Gauge PL lines + GaugePLLine gaugePLLine1 = new GaugePLLine(PLLineType.PL2); + gaugePLLine1.Points.Add(new GaugePLLinePoint(0.5, 3.2, null, null)); + gaugePLLine1.Points.Add(new GaugePLLinePoint(null, null, gauge1.Name, gauge1.Name)); + gaugePLLine1.Points.Add(new GaugePLLinePoint(null, null, gauge3.Name, gauge2.Name)); + dike.GaugePLLines.Add(gaugePLLine1); + + GaugePLLine gaugePLLine2 = new GaugePLLine(PLLineType.PL4); + gaugePLLine2.Points.Add(new GaugePLLinePoint(0.7, 2.5, null, null)); + gaugePLLine2.Points.Add(new GaugePLLinePoint(null, null, gauge1.Name, gauge1.Name)); + gaugePLLine2.Points.Add(new GaugePLLinePoint(null, null, gauge3.Name, gauge2.Name)); + dike.GaugePLLines.Add(gaugePLLine2); + + DikeCoordinateSystemConverter dikeCoordinateSystemConverter = new DikeCoordinateSystemConverter(); + dikeCoordinateSystemConverter.CreateLocalXZObjects(dike); + return dike; + } + + /// + /// Creates an Segment object instance + /// + /// + /// The soil profile for which the probability will be set + /// The probability value + /// Returns the constructed segment object + /// + /// + public Segment CreateSegment(string segmentId, string soilProfileId, double probability, FailureMechanismSystemType? segmentFailureMechanismType, string soilGeometry2DName) + { + ThrowHelper.ThrowIfStringArgumentNullOrEmpty(segmentId, StringResourceNames.SegmentIdArgumentNullOrEmpty); + ThrowWhenNoSoilGeometry(soilProfileId, soilGeometry2DName); + ThrowWhenDoubleSoilGeometry(soilProfileId, soilGeometry2DName); + + // Lookup the segment to associate + var segment = segments.FirstOrDefault(s => s.Name == segmentId) ?? new Segment { Name = segmentId }; + if (segments.Find(s => s.Name == segmentId) == null) + { + segments.Add(segment); + } + // Create 1d-soilprofile if defined + if (soilProfileId != null) + { + SoilProfile1D soilProfile; + soilProfile = soilProfiles.FirstOrDefault(s => s.Name == soilProfileId.ToString()); + if (soilProfile == null) + { + soilProfile = new SoilProfile1D() { Name = soilProfileId }; + soilProfiles.Add(soilProfile); + } + // Add the probability value to the table + segment.AddSoilProfileProbability(soilProfile, probability, segmentFailureMechanismType); + } + + // Create 2d-soilprofile if defined + if (soilGeometry2DName != null) + { + // Add the probability value to the table + segment.AddSoilGeometry2DProbability(soilGeometry2DName, probability, segmentFailureMechanismType); + } + + + return segment; + } + + /// + /// Check if either a 1D-geometry or a 2D-geometry is specified + /// + /// + /// + private void ThrowWhenNoSoilGeometry(string soilProfileId, string soilGeometry2DName) + { + ThrowHelper.ThrowWhenConditionIsTrue( + StringResourceNames.SoilProfileIdArgumentNullOrEmpty, + () => (String.IsNullOrEmpty(soilProfileId)) && (String.IsNullOrEmpty(soilGeometry2DName))); + } + + /// + /// Check if both a 1D-geometry or a 2D-geometry is specified (which is not allowed) + /// + /// + /// + private void ThrowWhenDoubleSoilGeometry(string soilProfileId, string soilGeometry2DName) + { + ThrowHelper.ThrowWhenConditionIsTrue( + StringResourceNames.SoilProfileIdArgumentNullOrEmpty, + () => (!String.IsNullOrEmpty(soilProfileId)) && (!String.IsNullOrEmpty(soilGeometry2DName))); + } + + /// + /// Creates a new surface line point which will be added to the characteristics point collection + /// + /// The ID of the surface line containing the point collections + /// The characteristic point type + /// The x value + /// The y value of the point + /// The added surfaceline point + /// The new point will only be added to the characteristic point collection when a match is found in the point collection of the surface line. An exception will be thrown if the point doesnt exist + /// + /// + /// + public GeometryPoint CreateSurfaceLinePoint(string surfaceLineId, CharacteristicPointType characteristicPointType, double x, double z) + { + ThrowHelper.ThrowIfStringArgumentNullOrEmpty(surfaceLineId, StringResourceNames.SurfaceLineIdArgumentNullOrEmpty); + + // it's required that the surface line with the given id exists if this is not the case an exception will be thrown + var surfaceLine = ThrowHelper.ThrowWhenRequiredEntityDoesntExistInLookup( + surfaceLines, surfaceLineId, s => s.Name == surfaceLineId); + + var canAdd = (x != -1 || z != -1); // empty points will not be added + + GeometryPoint point = null; + + if (canAdd) + { + // Is required because old data has been created by the klikprogramma of Erik Vastenburg + if (characteristicPointType == CharacteristicPointType.TrafficLoadOutside) + { + const double cTolerance = 0.0051; + point = surfaceLine.Geometry.Points.FirstOrDefault(p => p.X.AlmostEquals(x, cTolerance) && p.Z.AlmostEquals(z, cTolerance)); + } + else + { + point = surfaceLine.Geometry.Points.FirstOrDefault(p => p.X.AlmostEquals(x) && p.Z.AlmostEquals(z)); + } + + if (point != null) + { + var index = FindUnannotatedGeometryPointForGivenLocation(surfaceLine, point); + if (index == -1) + { + surfaceLine.AddCharacteristicPoint(point, characteristicPointType); + } + else + { + surfaceLine.CharacteristicPoints.Annotate(index, characteristicPointType); + } + } + else + { + throw new PointNotExistsException( + surfaceLine.Name, + characteristicPointType, + point, + ThrowHelper.GetResourceString(StringResourceNames.SurfaceLinePointNotExtists)); + } + } + + return point; + } + + private static int FindUnannotatedGeometryPointForGivenLocation(SurfaceLine2 surfaceLine, GeometryPoint point) + { + int index = -1; + for (int i = 0; i < surfaceLine.CharacteristicPoints.Count; i++) + { + if (ReferenceEquals(surfaceLine.CharacteristicPoints[i].GeometryPoint, point) && + surfaceLine.CharacteristicPoints[i].CharacteristicPointType == CharacteristicPointType.None) + { + index = i; + break; + } + } + return index; + } + + public Gauge CreateGauge(string gaugeId, string locationID, double localX) + { + ThrowHelper.ThrowIfStringArgumentNullOrEmpty(gaugeId, StringResourceNames.GaugeIdArgumentNullOrEmpty); + ThrowHelper.ThrowIfStringArgumentNullOrEmpty(locationID, StringResourceNames.LocationIdArgumentNullOrEmpty); + + Location location = this.locations.FirstOrDefault(s => s.Name == locationID); + if (location == null) + { + throw new NonExistentLocationException(locationID, ThrowHelper.GetResourceString(StringResourceNames.NonExistentLocation)); + } + + Gauge gauge = this.gauges.FirstOrDefault(s => s.Name == gaugeId && s.Location == location) ?? new Gauge { Name = gaugeId }; + + gauge.Location = location; + gauge.LocalX = localX; + + return gauge; + } + + /// + /// Creates a scenario object + /// + /// The location id + /// The location's scenario id + /// A materialized object + /// + /// s.Location.Name == locationId && s.LocationScenarioID == locationScenarioId), + StringResourceNames.EntityAlreadyExist, + c => c != null, + e => new EntityAlreadyExistException(ThrowHelper.GetResourceString(e)) + ); + + // Lookup the location to associate + // if the item does not exist create one and add it to the lookup + Location location = this.locations.FirstOrDefault(s => s.Name == locationId); + if (location == null) + { + throw new NonExistentLocationException(locationId, ThrowHelper.GetResourceString(StringResourceNames.NonExistentLocation)); + } + + + Scenario scenario = new Scenario() + { + Location = location, + LocationScenarioID = locationScenarioId + }; + + return scenario; + } + + #endregion + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Specifications/Validator.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Specifications/Validator.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Specifications/Validator.cs (revision 3305) @@ -0,0 +1,35 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System.Collections.Generic; +using Deltares.Dam.Data.Specifications; +using Deltares.Standard.Specifications.Extensions; + +namespace Deltares.Standard.Specifications +{ + public static class Validator + { + public static IEnumerable Validate(T target) + { + return target.Validate(); + } + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Importers/LocationAttributeMapping.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Importers/LocationAttributeMapping.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Importers/LocationAttributeMapping.cs (revision 3305) @@ -0,0 +1,30 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using Deltares.Dam.Data.CsvImporters; +using Deltares.Maps; + +namespace Deltares.Dam.Data.Importers +{ + public class LocationAttributeMapping : AttributeMapping + { + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DtoAssembler/IDtoAssembler.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DtoAssembler/IDtoAssembler.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DtoAssembler/IDtoAssembler.cs (revision 3305) @@ -0,0 +1,138 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System.Collections.Generic; +using System.Xml.Linq; + +namespace Deltares.Standard +{ + /// + /// Defines the contract of a data transfer object (dto) assembler + /// The interface should be used in scenario's where an domain object needs + /// to be created from a dto and vice versa. + /// The dto in this case can be any class. + /// + /// The domain object type + /// The dto object type + public interface IDtoAssembler + { + /// + /// Creates a domain object from dto + /// + /// The dto to create a domain object from + /// The domain object + TDomainObject CreateDomainObject(TDataTransferObject dtoObj); + + /// + /// Creates a dto from a domain object + /// + /// The domain object to create the dto from + /// The dto object + TDataTransferObject CreateDataTransferObject(TDomainObject domainObj); + } + + /// + /// Defines the contract of a data transfer object (dto) assembler + /// The interface should be used in scenario's where an domain object needs + /// to be created from a dto and vice versa. + /// The dto in this case can be any class. + /// + /// The domain object type + /// The dto object type + public interface IDtoAssembler + { + /// + /// Creates a domain object from output dto + /// + /// The dto to create a domain object from + /// The domain object + TDomainOutputObject CreateOutputObject(TDataTransferObject dto); + + /// + /// Creates a domain object from output dto + /// + /// The dto to create a domain object from + /// The domain object + TDomainInputObject CreateInputObject(TDataTransferObject dto); + + /// + /// Creates a dto from a domain input object + /// + /// The domain object to create the dto from + /// The dto object + TDataTransferObject CreateDataTransferObject(TDomainInputObject input); + } + + + /// + /// Defines the contract of a data transfer object (dto) assembler + /// The interface should be used in scenario's where an domain object needs + /// to be created from a dto and vice versa. + /// The dto in this case is a object. + /// + /// The domain object type + public interface IDtoAssembler : IDtoAssembler + { + string ElementName { get; } + } + + /// + /// Defines the contract of a data transfer object (dto) collection assembler + /// The interface should be used in scenario's where an domain object collections needs + /// to be created from a dto collection and vice versa. + /// The dto in this case is a object. + /// + /// The domain object type in the collection + /// The data transfer object type in the collection + public interface IDtoCollectionAssembler + { + /// + /// Gets the entity assembler + /// + IDtoAssembler EntityAssembler { get; } + + /// + /// Create the domain object collection + /// + /// The dto collection object from which to create domain collection + /// The (typed) domain object collection + IEnumerable CreateDomainObjectCollection(TDataTransferObject dtoCollObj); + + /// + /// Created the data transfer collection object + /// + /// The domain collection from which to create the dto collection + /// The dto collection object + TDataTransferObject CreateDataTransferObject(IEnumerable domainCollObj); + } + + /// + /// Defines the contract of a data transfer object (dto) collection assembler + /// The interface should be used in scenario's where an domain object collections needs + /// to be created from a dto collection and vice versa. + /// The dto in this case is a object. + /// + /// The domain object type in the collection + public interface IDtoCollectionAssembler : IDtoCollectionAssembler + { + string ElementName { get; } + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Specifications/LessThanOrEqualToSpecification.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Specifications/LessThanOrEqualToSpecification.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Specifications/LessThanOrEqualToSpecification.cs (revision 3305) @@ -0,0 +1,39 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU 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; + +namespace Deltares.Standard.Specifications +{ + public class LessThanOrEqualToSpecification : ValueBoundSpecification where TValue : IComparable + { + public LessThanOrEqualToSpecification(string attributeName, TValue attributeValue) + : base(attributeName, attributeValue) + { + } + + public override bool IsSatisfiedBy(TCandidate candidate) + { + var actual = this.GetCandidateTValue(candidate) as IComparable; + return (actual.CompareTo(this.AttributeValue) <= 0); + } + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/GeometryRepositoryExtensions.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/GeometryRepositoryExtensions.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/GeometryRepositoryExtensions.cs (revision 3305) @@ -0,0 +1,79 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System.Collections.Generic; +using System.Linq; + +namespace Deltares.Maps +{ + public static class GeometryRepositoryExtensions + { + /// + /// Determines if lines in the source repository have an intersection with lines in the target repository, + /// the result is grouped by the count of intersection points + /// + /// + /// + /// + /// A list of target and source geometries and the calculated intersection points grouped by the count of + /// intersection points + /// + public static IEnumerable> GetIntersectionPoints( + this IFeatureRepository sourceRepository, IFeatureRepository targetRepository) + { + /* + var results = from source in sourceRepository.Features + from target in targetRepository.Query(source) + let intersectionPoints = target.Geometry.Intersection(source.Geometry) + select new IntersectionResult() + { + Source = source, + Target = target, + IntersectionPoints = intersectionPoints.Coordinates + }; +*/ + + var results = new List(); + foreach (IFeature source in sourceRepository.Features) + { + foreach (IFeature target in targetRepository.Query(source)) + { + results.Add(new IntersectionResult + { + Source = source, + Target = target, + IntersectionPoints = target.Geometry.Intersection(source.Geometry).Coordinates + }); + } + } + + return from result in results + group result by result.IntersectionPoints.Count(); + } + + public static IEnumerable GetResultsHavingCount( + this IEnumerable> results, int count) + { + IGrouping havingKey = results.FirstOrDefault(r => r.Key == count); + return havingKey == null ? new List() : havingKey.Select(r => r); + } + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Specifications/ValidationException.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Specifications/ValidationException.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Specifications/ValidationException.cs (revision 3305) @@ -0,0 +1,48 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU 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.Standard.Specifications +{ + [Serializable] + public class ValidationException : Exception + { + public ValidationException() + { + } + + public ValidationException(string message) : base(message) + { + } + + public ValidationException(string message, Exception inner) : base(message, inner) + { + } + + protected ValidationException( + SerializationInfo info, + StreamingContext context) : base(info, context) + { + } + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DtoAssembler/FileIdentification.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DtoAssembler/FileIdentification.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DtoAssembler/FileIdentification.cs (revision 3305) @@ -0,0 +1,78 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU 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.Reflection; + +namespace Deltares.Standard +{ + /// + /// This class contains general properties which can be used in the header of an xml file or in + /// data transfer objects like or + /// + public class FileIdentification + { + public FileIdentification() + : this(Assembly.GetCallingAssembly()) + { + } + + public FileIdentification(Assembly assembly) + { + this.Application = assembly.GetName().Name; + this.Version = assembly.GetName().Version.ToString(); + this.Company = "Deltares"; + this.Created = DateTime.UtcNow; + } + + /// + /// The name of the applcation where the xml data is coming from + /// + public string Application { get; set; } + + /// + /// The version of the application or dll where this data is form + /// + public string Version { get; set; } + + /// + /// The name of the company + /// + public string Company { get; set; } + + /// + /// The license of the application + /// + /// This property is not required + public string License { get; set; } + + /// + /// A general description of the application where the data belongs to + /// + /// This property is not required + public string Description { get; set; } + + /// + /// Date time stamp of the creation of the data data items + /// + public DateTime Created { get; set; } + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/Test/Properties/AssemblyInfo.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/Test/Properties/AssemblyInfo.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/Test/Properties/AssemblyInfo.cs (revision 3305) @@ -0,0 +1,60 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of the application DAM - UI. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU 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.Reflection; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. + +[assembly: AssemblyTitle("Deltares.Maps.Test")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("WL | Delft Hydraulics")] +[assembly: AssemblyProduct("Deltares.Maps.Test")] +[assembly: AssemblyCopyright("Copyright © WL | Delft Hydraulics 2011")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. + +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM + +[assembly: Guid("841a94ce-ee18-41a1-87b4-5d6c98edf935")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] + +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Specifications/NotNullSpecification.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Specifications/NotNullSpecification.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Specifications/NotNullSpecification.cs (revision 3305) @@ -0,0 +1,37 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +namespace Deltares.Standard.Specifications +{ + public class NotNullSpecification : SpecificationBase + { + public NotNullSpecification() + { + Name = "Not null specification"; + Description = "The candidate should have a value other then null"; + } + + public override bool IsSatisfiedBy(object candidate) + { + return candidate != null; + } + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DtoAssembler/DtoPropertyAttributeMap.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DtoAssembler/DtoPropertyAttributeMap.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DtoAssembler/DtoPropertyAttributeMap.cs (revision 3305) @@ -0,0 +1,343 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU 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.Linq; +using Deltares.Standard.IO.DtoAssembler; + +namespace Deltares.Standard +{ + /// + /// The property bag defines a dynamic property collection (dictionary) + /// + public class DtoPropertyAttributeMap : IDictionary + { + /// + /// Holds the property dictionary + /// + private readonly IDictionary dict = new Dictionary(); + + #region IDictionary Members + + /// + /// Adds a property attribute mapping to the dictionary + /// + /// The name of the property + /// The value + public void Add(string propName, DtoPropertyAttriubteMapping item) + { + if (item == null) + throw new DtoPropertyMapException("Cannot add an empty or null item to the map"); + + if (!item.PropertyName.HasValidStringValue() || propName != item.PropertyName) + throw new DtoPropertyMapException("Property name is empty or doesn't match dictionary property name (key)"); + + this.dict.Add(propName, item); + } + + /// + /// Determinses wheter the dictionary contains the specified key + /// + /// The name of the property + /// + public bool ContainsKey(string propName) + { + return this.dict.ContainsKey(propName); + } + + /// + /// Gets the containing keys + /// + public ICollection Keys + { + get { return this.dict.Keys; } + } + + /// + /// Removes a key from the dictionary + /// + /// The key or property name + /// Booleand value indicating when the item is successfuly removed + public bool Remove(string propName) + { + return this.dict.Remove(propName); + } + + /// + /// + /// + /// + /// + /// + public bool TryGetValue(string propName, out DtoPropertyAttriubteMapping value) + { + return this.dict.TryGetValue(propName, out value); + } + + /// + /// + /// + public ICollection Values + { + get { return this.dict.Values; } + } + + /// + /// + /// + /// + /// + public DtoPropertyAttriubteMapping this[string propName] + { + get { return this.dict[propName]; } + set { this.dict[propName] = value; } + } + + /// + /// + /// + /// + public void Add(KeyValuePair item) + { + this.dict.Add(item.Key, item.Value); + } + + /// + /// + /// + public void Clear() + { + this.dict.Clear(); + } + + /// + /// + /// + /// + /// + public bool Contains(KeyValuePair item) + { + return ((IDictionary) this.dict).Contains(item); + } + + /// + /// + /// + /// + /// + public void CopyTo(KeyValuePair[] array, int arrayIndex) + { + ((IDictionary) this.dict).CopyTo(array, arrayIndex); + } + + /// + /// + /// + public int Count + { + get { return this.dict.Count; } + } + + /// + /// + /// + public bool IsReadOnly + { + get { return false; } + } + + /// + /// + /// + /// + /// + public bool Remove(KeyValuePair item) + { + return this.dict.Remove(item.Key); + } + + /// + /// + /// + /// + public IEnumerator> GetEnumerator() + { + return this.dict.GetEnumerator(); + } + + /// + /// + /// + /// + IEnumerator IEnumerable.GetEnumerator() + { + return (IEnumerator) ((IDictionary) this.dict).GetEnumerator(); + } + + #endregion + + /// + /// Adds a property attribute mapping to the dictionary + /// + /// The item to add + public void Add(DtoPropertyAttriubteMapping item) + { + if (item == null) + throw new ArgumentNullException("item"); + + this.Add(item.PropertyName, item); + } + + /// + /// Adds a or updtes a property attribute mapping to the dictionary + /// + /// The item to add + public void AddOrUpdate(string propName, string attrName) + { + this.AddOrUpdate(propName, attrName, DtoPropertyImportance.Optional); + } + + /// + /// Adds a or updtes a property attribute mapping to the dictionary + /// + /// The item to add + public void AddOrUpdate(string propName, string attrName, DtoPropertyImportance importance) + { + if (!attrName.HasValidStringValue()) + throw new DtoPropertyMapException("attrName"); + + this.AddOrUpdate(propName, + new DtoPropertyAttriubteMapping() + { + PropertyName = propName, + AttributeName = attrName, + Importance = importance + }); + } + + + /// + /// Adds a or updtes a property attribute mapping to the dictionary + /// + /// The item to add + public void AddOrUpdate(DtoPropertyAttriubteMapping item) + { + if (item == null) + throw new ArgumentNullException("item"); + + this.AddOrUpdate(item.PropertyName, item); + } + + + /// + /// Adds or updates new items in the dictionary + /// + /// The name of the property + /// The value + public void AddOrUpdate(string propName, DtoPropertyAttriubteMapping item) + { + if (item == null) + throw new ArgumentNullException("item"); + + if (!propName.HasValidStringValue()) + throw new DtoPropertyMapException("Property name (or key) is empty"); + + if (!this.dict.ContainsKey(propName)) + { + this.Add(item.PropertyName, item); + } + else + { + this.dict[propName] = item; + } + } + + /// + /// Adds or updates new items in the dictionary + /// + /// The key value pair collection to handle + public void AddOrUpdateRange(IEnumerable coll) + { + foreach (DtoPropertyAttriubteMapping item in coll) + { + this.AddOrUpdate(item); + } + } + + /// + /// Gets an item by property name + /// + /// The name of the property to look for + /// The item if found null otherwise + public DtoPropertyAttriubteMapping GetByPropertyName(string name) + { + return this.GetByPropertyName(name, StringComparison.InvariantCultureIgnoreCase); + } + + /// + /// Gets an item by property name + /// + /// The name of the property to look for + /// The string type + /// The item if found null otherwise + public DtoPropertyAttriubteMapping GetByPropertyName(string name, StringComparison comparisonType) + { + IEnumerable q = from x in this.dict.Values + where x.PropertyName.Equals(name, comparisonType) + select x; + + if (q.Any()) + return q.Single(); + + return null; + } + + /// + /// Gets an item by attribute name + /// + /// The name of the property to look for + /// The item if found null otherwise + public DtoPropertyAttriubteMapping GetByAttributeName(string name) + { + return this.GetByAttributeName(name, StringComparison.InvariantCultureIgnoreCase); + } + + /// + /// Gets an item by attribute name + /// + /// The name of the property to look for + /// The string type + /// The item if found null otherwise + public DtoPropertyAttriubteMapping GetByAttributeName(string name, StringComparison comparisonType) + { + IEnumerable q = from x in this.dict.Values + where x.AttributeName.Equals(name, comparisonType) + select x; + + if (q.Any()) + return q.Single(); + + return null; + } + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Importers/LineAttributeImporter.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Importers/LineAttributeImporter.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Importers/LineAttributeImporter.cs (revision 3305) @@ -0,0 +1,297 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU 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. + +//#define INCLUDE_ALL_LINE_TYPES + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.Serialization; +using Deltares.Dam.Data.CsvImporters; +using Deltares.Maps; + +namespace Deltares.Dam.Data.Importers +{ + /// + /// Exception for the class LineAttributeImporter + /// + public class LineAttributeImporterException : Exception + { + public LineAttributeImporterException() + { + } + + public LineAttributeImporterException(string message) + : base(message) + { + } + + public LineAttributeImporterException(string message, Exception inner) + : base(message, inner) + { + } + } + + public class LineAttributeImporter : IAttributeImporter where T : CsvImporterLocations.LocationRecord + { + private readonly IList errors; + private IDictionary targetLookup; + + public LineAttributeImporter() + { + this.errors = new List(); + this.targetLookup = new Dictionary(); + } + + /// + /// Gets or sets the target objects + /// + public IEnumerable Targets + { + private get { return this.targetLookup.Values; } + set + { + if (value != null) + { + this.targetLookup = value.ToDictionary(k => k.LocationId.ToLowerInvariant(), v => v); + + if (CrossSectionRepository != null) + { + // Filter out all locations which are not subject for the intersection query.. + CrossSectionRepository.Remove(f => !targetLookup.ContainsKey(GetID(f))); + } + } + } + } + + /// + /// + public IFeatureRepository AttributeRepository { internal get; set; } + + /// + /// + /// + public string LocationIDAttributeName { private get; set; } + + private IFeatureRepository crossSectionRepository; + + /// + /// Gets or sets the cross section repository + /// + public IFeatureRepository CrossSectionRepository + { + get { return this.crossSectionRepository; } + set + { + this.crossSectionRepository = value; + if (this.targetLookup != null && + this.targetLookup.Count > 0 && + value != null && + IsValidString(LocationIDAttributeName)) + { + // Filter out all locations which are not subject for the intersection query.. + CrossSectionRepository.Remove(f => !targetLookup.ContainsKey(GetID(f))); + } + } + } + + /// + /// + /// + public IEnumerable Errors + { + get { return this.errors; } + } + + /// + /// Gets or sets the name of the file. + /// + /// + /// The name of the file. + /// + public string FileName { private get; set; } + + public void AddError(Exception exception) + { + this.errors.Add(exception); + } + + /// + /// Sets the attribute mappings + /// + public IEnumerable> AttributeMappings { private get; set; } + + private string GetID(IFeature feature) + { + bool attributeExists = feature.Attributes.Exists(LocationIDAttributeName); + if (!attributeExists) + { + throw new LineAttributeImporterException(String.Format("Cannot find attribute '{0}'", LocationIDAttributeName)); + } + return feature.Attributes[LocationIDAttributeName].ToString().ToLowerInvariant(); + } + + /// + /// + /// + /// Preconditions: + /// - A valid data folder needs to given + /// - A set of "targets" with their characteristic points table and initialized id's available from the waterboard + /// - The required files need to be in the data folder (one for the characteristics points, + /// - A set of (characteristic) lines wich have to be retrieved from the files + /// + /// Postconditions: + /// - Some targets (the result of a join from the Location shape file and the existing location list from the Waterboard) have new characteristic point values + /// + /// + /// + /// + /// + /// + public void Import() + { + if (AttributeRepository == null) + throw new InvalidOperationException("No repository set"); + + if (!AttributeRepository.SupportedAttributes.Any()) + throw new InvalidOperationException("The repository doesn't contain attributes"); + + if (!IsValidString(LocationIDAttributeName)) + throw new InvalidOperationException("The location ID attribute name is not valid"); + + if (this.CrossSectionRepository == null) + throw new InvalidOperationException("No cross section repository set"); + + if (AttributeMappings == null) + throw new InvalidOperationException("No attribute mappings set"); + + // Find the intersection points between the geometries + + IEnumerable> results = this.CrossSectionRepository.GetIntersectionPoints(AttributeRepository); + + int count = 0; // <- using count to omit the Linq.Count() for perfomance reasons + IEnumerable work = results.GetResultsHavingCount(1); + foreach (IntersectionResult intersectionResult in work) + { + foreach (AttributeMapping mapping in AttributeMappings) + { + + IFeature crossSection, attributeLine; + if (intersectionResult.Source.Attributes.Exists(mapping.Name)) + { + crossSection = intersectionResult.Target; + attributeLine = intersectionResult.Source; + } + else + { + if (intersectionResult.Target.Attributes.Exists(mapping.Name)) + { + crossSection = intersectionResult.Source; + attributeLine = intersectionResult.Target; + } + else + { + AddError(new AttributeMissingException(mapping.Name)); + continue; + } + } + + // Get the surface line for the location having the location ID + string locationId = GetID(crossSection); + if (!targetLookup.ContainsKey(locationId)) + { + this.errors.Add(new ImportException(string.Format("Location {0} not found", LocationIDAttributeName))); + continue; + } + T target = targetLookup[locationId]; + object value = attributeLine.Attributes[mapping.Name]; + + try + { + // set the value on target property + mapping.Action(target, value); + if (mapping.Name.ToUpper() == "DAMPINGPL3") + { + if (target.DampingFactorPl3 < 0 || target.DampingFactorPl3 > 1) + { + AddError(new AttributeWrongValueException(mapping.Name, target.DampingFactorPl3.Value, 0.0, 1.0)); + target.DampingFactorPl3 = 0; + } + } + if (String.Compare(mapping.Name, "DampingPL4", true) == 0) + { + if (target.DampingFactorPl4 < 0 || target.DampingFactorPl4 > 1) + { + AddError(new AttributeWrongValueException(mapping.Name, target.DampingFactorPl4.Value, 0.0, 1.0)); + target.DampingFactorPl4 = 0; + } + } + count++; + } + catch (Exception e) + { + throw new AttributeParseException( + string.Format("Error parsing the value '{0}' of '{1}' for target '{2}' ", value.ToString().Replace("\0", ""), + mapping.Name, target.LocationId), e); + } + } + } + if (count == 0) + { + this.errors.Add(new NotSupportedException("There are none or multiple intersections found. There should be exactly one intersection for each location in the target repository")); + } + } + + private static bool IsValidString(string value) + { + return !(string.IsNullOrEmpty(value) || value.Trim() == string.Empty); + } + } + + [Serializable] + public class AttributeParseException : Exception + { + // + // For guidelines regarding the creation of new exception types, see + // http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpgenref/html/cpconerrorraisinghandlingguidelines.asp + // and + // http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dncscol/html/csharp07192001.asp + // + + public AttributeParseException() + { + } + + public AttributeParseException(string message) : base(message) + { + } + + public AttributeParseException(string message, Exception inner) : base(message, inner) + { + } + + protected AttributeParseException( + SerializationInfo info, + StreamingContext context) : base(info, context) + { + } + } +} Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/CsvExportData.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/CsvExportData.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/CsvExportData.cs (revision 3305) @@ -0,0 +1,2394 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU 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.ComponentModel; +using System.Diagnostics; +using System.IO; +using System.Xml.Serialization; +using Deltares.Geographic; +using Deltares.Geometry; +using Deltares.Standard; +using Deltares.Standard.EventPublisher; +using Deltares.Standard.Units; +using System; +using Deltares.Geotechnics.Soils; +using Deltares.Geotechnics.SurfaceLines; +using Deltares.Standard.Attributes; + +namespace Deltares.Dam.Data +{ + /// + /// Class for presenting Design results. + /// + /// + /// + /// + public class CsvExportData : IVisibleEnabled, IGeographicPoint + { + private string baseFileName; + private string scenarioName; + private string locationName; + private int locationScenarioCount; + private double xRd; + private double yRd; + private string profileName; + + private string calculationSubDir; + private string dikeName; + private AnalysisType analysisType; + private DamFailureMechanismeCalculationSpecification damFailureMechanismeCalculationSpecification; + private Scenario scenario; + private SoilProfile1D soilProfile; + private string soilGeometry2DName; + private double? localPipingExitPointX; + private double? safetyFactorStability; + private double? zone1SafetyFactorStability; + private double? localZone1EntryPointX; + private double? localZone1ExitPointX; + private double? zone2SafetyFactorStability; + private double? localZone2EntryPointX; + private double? localZone2ExitPointX; + private double? upliftFactor; + private double? heaveFactor; + private double? blighPipingFactor; + private double? blighHCritical; + private double? sellmeijer2ForcesPipingFactor; + private double? sellmeijer2ForcesHCritical; + private double? sellmeijer4ForcesPipingFactor; + private double? sellmeijer4ForcesHCritical; + private double? sellmeijerPipingFactor; + private double? sellmeijerHCritical; + private double? wti2017BackwardErosionSafetyFactor; + private double? wti2017BackwardErosionHcritical; + private double? wti2017UpliftSafetyFactor; + private double? wti2017UpliftHcritical; + private double? wti2017BackwardErosionDeltaPhiC; + private double? wti2017BackwardErosionDeltaPhiReduced; + private double? wti2017UpliftDeltaPhiC; + private double? wti2017HeaveSafetyFactor; + private double? wti2017HeaveHcritical; + private double? wti2017Gradient; + private double? wti2017SafetyFactorOverall; + private double? wti2017HcriticalOverall; + private double? wti2017EffectiveStress; + private double? wti2017CCreep; + + private bool? isUplift; + private double? pl3MinUplift; + private double? pl3HeadAdjusted; + private double? pl3LocalLocationXMinUplift; + private double? pl4MinUplift; + private double? pl4HeadAdjusted; + private double? pl4LocalLocationXMinUplift; + private CalculationResult calculationResult = CalculationResult.NoRun; + private string resultMessage = ""; + private int numberOfIterations; + private MStabModelType? stabilityModel; + + private ResultEvaluation resultEvaluation = ResultEvaluation.NotEvaluated; + private string notes = ""; + + private StabilityKernelType selectedStabilityKernelType = StabilityKernelType.DamClassicStability; + // redesigned LOCAL surfaceline (initialized with original local surfaceline) + private SurfaceLine2 redesignedSurfaceLine; + // redesigned Global surfaceline in use for this result (either piping or stability) + private SurfaceLine2 redesignedSurfaceLineGlobal; + + public CsvExportData() + { + // this contructor is needed for the UI table eventhough is seems not to be referenced. + } + + /// + /// Initializes a new instance of the class. + /// + /// Name of the location. + /// Name of the scenario. + public CsvExportData(string locationName, string scenarioName) + { + this.locationName = locationName; + this.scenarioName = scenarioName; + } + + /// + /// Determines the global point coordinates based on global surface line. + /// + /// The local point. + /// The global surface line. + /// + private GeometryPoint DetermineGlobalPointCoordinatesBasedOnGlobalSurfaceLine(GeometryPoint localPoint, SurfaceLine2 globalSurfaceLine) + { + CoordinateSystemConverter coordinateSystemConverter = new CoordinateSystemConverter(); + coordinateSystemConverter.DefineGlobalXYZBasedOnLine(globalSurfaceLine.Geometry); + + coordinateSystemConverter.ConvertLocalXZToGlobalXYZ(localPoint); + return localPoint; + } + + [Browsable(false)] + public StabilityKernelType SelectedStabilityKernelType + { + get { return selectedStabilityKernelType; } + set { selectedStabilityKernelType = value; } + } + + /// + /// Gets or sets the number of iterations (as used in the design calculation). + /// + /// + /// The number of iterations. + /// + [ReadOnly(true)] + public int NumberOfIterations + { + get + { + return numberOfIterations; + } + set { numberOfIterations = value; } + } + + /// + /// Gets the result file. + /// + /// + /// The result file. + /// + [Browsable(false)] + public string ResultFile + { + get + { + if (!String.IsNullOrEmpty(BaseFileName)) + { + const string wmfExtension = ".wmf"; + string fullBaseFilename = DamProject.ProjectWorkingPath; + if (CalculationSubDir != "") + { + fullBaseFilename = Path.Combine(fullBaseFilename, CalculationSubDir); + } + fullBaseFilename = fullBaseFilename + Path.DirectorySeparatorChar + BaseFileName; + string fullFilename = fullBaseFilename + wmfExtension; + if (!File.Exists(fullFilename)) + { + fullFilename = fullBaseFilename + "z1" + wmfExtension; + } + if (!File.Exists(fullFilename)) + { + fullFilename = fullBaseFilename + "z2" + wmfExtension; + } + return fullFilename; + } + return ""; + } + } + + /// + /// Gets the input file. + /// + /// + /// The input file. + /// + [Browsable(false)] + private string InputFile + { + get + { + if (!String.IsNullOrEmpty(BaseFileName)) + { + string fileExtension = ".sti"; + if (selectedStabilityKernelType != StabilityKernelType.DamClassicStability) + { + fileExtension = ".dsx"; + } + string fullBaseFilename = DamProject.ProjectWorkingPath; + if (CalculationSubDir != "") + { + fullBaseFilename = Path.Combine(fullBaseFilename, CalculationSubDir); + } + fullBaseFilename = fullBaseFilename + Path.DirectorySeparatorChar + BaseFileName; + string fullFilename = fullBaseFilename + fileExtension; + return fullFilename; + } + return ""; + } + } + + /// + /// Gets the piping result file. + /// + /// + /// The piping result file. + /// + [Browsable(false)] + private string PipingResultFile + { + // Path of piping is not based on the working dir but on assembly (Assembly.GetExecutingAssembly().Location) + get + { + if (!String.IsNullOrEmpty(BaseFileName)) + { + const string txtExtension = ".txt"; + string fullBaseFilename = DamProject.ProjectWorkingPath; + if (CalculationSubDir != "") + { + fullBaseFilename = Path.Combine(fullBaseFilename, CalculationSubDir); + } + fullBaseFilename = fullBaseFilename + Path.DirectorySeparatorChar + BaseFileName; + string fullFilename = fullBaseFilename + txtExtension; + return fullFilename; + } + return ""; + } + } + + [PropertyOrder(1, 2)] + [ReadOnly(true)] + public AnalysisType AnalysisType // moet vanuit invoer komen + { + get { return analysisType; } + set { analysisType = value; } + } + + [Browsable(false)] + public DamFailureMechanismeCalculationSpecification DamFailureMechanismeCalculation // moet vanuit invoer komen + { + get { return damFailureMechanismeCalculationSpecification; } + set + { + // Clone the specification to ensure a non-changeable version. + damFailureMechanismeCalculationSpecification = value.Clone(); + } + } + + [CsvExportColumn("DikeName", 2)] + [Browsable(false)] + public string DikeName + { + get + { + return dikeName; + } + set + { + dikeName = value; + } + } + + [CsvExportColumn("Calculation", 3)] + [Browsable(false)] + public string Calculation + { + get { return damFailureMechanismeCalculationSpecification != null ? damFailureMechanismeCalculationSpecification.ToString() : ""; } + } + + [CsvExportColumn("Scenario", 4)] + [Browsable(false)] + public string ScenarioName + { + get + { + return scenarioName; + } + set + { + scenarioName = value; + } + } + + [CsvExportColumn("LocationName", 5)] + [PropertyOrder(0, 1)] + [ReadOnly(true)] + public string LocationName + { + get + { + return locationName; + } + set + { + locationName = value; + } + } + + [PropertyOrder(0, 2)] + [ReadOnly(true)] + public string ScenarioDefinitionName + { + get { return scenarioName + " of " + locationScenarioCount.ToString(); } + } + + [PropertyOrder(0, 3)] + [ReadOnly(true)] + public CalculationResult CalculationResult + { + get + { + return calculationResult; + } + set + { + calculationResult = value; + } + } + + [PropertyOrder(8,1)] + [ReadOnly(true)] + public string ResultMessage + { + get + { + RemoveCarriageReturnsFromMessage(ref resultMessage); + return resultMessage; + } + set { resultMessage = value; } + } + + /// + /// Removes the carriage returns from message. + /// + /// The message. + internal static void RemoveCarriageReturnsFromMessage(ref string message) + { + // remove carriage return at the end + message = message.TrimEnd('\r', '\n'); + // replace other carriage returns by a space + message = message.Replace("\r\n", " "); + } + + + [CsvExportColumn("X", 6)] + [Format("F3")] + [PropertyOrder(1, 0)] + [Unit(UnitType.Length)] + [XmlIgnore] + [ReadOnly(true)] + public double X + { + get + { + return xRd; + } + set + { + xRd = value; + } + } + + [CsvExportColumn("Y", 7)] + [Format("F3")] + [PropertyOrder(1, 1)] + [Unit(UnitType.Length)] + [XmlIgnore] + [ReadOnly(true)] + public double Y + { + get + { + return yRd; + } + set + { + yRd = value; + } + } + + [CsvExportColumn("LocationScenarioId", 8)] + [Browsable(false)] + public string LocationScenarioId + { + get { return scenarioName; } + } + + [CsvExportColumn("RiverLevel", 9)] + [PropertyOrder(2, 12)] + [Format("F3")] + [ReadOnly(true)] + public double? RiverLevel + { + get { return scenario.RiverLevel; } + } + + [CsvExportColumn("RiverLevelLow", 10)] + [PropertyOrder(2, 13)] + [Format("F3")] + [ReadOnly(true)] + public double? RiverLevelLow + { + get { return scenario.RiverLevelLow; } + } + + [CsvExportColumn("DikeTableHeight", 11)] + [PropertyOrder(2, 14)] + [Format("F3")] + [ReadOnly(true)] + public double? DikeTableHeight + { + get { return scenario.DikeTableHeight; } + } + + [CsvExportColumn("DikeTableHeight", 12)] + [PropertyOrder(2, 15)] + [Format("F3")] + [ReadOnly(true)] + public double? SlopeDampingPiezometricHeightPolderSide + { + get { return scenario.Location.SlopeDampingPiezometricHeightPolderSide; } + } + + /// + /// Gets the height of the current original dike (so not of the redesigned surfaceline). + /// + /// + /// The height of the current dike. + /// + [CsvExportColumn("CurrentDikeHeight", 13)] + [Browsable(false)] + public double? CurrentDikeHeight + { + get { return scenario.Location.SurfaceLine2.GetDikeHeight(); } + } + + /// + /// Gets the current original dike toe at polder x (so not of the redesigned surfaceline). + /// + /// + /// The current global dike toe at polder x. + /// + [CsvExportColumn("CurrentDikeToeAtPolderX", 14)] + [Browsable(false)] + public double? CurrentDikeToeAtPolderX + { + get + { + double? x = null; + GeometryPoint point = scenario.Location.SurfaceLine2.GetDikeToeInward(); + if (point != null) + x = point.X; + return x; + } + } + + /// + /// Gets the current original dike toe at polder z (so not of the redesigned surfaceline). + /// + /// + /// The current global dike toe at polder z. + /// + [CsvExportColumn("CurrentDikeToeAtPolderZ", 15)] + [Browsable(false)] + public double? CurrentDikeToeAtPolderZ + { + get + { + double? z = null; + GeometryPoint point = scenario.Location.SurfaceLine2.GetDikeToeInward(); + if (point != null) + z = point.Z; + return z; + } + } + + private double? GetSoilProfileProbability(FailureMechanismSystemType? failureMechanismType) + { + if (soilProfile != null) + { + return scenario.Location.GetSoilProfileProbability(soilProfile, failureMechanismType); + } + return scenario.Location.GetSoilGeometry2DProbability(soilGeometry2DName, failureMechanismType); + } + + [CsvExportColumn("StabilityProfileName", 16)] + [Browsable(false)] + public string StabilityProfileName + { + get { return ProfileName; } + } + + [CsvExportColumn("StabilityProfileProbability", 17)] + [Format("F3")] + [Unit(UnitType.Fractions)] + [Browsable(false)] + public double? StabilityProfileProbability + { + get { return GetSoilProfileProbability(FailureMechanismSystemType.StabilityInside); } + } + + [CsvExportColumn("PipingProfileName", 18)] + [Browsable(false)] + public string PipingProfileName + { + get { return ProfileName; } + } + + [CsvExportColumn("PipingProfileProbability", 19)] + [Format("F3")] + [Unit(UnitType.Fractions)] + [Browsable(false)] + public double? PipingProfileProbability + { + get { return GetSoilProfileProbability(FailureMechanismSystemType.Piping); } + } + + /// + /// Gets the length of the current original dike (so not of the redesigned surfaceline). + /// + /// + /// The length of the current dike. + /// + [CsvExportColumn("CurrentDikeLength", 20)] + [Browsable(false)] + public double? CurrentDikeLength + { + get { return scenario.Location.SurfaceLine2.GetDikeLength(); } + } + + [CsvExportColumn("StabilityToeAtPolderX", 21)] + [Format("F3")] + [Unit(UnitType.Length)] + [Browsable(false)] + public double? StabilityToeAtPolderX + { + get + { + if (redesignedSurfaceLineGlobal == null) + return null; + + GeometryPoint point = redesignedSurfaceLineGlobal.GetDikeToeInward(); + if (point != null) + return point.X; + return null; + } + } + + [CsvExportColumn("StabilityToeAtPolderZ", 22)] + [Format("F3")] + [Unit(UnitType.Length)] + [Browsable(false)] + public double? StabilityToeAtPolderZ + { + get + { + if (redesignedSurfaceLineGlobal == null) + return null; + + GeometryPoint point = redesignedSurfaceLineGlobal.GetDikeToeInward(); + if (point != null) + return point.Z; + return null; + } + } + + [CsvExportColumn("StabilityShoulderHeight", 23)] + [Format("F3")] + [Unit(UnitType.Length)] + [Browsable(false)] + public double? StabilityShoulderHeight + { + get + { + if (redesignedSurfaceLineGlobal == null) + return null; + + GeometryPoint point = redesignedSurfaceLineGlobal.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.ShoulderTopInside); + if (point != null) + return point.Z; + return null; + } + } + + [CsvExportColumn("StabilitySafetyFactor", 24)] + [Format("F3")] + [Unit(UnitType.None)] + [ReadOnly(true)] + [Browsable(false)] + public double? StabilitySafetyFactor + { + get { return safetyFactorStability; } + set { safetyFactorStability = value; } + } + + [CsvExportColumn("RequiredSafetyFactorStabilityInnerSlope", 26)] + [Format("F3")] + [Unit(UnitType.None)] + [ReadOnly(true)] + [Browsable(false)] + public double? RequiredSafetyFactorStabilityInnerSlope + { + get { return scenario.RequiredSafetyFactorStabilityInnerSlope;} + } + + [CsvExportColumn("RequiredSafetyFactorStabilityOuterSlope", 27)] + [Format("F3")] + [Unit(UnitType.None)] + [ReadOnly(true)] + [Browsable(false)] + public double? RequiredSafetyFactorStabilityOuterSlope + { + get { return scenario.RequiredSafetyFactorStabilityOuterSlope; } + } + + [CsvExportColumn("RequiredSafetyFactorPiping", 28)] + [Format("F3")] + [Unit(UnitType.Length)] + [ReadOnly(true)] + [Browsable(false)] + public double? RequiredSafetyFactorPiping + { + get { return scenario.RequiredSafetyFactorPiping; } + } + + [CsvExportColumn("PipingToeAtPolderX", 29)] + [Format("F3")] + [Unit(UnitType.Length)] + [Browsable(false)] + public double? PipingToeAtPolderX + { + get + { + if (redesignedSurfaceLineGlobal == null) + return null; + + GeometryPoint point = redesignedSurfaceLineGlobal.GetDikeToeInward(); + if (point != null) + return point.X; + return null; + } + } + + [CsvExportColumn("PipingToeAtPolderZ", 30)] + [Format("F3")] + [Unit(UnitType.Length)] + [Browsable(false)] + public double? PipingToeAtPolderZ + { + get + { + if (redesignedSurfaceLineGlobal == null) + return null; + + GeometryPoint point = redesignedSurfaceLineGlobal.GetDikeToeInward(); + if (point != null) + return point.Z; + return null; + } + } + + [CsvExportColumn("PipingShoulderHeight", 31)] + [Format("F3")] + [Unit(UnitType.Length)] + [Browsable(false)] + public double? PipingShoulderHeight + { + get + { + if (redesignedSurfaceLineGlobal == null) + return null; + + GeometryPoint point = redesignedSurfaceLineGlobal.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.ShoulderTopInside); + if (point != null) + return point.Z; + return null; + } + } + + [CsvExportColumn("DikeLength", 33)] + [Format("F3")] + [PropertyOrder(4, 1)] + [Unit(UnitType.Length)] + [ReadOnly(true)] + public double? DikeLength + { + get + { + if (redesignedSurfaceLineGlobal != null) + { + return redesignedSurfaceLineGlobal.GetDikeLength(); + } + return null; + } + } + + [CsvExportColumn("Zone1SafetyFactorStability", 34)] + [Format("F3")] + [PropertyOrder(3, 1)] + [Unit(UnitType.None)] + [ReadOnly(true)] + public double? Zone1SafetyFactorStability + { + get { return zone1SafetyFactorStability; } + set { zone1SafetyFactorStability = value; } + } + + [Format("F3")] + [PropertyOrder(3, 2)] + [Unit(UnitType.Length)] + [ReadOnly(true)] + public double? LocalZone1EntryPointX + { + get { return localZone1EntryPointX; } + set { localZone1EntryPointX = value; } + } + + [CsvExportColumn("Zone1EntryPointX", 36)] + [Format("F3")] + [PropertyOrder(3, 3)] + [Unit(UnitType.Length)] + [ReadOnly(true)] + [XmlIgnore] + public double? Zone1EntryPointX + { + get + { + if (localZone1EntryPointX == null || redesignedSurfaceLineGlobal == null) + return null; + + GeometryPoint point = DetermineGlobalPointCoordinatesBasedOnGlobalSurfaceLine( + new GeometryPoint(localZone1EntryPointX.Value, 0.0, 0.0), redesignedSurfaceLineGlobal); + + return point.X; + } + } + + [CsvExportColumn("Zone1EntryPointY", 37)] + [Format("F3")] + [PropertyOrder(3, 4)] + [Unit(UnitType.Length)] + [ReadOnly(true)] + [XmlIgnore] + public double? Zone1EntryPointY + { + get + { + if (localZone1EntryPointX == null || redesignedSurfaceLineGlobal == null) + return null; + + GeometryPoint point = DetermineGlobalPointCoordinatesBasedOnGlobalSurfaceLine( + new GeometryPoint(localZone1EntryPointX.Value, 0.0, 0.0), redesignedSurfaceLineGlobal); + + return point.Y; + } + } + + [CsvExportColumn("Zone1EntryPointZ", 38)] + [Format("F3")] + [PropertyOrder(3, 5)] + [Unit(UnitType.Length)] + [ReadOnly(true)] + [XmlIgnore] + public double? Zone1EntryPointZ + { + get + { + if (localZone1EntryPointX == null) + return null; + if (redesignedSurfaceLine == null) + return null; + return redesignedSurfaceLine.Geometry.GetZAtX(localZone1EntryPointX.Value); + } + } + + [CsvExportColumn("LocalZone1ExitPointX", 39)] + [Format("F3")] + [PropertyOrder(3, 6)] + [Unit(UnitType.Length)] + [ReadOnly(true)] + public double? LocalZone1ExitPointX + { + get { return localZone1ExitPointX; } + set { localZone1ExitPointX = value; } + } + + [CsvExportColumn("Zone1ExitPointX", 40)] + [Format("F3")] + [PropertyOrder(3, 7)] + [Unit(UnitType.Length)] + [ReadOnly(true)] + public double? Zone1ExitPointX + { + get + { + if (localZone1ExitPointX == null || redesignedSurfaceLineGlobal == null) + return null; + + GeometryPoint point = DetermineGlobalPointCoordinatesBasedOnGlobalSurfaceLine( + new GeometryPoint(localZone1ExitPointX.Value, 0.0, 0.0), redesignedSurfaceLineGlobal); + + return point.X; + } + } + + [CsvExportColumn("Zone1ExitPointY", 41)] + [Format("F3")] + [PropertyOrder(3, 8)] + [Unit(UnitType.Length)] + [ReadOnly(true)] + public double? Zone1ExitPointY + { + get + { + if (localZone1ExitPointX == null || redesignedSurfaceLineGlobal == null) + return null; + + GeometryPoint point = DetermineGlobalPointCoordinatesBasedOnGlobalSurfaceLine( + new GeometryPoint(localZone1ExitPointX.Value, 0.0, 0.0), redesignedSurfaceLineGlobal); + + return point.Y; + } + } + + [CsvExportColumn("Zone1ExitPointZ", 42)] + [Format("F3")] + [PropertyOrder(3, 9)] + [Unit(UnitType.Length)] + [ReadOnly(true)] + public double? Zone1ExitPointZ + { + get + { + if (localZone1ExitPointX == null) + return null; + if (redesignedSurfaceLine == null) + return null; + return redesignedSurfaceLine.Geometry.GetZAtX(localZone1ExitPointX.Value); + } + } + + [CsvExportColumn("Zone2SafetyFactorStability", 43)] + [Format("F3")] + [PropertyOrder(3, 10)] + [Unit(UnitType.None)] + [ReadOnly(true)] + public double? Zone2SafetyFactorStability + { + get { return zone2SafetyFactorStability; } + set { zone2SafetyFactorStability = value; } + } + + [CsvExportColumn("LocalZone2EntryPointX", 44)] + [Format("F3")] + [PropertyOrder(3, 11)] + [Unit(UnitType.Length)] + [ReadOnly(true)] + public double? LocalZone2EntryPointX + { + get { return localZone2EntryPointX; } + set { localZone2EntryPointX = value; } + } + + [CsvExportColumn("Zone2EntryPointX", 45)] + [Format("F3")] + [PropertyOrder(3, 12)] + [Unit(UnitType.Length)] + [ReadOnly(true)] + public double? Zone2EntryPointX + { + get + { + if (localZone2EntryPointX == null || redesignedSurfaceLineGlobal == null) + return null; + + GeometryPoint point = DetermineGlobalPointCoordinatesBasedOnGlobalSurfaceLine( + new GeometryPoint(localZone2EntryPointX.Value, 0.0, 0.0), redesignedSurfaceLineGlobal); + + return point.X; + + } + } + + [CsvExportColumn("Zone2EntryPointY", 46)] + [Format("F3")] + [PropertyOrder(3, 13)] + [Unit(UnitType.Length)] + [ReadOnly(true)] + public double? Zone2EntryPointY + { + get + { + if (localZone2EntryPointX == null || redesignedSurfaceLineGlobal == null) + return null; + + GeometryPoint point = DetermineGlobalPointCoordinatesBasedOnGlobalSurfaceLine( + new GeometryPoint(localZone2EntryPointX.Value, 0.0, 0.0), redesignedSurfaceLineGlobal); + + return point.Y; + + } + } + + [CsvExportColumn("Zone2EntryPointZ", 47)] + [Format("F3")] + [PropertyOrder(3, 14)] + [Unit(UnitType.Length)] + [ReadOnly(true)] + public double? Zone2EntryPointZ + { + get + { + if (localZone2EntryPointX == null) + return null; + if (redesignedSurfaceLine == null) + return null; + return redesignedSurfaceLine.Geometry.GetZAtX(localZone2EntryPointX.Value); + } + } + + [CsvExportColumn("LocalZone2ExitPointX", 48)] + [Format("F3")] + [PropertyOrder(3, 15)] + [Unit(UnitType.Length)] + [ReadOnly(true)] + public double? LocalZone2ExitPointX + { + get { return localZone2ExitPointX; } + set { localZone2ExitPointX = value; } + } + + [CsvExportColumn("Zone2ExitPointX", 49)] + [Format("F3")] + [PropertyOrder(3, 16)] + [Unit(UnitType.Length)] + [ReadOnly(true)] + public double? Zone2ExitPointX + { + get + { + if (localZone2ExitPointX == null || redesignedSurfaceLineGlobal == null) + return null; + + GeometryPoint point = DetermineGlobalPointCoordinatesBasedOnGlobalSurfaceLine( + new GeometryPoint(localZone2ExitPointX.Value, 0.0, 0.0), redesignedSurfaceLineGlobal); + + return point.X; + } + } + + [CsvExportColumn("Zone2ExitPointY", 50)] + [Format("F3")] + [PropertyOrder(3, 17)] + [Unit(UnitType.Length)] + [ReadOnly(true)] + public double? Zone2ExitPointY + { + get + { + if (localZone2ExitPointX == null || redesignedSurfaceLineGlobal == null) + return null; + + GeometryPoint point = DetermineGlobalPointCoordinatesBasedOnGlobalSurfaceLine( + new GeometryPoint(localZone2ExitPointX.Value, 0.0, 0.0), redesignedSurfaceLineGlobal); + + return point.Y; + } + } + + [CsvExportColumn("Zone2ExitPointZ", 51)] + + [Format("F3")] + [PropertyOrder(3, 18)] + [Unit(UnitType.Length)] + [ReadOnly(true)] + public double? Zone2ExitPointZ + { + get + { + if (localZone2ExitPointX == null || redesignedSurfaceLine == null) + return null; + return redesignedSurfaceLine.Geometry.GetZAtX(localZone2ExitPointX.Value); + } + } + + [CsvExportColumn("IsUplift", 52)] + [PropertyOrder(1, 4)] + [ReadOnly(true)] + public bool? IsUplift + { + get { return isUplift; } + set { isUplift = value; } + } + + [CsvExportColumn("Pl3MinUplift", 53)] + [Format("F3")] + [PropertyOrder(5, 1)] + [Unit(UnitType.None)] + [ReadOnly(true)] + public double? Pl3MinUplift + { + get { return pl3MinUplift; } + set { pl3MinUplift = value; } + } + + [CsvExportColumn("Pl3HeadAdjusted", 54)] + [Format("F3")] + [PropertyOrder(5, 2)] + [Unit(UnitType.Length)] + [ReadOnly(true)] + public double? Pl3HeadAdjusted + { + get { return pl3HeadAdjusted; } + set { pl3HeadAdjusted = value; } + } + + [CsvExportColumn("pl3LocalLocationXMinUplift", 55)] + [Format("F3")] + [PropertyOrder(5, 3)] + [Unit(UnitType.Length)] + [ReadOnly(true)] + public double? Pl3LocalLocationXMinUplift + { + get { return pl3LocalLocationXMinUplift; } + set { pl3LocalLocationXMinUplift = value; } + } + + [CsvExportColumn("Pl3LocationXMinUplift", 56)] + [Format("F3")] + [PropertyOrder(5, 4)] + [Unit(UnitType.Length)] + [ReadOnly(true)] + [XmlIgnore] + public double? Pl3LocationXMinUplift + { + get + { + if (pl3LocalLocationXMinUplift == null || redesignedSurfaceLineGlobal == null) + return null; + + GeometryPoint point = DetermineGlobalPointCoordinatesBasedOnGlobalSurfaceLine( + new GeometryPoint(pl3LocalLocationXMinUplift.Value, 0.0, 0.0), redesignedSurfaceLineGlobal); + + return point.X; + } + } + + [CsvExportColumn("Pl3LocationYMinUplift", 57)] + [Format("F3")] + [PropertyOrder(5, 5)] + [Unit(UnitType.Length)] + [ReadOnly(true)] + [XmlIgnore] + public double? Pl3LocationYMinUplift + { + get + { + if (pl3LocalLocationXMinUplift == null || redesignedSurfaceLineGlobal == null) + return null; + + GeometryPoint point = DetermineGlobalPointCoordinatesBasedOnGlobalSurfaceLine( + new GeometryPoint(pl3LocalLocationXMinUplift.Value, 0.0, 0.0), redesignedSurfaceLineGlobal); + + return point.Y; + } + } + + [CsvExportColumn("Pl4MinUplift", 58)] + [Format("F3")] + [PropertyOrder(5, 6)] + [Unit(UnitType.None)] + [ReadOnly(true)] + public double? Pl4MinUplift + { + get { return pl4MinUplift; } + set { pl4MinUplift = value; } + } + + [CsvExportColumn("Pl4HeadAdjusted", 59)] + [Format("F3")] + [PropertyOrder(5, 7)] + [Unit(UnitType.Length)] + [ReadOnly(true)] + public double? Pl4HeadAdjusted + { + get { return pl4HeadAdjusted; } + set { pl4HeadAdjusted = value; } + } + + [CsvExportColumn("pl4LocalLocationXMinUplift", 60)] + [Format("F3")] + [PropertyOrder(5, 8)] + [Unit(UnitType.Length)] + [ReadOnly(true)] + public double? Pl4LocalLocationXMinUplift + { + get { return pl4LocalLocationXMinUplift; } + set { pl4LocalLocationXMinUplift = value; } + } + + [CsvExportColumn("Pl4LocationXMinUplift", 61)] + [Format("F3")] + [PropertyOrder(5, 9)] + [Unit(UnitType.Length)] + [ReadOnly(true)] + [XmlIgnore] + public double? Pl4LocationXMinUplift + { + get + { + if (pl4LocalLocationXMinUplift == null || redesignedSurfaceLineGlobal == null) + return null; + + GeometryPoint point = DetermineGlobalPointCoordinatesBasedOnGlobalSurfaceLine( + new GeometryPoint(pl4LocalLocationXMinUplift.Value, 0.0, 0.0), redesignedSurfaceLineGlobal); + + return point.X; + } + } + + [CsvExportColumn("Pl4LocationYMinUplift", 62)] + [Format("F3")] + [PropertyOrder(5, 10)] + [Unit(UnitType.Length)] + [ReadOnly(true)] + [XmlIgnore] + public double? Pl4LocationYMinUplift + { + get + { + if (pl4LocalLocationXMinUplift == null || redesignedSurfaceLineGlobal == null) + return null; + + GeometryPoint point = DetermineGlobalPointCoordinatesBasedOnGlobalSurfaceLine( + new GeometryPoint(pl4LocalLocationXMinUplift.Value, 0.0, 0.0), redesignedSurfaceLineGlobal); + + return point.Y; + } + } + + [Format("F3")] + [Unit(UnitType.None)] + [ReadOnly(true)] + [PropertyOrder(6, 11)] + public double? UpliftFactor + { + get { return upliftFactor; } + set { upliftFactor = value; } + } + + [Format("F3")] + [Unit(UnitType.None)] + [ReadOnly(true)] + [PropertyOrder(6, 12)] + [Browsable(false)] + public double? HeaveFactor + { + get { return heaveFactor; } + set { heaveFactor = value; } + } + + [CsvExportColumn("BlighPipingFactor", 63)] + [Format("F3")] + [Unit(UnitType.None)] + [ReadOnly(true)] + [Browsable(false)] + public double? BlighPipingFactor + { + get { return blighPipingFactor; } + set { blighPipingFactor = value; } + } + + [CsvExportColumn("BlighHCritical", 64)] + [Format("F3")] + [Unit(UnitType.Length)] + [ReadOnly(true)] + [Browsable(false)] + public double? BlighHCritical + { + get { return blighHCritical; } + set { blighHCritical = value; } + } + + [CsvExportColumn("Sellmeijer2ForcesPipingFactor", 65)] + [Format("F3")] + [Unit(UnitType.None)] + [ReadOnly(true)] + [Browsable(false)] + public double? Sellmeijer2ForcesPipingFactor + { + get { return sellmeijer2ForcesPipingFactor; } + set { sellmeijer2ForcesPipingFactor = value; } + } + + [CsvExportColumn("Sellmeijer2ForcesHCritical", 66)] + [Format("F3")] + [Unit(UnitType.Length)] + [ReadOnly(true)] + [Browsable(false)] + public double? Sellmeijer2ForcesHCritical + { + get { return sellmeijer2ForcesHCritical; } + set { sellmeijer2ForcesHCritical = value; } + } + + [CsvExportColumn("Sellmeijer4ForcesPipingFactor", 67)] + [Format("F3")] + [Unit(UnitType.None)] + [ReadOnly(true)] + [Browsable(false)] + public double? Sellmeijer4ForcesPipingFactor + { + get { return sellmeijer4ForcesPipingFactor; } + set { sellmeijer4ForcesPipingFactor = value; } + } + + [CsvExportColumn("Sellmeijer4ForcesHCritical", 68)] + [Format("F3")] + [Unit(UnitType.Length)] + [ReadOnly(true)] + [Browsable(false)] + public double? Sellmeijer4ForcesHCritical + { + get { return sellmeijer4ForcesHCritical; } + set { sellmeijer4ForcesHCritical = value; } + } + + [CsvExportColumn("SellmeijerPipingFactor", 69)] + [Format("F3")] + [Unit(UnitType.None)] + [ReadOnly(true)] + [Browsable(false)] + public double? SellmeijerPipingFactor + { + get { return sellmeijerPipingFactor; } + set { sellmeijerPipingFactor = value; } + } + + [CsvExportColumn("SellmeijerHCritical", 70)] + + [Format("F3")] + [Unit(UnitType.Length)] + [ReadOnly(true)] + [Browsable(false)] + public double? SellmeijerHCritical + { + get { return sellmeijerHCritical; } + set { sellmeijerHCritical = value; } + } + + /// + /// Gets or sets the wti2017 safety factor for backward erosion. + /// + /// + /// The wti2017 safety factor. + /// + [Format("F3")] + [Unit(UnitType.None)] + [ReadOnly(true)] + [CsvExportColumn("Wti2017BackwardErosionSafetyFactor", 71)] + [PropertyOrder(7, 1)] + public double? Wti2017BackwardErosionSafetyFactor + { + get { return wti2017BackwardErosionSafetyFactor; } + set { wti2017BackwardErosionSafetyFactor = value; } + } + + /// + /// Gets or sets the wti2017 safety factor for Uplift. + /// + /// + /// The wti2017 safety factor for Uplift. + /// + [Format("F3")] + [Unit(UnitType.None)] + [ReadOnly(true)] + [CsvExportColumn("Wti2017UpliftSafetyFactor", 72)] + [PropertyOrder(7, 5)] + public double? Wti2017UpliftSafetyFactor + { + get + { + return wti2017UpliftSafetyFactor; + } + set + { + wti2017UpliftSafetyFactor = value; + } + } + + /// + /// Gets or sets the wti2017 safety factor heave. + /// + /// + /// The wti2017 safety factor heave. + /// + [Format("F3")] + [Unit(UnitType.None)] + [ReadOnly(true)] + [CsvExportColumn("Wti2017HeaveSafetyFactor", 73)] + [PropertyOrder(7, 8)] + public double? Wti2017HeaveSafetyFactor + { + get + { + return wti2017HeaveSafetyFactor; + } + set + { + wti2017HeaveSafetyFactor = value; + } + } + + /// + /// Gets or sets the wti2017 safety factor overall (see MWDAM-1299). + /// + /// + /// The wti2017 safety factor overall. + /// + [Format("F3")] + [Unit(UnitType.None)] + [ReadOnly(true)] + [CsvExportColumn("Wti2017SafetyFactorOverall", 74)] + [PropertyOrder(7, 11)] + public double? Wti2017SafetyFactorOverall + { + get + { + return wti2017SafetyFactorOverall; + } + set + { + wti2017SafetyFactorOverall = value; + } + } + + /// + /// Gets or sets the wti2017 critical waterlevel for backward erosion. + /// + /// + /// The wti2017 critical waterlevel backward erosion. + /// + [Format("F3")] + [Unit(UnitType.Length)] + [ReadOnly(true)] + [CsvExportColumn("Wti2017BackwardErosionHcritical", 75)] + [PropertyOrder(7, 2)] + public double? Wti2017BackwardErosionHcritical + { + get { return wti2017BackwardErosionHcritical; } + set { wti2017BackwardErosionHcritical = value; } + } + + /// + /// Gets or sets the wti2017 critical waterlevel for Uplift. + /// + /// + /// The wti2017 hcritical uplift. + /// + [Format("F3")] + [Unit(UnitType.Length)] + [ReadOnly(true)] + [CsvExportColumn("Wti2017UpliftHcritical", 76)] + [PropertyOrder(7, 6)] + public double? Wti2017UpliftHcritical + { + get + { + return wti2017UpliftHcritical; + } + set + { + wti2017UpliftHcritical = value; + } + } + + /// + /// Gets or sets the wti2017 critical waterlevel for Heave. + /// + /// + /// The wti2017 hcritical heave. + /// + [Format("F3")] + [Unit(UnitType.Length)] + [ReadOnly(true)] + [CsvExportColumn("Wti2017HeaveHcritical", 77)] + [PropertyOrder(7, 9)] + public double? Wti2017HeaveHcritical + { + get + { + return wti2017HeaveHcritical; + } + set + { + wti2017HeaveHcritical = value; + } + } + + /// + /// Gets or sets the wti2017 critical waterlevel overall (see MWDAM-1299). + /// + /// + /// The wti2017 hcritical overall. + /// + [Format("F3")] + [Unit(UnitType.Length)] + [ReadOnly(true)] + [CsvExportColumn("Wti2017HcriticalOverall", 78)] + [PropertyOrder(7, 12)] + public double? Wti2017HcriticalOverall + { + get + { + return wti2017HcriticalOverall; + } + set + { + wti2017HcriticalOverall = value; + } + } + + /// + /// Gets or sets the wti2017 delta phi c be (backward erosion, critical head difference). + /// + /// + /// The wti2017 delta phi c be. + /// + [Format("F3")] + [Unit(UnitType.Length)] + [ReadOnly(true)] + [CsvExportColumn("Wti2017BackwardErosionDeltaPhiC", 79)] + [PropertyOrder(7, 3)] + public double? Wti2017BackwardErosionDeltaPhiC + { + get + { + return wti2017BackwardErosionDeltaPhiC; + } + set + { + wti2017BackwardErosionDeltaPhiC = value; + } + } + + /// + /// Gets or sets the wti2017 delta phi c be (backward erosion, reduced head difference). + /// + /// + /// The wti2017 delta phi c be. + /// + [Format("F3")] + [Unit(UnitType.Length)] + [ReadOnly(true)] + [CsvExportColumn("Wti2017BackwardErosionDeltaPhiReduced", 80)] + [PropertyOrder(7, 4)] + public double? Wti2017BackwardErosionDeltaPhiReduced + { + get + { + return wti2017BackwardErosionDeltaPhiReduced; + } + set + { + wti2017BackwardErosionDeltaPhiReduced = value; + } + } + + /// + /// Gets or sets the wti2017 delta phi cu (Uplift, critical head difference). + /// + /// + /// The wti2017 delta phi cu. + /// + [Format("F3")] + [Unit(UnitType.Length)] + [ReadOnly(true)] + [CsvExportColumn("Wti2017UpliftDeltaPhiC", 81)] + [PropertyOrder(7, 7)] + public double? Wti2017UpliftDeltaPhiC + { + get + { + return wti2017UpliftDeltaPhiC; + } + set + { + wti2017UpliftDeltaPhiC = value; + } + } + + /// + /// Gets or sets the wti2017 gradient (vertical outflow gradient for Heave). + /// + /// + /// The wti2017 gradient. + /// + [Format("F3")] + [Unit(UnitType.None)] + [ReadOnly(true)] + [CsvExportColumn("Wti2017Gradient", 82)] + [PropertyOrder(7, 10)] + public double? Wti2017Gradient + { + get + { + return wti2017Gradient; + } + set + { + wti2017Gradient = value; + } + } + + /// + /// Gets or sets the effective stress (at exit point, as calculated with Wti EffectiveThicknessCalculator). + /// + /// + /// The effective stress. + /// + [Format("F3")] + [Unit(UnitType.Pressure)] + [ReadOnly(true)] + [CsvExportColumn("Wti2017EffectiveStress", 83)] + [PropertyOrder(7, 13)] + public double? Wti2017EffectiveStress + { + get + { + return wti2017EffectiveStress; + } + set + { + wti2017EffectiveStress = value; + } + } + + /// + /// Gets or sets the wti2017 c creep (Creep coefficient). + /// + /// + /// The wti2017 c creep. + /// + [Format("F3")] + [Unit(UnitType.None)] + [ReadOnly(true)] + [CsvExportColumn("Wti2017CCreep", 84)] + [PropertyOrder(7, 14)] + public double? Wti2017CCreep + { + get { return wti2017CCreep; } + set { wti2017CCreep = value; } + } + + + + [CsvExportColumn("DikeToeAtRiverXrd", 85)] + [Browsable(false)] + public double? DikeToeAtRiverXrd + { + get + { + if (redesignedSurfaceLineGlobal != null) + { + return redesignedSurfaceLineGlobal.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtRiver).X; + } + return null; + } + } + + [CsvExportColumn("DikeToeAtRiverYrd", 86)] + [Browsable(false)] + public double? DikeToeAtRiverYrd + { + get + { + if (redesignedSurfaceLineGlobal != null) + { + return redesignedSurfaceLineGlobal.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtRiver).Y; + } + return null; + } + } + + [CsvExportColumn("DikeToeAtRiverZrd", 87)] + [Browsable(false)] + public double? DikeToeAtRiverZrd + { + get + { + if (redesignedSurfaceLineGlobal != null) + { + return redesignedSurfaceLineGlobal.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtRiver).Z; + } + return null; + } + } + + [CsvExportColumn("DikeTopAtRiverXrd", 88)] + [Browsable(false)] + public double? DikeTopAtRiverXrd + { + get + { + if (redesignedSurfaceLineGlobal != null) + { + return redesignedSurfaceLineGlobal.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtRiver).X; + } + return null; + } + } + + [CsvExportColumn("DikeTopAtRiverYrd", 89)] + [Browsable(false)] + public double? DikeTopAtRiverYrd + { + get + { + if (redesignedSurfaceLineGlobal != null) + { + return redesignedSurfaceLineGlobal.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtRiver).Y; + } + return null; + } + } + + [CsvExportColumn("DikeTopAtRiverZrd", 90)] + [Browsable(false)] + public double? DikeTopAtRiverZrd + { + get + { + if (redesignedSurfaceLineGlobal != null) + { + return redesignedSurfaceLineGlobal.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtRiver).Z; + } + return null; + } + } + + [CsvExportColumn("DikeTopAtPolderXrd", 91)] + [Browsable(false)] + public double? DikeTopAtPolderXrd + { + get + { + if (redesignedSurfaceLineGlobal != null) + { + return redesignedSurfaceLineGlobal.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder).X; + } + return null; + } + } + + [CsvExportColumn("DikeTopAtPolderYrd", 92)] + [Browsable(false)] + public double? DikeTopAtPolderYrd + { + get + { + if (redesignedSurfaceLineGlobal != null) + { + return redesignedSurfaceLineGlobal.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder).Y; + } + return null; + } + } + + [CsvExportColumn("DikeTopAtPolderZrd", 93)] + [Browsable(false)] + public double? DikeTopAtPolderZrd + { + get + { + if (redesignedSurfaceLineGlobal != null) + { + return redesignedSurfaceLineGlobal.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder).Z; + } + return null; + } + } + + [CsvExportColumn("DikeToeAtPolderXrd", 94)] + [Browsable(false)] + public double? DikeToeAtPolderXrd + { + get + { + if (redesignedSurfaceLineGlobal != null) + { + return redesignedSurfaceLineGlobal.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder).X; + } + return null; + } + } + + [CsvExportColumn("DikeToeAtPolderYrd", 95)] + [Browsable(false)] + public double? DikeToeAtPolderYrd + { + get + { + if (redesignedSurfaceLineGlobal != null) + { + return redesignedSurfaceLineGlobal.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder).Y; + } + return null; + } + } + + [CsvExportColumn("DikeToeAtPolderZrd", 96)] + [Browsable(false)] + public double? DikeToeAtPolderZrd + { + get + { + if (redesignedSurfaceLineGlobal != null) + { + return redesignedSurfaceLineGlobal.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder).Z; + } + return null; + } + } + + [Browsable(false)] + public Scenario Scenario + { + get { return scenario; } + set + { + scenario = value; + if (scenario != null) + { + scenarioName = scenario.LocationScenarioID; + locationName = scenario.Location.Name; + locationScenarioCount = scenario.Location.Scenarios.Count; + xRd = scenario.Location.XRd; + yRd = scenario.Location.YRd; + } + } + } + + [Browsable(false)] + public SoilProfile1D SoilProfile + { + get { return soilProfile; } + set + { + soilProfile = value; + } + } + + [Browsable(false)] + public string SoilGeometry2DName + { + get { return soilGeometry2DName; } + set { soilGeometry2DName = value; } + } + + /// + /// Creates a new instance based on + /// with global coordinates instead of local coordinates. + /// + [Browsable(false)] + public SurfaceLine2 CreateRedesignedSurfaceLineGlobal() + { + SurfaceLine2 localRedesignedSurfaceLineGlobal = null; + if (redesignedSurfaceLine != null) + { + SurfaceLine2 originalSurfaceLine = scenario.Location.SurfaceLine2; + if (originalSurfaceLine != null) + { + var coordinateSystemConverter = new CoordinateSystemConverter(); + coordinateSystemConverter.DefineGlobalXYZBasedOnLine(originalSurfaceLine.Geometry); + localRedesignedSurfaceLineGlobal = redesignedSurfaceLine.FullDeepClone(); + coordinateSystemConverter.ConvertLocalXZToGlobalXYZ(localRedesignedSurfaceLineGlobal.Geometry); + } + } + return localRedesignedSurfaceLineGlobal; + } + + /// + /// Gets or sets the redesigned surface line2. + /// + /// + /// The redesigned surface line2. + /// + [Browsable(false)] + public SurfaceLine2 RedesignedSurfaceLine2 + { + get { return redesignedSurfaceLine; } + set + { + redesignedSurfaceLine = value; + // Also determine and set the correct global version in order to retrieve dependend properties + redesignedSurfaceLineGlobal = CreateRedesignedSurfaceLineGlobal(); + } + } + + [PropertyOrder(2, 1)] + [XmlIgnore] + [ReadOnly(true)] + public string ProfileName + { + get + { + if (scenario != null) + { + profileName = GetSoilProfileName(); + } + return profileName; + } + set + { + profileName = value; + } + } + + private string GetSoilProfileName() + { + string soilprofilename = ""; + if (soilProfile != null) + { + soilprofilename = soilProfile.Name; + } + else + { + if (!String.IsNullOrEmpty(soilGeometry2DName)) + { + soilprofilename = soilGeometry2DName; + } + } + return soilprofilename; + } + + [Format("F3")] + [PropertyOrder(2, 2)] + [Unit(UnitType.Fractions)] + [ReadOnly(true)] + [XmlIgnore] + public double? ProfileProbability + { + get + { + double? res = null; + switch (damFailureMechanismeCalculationSpecification.FailureMechanismSystemType) + { + case FailureMechanismSystemType.HorizontalBalance: + case FailureMechanismSystemType.StabilityOutside: + case FailureMechanismSystemType.StabilityInside: + res = StabilityProfileProbability; + break; + case FailureMechanismSystemType.Piping: + res = PipingProfileProbability; + break; + } + return res; + } + } + + [Unit(UnitType.None)] + [PropertyOrder(2, 3)] + [ReadOnly(true)] + public MStabModelType? StabilityModel + { + get + { + return stabilityModel; + } + set { stabilityModel = value; } + } + + [Unit(UnitType.None)] + [Format("F3")] + [PropertyOrder(2, 4)] + [ReadOnly(true)] + [XmlIgnore] + public double? SafetyFactor + { + get + { + double? res = null; + switch (damFailureMechanismeCalculationSpecification.FailureMechanismSystemType) + { + case FailureMechanismSystemType.HorizontalBalance: + case FailureMechanismSystemType.StabilityOutside: + case FailureMechanismSystemType.StabilityInside: + res = StabilitySafetyFactor; + break; + case FailureMechanismSystemType.Piping: + res = PipingFactor; + break; + } + return res; + } + } + + [Format("F3")] + [PropertyOrder(2, 10)] + [Unit(UnitType.None)] + [ReadOnly(true)] + [XmlIgnore] + public double? RequiredSafetyFactor + { + get + { + double? res = null; + switch (damFailureMechanismeCalculationSpecification.FailureMechanismSystemType) + { + case FailureMechanismSystemType.StabilityOutside: + res = RequiredSafetyFactorStabilityOuterSlope; + break; + case FailureMechanismSystemType.StabilityInside: + res = RequiredSafetyFactorStabilityInnerSlope; + break; + case FailureMechanismSystemType.Piping: + res = RequiredSafetyFactorPiping; + break; + } + return res; + } + } + + [Format("F3")] + [PropertyOrder(2, 5)] + [Unit(UnitType.Length)] + [XmlIgnore] + [ReadOnly(true)] + public double? ShoulderHeight + { + get + { + double? res = null; + switch (damFailureMechanismeCalculationSpecification.FailureMechanismSystemType) + { + case FailureMechanismSystemType.StabilityInside: + res = StabilityShoulderHeight; + break; + case FailureMechanismSystemType.Piping: + res = PipingShoulderHeight; + break; + } + return res; + } + } + + [Format("F3")] + [PropertyOrder(2, 7)] + [Unit(UnitType.Length)] + [XmlIgnore] + [ReadOnly(true)] + public double? ToeAtPolderX + { + get + { + double? res = null; + switch (damFailureMechanismeCalculationSpecification.FailureMechanismSystemType) + { + case FailureMechanismSystemType.StabilityInside: + res = StabilityToeAtPolderX; + break; + case FailureMechanismSystemType.Piping: + res = PipingToeAtPolderX; + break; + } + return res; + } + } + + [Format("F3")] + [PropertyOrder(2, 8)] + [Unit(UnitType.Length)] + [XmlIgnore] + [ReadOnly(true)] + public double? ToeAtPolderZ + { + get + { + double? res = null; + switch (damFailureMechanismeCalculationSpecification.FailureMechanismSystemType) + { + case FailureMechanismSystemType.StabilityInside: + res = StabilityToeAtPolderZ; + break; + case FailureMechanismSystemType.Piping: + res = PipingToeAtPolderZ; + break; + } + return res; + } + } + + [PropertyOrder(6, 1)] + [Unit(UnitType.None)] + [ReadOnly(true)] + [XmlIgnore] + public PipingModelType? PipingModel + { + get + { + if (damFailureMechanismeCalculationSpecification.FailureMechanismSystemType == FailureMechanismSystemType.Piping) + { + return damFailureMechanismeCalculationSpecification.PipingModelType; + } + return null; + } + } + + [Format("F3")] + [PropertyOrder(6, 2)] + [Unit(UnitType.None)] + [ReadOnly(true)] + [XmlIgnore] + public double? PipingFactor + { + get + { + double? res = null; + if (damFailureMechanismeCalculationSpecification.FailureMechanismSystemType == FailureMechanismSystemType.Piping) + { + switch (damFailureMechanismeCalculationSpecification.PipingModelType) + { + case PipingModelType.Bligh: + res = BlighPipingFactor; + break; + case PipingModelType.Sellmeijer: + res = SellmeijerPipingFactor; + break; + case PipingModelType.Sellmeijer2Forces: + res = Sellmeijer2ForcesPipingFactor; + break; + case PipingModelType.Sellmeijer4Forces: + res = Sellmeijer4ForcesPipingFactor; + break; + case PipingModelType.Wti2017: + res = Wti2017SafetyFactorOverall; + break; + } + } + return res; + } + } + + [Format("F3")] + [PropertyOrder(6, 3)] + [Unit(UnitType.Length)] + [ReadOnly(true)] + [XmlIgnore] + public double? LocalPipingEntryPointX + { + get + { + GeometryPoint point = null; + if (redesignedSurfaceLine != null) + { + point = redesignedSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtRiver); + } + if (point != null && scenario != null) + return point.X - scenario.Location.DistanceToEntryPoint; + if (point != null) + return point.X; + return null; + } + } + + [Format("F3")] + [PropertyOrder(6, 4)] + [Unit(UnitType.Length)] + [ReadOnly(true)] + [XmlIgnore] + public double? PipingEntryPointX + { + get + { + if (LocalPipingEntryPointX == null || redesignedSurfaceLineGlobal == null) + return null; + + GeometryPoint point = DetermineGlobalPointCoordinatesBasedOnGlobalSurfaceLine( + new GeometryPoint(LocalPipingEntryPointX.Value, 0.0, 0.0), redesignedSurfaceLineGlobal); + + return point.X; + } + } + + [Format("F3")] + [PropertyOrder(6, 5)] + [Unit(UnitType.Length)] + [ReadOnly(true)] + [XmlIgnore] + public double? PipingEntryPointY + { + get + { + if (LocalPipingEntryPointX == null || redesignedSurfaceLineGlobal == null) + return null; + + GeometryPoint point = DetermineGlobalPointCoordinatesBasedOnGlobalSurfaceLine( + new GeometryPoint(LocalPipingEntryPointX.Value, 0.0, 0.0), redesignedSurfaceLineGlobal); + + return point.Y; + } + } + + [Format("F3")] + [PropertyOrder(6, 6)] + [Unit(UnitType.Length)] + [ReadOnly(true)] + public double? LocalPipingExitPointX + { + get { return localPipingExitPointX; } + set { localPipingExitPointX = value; } + } + + [Format("F3")] + [PropertyOrder(6, 7)] + [Unit(UnitType.Length)] + [ReadOnly(true)] + [XmlIgnore] + public double? PipingExitPointX + { + get + { + if (localPipingExitPointX == null || redesignedSurfaceLineGlobal == null) + return null; + + GeometryPoint point = DetermineGlobalPointCoordinatesBasedOnGlobalSurfaceLine( + new GeometryPoint(localPipingExitPointX.Value, 0.0, 0.0), redesignedSurfaceLineGlobal); + + return point.X; + } + } + + [Format("F3")] + [PropertyOrder(6, 8)] + [Unit(UnitType.Length)] + [ReadOnly(true)] + [XmlIgnore] + public double? PipingExitPointY + { + get + { + if (localPipingExitPointX == null || redesignedSurfaceLineGlobal == null) + return null; + + GeometryPoint point = DetermineGlobalPointCoordinatesBasedOnGlobalSurfaceLine( + new GeometryPoint(localPipingExitPointX.Value, 0.0, 0.0), redesignedSurfaceLineGlobal); + + return point.Y; + } + } + + [Format("F3")] + [PropertyOrder(6, 9)] + [Unit(UnitType.Length)] + [ReadOnly(true)] + public double? SeepageLength + { + get + { + if (scenario != null) + { + return localPipingExitPointX - LocalPipingEntryPointX; + } + return localPipingExitPointX - LocalPipingEntryPointX; + } + } + + [Format("F3")] + [PropertyOrder(6, 10)] + [Unit(UnitType.Length)] + [ReadOnly(true)] + [XmlIgnore] + public double? HCritical + { + get + { + double? res = null; + if (damFailureMechanismeCalculationSpecification.FailureMechanismSystemType == FailureMechanismSystemType.Piping) + { + switch (damFailureMechanismeCalculationSpecification.PipingModelType) + { + case PipingModelType.Bligh: + res = BlighHCritical; + break; + case PipingModelType.Sellmeijer: + res = SellmeijerHCritical; + break; + case PipingModelType.Sellmeijer2Forces: + res = Sellmeijer2ForcesHCritical; + break; + case PipingModelType.Sellmeijer4Forces: + res = Sellmeijer4ForcesHCritical; + break; + case PipingModelType.Wti2017: + res = Wti2017HcriticalOverall; + break; + } + } + return res; + } + } + + [Browsable(false)] + public string BaseFileName + { + get { return baseFileName; } + set { baseFileName = value; } + } + + [Browsable(false)] + public string CalculationSubDir + { + get { return calculationSubDir; } + set { calculationSubDir = value; } + } + + + public ResultEvaluation ResultEvaluation + { + get { return resultEvaluation; } + set + { + DataEventPublisher.BeforeChange(this, "ResultEvaluation"); + resultEvaluation = value; + DataEventPublisher.AfterChange(this, "ResultEvaluation"); + } + } + + [Description("Use this area to explain the valuation and for any further remarks")] + public string Notes + { + get { return notes; } + set + { + DataEventPublisher.BeforeChange(this, "Notes"); + notes = value; + DataEventPublisher.AfterChange(this, "Notes"); + } + } + + /// + /// Copies the result file. + /// + /// The extension. + private void CopyResultFile(string extension) + { + string copyResFile = Path.GetDirectoryName(InputFile) + Path.DirectorySeparatorChar + Path.GetFileNameWithoutExtension(InputFile) + " (copy)" + extension; + var resFile = Path.ChangeExtension(InputFile, extension); + if (resFile != null) + { + File.Copy(resFile, copyResFile, true); + } + } + + private string GetCurrentExeForOpenCalculationFile() + { + var exeName = DamHelperFunctions.MStabExePath; + if (SelectedStabilityKernelType != StabilityKernelType.DamClassicStability) + { + exeName = Path.GetDirectoryName(exeName) + "\\MStab.exe"; + } + return exeName; + } + + /// + /// Opens the calculation file. + /// + public void OpenCalculationFile() + { + if (File.Exists(InputFile)) + { + string copyFile = Path.GetDirectoryName(InputFile) + Path.DirectorySeparatorChar + + Path.GetFileNameWithoutExtension(InputFile) + " (copy)" + Path.GetExtension(InputFile); + File.Copy(InputFile, copyFile, true); + var exeName = GetCurrentExeForOpenCalculationFile(); + if (SelectedStabilityKernelType == StabilityKernelType.DamClassicStability) + { + const string stdExtension = ".std"; + CopyResultFile(stdExtension); + + const string stoExtension = ".sto"; + CopyResultFile(stoExtension); + } + var process = new Process + { + StartInfo = + { + RedirectStandardOutput = false, + FileName = exeName + } + }; + if (SelectedStabilityKernelType == StabilityKernelType.DamClassicStability) + { + process.StartInfo.Arguments = " \"" + copyFile + "\""; + } + process.StartInfo.UseShellExecute = false; + process.StartInfo.WindowStyle = ProcessWindowStyle.Normal; + process.Start(); + } + else + { + if (File.Exists(PipingResultFile)) + { + string copyFile = Path.GetTempPath() + Path.DirectorySeparatorChar + Path.GetFileNameWithoutExtension(PipingResultFile) + " (copy)" + + Path.GetExtension(PipingResultFile); + + File.Copy(PipingResultFile, copyFile, true); + Process.Start(copyFile); + } + } + } + + public bool IsEnabled(string property) + { + return true; + } + + public bool IsVisible(string property) + { + if (damFailureMechanismeCalculationSpecification == null) + return false; + switch (property) + { + // #Bka note that using FailureMechanismSystemType here is only possible as long as multiple specifications are NOT allowed. Otherwise visibility would + // have top be set here per line instead for whole column. + case "Zone1SafetyFactorStability": + case "Zone1EntryPointX": + case "Zone1EntryPointZ": + case "Zone1ExitPointX": + case "Zone1ExitPointZ": + case "Zone2SafetyFactorStability": + case "Zone2EntryPointX": + case "Zone2EntryPointZ": + case "Zone2ExitPointX": + case "Zone2ExitPointZ": + return damFailureMechanismeCalculationSpecification.FailureMechanismSystemType == FailureMechanismSystemType.StabilityInside;// && + //(damFailureMechanismeCalculationSpecification.FailureMechanismeParamatersMStab.MStabParameters.ZonesType == MStabZonesType.ZoneAreas || + //damFailureMechanismeCalculationSpecification.FailureMechanismeParamatersMStab.MStabParameters.ZonesType == MStabZonesType.ForbiddenZone); + //#Bka: zones are defined per location so can differ from result to result. Hence using Isvisible is not possible for this as zones should then be made + // visible or invisible per line in the table. + case "StabilityModel": + return damFailureMechanismeCalculationSpecification.FailureMechanismSystemType == + FailureMechanismSystemType.StabilityInside || + damFailureMechanismeCalculationSpecification.FailureMechanismSystemType == + FailureMechanismSystemType.StabilityOutside; + case "PipingModel": + return damFailureMechanismeCalculationSpecification.FailureMechanismSystemType == FailureMechanismSystemType.Piping; + case "PipingFactor": + return damFailureMechanismeCalculationSpecification.FailureMechanismSystemType == FailureMechanismSystemType.Piping; + case "HCritical": + return damFailureMechanismeCalculationSpecification.FailureMechanismSystemType == FailureMechanismSystemType.Piping; + case "OpenCalculationFile": + return damFailureMechanismeCalculationSpecification.FailureMechanismSystemType != FailureMechanismSystemType.Piping && + File.Exists(GetCurrentExeForOpenCalculationFile()); + default: + return true; + } + + } + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/Test/packages.config =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/Test/packages.config (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/Test/packages.config (revision 3305) @@ -0,0 +1,30 @@ + + + + + + + + + \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DamEngineIo/FillXmlInputFromDamUi.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DamEngineIo/FillXmlInputFromDamUi.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DamEngineIo/FillXmlInputFromDamUi.cs (revision 3305) @@ -0,0 +1,752 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Collections.Generic; +using System.Linq; +using Deltares.Dam.Data.Properties; +using Deltares.Dam.Data.Sensors; +using Deltares.DamEngine.Io; +using Deltares.DamEngine.Io.XmlInput; +using Deltares.Geotechnics.Soils; +using Deltares.Geotechnics.SurfaceLines; +using Soil = Deltares.Geotechnics.Soils.Soil; +using SurfaceLine = Deltares.DamEngine.Io.XmlInput.SurfaceLine; + +namespace Deltares.Dam.Data.DamEngineIo +{ + /// + /// Create XML Input object from DAM UI project + /// + public class FillXmlInputFromDamUi + { + /// + /// Creates the input. + /// + /// The dam project data. + /// The project map. + /// + public static Input CreateInput(DamProjectData damProjectData) + { + ValidateDamProjectData(damProjectData); + + Input input = new Input(); + Dike dike = damProjectData.WaterBoard.Dikes[0]; + + input.ProjectPath = damProjectData.ProjectPath; + input.CalculationMap = damProjectData.CalculationMap; + input.MaxCalculationCoresSpecified = true; + input.MaxCalculationCores = damProjectData.MaxCalculationCores; + + TransferAnalysisSpecification(damProjectData, input); + TransferStabilityParameters(damProjectData, input); + + // Process locations + List localLocations = new List(); + foreach (LocationJob locationJob in damProjectData.SelectedLocationJobs) + { + localLocations.Add(locationJob.Location); + } + input.Locations = new DamEngine.Io.XmlInput.Location[localLocations.Count]; + TransferLocations(localLocations, input.Locations); + + // Process surfacelines + List localSurfaceLines = new List(); + for (int i = 0; i < localLocations.Count; i++) + { + var crtSurfaceLine = localLocations[i].LocalXZSurfaceLine2; + if (!localSurfaceLines.Any(sl => sl.Name.Equals(crtSurfaceLine.Name))) + { + localSurfaceLines.Add(crtSurfaceLine); + } + } + input.SurfaceLines = new SurfaceLine[localSurfaceLines.Count]; + TransferSurfaceLines(localSurfaceLines, input.SurfaceLines); + + // Process soils + input.Soils = new DamEngine.Io.XmlInput.Soil[dike.SoilList.Soils.Count]; + TransferSoils(dike.SoilList.Soils, input.Soils); + TransferAquiferSoils(dike.SoilList.AquiferDictionary, input); + + // Process soilprofiles + if (damProjectData.DamProjectCalculationSpecification.SelectedStabilityKernelType == StabilityKernelType.DamClassicStability) + { + // Fill 1D profiles in case of DamClassicStability + if (dike.SoilProfiles != null) + { + var profilesCount = dike.SoilProfiles.Count; + input.SoilProfiles1D = new DamEngine.Io.XmlInput.SoilProfile1D[profilesCount]; + TransferSoilProfiles1D(dike.SoilProfiles, input.SoilProfiles1D); + input.SoilProfiles2D = new DamEngine.Io.XmlInput.SoilProfile2D[dike.SoilProfiles.Count]; + } + } + + var localSegments = EnsureInputLocationsSegmentsAreInSegments(damProjectData.WaterBoard.Segments, localLocations); + if (damProjectData.DamProjectCalculationSpecification.SelectedStabilityKernelType == StabilityKernelType.WtiMacroStabilityKernel) + { + // fill 2D profiles in case of WtiMacroStabilityKernel + var i = 0; + foreach (var localSegment in localSegments) + { + foreach (var localSegmentSoilProfileProbability in localSegment.SoilProfileProbabilities) + { + if (localSegmentSoilProfileProbability.SegmentFailureMechanismType == + FailureMechanismSystemType.StabilityInside) + { + var soilSurfaceProfile = new SoilSurfaceProfile(); + var soilProfile1D = new Deltares.Geotechnics.Soils.SoilProfile1D(); + soilProfile1D.Assign(localSegmentSoilProfileProbability.SoilProfile); + soilSurfaceProfile.SoilProfile = soilProfile1D; + soilSurfaceProfile.SurfaceLine2 = localLocations[i].LocalXZSurfaceLine2; + var dikeSoil = localLocations[i].GetDikeEmbankmentSoil(); + soilSurfaceProfile.DikeEmbankmentMaterial = dikeSoil; + foreach (SoilLayer2D layer in soilSurfaceProfile.Surfaces) + { + if (layer.Soil == null) + { + layer.Soil = dikeSoil; + } + } + } + } + i++; + } + TransferSoilProfiles2D(dike.SoilProfiles, input.SoilProfiles2D); + } + + // Process segments + if (localSegments != null) + { + input.Segments = new DamEngine.Io.XmlInput.Segment[localSegments.Count]; + TransferSegments(localSegments, input.Segments); + } + + if (damProjectData.InputTimeSerieCollection != null) + { + input.OperationalInputTimeSeries = new DamEngine.Io.XmlInput.TimeSerie[damProjectData.InputTimeSerieCollection.Series.Count]; + TransferInputTimeSeries(damProjectData.InputTimeSerieCollection, input.OperationalInputTimeSeries); + } + + if (damProjectData.SensorData != null) + { + input.SensorData = new InputSensorData(); + TransferSensorData(damProjectData.SensorData, input.SensorData); + } + return input; + } + + private static void TransferSensorData(SensorData sensorData, InputSensorData inputSensorData) + { + // Transfer sensorgroups + int sensorGroupIndex = 0; + inputSensorData.SensorGroups = new DamEngine.Io.XmlInput.SensorGroup[sensorData.SensorGroups.Count]; + foreach (var sensorGroup in sensorData.SensorGroups) + { + var inputSensorGroup = new DamEngine.Io.XmlInput.SensorGroup(); + inputSensorGroup.SensorIds = new SensorGroupSensorIds[sensorGroup.SensorCount]; + inputSensorGroup.Id = sensorGroup.ID; + int sensorIdIndex = 0; + foreach (var sensor in sensorGroup.SensorArray) + { + inputSensorGroup.SensorIds[sensorIdIndex] = new SensorGroupSensorIds() { SensorId = sensor.ID }; + sensorIdIndex++; + } + inputSensorData.SensorGroups[sensorGroupIndex] = inputSensorGroup; + sensorGroupIndex++; + } + + // Transfer sensorlocations + int senserLocationIndex = 0; + inputSensorData.SensorLocations = new DamEngine.Io.XmlInput.SensorLocation[sensorData.SensorLocations.Count]; + foreach (var sensorLocation in sensorData.SensorLocations) + { + var inputSensorLocation = new DamEngine.Io.XmlInput.SensorLocation(); + inputSensorLocation.GroupId = sensorLocation.GroupID; + inputSensorLocation.LocationId = sensorLocation.LocationName; + inputSensorLocation.SourceTypePl1PlLineOffsetBelowDikeToeAtPolder = ConversionHelper.ConvertToInputDataSourceTypeSensors(sensorLocation.SourceTypePl1PlLineOffsetBelowDikeToeAtPolder); + inputSensorLocation.SourceTypePl1PlLineOffsetBelowDikeTopAtPolder = ConversionHelper.ConvertToInputDataSourceTypeSensors(sensorLocation.SourceTypePl1PlLineOffsetBelowDikeTopAtPolder); + inputSensorLocation.SourceTypePl1PlLineOffsetBelowDikeTopAtRiver = ConversionHelper.ConvertToInputDataSourceTypeSensors(sensorLocation.SourceTypePl1PlLineOffsetBelowDikeTopAtRiver); + inputSensorLocation.SourceTypePl1PlLineOffsetBelowShoulderBaseInside = ConversionHelper.ConvertToInputDataSourceTypeSensors(sensorLocation.SourceTypePl1PlLineOffsetBelowShoulderBaseInside); + inputSensorLocation.SourceTypePl1WaterLevelAtRiver = ConversionHelper.ConvertToInputDataSourceTypeSensors(sensorLocation.SourceTypePl1WaterLevelAtRiver); + inputSensorLocation.SourceTypePl1WaterLevelAtPolder = ConversionHelper.ConvertToInputDataSourceTypeSensors(sensorLocation.SourceTypePl1WaterLevelAtPolder); + inputSensorLocation.SourceTypePl3 = ConversionHelper.ConvertToInputDataSourceTypeSensors(sensorLocation.SourceTypePl3); + inputSensorLocation.SourceTypePl4 = ConversionHelper.ConvertToInputDataSourceTypeSensors(sensorLocation.SourceTypePl4); + inputSensorData.SensorLocations[senserLocationIndex] = inputSensorLocation; + senserLocationIndex++; + } + + // Transfer sensors + inputSensorData.Sensors = new DamEngine.Io.XmlInput.Sensor[sensorData.Sensors.Count]; + int sensorIndex = 0; + foreach (var sensor in sensorData.Sensors) + { + var inputSensor = new DamEngine.Io.XmlInput.Sensor(); + inputSensor.Id = sensor.ID; + inputSensor.Name = sensor.Name; + inputSensor.RelativeLocation = sensor.RelativeLocation; + inputSensor.SensorType = ConversionHelper.ConvertToInputSensorType(sensor.Type); + inputSensor.PlLineMapping = new SensorPlLineMapping[sensor.PLLineMappings.Length]; + int mappingIndex = 0; + foreach (var plLineMapping in sensor.PLLineMappings) + { + inputSensor.PlLineMapping[mappingIndex] = new SensorPlLineMapping() { PLineType = ConversionHelper.ConvertToInputPlLineType(plLineMapping) }; + mappingIndex++; + } + inputSensorData.Sensors[sensorIndex] = inputSensor; + sensorIndex++; + } + } + + private static void TransferInputTimeSeries(TimeSerieCollection inputTimeSerieCollection, DamEngine.Io.XmlInput.TimeSerie[] operationalInputTimeSeries) + { + int timeSerieIndex = 0; + foreach (var timeSerie in inputTimeSerieCollection.Series) + { + var inputTimeSerie = new DamEngine.Io.XmlInput.TimeSerie(); + inputTimeSerie.Entries = new TimeSerieEntries(); + inputTimeSerie.Entries.TimeSerieEntry = new TimeSerieEntriesTimeSerieEntry[timeSerie.Entries.Count]; + inputTimeSerie.TimeStep = new TimeSerieTimeStep(); + inputTimeSerie.LocationId = timeSerie.LocationId; + inputTimeSerie.ParameterId = timeSerie.ParameterId; + inputTimeSerie.ForecastDateTime = timeSerie.ForecastDateTime; + inputTimeSerie.Type = timeSerie.Type; + inputTimeSerie.StartDateTime = timeSerie.StartDateTime; + inputTimeSerie.EndDateTime = timeSerie.EndDateTime; + inputTimeSerie.MissVal = timeSerie.MissVal; + inputTimeSerie.LongName = timeSerie.LongName; + inputTimeSerie.StationName = timeSerie.StationName; + inputTimeSerie.Units = timeSerie.Units; + inputTimeSerie.SourceOrganisation = timeSerie.SourceOrganisation; + inputTimeSerie.SourceSystem = timeSerie.SourceSystem; + inputTimeSerie.FileDescription = timeSerie.FileDescription; + inputTimeSerie.Region = timeSerie.Region; + inputTimeSerie.TimeStep.Multiplier = timeSerie.TimeStep.Multiplier; + inputTimeSerie.TimeStep.Divider = timeSerie.TimeStep.Divider; + inputTimeSerie.TimeStep.MultiplierSpecified1 = timeSerie.TimeStep.MultiplierSpecified; + inputTimeSerie.TimeStep.DividerSpecified1 = timeSerie.TimeStep.DividerSpecified; + inputTimeSerie.TimeStep.TimeStepUnit = ConversionHelper.ConvertToInputTimeStepUnit(timeSerie.TimeStep.Unit); + int timeSerieEntryIndex = 0; + foreach (var timestepEntry in timeSerie.Entries) + { + TimeSerieEntriesTimeSerieEntryStochastValue stochastValue = null; + if (timestepEntry.StochastValue != null) + { + stochastValue = new TimeSerieEntriesTimeSerieEntryStochastValue() + { + Distribution = timestepEntry.StochastValue.Distribution, + Mean = timestepEntry.StochastValue.Mean, + StandardDeviation = timestepEntry.StochastValue.StandardDeviation + }; + } + TimeSerieEntriesTimeSerieEntry timeStep = new TimeSerieEntriesTimeSerieEntry() + { + DateTime = timestepEntry.DateTime, + Value = timestepEntry.Value, + BasisFileNameWMF = timestepEntry.BasisFileName, + Flagnietechtgebruikt = timestepEntry.Flag, + RelativeCalculationPathName = timestepEntry.RelativeCalculationPathName, + StochastValue = stochastValue + }; + inputTimeSerie.Entries.TimeSerieEntry[timeSerieEntryIndex] = timeStep; + timeSerieEntryIndex++; + + } + operationalInputTimeSeries[timeSerieIndex] = inputTimeSerie; + timeSerieIndex++; + } + } + + private static void TransferAquiferSoils(Dictionary aquiferDictionary, Input input) + { + InputAquiferSoil[] aquiferSoils; + if (aquiferDictionary != null && aquiferDictionary.Count > 0) + { + aquiferSoils = new InputAquiferSoil[aquiferDictionary.Count]; + int soilIndex = 0; + foreach (KeyValuePair keyValuePair in aquiferDictionary) + { + aquiferSoils[soilIndex] = new InputAquiferSoil() { Soilname = keyValuePair.Key.Name, IsAquifer = keyValuePair.Value }; + soilIndex++; + } + } + else + { + aquiferSoils = null; + } + input.AquiferSoils = aquiferSoils; + } + + private static IList EnsureInputLocationsSegmentsAreInSegments(IList segments, List localLocations) + { + var localSegments = new List(); + localSegments.AddRange(segments); + foreach (var localLocation in localLocations) + { + var seg = localSegments.FirstOrDefault(x => x.Name == localLocation.Segment.Name); + if (seg == null) + { + localSegments.Add(localLocation.Segment); + } + } + return localSegments; + } + + private static void TransferAnalysisSpecification(DamProjectData damProjectData, Input input) + { + input.DamProjectType = ConversionHelper.ConvertToInputDamProjectType(damProjectData.DamProjectType); + if (damProjectData.DamProjectCalculationSpecification.CurrentSpecification != null) + { + input.FailureMechanismSystemType = ConversionHelper.ConvertToInputFailureMechanismSystemType(damProjectData.DamProjectCalculationSpecification.CurrentSpecification.FailureMechanismSystemType); + + input.AnalysisTypeSpecified = (input.DamProjectType == InputDamProjectType.Design); + if (input.AnalysisTypeSpecified) + { + input.AnalysisType = ConversionHelper.ConvertToInputAnalysisType(DamProjectCalculationSpecification.SelectedAnalysisType); + } + + input.PipingModelTypeSpecified = input.FailureMechanismSystemType == ConversionHelper.InputFailureMechanismPiping; + if (input.PipingModelTypeSpecified) + { + input.PipingModelType = ConversionHelper.ConvertToInputPipingModelType(damProjectData.DamProjectCalculationSpecification.CurrentSpecification.PipingModelType); + } + + input.StabilityModelTypeSpecified = input.FailureMechanismSystemType == ConversionHelper.InputFailureMechanismStabilityInside || + input.FailureMechanismSystemType == ConversionHelper.InputFailureMechanismStabilityOutside; + if (input.StabilityModelTypeSpecified) + { + input.StabilityModelType = ConversionHelper.ConvertToInputStabilityModelType(damProjectData.DamProjectCalculationSpecification.CurrentSpecification.StabilityModelType); + } + } + } + + private static void TransferStabilityParameters(DamProjectData damProjectData, Input input) + { + if (damProjectData.DamProjectCalculationSpecification != null && damProjectData.DamProjectCalculationSpecification.CurrentSpecification != null) + { + var curSpec = damProjectData.DamProjectCalculationSpecification.CurrentSpecification; + if (curSpec.FailureMechanismeParamatersMStab != null && curSpec.FailureMechanismeParamatersMStab.MStabParameters != null) + { + input.StabilityParameters = new StabilityParameters(); + input.StabilityParameters.SearchMethod = ConversionHelper.ConvertToInputSearchMethod(curSpec.FailureMechanismeParamatersMStab.MStabParameters.SearchMethod); + var slipCircleDefinition = curSpec.FailureMechanismeParamatersMStab.MStabParameters.SlipCircleDefinition; + if (slipCircleDefinition != null) + { + input.StabilityParameters.GridDetermination = ConversionHelper.ConvertToInputGridDetermination(slipCircleDefinition.GridSizeDetermination); + input.StabilityParameters.BishopTangentLinesDefinitionSpecified = true; + input.StabilityParameters.BishopTangentLinesDefinition = ConversionHelper.ConvertToInputTangentLinesDefinition(slipCircleDefinition.BishopTangentLinesDefinition); + input.StabilityParameters.BishopTangentLinesDistanceSpecified = true; + input.StabilityParameters.BishopTangentLinesDistance = slipCircleDefinition.BishopTangentLinesDistance; + input.StabilityParameters.BishopGridVerticalPointsCountSpecified = true; + input.StabilityParameters.BishopGridVerticalPointsCount = slipCircleDefinition.BishopGridVerticalPointCount; + input.StabilityParameters.BishopGridVerticalPointsDistanceSpecified = true; + input.StabilityParameters.BishopGridVerticalPointsDistance = slipCircleDefinition.BishopGridVerticalPointDistance; + input.StabilityParameters.BishopGridHorizontalPointsCountSpecified = true; + input.StabilityParameters.BishopGridHorizontalPointsCount = slipCircleDefinition.BishopGridHorizontalPointCount; + input.StabilityParameters.BishopGridHorizontalPointsDistanceSpecified = true; + input.StabilityParameters.BishopGridHorizontalPointsDistance = slipCircleDefinition.BishopGridHorizontalPointDistance; + input.StabilityParameters.UpliftVanTangentLinesDefinitionSpecified = true; + input.StabilityParameters.UpliftVanTangentLinesDefinition = ConversionHelper.ConvertToInputTangentLinesDefinition(slipCircleDefinition.UpliftVanTangentLinesDefinition); + input.StabilityParameters.UpliftVanTangentLinesDistanceSpecified = true; + input.StabilityParameters.UpliftVanTangentLinesDistance = slipCircleDefinition.UpliftVanTangentLinesDistance; + input.StabilityParameters.UpliftVanGridLeftVerticalPointsCountSpecified = true; + input.StabilityParameters.UpliftVanGridLeftVerticalPointsCount = slipCircleDefinition.UpliftVanLeftGridVerticalPointCount; + input.StabilityParameters.UpliftVanGridLeftVerticalPointsDistanceSpecified = true; + input.StabilityParameters.UpliftVanGridLeftVerticalPointsDistance = slipCircleDefinition.UpliftVanLeftGridVerticalPointDistance; + input.StabilityParameters.UpliftVanGridLeftHorizontalPointsCountSpecified = true; + input.StabilityParameters.UpliftVanGridLeftHorizontalPointsCount = slipCircleDefinition.UpliftVanLeftGridHorizontalPointCount; + input.StabilityParameters.UpliftVanGridLeftHorizontalPointsDistanceSpecified = true; + input.StabilityParameters.UpliftVanGridLeftHorizontalPointsDistance = slipCircleDefinition.UpliftVanLeftGridHorizontalPointDistance; + input.StabilityParameters.UpliftVanGridRightVerticalPointsCountSpecified = true; + input.StabilityParameters.UpliftVanGridRightVerticalPointsCount = slipCircleDefinition.UpliftVanRightGridVerticalPointCount; + input.StabilityParameters.UpliftVanGridRightVerticalPointsDistanceSpecified = true; + input.StabilityParameters.UpliftVanGridRightVerticalPointsDistance = slipCircleDefinition.UpliftVanRightGridVerticalPointDistance; + input.StabilityParameters.UpliftVanGridRightHorizontalPointsCountSpecified = true; + input.StabilityParameters.UpliftVanGridRightHorizontalPointsCount = slipCircleDefinition.UpliftVanRightGridHorizontalPointCount; + input.StabilityParameters.UpliftVanGridRightHorizontalPointsDistanceSpecified = true; + input.StabilityParameters.UpliftVanGridRightHorizontalPointsDistance = slipCircleDefinition.UpliftVanRightGridHorizontalPointDistance; + } + } + } + } + + private static void ValidateDamProjectData(DamProjectData damProjectData) + { + ThrowHelper.ThrowIfArgumentNull(damProjectData.WaterBoard, nameof(damProjectData.WaterBoard), StringResourceNames.NoDikeDefined); + if (damProjectData.WaterBoard.Dikes == null || damProjectData.WaterBoard.Dikes.Count != 1) + { + throw new ArgumentException(Resources.DikeShouldContainExactly1Dike); + } + var dike = damProjectData.WaterBoard.Dikes[0]; + ThrowHelper.ThrowIfArgumentNull(dike.Locations, nameof(dike.Locations), StringResourceNames.NoLocationsDefined); + // Following situation should never occur in the UI. Tested because of the check on RiverLevelLow in the code below + var currentSpecification = damProjectData.DamProjectCalculationSpecification.CurrentSpecification; + ThrowHelper.ThrowIfArgumentNull(currentSpecification, nameof(currentSpecification), StringResourceNames.NoCalculationTypeSpecified); + foreach (Location location in dike.Locations) + { + ThrowHelper.ThrowIfArgumentNull(location.Scenarios, nameof(location.Scenarios), StringResourceNames.NoScenariosDefinedInLocation); + foreach (var scenario in location.Scenarios) + { + string errorMessage = string.Format(Resources.NoRiverLevel, location.Name, scenario.LocationScenarioID); + ThrowHelper.ThrowIfArgumentNull(scenario.RiverLevel, nameof(scenario.RiverLevel), errorMessage); + // In code above is tested that CurrentSpecification exists + if (currentSpecification.FailureMechanismSystemType == FailureMechanismSystemType.StabilityOutside) + { + errorMessage = string.Format(Resources.NoRiverLevelLow, location.Name, scenario.LocationScenarioID); + ThrowHelper.ThrowIfArgumentNull(scenario.RiverLevelLow, nameof(scenario.RiverLevelLow), errorMessage); + } + } + } + + ThrowHelper.ThrowIfArgumentNull(dike.SurfaceLines2, nameof(dike.SurfaceLines2), StringResourceNames.NoSurfaceLines); + foreach (var surfaceLine in dike.SurfaceLines2) + { + if ((surfaceLine.CharacteristicPoints == null) || (surfaceLine.CharacteristicPoints.Count < 1)) + { + throw new ArgumentException(string.Format(Resources.SurfaceLineHasNoCharacteristicPoints, surfaceLine.Name)); + } + if ((surfaceLine.Geometry == null) || (surfaceLine.Geometry.Count < 2)) + { + throw new ArgumentException(string.Format(Resources.SurfaceLineHasNoPoints, surfaceLine.Name)); + } + } + ThrowHelper.ThrowIfArgumentNull(dike.SoilList, nameof(dike.SoilList), StringResourceNames.NoSoilsDefinedInProject); + ThrowHelper.ThrowIfArgumentNull(dike.SoilList.Soils, nameof(dike.SoilList.Soils), StringResourceNames.NoSoilsDefinedInProject); + ThrowHelper.ThrowIfArgumentNull(dike.SoilProfiles, nameof(dike.SoilProfiles), StringResourceNames.NoSoilprofiles1DDefinedInProject); + // Check for invalid Id names + foreach (var location in dike.Locations) + { + if (!IdValidator.IsCorrectName(location.Name)) + { + throw new IdValidatorException(string.Format(Resources.LocationInvalidName, location.Name)); + } + } + foreach (var segment in damProjectData.WaterBoard.Segments) + { + if (!IdValidator.IsCorrectName(segment.Name)) + { + throw new IdValidatorException(string.Format(Resources.SegmentInvalidName, segment.Name)); + } + } + foreach (var surfaceLine2 in dike.SurfaceLines2) + { + if (!IdValidator.IsCorrectName(surfaceLine2.Name)) + { + throw new IdValidatorException(string.Format(Resources.SurfaceLineInvalidName, surfaceLine2.Name)); + } + } + foreach (var soilProfile in dike.SoilProfiles) + { + if (!IdValidator.IsCorrectName(soilProfile.Name)) + { + throw new IdValidatorException(string.Format(Resources.SoilProfileInvalidName, soilProfile.Name)); + } + } + foreach (var soil in dike.SoilList.Soils) + { + if (!IdValidator.IsCorrectName(soil.Name)) + { + throw new IdValidatorException(string.Format(Resources.SoilInvalidName, soil.Name)); + } + } + } + + private static void TransferSoils(List soils, DamEngine.Io.XmlInput.Soil[] inputSoils) + { + for (int i = 0; i < soils.Count; i++) + { + var soil = soils[i]; + var inputSoil = new DamEngine.Io.XmlInput.Soil(); + inputSoil.Name = soil.Name; + inputSoil.AbovePhreaticLevelSpecified = !Double.IsNaN(soil.AbovePhreaticLevel); + inputSoil.AbovePhreaticLevel = soil.AbovePhreaticLevel; + inputSoil.BelowPhreaticLevelSpecified = !Double.IsNaN(soil.BelowPhreaticLevel); + inputSoil.BelowPhreaticLevel = soil.BelowPhreaticLevel; + inputSoil.DryUnitWeightSpecified = !Double.IsNaN(soil.DryUnitWeight); + inputSoil.DryUnitWeight = soil.DryUnitWeight; + inputSoil.BeddingAngleSpecified = !Double.IsNaN(soil.BeddingAngle); + inputSoil.BeddingAngle = soil.BeddingAngle; + inputSoil.DiameterD70Specified = !Double.IsNaN(soil.DiameterD70); + inputSoil.DiameterD70 = soil.DiameterD70; + inputSoil.DiameterD90Specified = !Double.IsNaN(soil.DiameterD90); + inputSoil.DiameterD90 = soil.DiameterD90; + inputSoil.PermeabKxSpecified = !Double.IsNaN(soil.PermeabKx); + inputSoil.PermeabKx = soil.PermeabKx; + inputSoil.WhitesConstantSpecified = !Double.IsNaN(soil.WhitesConstant); + inputSoil.WhitesConstant = soil.WhitesConstant; + inputSoil.ShearStrengthModelSpecified = true; + inputSoil.ShearStrengthModel = ConversionHelper.ConvertToSoilShearStrengthModel(soil.ShearStrengthModel); + inputSoil.UseDefaultShearStrengthModelSpecified = true; + inputSoil.UseDefaultShearStrengthModel = soil.UseDefaultShearStrengthModel; + inputSoil.CohesionSpecified = !Double.IsNaN(soil.Cohesion); + inputSoil.Cohesion = soil.Cohesion; + inputSoil.FrictionAngleSpecified = !Double.IsNaN(soil.FrictionAngle); + inputSoil.FrictionAngle = soil.FrictionAngle; + inputSoil.OcrSpecified = !Double.IsNaN(soil.OCR); + inputSoil.Ocr = soil.OCR; + inputSoil.SlopeRestProfileSpecified = !Double.IsNaN(soil.RestSlope); + inputSoil.SlopeRestProfile = soil.RestSlope; + inputSoil.DilatancyTypeSpecified = true; + inputSoil.DilatancyType = ConversionHelper.ConvertToSoilDilatancyType(soil.DilatancyType); + inputSoils[i] = inputSoil; + } + } + + private static void TransferSurfaceLines(IList dikeSurfaceLines, SurfaceLine[] inputSurfaceLines) + { + for (int i = 0; i < dikeSurfaceLines.Count; i++) + { + var surfaceLine = dikeSurfaceLines[i]; + var inputSurfaceLine = new SurfaceLine(); + inputSurfaceLine.Name = surfaceLine.Name; + inputSurfaceLine.Points = new SurfaceLinePoint[surfaceLine.CharacteristicPoints.Count]; + for (int j = 0; j < surfaceLine.CharacteristicPoints.Count; j++) + { + var characteristicPoint = surfaceLine.CharacteristicPoints[j]; + var inputPoint = new SurfaceLinePoint() + { + PointType = ConversionHelper.ConvertToInputPointType(characteristicPoint.CharacteristicPointType), + X = characteristicPoint.X, + Z = characteristicPoint.Z + }; + inputSurfaceLine.Points[j] = inputPoint; + } + inputSurfaceLines[i] = inputSurfaceLine; + } + } + private static void TransferLocations(IList dikeLocations, DamEngine.Io.XmlInput.Location[] inputLocations) + { + for (int i = 0; i < dikeLocations.Count; i++) + { + var location = dikeLocations[i]; + var inputLocation = new DamEngine.Io.XmlInput.Location(); + inputLocation.Name = location.Name; + inputLocation.DistanceToEntryPoint = location.DistanceToEntryPoint; + inputLocation.DistanceToEntryPointSpecified = true; + inputLocation.XSoilGeometry2DOriginSpecified = true; + inputLocation.XSoilGeometry2DOrigin = location.XSoilGeometry2DOrigin; + + inputLocation.SurfaceLineName = location.LocalXZSurfaceLine2.Name; + inputLocation.SegmentName = location.Segment.Name; + + var waternetOptions = new LocationWaternetOptions(); + waternetOptions.PhreaticLineCreationMethod = ConversionHelper.ConvertToInputPhreaticLineCreationMethod(location.PLLineCreationMethod); + waternetOptions.IntrusionVerticalWaterPressure = ConversionHelper.ConvertToInputIntrusionVerticalWaterPressure(location.IntrusionVerticalWaterPressure ?? IntrusionVerticalWaterPressureType.Standard); + waternetOptions.DampingFactorPl3 = location.DampingFactorPL3; + waternetOptions.DampingFactorPl4 = location.DampingFactorPL4; + waternetOptions.PenetrationLength = location.PenetrationLength; + waternetOptions.SlopeDampingFactor = location.SlopeDampingPiezometricHeightPolderSide; + inputLocation.WaternetOptions = waternetOptions; + + inputLocation.DesignScenarios = new LocationDesignScenario[location.Scenarios.Count]; + for (int j = 0; j < location.Scenarios.Count; j++) + { + var designScenario = location.Scenarios[j]; + var inputDesignScenario = new LocationDesignScenario(); + inputDesignScenario.RiverLevel = designScenario.RiverLevel.Value; + + inputDesignScenario.Id = designScenario.LocationScenarioID; + inputDesignScenario.RiverLevelLowSpecified = designScenario.RiverLevelLow.HasValue; + inputDesignScenario.RiverLevelLow = designScenario.RiverLevelLow ?? 0.0; + inputDesignScenario.DikeTableHeightSpecified = designScenario.DikeTableHeight.HasValue; + inputDesignScenario.DikeTableHeight = designScenario.DikeTableHeight ?? 0.0; + inputDesignScenario.PlLineOffsetBelowDikeTopAtRiver = designScenario.PlLineOffsetBelowDikeTopAtRiver; + inputDesignScenario.PlLineOffsetBelowDikeTopAtPolder = designScenario.PlLineOffsetBelowDikeTopAtPolder; + inputDesignScenario.PlLineOffsetBelowShoulderBaseInside = designScenario.PlLineOffsetBelowShoulderBaseInside; + inputDesignScenario.PlLineOffsetBelowDikeToeAtPolder = designScenario.PlLineOffsetBelowDikeToeAtPolder; + inputDesignScenario.PlLineOffsetBelowDikeCrestMiddleSpecified = designScenario.UsePlLineOffsetBelowDikeCrestMiddle ?? false; + inputDesignScenario.PlLineOffsetBelowDikeCrestMiddle = designScenario.PlLineOffsetBelowDikeCrestMiddle ?? 0.0; + inputDesignScenario.PlLineOffsetFactorBelowShoulderCrestSpecified = designScenario.UsePlLineOffsetFactorBelowShoulderCrest ?? false; + inputDesignScenario.PlLineOffsetFactorBelowShoulderCrest = designScenario.PlLineOffsetFactorBelowShoulderCrest ?? 0.0; + inputDesignScenario.HeadPl3Specified = designScenario.HeadPl3.HasValue; + inputDesignScenario.HeadPl3 = designScenario.HeadPl3 ?? 0.0; + inputDesignScenario.HeadPl4Specified = designScenario.HeadPl4.HasValue; + inputDesignScenario.HeadPl4 = designScenario.HeadPl4 ?? 0.0; + inputDesignScenario.UpliftCriterionStability = designScenario.UpliftCriterionStability; + inputDesignScenario.UpliftCriterionPiping = designScenario.UpliftCriterionPiping; + inputDesignScenario.RequiredSafetyFactorStabilityInnerSlope = designScenario.RequiredSafetyFactorStabilityInnerSlope; + inputDesignScenario.RequiredSafetyFactorStabilityOuterSlope = designScenario.RequiredSafetyFactorStabilityOuterSlope; + inputDesignScenario.RequiredSafetyFactorPiping = designScenario.RequiredSafetyFactorPiping; + inputDesignScenario.PolderLevel = designScenario.PolderLevel; + inputDesignScenario.HeadPl2Specified = designScenario.HeadPl2.HasValue; + inputDesignScenario.HeadPl2 = designScenario.HeadPl2 ?? 0.0; + + inputLocation.DesignScenarios[j] = inputDesignScenario; + } + inputLocation.DikeEmbankmentMaterial = location.DikeEmbankmentMaterial; + inputLocation.StabilityOptions = new LocationStabilityOptions + { + MapForSoilgeometries2D = location.MapForSoilGeometries2D, + SoilDatabaseName = location.SoildatabaseName, + ZoneType = ConversionHelper.ConvertToInputZoneType(location.StabilityZoneType), + ForbiddenZoneFactorSpecified = true, + ForbiddenZoneFactor = location.ForbiddenZoneFactor, + ZoneAreaRestSlopeCrestWidthSpecified = true, + ZoneAreaRestSlopeCrestWidth = location.ZoneAreaRestSlopeCrestWidth, + TrafficLoadSpecified = true, + TrafficLoad = location.TrafficLoad, + TrafficLoadDegreeOfConsolidationSpecified = location.TL_DegreeOfConsolidation.HasValue, + TrafficLoadDegreeOfConsolidation = location.TL_DegreeOfConsolidation ?? 0.0, + MinimumCircleDepthSpecified = true, + MinimumCircleDepth = location.MinimalCircleDepth + }; + + // Design options + var designOptions = new LocationDesignOptions(); + designOptions.RedesignDikeHeight = location.RedesignDikeHeight; + designOptions.RedesignDikeShoulder = location.RedesignDikeShoulder; + designOptions.ShoulderEmbankmentMaterial = location.ShoulderEmbankmentMaterial; + designOptions.StabilityShoulderGrowSlope = location.StabilityShoulderGrowSlope; + designOptions.StabilityShoulderGrowDeltaX = location.StabilityShoulderGrowDeltaX; + designOptions.StabilitySlopeAdaptionDeltaX = location.StabilitySlopeAdaptionDeltaX; + designOptions.SlopeAdaptionStartCotangent = location.SlopeAdaptionStartCotangent; + designOptions.SlopeAdaptionEndCotangent = location.SlopeAdaptionEndCotangent; + designOptions.SlopeAdaptionStepCotangent = location.SlopeAdaptionStepCotangent; + designOptions.NewDikeTopWidthSpecified = location.UseNewDikeTopWidth; + designOptions.NewDikeTopWidth = location.NewDikeTopWidth; + designOptions.NewDikeSlopeInsideSpecified = location.UseNewDikeSlopeInside; + designOptions.NewDikeSlopeInside = location.NewDikeSlopeInside; + designOptions.NewDikeSlopeOutsideSpecified = location.UseNewDikeSlopeOutside; + designOptions.NewDikeSlopeOutside = location.NewDikeSlopeOutside; + designOptions.NewShoulderTopSlopeSpecified = location.UseNewShoulderTopSlope; + designOptions.NewShoulderTopSlope = location.NewShoulderTopSlope; + designOptions.NewShoulderBaseSlopeSpecified = location.UseNewShoulderBaseSlope; + designOptions.NewShoulderBaseSlope = location.NewShoulderBaseSlope; + designOptions.NewMaxHeightShoulderAsFractionSpecified = location.UseNewMaxHeightShoulderAsFraction; + designOptions.NewMaxHeightShoulderAsFraction = location.NewMaxHeightShoulderAsFraction; + designOptions.NewMinDistanceDikeToeStartDitchSpecified = location.UseNewMinDistanceDikeToeStartDitch; + designOptions.NewMinDistanceDikeToeStartDitch = location.NewMinDistanceDikeToeStartDitch; + designOptions.UseNewDitchDefinition = location.UseNewDitchDefinition; + designOptions.NewWidthDitchBottomSpecified = location.UseNewDitchDefinition; + designOptions.NewWidthDitchBottom = location.NewWidthDitchBottom; + designOptions.NewSlopeAngleDitchSpecified = location.UseNewDitchDefinition; + designOptions.NewSlopeAngleDitch = location.NewSlopeAngleDitch; + designOptions.NewDepthDitchSpecified = location.UseNewDitchDefinition; + designOptions.NewDepthDitch = location.NewDepthDitch; + designOptions.StabilityDesignMethod = ConversionHelper.ConvertToInputStabilityDesignMethod(location.StabilityDesignMethod); + inputLocation.DesignOptions = designOptions; + inputLocations[i] = inputLocation; + } + } + + private static void TransferSoilProfiles1D(IList dikeSoilProfiles, DamEngine.Io.XmlInput.SoilProfile1D[] inputSoilProfiles1D) + { + var profilesCount = dikeSoilProfiles.Count; + for (int i = 0; i < profilesCount; i++) + { + var soilProfile1D = dikeSoilProfiles[i]; + var inputSoilProfile1D = new DamEngine.Io.XmlInput.SoilProfile1D + { + Name = soilProfile1D.Name, + BottomLevel = soilProfile1D.BottomLevel, + Layers1D = new SoilProfile1DLayer1D[soilProfile1D.LayerCount] + }; + AddLayers1D(soilProfile1D, inputSoilProfile1D); + inputSoilProfiles1D[i] = inputSoilProfile1D; + } + } + + private static void TransferSoilProfiles2D(IList dikeSoilProfiles, DamEngine.Io.XmlInput.SoilProfile2D[] inputSoilProfiles2D) + { + var profilesCount = dikeSoilProfiles.Count; + for (int i = 0; i < profilesCount; i++) + { + var soilProfile2D = dikeSoilProfiles[i]; + var inputSoilProfile2D = new DamEngine.Io.XmlInput.SoilProfile2D + { + Name = soilProfile2D.Name, + + Layers2D = new SoilProfile2DLayer2D[soilProfile2D.LayerCount] + }; + // AddLayers2D(soilProfile2D, inputSoilProfile2D); + inputSoilProfiles2D[i] = inputSoilProfile2D; + } + } + + private static void AddLayers1D(Deltares.Geotechnics.Soils.SoilProfile1D soilProfile1D, DamEngine.Io.XmlInput.SoilProfile1D inputSoilProfile1D) + { + for (int i = 0; i < soilProfile1D.LayerCount; i++) + { + var layer = soilProfile1D.Layers[i]; + var inputLayer = new SoilProfile1DLayer1D + { + Name = layer.Id, + SoilName = layer.Soil.Name, + TopLevel = layer.TopLevel, + IsAquifer = layer.IsAquifer, + WaterpressureInterpolationModel = ConversionHelper.ConvertToInputWaterpressureInterpolationModel( + layer.WaterpressureInterpolationModel) + }; + inputSoilProfile1D.Layers1D[i] = inputLayer; + } + } + private static void TransferSegments(IList segments, DamEngine.Io.XmlInput.Segment[] inputSegments) + { + for (int i = 0; i < segments.Count; i++) + { + var segment = segments[i]; + var inputSegment = new DamEngine.Io.XmlInput.Segment + { + Name = segment.Name + }; + AddSoilProfileProbabilities(segment, inputSegment); + inputSegments[i] = inputSegment; + } + } + + private static void AddSoilProfileProbabilities(Segment segment, DamEngine.Io.XmlInput.Segment inputSegment) + { + if (segment.SoilProfileProbabilities != null) + { + var probabilityCount = segment.SoilProfileProbabilities.Count; + inputSegment.SoilGeometryProbability = new SegmentSoilGeometryProbability[probabilityCount]; + for (int i = 0; i < probabilityCount; i++) + { + var soilGeometryProbability = segment.SoilProfileProbabilities[i]; + var inputSoilGeometryProbability = new SegmentSoilGeometryProbability(); + inputSoilGeometryProbability.Probability = soilGeometryProbability.Probability; + if (soilGeometryProbability.SegmentFailureMechanismType.HasValue) + { + inputSoilGeometryProbability.SegmentFailureMechanismType = ConversionHelper.ConvertToInputSegmentFailureMechanismType(soilGeometryProbability.SegmentFailureMechanismType.Value); + inputSoilGeometryProbability.SegmentFailureMechanismTypeSpecified = true; + } + else + { + inputSoilGeometryProbability.SegmentFailureMechanismTypeSpecified = false; + } + + switch (soilGeometryProbability.SoilProfileType) + { + case SoilProfileType.SoilProfile1D: + case SoilProfileType.SoilProfile2D: + inputSoilGeometryProbability.SoilProfileName = soilGeometryProbability.SoilGeometryName; + break; + default: + inputSoilGeometryProbability.SoilProfileName = soilGeometryProbability.SoilGeometry2DName; + break; + + } + inputSoilGeometryProbability.SoilProfileType = ConversionHelper.ConvertToInputSoilProfileType(soilGeometryProbability.SoilProfileType); + inputSegment.SoilGeometryProbability[i] = inputSoilGeometryProbability; + } + } + } + } +} Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DtoAssembler/DtoPropertyMapException.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DtoAssembler/DtoPropertyMapException.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DtoAssembler/DtoPropertyMapException.cs (revision 3305) @@ -0,0 +1,49 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU 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.Standard +{ + [Serializable] + public class DtoPropertyMapException : Exception + { + public DtoPropertyMapException() + { + } + + public DtoPropertyMapException(string message) : base(message) + { + } + + public DtoPropertyMapException(string message, Exception inner) : base(message, inner) + { + } + + protected DtoPropertyMapException( + SerializationInfo info, + StreamingContext context) + : base(info, context) + { + } + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DataPlugins/DataPluginImporter.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DataPlugins/DataPluginImporter.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DataPlugins/DataPluginImporter.cs (revision 3305) @@ -0,0 +1,1317 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU 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.Diagnostics; +using System.IO; +using System.Linq; +using Deltares.Dam.Data.CsvImporters; +using Deltares.Dam.Data.IO; +using Deltares.Geometry; +using Deltares.Geotechnics.IO; +using Deltares.Geotechnics.Soils; +using Deltares.Geotechnics.SurfaceLines; +using Deltares.Maps; +using Deltares.Standard; +using Deltares.Standard.Logging; +using GeoAPI.Geometries; + +namespace Deltares.Dam.Data.DataPlugins +{ + using Data; + using Importers; + using Configuration; + using Location = Location; + + // TODO: Import PL1-lines + + /// + /// ImportMode + /// + internal enum ImportMode + { + DikeRingAndLocationData, + All + } + + /// + /// Exception for DataPluginImporter + /// + public class DataPluginImporterException : ApplicationException + { + public DataPluginImporterException() + { + } + + public DataPluginImporterException(string message) + : base(message) + { + } + + public DataPluginImporterException(string message, Exception inner) + : base(message, inner) + { + } + } + + /// + /// DataPlugin implementation to import from files + /// + public class DataPluginImporter : IDataPlugin + { + private bool isAllDataImported = false; + private bool isDikeRingAndLocationDataImported = false; + private WaterBoard waterBoard; + private readonly IFeatureRepository repository = new FeatureRepository(); + private readonly List importLogMessages = new List(); + private List attributes; + private DamProjectType damProjectType; + private bool csvDataAdded = false; + + private string damProjectFolder; + + /// + /// Initializes a new instance of the class. + /// + public DataPluginImporter() + { + InitializeWaterBoard(); + attributes = new List(); + } + + private void InitializeWaterBoard() + { + if (waterBoard != null) + { + waterBoard.Dispose(); + } + waterBoard = new WaterBoard(); + } + + /// + /// Sets the type of the dam project. + /// + /// + /// The type of the dam project. + /// + public DamProjectType DamProjectType + { + set + { + damProjectType = value; + } + } + + /// + /// Gets the import log messages. + /// + /// + /// The import log messages. + /// + public List ImportLogMessages + { + get { return importLogMessages; } + } + + /// + /// Gets or sets the dam project folder. + /// + /// + /// The dam project folder. + /// + public string DamProjectFolder + { + get { return damProjectFolder; } + set + { + if (damProjectFolder != value) + { + damProjectFolder = value; + Clear(); + } + } + } + + /// + /// Gets the data folder. + /// + /// + /// The data folder. + /// + public string DataFolder { get; private set; } + + /// + /// Gets or sets the attributes. + /// + /// + /// The attributes. + /// + /// value + public IEnumerable Attributes + { + get { return attributes; } + set + { + if (value == null) + throw new ArgumentNullException("value"); + + isAllDataImported = false; + attributes = value as List ?? value.ToList(); + } + } + + /// + /// Define data sources + /// + /// + /// + public void SetDataSources(string dataFolder, IEnumerable dataSources) + { + isAllDataImported = false; + DataFolder = dataFolder; + DataSources = dataSources; + } + + /// + /// Get data source definitions + /// + /// + public IEnumerable DataSources { get; private set; } + + /// + /// Get info for WaterBoard + /// + /// + public Info WaterBoardInfo + { + get + { + ThrowIfDataNotRead(); + return new Info + { + Name = waterBoard.Name, + Description = waterBoard.Description, + Source = DataSourceManager.GetSource(waterBoard, "Name") + }; + } + } + + /// + /// Gets the map geometry identifier list. + /// + /// + /// The map geometry identifier list. + /// + public IEnumerable MapGeometryIdList + { + get + { + ThrowIfDataNotRead(); + return repository.FeatureIds.Select(id => id.ToString()); + } + } + + /// + /// Clears this instance. + /// + private void Clear() + { + InitializeWaterBoard(); + + isAllDataImported = false; + isDikeRingAndLocationDataImported = false; + } + + /// + /// Gets the dike. + /// + /// The dike ring identifier. + /// + private Dike GetDike(string dikeRingId) + { + ThrowIfDataNotRead(); + return waterBoard.Dikes.First(d => d.Name.Equals(dikeRingId)); + } + + /// + /// Gets the or create dike. + /// + /// The dike ring identifier. + /// + private Dike GetOrCreateDike(string dikeRingId) + { + // first check to see if this dike is already known, if not create it + Dike dike = null; + + // try to get it + if (waterBoard.Dikes.Any()) + { + var id = dikeRingId; + dike = waterBoard.Dikes.FirstOrDefault(x => x.Name.Equals(id)); + } + + // not found, create it + if (dike == null) + { + dike = new Dike { Name = dikeRingId }; + waterBoard.Dikes.Add(dike); + } + + return dike; + } + + /// + /// Gets the segment. + /// + /// The segment identifier. + /// + private Segment GetSegment(string segmentID) + { + ThrowIfDataNotRead(); + return waterBoard.Segments.First(s => s.Name.Equals(segmentID)); + } + + /// + /// Gets the location. + /// + /// The dike ring identifier. + /// The location identifier. + /// + private Location GetLocation(string dikeRingId, string locationId) + { + var dike = GetDike(dikeRingId); + return dike.Locations.First(l => l.Name.Equals(locationId)); + } + + /// + /// Gets a soil. + /// + /// The dike ring identifier. + /// The soil identifier. + /// + private Soil GetSoil(string dikeRingId, string soilId) + { + var dike = GetDike(dikeRingId); + Soil soil = dike.SoilList.GetSoilByName(soilId); + return soil; + } + + /// + /// Gets a soil profile. + /// + /// The dike ring identifier. + /// The soil profile1 d identifier. + /// + private SoilProfile1D GetSoilProfile(string dikeRingId, string soilProfile1DId) + { + var dike = GetDike(dikeRingId); + return dike.SoilProfiles.First(p => p.Name.Equals(soilProfile1DId)); + } + + /// + /// Gets a scenario. + /// + /// The dike ring identifier. + /// The location identifier. + /// The scenario identifier. + /// + private Scenario GetScenario(string dikeRingId, string locationId, string scenarioId) + { + var dike = GetDike(dikeRingId); + var location = dike.Locations.FirstOrDefault(l => l.Name.Equals(locationId)); + return (location == null ? null : location.Scenarios.FirstOrDefault(s => s.LocationScenarioID.Equals(scenarioId))); + } + + /// + /// Gets a surface line. + /// + /// The dike ring identifier. + /// The surface line identifier. + /// + private SurfaceLine2 GetSurfaceLine(string dikeRingId, string surfaceLineId) + { + var dike = GetDike(dikeRingId); + return dike.SurfaceLines2.First(x => x.Name.Equals(surfaceLineId)); + } + + /// + /// Gets the surface line identifier list. + /// + /// The dike ring identifier. + /// + public IEnumerable GetSurfaceLineIdList(string dikeRingId) + { + var dike = GetDike(dikeRingId); + return dike.SurfaceLines2.Select(surfaceLine => surfaceLine.Name); + } + + /// + /// Gets the parameters from dictionary. + /// + /// The dictionary. + /// The source. + /// + private IEnumerable GetParametersFromDictionary( + Dictionary dictionary, object source) + { + var pairs = dictionary.Select(nameValuePair => new NameValueParameter + { + ParameterName = nameValuePair.Key, + ParameterValue = nameValuePair.Value, + Source = DataSourceManager.GetSource(source, nameValuePair.Key) + }); + + return new List(pairs); + } + + /// + /// Gets the dike ring identifier list. + /// + /// + public IEnumerable GetDikeRingIdList() + { + ImportDikeRingAndLocationData(); + return waterBoard.Dikes.Select(dike => dike.Name); + } + + /// + /// Imports the data for dike rings. + /// + /// The dike ring ids. + /// The progress. + public void ImportDataForDikeRings(IEnumerable dikeRingIds, + DamEngine.Data.Standard.Calculation.ProgressDelegate progress) + { + isAllDataImported = false; + isDikeRingAndLocationDataImported = false; + ImportAllData(dikeRingIds, progress); + } + + /// + /// Gets the scenario list. + /// + /// The dike ring identifier. + /// The location identifier. + /// + public IEnumerable GetScenarioList(string dikeRingId, string locationId) + { + var location = GetLocation(dikeRingId, locationId); + return location.Scenarios.Select(scenario => scenario.LocationScenarioID); + } + + /// + /// Gets the dike ring information. + /// + /// The dike ring identifier. + /// + public Info GetDikeRingInfo(string dikeRingId) + { + var dike = GetDike(dikeRingId); + return new Info + { + Name = dike.Name, + Description = dike.Description, + Source = DataSourceManager.GetSource(dike, "Name") + }; + } + + /// + /// Gets the dike parameters. + /// + /// The dike ring identifier. + /// + public IEnumerable GetDikeParameters(string dikeRingId) + { + var dike = GetDike(dikeRingId); + var nameValuePairs = dike.GetParametersAsNameValuePairs(); + + return GetParametersFromDictionary(nameValuePairs, dike); + } + + /// + /// Gets the location identifier list. + /// + /// The dike ring identifier. + /// + public IEnumerable GetLocationIdList(string dikeRingId) + { + ImportDikeRingAndLocationData(); + var dike = GetDike(dikeRingId); + return dike.Locations.Select(location => location.Name); + } + + /// + /// Gets the location information. + /// + /// The dike ring identifier. + /// The location identifier. + /// + public Info GetLocationInfo(string dikeRingId, string locationId) + { + var location = GetLocation(dikeRingId, locationId); + return new Info + { + Name = location.Name, + Description = "", + Source = DataSourceManager.GetSource(location, "Name") + }; + } + + /// + /// Gets the location details. + /// + /// The dike ring identifier. + /// The location identifier. + /// + public IEnumerable GetLocationDetails(string dikeRingId, string locationId) + { + var location = GetLocation(dikeRingId, locationId); + + var nameValuePairs = location.GetParametersAsNameValuePairs(); + return GetParametersFromDictionary(nameValuePairs, location); + } + + /// + /// Gets the scenario details. + /// + /// The dike ring identifier. + /// The location identifier. + /// The scenario identifier. + /// + public IEnumerable GetScenarioDetails(string dikeRingId, string locationId, string scenarioId) + { + var location = GetLocation(dikeRingId, locationId); + var scenario = GetScenario(dikeRingId, locationId, scenarioId); + + if (scenario == null) yield break; + + var nameValuePairs = scenario.GetParametersAsNameValuePairs(); + foreach (var nameValuePair in nameValuePairs) + { + yield return new NameValueParameter + { + ParameterName = nameValuePair.Key, + ParameterValue = nameValuePair.Value, + Source = DataSourceManager.GetSource(location, nameValuePair.Key) + }; + } + } + + public void DisposeImportedItem(string dikeRingId) + { + GetDike(dikeRingId).Dispose(); + } + + /// + /// Gets the surface line points. + /// + /// The dike ring identifier. + /// The surface line identifier. + /// + public IList GetSurfaceLinePoints(string dikeRingId, string surfaceLineId) + { + var surfaceLine = GetSurfaceLine(dikeRingId, surfaceLineId); + + var surfaceLinePoints = new List(); + for (int pointIndex = 0; pointIndex < surfaceLine.Geometry.Points.Count(); pointIndex++) + { + surfaceLinePoints.Add(surfaceLine.Geometry.Points[pointIndex]); + } + return surfaceLinePoints; + } + + /// + /// Gets the surface line characteristic points. + /// + /// The dike ring identifier. + /// The surface line identifier. + /// + public IEnumerable GetSurfaceLineCharacteristicPoints(string dikeRingId, + string surfaceLineId) + { + var surfaceLine = GetSurfaceLine(dikeRingId, surfaceLineId); + + foreach (CharacteristicPointType type in Enum.GetValues(typeof(CharacteristicPointType))) + { + // get & check point + var point = surfaceLine.CharacteristicPoints.GetGeometryPoint(type); + if (point == null) continue; + if ((point.X == -1.0) && (point.Y == -1.0) && (point.Z == -1.0)) continue; + + // create point + yield return new DpCharacteristicPoint { Id = type.ToString(), X = point.X, Y = point.Y, Z = point.Z }; + } + } + + /// + /// Gets the segment identifier list. + /// + /// The dike ring identifier. + /// + public IEnumerable GetSegmentIdList(string dikeRingId) + { + ThrowIfDataNotRead(); + return waterBoard.Segments.Select(segment => segment.Name); + } + + /// + /// Gets the profile1 d identifier list for segment. + /// + /// The dike ring identifier. + /// The segment identifier. + /// Type of the segment failure mechanism. + /// + public IEnumerable GetProfile1DIdListForSegment(string dikeRingId, string segmentId, FailureMechanismSystemType segmentFailureMechanismType) + { + ThrowIfDataNotRead(); + var segment = GetSegment(segmentId); + foreach (SoilGeometryProbability soilGeometryProbability in segment.SoilProfileProbabilities) + { + if (soilGeometryProbability.SoilProfile != null) + { + if ((soilGeometryProbability.SegmentFailureMechanismType == null) || (soilGeometryProbability.SegmentFailureMechanismType.Value == segmentFailureMechanismType)) + yield return soilGeometryProbability.SoilGeometryName; + } + } + } + + /// + /// Gets the profile2 d identifier list for segment. + /// + /// The dike ring identifier. + /// The segment identifier. + /// Type of the segment failure mechanism. + /// + public IEnumerable GetProfile2DIdListForSegment(string dikeRingId, string segmentId, FailureMechanismSystemType segmentFailureMechanismType) + { + ThrowIfDataNotRead(); + var segment = GetSegment(segmentId); + foreach (SoilGeometryProbability soilGeometryProbability in segment.SoilProfileProbabilities) + { + if (soilGeometryProbability.SoilProfile == null) + { + if ((soilGeometryProbability.SegmentFailureMechanismType == null) || (soilGeometryProbability.SegmentFailureMechanismType.Value == segmentFailureMechanismType)) + yield return soilGeometryProbability.SoilGeometryName; + } + } + } + + /// + /// Gets the segment profile1 d details. + /// + /// The dike ring identifier. + /// The segment identifier. + /// The profile1 d identifier. + /// + public IEnumerable GetSegmentProfile1DDetails(string dikeRingId, string segmentId, + string profile1DId, FailureMechanismSystemType segmentFailureMechanismType) + { + var segment = GetSegment(segmentId); + var nameValuePairs = segment.GetParametersForSoilProfile1DAsNameValuePairs(profile1DId, segmentFailureMechanismType); + + return GetParametersFromDictionary(nameValuePairs, segment); + } + + /// + /// Gets the segment profile2 d details. + /// + /// The dike ring identifier. + /// The segment identifier. + /// The profile2 d identifier. + /// + public IEnumerable GetSegmentProfile2DDetails(string dikeRingId, string segmentId, + string profile2DId, FailureMechanismSystemType failureMechanismSystemType) + { + var segment = GetSegment(segmentId); + var nameValuePairs = segment.GetParametersForSoilProfile2DAsNameValuePairs(profile2DId, failureMechanismSystemType); + + return GetParametersFromDictionary(nameValuePairs, segment); + } + + /// + /// Gets the soil profile1 d identifier list. + /// + /// The dike ring identifier. + /// + public IEnumerable GetSoilProfile1DIdList(string dikeRingId) + { + var dike = GetDike(dikeRingId); + return dike.SoilProfiles.Select(soilProfile => soilProfile.Name); + } + + /// + /// Gets the soil profile1 d details. + /// + /// The dike ring identifier. + /// The soil profile1 d identifier. + /// + public DpSoilProfile GetSoilProfile1DDetails(string dikeRingId, string soilProfile1DId) + { + var soilProfile = GetSoilProfile(dikeRingId, soilProfile1DId); + var dpSoilProfile = new DpSoilProfile { Layers = new List() }; + for (int layerIndex = 0; layerIndex < soilProfile.Layers.Count; layerIndex++) + { + var dpLayer = new DpLayer + { + TopLevel = soilProfile.Layers[layerIndex].TopLevel, + SoilName = soilProfile.Layers[layerIndex].Soil.Name + }; + dpSoilProfile.Layers.Add(dpLayer); + } + var bottomLevelLayer = new DpLayer + { + TopLevel = soilProfile.BottomLevel, + SoilName = SoilProfile1D.SoilProfileBottomLevelId + }; + dpSoilProfile.Layers.Add(bottomLevelLayer); + return dpSoilProfile; + } + + /// + /// Gets the soil profile2 d identifier list. + /// + /// The dike ring identifier. + /// + /// + public IEnumerable GetSoilProfile2DIdList(string dikeRingId) + { + ThrowIfDataNotRead(); + throw new NotImplementedException(); + } + + /// + /// Gets the soil profile2 d details. + /// + /// The dike ring identifier. + /// The soil profile2 d identifier. + /// + /// + public string GetSoilProfile2DDetails(string dikeRingId, string soilProfile2DId) + { + ThrowIfDataNotRead(); + throw new NotImplementedException(); + } + + /// + /// Gets the soil identifier list. + /// + /// The dike ring identifier. + /// + public IEnumerable GetSoilIdList(string dikeRingId) + { + var dike = GetDike(dikeRingId); + IEnumerable soilNames = dike.SoilList.Soils.Select(soil => soil.Name).ToList(); + return soilNames; + } + + /// + /// Gets the soil aquifer values. + /// + /// The dike ring identifier. + /// + public IEnumerable GetSoilAquiferValues(string dikeRingId) + { + var dike = GetDike(dikeRingId); + var res = new List(); + foreach (var soil in dike.SoilList.Soils) + { + if (dike.SoilList.AquiferDictionary.ContainsKey(soil)) + { + var nvp = new NameValueParameter(); + nvp.ParameterName = soil.Name; + nvp.ParameterValue = dike.SoilList.AquiferDictionary[soil].ToString(); + nvp.Source = DataSourceSystemType.MSoilBase; + res.Add(nvp); + } + } + return res; + } + + /// + /// Gets the soil details. + /// + /// The dike ring identifier. + /// The soil identifier. + /// + public IEnumerable GetSoilDetails(string dikeRingId, string soilId) + { + var soil = GetSoil(dikeRingId, soilId); + var nameValuePairs = SoilUtils.GetParametersAsNameValuePairs(soil); + + return GetParametersFromDictionary(nameValuePairs, soil); + } + + /// + /// Gets the map geometry. + /// + /// The map geometry identifier. + /// + public string GetMapGeometry(string mapGeometryId) + { + ThrowIfDataNotRead(); + var geom = GetGeometryById(mapGeometryId); + return geom.AsText(); + } + + /// + /// Gets the map geometry attributes. + /// + /// The map geometry identifier. + /// + public IEnumerable GetMapGeometryAttributes(string mapGeometryId) + { + ThrowIfDataNotRead(); + var geom = GetGeometryById(mapGeometryId); + + var geomAttributes = repository.GetAttributes(geom); + + return geomAttributes + .Select(kvp => + new NameValueParameter + { + ParameterName = kvp.Key, + ParameterValue = kvp.Value.ToString() + }).ToList(); + } + + /// + /// Import all csv files + /// + /// The import folder. + /// The import mode. + /// The progress. + /// The CSV importer. + /// + private bool ImportCsvFiles(string importFolder, + ImportMode importMode, DamEngine.Data.Standard.Calculation.ProgressDelegate progress, ref CsvImporter csvImporter) + { + DataSourceManager.CurrentSource = DataSourceSystemType.Csv; + bool isImportOnlyLocations = (importMode == ImportMode.DikeRingAndLocationData); + csvImporter.ImportCsvDataFromDirectory(importFolder, isImportOnlyLocations, progress, damProjectType); + + // add messages + var messages = csvImporter.ErrorMessages; + ImportLogMessages.AddRange(messages); + + DataSourceManager.CurrentSource = DataSourceSystemType.User; + + // check for fatal messages + bool importOk = messages.All(m => m.MessageType != LogMessageType.FatalError); + + return importOk; + } + + /// + /// Import name of the specified soilbase to all dikerings with id as specified in dikeRingIds. + /// Note that it does NOT import the soils in the database themselves. + /// If dikeringId not found then a new dike is created for that dikeRingId. + /// + /// path where the data can be found + /// + private void ImportMSoilBaseName(string importFolder, IEnumerable dikeRingIds) + { + if (dikeRingIds == null) return; + + DataSourceManager.CurrentSource = DataSourceSystemType.MSoilBase; + + foreach (string dikeRingId in dikeRingIds) + { + var dike = GetOrCreateDike(dikeRingId); + + dike.SoilDatabaseName = importFolder; + } + + DataSourceManager.CurrentSource = DataSourceSystemType.User; + } + + /// + /// Import the specified MGeobase to all dikerings with id as specified in dikeRingIds + /// Note that this does import the 1D soil profiles together with the soils and their parameters. + /// If dikeringId not found then a new dike is created for that dikeRingId + /// + /// path where the data can be found + /// + private void ImportMGeobase(string importFolder, IEnumerable dikeRingIds) + { + if (dikeRingIds == null) return; + + DataSourceManager.CurrentSource = DataSourceSystemType.MGeobase; + + foreach (string dikeRingId in dikeRingIds) + { + // first check to see if this dike is already known, if not create it + var dike = GetOrCreateDike(dikeRingId); + + dike.SoilDatabaseName = importFolder; + dike.AddSoilProfilesFromDB(); + } + + DataSourceManager.CurrentSource = DataSourceSystemType.User; + } + + /// + /// Import data from Iris shapefiles + /// + /// path where the data can be found + private void ImportIrisFiles(string importFolder) + { + DataSourceManager.CurrentSource = DataSourceSystemType.Iris; + + // get locations (locationid and beginpoint and endpoint in RD) from "locations.shp" (LocationsNew) + // get line of buitenkruinlijn + // voeg aan elke locatie snijpunt met buitenkruinlijn toe (geen snijpunt is exception) + // nu heeft locatie een begin-, eind- en buitenrkuinpunt + // get line of binnenkruinlijn + // voeg aan elke locatie snijpunt met binnenkruinlijn toe (geen snijpunt is exception) + // nu heeft locatie een begin-, eind-, binnen- en buitenrkuinpunt + + // er is al een lijst met locaties in Waterboard WaterBoard.Dike[0].Locations (LocationsOrg) + // LocationOrg.GeometryPoint[DikeTopAtRiver] = LocationNew.buitenkuinpunt + // LocationOrg.GeometryPoint[DikeTopAtPolder] = LocationNew.binnnenkuinpunt + // Als LocationNew.id niet gevonden kan worden in LocationsOrg dan exception + + // Get all locations from waterboard + var locations = GetAllLocations(); + + var importer = new LocationCharacteristicPointImporter(importFolder, locations); + importer.Import(); + + DataSourceManager.CurrentSource = DataSourceSystemType.User; + } + + /// + /// Get background shapefile for this waterboard + /// + /// path where the data can be found + private void ImportBackgroundShapeFiles(string importFolder) + { + DataSourceManager.CurrentSource = DataSourceSystemType.Gis; + + var reader = new ShapeFileReader(importFolder) + { + IgnoreAttributeData = true + }; + var importer = new FeatureImporter(repository, reader); + importer.Import(); + + DataSourceManager.CurrentSource = DataSourceSystemType.User; + } + + /// + /// Get all locations for all dikes + /// + /// + private IEnumerable GetAllLocations() + { + return waterBoard.Dikes.SelectMany(dike => dike.Locations); + } + + /// + /// Pre conditions: + /// - A list of waterboard locations with initialized x,y values + /// - shape file ccontaining the attributes and data + /// + /// Post condition: + /// - Location properties (in relation to the attributes) are set + /// + /// + /// + /// + /// + /// + private void ImportDataShapeFiles(string importFolder, IEnumerable dataAttributes, + ImportMode importMode, IEnumerable dikeRingIds, + DamEngine.Data.Standard.Calculation.ProgressDelegate progress, + ref List locationRecords) + { + DataSourceManager.CurrentSource = DataSourceSystemType.Gis; + + if (importFolder == null) + throw new ArgumentNullException("importFolder"); + + string importErrorLogFile = @"shapefiletrace.log"; + if (!string.IsNullOrEmpty(DamProjectFolder)) + { + importErrorLogFile = Path.Combine(DamProjectFolder, importErrorLogFile); + } + var dataAttributesList = dataAttributes as List ?? dataAttributes.ToList(); + var exceptions = new List(); + + var locationImporter = LocationShapeFileImporter.Create( + locationRecords, dataAttributesList, importFolder); + if (locationImporter != null) + { + locationImporter.Import(); + locationRecords = locationImporter.ImportedItems.ToList(); + } + + // Skip reading properties when only dikering and locationdata is required + if (importMode == ImportMode.All) + { + // + // Location Property Importer + // This is where all the attribute values are read form the shapefiles + // + var importer = new LocationPropertyImporter(importFolder, dataAttributesList) + { + Targets = locationRecords + }; + + importer.Import(progress); + exceptions.AddRange(importer.ImportErrors); + foreach (var importerMessage in importer.ImproperAttributeMessages) + { + var lm = new LogMessage(LogMessageType.Error, this, importerMessage); + importLogMessages.Add(lm); + } + } + + using (var sw = new StreamWriter(importErrorLogFile, false)) + { + if (!exceptions.Any()) return; + foreach (var error in exceptions) + { + //defaultWriter.Write(error.Message); + sw.WriteLine("Date: {0}, Error type: {1}, Message: {2}", + DateTime.Now.ToShortDateString(), error.GetType().Name, error.Message); + var lm = new LogMessage(LogMessageType.Error, this, error.Message); + importLogMessages.Add(lm); + } + } + } + + /// + /// Gets the geometry by identifier. + /// + /// The map geometry identifier. + /// + /// mapGeometryId + /// Can't find a geometry with this id + private IGeometry GetGeometryById(string mapGeometryId) + { + if (mapGeometryId == null) + throw new ArgumentNullException("mapGeometryId"); + + var id = new Guid(mapGeometryId); + + var geom = repository.GetGeometryById(id); + if (geom == null) + throw new ArgumentException("Can't find a geometry with this id"); + + return geom; + } + + /// + /// Import only Dikering and location id's + /// + private void ImportDikeRingAndLocationData() + { + if (isDikeRingAndLocationDataImported || isAllDataImported) return; + + CsvImporter csvImporter = new CsvImporter(); + foreach (var dataSource in DataSources) + { + ImportDikeRingAndLocationData(dataSource, ref csvImporter); + } + var combineImportedData = new CombineImportedData + { + WaterBoard = waterBoard, + LocationRecords = csvImporter.LocationRecords, + }; + combineImportedData.AddCsvDataToDikes(); + isDikeRingAndLocationDataImported = true; + } + + /// + /// Gets the data location. + /// + /// The data source. + /// + private string GetDataLocation(DataSource dataSource) + { + var dataLocation = dataSource.DataLocation; + if (!string.IsNullOrEmpty(DataFolder) + && (!Directory.Exists(dataLocation) || !File.Exists(dataLocation))) + { + dataLocation = Path.Combine(DataFolder, dataLocation); + } + + return dataLocation; + } + + /// + /// Imports the dike ring and location data. + /// + /// The data source. + /// + /// + private void ImportDikeRingAndLocationData(DataSource dataSource, ref CsvImporter csvImporter) + { + var dataLocation = GetDataLocation(dataSource); + + switch (dataSource.DataSourceType) + { + case DataSourceType.CsvFiles: + // New importer + ImportCsvFiles(dataLocation, ImportMode.DikeRingAndLocationData, null, ref csvImporter); + break; + case DataSourceType.DataShapeFiles: + List locationRecords = csvImporter.LocationRecords; + ImportShapeFile(dataLocation, ref locationRecords); + csvImporter.LocationRecords = locationRecords; + break; + case DataSourceType.Iris: + case DataSourceType.BackgroundShapeFiles: + case DataSourceType.MSoilBase: + case DataSourceType.MGeobase: + break; + default: + throw new ArgumentOutOfRangeException(); + } + } + + /// + /// Imports the data. + /// + /// The data source. + /// The dike ring identifier list. + /// The import mode. + /// The progress. + /// The CSV importer. + /// + private void ImportData2(DataSource dataSource, + IEnumerable dikeRingIdList, ImportMode importMode, + DamEngine.Data.Standard.Calculation.ProgressDelegate progress, ref CsvImporter csvImporter) + { + var dataLocation = GetDataLocation(dataSource); + switch (dataSource.DataSourceType) + { + case DataSourceType.CsvFiles: + // New importer + ImportCsvFiles(dataLocation, importMode, progress, ref csvImporter); + break; + case DataSourceType.Iris: + ImportIrisFiles(dataLocation); + break; + case DataSourceType.DataShapeFiles: + List locationRecords = csvImporter.LocationRecords; + ImportDataShapeFiles(dataLocation, attributes, importMode, dikeRingIdList, progress, ref locationRecords); + csvImporter.LocationRecords = locationRecords; + break; + case DataSourceType.BackgroundShapeFiles: + if (importMode == ImportMode.All) + { + ImportBackgroundShapeFiles(dataLocation); + } + break; + case DataSourceType.MSoilBase: + ImportMSoilBaseName(dataLocation, dikeRingIdList); + break; + case DataSourceType.MGeobase: + ImportMGeobase(dataLocation, dikeRingIdList); + break; + default: + throw new ArgumentOutOfRangeException(); + } + } + + /// + /// Imports the shape file. + /// + /// The data location. + /// The location records. + private void ImportShapeFile(string dataLocation, ref List locationRecords) + { + // get locations + var configuredAttribute = + attributes.SingleOrDefault(a => a.AttributeId.Equals( + LocationShapeFileAttributeMap.LocationAttributeId, + StringComparison.InvariantCultureIgnoreCase)); + if (configuredAttribute == null) + { + return; + } + var locationImporter = LocationShapeFileImporter.Create( + locationRecords, attributes, dataLocation); + if (locationImporter != null) + { + locationImporter.Import(); + locationRecords = locationImporter.ImportedItems.ToList(); + } + } + + /// + /// Imports all data. + /// + /// The dike ring ids. + /// The progress. + private void ImportAllData(IEnumerable dikeRingIds, DamEngine.Data.Standard.Calculation.ProgressDelegate progress) + { + // do nothing if all data is already imported + if (isAllDataImported) return; + + ImportData(ImportMode.All, dikeRingIds, progress); + + isAllDataImported = true; + } + + /// + /// Import all data + /// + private void ImportData(ImportMode importMode, IEnumerable dikeRingIds, DamEngine.Data.Standard.Calculation.ProgressDelegate progress) + { + ThrowIfNoDataDefinitions(); + if (!isDikeRingAndLocationDataImported) + { + // If locations and dikeringIds were not read yet then we start with a new waterboard + // Else continue with waterboard that was created when importing the locations + InitializeWaterBoard(); + } + + waterBoard.Description = "Waterschap"; + CsvImporter csvImporter = new CsvImporter(); + + var dikeRingIdList = dikeRingIds == null ? null : dikeRingIds as List ?? dikeRingIds.ToList(); + + foreach (var dataSource in DataSources) + { + // Skip Iris because it needs the locations + // Data from shapefiles is added to locationrecords from csvImporter + if (dataSource.DataSourceType != DataSourceType.Iris) + { + ImportData2(dataSource, dikeRingIdList, importMode, progress, ref csvImporter); + } + } + // create and fill the locations, scenarios etc. with the data from csv and shapefiles + AddCsvDataToDikes(csvImporter); + // Now that the locations are defined, read Iris data + foreach (var dataSource in DataSources) + { + if (dataSource.DataSourceType == DataSourceType.Iris) + { + ImportData2(dataSource, dikeRingIdList, importMode, progress, ref csvImporter); + } + } + AddScenarioDataToDikes(csvImporter); + if (importMode == ImportMode.All) + { + CorrectSegmentAssignments(); + } + } + + /// + /// Adds the scenario data to dikes. + /// + /// The CSV importer. + private void AddScenarioDataToDikes(CsvImporter csvImporter) + { + if (csvImporter != null) + { + DataSourceManager.CurrentSource = DataSourceSystemType.Csv; + var combineImportedData = new CombineImportedData + { + WaterBoard = waterBoard, + LocationRecords = csvImporter.LocationRecords, + ScenarioRecords = csvImporter.ScenariosRecords, + }; + combineImportedData.AddScenarioDataToDikes(); + importLogMessages.AddRange(combineImportedData.ErrorMessages); + Debug.Assert(ReferenceEquals(waterBoard, combineImportedData.WaterBoard)); + waterBoard = combineImportedData.WaterBoard; + } + } + + /// + /// Adds the CSV data to dikes. + /// + /// The CSV importer. + private void AddCsvDataToDikes(CsvImporter csvImporter) + { + if (csvImporter != null) + { + DataSourceManager.CurrentSource = DataSourceSystemType.Csv; + var combineImportedData = new CombineImportedData + { + WaterBoard = waterBoard, + LocationRecords = csvImporter.LocationRecords, + CharacteristicPointsRecords = csvImporter.CharacteristicPointsRecords, + ScenarioRecords = csvImporter.ScenariosRecords, + SegmentRecords = csvImporter.SegmentRecords, + SoilProfilerecords = csvImporter.SoilProfilesRecords, + SurfaceLineRecords = csvImporter.SurfaceLinesRecords + }; + combineImportedData.AddCsvDataToDikes(); + importLogMessages.AddRange(combineImportedData.ErrorMessages); + Debug.Assert(ReferenceEquals(waterBoard, combineImportedData.WaterBoard)); + waterBoard = combineImportedData.WaterBoard; + csvDataAdded = true; + } + } + + /// + /// When segment shapefile has assigned new segmentIds the segment object has to be re-assigned + /// + private void CorrectSegmentAssignments() + { + foreach (var dike in waterBoard.Dikes) + { + foreach (var location in dike.Locations) + { + location.Segment = waterBoard.Segments.FirstOrDefault(s => s.Name.Equals(location.SegmentId)); + } + } + } + + /// + /// Check if data definitions already specified + /// + private void ThrowIfNoDataDefinitions() + { + if (DataSources == null || !DataSources.Any()) + { + throw new DataPluginImporterException("No data sources defined"); + } + } + + /// + /// Check if data has been read + /// + private void ThrowIfDataNotRead() + { + if (!isAllDataImported) + { + throw new DataPluginImporterException("Data has not been imported yet"); + } + } + + /// + /// Returns a that represents this instance. + /// + /// + /// A that represents this instance. + /// + public override string ToString() + { + return "DataPluginImporter"; + } + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Sensors/Sensor.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Sensors/Sensor.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Sensors/Sensor.cs (revision 3305) @@ -0,0 +1,388 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Xml.Serialization; +using Deltares.Standard; +using Deltares.Standard.Attributes; +using Deltares.Standard.EventPublisher; +using Deltares.Standard.IO.Xml; +using Deltares.Standard.Specifications; +using GeoAPI.Geometries; +using NetTopologySuite.Geometries; +using Validator = Deltares.Standard.Specifications.Validator; +using XmlSerializer = Deltares.Standard.IO.Xml.XmlSerializer; + +namespace Deltares.Dam.Data.Sensors +{ + /// + /// This class represents a sensor or monitoring point used in dikes. + /// This entity is created for Dam Live + /// + [Serializable] + public class Sensor : IName, IVisibleEnabled + { + #region Business Rules + + /// + /// Specication to test if the value of the candidate is valid + /// + internal class ContiansAtLeastOneItem : PredicateSpecification> + { + public ContiansAtLeastOneItem() + : base(x => x.Any()) + { + Description = "The sensor should contain at least one PL Line mapping."; + } + } + + #endregion + + private readonly IGeometry geometry; + private double relativeLocation; + private readonly HashSet plLineTypes; + private int id; + + public Sensor() + { + plLineTypes = new HashSet(); + ID = -1; + geometry = new Point(0,0,0); + } + + public Sensor(Point point) : this() + { + if (point == null) throw new ArgumentNullException("point"); + this.geometry = point; + + } + + public Sensor(double x, double y, double z) : this(new Point(x, y, z)) + { + } + + /// + /// Gets or sets the ID. + /// + /// + /// The ID should be unique. + /// + [PropertyOrder(1,1)] + public int ID + { + get { return id; } + set + { + id = value; + DataEventPublisher.AfterChange(this, s => s.ID); + } + } + + /// + /// Gets or sets the name of this sensor. + /// + /// + /// The name string value should not be empty and unique. + /// + [Specification(typeof(NotEmptySpecification))] + [PropertyOrder(1, 2)] + public string Name { get; set; } + + /// + /// Gets or sets the depth. + /// + /// + /// The depth. + /// + [PropertyOrder(1, 5)] + [Format("F3")] + public double Depth + { + get { return ZRd; } + set + { + DataEventPublisher.BeforeChange(this, s => s.Depth); + ZRd = value; + DataEventPublisher.AfterChange(this, s => s.Depth); + } + } + + /// + /// Gets or sets the relative location along the profile. + /// + /// + /// The relative location in meter. + /// + [PropertyOrder(1, 4)] + [Format("F3")] + public double RelativeLocation + { + get { return relativeLocation; } + set + { + DataEventPublisher.BeforeChange(this, s => s.RelativeLocation); + relativeLocation = value; + RelativeLocationSpecified = true; + DataEventPublisher.AfterChange(this, s => s.RelativeLocation); + } + } + + /// + /// Gets or sets the X rd. + /// + /// + /// The X rd. + /// + [Browsable(false)] + public double XRd + { + get { return geometry.Coordinate.X; } + set { geometry.Coordinate.X = value; } + } + + /// + /// Gets or sets the Y rd. + /// + /// + /// The Y rd. + /// + [Browsable(false)] + public double YRd + { + get { return geometry.Coordinate.Y; } + set { geometry.Coordinate.Y = value; } + } + + /// + /// Gets or sets the Z rd. Same as Depth?? + /// + /// + /// The Z rd. + /// + [Browsable(false)] + public double ZRd + { + get { return geometry.Coordinate.Z; } + set { geometry.Coordinate.Z = value; } + } + + /// + /// Gets a value indicating whether the relative location is specified. + /// + /// + /// true if the relative location is specified; otherwise, false. + /// + [Browsable(false)] + public bool RelativeLocationSpecified { get; private set; } + + private SensorType type; + + /// + /// Gets or sets the type of this sensor. + /// + /// + /// The type. Default value is PiezoMetricHead. + /// + [PropertyOrder(1, 7)] + public SensorType Type + { + get { return type; } + set { type = value; } + } + + /// + /// Gets or sets the PL line array. Used for serialization only. + /// + /// + /// The PL line array. + /// + [XmlElement("PLLineMappings")] + [Specification(typeof(NotNullSpecification))] + [Specification(typeof(ContiansAtLeastOneItem))] + [Browsable(false)] + public PLLineType[] PLLineMappings + { + get { return plLineTypes.ToArray(); } + set + { + ClearPLLines(); + foreach (var lineType in value) + { + Add(lineType); + } + } + } + + [XmlIgnore] + [PropertyOrder(1, 6)] + public string PLLineMappingsAsString + { + get + { + string res = ""; + foreach (var plLineType in plLineTypes) + { + switch (plLineType) + { + case PLLineType.PL1: res = res + "1; "; break; + case PLLineType.PL2: res = res + "2; "; break; + case PLLineType.PL3: res = res + "3; "; break; + case PLLineType.PL4: res = res + "4; "; break; + } + } + return res; + } + set + { + ClearPLLines(); + var locPlLineTypes = ParseStringToPlLineTypes(value); + foreach (var plLineType in locPlLineTypes) + { + switch (plLineType) + { + case 1: plLineTypes.Add(PLLineType.PL1); break; + case 2: plLineTypes.Add(PLLineType.PL2); break; + case 3: plLineTypes.Add(PLLineType.PL3); break; + case 4: plLineTypes.Add(PLLineType.PL4); break; + } + } + } + } + + private List ParseStringToPlLineTypes(string value) + { + value = value.Trim(); + var ids = new List(); + var idsarr = value.Split(new Char[] { ';' }, StringSplitOptions.RemoveEmptyEntries); + foreach (var s in idsarr) + { + try + { + var val = Int32.Parse(s); + ids.Add(val); + } + catch (Exception) + { + // surpress errors, just do not use value + } + } + return ids; + } + + /// + /// Adds the specified PL line. + /// + /// The PL line. + public void Add(PLLineType plLine) + { + plLineTypes.Add(plLine); + } + + /// + /// Removes the specified PL line. + /// + /// The PL line. + public void Remove(PLLineType plLine) + { + plLineTypes.Remove(plLine); + } + + /// + /// Clears the PL lines list. + /// + public void ClearPLLines() + { + plLineTypes.Clear(); + } + + + /// + /// Serializes this instance to a xml string. + /// + /// A xml string + internal string Serialize() + { + var xmlSerializer = new XmlSerializer(); + return xmlSerializer.SerializeToString(this); + } + + + /// + /// Deserializes the specified XML. + /// + /// The XML to deserialize. + /// A sensor instance + internal static Sensor Deserialize(string xml) + { + var xmlDeserializer = new XmlDeserializer(); + return (Sensor)xmlDeserializer.XmlDeserializeFromString(xml, typeof(Sensor)); + } + + /// + /// Determines whether this instance is valid. + /// + /// + /// true if this instance is valid; otherwise, false. + /// + public bool IsValid() + { + return !Validator.Validate(this).Any(); + } + + /// + /// Determines whether this instance is transient (associated with a correct ID in the context of the repository). + /// + /// + /// true if this instance is transient; otherwise, false. + /// + public bool IsTransient() + { + return ID < 0; + } + + public override string ToString() + { + var name = string.IsNullOrWhiteSpace(Name) ? "name_not_set" : Name; + + return string.Format("[ID: {0}, Name: {1}, Depth: {2}, Type: {3}, RelativeLocation: {4}]", + ID, name, Depth, Type, RelativeLocation); + } + + public bool IsVisible(string property) + { + switch (property) + { + case "XRd": return false; + case "YRd": return false; + case "ZRd": return false; + default: return true; + } + } + + public bool IsEnabled(string property) + { + return true; + } + } +} Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Geometry2DBoundaryLine.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Geometry2DBoundaryLine.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Geometry2DBoundaryLine.cs (revision 3305) @@ -0,0 +1,50 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using Deltares.Geometry; +using Deltares.Standard; + +namespace Deltares.Dam.Data +{ + + public class Geometry2DPoint : GeometryPoint + { + public Geometry2DPoint() : this (0, 0) { } + + public Geometry2DPoint(double aX, double aZ) : base(aX, 0, aZ) + { + } + } + + public class Geometry2DBoundaryLine : PolyLine, ICloneable + { + public Geometry2DBoundaryLine Clone() + { + Geometry2DBoundaryLine boundaryLine = new Geometry2DBoundaryLine(); + foreach (Geometry2DPoint point in this.Points) + { + Geometry2DPoint newPoint = new Geometry2DPoint() { X = point.X, Y = point.Y, Z = point.Z }; + boundaryLine.Points.Add(newPoint); + } + return boundaryLine; + } + } +} Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/SoilGeometry.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/SoilGeometry.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/SoilGeometry.cs (revision 3305) @@ -0,0 +1,96 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU 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.Geotechnics.Soils; +using Deltares.Standard.Attributes; + +namespace Deltares.Dam.Data +{ + + /// + /// Exception class for SoilGeometry + /// + public class SoilGeometryException : ApplicationException + { + public SoilGeometryException(string message) : base(message) + { + } + } + + public class SoilGeometryBase + { + [XmlOldName("SoilGeometryType")] + public virtual SoilProfileType SoilProfileType { 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 + + [XmlOldName("SoilGeometryType")] + public override SoilProfileType SoilProfileType + { + get + { + SoilProfileType soilProfileType = SoilProfileType.SoilGeometryStiFile; + if (soilProfile != null) + { + soilProfileType = SoilProfileType.SoilProfile1D; + } + if ((SoilProfile == null) && ((SoilGeometry2DName == null) || SoilGeometry2DName == "")) + { + throw new SoilGeometryException("No geometry assigned"); + } + return soilProfileType; + } + } + + public SoilProfile1D SoilProfile + { + get { return soilProfile; } + set { soilProfile = value; } + } + + public string SoilGeometry2DName + { + get { return soilGeometry2DName; } + set { soilGeometry2DName = value; } + } + #endregion PublicPropteries + } +} Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/BackgroundRepositoryFeature.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/BackgroundRepositoryFeature.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/BackgroundRepositoryFeature.cs (revision 3305) @@ -0,0 +1,35 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using Deltares.Geographic; + +namespace Deltares.Dam.Data +{ + public class BackgroundRepositoryFeature : IWKT + { + public virtual string Feature { get; set; } + + public string WKT + { + get { return this.Feature; } + } + } +} Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/GaugePLLine.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/GaugePLLine.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/GaugePLLine.cs (revision 3305) @@ -0,0 +1,74 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using Deltares.Geometry; + +namespace Deltares.Dam.Data +{ + using System; + public class GaugePLLinePoint : GeometryPoint + { + public GaugePLLinePoint() : this(null, null, null, null) { } + + public GaugePLLinePoint(double? localX, double? localZ, string gaugeX, string gaugeZ) + { + this.X = localX; + this.Z = localZ; + this.GaugeIDX = gaugeX; + this.GaugeIDZ = gaugeZ; + } + + public new double? X { get; set; } + public new double? Z { get; set; } + public string GaugeIDX { get; set; } + public string GaugeIDZ { get; set; } + + public override string ToString() + { + return String.Format("({0}, {1}, '{2}', '{3}')", this.X.HasValue ? this.X.ToString() : "?", this.Z.HasValue ? this.Z.ToString() : "?", this.GaugeIDX, this.GaugeIDZ); + } + } + + public class GaugePLLine : PolyLine + { + private GaugePLLine() + : base() + { + } + + public GaugePLLine(PLLineType plLineType) + : this() + { + this.PLLineType = plLineType; + } + + public PLLineType PLLineType { get; set; } + + public override string ToString() + { + string result = String.Format("{0} | ", this.PLLineType.ToString()); + foreach (GaugePLLinePoint point in this.Points) + result += point.ToString() + ", "; + + return result; + } + } +} Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DtoAssembler/MissingRequiredFieldValueException.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DtoAssembler/MissingRequiredFieldValueException.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DtoAssembler/MissingRequiredFieldValueException.cs (revision 3305) @@ -0,0 +1,52 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU 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.Standard +{ + /// + /// + /// + [Serializable] + public class MissingRequiredValueException : Exception + { + public MissingRequiredValueException() + { + } + + public MissingRequiredValueException(string message) : base(message) + { + } + + public MissingRequiredValueException(string message, Exception inner) : base(message, inner) + { + } + + protected MissingRequiredValueException( + SerializationInfo info, + StreamingContext context) + : base(info, context) + { + } + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Sensors/SensorRepository.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Sensors/SensorRepository.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Sensors/SensorRepository.cs (revision 3305) @@ -0,0 +1,151 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU 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 Deltares.Standard.Extensions; + +namespace Deltares.Dam.Data.Sensors +{ + public class SensorRepository + { + private SensorLocation sensorLocation; + private readonly HashSet names; + private readonly HashSet ids; + + private SensorRepository() + { + names = new HashSet(); + ids = new HashSet(); + } + + public SensorRepository(Location location) : this() + { + if (location.SensorLocation == null) + { + location.AddNewSensorData(); + } + + sensorLocation = location.SensorLocation; + + if (sensorLocation.Group == null) + sensorLocation.Group = new Group(); + } + + internal Group Group + { + get { return sensorLocation.Group; } + } + + public IEnumerable Sensors + { + get { return Group.Selection; } + } + + internal int GetUniqueSensorID() + { + return Group.Selection.GetUniqueID(x => x.ID); + } + + /// + /// Adds a new sensor to the location sensor group. + /// + /// The created Sensor + public Sensor AddNew() + { + var factory = new SensorFactory(); + Sensor sensor = factory.CreateUniqueSensor(Group.Selection); + AddSensor(sensor); + return sensor; + } + + /// + /// Adds the collection of sensors to the group. + /// + /// The sensor needs to meet the business rules before it can be added + /// The sensor collection to add to the group of this location. + /// + /// + public void Add(IEnumerable sensors) + { + if (sensors == null) throw new ArgumentNullException("sensors"); + foreach (var sensor in sensors) + Add(sensor); + } + + /// + /// Adds the specified sensor. + /// + /// The sensor needs to meet the business rules before it can be added + /// The sensor to add. + /// + /// + public void Add(Sensor sensor) + { + if (sensor == null) + throw new ArgumentNullException("sensor"); + + if (string.IsNullOrWhiteSpace(sensor.Name)) + throw new ArgumentException("Cant add this sensor because its name is empty"); + + if (sensor.IsTransient()) + throw new ArgumentException("Cant add this sensor because its ID is not valid. The ID must be greater then -1"); + + if (ids.Contains(sensor.ID)) + throw new ArgumentException("Cant add this sensor becuase its ID is already added"); + + if (names.Contains(sensor.Name)) + throw new ArgumentException("Cant add this sensor because its name is already used"); + + AddSensor(sensor); + } + + /// + /// Adds the sensor unconditionally + /// + /// The sensor. + private void AddSensor(Sensor sensor) + { + ids.Add(sensor.ID); + names.Add(sensor.Name); + sensorLocation.Group.Add(sensor); + } + + /// + /// Serializes the state of this repository to a XML string. + /// + /// + internal string Serialize() + { + return sensorLocation.Serialize(); + } + + /// + /// Deserializes the specified XML to restore the state of this repository + /// + /// The XML. + internal static SensorRepository Deserialize(string xml) + { + if (string.IsNullOrWhiteSpace(xml)) throw new ArgumentException("xml"); + return new SensorRepository() { sensorLocation = SensorLocation.Deserialize(xml) }; + } + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/FeatureRepository.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/FeatureRepository.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/FeatureRepository.cs (revision 3305) @@ -0,0 +1,284 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Collections.Generic; +using System.Linq; + +using GeoAPI.Geometries; + +using NetTopologySuite.Features; +using NetTopologySuite.Index.Quadtree; + +namespace Deltares.Maps +{ + /// + /// Spatial Indexed Feature Repository + /// + public class FeatureRepository : IFeatureRepository + { + private readonly IList emptyGeometryFeatures; + private readonly IList features; + private Quadtree spatialIndex; + + public FeatureRepository() + { + features = new List(); + emptyGeometryFeatures = new List(); + spatialIndex = new Quadtree(); + } + + public static IFeatureRepository CreateFromShapeFile(string fileName) + { + if (fileName == null) + { + throw new ArgumentNullException("fileName"); + } + + return CreateFromShapeFile(new ShapeFileLocation(fileName)); + } + + public IEnumerable Query(IFeature feature) + { + return Query(feature.Geometry); + } + + public IEnumerable Query(IGeometry geometry) + { + return geometry.IsEmpty ? emptyGeometryFeatures : Query(geometry.EnvelopeInternal); + } + + /// + /// Gets features based on the envelope. + /// + /// + /// Note that this call won't handle empty geometries. To return empty geometries as well use Query(IFeature) or + /// Query(IGeometry) + /// instead of this call + /// + /// + /// + public IEnumerable Query(Envelope envelope) + { + //return this.featureLookup.Values.Where(f => envelope.Intersects(f.Geometry.EnvelopeInternal)); + return spatialIndex.Query((Envelope)envelope); + } + + public static IFeatureRepository CreateFromShapeFile(ShapeFileLocation shapeFileLocation) + { + if (shapeFileLocation == null) + { + throw new ArgumentNullException("shapeFileLocation"); + } + var repository = new FeatureRepository(); + try + { + FeatureImporter.ImportFromShapeFile(shapeFileLocation, repository); + } + catch (Exception e) + { + throw e; + } + return repository; + } + + public IEnumerable FeatureIds + { + get { return Features.Select(geom => geom.Id); } + } + + public IGeometry GetGeometryById(Guid id) + { + //var feature = this.featureLookup.Values.FirstOrDefault(item => item.Id == id); + IFeature feature = Features.FirstOrDefault(item => item.Id == id); + if (feature != null) + { + return feature.Geometry; + } + + throw new ArgumentException(string.Format("Unknown id '{0}', geometry not found", id)); + } + + public IEnumerable> GetAttributes(IGeometry geom) + { + if (geom == null) + { + throw new ArgumentNullException("geom"); + } + + IFeature feature = + Features.SingleOrDefault( + f => f.Geometry == geom || f.Geometry.AsText().GetHashCode() == geom.AsText().GetHashCode()); + + if (feature != null) + { + IAttributesTable attributes = feature.Attributes; + return attributes.GetNames().Select(attr => new KeyValuePair(attr, attributes[attr])); + ; + } + + throw new ArgumentException("Couldn't find the geometry in the repository"); + } + + public IEnumerable Features + { + get { return features.Concat(emptyGeometryFeatures); } + } + + /// + /// TODO: Is it allowed to have different attributes per geometry? If this is the case the we have to create a fast and + /// robust attribute collector. + /// + public IEnumerable SupportedAttributes + { + get + { + if (Features == null || !Features.Any()) + { + return new List(); + } + + return Features.SelectMany(geometry => geometry.Attributes.GetNames()).Distinct(); + } + } + + public void Add(IFeature feature) + { + if (feature == null) + { + throw new ArgumentNullException("feature"); + } + + if (feature.Geometry.IsEmpty) + { + emptyGeometryFeatures.Add(feature); + } + else + { + features.Add(feature); + AddToSpatialIndex(feature); + } + } + + private void AddToSpatialIndex(IFeature feature) + { + try + { + spatialIndex.Insert(feature.Geometry.EnvelopeInternal, feature); + } + catch (Exception e) + { + throw e; + } + } + + private void RemoveFromSpatialIndex(IFeature feature) + { + spatialIndex.Insert(feature.Geometry.EnvelopeInternal, feature); + } + + public void Add(IEnumerable featureCollection) + { + if (featureCollection == null) + { + throw new ArgumentNullException("featureCollection"); + } + + foreach (IFeature feature in featureCollection) + { + Add(feature); + } + } + + public void Remove(IFeature feature) + { + if (feature == null) + { + throw new ArgumentNullException("feature"); + } + + if (feature.Geometry.IsEmpty) + { + emptyGeometryFeatures.Remove(feature); + } + else + { + features.Remove(feature); + RemoveFromSpatialIndex(feature); + } + } + + public void Remove(Func predicate) + { + if (predicate == null) + { + throw new ArgumentNullException("predicate"); + } + + var work = new Queue(Count); + foreach (IFeature feature in Features.Where(predicate)) + { + work.Enqueue(feature); + } + + while (work.Count > 0) + { + Remove(work.Dequeue()); + } + } + + public void Add(Feature feature, Func predicate) + { + if (feature == null) + { + throw new ArgumentNullException("feature"); + } + + if (predicate == null) + { + throw new ArgumentNullException("predicate"); + } + + if (predicate(feature)) + { + Add(feature); + } + } + + /// + /// Clears the list of features in the repository + /// + public void Clear() + { + features.Clear(); + emptyGeometryFeatures.Clear(); + spatialIndex = new Quadtree(); + } + + /// + /// Gets the feature count in the repository + /// + public int Count + { + get { return features.Count + emptyGeometryFeatures.Count; } + } + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/Test/TestData/Gemeenten.shp =================================================================== diff -u Binary files differ Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/CsvImporters/CsvImporterSurfaceLines.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/CsvImporters/CsvImporterSurfaceLines.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/CsvImporters/CsvImporterSurfaceLines.cs (revision 3305) @@ -0,0 +1,196 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU 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.IO; +using System.Linq; +using System.Threading; +using Deltares.Standard.IO; +using Deltares.Standard.Language; +using LumenWorks.Framework.IO.Csv; + +namespace Deltares.Dam.Data.CsvImporters +{ + public class CsvImporterSurfaceLinesException : Exception + { + public CsvImporterSurfaceLinesException(string message) : base(message) + { + } + } + + public class CsvImporterSurfaceLines + { + private readonly List surfaceLineRecords = new List(); + private List errorMessages = new List(); + + public class SurfaceLineRecord + { + private IList xcoors = new List(); + private IList ycoors = new List(); + private IList zcoors = new List(); + + public string SurfaceLineId { get; set; } + public int SurfaceLineRecordId { get; set; } + + public IList Xcoors + { + get { return xcoors; } + set { xcoors = value; } + } + + public IList Ycoors + { + get { return ycoors; } + set { ycoors = value; } + } + + public IList Zcoors + { + get { return zcoors; } + set { zcoors = value; } + } + } + + private void CheckColumn(int index, string fileName, string fieldName) + { + if (index < 0) + { + var csvHeaderFieldError = LocalizationManager.GetTranslatedText(GetType(), "csvHeaderFieldError"); + throw new CsvImporterSurfaceLinesException(String.Format("{0} : {1} {2}", fileName, csvHeaderFieldError, fieldName)); + } + } + + /// + /// Copies to temporary file. + /// + /// Name of the file. + /// the name of the temporary file + private string CopyToTemporaryFile(string fileName) + { + string newFilename = Path.GetTempFileName(); + File.Delete(newFilename); + File.Copy(fileName, newFilename); + return newFilename; + } + + public CsvImporterSurfaceLines(string filename) + { + errorMessages.Clear(); + ThrowHelper.ThrowIfStringArgumentNullOrEmpty(filename, StringResourceNames.CsvFileNotValid); + ThrowHelper.ThrowIfFileNotExist(filename, StringResourceNames.CsvFileNotFound); + + // This is a 'dynamic' csv file, i.e. the number of columns is not known and can vary per row. So make sure of a + // proper header (i.e. a header with the maximum number of fields + // because the file will be changed we copy it to a temporary file and perform the action on the temporary file + string tempFilename = CopyToTemporaryFile(filename); + CsvReaderUtilities.EnsureProperHeaderForDynamicRecordLengthInCsvFile(tempFilename); + var oldcur = Thread.CurrentThread.CurrentCulture; + try + { + Thread.CurrentThread.CurrentCulture = CsvReaderUtilities.DetermineCultureForFile(tempFilename); + using (CsvReader csv = new CsvReader(new StreamReader(tempFilename), true, ';'){ MissingFieldAction = MissingFieldAction.ReplaceByNull }) + { + string[] headers = CsvImporterHelper.GetFieldHeaders(this, csv); + int colIndexSurfaceLineId = CsvReaderUtilities.GetHeaderIndexByString(headers, SurfaceLineCsvColumnNames.LocationColumnName); + if (colIndexSurfaceLineId < 0) + { + // colIndexSurfaceLineId can be defined with 2 identifiers (ProfileNameColumnName is deprecated, LocationColumnName is the new one) + colIndexSurfaceLineId = CsvReaderUtilities.GetHeaderIndexByString(headers, SurfaceLineCsvColumnNames.LocationColumnName); + if (colIndexSurfaceLineId < 0) + { + colIndexSurfaceLineId = CsvReaderUtilities.GetHeaderIndexByString(headers, SurfaceLineCsvColumnNames.ProfileNameColumnName); + } + } + CheckColumn(colIndexSurfaceLineId, tempFilename, SurfaceLineCsvColumnNames.LocationColumnName); + int colIndexFirstX = CsvReaderUtilities.GetHeaderIndexByString(headers, SurfaceLineCsvColumnNames.FirstXColumnName); + CheckColumn(colIndexFirstX, tempFilename, SurfaceLineCsvColumnNames.FirstXColumnName); + int maxColumns = headers.Count(); + var end = Math.Floor((maxColumns - colIndexFirstX + 1) / 3.0); + var surflineIndex = 1; + while (csv.ReadNextRecord()) + { + var recordReadError = false; + SurfaceLineRecord surfaceLine = new SurfaceLineRecord + { + SurfaceLineRecordId = surflineIndex + }; + surflineIndex++; + surfaceLine.SurfaceLineId = csv[colIndexSurfaceLineId]; + var colIndex = colIndexFirstX; + for (int i = 0; i < end; i++) + { + // if the first value = null the end of this surfaceline is reached, so break and it. Checking on null can only be done this way, + // a csv[index] == null does not work as that throws an exception itself. + try + { + var dum = csv[colIndex]; + if (String.IsNullOrEmpty(dum)) + break; + } + catch (Exception) + { + break; + } + // other "errors" are real errors so trap them. + try + { + surfaceLine.Xcoors.Add(Convert.ToDouble(csv[colIndex])); + colIndex++; + surfaceLine.Ycoors.Add(Convert.ToDouble(csv[colIndex])); + colIndex++; + surfaceLine.Zcoors.Add(Convert.ToDouble(csv[colIndex])); + colIndex++; + } + catch (Exception e) + { + var csvSurfaceLineError = String.Format(LocalizationManager.GetTranslatedText(GetType(), "csvSurfaceLineError"), surfaceLine.SurfaceLineRecordId, colIndex + 1); + errorMessages.Add(csvSurfaceLineError + e.Message); + recordReadError = true; + break; + } + } + if (!recordReadError) + { + surfaceLineRecords.Add(surfaceLine); + } + } + } + } + finally + { + File.Delete(tempFilename); + Thread.CurrentThread.CurrentCulture = oldcur; + } + } + + public List ImportedItems + { + get { return surfaceLineRecords; } + } + + public List ErrorMessages + { + get { return errorMessages; } + set { errorMessages = value; } + } + } +} Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/IO/AbstractExporter.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/IO/AbstractExporter.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/IO/AbstractExporter.cs (revision 3305) @@ -0,0 +1,112 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU 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 SPath = System.IO.Path; + +namespace Deltares.Dam.Data.IO +{ + public abstract class AbstractExporter : IExport + { + private string name; + private string path; + + protected AbstractExporter(string name) + : this(name, ".") + { + } + + protected AbstractExporter(string name, string outputPath) + : this(name, outputPath, default(T)) + { + } + + protected AbstractExporter(string name, string outputPath, T data) + { + this.name = name; + this.path = outputPath; + this.Data = data; + } + + #region Implementation of IExport + + /// + /// Sets the name of the file without extension + /// + public string Name + { + protected get { return this.name; } + set { this.name = value; } + } + + /// + /// Sets the path of the output folder + /// + public string Path + { + set { this.path = value; } + protected get { return this.path; } + } + + /// + /// Sets the data to export + /// + object IExport.Data { set { this.Data = (T)value; } } + + /// + /// Sets the data to export + /// + public T Data { set; protected get; } + + /// + /// Gets or sets the name of the file which will be set/combined by Path + Name + Extension in the export method + /// + public string FileName { get; private set; } + + /// + /// Gets or sets the file extension + /// + protected string FileExtension { private get; set; } + + /// + /// Exports the data to files in the current folder + /// + public void Export() + { + if (string.IsNullOrEmpty(this.path)) + throw new InvalidOperationException("path"); + + if (string.IsNullOrEmpty(this.name) || this.name.Trim() == "") + throw new InvalidOperationException("No name given for the file to export to"); + + this.FileName = SPath.Combine(path, name + this.FileExtension); + + Export(this.FileName, this.Data); + } + + #endregion + + protected virtual void Export(string fileName, T data) + { + } + + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Importers/ImportException.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Importers/ImportException.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Importers/ImportException.cs (revision 3305) @@ -0,0 +1,48 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU 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.Dam.Data.Importers +{ + [Serializable] + public class ImportException : Exception + { + public ImportException() + { + } + + public ImportException(string message) : base(message) + { + } + + public ImportException(string message, Exception inner) : base(message, inner) + { + } + + protected ImportException( + SerializationInfo info, + StreamingContext context) : base(info, context) + { + } + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Sensors/Specifications/PiezometricHeadSensorSpecification.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Sensors/Specifications/PiezometricHeadSensorSpecification.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Sensors/Specifications/PiezometricHeadSensorSpecification.cs (revision 3305) @@ -0,0 +1,33 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using Deltares.Standard.Specifications; + +namespace Deltares.Dam.Data.Sensors.Specifications +{ + internal class PiezometricHeadSensorSpecification : PredicateSpecification + { + public PiezometricHeadSensorSpecification() : + base(s => s.Type == SensorType.PiezometricHead) + { + } + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DamEngineIo/FillDamUiFromXmlOutput.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DamEngineIo/FillDamUiFromXmlOutput.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DamEngineIo/FillDamUiFromXmlOutput.cs (revision 3305) @@ -0,0 +1,318 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System.Collections.Generic; +using System.Linq; +using Deltares.DamEngine.Io.XmlOutput; +using Deltares.Geometry; +using Deltares.Geotechnics.GeotechnicalGeometry; +using Deltares.Geotechnics.Soils; +using Deltares.Geotechnics.SurfaceLines; +using Deltares.Standard.EventPublisher; +using Deltares.Standard.Extensions; +using SurfaceLine = Deltares.DamEngine.Io.XmlOutput.SurfaceLine; + +namespace Deltares.Dam.Data.DamEngineIo +{ + /// + /// Class to support the conversion of XmlOutput (as provided by the Engine) to DamUI objects. + /// + public class FillDamUiFromXmlOutput + { + /// + /// Adds the output to dam project data. + /// Precondition is that dam project data is filled and contains all relevant data that is referred to in the Output. + /// + /// The dam project data. + /// The output. + /// + public static DamProjectData AddOutputToDamProjectData(DamProjectData damProjectData, Output output) + { + if (output != null && output.Results != null && output.Results.CalculationResults != null) + { + if (output.Results.CalculationResults != null) + { + DataEventPublisher.InvokeWithoutPublishingEvents(() => + { + CreateDesignResultsFromOutput(output, damProjectData); + } + ); + } + } + + // Transfer calculation messages + if (output != null && output.Results != null && output.Results.CalculationMessages != null) + { + damProjectData.CalculationMessages = new List(); + for (int i = 0; i < output.Results.CalculationMessages.Length; i++) + { + var validationResult = output.Results.CalculationMessages[i]; + var logMessage = new Deltares.Standard.Logging.LogMessage(); + logMessage.MessageType = ConversionHelper.ConvertToMessageType(validationResult.MessageType); + logMessage.Subject = null; + logMessage.Message = validationResult.Message1; + damProjectData.CalculationMessages.Add(logMessage); + } + } + + // Transfer output time series + if (output.Results.OperationalOutputTimeSeries != null) + { + damProjectData.OutputTimeSerieCollection = new TimeSerieCollection(); + TransferOutputTimeSeries(output.Results.OperationalOutputTimeSeries, damProjectData.OutputTimeSerieCollection); + } + return damProjectData; + } + + private static void TransferOutputTimeSeries(DamEngine.Io.XmlOutput.TimeSerie[] outputTimeSeries, TimeSerieCollection outputTimeSerieCollection) + { + foreach (var outputTimeSerie in outputTimeSeries) + { + var timeSerie = outputTimeSerieCollection.AddNewSeries(outputTimeSerie.LocationId); + timeSerie.ParameterId = outputTimeSerie.ParameterId; + timeSerie.ForecastDateTime = outputTimeSerie.ForecastDateTime; + timeSerie.Type = outputTimeSerie.Type; + timeSerie.StartDateTime = outputTimeSerie.StartDateTime; + timeSerie.EndDateTime = outputTimeSerie.EndDateTime; + timeSerie.MissVal = outputTimeSerie.MissVal; + timeSerie.LongName = outputTimeSerie.LongName; + timeSerie.StationName = outputTimeSerie.StationName; + timeSerie.Units = outputTimeSerie.Units; + timeSerie.SourceOrganisation = outputTimeSerie.SourceOrganisation; + timeSerie.SourceSystem = outputTimeSerie.SourceSystem; + timeSerie.FileDescription = outputTimeSerie.FileDescription; + timeSerie.Region = outputTimeSerie.Region; + timeSerie.TimeStep.Multiplier = outputTimeSerie.TimeStep.Multiplier; + timeSerie.TimeStep.Divider = outputTimeSerie.TimeStep.Divider; + timeSerie.TimeStep.MultiplierSpecified = outputTimeSerie.TimeStep.MultiplierSpecified1; + timeSerie.TimeStep.DividerSpecified = outputTimeSerie.TimeStep.DividerSpecified1; + timeSerie.TimeStep.Unit = ConversionHelper.ConvertToTimeStepUnit(outputTimeSerie.TimeStep.TimeStepUnit); + for (int i = 0; i < outputTimeSerie.Entries.TimeSerieEntry.Length; i++) + { + var entry = outputTimeSerie.Entries.TimeSerieEntry[i]; + Stochast stochastValue = null; + if (entry.StochastValue != null) + { + stochastValue = new Stochast() + { + Distribution = entry.StochastValue.Distribution, + Mean = entry.StochastValue.Mean, + StandardDeviation = entry.StochastValue.StandardDeviation + }; + } + TimeSerieEntry timeSerieEntry = new TimeSerieEntry() + { + DateTime = entry.DateTime, + Value = entry.Value, + BasisFileName = entry.BasisFileNameWMF, + Flag = entry.Flagnietechtgebruikt, + RelativeCalculationPathName = entry.RelativeCalculationPathName, + StochastValue = stochastValue + }; + timeSerie.Entries.Add(timeSerieEntry); + } + } + } + + private static void CreateDesignResultsFromOutput(Output output, DamProjectData damProjectData) + { + if (damProjectData.WaterBoard.Dikes[0] != null) + { + // Design results + damProjectData.DesignCalculations = new List(); + for (int i = 0; i < output.Results.CalculationResults.Length; i++) + { + var designResult = output.Results.CalculationResults[i]; + var desResult = new CsvExportData(designResult.LocationName, designResult.ScenarioName) + { + DamFailureMechanismeCalculation = damProjectData.DamProjectCalculationSpecification.CurrentSpecification, // vanuit invoer + SelectedStabilityKernelType = damProjectData.DamProjectCalculationSpecification.SelectedStabilityKernelType, + AnalysisType = DamProjectCalculationSpecification.SelectedAnalysisType, //is vanuit invoer + DikeName = damProjectData.WaterBoard.Dikes[0].Name, // is de enige voor nu + CalculationResult = ConversionHelper.ConvertToCalculationResult(designResult.CalculationResult), + BaseFileName = designResult.BaseFileName, + CalculationSubDir = designResult.CalculationSubDir, + ProfileName = designResult.ProfileName + }; + desResult.CalculationResult = ConversionHelper.ConvertToCalculationResult(designResult.CalculationResult); + desResult.Scenario = GetScenarioByName(damProjectData, designResult.LocationName, designResult.ScenarioName); + desResult.SoilProfile = GetSoilProfileByName(damProjectData, designResult.ProfileName); + if (desResult.SoilProfile == null) + { + desResult.SoilGeometry2DName = designResult.ProfileName; + } + if (designResult.PipingDesignResults != null) + { + CreateDesignResultsPipingOutput(designResult, desResult); + } + if (designResult.StabilityDesignResults != null) + { + CreateDesignResultsStabilityOutput(designResult, desResult); + } + if (desResult.Scenario != null) + { + desResult.Scenario.CalculationResult = desResult.CalculationResult; + desResult.Scenario.CalculationResults.Add(desResult); + } + damProjectData.DesignCalculations.Add(desResult); + } + } + } + + private static void CreateDesignResultsPipingOutput(DesignResult designResult, CsvExportData desResult) + { + desResult.ResultMessage = designResult.PipingDesignResults.ResultMessage; + if (designResult.PipingDesignResults.RedesignedSurfaceLine != null) + { + desResult.RedesignedSurfaceLine2 = new SurfaceLine2(); + var surfaceLine = ConvertXmlSurfaceLineToSurfaceLine2(designResult.PipingDesignResults.RedesignedSurfaceLine); + desResult.RedesignedSurfaceLine2 = surfaceLine; + } + if (designResult.PipingDesignResults.UpliftFactorSpecified) desResult.UpliftFactor = designResult.PipingDesignResults.UpliftFactor; + if (designResult.PipingDesignResults.HeaveFactorSpecified) desResult.HeaveFactor = designResult.PipingDesignResults.HeaveFactor; + if (designResult.PipingDesignResults.BlighFactorSpecified) desResult.BlighPipingFactor = designResult.PipingDesignResults.BlighFactor; + if (designResult.PipingDesignResults.BlighHcriticalSpecified) desResult.BlighHCritical = designResult.PipingDesignResults.BlighHcritical; + if (designResult.PipingDesignResults.Sellmeijer4ForcesFactorSpecified) desResult.Sellmeijer4ForcesPipingFactor = designResult.PipingDesignResults.Sellmeijer4ForcesFactor; + if (designResult.PipingDesignResults.Sellmeijer4ForcesHcriticalSpecified) desResult.Sellmeijer4ForcesHCritical = designResult.PipingDesignResults.Sellmeijer4ForcesHcritical; + if (designResult.PipingDesignResults.SellmeijerVnkFactorSpecified) desResult.SellmeijerPipingFactor = designResult.PipingDesignResults.SellmeijerVnkFactor; + if (designResult.PipingDesignResults.SellmeijerVnkHcriticalSpecified) desResult.SellmeijerHCritical = designResult.PipingDesignResults.SellmeijerVnkHcritical; + if (designResult.PipingDesignResults.Wti2017BackwardErosionFactorSpecified) desResult.Wti2017BackwardErosionSafetyFactor = designResult.PipingDesignResults.Wti2017BackwardErosionFactor; + if (designResult.PipingDesignResults.Wti2017BackwardErosionHcriticalSpecified) desResult.Wti2017BackwardErosionHcritical = designResult.PipingDesignResults.Wti2017BackwardErosionHcritical; + if (designResult.PipingDesignResults.Wti2017BackwardErosionDeltaPhiCSpecified) desResult.Wti2017BackwardErosionDeltaPhiC = designResult.PipingDesignResults.Wti2017BackwardErosionDeltaPhiC; + if (designResult.PipingDesignResults.Wti2017BackwardErosionDeltaPhiReducedSpecified) desResult.Wti2017BackwardErosionDeltaPhiReduced = designResult.PipingDesignResults.Wti2017BackwardErosionDeltaPhiReduced; + if (designResult.PipingDesignResults.Wti2017UpliftFactorSpecified) desResult.Wti2017UpliftSafetyFactor = designResult.PipingDesignResults.Wti2017UpliftFactor; + if (designResult.PipingDesignResults.Wti2017UpliftHcriticalSpecified) desResult.Wti2017UpliftHcritical = designResult.PipingDesignResults.Wti2017UpliftHcritical; + if (designResult.PipingDesignResults.Wti2017DeltaPhiCuSpecified) desResult.Wti2017UpliftDeltaPhiC = designResult.PipingDesignResults.Wti2017DeltaPhiCu; + if (designResult.PipingDesignResults.Wti2017HeaveFactorSpecified) desResult.Wti2017HeaveSafetyFactor = designResult.PipingDesignResults.Wti2017HeaveFactor; + if (designResult.PipingDesignResults.Wti2017HeaveHcriticalSpecified) desResult.Wti2017HeaveHcritical = designResult.PipingDesignResults.Wti2017HeaveHcritical; + if (designResult.PipingDesignResults.Wti2017GradientSpecified) desResult.Wti2017Gradient = designResult.PipingDesignResults.Wti2017Gradient; + if (designResult.PipingDesignResults.Wti2017FactorOverallSpecified) desResult.Wti2017SafetyFactorOverall = designResult.PipingDesignResults.Wti2017FactorOverall; + if (designResult.PipingDesignResults.Wti2017HcriticalOverallSpecified) desResult.Wti2017HcriticalOverall = designResult.PipingDesignResults.Wti2017HcriticalOverall; + if (designResult.PipingDesignResults.Wti2017EffectiveStressSpecified) desResult.Wti2017EffectiveStress = designResult.PipingDesignResults.Wti2017EffectiveStress; + if (designResult.PipingDesignResults.Wti2017CCreepSpecified) desResult.Wti2017CCreep = designResult.PipingDesignResults.Wti2017CCreep; + + if (designResult.PipingDesignResults.ExitPointXSpecified) desResult.LocalPipingExitPointX = designResult.PipingDesignResults.ExitPointX; + + if (designResult.PipingDesignResults.UpliftSituation != null) + { + var uplift = designResult.PipingDesignResults.UpliftSituation; + desResult.IsUplift = uplift.IsUplift; + desResult.Pl3MinUplift = uplift.Pl3MinUplift; + desResult.Pl3HeadAdjusted = uplift.Pl3HeadAdjusted; + desResult.Pl3LocalLocationXMinUplift = uplift.Pl3LocationXMinUplift; + desResult.Pl4MinUplift = uplift.Pl4MinUplift; + desResult.Pl4HeadAdjusted = uplift.Pl4HeadAdjusted; + desResult.Pl4LocalLocationXMinUplift = uplift.Pl4LocationXMinUplift; + } + } + + private static Scenario GetScenarioByName(DamProjectData damProjectData, string locationName, string scenarioName) + { + var locations = damProjectData.Locations; + foreach (var location in locations) + { + if (location.Name == locationName) + { + foreach (var scenario in location.Scenarios) + { + if (scenario.LocationScenarioID == scenarioName) + { + return scenario; + } + } + } + } + return null; + } + + private static SoilProfile1D GetSoilProfileByName(DamProjectData damProjectData, string profileName) + { + var soilProfiles1D = damProjectData.WaterBoard.Dikes[0].SoilProfiles; + foreach (var soilProfile1D in soilProfiles1D) + { + if (soilProfile1D.Name == profileName) + { + return soilProfile1D; + } + } + return null; + } + + private static SurfaceLine2 ConvertXmlSurfaceLineToSurfaceLine2(SurfaceLine inputSurfaceLine) + { + var surfaceLine = new SurfaceLine2 + { + Name = inputSurfaceLine.Name + }; + surfaceLine.CharacteristicPoints.Geometry = surfaceLine.Geometry; + AddPointsToSurfaceLine(inputSurfaceLine, surfaceLine); + return surfaceLine; + } + + private static void AddPointsToSurfaceLine(SurfaceLine inputSurfaceLine, SurfaceLine2 surfaceLine) + { + surfaceLine.Geometry = new LocalizedGeometryPointString(); + for (int j = 0; j < inputSurfaceLine.Points.Length; j++) + { + var inputPoint = inputSurfaceLine.Points[j]; + var geometryPoint = new GeometryPoint() + { + X = inputPoint.X, + Y = 0.0, + Z = inputPoint.Z + }; + surfaceLine.AddCharacteristicPoint(geometryPoint, ConversionHelper.ConvertToDamPointType(inputPoint.PointType)); + } + } + + + private static void CreateDesignResultsStabilityOutput(DesignResult designResult, CsvExportData desResult) + { + desResult.ResultMessage = designResult.StabilityDesignResults.ResultMessage; + if (designResult.StabilityDesignResults.RedesignedSurfaceLine != null) + { + var surfaceLine = ConvertXmlSurfaceLineToSurfaceLine2(designResult.StabilityDesignResults.RedesignedSurfaceLine); + desResult.RedesignedSurfaceLine2 = surfaceLine; + } + if (designResult.StabilityDesignResults.SafetyFactorSpecified) desResult.StabilitySafetyFactor = designResult.StabilityDesignResults.SafetyFactor; + if (designResult.StabilityDesignResults.Zone1SafetyFactorSpecified) desResult.Zone1SafetyFactorStability = designResult.StabilityDesignResults.Zone1SafetyFactor; + if (designResult.StabilityDesignResults.Zone1EntryPointXSpecified) desResult.LocalZone1EntryPointX = designResult.StabilityDesignResults.Zone1EntryPointX; + if (designResult.StabilityDesignResults.Zone1ExitPointXSpecified) desResult.LocalZone1ExitPointX = designResult.StabilityDesignResults.Zone1ExitPointX; + if (designResult.StabilityDesignResults.Zone2SafetyFactorSpecified) desResult.Zone2SafetyFactorStability = designResult.StabilityDesignResults.Zone2SafetyFactor; + if (designResult.StabilityDesignResults.Zone2EntryPointXSpecified) desResult.LocalZone2EntryPointX = designResult.StabilityDesignResults.Zone2EntryPointX; + if (designResult.StabilityDesignResults.Zone2ExitPointXSpecified) desResult.LocalZone2ExitPointX = designResult.StabilityDesignResults.Zone2ExitPointX; + if (designResult.StabilityDesignResults.NumberOfIterationsSpecified) desResult.NumberOfIterations = designResult.StabilityDesignResults.NumberOfIterations; + if (designResult.StabilityDesignResults.SafetyFactorSpecified) desResult.StabilityModel = ConversionHelper.ConvertToStabilityModelType(designResult.StabilityDesignResults.StabilityModelType); + + if (designResult.StabilityDesignResults.UpliftSituation != null) + { + var uplift = designResult.StabilityDesignResults.UpliftSituation; + desResult.IsUplift = uplift.IsUplift; + desResult.Pl3MinUplift = uplift.Pl3MinUplift; + desResult.Pl3HeadAdjusted = uplift.Pl3HeadAdjusted; + desResult.Pl3LocalLocationXMinUplift = uplift.Pl3LocationXMinUplift; + desResult.Pl4MinUplift = uplift.Pl4MinUplift; + desResult.Pl4HeadAdjusted = uplift.Pl4HeadAdjusted; + desResult.Pl4LocalLocationXMinUplift = uplift.Pl4LocationXMinUplift; + } + } + } +} Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/TimeStep.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/TimeStep.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/TimeStep.cs (revision 3305) @@ -0,0 +1,58 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +namespace Deltares.Dam.Data +{ + public class TimeStep + { + public TimeStep() + { + DividerSpecified = false; + } + + public TimeStepUnit Unit { get; set; } + + private uint divider; + public uint Divider + { + get { return divider; } + set + { + divider = value; + DividerSpecified = true; + } + } + + public bool DividerSpecified { get; set; } + public bool MultiplierSpecified { get; set; } + + private uint multiplier; + public uint Multiplier + { + get { return multiplier; } + set + { + multiplier = value; + MultiplierSpecified = true; + } + } + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Xsd/DamMStabInputDefinition.xsd =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Xsd/DamMStabInputDefinition.xsd (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Xsd/DamMStabInputDefinition.xsd (revision 3305) @@ -0,0 +1,270 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Specifications/AndSpecification.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Specifications/AndSpecification.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Specifications/AndSpecification.cs (revision 3305) @@ -0,0 +1,58 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using Deltares.Dam.Data; + +namespace Deltares.Standard.Specifications +{ + /// + /// The and specification is a compositable one. + /// + /// The type of the candidate. + public class AndSpecification : CompositeSpecification + { + private readonly ISpecification one; + private readonly ISpecification other; + + public AndSpecification(ISpecification one, ISpecification other) + { + this.one = one; + this.other = other; + } + + /// + /// Determines whether this candidate satisfies the specification AND the other. + /// + /// The candidate. + /// + /// true if the candidate satisfies the specification otherwise, false. + /// + public override bool IsSatisfiedBy(TCandidate candidate) + { + bool satisfied = (this.one.IsSatisfiedBy(candidate) && this.other.IsSatisfiedBy(candidate)); + if (!satisfied) + { + base.Description = this.Description; + } + return satisfied; + } + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Specifications/CompositeSpecification.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Specifications/CompositeSpecification.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Specifications/CompositeSpecification.cs (revision 3305) @@ -0,0 +1,118 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using Deltares.Standard.Specifications; + +namespace Deltares.Dam.Data +{ + public abstract class CompositeSpecification : SpecificationBase + { + #region Operator overloads + + /// + /// Implements the operator true. + /// + /// The specification. + /// + /// The result of the operator. + /// + public static bool operator true(CompositeSpecification specification) + { + return false; + } + + /// + /// Implements the operator false. + /// + /// The specification. + /// + /// The result of the operator. + /// + public static bool operator false(CompositeSpecification specification) + { + return false; + } + + /// + /// Implements the operator &. + /// + /// The left. + /// The right. + /// + /// The result of the operator. + /// + public static CompositeSpecification operator &(CompositeSpecification left, CompositeSpecification right) + { + return new AndSpecification(left, right); + } + + /// + /// Ands the specified other. + /// + /// The other. + /// + public CompositeSpecification And(ISpecification other) + { + return new AndSpecification(this, other); + } + + /// + /// Implements the operator |. + /// + /// The left. + /// The right. + /// + /// The result of the operator. + /// + public static CompositeSpecification operator |(CompositeSpecification left, CompositeSpecification right) + { + return new AndSpecification(left, right); + } + + public OrSpecification Or(ISpecification other) + { + return new OrSpecification(this, other); + } + + /// + /// Implements the operator !. + /// + /// The specification. + /// + /// The result of the operator. + /// + public static CompositeSpecification operator !(CompositeSpecification specification) + { + return new NotSpecification(specification); + } + + /// + /// Nots this instance. + /// + /// + public NotSpecification Not() + { + return new NotSpecification(this); + } + + #endregion + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Sensors/SensorImportFromExcelSheet.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Sensors/SensorImportFromExcelSheet.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Sensors/SensorImportFromExcelSheet.cs (revision 3305) @@ -0,0 +1,591 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU 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.Data; +using System.Data.OleDb; +using System.Linq; +using Deltares.Standard.Extensions; +using Deltares.Standard.Application; +//using log4net.Config; +//using log4net.Repository.Hierarchy; + +namespace Deltares.Dam.Data.Sensors +{ + /// + /// Import sensor data from Excel sheet + /// + public class SensorImportFromExcelSheet + { + const string SensorProfileSheetName = "SensorProfileID"; + const string SensorGroupSheetName = "SensorGroupID"; + const string SensorSheetName = "SensorID"; + const string DikeLineInProfileSheetName = "DikeLineInProfile"; + const string IDColumnName = "ID"; + const string SensorNameColumnName = "SensorName"; + const string PLLineMappingColumnName = "PLLine-Mapping"; + const string ProfileColumnName = "Profile"; + + internal readonly static LogHelper Logger = LogHelper.Create("Main Program."); + + /// + /// Reads the sensor data from excel. + /// + /// The source file. + /// The dike. + /// + /// Error reading excel file + /// or + /// The + PLLineMappingColumnName + column has an error. Make sure the cells are not empty and are formatted as text + /// + public static void ReadSensorDataFromExcel(string sourceFile, Dike dike) + { + var sheets = new[] + { + SensorProfileSheetName, + SensorGroupSheetName, + SensorSheetName, + DikeLineInProfileSheetName + }; + + DataSet ds = null; + string fileName = sourceFile; + var connectionString = string.Format("Provider=Microsoft.Jet.OLEDB.4.0; data source={0}; Extended Properties=Excel 8.0;", fileName); + using (var conn = new OleDbConnection(connectionString)) + { + ds = FillDataSet(conn, ds, sheets); + } + + if (ds == null) + { + throw new InvalidOperationException("Error reading excel file"); + } + + var profiles = ds.Tables[SensorProfileSheetName].AsEnumerable(); + var groups = ds.Tables[SensorGroupSheetName].AsEnumerable(); + + var sensors = ParseSensors(ds); + + var count = 0; + foreach (var location in dike.Locations) + { + var repository = new SensorRepository(location); + + int id; + if (ParseSensorProfileWorksheet(location, profiles, out id)) + { + continue; + } + + // Parsing sensor groups + if (ParseSensorGroups(groups, id, sensors, repository)) + { + continue; + + } + + count++; + } + + Logger.LogInfo(string.Format("Successfully imported {0} sensor groups(s).", count)); + Logger.LogInfo(string.Format("Successfully imported {0} sensor profile(s).", count)); + + } + + + + private static List ParseSensors(DataSet ds) + { + var sensors = new List(); + var sensorRows = ds.Tables[SensorSheetName].AsEnumerable(); + int count = 0; + + foreach (var row in sensorRows) + { + + if (row.IsNull(IDColumnName)) + { + Logger.LogWarning(string.Format( + "Error reading row {0} in worksheet {1}. This row will be skipped.", count + 2, SensorSheetName)); + continue; + } + count++; + + var id = (int) row.Field(IDColumnName); + var name = row.Field(SensorNameColumnName); + var relativeLocation = row.Field("RelativeLocationSensorAlongProfileManual"); + var depth = row.Field("DepthSensor"); + var enumTypeIgnoreCase = row.Field("SensorType").ToEnumTypeIgnoreCase(); + + var sensor = new Sensor + { + ID = id, + Name = name, + RelativeLocation = relativeLocation, + Depth = depth, + Type = enumTypeIgnoreCase + //1 255364,05597700000 598646,53034800000 + //XRd = 255364.05597700000, + //YRd = 598646.53034800000, + }; + + try + { + var mappings = row.Field(PLLineMappingColumnName) + .Split(new[] {';'}, StringSplitOptions.RemoveEmptyEntries) + .Select(tag => tag.Trim()) + //.Where(tag => !string.IsNullOrWhiteSpace(tag)) + .ToArray(); + + foreach (var mapping in mappings) + { + switch (mapping) + { + case "1": + sensor.Add(PLLineType.PL1); + break; + case "2": + sensor.Add(PLLineType.PL2); + break; + case "3": + sensor.Add(PLLineType.PL3); + break; + case "4": + sensor.Add(PLLineType.PL4); + break; + } + } + } + catch (Exception e) + { + throw new InvalidOperationException( + "The " + PLLineMappingColumnName + + " column has an error. Make sure the cells are not empty and are formatted as text", e); + } + + Logger.LogInfo(sensor.ToString()); + sensors.Add(sensor); + } + + Logger.LogInfo(string.Format("Successfully imported {0} sensor(s).", count)); + return sensors; + } + + /// + /// Parses the sensor groups. + /// + /// The sensor groups. + /// The identifier. + /// The sensors. + /// The repository. + /// + /// + /// + private static bool ParseSensorGroups(IEnumerable sensorGroups, int id, List sensors, SensorRepository repository) + { + const string sensorSelectionColumnName = "SensorSelection"; + string currentSensorId = ""; + try + { + + string[] groupIds = null; + foreach (var sensorGroup in sensorGroups) + { + var idValue = (int)sensorGroup.Field(IDColumnName); + if (idValue != id) + { + continue; + } + + var groupIdValue = sensorGroup.Field(sensorSelectionColumnName); + + if (groupIdValue == null) + { + Logger.LogWarning(string.Format("Error reading the value from column {0} for group id {1}", + sensorSelectionColumnName, id)); + } + else + { + groupIds = groupIdValue.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries); + break; + } + } + + if (groupIds == null) + { + Logger.LogWarning(string.Format("Couldn't find group id '{0}' in worksheet {1}", id, + SensorGroupSheetName)); + return true; + } + + foreach (var groupId in groupIds) + { + currentSensorId = groupId; + var single = sensors.Single(s => s.ID.ToString() == groupId); + repository.Add(single); + } + } + catch (InvalidOperationException ioe) + { + if (!string.IsNullOrWhiteSpace(currentSensorId)) + { + string message = string.Format("Error finding sensor. The sensor with ID '{0}' was not found in the Excel worksheet '{1}'", currentSensorId, SensorSheetName); + throw new InvalidOperationException(message, ioe); + } + throw ioe; + } + catch (Exception e) + { + throw new InvalidOperationException( + string.Format("An unknown error occurred in column " + sensorSelectionColumnName + " in the Excel sheet " + SensorGroupSheetName + + ". Used the following location ID: " + id, e)); + } + + return false; + } + + /// + /// Parses the sensor profile worksheet. + /// + /// The location. + /// The sensor locations. + /// The identifier. + /// + /// An error occurred while parsing row in worksheet + SensorProfileSheetName + private static bool ParseSensorProfileWorksheet(Location location, EnumerableRowCollection sensorLocations, out int id) + { + id = -1; + try + { + var record = sensorLocations + .Where(x => x.Field(ProfileColumnName) == location.Name) + .Select(x => new + { + ID = GetLocationIDField(x), + GroupID = GetGroupIDField(x), + Alias = GetNameAliasField(x), + InputPL1OuterWaterLevel = GetPL1WaterLevelRiverSide(x), + InputPL1PLLineOffsetBelowDikeTopAtRiver = GetPL1OffsetBelowDikeTopAtRiver(x), + InputPL1PLLineOffsetBelowDikeTopAtPolder = GetPL1OffsetBelowDikeTopAtPolder(x), + InputPL1PLLineOffsetBelowShoulderBaseInside = GetPL1OffsetBelowShoulderBaseInside(x), + InputPL1PLLineOffsetBelowDikeToeAtPolder = GetPL1OffsetBelowDikeToeAtPolder(x), + InputPL1PolderLevel = GetPL1PolderLevelSensorType(x), + InputPL3 = GetInputPl3(x), + InputPL4 = GetInputPl4(x) + }).SingleOrDefault(); + + if (record == null) + { + Logger.LogWarning(string.Format("Location profile ID '{0}' not found in worksheet {1}. Location profile skipped.", + location.Name, SensorProfileSheetName)); + return true; + } + + id = record.GroupID; + + var sensorData = location.SensorLocation; + sensorData.Group.ID = record.GroupID; + sensorData.Alias = record.Alias; + sensorData.SourceTypePl1WaterLevelAtRiver = record.InputPL1OuterWaterLevel; + sensorData.SourceTypePl1PlLineOffsetBelowDikeTopAtRiver = record.InputPL1PLLineOffsetBelowDikeTopAtRiver; + sensorData.SourceTypePl1PlLineOffsetBelowDikeTopAtPolder = record.InputPL1PLLineOffsetBelowDikeTopAtPolder; + sensorData.SourceTypePl1PlLineOffsetBelowShoulderBaseInside = record.InputPL1PLLineOffsetBelowShoulderBaseInside; + sensorData.SourceTypePl1PlLineOffsetBelowDikeToeAtPolder = record.InputPL1PLLineOffsetBelowDikeToeAtPolder; + sensorData.SourceTypePl1WaterLevelAtPolder = record.InputPL1PolderLevel; + sensorData.SourceTypePl3 = record.InputPL3; + sensorData.SourceTypePl4 = record.InputPL4; + } + catch (Exception e) + { + throw new InvalidOperationException("An error occurred while parsing row in worksheet " + SensorProfileSheetName, e); + } + return false; + } + /// + /// Fills the data set. + /// + /// The connection. + /// The ds. + /// The sheets. + /// + private static DataSet FillDataSet(OleDbConnection conn, DataSet ds, string[] sheets) + { + conn.Open(); + ds = new DataSet(); + + foreach (string sheet in sheets) + { + // string columns = String.Join(",", columnNames.ToArray()); + const string columns = "*"; + using (var da = new OleDbDataAdapter( + "SELECT " + columns + " FROM [" + sheet + "$]", conn)) + { + var dt = new DataTable(sheet); + da.Fill(dt); + ds.Tables.Add(dt); + } + } + return ds; + } + + /// + /// Gets the p l1 water level river side. + /// + /// The x. + /// + private static DataSourceTypeSensors GetPL1WaterLevelRiverSide(DataRow x) + { + DataSourceTypeSensors pl1WaterLevelRiverSide; + + try + { + pl1WaterLevelRiverSide = x.Field("InputPL1OuterWaterLevel").ToEnumTypeIgnoreCase(); + } + catch (Exception) + { + throw; + } + + return pl1WaterLevelRiverSide; + } + + /// + /// Gets the p l1 offset below dike top at river. + /// + /// The x. + /// + private static DataSourceTypeSensors GetPL1OffsetBelowDikeTopAtRiver(DataRow x) + { + const string columnName = "InputPL1PLLineOffsetBelowDikeTopAtRiver"; + + DataSourceTypeSensors pl1OffsetBelowDikeTopAtRiver; + try + { + pl1OffsetBelowDikeTopAtRiver = x.Field(columnName).ToEnumTypeIgnoreCase(); + } + catch (Exception) + { + throw; + } + + return pl1OffsetBelowDikeTopAtRiver; + } + + /// + /// Gets the p l1 offset below dike top at polder. + /// + /// The x. + /// + private static DataSourceTypeSensors GetPL1OffsetBelowDikeTopAtPolder(DataRow x) + { + const string columnName = "InputPL1PLLineOffsetBelowDikeTopAtPolder"; + + DataSourceTypeSensors pl1OffsetBelowDikeTopAtPolder; + try + { + pl1OffsetBelowDikeTopAtPolder = x.Field(columnName).ToEnumTypeIgnoreCase(); + } + catch (Exception) + { + throw; + } + + return pl1OffsetBelowDikeTopAtPolder; + } + + /// + /// Gets the p l1 offset below shoulder base inside. + /// + /// The x. + /// + private static DataSourceTypeSensors GetPL1OffsetBelowShoulderBaseInside(DataRow x) + { + DataSourceTypeSensors pl1OffsetBelowShoulderBaseInside; + try + { + pl1OffsetBelowShoulderBaseInside = x.Field("InputPL1PLLineOffsetBelowShoulderBaseInside").ToEnumTypeIgnoreCase(); + } + catch (Exception) + { + throw; + } + + return pl1OffsetBelowShoulderBaseInside; + } + + /// + /// Gets the p l1 offset below dike toe at polder. + /// + /// The x. + /// + private static DataSourceTypeSensors GetPL1OffsetBelowDikeToeAtPolder(DataRow x) + { + DataSourceTypeSensors pl1OffsetBelowDikeToeAtPolder; + + try + { + pl1OffsetBelowDikeToeAtPolder = x.Field("InputPL1PLLineOffsetBelowDikeToeAtPolder").ToEnumTypeIgnoreCase(); + } + catch (Exception) + { + throw; + } + return pl1OffsetBelowDikeToeAtPolder; + } + + /// + /// Gets the type of the p l1 polder level sensor. + /// + /// The x. + /// + private static DataSourceTypeSensors GetPL1PolderLevelSensorType(DataRow x) + { + const string columnName = "InputPL1PolderLevel"; + DataSourceTypeSensors pl1PolderLevelSensorType; + + try + { + pl1PolderLevelSensorType = x.Field(columnName).ToEnumTypeIgnoreCase(); + } + catch (Exception) + { + + throw; + } + + return pl1PolderLevelSensorType; + } + + /// + /// Gets the input PL4. + /// + /// The x. + /// + private static DataSourceTypeSensors GetInputPl4(DataRow x) + { + DataSourceTypeSensors dataSourceTypeSensors; + + try + { + dataSourceTypeSensors = x.Field("InputPL4").ToEnumTypeIgnoreCase(); + } + catch (Exception) + { + + throw; + } + + return dataSourceTypeSensors; + } + + /// + /// Gets the input PL3. + /// + /// The x. + /// + private static DataSourceTypeSensors GetInputPl3(DataRow x) + { + DataSourceTypeSensors pl3; + + try + { + pl3 = x.Field("InputPL3").ToEnumTypeIgnoreCase(); + } + catch (Exception) + { + throw; + } + + return pl3; + } + + /// + /// Gets the name alias field. + /// + /// The x. + /// + /// nameAliasField + private static string GetNameAliasField(DataRow x) + { + var nameAliasField = x.Field("NameAlias"); + if (nameAliasField == null) + { + throw new ArgumentNullException("nameAliasField"); + } + return nameAliasField; + } + + /// + /// Gets the group identifier field. + /// + /// The x. + /// + /// Error parsing value : + x.Field(columnName) + private static int GetGroupIDField(DataRow x) + { + int groupIdField; + const string columnName = "SensorGroup"; + try + { + groupIdField = (int)x.Field(columnName); + } + catch (InvalidCastException) + { + throw new InvalidCastException("Error parsing value : " + x.Field(columnName)); + } + catch (Exception) + { + + throw; + } + + return groupIdField; + } + + /// + /// Gets the location identifier field. + /// + /// The x. + /// + /// Error parsing value : + x.Field(columnName) + . LocationID should be a numeric value. + private static int GetLocationIDField(DataRow x) + { + int locationIdField; + const string columnName = "locationID"; + + try + { + locationIdField = (int)x.Field(columnName); + } + catch (InvalidCastException) + { + throw new InvalidCastException("Error parsing value : " + x.Field(columnName) + ". LocationID should be a numeric value."); + } + catch (Exception) + { + throw; + } + return locationIdField; + } + + } +} Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Xsd/pi_sharedtypes.xsd =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Xsd/pi_sharedtypes.xsd (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Xsd/pi_sharedtypes.xsd (revision 3305) @@ -0,0 +1,175 @@ + + + + + + + + + + + + + + + + + + + + + + + The timeunit element has three attributes, unit and devider and multiplier. + the unit is second, minute, hour, week, month year. + The divider attribute is optional (default = 1). + + + + + + + + + + + + + + + + + + + + + + The timeunit element has two attributes, unit and divider. + the unit is required and can be 1, 2, 3, or 4 meaning: year, month, day and hour. + The divider attribute is optional (default = 1). + + + + + + + + + + + + + + Example: to construct timeSteps op 5 seconds use unit 4 (hours) + and a divider of 720. For daily timeSteps use unit 2 (day) and divider 1. + + + + + + + The geographical datum for the location data. + Presently only WGS-1984, OS 1936 and LOCAL are recognised. + LOCAL indicates a local grid. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Location ID, defined by the model + + + + + + + Content of the data (Discharge, Precipitation, VPD); defined by the model + + + + + + + The timeZone (in decimal hours shift from GMT) + e.g. -1.0 or 3.5. If not present GMT is assumed + + + + + + + + + + + + + + + + + + + + + + + + + Type of data, either accumulative or instantaneous. + For accumulative data the time/date of the event is + the moment at which the data was gathered. + + + + + + + + Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/Test/Services/FeatureImporterTest.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/Test/Services/FeatureImporterTest.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/Test/Services/FeatureImporterTest.cs (revision 3305) @@ -0,0 +1,71 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of the application DAM - UI. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU 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.Linq; + +using NUnit.Framework; + +namespace Deltares.Maps.Tests.Services +{ + [TestFixture] + public class FeatureImporterTest + { + #region Setup + + [TestFixtureSetUp] + public void FixtureSetup() + { + } + + [TestFixtureTearDown] + public void FixtureTearDown() + { + } + + [SetUp] + public void TestSetup() + { + } + + [TearDown] + public void TestTearDown() + { + } + + #endregion + + [Test] + public void Import_ReadShapeFile_RepositoryContainsGeometries() + { + var testFile = new ShapeFileLocation(@"..\..\..\Data\ShapeFiles\Gemeenten.shp"); + IReader reader = new ShapeFileReader(testFile); + IFeatureRepository repository = new FeatureRepository(); + + IFeatureImporter importer = new FeatureImporter(repository, reader); + importer.Import(); + + Assert.IsNotNull(repository.Features); + Assert.IsTrue(repository.Features.Any()); + + } + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Sensors/Specifications/UseLocationAsDataSource.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Sensors/Specifications/UseLocationAsDataSource.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Sensors/Specifications/UseLocationAsDataSource.cs (revision 3305) @@ -0,0 +1,33 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using Deltares.Standard.Specifications; + +namespace Deltares.Dam.Data.Sensors.Specifications +{ + internal class UseLocationAsDataSource : PredicateSpecification + { + public UseLocationAsDataSource() : + base(x => x == DataSourceTypeSensors.LocationData) + { + } + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DamProjectData.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DamProjectData.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DamProjectData.cs (revision 3305) @@ -0,0 +1,659 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU 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.ComponentModel; +using System.Linq; +using System.Xml.Serialization; +using System.Collections.Generic; +using Deltares.Dam.Data.IO; +using Deltares.Dam.Data.Sensors; +using Deltares.Standard; +using Deltares.Standard.Attributes; +using Deltares.Standard.EventPublisher; +using Deltares.Standard.Language; +using Deltares.Standard.Logging; +using Deltares.Standard.Project; +using Deltares.Standard.Validation; + +namespace Deltares.Dam.Data +{ + + public class DamProjectData : Project, IDomain, IDisposable + { + public readonly double MissValStabilitySafetyFactor = -1.0; + private VersionInfo versionInfo; + private WaterBoard waterBoard; + private DamProjectCalculationSpecification damProjectCalculationSpecification; + private WaterBoardJob waterBoardJob = null; + private DamProjectType damProjectType = DamProjectType.Calamity; + private string damDataSourceFileName = ""; + private List jobs = new List(); + private List designCalculations = null; + private List dataSources = new List(); + private string dataSourceEsriProjection = null; + private SensorData sensorData; + private int maxCalculationCores = 1; + private TimeSerieCollection inputTimeSerieCollection = null; + private TimeSerieCollection outputTimeSerieCollection = null; + + /// + /// Constructor + /// + public DamProjectData() + { + this.versionInfo = new VersionInfo(); + this.waterBoard = new WaterBoard(); + this.waterBoardJob = null; + this.damProjectCalculationSpecification = new DamProjectCalculationSpecification(); + } + + /// Gets the version information. + /// The version information. + public VersionInfo VersionInfo + { + get { return versionInfo; } + set { versionInfo = value; } + } + + /// + /// Gets or sets the project working path. + /// + /// + /// The project working path. + /// + public string ProjectPath + { + get + { + return DamProject.ProjectMap; + } + } + + /// + /// Gets or sets the calculation map. + /// + /// + /// The calculation map. + /// + public string CalculationMap + { + get + { + return DamProject.CalculationMap; + } + } + + /// + /// Gets or sets the maximum calculation cores. + /// + /// + /// The maximum calculation cores. + /// + public int MaxCalculationCores + { + get + { + return maxCalculationCores; + } + set + { + maxCalculationCores = value; + } + } + /// + /// Toplevel object to hold waterboard data + /// + public virtual WaterBoard WaterBoard + { + get { return this.waterBoard; } + set + { + this.waterBoard = value; + if (this.waterBoardJob != null && this.waterBoardJob.Subject != value) + { + this.waterBoardJob = null; + } + } + } + /// + /// calculation specification for the project + /// + /// Composite relationship + [Validate] + public DamProjectCalculationSpecification DamProjectCalculationSpecification + { + get { return damProjectCalculationSpecification; } + set { damProjectCalculationSpecification = value; } + + } + + [Child] + public virtual DamJob WaterBoardJob + { + get + { + if (waterBoardJob == null) + { + waterBoardJob = new WaterBoardJob(this.waterBoard); + waterBoardJob.Subject = this.waterBoard; + + foreach (Dike dike in waterBoard.Dikes) + { + CompositeJob dikeJob = new DikeJob(dike); + waterBoardJob.Jobs.Add(dikeJob); + + foreach (Location location in dike.Locations) + { + LocationJob locationJob = new LocationJob(location); + dikeJob.Jobs.Add(locationJob); + } + } + } + + return waterBoardJob; + } + set { waterBoardJob = value as WaterBoardJob; } + } + + [ReadOnly(true)] + [Label("Calculation type")] + [Description("Indicates the purpose of the calculations")] + public virtual DamProjectType DamProjectType + { + get { return damProjectType; } + set + { + DataEventPublisher.BeforeChange(this, "DamProjectType"); + + bool modified = damProjectType != value; + + damProjectType = value; + Location.DamProjectType = value; + DamFailureMechanismeCalculationSpecification.DamProjectType = value; + + if (modified) + { + LocationJob.DamProjectType = damProjectType; + DataEventPublisher.DataListModified(this.LocationJobs); + } + + DataEventPublisher.AfterChange(this, "DamProjectType"); + } + } + + [Label("DAM datasource file")] + [Description("Indicates which \".defx\" import definition file to use")] + public virtual string DamDataSourceFileName + { + get { return damDataSourceFileName; } + set + { + DataEventPublisher.BeforeChange(this, "DamDataSourceFileName"); + damDataSourceFileName = value; + DataEventPublisher.AfterChange(this, "DamDataSourceFileName"); + } + } + + /// + /// Clear all results + /// + public void ClearResults() + { + if (designCalculations != null) + { + designCalculations.Clear(); + } + foreach (LocationJob locationJob in this.LocationJobs) + { + locationJob.LocationResult = new LocationResult(); + foreach (Scenario scenario in locationJob.Location.Scenarios) + { + scenario.CalculationResults.Clear(); + } + } + } + + private List CreateScenarioListForDeletion() + { + List scenarios = new List(); ; + + List locations = this.LocationJobs.Select(x => x.Location).ToList(); + foreach (Location location in locations) + { + if (location.Scenarios != null) + { + scenarios.AddRange(location.Scenarios); + } + } + + return scenarios; + } + + private List CreateScenarioListForCalculation() + { + List scenarios = new List(); ; + + List locations = this.SelectedLocationJobs.Select(x => x.Location).ToList(); + foreach (Location location in locations) + { + if (location.Scenarios != null) + { + scenarios.AddRange(location.Scenarios); + } + } + + return scenarios; + } + + /// + /// Updates the design calculations. + /// + public void UpdateDesignCalculations() + { + if (designCalculations == null) + { + designCalculations = new List(); + } + else + { + designCalculations.Clear(); + } + var scenarios = CreateScenarioListForCalculation(); + foreach (Scenario scenario in scenarios) + { + if (scenario.CalculationResults != null && scenario.CalculationResults.Count > 0) + { + designCalculations.AddRange(scenario.CalculationResults); + } + } + DataEventPublisher.DataListModified(designCalculations); + } + + [XmlIgnore] + public List CalculationMessages { get; set; } + + [XmlIgnore] + [ReadOnly(true)] + public List DesignCalculations + { + get + { + if (designCalculations == null) + { + this.UpdateDesignCalculations(); + } + + return designCalculations; + } + set + { + designCalculations = value; + } + } + + public CalculationResult Validate() + { + try + { + //Todo validation has to extended, handling the actual messages instead of just CalculationResult too. + foreach (Dike dike in this.WaterBoard.Dikes) + { + dike.Validate(); + } + return CalculationResult.Succeeded; + } + catch + { + return CalculationResult.InvalidInputData; + } + } + + public LocationJob GetLocationJob(Location location) + { + foreach (LocationJob locationJob in this.LocationJobs) + { + if (locationJob.Location == location) + { + return locationJob; + } + } + + return null; + } + + [XmlIgnore] + [ReadOnly(true)] + [Browsable(false)] + public List LocationJobs + { + get + { + if (jobs.Count == 0) + { + CompositeJob waterboardJob = this.WaterBoardJob as CompositeJob; + foreach (CompositeJob dijkJob in waterboardJob.Jobs) + { + foreach (LocationJob locationJob in dijkJob.Jobs) + { + jobs.Add(locationJob); + } + } + } + + return jobs; + } + } + + public LocationJob GetFirstLocationJobWithDesignResults() + { + foreach (LocationJob locationJob in this.LocationJobs) + { + if (locationJob.HasDesignScenarioResults) + { + return locationJob; + } + } + return null; + } + + public LocationJob GetFirstLocationJobWithCalamityResults() + { + foreach (LocationJob locationJob in this.LocationJobs) + { + if (locationJob.HasLocationResults) + { + return locationJob; + } + } + return null; + } + + [XmlIgnore] + [ReadOnly(true)] + [Browsable(false)] + [Validate] + public List SelectedLocationJobs + { + get + { + List selectedLocationJobs = new List(); + foreach (LocationJob locationJob in this.LocationJobs) + { + if (locationJob.Run.HasValue && locationJob.Run.Value) + { + selectedLocationJobs.Add(locationJob); + } + } + + return selectedLocationJobs; + } + } + + [Validate] + public ValidationResult[] ValidateEnoughLocationJobs() + { + if (this.SelectedLocationJobs.Count == 0) + { + return new ValidationResult[] + { + new ValidationResult(ValidationResultType.Error, + LocalizationManager.GetTranslatedText(this, "NoLocationsSelected"), + this) + }; + } + else + { + return new ValidationResult[0]; + } + } + + [XmlIgnore] + [Browsable(false)] + [ReadOnly(true)] + [Label("Locations")] + public List Locations + { + get { return this.WaterBoard.Locations; } + } + + [Browsable(false)] + public List DataSources + { + get { return dataSources; } + set { dataSources = value; } + } + + [Browsable(false)] + public string DataSourceEsriProjection + { + get { return this.dataSourceEsriProjection; } + set { this.dataSourceEsriProjection = value; } + } + + /// + /// Gets or sets the sensor data. + /// + /// + /// The sensor data. + /// + public SensorData SensorData + { + get { return sensorData; } + set { sensorData = value; } + } + + /// + /// Gets or sets the input time serie collection. + /// + /// + /// The input time serie collection. + /// + public TimeSerieCollection InputTimeSerieCollection + { + get + { + return inputTimeSerieCollection; + } + set + { + inputTimeSerieCollection = value; + } + } + + /// + /// Gets or sets the output time serie collection. + /// + /// + /// The output time serie collection. + /// + public TimeSerieCollection OutputTimeSerieCollection + { + get + { + return outputTimeSerieCollection; + } + set + { + outputTimeSerieCollection = value; + } + } + + public void DeleteResults() + { + LogManager.Messages.Clear(); + if (waterBoardJob != null && waterBoardJob.Jobs != null) + { + waterBoardJob.Jobs.Clear(); + } + waterBoardJob = null; + if (jobs != null) + { + jobs.Clear(); + } + + // Delete calculationresults in scenarios + var scenarios = CreateScenarioListForDeletion(); + foreach (Scenario scenario in scenarios) + { + scenario.ClearResults(); + scenario.ClearErrors(); + } + + if (designCalculations != null) + { + designCalculations.Clear(); + } + } + + private int GetNumberOfCalculatedJobs() + { + var numberOfCalculatedJobs = 0; + + foreach (LocationJob locationJob in this.LocationJobs) + { + if ((locationJob.Result != JobResult.NoRun) && locationJob.Run != null && locationJob.Run.Value) + { + foreach (Dike dike in this.WaterBoard.Dikes) + { + if (dike.Locations.Contains(locationJob.Location)) + { + dike.UpdateLocation(locationJob.Location); + break; + } + } + numberOfCalculatedJobs++; + } + } + + return numberOfCalculatedJobs; + } + + public bool HasResults() + { + bool hasResults = waterBoard.Dikes.Count > 0 && waterBoardJob != null && waterBoardJob.Jobs.Count > 0; + if (hasResults) + { + hasResults = GetNumberOfCalculatedJobs() > 0; + } + return hasResults; + } + + /// + /// Check if design with geometry adaption is allowed + /// + /// + private bool IsDesignWithGeometryAdaptionAllowed() + { + bool isAdoption = this.DamProjectType == DamProjectType.Design && DamProjectCalculationSpecification.SelectedAnalysisType != AnalysisType.NoAdaption; + bool isStabilityOutside = this.DamProjectCalculationSpecification.DamCalculationSpecifications.Any(specification => specification.FailureMechanismSystemType == FailureMechanismSystemType.StabilityOutside); + return (!isAdoption || !isStabilityOutside); + } + + /// + /// Validates the geometry adaption setting. + /// + /// + [Validate] + public ValidationResult[] ValidateGeometryAdaptionSetting() + { + if (!IsDesignWithGeometryAdaptionAllowed()) + { + return new[]{ new ValidationResult(ValidationResultType.Error, LocalizationManager.GetTranslatedText(this, "DesignAndAdaptionNotAllowedForStabilityOutside"), + this, "DamCalculationSpecifications", "DamCalculationSpecifications", null)}; + } + else + { + return new ValidationResult[0]; + } + + } + + public override bool IsVisible(string property) + { + switch (property) + { + case "SensorData": return damProjectType == DamProjectType.DamLiveConfiguration; + case "SchematizationFactors": return false; + //Bka: for now (release 1.4.1), do not show SchematizationFactors return this.HasResults() && this.DamProjectType == Data.DamProjectType.Assessment; + case "DesignCalculations": return this.HasResults() && this.DamProjectType == Data.DamProjectType.Design; + case "DamProjectCalculationSpecification": + return damProjectCalculationSpecification.DamCalculationSpecifications.Count > 0; + default: return true; + } + } + + public ICollection GetDomain(string property) + { + switch (property) + { + default: return null; + } + } + + public override string ToString() + { + return this.WaterBoard != null ? this.WaterBoard.Name : ""; + } + + public void Dispose() + { + WaterBoard.Dispose(); + DamProjectCalculationSpecification.Dispose(); + } + + public void FillOverallSensorData() + { + if (sensorData != null) + { + sensorData.Sensors.Clear(); + sensorData.SensorGroups.Clear(); + sensorData.SensorLocations.Clear(); + } + else + { + sensorData = new SensorData(); + } + foreach (var location in Locations) + { + var sd = location.SensorLocation; + + foreach (var sensor in sd.Sensors ) + { + if (sensorData.GetSensorById(sensor.ID) == null) + { + sensorData.Sensors.Add(sensor); + } + } + if (sensorData.GetGroupById(sd.Group.ID) == null && sd.Group.ID != 0) + { + sd.Group.PickSensors = sensorData.Sensors; + sensorData.SensorGroups.Add(sd.Group); + } + if (sensorData.GetSensorLocationByLocationName(sd.LocationName) == null) + { + sensorData.SensorLocations.Add(sd); + } + } + } + } +} Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DAMEnumerations.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DAMEnumerations.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DAMEnumerations.cs (revision 3305) @@ -0,0 +1,314 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU 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.Standard.Attributes; + +namespace Deltares.Dam.Data +{ + public enum DamLicenseType + { + None = 0, + Dongle = 1, + FlexNet = 2, + FlexLm = 3, + LicFile = 4, + LFM = 5 + } + + public enum DamProjectType + { + Calamity, + [XmlOldName("Assessment")] + AssessOld, + Design, + DamLiveConfiguration + } + + public enum StabilityKernelType + { + // The Classic models all use DGMStabDam.dll to generate a sti file from the input (so also pl-lines only) + // DAM classic uses the Delphi version of DGS (as exe) to solve the calculation + [XmlOldName("DamClassic")] + DamClassicStability, + + // WtiMacroStabilityKernel uses the latest MacroStability kernel as used by the new C# version of DGeoStabilty. + [XmlOldName("AdvancedWti")] + WtiMacroStabilityKernel + }; + + public enum AnalysisType + { + [Label("No adaptation")] + [XmlOldName("Normal")] + NoAdaption, + + [Label("Adapt geometry")] + [XmlOldName("Design")] + AdaptGeometry + }; + + public enum FailureMechanismSystemType + { + [XmlOldName("Stability", "StabilityInsideMStab")] + StabilityInside, + StabilityOutside, + Piping, + HorizontalBalance, + FlowSlide + } + + public enum MStabModelType + { + Bishop, + Spencer, + Fellenius, + UpliftVan, + UpliftSpencer, + BishopRandomField, + HorizontalBalance, + BishopUpliftVan, + SpencerHigh, // #Bka added SpencerHigh/SpencerLow as quick fix. Should be replaced with options for Spencer later! These enums should be removed. + SpencerLow + } + + public enum PipingModelType + { + Bligh, + Sellmeijer, + Sellmeijer2Forces, + Sellmeijer4Forces, + Wti2017 + }; + + public enum FlowSlideModelType + { + All, + }; + + public enum PLLineAssignment + { + NoPLLines, + ExpertKnowledge + } + + public enum SoilProfileType + { + [XmlOldName("SoilGeometry1D")] + SoilProfile1D, + SoilProfile2D, + [XmlOldName("SoilGeometry2D")] + SoilGeometryStiFile + } + + + + public enum MStabShearStrength + { + CPhi, + StressTables, + CuCalculated, + CuMeasured, + CuGradient, + Default + } + + public enum MStabSearchMethod + { + Grid, + GeneticAlgorithm + } + + public enum MStabGridPosition + { + Left, + Right + } + + public enum MStabZonesType + { + [Label("No zones")] + NoZones = 0, + [Label("Zone areas")] + ZoneAreas = 1, + [Label("Forbidden zones")] + ForbiddenZone = 2 + } + + public enum StabilityDesignMethod //Design + { + OptimizedSlopeAndShoulderAdaption, + SlopeAdaptionBeforeShoulderAdaption + } + + public enum PLLineType + { + PL1, + PL2, + PL3, + PL4 + } + + public enum PLLinePointPositionXzType + { + OnPLLine, + AbovePLLine, + BelowPLLine, + BeyondPLLine // indicates that point is outside the scope of the pl line. + }; + + public enum ResultEvaluation //RWScenarios + { + [Label("Accepted")] + Accepted, + + [Label("Rejected")] + Rejected, + + [Label("Not evaluated")] + NotEvaluated + } + + public enum LoadSituation //RWScenarios + { + Dry, + Wet + } + + public enum DataSourceTypeSensors //Sensors + { + Ignore, + LocationData, + Sensor + } + + public enum SensorType //Sensors + { + PiezometricHead, + WaterLevel, + PolderLevel + } + + /// + /// Type of output series + /// + public enum TimeSerieParameters + { + [Obsolete("Use StabilityInsideFactor instead")] + SafetyFactor, // <- Is same as StabilityInsideFactor, kept for legacy code + PipingFactorWti, + PipingFactorBligh, + PipingFactorSellmeijer, + ProbabilityOfFailurePipingSellmeijer, + OvertoppingErosion, + StabilityInsideFactor, + StabilityOutsideFactor + } + + public enum UpliftType + { + Uplift, + NoUplift + } + + public enum PLLineCreationMethod + { + ExpertKnowledgeRRD, + ExpertKnowledgeLinearInDike, + GaugesWithFallbackToExpertKnowledgeRRD, + Sensors, + None + } + + public enum ProjectPathLocation + { + // Other future possibilties: InProjectMap, InWindowsTemp + InApplicationMap, + InUserMap, + InProjectMap + } + + public enum DataSourceType + { + CsvFiles, + Iris, + DataShapeFiles, + BackgroundShapeFiles, + MSoilBase, + MGeobase + } + + public enum LayerType + { + Top, + Dike, + Cover, + Aquifer1, + Aquifer2, + Aquitard + } + + public enum JobResult + { + [Label("Not calculated")] + NoRun, + + [Label("Failed")] + Failed, + + [Label("Good")] + Good, + + [Label("Bad")] + Bad, + + [Label("Mixed")] + Mixed + } + + public enum TimeStepUnit + { + Second, + Minute, + Hour, + Day, + Week, + Month, + Year, + Nonequidistant + } + + public enum ConfigurationStatus + { + Available, // Option is implemented and available + NotAvailable, // Option is implemented and available (can be used when combination is in development, so it will be hidden) + NotImplemented // Option is not implemented (so also no available) + } + + public enum IntrusionVerticalWaterPressureType + { + Standard, + Linear, + FullHydroStatic, + HydroStatic, + SemiTimeDependent + } +} Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/Test/TestData/Gemeenten.sbn =================================================================== diff -u Binary files differ Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/FailureMechanismeParamatersMStab.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/FailureMechanismeParamatersMStab.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/FailureMechanismeParamatersMStab.cs (revision 3305) @@ -0,0 +1,107 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using Deltares.Geotechnics.Soils; +using Deltares.Geotechnics.SurfaceLines; +using Deltares.Standard; +using Deltares.Standard.Validation; + +namespace Deltares.Dam.Data +{ + public class FailureMechanismeParamatersMStab : IAssignable, ICloneable + { + /// + /// Additinal specifications/settings of calculation using MStab + /// + public FailureMechanismeParamatersMStab() + { + this.MStabParameters = new MStabParameters(); + this.IsStabilityCheckOnUplift = false; + } + public Location Location { get; set; } + public SurfaceLine2 SurfaceLine { get; set; } + public PLLines PLLines { get; set; } + public SoilProfile1D SoilProfile { get; set; } + public string SoilGeometry2DName { get; set; } + public double RiverLevel { get; set; } + public double DikeTableHeight { get; set; } + public double TrafficLoad { get; set; } + /// + /// Indicates whether in stability calculation a check on uplift will be performed before performin UpliftVan calculation. + /// Default it is false (set in constructor) + /// + public bool IsStabilityCheckOnUplift { get; set; } + public MStabDesignEmbankment Design { get; set; } + [Validate] + public MStabParameters MStabParameters { get; set; } + + /// + /// Checks whether all rerquired data is there. + /// + public bool IsComplete + { + get + { + return + !string.IsNullOrEmpty(this.MStabParameters.SoilDatabaseName) && + this.PLLines != null && + (this.SoilProfile != null || this.MStabParameters.GeometryCreationOptions.SoilGeometry2DFilename != "") && + this.Location != null && + this.SurfaceLine != null && + !string.IsNullOrEmpty(this.MStabParameters.ProjectFileName); + } + } + + /// + /// Performs the Assignment + /// + /// + public void Assign(FailureMechanismeParamatersMStab failureMechanismeParametersMStab) + { + this.Location = failureMechanismeParametersMStab.Location; + this.SurfaceLine = failureMechanismeParametersMStab.SurfaceLine; + this.SoilProfile = failureMechanismeParametersMStab.SoilProfile; + this.SoilGeometry2DName = failureMechanismeParametersMStab.SoilGeometry2DName; + this.PLLines = failureMechanismeParametersMStab.PLLines; + + this.RiverLevel = failureMechanismeParametersMStab.RiverLevel; + this.DikeTableHeight = failureMechanismeParametersMStab.DikeTableHeight; + this.TrafficLoad = failureMechanismeParametersMStab.TrafficLoad; ; + this.Design = failureMechanismeParametersMStab.Design; + + this.MStabParameters.Assign(failureMechanismeParametersMStab.MStabParameters); + } + + /// + /// Clones the object. + /// + /// FailureMechanismeParamatersMStab + public FailureMechanismeParamatersMStab Clone() + { + FailureMechanismeParamatersMStab failureMechanismeParamatersMStab = new FailureMechanismeParamatersMStab(); + failureMechanismeParamatersMStab.MStabParameters = this.MStabParameters.Clone(); + failureMechanismeParamatersMStab.Assign(this); + + return failureMechanismeParamatersMStab; + } + + } +} Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/CsvExportColumnAttribute.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/CsvExportColumnAttribute.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/CsvExportColumnAttribute.cs (revision 3305) @@ -0,0 +1,38 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +namespace Deltares.Dam.Data +{ + using System; + + [AttributeUsage(AttributeTargets.Property)] + public class CsvExportColumnAttribute : Attribute + { + public CsvExportColumnAttribute(string name, int index) + { + Name = name; + Index = index; + } + + public string Name { get; private set; } + public int Index { get; private set; } + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DtoAssembler/Xsd/FileIdentificationDefinition.xsd =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DtoAssembler/Xsd/FileIdentificationDefinition.xsd (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DtoAssembler/Xsd/FileIdentificationDefinition.xsd (revision 3305) @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/TimeSerie.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/TimeSerie.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/TimeSerie.cs (revision 3305) @@ -0,0 +1,240 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Collections.Generic; + +namespace Deltares.Dam.Data +{ + + public class TimeSerie + { + /// + /// List of parameter identifiers used in Fews timeseries + /// + public const string WaterLevelParameterId = "Waterlevel"; + public const string WaterLevelMeanParameterId = "WaterlevelMean"; + public const string WaterLevelStdParameterId = "WaterlevelStdev"; + public const string WaterLevelDistParameterId = "WaterlevelDistribution"; + public const string WaterPressureParameterId = "Waterpressure"; + public const string PiezoMetricHeadId = "PiezoMetricHead"; + + private readonly TimeStep timeStep; + //Bka: read only not possible to serialize to DB private readonly List entries; + private IList entries; + + public const double DefaultMissingValue = -999.0; + + public TimeSerie() + { + this.timeStep = new TimeStep(); + this.entries = new List(); + ForecastDateTime = DateTime.MinValue; + } + + public string Type { get; set; } + public string LocationId { get; set; } + public string ParameterId { get; set; } + public TimeStep TimeStep { get { return this.timeStep; } } + public DateTime StartDateTime { get; set; } + public DateTime EndDateTime { get; set; } + public DateTime ForecastDateTime { get; set; } + public double MissVal { get; set; } + public string LongName { get; set; } + public string StationName { get; set; } + public string Units { get; set; } + public string SourceOrganisation { get; set; } + public string SourceSystem { get; set; } + public string FileDescription { get; set; } + public DateTime? CreationDateTime { get; set; } + public string Region { get; set; } + + public virtual IList Entries + { + get { return this.entries; } + set { this.entries = value; } + } + + public string Comment { get; set; } + + /// + /// Creates a shallow copy of the current time serie and applies the map function to each of its entries + /// + /// The time serie entry function which maps uses the current value as input + /// Time serie (clone) with new calculated entries + public TimeSerie Map(Func function) + { + return this.Map(this.ParameterId, function); + } + + /// + /// Creates a shallow copy of the current time serie and applies the map function to each of its entries + /// + /// The (new) id of the parameter in the cloned time serie + /// The (new) location id of the cloned time serie + /// The time serie entry function which maps uses the current value as input + /// Time serie (clone) with new calculated entries + public TimeSerie Map(string parameterId, string locationId, Func function) + { + return Map(this, parameterId, locationId, function); + } + + /// + /// Creates a shallow copy of the current time serie and applies the map function to each of its entries + /// + /// The (new) id of the parameter in the cloned time serie + /// The time serie entry function which maps uses the current value as input + /// Time serie (clone) with new calculated entries + public TimeSerie Map(string parameterId, Func function) + { + return Map(this, parameterId, function); + } + + /// + /// Creates a shallow copy of the current time serie and applies the map function to each of its entries + /// + /// The time serie to map from + /// The (new) id of the parameter in the cloned time serie + /// The time serie entry function which maps uses the current value as input + /// Time serie (clone) with new calculated entries + public static TimeSerie Map(TimeSerie timeSerie, string parameterId, Func function) + { + return Map(timeSerie, parameterId, null, function); + } + + /// + /// Creates a shallow copy of the current time serie and applies the map function to each of its entries + /// + /// The time serie to map from + /// The (new) id of the parameter in the cloned time serie + /// The (new) location id of the cloned time serie + /// The time serie entry function which maps uses the current value as input + /// Time serie (clone) with new calculated entries + public static TimeSerie Map(TimeSerie timeSerie, string parameterId, string locationId, Func function) + { + var result = CreateTimeSerie(timeSerie, parameterId); + if (!(string.IsNullOrEmpty(locationId) || locationId.Trim() == "")) + result.LocationId = locationId; + + foreach (var entry in timeSerie.Entries) + result.Entries.Add(function(entry)); + return result; + } + + /// + /// Gets a shallow copy of the time serie without the time serie entries + /// + /// A copy of this time serie + public TimeSerie GetShallowCopy() + { + var serie = new TimeSerie + { + Type = Type, + ParameterId = ParameterId, + LocationId = LocationId, + StartDateTime = StartDateTime, + EndDateTime = EndDateTime, + ForecastDateTime = ForecastDateTime, + MissVal = MissVal, + LongName = LongName, + StationName = StationName, + SourceOrganisation = SourceOrganisation, + SourceSystem = SourceSystem, + FileDescription = FileDescription, + CreationDateTime = CreationDateTime, + Region = Region, + Units = Units, + TimeStep = + { + Multiplier = TimeStep.Multiplier, + Divider = TimeStep.Divider, + Unit = TimeStep.Unit + } + }; + + serie.Entries.Clear(); + return serie; + } + + public static TimeSerie CreateTimeSerie(string locationId) + { + var timeSerie = new TimeSerie + { + MissVal = DefaultMissingValue, + ParameterId = WaterLevelParameterId, + LocationId = locationId, + StationName = locationId, + Type = "instantaneous", + Units = "m", + Comment = "" + }; + + return timeSerie; + } + + + /// + /// Creates a time serie by copying data from the source time serie without + /// time serie entries (shallow copy) + /// + /// The source time serie used to copy from + /// The new parameter ID + /// A time serie copy without time entries + public static TimeSerie CreateTimeSerie(TimeSerie source, string parameterId) + { + var serie = source.GetShallowCopy(); + serie.ParameterId = parameterId; + serie.Units = "-"; + serie.Comment = ""; + return serie; + } + + public double GetValue(DateTime dateTime) + { + foreach (TimeSerieEntry entry in this.Entries) + { + if (entry.DateTime >= dateTime) + { + return entry.Value; + } + } + + return -1; + } + + public string GetNearestBasisFileName(DateTime dateTime) + { + string res = ""; + double mindiff = 1e99; + double diff = 0; + foreach (TimeSerieEntry entry in this.Entries) + { + diff = Math.Abs(entry.DateTime.ToFileTimeUtc() - dateTime.ToFileTimeUtc()); + if (diff < mindiff) + { + res = entry.BasisFileName; + mindiff = diff; + } + } + return res; + } + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/LogHelper.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/LogHelper.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/LogHelper.cs (revision 3305) @@ -0,0 +1,216 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU 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 log4net; +using log4net.Appender; +using log4net.Repository; + +namespace Deltares.Standard.Application +{ + /// + /// LogHelper is a utility class to simplify logging to different appenders. + /// This class uses log4net to delegate the actual logging. See the log4net + /// documentation to configure this API in the client application using either + /// the configuration file or programmaticaly. + /// + /// TODO: This logger should be able to log to EntLib too! + /// see http://stackoverflow.com/questions/710863/log4net-vs-nlog + /// + public class LogHelper + { + private readonly object sync = new object(); + private readonly List exceptions = new List(); + + /// + /// Creates a LogHelper class to simplify logging + /// + /// The target object to log for. This object type name will be used in the log + /// An instance of this helper + public static LogHelper Create(object obj) + { + if (obj == null) throw new ArgumentNullException("obj"); + return Create(obj.GetType()); + } + + /// + /// Creates a LogHelper to simplify logging. + /// + /// The target type to log for. + /// An instance of this helper + public static LogHelper Create(Type type) + { + return new LogHelper(log4net.LogManager.GetLogger(type)); + } + + /// + /// Creates a LogHelper class to simplify logging + /// + /// The target type to log for. + /// An instance of this helper + public static LogHelper Create() + { + return Create(typeof(T)); + } + + /// + /// Creates a LogHelper class to simplify logging + /// + /// The name. + /// + public static LogHelper Create(string name) + { + return new LogHelper(log4net.LogManager.GetLogger(name)); + } + + /// + /// Holds a reference to the log4net logger + /// + private readonly ILog logger; + + public LogHelper(ILog logger) + { + this.logger = logger; + } + + /// + /// Logs fatal messages if ALL, DEBUG, INFO, WARN, ERROR or FATAL is enabled in the config. + /// + /// The message. + /// The exception. + public void LogFatal(string message, Exception exception = null) + { + if (logger != null && logger.IsFatalEnabled) + logger.Fatal(message, exception); + + Add(exception); + } + + /// + /// Logs error messages if ALL, DEBUG, INFO, WARN or ERROR level is enabled in the config. + /// + /// The message. + /// The exception. + public void LogError(string message, Exception exception = null) + { + if (logger != null && logger.IsErrorEnabled) + logger.Error(message, exception); + + Add(exception); + } + + /// + /// Logs warning messages if ALL, DEBUG, INFO or WARN level is enabled in the config. + /// + /// The message. + /// The exception. + public void LogWarning(string message, Exception exception = null) + { + if (logger != null && logger.IsWarnEnabled) + logger.Warn(message, exception); + + Add(exception); + } + + /// + /// Logs info messages if ALL, DEBUG or INFO is enabled in the config. + /// + /// The message. + /// The exception. + public void LogInfo(string message, Exception exception = null) + { + if (logger != null && logger.IsInfoEnabled) + logger.Info(message, exception); + + Add(exception); + } + + /// + /// Logs debug messages if ALL or DEBUG is enabled in the config. + /// + /// The message. + /// The exception. + public void LogDebug(string message, Exception exception = null) + { + if (logger != null && logger.IsDebugEnabled) + logger.Debug(message, exception); + + Add(exception); + } + + /// + /// Flushes all appenders across the whole logging repository + /// + /// This call is in most cases not needed + public void Flush() + { + lock(sync) + { + ILoggerRepository rep = log4net.LogManager.GetRepository(); + foreach (IAppender appender in rep.GetAppenders()) + { + var buffered = appender as BufferingAppenderSkeleton; + if (buffered != null) + { + buffered.Flush(); + } + } + + exceptions.Clear(); + } + } + + /// + /// Clears the internal exception list + /// + public void Clear() + { + lock(sync) + { + exceptions.Clear(); + } + } + + /// + /// Gets a value indicating whether this instance has logged exceptions. + /// + /// + /// true if this instance has logged exceptions; otherwise, false. + /// + public bool HasLoggedExceptions + { + get { return exceptions.Count > 0; } + } + + /// + /// Adds the specified exception the internal list. + /// + /// The exception. + private void Add(Exception exception) + { + if (exception != null) + lock (sync) + exceptions.Add(exception); + } + + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Importers/LocationImportHelper.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Importers/LocationImportHelper.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Importers/LocationImportHelper.cs (revision 3305) @@ -0,0 +1,145 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU 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 Deltares.Geotechnics.Soils; +using Deltares.Standard.Extensions; + +namespace Deltares.Dam.Data.Importers +{ + internal static class LocationImportHelper + { + internal static PLLineCreationMethod ToPLLineCreationMethod(object value) + { + if (value == null) + throw new ArgumentNullException("value"); + + return ToPLLineCreationMethod(value.ToString()); + } + + internal static PLLineCreationMethod ToPLLineCreationMethod(string value) + { + if (string.IsNullOrEmpty(value) || value.Trim() == "") + throw new ArgumentException("value"); + + var translationTable = new Dictionary() + { + {"none", PLLineCreationMethod.None}, + {"expertknowledgelinearindike", PLLineCreationMethod.ExpertKnowledgeLinearInDike}, + {"expertknowledgerrd", PLLineCreationMethod.ExpertKnowledgeRRD}, + {"gaugeswithfallbacktoexpertknowledgerrd", PLLineCreationMethod.GaugesWithFallbackToExpertKnowledgeRRD} + }; + + var key = value.ToLowerInvariant(); + return key.ToEnumType(translationTable); + } + + internal static IntrusionVerticalWaterPressureType ToIntrusionVerticalWaterPressure(object value) + { + if (value == null) + throw new ArgumentNullException("value"); + + return ToIntrusionVerticalWaterPressure(value.ToString()); + } + + internal static IntrusionVerticalWaterPressureType ToIntrusionVerticalWaterPressure(string value) + { + if (string.IsNullOrEmpty(value) || value.Trim() == "") + throw new ArgumentException("value"); + + var translationTable = new Dictionary() + { + {"fullhydrostatic", IntrusionVerticalWaterPressureType.FullHydroStatic}, + {"hydrostatic", IntrusionVerticalWaterPressureType.HydroStatic}, + {"linear", IntrusionVerticalWaterPressureType.Linear}, + {"semitimedependent", IntrusionVerticalWaterPressureType.SemiTimeDependent}, + {"standard", IntrusionVerticalWaterPressureType.Standard} + }; + + var key = value.ToLowerInvariant(); + return key.ToEnumType(translationTable); + } + + internal static MStabZonesType ToMStabZonesTypeMethod(object value) + { + if (value == null) + throw new ArgumentNullException("value"); + + return ToMStabZonesTypeMethod(value.ToString()); + } + + /// + /// Convert string to stability zonetype. + /// + /// The value. + /// + internal static MStabZonesType ToMStabZonesTypeMethod(string value) + { + if (string.IsNullOrEmpty(value) || value.Trim() == "") + throw new ArgumentException("value"); + + var translationTable = new Dictionary() + { + {"nozones", MStabZonesType.NoZones}, + {"zoneareas", MStabZonesType.ZoneAreas}, + {"forbiddenzone", MStabZonesType.ForbiddenZone} + }; + var key = value.ToLowerInvariant(); + return key.ToEnumType(translationTable); + } + + /// + /// Converts an object type (which IS a string) to a StabilityDesignMethod + /// + /// The value to convert + /// + /// if is null + internal static StabilityDesignMethod ToStabilityDesignMethod(object value) + { + if (value == null) + throw new ArgumentNullException("value"); + + return ToStabilityDesignMethod(value.ToString()); + } + + + /// + /// Convert string to stability design method type. + /// + /// The value. + /// + internal static StabilityDesignMethod ToStabilityDesignMethod(string value) + { + if (string.IsNullOrEmpty(value) || value.Trim() == "") + throw new ArgumentException("value"); + + var translationTable = new Dictionary() + { + {"optimizedslopeandshoulderadaption", StabilityDesignMethod.OptimizedSlopeAndShoulderAdaption}, + {"slopeadaptionbeforeshoulderadaption", StabilityDesignMethod.SlopeAdaptionBeforeShoulderAdaption} + }; + + var key = value.ToLowerInvariant(); + return key.ToEnumType(translationTable); + } + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Specifications/SpecificationBaseAttribute.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Specifications/SpecificationBaseAttribute.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Specifications/SpecificationBaseAttribute.cs (revision 3305) @@ -0,0 +1,93 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU 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.Standard.Extensions; + +namespace Deltares.Standard.Specifications +{ + /// + /// Defines the abstract base class for the specification attributes + /// to derive more specific types from + /// + [AttributeUsage(AttributeTargets.Property | AttributeTargets.Property, Inherited = true, AllowMultiple = true)] + public abstract class SpecificationBaseAttribute : Attribute + { + private readonly ISpecification specification; + + protected SpecificationBaseAttribute(Type specification, params object[] args) + { + if (args == null && !specification.HasDefaultConstructor()) + throw new ArgumentException("The specification type should have a default constructor or supply "); + + if (!typeof(ISpecification).IsAssignableFrom(specification)) + throw new ArgumentException("The specification type should implement interface ISpecification"); + + this.specification = Activator.CreateInstance(specification, args) as ISpecification; + } + + protected SpecificationBaseAttribute(Type specification) : this(specification, null) + { + } + + /// + /// Gets or sets the name of the specification. + /// + /// If this property is not set, the name of the specification (when available) will be used + /// + /// The name. + /// + public string Name { get; set; } + + /// + /// Gets or sets the text in case the specification is not satisfied + /// + /// If this property is not set, the description of the specification (when available) will be used + /// + /// The not satisfied text. + /// + public string NotSatisfiedText { get; set; } + + + public string GroupName { get; set; } + + + // This is a positional argument + + public ISpecification Specification + { + get { return this.specification; } + } + } + + [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Property, Inherited = false, AllowMultiple = true)] + public sealed class SpecificationAttribute : SpecificationBaseAttribute + { + public SpecificationAttribute(Type specification, params object[] args) + : base(specification, args) + { + } + + public SpecificationAttribute(Type specification) : base(specification) + { + } + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Importers/ModelFactorCsvIdentifiers.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Importers/ModelFactorCsvIdentifiers.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Importers/ModelFactorCsvIdentifiers.cs (revision 3305) @@ -0,0 +1,51 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +namespace Deltares.Dam.Data.Importers +{ + public static class ModelFactorCsvIdentifiers + { + /// + /// safety_factor_piping + /// + public const string SafetyFactorPiping = "safety_factor_piping"; + + /// + /// safety_factor_stability_inner_slope + /// + public const string SafetyFactorStabilityInnerslope = "safety_factor_stability_inner_slope"; + + /// + /// safety_factor_stability_outer_slope + /// + public const string SafetyFactorStabilityOuterslope = "safety_factor_stability_outer_slope"; + + /// + /// uplift_criterion_piping + /// + public const string UpliftCriterionPiping = "uplift_criterion_piping"; + + /// + /// uplift_criterion_stability + /// + public const string UpliftCriterionStability = "uplift_criterion_stability"; + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/ImportDirector.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/ImportDirector.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/ImportDirector.cs (revision 3305) @@ -0,0 +1,47 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using Deltares.Dam.Data.DataPlugins.Configuration; + +namespace Deltares.Dam.Data +{ + public static class ImportDirector + { + public static WaterBoard Construct(string importFolder, DamEngine.Data.Standard.Calculation.ProgressDelegate progress) + { + + var damProject = new DamProject { DamProjectData = new DamProjectData() }; + var csvSource = new DataSource { DataSourceType = DataSourceType.CsvFiles, DataLocation = "" }; + var soilSource = new DataSource { DataSourceType = DataSourceType.MSoilBase, DataLocation = "./soilmaterials.mdb" }; + var container = new DataSourceContainer + { + DataSourceList = { + csvSource, soilSource + } + }; + + damProject.Import(importFolder, container, new[] { "Dike from CSV" }, DamProjectType.Design, progress); + + return damProject.DamProjectData.WaterBoard; + } + + } +} Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/IO/IExport.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/IO/IExport.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/IO/IExport.cs (revision 3305) @@ -0,0 +1,46 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +namespace Deltares.Dam.Data.IO +{ + public interface IExport + { + /// + /// Sets the name of the file without extension + /// + string Name { set; } + + /// + /// Sets the path of the output folder + /// + string Path { set; } + + /// + /// Sets the data to export + /// + object Data { set; } + + /// + /// Exports the data to the file(s) + /// + void Export(); + } +} Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Importers/LocationCharacteristicPointImporter.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Importers/LocationCharacteristicPointImporter.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Importers/LocationCharacteristicPointImporter.cs (revision 3305) @@ -0,0 +1,220 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU 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. + +//#define INCLUDE_ALL_LINE_TYPES + +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using Deltares.Geotechnics.SurfaceLines; +using Deltares.Maps; + +namespace Deltares.Dam.Data.Importers +{ + public class LocationCharacteristicPointImporter + { + // define file names + private const string CharacteristicLinesFile = "Kruin_dijkring10.shp"; + public const string CharacteristicLineAttributeName = "TEMP_ID"; + private const string LocationsFile = "Locations.shp"; + public const string LocationDikeAttributeName = "DIKERINGID"; + public const string LocationIDAttributeName = "LOCATION"; + + const string DikeTopPolderLineID = "kruin-binnen"; + const string DikeTopAtPolderLineID = "kruin-buiten"; + +#if INCLUDE_ALL_LINE_TYPES + private IEnumerable supportedLineTypes = new[] + { + DikeTopPolderLineID, + DikeTopAtPolderLineID + }; +#else + private readonly IEnumerable supportedLineTypes = new[] + { + DikeTopPolderLineID + }; +#endif + + + private string dataFolder; + private readonly IEnumerable locations; + + public LocationCharacteristicPointImporter(IEnumerable locations) + { + if (locations == null) + throw new ArgumentNullException("locations"); + + this.locations = locations; + } + + public LocationCharacteristicPointImporter(string dataFolder, IEnumerable locations): this(locations) + { + LoadRepositories(dataFolder); + } + + private void LoadRepositories(string dataFolder) + { + if (dataFolder == null) + throw new ArgumentNullException("dataFolder"); + + this.dataFolder = dataFolder; + + ValidateDataFolder(); + + var profileLocationsShapeFile = new ShapeFileLocation(this.dataFolder, LocationsFile); + // Get all the locations from the profile data shape file using a repository + this.ProfileLocationsRepository = FeatureRepository.CreateFromShapeFile(profileLocationsShapeFile); + + var shapeFile = new ShapeFileLocation(this.dataFolder, CharacteristicLinesFile); + this.CharacteristicLineRepository = FeatureRepository.CreateFromShapeFile(shapeFile); + + // Load and validate the attributes required to import the locations + ThrowWhenDataFileNotValid(this.ProfileLocationsRepository, LocationIDAttributeName, LocationsFile); + ThrowWhenDataFileNotValid(this.ProfileLocationsRepository, LocationDikeAttributeName, LocationsFile); + ThrowWhenDataFileNotValid(this.CharacteristicLineRepository, CharacteristicLineAttributeName, CharacteristicLinesFile); + } + + public IFeatureRepository CharacteristicLineRepository { get; set; } + public IFeatureRepository ProfileLocationsRepository { get; set; } + + /// + /// + /// + /// Preconditions: + /// - A valid data folder needs to given + /// - A set of "locations" with their characteristic points table and initialized id's available from the waterboard + /// - The required files need to be in the data folder (one for the characteristics points, + /// - A set of (characteristic) lines wich have to be retrieved from the files + /// + /// Postconditions: + /// - Some locations (the result of a join from the Location shape file and the existing location list from the Waterboard) have new characteristic point values + /// + /// + /// + /// + /// + /// + public void Import() + { + ThrowWhenRepositoryIsInvalid(this.CharacteristicLineRepository, CharacteristicLineAttributeName); + ThrowWhenRepositoryIsInvalid(this.ProfileLocationsRepository, LocationIDAttributeName); + ThrowWhenRepositoryIsInvalid(this.ProfileLocationsRepository, LocationDikeAttributeName); + + // TODO Test both repositories on geometry type (must be linestring) + + // Find the intersection points between the geometries + + var results = this.ProfileLocationsRepository.GetIntersectionPoints(this.CharacteristicLineRepository); + var work = results.GetResultsHavingCount(1); + foreach (var intersectionResult in work) + { + IFeature profile, characteristicLine; + if (intersectionResult.Source.Attributes.Exists(CharacteristicLineAttributeName)) + { + profile = intersectionResult.Target; + characteristicLine = intersectionResult.Source; + } + else + { + profile = intersectionResult.Source; + characteristicLine = intersectionResult.Target; + } + + string lineTypeID = characteristicLine.Attributes[CharacteristicLineAttributeName].ToString(); + if (!supportedLineTypes.Contains(lineTypeID)) + { + LogMessage(); + continue; + } + + var locationList = locations.ToList(); + var locname = profile.Attributes[LocationIDAttributeName].ToString(); + + // Get the surface line for the location having the location ID + var surfaceLine = locationList.First(loc => loc.Name == locname).SurfaceLine2; + + var dikeTopAtPolder = surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder); + dikeTopAtPolder.X = intersectionResult.IntersectionPoints.ElementAt(0).X; + dikeTopAtPolder.Y = intersectionResult.IntersectionPoints.ElementAt(0).Y; + } + } + + private static void LogMessage() + { + + } + + private static IEnumerable GetAllFiles(string path) + { + if (!Directory.Exists(path)) + throw new DirectoryNotFoundException(string.Format("Data folder '{0}' not found", path)); + + return Directory.GetFiles(path); + } + + private static bool IsRepositoryValid(IFeatureRepository repository, string attributeName) + { + if (repository == null) + return false; + + bool keyAndValueExist = !repository.Features.Any(geom => !geom.Attributes.Exists(attributeName) || geom.Attributes[attributeName] == null); + return keyAndValueExist; + } + + private static void ThrowWhenRepositoryIsInvalid(IFeatureRepository repository, string attributeName) + { + if (!IsRepositoryValid(repository, attributeName)) + { + throw new InvalidOperationException( + string.Format("The geometry repository doesn't contain the required attribute '{0}'", attributeName)); + } + } + + private static void ThrowWhenDataFileNotValid(IFeatureRepository repository, string attributeName, string fileName) + { + if (!IsRepositoryValid(repository, attributeName)) + { + throw new ArgumentException( + string.Format("The ShapeFile '{0}' doesn't contain the required attribute '{1}'", + fileName, attributeName)); + } + } + + private void ValidateDataFolder() + { + // Get all the shape files from the data folder + var files = GetAllFiles(this.dataFolder); + + // Validate the existence of the required files + + if (!files.Any(file => file.EndsWith(CharacteristicLinesFile))) + throw new FileNotFoundException(string.Format("The folder '{0}' doesn't contain the required file '{1}'", + this.dataFolder, CharacteristicLinesFile)); + + if (!files.Any(file => file.EndsWith(LocationsFile))) + throw new FileNotFoundException( + string.Format("The folder '{0}' doesn't contain the required file '{1}'", + this.dataFolder, LocationsFile)); + } + } +} Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/AttributeMapping.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/AttributeMapping.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/AttributeMapping.cs (revision 3305) @@ -0,0 +1,42 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU 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; + +namespace Deltares.Maps +{ + /// + /// Mapping helper class + /// + /// + public class AttributeMapping + { + public string Id { get; set; } + public string Name { get; set; } + public string File { get; set; } + public Action Action { get; set; } + + public override string ToString() + { + return Id + "|" + Name + "|" + File; + } + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/CsvImporters/CsvImporterCharacteristicPoints.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/CsvImporters/CsvImporterCharacteristicPoints.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/CsvImporters/CsvImporterCharacteristicPoints.cs (revision 3305) @@ -0,0 +1,498 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU 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.IO; +using System.Linq; +using System.Threading; +using Deltares.Geotechnics.SurfaceLines; +using Deltares.Standard.IO; +using Deltares.Standard.Language; +using LumenWorks.Framework.IO.Csv; + +namespace Deltares.Dam.Data.CsvImporters +{ + public class CsvImporterCharacteristicPointsException : ApplicationException + { + public CsvImporterCharacteristicPointsException(string message) + : base(message) + { + } + } + + public class CsvImporterCharacteristicPoints + { + private List characteristicPointsRecords = new List(); + private List errorMessages = new List(); + + public class CharPoint + { + public CharacteristicPointType Type { get; set; } + public double X { get; set; } + public double Y { get; set; } + public double Z { get; set; } + } + + public class CharacteristicPointsRecord + { + private IList points = new List(); + public string SurfaceLineId { get; set; } + + public IList Points + { + get { return points; } + set { points = value; } + } + + public int Volgnummer { get; set; } + } + + private void CheckColumn(int index, string fileName, string fieldName) + { + if (index < 0) + { + var csvHeaderFieldError = LocalizationManager.GetTranslatedText(this.GetType(), "csvHeaderFieldError"); + throw new CsvImporterCharacteristicPointsException(String.Format("{0} : {1} {2}", fileName, csvHeaderFieldError, + fieldName)); + } + } + + public CsvImporterCharacteristicPoints(string fileName) + { + const int minimalNumberOfColumns = 49; // Column 53 "volgnummer" is not mandatory; DTH removed + errorMessages.Clear(); + ThrowHelper.ThrowIfStringArgumentNullOrEmpty(fileName, StringResourceNames.CsvFileNotValid); + ThrowHelper.ThrowIfFileNotExist(fileName, StringResourceNames.CsvFileNotFound); + + var oldcur = Thread.CurrentThread.CurrentCulture; + try + { + Thread.CurrentThread.CurrentCulture = CsvReaderUtilities.DetermineCultureForFile(fileName); + using (CsvReader csv = new CsvReader(new StreamReader(fileName), true, ';')) + { + string[] headers = CsvImporterHelper.GetFieldHeaders(this, csv); + if (headers.Count() < minimalNumberOfColumns) + { + var csvHeaderColumnCountError = String.Format(LocalizationManager.GetTranslatedText(this.GetType(), "csvHeaderColumnCountError"), minimalNumberOfColumns); + throw new CsvImporterCharacteristicPointsException(String.Format("{0} : {1}", fileName, csvHeaderColumnCountError)); + } + + int SurfaceLineIdCol = CsvReaderUtilities.GetHeaderIndexByString(headers, CharacteristicPointCsvIdentifiers.LocationId); + if (SurfaceLineIdCol < 0) + { + // colIndexSurfaceLineId can be defined with 2 identifiers (surfaceLineId is deprecated, locationId is the new one) + SurfaceLineIdCol = CsvReaderUtilities.GetHeaderIndexByString(headers, + CharacteristicPointCsvIdentifiers.SurfaceLineId); + } + CheckColumn(SurfaceLineIdCol, fileName, CharacteristicPointCsvIdentifiers.SurfaceLineId); + + int XMaaiveldBinnenwaartsCol = CsvReaderUtilities.GetHeaderIndexByString(headers, + CharacteristicPointCsvIdentifiers + .SurfaceLevelInsideX); + CheckColumn(XMaaiveldBinnenwaartsCol, fileName, + CharacteristicPointCsvIdentifiers.SurfaceLevelInsideX); + + int YMaaiveldBinnenwaartsCol = CsvReaderUtilities.GetHeaderIndexByString(headers, + CharacteristicPointCsvIdentifiers + .SurfaceLevelInsideY); + CheckColumn(YMaaiveldBinnenwaartsCol, fileName, + CharacteristicPointCsvIdentifiers.SurfaceLevelInsideY); + + int ZMaaiveldBinnenwaartsCol = CsvReaderUtilities.GetHeaderIndexByString(headers, + CharacteristicPointCsvIdentifiers + .SurfaceLevelInsideZ); + CheckColumn(ZMaaiveldBinnenwaartsCol, fileName, + CharacteristicPointCsvIdentifiers.SurfaceLevelInsideZ); + + int XInsteekSlootPolderzijdeCol = CsvReaderUtilities.GetHeaderIndexByString(headers, + CharacteristicPointCsvIdentifiers + .DitchPolderSideX); + CheckColumn(XInsteekSlootPolderzijdeCol, fileName, + CharacteristicPointCsvIdentifiers.DitchPolderSideX); + + int YInsteekSlootPolderzijdeCol = CsvReaderUtilities.GetHeaderIndexByString(headers, + CharacteristicPointCsvIdentifiers + .DitchPolderSideY); + CheckColumn(YInsteekSlootPolderzijdeCol, fileName, + CharacteristicPointCsvIdentifiers.DitchPolderSideY); + + int ZInsteekSlootPolderzijdeCol = CsvReaderUtilities.GetHeaderIndexByString(headers, + CharacteristicPointCsvIdentifiers + .DitchPolderSideZ); + CheckColumn(ZInsteekSlootPolderzijdeCol, fileName, + CharacteristicPointCsvIdentifiers.DitchPolderSideZ); + + int XSlootbodemPolderzijdeCol = CsvReaderUtilities.GetHeaderIndexByString(headers, + CharacteristicPointCsvIdentifiers + .BottomDitchPolderSideX); + CheckColumn(XSlootbodemPolderzijdeCol, fileName, + CharacteristicPointCsvIdentifiers.BottomDitchPolderSideX); + + int YSlootbodemPolderzijdeCol = CsvReaderUtilities.GetHeaderIndexByString(headers, + CharacteristicPointCsvIdentifiers + .BottomDitchPolderSideY); + CheckColumn(YSlootbodemPolderzijdeCol, fileName, + CharacteristicPointCsvIdentifiers.BottomDitchPolderSideY); + + int ZSlootbodemPolderzijdeCol = CsvReaderUtilities.GetHeaderIndexByString(headers, + CharacteristicPointCsvIdentifiers + .BottomDitchPolderSideZ); + CheckColumn(ZSlootbodemPolderzijdeCol, fileName, + CharacteristicPointCsvIdentifiers.BottomDitchPolderSideZ); + + int XSlootbodemDijkzijdeCol = CsvReaderUtilities.GetHeaderIndexByString(headers, + CharacteristicPointCsvIdentifiers + .BottomDitchDikeSideX); + CheckColumn(XSlootbodemDijkzijdeCol, fileName, + CharacteristicPointCsvIdentifiers.BottomDitchDikeSideX); + + int YSlootbodemDijkzijdeCol = CsvReaderUtilities.GetHeaderIndexByString(headers, + CharacteristicPointCsvIdentifiers + .BottomDitchDikeSideY); + CheckColumn(YSlootbodemDijkzijdeCol, fileName, + CharacteristicPointCsvIdentifiers.BottomDitchDikeSideY); + + int ZSlootbodemDijkzijdeCol = CsvReaderUtilities.GetHeaderIndexByString(headers, + CharacteristicPointCsvIdentifiers + .BottomDitchDikeSideZ); + CheckColumn(ZSlootbodemDijkzijdeCol, fileName, + CharacteristicPointCsvIdentifiers.BottomDitchDikeSideZ); + + int XInsteekSlootDijkzijdeCol = CsvReaderUtilities.GetHeaderIndexByString(headers, + CharacteristicPointCsvIdentifiers + .DitchDikeSideX); + CheckColumn(XInsteekSlootDijkzijdeCol, fileName, CharacteristicPointCsvIdentifiers.DitchDikeSideX); + + int YInsteekSlootDijkzijdeCol = CsvReaderUtilities.GetHeaderIndexByString(headers, + CharacteristicPointCsvIdentifiers + .DitchDikeSideY); + // The click program by Erik Vastenburg now delivers "Y_Insteek_sloot dijkzijde" instead of the correct above definition + // Erik will change this in his program but for now, this wrong tag should also be recognized. + if (YInsteekSlootDijkzijdeCol < 0) + { + const string fieldY_Insteekslootdijkzijde = "Y_Insteek_sloot dijkzijde"; + YInsteekSlootDijkzijdeCol = CsvReaderUtilities.GetHeaderIndexByString(headers, + fieldY_Insteekslootdijkzijde); + CheckColumn(YInsteekSlootDijkzijdeCol, fileName, fieldY_Insteekslootdijkzijde); + } + else + { + CheckColumn(YInsteekSlootDijkzijdeCol, fileName, + CharacteristicPointCsvIdentifiers.DitchDikeSideY); + } + + int ZInsteekSlootDijkzijdeCol = CsvReaderUtilities.GetHeaderIndexByString(headers, CharacteristicPointCsvIdentifiers.DitchDikeSideZ); + CheckColumn(ZInsteekSlootDijkzijdeCol, fileName, CharacteristicPointCsvIdentifiers.DitchDikeSideZ); + + int XTeenDijkBinnenwaartsCol = CsvReaderUtilities.GetHeaderIndexByString(headers, CharacteristicPointCsvIdentifiers.DikeToeAtPolderX); + CheckColumn(XTeenDijkBinnenwaartsCol, fileName, CharacteristicPointCsvIdentifiers.DikeToeAtPolderX); + + int YTeenDijkBinnenwaartsCol = CsvReaderUtilities.GetHeaderIndexByString(headers, CharacteristicPointCsvIdentifiers.DikeToeAtPolderY); + CheckColumn(YTeenDijkBinnenwaartsCol, fileName, CharacteristicPointCsvIdentifiers.DikeToeAtPolderY); + + int ZTeenDijkBinnenwaartsCol = CsvReaderUtilities.GetHeaderIndexByString(headers, CharacteristicPointCsvIdentifiers.DikeToeAtPolderZ); + CheckColumn(ZTeenDijkBinnenwaartsCol, fileName, CharacteristicPointCsvIdentifiers.DikeToeAtPolderZ); + + int XKruinBinnenbermCol = CsvReaderUtilities.GetHeaderIndexByString(headers, CharacteristicPointCsvIdentifiers.TopShoulderInsideX); + CheckColumn(XKruinBinnenbermCol, fileName, CharacteristicPointCsvIdentifiers.TopShoulderInsideX); + + int YKruinBinnenbermCol = CsvReaderUtilities.GetHeaderIndexByString(headers, CharacteristicPointCsvIdentifiers.TopShoulderInsideY); + CheckColumn(YKruinBinnenbermCol, fileName, CharacteristicPointCsvIdentifiers.TopShoulderInsideY); + + int ZKruinBinnenbermCol = CsvReaderUtilities.GetHeaderIndexByString(headers, CharacteristicPointCsvIdentifiers.TopShoulderInsideZ); + CheckColumn(ZKruinBinnenbermCol, fileName, CharacteristicPointCsvIdentifiers.TopShoulderInsideZ); + + int XInsteekBinnenbermCol = CsvReaderUtilities.GetHeaderIndexByString(headers, CharacteristicPointCsvIdentifiers.InsteekShoulderInsideX); + CheckColumn(XInsteekBinnenbermCol, fileName, CharacteristicPointCsvIdentifiers.InsteekShoulderInsideX); + + int YInsteekBinnenbermCol = CsvReaderUtilities.GetHeaderIndexByString(headers, CharacteristicPointCsvIdentifiers.InsteekShoulderInsideY); + CheckColumn(YInsteekBinnenbermCol, fileName, CharacteristicPointCsvIdentifiers.InsteekShoulderInsideY); + + int ZInsteekBinnenbermCol = CsvReaderUtilities.GetHeaderIndexByString(headers, CharacteristicPointCsvIdentifiers.InsteekShoulderInsideZ); + CheckColumn(ZInsteekBinnenbermCol, fileName, CharacteristicPointCsvIdentifiers.InsteekShoulderInsideZ); + + int XKruinBinnentaludCol = CsvReaderUtilities.GetHeaderIndexByString(headers, CharacteristicPointCsvIdentifiers.DikeTopAtPolderX); + CheckColumn(XKruinBinnentaludCol, fileName, CharacteristicPointCsvIdentifiers.DikeTopAtPolderX); + + int YKruinBinnentaludCol = CsvReaderUtilities.GetHeaderIndexByString(headers, CharacteristicPointCsvIdentifiers.DikeTopAtPolderY); + CheckColumn(YKruinBinnentaludCol, fileName, CharacteristicPointCsvIdentifiers.DikeTopAtPolderY); + + int ZKruinBinnentaludCol = CsvReaderUtilities.GetHeaderIndexByString(headers, CharacteristicPointCsvIdentifiers.DikeTopAtPolderZ); + CheckColumn(ZKruinBinnentaludCol, fileName, CharacteristicPointCsvIdentifiers.DikeTopAtPolderZ); + + int XVerkeersbelastingKantBinnenwaartsCol = CsvReaderUtilities.GetHeaderIndexByString(headers, CharacteristicPointCsvIdentifiers.TrafficLoadInsideX); + CheckColumn(XVerkeersbelastingKantBinnenwaartsCol, fileName, CharacteristicPointCsvIdentifiers.TrafficLoadInsideX); + + int YVerkeersbelastingKantBinnenwaartsCol = CsvReaderUtilities.GetHeaderIndexByString(headers, CharacteristicPointCsvIdentifiers.TrafficLoadInsideY); + CheckColumn(YVerkeersbelastingKantBinnenwaartsCol, fileName, + CharacteristicPointCsvIdentifiers.TrafficLoadInsideY); + + int ZVerkeersbelastingKantBinnenwaartsCol = CsvReaderUtilities.GetHeaderIndexByString(headers, CharacteristicPointCsvIdentifiers.TrafficLoadInsideZ); + CheckColumn(ZVerkeersbelastingKantBinnenwaartsCol, fileName, CharacteristicPointCsvIdentifiers.TrafficLoadInsideZ); + + int XVerkeersbelastingKantBuitenwaartsCol = CsvReaderUtilities.GetHeaderIndexByString(headers, CharacteristicPointCsvIdentifiers.TrafficLoadOutsideX); + CheckColumn(XVerkeersbelastingKantBuitenwaartsCol, fileName, CharacteristicPointCsvIdentifiers.TrafficLoadOutsideX); + + int YVerkeersbelastingKantBuitenwaartsCol = CsvReaderUtilities.GetHeaderIndexByString(headers, CharacteristicPointCsvIdentifiers.TrafficLoadOutsideY); + CheckColumn(YVerkeersbelastingKantBuitenwaartsCol, fileName, CharacteristicPointCsvIdentifiers.TrafficLoadOutsideY); + + int ZVerkeersbelastingKantBuitenwaartsCol = CsvReaderUtilities.GetHeaderIndexByString(headers, CharacteristicPointCsvIdentifiers.TrafficLoadOutsideZ); + CheckColumn(ZVerkeersbelastingKantBuitenwaartsCol, fileName, CharacteristicPointCsvIdentifiers.TrafficLoadOutsideZ); + + int XKruinBuitentaludCol = CsvReaderUtilities.GetHeaderIndexByString(headers, CharacteristicPointCsvIdentifiers.DikeTopAtRiverX); + CheckColumn(XKruinBuitentaludCol, fileName, CharacteristicPointCsvIdentifiers.DikeTopAtRiverX); + + int YKruinBuitentaludCol = CsvReaderUtilities.GetHeaderIndexByString(headers, CharacteristicPointCsvIdentifiers.DikeTopAtRiverY); + CheckColumn(YKruinBuitentaludCol, fileName, CharacteristicPointCsvIdentifiers.DikeTopAtRiverY); + + int ZKruinBuitentaludCol = CsvReaderUtilities.GetHeaderIndexByString(headers, CharacteristicPointCsvIdentifiers.DikeTopAtRiverZ); + CheckColumn(ZKruinBuitentaludCol, fileName, CharacteristicPointCsvIdentifiers.DikeTopAtRiverZ); + + int XInsteekBuitenbermCol = CsvReaderUtilities.GetHeaderIndexByString(headers, CharacteristicPointCsvIdentifiers.InsteekShoulderOutsideX); + CheckColumn(XInsteekBuitenbermCol, fileName, CharacteristicPointCsvIdentifiers.InsteekShoulderOutsideX); + + int YInsteekBuitenbermCol = CsvReaderUtilities.GetHeaderIndexByString(headers, CharacteristicPointCsvIdentifiers.InsteekShoulderOutsideY); + CheckColumn(YInsteekBuitenbermCol, fileName, CharacteristicPointCsvIdentifiers.InsteekShoulderOutsideY); + + int ZInsteekBuitenbermCol = CsvReaderUtilities.GetHeaderIndexByString(headers, CharacteristicPointCsvIdentifiers.InsteekShoulderOutsideZ); + CheckColumn(ZInsteekBuitenbermCol, fileName, CharacteristicPointCsvIdentifiers.InsteekShoulderOutsideZ); + + int XKruinBuitenbermCol = CsvReaderUtilities.GetHeaderIndexByString(headers, CharacteristicPointCsvIdentifiers.TopShoulderOutsideX); + CheckColumn(XKruinBuitenbermCol, fileName, CharacteristicPointCsvIdentifiers.TopShoulderOutsideX); + + int YKruinBuitenbermCol = CsvReaderUtilities.GetHeaderIndexByString(headers, CharacteristicPointCsvIdentifiers.TopShoulderOutsideY); + CheckColumn(YKruinBuitenbermCol, fileName, CharacteristicPointCsvIdentifiers.TopShoulderOutsideY); + + int ZKruinBuitenbermCol = CsvReaderUtilities.GetHeaderIndexByString(headers, CharacteristicPointCsvIdentifiers.TopShoulderOutsideZ); + CheckColumn(ZKruinBuitenbermCol, fileName, CharacteristicPointCsvIdentifiers.TopShoulderOutsideZ); + + int XTeenDijkBuitenwaartsCol = CsvReaderUtilities.GetHeaderIndexByString(headers, CharacteristicPointCsvIdentifiers.DikeToeAtRiverX); + CheckColumn(XTeenDijkBuitenwaartsCol, fileName, CharacteristicPointCsvIdentifiers.DikeToeAtRiverX); + + int YTeenDijkBuitenwaartsCol = CsvReaderUtilities.GetHeaderIndexByString(headers, CharacteristicPointCsvIdentifiers.DikeToeAtRiverY); + CheckColumn(YTeenDijkBuitenwaartsCol, fileName, CharacteristicPointCsvIdentifiers.DikeToeAtRiverY); + + int ZTeenDijkBuitenwaartsCol = CsvReaderUtilities.GetHeaderIndexByString(headers, CharacteristicPointCsvIdentifiers.DikeToeAtRiverZ); + CheckColumn(ZTeenDijkBuitenwaartsCol, fileName, CharacteristicPointCsvIdentifiers.DikeToeAtRiverZ); + + int XMaaiveldBuitenwaartsCol = CsvReaderUtilities.GetHeaderIndexByString(headers, CharacteristicPointCsvIdentifiers.SurfaceLevelOutsideX); + CheckColumn(XMaaiveldBuitenwaartsCol, fileName, + CharacteristicPointCsvIdentifiers.SurfaceLevelOutsideX); + + int YMaaiveldBuitenwaartsCol = CsvReaderUtilities.GetHeaderIndexByString(headers, CharacteristicPointCsvIdentifiers.SurfaceLevelOutsideY); + CheckColumn(YMaaiveldBuitenwaartsCol, fileName, + CharacteristicPointCsvIdentifiers.SurfaceLevelOutsideY); + + int ZMaaiveldBuitenwaartsCol = CsvReaderUtilities.GetHeaderIndexByString(headers, CharacteristicPointCsvIdentifiers.SurfaceLevelOutsideZ); + CheckColumn(ZMaaiveldBuitenwaartsCol, fileName,CharacteristicPointCsvIdentifiers.SurfaceLevelOutsideZ); + + //optional, do not check + int XInsteekGeulCol = CsvReaderUtilities.GetHeaderIndexByString(headers, CharacteristicPointCsvIdentifiers.InsertRiverChannelX); + //optional, do not check + int YInsteekGeulCol = CsvReaderUtilities.GetHeaderIndexByString(headers, CharacteristicPointCsvIdentifiers.InsertRiverChannelY); + //optional, do not check + int ZInsteekGeulCol = CsvReaderUtilities.GetHeaderIndexByString(headers, CharacteristicPointCsvIdentifiers.InsertRiverChannelZ); + + //optional, do not check + int XTeenGeulCol = CsvReaderUtilities.GetHeaderIndexByString(headers, CharacteristicPointCsvIdentifiers.BottomRiverChannelX); + //optional, do not check + int YTeenGeulCol = CsvReaderUtilities.GetHeaderIndexByString(headers, CharacteristicPointCsvIdentifiers.BottomRiverChannelY); + //optional, do not check + int ZTeenGeulCol = CsvReaderUtilities.GetHeaderIndexByString(headers, CharacteristicPointCsvIdentifiers.BottomRiverChannelZ); + + // optional so do not check + const string fieldVolgnummer = "Volgnummer"; + int VolgnummerCol = CsvReaderUtilities.GetHeaderIndexByString(headers, fieldVolgnummer); + + + while (csv.ReadNextRecord()) + { + try + { + CharacteristicPointsRecord characteristicPoints = new CharacteristicPointsRecord(); + characteristicPoints.SurfaceLineId = csv[SurfaceLineIdCol]; + if (VolgnummerCol > -1) + { + characteristicPoints.Volgnummer = Convert.ToInt32(csv[VolgnummerCol]); + } + + CharPoint mbi = new CharPoint(); + mbi.Type = CharacteristicPointType.SurfaceLevelInside; + mbi.X = Convert.ToDouble(csv[XMaaiveldBinnenwaartsCol]); + mbi.Y = Convert.ToDouble(csv[YMaaiveldBinnenwaartsCol]); + mbi.Z = Convert.ToDouble(csv[ZMaaiveldBinnenwaartsCol]); + characteristicPoints.Points.Add(mbi); + + CharPoint isp = new CharPoint(); + isp.Type = CharacteristicPointType.DitchPolderSide; + isp.X = Convert.ToDouble(csv[XInsteekSlootPolderzijdeCol]); + isp.Y = Convert.ToDouble(csv[YInsteekSlootPolderzijdeCol]); + isp.Z = Convert.ToDouble(csv[ZInsteekSlootPolderzijdeCol]); + characteristicPoints.Points.Add(isp); + + CharPoint sbp = new CharPoint(); + sbp.Type = CharacteristicPointType.BottomDitchPolderSide; + sbp.X = Convert.ToDouble(csv[XSlootbodemPolderzijdeCol]); + sbp.Y = Convert.ToDouble(csv[YSlootbodemPolderzijdeCol]); + sbp.Z = Convert.ToDouble(csv[ZSlootbodemPolderzijdeCol]); + characteristicPoints.Points.Add(sbp); + + CharPoint sbd = new CharPoint(); + sbd.Type = CharacteristicPointType.BottomDitchDikeSide; + sbd.X = Convert.ToDouble(csv[XSlootbodemDijkzijdeCol]); + sbd.Y = Convert.ToDouble(csv[YSlootbodemDijkzijdeCol]); + sbd.Z = Convert.ToDouble(csv[ZSlootbodemDijkzijdeCol]); + characteristicPoints.Points.Add(sbd); + + CharPoint isd = new CharPoint(); + isd.Type = CharacteristicPointType.DitchDikeSide; + isd.X = Convert.ToDouble(csv[XInsteekSlootDijkzijdeCol]); + isd.Y = Convert.ToDouble(csv[YInsteekSlootDijkzijdeCol]); + isd.Z = Convert.ToDouble(csv[ZInsteekSlootDijkzijdeCol]); + characteristicPoints.Points.Add(isd); + + CharPoint tdbi = new CharPoint(); + tdbi.Type = CharacteristicPointType.DikeToeAtPolder; + tdbi.X = Convert.ToDouble(csv[XTeenDijkBinnenwaartsCol]); + tdbi.Y = Convert.ToDouble(csv[YTeenDijkBinnenwaartsCol]); + tdbi.Z = Convert.ToDouble(csv[ZTeenDijkBinnenwaartsCol]); + characteristicPoints.Points.Add(tdbi); + + CharPoint kbb = new CharPoint(); + kbb.Type = CharacteristicPointType.ShoulderTopInside; + kbb.X = Convert.ToDouble(csv[XKruinBinnenbermCol]); + kbb.Y = Convert.ToDouble(csv[YKruinBinnenbermCol]); + kbb.Z = Convert.ToDouble(csv[ZKruinBinnenbermCol]); + characteristicPoints.Points.Add(kbb); + + CharPoint ibb = new CharPoint(); + ibb.Type = CharacteristicPointType.ShoulderBaseInside; + ibb.X = Convert.ToDouble(csv[XInsteekBinnenbermCol]); + ibb.Y = Convert.ToDouble(csv[YInsteekBinnenbermCol]); + ibb.Z = Convert.ToDouble(csv[ZInsteekBinnenbermCol]); + characteristicPoints.Points.Add(ibb); + + CharPoint kbt = new CharPoint(); + kbt.Type = CharacteristicPointType.DikeTopAtPolder; + kbt.X = Convert.ToDouble(csv[XKruinBinnentaludCol]); + kbt.Y = Convert.ToDouble(csv[YKruinBinnentaludCol]); + kbt.Z = Convert.ToDouble(csv[ZKruinBinnentaludCol]); + characteristicPoints.Points.Add(kbt); + + CharPoint vbbi = new CharPoint(); + vbbi.Type = CharacteristicPointType.TrafficLoadInside; + vbbi.X = Convert.ToDouble(csv[XVerkeersbelastingKantBinnenwaartsCol]); + vbbi.Y = Convert.ToDouble(csv[YVerkeersbelastingKantBinnenwaartsCol]); + vbbi.Z = Convert.ToDouble(csv[ZVerkeersbelastingKantBinnenwaartsCol]); + characteristicPoints.Points.Add(vbbi); + + CharPoint vbbu = new CharPoint(); + vbbu.Type = CharacteristicPointType.TrafficLoadOutside; + vbbu.X = Convert.ToDouble(csv[XVerkeersbelastingKantBuitenwaartsCol]); + vbbu.Y = Convert.ToDouble(csv[YVerkeersbelastingKantBuitenwaartsCol]); + vbbu.Z = Convert.ToDouble(csv[ZVerkeersbelastingKantBuitenwaartsCol]); + characteristicPoints.Points.Add(vbbu); + + CharPoint kbut = new CharPoint(); + kbut.Type = CharacteristicPointType.DikeTopAtRiver; + kbut.X = Convert.ToDouble(csv[XKruinBuitentaludCol]); + kbut.Y = Convert.ToDouble(csv[YKruinBuitentaludCol]); + kbut.Z = Convert.ToDouble(csv[ZKruinBuitentaludCol]); + characteristicPoints.Points.Add(kbut); + + CharPoint ibub = new CharPoint(); + ibub.Type = CharacteristicPointType.ShoulderBaseOutside; + ibub.X = Convert.ToDouble(csv[XInsteekBuitenbermCol]); + ibub.Y = Convert.ToDouble(csv[YInsteekBuitenbermCol]); + ibub.Z = Convert.ToDouble(csv[ZInsteekBuitenbermCol]); + characteristicPoints.Points.Add(ibub); + + CharPoint kbub = new CharPoint(); + kbub.Type = CharacteristicPointType.ShoulderTopOutside; + kbub.X = Convert.ToDouble(csv[XKruinBuitenbermCol]); + kbub.Y = Convert.ToDouble(csv[YKruinBuitenbermCol]); + kbub.Z = Convert.ToDouble(csv[ZKruinBuitenbermCol]); + characteristicPoints.Points.Add(kbub); + + CharPoint tdbu = new CharPoint(); + tdbu.Type = CharacteristicPointType.DikeToeAtRiver; + tdbu.X = Convert.ToDouble(csv[XTeenDijkBuitenwaartsCol]); + tdbu.Y = Convert.ToDouble(csv[YTeenDijkBuitenwaartsCol]); + tdbu.Z = Convert.ToDouble(csv[ZTeenDijkBuitenwaartsCol]); + characteristicPoints.Points.Add(tdbu); + + CharPoint mbu = new CharPoint(); + mbu.Type = CharacteristicPointType.SurfaceLevelOutside; + mbu.X = Convert.ToDouble(csv[XMaaiveldBuitenwaartsCol]); + mbu.Y = Convert.ToDouble(csv[YMaaiveldBuitenwaartsCol]); + mbu.Z = Convert.ToDouble(csv[ZMaaiveldBuitenwaartsCol]); + characteristicPoints.Points.Add(mbu); + + if (XTeenGeulCol > 0) + { + CharPoint brc = new CharPoint(); + brc.Type = CharacteristicPointType.BottomRiverChannel; + brc.X = Convert.ToDouble(csv[XTeenGeulCol]); + brc.Y = Convert.ToDouble(csv[YTeenGeulCol]); + brc.Z = Convert.ToDouble(csv[ZTeenGeulCol]); + characteristicPoints.Points.Add(brc); + } + + if (XInsteekGeulCol > 0) + { + CharPoint irc = new CharPoint(); + irc.Type = CharacteristicPointType.InsertRiverChannel; + irc.X = Convert.ToDouble(csv[XInsteekGeulCol]); + irc.Y = Convert.ToDouble(csv[YInsteekGeulCol]); + irc.Z = Convert.ToDouble(csv[ZInsteekGeulCol]); + characteristicPoints.Points.Add(irc); + } + + characteristicPointsRecords.Add(characteristicPoints); + } + catch (Exception e) + { + var csvCharacteristicPointError = LocalizationManager.GetTranslatedText(this.GetType(), + "csvCharacteristicPointError"); + errorMessages.Add(csvCharacteristicPointError + e.Message); + } + } + } + } + finally + { + Thread.CurrentThread.CurrentCulture = oldcur; + } + } + + public List ImportedItems + { + get { return characteristicPointsRecords; } + } + + public List ErrorMessages + { + get { return errorMessages; } + set { errorMessages = value; } + } + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/CsvExportCharacteristicPoints.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/CsvExportCharacteristicPoints.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/CsvExportCharacteristicPoints.cs (revision 3305) @@ -0,0 +1,201 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU 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.Globalization; +using Deltares.Geotechnics.SurfaceLines; + +namespace Deltares.Dam.Data +{ + public class CsvExportCharacteristicPoints + { + private readonly SurfaceLine2 surfaceLine; + private readonly CsvExportSurfaceLineIdentifiers csvExportSurfaceLineIdentifiers; + public CsvExportCharacteristicPoints(CsvExportSurfaceLineIdentifiers csvExportSurfaceLineIdentifiers, SurfaceLine2 surfaceLine) + { + this.surfaceLine = surfaceLine; + this.csvExportSurfaceLineIdentifiers = csvExportSurfaceLineIdentifiers; + } + + string GetXfromPoint(SurfaceLine2 line, CharacteristicPointType type) + { + var point = line.CharacteristicPoints.GetGeometryPoint(type); + var result = -1.0; + if (point != null) + { + result = point.X; + } + return result.ToString("F3", CultureInfo.InvariantCulture); + } + + string GetYfromPoint(SurfaceLine2 line, CharacteristicPointType type) + { + var point = line.CharacteristicPoints.GetGeometryPoint(type); + var result = -1.0; + if (point != null) + { + result = point.Y; + } + return result.ToString("F3", CultureInfo.InvariantCulture); + } + + string GetZfromPoint(SurfaceLine2 line, CharacteristicPointType type) + { + var point = line.CharacteristicPoints.GetGeometryPoint(type); + var result = -1.0; + if (point != null) + { + result = point.Z; + } + return result.ToString("F3", CultureInfo.InvariantCulture); + } + + // The following 5 properties are identifiers and should be the first columns. + // Use negative identifers to add them as the first columns + [CsvExportColumn(CharacteristicPointCsvIdentifiers.LocationId, -4)] + public string LocationId { get { return (csvExportSurfaceLineIdentifiers == null) ? "" : csvExportSurfaceLineIdentifiers.LocationId; } } + + [CsvExportColumn(CsvExportSurfaceLineIdentifiers.CsvHeaderSoilProfileId, -3)] + public string SoilProfileId { get { return (csvExportSurfaceLineIdentifiers == null) ? "" : csvExportSurfaceLineIdentifiers.SoilProfileId; } } + + [CsvExportColumn(CsvExportSurfaceLineIdentifiers.CsvHeaderScenario, -2)] + public string Scenario { get { return (csvExportSurfaceLineIdentifiers == null) ? "" : csvExportSurfaceLineIdentifiers.Scenario; } } + + [CsvExportColumn(CsvExportSurfaceLineIdentifiers.CsvHeaderCalculationMechanism, -1)] + public string CalculationMechanism { get { return (csvExportSurfaceLineIdentifiers == null) ? "" : csvExportSurfaceLineIdentifiers.CalculationMechanism; } } + + [CsvExportColumn(CsvExportSurfaceLineIdentifiers.CsvHeaderCalculationModel, 0)] + public string CalculationModel { get { return (csvExportSurfaceLineIdentifiers == null) ? "" : csvExportSurfaceLineIdentifiers.CalculationModel; } } + + // The following properties are the real surfaceline characteristic points data + [CsvExportColumn(CharacteristicPointCsvIdentifiers.SurfaceLevelOutsideX, 2)] + public string SurfaceLevelOutsideX { get { return GetXfromPoint(surfaceLine, CharacteristicPointType.SurfaceLevelOutside); } } + [CsvExportColumn(CharacteristicPointCsvIdentifiers.SurfaceLevelOutsideY, 3)] + public string SurfaceLevelOutsideY { get { return GetYfromPoint(surfaceLine, CharacteristicPointType.SurfaceLevelOutside); } } + [CsvExportColumn(CharacteristicPointCsvIdentifiers.SurfaceLevelOutsideZ, 4)] + public string SurfaceLevelOutsideZ { get { return GetZfromPoint(surfaceLine, CharacteristicPointType.SurfaceLevelOutside); } } + + [CsvExportColumn(CharacteristicPointCsvIdentifiers.DikeToeAtRiverX, 5)] + public string DikeToeAtRiverX { get { return GetXfromPoint(surfaceLine, CharacteristicPointType.DikeToeAtRiver); } } + [CsvExportColumn(CharacteristicPointCsvIdentifiers.DikeToeAtRiverY, 6)] + public string DikeToeAtRiverY { get { return GetYfromPoint(surfaceLine, CharacteristicPointType.DikeToeAtRiver); } } + [CsvExportColumn(CharacteristicPointCsvIdentifiers.DikeToeAtRiverZ, 7)] + public string DikeToeAtRiverZ { get { return GetZfromPoint(surfaceLine, CharacteristicPointType.DikeToeAtRiver); } } + + [CsvExportColumn(CharacteristicPointCsvIdentifiers.TopShoulderOutsideX, 8)] + public string ShoulderTopOutsideX { get { return GetXfromPoint(surfaceLine, CharacteristicPointType.ShoulderTopOutside); } } + [CsvExportColumn(CharacteristicPointCsvIdentifiers.TopShoulderOutsideY, 9)] + public string ShoulderTopOutsideY { get { return GetYfromPoint(surfaceLine, CharacteristicPointType.ShoulderTopOutside); } } + [CsvExportColumn(CharacteristicPointCsvIdentifiers.TopShoulderOutsideZ, 10)] + public string ShoulderTopOutsideZ { get { return GetZfromPoint(surfaceLine, CharacteristicPointType.ShoulderTopOutside); } } + + [CsvExportColumn(CharacteristicPointCsvIdentifiers.InsteekShoulderOutsideX, 11)] + public string ShoulderBaseOutsideX { get { return GetXfromPoint(surfaceLine, CharacteristicPointType.ShoulderBaseOutside); } } + [CsvExportColumn(CharacteristicPointCsvIdentifiers.InsteekShoulderOutsideY, 12)] + public string ShoulderBaseOutsideY { get { return GetYfromPoint(surfaceLine, CharacteristicPointType.ShoulderBaseOutside); } } + [CsvExportColumn(CharacteristicPointCsvIdentifiers.InsteekShoulderOutsideZ, 13)] + public string ShoulderBaseOutsideZ { get { return GetZfromPoint(surfaceLine, CharacteristicPointType.ShoulderBaseOutside); } } + + [CsvExportColumn(CharacteristicPointCsvIdentifiers.DikeTopAtRiverX, 14)] + public string DikeTopAtRiverX { get { return GetXfromPoint(surfaceLine, CharacteristicPointType.DikeTopAtRiver); } } + [CsvExportColumn(CharacteristicPointCsvIdentifiers.DikeTopAtRiverY, 15)] + public string DikeTopAtRiverY { get { return GetYfromPoint(surfaceLine, CharacteristicPointType.DikeTopAtRiver); } } + [CsvExportColumn(CharacteristicPointCsvIdentifiers.DikeTopAtRiverZ, 16)] + public string DikeTopAtRiverZ { get { return GetZfromPoint(surfaceLine, CharacteristicPointType.DikeTopAtRiver); } } + + [CsvExportColumn(CharacteristicPointCsvIdentifiers.TrafficLoadOutsideX, 17)] + public string TrafficLoadOutsideX { get { return GetXfromPoint(surfaceLine, CharacteristicPointType.TrafficLoadOutside); } } + [CsvExportColumn(CharacteristicPointCsvIdentifiers.TrafficLoadOutsideY, 18)] + public string TrafficLoadOutsideY { get { return GetYfromPoint(surfaceLine, CharacteristicPointType.TrafficLoadOutside); } } + [CsvExportColumn(CharacteristicPointCsvIdentifiers.TrafficLoadOutsideZ, 19)] + public string TrafficLoadOutsideZ { get { return GetZfromPoint(surfaceLine, CharacteristicPointType.TrafficLoadOutside); } } + + [CsvExportColumn(CharacteristicPointCsvIdentifiers.TrafficLoadInsideX, 20)] + public string TrafficLoadInsideX { get { return GetXfromPoint(surfaceLine, CharacteristicPointType.TrafficLoadInside); } } + [CsvExportColumn(CharacteristicPointCsvIdentifiers.TrafficLoadInsideY, 21)] + public string TrafficLoadInsideY { get { return GetYfromPoint(surfaceLine, CharacteristicPointType.TrafficLoadInside); } } + [CsvExportColumn(CharacteristicPointCsvIdentifiers.TrafficLoadInsideZ, 22)] + public string TrafficLoadInsideZ { get { return GetZfromPoint(surfaceLine, CharacteristicPointType.TrafficLoadInside); } } + + [CsvExportColumn(CharacteristicPointCsvIdentifiers.DikeTopAtPolderX, 23)] + public string DikeTopAtPolderX { get { return GetXfromPoint(surfaceLine, CharacteristicPointType.DikeTopAtPolder); } } + [CsvExportColumn(CharacteristicPointCsvIdentifiers.DikeTopAtPolderY, 24)] + public string DikeTopAtPolderY { get { return GetYfromPoint(surfaceLine, CharacteristicPointType.DikeTopAtPolder); } } + [CsvExportColumn(CharacteristicPointCsvIdentifiers.DikeTopAtPolderZ, 25)] + public string DikeTopAtPolderZ { get { return GetZfromPoint(surfaceLine, CharacteristicPointType.DikeTopAtPolder); } } + + [CsvExportColumn(CharacteristicPointCsvIdentifiers.InsteekShoulderInsideX, 26)] + public string ShoulderBaseInsideX { get { return GetXfromPoint(surfaceLine, CharacteristicPointType.ShoulderBaseInside); } } + [CsvExportColumn(CharacteristicPointCsvIdentifiers.InsteekShoulderInsideY, 27)] + public string ShoulderBaseInsideY { get { return GetYfromPoint(surfaceLine, CharacteristicPointType.ShoulderBaseInside); } } + [CsvExportColumn(CharacteristicPointCsvIdentifiers.InsteekShoulderInsideZ, 28)] + public string ShoulderBaseInsideZ { get { return GetZfromPoint(surfaceLine, CharacteristicPointType.ShoulderBaseInside); } } + + [CsvExportColumn(CharacteristicPointCsvIdentifiers.TopShoulderInsideX, 29)] + public string ShoulderTopInsideX { get { return GetXfromPoint(surfaceLine, CharacteristicPointType.ShoulderTopInside); } } + [CsvExportColumn(CharacteristicPointCsvIdentifiers.TopShoulderInsideY, 30)] + public string ShoulderTopInsideY { get { return GetYfromPoint(surfaceLine, CharacteristicPointType.ShoulderTopInside); } } + [CsvExportColumn(CharacteristicPointCsvIdentifiers.TopShoulderInsideZ, 31)] + public string ShoulderTopInsideZ { get { return GetZfromPoint(surfaceLine, CharacteristicPointType.ShoulderTopInside); } } + + [CsvExportColumn(CharacteristicPointCsvIdentifiers.DikeToeAtPolderX, 32)] + public string DikeToeAtPolderX { get { return GetXfromPoint(surfaceLine, CharacteristicPointType.DikeToeAtPolder); } } + [CsvExportColumn(CharacteristicPointCsvIdentifiers.DikeToeAtPolderY, 33)] + public string DikeToeAtPolderY { get { return GetYfromPoint(surfaceLine, CharacteristicPointType.DikeToeAtPolder); } } + [CsvExportColumn(CharacteristicPointCsvIdentifiers.DikeToeAtPolderZ, 34)] + public string DikeToeAtPolderZ { get { return GetZfromPoint(surfaceLine, CharacteristicPointType.DikeToeAtPolder); } } + + [CsvExportColumn(CharacteristicPointCsvIdentifiers.DitchDikeSideX, 35)] + public string DitchDikeSideX { get { return GetXfromPoint(surfaceLine, CharacteristicPointType.DitchDikeSide); } } + [CsvExportColumn(CharacteristicPointCsvIdentifiers.DitchDikeSideY, 36)] + public string DitchDikeSideY { get { return GetYfromPoint(surfaceLine, CharacteristicPointType.DitchDikeSide); } } + [CsvExportColumn(CharacteristicPointCsvIdentifiers.DitchDikeSideZ, 37)] + public string DitchDikeSideZ { get { return GetZfromPoint(surfaceLine, CharacteristicPointType.DitchDikeSide); } } + + [CsvExportColumn(CharacteristicPointCsvIdentifiers.BottomDitchDikeSideX, 38)] + public string BottomDitchDikeSideX { get { return GetXfromPoint(surfaceLine, CharacteristicPointType.BottomDitchDikeSide); } } + [CsvExportColumn(CharacteristicPointCsvIdentifiers.BottomDitchDikeSideY, 39)] + public string BottomDitchDikeSideY { get { return GetYfromPoint(surfaceLine, CharacteristicPointType.BottomDitchDikeSide); } } + [CsvExportColumn(CharacteristicPointCsvIdentifiers.BottomDitchDikeSideZ, 40)] + public string BottomDitchDikeSideZ { get { return GetZfromPoint(surfaceLine, CharacteristicPointType.BottomDitchDikeSide); } } + + [CsvExportColumn(CharacteristicPointCsvIdentifiers.BottomDitchPolderSideX, 41)] + public string BottomDitchPolderSideX { get { return GetXfromPoint(surfaceLine, CharacteristicPointType.BottomDitchPolderSide); } } + [CsvExportColumn(CharacteristicPointCsvIdentifiers.BottomDitchPolderSideY, 42)] + public string BottomDitchPolderSideY { get { return GetYfromPoint(surfaceLine, CharacteristicPointType.BottomDitchPolderSide); } } + [CsvExportColumn(CharacteristicPointCsvIdentifiers.BottomDitchPolderSideZ, 43)] + public string BottomDitchPolderSideZ { get { return GetZfromPoint(surfaceLine, CharacteristicPointType.BottomDitchPolderSide); } } + + [CsvExportColumn(CharacteristicPointCsvIdentifiers.DitchPolderSideX, 44)] + public string DitchPolderSideX { get { return GetXfromPoint(surfaceLine, CharacteristicPointType.DitchPolderSide); } } + [CsvExportColumn(CharacteristicPointCsvIdentifiers.DitchPolderSideY, 45)] + public string DitchPolderSideY { get { return GetYfromPoint(surfaceLine, CharacteristicPointType.DitchPolderSide); } } + [CsvExportColumn(CharacteristicPointCsvIdentifiers.DitchPolderSideZ, 46)] + public string DitchPolderSideZ { get { return GetZfromPoint(surfaceLine, CharacteristicPointType.DitchPolderSide); } } + + [CsvExportColumn(CharacteristicPointCsvIdentifiers.SurfaceLevelInsideX, 47)] + public string SurfaceLevelInsideX { get { return GetXfromPoint(surfaceLine, CharacteristicPointType.SurfaceLevelInside); } } + [CsvExportColumn(CharacteristicPointCsvIdentifiers.SurfaceLevelInsideY, 48)] + public string SurfaceLevelInsideY { get { return GetYfromPoint(surfaceLine, CharacteristicPointType.SurfaceLevelInside); } } + [CsvExportColumn(CharacteristicPointCsvIdentifiers.SurfaceLevelInsideZ, 49)] + public string SurfaceLevelInsideZ { get { return GetZfromPoint(surfaceLine, CharacteristicPointType.SurfaceLevelInside); } } + + } +} Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Specifications/NotSpecification.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Specifications/NotSpecification.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Specifications/NotSpecification.cs (revision 3305) @@ -0,0 +1,52 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using Deltares.Dam.Data; + +namespace Deltares.Standard.Specifications +{ + public class NotSpecification : CompositeSpecification + { + private readonly ISpecification specification; + + public NotSpecification(ISpecification specification) + { + this.specification = specification; + } + + /// + /// Determines whether the candidate satisfies the specification. + /// + /// The candidate to test. + /// + /// true if the candidate satisfies the specification otherwise, false. + /// + public override bool IsSatisfiedBy(TCandidate candidate) + { + bool satisfied = !(this.specification.IsSatisfiedBy(candidate)); + if (!satisfied) + { + base.Description = this.specification.Description; + } + return satisfied; + } + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/ShapeFileReader.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/ShapeFileReader.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/ShapeFileReader.cs (revision 3305) @@ -0,0 +1,99 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU 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 NetTopologySuite.Geometries; +using NetTopologySuite.IO; + +namespace Deltares.Maps +{ + /// + /// Reads data from ShapeFiles + /// + /// + /// + public class ShapeFileReader : FileReader, IFeatureReader + { + public ShapeFileReader(IFile file) + : base(file) + { + } + + public ShapeFileReader(string fileName) + : base(new ShapeFileLocation(fileName)) + { + } + + /// + /// Gets or sets the value indicating geometry attribute or feature data should be read + /// If set to false the attribute data will be read form the .dbf file (default) + /// + public bool IgnoreAttributeData { get; set; } + + #region IFeatureReader Members + + public override IEnumerable Read() + { + using (var reader = new ShapefileDataReader(File.FullPath, GeometryFactory.Default)) + { + int count = 0; + + while (reader.Read()) + { + var feature = new NtsFeature + { + Geometry = reader.Geometry + }; + + if (!IgnoreAttributeData) + { + for (int i = 0; i < reader.DbaseHeader.NumFields; i++) + { + string colName = reader.DbaseHeader.Fields[i].Name; + object rowValue = reader.GetValue(i); + if (!feature.Attributes.Exists(colName)) + { + feature.Attributes.AddAttribute(colName, rowValue); + } + } + } + + count++; + yield return feature; + } + + if (reader.RecordCount != count) + { + string message = string.Format( + "The shape file '{0}' contains multiple records but only one (composite) shape. " + + "This is not yet supported. The current implementation of the shape file reader only works " + + "with shape files where each shape has exactly one database record.", + File.FullPath); + throw new NotSupportedException(message); + } + } + } + + #endregion + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Translations.xml =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Translations.xml (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Translations.xml (revision 3305) @@ -0,0 +1,599 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/Feature.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/Feature.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/Feature.cs (revision 3305) @@ -0,0 +1,265 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU 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 GeoAPI.Geometries; + +using NetTopologySuite.Geometries; +using NetTopologySuite.IO; + +namespace Deltares.Maps +{ + public class Feature : NetTopologySuite.Features.Feature, IFeature + { + private string geomWkt; + private IGeometry geometry; + private int? oldHashCode; + private Guid id; + + private Feature(string geomWkt) + { + this.geomWkt = geomWkt; + ParseGeometryString(); + IntializeGeometry(); + } + + private Feature(IGeometry geometry) + { + this.geometry = geometry; + WriteWktString(); + IntializeGeometry(); + } + + private void IntializeGeometry() + { + id = Guid.NewGuid(); + Attributes = new AttributesDictionary(); + } + + public virtual string WktFormat + { + get + { + if (geometry == null) + { + if (string.IsNullOrEmpty(geomWkt)) + { + WriteWktString(); + } + } + return geomWkt; + } + } + + /// + /// Gets the geometry. It parses the geometry wkt string when needed + /// + new public IGeometry Geometry + { + get + { + if (geometry == null) + { + if (!string.IsNullOrEmpty(geomWkt)) + { + ParseGeometryString(); + } + else + { + throw new InvalidOperationException( + "The internal state for this object is not valid. The internal geometry is empty."); + } + } + return geometry; + } + } + + public virtual Guid Id + { + get { return id; } + protected set { id = value; } + } + + public static Feature Create(string geomWkt, IEnumerable> attributes) + { + Feature feature = Create(geomWkt); + foreach (var attribute in attributes) + { + feature.AddAttribute(attribute.Key, attribute.Value); + } + return feature; + } + + /// + /// Creates a feature with a geometry parsed from the argument string + /// + /// The well known geometry string + /// A feature + public static Feature Create(string geomWkt) + { + if (geomWkt == null) + { + throw new ArgumentNullException("geomWkt"); + } + + try + { + return new Feature(geomWkt); + } + catch (Exception exception) + { + if (exception.Message.Contains("','")) + { + throw new ArgumentException( + "There was an error parsing the WKT geometry string, maybe due to an incorrect culture format conversion", + "geomWkt", + exception); + } + } + + throw new InvalidOperationException(); + } + + /// + /// Creates an empty feature with a point geometry + /// + /// + /// + /// + private static Feature Create(double x, double y) + { + return new Feature(new Point(x, y)); + } + + public static Feature Create(double x, double y, IEnumerable> attributes) + { + Feature feature = Create(x, y); + foreach (var attribute in attributes) + { + feature.AddAttribute(attribute.Key, attribute.Value); + } + return feature; + } + + public static Feature Create(Coordinate coordinate) + { + if (coordinate == null) + { + throw new ArgumentNullException("coordinate"); + } + + return new Feature(new Point(coordinate)); + } + + public static Feature Create(IGeometry geometry) + { + if (geometry == null) + { + throw new ArgumentNullException("geometry"); + } + + return new Feature(geometry); + } + + private void WriteWktString() + { + var writer = new WKTWriter(); + geomWkt = CultureHelper.InvokeWithUSCulture(() => writer.Write(geometry)); + } + + private void ParseGeometryString() + { + var reader = new WKTReader(GeometryFactory.Default); + geometry = reader.Read(geomWkt); + } + + public override bool Equals(object obj) + { + var other = obj as Feature; + if (other == null) + { + return false; + } + + // handle the case of comparing two NEW objects + bool otherIsTransient = Equals(other.Id, Guid.Empty); + bool thisIsTransient = Equals(Id, Guid.Empty); + if (otherIsTransient && thisIsTransient) + { + return ReferenceEquals(other, this); + } + + return other.Id.Equals(Id); + } + + public override int GetHashCode() + { + // Once we have a hash code we'll never change it + if (oldHashCode.HasValue) + { + return oldHashCode.Value; + } + + bool thisIsTransient = Equals(Id, Guid.Empty); + + // When this instance is transient, we use the base GetHashCode() + // and remember it, so an instance can NEVER change its hash code. + if (thisIsTransient) + { + oldHashCode = base.GetHashCode(); + return oldHashCode.Value; + } + return Id.GetHashCode(); + } + + public static bool operator ==(Feature x, Feature y) + { + return Equals(x, y); + } + + public static bool operator !=(Feature x, Feature y) + { + return !(x == y); + } + + public void AddAttribute(string attributeName, object value) + { + try + { + Attributes.AddAttribute(attributeName, value); + } + catch (ArgumentException exception) + { + throw new ArgumentException(attributeName, exception); + } + } + + public object this[string attributeName] + { + get { return Attributes[attributeName]; } + set { Attributes[attributeName] = value; } + } + + public object Tag { get; set; } + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Packages.xml =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Packages.xml (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Packages.xml (revision 3305) @@ -0,0 +1,43 @@ + + + + + + <module>0</module> + </package> + <package> + <title en="Basic, Uplift, Spencer" nl="Basic, Uplift, Spencer" /> + <module>0</module> + <module>1</module> + <module>2</module> + </package> + <package> + <title en="Full" nl="Volledig" /> + <module>0</module> + <module>1</module> + <module>2</module> + <module>3</module> + <module>5</module> + </package> +</packages> Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/CompositeJob.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/CompositeJob.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/CompositeJob.cs (revision 3305) @@ -0,0 +1,94 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System.Collections.Generic; +using System.ComponentModel; +using Deltares.Standard.Attributes; + +namespace Deltares.Dam.Data +{ + public class CompositeJob : DamJob + { + private IList<DamJob> jobs = new List<DamJob>(); + + public CompositeJob() + { + } + + public CompositeJob(object subject) : base(subject) + { + } + + public override bool? Run + { + get + { + bool containsRun = false; + bool containsNoRun = false; + + foreach (DamJob job in jobs) + { + if (!job.Run.HasValue) + { + containsRun = true; + containsNoRun = true; + } + else if (job.Run.Value) + { + containsRun = true; + } + else + { + containsNoRun = true; + } + } + + if (containsRun && containsNoRun) + { + return null; + } + else if (containsRun) + { + return true; + } + else + { + return false; + } + } + set + { + foreach (DamJob job in jobs) + { + job.Run = value; + } + } + } + + [Child] + [Browsable(false)] + public virtual IList<DamJob> Jobs + { + get { return jobs; } + set { jobs = value; } + } + } +} Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/IFeatureReader.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/IFeatureReader.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/IFeatureReader.cs (revision 3305) @@ -0,0 +1,32 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +namespace Deltares.Maps +{ + public interface IFeatureReader : IFileReader<IFile, IFeature> + { + /// <summary> + /// Gets or sets the value indicating geometry attribute or feature data should be read + /// If set to false the attribute data will be read form the .dbf file (default) + /// </summary> + bool IgnoreAttributeData { get; set; } + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/EntityFactoryException.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/EntityFactoryException.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/EntityFactoryException.cs (revision 3305) @@ -0,0 +1,52 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. +// +// 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.Dam.Data +{ + + [Serializable] + public class EntityFactoryException : Exception + { + public EntityFactoryException() + { + } + + public EntityFactoryException(string message) + : base(message) + { + } + + public EntityFactoryException(string message, Exception inner) + : base(message, inner) + { + } + + protected EntityFactoryException( + SerializationInfo info, + StreamingContext context) + : base(info, context) + { + } + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/Test/Services/PolygonAttributeImporterTest.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/Test/Services/PolygonAttributeImporterTest.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/Test/Services/PolygonAttributeImporterTest.cs (revision 3305) @@ -0,0 +1,313 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of the application DAM - UI. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Collections.Generic; +using System.Linq; + +using GeoAPI.Geometries; + +using NetTopologySuite.Geometries; + +using NUnit.Framework; + +using Rhino.Mocks; + +namespace Deltares.Maps.Tests.Services +{ + [TestFixture] + public class PolygonAttributeImporterTest + { + private MockRepository mocks; + private IFeatureRepository repository; + + #region Setup + + [TestFixtureSetUp] + public void FixtureSetup() + { + mocks = new MockRepository(); + repository = mocks.DynamicMock<IFeatureRepository>(); + } + + [TestFixtureTearDown] + public void FixtureTearDown() + { + } + + [SetUp] + public void TestSetup() + { + } + + [TearDown] + public void TestTearDown() + { + mocks.VerifyAll(); + } + + #endregion + + class MockTarget + { + public double X { get; set; } + public double Y { get; set; } + public double Property1 { get; set; } + } + + [Test] + public void Import_TargetPointIsInPolygon_TargetPropertyIsSet() + { + const string attributeName = "TrafLoad"; + const double expected = 20; + + var target = new MockTarget { X = 0, Y = 0 }; + + var geometryRepository = new FeatureRepository(); + var importer = new PolygonAttributeImporter<MockTarget> + { + XGetter = t => t.X, + YGetter = t => t.Y, + Targets = new[] { target }, + AttributeMappings = new[] + { + new AttributeMapping<MockTarget> + { + Name = attributeName, + Action = (t, value) => t.Property1 = (double)value + } + }, + AttributeRepository = geometryRepository + }; + + var square = new Polygon(new LinearRing(new[] + { + new Coordinate(-1, 1), + new Coordinate(1, 1), + new Coordinate(1, -1), + new Coordinate(-1, -1), + new Coordinate(-1, 1) + })); + + Feature geom = Feature.Create(square); + geom.AddAttribute(attributeName, expected); + geometryRepository.Add(geom); + + mocks.ReplayAll(); + + importer.Import(); + + Assert.AreEqual(expected, target.Property1); + } + + [Test] + public void Import_TargetPointTouchesPolygon_TargetPropertyIsSet() + { + const string attributeName = "TrafLoad"; + const double expected = 20; + + var target = new MockTarget { X = -1, Y = 1 }; + + var geometryRepository = new FeatureRepository(); + var importer = new PolygonAttributeImporter<MockTarget> + { + XGetter = t => t.X, + YGetter = t => t.Y, + Targets = new[] { target }, + AttributeMappings = new[] + { + new AttributeMapping<MockTarget> + { + Name = attributeName, + Action = (t, value) => t.Property1 = (double)value + } + }, + AttributeRepository = geometryRepository + }; + + var square = new Polygon(new LinearRing(new[] + { + new Coordinate(-1, 1), + new Coordinate(1, 1), + new Coordinate(1, -1), + new Coordinate(-1, -1), + new Coordinate(-1, 1) + })); + + Feature geom = Feature.Create(square); + geom.AddAttribute(attributeName, expected); + geometryRepository.Add(geom); + + mocks.ReplayAll(); + + importer.Import(); + + Assert.AreEqual(expected, target.Property1); + } + + [Test] + public void Import_TargetPointOutsidePolygon_TargetPropertyIsNotSet() + { + const string attributeName = "TrafLoad"; + const double expected = -999; + + var target = new MockTarget { X = -2, Y = 2, Property1 = expected }; + + var geometryRepository = new FeatureRepository(); + var importer = new PolygonAttributeImporter<MockTarget> + { + XGetter = t => t.X, + YGetter = t => t.Y, + Targets = new[] { target }, + AttributeMappings = new[] + { + new AttributeMapping<MockTarget> + { + Name = attributeName, + Action = (t, value) => t.Property1 = (double)value + } + }, + AttributeRepository = geometryRepository + }; + + var square = new Polygon(new LinearRing(new[] + { + new Coordinate(-1, 1), + new Coordinate(1, 1), + new Coordinate(1, -1), + new Coordinate(-1, -1), + new Coordinate(-1, 1) + })); + + Feature geom = Feature.Create(square); + geom.AddAttribute(attributeName, expected); + geometryRepository.Add(geom); + + mocks.ReplayAll(); + + importer.Import(); + + Assert.AreEqual(expected, target.Property1); + } + + [Test] + [ExpectedException(typeof(InvalidOperationException))] + public void Import_RepositoryContainsNoAttributes_Throws() + { + const string attributeName = "TrafLoad"; + + var target = new MockTarget { X = 0, Y = 0 }; + + var importer = new PolygonAttributeImporter<MockTarget> + { + XGetter = t => t.X, + YGetter = t => t.Y, + Targets = new[] { target }, + AttributeMappings = new[] + { + new AttributeMapping<MockTarget> + { + Name = attributeName, + Action = (t, value) => t.Property1 = (double)value + } + }, + AttributeRepository = repository + }; + + Expect.Call(repository.SupportedAttributes).Return(new List<string>()); + mocks.ReplayAll(); + + importer.Import(); + } + + [Test] + [ExpectedException(typeof(InvalidOperationException))] + public void Import_RepositoryNotSet_Throws() + { + const string attributeName = "TrafLoad"; + + var target = new MockTarget { X = 0, Y = 0 }; + + var importer = new PolygonAttributeImporter<MockTarget> + { + XGetter = t => t.X, + YGetter = t => t.Y, + Targets = new[] { target }, + AttributeMappings = new[] + { + new AttributeMapping<MockTarget> + { + Name = attributeName, + Action = (t, value) => t.Property1 = (double)value + } + } + }; + + mocks.ReplayAll(); + + importer.Import(); + } + + [Test] + public void Import_AttributeNameMissing_ErrorIsAddedToList() + { + const string attributeName = "TrafLoad"; + + var target = new MockTarget { X = 0, Y = 0 }; + + var importer = new PolygonAttributeImporter<MockTarget> + { + XGetter = t => t.X, + YGetter = t => t.Y, + Targets = new[] { target }, + AttributeMappings = + new[] + { + new AttributeMapping<MockTarget> { Name = attributeName, Action = (t, value) => t.Property1 = (double)value } + }, + AttributeRepository = repository + }; + + var square = new Polygon(new LinearRing(new[] + { + new Coordinate(-1, 1), + new Coordinate(1, 1), + new Coordinate(1, -1), + new Coordinate(-1, -1), + new Coordinate(-1, 1) + })); + + Feature feature = Feature.Create(square); + const string testAttribute = "test"; + feature.AddAttribute(testAttribute, new object()); + + //Expect.Call(repository.Features).Return(new[] { feature }); + Expect.Call(repository.Query((IGeometry)null)).IgnoreArguments().Return(new[] { feature }); + Expect.Call(repository.SupportedAttributes).Return(new[] { testAttribute }); + + mocks.ReplayAll(); + + importer.Import(); + + Assert.AreEqual(1, importer.Errors.OfType<AttributeMissingException>().Count()); + } + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Sensors/SensorTimeSeriesProcessorException.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Sensors/SensorTimeSeriesProcessorException.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Sensors/SensorTimeSeriesProcessorException.cs (revision 3305) @@ -0,0 +1,48 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. +// +// 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.Dam.Data.Sensors +{ + [Serializable] + public class SensorTimeSeriesProcessorException : Exception + { + public SensorTimeSeriesProcessorException() + { + } + + public SensorTimeSeriesProcessorException(string message) : base(message) + { + } + + public SensorTimeSeriesProcessorException(string message, Exception inner) : base(message, inner) + { + } + + protected SensorTimeSeriesProcessorException( + SerializationInfo info, + StreamingContext context) : base(info, context) + { + } + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Xsd/SoilProfileDataSet.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Xsd/SoilProfileDataSet.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Xsd/SoilProfileDataSet.cs (revision 3305) @@ -0,0 +1,29 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +namespace Deltares.Dam.Data.Xsd +{ + + + public partial class SoilProfileDataSet + { + } +} Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/PL1Line.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/PL1Line.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/PL1Line.cs (revision 3305) @@ -0,0 +1,57 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. +// +// 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.Geometry; + +namespace Deltares.Dam.Data +{ + + public class PL1LineException : Exception + { + public PL1LineException(string message) : base(message) + { + } + } + + public class PL1Line : GeometryPointString + { + public void Assign(PL1Line pl1Line) + { + this.Points.Clear(); + + foreach (GeometryPoint point in pl1Line.Points) + { + GeometryPoint newPoint = (GeometryPoint) point.Clone(); + this.Points.Add(newPoint); + } + } + + public PL1Line Clone() + { + var newPL1Line = new PL1Line(); + + newPL1Line.Assign(this); + + return newPL1Line; + } + } +} Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Importers/ICsvImporter.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Importers/ICsvImporter.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Importers/ICsvImporter.cs (revision 3305) @@ -0,0 +1,39 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +namespace Deltares.Dam.Data.Importers +{ + using System.Collections.Generic; + + public interface ICsvImporter + { + bool IsImportFileValid { get; } + } + + public interface IImporter<T> + { + IEnumerable<T> ImportedItems { get; } + } + + public interface ICsvImporter<T> : ICsvImporter, IImporter<T> + { + } +} Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Xsd/SoilProfileDataSet.xsc =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Xsd/SoilProfileDataSet.xsc (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Xsd/SoilProfileDataSet.xsc (revision 3305) @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="utf-8"?> +<!--<autogenerated> + This code was generated by a tool. + Changes to this file may cause incorrect behavior and will be lost if + the code is regenerated. +</autogenerated>--> +<DataSetUISetting Version="1.00" xmlns="urn:schemas-microsoft-com:xml-msdatasource"> + <TableUISettings /> +</DataSetUISetting> \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Properties/Settings.Designer.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Properties/Settings.Designer.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Properties/Settings.Designer.cs (revision 3305) @@ -0,0 +1,317 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. +// +// 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. + +//------------------------------------------------------------------------------ +// <auto-generated> +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// </auto-generated> +//------------------------------------------------------------------------------ + +namespace Deltares.Dam.Data.Properties { + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default { + get { + return defaultInstance; + } + } + + [global::System.Configuration.ApplicationScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("segments")] + public string SegmentImportFileName { + get { + return ((string)(this["SegmentImportFileName"])); + } + } + + [global::System.Configuration.ApplicationScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("locations")] + public string LocationImportFileName { + get { + return ((string)(this["LocationImportFileName"])); + } + } + + [global::System.Configuration.ApplicationScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("soilprofiles")] + public string SoilProfileImportFileName { + get { + return ((string)(this["SoilProfileImportFileName"])); + } + } + + [global::System.Configuration.ApplicationScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("surfacelines")] + public string SurfaceLineImportFileName { + get { + return ((string)(this["SurfaceLineImportFileName"])); + } + } + + [global::System.Configuration.ApplicationScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("characteristicpoints")] + public string CharacteristicPointsImportFileName { + get { + return ((string)(this["CharacteristicPointsImportFileName"])); + } + } + + [global::System.Configuration.ApplicationScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("csv")] + public string ImportFileExtension { + get { + return ((string)(this["ImportFileExtension"])); + } + } + + [global::System.Configuration.ApplicationScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("Soilbase\\soilbase.mdb")] + public string SoilDatabaseFile { + get { + return ((string)(this["SoilDatabaseFile"])); + } + } + + [global::System.Configuration.ApplicationScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("modelparameters")] + public string ModelParametersImportFileName { + get { + return ((string)(this["ModelParametersImportFileName"])); + } + } + + [global::System.Configuration.ApplicationScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("0.66")] + public double IJkdijkPipingLengthPredictionParameter { + get { + return ((double)(this["IJkdijkPipingLengthPredictionParameter"])); + } + } + + [global::System.Configuration.ApplicationScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("pl1lines")] + public string PL1LineImportFileName { + get { + return ((string)(this["PL1LineImportFileName"])); + } + } + + [global::System.Configuration.ApplicationScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("gauges")] + public string GaugesImportFileName { + get { + return ((string)(this["GaugesImportFileName"])); + } + } + + [global::System.Configuration.ApplicationScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute(".\\DGeoStability.exe")] + public string MStabExePath { + get { + return ((string)(this["MStabExePath"])); + } + } + + [global::System.Configuration.ApplicationScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute(".\\GeoStudio.exe")] + public string SlopeWExePath { + get { + return ((string)(this["SlopeWExePath"])); + } + } + + [global::System.Configuration.ApplicationScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("Automatic")] + public global::Deltares.Dam.Data.GridSizeDetermination SlipCircleGridSizeDetermination { + get { + return ((global::Deltares.Dam.Data.GridSizeDetermination)(this["SlipCircleGridSizeDetermination"])); + } + } + + [global::System.Configuration.ApplicationScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("36")] + public int SlipCircleUpliftVanLeftGridVerticalPointCount { + get { + return ((int)(this["SlipCircleUpliftVanLeftGridVerticalPointCount"])); + } + } + + [global::System.Configuration.ApplicationScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("2")] + public double SlipCircleUpliftVanLeftGridVerticalPointDistance { + get { + return ((double)(this["SlipCircleUpliftVanLeftGridVerticalPointDistance"])); + } + } + + [global::System.Configuration.ApplicationScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("14")] + public int SlipCircleUpliftVanLeftGridHorizontalPointCount { + get { + return ((int)(this["SlipCircleUpliftVanLeftGridHorizontalPointCount"])); + } + } + + [global::System.Configuration.ApplicationScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("2")] + public double SlipCircleUpliftVanLeftGridHorizontalPointDistance { + get { + return ((double)(this["SlipCircleUpliftVanLeftGridHorizontalPointDistance"])); + } + } + + [global::System.Configuration.ApplicationScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("3")] + public int SlipCircleUpliftVanRightGridVerticalPointCount { + get { + return ((int)(this["SlipCircleUpliftVanRightGridVerticalPointCount"])); + } + } + + [global::System.Configuration.ApplicationScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("2")] + public double SlipCircleUpliftVanRightGridVerticalPointDistance { + get { + return ((double)(this["SlipCircleUpliftVanRightGridVerticalPointDistance"])); + } + } + + [global::System.Configuration.ApplicationScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("6")] + public int SlipCircleUpliftVanRightGridHorizontalPointCount { + get { + return ((int)(this["SlipCircleUpliftVanRightGridHorizontalPointCount"])); + } + } + + [global::System.Configuration.ApplicationScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("2")] + public double SlipCircleUpliftVanRightGridHorizontalPointDistance { + get { + return ((double)(this["SlipCircleUpliftVanRightGridHorizontalPointDistance"])); + } + } + + [global::System.Configuration.ApplicationScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("10")] + public int SlipCircleBishopGridVerticalPointCount { + get { + return ((int)(this["SlipCircleBishopGridVerticalPointCount"])); + } + } + + [global::System.Configuration.ApplicationScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("2.5")] + public double SlipCircleBishopGridVerticalPointDistance { + get { + return ((double)(this["SlipCircleBishopGridVerticalPointDistance"])); + } + } + + [global::System.Configuration.ApplicationScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("10")] + public int SlipCircleBishopGridHorizontalPointCount { + get { + return ((int)(this["SlipCircleBishopGridHorizontalPointCount"])); + } + } + + [global::System.Configuration.ApplicationScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("2.5")] + public double SlipCircleBishopGridHorizontalPointDistance { + get { + return ((double)(this["SlipCircleBishopGridHorizontalPointDistance"])); + } + } + + [global::System.Configuration.ApplicationScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("OnBoundaryLines")] + public global::Deltares.Dam.Data.TangentLinesDefinition SlipCircleUpliftVanTangentLinesDefinition { + get { + return ((global::Deltares.Dam.Data.TangentLinesDefinition)(this["SlipCircleUpliftVanTangentLinesDefinition"])); + } + } + + [global::System.Configuration.ApplicationScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("0.25")] + public double SlipCircleUpliftVanTangentLinesDistance { + get { + return ((double)(this["SlipCircleUpliftVanTangentLinesDistance"])); + } + } + + [global::System.Configuration.ApplicationScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("OnBoundaryLines")] + public global::Deltares.Dam.Data.TangentLinesDefinition SlipCircleBishopTangentLinesDefinition { + get { + return ((global::Deltares.Dam.Data.TangentLinesDefinition)(this["SlipCircleBishopTangentLinesDefinition"])); + } + } + + [global::System.Configuration.ApplicationScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("0.25")] + public double SlipCircleBishopTangentLinesDistance { + get { + return ((double)(this["SlipCircleBishopTangentLinesDistance"])); + } + } + } +} Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.DamClientsLibrary.Version/Deltares.DamClientsLibrary.Version.csproj =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.DamClientsLibrary.Version/Deltares.DamClientsLibrary.Version.csproj (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.DamClientsLibrary.Version/Deltares.DamClientsLibrary.Version.csproj (revision 3305) @@ -0,0 +1,63 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProjectGuid>{48691761-637B-4EFF-A04C-2047E5FA9843}</ProjectGuid> + <OutputType>Library</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>Deltares.DamClientsLibrary.Version</RootNamespace> + <AssemblyName>Deltares.DamClientsLibrary.Version</AssemblyName> + <TargetFrameworkVersion>v4.5</TargetFrameworkVersion> + <FileAlignment>512</FileAlignment> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'"> + <DebugSymbols>true</DebugSymbols> + <OutputPath>..\..\bin\Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE</DefineConstants> + <DebugType>full</DebugType> + <PlatformTarget>x86</PlatformTarget> + <ErrorReport>prompt</ErrorReport> + <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'"> + <OutputPath>..\..\bin\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <Optimize>true</Optimize> + <DebugType>pdbonly</DebugType> + <PlatformTarget>x86</PlatformTarget> + <ErrorReport>prompt</ErrorReport> + <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet> + </PropertyGroup> + <ItemGroup> + <Reference Include="System" /> + <Reference Include="System.Core" /> + <Reference Include="System.Xml.Linq" /> + <Reference Include="System.Data.DataSetExtensions" /> + <Reference Include="Microsoft.CSharp" /> + <Reference Include="System.Data" /> + <Reference Include="System.Net.Http" /> + <Reference Include="System.Xml" /> + </ItemGroup> + <ItemGroup> + <Compile Include="Properties\AssemblyInfo.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="..\Copying.GPL.licenseheader"> + <Link>Copying.GPL.licenseheader</Link> + </None> + <None Include="GlobalAssembly.cs.svn" /> + </ItemGroup> + <Import Project="$(ProjectDir)..\build\Deltares.DamClientsLibrary.Version.targets" /> + <PropertyGroup> + <PreBuildEvent>"$(ProjectDir)..\..\..\utils\svn_insert_version.cmd" "$(ProjectDir)" GlobalAssembly.cs.svn GlobalAssembly.cs</PreBuildEvent> + </PropertyGroup> + <!-- To modify your build process, add your task inside one of the targets below and uncomment it. + Other similar extension points exist, see Microsoft.Common.targets. + <Target Name="BeforeBuild"> + </Target> + <Target Name="AfterBuild"> + </Target> + --> +</Project> \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.DamClientsLibrary.Version/GlobalAssembly.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.DamClientsLibrary.Version/GlobalAssembly.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.DamClientsLibrary.Version/GlobalAssembly.cs (revision 3305) @@ -0,0 +1,13 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Deltares")] +[assembly: AssemblyCopyright("Copyright © Deltares 2019")] +[assembly: AssemblyProduct("DAM (Dijksterkte Analyse Module)")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +[assembly: AssemblyVersion("19.1.0.0")] +[assembly: AssemblyFileVersion("19.1.0.0")] Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Specifications/MaximumAttribute.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Specifications/MaximumAttribute.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Specifications/MaximumAttribute.cs (revision 3305) @@ -0,0 +1,41 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. +// +// 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; + +namespace Deltares.Standard.Specifications +{ + [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, Inherited = false, AllowMultiple = true)] + public sealed class MaximumAttribute : Attribute + { + private readonly double attribteValue; + + public MaximumAttribute(double maxValue) + { + this.attribteValue = maxValue; + } + + public double AttributeValue + { + get { return this.attribteValue; } + } + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/ICalculator.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/ICalculator.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/ICalculator.cs (revision 3305) @@ -0,0 +1,33 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +namespace Deltares.Dam.Data +{ + public interface ICalculator + { + double? Calculate(params object[] args); + } + + public interface ICalculator<in T> : ICalculator + { + double? Calculate(T args); + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Sensors/Specifications/PolderLevelSensorSpecification.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Sensors/Specifications/PolderLevelSensorSpecification.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Sensors/Specifications/PolderLevelSensorSpecification.cs (revision 3305) @@ -0,0 +1,33 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using Deltares.Standard.Specifications; + +namespace Deltares.Dam.Data.Sensors.Specifications +{ + internal class PolderLevelSensorSpecification : PredicateSpecification<Sensor> + { + public PolderLevelSensorSpecification() : + base(s => s.Type == SensorType.PolderLevel) + { + } + } +} Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DtoAssembler/DtoAssembler.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DtoAssembler/DtoAssembler.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DtoAssembler/DtoAssembler.cs (revision 3305) @@ -0,0 +1,269 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. +// +// 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.IO; +using System.Linq; +using System.Reflection; +using System.Xml.Linq; +using Deltares.Standard.Extensions; +using Deltares.Standard.IO.DtoAssembler; + +namespace Deltares.Standard +{ + + #region DtoAssembler<TDomainObject, TDataTransferObject> definition + + /// <summary> + /// Default implementation for the <see cref="IDtoAssembler"/> interface + /// </summary> + /// <typeparam name="T">The domain object type</typeparam> + public abstract class DtoAssembler<TDomainObject, TDataTransferObject> : IDtoAssembler<TDomainObject, TDataTransferObject> + where TDomainObject : new() + { + /// <summary> + /// Holds the property mappings + /// </summary> + private DtoPropertyAttributeMap map = new DtoPropertyAttributeMap(); + + /// <summary> + /// Gets the property mappings collection + /// </summary> + protected DtoPropertyAttributeMap Mappings + { + get { return this.map; } + } + + #region IDtoAssembler<TDomainObject,TDataTransferObject> Members + + /// <summary> + /// + /// </summary> + /// <param name="dtoObj"></param> + /// <returns></returns> + public abstract TDomainObject CreateDomainObject(TDataTransferObject dtoObj); + + /// <summary> + /// + /// </summary> + /// <param name="domainObj"></param> + /// <returns></returns> + public abstract TDataTransferObject CreateDataTransferObject(TDomainObject domainObj); + + #endregion + + /// <summary> + /// + /// </summary> + protected void InitializeMappings() + { + var tmp = new TDomainObject(); + this.map.AddOrUpdateRange(tmp.ToPropertyMap()); + } + + /// <summary> + /// + /// </summary> + protected void InitializeMappings(string elementName, XDocument xsdReferenceDocument) + { + var tmp = new TDomainObject(); + IEnumerable<DtoPropertyAttriubteMapping> tmpMap = tmp.ToPropertyMap(elementName, xsdReferenceDocument); + this.map.AddOrUpdateRange(tmpMap); + } + + /// <summary> + /// Adds or updates a property-to-attribute mapping item into the property map + /// </summary> + /// <param name="propertyName">The name of the property</param> + /// <param name="attributeName">The name of the attribute to map to</param> + protected void AddOrUpdateMapping(string propertyName, string attributeName) + { + this.AddOrUpdateMapping(propertyName, attributeName, DtoPropertyImportance.Optional); + } + + /// <summary> + /// Adds or updates a property-to-attribute mapping item into the property map + /// </summary> + /// <param name="propertyName">The name of the property</param> + /// <param name="attributeName">The name of the attribute to map to</param> + /// <param name="importance">The usage or importance of the value i.e. reguired or optional</param> + protected void AddOrUpdateMapping(string propertyName, string attributeName, DtoPropertyImportance importance) + { + if (!propertyName.HasValidStringValue()) + throw new DtoPropertyMapException("propertyName is not valid (empty or null)"); + + bool q = (from x in new TDomainObject().GetType().GetProperties() + where x.Name == propertyName + select x).Any(); + + if (!q) + throw new DtoPropertyMapException("The property you want to add or update doesnt exist in the property list of the domain object."); + + this.Mappings.AddOrUpdate(propertyName, attributeName, importance); + } + } + + #endregion + + #region DtoAssembler<TDomainObject, XElement> + + /// <summary> + /// Default implementation for the <see cref="IDtoAssembler"/> interface + /// </summary> + /// <remarks> + /// This base class inherits from <see cref="DtoAssembler"/> this class just fixes + /// the dto type to XElement + /// </remarks> + /// <typeparam name="T">The domain object type</typeparam> + public abstract class DtoAssembler<TDomainObject> : DtoAssembler<TDomainObject, XElement>, IDtoAssembler<TDomainObject> + where TDomainObject : new() + { + /// <summary> + /// Initializes a new instance of the DtoAssembler class + /// </summary> + /// <param name="elementName">Sets the element name</param> + /// <param name="xsdStream">The text reader stream for reading in ther xsd file which is embedded as an resource</param> + public DtoAssembler(string elementName, Stream xsdStream) + : this(elementName, null, xsdStream) + { + } + + /// <summary> + /// Initializes a new instance of the DtoAssembler class + /// </summary> + /// <param name="elementName">Sets the element name</param> + /// <param name="xsdStream">The text reader stream for reading in ther xsd file which is embedded as an resource</param> + public DtoAssembler(string elementName, string elementNamespace) + : this(elementName, elementNamespace, null) + { + } + + /// <summary> + /// Initializes a new instance of the DtoAssembler class + /// </summary> + /// <param name="elementName">Sets the element name</param> + /// <param name="xsdStream">The text reader stream for reading in ther xsd file which is embedded as an resource</param> + public DtoAssembler(string elementName, string elementNamespace, Stream xsdStream) + { + this.ElementName = elementName; + this.ElementNamespace = elementNamespace; + + if (xsdStream == null) + xsdStream = this.GetXsdStreamFromEmbeddedResource(); + + XDocument doc = XDocument.Load(new StreamReader(xsdStream)); + this.Schema = doc; + base.InitializeMappings(elementName, doc); + } + + /// <summary> + /// Gets or sets the namespace value for the element + /// </summary> + public string ElementNamespace { get; private set; } + + /// <summary> + /// Gets the xml schema (if any) + /// </summary> + public XDocument Schema { get; private set; } + + #region IDtoAssembler<TDomainObject> Members + + /// <summary> + /// Gets the xml element name + /// </summary> + public string ElementName { get; private set; } + + /// <summary> + /// Creates and materialized a data transfer object (dto) from a domain object + /// </summary> + /// <param name="domainObj">The domain object</param> + /// <returns>An XElement instance</returns> + public override XElement CreateDataTransferObject(TDomainObject domainObj) + { + if (domainObj == null) + return null; + + if (!this.ElementName.HasValidStringValue()) + throw new DtoAssemblerException("There is no element name specified"); + + if (this.ElementNamespace.HasValidStringValue()) + { + XNamespace ns = this.ElementNamespace; + return new XElement(ns + this.ElementName) + .Materialize(domainObj, this.Mappings); + } + + return new XElement(this.ElementName) + .Materialize(domainObj, this.Mappings); + } + + /// <summary> + /// Creates and materializes a domain object from a data transfer object (dto) + /// </summary> + /// <param name="dtoObj">The dto object</param> + /// <returns>The materialized domain object</returns> + public override TDomainObject CreateDomainObject(XElement dto) + { + return new TDomainObject().Materialize(dto, this.Mappings); + } + + #endregion + + public Stream GetXsdStreamFromEmbeddedResource() + { + if (string.IsNullOrEmpty(this.ElementNamespace)) + return null; + + Assembly assembly = this.GetType().Assembly; + string schemaName = this.ElementNamespace.Substring(this.ElementNamespace.LastIndexOf('/') + 1); + schemaName += schemaName.EndsWith(".xsd") ? "" : ".xsd"; + + string resourceName = (from string name in assembly.GetManifestResourceNames() + where name.EndsWith(schemaName) + select name).Single(); + + return assembly.GetEmbeddedFile(resourceName); + } + + public virtual TDomainObject CreateDomainObject(XDocument dtoDocument) + { + if (dtoDocument == null) + throw new ArgumentNullException("dtoDocument"); + + XElement el = null; + try + { + el = (from x in dtoDocument.Descendants() + where x.Name.LocalName == this.ElementName + select x).Single(); + } + catch + { + throw; + } + + return this.CreateDomainObject(el); + } + } + + #endregion +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/UISupport/DAMNewProjectData.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/UISupport/DAMNewProjectData.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/UISupport/DAMNewProjectData.cs (revision 3305) @@ -0,0 +1,198 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. +// +// 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.Xml.Serialization; +using Deltares.Standard; +using Deltares.Standard.Attributes; +using Deltares.Standard.EventPublisher; +using DotSpatial.Projections; + +namespace Deltares.Dam.Data.UISupport +{ + public class DAMNewProjectData : IVisibleEnabled, IDomain + { + private DamProjectType damProjectType; + private string damDataSourceFileName; + private string damProjectFileName; + private string sensorConfigurationFileName; + private List<string> selectedDikeRingIds = new List<string>(); + private string dataSourceEsriProjection; + private string dataSourceProjectionName; + private bool dataSourceProjectionUserDefined; + + [Label("Calculation type")] + [Description("Indicates the purpose of the calculations")] + [XmlIgnore] + public DamProjectType DamProjectType + { + get { return damProjectType; } + set + { + DataEventPublisher.BeforeChange(this, "DamProjectType"); + damProjectType = value; + DataEventPublisher.AfterChange(this, "DamProjectType"); + } + } + + [Label("DAM datasource file")] + [Description("Indicates which \".defx\" import definition file to use")] + [XmlIgnore] + public string DamDataSourceFileName + { + get { return damDataSourceFileName; } + set + { + DataEventPublisher.BeforeChange(this, "DamDataSourceFileName"); + damDataSourceFileName = value; + DataEventPublisher.AfterChange(this, "DamDataSourceFileName"); + } + } + + [XmlIgnore] + public string SensorConfigurationFileName + { + get { return sensorConfigurationFileName; } + set + { + DataEventPublisher.BeforeChange(this, "SensorConfigurationFileName"); + sensorConfigurationFileName = value; + DataEventPublisher.AfterChange(this, "SensorConfigurationFileName"); + } + } + + [XmlIgnore] + public string DamProjectFileName + { + get { return damProjectFileName; } + set + { + DataEventPublisher.BeforeChange(this, "DamProjectFileName"); + damProjectFileName = value; + DataEventPublisher.AfterChange(this, "DamProjectFileName"); + } + } + + [XmlIgnore] + public string DataSourceEsriProjection + { + get { return dataSourceEsriProjection; } + set + { + DataEventPublisher.BeforeChange(this, "DataSourceEsriProjection"); + dataSourceEsriProjection = value; + DataEventPublisher.AfterChange(this, "DataSourceEsriProjection"); + try + { + var projection = ProjectionInfo.FromEsriString(value); + DataSourceProjectionName = projection.Name ?? projection.ToString(); + } + catch (Exception) + { + DataSourceProjectionName = "Invalid projection"; + } + } + } + + [XmlIgnore] + [ReadOnly(true)] + public string DataSourceProjectionName + { + get { return dataSourceProjectionName; } + set + { + DataEventPublisher.BeforeChange(this, "DataSourceProjectionName"); + dataSourceProjectionName = value; + DataEventPublisher.AfterChange(this, "DataSourceProjectionName"); + } + } + + /// <summary> + /// Selects the sensor configuration file. + /// </summary> + [Label("...")] + public void SelectSensorConfigurationFile() + { + // This method is needed for the databinding to DamNewProjectDialog + // The IsEnabled is implemented in this class + // The UI code itself is implemented in the DamNewProjectDialog itself + } + + /// <summary> + /// Selects the projection. + /// </summary> + public void SelectProjection() + { + // This method is needed for the databinding to DamNewProjectDialog + // The IsEnabled is implemented in this class + // The UI code itself is implemented in the DamNewProjectDialog itself + } + + public List<string> SelectedDikeRingIds + { + get { return selectedDikeRingIds; } + set { selectedDikeRingIds = value; } + } + + public bool DataSourceProjectionUserDefined + { + get { return dataSourceProjectionUserDefined; } + set { dataSourceProjectionUserDefined = value; } + } + + public bool IsVisible(string property) + { + if (property == "SelectProjection") + { + return (string.IsNullOrEmpty(DataSourceEsriProjection) || DataSourceProjectionUserDefined); + } + return true; + } + + public bool IsEnabled(string property) + { + if ((property == "SensorConfigurationFileName") || (property == "SelectSensorConfigurationFile")) + { + return (DamProjectType == DamProjectType.DamLiveConfiguration); + } + return true; + } + + public ICollection GetDomain(string property) + { + switch (property) + { + case "DamProjectType": + return new[] + { + DamProjectType.Design, + DamProjectType.Calamity, + DamProjectType.DamLiveConfiguration + }; + default: + return null; + } + } + } +} Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/FileWriterUtil.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/FileWriterUtil.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/FileWriterUtil.cs (revision 3305) @@ -0,0 +1,40 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. +// +// 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.IO; + +namespace Deltares.Dam.Data +{ + public static class FileWriterUtil + { + public static void RemoveThreeBytesFromXml(string outputFilename) + { + byte[] uncorrectedXmlData = File.ReadAllBytes(outputFilename); + byte[] correctedXmlData = new byte[uncorrectedXmlData.Length - 3]; + for (int byteIndex = 3; byteIndex < uncorrectedXmlData.Length; byteIndex++) + { + correctedXmlData[byteIndex - 3] = uncorrectedXmlData[byteIndex]; + } + File.WriteAllBytes(outputFilename, correctedXmlData); + + } + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Specifications/ISpecification.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Specifications/ISpecification.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Specifications/ISpecification.cs (revision 3305) @@ -0,0 +1,70 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +namespace Deltares.Standard.Specifications +{ + /// <summary> + /// + /// </summary> + public interface ISpecification + { + /// <summary> + /// Gets or sets the name of the specification. (Short description) + /// </summary> + /// <value> + /// The name string value should be a required property for each specification. + /// </value> + string Name { get; set; } + + /// <summary> + /// Gets or sets the description of the specification. (Long description) + /// </summary> + /// <value> + /// The description string value. + /// </value> + string Description { get; set; } + + /// <summary> + /// Determines whether the candidate satisfies the specification. + /// </summary> + /// <param name="candidate">The candidate.</param> + /// <returns> + /// <c>true</c> if the candidate satisfies the specification otherwise, <c>false</c>. + /// </returns> + bool IsSatisfiedBy(object candidate); + } + + /// <summary> + /// + /// </summary> + /// <typeparam name="TCandidate">The type of the candidate.</typeparam> + public interface ISpecification<in TCandidate> : ISpecification + { + /// <summary> + /// Determines whether the candidate satisfies the specification. + /// </summary> + /// <param name="candidate">The candidate.</param> + /// <returns> + /// <c>true</c> if the candidate satisfies the specification otherwise, <c>false</c>. + /// </returns> + bool IsSatisfiedBy(TCandidate candidate); + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/Test/Services/FeatueRepositoryExtensionsTest.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/Test/Services/FeatueRepositoryExtensionsTest.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/Test/Services/FeatueRepositoryExtensionsTest.cs (revision 3305) @@ -0,0 +1,228 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of the application DAM - UI. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System.Collections.Generic; +using System.Linq; + +using GeoAPI.Geometries; + +using NetTopologySuite.Geometries; + +using NUnit.Framework; + +using Rhino.Mocks; + +namespace Deltares.Maps.Tests.Services +{ + [TestFixture] + public class FeatueRepositoryExtensionsTest + { + private MockRepository mocks; + private IFeatureRepository rep1, rep2; + private LineString dikeRing; + + #region Setup + + [TestFixtureSetUp] + public void FixtureSetup() + { + mocks = new MockRepository(); + } + + [TestFixtureTearDown] + public void FixtureTearDown() + { + } + + [SetUp] + public void TestSetup() + { + rep1 = mocks.DynamicMock<IFeatureRepository>(); + rep2 = mocks.DynamicMock<IFeatureRepository>(); + + dikeRing = new LineString(new[] + { + new Coordinate(-2, 2), + new Coordinate(2, 2), + new Coordinate(2, -2), + new Coordinate(-2, -2), + new Coordinate(-2, 2) + }); + } + + [TearDown] + public void TestTearDown() + { + mocks.VerifyAll(); + } + + #endregion + + [Test] + public void GetLineIntersectionPoints_OneValidProfileIntersects_ListContainsOneElement() + { + var profile1 = new LineString(new[] + { + new Coordinate(-3, 1), + new Coordinate(0, 1) + }); + + var profile2 = new LineString(new[] + { + new Coordinate(-3, -3), + new Coordinate(0, -3) + }); + + Feature geom1 = Feature.Create(profile1); + Feature geom2 = Feature.Create(profile2); + Expect.Call(rep1.Features).Return(new[] + { + geom1, + geom2 + }); + + Feature dikeGeom = Feature.Create(dikeRing); + Expect.Call(rep2.Query((IFeature)null)).IgnoreArguments().Return(new[] + { + dikeGeom + }); + + mocks.ReplayAll(); + + IEnumerable<IGrouping<int, IntersectionResult>> results = rep1.GetIntersectionPoints(rep2); + Assert.IsNotNull(results); + Assert.AreEqual(2, results.Count()); + Assert.IsTrue(results.Any(r => r.Key == 1)); + Assert.IsTrue(results.Any(r => r.Key == 0)); + + IntersectionResult result = results.GetResultsHavingCount(1).Single(); + Assert.AreEqual(result.Source.Id, geom1.Id); + Assert.AreEqual(result.Target.Id, dikeGeom.Id); + Assert.AreEqual(-2, result.IntersectionPoints.ElementAt(0).X, 0.0001); + Assert.AreEqual(1, result.IntersectionPoints.ElementAt(0).Y, 0.0001); + } + + [Test] + public void GetLineIntersectionPoints_TwoValidProfilesIntersects_ListContainsTwoElements() + { + var profile1 = new LineString(new[] + { + new Coordinate(-3, 1), + new Coordinate(0, 1) + }); + + var profile2 = new LineString(new[] + { + new Coordinate(-3, -1), + new Coordinate(0, -1) + }); + + Feature geom1 = Feature.Create(profile1); + Feature geom2 = Feature.Create(profile2); + Expect.Call(rep1.Features).Return(new[] + { + geom1, + geom2 + }); + + Feature dikeGeom = Feature.Create(dikeRing); + Expect.Call(rep2.Query((IFeature)null)).IgnoreArguments().Return(new[] + { + dikeGeom + }); + mocks.ReplayAll(); + + IEnumerable<IGrouping<int, IntersectionResult>> results = rep1.GetIntersectionPoints(rep2); + + Assert.IsNotNull(results); + Assert.AreEqual(1, results.Count()); + Assert.IsTrue(results.Any(r => r.Key == 1)); + + Assert.AreEqual(2, results.GetResultsHavingCount(1).Count()); + IntersectionResult result = results.ElementAt(0).First(); + Assert.AreEqual(result.Source.Id, geom1.Id); + Assert.AreEqual(result.Target.Id, dikeGeom.Id); + Assert.AreEqual(-2, result.IntersectionPoints.ElementAt(0).X, 0.0001); + Assert.AreEqual(1, result.IntersectionPoints.ElementAt(0).Y, 0.0001); + } + + [Test] + public void GetLineIntersectionPoints_ProfileIntersectsOnTwoSegements_ListContainsOneElementAndTwoIntersectionPoints() + { + var profile1 = new LineString(new[] + { + new Coordinate(-3, 1), + new Coordinate(3, 1) + }); + + Feature geom1 = Feature.Create(profile1); + Expect.Call(rep1.Features).Return(new[] + { + geom1 + }); + + Feature dikeGeom = Feature.Create(dikeRing); + Expect.Call(rep2.Query((IFeature)null)).IgnoreArguments().Return(new[] + { + dikeGeom + }); + + mocks.ReplayAll(); + + IEnumerable<IGrouping<int, IntersectionResult>> results = rep1.GetIntersectionPoints(rep2); + Assert.IsNotNull(results); + Assert.AreEqual(1, results.Count()); + Assert.AreEqual(1, results.GetResultsHavingCount(2).Count()); + IntersectionResult result = results.ElementAt(0).First(); + Assert.AreEqual(result.Source.Id, geom1.Id); + Assert.AreEqual(result.Target.Id, dikeGeom.Id); + } + + [Test] + public void GetLineIntersectionPoints_ProfileDoesNotIntersects_ListContainsOneElementAndZeroIntersectionPoints() + { + var profile1 = new LineString(new[] + { + new Coordinate(-3, -3), + new Coordinate(3, -3) + }); + + Feature geom1 = Feature.Create(profile1); + Expect.Call(rep1.Features).Return(new[] + { + geom1 + }); + + Feature dikeGeom = Feature.Create(dikeRing); + Expect.Call(rep2.Query((IFeature)null)).IgnoreArguments().Return(new[] + { + dikeGeom + }); + + mocks.ReplayAll(); + + IEnumerable<IGrouping<int, IntersectionResult>> results = rep1.GetIntersectionPoints(rep2); + Assert.IsNotNull(results); + Assert.AreEqual(1, results.Count()); + Assert.AreEqual(1, results.GetResultsHavingCount(0).Count()); + } + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/IO/CombineImportedData.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/IO/CombineImportedData.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/IO/CombineImportedData.cs (revision 3305) @@ -0,0 +1,864 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Collections.Generic; +using System.Linq; + +using Deltares.Dam.Data.CsvImporters; +using Deltares.Geotechnics.Exception; +using Deltares.Geotechnics.GeotechnicalGeometry; +using Deltares.Geotechnics.Soils; +using Deltares.Geotechnics.SurfaceLines; +using Deltares.Standard.EventPublisher; +using Deltares.Standard.Language; +using Deltares.Standard.Logging; + +namespace Deltares.Dam.Data.IO +{ + + public class CombineImportedDataException : ApplicationException + { + public CombineImportedDataException(string message) + : base(message) + { + } + } + + public class CombineImportedData + { + private WaterBoard waterBoard; + private readonly IList<LogMessage> errorMessages = new List<LogMessage>(); + + public WaterBoard WaterBoard + { + get { return waterBoard; } + set { waterBoard = value; } + } + + public IEnumerable<CsvImporterLocations.LocationRecord> LocationRecords { get; set; } + + public IEnumerable<CsvImporterSegments.SegmentRecord> SegmentRecords { get; set; } + + public IEnumerable<CsvImporterSoilProfiles.SoilProfileRecord> SoilProfilerecords { get; set; } + + public IEnumerable<CsvImporterSurfaceLines.SurfaceLineRecord> SurfaceLineRecords { get; set; } + + public IEnumerable<CsvImporterCharacteristicPoints.CharacteristicPointsRecord> CharacteristicPointsRecords { get; set; } + + public IEnumerable<CsvImporterScenarios.ScenarioRecord> ScenarioRecords { get; set; } + + public IList<LogMessage> ErrorMessages + { + get { return errorMessages; } + } + + /// <summary> + /// Adds the dikes from locations to water board. + /// </summary> + /// <param name="targetWaterBoard">The water board.</param> + private void AddDikesFromLocationsToWaterBoard(WaterBoard targetWaterBoard) + { + if (LocationRecords == null) + return; + + // Create list of unique dikering ids + var dikeRingIdList = new List<string>(); + foreach (var locationRecord in LocationRecords) + { + if (!String.IsNullOrEmpty(locationRecord.DikeRingId)) + { + if (!dikeRingIdList.Contains(locationRecord.DikeRingId)) + { + dikeRingIdList.Add(locationRecord.DikeRingId); + } + } + } + + // if no dikeringIds assigned, then use default dike and assign it to the locations (if there are any) + if ((dikeRingIdList.Count <= 0) && LocationRecords.Any()) + { + string defaultDikeRingId = "Dike from CSV"; + if (targetWaterBoard.Dikes.Count > 0) + { + defaultDikeRingId = targetWaterBoard.Dikes[0].Name; + } + foreach (var locationRecord in LocationRecords) + { + locationRecord.DikeRingId = defaultDikeRingId; + } + dikeRingIdList.Add(defaultDikeRingId); + } + + // Add dikeringids if not yet in waterboard + foreach (var dikeRingId in dikeRingIdList) + { + var dike = targetWaterBoard.Dikes.FirstOrDefault(d => d.Name.Equals(dikeRingId)); + if (dike == null) + { + targetWaterBoard.Dikes.Add(new Dike() { Name = dikeRingId }); + } + } + } + + /// <summary> + /// Adds the imported CSV data to dikes. + /// </summary> + public void AddCsvDataToDikes() + { + if (waterBoard == null) + { + var damProjectDataNotAssignedForImport = LocalizationManager.GetTranslatedText(GetType(), "damProjectDataNotAssignedForImport"); + throw new CombineImportedDataException(damProjectDataNotAssignedForImport); + } + AddDikesFromLocationsToWaterBoard(waterBoard); + + foreach (var dike in waterBoard.Dikes) + { + TransferLocationsData(dike); + TransferSoilProfilesData(dike); + TransferSegmentData(dike); + // Use InvokeWithoutPublishingEvents for performance reasons after introducing SurfaceLine2 + DataEventPublisher.InvokeWithoutPublishingEvents(() => { TransferSurfaceLines(dike); }); + } + } + + public void AddScenarioDataToDikes() + { + foreach (var dike in waterBoard.Dikes) + { + if (ScenarioRecords != null) + { + TransferScenarios(dike); + } + } + } + + private bool CheckForValidSegmentId(int segmentRecordId, string segmentId) + { + if (String.IsNullOrEmpty(segmentId)) + { + var segmentRecordHasNoId = LocalizationManager.GetTranslatedText(GetType(), "segmentRecordHasNoId"); + LogMessage logmessage = new LogMessage(LogMessageType.Error, null, + String.Format("Record {0} : {1}", segmentRecordId, segmentRecordHasNoId)); + ErrorMessages.Add(logmessage); + return false; + } + return true; + } + + /// <summary> + /// Check if either a 1D-geometry or a 2D-geometry is specified + /// </summary> + /// <param name="segmentId"></param> + /// <param name="soilProfileId"></param> + /// <param name="soilGeometry2DName"></param> + private bool CheckForAnySoilGeometry(string segmentId, string soilProfileId, string soilGeometry2DName) + { + if ((String.IsNullOrEmpty(soilProfileId)) && (String.IsNullOrEmpty(soilGeometry2DName))) + { + var segmentHasNoProfileOrGeometry = LocalizationManager.GetTranslatedText(GetType(), "segmentHasNoProfileOrGeometry"); + LogMessage logmessage = new LogMessage(LogMessageType.Error, null, + String.Format("{0} : {1}", segmentId, segmentHasNoProfileOrGeometry)); + ErrorMessages.Add(logmessage); + return false; + } + return true; + } + + /// <summary> + /// Check if both a 1D-geometry or a 2D-geometry is specified (which is not allowed) + /// </summary> + /// <param name="segmentId"></param> + /// <param name="soilProfileId"></param> + /// <param name="soilGeometry2DName"></param> + private bool CheckForDoubleSoilGeometry(string segmentId, string soilProfileId, string soilGeometry2DName) + { + if ((!String.IsNullOrEmpty(soilProfileId)) && (!String.IsNullOrEmpty(soilGeometry2DName))) + { + var segmentHasProfileAndGeometry = LocalizationManager.GetTranslatedText(GetType(), "segmentHasProfileAndGeometry"); + LogMessage logmessage = new LogMessage(LogMessageType.Error, null, + String.Format("{0} : {1}", segmentId, segmentHasProfileAndGeometry)); + ErrorMessages.Add(logmessage); + return false; + } + return true; + } + + // Before using this, the Locations and (for 1D profiles) SoilProfiles must be known!? + private void TransferSegmentData(Dike dike) + { + if (SegmentRecords == null) + return; + + if (waterBoard.Segments.Count > 0) + { + foreach (var segmentRecord in SegmentRecords) + { + // look for existing segments by Id. If found, remove them from the waterboard as they are to be (re)read here. + var oldSegments = waterBoard.Segments.Where(s => s.Name == segmentRecord.SegmentId).ToList(); + foreach (var oldSegment in oldSegments) + { + waterBoard.Segments.Remove(oldSegment); + } + } + } + + var soilProfileLookup = dike.SoilProfiles != null ? dike.SoilProfiles.ToDictionary(sp => sp.Name, sp => sp) : null; + foreach (var segmentRecord in SegmentRecords) + { + + if (CheckForValidSegmentId(segmentRecord.SegmentRecordId, segmentRecord.SegmentId) && + (CheckForDoubleSoilGeometry(segmentRecord.SegmentId, segmentRecord.SoilProfileId, + segmentRecord.SoilGeometry2DName)) && + (CheckForAnySoilGeometry(segmentRecord.SegmentId, segmentRecord.SoilProfileId, + segmentRecord.SoilGeometry2DName))) + { + bool newSegment = false; + //check if new segment is needed + var segment = waterBoard.GetSegmentByName(segmentRecord.SegmentId); + if (segment == null) + { + newSegment = true; + segment = new Segment(); + } + + segment.Name = segmentRecord.SegmentId; + if (!String.IsNullOrEmpty(segmentRecord.SoilGeometry2DName)) + { + segment.AddSoilGeometry2DProbability(segmentRecord.SoilGeometry2DName, + segmentRecord.Probability, + segmentRecord.SegmentFailureMechanismType); + } + if (!String.IsNullOrEmpty(segmentRecord.SoilProfileId)) + { + if (soilProfileLookup == null) + { + var dikeHasNoSoilProfiles = LocalizationManager.GetTranslatedText(GetType(), "dikeHasNoSoilProfiles"); + LogMessage logmessage = new LogMessage(LogMessageType.Error, null, + String.Format("{0} : {1}", dike.Name, + dikeHasNoSoilProfiles)); + ErrorMessages.Add(logmessage); + } + else + { + var soilProfileName = segmentRecord.SoilProfileId; + SoilProfile1D soilProfile = soilProfileLookup.ContainsKey(soilProfileName) ? soilProfileLookup[soilProfileName] : null; + if (soilProfile == null) + { + //#Bka: do not give message here as it might be that an old project is being loaded which does not have a full + // dataset (such as old HHNK projects by Irene), leading to a very large list with non relevant errors as the locations + // for which this check is performed are not all used. + // var soilProfileForSegmentDoesNotExist = + // LocalizationManager.GetTranslatedText(this.GetType(), + // "soilProfileForSegmentDoesNotExist"); + // LogMessage logmessage = new LogMessage(LogMessageType.Error, null, + // String.Format("{0} : {1}:{2}", + // segmentRecord.SegmentId, + // soilProfileForSegmentDoesNotExist, + // segmentRecord.SoilProfileId)); + // ErrorMessages.Add(logmessage); + } + else + { + segment.AddSoilProfileProbability(soilProfile, segmentRecord.Probability, + segmentRecord.SegmentFailureMechanismType); + } + } + } + // Note Bka: coupling of segment to location still needs to be done. But can only be achieved when location has info on segment or segment id + //segment.Locations.AddRange(dike.Locations.Where(l => l.Segment.Name == segmentRecord.SegmentId)); + // var segId = dike.Locations[0].SegmentId; + // if (segId == segmentRecord.SegmentId) + // dike.Locations[0].Segment = segment; + if (newSegment) + { + waterBoard.Segments.Add(segment); + var segmentId = segmentRecord.SegmentId; + var locationsWithSegmentId = waterBoard.Locations.Where(x => x.SegmentId == segmentId); + foreach (var location in locationsWithSegmentId) + { + location.Segment = segment; + } + } + + } + } + } + + private void TransferSoilProfilesData(Dike dike) + { + if (SoilProfilerecords == null) + return; + + bool newSoilProfile = false; + var orgId = ""; + SoilProfile1D soilProfile = null; + var layerIndex = 0; + + foreach (var soilProfileRecord in SoilProfilerecords) + { + if ((String.IsNullOrEmpty(soilProfileRecord.SoilProfileId)) || (String.IsNullOrEmpty(soilProfileRecord.SoilName))) + { + var noIdForSoilProfileRecordError = LocalizationManager.GetTranslatedText(this.GetType(), "noIdOrSoilForSoilProfileRecordError"); + LogMessage logmessage = new LogMessage(LogMessageType.Error, this, + String.Format("Record {0} : {1}", soilProfileRecord.SoilProfileRecordId, noIdForSoilProfileRecordError)); + ErrorMessages.Add(logmessage); + AddErrorMessage("noIdOrSoilForSoilProfileRecordError", soilProfileRecord); + } + else + { + // see if a next profile is to be converted from the csv data. If not, layer needs to be added to the current profile + if (orgId != soilProfileRecord.SoilProfileId) + { + // first add current profile (if it exists) to dike. + if (soilProfile != null) + { + if (newSoilProfile) + { + try + { + soilProfile.ValidateDirect(); + dike.SoilProfiles.Add(soilProfile); + } + catch (SoilProfileLayersNotSortedDescendingException e) + { + LogMessage logmessage = new LogMessage(LogMessageType.Error, null, e.Message); + ErrorMessages.Add(logmessage); + } + layerIndex = 0; + } + newSoilProfile = false; + } + // determine the next profile (existing or new) + soilProfile = dike.SoilProfiles.FirstOrDefault(s => s.Name == soilProfileRecord.SoilProfileId); + if (soilProfile == null) + { + soilProfile = new SoilProfile1D(); + newSoilProfile = true; + } + // clear layers of existing profile + if (soilProfile.Layers != null) + { + soilProfile.Layers.Clear(); + } + else + { + var existingSoilProfileHasNoLayers = LocalizationManager.GetTranslatedText(this.GetType(), "existingSoilProfileHasNoLayers"); + LogMessage logmessage = new LogMessage(LogMessageType.Error, null, + String.Format("{0} : {1}", soilProfileRecord.SoilProfileId, existingSoilProfileHasNoLayers)); + ErrorMessages.Add(logmessage); + + } + soilProfile.Name = soilProfileRecord.SoilProfileId; + orgId = soilProfileRecord.SoilProfileId; + } + // if this is a dummy layer to set the bottom level for the entire profile, then do so + if (soilProfileRecord.SoilName == SoilProfile1D.SoilProfileBottomLevelId) + { + soilProfile.BottomLevel = soilProfileRecord.TopLevel; + } + else + { + // else set the layer + SoilLayer1D layer = new SoilLayer1D(); + layer.TopLevel = soilProfileRecord.TopLevel; + var soilIndex = dike.SoilList.GetSoilIndexByName(soilProfileRecord.SoilName); + if (soilIndex == -1) + { + var soil = new Soil + { + Name = soilProfileRecord.SoilName + }; + dike.SoilList.Soils.Add(soil); + soilIndex = dike.SoilList.Soils.Count - 1; + } + layer.Soil = dike.SoilList.Soils[soilIndex]; + layer.Name = "Layer" + (layerIndex); + layerIndex++; + soilProfile.Layers.Add(layer); + } + } + } + // finally add last current profile to dike. + if ((soilProfile != null) && (newSoilProfile)) + { + try + { + if ((soilProfile.Layers == null) || (soilProfile.Layers.Count == 0)) + { + throw new SoilProfileLayersNotSortedDescendingException(String.Format("Soilprofile '{0}' has no layers", soilProfile.Name)); + } + soilProfile.ValidateDirect(); + + dike.SoilProfiles.Add(soilProfile); + } + catch (SoilProfileLayersNotSortedDescendingException e) + { + LogMessage logmessage = new LogMessage(LogMessageType.Error, null, e.Message); + ErrorMessages.Add(logmessage); + } + } + + // Make sure all soilprofiles last layer have a height + foreach (var soilProfile1 in dike.SoilProfiles) + { + try + { + soilProfile1.EnsureLastLayerHasHeight(); + } + catch (Exception e) + { + //var error = new StringBuilder(); + string error = String.Format("Error postprocessing soilprofile '{0}': {1}", soilProfile1.Name, e.Message); + LogMessage logmessage = new LogMessage(LogMessageType.Error, null, error); + ErrorMessages.Add(logmessage); + } + } + } + + internal bool CheckCharacteristicPointsForCoincidingLocations(SurfaceLine2 surfaceLine2, + out CharacteristicPointType type1, out CharacteristicPointType type2) + { + var doubleFound = false; + type1 = CharacteristicPointType.None; + type2 = CharacteristicPointType.None; + var points = surfaceLine2.CharacteristicPoints; + foreach (var characteristicPoint in surfaceLine2.CharacteristicPoints) + { + if (!doubleFound) + { + // Find the coinciding points + var doublePoints = points.Where(x => + Math.Abs(x.X - characteristicPoint.X) < 1e-4 && Math.Abs(x.Y - characteristicPoint.Y) < 1e-4 && + Math.Abs(x.Z - characteristicPoint.Z) < 1e-4); + if (doublePoints.Count() > 1) + { + // if there are coinciding points, see if the types clash. Only valid coinciding points are traffic loads + // which may coincide with any other type of point + var firstType = doublePoints.First().CharacteristicPointType; + var skip = 0; + foreach (var doublePoint in doublePoints) + { + if (skip > 0 && !doubleFound && firstType != CharacteristicPointType.TrafficLoadInside && + firstType != CharacteristicPointType.TrafficLoadOutside) + { + if (doublePoint.CharacteristicPointType != CharacteristicPointType.TrafficLoadInside && + doublePoint.CharacteristicPointType != CharacteristicPointType.TrafficLoadOutside) + { + doubleFound = doublePoint.CharacteristicPointType != firstType; + if (doubleFound) + { + type1 = firstType; + type2 = doublePoint.CharacteristicPointType; + } + } + } + firstType = doublePoint.CharacteristicPointType; + skip++; + } + } + } + } + return !doubleFound; + } + + private void TransferSurfaceLines(Dike dike) + { + if (SurfaceLineRecords == null) + return; + + foreach (var surfaceLineRecord in SurfaceLineRecords) + { + if (String.IsNullOrEmpty(surfaceLineRecord.SurfaceLineId)) + { + var noIdForSurfaceLineRecordError = LocalizationManager.GetTranslatedText(GetType(), "noIdSurfaceLineRecordError"); + LogMessage logmessage = new LogMessage(LogMessageType.Error, null, + String.Format("Record {0} : {1}", surfaceLineRecord.SurfaceLineRecordId, noIdForSurfaceLineRecordError)); + ErrorMessages.Add(logmessage); + } + else + { + bool newSurfaceLine = false; + SurfaceLine2 surfaceLine = + dike.SurfaceLines2.FirstOrDefault(s => s.Name == surfaceLineRecord.SurfaceLineId); + if (surfaceLine == null) + { + surfaceLine = new SurfaceLine2 + { + Geometry = new LocalizedGeometryPointString(), + CharacteristicPoints = { GeometryMustContainPoint = true } + }; + newSurfaceLine = true; + } + surfaceLine.Name = surfaceLineRecord.SurfaceLineId; + // first add all points from the surface line csv + for (int i = 0; i < surfaceLineRecord.Xcoors.Count; i++) + { + // empty points will not be added + if (surfaceLineRecord.Xcoors[i] != -1 || surfaceLineRecord.Ycoors[i] != -1 || surfaceLineRecord.Zcoors[i] != -1) + surfaceLine.EnsurePointOfType(surfaceLineRecord.Xcoors[i], surfaceLineRecord.Ycoors[i], surfaceLineRecord.Zcoors[i], null); + } + // Add the surface line to the dike + if (newSurfaceLine) + { + dike.SurfaceLines2.Add(surfaceLine); + } + // now see if all characteristic points belonging to this surface line are part of the surface line + var characteristicPointsRecord = + CharacteristicPointsRecords.FirstOrDefault(s => s.SurfaceLineId == surfaceLine.Name); + bool charCheck = true; + if (characteristicPointsRecord != null) + { + foreach (var point in characteristicPointsRecord.Points) + { + // ignore unset points + if (!((point.X == -1) && (point.Y == -1) && (point.Z == -1))) + { + var tppoint = surfaceLine.Geometry.GetPointAt(point.X, point.Y, point.Z); + + if (tppoint != null) + { + surfaceLine.EnsurePointOfType(point.X, point.Y, point.Z, point.Type); + } + else + { + var charPointNotFoundInSurfaceError = + LocalizationManager.GetTranslatedText(GetType(), "charPointNotFoundInSurfaceError"); + LogMessage logmessage = new LogMessage(LogMessageType.Error, null, String.Format("{0} : {1} {2}", + surfaceLine.Name, charPointNotFoundInSurfaceError, point.Type)); + ErrorMessages.Add(logmessage); + charCheck = false; + } + } + } + } + else + { + var noCharPointsFoundForSurfaceError = LocalizationManager.GetTranslatedText(GetType(), "noCharPointsFoundForSurfaceError"); + LogMessage logmessage = new LogMessage(LogMessageType.Error, null, + String.Format("{0} : {1}", surfaceLine.Name, + noCharPointsFoundForSurfaceError)); + ErrorMessages.Add(logmessage); + charCheck = false; + } + // Check on illegal coinciding characteristic points + if (charCheck) + { + charCheck = CheckOnCoincidingPoints(surfaceLine); + } + if (!charCheck) + { + surfaceLine.Dispose(); + dike.SurfaceLines2.Remove(surfaceLine); + } + } + } + } + + internal bool CheckOnCoincidingPoints(SurfaceLine2 surfaceLine) + { + bool charCheck; + CharacteristicPointType firstType; + CharacteristicPointType secondType; + charCheck = CheckCharacteristicPointsForCoincidingLocations(surfaceLine, out firstType, out secondType); + if (!charCheck) + { + var coincidingCharPointsFoundForSurfaceError = + LocalizationManager.GetTranslatedText(GetType(), "CoincidingCharPointsFoundForSurfaceError"); + LogMessage logmessage = new LogMessage(LogMessageType.Error, null, String.Format("{0} : {1} : {2} : {3}", + surfaceLine.Name, coincidingCharPointsFoundForSurfaceError, firstType.ToString(), secondType.ToString())); + ErrorMessages.Add(logmessage); + } + + return charCheck; + } + + private void TransferScenarios(Dike dike) + { + if (ScenarioRecords == null) + return; + + var dikeLocationLookup = dike.Locations.ToDictionary(l => l.Name, l => l); + foreach (var scenarioRecord in ScenarioRecords) + { + bool recordError = false; + if (string.IsNullOrEmpty(scenarioRecord.LocationId)) + { + var noLocationIdForScenarioRecordError = LocalizationManager.GetTranslatedText(GetType(), + "noLocationIdForScenarioRecordError"); + LogMessage logmessage = new LogMessage(LogMessageType.Error, null, + string.Format("Record {0} : {1}", + scenarioRecord.ScenarioRecordId, + noLocationIdForScenarioRecordError)); + ErrorMessages.Add(logmessage); + recordError = true; + } + + // faassen: location id was of type int with default value -1 if empty. Now it is string and null as the default value + if (scenarioRecord.LocationScenarioId == null) + { + var invalidLocationScenarioIdForScenarioRecordError = + LocalizationManager.GetTranslatedText(GetType(), "invalidLocationScenarioIdForScenarioRecordError"); + LogMessage logmessage = new LogMessage(LogMessageType.Error, null, string.Format("Record {0} : {1}", + scenarioRecord.ScenarioRecordId, invalidLocationScenarioIdForScenarioRecordError)); + ErrorMessages.Add(logmessage); + recordError = true; + } + + var dikeLocation = dikeLocationLookup.ContainsKey(scenarioRecord.LocationId) ? dikeLocationLookup[scenarioRecord.LocationId] : null; + if (dikeLocation == null) + { + var locationNotFoundForScenarioRecordError = LocalizationManager.GetTranslatedText(GetType(), "locationNotFoundForScenarioRecordError"); + LogMessage logmessage = new LogMessage(LogMessageType.Error, this, string.Format("Record {0} : {1}", + scenarioRecord.ScenarioRecordId, locationNotFoundForScenarioRecordError)); + ErrorMessages.Add(logmessage); + recordError = true; + } + if (!recordError) + { + // Add to location scenario list + var dikeScenario = dikeLocation.Scenarios.FirstOrDefault(s => s.Location.Name == scenarioRecord.LocationId && + s.LocationScenarioID == scenarioRecord.LocationScenarioId); + if (dikeScenario != null) + { + var duplicateScenarioRecordError = LocalizationManager.GetTranslatedText(GetType(), "duplicateScenarioRecordError"); + string errorMessage = string.Format(duplicateScenarioRecordError, dikeLocation.Name, dikeScenario.LocationScenarioID); + LogMessage logmessage = new LogMessage(LogMessageType.Error, null, string.Format("Record {0} : {1}", + scenarioRecord.ScenarioRecordId, errorMessage)); + ErrorMessages.Add(logmessage); + } + else + { + var locationRecord = LocationRecords.FirstOrDefault(l => l.LocationId == scenarioRecord.LocationId); + + // Check if polder is present in either the location or the scenario record. This + // value is mandatory and must be present in either one. + if (locationRecord?.PolderLevel == null && scenarioRecord.PolderLevel == null) + { + string missingPolderLevelError = LocalizationManager.GetTranslatedText(GetType(), "missingPolderLevel"); + LogMessage logmessage = new LogMessage(LogMessageType.Error, null, string.Format("Record {0} : {1}", + scenarioRecord.ScenarioRecordId, missingPolderLevelError)); + ErrorMessages.Add(logmessage); + } + else + { + var scenario = CreateScenario(dikeLocation, scenarioRecord, locationRecord); + dikeLocation.Scenarios.Add(scenario); + } + } + } + } + } + + /// <summary> + /// Creates a <see cref="Scenario"/> based on its input arguments. + /// </summary> + /// <param name="dikeLocation">The <see cref="Location"/> that belongs to the <see cref="Scenario"/>.</param> + /// <param name="scenarioRecord">The <see cref="CsvImporterScenarios.ScenarioRecord"/> to retrieve the data from.</param> + /// <param name="locationRecord">The <see cref="CsvImporterLocations.LocationRecord"/> to retrieve the data from.</param> + /// <returns>A <see cref="Scenario"/>.</returns> + private static Scenario CreateScenario(Location dikeLocation, CsvImporterScenarios.ScenarioRecord scenarioRecord, + CsvImporterLocations.LocationRecord locationRecord) + { + // set values in scenario (1 from scenariorecord, 2 from locationrecord, 3 default) + var modelFactors = new ModelFactors(); + modelFactors.RequiredSafetyFactorStabilityInnerSlope = scenarioRecord.RequiredSafetyFactorStabilityInnerSlope ?? + (locationRecord.RequiredSafetyFactorStabilityInnerSlope ?? modelFactors.RequiredSafetyFactorStabilityInnerSlope); + modelFactors.RequiredSafetyFactorStabilityOuterSlope = scenarioRecord.RequiredSafetyFactorStabilityOuterSlope ?? + (locationRecord.RequiredSafetyFactorStabilityOuterSlope ?? modelFactors.RequiredSafetyFactorStabilityOuterSlope); + modelFactors.RequiredSafetyFactorPiping = scenarioRecord.RequiredSafetyFactorPiping ?? + (locationRecord.RequiredSafetyFactorPiping ?? modelFactors.RequiredSafetyFactorPiping); + modelFactors.UpliftCriterionStability = scenarioRecord.UpliftCriterionStability ?? + (locationRecord.UpliftCriterionStability ?? modelFactors.UpliftCriterionStability); + modelFactors.UpliftCriterionPiping = scenarioRecord.UpliftCriterionPiping ?? + (locationRecord.UpliftCriterionPiping ?? modelFactors.UpliftCriterionPiping); + var scenario = new Scenario + { + Location = dikeLocation, + LocationScenarioID = scenarioRecord.LocationScenarioId, + ModelFactors = modelFactors + }; + scenario.PlLineOffsetBelowDikeToeAtPolder = scenarioRecord.PlLineOffsetBelowDikeToeAtPolder ?? + (locationRecord.PlLineOffsetBelowDikeToeAtPolder ?? scenario.PlLineOffsetBelowDikeToeAtPolder); + scenario.PlLineOffsetBelowDikeTopAtPolder = scenarioRecord.PlLineOffsetBelowDikeTopAtPolder ?? + (locationRecord.PlLineOffsetBelowDikeTopAtPolder ?? scenario.PlLineOffsetBelowDikeTopAtPolder); + scenario.PlLineOffsetBelowDikeTopAtRiver = scenarioRecord.PlLineOffsetBelowDikeTopAtRiver ?? + (locationRecord.PlLineOffsetBelowDikeTopAtRiver ?? scenario.PlLineOffsetBelowDikeTopAtRiver); + scenario.PlLineOffsetBelowShoulderBaseInside = scenarioRecord.PlLineOffsetBelowShoulderBaseInside ?? + (locationRecord.PlLineOffsetBelowShoulderBaseInside ?? scenario.PlLineOffsetBelowShoulderBaseInside); + // set values in scenario (1 from scenariorecord, 2 from locationrecord, 3 stays null) + scenario.PlLineOffsetBelowDikeCrestMiddle = scenarioRecord.PlLineOffsetBelowDikeCrestMiddle ?? + locationRecord.PlLineOffsetBelowDikeCrestMiddle; + scenario.PlLineOffsetFactorBelowShoulderCrest = scenarioRecord.PlLineOffsetFactorBelowShoulderCrest ?? + locationRecord.PlLineOffsetFactorBelowShoulderCrest; + scenario.UsePlLineOffsetBelowDikeCrestMiddle = scenarioRecord.UsePlLineOffsetBelowDikeCrestMiddle ?? + locationRecord.UsePlLineOffsetBelowDikeCrestMiddle; + scenario.UsePlLineOffsetFactorBelowShoulderCrest = scenarioRecord.UsePlLineOffsetFactorBelowShoulderCrest ?? + locationRecord.UsePlLineOffsetFactorBelowShoulderCrest; + scenario.HeadPl3 = scenarioRecord.HeadPl3 ?? locationRecord.HeadPl3; + scenario.HeadPl4 = scenarioRecord.HeadPl4 ?? locationRecord.HeadPl4; + scenario.PolderLevel = scenarioRecord.PolderLevel ?? locationRecord.PolderLevel.Value; + scenario.HeadPl2 = scenarioRecord.HeadPl2 ?? locationRecord.HeadPl2; + scenario.DikeTableHeight = scenarioRecord.DikeTableHeight ?? locationRecord.DikeTableHeight; + scenario.RiverLevel = scenarioRecord.RiverLevel ?? locationRecord.RiverLevel; + scenario.RiverLevelLow = scenarioRecord.RiverLevelLow ?? locationRecord.RiverLevelLow; + return scenario; + } + + /// <summary> + /// Transfers the locations data. + /// </summary> + /// <param name="dike">The dike.</param> + private void TransferLocationsData(Dike dike) + { + if (LocationRecords == null) + return; + + foreach (var locationRecord in LocationRecords) + { + if (locationRecord.DikeRingId.Equals(dike.Name)) + { + // Check if id is defined + if (String.IsNullOrEmpty(locationRecord.LocationId)) + { + AddErrorMessage("noIdLocationRecordError", locationRecord); + continue; + } + + // See if location already exist; else create one and add it to the dike + Location location = dike.Locations.FirstOrDefault(s => s.Name == locationRecord.LocationId); + if (location == null) + { + var errorInrecord = false; + location = new Location(); + + location.SetDefaultValues(); + location.Name = locationRecord.LocationId; + location.SurfaceLineId = locationRecord.SurfaceLineId; + location.SegmentId = locationRecord.SegmentId; + + if (locationRecord.DikeRingId != null) + { + location.DikeRingId = locationRecord.DikeRingId; + } + if (location.DampingFactorPL3 < 0 || location.DampingFactorPL3 > 1) + { + AddErrorMessage("DampingFactorPl3BeyondLimits", locationRecord); + errorInrecord = true; + } + if (location.DampingFactorPL4 < 0 || location.DampingFactorPL4 > 1) + { + AddErrorMessage("DampingFactorPl4BeyondLimits", locationRecord); + errorInrecord = true; + } + + if (null != locationRecord.DikeEmbankmentMaterial) + { + location.DikeEmbankmentMaterial = locationRecord.DikeEmbankmentMaterial; + } + if (null != locationRecord.ShoulderEmbankmentMaterial) + { + location.ShoulderEmbankmentMaterial = locationRecord.ShoulderEmbankmentMaterial; + } + + location.XRd = locationRecord.GeoX.GetValueOrDefault(location.XRd); + location.YRd = locationRecord.GeoY.GetValueOrDefault(location.YRd); + location.XSoilGeometry2DOrigin = locationRecord.XSoilGeometry2DOrigin.GetValueOrDefault(location.XSoilGeometry2DOrigin); + location.DampingFactorPL3 = locationRecord.DampingFactorPl3.GetValueOrDefault(location.DampingFactorPL3); + location.DampingFactorPL4 = locationRecord.DampingFactorPl4.GetValueOrDefault(location.DampingFactorPL4); + location.PenetrationLength = locationRecord.PenetrationLength.GetValueOrDefault(location.PenetrationLength); + location.TrafficLoad = locationRecord.TrafficLoad.GetValueOrDefault(location.TrafficLoad); + location.TL_DegreeOfConsolidation = locationRecord.TL_DegreeOfConsolidation; + location.PLLineCreationMethod = locationRecord.PLLineCreationMethod.GetValueOrDefault(location.PLLineCreationMethod); + if (locationRecord.IntrusionVerticalWaterPressure.HasValue) + { + location.IntrusionVerticalWaterPressure = locationRecord.IntrusionVerticalWaterPressure.Value; + } + location.StabilityShoulderGrowSlope = locationRecord.StabilityShoulderGrowSlope.GetValueOrDefault(location.StabilityShoulderGrowSlope); + location.StabilityShoulderGrowDeltaX = locationRecord.StabilityShoulderGrowDeltaX.GetValueOrDefault(location.StabilityShoulderGrowDeltaX); + location.StabilitySlopeAdaptionDeltaX = locationRecord.StabilitySlopeAdaptionDeltaX.GetValueOrDefault(location.StabilitySlopeAdaptionDeltaX); + location.MinimalCircleDepth = locationRecord.MinimalCircleDepth.GetValueOrDefault(location.MinimalCircleDepth); + location.DistanceToEntryPoint = locationRecord.DistanceToEntryPoint.GetValueOrDefault(location.DistanceToEntryPoint); + location.SlopeDampingPiezometricHeightPolderSide = locationRecord.SlopeDampingPiezometricHeightPolderSide.GetValueOrDefault(location.SlopeDampingPiezometricHeightPolderSide); + location.StabilityDesignMethod = locationRecord.StabilityDesignMethod.GetValueOrDefault(location.StabilityDesignMethod); + location.SlopeAdaptionStartCotangent = locationRecord.SlopeAdaptionStartCotangent.GetValueOrDefault(location.SlopeAdaptionStartCotangent); + location.SlopeAdaptionEndCotangent = locationRecord.SlopeAdaptionEndCotangent.GetValueOrDefault(location.SlopeAdaptionEndCotangent); + location.SlopeAdaptionStepCotangent = locationRecord.SlopeAdaptionStepCotangent.GetValueOrDefault(location.SlopeAdaptionStepCotangent); + location.StabilityZoneType = locationRecord.StabilityZoneType.GetValueOrDefault(location.StabilityZoneType); + location.ForbiddenZoneFactor = locationRecord.ForbiddenZoneFactor.GetValueOrDefault(location.ForbiddenZoneFactor); + location.ZoneAreaRestSlopeCrestWidth = locationRecord.ZoneAreaRestSlopeCrestWidth.GetValueOrDefault(location.ZoneAreaRestSlopeCrestWidth); + location.NewDepthDitch = locationRecord.NewDepthDitch.GetValueOrDefault(location.NewDepthDitch); + location.NewDikeSlopeInside = locationRecord.NewDikeSlopeInside.GetValueOrDefault(location.NewDikeSlopeInside); + location.NewDikeSlopeOutside = locationRecord.NewDikeSlopeOutside.GetValueOrDefault(location.NewDikeSlopeOutside); + location.NewDikeTopWidth = locationRecord.NewDikeTopWidth.GetValueOrDefault(location.NewDikeTopWidth); + location.NewMaxHeightShoulderAsFraction = locationRecord.NewMaxHeightShoulderAsFraction.GetValueOrDefault(location.NewMaxHeightShoulderAsFraction); + location.NewMinDistanceDikeToeStartDitch = locationRecord.NewMinDistanceDikeToeStartDitch.GetValueOrDefault(location.NewMinDistanceDikeToeStartDitch); + location.NewShoulderBaseSlope = locationRecord.NewShoulderBaseSlope.GetValueOrDefault(location.NewShoulderBaseSlope); + location.NewShoulderTopSlope = locationRecord.NewShoulderTopSlope.GetValueOrDefault(location.NewShoulderTopSlope); + location.NewSlopeAngleDitch = locationRecord.NewSlopeAngleDitch.GetValueOrDefault(location.NewSlopeAngleDitch); + location.NewWidthDitchBottom = locationRecord.NewWidthDitchBottom.GetValueOrDefault(location.NewWidthDitchBottom); + location.UseNewDikeSlopeInside = locationRecord.UseNewDikeSlopeInside.GetValueOrDefault(location.UseNewDikeSlopeInside); + location.UseNewDikeSlopeOutside = locationRecord.UseNewDikeSlopeOutside.GetValueOrDefault(location.UseNewDikeSlopeOutside); + location.UseNewDikeTopWidth = locationRecord.UseNewDikeTopWidth.GetValueOrDefault(location.UseNewDikeTopWidth); + location.UseNewDitchDefinition = locationRecord.UseNewDitchDefinition.GetValueOrDefault(location.UseNewDitchDefinition); + location.UseNewMaxHeightShoulderAsFraction = locationRecord.UseNewMaxHeightShoulderAsFraction.GetValueOrDefault(location.UseNewMaxHeightShoulderAsFraction); + location.UseNewMinDistanceDikeToeStartDitch = locationRecord.UseNewMinDistanceDikeToeStartDitch.GetValueOrDefault(location.UseNewMinDistanceDikeToeStartDitch); + location.UseNewShoulderBaseSlope = locationRecord.UseNewShoulderBaseSlope.GetValueOrDefault(location.UseNewShoulderBaseSlope); + location.UseNewShoulderTopSlope = locationRecord.UseNewShoulderTopSlope.GetValueOrDefault(location.UseNewShoulderTopSlope); + + if (!errorInrecord) + { + dike.Locations.Add(location); + } + else + { + location.Dispose(); + } + } + } + } + } + + private void AddErrorMessage(string errorMessageTranslationId, CsvImporterLocations.LocationRecord locationRecord) + { + AddErrorMessage(errorMessageTranslationId, locationRecord.LocationRecordId); + } + + private void AddErrorMessage(string errorMessageTranslationId, CsvImporterSoilProfiles.SoilProfileRecord soilProfileRecord) + { + AddErrorMessage(errorMessageTranslationId, soilProfileRecord.SoilProfileRecordId); + } + + private void AddErrorMessage(string errorMessageTranslationId, int id) + { + var noIdForSoilProfileRecordError = LocalizationManager.GetTranslatedText(GetType(), errorMessageTranslationId); + var logmessage = new LogMessage( + LogMessageType.Error, this, + String.Format("Record {0} : {1}", + id, + noIdForSoilProfileRecordError + ) + ); + ErrorMessages.Add(logmessage); + } + } +} Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/CultureHelper.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/CultureHelper.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/CultureHelper.cs (revision 3305) @@ -0,0 +1,84 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. +// +// 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.Globalization; +using System.Threading; + +namespace Deltares.Maps +{ + public static class CultureHelper + { + public static void InvokeWithDutchCulture(Action action) + { + var nlCulture = new CultureInfo("nl-NL"); + InvokeWithCulture(nlCulture, action); + } + + public static void InvokeWithUSCulture(Action action) + { + var usCulture = new CultureInfo("en-US"); + InvokeWithCulture(usCulture, action); + } + + public static T InvokeWithDutchCulture<T>(Func<T> func) + { + var culture = new CultureInfo("nl-NL"); + return InvokeWithCulture(culture, func); + } + + public static T InvokeWithUSCulture<T>(Func<T> func) + { + var culture = new CultureInfo("en-US"); + return InvokeWithCulture(culture, func); + } + + public static T InvokeWithCulture<T>(CultureInfo targetCulture, Func<T> func) + { + CultureInfo currentCulture = Thread.CurrentThread.CurrentCulture; + try + { + // set the current thread to dutch culture to mimic floating piont numbers with a comma + Thread.CurrentThread.CurrentCulture = targetCulture; + return func(); + } + finally + { + Thread.CurrentThread.CurrentCulture = currentCulture; + } + } + + public static void InvokeWithCulture(CultureInfo targetCulture, Action testAction) + { + CultureInfo currentCulture = Thread.CurrentThread.CurrentCulture; + try + { + // set the current thread to dutch culture to mimic floating piont numbers with a comma + Thread.CurrentThread.CurrentCulture = targetCulture; + testAction(); + } + finally + { + Thread.CurrentThread.CurrentCulture = currentCulture; + } + } + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Sensors/Group.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Sensors/Group.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Sensors/Group.cs (revision 3305) @@ -0,0 +1,261 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Xml.Serialization; +using Deltares.Standard.Attributes; +using Deltares.Standard.EventPublisher; +using Deltares.Standard.IO.Xml; +using ValidationResult = Deltares.Dam.Data.Specifications.ValidationResult; +using Validator = Deltares.Standard.Specifications.Validator; +using XmlSerializer = Deltares.Standard.IO.Xml.XmlSerializer; + +namespace Deltares.Dam.Data.Sensors +{ + [Serializable] + public class Group + { + /// <summary> + /// Holds a reference to the set of selected sensors + /// </summary> + private readonly HashSet<Sensor> sensors; + private List<Sensor> pickSensors; + private int id; + + /// <summary> + /// Holds a reference to a set of relative loctions along the profile + /// </summary> + private readonly IDictionary<Sensor, double> relativeLocationAlongProfileDictionary; + + public Group() + { + sensors = new HashSet<Sensor>(); + relativeLocationAlongProfileDictionary = new Dictionary<Sensor, double>(); + ID = -1; + DataEventPublisher.AfterChange(this); + } + + /// <summary> + /// Gets or sets the ID. + /// </summary> + /// <value> + /// The ID value should be unique. + /// </value> + [PropertyOrder(1, 1)] + public int ID + { + get { return id; } + set + { + id = value; + DataEventPublisher.AfterChange(this, g => g.ID); + } + } + + /// <summary> + /// Gets the selected sensors. + /// </summary> + [XmlIgnore] + [Browsable(false)] + public IEnumerable<Sensor> Selection + { + get { return sensors; } + } + + /// <summary> + /// Gets or sets the selection as list for UI (table) purposes. + /// </summary> + /// <value> + /// The selection as list. + /// </value> + [XmlIgnore] + [PropertyOrder(1, 2)] + public string SelectionAsString + { + get + { + string res = ""; + foreach (var sensor in sensors) + { + res = res + sensor.ID + "; "; + } + return res; + } + set + { + ClearSelection(); + var locSensors = ParseStringToSensorIDs(value); + if (pickSensors != null) + { + foreach (var sensorID in locSensors) + { + var sensor = PickSensors.Find(x => x.ID == sensorID); + if (sensor != null) + { + Add(sensor); + } + } + } + } + } + + private List<int> ParseStringToSensorIDs(string value) + { + value = value.Trim(); + var ids = new List<int>(); + var idsarr = value.Split(new Char [] {';'}, StringSplitOptions.RemoveEmptyEntries); + foreach (var s in idsarr) + { + try + { + var val = Int32.Parse(s); + ids.Add(val); + } + catch (Exception) + { + // surpress errors, just do not use value + } + } + return ids; + } + + /// <summary> + /// Persistable sensor array. Only for internal use + /// </summary> + [Browsable(false)] + public Sensor[] SensorArray + { + get { return sensors.ToArray(); } + set { + ClearSelection(); + foreach (var sensor in value) + { + Add(sensor); + } + } + } + + /// <summary> + /// Gets the sensor count. + /// </summary> + [Browsable(false)] + public int SensorCount + { + get { return sensors.Count; } + } + + [XmlIgnore] + [Browsable(false)] + public IEnumerable<KeyValuePair<Sensor, double>> SensorRelativeLocations + { + get { return relativeLocationAlongProfileDictionary; } + } + + [XmlIgnore] + [ReadOnly(true)] + public List<Sensor> PickSensors + { + get { return pickSensors; } + set { pickSensors = value; } + } + + /// <summary> + /// Determines whether this instance is valid. + /// </summary> + /// <returns></returns> + public bool IsValid() + { + IEnumerable<ValidationResult> validationResults = Validator.Validate(this); + return !validationResults.Any(); + } + + /// <summary> + /// Determines whether this instance is transient (associated with an invalid ID). + /// </summary> + /// <returns> + /// <c>true</c> if this instance is transient; otherwise, <c>false</c>. + /// </returns> + public bool IsTransient() + { + return ID <= 0; + } + + /// <summary> + /// Sets the relative location. + /// </summary> + /// <param name="sensor">The sensor.</param> + /// <param name="value">The value.</param> + public void SetRelativeLocation(Sensor sensor, double value) + { + relativeLocationAlongProfileDictionary[sensor] = value; + } + + /// <summary> + /// Adds the specified sensor to the selected sensor list for this group. + /// </summary> + /// <param name="sensor">The sensor to add.</param> + public void Add(Sensor sensor) + { + sensors.Add(sensor); + if (!relativeLocationAlongProfileDictionary.ContainsKey(sensor)) + relativeLocationAlongProfileDictionary.Add(sensor, 0); + + } + + /// <summary> + /// Removes the specified sensor from the selected sensor list from this group. + /// </summary> + /// <param name="sensor">The sensor to remove.</param> + public void Remove(Sensor sensor) + { + sensors.Remove(sensor); + if (relativeLocationAlongProfileDictionary.ContainsKey(sensor)) + relativeLocationAlongProfileDictionary.Remove(sensor); + } + + /// <summary> + /// Clears the sensor selection + /// </summary> + public void ClearSelection() + { + sensors.Clear(); + relativeLocationAlongProfileDictionary.Clear(); + } + + public string Serialize() + { + return new XmlSerializer().SerializeToString(this); + } + + public static Group Deserialize(string xml) + { + return (Group)new XmlDeserializer().XmlDeserializeFromString(xml, typeof(Group)); + } + + public override string ToString() + { + return ID.ToString(); + } + } +} Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/CsvImporters/CsvImporterSoilProfiles.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/CsvImporters/CsvImporterSoilProfiles.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/CsvImporters/CsvImporterSoilProfiles.cs (revision 3305) @@ -0,0 +1,137 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. +// +// 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.IO; +using System.Linq; +using System.Threading; +using Deltares.Standard.IO; +using Deltares.Standard.Language; +using LumenWorks.Framework.IO.Csv; + +namespace Deltares.Dam.Data.CsvImporters +{ + public class CsvImporterSoilProfilesException : ApplicationException + { + public CsvImporterSoilProfilesException(string message) + : base(message) + { + } + } + + public class CsvImporterSoilProfiles + { + private List<SoilProfileRecord> soilProfileRecords = new List<SoilProfileRecord>(); + private List<string> errorMessages = new List<string>(); + + public class SoilProfileRecord + { + public int SoilProfileRecordId { get; set; } + public string SoilProfileId { get; set; } + public double TopLevel { get; set; } + public string SoilName { get; set; } + } + + private void CheckColumn(int index, string fileName, string fieldName) + { + if (index < 0) + { + var csvHeaderFieldError = LocalizationManager.GetTranslatedText(this.GetType(), "csvHeaderFieldError"); + throw new CsvImporterSoilProfilesException(String.Format("{0} : {1} {2}", fileName, csvHeaderFieldError, + fieldName)); + } + } + + public CsvImporterSoilProfiles(string fileName) + { + errorMessages.Clear(); + ThrowHelper.ThrowIfStringArgumentNullOrEmpty(fileName, StringResourceNames.CsvFileNotValid); + ThrowHelper.ThrowIfFileNotExist(fileName, StringResourceNames.CsvFileNotFound); + + var oldcur = Thread.CurrentThread.CurrentCulture; + try + { + Thread.CurrentThread.CurrentCulture = CsvReaderUtilities.DetermineCultureForFile(fileName); + using (CsvReader csv = new CsvReader(new StreamReader(fileName), true, ';')) + { + string[] headers = CsvImporterHelper.GetFieldHeaders(this, csv); + // The definition of the csv contains one extra column (soiltype) which is now obsolete. + // So number of columns may be 3 or 4. + if ((headers.Count() < 3) || (headers.Count() > 4)) + { + var csvHeaderError = LocalizationManager.GetTranslatedText(this.GetType(), "csvHeaderError"); + throw new CsvImporterSoilProfilesException(String.Format("{0} : {1}", fileName, csvHeaderError)); + } + const string fieldsoilprofile_id = "soilprofile_id"; + int colIndexSoilProfileId = CsvReaderUtilities.GetHeaderIndexByString(headers, fieldsoilprofile_id); + CheckColumn(colIndexSoilProfileId, fileName, fieldsoilprofile_id); + + const string fieldtop_level = "top_level"; + int colIndexTopLevel = CsvReaderUtilities.GetHeaderIndexByString(headers, fieldtop_level); + CheckColumn(colIndexTopLevel, fileName, fieldtop_level); + + const string fieldsoil_name = "soil_name"; + int colIndexSoilName = CsvReaderUtilities.GetHeaderIndexByString(headers, fieldsoil_name); + CheckColumn(colIndexSoilName, fileName, fieldsoil_name); + var index = 1; + while (csv.ReadNextRecord()) + { + var soilProfile = new SoilProfileRecord(); + int colIndex = -1; // Keep track of column for error message + try + { + soilProfile.SoilProfileRecordId = index; + index++; + colIndex = colIndexSoilProfileId; + soilProfile.SoilProfileId = csv[colIndexSoilProfileId]; + colIndex = colIndexTopLevel; + soilProfile.TopLevel = Convert.ToDouble(csv[colIndexTopLevel]); + colIndex = colIndexSoilName; + soilProfile.SoilName = csv[colIndexSoilName]; + soilProfileRecords.Add(soilProfile); + } + catch (Exception e) + { + var csvSoilProfileError = String.Format(LocalizationManager.GetTranslatedText(this.GetType(), "csvSoilProfileError"), soilProfile.SoilProfileId, colIndex + 1); + errorMessages.Add(String.Format("Record {0} : {1}", index, csvSoilProfileError + e.Message)); + } + } + } + } + finally + { + Thread.CurrentThread.CurrentCulture = oldcur; + } + } + + public List<SoilProfileRecord> ImportedItems + { + get { return soilProfileRecords; } + } + + public List<string> ErrorMessages + { + get { return errorMessages; } + set { errorMessages = value; } + } + } +} Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DataPlugins/Configuration/DataSourceContainer.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DataPlugins/Configuration/DataSourceContainer.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DataPlugins/Configuration/DataSourceContainer.cs (revision 3305) @@ -0,0 +1,212 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Xml.Serialization; +using Deltares.Geotechnics; +using Deltares.Geotechnics.SurfaceLines; +using Deltares.Standard; +using Deltares.Standard.IO; +using Deltares.Standard.IO.Xml; +using XmlSerializer = Deltares.Standard.IO.Xml.XmlSerializer; + +namespace Deltares.Dam.Data.DataPlugins.Configuration +{ + public class DataSourceContainer + { + private string mapSoilProfile2D = null; + private string sensorConfigurationFilename = null; + private bool isImportAsRelativeProfiles; + private CharacteristicPointType soilProfileCharacteristicPointReference; + private List<DataAttribute> dataAttributes; + private List<DataSource> dataSourceList = new List<DataSource>(); + private string dataSourceEsriProjection = null; + + /// <summary> + /// Initializes a new instance of the <see cref="DataSourceContainer"/> class. + /// </summary> + public DataSourceContainer() + { + this.dataAttributes = new List<DataAttribute>(); + } + + /// <summary> + /// Adds the specified attribute. + /// </summary> + /// <param name="attribute">The attribute.</param> + public void Add(DataAttribute attribute) + { + this.dataAttributes.Add(attribute); + } + + /// <summary> + /// Gets or sets the data source esri projection. + /// </summary> + /// <value> + /// The data source esri projection. + /// </value> + public string DataSourceEsriProjection + { + get { return this.dataSourceEsriProjection; } + set { this.dataSourceEsriProjection = value; } + } + + /// <summary> + /// Gets or sets the map soil profile2 d. + /// </summary> + /// <value> + /// The map soil profile2 d. + /// </value> + public string MapSoilProfile2D + { + get { return this.mapSoilProfile2D; } + set { this.mapSoilProfile2D = value; } + } + + /// <summary> + /// Gets or sets the sensor configuration filename. + /// </summary> + /// <value> + /// The sensor configuration filename. + /// </value> + public string SensorConfigurationFilename + { + get { return this.sensorConfigurationFilename; } + set { this.sensorConfigurationFilename = value; } + } + + /// <summary> + /// Gets or sets the soil profile characteristic point reference. + /// </summary> + /// <value> + /// The soil profile characteristic point reference. + /// </value> + public CharacteristicPointType SoilProfileCharacteristicPointReference + { + get { return this.soilProfileCharacteristicPointReference; } + set { this.soilProfileCharacteristicPointReference = value; } + } + + /// <summary> + /// Gets or sets a value indicating whether this instance is import as relative profiles. + /// </summary> + /// <value> + /// <c>true</c> if this instance is import as relative profiles; otherwise, <c>false</c>. + /// </value> + public bool IsImportAsRelativeProfiles + { + get { return this.isImportAsRelativeProfiles; } + set { this.isImportAsRelativeProfiles = value; } + } + + /// <summary> + /// Gets or sets the data source list. + /// </summary> + /// <value> + /// The data source list. + /// </value> + public List<DataSource> DataSourceList + { + get { return this.dataSourceList; } + set { this.dataSourceList = value; } + } + + /// <summary> + /// Gets or sets the data attributes. + /// </summary> + /// <value> + /// The data attributes. + /// </value> + [XmlArrayItem("Attribute")] + public List<DataAttribute> DataAttributes + { + get { return this.dataAttributes; } + set { this.dataAttributes = value; } + } + + /// <summary> + /// Serializes the specified container. + /// </summary> + /// <param name="container">The container.</param> + /// <param name="file">The file.</param> + /// <exception cref="System.ArgumentNullException"> + /// container + /// or + /// file + /// </exception> + public static void Serialize(DataSourceContainer container, string file) + { + if (container == null) + throw new ArgumentNullException("container"); + if (file == null) + throw new ArgumentNullException("file"); + + var xmlSerializer = new XmlSerializer(); + xmlSerializer.Serialize(container, file); + } + + /// <summary> + /// Deserializes the specified file. + /// </summary> + /// <param name="file">The file.</param> + /// <returns></returns> + /// <exception cref="System.ArgumentNullException">file</exception> + public static DataSourceContainer Deserialize(string file) + { + if (file == null) + throw new ArgumentNullException("file"); + + var xmlDeserializer = new XmlDeserializer(); + var classFactory = new DefaultClassFactory(); + var container = (DataSourceContainer)xmlDeserializer.XmlDeserialize(file, typeof(DataSourceContainer), classFactory); + return container; + } + + /// <summary> + /// Validates the specified container. + /// </summary> + /// <param name="container">The container.</param> + /// <param name="allowedAttributes">The allowed attributes.</param> + /// <returns></returns> + /// <exception cref="System.ArgumentNullException"> + /// container + /// or + /// allowedAttributes + /// </exception> + public static IEnumerable<Exception> Validate(DataSourceContainer container, IEnumerable<string> allowedAttributes) + { + if (container == null) + throw new ArgumentNullException("container"); + if (allowedAttributes == null) + throw new ArgumentNullException("allowedAttributes"); + + if (container.DataAttributes != null) + { + foreach (var attribute in container.DataAttributes.Where(attribute => !allowedAttributes.Contains(attribute.AttributeName))) + { + yield return new NotSupportedException(string.Format("The attribute {0} is not supported.", attribute)); + } + } + } + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/MStabParameters.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/MStabParameters.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/MStabParameters.cs (revision 3305) @@ -0,0 +1,822 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. +// +// 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.ComponentModel; +using System.Xml.Serialization; +using Deltares.Standard.Attributes; +using Deltares.Standard.EventPublisher; +using Deltares.Standard.Validation; + +namespace Deltares.Dam.Data +{ + using Deltares.Standard; + + public enum TangentLinesDefinition + { + OnBoundaryLines = 0, + Specified = 1 + } + + public enum GridSizeDetermination + { + Automatic = 0, + Specified = 1 + } + + public class SheetPiling : IAssignable<SheetPiling>, ICloneable<SheetPiling> + { + public double XCoordinate { get; set; } + public double YCoordinate { get; set; } + public double ZCoordinate { get; set; } + public double Length { get; set; } + + public void Assign(SheetPiling sheetPiling) + { + this.XCoordinate = sheetPiling.XCoordinate; + this.YCoordinate = sheetPiling.YCoordinate; + this.ZCoordinate = sheetPiling.ZCoordinate; + this.Length = sheetPiling.Length; + } + + public SheetPiling Clone() + { + var sheetPiling = new SheetPiling(); + sheetPiling.Assign(this); + return sheetPiling; + } + } + + public class HorizontalBalanceArea : IAssignable<HorizontalBalanceArea>, ICloneable<HorizontalBalanceArea> + { + public double XLeft { get; set; } + public double XRight { get; set; } + public double YTop { get; set; } + public double YBottom { get; set; } + public int PlaneCount { get; set; } + public void Assign(HorizontalBalanceArea horizontalBalanceArea) + { + this.XLeft = horizontalBalanceArea.XLeft; + this.XRight = horizontalBalanceArea.XRight; + this.YTop = horizontalBalanceArea.YTop; + this.YBottom = horizontalBalanceArea.YBottom; + this.PlaneCount = horizontalBalanceArea.PlaneCount; + } + + public HorizontalBalanceArea Clone() + { + var horizontalBalanceArea = new HorizontalBalanceArea(); + horizontalBalanceArea.Assign(this); + return horizontalBalanceArea; + } + } + + public class SlipCircleDefinition : IVisibleEnabled, IAssignable<SlipCircleDefinition>, ICloneable<SlipCircleDefinition> + { + private double xCoordinateLastUpliftPoint; + private int upliftVanLeftGridVerticalPointCount; + private double upliftVanTangentLinesDistance; + private double bishopTangentLinesDistance; + private double upliftVanLeftGridVerticalPointDistance; + private int upliftVanLeftGridHorizontalPointCount; + private double upliftVanLeftGridHorizontalPointDistance; + private int upliftVanRightGridVerticalPointCount; + private double upliftVanRightGridVerticalPointDistance; + private int upliftVanRightGridHorizontalPointCount; + private double upliftVanRightGridHorizontalPointDistance; + private int bishopGridHorizontalPointCount; + private double bishopGridHorizontalPointDistance; + private int bishopGridVerticalPointCount; + private double bishopGridVerticalPointDistance; + + [Format("F2")] + public double XCoordinateLastUpliftPoint + { + get + { + return xCoordinateLastUpliftPoint; + } + set + { + DataEventPublisher.BeforeChange(this, "XCoordinateLastUpliftPoint"); + xCoordinateLastUpliftPoint = value; + DataEventPublisher.AfterChange(this, "XCoordinateLastUpliftPoint"); + } + } + public TangentLinesDefinition UpliftVanTangentLinesDefinition { get; set; } + [Format("F2")] + [Minimum(0.01)] + [Maximum(1000.0)] + public double UpliftVanTangentLinesDistance + { + get + { + return upliftVanTangentLinesDistance; + } + set + { + DataEventPublisher.BeforeChange(this, "UpliftVanTangentLinesDistance"); + upliftVanTangentLinesDistance = value; + DataEventPublisher.AfterChange(this, "UpliftVanTangentLinesDistance"); + } + } + public TangentLinesDefinition BishopTangentLinesDefinition { get; set; } + [Format("F2")] + [Minimum(0.01)] + [Maximum(1000.0)] + public double BishopTangentLinesDistance + { + get + { + return bishopTangentLinesDistance; + } + set + { + DataEventPublisher.BeforeChange(this, "BishopTangentLinesDistance"); + bishopTangentLinesDistance = value; + DataEventPublisher.AfterChange(this, "BishopTangentLinesDistance"); + } + } + public GridSizeDetermination GridSizeDetermination { get; set; } + [Minimum(1)] + [Maximum(100)] + public int UpliftVanLeftGridVerticalPointCount + { + get + { + return upliftVanLeftGridVerticalPointCount; + } + set + { + DataEventPublisher.BeforeChange(this, "UpliftVanLeftGridVerticalPointCount"); + upliftVanLeftGridVerticalPointCount = value; + DataEventPublisher.AfterChange(this, "UpliftVanLeftGridVerticalPointCount"); + } + } + [Format("F2")] + [Minimum(0.01)] + [Maximum(1000.0)] + public double UpliftVanLeftGridVerticalPointDistance + { + get + { + return upliftVanLeftGridVerticalPointDistance; + } + set + { + DataEventPublisher.BeforeChange(this, "UpliftVanLeftGridVerticalPointDistance"); + upliftVanLeftGridVerticalPointDistance = value; + DataEventPublisher.AfterChange(this, "UpliftVanLeftGridVerticalPointDistance"); + } + } + [Minimum(1)] + [Maximum(100)] + public int UpliftVanLeftGridHorizontalPointCount + { + get + { + return upliftVanLeftGridHorizontalPointCount; + } + set + { + DataEventPublisher.BeforeChange(this, "UpliftVanLeftGridHorizontalPointCount"); + upliftVanLeftGridHorizontalPointCount = value; + DataEventPublisher.AfterChange(this, "UpliftVanLeftGridHorizontalPointCount"); + } + } + [Format("F2")] + [Minimum(0.01)] + [Maximum(1000.0)] + public double UpliftVanLeftGridHorizontalPointDistance + { + get + { + return upliftVanLeftGridHorizontalPointDistance; + } + set + { + DataEventPublisher.BeforeChange(this, "UpliftVanLeftGridHorizontalPointDistance"); + upliftVanLeftGridHorizontalPointDistance = value; + DataEventPublisher.AfterChange(this, "UpliftVanLeftGridHorizontalPointDistance"); + } + } + [Minimum(1)] + [Maximum(100)] + public int UpliftVanRightGridVerticalPointCount + { + get + { + return upliftVanRightGridVerticalPointCount; + } + set + { + DataEventPublisher.BeforeChange(this, "UpliftVanRightGridVerticalPointCount"); + upliftVanRightGridVerticalPointCount = value; + DataEventPublisher.AfterChange(this, "UpliftVanRightGridVerticalPointCount"); + } + } + [Format("F2")] + [Minimum(0.01)] + [Maximum(1000.0)] + public double UpliftVanRightGridVerticalPointDistance + { + get + { + return upliftVanRightGridVerticalPointDistance; + } + set + { + DataEventPublisher.BeforeChange(this, "UpliftVanRightGridVerticalPointDistance"); + upliftVanRightGridVerticalPointDistance = value; + DataEventPublisher.AfterChange(this, "UpliftVanRightGridVerticalPointDistance"); + } + } + [Minimum(1)] + [Maximum(100)] + public int UpliftVanRightGridHorizontalPointCount + { + get + { + return upliftVanRightGridHorizontalPointCount; + } + set + { + DataEventPublisher.BeforeChange(this, "UpliftVanRightGridHorizontalPointCount"); + upliftVanRightGridHorizontalPointCount = value; + DataEventPublisher.AfterChange(this, "UpliftVanRightGridHorizontalPointCount"); + } + } + [Format("F2")] + [Minimum(0.01)] + [Maximum(1000.0)] + public double UpliftVanRightGridHorizontalPointDistance + { + get + { + return upliftVanRightGridHorizontalPointDistance; + } + set + { + DataEventPublisher.BeforeChange(this, "UpliftVanRightGridHorizontalPointDistance"); + upliftVanRightGridHorizontalPointDistance = value; + DataEventPublisher.AfterChange(this, "UpliftVanRightGridHorizontalPointDistance"); + } + } + [Minimum(1)] + [Maximum(100)] + public int BishopGridVerticalPointCount + { + get + { + return bishopGridVerticalPointCount; + } + set + { + DataEventPublisher.BeforeChange(this, "BishopGridVerticalPointCount"); + bishopGridVerticalPointCount = value; + DataEventPublisher.AfterChange(this, "BishopGridVerticalPointCount"); + } + } + [Format("F2")] + [Minimum(0.01)] + [Maximum(1000.0)] + public double BishopGridVerticalPointDistance + { + get + { + return bishopGridVerticalPointDistance; + } + set + { + DataEventPublisher.BeforeChange(this, "BishopGridVerticalPointDistance"); + bishopGridVerticalPointDistance = value; + DataEventPublisher.AfterChange(this, "BishopGridVerticalPointDistance"); + } + } + [Minimum(1)] + [Maximum(100)] + public int BishopGridHorizontalPointCount + { + get + { + return bishopGridHorizontalPointCount; + } + set + { + DataEventPublisher.BeforeChange(this, "BishopGridHorizontalPointCount"); + bishopGridHorizontalPointCount = value; + DataEventPublisher.AfterChange(this, "BishopGridHorizontalPointCount"); + } + } + [Format("F2")] + [Minimum(0.01)] + [Maximum(1000.0)] + public double BishopGridHorizontalPointDistance + { + get + { + return bishopGridHorizontalPointDistance; + } + set + { + DataEventPublisher.BeforeChange(this, "BishopGridHorizontalPointDistance"); + bishopGridHorizontalPointDistance = value; + DataEventPublisher.AfterChange(this, "BishopGridHorizontalPointDistance"); + } + } + + public DamFailureMechanismeCalculationSpecification Specification { get; set; } + + public bool IsVisible(string property) + { + if (Specification == null) + return true; + + switch (property) + { + case "GridSizeDetermination": return IsStabiltyUpliftVan() || IsStabiltyBishopUpliftVan() || IsStabiltyBishop(); + // Uplift Van + case "UpliftVanTangentLinesDefinition": + return IsStabiltyUpliftVan() || IsStabiltyBishopUpliftVan(); + case "UpliftVanTangentLinesDistance": + return IsStabiltyUpliftVan() || IsStabiltyBishopUpliftVan(); + case "UpliftVanLeftGridVerticalPointCount": + return IsStabiltyUpliftVan() || IsStabiltyBishopUpliftVan(); + case "UpliftVanLeftGridVerticalPointDistance": + return IsStabiltyUpliftVan() || IsStabiltyBishopUpliftVan(); + case "UpliftVanLeftGridHorizontalPointCount": + return IsStabiltyUpliftVan() || IsStabiltyBishopUpliftVan(); + case "UpliftVanLeftGridHorizontalPointDistance": + return IsStabiltyUpliftVan() || IsStabiltyBishopUpliftVan(); + case "UpliftVanRightGridVerticalPointCount": + return IsStabiltyUpliftVan() || IsStabiltyBishopUpliftVan(); + case "UpliftVanRightGridVerticalPointDistance": + return IsStabiltyUpliftVan() || IsStabiltyBishopUpliftVan(); + case "UpliftVanRightGridHorizontalPointCount": + return IsStabiltyUpliftVan() || IsStabiltyBishopUpliftVan(); + case "UpliftVanRightGridHorizontalPointDistance": + return IsStabiltyUpliftVan() || IsStabiltyBishopUpliftVan(); + + // Bishop + case "BishopTangentLinesDefinition": + return false; //IsStabiltyBishop() || IsStabiltyBishopUpliftVan(); False for now. See MWDAM-640. + case "BishopTangentLinesDistance": + return false; //IsStabiltyBishop() || IsStabiltyBishopUpliftVan(); False for now. See MWDAM-640. + case "BishopGridVerticalPointCount": + return IsStabiltyBishop() || IsStabiltyBishopUpliftVan(); + case "BishopGridVerticalPointDistance": + return IsStabiltyBishop() || IsStabiltyBishopUpliftVan(); + case "BishopGridHorizontalPointCount": + return IsStabiltyBishop() || IsStabiltyBishopUpliftVan(); + case "BishopGridHorizontalPointDistance": + return IsStabiltyBishop() || IsStabiltyBishopUpliftVan(); + default: return true; + } + } + + private bool IsStabiltyBishop() + { + return ((Specification.FailureMechanismSystemType == FailureMechanismSystemType.StabilityInside || + Specification.FailureMechanismSystemType == FailureMechanismSystemType.StabilityOutside) && + (MStabModelType)Specification.CalculationModel == MStabModelType.Bishop); + } + + private bool IsStabiltyUpliftVan() + { + return ((Specification.FailureMechanismSystemType == FailureMechanismSystemType.StabilityInside || + Specification.FailureMechanismSystemType == FailureMechanismSystemType.StabilityOutside) && + (MStabModelType)Specification.CalculationModel == MStabModelType.UpliftVan); + } + + private bool IsStabiltyBishopUpliftVan() + { + return ((Specification.FailureMechanismSystemType == FailureMechanismSystemType.StabilityInside || + Specification.FailureMechanismSystemType == FailureMechanismSystemType.StabilityOutside) && + (MStabModelType)Specification.CalculationModel == MStabModelType.BishopUpliftVan); + } + + public bool IsEnabled(string property) + { + if (Specification == null) + return true; + + switch (property) + { + // Uplift Van + case "UpliftVanTangentLinesDefinition": + return true; + case "UpliftVanTangentLinesDistance": + return UpliftVanTangentLinesDefinition == TangentLinesDefinition.Specified; + case "UpliftVanLeftGridVerticalPointCount": + return GridSizeDetermination == GridSizeDetermination.Specified; + case "UpliftVanLeftGridVerticalPointDistance": + return GridSizeDetermination == GridSizeDetermination.Specified; + case "UpliftVanLeftGridHorizontalPointCount": + return GridSizeDetermination == GridSizeDetermination.Specified; + case "UpliftVanLeftGridHorizontalPointDistance": + return GridSizeDetermination == GridSizeDetermination.Specified; + case "UpliftVanRightGridVerticalPointCount": + return GridSizeDetermination == GridSizeDetermination.Specified; + case "UpliftVanRightGridVerticalPointDistance": + return GridSizeDetermination == GridSizeDetermination.Specified; + case "UpliftVanRightGridHorizontalPointCount": + return GridSizeDetermination == GridSizeDetermination.Specified; + case "UpliftVanRightGridHorizontalPointDistance": + return GridSizeDetermination == GridSizeDetermination.Specified; + + // Bishop + case "BishopTangentLinesDefinition": + return true; + case "BishopTangentLinesDistance": + return BishopTangentLinesDefinition == TangentLinesDefinition.Specified; + case "BishopGridVerticalPointCount": + return GridSizeDetermination == GridSizeDetermination.Specified; + case "BishopGridVerticalPointDistance": + return GridSizeDetermination == GridSizeDetermination.Specified; + case "BishopGridHorizontalPointCount": + return GridSizeDetermination == GridSizeDetermination.Specified; + case "BishopGridHorizontalPointDistance": + return GridSizeDetermination == GridSizeDetermination.Specified; + default: return true; + } + } + + public void Assign(SlipCircleDefinition slipCircleDefinition) + { + this.XCoordinateLastUpliftPoint = slipCircleDefinition.XCoordinateLastUpliftPoint; + this.UpliftVanTangentLinesDefinition = slipCircleDefinition.UpliftVanTangentLinesDefinition; + this.UpliftVanTangentLinesDistance = slipCircleDefinition.UpliftVanTangentLinesDistance; + this.BishopTangentLinesDefinition = slipCircleDefinition.BishopTangentLinesDefinition; + this.BishopTangentLinesDistance = slipCircleDefinition.BishopTangentLinesDistance; + this.GridSizeDetermination = slipCircleDefinition.GridSizeDetermination; + this.UpliftVanLeftGridVerticalPointCount = slipCircleDefinition.UpliftVanLeftGridVerticalPointCount; + this.UpliftVanLeftGridVerticalPointDistance = slipCircleDefinition.UpliftVanLeftGridVerticalPointDistance; + this.UpliftVanLeftGridHorizontalPointCount = slipCircleDefinition.UpliftVanLeftGridHorizontalPointCount; + this.UpliftVanLeftGridHorizontalPointDistance = slipCircleDefinition.UpliftVanLeftGridHorizontalPointDistance; + this.UpliftVanRightGridVerticalPointCount = slipCircleDefinition.UpliftVanRightGridVerticalPointCount; + this.UpliftVanRightGridVerticalPointDistance = slipCircleDefinition.UpliftVanRightGridVerticalPointDistance; + this.UpliftVanRightGridHorizontalPointCount = slipCircleDefinition.UpliftVanRightGridHorizontalPointCount; + this.UpliftVanRightGridHorizontalPointDistance = slipCircleDefinition.UpliftVanRightGridHorizontalPointDistance; + this.BishopGridVerticalPointCount = slipCircleDefinition.BishopGridVerticalPointCount; + this.BishopGridVerticalPointDistance = slipCircleDefinition.BishopGridVerticalPointDistance; + this.BishopGridHorizontalPointCount = slipCircleDefinition.BishopGridHorizontalPointCount; + this.BishopGridHorizontalPointDistance = slipCircleDefinition.BishopGridHorizontalPointDistance; + } + + public SlipCircleDefinition Clone() + { + var slipCircleDefinition = new SlipCircleDefinition(); + slipCircleDefinition.Assign(this); + return slipCircleDefinition; + } + } + + public class MStabZoneAreas : IAssignable<MStabZoneAreas>, ICloneable<MStabZoneAreas> + { + public double DikeTableHeight { get; set; } + public double DikeTableWidth { get; set; } + public double XCoordinateDikeTopAtRiver { get; set; } + public double XCoordinateDikeTopAtPolder { get; set; } + public double XCoordinateStartRestProfile { get; set; } + public double SafetyFactorZone1A { get; set; } + public double SafetyFactorZone1B { get; set; } + public void Assign(MStabZoneAreas mstabZoneAreas) + { + this.DikeTableHeight = mstabZoneAreas.DikeTableHeight; + this.DikeTableWidth = mstabZoneAreas.DikeTableWidth; + this.XCoordinateDikeTopAtRiver = mstabZoneAreas.XCoordinateDikeTopAtRiver; + this.XCoordinateDikeTopAtPolder = mstabZoneAreas.XCoordinateDikeTopAtPolder; + this.XCoordinateStartRestProfile = mstabZoneAreas.XCoordinateStartRestProfile; + this.SafetyFactorZone1A = mstabZoneAreas.SafetyFactorZone1A; + this.SafetyFactorZone1B = mstabZoneAreas.SafetyFactorZone1B; + } + + public MStabZoneAreas Clone() + { + var mstabZoneAreas = new MStabZoneAreas(); + mstabZoneAreas.Assign(this); + return mstabZoneAreas; + } + } + + public class MStabForbiddenZone : IAssignable<MStabForbiddenZone>, ICloneable<MStabForbiddenZone> + { + public bool IsXEntryMinUsed { get; set; } + public bool IsXEntryMaxUsed { get; set; } + public double XEntryMin { get; set; } + public double XEntryMax { get; set; } + public void Assign(MStabForbiddenZone mstabForbiddenZone) + { + this.IsXEntryMinUsed = mstabForbiddenZone.IsXEntryMinUsed; + this.IsXEntryMaxUsed = mstabForbiddenZone.IsXEntryMaxUsed; + this.XEntryMin = mstabForbiddenZone.XEntryMin; + this.XEntryMax = mstabForbiddenZone.XEntryMax; + } + + public MStabForbiddenZone Clone() + { + var mstabForbiddenZone = new MStabForbiddenZone(); + mstabForbiddenZone.Assign(this); + return mstabForbiddenZone; + } + } + + public class MStabDesignEmbankment : IAssignable<MStabDesignEmbankment>, ICloneable<MStabDesignEmbankment> + { + public string EmbankmentMaterialname { get; set; } + public string PreviousGeometry2DFilename { get; set; } + public void Assign(MStabDesignEmbankment mstabDesignEmbankment) + { + this.EmbankmentMaterialname = mstabDesignEmbankment.EmbankmentMaterialname; + this.PreviousGeometry2DFilename = mstabDesignEmbankment.PreviousGeometry2DFilename; + } + + public MStabDesignEmbankment Clone() + { + var mstabDesignEmbankment = new MStabDesignEmbankment(); + mstabDesignEmbankment.Assign(this); + return mstabDesignEmbankment; + } + } + + public class MStabGeometryCreationOptions : IAssignable<MStabGeometryCreationOptions>, ICloneable<MStabGeometryCreationOptions> + { + public MStabGeometryCreationOptions() + { + SoilProfileType = SoilProfileType.SoilProfile1D; + SoilGeometry2DFilename = ""; + XOffsetSoilGeometry2DOrigin = 0.0; + MaterialForDike = ""; + MaterialForShoulder = ""; + IsDrySituation = false; + PLLineAssignment = PLLineAssignment.ExpertKnowledge; + IntrusionVerticalWaterPressureType = IntrusionVerticalWaterPressureType.Standard; + PenetrationLength = 0.0; + IsDesign = false; + } + [XmlOldName("SoilGeometryType")] + public SoilProfileType SoilProfileType { get; set; } + public string SoilGeometry2DFilename { get; set; } + public double XOffsetSoilGeometry2DOrigin { get; set; } + public string MaterialForDike { get; set; } + public string MaterialForShoulder { get; set; } + public bool IsDrySituation { get; set; } + public PLLineAssignment PLLineAssignment { get; set; } + public IntrusionVerticalWaterPressureType IntrusionVerticalWaterPressureType { get; set; } + public double PenetrationLength { get; set; } + public bool IsDesign { get; set; } + + public void Assign(MStabGeometryCreationOptions mstabGeometryCreationOptions) + { + this.SoilProfileType = mstabGeometryCreationOptions.SoilProfileType; + this.SoilGeometry2DFilename = mstabGeometryCreationOptions.SoilGeometry2DFilename; + this.XOffsetSoilGeometry2DOrigin = mstabGeometryCreationOptions.XOffsetSoilGeometry2DOrigin; + this.MaterialForDike = mstabGeometryCreationOptions.MaterialForDike; + this.MaterialForShoulder = mstabGeometryCreationOptions.MaterialForShoulder; + this.IsDrySituation = mstabGeometryCreationOptions.IsDrySituation; + this.PLLineAssignment = mstabGeometryCreationOptions.PLLineAssignment; + this.IntrusionVerticalWaterPressureType = mstabGeometryCreationOptions.IntrusionVerticalWaterPressureType; + this.PenetrationLength = mstabGeometryCreationOptions.PenetrationLength; + this.IsDesign = mstabGeometryCreationOptions.IsDesign; + } + + public MStabGeometryCreationOptions Clone() + { + var mstabGeometryCreationOptions = new MStabGeometryCreationOptions(); + mstabGeometryCreationOptions.Assign(this); + return mstabGeometryCreationOptions; + } + } + + public class MStabCalculationOptions : IAssignable<MStabCalculationOptions>, ICloneable<MStabCalculationOptions> + { + public double MinimalCircleDepth { get; set; } + [Label("MStab Zone Types")] + [ReadOnly(true)] + public MStabZonesType ZonesType { get; set; } + + public void Assign(MStabCalculationOptions mstabCalculationOptions) + { + this.MinimalCircleDepth = mstabCalculationOptions.MinimalCircleDepth; + this.ZonesType = mstabCalculationOptions.ZonesType; + } + + public MStabCalculationOptions Clone() + { + var mstabCalculationOptions = new MStabCalculationOptions(); + mstabCalculationOptions.Assign(this); + return mstabCalculationOptions; + } + } + + public class MStabParameters : ICloneable<MStabParameters>, IVisibleEnabled + { + private MStabGridPosition gridPosition; + + public MStabParameters() + { + this.IsCalculateAllStabilityProjectsAtOnce = true; + this.IsOverrulePLLineCreationMethod = false; + this.PLLineCreationMethod = PLLineCreationMethod.ExpertKnowledgeRRD; + this.Model = MStabModelType.Bishop; + this.SearchMethod = MStabSearchMethod.Grid; + this.ZoneAreas = null; + this.gridPosition = MStabGridPosition.Right; + this.CalculationOptions = new MStabCalculationOptions(); + this.GeometryCreationOptions = new MStabGeometryCreationOptions(); + this.SheetPiling = null; + this.HorizontalBalanceArea = new HorizontalBalanceArea(); + this.SlipCircleDefinition = new SlipCircleDefinition(); + } + + public bool IsCombinedBishopUpliftVanCalculation { get { return (Model == MStabModelType.BishopUpliftVan); } } + // IsCombinedBishopUpliftVanCalculation (formerly IsAutoSelectCalculation) is the same as Model == MStabModel.BishopUpliftVan + // This property was first implemented for FewsDam and later MStabModel.BishopUpliftVan was implemented for normal DAM operation + // Now we will use Model == MStabModel.BishopUpliftVan for both FewsDam and DAM + // This readonly property is implemented for backward compatibiity + + public bool IsCalculateAllStabilityProjectsAtOnce { get; set; } + // Normally PLLine creation is specified per location. + // If IsOverrulePLLineCreationMethod is set to true the settings in the locations will be + // overruled with the value in PLLineCreationMethod + public bool IsOverrulePLLineCreationMethod { get; set; } + public PLLineCreationMethod PLLineCreationMethod { get; set; } + [Label("Model")] + public MStabModelType Model { get; set; } + [Label("Shear Strength")] + public MStabShearStrength ShearStrength { get; set; } + [Label("Search Method")] + public MStabSearchMethod SearchMethod { get; set; } + public bool IsProbabilistic { get; set; } + public string ProjectFileName { get; set; } + public string SoilDatabaseName { get; set; } + public MStabZoneAreas ZoneAreas { get; set; } + public MStabForbiddenZone ForbiddenZone { get; set; } + public MStabGeometryCreationOptions GeometryCreationOptions { get; set; } + public SheetPiling SheetPiling { get; set; } + public HorizontalBalanceArea HorizontalBalanceArea { get; set; } + [Validate] + public SlipCircleDefinition SlipCircleDefinition { get; set; } + public MStabCalculationOptions CalculationOptions { get; set; } + + public MStabGridPosition GridPosition + { + get { return gridPosition; } + set + { + DataEventPublisher.BeforeChange(this, "GridPosition"); + gridPosition = value; + DataEventPublisher.AfterChange(this, "GridPosition"); + } + } + + public void Assign(MStabParameters mstabParameters) + { + this.Model = mstabParameters.Model; + this.ShearStrength = mstabParameters.ShearStrength; + this.SearchMethod = mstabParameters.SearchMethod; + this.IsProbabilistic = mstabParameters.IsProbabilistic; + this.GridPosition = mstabParameters.GridPosition; + this.ProjectFileName = mstabParameters.ProjectFileName; + this.SoilDatabaseName = mstabParameters.SoilDatabaseName; + if (this.ZoneAreas != null) + { + this.ZoneAreas.Assign(mstabParameters.ZoneAreas); + } + else + { + this.ZoneAreas = null; + } + if (this.ForbiddenZone != null) + { + this.ForbiddenZone.Assign(mstabParameters.ForbiddenZone); + } + else + { + this.ForbiddenZone = null; + } + if (this.CalculationOptions != null) + { + this.CalculationOptions.Assign(mstabParameters.CalculationOptions); + } + else + { + this.CalculationOptions = null; + } + if (this.GeometryCreationOptions != null) + { + this.GeometryCreationOptions.Assign(mstabParameters.GeometryCreationOptions); + } + else + { + this.GeometryCreationOptions = null; + } + if (this.SheetPiling != null) + { + this.SheetPiling.Assign(mstabParameters.SheetPiling); + } + else + { + this.SheetPiling = null; + } + if (this.HorizontalBalanceArea != null) + { + this.HorizontalBalanceArea.Assign(mstabParameters.HorizontalBalanceArea); + } + else + { + this.HorizontalBalanceArea = null; + } + this.SoilDatabaseName = mstabParameters.SoilDatabaseName; + if (this.SlipCircleDefinition != null) + { + this.SlipCircleDefinition.Assign(mstabParameters.SlipCircleDefinition); + } + else + { + this.SlipCircleDefinition = null; + } + } + + [Label("MStab Zone Types")] + [ReadOnly(true)] + [XmlIgnore] + public MStabZonesType ZonesType + { + get { return this.CalculationOptions.ZonesType; } + set { this.CalculationOptions.ZonesType = value; } + } + + public MStabParameters Clone() + { + var mstabParameters = new MStabParameters(); + if (this.ZoneAreas != null) + mstabParameters.ZoneAreas = this.ZoneAreas.Clone(); + if (this.ForbiddenZone != null) + mstabParameters.ForbiddenZone = this.ForbiddenZone.Clone(); + if (this.GeometryCreationOptions != null) + mstabParameters.GeometryCreationOptions = this.GeometryCreationOptions.Clone(); + if (this.SheetPiling != null) + mstabParameters.SheetPiling = this.SheetPiling.Clone(); + if (this.HorizontalBalanceArea != null) + mstabParameters.HorizontalBalanceArea = this.HorizontalBalanceArea.Clone(); + if (this.SlipCircleDefinition != null) + mstabParameters.SlipCircleDefinition = this.SlipCircleDefinition.Clone(); + if (this.CalculationOptions != null) + mstabParameters.CalculationOptions = this.CalculationOptions.Clone(); + + mstabParameters.Assign(this); + + return mstabParameters; + } + + #region IVisibleEnabled Members + + public bool IsEnabled(string property) + { + switch (property) + { + case "SearchMethod": return Location.DamProjectType == DamProjectType.Design; + case "GridPosition": return false; // position depends on failuremechanisme type (inside or outside) + case "ZonesType": return false; // Is set per location! + default: return true; + } + } + + public bool IsVisible(string property) + { + switch (property) + { + case "Model": return true; + case "SearchMethod": return + (SlipCircleDefinition.Specification.FailureMechanismSystemType == FailureMechanismSystemType.StabilityInside || + SlipCircleDefinition.Specification.FailureMechanismSystemType == FailureMechanismSystemType.StabilityOutside) && + (Model == MStabModelType.Bishop || + Model == MStabModelType.BishopUpliftVan || Model == MStabModelType.UpliftVan); + case "ZonesType": return false; // Is set per location! + case "GridPosition": return false; // position depends on failuremechanisme type (inside or outside) + default: return true; + } + } + + #endregion + + } +} Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/ObjectMaterializer.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/ObjectMaterializer.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/ObjectMaterializer.cs (revision 3305) @@ -0,0 +1,130 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Deltares.Dam.Data +{ + + public class ObjectMaterializer<T> + { + private struct SetterInfo + { + public Action<T, string> Function; + public bool Required; + } + + /// <summary> + /// Holds the property setter actions with the name as the key of the setter + /// </summary> + private readonly Dictionary<string, SetterInfo> dict; + + /// <summary> + /// Holds the list of actions in a list so it is accessible with an index + /// </summary> + private List<SetterInfo> setters; + + public ObjectMaterializer() + { + this.dict = new Dictionary<string, SetterInfo>(); + this.setters = new List<SetterInfo>(); + } + + + /// <summary> + /// Adds a new property setter + /// </summary> + /// <param name="setterName">The name of the setter</param> + /// <param name="func">The setter lambda expression</param> + /// <param name="required"></param> + public void Add(string setterName, Action<T, string> func, bool required) + { + SetterInfo columnInfo = new SetterInfo() { Function = func, Required = required }; + dict.Add(setterName, columnInfo); + } + + public void Add(string setterName, Action<T, string> func) + { + Add(setterName, func, true); + } + + /// <summary> + /// Removes a property setter + /// </summary> + /// <param name="setterName">The name of the setter</param> + public void Remove(string setterName) + { + dict.Remove(setterName); + setters = dict.Values.ToList(); + } + + /// <summary> + /// Returns the mapped keys + /// </summary> + public IEnumerable<string> MappingKeys + { + get { return this.dict.Keys; } + } + + public bool IsRequired(string setterName) + { + return this.dict.ContainsKey(setterName) && this.dict[setterName].Required; + } + + /// <summary> + /// Gets the setter action by index + /// </summary> + /// <param name="index">The index of the property set expression</param> + /// <returns></returns> + public Action<T, string> this[int index] + { + get + { + if (setters == null) + setters = dict.Values.ToList(); + return setters[index].Function; + } + } + + /// <summary> + /// Gets the setter action by name + /// </summary> + /// <param name="name">The name of the property set expression</param> + /// <returns></returns> + public Action<T, string> this[string name] + { + get + { + return dict[name].Function; + } + } + + /// <summary> + /// Gets the number of setter items + /// </summary> + public int Count + { + get { return dict.Count; } + } + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/LocationJob.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/LocationJob.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/LocationJob.cs (revision 3305) @@ -0,0 +1,379 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System.Collections.Generic; +using System.ComponentModel; +using Deltares.Geographic; +using Deltares.Standard.Attributes; +using Deltares.Standard.EventPublisher; +using Deltares.Standard.Validation; + +namespace Deltares.Dam.Data +{ + using System; + using System.Xml.Serialization; + using Deltares.Standard; + + public interface ILocationJob + { + Location Location { get; } + } + + public class LocationJob : DamJob, ILocationJob, IGeographicPoint, IVisibleEnabled + { + private TimeSerie waterLevelTimeSerie = new TimeSerie(); + private LocationResult locationResult = new LocationResult(); + + private static string currentProfileName = ""; + private static string currentScenarioName = ""; + private static string currentCalculation = ""; + private static DateTime currentTime = DateTime.Today; + private static DamProjectType damProjectType = DamProjectType.Calamity; + + private double designRequiredFactor = 0.0; + + public LocationJob() + { + } + + public LocationJob(object subject) + : base(subject) + { + } + + /// <summary> + /// TODO: what todo when location is null? + /// </summary> + public double XRd { get { return this.Location == null ? 0 : this.Location.XRd; } } + public double YRd { get { return this.Location == null ? 0 : this.Location.YRd; } } + + [XmlIgnore] + [Validate] + public Location Location + { + get + { + return this.Subject as Location; + } + set + { + this.Subject = value; + } + } + + public TimeSerie WaterLevelTimeSerie + { + get { return waterLevelTimeSerie; } + set + { + DataEventPublisher.BeforeChange(this, "WaterLevelTimeSerie"); + waterLevelTimeSerie = value; + DataEventPublisher.AfterChange(this, "WaterLevelTimeSerie"); + } + } + + public virtual LocationResult LocationResult + { + get { return locationResult; } + set + { + DataEventPublisher.BeforeChange(this, "LocationResult"); + locationResult = value; + DataEventPublisher.AfterChange(this, "LocationResult"); + } + } + + private bool HasUsableStabilityTimeSerieEntries() + { + var res = false; + foreach (var timeSerieEntry in locationResult.StabilityTimeSerie.Entries) + { + if (timeSerieEntry.Value != Double.NaN) + { + res = true; + break; + } + } + return res; + } + + public bool HasLocationResults + { + get + { + if (locationResult == null) + return false; + return ((locationResult.PipingTimeSerie != null && locationResult.PipingTimeSerie.Entries.Count > 0) || + (locationResult.StabilityTimeSerie != null && + locationResult.StabilityTimeSerie.Entries.Count > 0 && HasUsableStabilityTimeSerieEntries())); + } + } + + public LocationResult GetLocationResultWithStabilityTimeSerie(string locationName) + { + LocationResult result = null; + if (locationResult != null && locationResult.StabilityTimeSerie != null && + locationResult.StabilityTimeSerie.LocationId == locationName && + locationResult.StabilityTimeSerie.Entries != null && locationResult.StabilityTimeSerie.Entries.Count > 1) + { + result = locationResult; + } + return result; + } + + public LocationResult GetFirstLocationResultWithStabilityTimeSerie() + { + LocationResult result = null; + if (locationResult != null && locationResult.StabilityTimeSerie != null && + locationResult.StabilityTimeSerie.Entries != null && locationResult.StabilityTimeSerie.Entries.Count > 1) + { + result = locationResult; + } + return result; + } + + public CsvExportData GetFirstDesignResult() + { + if (this.HasDesignScenarioResults) + { + Scenario scenario = Location.Scenarios[0]; + if (scenario != null && scenario.CalculationResults.Count > 0) + { + return scenario.CalculationResults[0]; + } + } + return null; + } + + public CsvExportData GetDesignResultByProfileScenarioAndCalculationName(string profileName, string scenarioName, + string calculationName) + { + if (this.HasDesignScenarioResults) + { + foreach (var scenario in Location.Scenarios) + { + foreach (var calculationResult in scenario.CalculationResults) + { + if (calculationResult.ProfileName == profileName && + calculationResult.ScenarioName == scenarioName && + calculationResult.StabilityModel.ToString() == calculationName) + return calculationResult; + } + } + } + return null; + } + + /// <summary> + /// Gets a value indicating whether this instance has (Design) scenario results. + /// </summary> + /// <value> + /// <c>true</c> if this instance has scenario results; otherwise, <c>false</c>. + /// </value> + public bool HasDesignScenarioResults + { + get + { + List<Scenario> scenarios = Location.Scenarios; + foreach (var scenario in scenarios) + { + foreach (var calculationResult in scenario.CalculationResults) + { + if ((calculationResult.SafetyFactor != null) || (calculationResult.CalculationResult == CalculationResult.UnexpectedError) ) + { + return true; + } + } + } + return false; + } + } + + /// <summary> + /// Get lowest safetyfactor of all scenarios + /// </summary> + /// <returns></returns> + private double GetLowestRealSafetyFactorFromDesignScenarios() + { + var res = double.MaxValue; + List<Scenario> scenarios = Location.Scenarios; + foreach (var scenario in scenarios) + { + foreach (var calculationResult in scenario.CalculationResults) + { + if (calculationResult.CalculationResult == CalculationResult.UnexpectedError) + { + res = -1; + } + if (calculationResult.SafetyFactor != null) + { + if (calculationResult.SafetyFactor.Value < res) + { + res = calculationResult.SafetyFactor.Value; + if (calculationResult.RequiredSafetyFactor != null) + { + designRequiredFactor = calculationResult.RequiredSafetyFactor.Value; + } + } + } + } + } + if (res == double.MaxValue) res = DamGlobalConstants.NoRunValue; + return res; + } + + [Data] + [Label("Safety factor")] + [XmlIgnore] + [Format("F3")] + public double SafetyFactor + { + get + { + if (DamProjectType == DamProjectType.Calamity) + { + if (HasLocationResults) + { + TimeSerie timeSerie = this.LocationResult.StabilityTimeSerie; + return timeSerie.GetValue(CurrentTime); + } + return DamGlobalConstants.NoRunValue; + } + if (DamProjectType == DamProjectType.Design) + { + return GetLowestRealSafetyFactorFromDesignScenarios(); + } + return DamGlobalConstants.NoRunValue; + } + } + + [Data] + [Format("F3")] + public double RequiredFactorOfSafety + { + get + { + if (DamProjectType == DamProjectType.Design) + { + return designRequiredFactor; + } + return 1.0; + } + } + + [Data] + [XmlIgnore] + [Label("Result")] + public JobResult Result + { + get + { + return JobResultInterpreter.GetJobResult(SafetyFactor, RequiredFactorOfSafety, true); + } + } + + [XmlIgnore] + [Browsable(false)] + public double X + { + get { return this.XRd; } + set + { + if (Location != null) + Location.XRd = value; + } + } + + [XmlIgnore] + [Browsable(false)] + public double Y + { + get { return this.YRd; } + set + { + if (Location != null) + Location.YRd = value; + } + } + + [XmlIgnore] + [Browsable(false)] + public static string CurrentProfileName + { + get { return currentProfileName; } + set { currentProfileName = value; } + } + + [XmlIgnore] + [Browsable(false)] + public static string CurrentScenarioName + { + get { return currentScenarioName; } + set { currentScenarioName = value; } + } + + [XmlIgnore] + [Browsable(false)] + public static string CurrentCalculation + { + get { return currentCalculation; } + set { currentCalculation = value; } + } + + [XmlIgnore] + [Browsable(false)] + public static DateTime CurrentTime + { + get { return currentTime; } + set { currentTime = value; } + } + + [XmlIgnore] + [Browsable(false)] + public static DamProjectType DamProjectType + { + get { return damProjectType; } + set { damProjectType = value; } + } + + public bool IsEnabled(string property) + { + return true; + } + + public bool IsVisible(string property) + { + switch (property) + { + case "SafetyFactor": return this.Result != JobResult.NoRun && this.Result != JobResult.Failed; + case "RequiredFactorOfSafety": return this.Result != JobResult.NoRun && this.Result != JobResult.Failed; + case "WaterLevelTimeSerie": + return HasLocationResults; + default: return true; + } + } + + public override string ToString() + { + return this.Location != null ? this.Location.ToString() : ""; + } + } +} Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Importers/LocationShapeFileAttributeMap.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Importers/LocationShapeFileAttributeMap.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Importers/LocationShapeFileAttributeMap.cs (revision 3305) @@ -0,0 +1,807 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Collections.Generic; +using System.Linq; +using Deltares.Dam.Data.CsvImporters; +using Deltares.Standard.Extensions; +using DataAttribute = Deltares.Dam.Data.DataPlugins.Configuration.DataAttribute; + +namespace Deltares.Dam.Data.Importers +{ + public class LocationShapeFileAttributeMap + { + #region Attribute ID Constants + + /// <summary> + /// location_id + /// </summary> + public const string LocationAttributeId = CsvColumnNames.LocationColumnName; + + /// <summary> + /// DikeringId + /// </summary> + public const string DikeRingAttributeId = CsvColumnNames.DikeRingColumnName; + + /// <summary> + /// crosssection + /// CustomShape + /// crosssection.shp + /// LocationId + /// string, string + /// </summary> + public const string CrossSectionAttributId = "crossection"; + + /// <summary> + /// segment_id + /// segment_id.shp + /// segmentid + /// string + /// </summary> + public const string SegmentAttributeId = CsvColumnNames.SegmentColumnName; + + /// <summary> + /// PolderLevel + /// PolderLevel.shp + /// PLHigh + /// double + /// </summary> + public const string PolderLevelAttributeId = CsvColumnNames.PolderLevelColumnName; + + /// <summary> + /// head_pl2 HeadPL2.shp HeadPL2 double + /// </summary> + public const string HeadPl2AttributeId = CsvColumnNames.HeadPl2ColumnName; + + /// <summary> + /// head_pl3 CustomShape HeadPL3.shp HeadPL3 double + /// </summary> + public const string HeadPl3AttributeId = CsvColumnNames.HeadPl3ColumnName; + + /// <summary> + /// head_pl4 CustomShape HeadPL4.shp HeadPL4 double + /// </summary> + public const string HeadPl4AttributeId = CsvColumnNames.HeadPl4ColumnName; + + /// <summary> + /// x_soilgeometry2D_origin + /// CustomShape + /// XSoilGeometry2DOrigin.shp + /// XG2DOrg + /// double + /// </summary> + public const string XSoilGeometry2DOriginAttributeId = CsvColumnNames.XSoilGeometry2DOriginColumnName; + + /// <summary> + /// ophoogmateriaaldijk + /// CustomShape + /// ShoulderMaterial.shp + /// DikeMtrl + /// string + /// </summary> + public const string DikeEmbankmentMaterialAttributeId = CsvColumnNames.DikeEmbankmentMaterialColumnName; + + /// <summary> + /// ophoogmateriaalberm + /// CustomShape + /// ShoulderMaterial.shp + /// ShlderMtrl + /// string + /// </summary> + public const string ShoulderEmbankmentMaterialAttributeId = CsvColumnNames.ShoulderEmbankmentMaterialColumnName; + + /// <summary> + /// dempingsfactor_pl3 + /// CustomShape + /// DampingFactorPL3.shp + /// DampingPL3 double + /// </summary> + public const string DampingFactorPl3AttributeId = CsvColumnNames.DampingFactorPl3ColumnName; + + /// <summary> + /// dempingsfactor_pl4 + /// CustomShape + /// DampingFactorPL4.shp + /// DampingPL4 + /// double + /// </summary> + public const string DampingFactorPl4AttributeId = CsvColumnNames.DampingFactorPl4ColumnName; + + /// <summary> + /// PenetrationLength + /// CustomShape + /// PenetrationLength.shp + /// PenLength + /// double + /// </summary> + public const string PenetrationLengthAttributeId = CsvColumnNames.PenetrationLengthColumnName; + + /// <summary> + /// TrafficLoad + /// CustomShape + /// TrafficLoad.shp + /// TrafLoad + /// double + /// </summary> + public const string TrafficLoadAttributeId = CsvColumnNames.TrafficLoadColumnName; + + + /// <summary> + /// TL_DegreeOfConsolidation + /// CustomShape + /// TL_DegreeOfConsolidation.shp + /// TL_DegOfCo + /// double + /// </summary> + public const string TL_DegreeOfConsolidationAttributeId = CsvColumnNames.TlDegreeOfConsolidationColumnName; + + + /// <summary> + /// PLLineCreationMethod + /// CustomShape + /// PLLineCreationMethod.shp + /// PLCrtMthd + /// string + /// </summary> + public const string PlLineCreationMethodAttributeId = CsvColumnNames.PlLineCreationMethodColumnName; + + + /// <summary> + /// PlLineOffsetBelowDikeTopAtRiver + /// CustomShape + /// PlLineOffsetBelowDikeTopAtRiver.shp + /// PLBlwTDRvr + /// double + /// </summary> + public const string PlLineOffsetBelowDikeTopAtRiverAttributeId = CsvColumnNames.PlLineOffsetBelowDikeTopAtRiverColumnName; + + /// <summary> + /// PlLineOffsetBelowDikeTopAtPolder + /// CustomShape + /// PlLineOffsetBelowDikeTopAtPolder.shp + /// PLBlwTDPld + /// double + /// </summary> + public const string PlLineOffsetBelowDikeTopAtPolderAttributeId = CsvColumnNames.PlLineOffsetBelowDikeTopAtPolderColumnName; + + /// <summary> + /// PlLineOffsetBelowShoulderBaseInside + /// CustomShape + /// PlLineOffsetBelowShoulderBaseInside.shp + /// PLBlwTDSh + /// double + /// </summary> + public const string PlLineOffsetBelowShoulderBaseInsideAttributeId = CsvColumnNames.PlLineOffsetBelowShoulderBaseInsideColumnName; + + /// <summary> + /// PlLineOffsetBelowDikeToeAtPolder + /// CustomShape + /// PlLineOffsetBelowDikeToeAtPolder.shp + /// PLBlwDTPld + /// double + /// </summary> + public const string PlLineOffsetBelowDikeToeAtPolderAttributeId = CsvColumnNames.PlLineOffsetBelowDikeToeAtPolderColumnName; + + /// <summary> + /// PlLineOffsetBelowDikeCrestMiddle + /// CustomShape + /// PlLineOffsetBelowDikeCrestMiddle.shp + /// PLBlDCM + /// double + /// </summary> + public const string PlLineOffsetBelowDikeCrestMiddleAttributeId = CsvColumnNames.PlLineOffsetBelowDikeCrestMiddleColumnName; + + /// <summary> + /// PlLineOffsetFactorBelowShoulderCrest + /// CustomShape + /// PlLineOffsetFactorBelowShoulderCrest.shp + /// PLFBlSC + /// double + /// </summary> + public const string PlLineOffsetFactorBelowShoulderCrestAttributeId = CsvColumnNames.PlLineOffsetFactorBelowShoulderCrestColumnName; + + /// <summary> + /// UsePlLineOffsetBelowDikeCrestMiddle + /// CustomShape + /// UsePlLineOffsetBelowDikeCrestMiddle.shp + /// UPLBlDCM + /// double + /// </summary> + public const string UsePlLineOffsetBelowDikeCrestMiddleAttributeId = CsvColumnNames.UsePlLineOffsetBelowDikeCrestMiddleColumnName; + + /// <summary> + /// UsePlLineOffsetFactorBelowShoulderCrest + /// CustomShape + /// UsePlLineOffsetFactorBelowShoulderCrest.shp + /// UPLFBlSC + /// double + /// </summary> + public const string UsePlLineOffsetFactorBelowShoulderCrestAttributeId = CsvColumnNames.UsePlLineOffsetFactorBelowShoulderCrestColumnName; + + /// <summary> + /// The intrusion vertical water pressure attribute identifier + /// CustomShape + /// IntrusionVerticalWaterPressure.shp + /// IVWP + /// string + /// </summary> + public const string IntrusionVerticalWaterPressureAttributeId = CsvColumnNames.IntrusionVerticalWaterPressureColumnName; + + /// <summary> + /// StabilityShoulderGrowSlope + /// CustomShape + /// StabilityShoulderGrowSlope.shp + /// StShSlpGr + /// double + /// </summary> + public const string StabilityShoulderGrowSlopeAttributeId = CsvColumnNames.StabilityShoulderGrowSlopeColumnName; + + /// <summary> + /// StabilityShoulderGrowDeltaX + /// CustomShape + /// StabilityShoulderGrowDeltaX.shp + /// StShDXGr + /// double + /// </summary> + public const string StabilityShoulderGrowDeltaXAttributeId = CsvColumnNames.StabilityShoulderGrowDeltaXColumnName; + + /// <summary> + /// StabilitySlopeAdaptionDeltaX + /// CustomShape + /// StabilitySlopeAdaptionDeltaX.shp + /// StSlAdaptDX + /// double + /// </summary> + public const string StabilitySlopeAdaptionDeltaXAttributeId = CsvColumnNames.StabilitySlopeAdaptionDeltaXColumnName; + + /// <summary> + /// minimal_circle_depth + /// CustomShape + /// minimal_circle_depth.shp + /// mincrcldepth + /// double + /// </summary> + public const string MinimalCircleDepthAtrributeId = CsvColumnNames.MinimalCircleDepthColumnName; + + /// <summary> + /// safety_factor_piping + /// CustomShape + /// safety_factor_piping.shp + /// fpiping + /// double + /// </summary> + public const string RequiredSafetyFactorPipingAttributeId = CsvColumnNames.RequiredSafetyFactorPipingColumnName; + + /// <summary> + /// safety_factor_stability_inner_slope + /// CustomShape + /// safety_factor_stability_inner_slope.shp + /// fstabinner + /// double + /// </summary> + public const string RequiredSafetyFactorStabilityInnerSlopeAttributeId = CsvColumnNames.RequiredSafetyFactorStabilityInnerSlopeColumnName; + + /// <summary> + /// safety_factor_stability_outer_slope + /// CustomShape + /// safety_factor_stability_outer_slope.shp + /// fstabouter + /// double + /// </summary> + public const string RequiredSafetyFactorStabilityOuterSlopeAttributeId = CsvColumnNames.RequiredSafetyFactorStabilityOuterSlopeColumnName; + + /// <summary> + /// uplift_criterion_piping + /// CustomShape + /// uplift_criterion_piping.shp + /// uplpiping + /// double + /// </summary> + public const string UpliftCriterionPipingAttributeId = CsvColumnNames.UpliftCriterionPipingColumnName; + + /// <summary> + /// uplift_criterion_stability + /// CustomShape + /// uplift_criterion_stability.shp + /// uplstab + /// double + /// </summary> + public const string UpliftCriterionStabilityAttributeId = CsvColumnNames.UpliftCriterionStabilityColumnName; + + /// <summary> + /// distance_to_entry_point + /// CustomShape + /// distance_to_entry_point.shp + /// distentry + /// double + /// </summary> + public const string DistanceToEntryPointAttributeId = CsvColumnNames.DistanceToEntryPointColumnName; + + /// <summary> + /// SlopeDampingPiezometricHeightPolderSideAttributeId + /// CustomShape + /// DTH.shp + /// DTH + /// double + /// </summary> + public const string SlopeDampingPiezometricHeightPolderSideAttributeId = CsvColumnNames.SlopeDampingPiezometricHeightPolderSideColumnName; + + /// <summary> + /// ZoneType + /// CustomShape + /// StabilityZones.shp + /// zonetype + /// string + /// </summary> + public const string ZoneTypeAttributeId = CsvColumnNames.ZoneTypeColumnName; + + /// <summary> + /// ForbiddenZoneFactor + /// CustomShape + /// StabilityZones.shp + /// ForbiddenZoneFactor + /// double + /// </summary> + public const string ForbiddenZoneFactorAttributeId = CsvColumnNames.ForbiddenZoneFactorColumnName; + + /// <summary> + /// ZoneAreaRestSlopeCrestWidth + /// CustomShape + /// StabilityZones.shp + /// ZoneAreaRestSlopeCrestWidth + /// double + /// </summary> + public const string ZoneAreaRestSlopeCrestWidthAttributeId = CsvColumnNames.ZoneAreaRestSlopeCrestWidthColumnName; + + /// <summary> + /// StabilityDesignMethodColumnName + /// CustomShape + /// DesignParameters.shp + /// StabilityDesignMethodColumnName + /// string + /// </summary> + public const string StabilityDesignMethodAttributeId = CsvColumnNames.StabilityDesignMethodColumnName; + + /// <summary> + /// SlopeAdaptionStartCotangentColumnName + /// CustomShape + /// DesignParameters.shp + /// SlopeAdaptionStartCotangentColumnName + /// double + /// </summary> + public const string SlopeAdaptionStartCotangentAttributeId = CsvColumnNames.SlopeAdaptionStartCotangentColumnName; + + /// <summary> + /// SlopeAdaptionEndCotangentColumnName + /// CustomShape + /// DesignParameters.shp + /// SlopeAdaptionEndCotangentColumnName + /// double + /// </summary> + public const string SlopeAdaptionEndCotangentAttributeId = CsvColumnNames.SlopeAdaptionEndCotangentColumnName; + + /// <summary> + /// SlopeAdaptionStepCotangentColumnName + /// CustomShape + /// DesignParameters.shp + /// SlopeAdaptionStepCotangentColumnName + /// double + /// </summary> + public const string SlopeAdaptionStepCotangentAttributeId = CsvColumnNames.SlopeAdaptionStepCotangentColumnName; + + /// <summary> + /// UseNewDikeTopWidth + /// CustomShape + /// DesignParameters.shp + /// UseNewDikeTopWidth + /// double + /// </summary> + public const string UseNewDikeTopWidthAttributeId = CsvColumnNames.UseNewDikeTopWidthColumnName; + + /// <summary> + /// NewDikeTopWidth + /// CustomShape + /// DesignParameters.shp + /// NewDikeTopWidth + /// double + /// </summary> + public const string NewDikeTopWidthAttributeId = CsvColumnNames.NewDikeTopWidthColumnName; + + /// <summary> + /// UseNewDikeSlopeInside + /// CustomShape + /// DesignParameters.shp + /// UseNewDikeSlopeInside + /// double + /// </summary> + public const string UseNewDikeSlopeInsideAttributeId = CsvColumnNames.UseNewDikeSlopeInsideColumnName; + + /// <summary> + /// NewDikeSlopeInside + /// CustomShape + /// DesignParameters.shp + /// NewDikeSlopeInside + /// double + /// </summary> + public const string NewDikeSlopeInsideAttributeId = CsvColumnNames.NewDikeSlopeInsideColumnName; + + /// <summary> + /// UseNewDikeSlopeOutside + /// CustomShape + /// DesignParameters.shp + /// UseNewDikeSlopeOutside + /// double + /// </summary> + public const string UseNewDikeSlopeOutsideAttributeId = CsvColumnNames.UseNewDikeSlopeOutsideColumnName; + + /// <summary> + /// NewDikeSlopeOutside + /// CustomShape + /// DesignParameters.shp + /// NewDikeSlopeOutside + /// double + /// </summary> + public const string NewDikeSlopeOutsideAttributeId = CsvColumnNames.NewDikeSlopeOutsideColumnName; + + /// <summary> + /// UseNewShoulderTopSlope + /// CustomShape + /// DesignParameters.shp + /// UseNewShoulderTopSlope + /// double + /// </summary> + public const string UseNewShoulderTopSlopeAttributeId = CsvColumnNames.UseNewShoulderTopSlopeColumnName; + + /// <summary> + /// NewShoulderTopSlope + /// CustomShape + /// DesignParameters.shp + /// NewShoulderTopSlope + /// double + /// </summary> + public const string NewShoulderTopSlopeAttributeId = CsvColumnNames.NewShoulderTopSlopeColumnName; + + /// <summary> + /// UseNewShoulderBaseSlope + /// CustomShape + /// DesignParameters.shp + /// UseNewShoulderBaseSlope + /// double + /// </summary> + public const string UseNewShoulderBaseSlopeAttributeId = CsvColumnNames.UseNewShoulderBaseSlopeColumnName; + + /// <summary> + /// NewShoulderBaseSlope + /// CustomShape + /// DesignParameters.shp + /// NewShoulderBaseSlope + /// double + /// </summary> + public const string NewShoulderBaseSlopeAttributeId = CsvColumnNames.NewShoulderBaseSlopeColumnName; + + /// <summary> + /// UseNewMaxHeightShoulderAsFraction + /// CustomShape + /// DesignParameters.shp + /// UseNewMaxHeightShoulderAsFraction + /// double + /// </summary> + public const string UseNewMaxHeightShoulderAsFractionAttributeId = CsvColumnNames.UseNewMaxHeightShoulderAsFractionColumnName; + + /// <summary> + /// NewMaxHeightShoulderAsFraction + /// CustomShape + /// DesignParameters.shp + /// NewMaxHeightShoulderAsFraction + /// double + /// </summary> + public const string NewMaxHeightShoulderAsFractionAttributeId = CsvColumnNames.NewMaxHeightShoulderAsFractionColumnName; + + /// <summary> + /// UseNewMinDistanceDikeToeStartDitch + /// CustomShape + /// DesignParameters.shp + /// UseNewMinDistanceDikeToeStartDitch + /// double + /// </summary> + public const string UseNewMinDistanceDikeToeStartDitchAttributeId = CsvColumnNames.UseNewMinDistanceDikeToeStartDitchColumnName; + + /// <summary> + /// NewMinDistanceDikeToeStartDitch + /// CustomShape + /// DesignParameters.shp + /// NewMinDistanceDikeToeStartDitch + /// double + /// </summary> + public const string NewMinDistanceDikeToeStartDitchAttributeId = CsvColumnNames.NewMinDistanceDikeToeStartDitchColumnName; + + /// <summary> + /// UseNewDitchDefinition + /// CustomShape + /// DesignParameters.shp + /// UseNewDitchDefinition + /// double + /// </summary> + public const string UseNewDitchDefinitionAttributeId = CsvColumnNames.UseNewDitchDefinitionColumnName; + + /// <summary> + /// NewWidthDitchBottom + /// CustomShape + /// DesignParameters.shp + /// NewWidthDitchBottom + /// double + /// </summary> + public const string NewWidthDitchBottomAttributeId = CsvColumnNames.NewWidthDitchBottomColumnName; + + /// <summary> + /// NewDepthDitch + /// CustomShape + /// DesignParameters.shp + /// NewDepthDitch + /// double + /// </summary> + public const string NewDepthDitchAttributeId = CsvColumnNames.NewDepthDitchColumnName; + + /// <summary> + /// NewSlopeAngleDitch + /// CustomShape + /// DesignParameters.shp + /// NewSlopeAngleDitch + /// double + /// </summary> + public const string NewSlopeAngleDitchAttributeId = CsvColumnNames.NewSlopeAngleDitchColumnName; + + /// <summary> + /// DikeTableHeight + /// CustomShape + /// DikeTableHeight.shp + /// DikeTableHeight + /// double + /// </summary> + public const string DikeTableHeightAttributeId = CsvColumnNames.DikeTableHeightColumnName; + + /// <summary> + /// water_height + /// CustomShape + /// RiverLevel.shp + /// RiverLevel + /// double + /// </summary> + public const string RiverLevelAttributeId = CsvColumnNames.RiverLevelColumnName; + + /// <summary> + /// water_height_low + /// CustomShape + /// RiverLevelLow.shp + /// RiverLevelLow + /// double + /// </summary> + public const string RiverLevelLowAttributeId = CsvColumnNames.RiverLevelLowColumnName; + + #endregion + + internal static readonly IDictionary<string, LocationAttributeMapping> AttributePropertyMap; + internal static readonly IDictionary<string, LocationAttributeMapping> ConstructionalMap; + + internal const string LocationShapeFileName = "Location.shp"; + internal const string ShoulderMaterialShapeFileName = "ShoulderMaterial.shp"; + internal const string PolderLevelShapeFileName = "PolderLevel.shp"; + internal const string PlLineShapeFileName = "PLLines.shp"; + + static LocationShapeFileAttributeMap() + { + // Note: the reason that I create a keyValPair lists here is that I can see which keys are alredy added + // when using a dictionary initializer you cant see which attribute is already added which gives you a headache when you have duplicate keys :) + + #region Attribute Map + + Func<string, string,string, Action<CsvImporterLocations.LocationRecord, object>,KeyValuePair<string,LocationAttributeMapping>> createItem = + (id, f, c, a) => new KeyValuePair<string, LocationAttributeMapping>(id, new LocationAttributeMapping(){Id = id.ToLower(), File = f, Name = c, Action = a}); + + var mappings = new List<KeyValuePair<string, LocationAttributeMapping>> + { + // direct property mappings + createItem(SegmentAttributeId, "segment_id.shp", "segmentid", (t, value) => t.SegmentId = value.ToString()), + createItem(DampingFactorPl3AttributeId, "DampingFactoPL3.shp", "DampingPL3", (t, value) => t.DampingFactorPl3 = value.ToType<double>() ), + createItem(DampingFactorPl4AttributeId, "DampingFactoPL4.shp", "DampingPL4", (t, value) => t.DampingFactorPl4 = value.ToType<double>() ), + createItem(DikeEmbankmentMaterialAttributeId, "Dikematerial.shp", "DikeMtrl", (t, value) => t.DikeEmbankmentMaterial = value.ToType<string>() ), + createItem(DistanceToEntryPointAttributeId, "distance_to_entry_point.shp", "dist_entry", (t, value) => t.DistanceToEntryPoint = value.ToType<double>()), + createItem(HeadPl2AttributeId, "HeadPL2.shp", "HeadPL2", (t, value) => t.HeadPl2 = value.ToType<double>() ), + createItem(HeadPl3AttributeId, "HeadPL3.shp", "HeadPL3", (t, value) => t.HeadPl3 = value.ToType<double>() ), + createItem(HeadPl4AttributeId, "HeadPL4.shp", "HeadPL4", (t, value) => t.HeadPl4 = value.ToType<double>() ), + createItem(MinimalCircleDepthAtrributeId, "minimal_circle_depth.shp", "mincrcldepth", (t, value) => t.MinimalCircleDepth = value.ToType<double>()), + createItem(PenetrationLengthAttributeId, "PenetrationLength.shp", "PenLength", (t, value) => t.PenetrationLength = value.ToType<double>()), + createItem(PolderLevelAttributeId, PolderLevelShapeFileName, "PLHigh", (t, value) => t.PolderLevel = value.ToType<double>()), + createItem(PlLineCreationMethodAttributeId, "PLLineCreationMethod.shp", "PLCrtMthd", (t, value) => t.PLLineCreationMethod = LocationImportHelper.ToPLLineCreationMethod(value)), + createItem(ZoneTypeAttributeId, "StabilityZones.shp", "ZoneType", (t, value) => t.StabilityZoneType = LocationImportHelper.ToMStabZonesTypeMethod(value)), + createItem(ForbiddenZoneFactorAttributeId, "StabilityZones.shp", "ForbiddenZoneFactor", (t, value) => t.ForbiddenZoneFactor = value.ToType<double>()), + createItem(ZoneAreaRestSlopeCrestWidthAttributeId, "StabilityZones.shp", "ZoneAreaRestSlopeCrestWidth", (t, value) => t.ZoneAreaRestSlopeCrestWidth = value.ToType<double>()), + createItem(PlLineOffsetBelowDikeTopAtRiverAttributeId, PlLineShapeFileName, "PLBlwTDRvr", (t, value) => t.PlLineOffsetBelowDikeTopAtRiver = value.ToType<double>()), + createItem(PlLineOffsetBelowDikeTopAtPolderAttributeId, PlLineShapeFileName, "PLBlwTDPld", (t, value) => t.PlLineOffsetBelowDikeTopAtPolder = value.ToType<double>()), + createItem(PlLineOffsetBelowShoulderBaseInsideAttributeId, PlLineShapeFileName, "PLBlwTDSh", (t, value) => t.PlLineOffsetBelowShoulderBaseInside = value.ToType<double>()), + createItem(PlLineOffsetBelowDikeToeAtPolderAttributeId, PlLineShapeFileName, "PLBlwDTPld", (t, value) => t.PlLineOffsetBelowDikeToeAtPolder = value.ToType<double>()), + createItem(PlLineOffsetBelowDikeCrestMiddleAttributeId, PlLineShapeFileName, "PLBlDCM", (t, value) => t.PlLineOffsetBelowDikeCrestMiddle = value.ToType<double>()), + createItem(PlLineOffsetFactorBelowShoulderCrestAttributeId, PlLineShapeFileName, "PLFBlSC", (t, value) => t.PlLineOffsetFactorBelowShoulderCrest = value.ToType<double>()), + createItem(UsePlLineOffsetBelowDikeCrestMiddleAttributeId, PlLineShapeFileName, "UPLBlDCM", (t, value) => t.UsePlLineOffsetBelowDikeCrestMiddle = value.ToType<bool>()), + createItem(UsePlLineOffsetFactorBelowShoulderCrestAttributeId, PlLineShapeFileName, "UPLFBlSC", (t, value) => t.UsePlLineOffsetFactorBelowShoulderCrest = value.ToType<bool>()), + createItem(IntrusionVerticalWaterPressureAttributeId, "IntrusionVerticalWaterPressure.shp", "IVWP", (t, value) => t.IntrusionVerticalWaterPressure = LocationImportHelper.ToIntrusionVerticalWaterPressure(value)), + createItem(TrafficLoadAttributeId, "trafficload.shp", "TrafLoad", (t, value) => t.TrafficLoad = value.ToType<double>() ), + createItem(TL_DegreeOfConsolidationAttributeId, "TL_DegreeOfConsolidation.shp", "TL_DegOfCo", (t, value) => t.TL_DegreeOfConsolidation = value.ToType<double>() ), + createItem(RequiredSafetyFactorPipingAttributeId, "safety_factor_piping.shp", "fpiping", (t, value) => t.RequiredSafetyFactorPiping = value.ToType<double>()), + createItem(RequiredSafetyFactorStabilityInnerSlopeAttributeId, "safety_factor_stability_inner_slope.shp", "fstabinner", (t, value) => t.RequiredSafetyFactorStabilityInnerSlope = value.ToType<double>()), + createItem(RequiredSafetyFactorStabilityOuterSlopeAttributeId, "safety_factor_stability_outer_slope.shp", "fstabouter", (t, value) => t.RequiredSafetyFactorStabilityOuterSlope = value.ToType<double>()), + createItem(ShoulderEmbankmentMaterialAttributeId, ShoulderMaterialShapeFileName, "ShlderMtrl", (t, value) => t.ShoulderEmbankmentMaterial = value.ToType<string>() ), + createItem(StabilityShoulderGrowSlopeAttributeId, "StabilityShoulderGrowSlope.shp", "StShSlpGr", (t, value) => t.StabilityShoulderGrowSlope = value.ToType<double>()), + createItem(StabilityShoulderGrowDeltaXAttributeId, "StabilityShoulderGrowDeltaX.shp", "StShDXGr", (t, value) => t.StabilityShoulderGrowDeltaX = value.ToType<double>()), + createItem(StabilitySlopeAdaptionDeltaXAttributeId, "StabilitySlopeAdaptionDeltaX.shp", "StSlAdaptDX", (t, value) => t.StabilitySlopeAdaptionDeltaX = value.ToType<double>()), + createItem(UpliftCriterionPipingAttributeId, "uplift_criterion_piping.shp", "uplpiping", (t, value) => t.UpliftCriterionPiping = value.ToType<double>()), + createItem(UpliftCriterionStabilityAttributeId, "uplift_criterion_stability.shp", "uplstab", (t, value) => t.UpliftCriterionStability = value.ToType<double>()), + createItem(XSoilGeometry2DOriginAttributeId, "XSoilGeometry2DOrigin.shp", "XG2DOrg", (t, value) => t.XSoilGeometry2DOrigin = value.ToType<double>()), + createItem(SlopeDampingPiezometricHeightPolderSideAttributeId, "SlopeDampingPiezometricHeightPolderSide.shp", "SlopeDampingPiezometricHeightPolderSide", (t, value) => t.SlopeDampingPiezometricHeightPolderSide = value.ToType<double>() ), + createItem(DikeTableHeightAttributeId, "DikeTableHeight.shp", "DikeTableHeight", (t, value) => t.DikeTableHeight = value.ToType<double>() ), + createItem(RiverLevelAttributeId, "RiverLevel.shp", "RiverLevel", (t, value) => t.RiverLevel = value.ToType<double>() ), + createItem(RiverLevelLowAttributeId, "RiverLevelLow.shp", "RiverLevelLow", (t, value) => t.RiverLevelLow = value.ToType<double>() ), + + createItem(StabilityDesignMethodAttributeId, "DesignParameters.shp", "StabilityDesignMethod", (t, value) => t.StabilityDesignMethod = LocationImportHelper.ToStabilityDesignMethod(value) ), + createItem(SlopeAdaptionStartCotangentAttributeId, "DesignParameters.shp", "SlopeAdaptionStartCotangent", (t, value) => t.SlopeAdaptionStartCotangent = value.ToType<double>() ), + createItem(SlopeAdaptionEndCotangentAttributeId, "DesignParameters.shp", "SlopeAdaptionEndCotangent", (t, value) => t.SlopeAdaptionEndCotangent = value.ToType<double>() ), + createItem(SlopeAdaptionStepCotangentAttributeId, "DesignParameters.shp", "SlopeAdaptionStepCotangent", (t, value) => t.SlopeAdaptionStepCotangent = value.ToType<double>() ), + createItem(UseNewDikeTopWidthAttributeId, "DesignParameters.shp", "UseNewDikeTopWidth", (t, value) => t.UseNewDikeTopWidth = value.ToType<bool>() ), + createItem(NewDikeTopWidthAttributeId, "DesignParameters.shp", "NewDikeTopWidth", (t, value) => t.NewDikeTopWidth = value.ToType<double>() ), + createItem(UseNewDikeSlopeInsideAttributeId, "DesignParameters.shp", "UseNewDikeSlopeInside", (t, value) => t.UseNewDikeSlopeInside = value.ToType<bool>() ), + createItem(NewDikeSlopeInsideAttributeId, "DesignParameters.shp", "NewDikeSlopeInside", (t, value) => t.NewDikeSlopeInside = value.ToType<double>() ), + createItem(UseNewDikeSlopeOutsideAttributeId, "DesignParameters.shp", "UseNewDikeSlopeOutside", (t, value) => t.UseNewDikeSlopeOutside = value.ToType<bool>() ), + createItem(NewDikeSlopeOutsideAttributeId, "DesignParameters.shp", "NewDikeSlopeOutside", (t, value) => t.NewDikeSlopeOutside = value.ToType<double>() ), + createItem(UseNewShoulderTopSlopeAttributeId, "DesignParameters.shp", "UseNewShoulderTopSlope", (t, value) => t.UseNewShoulderTopSlope = value.ToType<bool>() ), + createItem(NewShoulderTopSlopeAttributeId, "DesignParameters.shp", "NewShoulderTopSlope", (t, value) => t.NewShoulderTopSlope = value.ToType<double>() ), + createItem(UseNewShoulderBaseSlopeAttributeId, "DesignParameters.shp", "UseNewShoulderBaseSlope", (t, value) => t.UseNewShoulderBaseSlope = value.ToType<bool>() ), + createItem(NewShoulderBaseSlopeAttributeId, "DesignParameters.shp", "NewShoulderBaseSlope", (t, value) => t.NewShoulderBaseSlope = value.ToType<double>() ), + createItem(UseNewMaxHeightShoulderAsFractionAttributeId, "DesignParameters.shp", "UseNewMaxHeightShoulderAsFraction", (t, value) => t.UseNewMaxHeightShoulderAsFraction = value.ToType<bool>() ), + createItem(NewMaxHeightShoulderAsFractionAttributeId, "DesignParameters.shp", "NewMaxHeightShoulderAsFraction", (t, value) => t.NewMaxHeightShoulderAsFraction = value.ToType<double>() ), + createItem(UseNewMinDistanceDikeToeStartDitchAttributeId, "DesignParameters.shp", "UseNewMinDistanceDikeToeStartDitch", (t, value) => t.UseNewMinDistanceDikeToeStartDitch = value.ToType<bool>() ), + createItem(NewMinDistanceDikeToeStartDitchAttributeId, "DesignParameters.shp", "NewMinDistanceDikeToeStartDitch", (t, value) => t.NewMinDistanceDikeToeStartDitch = value.ToType<double>() ), + createItem(UseNewDitchDefinitionAttributeId, "DesignParameters.shp", "UseNewDitchDefinition", (t, value) => t.UseNewDitchDefinition = value.ToType<bool>() ), + createItem(NewWidthDitchBottomAttributeId, "DesignParameters.shp", "NewWidthDitchBottom", (t, value) => t.NewWidthDitchBottom = value.ToType<double>() ), + createItem(NewDepthDitchAttributeId, "DesignParameters.shp", "NewDepthDitch", (t, value) => t.NewDepthDitch = value.ToType<double>() ), + createItem(NewSlopeAngleDitchAttributeId, "DesignParameters.shp", "NewSlopeAngleDitch", (t, value) => t.NewSlopeAngleDitch = value.ToType<double>() ) + + }; + + AttributePropertyMap = new Dictionary<string, LocationAttributeMapping>(); + foreach (var keyValuePair in mappings) + { + var key = keyValuePair.Key.ToLower(); + if (AttributePropertyMap.ContainsKey(key)) + { + throw new TypeInitializationException(typeof (LocationShapeFileAttributeMap).FullName, + new ArgumentException(string.Format("The item with the key '{0}' has already been added", key))); + } + AttributePropertyMap.Add(key, keyValuePair.Value); + } + + ConstructionalMap = new Dictionary<string, LocationAttributeMapping>() + { + {LocationAttributeId.ToLower(), new LocationAttributeMapping() { File = LocationShapeFileName, Id = LocationAttributeId, Name = "LocationId"}}, + {DikeRingAttributeId.ToLower(), new LocationAttributeMapping() { File = LocationShapeFileName, Id = DikeRingAttributeId, Name = "DikeringId"}}, + {CrossSectionAttributId.ToLower(), new LocationAttributeMapping() { File = "crosssection.shp", Id = CrossSectionAttributId, Name = "LocationId"}} + }; + + #endregion + } + + private static IEnumerable<string> NonPropertyAttributes + { + get + { + yield return LocationAttributeId.ToLower(); + yield return DikeRingAttributeId.ToLower(); + //yield return SegmentAttributeId.ToLower(); + yield return CrossSectionAttributId.ToLower(); + } + } + + public static bool IsPropertyAttribute(string attributeId) + { + if (string.IsNullOrEmpty(attributeId) || attributeId.Trim() == "") + throw new ArgumentNullException("attributeId"); + + var id = attributeId.ToLowerInvariant(); + return !NonPropertyAttributes.Contains(id); + } + + public static LocationAttributeMapping GetAttributeMapping(string attributeId) + { + if (string.IsNullOrEmpty(attributeId) || attributeId.Trim() == "") + throw new ArgumentNullException("attributeId"); + + return GetAttributeMapping(null, attributeId); + } + + public static LocationAttributeMapping GetAttributeMapping(DataAttribute dataAttribute) + { + if (dataAttribute == null) + throw new ArgumentNullException("dataAttribute"); + + return GetAttributeMapping(dataAttribute, dataAttribute.AttributeId); + } + + public static LocationAttributeMapping GetAttributeMapping(DataAttribute dataAttribute, string attributeId) + { + if (string.IsNullOrEmpty(attributeId) || attributeId.Trim() == "") + throw new ArgumentNullException("attributeId"); + + var map = ConstructionalMap; + + string file = string.Empty, attrName = string.Empty; + Action<CsvImporterLocations.LocationRecord, object> action = (t, value) => { }; + + var id = attributeId.ToLower(); + + if (ConstructionalMap.ContainsKey(id)) + { + file = dataAttribute == null || string.IsNullOrEmpty(dataAttribute.DataSource) || dataAttribute.DataSource.Trim() == string.Empty ? + map[id].File : dataAttribute.DataSource; + + attrName = dataAttribute == null || string.IsNullOrEmpty(dataAttribute.AttributeName) || dataAttribute.AttributeName.Trim() == "" + ? map[id].Name // return the default shape file colum name + : dataAttribute.AttributeName.ToLower(); + + action = map[id].Action; + } + else if (AttributePropertyMap.ContainsKey(id)) + { + map = AttributePropertyMap; + file = dataAttribute == null || string.IsNullOrEmpty(dataAttribute.DataSource) || dataAttribute.DataSource.Trim() == string.Empty ? + map[id].File : dataAttribute.DataSource; + + attrName = dataAttribute == null || string.IsNullOrEmpty(dataAttribute.AttributeName) || dataAttribute.AttributeName.Trim() == "" + ? map[id].Name // return the default shape file colum name + : dataAttribute.AttributeName; + + action = map[id].Action; + } + + return new LocationAttributeMapping + { + Id = attributeId, + File = file, + Name = attrName, + Action = action + }; + } + + /// <summary> + /// Checks if the given attribute id is supported by this importer. + /// The id check is case sensitive! + /// </summary> + /// <param name="attributeId"></param> + /// <returns>True if the attribute id is in the key map</returns> + public static bool IsAttributeIdSupported(string attributeId) + { + if (string.IsNullOrEmpty(attributeId) || attributeId.Trim() == "") + throw new ArgumentNullException("attributeId"); + + var id = attributeId.ToLower(); + return AttributePropertyMap.ContainsKey(id); + } + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Xsd/pi_timeseries.xsd =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Xsd/pi_timeseries.xsd (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Xsd/pi_timeseries.xsd (revision 3305) @@ -0,0 +1,260 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- +Copyright (C) Stichting Deltares 2019. All rights reserved. + +This file is part of the DAM - Clients Library. + +The DAM - UI is free software: you can redistribute it and/or modify +it under the terms of the GNU 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 General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see <http://www.gnu.org/licenses/>. + +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. +--> +<schema xmlns:fews="http://www.wldelft.nl/fews/PI" xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.wldelft.nl/fews/PI" elementFormDefault="qualified" attributeFormDefault="unqualified" version="1.0"> +<include schemaLocation="pi_sharedtypes.xsd"/> +<element name="TimeSeries" type="fews:TimeSeriesCollectionComplexType"> +<annotation> +<documentation> +Time series data represent data collected over a given period of time at a specific location +</documentation> +</annotation> +</element> +<complexType name="TimeSeriesCollectionComplexType"> +<annotation> +<documentation> +Time series data represent data collected over a given period of time at a specific location +</documentation> +</annotation> +<sequence> +<element name="timeZone" type="fews:TimeZoneSimpleType" default="0.0" minOccurs="0"/> +<element name="series" type="fews:TimeSeriesComplexType" maxOccurs="unbounded"> +<annotation> +<documentation> +Time series data represent data collected over a given period of time at a specific location +</documentation> +</annotation> +</element> +</sequence> +<attribute name="version" type="fews:versionString" use="optional" default="1.2"> +<annotation> +<documentation>The version of the published interface schemas</documentation> +</annotation> +</attribute> +</complexType> +<complexType name="TimeSeriesComplexType"> +<annotation> +<documentation> +Time series data represent data collected over a given period of time at a specific location +</documentation> +</annotation> +<sequence> +<element name="header" type="fews:HeaderComplexType"> +<annotation> +<documentation> +The header is used to specify the link to the location and the contents +</documentation> +</annotation> +</element> +<element name="event" type="fews:EventComplexType" minOccurs="0" maxOccurs="unbounded"> +<annotation> +<documentation> +unlimited number of events with a constant timeStep. The date, time and value attributes are required, the quality flag is optional. When no events exists the event values are stored in a bin file. The binary file has the same name as the xml file only the extension is "bin" instead of "xml". The bin file contains only IEEE 32 bit reals. The length of the bin file is 4 times the number of events for all time series in the file. The byte order in the bin file is always Intel x86. The bin file is only allowed for equidistant time steps. +</documentation> +</annotation> +</element> +<element name="comment" type="fews:commentString" minOccurs="0"> +<annotation> +<documentation> +use this field as a notebook to add comments, suggestions description of data entered etc. +</documentation> +</annotation> +</element> +</sequence> +</complexType> +<complexType name="HeaderComplexType"> +<annotation> +<documentation> +The header is used to specify the link to the location and the contents +</documentation> +</annotation> +<sequence> +<element name="type" type="fews:timeSeriesType"> +<annotation> +<documentation> +Type of data, either accumulative or instantaneous. For accumulative data the time/date of the event is the moment at which the data was gathered. +</documentation> +</annotation> +</element> +<element name="locationId" type="fews:LocationIdSimpleType"/> +<element name="parameterId" type="fews:ParameterSimpleType"/> +<element name="qualifierId" type="fews:idString" minOccurs="0" maxOccurs="unbounded"> +<annotation> +<documentation> +Since version 1.4 Further clarification of the time series, when the parameter, location and time step are not enough to identify a time series. Multiple qualifiers are allowed, the order of the qualifiers is insignificant. A different order of the qualifier ids should not map to the an other time series. +</documentation> +</annotation> +</element> +<sequence minOccurs="0"> +<element name="ensembleId" type="fews:idString" minOccurs="0"> +<annotation> +<documentation> +Since version 1.4 An ensemble forecast consists of a number of simulations made by making small changes to the estimate of the current state used to initialize the simulation. These small changes are designed to reflect the uncertainty in the estimate. Every simulation has it's own ensembleMemberIndex When specified the ensembleMemberIndex is required +</documentation> +</annotation> +</element> +<element name="ensembleMemberIndex" type="nonNegativeInteger"> +<annotation> +<documentation> +Since version 1.4 An ensemble forecast consists of a number of simulations made by making small changes to the estimate of the current state used to initialize the simulation. These small changes are designed to reflect the uncertainty in the estimate. Every simulation has it's own ensembleMemberIndex. Ensemble id is not required when the ensembleMemberIndex is specified +</documentation> +</annotation> +</element> +</sequence> +<element name="timeStep" type="fews:TimeStepComplexType"> +<annotation> +<documentation>The timeStep element provides three choices</documentation> +</annotation> +</element> +<element name="startDate" type="fews:DateTimeComplexType"> +<annotation> +<documentation>date/time of the first event</documentation> +</annotation> +</element> +<element name="endDate" type="fews:DateTimeComplexType"> +<annotation> +<documentation>date/time of the last event</documentation> +</annotation> +</element> +<element name="forecastDate" type="fews:DateTimeComplexType" minOccurs="0"> +<annotation> +<documentation> +Since version 1.5 date/time of the forecast. By default the forecastDate equals the start time +</documentation> +</annotation> +</element> +<element name="missVal" type="double" default="NaN"> +<annotation> +<documentation> +Missing value definition for this TimeSeries. Defaults to NaN if left empty +</documentation> +</annotation> +</element> +<element name="longName" type="string" minOccurs="0"> +<annotation> +<documentation>Optional long (descriptive) name</documentation> +</annotation> +</element> +<element name="stationName" type="fews:nameString" minOccurs="0"> +<annotation> +<documentation>Station name</documentation> +</annotation> +</element> +<element name="lat" type="double" minOccurs="0"> +<annotation> +<documentation>Latitude of station</documentation> +</annotation> +</element> +<element name="lon" type="double" minOccurs="0"> +<annotation> +<documentation>Longitude of station</documentation> +</annotation> +</element> +<element name="x" type="double" minOccurs="0"> +<annotation> +<documentation>X coordinate of station</documentation> +</annotation> +</element> +<element name="y" type="double" minOccurs="0"> +<annotation> +<documentation>Y coordinate of station</documentation> +</annotation> +</element> +<element name="z" type="double" minOccurs="0"> +<annotation> +<documentation>Z coordinate of station</documentation> +</annotation> +</element> +<element name="units" type="string" minOccurs="0"> +<annotation> +<documentation>Optional string that identifies the units used</documentation> +</annotation> +</element> +<element name="sourceOrganisation" type="string" minOccurs="0"/> +<element name="sourceSystem" type="string" minOccurs="0"/> +<element name="fileDescription" type="string" minOccurs="0"> +<annotation> +<documentation> +Description of (the content of) this file +</documentation> +</annotation> +</element> +<element name="creationDate" type="date" minOccurs="0"> +<annotation> +<documentation> +Date on which this TimeSeries was created +</documentation> +</annotation> +</element> +<element name="creationTime" type="time" minOccurs="0"> +<annotation> +<documentation> +Time on which this TimeSeries was created +</documentation> +</annotation> +</element> +<element name="region" type="string" minOccurs="0"> +<annotation> +<documentation> +code/description of the region. Needed if the id's can be the same in different regions. +</documentation> +</annotation> +</element> +<element name="thresholds" type="fews:ThresholdComplexType" minOccurs="0"/> +</sequence> +</complexType> +<complexType name="ThresholdComplexType"> +<sequence> +<element name="highLevelThreshold" type="fews:HighLevelThresholdsComplexType" maxOccurs="unbounded"/> +</sequence> +</complexType> +<complexType name="HighLevelThresholdsComplexType"> +<attribute name="id" type="string" use="required"/> +<attribute name="name" type="string" use="optional"/> +<attribute name="value" type="float" use="required"/> +</complexType> +<complexType name="EventComplexType"> +<annotation> +<documentation> +unlimited number of events with a constant timeStep. Each TimeSeries should contain at least one element (records). The date, time and value attributes are required, the quality flag is optional. +</documentation> +</annotation> +<attribute name="date" type="fews:dateType" use="required"> +<annotation> +<documentation>ISO 8601 (yyyy-mm-dd)</documentation> +</annotation> +</attribute> +<attribute name="time" type="fews:timeType" use="required"> +<annotation> +<documentation>ISO 8601 (hh:mm:ss.dsec e.g. 16:30:0.001)</documentation> +</annotation> +</attribute> +<attribute name="value" type="double" use="required"/> +<attribute name="flag" type="int" use="optional"/> +<attribute name="comment" type="string" use="optional"> +<annotation> +<documentation>Since version 1.3</documentation> +</annotation> +</attribute> +</complexType> +</schema> \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DtoAssembler/DtoAssemblerException.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DtoAssembler/DtoAssemblerException.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DtoAssembler/DtoAssemblerException.cs (revision 3305) @@ -0,0 +1,56 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. +// +// 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.Standard +{ + [Serializable] + public class DtoAssemblerException : Exception + { + // + // For guidelines regarding the creation of new exception types, see + // http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpgenref/html/cpconerrorraisinghandlingguidelines.asp + // and + // http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dncscol/html/csharp07192001.asp + // + + public DtoAssemblerException() + { + } + + public DtoAssemblerException(string message) : base(message) + { + } + + public DtoAssemblerException(string message, Exception inner) : base(message, inner) + { + } + + protected DtoAssemblerException( + SerializationInfo info, + StreamingContext context) + : base(info, context) + { + } + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/ApplicationLogger.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/ApplicationLogger.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/ApplicationLogger.cs (revision 3305) @@ -0,0 +1,59 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +namespace Deltares.Dam.Data +{ + using System; + using System.Diagnostics; + using System.IO; + + public class ApplicationLogger + { + public const string errorLogExtension = "errorlog.txt"; + public static StreamWriter AppendErrorLog(string workingPath, Dike dike) + { + StreamWriter errorLog = null; + try + { + errorLog = File.AppendText(workingPath + dike.Name + errorLogExtension); + } + catch (Exception e) + { + Trace.Assert(false, "Could not append to errorlog." + e.ToString()); + } + return errorLog; + } + + public static StreamWriter CreateErrorLog(string workingPath, Dike dike) + { + StreamWriter errorLog = null; + try + { + errorLog = File.CreateText(workingPath + dike.Name + errorLogExtension); + } + catch (Exception e) + { + Trace.Assert(false, "Could not create errorlog." + e.ToString()); + } + return errorLog; + } + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/WaterBoardJobImporter.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/WaterBoardJobImporter.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/WaterBoardJobImporter.cs (revision 3305) @@ -0,0 +1,44 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +namespace Deltares.Dam.Data +{ + public static class WaterBoardJobImporter + { + public static void ImportWaterlevels(WaterBoardJob waterBoardJob, TimeSerieCollection timeSerieCollection) + { + foreach (DamJob dikeJob in waterBoardJob.Jobs) + { + if (dikeJob.GetType() == typeof(DikeJob)) + { + foreach (DamJob locationJob in ((DikeJob)dikeJob).Jobs) + { + if (locationJob.GetType() == typeof(LocationJob)) + { + ((LocationJob)locationJob).WaterLevelTimeSerie = timeSerieCollection.FindSerie + ("WaterLevel", ((LocationJob)locationJob).Location.Name); + } + } + } + } + } + } +} Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/build/Deltares.DamClientsLibrary.Version.targets =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/build/Deltares.DamClientsLibrary.Version.targets (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/build/Deltares.DamClientsLibrary.Version.targets (revision 3305) @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <Configuration Condition="$(Configuration) == ''">Debug</Configuration> + <Platform Condition="$(Platform) == ''">x86</Platform> + <OutputType Condition="$(OutputType) == ''">Library</OutputType> + <CheckForOverflowUnderflow Condition="$(CheckForOverflowUnderflow) == ''">true</CheckForOverflowUnderflow> + <SolutionDir>$(MSBuildThisFileDirectory)</SolutionDir> + <OutputPath Condition="$(OutputPath) == ''">$(SolutionDir)\bin\$(Configuration)\</OutputPath> + <OutDir>$(OutputPath)</OutDir> + <PlatformTarget>x86</PlatformTarget> + <TargetFrameworkVersion>v4.5</TargetFrameworkVersion> + <WarningLevel>4</WarningLevel> + <FileAlignment>512</FileAlignment> + <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> + <AppDesignerFolder>Properties</AppDesignerFolder> + <ErrorReport>prompt</ErrorReport> + <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'"> + <DefineConstants>DEBUG;TRACE</DefineConstants> + <DebugType>full</DebugType> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'"> + <DefineConstants>TRACE</DefineConstants> + <DebugType>pdbonly</DebugType> + <AllowedReferenceRelatedFileExtensions>none</AllowedReferenceRelatedFileExtensions> + </PropertyGroup> + <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> + <ItemGroup> + <Compile Include="$(ProjectDir)..\Deltares.DamClientsLibrary.Version\GlobalAssembly.cs"> + <Link>GlobalAssembly.cs</Link> + </Compile> + </ItemGroup> +</Project> \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Properties/Resources.resx =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Properties/Resources.resx (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Properties/Resources.resx (revision 3305) @@ -0,0 +1,312 @@ +<?xml version="1.0" encoding="utf-8"?> +<root> + <!-- + Microsoft ResX Schema + + Version 2.0 + + The primary goals of this format is to allow a simple XML format + that is mostly human readable. The generation and parsing of the + various data types are done through the TypeConverter classes + associated with the data types. + + Example: + + ... ado.net/XML headers & schema ... + <resheader name="resmimetype">text/microsoft-resx</resheader> + <resheader name="version">2.0</resheader> + <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> + <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> + <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> + <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> + <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> + <value>[base64 mime encoded serialized .NET Framework object]</value> + </data> + <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> + <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> + <comment>This is a comment</comment> + </data> + + There are any number of "resheader" rows that contain simple + name/value pairs. + + Each data row contains a name, and value. The row also contains a + type or mimetype. Type corresponds to a .NET class that support + text/value conversion through the TypeConverter architecture. + Classes that don't support this are serialized and stored with the + mimetype set. + + The mimetype is used for serialized objects, and tells the + ResXResourceReader how to depersist the object. This is currently not + extensible. For a given mimetype the value must be set accordingly: + + Note - application/x-microsoft.net.object.binary.base64 is the format + that the ResXResourceWriter will generate, however the reader can + read any of the formats listed below. + + mimetype: application/x-microsoft.net.object.binary.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.soap.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Soap.SoapFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.bytearray.base64 + value : The object must be serialized into a byte array + : using a System.ComponentModel.TypeConverter + : and then encoded with base64 encoding. + --> + <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> + <xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> + <xsd:element name="root" msdata:IsDataSet="true"> + <xsd:complexType> + <xsd:choice maxOccurs="unbounded"> + <xsd:element name="metadata"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" /> + </xsd:sequence> + <xsd:attribute name="name" use="required" type="xsd:string" /> + <xsd:attribute name="type" type="xsd:string" /> + <xsd:attribute name="mimetype" type="xsd:string" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="assembly"> + <xsd:complexType> + <xsd:attribute name="alias" type="xsd:string" /> + <xsd:attribute name="name" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="data"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> + <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> + <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="resheader"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" /> + </xsd:complexType> + </xsd:element> + </xsd:choice> + </xsd:complexType> + </xsd:element> + </xsd:schema> + <resheader name="resmimetype"> + <value>text/microsoft-resx</value> + </resheader> + <resheader name="version"> + <value>2.0</value> + </resheader> + <resheader name="reader"> + <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <resheader name="writer"> + <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <data name="CsvFileNotFound" xml:space="preserve"> + <value>Couldn't find the csv data file {0}</value> + </data> + <data name="CsvFileNotValid" xml:space="preserve"> + <value>The file name is not valid or empty</value> + </data> + <data name="CsvHeaderNotValid" xml:space="preserve"> + <value>The header in the import file is not valid</value> + </data> + <data name="CsvHeaderNullOrEmpty" xml:space="preserve"> + <value>The header in the import file is not valid</value> + </data> + <data name="CsvObjectMaterializerNotValid" xml:space="preserve"> + <value>The object materializer is not valid</value> + </data> + <data name="CsvSplitterPatternNotValid" xml:space="preserve"> + <value>The given pattern to split the data values of the CSV files is not valid</value> + </data> + <data name="DataImportArgumentNull" xml:space="preserve"> + <value>The data import argument is not valid</value> + </data> + <data name="EntityAlreadyExist" xml:space="preserve"> + <value>Cannot create or add the entity with the the given id because it already exist</value> + </data> + <data name="EntityFactoryArgumentNull" xml:space="preserve"> + <value>The factory argument is null but is a required</value> + </data> + <data name="ImportDataNotValid" xml:space="preserve"> + <value>The imported data is not valid. Reason: {0}</value> + </data> + <data name="ImportedLocationDoesntHaveValidSurfaceLines" xml:space="preserve"> + <value>No dike points in location surface line. Please check if the surface line ID defined in the locations import file matches the ID's in the surface line import file</value> + </data> + <data name="ImportFileNotExist" xml:space="preserve"> + <value>The import file {0} couldn't be found. This file is required.</value> + </data> + <data name="ImportFilesNotValidated" xml:space="preserve"> + <value>The file which are required for the import are not validated</value> + </data> + <data name="ImportFolderNotExist" xml:space="preserve"> + <value>The import folder {0} does not exist</value> + </data> + <data name="ImportFolderNullOrEmpty" xml:space="preserve"> + <value>The import folder is not valid</value> + </data> + <data name="MStabExecutableFileNameNotFound" xml:space="preserve"> + <value>Couldn't find the MStab executable at location {0}</value> + </data> + <data name="OutputFileHasNoContent" xml:space="preserve"> + <value>Couldn't parse the file because it has no valid content</value> + </data> + <data name="OutputFileNameNotValid" xml:space="preserve"> + <value>The file name is not valid</value> + </data> + <data name="OutputFileNotExist" xml:space="preserve"> + <value>Couldn't find the output file {0}</value> + </data> + <data name="ProjectFileNameNullOrEmpty" xml:space="preserve"> + <value>Project file name is not valid</value> + </data> + <data name="ProjectFileNotExist" xml:space="preserve"> + <value>Project file not found </value> + </data> + <data name="RequiredEntityDoesNotExist" xml:space="preserve"> + <value>The required entity '{0}' with ID '{1}' doesn't exist</value> + </data> + <data name="RequiredParameterMissing" xml:space="preserve"> + <value>The required parameter {0} which should be contained in object {1} is missing</value> + </data> + <data name="SegmentIdArgumentNullOrEmpty" xml:space="preserve"> + <value>The segment id value is null or empty which is not allowed</value> + </data> + <data name="SoilAttachedToLayerNotValid" xml:space="preserve"> + <value>The soil material in the layer could not be converted to local type</value> + </data> + <data name="SoilProfileIdArgumentNullOrEmpty" xml:space="preserve"> + <value>The soil profile name or id value is null or empty which is not allowed</value> + </data> + <data name="SurfaceLineIdArgumentNullOrEmpty" xml:space="preserve"> + <value>The surface line id argument is null or empty but it is required</value> + </data> + <data name="SurfacelineIsNotInsideSoilprofile" xml:space="preserve"> + <value>Surfaceline is not inside soil profile</value> + </data> + <data name="TopLayerToBeEvaluatedNotInsideSoilprofile" xml:space="preserve"> + <value>The top layer to be evaluated is not inside the soil profile</value> + </data> + <data name="SurfaceLinePointNotExtists" xml:space="preserve"> + <value>The required characteristic point type '{0}' with coordinate '{1}' does not exist in the point collection of surfaceline '{2}'</value> + </data> + <data name="NonExistentLocation" xml:space="preserve"> + <value>Location '{0}' does not exist in the location collection.</value> + </data> + <data name="TwoSandlayersRequiredInSoilProfile" xml:space="preserve"> + <value>Two sandlayers are mandatory in soil profile</value> + </data> + <data name="CsvColumnIndexAlreadyExists" xml:space="preserve"> + <value>The column index of {0} defined on property {1} in the CSV export object class already exists</value> + </data> + <data name="WaterLevelInputFileNullOrEmpty" xml:space="preserve"> + <value>The water level input file is not null or empty</value> + </data> + <data name="NoSoilProfileDefinedForLocation" xml:space="preserve"> + <value>No soil profiles have been defined for location '{0}'.</value> + </data> + <data name="LocationHasNoSegment" xml:space="preserve"> + <value>Location '{0}' has no segment.</value> + </data> + <data name="FileNameNotValid" xml:space="preserve"> + <value>The file name is not valid. Maybe due to a null or empty string and or invalid characters. Please use a valid file name</value> + </data> + <data name="GaugeIdArgumentNullOrEmpty" xml:space="preserve"> + <value>The gauge id value is null or empty which is not allowed</value> + </data> + <data name="LocationIdArgumentNullOrEmpty" xml:space="preserve"> + <value>The location id value is null or empty which is not allowed</value> + </data> + <data name="ImportedLocationDoesntHaveSoilprofile" xml:space="preserve"> + <value>This location does not have a soilprofile</value> + </data> + <data name="ImportedLocationDoesntHaveValidPL1Lines" xml:space="preserve"> + <value>No points in location PL1 line. Please check if the PL1 line ID defined in the locations import file matches the ID's in the PL1 line import file</value> + </data> + <data name="SoildatabaseNotFound" xml:space="preserve"> + <value>Soildatabase '{0}' is not found</value> + </data> + <data name="SoilProfileNotAssigned" xml:space="preserve"> + <value>The soilprofile is not assigned</value> + </data> + <data name="SurfaceLineNotAssigned" xml:space="preserve"> + <value>The surfaceline is not assigned</value> + </data> + <data name="SlopeWExecutableFileNameNotFound" xml:space="preserve"> + <value>Couldn't find the SlopeW (GeoStudio) executable at location {0}</value> + </data> + <data name="SoilListIsNull" xml:space="preserve"> + <value>The soil list is not yet created.</value> + </data> + <data name="PL1NotCreated" xml:space="preserve"> + <value>PL1 has not been created</value> + </data> + <data name="DikeShouldContainExactly1Dike" xml:space="preserve"> + <value>The project should contain exactly 1 dike</value> + </data> + <data name="LocationInvalidName" xml:space="preserve"> + <value>Location has an invalid name {0}</value> + </data> + <data name="NoCalculationTypeSpecified" xml:space="preserve"> + <value>No calculation type specified</value> + </data> + <data name="NoDikeDefined" xml:space="preserve"> + <value>No dike defined in this project</value> + </data> + <data name="NoLocationsDefined" xml:space="preserve"> + <value>No locations defined in this project</value> + </data> + <data name="NoRiverLevel" xml:space="preserve"> + <value>Location '{0}', scenario '{1}' has no river level</value> + </data> + <data name="NoRiverLevelLow" xml:space="preserve"> + <value>Location '{0}', scenario '{1}' has no river level low</value> + </data> + <data name="NoScenariosDefinedInLocation" xml:space="preserve"> + <value>No scenarios defined in location</value> + </data> + <data name="NoSoilprofiles1DDefinedInProject" xml:space="preserve"> + <value>No soilprofiles1D defined in this project</value> + </data> + <data name="NoSoilsDefinedInProject" xml:space="preserve"> + <value>No soils defined in this project</value> + </data> + <data name="NoSurfaceLines" xml:space="preserve"> + <value>No surfacelines defined in this project</value> + </data> + <data name="SegmentInvalidName" xml:space="preserve"> + <value>Segment has an invalid name {0}</value> + </data> + <data name="SoilInvalidName" xml:space="preserve"> + <value>Soil has an invalid name {0}</value> + </data> + <data name="SoilProfileInvalidName" xml:space="preserve"> + <value>Soilprofile has an invalid name {0}</value> + </data> + <data name="SurfaceLineHasNoCharacteristicPoints" xml:space="preserve"> + <value>Surfaceline '{0}' has no characteristic points</value> + </data> + <data name="SurfaceLineHasNoPoints" xml:space="preserve"> + <value>Surfaceline '{0}' has no points</value> + </data> + <data name="SurfaceLineInvalidName" xml:space="preserve"> + <value>Surfaceline has an invalid name {0}</value> + </data> +</root> \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/IFeatureRepository.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/IFeatureRepository.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/IFeatureRepository.cs (revision 3305) @@ -0,0 +1,65 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. +// +// 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 GeoAPI.Geometries; + +namespace Deltares.Maps +{ + public interface IFeatureRepository : IFeatureCollection + { + IGeometry GetGeometryById(Guid id); + + IEnumerable<KeyValuePair<string, object>> GetAttributes(IGeometry geom); + + IEnumerable<Guid> FeatureIds { get; } + IEnumerable<IFeature> Features { get; } + + IEnumerable<string> SupportedAttributes { get; } + + /// <summary> + /// Returns a list of features which may lie in the given search envelope + /// </summary> + /// <param name="feature"></param> + /// <returns></returns> + IEnumerable<IFeature> Query(IFeature feature); + + /// <summary> + /// Returns a list of features which may lie in the given search envelope + /// </summary> + /// <param name="feature"></param> + /// <returns></returns> + IEnumerable<IFeature> Query(IGeometry feature); + + /// <summary> + /// Returns a list of features which may lie in the given search envelope + /// </summary> + /// <param name="feature"></param> + /// <returns></returns> + IEnumerable<IFeature> Query(Envelope feature); + + void Add(Feature feature, Func<IFeature, bool> predicate); + + void Remove(Func<IFeature, bool> predicate); + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Properties/AssemblyInfo.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Properties/AssemblyInfo.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Properties/AssemblyInfo.cs (revision 3305) @@ -0,0 +1,31 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. +// +// 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.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +[assembly: AssemblyTitle("Deltares.Dam.Data")] +[assembly: ComVisible(false)] +[assembly: Guid("a6184ba6-b126-4783-b437-e987b511e09b")] + +[assembly: InternalsVisibleTo("Deltares.Dam.Tests")] +[assembly: InternalsVisibleTo("Deltares.Dam.IntegrationTests")] Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/IO/VersionInfo.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/IO/VersionInfo.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/IO/VersionInfo.cs (revision 3305) @@ -0,0 +1,87 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. +// +// 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.Reflection; +using System.Xml.Serialization; +using Deltares.Standard.Attributes; + +namespace Deltares.Dam.Data.IO +{ + [XmlNoKey] + public class VersionInfo + { + public const int CurrentFileVersion = 1; + /// <summary>Current File Version.</summary> + /// <value>The file version.</value> + /// + /// + public int FileVersion { get; set; } // Default is 0 and indicates the situation that FileVersion was not introduced yet + + /// <summary>Gets or sets the assembly name with which the input file is being created.</summary> + /// <value>The program version.</value> + /// + public string AssemblyName { get; set; } + + /// <summary>Gets or sets the assembly version with which the input file is being created.</summary> + /// <value>The program version.</value> + /// + public string AssemblyVersion { get; set; } + + /// <summary>Gets or sets the version as read.</summary> + /// <value>The file version as read.</value> + /// + /// + [XmlIgnore] + public int FileVersionAsRead { get; set; } + /// <summary>Gets or sets the assembly name with which the input file has been created.</summary> + /// <value>The assembly version as read.</value> + [XmlIgnore] + public string AssemblyNameAsRead { get; set; } + + /// <summary>Gets or sets the assembly version with which the input file has been created.</summary> + /// <value>The assembly version as read.</value> + [XmlIgnore] + public string AssemblyVersionAsRead { get; set; } + + /// <summary>Initializes the version information to the current program version.</summary> + public void InitVersionInfo() + { + FileVersion = VersionInfo.CurrentFileVersion; + var hostAssembly = Assembly.GetEntryAssembly(); + if (hostAssembly == null) + { + hostAssembly = Assembly.GetExecutingAssembly(); + } + AssemblyName = hostAssembly.GetName().Name; + AssemblyVersion = hostAssembly.GetName().Version.ToString(); + } + + /// <summary>After the read the current version info should be transferred to the ..AsRead fields + /// and after that current version info can be initialized.</summary> + public void InitVersionInfoAfterRead() + { + FileVersionAsRead = FileVersion; + AssemblyNameAsRead = AssemblyName; + AssemblyVersionAsRead = AssemblyVersion; + InitVersionInfo(); + } + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Xsd/SoilProfileDataSet.xsd =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Xsd/SoilProfileDataSet.xsd (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Xsd/SoilProfileDataSet.xsd (revision 3305) @@ -0,0 +1,264 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +Copyright (C) Stichting Deltares 2019. All rights reserved. + +This file is part of the DAM - Clients Library. + +The DAM - UI is free software: you can redistribute it and/or modify +it under the terms of the GNU 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 General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see <http://www.gnu.org/licenses/>. + +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. +--> +<xs:schema id="SoilProfileDataSet" targetNamespace="http://tempuri.org/DataSet1.xsd" xmlns:mstns="http://tempuri.org/DataSet1.xsd" xmlns="http://tempuri.org/DataSet1.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:msprop="urn:schemas-microsoft-com:xml-msprop" attributeFormDefault="qualified" elementFormDefault="qualified"> + <xs:annotation> + <xs:appinfo source="urn:schemas-microsoft-com:xml-msdatasource"> + <DataSource DefaultConnectionIndex="0" FunctionsComponentName="QueriesTableAdapter" Modifier="AutoLayout, AnsiClass, Class, Public" SchemaSerializationMode="IncludeSchema" xmlns="urn:schemas-microsoft-com:xml-msdatasource"> + <Connections> + <Connection AppSettingsObjectName="Web.config" AppSettingsPropertyName="ConnectionString" IsAppSettingsProperty="true" Modifier="Assembly" Name="ConnectionString (Web.config)" PropertyReference="AppConfig.System.Configuration.ConfigurationManager.0.ConnectionStrings.ConnectionString.ConnectionString" Provider="System.Data.Odbc" /> + </Connections> + <Tables> + <TableAdapter BaseClass="System.ComponentModel.Component" DataAccessorModifier="AutoLayout, AnsiClass, Class, Public" DataAccessorName="ODGEOMETRIESTableAdapter" GeneratorDataComponentClassName="ODGEOMETRIESTableAdapter" Name="ODGEOMETRIES" UserDataComponentName="ODGEOMETRIESTableAdapter"> + <MainSource> + <DbSource ConnectionRef="ConnectionString (Web.config)" DbObjectName="[D:\bka\Voorbeeld MGeobase\Vb].ODGEOMETRIES" DbObjectType="Table" GenerateMethods="Get" GenerateShortCommands="false" GeneratorGetMethodName="GetData" GetMethodModifier="Public" GetMethodName="GetData" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="false" UserGetMethodName="GetData" UserSourceName="GetData"> + <SelectCommand> + <DbCommand CommandType="Text" ModifiedByUser="true"> + <CommandText>SELECT OD_NR, OD_NAME, OD_DESCR, OD_RDX, OD_RDY, OD_CPTNR, OD_BORINGNR, OD_GEOL_ZONE, OD_CHANCE_OCCUR FROM ODGEOMETRIES</CommandText> + <Parameters /> + </DbCommand> + </SelectCommand> + </DbSource> + </MainSource> + <Mappings> + <Mapping SourceColumn="OD_NR" DataSetColumn="OD_NR" /> + <Mapping SourceColumn="OD_NAME" DataSetColumn="OD_NAME" /> + <Mapping SourceColumn="OD_DESCR" DataSetColumn="OD_DESCR" /> + <Mapping SourceColumn="OD_RDX" DataSetColumn="OD_RDX" /> + <Mapping SourceColumn="OD_RDY" DataSetColumn="OD_RDY" /> + <Mapping SourceColumn="OD_CPTNR" DataSetColumn="OD_CPTNR" /> + <Mapping SourceColumn="OD_BORINGNR" DataSetColumn="OD_BORINGNR" /> + <Mapping SourceColumn="OD_GEOL_ZONE" DataSetColumn="OD_GEOL_ZONE" /> + <Mapping SourceColumn="OD_CHANCE_OCCUR" DataSetColumn="OD_CHANCE_OCCUR" /> + </Mappings> + <Sources /> + </TableAdapter> + <TableAdapter BaseClass="System.ComponentModel.Component" DataAccessorModifier="AutoLayout, AnsiClass, Class, Public" DataAccessorName="ODGEOLAYERSTableAdapter" GeneratorDataComponentClassName="ODGEOLAYERSTableAdapter" Name="ODGEOLAYERS" UserDataComponentName="ODGEOLAYERSTableAdapter"> + <MainSource> + <DbSource ConnectionRef="ConnectionString (Web.config)" DbObjectName="[D:\bka\Voorbeeld MGeobase\Vb].ODGEOLAYERS" DbObjectType="Table" GenerateMethods="Get" GenerateShortCommands="false" GeneratorGetMethodName="GetData" GetMethodModifier="Public" GetMethodName="GetData" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="false" UserGetMethodName="GetData" UserSourceName="GetData"> + <SelectCommand> + <DbCommand CommandType="Text" ModifiedByUser="true"> + <CommandText>SELECT OL_NR, OD_NR, MA_NR, OL_LAYERNR, OL_LEVEL, OL_PLATTOP, OL_PLATBOTTOM, OL_TOPEXCESSPP, OL_BOTEXCESSPP, OL_OCR FROM ODGEOLAYERS</CommandText> + <Parameters /> + </DbCommand> + </SelectCommand> + </DbSource> + </MainSource> + <Mappings> + <Mapping SourceColumn="OL_NR" DataSetColumn="OL_NR" /> + <Mapping SourceColumn="OD_NR" DataSetColumn="OD_NR" /> + <Mapping SourceColumn="MA_NR" DataSetColumn="MA_NR" /> + <Mapping SourceColumn="OL_LAYERNR" DataSetColumn="OL_LAYERNR" /> + <Mapping SourceColumn="OL_LEVEL" DataSetColumn="OL_LEVEL" /> + <Mapping SourceColumn="OL_PLATTOP" DataSetColumn="OL_PLATTOP" /> + <Mapping SourceColumn="OL_PLATBOTTOM" DataSetColumn="OL_PLATBOTTOM" /> + <Mapping SourceColumn="OL_TOPEXCESSPP" DataSetColumn="OL_TOPEXCESSPP" /> + <Mapping SourceColumn="OL_BOTEXCESSPP" DataSetColumn="OL_BOTEXCESSPP" /> + <Mapping SourceColumn="OL_OCR" DataSetColumn="OL_OCR" /> + </Mappings> + <Sources /> + </TableAdapter> + <TableAdapter BaseClass="System.ComponentModel.Component" DataAccessorModifier="AutoLayout, AnsiClass, Class, Public" DataAccessorName="MATERIALSTableAdapter" GeneratorDataComponentClassName="MATERIALSTableAdapter" Name="MATERIALS" UserDataComponentName="MATERIALSTableAdapter"> + <MainSource> + <DbSource ConnectionRef="ConnectionString (Web.config)" DbObjectName="[D:\bka\Voorbeeld MGeobase\Vb].MATERIALS" DbObjectType="Table" GenerateMethods="Get" GenerateShortCommands="false" GeneratorGetMethodName="GetData" GetMethodModifier="Public" GetMethodName="GetData" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="false" UserGetMethodName="GetData" UserSourceName="GetData"> + <SelectCommand> + <DbCommand CommandType="Text" ModifiedByUser="true"> + <CommandText>SELECT MA_NR, MA_NAME, MA_DESCR, MA_INDEX FROM MATERIALS</CommandText> + <Parameters /> + </DbCommand> + </SelectCommand> + </DbSource> + </MainSource> + <Mappings> + <Mapping SourceColumn="MA_NR" DataSetColumn="MA_NR" /> + <Mapping SourceColumn="MA_NAME" DataSetColumn="MA_NAME" /> + <Mapping SourceColumn="MA_DESCR" DataSetColumn="MA_DESCR" /> + <Mapping SourceColumn="MA_INDEX" DataSetColumn="MA_INDEX" /> + </Mappings> + <Sources /> + </TableAdapter> + <TableAdapter BaseClass="System.ComponentModel.Component" DataAccessorModifier="AutoLayout, AnsiClass, Class, Public" DataAccessorName="PARAMETERNAMESTableAdapter" GeneratorDataComponentClassName="PARAMETERNAMESTableAdapter" Name="PARAMETERNAMES" UserDataComponentName="PARAMETERNAMESTableAdapter"> + <MainSource> + <DbSource ConnectionRef="ConnectionString (Web.config)" DbObjectName="[D:\bka\Voorbeeld MGeobase\Vb].PARAMETERNAMES" DbObjectType="Table" GenerateMethods="Get" GenerateShortCommands="false" GeneratorGetMethodName="GetData" GetMethodModifier="Public" GetMethodName="GetData" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="false" UserGetMethodName="GetData" UserSourceName="GetData"> + <SelectCommand> + <DbCommand CommandType="Text" ModifiedByUser="true"> + <CommandText>SELECT PN_NR, PN_NAME FROM PARAMETERNAMES</CommandText> + <Parameters /> + </DbCommand> + </SelectCommand> + </DbSource> + </MainSource> + <Mappings> + <Mapping SourceColumn="PN_NR" DataSetColumn="PN_NR" /> + <Mapping SourceColumn="PN_NAME" DataSetColumn="PN_NAME" /> + </Mappings> + <Sources /> + </TableAdapter> + <TableAdapter BaseClass="System.ComponentModel.Component" DataAccessorModifier="AutoLayout, AnsiClass, Class, Public" DataAccessorName="PARAMETERVALUESTableAdapter" GeneratorDataComponentClassName="PARAMETERVALUESTableAdapter" Name="PARAMETERVALUES" UserDataComponentName="PARAMETERVALUESTableAdapter"> + <MainSource> + <DbSource ConnectionRef="ConnectionString (Web.config)" DbObjectName="[D:\bka\Voorbeeld MGeobase\Vb].PARAMETERVALUES" DbObjectType="Table" GenerateMethods="Get" GenerateShortCommands="false" GeneratorGetMethodName="GetData" GetMethodModifier="Public" GetMethodName="GetData" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="false" UserGetMethodName="GetData" UserSourceName="GetData"> + <SelectCommand> + <DbCommand CommandType="Text" ModifiedByUser="true"> + <CommandText>SELECT PV_NR, MA_NR, PN_NR, PV_VALUE FROM PARAMETERVALUES</CommandText> + <Parameters /> + </DbCommand> + </SelectCommand> + </DbSource> + </MainSource> + <Mappings> + <Mapping SourceColumn="PV_NR" DataSetColumn="PV_NR" /> + <Mapping SourceColumn="MA_NR" DataSetColumn="MA_NR" /> + <Mapping SourceColumn="PN_NR" DataSetColumn="PN_NR" /> + <Mapping SourceColumn="PV_VALUE" DataSetColumn="PV_VALUE" /> + </Mappings> + <Sources /> + </TableAdapter> + </Tables> + <Sources /> + </DataSource> + </xs:appinfo> + </xs:annotation> + <xs:element name="SoilProfileDataSet" msdata:IsDataSet="true" msdata:UseCurrentLocale="true" msprop:Generator_UserDSName="SoilProfileDataSet" msprop:Generator_DataSetName="SoilProfileDataSet" msprop:EnableTableAdapterManager="true"> + <xs:complexType> + <xs:choice minOccurs="0" maxOccurs="unbounded"> + <xs:element name="ODGEOMETRIES" msprop:Generator_UserTableName="ODGEOMETRIES" msprop:Generator_RowDeletedName="ODGEOMETRIESRowDeleted" msprop:Generator_RowChangedName="ODGEOMETRIESRowChanged" msprop:Generator_RowClassName="ODGEOMETRIESRow" msprop:Generator_RowChangingName="ODGEOMETRIESRowChanging" msprop:Generator_RowEvArgName="ODGEOMETRIESRowChangeEvent" msprop:Generator_RowEvHandlerName="ODGEOMETRIESRowChangeEventHandler" msprop:Generator_TableClassName="ODGEOMETRIESDataTable" msprop:Generator_TableVarName="tableODGEOMETRIES" msprop:Generator_RowDeletingName="ODGEOMETRIESRowDeleting" msprop:Generator_TablePropName="ODGEOMETRIES"> + <xs:complexType> + <xs:sequence> + <xs:element name="OD_NR" msdata:ReadOnly="true" msdata:AutoIncrement="true" msdata:AutoIncrementSeed="-1" msdata:AutoIncrementStep="-1" msprop:Generator_UserColumnName="OD_NR" msprop:Generator_ColumnVarNameInTable="columnOD_NR" msprop:Generator_ColumnPropNameInRow="OD_NR" msprop:Generator_ColumnPropNameInTable="OD_NRColumn" type="xs:int" /> + <xs:element name="OD_NAME" msprop:Generator_UserColumnName="OD_NAME" msprop:Generator_ColumnVarNameInTable="columnOD_NAME" msprop:Generator_ColumnPropNameInRow="OD_NAME" msprop:Generator_ColumnPropNameInTable="OD_NAMEColumn" minOccurs="0"> + <xs:simpleType> + <xs:restriction base="xs:string"> + <xs:maxLength value="64" /> + </xs:restriction> + </xs:simpleType> + </xs:element> + <xs:element name="OD_DESCR" msprop:Generator_UserColumnName="OD_DESCR" msprop:Generator_ColumnVarNameInTable="columnOD_DESCR" msprop:Generator_ColumnPropNameInRow="OD_DESCR" msprop:Generator_ColumnPropNameInTable="OD_DESCRColumn" minOccurs="0"> + <xs:simpleType> + <xs:restriction base="xs:string"> + <xs:maxLength value="240" /> + </xs:restriction> + </xs:simpleType> + </xs:element> + <xs:element name="OD_RDX" msprop:Generator_UserColumnName="OD_RDX" msprop:Generator_ColumnVarNameInTable="columnOD_RDX" msprop:Generator_ColumnPropNameInRow="OD_RDX" msprop:Generator_ColumnPropNameInTable="OD_RDXColumn" type="xs:double" minOccurs="0" /> + <xs:element name="OD_RDY" msprop:Generator_UserColumnName="OD_RDY" msprop:Generator_ColumnVarNameInTable="columnOD_RDY" msprop:Generator_ColumnPropNameInRow="OD_RDY" msprop:Generator_ColumnPropNameInTable="OD_RDYColumn" type="xs:double" minOccurs="0" /> + <xs:element name="OD_CPTNR" msprop:Generator_UserColumnName="OD_CPTNR" msprop:Generator_ColumnVarNameInTable="columnOD_CPTNR" msprop:Generator_ColumnPropNameInRow="OD_CPTNR" msprop:Generator_ColumnPropNameInTable="OD_CPTNRColumn" type="xs:int" minOccurs="0" /> + <xs:element name="OD_BORINGNR" msprop:Generator_UserColumnName="OD_BORINGNR" msprop:Generator_ColumnVarNameInTable="columnOD_BORINGNR" msprop:Generator_ColumnPropNameInRow="OD_BORINGNR" msprop:Generator_ColumnPropNameInTable="OD_BORINGNRColumn" type="xs:int" minOccurs="0" /> + <xs:element name="OD_GEOL_ZONE" msprop:Generator_UserColumnName="OD_GEOL_ZONE" msprop:Generator_ColumnVarNameInTable="columnOD_GEOL_ZONE" msprop:Generator_ColumnPropNameInRow="OD_GEOL_ZONE" msprop:Generator_ColumnPropNameInTable="OD_GEOL_ZONEColumn" type="xs:int" minOccurs="0" /> + <xs:element name="OD_CHANCE_OCCUR" msprop:Generator_UserColumnName="OD_CHANCE_OCCUR" msprop:Generator_ColumnVarNameInTable="columnOD_CHANCE_OCCUR" msprop:Generator_ColumnPropNameInRow="OD_CHANCE_OCCUR" msprop:Generator_ColumnPropNameInTable="OD_CHANCE_OCCURColumn" type="xs:double" minOccurs="0" /> + </xs:sequence> + </xs:complexType> + </xs:element> + <xs:element name="ODGEOLAYERS" msprop:Generator_UserTableName="ODGEOLAYERS" msprop:Generator_RowDeletedName="ODGEOLAYERSRowDeleted" msprop:Generator_RowChangedName="ODGEOLAYERSRowChanged" msprop:Generator_RowClassName="ODGEOLAYERSRow" msprop:Generator_RowChangingName="ODGEOLAYERSRowChanging" msprop:Generator_RowEvArgName="ODGEOLAYERSRowChangeEvent" msprop:Generator_RowEvHandlerName="ODGEOLAYERSRowChangeEventHandler" msprop:Generator_TableClassName="ODGEOLAYERSDataTable" msprop:Generator_TableVarName="tableODGEOLAYERS" msprop:Generator_RowDeletingName="ODGEOLAYERSRowDeleting" msprop:Generator_TablePropName="ODGEOLAYERS"> + <xs:complexType> + <xs:sequence> + <xs:element name="OL_NR" msdata:ReadOnly="true" msdata:AutoIncrement="true" msdata:AutoIncrementSeed="-1" msdata:AutoIncrementStep="-1" msprop:Generator_UserColumnName="OL_NR" msprop:Generator_ColumnVarNameInTable="columnOL_NR" msprop:Generator_ColumnPropNameInRow="OL_NR" msprop:Generator_ColumnPropNameInTable="OL_NRColumn" type="xs:int" /> + <xs:element name="OD_NR" msprop:Generator_UserColumnName="OD_NR" msprop:Generator_ColumnVarNameInTable="columnOD_NR" msprop:Generator_ColumnPropNameInRow="OD_NR" msprop:Generator_ColumnPropNameInTable="OD_NRColumn" type="xs:int" minOccurs="0" /> + <xs:element name="MA_NR" msprop:Generator_UserColumnName="MA_NR" msprop:Generator_ColumnVarNameInTable="columnMA_NR" msprop:Generator_ColumnPropNameInRow="MA_NR" msprop:Generator_ColumnPropNameInTable="MA_NRColumn" type="xs:int" minOccurs="0" /> + <xs:element name="OL_LAYERNR" msprop:Generator_UserColumnName="OL_LAYERNR" msprop:Generator_ColumnVarNameInTable="columnOL_LAYERNR" msprop:Generator_ColumnPropNameInRow="OL_LAYERNR" msprop:Generator_ColumnPropNameInTable="OL_LAYERNRColumn" type="xs:int" minOccurs="0" /> + <xs:element name="OL_LEVEL" msprop:Generator_UserColumnName="OL_LEVEL" msprop:Generator_ColumnVarNameInTable="columnOL_LEVEL" msprop:Generator_ColumnPropNameInRow="OL_LEVEL" msprop:Generator_ColumnPropNameInTable="OL_LEVELColumn" type="xs:double" minOccurs="0" /> + <xs:element name="OL_PLATTOP" msprop:Generator_UserColumnName="OL_PLATTOP" msprop:Generator_ColumnVarNameInTable="columnOL_PLATTOP" msprop:Generator_ColumnPropNameInRow="OL_PLATTOP" msprop:Generator_ColumnPropNameInTable="OL_PLATTOPColumn" type="xs:int" minOccurs="0" /> + <xs:element name="OL_PLATBOTTOM" msprop:Generator_UserColumnName="OL_PLATBOTTOM" msprop:Generator_ColumnVarNameInTable="columnOL_PLATBOTTOM" msprop:Generator_ColumnPropNameInRow="OL_PLATBOTTOM" msprop:Generator_ColumnPropNameInTable="OL_PLATBOTTOMColumn" type="xs:int" minOccurs="0" /> + <xs:element name="OL_TOPEXCESSPP" msprop:Generator_UserColumnName="OL_TOPEXCESSPP" msprop:Generator_ColumnVarNameInTable="columnOL_TOPEXCESSPP" msprop:Generator_ColumnPropNameInRow="OL_TOPEXCESSPP" msprop:Generator_ColumnPropNameInTable="OL_TOPEXCESSPPColumn" type="xs:double" minOccurs="0" /> + <xs:element name="OL_BOTEXCESSPP" msprop:Generator_UserColumnName="OL_BOTEXCESSPP" msprop:Generator_ColumnVarNameInTable="columnOL_BOTEXCESSPP" msprop:Generator_ColumnPropNameInRow="OL_BOTEXCESSPP" msprop:Generator_ColumnPropNameInTable="OL_BOTEXCESSPPColumn" type="xs:double" minOccurs="0" /> + <xs:element name="OL_OCR" msprop:Generator_UserColumnName="OL_OCR" msprop:Generator_ColumnVarNameInTable="columnOL_OCR" msprop:Generator_ColumnPropNameInRow="OL_OCR" msprop:Generator_ColumnPropNameInTable="OL_OCRColumn" type="xs:double" minOccurs="0" /> + </xs:sequence> + </xs:complexType> + </xs:element> + <xs:element name="MATERIALS" msprop:Generator_UserTableName="MATERIALS" msprop:Generator_RowDeletedName="MATERIALSRowDeleted" msprop:Generator_RowChangedName="MATERIALSRowChanged" msprop:Generator_RowClassName="MATERIALSRow" msprop:Generator_RowChangingName="MATERIALSRowChanging" msprop:Generator_RowEvArgName="MATERIALSRowChangeEvent" msprop:Generator_RowEvHandlerName="MATERIALSRowChangeEventHandler" msprop:Generator_TableClassName="MATERIALSDataTable" msprop:Generator_TableVarName="tableMATERIALS" msprop:Generator_RowDeletingName="MATERIALSRowDeleting" msprop:Generator_TablePropName="MATERIALS"> + <xs:complexType> + <xs:sequence> + <xs:element name="MA_NR" msdata:ReadOnly="true" msdata:AutoIncrement="true" msdata:AutoIncrementSeed="-1" msdata:AutoIncrementStep="-1" msprop:Generator_UserColumnName="MA_NR" msprop:Generator_ColumnVarNameInTable="columnMA_NR" msprop:Generator_ColumnPropNameInRow="MA_NR" msprop:Generator_ColumnPropNameInTable="MA_NRColumn" type="xs:int" /> + <xs:element name="MA_NAME" msprop:Generator_UserColumnName="MA_NAME" msprop:Generator_ColumnVarNameInTable="columnMA_NAME" msprop:Generator_ColumnPropNameInRow="MA_NAME" msprop:Generator_ColumnPropNameInTable="MA_NAMEColumn" minOccurs="0"> + <xs:simpleType> + <xs:restriction base="xs:string"> + <xs:maxLength value="128" /> + </xs:restriction> + </xs:simpleType> + </xs:element> + <xs:element name="MA_DESCR" msprop:Generator_UserColumnName="MA_DESCR" msprop:Generator_ColumnVarNameInTable="columnMA_DESCR" msprop:Generator_ColumnPropNameInRow="MA_DESCR" msprop:Generator_ColumnPropNameInTable="MA_DESCRColumn" minOccurs="0"> + <xs:simpleType> + <xs:restriction base="xs:string"> + <xs:maxLength value="240" /> + </xs:restriction> + </xs:simpleType> + </xs:element> + <xs:element name="MA_INDEX" msprop:Generator_UserColumnName="MA_INDEX" msprop:Generator_ColumnVarNameInTable="columnMA_INDEX" msprop:Generator_ColumnPropNameInRow="MA_INDEX" msprop:Generator_ColumnPropNameInTable="MA_INDEXColumn" type="xs:int" minOccurs="0" /> + </xs:sequence> + </xs:complexType> + </xs:element> + <xs:element name="PARAMETERNAMES" msprop:Generator_UserTableName="PARAMETERNAMES" msprop:Generator_RowDeletedName="PARAMETERNAMESRowDeleted" msprop:Generator_RowChangedName="PARAMETERNAMESRowChanged" msprop:Generator_RowClassName="PARAMETERNAMESRow" msprop:Generator_RowChangingName="PARAMETERNAMESRowChanging" msprop:Generator_RowEvArgName="PARAMETERNAMESRowChangeEvent" msprop:Generator_RowEvHandlerName="PARAMETERNAMESRowChangeEventHandler" msprop:Generator_TableClassName="PARAMETERNAMESDataTable" msprop:Generator_TableVarName="tablePARAMETERNAMES" msprop:Generator_RowDeletingName="PARAMETERNAMESRowDeleting" msprop:Generator_TablePropName="PARAMETERNAMES"> + <xs:complexType> + <xs:sequence> + <xs:element name="PN_NR" msdata:ReadOnly="true" msdata:AutoIncrement="true" msdata:AutoIncrementSeed="-1" msdata:AutoIncrementStep="-1" msprop:Generator_UserColumnName="PN_NR" msprop:Generator_ColumnVarNameInTable="columnPN_NR" msprop:Generator_ColumnPropNameInRow="PN_NR" msprop:Generator_ColumnPropNameInTable="PN_NRColumn" type="xs:int" /> + <xs:element name="PN_NAME" msprop:Generator_UserColumnName="PN_NAME" msprop:Generator_ColumnVarNameInTable="columnPN_NAME" msprop:Generator_ColumnPropNameInRow="PN_NAME" msprop:Generator_ColumnPropNameInTable="PN_NAMEColumn" minOccurs="0"> + <xs:simpleType> + <xs:restriction base="xs:string"> + <xs:maxLength value="64" /> + </xs:restriction> + </xs:simpleType> + </xs:element> + </xs:sequence> + </xs:complexType> + </xs:element> + <xs:element name="PARAMETERVALUES" msprop:Generator_UserTableName="PARAMETERVALUES" msprop:Generator_RowDeletedName="PARAMETERVALUESRowDeleted" msprop:Generator_RowChangedName="PARAMETERVALUESRowChanged" msprop:Generator_RowClassName="PARAMETERVALUESRow" msprop:Generator_RowChangingName="PARAMETERVALUESRowChanging" msprop:Generator_RowEvArgName="PARAMETERVALUESRowChangeEvent" msprop:Generator_RowEvHandlerName="PARAMETERVALUESRowChangeEventHandler" msprop:Generator_TableClassName="PARAMETERVALUESDataTable" msprop:Generator_TableVarName="tablePARAMETERVALUES" msprop:Generator_RowDeletingName="PARAMETERVALUESRowDeleting" msprop:Generator_TablePropName="PARAMETERVALUES"> + <xs:complexType> + <xs:sequence> + <xs:element name="PV_NR" msdata:ReadOnly="true" msdata:AutoIncrement="true" msdata:AutoIncrementSeed="-1" msdata:AutoIncrementStep="-1" msprop:Generator_UserColumnName="PV_NR" msprop:Generator_ColumnVarNameInTable="columnPV_NR" msprop:Generator_ColumnPropNameInRow="PV_NR" msprop:Generator_ColumnPropNameInTable="PV_NRColumn" type="xs:int" /> + <xs:element name="MA_NR" msprop:Generator_UserColumnName="MA_NR" msprop:Generator_ColumnVarNameInTable="columnMA_NR" msprop:Generator_ColumnPropNameInRow="MA_NR" msprop:Generator_ColumnPropNameInTable="MA_NRColumn" type="xs:int" minOccurs="0" /> + <xs:element name="PN_NR" msprop:Generator_UserColumnName="PN_NR" msprop:Generator_ColumnVarNameInTable="columnPN_NR" msprop:Generator_ColumnPropNameInRow="PN_NR" msprop:Generator_ColumnPropNameInTable="PN_NRColumn" type="xs:int" minOccurs="0" /> + <xs:element name="PV_VALUE" msprop:Generator_UserColumnName="PV_VALUE" msprop:Generator_ColumnVarNameInTable="columnPV_VALUE" msprop:Generator_ColumnPropNameInRow="PV_VALUE" msprop:Generator_ColumnPropNameInTable="PV_VALUEColumn" type="xs:double" minOccurs="0" /> + </xs:sequence> + </xs:complexType> + </xs:element> + </xs:choice> + </xs:complexType> + <xs:unique name="Constraint1" msdata:PrimaryKey="true"> + <xs:selector xpath=".//mstns:ODGEOMETRIES" /> + <xs:field xpath="mstns:OD_NR" /> + </xs:unique> + <xs:unique name="ODGEOLAYERS_Constraint1" msdata:ConstraintName="Constraint1" msdata:PrimaryKey="true"> + <xs:selector xpath=".//mstns:ODGEOLAYERS" /> + <xs:field xpath="mstns:OL_NR" /> + </xs:unique> + <xs:unique name="MATERIALS_Constraint1" msdata:ConstraintName="Constraint1" msdata:PrimaryKey="true"> + <xs:selector xpath=".//mstns:MATERIALS" /> + <xs:field xpath="mstns:MA_NR" /> + </xs:unique> + <xs:unique name="PARAMETERNAMES_Constraint1" msdata:ConstraintName="Constraint1" msdata:PrimaryKey="true"> + <xs:selector xpath=".//mstns:PARAMETERNAMES" /> + <xs:field xpath="mstns:PN_NR" /> + </xs:unique> + <xs:unique name="PARAMETERVALUES_Constraint1" msdata:ConstraintName="Constraint1" msdata:PrimaryKey="true"> + <xs:selector xpath=".//mstns:PARAMETERVALUES" /> + <xs:field xpath="mstns:PV_NR" /> + </xs:unique> + </xs:element> + <xs:annotation> + <xs:appinfo> + <msdata:Relationship name="ODGEOMETRIES_ODGEOLAYERS" msdata:parent="ODGEOMETRIES" msdata:child="ODGEOLAYERS" msdata:parentkey="OD_NR" msdata:childkey="OD_NR" msprop:Generator_UserRelationName="ODGEOMETRIES_ODGEOLAYERS" msprop:Generator_RelationVarName="relationODGEOMETRIES_ODGEOLAYERS" msprop:Generator_UserChildTable="ODGEOLAYERS" msprop:Generator_UserParentTable="ODGEOMETRIES" msprop:Generator_ParentPropName="ODGEOMETRIESRow" msprop:Generator_ChildPropName="GetODGEOLAYERSRows" /> + <msdata:Relationship name="ODGEOLAYERS_MATERIALS" msdata:parent="MATERIALS" msdata:child="ODGEOLAYERS" msdata:parentkey="MA_NR" msdata:childkey="MA_NR" msprop:Generator_UserRelationName="ODGEOLAYERS_MATERIALS" msprop:Generator_RelationVarName="relationODGEOLAYERS_MATERIALS" msprop:Generator_UserChildTable="ODGEOLAYERS" msprop:Generator_UserParentTable="MATERIALS" msprop:Generator_ParentPropName="MATERIALSRow" msprop:Generator_ChildPropName="GetODGEOLAYERSRows" /> + <msdata:Relationship name="PARAMETERVALUES_MATERIALS" msdata:parent="MATERIALS" msdata:child="PARAMETERVALUES" msdata:parentkey="MA_NR" msdata:childkey="MA_NR" msprop:Generator_UserRelationName="PARAMETERVALUES_MATERIALS" msprop:Generator_RelationVarName="relationPARAMETERVALUES_MATERIALS" msprop:Generator_UserChildTable="PARAMETERVALUES" msprop:Generator_UserParentTable="MATERIALS" msprop:Generator_ParentPropName="MATERIALSRow" msprop:Generator_ChildPropName="GetPARAMETERVALUESRows" /> + <msdata:Relationship name="PARAMETERNAMES_PARAMETERVALUES" msdata:parent="PARAMETERNAMES" msdata:child="PARAMETERVALUES" msdata:parentkey="PN_NR" msdata:childkey="PN_NR" msprop:Generator_UserRelationName="PARAMETERNAMES_PARAMETERVALUES" msprop:Generator_RelationVarName="relationPARAMETERNAMES_PARAMETERVALUES" msprop:Generator_UserChildTable="PARAMETERVALUES" msprop:Generator_UserParentTable="PARAMETERNAMES" msprop:Generator_ParentPropName="PARAMETERNAMESRow" msprop:Generator_ChildPropName="GetPARAMETERVALUESRows" /> + </xs:appinfo> + </xs:annotation> +</xs:schema> \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/Test/Services/ShapeFileCreatorTest.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/Test/Services/ShapeFileCreatorTest.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/Test/Services/ShapeFileCreatorTest.cs (revision 3305) @@ -0,0 +1,231 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of the application DAM - UI. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. +// +// 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.IO; +using System.Linq; +using System.Threading; + +using NUnit.Framework; + +namespace Deltares.Maps.Tests.Services +{ + [TestFixture] + public class ShapeFileCreatorTest + { + const string OutputFolder = "ShapeFileTestFiles"; + + private FeatureRepository repository; + private string fileName; + private string shpFile; + private string dbfFile; + private string shxFile; + private string shpFilePath; + private string shxFilePath; + private string dbfFilePath; + + #region Setup + + [TestFixtureSetUp] + public void FixtureSetup() + { + if (Directory.Exists(OutputFolder)) + { + //Directory.Delete(OutputFolder, true); // TODO: Disabled to prevent files from being deleted in test data dir (although copied there for other tests) + } + + Directory.CreateDirectory(OutputFolder); + } + + [TestFixtureTearDown] + public void FixtureTearDown() + { + } + + [SetUp] + public void TestSetup() + { + fileName = "TestFile_" + Guid.NewGuid().ToString().Replace("-", "_"); + shpFile = fileName + ".shp"; + dbfFile = fileName + ".dbf"; + shxFile = fileName + ".shx"; + + shpFilePath = Path.Combine(OutputFolder, shpFile); + shxFilePath = Path.Combine(OutputFolder, shxFile); + dbfFilePath = Path.Combine(OutputFolder, dbfFile); + + if (File.Exists(shpFilePath)) + { + File.Delete(shpFilePath); + } + if (File.Exists(shxFilePath)) + { + File.Delete(shxFilePath); + } + if (File.Exists(dbfFilePath)) + { + File.Delete(dbfFilePath); + } + + repository = new FeatureRepository(); + } + + [TearDown] + public void TestTearDown() + { + if (File.Exists(shpFilePath)) + { + File.Delete(shpFilePath); + } + if (File.Exists(shxFilePath)) + { + File.Delete(shxFilePath); + } + if (File.Exists(dbfFilePath)) + { + // disposing the dbf file could take longer + for (int i = 0; i < 3; i++) + { + try + { + File.Delete(dbfFilePath); + } + catch (IOException) + { + Thread.Sleep(200); + } + } + } + } + + #endregion + + [Test] + [ExpectedException(typeof(ArgumentException))] + public void CreateFile_ValidPathAndNoFeatures_Throws() + { + ShapeFileCreator.Create(@"", fileName, repository); + } + + [Test] + [ExpectedException(typeof(ArgumentNullException))] + public void CreateFile_InvalidName_Throws() + { + ShapeFileCreator.Create(@"", "", repository); + } + + [Test] + [Ignore("Need to fix shape file writing")] + [ExpectedException(typeof(NotSupportedException), + ExpectedMessage = "The repository contains geometry types which are currently not supported")] + public void CreateFile_RepositoryContainsNotSupportedFeature_Throws() + { + repository.Add(Feature.Create("POLYGON (( 10 10, 10 20, 20 20, 20 15, 10 10))")); + ShapeFileCreator.Create(@"", fileName, repository); + } + + [Test] + [Ignore("Need to fix shape file writing")] + [ExpectedException(typeof(NotSupportedException), + ExpectedMessage = + "The repository contains different geometry types. Currently only one type per repository is supported ")] + public void CreateFile_RepositoryContainsDifferentGeometryTypes_Throws() + { + repository.Add(Feature.Create("LINESTRING EMPTY")); + repository.Add(Feature.Create("POINT(0 0)")); + ShapeFileCreator.Create(@"", fileName, repository); + } + + [Test] + [Ignore("Need to fix shape file writing")] + public void CreateFile_ValidPathAndRepositoryContainsOneLineString_ShapeFileIsCreated() + { + repository.Add(Feature.Create("LINESTRING (10 10, 10 20)")); + ShapeFileCreator.Create(OutputFolder, fileName, repository); + + AssertThatMandatoryFilesExist(); + + var shapeFile = new ShapeFileLocation(shpFilePath); + IFeatureRepository retrievedRepository = FeatureRepository.CreateFromShapeFile(shapeFile); + Assert.IsNotNull(retrievedRepository); + Assert.IsTrue(retrievedRepository.Count == 1); + Assert.AreEqual("LineString", repository.Features.ElementAt(0).Geometry.GeometryType); + } + + [Test] + [Ignore("Need to fix shape file writing")] + public void CreateFile_ValidPathAndRepositoryContainsOneLineStringAndOneMultiLineString_ShapeFileIsCreated() + { + repository.Add(Feature.Create("LINESTRING (10 10, 10 20)")); + repository.Add(Feature.Create("MULTILINESTRING ((10 10, 20 20, 10 40),(40 40, 30 30, 40 20, 30 10))")); + ShapeFileCreator.Create(OutputFolder, fileName, repository); + + AssertThatMandatoryFilesExist(); + + var shapeFile = new ShapeFileLocation(shpFilePath); + IFeatureRepository retrievedRepository = FeatureRepository.CreateFromShapeFile(shapeFile); + Assert.IsNotNull(retrievedRepository); + Assert.IsTrue(retrievedRepository.Count == 2); + Assert.IsTrue(repository.Features.Any(f => f.Geometry.GeometryType == "LineString")); + Assert.IsTrue(repository.Features.Any(f => f.Geometry.GeometryType == "MultiLineString")); + } + + [Test] + [Ignore("Need to fix shape file writing")] + public void CreateFile_ValidPathAndRepositoryContainsOnePoint_ShapeFileIsCreated() + { + repository.Add(Feature.Create("POINT(0 0)")); + ShapeFileCreator.Create(OutputFolder, fileName, repository); + + AssertThatMandatoryFilesExist(); + + var shapeFile = new ShapeFileLocation(shpFilePath); + IFeatureRepository retrievedRepository = FeatureRepository.CreateFromShapeFile(shapeFile); + Assert.IsNotNull(retrievedRepository); + Assert.IsTrue(retrievedRepository.Count == 1); + Assert.AreEqual("GeometryPoint", repository.Features.ElementAt(0).Geometry.GeometryType); + } + + /* [Test] + public void CreateFile_ValidPathAndRepositoryContainsMultyPoint_ShapeFileIsCreated() + { + //repository.Add(Feature.Create("POINT(0 0)")); + repository.Add(Feature.Create("MULTIPOINT (10 40, 40 30, 20 20, 30 10)")); + ShapeFileCreator.Create(OutputFolder, fileName, repository); + + AssertThatMandatoryFilesExist(); + + var shapeFile = new ShapeFile(this.shpFilePath); + var retrievedRepository = FeatureRepository.CreateFromShapeFile(shapeFile); + Assert.IsNotNull(retrievedRepository); + Assert.IsTrue(retrievedRepository.Count == 2); + Assert.IsTrue(repository.Features.Any(f => f.Geometry.GeometryType == GeometryType2.MultiPoint)); + Assert.IsTrue(repository.Features.Any(f => f.Geometry.GeometryType == GeometryType2.GeometryPoint)); + }*/ + + private void AssertThatMandatoryFilesExist() + { + Assert.IsTrue(File.Exists(shpFilePath), string.Format("{0} does not exist", shpFile)); + Assert.IsTrue(File.Exists(dbfFilePath), string.Format("{0} does not exist", dbfFile)); + Assert.IsTrue(File.Exists(shxFilePath), string.Format("{0} does not exist", shxFile)); + } + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Xsd/ProfileDefinition.xsd =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Xsd/ProfileDefinition.xsd (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Xsd/ProfileDefinition.xsd (revision 3305) @@ -0,0 +1,58 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +Copyright (C) Stichting Deltares 2019. All rights reserved. + +This file is part of the DAM - Clients Library. + +The DAM - UI is free software: you can redistribute it and/or modify +it under the terms of the GNU 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 General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see <http://www.gnu.org/licenses/>. + +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. +--> + +<!-- Created with Liquid XML Studio 1.0.8.0 (http://www.liquid-technologies.com) --> +<xsd:schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsd="http://www.w3.org/2001/XMLSchema" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://deltares.nl/2008/ProfileDefinition"> + <xs:complexType name="Profile"> + <xs:sequence> + <xs:element minOccurs="0" name="Layers"> + <xs:complexType> + <xs:sequence> + <xs:element minOccurs="0" maxOccurs="unbounded" name="Layer"> + <xs:complexType> + <xs:attribute name="ID" type="xs:ID" use="required" /> + <xs:attribute name="SoilID" type="xs:string" use="required" /> + <xs:attribute name="TopLevel" type="xs:double" use="required" /> + <xs:attribute default="0" name="ExcessPorePressureAtTop" type="xs:double" use="optional" /> + <xs:attribute default="0" name="ExcessPorePressureAtBottom" type="xs:double" use="optional" /> + <xs:attribute default="1" name="OCRValue" type="xs:double" use="optional" /> + <xs:attribute name="PlAtTop" type="xs:integer" /> + <xs:attribute name="PlAtBottom" type="xs:integer" /> + </xs:complexType> + </xs:element> + </xs:sequence> + </xs:complexType> + </xs:element> + </xs:sequence> + <xs:attribute name="Name" type="xs:string" use="required" /> + <xs:attribute name="InBetweenSandLayerID" type="xs:string" use="optional" /> + <xs:attribute name="InfiltrationLayerID" type="xs:string" use="optional" /> + <xs:attribute name="BottomSandLayerID" type="xs:string" use="optional" /> + <xs:attribute name="XCoordinate" type="xs:double" use="optional" /> + <xs:attribute name="YCoordinate" type="xs:double" use="optional" /> + <xs:attribute name="PhreaticLevel" type="xs:double" use="optional" /> + <xs:attribute name="HasPhreaticLevel" type="xs:boolean" /> + <xs:attribute name="BottomLevel" type="xs:double" /> + </xs:complexType> +</xsd:schema> \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Importers/CsvColumnNames.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Importers/CsvColumnNames.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Importers/CsvColumnNames.cs (revision 3305) @@ -0,0 +1,385 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +namespace Deltares.Dam.Data.Importers +{ + /// <summary> + /// Defines column name definitions used for importing csv data + /// </summary> + /// <remarks> + /// Some of the definitions are used (referenced) in the LocationPropertyImporter. + /// Changing the definitions will affect the location importers using shapefiles as well!! + /// </remarks> + public static class CsvColumnNames + { + /// <summary> + /// location_id + /// </summary> + public const string LocationColumnName = "location_id"; + + /// <summary> + /// location_scenario_id + /// </summary> + public const string LocationScenarioColumnName = "location_scenario_id"; + + /// <summary> + /// dikering_id + /// </summary> + public const string DikeRingColumnName = "dikering_id"; + + /// <summary> + /// surfaceline_id + /// </summary> + public const string SurfaceLineColumnName = "surfaceline_id"; + + /// <summary> + /// geo_x + /// </summary> + public const string XValueColumnName = "geo_x"; + + /// <summary> + /// geo_y + /// </summary> + public const string YValueColumnName = "geo_y"; + + /// <summary> + /// segment_id + /// </summary> + public const string SegmentColumnName = "segment_id"; + + /// <summary> + /// polderlevel + /// </summary> + public const string PolderLevelColumnName = "polderlevel"; + + /// <summary> + /// head_pl2 + /// </summary> + public const string HeadPl2ColumnName = "head_pl2"; + + /// <summary> + /// head_pl3 + /// </summary> + public const string HeadPl3ColumnName = "head_pl3"; + + /// <summary> + /// head_pl4 + /// </summary> + public const string HeadPl4ColumnName = "head_pl4"; + + /// <summary> + /// head_pl3 + /// </summary> + public const string HeadPl3OldFormatColumnName = "HeadPl3"; + + /// <summary> + /// head_pl4 + /// </summary> + public const string HeadPl4OldFormatColumnName = "HeadPl4"; + + /// <summary> + /// x_soilgeometry2D_origin + /// </summary> + public const string XSoilGeometry2DOriginColumnName = "x_soilgeometry2D_origin"; + + /// <summary> + /// ophoogmateriaaldijk + /// </summary> + public const string DikeEmbankmentMaterialColumnName = "ophoogmateriaaldijk"; + + /// <summary> + /// ophoogmateriaalberm + /// </summary> + public const string ShoulderEmbankmentMaterialColumnName = "ophoogmateriaalberm"; + + /// <summary> + /// dempingsfactor_pl3 + /// </summary> + public const string DampingFactorPl3ColumnName = "dempingsfactor_pl3"; + + /// <summary> + /// dempingsfactor_pl4 + /// </summary> + public const string DampingFactorPl4ColumnName = "dempingsfactor_pl4"; + + /// <summary> + /// PenetrationLength + /// </summary> + public const string PenetrationLengthColumnName = "PenetrationLength"; + + /// <summary> + /// TrafficLoad + /// </summary> + public const string TrafficLoadColumnName = "TrafficLoad"; + + /// <summary> + /// TL_DegreeOfConsolidation + /// </summary> + public const string TlDegreeOfConsolidationColumnName = "TL_DegreeOfConsolidation"; + + /// <summary> + /// PLLineCreationMethod + /// </summary> + public const string PlLineCreationMethodColumnName = "PLLineCreationMethod"; + + /// <summary> + /// PlLineOffsetBelowDikeTopAtRiver + /// </summary> + public const string PlLineOffsetBelowDikeTopAtRiverColumnName = "PlLineOffsetBelowDikeTopAtRiver"; + + /// <summary> + /// PlLineOffsetBelowDikeTopAtPolder + /// </summary> + public const string PlLineOffsetBelowDikeTopAtPolderColumnName = "PlLineOffsetBelowDikeTopAtPolder"; + + /// <summary> + /// PlLineOffsetBelowShoulderBaseInside + /// </summary> + public const string PlLineOffsetBelowShoulderBaseInsideColumnName = "PlLineOffsetBelowShoulderBaseInside"; + + /// <summary> + /// PlLineOffsetBelowDikeToeAtPolder + /// </summary> + public const string PlLineOffsetBelowDikeToeAtPolderColumnName = "PlLineOffsetBelowDikeToeAtPolder"; + + /// <summary> + /// The pl line offset below dike crest middle + /// </summary> + public const string PlLineOffsetBelowDikeCrestMiddleColumnName = "PLLineOffsetBelowDikeCrestMiddle"; + + /// <summary> + /// The pl line offset factor below shoulder crest + /// </summary> + public const string PlLineOffsetFactorBelowShoulderCrestColumnName = "PLLineOffsetFactorBelowShoulderCrest"; + + /// <summary> + /// Use the pl line offset below dike crest middle + /// </summary> + public const string UsePlLineOffsetBelowDikeCrestMiddleColumnName = "UsePLLineOffsetBelowDikeCrestMiddle"; + + /// <summary> + /// Use the pl line offset factor below shoulder crest + /// </summary> + public const string UsePlLineOffsetFactorBelowShoulderCrestColumnName = "UsePLLineOffsetFactorBelowShoulderCrest"; + + /// <summary> + /// The intrusion vertical water pressure + /// </summary> + public const string IntrusionVerticalWaterPressureColumnName = "IntrusionVerticalWaterPressure"; + + /// <summary> + /// StabilityShoulderGrowSlope + /// </summary> + public const string StabilityShoulderGrowSlopeColumnName = "StabilityShoulderGrowSlope"; + + /// <summary> + /// StabilityShoulderGrowDeltaX + /// </summary> + public const string StabilityShoulderGrowDeltaXColumnName = "StabilityShoulderGrowDeltaX"; + + /// <summary> + /// StabilitySlopeAdaptionDeltaX + /// </summary> + public const string StabilitySlopeAdaptionDeltaXColumnName = "StabilitySlopeAdaptionDeltaX"; + + /// <summary> + /// minimal_circle_depth + /// </summary> + public const string MinimalCircleDepthColumnName = "minimal_circle_depth"; + + /// <summary> + /// distance_to_entry_point + /// </summary> + public const string DistanceToEntryPointColumnName = "distance_to_entry_point"; + + /// <summary> + /// Stability Design Method + /// </summary> + public const string StabilityDesignMethodColumnName = "StabilityDesignMethod"; + + /// <summary> + /// Start value (cotangent) for slope adaption by angle + /// </summary> + public const string SlopeAdaptionStartCotangentColumnName = "SlopeAdaptionStartCotangent"; + + /// <summary> + /// End value (cotangent) for slope adaption by angle + /// </summary> + public const string SlopeAdaptionEndCotangentColumnName = "SlopeAdaptionEndCotangent"; + + /// <summary> + /// Step size (cotangent) for slope adaption by angle + /// </summary> + public const string SlopeAdaptionStepCotangentColumnName = "SlopeAdaptionStepCotangent"; + + /// <summary> + /// Slope damping piezometric height polderside + /// </summary> + public const string SlopeDampingPiezometricHeightPolderSideColumnName = "SlopeDampingPiezometricHeightPolderSide"; + + /// <summary> + /// safety_factor_stability_inner_slope + /// </summary> + public const string RequiredSafetyFactorStabilityInnerSlopeColumnName = ModelFactorCsvIdentifiers.SafetyFactorStabilityInnerslope; + + /// <summary> + /// safety_factor_stability_outer_slope + /// </summary> + public const string RequiredSafetyFactorStabilityOuterSlopeColumnName = ModelFactorCsvIdentifiers.SafetyFactorStabilityOuterslope; + + /// <summary> + /// safety_factor_piping + /// </summary> + public const string RequiredSafetyFactorPipingColumnName = ModelFactorCsvIdentifiers.SafetyFactorPiping; + + /// <summary> + /// uplift_criterion_piping + /// </summary> + public const string UpliftCriterionPipingColumnName = ModelFactorCsvIdentifiers.UpliftCriterionPiping; + + /// <summary> + /// uplift_criterion_stability + /// </summary> + public const string UpliftCriterionStabilityColumnName = ModelFactorCsvIdentifiers.UpliftCriterionStability; + + + /// <summary> + /// Zone type + /// </summary> + public const string ZoneTypeColumnName = "ZoneType"; + + /// <summary> + /// ForbiddenZoneFactor + /// </summary> + public const string ForbiddenZoneFactorColumnName = "ForbiddenZoneFactor"; + + /// <summary> + /// ZoneAreaRestSlopeCrestWidth + /// </summary> + public const string ZoneAreaRestSlopeCrestWidthColumnName = "ZoneAreaRestSlopeCrestWidth"; + + /// <summary> + /// NewDikeTopWidth + /// </summary> + public const string NewDikeTopWidthColumnName = "NewDikeTopWidth"; + + /// <summary> + /// UseNewDikeTopWidth + /// </summary> + public const string UseNewDikeTopWidthColumnName = "UseNewDikeTopWidth"; + + /// <summary> + /// NewDikeSlopeInside + /// </summary> + public const string NewDikeSlopeInsideColumnName = "NewDikeSlopeInside"; + + /// <summary> + /// UseNewDikeSlopeInside + /// </summary> + public const string UseNewDikeSlopeInsideColumnName = "UseNewDikeSlopeInside"; + + /// <summary> + /// NewDikeSlopeOutside + /// </summary> + public const string NewDikeSlopeOutsideColumnName = "NewDikeSlopeOutside"; + + /// <summary> + /// UseNewDikeSlopeOutside + /// </summary> + public const string UseNewDikeSlopeOutsideColumnName = "UseNewDikeSlopeOutside"; + + /// <summary> + /// NewShoulderTopSlope + /// </summary> + public const string NewShoulderTopSlopeColumnName = "NewShoulderTopSlope"; + + /// <summary> + /// UseNewShoulderTopSlope + /// </summary> + public const string UseNewShoulderTopSlopeColumnName = "UseNewShoulderTopSlope"; + + /// <summary> + /// NewShoulderBaseSlope + /// </summary> + public const string NewShoulderBaseSlopeColumnName = "NewShoulderBaseSlope"; + + /// <summary> + /// UseNewShoulderBaseSlope + /// </summary> + public const string UseNewShoulderBaseSlopeColumnName = "UseNewShoulderBaseSlope"; + + /// <summary> + /// NewMaxHeightShoulderAsFraction + /// </summary> + public const string NewMaxHeightShoulderAsFractionColumnName = "NewMaxHeightShoulderAsFraction"; + + /// <summary> + /// UseNewMaxHeightShoulderAsFraction + /// </summary> + public const string UseNewMaxHeightShoulderAsFractionColumnName = "UseNewMaxHeightShoulderAsFraction"; + + /// <summary> + /// NewMinDistanceDikeToeStartDitch + /// </summary> + public const string NewMinDistanceDikeToeStartDitchColumnName = "NewMinDistanceDikeToeStartDitch"; + + /// <summary> + /// UseNewMinDistanceDikeToeStartDitch + /// </summary> + public const string UseNewMinDistanceDikeToeStartDitchColumnName = "UseNewMinDistanceDikeToeStartDitch"; + + /// <summary> + /// UseNewDitchDefinition + /// </summary> + public const string UseNewDitchDefinitionColumnName = "UseNewDitchDefinition"; + + /// <summary> + /// NewWidthDitchBottom + /// </summary> + public const string NewWidthDitchBottomColumnName = "NewWidthDitchBottom"; + + /// <summary> + /// newSlopeAngleDitch + /// </summary> + public const string NewSlopeAngleDitchColumnName = "newSlopeAngleDitch"; + + /// <summary> + /// NewDepthDitch + /// </summary> + public const string NewDepthDitchColumnName = "NewDepthDitch"; + + /// <summary> + /// DikeTableHeight + /// </summary> + public const string DikeTableHeightColumnName = "dike_table_height"; + + /// <summary> + /// water_height + /// </summary> + public const string RiverLevelColumnName = "water_height"; + + /// <summary> + /// water_height_low + /// </summary> + public const string RiverLevelLowColumnName = "water_height_low"; + + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DamGlobalConstants.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DamGlobalConstants.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DamGlobalConstants.cs (revision 3305) @@ -0,0 +1,30 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +namespace Deltares.Dam.Data +{ + public static class DamGlobalConstants + { + public const double NoRunValue = 99; + public const double PlLineOffsetFactorBelowShoulderCrestMinValue = 0.0; + public const double PlLineOffsetFactorBelowShoulderCrestMaxValue = 1.0; + } +} Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/IFeature.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/IFeature.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/IFeature.cs (revision 3305) @@ -0,0 +1,37 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. +// +// 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 GeoAPI.Geometries; + +using NetTopologySuite.Features; + +namespace Deltares.Maps +{ + public interface IFeature + { + Guid Id { get; } + string WktFormat { get; } + IGeometry Geometry { get; } + IAttributesTable Attributes { get; } + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Specifications/PredicateSpecification.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Specifications/PredicateSpecification.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Specifications/PredicateSpecification.cs (revision 3305) @@ -0,0 +1,55 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. +// +// 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.Dam.Data; + +namespace Deltares.Standard.Specifications +{ + public class PredicateSpecification<T> : CompositeSpecification<T> + { + private readonly Predicate<T> predicate; + + public PredicateSpecification(Predicate<T> predicate) + { + if (predicate == default(Predicate<T>)) + throw new ArgumentNullException("predicate"); + + this.predicate = predicate; + } + + #region ISpecification<T> Members + + /// <summary> + /// Determines whether the candidate satisfies the specification. + /// </summary> + /// <param name="candidate">The candidate.</param> + /// <returns> + /// <c>true</c> if the candidate satisfies the specification otherwise, <c>false</c>. + /// </returns> + public override bool IsSatisfiedBy(T candidate) + { + return this.predicate(candidate); + } + + #endregion + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/WaterBoardJob.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/WaterBoardJob.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/WaterBoardJob.cs (revision 3305) @@ -0,0 +1,46 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +namespace Deltares.Dam.Data +{ + public class WaterBoardJob : CompositeJob + { + public WaterBoardJob() + { + } + public WaterBoardJob(object subject): base(subject) + { + } + + public bool AreAllDikeLocationsWaterLevelTimeSeriesAssigned() + { + bool areAssigned = true; + foreach (DamJob damJob in Jobs) + { + if (damJob.GetType() == typeof(DikeJob)) + { + areAssigned = areAssigned && (((DikeJob)damJob).AreAllLocationWaterLevelTimeSeriesAssigned()); + } + } + return areAssigned; + } + } +} Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Assemblers/DamMStabAssembler.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Assemblers/DamMStabAssembler.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Assemblers/DamMStabAssembler.cs (revision 3305) @@ -0,0 +1,684 @@ +//----------------------------------------------------------------------- +// <copyright file="DamMStabAssembler.cs" company="Deltares"> +// Copyright (c) 2010 Deltares. All rights reserved. +// </copyright> +// <author>B.S.T.I.M. The</author> +// <email>tom.the@deltares.nl</email> +// <date>18-05-2010</date> +// <summary>xml file creator for DGSMStabDam.dll</summary> +//----------------------------------------------------------------------- +using Deltares.Geometry; +using Deltares.Geotechnics.Soils; +using Deltares.Geotechnics.SurfaceLines; +using Deltares.Standard.IO.DtoAssembler; + +namespace Deltares.Dam.Data.Assemblers +{ + using System; + using System.IO; + using System.Linq; + using System.Reflection; + using System.Xml; + using System.Xml.Linq; + using System.Xml.Schema; + using Deltares.Soilbase; + using Deltares.Standard; + using Deltares.Geotechnics; + using Standard.Extensions; + + /// <summary> + /// + /// </summary> + public class DamMStabAssembler : + DtoDocumentAssembler<FailureMechanismeParamatersMStab, FailureMechanismeParamatersMStab> + { + #region Constant declarations + + /// <summary> + /// Holds the common part of the path to the embedded resource + /// </summary> + private const string EmbeddedResourcePath = "Deltares.Dam.Data.Xsd"; + + public const string XmlAttributeBottomLevel = "BottomLevel"; + public const string XmlAttributeBoundaryLayer = "BoundaryLayer"; + public const string XmlAttributeHasPhreaticLevel = "HasPhreaticLevel"; + public const string XmlAttributeID = "ID"; + public const string XmlAttributeIsPhreatic = "IsPhreatic"; + + public const string XmlAttributeMStabFileName = "MStabFileName"; + public const string XmlAttributeName = "Name"; + public const string XmlAttributePhreaticLevel = "PhreaticLevel"; + public const string XmlAttributeSoilDBName = "SoilDBName"; + public const string XmlAttributeSoilID = "SoilID"; + public const string XmlAttributeTopLevel = "TopLevel"; + public const string XmlAttributeXCoord = "XCoord"; + public const string XmlAttributeXCoordinate = "XCoordinate"; + public const string XmlAttributeYCoord = "YCoord"; + public const string XmlAttributeYCoordinate = "YCoordinate"; + public const string XmlAttributeCharacteristicPointType = "CharacteristicPointType"; + public const string XmlElementExternalPLLines = "ExternalPLLines"; + public const string XmlElementLayer = "Layer"; + public const string XmlElementLayers = "Layers"; + public const string XmlAttributeSoilType = "SoilType"; + public const string XmlAttributeInBetweenSandLayerID = "InBetweenSandLayerID"; + public const string XmlAttributeBottomSandLayerID = "BottomSandLayerID"; + public const string XmlAttributeInfiltrationLayerID = "InfiltrationLayerID"; + + /// <summary> + /// Holds the xml element name + /// </summary> + public const string XmlElementName = "DamMStabDoc"; + + public const string XmlElementNameInput = "DamMStabInput"; + + /// <summary> + /// Holds the xml namespace + /// </summary> + public const string XmlElementNamespace = "http://deltares.nl/2008/" + XmlSchemaName; + + public const string XmlElementNamespaceInput = "http://deltares.nl/2008/" + XmlSchemaNameInput; + public const string XmlElementPLLine = "PLLine"; + public const string XmlElementPLPoint = "PLPoint"; + public const string XmlElementProfile = "Profile"; + public const string XmlElementSurfaceLine = "SurfaceLine"; + public const string XmlElementSurfacePoint = "SurfacePoint"; + public const string XmlElementCharacteristicPoints = "CharacteristicPoints"; + public const string XmlElementCharacteristicPoint = "CharacteristicPoint"; + public const string XmlElementZoneAreas = "ZoneAreas"; + public const string XmlElementForbiddenZone = "ForbiddenZone"; + public const string XmlElementSheetPiling = "SheetPiling"; + public const string XmlElementHorizontalBalanceArea = "HorizontalBalanceArea"; + public const string XmlElementSlipCircleDefinition = "SlipCircleDefinition"; + + /// <summary> + /// Holds the model xml element and attribute names + /// </summary> + public const string XmlElementModel = "Model"; + + public const string XmlAttributeCalculationModel = "CalculationModel"; + public const string XmlAttributeShearStrength = "ShearStrength"; + public const string XmlAttributeProbabilistic = "Probabilistic"; + public const string XmlAttributeSearchMethod = "SearchMethod"; + public const string XmlAttributeGridPosition = "GridPosition"; + + /// <summary> + /// Holds the TrafficLoad xml element and attribute names + /// </summary> + public const string XmlElementTrafficLoad = "TrafficLoad"; + + public const string XmlAttributeXCoordinateAtRiver = "XCoordinateAtRiver"; + public const string XmlAttributeXCoordinateAtPolder = "XCoordinateAtPolder"; + public const string XmlAttributeLoad = "Load"; + + /// <summary> + /// Holds the CalculationOptions xml element and attribute names + /// </summary> + public const string XmlElementCalculationOptions = "CalculationOptions"; + + public const string XmlAttributeMinimalCircleDepth = "MinimalCircleDepth"; + public const string XmlAttributeZonesType = "ZonesType"; + + /// <summary> + /// Holds the GeometryCreationOptions xml element and attribute names + /// </summary> + public const string XmlElementGeometryCreationOptions = "GeometryCreationOptions"; + + public const string XmlAttributeSoilGeometryType = "SoilGeometryType"; + public const string XmlAttributeSoilGeometry2DFilename = "SoilGeometry2DFilename"; + public const string XmlAttributeXOffsetSoilGeometry2DOrigin = "XOffsetSoilGeometry2DOrigin"; + public const string XmlAttributeMaterialForDike = "MaterialForDike"; + public const string XmlAttributeMaterialForShoulder = "MaterialForShoulder"; + public const string XmlAttributeIsUseOriginalPLLineAssignments = "IsUseOriginalPLLineAssignments"; + public const string XmlAttributeIsUseOriginalCalculationOptions = "IsUseOriginalCalculationOptions"; + public const string XmlAttributeIsDrySituation = "IsDrySituation"; + public const string XmlAttributePLLineAssignment = "PLLineAssignment"; + public const string XmlAttributeIntrusionVerticalWaterPressure = "IntrusionVerticalWaterPressure"; + public const string XmlAttributePenetrationLength = "PenetrationLength"; + public const string XmlAttributeIsDesign = "IsDesign"; + + public const string XmlElementDesign = "Design"; + public const string XmlAttributeEmbankmentMaterialName = "EmbankmentMaterialName"; + public const string XmlAttributePreviousGeometry2DFilename = "PreviousGeometry2DFilename"; + /// <summary> + /// Holds the name of the xml schema + /// </summary> + private const string XmlSchemaName = "DamMStabDocDefinition"; + + private const string XmlSchemaNameInput = "DamMStabInputDefinition"; + + /// <summary> + /// Holds the xsd resource path + /// </summary> + public const string XsdEmbeddedResourcePath = EmbeddedResourcePath + "." + XmlSchemaName + ".xsd"; + + private const string XsdEmbeddedResourcePathInput = EmbeddedResourcePath + "." + XmlSchemaNameInput + ".xsd"; + + #endregion + + /// <summary> + /// + /// </summary> + public DamMStabAssembler() : + base(XmlElementName, XmlElementNamespace, XsdEmbeddedResourcePath) + { + } + + /// <summary> + /// + /// </summary> + /// <param name="failureMechanismeParamatersMStab"></param> + /// <returns></returns> + public override XDocument CreateDataTransferObject(FailureMechanismeParamatersMStab failureMechanismeParamatersMStab) + { + XDocument doc = base.CreateDataTransferObject(failureMechanismeParamatersMStab); + + XNamespace tns = ElementNamespace; + + Location location = failureMechanismeParamatersMStab.Location; + // Todo: Sheetpiling should be done correctly (SheetpilePointLevel vs SheetpileLength) + // For now: disable this + //if (location.SheetPileLength > 0.0) + //{ + // SheetPiling sheetPiling = new SheetPiling(); + // sheetPiling.Length = location.SheetPileLength; + // sheetPiling.XCoordinate = location.SheetPilePoint.X; + // sheetPiling.YCoordinate = location.SheetPilePoint.Y; + // sheetPiling.ZCoordinate = location.SheetPilePoint.Z; + // damFailureMechanismeCalculation.FailureMechanismeParamatersMStab.MStabParameters.SheetPiling = + // sheetPiling; + //} + + // DAMMStabInput + var inputElement = new XElement(tns + XmlElementNameInput); + doc.Root.Add(inputElement); + + XNamespace tnsb = XmlElementNamespaceInput; + doc.Root.Add(new XAttribute(XNamespace.Xmlns + "tnsb", tnsb.NamespaceName)); + + // Soil database + inputElement.Add(new XAttribute(XmlAttributeMStabFileName,failureMechanismeParamatersMStab.MStabParameters.ProjectFileName)); + inputElement.Add(new XAttribute(XmlAttributeSoilDBName, failureMechanismeParamatersMStab.MStabParameters.SoilDatabaseName)); + + // Surface line + XElement surfaceLineElement = GetSurfaceLineElement(failureMechanismeParamatersMStab, tnsb); + inputElement.Add(surfaceLineElement); + + // Surface line + XElement characteristicPointsElement = GetCharacteristicPointsElement(failureMechanismeParamatersMStab, tnsb); + inputElement.Add(characteristicPointsElement); + + // External PL lines + XElement externalPLLinesElement = GetExternalPlLinesElement(failureMechanismeParamatersMStab, tnsb); + inputElement.Add(externalPLLinesElement); + + // Model + XElement modelElement = GetModelElement(failureMechanismeParamatersMStab, tnsb); + inputElement.Add(modelElement); + + // Zone Area + if (failureMechanismeParamatersMStab.MStabParameters.ZoneAreas != null) + { + XElement zoneAreasElement = GetZoneAreasElement(failureMechanismeParamatersMStab.MStabParameters.ZoneAreas, tnsb); + inputElement.Add(zoneAreasElement); + } + + // Forbidden zone + if (failureMechanismeParamatersMStab.MStabParameters.ForbiddenZone != null) + { + XElement forbiddenZoneElement = + GetForbiddenZoneElement(failureMechanismeParamatersMStab.MStabParameters.ForbiddenZone, tnsb); + inputElement.Add(forbiddenZoneElement); + } + + // Traffic load + if ( + failureMechanismeParamatersMStab.SurfaceLine.HasAnnotation(CharacteristicPointType.TrafficLoadInside) && + failureMechanismeParamatersMStab.SurfaceLine.HasAnnotation(CharacteristicPointType.TrafficLoadOutside)) + { + XElement trafficLoadElement = GetTrafficLoadElement(failureMechanismeParamatersMStab, tnsb); + inputElement.Add(trafficLoadElement); + } + + // Calculation Options + if (failureMechanismeParamatersMStab.MStabParameters.CalculationOptions != + null) + { + XElement calculationOptionsElement = GetCalculationOptionsElement(failureMechanismeParamatersMStab, tnsb); + inputElement.Add(calculationOptionsElement); + } + + // GeometryCreationOptions Options + if (failureMechanismeParamatersMStab.MStabParameters.GeometryCreationOptions != null) + { + XElement geometryCreationOptionsElement = GetGeometryCreationOptionsElement(failureMechanismeParamatersMStab, tnsb); + inputElement.Add(geometryCreationOptionsElement); + } + + // SheetPiling + if (failureMechanismeParamatersMStab.MStabParameters.SheetPiling != null) + { + XElement sheetPilingElement = GetSheetPilingElement(failureMechanismeParamatersMStab.MStabParameters.SheetPiling, tnsb); + inputElement.Add(sheetPilingElement); + } + + // Horizontal Balance Area + if (failureMechanismeParamatersMStab.MStabParameters.HorizontalBalanceArea != null) + { + XElement horizontalBalanceAreaElement = + GetHorizontalBalanceAreaElement(failureMechanismeParamatersMStab.MStabParameters.HorizontalBalanceArea, tnsb); + inputElement.Add(horizontalBalanceAreaElement); + } + + // Slip Circle Definition + if (failureMechanismeParamatersMStab.MStabParameters.SlipCircleDefinition != null) + { + XElement slipCircleDefinitionElement = GetSlipCircleDefinitionElement( + failureMechanismeParamatersMStab.MStabParameters.SlipCircleDefinition, tnsb); + inputElement.Add(slipCircleDefinitionElement); + } + + // Design data + if (failureMechanismeParamatersMStab.Design != null) + { + XElement designElement = GetDesignElement(failureMechanismeParamatersMStab, tnsb); + inputElement.Add(designElement); + } + + // Profile + SoilProfile1D profile = failureMechanismeParamatersMStab.SoilProfile; + if (profile != null) + { + var soilProfileAssembler = new SoilProfileAssembler<SoilLayer1D, Soil>(); + XNamespace tnsa = soilProfileAssembler.ElementNamespace; + doc.Root.Add(new XAttribute(XNamespace.Xmlns + "tnsa", tnsa.NamespaceName)); + + + //TODO: Remove duplicate code. The method GetProfileElement should call the SoilProfileAssembler already defined in another namespace + XElement profileElement = GetProfileElement(profile, tns, tnsa); + // XElement profileElement = soilProfileAssembler.CreateDataTransferObject(profile); //GetProfileElement(profile, tns, tnsa); + // profileElement.Name = tns.GetName(profileElement.Name.LocalName);// .SetNamespace(DamMStabAssembler.XmlElementProfile, tns.NamespaceName); + doc.Root.Add(profileElement); + } + + return doc; + } + + private static XElement GetZoneAreasElement(MStabZoneAreas zoneAreas, XNamespace tns) + { + if (zoneAreas == null) + throw new ArgumentNullException("zoneAreas"); + + return zoneAreas.ToXElement(XmlElementZoneAreas, tns); + } + + private static XElement GetForbiddenZoneElement(MStabForbiddenZone forbiddenZone, XNamespace tns) + { + if (forbiddenZone == null) + throw new ArgumentNullException("forbiddenZone"); + + return forbiddenZone.ToXElement(XmlElementForbiddenZone, tns); + } + + private static XElement GetSheetPilingElement(Deltares.Dam.Data.SheetPiling sheetPiling, XNamespace tns) + { + if (sheetPiling == null) + throw new ArgumentNullException("sheetPiling"); + + return sheetPiling.ToXElement(XmlElementSheetPiling, tns); + } + + private static XElement GetHorizontalBalanceAreaElement(HorizontalBalanceArea horizontalBalanceArea, + XNamespace tns) + { + if (horizontalBalanceArea == null) + throw new ArgumentNullException("horizontalBalanceArea"); + + return horizontalBalanceArea.ToXElement(XmlElementHorizontalBalanceArea, tns); + } + + /// <summary> + /// Gets the slip circle definition element. + /// </summary> + /// <param name="slipCircleDefinition">The slip circle definition.</param> + /// <param name="tns">The namespace</param> + /// <returns></returns> + private static XElement GetSlipCircleDefinitionElement(SlipCircleDefinition slipCircleDefinition, XNamespace tns) + { + if (slipCircleDefinition == null) + throw new ArgumentNullException("slipCircleDefinition"); + + return slipCircleDefinition.ToXElement(XmlElementSlipCircleDefinition, tns); + } + + #region Private Assembler Methods + + /// <summary> + /// + /// </summary> + /// <param name="profile"></param> + /// <param name="tns"></param> + /// <param name="tnsa"></param> + /// <returns></returns> + private static XElement GetProfileElement(SoilProfile1D profile, XNamespace tns, + XNamespace tnsa) + { + var profileElement = new XElement(tns + XmlElementProfile); + profileElement.Add(new XAttribute(XmlAttributeName, profile.Name)); + profileElement.Add(new XAttribute(XmlAttributeXCoordinate, profile.X)); + profileElement.Add(new XAttribute(XmlAttributeYCoordinate, profile.Y)); + profileElement.Add(new XAttribute(XmlAttributePhreaticLevel, profile.PhreaticLevel)); + profileElement.Add(new XAttribute(XmlAttributeHasPhreaticLevel, profile.HasPhreaticLevel)); + profileElement.Add(new XAttribute(XmlAttributeBottomLevel, profile.BottomLevel)); + + if (profile.Layers.Count > 0) + { + var layersElement = new XElement(tnsa + XmlElementLayers); + GetProfileLayersElement(profile, tnsa, layersElement); + profileElement.Add(layersElement); + } + + // Bottom sand layer + if (profile.BottomAquiferLayer != null) + profileElement.Add(new XAttribute(XmlAttributeBottomSandLayerID, profile.BottomAquiferLayer.Id)); + // In-between sand layer + if (profile.InBetweenAquiferLayer != null) + profileElement.Add(new XAttribute(XmlAttributeInBetweenSandLayerID, profile.InBetweenAquiferLayer.Id)); + // Infiltration layer + if (profile.InfiltrationLayer != null) + profileElement.Add(new XAttribute(XmlAttributeInfiltrationLayerID, profile.InfiltrationLayer.Id)); + return profileElement; + } + + // Assembles the layer elements for the profile + private static void GetProfileLayersElement(SoilProfile1D profile, XNamespace tnsa, + XElement layersElement) + { + profile.EnsureUniqueLayerIds(); + foreach (SoilLayer1D layer in profile.Layers) + { + var layerElement = new XElement(tnsa + XmlElementLayer); + layersElement.Add(layerElement); + layerElement.Add(new XAttribute(XmlAttributeID, String.Format("{0}", layer.Id))); + layerElement.Add(new XAttribute(XmlAttributeSoilID, layer.Soil.Name)); + layerElement.Add(new XAttribute(XmlAttributeTopLevel, layer.TopLevel)); + } + } + + /// <summary> + /// Assembles the pl lines + /// </summary> + /// <param name="failureMechanismeParamatersMStab"></param> + /// <param name="tnsb"></param> + /// <returns></returns> + private static XElement GetExternalPlLinesElement( + FailureMechanismeParamatersMStab failureMechanismeParamatersMStab, XNamespace tnsb) + { + XElement externalPLLinesElement = null; + if (failureMechanismeParamatersMStab.PLLines != null) + { + externalPLLinesElement = new XElement(tnsb + XmlElementExternalPLLines); + foreach (PLLineType plLineType in Enum.GetValues(typeof(PLLineType))) + { + PLLine line = failureMechanismeParamatersMStab.PLLines.Lines[plLineType]; + var PLLineElement = new XElement(tnsb + XmlElementPLLine); + externalPLLinesElement.Add(PLLineElement); + PLLineElement.Add(new XAttribute(XmlAttributeIsPhreatic, line.IsPhreatic)); + PLLineElement.Add(new XAttribute(XmlAttributeBoundaryLayer, line.BoundaryLayer)); + foreach (PLLinePoint point in line.Points) + { + var PLPointElement = new XElement(tnsb + XmlElementPLPoint); + PLPointElement.Add(new XAttribute(XmlAttributeXCoord, point.X)); + PLPointElement.Add(new XAttribute(XmlAttributeYCoord, point.Z)); + PLLineElement.Add(PLPointElement); + } + } + } + if (failureMechanismeParamatersMStab.DupuitPLLines != null) + { + externalPLLinesElement = new XElement(tnsb + XmlElementExternalPLLines); + for (int plLineIndex = 0; + plLineIndex < + failureMechanismeParamatersMStab.DupuitPLLines.PLLines.Count; + plLineIndex++) + { + PLLine line = failureMechanismeParamatersMStab.DupuitPLLines.PLLines[plLineIndex]; + line.IsPhreatic = (plLineIndex == failureMechanismeParamatersMStab.DupuitPLLines.PLLines.Count - 1); + line.BoundaryLayer = plLineIndex; + var PLLineElement = new XElement(tnsb + XmlElementPLLine); + externalPLLinesElement.Add(PLLineElement); + PLLineElement.Add(new XAttribute(XmlAttributeIsPhreatic, line.IsPhreatic)); + PLLineElement.Add(new XAttribute(XmlAttributeBoundaryLayer, line.BoundaryLayer)); + for (int pointIndex = 1; pointIndex < line.Points.Count - 1; pointIndex++) + { + GeometryPoint point = line.Points[pointIndex]; + var PLPointElement = new XElement(tnsb + XmlElementPLPoint); + PLPointElement.Add(new XAttribute(XmlAttributeXCoord, point.X)); + PLPointElement.Add(new XAttribute(XmlAttributeYCoord, point.Z)); + PLLineElement.Add(PLPointElement); + } + } + } + return externalPLLinesElement; + } + + /// <summary> + /// Assembles the surface line element + /// </summary> + /// <param name="failureMechanismeParamatersMStab"></param> + /// <param name="tnsb"></param> + /// <returns></returns> + private static XElement GetSurfaceLineElement( + FailureMechanismeParamatersMStab failureMechanismeParamatersMStab, XNamespace tnsb) + { + var surfaceLineElement = new XElement(tnsb + XmlElementSurfaceLine); + foreach (GeometryPoint point in failureMechanismeParamatersMStab.SurfaceLine.Geometry.Points) + { + var surfacePointElement = new XElement(tnsb + XmlElementSurfacePoint); + surfacePointElement.Add(new XAttribute(XmlAttributeXCoord, point.X)); + surfacePointElement.Add(new XAttribute(XmlAttributeYCoord, point.Z)); + surfaceLineElement.Add(surfacePointElement); + } + return surfaceLineElement; + } + + /// <summary> + /// Assembles the characteristic points element + /// </summary> + /// <param name="failureMechanismeParamatersMStab"></param> + /// <param name="tnsb"></param> + /// <returns></returns> + private static XElement GetCharacteristicPointsElement( + FailureMechanismeParamatersMStab failureMechanismeParamatersMStab, XNamespace tnsb) + { + var characteristicPointsElement = new XElement(tnsb + XmlElementCharacteristicPoints); + foreach (CharacteristicPointType characteristicPointType in Enum.GetValues(typeof(CharacteristicPointType))) + { + GeometryPoint point = failureMechanismeParamatersMStab.SurfaceLine.CharacteristicPoints.GetGeometryPoint(characteristicPointType); + if (point != null) + { + var characteristicPointElement = new XElement(tnsb + XmlElementCharacteristicPoint); + characteristicPointElement.Add(new XAttribute(XmlAttributeXCoord, point.X)); + characteristicPointElement.Add(new XAttribute(XmlAttributeYCoord, point.Z)); + characteristicPointElement.Add(new XAttribute(XmlAttributeCharacteristicPointType, characteristicPointType.ToString())); + characteristicPointsElement.Add(characteristicPointElement); + } + + } + return characteristicPointsElement; + } + + + /// <summary> + /// Assembles the model element + /// </summary> + /// <param name="failureMechanismeParamatersMStab"></param> + /// <param name="tnsb"></param> + /// <returns></returns> + private static XElement GetModelElement( + FailureMechanismeParamatersMStab failureMechanismeParamatersMStab, XNamespace tnsb) + { + return new XElement(tnsb + XmlElementModel, + new XAttribute(XmlAttributeCalculationModel, failureMechanismeParamatersMStab.MStabParameters.Model), + new XAttribute(XmlAttributeShearStrength, failureMechanismeParamatersMStab.MStabParameters.ShearStrength), + new XAttribute(XmlAttributeProbabilistic, failureMechanismeParamatersMStab.MStabParameters.IsProbabilistic), + new XAttribute(XmlAttributeSearchMethod, failureMechanismeParamatersMStab.MStabParameters.SearchMethod), + new XAttribute(XmlAttributeGridPosition, failureMechanismeParamatersMStab.MStabParameters.GridPosition.ToString().ToLower()) + ); + } + + /// <summary> + /// Assembles the traffic load element + /// </summary> + /// <param name="failureMechanismeParamatersMStab"></param> + /// <param name="tnsb"></param> + /// <returns></returns> + private static XElement GetTrafficLoadElement( + FailureMechanismeParamatersMStab failureMechanismeParamatersMStab, XNamespace tnsb) + { + return new XElement(tnsb + XmlElementTrafficLoad, + new XAttribute(XmlAttributeXCoordinateAtRiver, failureMechanismeParamatersMStab. + SurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.TrafficLoadOutside).X), + new XAttribute(XmlAttributeXCoordinateAtPolder, failureMechanismeParamatersMStab. + SurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.TrafficLoadInside).X), + new XAttribute(XmlAttributeLoad, failureMechanismeParamatersMStab.TrafficLoad) + ); + } + + /// <summary> + /// Assembles the calculation options element + /// </summary> + /// <param name="failureMechanismeParamatersMStab"></param> + /// <param name="tnsb"></param> + /// <returns></returns> + private static XElement GetCalculationOptionsElement( + FailureMechanismeParamatersMStab failureMechanismeParamatersMStab, XNamespace tnsb) + { + return new XElement(tnsb + XmlElementCalculationOptions, + new XAttribute(XmlAttributeMinimalCircleDepth, failureMechanismeParamatersMStab. + MStabParameters.CalculationOptions.MinimalCircleDepth), + new XAttribute(XmlAttributeZonesType, failureMechanismeParamatersMStab. + MStabParameters.CalculationOptions.ZonesType.ToString()) + ); + } + + /// <summary> + /// Assembles the GeometryCreationOptions element + /// </summary> + /// <param name="failureMechanismeParamatersMStab"></param> + /// <param name="tnsb"></param> + /// <returns></returns> + private static XElement GetGeometryCreationOptionsElement( + FailureMechanismeParamatersMStab failureMechanismeParamatersMStab, XNamespace tnsb) + { + string soilGeometryName = failureMechanismeParamatersMStab.MStabParameters.GeometryCreationOptions.SoilGeometry2DFilename; + soilGeometryName = (soilGeometryName == null ? "" : soilGeometryName); + string materialForDike = failureMechanismeParamatersMStab.MStabParameters.GeometryCreationOptions.MaterialForDike; + materialForDike = (materialForDike == null ? "" : materialForDike); + string materialForShoulder = failureMechanismeParamatersMStab.MStabParameters.GeometryCreationOptions.MaterialForShoulder; + materialForShoulder = (materialForShoulder == null ? "" : materialForShoulder); + return new XElement(tnsb + XmlElementGeometryCreationOptions, + new XAttribute(XmlAttributeSoilGeometryType, failureMechanismeParamatersMStab. + MStabParameters.GeometryCreationOptions.SoilGeometryType), + new XAttribute(XmlAttributeSoilGeometry2DFilename, soilGeometryName), + new XAttribute(XmlAttributeXOffsetSoilGeometry2DOrigin, failureMechanismeParamatersMStab. + MStabParameters.GeometryCreationOptions.XOffsetSoilGeometry2DOrigin), + new XAttribute(XmlAttributeMaterialForDike, materialForDike), + new XAttribute(XmlAttributeMaterialForShoulder, materialForShoulder), + new XAttribute(XmlAttributeIsUseOriginalPLLineAssignments, failureMechanismeParamatersMStab. + MStabParameters.GeometryCreationOptions.IsUseOriginalPLLineAssignments), + new XAttribute(XmlAttributeIsUseOriginalCalculationOptions, failureMechanismeParamatersMStab. + MStabParameters.GeometryCreationOptions.IsUseOriginalCalculationOptions), + new XAttribute(XmlAttributeIsDrySituation, failureMechanismeParamatersMStab. + MStabParameters.GeometryCreationOptions.IsDrySituation), + new XAttribute(XmlAttributePLLineAssignment, failureMechanismeParamatersMStab. + MStabParameters.GeometryCreationOptions.PLLineAssignment), + new XAttribute(XmlAttributeIntrusionVerticalWaterPressure, failureMechanismeParamatersMStab. + MStabParameters.GeometryCreationOptions.IntrusionVerticalWaterPressureType), + new XAttribute(XmlAttributePenetrationLength, failureMechanismeParamatersMStab. + MStabParameters.GeometryCreationOptions.PenetrationLength), + new XAttribute(XmlAttributeIsDesign, failureMechanismeParamatersMStab. + MStabParameters.GeometryCreationOptions.IsDesign)); + } + + /// <summary> + /// + /// </summary> + /// <param name="failureMechanismeParamatersMStab"></param> + /// <param name="tnsb"></param> + /// <returns></returns> + private static XElement GetDesignElement( + FailureMechanismeParamatersMStab failureMechanismeParamatersMStab, XNamespace tnsb) + { + string embankmentMaterialname = failureMechanismeParamatersMStab.Design.EmbankmentMaterialname; + embankmentMaterialname = (embankmentMaterialname == null ? "" : embankmentMaterialname); + string previousGeometry2DFilename = failureMechanismeParamatersMStab.Design.PreviousGeometry2DFilename; + previousGeometry2DFilename = (previousGeometry2DFilename == null ? "" : previousGeometry2DFilename); + + return new XElement(tnsb + XmlElementDesign, + new XAttribute(XmlAttributeEmbankmentMaterialName, embankmentMaterialname), + new XAttribute(XmlAttributePreviousGeometry2DFilename, previousGeometry2DFilename)); + } + + + + #endregion + + #region Schema Validator Method + + public bool ValidateSchema(XDocument doc, out string message) + { + bool result = true; + string errorMessage = String.Empty; + + // DAMMStabDefinition + XmlSchemaSet schemas = new XmlSchemaSet(); + + Stream xsdStream = Common.GetEmbeddedFile(Assembly.GetExecutingAssembly(), XsdEmbeddedResourcePath); + schemas.Add(XmlElementNamespace, XmlReader.Create(xsdStream)); + xsdStream = Common.GetEmbeddedFile(Assembly.GetExecutingAssembly(), XsdEmbeddedResourcePathInput); + schemas.Add(XmlElementNamespaceInput, XmlReader.Create(xsdStream)); + + Assembly assembly; + string schemaName; + string resourceName; + + // FileIdentificationDefinition + var fileIdentificationAssembler = new FileIdentificationAssembler(); + if (!schemas.Contains(fileIdentificationAssembler.ElementNamespace)) + { + assembly = fileIdentificationAssembler.GetType().Assembly; + schemaName = Path.GetFileName(fileIdentificationAssembler.ElementNamespace); + string schemaFileName = schemaName + ".xsd"; + resourceName = + (from string name in assembly.GetManifestResourceNames() + where name.EndsWith(schemaFileName) + select name).Single(); + xsdStream = Common.GetEmbeddedFile(assembly, resourceName); + schemas.Add(fileIdentificationAssembler.ElementNamespace, XmlReader.Create(xsdStream)); + } + + // ProfileDefinition + var soilProfileAssembler = + new SoilProfileAssembler<SoilLayer1D, Soil>(); + assembly = soilProfileAssembler.GetType().Assembly; + schemaName = Path.GetFileName(soilProfileAssembler.ElementNamespace); + resourceName = + (from string name in assembly.GetManifestResourceNames() + where name.EndsWith(schemaName + ".xsd") + select name).Single(); + xsdStream = Common.GetEmbeddedFile(assembly, resourceName); + schemas.Add(soilProfileAssembler.ElementNamespace, XmlReader.Create(xsdStream)); + doc.Validate(schemas, (o, e) => + { + result = false; + errorMessage = e.Message; + }, true); + + message = errorMessage; + + return result; + } + + #endregion + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/License/DamLicense.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/License/DamLicense.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/License/DamLicense.cs (revision 3305) @@ -0,0 +1,138 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. +// +// 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.Linq; +using Deltares.Authorization; + +namespace Deltares.Dam.Data.License +{ + /// <summary> + /// License class to chekout and checkin licenses + /// </summary> + public class DamLicense + { + + private static DAuthClient dAuthClient; + private static DamLicenseType damLicenseType = DamLicenseType.None; + private static string checkedOutFeature; + + /// <summary> + /// Gets the type of the dam license. + /// </summary> + /// <value> + /// The type of the dam license. + /// </value> + public static DamLicenseType DamLicenseType + { + get + { + return damLicenseType; + } + } + + /// <summary> + /// Checkouts the license. + /// Look up all features starting with the specified string + /// See if any of them has the correct license version, according to the version we get from the Application version info + /// </summary> + /// <param name="feature">The feature.</param> + /// <param name="version">The version.</param> + public static void CheckoutLicense(string feature, string version) + { + if (feature == null) throw new ArgumentNullException(nameof(feature)); + IEnumerable<string> featureNames = GetAllFeaturesStartingWith(feature); + if (featureNames == null) + { + checkedOutFeature = null; + damLicenseType = DamLicenseType.None; + return; + } + int majorVersion = GetMajorVersionFromVersionString(version); + string versionString = majorVersion.ToString(CultureInfo.InvariantCulture); + damLicenseType = DamLicenseType.None; + foreach (var featureName in featureNames) + { + if (DAuthClient.CheckOut(featureName, versionString)) + { + damLicenseType = DamLicenseType.LFM; + checkedOutFeature = featureName; + break; + } + } + } + + /// <summary> + /// Checks in the license. + /// </summary> + public static void CheckinLicense() + { + if (!String.IsNullOrEmpty(checkedOutFeature)) + { + DAuthClient.CheckIn(checkedOutFeature); + } + } + + /// <summary> + /// Gets all features starting with the specified feature string + /// </summary> + /// <param name="feature">the feature string to look up</param> + /// <returns>all the feature names thta start with the specified feature string</returns> + public static IEnumerable<string> GetAllFeaturesStartingWith(string feature) + { + string[] features = null; + DAuthClient.GetAvailableFeatures(ref features); + if (features == null) + { + return null; + } + IEnumerable<string> featureNames = features.Where(s => s.StartsWith(feature)); + return featureNames; + } + + private static DAuthClient DAuthClient + { + get + { + if (dAuthClient != null) + { + return dAuthClient; + } + dAuthClient = new DAuthClient(false, true); + return dAuthClient; + } + } + + private static int GetMajorVersionFromVersionString(string version) + { + var seperator = new[] + { + '.' + }; + var versionNumbers = version.Split(seperator); + int majorVersion; + int.TryParse(versionNumbers[0], out majorVersion); + return majorVersion; + } + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/NtsFeature.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/NtsFeature.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/NtsFeature.cs (revision 3305) @@ -0,0 +1,46 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. +// +// 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; + +namespace Deltares.Maps +{ + public class NtsFeature : NetTopologySuite.Features.Feature, IFeature + { + private readonly Guid id; + + public NtsFeature() + { + id = Guid.NewGuid(); + Attributes = new AttributesDictionary(); + } + + public Guid Id + { + get { return id; } + } + + public string WktFormat + { + get { return Geometry.AsText(); } + } + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Stochast.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Stochast.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Stochast.cs (revision 3305) @@ -0,0 +1,34 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +namespace Deltares.Dam.Data +{ + public class Stochast + { + public Stochast() + { + } + + public double Mean { get; set; } + public double StandardDeviation { get; set; } + public int Distribution { get; set; } + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DtoAssembler/Serialization.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DtoAssembler/Serialization.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DtoAssembler/Serialization.cs (revision 3305) @@ -0,0 +1,200 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. +// +// 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.IO; +using System.Runtime.Serialization; +using System.Xml.Serialization; + +namespace Deltares.Standard +{ + /// <summary> + /// Types that implement this interface has a seperate data object + /// that needs to be serialized instead of the implementer itself + /// </summary> + /// <remarks> + /// The type implementing this interface act as an adapter without subclassing (Decorator pattern). + /// It can have a complete different data contract interface and can delegate calls to the members + /// of the object being serialized + /// </remarks> + /// <typeparam name="T"></typeparam> + public interface ISerializableObject<T> + { + /// <summary> + /// Should return the data object to serialize + /// </summary> + /// <returns></returns> + T GetDataObject(); + + /// <summary> + /// Sets the data object which needs to be serialized later + /// Data properties in the implementer should implemenent setters and getters on this object + /// </summary> + /// <param name="obj"></param> + void SetDataObject(T obj); + } + + /// <summary> + /// A common exception which should be trown when validating the schema and mandatory fields are not set. + /// </summary> + [Serializable] + public class NotSchemaCompliantException : Exception + { + public NotSchemaCompliantException() + { + } + + public NotSchemaCompliantException(string message) : base(message) + { + } + + public NotSchemaCompliantException(string message, Exception inner) : base(message, inner) + { + } + + protected NotSchemaCompliantException( + SerializationInfo info, + StreamingContext context) + : base(info, context) + { + } + } + + /// <summary> + /// Defines a contract for the Serializer. + /// </summary> + public interface INamespaceProvider + { + /// <summary> + /// Defines a method which should return the target namespaces + /// </summary> + /// <returns>The qualified name</returns> + XmlSerializerNamespaces GetNamespaces(); + } + + public static class Serialization + { + /// <summary> + /// Serializes the target to file + /// </summary> + /// <typeparam name="T">The target type that implements ISchemaSerializer</typeparam> + /// <param name="target">The target instance</param> + /// <param name="fileName">The name of the file to serialze to</param> + public static void SerializeToFile<T>(T target, string fileName) + { + XmlSerializerNamespaces namespaces = null; + var ns = target as INamespaceProvider; + if (ns != null) + namespaces = ns.GetNamespaces(); + + var xml = new System.Xml.Serialization.XmlSerializer(typeof (T)); + using (var fs = new FileStream(fileName, FileMode.Create)) + { + if (namespaces != null) + xml.Serialize(fs, target, namespaces); + else + xml.Serialize(fs, target); + } + } + + /// <summary> + /// Serializes the target to string + /// </summary> + /// <typeparam name="T">The target type</typeparam> + /// <param name="target">The target instance</param> + /// <returns>the target serialized as a xml string</returns> + public static string SerializeToString<T>(T target) + { + string result = ""; + XmlSerializerNamespaces namespaces = null; + var ns = target as INamespaceProvider; + if (ns != null) + namespaces = ns.GetNamespaces(); + + var xml = new System.Xml.Serialization.XmlSerializer(typeof (T)); + using (var sw = new StringWriter()) + { + if (namespaces != null) + xml.Serialize(sw, target, namespaces); + else + xml.Serialize(sw, target); + + result = sw.ToString(); + } + return result; + } + + /// <summary> + /// Deserializes the target object class from file + /// </summary> + /// <typeparam name="T">The target type that implements ISchemaSerializer</typeparam> + /// <param name="fileName">The name of the file to deserialize from</param> + /// <returns>The target object graph</returns> + public static T DeserializeFromFile<T>(string fileName) where T : class + { + T result = default(T); + var xml = new System.Xml.Serialization.XmlSerializer(typeof (T)); + + using (var fs = new FileStream(fileName, FileMode.Open)) + { + result = xml.Deserialize(fs) as T; + } + return result; + } + + /// <summary> + /// Deserializes the target object class from file + /// </summary> + /// <typeparam name="T">The target type that implements ISchemaSerializer</typeparam> + /// <param name="fileName">The name of the file to deserialize from</param> + /// <returns>The target object graph</returns> + public static string DeserializeFromFileToString<T>(string fileName) where T : class + { + T result = default(T); + var xml = new System.Xml.Serialization.XmlSerializer(typeof (T)); + using (var fs = new FileStream(fileName, FileMode.Open)) + { + result = xml.Deserialize(fs) as T; + } + return SerializeToString<T>(result); + } + + /// <summary> + /// Deserializes the target object from string + /// </summary> + /// <typeparam name="T"></typeparam> + /// <param name="xmlData"></param> + /// <returns></returns> + public static T DeserializeFromString<T>(string xmlData) where T : class + { + T result = default(T); + var xml = new System.Xml.Serialization.XmlSerializer(typeof (T)); + using (var sr = new StringReader(xmlData)) + { + result = xml.Deserialize(sr) as T; + } + + return result; + } + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Specifications/ValueBoundSpecification.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Specifications/ValueBoundSpecification.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Specifications/ValueBoundSpecification.cs (revision 3305) @@ -0,0 +1,91 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +namespace Deltares.Standard.Specifications +{ + /// <summary> + /// With this class a value of an object bound to a property can be tested against the specification. + /// This is a variant of the ParameterizedSpecification + /// </summary> + /// <typeparam name="TCandidate">The candidate type</typeparam> + /// <typeparam name="TValue">The candidate property type</typeparam> + public abstract class ValueBoundSpecification<TCandidate, TValue> : SpecificationBase<TCandidate> + { + private readonly string attributeName; + private readonly TValue attributeValue; + private TValue candidateValue; + + protected ValueBoundSpecification(string attributeName, TValue attributeValue) + { + this.attributeName = attributeName; + this.attributeValue = attributeValue; + } + + /// <summary> + /// Gets the attribute value. + /// </summary> + public TValue AttributeValue + { + get { return attributeValue; } + } + + /// <summary> + /// Gets the candidate value. + /// </summary> + public TValue CandidateValue + { + get { return candidateValue; } + } + + /// <summary> + /// Gets the candidate string value. + /// </summary> + /// <param name="candidate">The candidate.</param> + /// <returns></returns> + protected string GetCandidateStringValue(TCandidate candidate) + { + return GetCandidateObjectValue(candidate).ToString(); + } + + /// <summary> + /// Gets the candidate T value. + /// </summary> + /// <param name="candidate">The candidate.</param> + /// <returns></returns> + protected TValue GetCandidateTValue(TCandidate candidate) + { + if (candidateValue.Equals(default(TValue))) + candidateValue = (TValue) GetCandidateObjectValue(candidate); + + return candidateValue; + } + + /// <summary> + /// Gets the candidate object value. + /// </summary> + /// <param name="candidate">The candidate.</param> + /// <returns></returns> + private object GetCandidateObjectValue(TCandidate candidate) + { + return candidate.GetType().GetProperty(attributeName).GetValue(candidate, null); + } + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Specifications/OrSpecification.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Specifications/OrSpecification.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Specifications/OrSpecification.cs (revision 3305) @@ -0,0 +1,57 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using Deltares.Dam.Data; + +namespace Deltares.Standard.Specifications +{ + public class OrSpecification<TCandidate> : CompositeSpecification<TCandidate> + { + private readonly ISpecification<TCandidate> one; + private readonly ISpecification<TCandidate> other; + + public OrSpecification(ISpecification<TCandidate> one, ISpecification<TCandidate> other) + { + this.one = one; + this.other = other; + } + + /// <summary> + /// Determines whether the candidate satisfies the specification. + /// </summary> + /// <param name="candidate">The candidate to test.</param> + /// <returns> + /// <c>true</c> if the candidate satisfies the specification otherwise, <c>false</c>. + /// </returns> + public override bool IsSatisfiedBy(TCandidate candidate) + { + bool otherIsSatisfiedBy = other.IsSatisfiedBy(candidate); + bool thisIsSatisfiedBy = one.IsSatisfiedBy(candidate); + + bool isSatisfied = (thisIsSatisfiedBy || otherIsSatisfiedBy); + if (!isSatisfied) + { + Description = "This " + one.Description + " AND " + other.Description + " are not satisfied"; + } + return isSatisfied; + } + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Assemblers/CalculationParametersAssembler.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Assemblers/CalculationParametersAssembler.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Assemblers/CalculationParametersAssembler.cs (revision 3305) @@ -0,0 +1,241 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. +// +// 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.IO; +using System.Reflection; +using System.Xml; +using System.Xml.Linq; +using System.Xml.Schema; +using Deltares.Standard; + +namespace Deltares.Dam.Data.Assemblers +{ + using Standard.Extensions; + + /// <summary> + /// + /// </summary> + public class CalculationParametersAssembler : DtoAssembler<CalculationParameters> + { + #region Constant declarations + + /// <summary> + /// Holds the common part of the path to the embedded resource + /// </summary> + private const string EmbeddedResourcePath = "Deltares.Dam.Data.Xsd"; + + public const string XmlCalculationModulesElementName = "CalculationModules"; + public const string XmlStabilityInsideElementName = "StabilityInside"; + public const string XmlStabilityOutsideElementName = "StabilityOutside"; + public const string XmlPipingWtiElementName = "PipingWti"; + public const string XmlPipingBlighElementName = "PipingBligh"; + public const string XmlPipingSellmeijerElementName = "PipingSellmeijer"; + // Obsolete module names + public const string XmlObsoletePipingSellmeijerProbabilisticElementName = "PipingSellmeijerProbabilistic"; + public const string XmlObsoleteStabilityElementName = "Stability"; + public const string XmlObsoletePipingIJkdijkElementName = "PipingIJkdijk"; + public const string XmlObsoleteOvertoppingElementName = "Overtopping"; + + public const string XmlMStabParametersElementName = "MStabParameters"; + public const string XmlMStabIsCalculateAllStabilityProjectsAtOnceElementName = "IsCalculateAllStabilityProjectsAtOnce"; + public const string XmlMStabCalculationModelElementName = "CalculationModel"; + public const string XmlMStabSearchMethodElementName = "SearchMethod"; + public const string XmlMStabUseZonesElementName = "UseZones"; + // Obsolete Mstab parameters + public const string XmlObsoleteMStabProbabilisticElementName = "Probabilistic"; + public const string XmlObsoleteMStabIsOverrulePLLineCreationMethodName = "IsOverrulePLLineCreationMethod"; + public const string XmlObsoleteMStabPLLineCreationMethodname = "PLLineCreationMethod"; + public const string XmlObsoleteMStabShearStrengthElementName = "ShearStrength"; + + /// <summary> + /// Holds the xml element name + /// </summary> + private const string XmlElementName = "CalculationParameters"; + + /// <summary> + /// Holds the name of the xml schema + /// </summary> + private const string XmlSchemaName = "CalculationParametersDefinition"; + + /// <summary> + /// Holds the xml namespace + /// </summary> + private const string XmlElementNamespace = "http://deltares.nl/2008/" + XmlSchemaName; + + /// <summary> + /// Holds the xsd resource path + /// </summary> + private const string XsdEmbeddedResourcePath = EmbeddedResourcePath + "." + XmlSchemaName + ".xsd"; + + + #endregion + + /// <summary> + /// + /// </summary> + public CalculationParametersAssembler() + : base(XmlElementName, XmlElementNamespace, Assembly.GetExecutingAssembly().GetEmbeddedFile(XsdEmbeddedResourcePath)) + { + } + + /// <summary> + /// Gets or sets the name of the file. + /// </summary> + /// <value> + /// The name of the file. + /// </value> + public string FileName { get; set; } + + public override CalculationParameters CreateDomainObject(XElement dtoObj) + { + + CalculationParameters calculationParameters = base.CreateDomainObject(dtoObj); + + // Calculation modules + XElement calculationModulesElement = dtoObj.Element(XmlCalculationModulesElementName); + if (calculationModulesElement != null) + { + CalculationModules calculationModules = new CalculationModules(); + var found = false; + XElement element = calculationModulesElement.Element(CalculationParametersAssembler.XmlStabilityInsideElementName); + if (element != null) + { + calculationModules.StabilityInside = int.Parse(element.Value) != 0; + found = true; + } + element = calculationModulesElement.Element(CalculationParametersAssembler.XmlObsoleteStabilityElementName); + if (element != null && !found) + { + calculationModules.StabilityInside = int.Parse(element.Value) != 0; + found = true; + } + element = calculationModulesElement.Element(CalculationParametersAssembler.XmlStabilityOutsideElementName); + if (element != null) + { + calculationModules.StabilityOutside = int.Parse(element.Value) != 0; + } + + element = calculationModulesElement.Element(CalculationParametersAssembler.XmlPipingWtiElementName); + if (element != null) + { + calculationModules.PipingWti = int.Parse(element.Value) != 0; + } + + element = calculationModulesElement.Element(CalculationParametersAssembler.XmlPipingBlighElementName); + if (element != null) + { + calculationModules.PipingBligh = int.Parse(element.Value) != 0; + } + + element = calculationModulesElement.Element(CalculationParametersAssembler.XmlPipingSellmeijerElementName); + if (element != null) + { + calculationModules.PipingSellmeijer = int.Parse(element.Value) != 0; + } + + // Check for obsolete keys + ThrowIfObsoleteKeyNameFound(calculationModulesElement, XmlObsoletePipingSellmeijerProbabilisticElementName, FileName); + ThrowIfObsoleteKeyNameFound(calculationModulesElement, XmlObsoletePipingIJkdijkElementName, FileName); + ThrowIfObsoleteKeyNameFound(calculationModulesElement, XmlObsoleteOvertoppingElementName, FileName); + + + calculationParameters.CalculationModules = calculationModules; + } + + // MStab parameters + XElement mstabParametersElement = dtoObj.Element(XmlMStabParametersElementName); + if (mstabParametersElement != null) + { + MStabParameters mstabParameters = new MStabParameters(); + + XElement element; + + element = mstabParametersElement.Element(CalculationParametersAssembler.XmlMStabIsCalculateAllStabilityProjectsAtOnceElementName); + if (element != null) + { + mstabParameters.IsCalculateAllStabilityProjectsAtOnce = int.Parse(element.Value) != 0; + } + + element = mstabParametersElement.Element(CalculationParametersAssembler.XmlMStabCalculationModelElementName); + if (element != null) + { + mstabParameters.Model = (MStabModelType)Enum.Parse(typeof(MStabModelType), element.Value, true); + } + + element = mstabParametersElement.Element(CalculationParametersAssembler.XmlMStabSearchMethodElementName); + if (element != null) + { + mstabParameters.SearchMethod = (MStabSearchMethod)Enum.Parse(typeof(MStabSearchMethod), element.Value, true); + } + + element = mstabParametersElement.Element(CalculationParametersAssembler.XmlMStabUseZonesElementName); + mstabParameters.CalculationOptions = new MStabCalculationOptions(); + mstabParameters.CalculationOptions.ZonesType = MStabZonesType.NoZones; + if (element != null) + { + int useZones = int.Parse(element.Value); + mstabParameters.CalculationOptions.ZonesType = (MStabZonesType)useZones; + } + + // Check for obsolete keys + ThrowIfObsoleteKeyNameFound(mstabParametersElement, XmlObsoleteMStabProbabilisticElementName, FileName); + ThrowIfObsoleteKeyNameFound(mstabParametersElement, XmlObsoleteMStabIsOverrulePLLineCreationMethodName, FileName); + ThrowIfObsoleteKeyNameFound(mstabParametersElement, XmlObsoleteMStabPLLineCreationMethodname, FileName); + ThrowIfObsoleteKeyNameFound(mstabParametersElement, XmlObsoleteMStabShearStrengthElementName, FileName); + + calculationParameters.MStabParameters = mstabParameters; + } + + return calculationParameters; + } + + private static void ThrowIfObsoleteKeyNameFound(XElement calculationModulesElement, string obsoleteElementKeyName, string fileName) + { + XElement obsoleteElement = calculationModulesElement.Element(obsoleteElementKeyName); + if (obsoleteElement != null) + { + throw new DtoAssemblerException(String.Format("Your input file {0} is incorrect. The specified parameter '{1}' in your xml is obsolete. Please remove it.", fileName, obsoleteElementKeyName)); + } + } + + #region Schema Validator Method + + public bool ValidateSchema(XDocument doc, out string message) + { + bool result = true; + string errorMessage = String.Empty; + + XmlSchemaSet schemas = new XmlSchemaSet(); + + Stream xsdStream = Common.GetEmbeddedFile(Assembly.GetExecutingAssembly(), XsdEmbeddedResourcePath); + schemas.Add(XmlElementNamespace, XmlReader.Create(xsdStream)); + + doc.Validate(schemas, (o, e) => { result = false; errorMessage = e.Message; }, true); + + message = errorMessage; + + return result; + } + + #endregion + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/PLLines.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/PLLines.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/PLLines.cs (revision 3305) @@ -0,0 +1,47 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System.Collections.Generic; + +namespace Deltares.Dam.Data +{ + + public class PLLines + { + IDictionary<PLLineType, PLLine> lines; + public PLLines() + { + lines = new Dictionary<PLLineType, PLLine>(); + foreach (PLLineType plLineType in PLLineType.GetValues(typeof(PLLineType))) + { + this.Lines[plLineType] = new PLLine(); + } + } + + public IDictionary<PLLineType, PLLine> Lines + { + get { return this.lines; } + private set { this.lines = value; } + } + public int PLLineCount { get { return PLLineType.GetValues(typeof(PLLineType)).GetLength(0); } } + + } +} Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Specifications/InBetweenRangeSpecification.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Specifications/InBetweenRangeSpecification.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Specifications/InBetweenRangeSpecification.cs (revision 3305) @@ -0,0 +1,54 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +namespace Deltares.Standard.Specifications +{ + /// <summary> + /// Checks if the candidate is in between the range boundaries. Boundaries are excluded + /// </summary> + public class InBetweenRangeSpecification : SpecificationBase<double> + { + private readonly double min; + private readonly double max; + + public InBetweenRangeSpecification(double min, double max) + { + this.min = min; + this.max = max; + + Name = "In between range specification"; + Description = string.Format("The candidate value should have a value between {0} and {1}. Boundaries are excluded", min, max); + } + + /// <summary> + /// Determines whether the candidate satisfies the specification. + /// </summary> + /// <param name="candidate">The candidate to test.</param> + /// <returns> + /// <c>true</c> if the candidate satisfies the specification otherwise, <c>false</c>. + /// </returns> + public override bool IsSatisfiedBy(double candidate) + { + return (min < candidate && max > candidate); + } + } + +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/Test/TestData/Gemeenten.shp.xml =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/Test/TestData/Gemeenten.shp.xml (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/Test/TestData/Gemeenten.shp.xml (revision 3305) @@ -0,0 +1,1051 @@ +<?xml + version="1.0"?> +<!-- +Copyright (C) Stichting Deltares 2018. All rights reserved. + +This file is part of the DAM - UI. + +The DAM - UI is free software: you can redistribute it and/or modify +it under the terms of the GNU 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 General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see <http://www.gnu.org/licenses/>. + +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. +--> +<metadata xml:lang="en"> + <Esri> + <CreaDate>20060810</CreaDate><CreaTime>14300900</CreaTime><SyncOnce>FALSE</SyncOnce><SyncDate>20090123</SyncDate> + <SyncTime>16122700</SyncTime><ModDate>20090123</ModDate><ModTime>16122700</ModTime> + <DataProperties> + <lineage> + <Process ToolSource="C:\Program Files\ArcGIS\ArcToolbox\Toolboxes\Data Management Tools.tbx\CopyFeatures" + Date="20060810" Time="134721"> + CopyFeatures "O:\Demo_data_opleidingen\Data DVD + opleidingen\CBS2005buurtkaartdata\buurt_2005_gen.shp" "O:\Demo_data_opleidingen\Data DVD opleidingen\Opzet + voor op DVD\Nederland.mdb\buurt_2005_gen" # 0 0 0 + </Process> + <Process ToolSource="C:\Program Files\ArcGIS\ArcToolbox\Toolboxes\Data Management Tools.tbx\CopyFeatures" + Date="20070308" Time="162449"> + CopyFeatures "\\arc\opleidingen\Demo_data_opleidingen\Data DVD + opleidingen\Opzet voor op DVD\Nederland\Nederland.mdb\WijkEnBuurtkaart\Gemeenten" + D:\Opleiding\Nederland\Nederland.gdb\WijkEnBuurtkaart\Gemeenten # 0 0 0 + </Process> + <Process ToolSource="C:\Program Files\ArcGIS\ArcToolbox\Toolboxes\Data Management Tools.tbx\CopyFeatures" + Date="20090123" Time="161228"> + CopyFeatures + F:\esriStuff\GeodataESRI\Data\Nederland\Nederland.gdb\WijkEnBuurtkaart\Gemeenten + F:\esriStuff\GeodataESRI\shapes\Gemeenten.shp # 0 0 0 + </Process> + </lineage> + </DataProperties> + <MetaID>{3764633F-A58A-4AFB-97F3-7B968ECEC015}</MetaID> + </Esri> + <MD_Metadata xmlns:gml="http://www.opengis.net/gml" xmlns:xlink="http://www.w3.org/1999/xlink" + xmlns:xsi="http://www.w3.org/2001/XML-schema-instance" xmlns:gco="http://www.isotc211.org/2005/gco" + xmlns="http://www.isotc211.org/2005/gmd"> + <fileIdentifier> + <gco:CharacterString>{1A0F83F5-5E97-4615-B068-AC18883EF221}</gco:CharacterString> + </fileIdentifier> + <language> + <gco:CharacterString>dut</gco:CharacterString> + </language> + <characterSet> + <MD_CharacterSetCode codeList="./resources/codeList.xml#MD_CharacterSetCode" codeListValue="utf8" /> + </characterSet> + <hierarchyLevel> + <MD_ScopeCode codeList="./resources/codeList.xml#MD_ScopeCode" codeListValue="dataset" /> + </hierarchyLevel> + <contact> + <CI_ResponsibleParty> + <individualName> + <gco:CharacterString /> + </individualName> + <organisationName> + <gco:CharacterString>ESRI Nederland Opleidingen</gco:CharacterString> + </organisationName> + <positionName> + <gco:CharacterString /> + </positionName> + <contactInfo> + <CI_Contact> + <phone> + <CI_Telephone> + <voice> + <gco:CharacterString /> + </voice> + <facsimile> + <gco:CharacterString /> + </facsimile> + </CI_Telephone> + </phone> + <address> + <CI_Address> + <deliveryPoint> + <gco:CharacterString /> + </deliveryPoint> + <city> + <gco:CharacterString /> + </city> + <administrativeArea> + <gco:CharacterString /> + </administrativeArea> + <postalCode> + <gco:CharacterString /> + </postalCode> + <country> + <gco:CharacterString /> + </country> + <electronicMailAddress> + <gco:CharacterString /> + </electronicMailAddress> + </CI_Address> + </address> + <onlineResource> + <CI_OnlineResource> + <linkage> + <URL /> + </linkage> + </CI_OnlineResource> + </onlineResource> + </CI_Contact> + </contactInfo> + <role> + <CI_RoleCode codeList="./resources/codeList.xml#CI_RoleCode" codeListValue="" /> + </role> + </CI_ResponsibleParty> + </contact> + <dateStamp> + <gco:Date>2006-08-14</gco:Date> + </dateStamp> + <metadataStandardName> + <gco:CharacterString>ISO 19115:2003</gco:CharacterString> + </metadataStandardName> + <metadataStandardVersion> + <gco:CharacterString>Nederlandse metadata standaard voor geografie 1.0</gco:CharacterString> + </metadataStandardVersion> + <referenceSystemInfo> + <MD_ReferenceSystem> + <referenceSystemIdentifier> + <RS_Identifier> + <code> + <gco:CharacterString>Rijksdriehoekstelsel_New (28992)</gco:CharacterString> + </code> + <codeSpace> + <gco:CharacterString>EPSG</gco:CharacterString> + </codeSpace> + </RS_Identifier> + </referenceSystemIdentifier> + </MD_ReferenceSystem> + </referenceSystemInfo> + <identificationInfo> + <MD_DataIdentification> + <citation> + <CI_Citation> + <title> + <gco:CharacterString>Wijk- en buurtkaart</gco:CharacterString> + + + + + + 2005 + + + + + + + + + + + + + De wijk- en buurtkaart bevat digitale geometrie van de grenzen van de buurten, wijken en gemeenten. De + kerncijfers van de buurten en de geaggreggeerde kerncijfers van de wijken en gemeenten zijn aan de kaart + toegevoegd. + + + + + + + + + + + + Centraal Bureau voor de Statistiek + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + +
+ + + + www.cbs.nl + + + +
+
+ + + +
+
+ + + + + + + Topografische Dienst Kadaster + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + +
+ + + + www.kadaster.nl + + + +
+
+ + + +
+
+ + + + + + + + + + + + + + + + Op alle data rust een copyright zoals die door de eigenaars van de data is + vastgelegd en bij hen is op te vragen. Gebruik van de data betekent dat u met deze voorwaarde akkoord + gaat. + + + + + + + + + + + + + + + + + + dut + + + + + + + + + + 3.254 + + + 7.244 + + + 50.735 + + + 53.561 + + + + + + + + + Nederland + + + + + + + + + + + + + + + Shapefile + + + 1.0 + + + + + + + + + + + + Centraal Bureau voor de Statistiek (CBS) + + + + + + +
+ + + + + + + + + + + + + + + + + + + + +
+ + + + www.cbs.nl + + + +
+
+ + + +
+
+ + + + + + + + + + + + + +
+
+ + + + + + + + + \\arc\opleidingen\Demo_data_opleidingen\Data DVD opleidingen\Opzet voor op DVD\Nederland.mdb + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + text + + + + De buurtgrenzen zijn gegeneraliseerd. + De begrenzing van de buurten met de volledige (niet-gegeneraliseerde) geometrie is als + verbijzondering toegevoegd aan de volledige digitale geometrie van de gemeentegrenzen van de + Topografische Dienst Kadaster. + + + + + + + + + + + De kaart is samengesteld uit drie bronnen: de gemeentegrenzen op land volgens de + kaart van gemeentegrenzen van de Topografische Dienst Kadaster, de buurtgrenzen volgens opgave van de + gemeenten en de grens van het land met grotere wateren volgens de meeste recente kaart van het Bestand + Bodemgebruik van het CBS. + + + + + + + + + + + + <gco:CharacterString /> + + + + + + + + + + + + + + + Gemeenten + + OBJECTID + + + Shape + + + GM_CODE + + + GM_NAAM + + + POSTCODE + + + DEK_PERC + + + OPP_TOT + + + OPP_LAND + + + OPP_WATER + + + BEV_DICHTH + + + AANT_INW + + + AANT_MAN + + + AANT_VROUW + + + P_0_14_JR + + + P_15_24_JR + + + P_25_44_JR + + + P_45_64_JR + + + P_65_EO_JR + + + P_WEST_AL + + + P_N_W_AL + + + P_MARROK + + + P_ANT_ARU + + + P_SURINAM + + + P_TURKIJE + + + P_OVER_NW + + + AANTAL_HH + + + P_EENP_HH + + + P_HH_Z_K + + + P_HH_M_K + + + GEM_HH_GR + + + AUTO_TOT + + + AUTO_MUT + + + AUTO_HH + + + AUTO_LAND + + + BEDR_AUTO + + + MOTOR_2W + + + Shape_Length + + + Shape_Area + + + + + Microsoft Windows XP Version 5.1 (Build 2600) Service Pack 2; ESRI ArcCatalog 9.2.0.1324 + + nlREQUIRED: A brief narrative summary of the data set. + REQUIRED: A summary of the intentions with which the data set was developed. + + + + REQUIRED: The name of an organization or individual that developed the data set. + REQUIRED: The date when the data set is published or otherwise made available for release. + GemeentenGemeenten + vector digital data + \\wl01982\F$\esriStuff\GeodataESRI\shapes\Gemeenten.shp + + + + REQUIRED: The basis on which the time period of content information is determined. + + + + REQUIRED: The year (and optionally month, or month and day) for which the data set corresponds to + the ground. + + + + + + REQUIRED: The state of the data set. + + REQUIRED: The frequency with which changes and additions are made to the data set after the initial data + set is completed. + + + + + 3.2539067.243915 + 53.56137550.734945 + + + 13573.708052278026.099972 + 306838.822004619352.799996 + + + + + + REQUIRED: Reference to a formally registered thesaurus or a similar authoritative source of theme + keywords. + + REQUIRED: Common-use word or phrase used to describe the subject of the data set. + + + REQUIRED: Restrictions and legal prerequisites for accessing the data set. + REQUIRED: Restrictions and legal prerequisites for using the data set after access is granted. + Shapefile + + + Microsoft Windows XP Version 5.1 (Build 2600) Service Pack 2; ESRI ArcCatalog 9.2.0.1324 + + + + + Gemeenten + + + + + + + + + + + 13573.708052278026.099972 + 619352.799996306838.822004 + 1 + + + + + 3.2539067.243915 + 53.56137550.734945 + 1 + + + + nl + FGDC Content Standards for Digital Geospatial Metadata + FGDC-STD-001-1998local time + + + + REQUIRED: The person responsible for the metadata information. + REQUIRED: The organization responsible for the metadata information. + + + REQUIRED: The mailing and/or physical address for the organization or individual. + REQUIRED: The city of the address.REQUIRED: The state or province of the address. + REQUIRED: The ZIP or other postal code of the address. + + REQUIRED: The telephone number by which individuals can speak to the organization or individual. + + + 20090123 + + http://www.esri.com/metadata/esriprof80.html + ESRI Metadata Profile + + + + + + ISO 19115 Geographic Information - Metadata + DIS_ESRI1.0 + + + + + + + dataset + + Downloadable Data + + + + 0,0000,000 + + + + + + + + + 002 + file://\\wl01982\F$\esriStuff\GeodataESRI\shapes\Gemeenten.shp + Local Area Network + + 0,000 + + + Shapefile + + + + + Vector + + + SimplePolygon + FALSE0FALSE + FALSE + + + G-polygon0 + + + + + + + GCS_AmersfoortRijksdriehoekstelsel_New + + + + coordinate pairmeters + + 0.0000000.000000 + + + + Double Stereographic + + 5.38763952.156161 + 0.999908155000.000000 + 463000.000000 + + + + + D_AmersfoortBessel_1841 + 6377397.155000299.152813 + + + + + Explicit elevation coordinate included with horizontal coordinates + 0.000100 + + + + + + + Rijksdriehoekstelsel_New + + + + + + + + + + + + + 0 + + + + + + + MOTOR_2WMOTOR_2W + Number11 + + + GemeentenFeature Class + 0 + + + ShapeShape + Geometry00 + 0Feature geometry. + ESRI + + Coordinates defining the features. + + + + GM_CODEGM_CODE + String16 + + + GM_NAAMGM_NAAM + String30 + + + POSTCODEPOSTCODE + String11 + + + DEK_PERCDEK_PERC + Float1911 + + + OPP_TOTOPP_TOT + Number9 + + + OPP_LANDOPP_LAND + Float1911 + + + OPP_WATEROPP_WATER + Float1911 + + + BEV_DICHTHBEV_DICHTH + Float1911 + + + AANT_INWAANT_INW + Float1911 + + + AANT_MANAANT_MAN + Float1911 + + + AANT_VROUWAANT_VROUW + Float1911 + + + P_0_14_JRP_0_14_JR + Float1911 + + + P_15_24_JRP_15_24_JR + Float1911 + + + P_25_44_JRP_25_44_JR + Float1911 + + + P_45_64_JRP_45_64_JR + Float1911 + + + P_65_EO_JRP_65_EO_JR + Float1911 + + + P_WEST_ALP_WEST_AL + Float1911 + + + P_N_W_ALP_N_W_AL + Float1911 + + + P_MARROKP_MARROK + Float1911 + + + P_ANT_ARUP_ANT_ARU + Float1911 + + + P_SURINAMP_SURINAM + Float1911 + + + P_TURKIJEP_TURKIJE + Float1911 + + + P_OVER_NWP_OVER_NW + Float1911 + + + AANTAL_HHAANTAL_HH + Float1911 + + + P_EENP_HHP_EENP_HH + Float1911 + + + P_HH_Z_KP_HH_Z_K + Float1911 + + + P_HH_M_KP_HH_M_K + Float1911 + + + GEM_HH_GRGEM_HH_GR + Float1911 + + + AUTO_TOTAUTO_TOT + Float1911 + + + AUTO_MUTAUTO_MUT + Float1911 + + + AUTO_HHAUTO_HH + Float1911 + + + AUTO_LANDAUTO_LAND + Float1911 + + + Shape_AreaShape_Area + Float19 + Area of feature in internal units squared.ESRI + + Positive real numbers that are automatically generated. + + 11 + + + BEDR_AUTOBEDR_AUTO + Float1911 + + + FIDFIDFloat + 19Internal feature number. + ESRI + + Sequential unique whole numbers that are automatically generated. + + 11 + + + Shape_LengShape_Leng + Float1911 + + + + 20090123 + + + + Metadata imported.C:\TEMP\metadata.xml + 20060810 + + + + \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Xsd/DamMStabDocDefinition.xsd =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Xsd/DamMStabDocDefinition.xsd (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Xsd/DamMStabDocDefinition.xsd (revision 3305) @@ -0,0 +1,65 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/Test/Services/ShapeFileReaderTest.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/Test/Services/ShapeFileReaderTest.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/Test/Services/ShapeFileReaderTest.cs (revision 3305) @@ -0,0 +1,121 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of the application DAM - UI. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Collections.Generic; +using System.Linq; + +using NUnit.Framework; + +namespace Deltares.Maps.Tests.Services +{ + [TestFixture] + public class ShapeFileReaderTest + { + private ShapeFileReader reader; + private ShapeFileLocation testFileLocation; + + #region Setup + + [TestFixtureSetUp] + public void FixtureSetup() + { + testFileLocation = new ShapeFileLocation(@"TestData\Gemeenten.shp"); + } + + [TestFixtureTearDown] + public void FixtureTearDown() + { + } + + [SetUp] + public void TestSetup() + { + reader = new ShapeFileReader(testFileLocation); + } + + [TearDown] + public void TestTearDown() + { + } + + #endregion + + [Test] + public void ReadShapeFile_ReadAttributeData_MaterializedFeatures() + { + reader.IgnoreAttributeData = false; // default + IEnumerable geoms = reader.Read(); + + Assert.IsNotNull(geoms); + Assert.IsTrue(geoms.Count() > 0); + foreach (IFeature geom in geoms) + { + Assert.IsNotNull(geom.Geometry); + Assert.IsNotNull(geom.WktFormat); + Assert.IsNotNull(geom.Attributes); + Assert.IsTrue(geom.Attributes.Count > 0); + Assert.IsNotNull(geom.Attributes.GetNames()); + Assert.IsTrue(geom.Attributes.GetNames().Count() > 0); + Assert.IsNotNull(geom.Attributes.GetValues()); + Assert.IsTrue(geom.Attributes.GetValues().Count() > 0); + } + } + + [Test] + public void ReadShapeFile_IgnoringAttributeData_MaterializedFeatures() + { + reader.IgnoreAttributeData = true; + IEnumerable geoms = reader.Read(); + Assert.IsNotNull(geoms); + Assert.IsTrue(geoms.Count() > 0); + foreach (IFeature geom in geoms) + { + Assert.IsNotNull(geom.Geometry); + Assert.IsNotNull(geom.WktFormat); + Assert.IsNotNull(geom.Attributes); + Assert.AreEqual(0, geom.Attributes.Count); + } + } + + [Test] + public void ReadShapeFile_DutchCulture_MaterializedFeatures() + { + Action action = + () => + { + reader.IgnoreAttributeData = true; + IEnumerable geoms = reader.Read(); + Assert.IsNotNull(geoms); + Assert.IsTrue(geoms.Count() > 0); + foreach (IFeature geom in geoms) + { + Assert.IsNotNull(geom.Geometry); + Assert.IsNotNull(geom.WktFormat); + Assert.IsNotNull(geom.Attributes); + Assert.AreEqual(0, geom.Attributes.Count); + } + }; + + CultureHelper.InvokeWithDutchCulture(action); + } + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/CsvImporters/CsvImporterSegments.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/CsvImporters/CsvImporterSegments.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/CsvImporters/CsvImporterSegments.cs (revision 3305) @@ -0,0 +1,169 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU 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.IO; +using System.Linq; +using System.Threading; +using Deltares.Standard.IO; +using Deltares.Standard.Language; +using LumenWorks.Framework.IO.Csv; + +namespace Deltares.Dam.Data.CsvImporters +{ + public class CsvImporterSegmentsException : ApplicationException + { + public CsvImporterSegmentsException(string message) + : base(message) + { + } + } + + public class CsvImporterSegments + { + private List segmentRecords = new List(); + private List errorMessages = new List(); + + public class SegmentRecord + { + public int SegmentRecordId { get; set; } + public string SegmentId { get; set; } + public string SoilProfileId { get; set; } + public double Probability { get; set; } + public FailureMechanismSystemType SegmentFailureMechanismType { get; set; } + public string SoilGeometry2DName { get; set; } + } + + private void CheckColumn(int index, string fileName, string fieldName) + { + if (index < 0) + { + var csvHeaderFieldError = LocalizationManager.GetTranslatedText(this.GetType(), "csvHeaderFieldError"); + throw new CsvImporterSegmentsException(String.Format("{0} : {1} {2}", fileName, csvHeaderFieldError, fieldName)); + } + } + + public CsvImporterSegments(string fileName) + { + errorMessages.Clear(); + ThrowHelper.ThrowIfStringArgumentNullOrEmpty(fileName, StringResourceNames.CsvFileNotValid); + ThrowHelper.ThrowIfFileNotExist(fileName, StringResourceNames.CsvFileNotFound); + + var oldcur = Thread.CurrentThread.CurrentCulture; + try + { + Thread.CurrentThread.CurrentCulture = CsvReaderUtilities.DetermineCultureForFile(fileName); + using (CsvReader csv = new CsvReader(new StreamReader(fileName), true, ';')) + { + string[] headers = CsvImporterHelper.GetFieldHeaders(this, csv); + if (headers.Count() != 4) + { + var csvHeaderError = LocalizationManager.GetTranslatedText(this.GetType(), "csvHeaderError"); + throw new CsvImporterSegmentsException(String.Format("{0} : {1}", fileName, csvHeaderError)); + } + + const string fieldsement_id = "segment_id"; + int colIndexSegmentId = CsvReaderUtilities.GetHeaderIndexByString(headers, fieldsement_id); + CheckColumn(colIndexSegmentId, fileName, fieldsement_id); + + const string fieldsoilprofile_id = "soilprofile_id"; + int colIndexSoilProfileId = CsvReaderUtilities.GetHeaderIndexByString(headers, fieldsoilprofile_id); + const string fieldsoilgeometry2D_name = "soilgeometry2D_name"; + int colIndexGeometry2dName = CsvReaderUtilities.GetHeaderIndexByString(headers, fieldsoilgeometry2D_name); + // soil profile and geometry2D are in bothe optional but at least one has to be there. + if ((colIndexSoilProfileId < 0) && (colIndexGeometry2dName < 0)) + { + var csvHeaderFieldError = LocalizationManager.GetTranslatedText(this.GetType(), "csvHeaderFieldError"); + throw new CsvImporterSoilProfilesException(String.Format("{0} : {1} {2} / {3}", fileName, csvHeaderFieldError, fieldsoilprofile_id, fieldsoilgeometry2D_name)); + } + const string fieldprobability = "probability"; + int colIndexProbability = CsvReaderUtilities.GetHeaderIndexByString(headers, fieldprobability); + CheckColumn(colIndexProbability, fileName, fieldprobability); + + const string fieldcalculation_type = "calculation_type"; + int colIndexCalculationType = CsvReaderUtilities.GetHeaderIndexByString(headers, fieldcalculation_type); + CheckColumn(colIndexCalculationType, fileName, fieldcalculation_type); + var index = 1; + while (csv.ReadNextRecord()) + { + SegmentRecord segment = new SegmentRecord(); + int colIndex = -1; // Keep track of column for error message + try + { + segment.SegmentId = csv[colIndexSegmentId]; + segment.SegmentRecordId = index; + index++; + if (colIndexSoilProfileId > -1) + { + colIndex = colIndexSoilProfileId; + segment.SoilProfileId = csv[colIndexSoilProfileId]; + } + if (colIndexGeometry2dName > -1) + { + colIndex = colIndexGeometry2dName; + segment.SoilGeometry2DName = csv[colIndexGeometry2dName]; + } + segment.Probability = Convert.ToDouble(csv[colIndexProbability]); + var typeAsString = csv[colIndexCalculationType]; + if (typeAsString == "Stability") + { + segment.SegmentFailureMechanismType = FailureMechanismSystemType.StabilityInside; + } + else if (typeAsString == "Piping") + { + segment.SegmentFailureMechanismType = FailureMechanismSystemType.Piping; + } + else + { + var csvSegmentCalculationTypeError = LocalizationManager.GetTranslatedText(this.GetType(), "csvSegmentCalculationTypeError"); + errorMessages.Add(String.Format("{0} : {1} {2}", fileName, segment.SegmentId, csvSegmentCalculationTypeError)); + } + + segmentRecords.Add(segment); + } + catch (Exception e) + { + var csvSegmentError = String.Format(LocalizationManager.GetTranslatedText(this.GetType(), "csvSegmentError"), segment.SegmentId, colIndex + 1); + errorMessages.Add(csvSegmentError + e.Message); + } + + } + } + } + finally + { + Thread.CurrentThread.CurrentCulture = oldcur; + } + } + + public List ImportedItems + { + get { return segmentRecords; } + } + + public List ErrorMessages + { + get { return errorMessages; } + set { errorMessages = value; } + } + } +} Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Specifications/SpecificationBase.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Specifications/SpecificationBase.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Specifications/SpecificationBase.cs (revision 3305) @@ -0,0 +1,72 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +namespace Deltares.Standard.Specifications +{ + /// + /// Abstract specification class that implements base properties + /// + /// The type of the candidate. + public abstract class SpecificationBase : ISpecification + { + protected SpecificationBase() + { + Name = this.GetType().Name; + } + + /// + /// Gets or sets the name of the specification. (Short description) + /// + /// + /// The name string value should be a required property for each specification. + /// + public string Name { get; set; } + + /// + /// Gets or sets the description of the specification. (Long description) + /// + /// + /// The description string value. + /// + public string Description { get; set; } + + /// + /// Determines whether the candidate satisfies the specification. + /// + /// The candidate to test. + /// + /// true if the candidate satisfies the specification otherwise, false. + /// + bool ISpecification.IsSatisfiedBy(object candidate) + { + return IsSatisfiedBy((TCandidate)candidate); + } + + /// + /// Determines whether the candidate satisfies the specification. + /// + /// The candidate to test. + /// + /// true if the candidate satisfies the specification otherwise, false. + /// + public abstract bool IsSatisfiedBy(TCandidate candidate); + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Geometry2DData.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Geometry2DData.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Geometry2DData.cs (revision 3305) @@ -0,0 +1,95 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System.Collections.Generic; +using System; +using Deltares.Standard.Extensions; + +namespace Deltares.Dam.Data +{ + + public struct Geometry2DLayer + { + public Geometry2DBoundaryLine boundaryLine; + public String soilName; + public LayerType layerType; + } + + public class Geometry2DDataException : ApplicationException + { + public Geometry2DDataException(string message): base(message) + { + } + } + + public class Geometry2DData + { + + private List layers = new List(); + private double tolerance = 0.0000000001; + + public Geometry2DData() + { + + } + + public int LayerCount { get { return layers.Count; } } + + public double Tolerance + { + get { return tolerance; } + set { tolerance = value; } + } + + public void AddLayer(Geometry2DLayer layer) + { + layers.Add(layer); + } + + public Geometry2DLayer GetLayer(int index) + { + return layers[index]; + } + + public void SetLayertype(int layerIndex, LayerType layerType) + { + Geometry2DLayer layer = layers[layerIndex]; + layer.layerType = layerType; + layers[layerIndex] = layer; + } + public void Validate() + { + if (layers.Count > 1) + { + double limitLeft = layers[0].boundaryLine.Points[0].X; + double limitRight = layers[0].boundaryLine.Points[layers[0].boundaryLine.Points.Count - 1].X; + foreach (Geometry2DLayer layer in layers) + { + if (!layer.boundaryLine.Points[0].X.AlmostEquals(limitLeft, tolerance) || + !layer.boundaryLine.Points[layer.boundaryLine.Points.Count - 1].X.AlmostEquals(limitRight, tolerance)) + { + throw new Geometry2DDataException("Boundary lines are not aligned"); + } + } + } + } + } +} Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/FileLocation.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/FileLocation.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/FileLocation.cs (revision 3305) @@ -0,0 +1,190 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU 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.IO; + +namespace Deltares.Maps +{ + public interface IFile + { + bool IsValid { get; } + string NameWithoutExtension { get; } + string FileName { get; } + string DirectoryName { get; } + string FullPath { get; } + } + + public abstract class FileLocation : IFile + { + const string TheGeometryFileIsNotValid = "The file is not valid"; + + private readonly string fullPath; + + /// + /// Create a file location with the current directory + /// + /// + /// + protected FileLocation(string fileName, string fileExtension) + : this(string.Empty, fileName, fileExtension) + { + } + + protected FileLocation(string fileLocation, string fileName, string fileExtension) + { + if (IsNullOrEmptyOrWhiteSpace(fileName)) + { + return; + } + + fullPath = fileName; + + if (IsNullOrEmptyOrWhiteSpace(fileExtension)) + { + return; + } + + if (!fileName.EndsWith(fileExtension)) + { + fileName += fileExtension; + } + + if (IsNullOrEmptyOrWhiteSpace(fileLocation) || fileLocation == "." || fileLocation == @".\") + { + fullPath = Path.Combine(Directory.GetCurrentDirectory(), fileName); + } + else + { + fullPath = Path.Combine(fileLocation, fileName); + } + } + + public bool IsValid + { + get { return HasValidData(FileName, FileExtension); } + } + + private static bool HasValidData(string fileName, string fileExtension) + { + if (IsNullOrEmptyOrWhiteSpace(fileExtension)) + { + return false; + } + + return !(IsNullOrEmptyOrWhiteSpace(fileName) || !fileName.EndsWith(fileExtension)); + } + + private static bool IsNullOrEmptyOrWhiteSpace(string value) + { + return string.IsNullOrEmpty(value) || value.Trim() == string.Empty; + } + + public bool Exists + { + get { return File.Exists(FullPath); } + } + + /// + /// Gets the name of the directory the file is contained in + /// + public string DirectoryName + { + get { return Path.GetDirectoryName(fullPath); } + } + + /// + /// Gets the file extension + /// + public string FileExtension + { + get { return Path.GetExtension(fullPath); } + } + + /// + /// Gets the name of the file without the path. Includes the extension + /// + public string FileName + { + get { return Path.GetFileName(fullPath); } + } + + /// + /// Gets the full path of the file (including the file name) + /// + // ReSharper disable ConvertToAutoPropertyWithPrivateSetter + public string FullPath + // ReSharper restore ConvertToAutoPropertyWithPrivateSetter + { + get { return fullPath; } + } + + /// + /// Gets the name of the file without extension and location + /// + public string NameWithoutExtension + { + get { return Path.GetFileNameWithoutExtension(fullPath); } + } + + public override string ToString() + { + return FullPath; + } + } + + public class ShapeFileLocation : FileLocation + { + public const string FileExtensionString = ".shp"; + + public ShapeFileLocation(string fileName) + : base(fileName, FileExtensionString) + { + } + + /// + /// + /// The location or folder of the file + /// The name of the file + public ShapeFileLocation(string fileLocation, string fileName) + : base(fileLocation, fileName, FileExtensionString) + { + } + } + + public class WktFileLocation : FileLocation + { + public const string FileExtensionString = ".wkt"; + + public WktFileLocation(string fileName) + : base(fileName, FileExtensionString) + { + } + + /// + /// + /// + /// + public WktFileLocation(string fileLocation, string fileName) + : base(fileLocation, fileName, FileExtensionString) + { + } + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/Test/TestData/Gemeenten.shx =================================================================== diff -u Binary files differ Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/Properties/AssemblyInfo.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/Properties/AssemblyInfo.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/Properties/AssemblyInfo.cs (revision 3305) @@ -0,0 +1,28 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU 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.Reflection; +using System.Runtime.InteropServices; + +[assembly: AssemblyTitle("Deltares.Maps")] +[assembly: ComVisible(false)] +[assembly: Guid("12d231d2-d46c-41ca-bc1d-b91e2986c4d5")] + Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/CsvExporter.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/CsvExporter.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/CsvExporter.cs (revision 3305) @@ -0,0 +1,146 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU 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.IO; +using System.Linq; +using System.Globalization; +using System.Reflection; + +namespace Deltares.Dam.Data +{ + + public class CsvExporter + { + private const string NullValue = "NULL"; + private const string Delimiter = ";"; + private readonly string fileName; + + private readonly IEnumerable data; + private string columnHeader; + private bool headerWritten; + + public CsvExporter(string fileName, IEnumerable data) + { + this.data = data; + ThrowHelper.ThrowWhenConditionIsTrue( + StringResourceNames.OutputFileNameNotValid, + () => string.IsNullOrEmpty(fileName) || fileName.Trim() == ""); + + this.fileName = fileName; + headerWritten = false; + WriteHeaderInFirstLine = true; + } + + public bool WriteHeaderInFirstLine { get; set; } + + public void WriteFile() + { + using (TextWriter writer = new StreamWriter(this.fileName, false)) + { + foreach (T dataItem in data) + { + string line = GetDataItemString(dataItem); + if (line.Trim() != "") + { + if (WriteHeaderInFirstLine && !headerWritten) + { + writer.WriteLine(columnHeader); + headerWritten = true; + } + + writer.WriteLine(line); + } + else + { + writer.WriteLine("No (public) properties are annotated with the column meta data CsvColumnAttribute."); + } + } + } + } + + private string GetDataItemString(T dataItem) + { + if (dataItem.Equals(default(T))) + throw new CsvExporterException("Invalid export data item"); + + var header = new Dictionary(); + var table = new Dictionary(); + + string line = ""; + foreach (var pInfo in (typeof(T).GetProperties())) + { + foreach (Attribute attribute in pInfo.GetCustomAttributes(true)) + { + var attr = attribute as CsvExportColumnAttribute; + if (null != attr) + { + ThrowWhenIndexAlreadyExists(header, attr.Index, pInfo.Name); + + header.Add(attr.Index, attr.Name); + object value; + try + { + value = pInfo.GetValue(dataItem, null) ?? NullValue; + } + catch (TargetInvocationException) + { + value = NullValue; + } + table.Add(attr.Index, value); + } + } + } + + // assemble the data line + if (table.Count > 0) + { + // order the keys by column index + var keys = table.Keys.OrderBy(k => k); + var counter = 0; + foreach (var index in keys) + { + var val = string.Format(CultureInfo.InvariantCulture, "{0}", table[index]); + line += val + (++counter < table.Count ? Delimiter : ""); + } + + // assemble the column header + if (WriteHeaderInFirstLine && string.IsNullOrEmpty(columnHeader)) + { + counter = 0; + foreach (var index in keys) + columnHeader += header[index] + (++counter < table.Count ? Delimiter : ""); + } + } + + return line; + } + + private static void ThrowWhenIndexAlreadyExists(IDictionary dictionary, int index, string propertyName) + { + string message = string.Format(ThrowHelper.GetResourceString(StringResourceNames.CsvColumnIndexAlreadyExists), index, propertyName); + ThrowHelper.ThrowWhenConditionIsTrue( + message, + () => dictionary.ContainsKey(index)); + } + } +} Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Specifications/Extensions/SpecificationExtensions.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Specifications/Extensions/SpecificationExtensions.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Specifications/Extensions/SpecificationExtensions.cs (revision 3305) @@ -0,0 +1,143 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using Deltares.Standard.Validation; +using ValidationResult = Deltares.Dam.Data.Specifications.ValidationResult; + +namespace Deltares.Standard.Specifications.Extensions +{ + public static class SpecificationExtensions + { + public static IEnumerable GetBySpecification(this IEnumerable collection, ISpecification specification) + { + return collection.Where(specification.IsSatisfiedBy); + } + + public static bool IsSatisfiedBySpecification(this T source, ISpecification specification) + { + return specification.IsSatisfiedBy(source); + } + + public static bool IsNotSatisfiedBySpecification(this T source, ISpecification specification) + { + return !IsSatisfiedBySpecification(source, specification); + } + + public static IEnumerable Validate(this T source, string groupName) + { + throw new NotImplementedException(); + } + + public static IEnumerable Validate(this T source) + { + var validationResults = new List(); + + foreach (var attribute in source.GetType().GetCustomAttributes(false)) + { + var specAttr = attribute as SpecificationBaseAttribute; + if (specAttr != null) + { + if (IsNotSatisfiedBySpecification(source, (ISpecification)specAttr.Specification)) + AddValidationResult(source, validationResults, specAttr); + } + } + + foreach (PropertyInfo property in source.GetType().GetProperties()) + { + foreach (object attribute in property.GetCustomAttributes(true)) + { + var specAttr = attribute as SpecificationBaseAttribute; + if (specAttr != null) + { + object candidateValue = property.GetValue(source, null); + if (!specAttr.Specification.IsSatisfiedBy(candidateValue)) + AddValidationResult(property, validationResults, specAttr); + } + else + { + var minAttr = attribute as MinimumAttribute; + if (minAttr != null) + { + var gte = + new GreaterThanOrEqualToSpecification(property.Name, minAttr.AttributeValue); + if (!gte.IsSatisfiedBy(source)) + { + validationResults.Add(new ValidationResult() + { + Subject = property, + MessageType = ValidationResultType.Error, + Error = new ValidationException(string.Format("The property or field {0} has the value {1} which is less then the specification {2}", + property.Name, gte.CandidateValue, minAttr.AttributeValue)) + }); + } + } + else + { + var maxAttr = attribute as MaximumAttribute; + if (maxAttr != null) + { + var lte = + new LessThanOrEqualToSpecification(property.Name, maxAttr.AttributeValue); + if (!lte.IsSatisfiedBy(source)) + { + validationResults.Add(new ValidationResult() + { + Subject = property, + MessageType = ValidationResultType.Error, + Error = new ValidationException(string.Format("The property or field {0} has the value {1} which is greater then the specification {2}", + property.Name, lte.CandidateValue, maxAttr.AttributeValue)) + }); + } + } + } + } + } + } + + return validationResults; + } + + private static void AddValidationResult(object subject, ICollection validationResults, SpecificationBaseAttribute specAttr) + { + string message = specAttr.NotSatisfiedText; + + if (string.IsNullOrWhiteSpace(message)) + message = specAttr.Specification.Description; + + if (string.IsNullOrWhiteSpace(message)) + message = specAttr.Specification.Name; + + if (string.IsNullOrWhiteSpace(message)) + message = specAttr.Specification.ToString(); + + validationResults.Add(new ValidationResult() + { + Subject = subject, + MessageType = ValidationResultType.Error, + Error = new ValidationException(message) + }); + } + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DtoAssembler/DtoDocumentAssembler.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DtoAssembler/DtoDocumentAssembler.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DtoAssembler/DtoDocumentAssembler.cs (revision 3305) @@ -0,0 +1,189 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU 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.Linq; +using System.Reflection; +using System.Xml.Linq; +using Deltares.Standard.IO.DtoAssembler; + +namespace Deltares.Standard +{ + /// + /// Default implementation for the interface + /// + /// + /// This base class inherits from this class just fixes + /// the dto type to XElement + /// + /// The domain object type + public abstract class DtoDocumentAssembler : IDtoAssembler + where TDomainInputObject : new() + where TDomainOutputObject : new() + { + /// + /// Initializes a new instance of the DtoDocumentAssembler class + /// + /// Sets the element name + /// The text reader stream for reading in ther xsd file which is embedded as an resource + public DtoDocumentAssembler(string elementName, string elementNamespace, string embeddedXsdPath) + : this(elementName, elementNamespace, embeddedXsdPath, null, null) + { + } + + /// + /// Initializes a new instance of the DtoDocumentAssembler class + /// + /// Sets the element name + /// The text reader stream for reading in ther xsd file which is embedded as an resource + public DtoDocumentAssembler(string elementName, string elementNamespace, string embeddedXsdPath, + DtoAssembler inputAssembler, DtoAssembler outputAssembler) + { + if (elementName == null) + throw new ArgumentNullException("elementName"); + + if (elementNamespace == null) + throw new ArgumentNullException("elementNamespace"); + + this.ElementName = elementName; + this.ElementNamespace = elementNamespace; + this.OutputAssembler = outputAssembler; + this.InputAssembler = inputAssembler; + //Stream xsdStream = Common.GetEmbeddedFile(Assembly.GetExecutingAssembly(), embeddedXsdPath); + //this.Schema = XDocument.Load(new StreamReader(xsdStream)); + } + + /// + /// Gets the xml element name + /// + public string ElementName { get; private set; } + + /// + /// Gets or sets the namespace value for the element + /// + public string ElementNamespace { get; private set; } + + /// + /// Gets the xml schema (if any) + /// + public XDocument Schema { get; private set; } + + /// + /// + /// + public DtoAssembler InputAssembler { get; set; } + + /// + /// + /// + public DtoAssembler OutputAssembler { get; set; } + + #region IDtoAssembler Members + + public virtual TDomainOutputObject CreateOutputObject(XDocument dtoDocument) + { + if (dtoDocument == null) + throw new ArgumentNullException("dtoDocument"); + + if (this.OutputAssembler != null) + { + // the document should contain the element only once! + XElement el = (from x in dtoDocument.Descendants() + where x.Name.LocalName == this.OutputAssembler.ElementName + select x).Single(); + + return this.OutputAssembler.CreateDomainObject(el); + } + + return default(TDomainOutputObject); + } + + public virtual TDomainInputObject CreateInputObject(XDocument dtoDocument) + { + if (dtoDocument == null) + throw new ArgumentNullException("dtoDocument"); + + if (this.InputAssembler != null) + { + // the document should contain the element only once! + XElement el = (from x in dtoDocument.Descendants() + where x.Name.LocalName == this.InputAssembler.ElementName + select x).Single(); + + return this.InputAssembler.CreateDomainObject(el); + } + + return default(TDomainInputObject); + } + + public virtual XDocument CreateDataTransferObject(TDomainInputObject domainInputObj) + { + var doc = new XDocument(new XDeclaration("1.0", "utf-8", "yes")); + + // add the file identification to the document + var fileId = new FileIdentification(Assembly.GetCallingAssembly()); + var fileIdAssembler = new FileIdentificationAssembler(); + + XNamespace xsi = "http://www.w3.org/2001/XMLSchema-instance"; + + XNamespace tns = this.ElementNamespace; + XNamespace tns1 = fileIdAssembler.ElementNamespace; + + var root = new XElement(tns + this.ElementName, + new XAttribute(XNamespace.Xmlns + "xsi", xsi.NamespaceName), + new XAttribute(XNamespace.Xmlns + "tns", tns.NamespaceName), + new XAttribute(XNamespace.Xmlns + "tns1", tns1.NamespaceName)); + + doc.Add(root); + doc.Root.Add(fileId.ToDto(fileIdAssembler, tns)); + + if (this.InputAssembler != null) + { + XNamespace tns2 = this.InputAssembler.ElementNamespace; + root.Add(new XAttribute(XNamespace.Xmlns + "tns2", tns2.NamespaceName)); + doc.Root.Add(domainInputObj.ToDto(this.InputAssembler, tns)); + } + + return doc; + } + + #endregion + + public TDomainOutputObject CreateOutputObject(string fileName) + { + return this.CreateOutputObject(this.CreateDocument(fileName)); + } + + public TDomainInputObject CreateInputObject(string fileName) + { + return this.CreateInputObject(this.CreateDocument(fileName)); + } + + private XDocument CreateDocument(string fileName) + { + if (!fileName.HasValidStringValue()) + throw new ArgumentNullException("fileName"); + + XDocument doc = XDocument.Load(fileName); + return doc; + } + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/WaterBoardPostProcessRelativeProfiles.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/WaterBoardPostProcessRelativeProfiles.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/WaterBoardPostProcessRelativeProfiles.cs (revision 3305) @@ -0,0 +1,112 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU 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.Geotechnics.Soils; +using Deltares.Geotechnics.SurfaceLines; +using Deltares.Standard.Logging; + +namespace Deltares.Dam.Data +{ + public class WaterBoardPostProcessRelativeProfilesException : Exception + { + public WaterBoardPostProcessRelativeProfilesException(string message) + : base(message) + { + } + } + + public static class WaterBoardPostProcessRelativeProfiles + { + /// + /// Creates the absolute profiles based on the original profiles. + /// The original profiles are considered to be relative to the specified characteristic point + /// 1) Create a copy of the assigned segment for each location + /// 2) In the copy the toplevel of the soilprofile will be moved to the z-coordinate of the specified characteristic point + /// + /// The water board. + /// The characteristic point to which the soilprofile toplevel should be moved + public static void CreateAbsoluteProfiles(WaterBoard waterBoard, CharacteristicPointType characteristicPointType) + { + foreach (Dike dike in waterBoard.Dikes) + { + foreach (Location location in dike.Locations) + { + var orgSegment = location.Segment; + if (orgSegment != null) + { + var newSegment = new Segment(); + newSegment.Name = String.Format("Segment {0}", location.Name); + foreach (SoilGeometryProbability orgSoilGeometryProbability in orgSegment.SoilProfileProbabilities) + { + try + { + var characteristicGeometryPoint = location.SurfaceLine2.CharacteristicPoints.GetGeometryPoint(characteristicPointType); + if (characteristicGeometryPoint == null) + { + throw new WaterBoardPostProcessRelativeProfilesException(String.Format("Characteristic point {0} is not defined", characteristicPointType)); + } + if (orgSoilGeometryProbability.SoilProfileType.Equals(SoilProfileType.SoilGeometryStiFile)) + { + throw new WaterBoardPostProcessRelativeProfilesException("Cannnot apply releative profiles for 2d soilprofiles"); + } + + // Create a copy of the original SoilGeometryProbability + SoilGeometryProbability newSoilGeometryProbability = new SoilGeometryProbability(); + newSoilGeometryProbability.Assign(orgSoilGeometryProbability); + + // Move all layer boundaries so toplevel of the soilprofile1D will be at level of specified characteristic point + // Dependent if deltaZ is positive or negative, the bottomLevel should be adjusted before or after adjusting the layers + // This is necessary, because the bottomlevel is adjusted automatically during adjustment of layers + var soilProfile1D = newSoilGeometryProbability.SoilProfile; + double deltaZ = characteristicGeometryPoint.Z - soilProfile1D.TopLevel; + if (deltaZ < 0) + { + soilProfile1D.BottomLevel += deltaZ; + } + foreach (SoilLayer1D soilLayer1D in soilProfile1D.Layers) + { + soilLayer1D.TopLevel += deltaZ; + } + if (deltaZ > 0) + { + soilProfile1D.BottomLevel += deltaZ; + } + + // Add new SoilGeometryProbability to new segment and assign new segment to location + newSegment.SoilProfileProbabilities.Add(newSoilGeometryProbability); + location.Segment = newSegment; + waterBoard.Segments.Add(newSegment); + } + catch (Exception e) + { + LogManager.Messages.Add(new LogMessage(LogMessageType.Error, location, + String.Format("Error in location '{0}' applying relative height for soilprofile '{1}': {2} ", + location.Name, orgSoilGeometryProbability.SoilGeometryName, e.Message))); + } + } + } + } + } + + } + } +} Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Xsd/SoilProfileDataSet1.Designer.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Xsd/SoilProfileDataSet1.Designer.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Xsd/SoilProfileDataSet1.Designer.cs (revision 3305) @@ -0,0 +1,4349 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU 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. + +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +#pragma warning disable 1591 + +namespace Deltares.Dam.Data.Xsd { + + + /// + ///Represents a strongly typed in-memory cache of data. + /// + [global::System.Serializable()] + [global::System.ComponentModel.DesignerCategoryAttribute("code")] + [global::System.ComponentModel.ToolboxItem(true)] + [global::System.Xml.Serialization.XmlSchemaProviderAttribute("GetTypedDataSetSchema")] + [global::System.Xml.Serialization.XmlRootAttribute("SoilProfileDataSet")] + [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.DataSet")] + public partial class SoilProfileDataSet : global::System.Data.DataSet { + + private ODGEOMETRIESDataTable tableODGEOMETRIES; + + private ODGEOLAYERSDataTable tableODGEOLAYERS; + + private MATERIALSDataTable tableMATERIALS; + + private PARAMETERNAMESDataTable tablePARAMETERNAMES; + + private PARAMETERVALUESDataTable tablePARAMETERVALUES; + + private global::System.Data.DataRelation relationODGEOMETRIES_ODGEOLAYERS; + + private global::System.Data.DataRelation relationODGEOLAYERS_MATERIALS; + + private global::System.Data.DataRelation relationPARAMETERVALUES_MATERIALS; + + private global::System.Data.DataRelation relationPARAMETERNAMES_PARAMETERVALUES; + + private global::System.Data.SchemaSerializationMode _schemaSerializationMode = global::System.Data.SchemaSerializationMode.IncludeSchema; + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public SoilProfileDataSet() { + this.BeginInit(); + this.InitClass(); + global::System.ComponentModel.CollectionChangeEventHandler schemaChangedHandler = new global::System.ComponentModel.CollectionChangeEventHandler(this.SchemaChanged); + base.Tables.CollectionChanged += schemaChangedHandler; + base.Relations.CollectionChanged += schemaChangedHandler; + this.EndInit(); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + protected SoilProfileDataSet(global::System.Runtime.Serialization.SerializationInfo info, global::System.Runtime.Serialization.StreamingContext context) : + base(info, context, false) { + if ((this.IsBinarySerialized(info, context) == true)) { + this.InitVars(false); + global::System.ComponentModel.CollectionChangeEventHandler schemaChangedHandler1 = new global::System.ComponentModel.CollectionChangeEventHandler(this.SchemaChanged); + this.Tables.CollectionChanged += schemaChangedHandler1; + this.Relations.CollectionChanged += schemaChangedHandler1; + return; + } + string strSchema = ((string)(info.GetValue("XmlSchema", typeof(string)))); + if ((this.DetermineSchemaSerializationMode(info, context) == global::System.Data.SchemaSerializationMode.IncludeSchema)) { + global::System.Data.DataSet ds = new global::System.Data.DataSet(); + ds.ReadXmlSchema(new global::System.Xml.XmlTextReader(new global::System.IO.StringReader(strSchema))); + if ((ds.Tables["ODGEOMETRIES"] != null)) { + base.Tables.Add(new ODGEOMETRIESDataTable(ds.Tables["ODGEOMETRIES"])); + } + if ((ds.Tables["ODGEOLAYERS"] != null)) { + base.Tables.Add(new ODGEOLAYERSDataTable(ds.Tables["ODGEOLAYERS"])); + } + if ((ds.Tables["MATERIALS"] != null)) { + base.Tables.Add(new MATERIALSDataTable(ds.Tables["MATERIALS"])); + } + if ((ds.Tables["PARAMETERNAMES"] != null)) { + base.Tables.Add(new PARAMETERNAMESDataTable(ds.Tables["PARAMETERNAMES"])); + } + if ((ds.Tables["PARAMETERVALUES"] != null)) { + base.Tables.Add(new PARAMETERVALUESDataTable(ds.Tables["PARAMETERVALUES"])); + } + this.DataSetName = ds.DataSetName; + this.Prefix = ds.Prefix; + this.Namespace = ds.Namespace; + this.Locale = ds.Locale; + this.CaseSensitive = ds.CaseSensitive; + this.EnforceConstraints = ds.EnforceConstraints; + this.Merge(ds, false, global::System.Data.MissingSchemaAction.Add); + this.InitVars(); + } + else { + this.ReadXmlSchema(new global::System.Xml.XmlTextReader(new global::System.IO.StringReader(strSchema))); + } + this.GetSerializationData(info, context); + global::System.ComponentModel.CollectionChangeEventHandler schemaChangedHandler = new global::System.ComponentModel.CollectionChangeEventHandler(this.SchemaChanged); + base.Tables.CollectionChanged += schemaChangedHandler; + this.Relations.CollectionChanged += schemaChangedHandler; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + [global::System.ComponentModel.Browsable(false)] + [global::System.ComponentModel.DesignerSerializationVisibility(global::System.ComponentModel.DesignerSerializationVisibility.Content)] + public ODGEOMETRIESDataTable ODGEOMETRIES { + get { + return this.tableODGEOMETRIES; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + [global::System.ComponentModel.Browsable(false)] + [global::System.ComponentModel.DesignerSerializationVisibility(global::System.ComponentModel.DesignerSerializationVisibility.Content)] + public ODGEOLAYERSDataTable ODGEOLAYERS { + get { + return this.tableODGEOLAYERS; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + [global::System.ComponentModel.Browsable(false)] + [global::System.ComponentModel.DesignerSerializationVisibility(global::System.ComponentModel.DesignerSerializationVisibility.Content)] + public MATERIALSDataTable MATERIALS { + get { + return this.tableMATERIALS; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + [global::System.ComponentModel.Browsable(false)] + [global::System.ComponentModel.DesignerSerializationVisibility(global::System.ComponentModel.DesignerSerializationVisibility.Content)] + public PARAMETERNAMESDataTable PARAMETERNAMES { + get { + return this.tablePARAMETERNAMES; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + [global::System.ComponentModel.Browsable(false)] + [global::System.ComponentModel.DesignerSerializationVisibility(global::System.ComponentModel.DesignerSerializationVisibility.Content)] + public PARAMETERVALUESDataTable PARAMETERVALUES { + get { + return this.tablePARAMETERVALUES; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + [global::System.ComponentModel.BrowsableAttribute(true)] + [global::System.ComponentModel.DesignerSerializationVisibilityAttribute(global::System.ComponentModel.DesignerSerializationVisibility.Visible)] + public override global::System.Data.SchemaSerializationMode SchemaSerializationMode { + get { + return this._schemaSerializationMode; + } + set { + this._schemaSerializationMode = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + [global::System.ComponentModel.DesignerSerializationVisibilityAttribute(global::System.ComponentModel.DesignerSerializationVisibility.Hidden)] + public new global::System.Data.DataTableCollection Tables { + get { + return base.Tables; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + [global::System.ComponentModel.DesignerSerializationVisibilityAttribute(global::System.ComponentModel.DesignerSerializationVisibility.Hidden)] + public new global::System.Data.DataRelationCollection Relations { + get { + return base.Relations; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + protected override void InitializeDerivedDataSet() { + this.BeginInit(); + this.InitClass(); + this.EndInit(); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public override global::System.Data.DataSet Clone() { + SoilProfileDataSet cln = ((SoilProfileDataSet)(base.Clone())); + cln.InitVars(); + cln.SchemaSerializationMode = this.SchemaSerializationMode; + return cln; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + protected override bool ShouldSerializeTables() { + return false; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + protected override bool ShouldSerializeRelations() { + return false; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + protected override void ReadXmlSerializable(global::System.Xml.XmlReader reader) { + if ((this.DetermineSchemaSerializationMode(reader) == global::System.Data.SchemaSerializationMode.IncludeSchema)) { + this.Reset(); + global::System.Data.DataSet ds = new global::System.Data.DataSet(); + ds.ReadXml(reader); + if ((ds.Tables["ODGEOMETRIES"] != null)) { + base.Tables.Add(new ODGEOMETRIESDataTable(ds.Tables["ODGEOMETRIES"])); + } + if ((ds.Tables["ODGEOLAYERS"] != null)) { + base.Tables.Add(new ODGEOLAYERSDataTable(ds.Tables["ODGEOLAYERS"])); + } + if ((ds.Tables["MATERIALS"] != null)) { + base.Tables.Add(new MATERIALSDataTable(ds.Tables["MATERIALS"])); + } + if ((ds.Tables["PARAMETERNAMES"] != null)) { + base.Tables.Add(new PARAMETERNAMESDataTable(ds.Tables["PARAMETERNAMES"])); + } + if ((ds.Tables["PARAMETERVALUES"] != null)) { + base.Tables.Add(new PARAMETERVALUESDataTable(ds.Tables["PARAMETERVALUES"])); + } + this.DataSetName = ds.DataSetName; + this.Prefix = ds.Prefix; + this.Namespace = ds.Namespace; + this.Locale = ds.Locale; + this.CaseSensitive = ds.CaseSensitive; + this.EnforceConstraints = ds.EnforceConstraints; + this.Merge(ds, false, global::System.Data.MissingSchemaAction.Add); + this.InitVars(); + } + else { + this.ReadXml(reader); + this.InitVars(); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + protected override global::System.Xml.Schema.XmlSchema GetSchemaSerializable() { + global::System.IO.MemoryStream stream = new global::System.IO.MemoryStream(); + this.WriteXmlSchema(new global::System.Xml.XmlTextWriter(stream, null)); + stream.Position = 0; + return global::System.Xml.Schema.XmlSchema.Read(new global::System.Xml.XmlTextReader(stream), null); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + internal void InitVars() { + this.InitVars(true); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + internal void InitVars(bool initTable) { + this.tableODGEOMETRIES = ((ODGEOMETRIESDataTable)(base.Tables["ODGEOMETRIES"])); + if ((initTable == true)) { + if ((this.tableODGEOMETRIES != null)) { + this.tableODGEOMETRIES.InitVars(); + } + } + this.tableODGEOLAYERS = ((ODGEOLAYERSDataTable)(base.Tables["ODGEOLAYERS"])); + if ((initTable == true)) { + if ((this.tableODGEOLAYERS != null)) { + this.tableODGEOLAYERS.InitVars(); + } + } + this.tableMATERIALS = ((MATERIALSDataTable)(base.Tables["MATERIALS"])); + if ((initTable == true)) { + if ((this.tableMATERIALS != null)) { + this.tableMATERIALS.InitVars(); + } + } + this.tablePARAMETERNAMES = ((PARAMETERNAMESDataTable)(base.Tables["PARAMETERNAMES"])); + if ((initTable == true)) { + if ((this.tablePARAMETERNAMES != null)) { + this.tablePARAMETERNAMES.InitVars(); + } + } + this.tablePARAMETERVALUES = ((PARAMETERVALUESDataTable)(base.Tables["PARAMETERVALUES"])); + if ((initTable == true)) { + if ((this.tablePARAMETERVALUES != null)) { + this.tablePARAMETERVALUES.InitVars(); + } + } + this.relationODGEOMETRIES_ODGEOLAYERS = this.Relations["ODGEOMETRIES_ODGEOLAYERS"]; + this.relationODGEOLAYERS_MATERIALS = this.Relations["ODGEOLAYERS_MATERIALS"]; + this.relationPARAMETERVALUES_MATERIALS = this.Relations["PARAMETERVALUES_MATERIALS"]; + this.relationPARAMETERNAMES_PARAMETERVALUES = this.Relations["PARAMETERNAMES_PARAMETERVALUES"]; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + private void InitClass() { + this.DataSetName = "SoilProfileDataSet"; + this.Prefix = ""; + this.Namespace = "http://tempuri.org/DataSet1.xsd"; + this.EnforceConstraints = true; + this.SchemaSerializationMode = global::System.Data.SchemaSerializationMode.IncludeSchema; + this.tableODGEOMETRIES = new ODGEOMETRIESDataTable(); + base.Tables.Add(this.tableODGEOMETRIES); + this.tableODGEOLAYERS = new ODGEOLAYERSDataTable(); + base.Tables.Add(this.tableODGEOLAYERS); + this.tableMATERIALS = new MATERIALSDataTable(); + base.Tables.Add(this.tableMATERIALS); + this.tablePARAMETERNAMES = new PARAMETERNAMESDataTable(); + base.Tables.Add(this.tablePARAMETERNAMES); + this.tablePARAMETERVALUES = new PARAMETERVALUESDataTable(); + base.Tables.Add(this.tablePARAMETERVALUES); + this.relationODGEOMETRIES_ODGEOLAYERS = new global::System.Data.DataRelation("ODGEOMETRIES_ODGEOLAYERS", new global::System.Data.DataColumn[] { + this.tableODGEOMETRIES.OD_NRColumn}, new global::System.Data.DataColumn[] { + this.tableODGEOLAYERS.OD_NRColumn}, false); + this.Relations.Add(this.relationODGEOMETRIES_ODGEOLAYERS); + this.relationODGEOLAYERS_MATERIALS = new global::System.Data.DataRelation("ODGEOLAYERS_MATERIALS", new global::System.Data.DataColumn[] { + this.tableMATERIALS.MA_NRColumn}, new global::System.Data.DataColumn[] { + this.tableODGEOLAYERS.MA_NRColumn}, false); + this.Relations.Add(this.relationODGEOLAYERS_MATERIALS); + this.relationPARAMETERVALUES_MATERIALS = new global::System.Data.DataRelation("PARAMETERVALUES_MATERIALS", new global::System.Data.DataColumn[] { + this.tableMATERIALS.MA_NRColumn}, new global::System.Data.DataColumn[] { + this.tablePARAMETERVALUES.MA_NRColumn}, false); + this.Relations.Add(this.relationPARAMETERVALUES_MATERIALS); + this.relationPARAMETERNAMES_PARAMETERVALUES = new global::System.Data.DataRelation("PARAMETERNAMES_PARAMETERVALUES", new global::System.Data.DataColumn[] { + this.tablePARAMETERNAMES.PN_NRColumn}, new global::System.Data.DataColumn[] { + this.tablePARAMETERVALUES.PN_NRColumn}, false); + this.Relations.Add(this.relationPARAMETERNAMES_PARAMETERVALUES); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + private bool ShouldSerializeODGEOMETRIES() { + return false; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + private bool ShouldSerializeODGEOLAYERS() { + return false; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + private bool ShouldSerializeMATERIALS() { + return false; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + private bool ShouldSerializePARAMETERNAMES() { + return false; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + private bool ShouldSerializePARAMETERVALUES() { + return false; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + private void SchemaChanged(object sender, global::System.ComponentModel.CollectionChangeEventArgs e) { + if ((e.Action == global::System.ComponentModel.CollectionChangeAction.Remove)) { + this.InitVars(); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedDataSetSchema(global::System.Xml.Schema.XmlSchemaSet xs) { + SoilProfileDataSet ds = new SoilProfileDataSet(); + global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType(); + global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence(); + global::System.Xml.Schema.XmlSchemaAny any = new global::System.Xml.Schema.XmlSchemaAny(); + any.Namespace = ds.Namespace; + sequence.Items.Add(any); + type.Particle = sequence; + global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable(); + if (xs.Contains(dsSchema.TargetNamespace)) { + global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream(); + global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream(); + try { + global::System.Xml.Schema.XmlSchema schema = null; + dsSchema.Write(s1); + for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext(); ) { + schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current)); + s2.SetLength(0); + schema.Write(s2); + if ((s1.Length == s2.Length)) { + s1.Position = 0; + s2.Position = 0; + for (; ((s1.Position != s1.Length) + && (s1.ReadByte() == s2.ReadByte())); ) { + ; + } + if ((s1.Position == s1.Length)) { + return type; + } + } + } + } + finally { + if ((s1 != null)) { + s1.Close(); + } + if ((s2 != null)) { + s2.Close(); + } + } + } + xs.Add(dsSchema); + return type; + } + + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public delegate void ODGEOMETRIESRowChangeEventHandler(object sender, ODGEOMETRIESRowChangeEvent e); + + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public delegate void ODGEOLAYERSRowChangeEventHandler(object sender, ODGEOLAYERSRowChangeEvent e); + + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public delegate void MATERIALSRowChangeEventHandler(object sender, MATERIALSRowChangeEvent e); + + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public delegate void PARAMETERNAMESRowChangeEventHandler(object sender, PARAMETERNAMESRowChangeEvent e); + + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public delegate void PARAMETERVALUESRowChangeEventHandler(object sender, PARAMETERVALUESRowChangeEvent e); + + /// + ///Represents the strongly named DataTable class. + /// + [global::System.Serializable()] + [global::System.Xml.Serialization.XmlSchemaProviderAttribute("GetTypedTableSchema")] + public partial class ODGEOMETRIESDataTable : global::System.Data.TypedTableBase { + + private global::System.Data.DataColumn columnOD_NR; + + private global::System.Data.DataColumn columnOD_NAME; + + private global::System.Data.DataColumn columnOD_DESCR; + + private global::System.Data.DataColumn columnOD_RDX; + + private global::System.Data.DataColumn columnOD_RDY; + + private global::System.Data.DataColumn columnOD_CPTNR; + + private global::System.Data.DataColumn columnOD_BORINGNR; + + private global::System.Data.DataColumn columnOD_GEOL_ZONE; + + private global::System.Data.DataColumn columnOD_CHANCE_OCCUR; + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public ODGEOMETRIESDataTable() { + this.TableName = "ODGEOMETRIES"; + this.BeginInit(); + this.InitClass(); + this.EndInit(); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + internal ODGEOMETRIESDataTable(global::System.Data.DataTable table) { + this.TableName = table.TableName; + if ((table.CaseSensitive != table.DataSet.CaseSensitive)) { + this.CaseSensitive = table.CaseSensitive; + } + if ((table.Locale.ToString() != table.DataSet.Locale.ToString())) { + this.Locale = table.Locale; + } + if ((table.Namespace != table.DataSet.Namespace)) { + this.Namespace = table.Namespace; + } + this.Prefix = table.Prefix; + this.MinimumCapacity = table.MinimumCapacity; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + protected ODGEOMETRIESDataTable(global::System.Runtime.Serialization.SerializationInfo info, global::System.Runtime.Serialization.StreamingContext context) : + base(info, context) { + this.InitVars(); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public global::System.Data.DataColumn OD_NRColumn { + get { + return this.columnOD_NR; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public global::System.Data.DataColumn OD_NAMEColumn { + get { + return this.columnOD_NAME; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public global::System.Data.DataColumn OD_DESCRColumn { + get { + return this.columnOD_DESCR; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public global::System.Data.DataColumn OD_RDXColumn { + get { + return this.columnOD_RDX; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public global::System.Data.DataColumn OD_RDYColumn { + get { + return this.columnOD_RDY; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public global::System.Data.DataColumn OD_CPTNRColumn { + get { + return this.columnOD_CPTNR; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public global::System.Data.DataColumn OD_BORINGNRColumn { + get { + return this.columnOD_BORINGNR; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public global::System.Data.DataColumn OD_GEOL_ZONEColumn { + get { + return this.columnOD_GEOL_ZONE; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public global::System.Data.DataColumn OD_CHANCE_OCCURColumn { + get { + return this.columnOD_CHANCE_OCCUR; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + [global::System.ComponentModel.Browsable(false)] + public int Count { + get { + return this.Rows.Count; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public ODGEOMETRIESRow this[int index] { + get { + return ((ODGEOMETRIESRow)(this.Rows[index])); + } + } + + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public event ODGEOMETRIESRowChangeEventHandler ODGEOMETRIESRowChanging; + + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public event ODGEOMETRIESRowChangeEventHandler ODGEOMETRIESRowChanged; + + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public event ODGEOMETRIESRowChangeEventHandler ODGEOMETRIESRowDeleting; + + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public event ODGEOMETRIESRowChangeEventHandler ODGEOMETRIESRowDeleted; + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public void AddODGEOMETRIESRow(ODGEOMETRIESRow row) { + this.Rows.Add(row); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public ODGEOMETRIESRow AddODGEOMETRIESRow(string OD_NAME, string OD_DESCR, double OD_RDX, double OD_RDY, int OD_CPTNR, int OD_BORINGNR, int OD_GEOL_ZONE, double OD_CHANCE_OCCUR) { + ODGEOMETRIESRow rowODGEOMETRIESRow = ((ODGEOMETRIESRow)(this.NewRow())); + object[] columnValuesArray = new object[] { + null, + OD_NAME, + OD_DESCR, + OD_RDX, + OD_RDY, + OD_CPTNR, + OD_BORINGNR, + OD_GEOL_ZONE, + OD_CHANCE_OCCUR}; + rowODGEOMETRIESRow.ItemArray = columnValuesArray; + this.Rows.Add(rowODGEOMETRIESRow); + return rowODGEOMETRIESRow; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public ODGEOMETRIESRow FindByOD_NR(int OD_NR) { + return ((ODGEOMETRIESRow)(this.Rows.Find(new object[] { + OD_NR}))); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public override global::System.Data.DataTable Clone() { + ODGEOMETRIESDataTable cln = ((ODGEOMETRIESDataTable)(base.Clone())); + cln.InitVars(); + return cln; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + protected override global::System.Data.DataTable CreateInstance() { + return new ODGEOMETRIESDataTable(); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + internal void InitVars() { + this.columnOD_NR = base.Columns["OD_NR"]; + this.columnOD_NAME = base.Columns["OD_NAME"]; + this.columnOD_DESCR = base.Columns["OD_DESCR"]; + this.columnOD_RDX = base.Columns["OD_RDX"]; + this.columnOD_RDY = base.Columns["OD_RDY"]; + this.columnOD_CPTNR = base.Columns["OD_CPTNR"]; + this.columnOD_BORINGNR = base.Columns["OD_BORINGNR"]; + this.columnOD_GEOL_ZONE = base.Columns["OD_GEOL_ZONE"]; + this.columnOD_CHANCE_OCCUR = base.Columns["OD_CHANCE_OCCUR"]; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + private void InitClass() { + this.columnOD_NR = new global::System.Data.DataColumn("OD_NR", typeof(int), null, global::System.Data.MappingType.Element); + base.Columns.Add(this.columnOD_NR); + this.columnOD_NAME = new global::System.Data.DataColumn("OD_NAME", typeof(string), null, global::System.Data.MappingType.Element); + base.Columns.Add(this.columnOD_NAME); + this.columnOD_DESCR = new global::System.Data.DataColumn("OD_DESCR", typeof(string), null, global::System.Data.MappingType.Element); + base.Columns.Add(this.columnOD_DESCR); + this.columnOD_RDX = new global::System.Data.DataColumn("OD_RDX", typeof(double), null, global::System.Data.MappingType.Element); + base.Columns.Add(this.columnOD_RDX); + this.columnOD_RDY = new global::System.Data.DataColumn("OD_RDY", typeof(double), null, global::System.Data.MappingType.Element); + base.Columns.Add(this.columnOD_RDY); + this.columnOD_CPTNR = new global::System.Data.DataColumn("OD_CPTNR", typeof(int), null, global::System.Data.MappingType.Element); + base.Columns.Add(this.columnOD_CPTNR); + this.columnOD_BORINGNR = new global::System.Data.DataColumn("OD_BORINGNR", typeof(int), null, global::System.Data.MappingType.Element); + base.Columns.Add(this.columnOD_BORINGNR); + this.columnOD_GEOL_ZONE = new global::System.Data.DataColumn("OD_GEOL_ZONE", typeof(int), null, global::System.Data.MappingType.Element); + base.Columns.Add(this.columnOD_GEOL_ZONE); + this.columnOD_CHANCE_OCCUR = new global::System.Data.DataColumn("OD_CHANCE_OCCUR", typeof(double), null, global::System.Data.MappingType.Element); + base.Columns.Add(this.columnOD_CHANCE_OCCUR); + this.Constraints.Add(new global::System.Data.UniqueConstraint("Constraint1", new global::System.Data.DataColumn[] { + this.columnOD_NR}, true)); + this.columnOD_NR.AutoIncrement = true; + this.columnOD_NR.AutoIncrementSeed = -1; + this.columnOD_NR.AutoIncrementStep = -1; + this.columnOD_NR.AllowDBNull = false; + this.columnOD_NR.ReadOnly = true; + this.columnOD_NR.Unique = true; + this.columnOD_NAME.MaxLength = 64; + this.columnOD_DESCR.MaxLength = 240; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public ODGEOMETRIESRow NewODGEOMETRIESRow() { + return ((ODGEOMETRIESRow)(this.NewRow())); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + protected override global::System.Data.DataRow NewRowFromBuilder(global::System.Data.DataRowBuilder builder) { + return new ODGEOMETRIESRow(builder); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + protected override global::System.Type GetRowType() { + return typeof(ODGEOMETRIESRow); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + protected override void OnRowChanged(global::System.Data.DataRowChangeEventArgs e) { + base.OnRowChanged(e); + if ((this.ODGEOMETRIESRowChanged != null)) { + this.ODGEOMETRIESRowChanged(this, new ODGEOMETRIESRowChangeEvent(((ODGEOMETRIESRow)(e.Row)), e.Action)); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + protected override void OnRowChanging(global::System.Data.DataRowChangeEventArgs e) { + base.OnRowChanging(e); + if ((this.ODGEOMETRIESRowChanging != null)) { + this.ODGEOMETRIESRowChanging(this, new ODGEOMETRIESRowChangeEvent(((ODGEOMETRIESRow)(e.Row)), e.Action)); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + protected override void OnRowDeleted(global::System.Data.DataRowChangeEventArgs e) { + base.OnRowDeleted(e); + if ((this.ODGEOMETRIESRowDeleted != null)) { + this.ODGEOMETRIESRowDeleted(this, new ODGEOMETRIESRowChangeEvent(((ODGEOMETRIESRow)(e.Row)), e.Action)); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + protected override void OnRowDeleting(global::System.Data.DataRowChangeEventArgs e) { + base.OnRowDeleting(e); + if ((this.ODGEOMETRIESRowDeleting != null)) { + this.ODGEOMETRIESRowDeleting(this, new ODGEOMETRIESRowChangeEvent(((ODGEOMETRIESRow)(e.Row)), e.Action)); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public void RemoveODGEOMETRIESRow(ODGEOMETRIESRow row) { + this.Rows.Remove(row); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedTableSchema(global::System.Xml.Schema.XmlSchemaSet xs) { + global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType(); + global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence(); + SoilProfileDataSet ds = new SoilProfileDataSet(); + global::System.Xml.Schema.XmlSchemaAny any1 = new global::System.Xml.Schema.XmlSchemaAny(); + any1.Namespace = "http://www.w3.org/2001/XMLSchema"; + any1.MinOccurs = new decimal(0); + any1.MaxOccurs = decimal.MaxValue; + any1.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax; + sequence.Items.Add(any1); + global::System.Xml.Schema.XmlSchemaAny any2 = new global::System.Xml.Schema.XmlSchemaAny(); + any2.Namespace = "urn:schemas-microsoft-com:xml-diffgram-v1"; + any2.MinOccurs = new decimal(1); + any2.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax; + sequence.Items.Add(any2); + global::System.Xml.Schema.XmlSchemaAttribute attribute1 = new global::System.Xml.Schema.XmlSchemaAttribute(); + attribute1.Name = "namespace"; + attribute1.FixedValue = ds.Namespace; + type.Attributes.Add(attribute1); + global::System.Xml.Schema.XmlSchemaAttribute attribute2 = new global::System.Xml.Schema.XmlSchemaAttribute(); + attribute2.Name = "tableTypeName"; + attribute2.FixedValue = "ODGEOMETRIESDataTable"; + type.Attributes.Add(attribute2); + type.Particle = sequence; + global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable(); + if (xs.Contains(dsSchema.TargetNamespace)) { + global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream(); + global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream(); + try { + global::System.Xml.Schema.XmlSchema schema = null; + dsSchema.Write(s1); + for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext(); ) { + schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current)); + s2.SetLength(0); + schema.Write(s2); + if ((s1.Length == s2.Length)) { + s1.Position = 0; + s2.Position = 0; + for (; ((s1.Position != s1.Length) + && (s1.ReadByte() == s2.ReadByte())); ) { + ; + } + if ((s1.Position == s1.Length)) { + return type; + } + } + } + } + finally { + if ((s1 != null)) { + s1.Close(); + } + if ((s2 != null)) { + s2.Close(); + } + } + } + xs.Add(dsSchema); + return type; + } + } + + /// + ///Represents the strongly named DataTable class. + /// + [global::System.Serializable()] + [global::System.Xml.Serialization.XmlSchemaProviderAttribute("GetTypedTableSchema")] + public partial class ODGEOLAYERSDataTable : global::System.Data.TypedTableBase { + + private global::System.Data.DataColumn columnOL_NR; + + private global::System.Data.DataColumn columnOD_NR; + + private global::System.Data.DataColumn columnMA_NR; + + private global::System.Data.DataColumn columnOL_LAYERNR; + + private global::System.Data.DataColumn columnOL_LEVEL; + + private global::System.Data.DataColumn columnOL_PLATTOP; + + private global::System.Data.DataColumn columnOL_PLATBOTTOM; + + private global::System.Data.DataColumn columnOL_TOPEXCESSPP; + + private global::System.Data.DataColumn columnOL_BOTEXCESSPP; + + private global::System.Data.DataColumn columnOL_OCR; + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public ODGEOLAYERSDataTable() { + this.TableName = "ODGEOLAYERS"; + this.BeginInit(); + this.InitClass(); + this.EndInit(); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + internal ODGEOLAYERSDataTable(global::System.Data.DataTable table) { + this.TableName = table.TableName; + if ((table.CaseSensitive != table.DataSet.CaseSensitive)) { + this.CaseSensitive = table.CaseSensitive; + } + if ((table.Locale.ToString() != table.DataSet.Locale.ToString())) { + this.Locale = table.Locale; + } + if ((table.Namespace != table.DataSet.Namespace)) { + this.Namespace = table.Namespace; + } + this.Prefix = table.Prefix; + this.MinimumCapacity = table.MinimumCapacity; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + protected ODGEOLAYERSDataTable(global::System.Runtime.Serialization.SerializationInfo info, global::System.Runtime.Serialization.StreamingContext context) : + base(info, context) { + this.InitVars(); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public global::System.Data.DataColumn OL_NRColumn { + get { + return this.columnOL_NR; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public global::System.Data.DataColumn OD_NRColumn { + get { + return this.columnOD_NR; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public global::System.Data.DataColumn MA_NRColumn { + get { + return this.columnMA_NR; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public global::System.Data.DataColumn OL_LAYERNRColumn { + get { + return this.columnOL_LAYERNR; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public global::System.Data.DataColumn OL_LEVELColumn { + get { + return this.columnOL_LEVEL; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public global::System.Data.DataColumn OL_PLATTOPColumn { + get { + return this.columnOL_PLATTOP; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public global::System.Data.DataColumn OL_PLATBOTTOMColumn { + get { + return this.columnOL_PLATBOTTOM; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public global::System.Data.DataColumn OL_TOPEXCESSPPColumn { + get { + return this.columnOL_TOPEXCESSPP; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public global::System.Data.DataColumn OL_BOTEXCESSPPColumn { + get { + return this.columnOL_BOTEXCESSPP; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public global::System.Data.DataColumn OL_OCRColumn { + get { + return this.columnOL_OCR; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + [global::System.ComponentModel.Browsable(false)] + public int Count { + get { + return this.Rows.Count; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public ODGEOLAYERSRow this[int index] { + get { + return ((ODGEOLAYERSRow)(this.Rows[index])); + } + } + + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public event ODGEOLAYERSRowChangeEventHandler ODGEOLAYERSRowChanging; + + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public event ODGEOLAYERSRowChangeEventHandler ODGEOLAYERSRowChanged; + + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public event ODGEOLAYERSRowChangeEventHandler ODGEOLAYERSRowDeleting; + + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public event ODGEOLAYERSRowChangeEventHandler ODGEOLAYERSRowDeleted; + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public void AddODGEOLAYERSRow(ODGEOLAYERSRow row) { + this.Rows.Add(row); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public ODGEOLAYERSRow AddODGEOLAYERSRow(ODGEOMETRIESRow parentODGEOMETRIESRowByODGEOMETRIES_ODGEOLAYERS, MATERIALSRow parentMATERIALSRowByODGEOLAYERS_MATERIALS, int OL_LAYERNR, double OL_LEVEL, int OL_PLATTOP, int OL_PLATBOTTOM, double OL_TOPEXCESSPP, double OL_BOTEXCESSPP, double OL_OCR) { + ODGEOLAYERSRow rowODGEOLAYERSRow = ((ODGEOLAYERSRow)(this.NewRow())); + object[] columnValuesArray = new object[] { + null, + null, + null, + OL_LAYERNR, + OL_LEVEL, + OL_PLATTOP, + OL_PLATBOTTOM, + OL_TOPEXCESSPP, + OL_BOTEXCESSPP, + OL_OCR}; + if ((parentODGEOMETRIESRowByODGEOMETRIES_ODGEOLAYERS != null)) { + columnValuesArray[1] = parentODGEOMETRIESRowByODGEOMETRIES_ODGEOLAYERS[0]; + } + if ((parentMATERIALSRowByODGEOLAYERS_MATERIALS != null)) { + columnValuesArray[2] = parentMATERIALSRowByODGEOLAYERS_MATERIALS[0]; + } + rowODGEOLAYERSRow.ItemArray = columnValuesArray; + this.Rows.Add(rowODGEOLAYERSRow); + return rowODGEOLAYERSRow; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public ODGEOLAYERSRow FindByOL_NR(int OL_NR) { + return ((ODGEOLAYERSRow)(this.Rows.Find(new object[] { + OL_NR}))); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public override global::System.Data.DataTable Clone() { + ODGEOLAYERSDataTable cln = ((ODGEOLAYERSDataTable)(base.Clone())); + cln.InitVars(); + return cln; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + protected override global::System.Data.DataTable CreateInstance() { + return new ODGEOLAYERSDataTable(); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + internal void InitVars() { + this.columnOL_NR = base.Columns["OL_NR"]; + this.columnOD_NR = base.Columns["OD_NR"]; + this.columnMA_NR = base.Columns["MA_NR"]; + this.columnOL_LAYERNR = base.Columns["OL_LAYERNR"]; + this.columnOL_LEVEL = base.Columns["OL_LEVEL"]; + this.columnOL_PLATTOP = base.Columns["OL_PLATTOP"]; + this.columnOL_PLATBOTTOM = base.Columns["OL_PLATBOTTOM"]; + this.columnOL_TOPEXCESSPP = base.Columns["OL_TOPEXCESSPP"]; + this.columnOL_BOTEXCESSPP = base.Columns["OL_BOTEXCESSPP"]; + this.columnOL_OCR = base.Columns["OL_OCR"]; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + private void InitClass() { + this.columnOL_NR = new global::System.Data.DataColumn("OL_NR", typeof(int), null, global::System.Data.MappingType.Element); + base.Columns.Add(this.columnOL_NR); + this.columnOD_NR = new global::System.Data.DataColumn("OD_NR", typeof(int), null, global::System.Data.MappingType.Element); + base.Columns.Add(this.columnOD_NR); + this.columnMA_NR = new global::System.Data.DataColumn("MA_NR", typeof(int), null, global::System.Data.MappingType.Element); + base.Columns.Add(this.columnMA_NR); + this.columnOL_LAYERNR = new global::System.Data.DataColumn("OL_LAYERNR", typeof(int), null, global::System.Data.MappingType.Element); + base.Columns.Add(this.columnOL_LAYERNR); + this.columnOL_LEVEL = new global::System.Data.DataColumn("OL_LEVEL", typeof(double), null, global::System.Data.MappingType.Element); + base.Columns.Add(this.columnOL_LEVEL); + this.columnOL_PLATTOP = new global::System.Data.DataColumn("OL_PLATTOP", typeof(int), null, global::System.Data.MappingType.Element); + base.Columns.Add(this.columnOL_PLATTOP); + this.columnOL_PLATBOTTOM = new global::System.Data.DataColumn("OL_PLATBOTTOM", typeof(int), null, global::System.Data.MappingType.Element); + base.Columns.Add(this.columnOL_PLATBOTTOM); + this.columnOL_TOPEXCESSPP = new global::System.Data.DataColumn("OL_TOPEXCESSPP", typeof(double), null, global::System.Data.MappingType.Element); + base.Columns.Add(this.columnOL_TOPEXCESSPP); + this.columnOL_BOTEXCESSPP = new global::System.Data.DataColumn("OL_BOTEXCESSPP", typeof(double), null, global::System.Data.MappingType.Element); + base.Columns.Add(this.columnOL_BOTEXCESSPP); + this.columnOL_OCR = new global::System.Data.DataColumn("OL_OCR", typeof(double), null, global::System.Data.MappingType.Element); + base.Columns.Add(this.columnOL_OCR); + this.Constraints.Add(new global::System.Data.UniqueConstraint("Constraint1", new global::System.Data.DataColumn[] { + this.columnOL_NR}, true)); + this.columnOL_NR.AutoIncrement = true; + this.columnOL_NR.AutoIncrementSeed = -1; + this.columnOL_NR.AutoIncrementStep = -1; + this.columnOL_NR.AllowDBNull = false; + this.columnOL_NR.ReadOnly = true; + this.columnOL_NR.Unique = true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public ODGEOLAYERSRow NewODGEOLAYERSRow() { + return ((ODGEOLAYERSRow)(this.NewRow())); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + protected override global::System.Data.DataRow NewRowFromBuilder(global::System.Data.DataRowBuilder builder) { + return new ODGEOLAYERSRow(builder); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + protected override global::System.Type GetRowType() { + return typeof(ODGEOLAYERSRow); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + protected override void OnRowChanged(global::System.Data.DataRowChangeEventArgs e) { + base.OnRowChanged(e); + if ((this.ODGEOLAYERSRowChanged != null)) { + this.ODGEOLAYERSRowChanged(this, new ODGEOLAYERSRowChangeEvent(((ODGEOLAYERSRow)(e.Row)), e.Action)); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + protected override void OnRowChanging(global::System.Data.DataRowChangeEventArgs e) { + base.OnRowChanging(e); + if ((this.ODGEOLAYERSRowChanging != null)) { + this.ODGEOLAYERSRowChanging(this, new ODGEOLAYERSRowChangeEvent(((ODGEOLAYERSRow)(e.Row)), e.Action)); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + protected override void OnRowDeleted(global::System.Data.DataRowChangeEventArgs e) { + base.OnRowDeleted(e); + if ((this.ODGEOLAYERSRowDeleted != null)) { + this.ODGEOLAYERSRowDeleted(this, new ODGEOLAYERSRowChangeEvent(((ODGEOLAYERSRow)(e.Row)), e.Action)); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + protected override void OnRowDeleting(global::System.Data.DataRowChangeEventArgs e) { + base.OnRowDeleting(e); + if ((this.ODGEOLAYERSRowDeleting != null)) { + this.ODGEOLAYERSRowDeleting(this, new ODGEOLAYERSRowChangeEvent(((ODGEOLAYERSRow)(e.Row)), e.Action)); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public void RemoveODGEOLAYERSRow(ODGEOLAYERSRow row) { + this.Rows.Remove(row); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedTableSchema(global::System.Xml.Schema.XmlSchemaSet xs) { + global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType(); + global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence(); + SoilProfileDataSet ds = new SoilProfileDataSet(); + global::System.Xml.Schema.XmlSchemaAny any1 = new global::System.Xml.Schema.XmlSchemaAny(); + any1.Namespace = "http://www.w3.org/2001/XMLSchema"; + any1.MinOccurs = new decimal(0); + any1.MaxOccurs = decimal.MaxValue; + any1.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax; + sequence.Items.Add(any1); + global::System.Xml.Schema.XmlSchemaAny any2 = new global::System.Xml.Schema.XmlSchemaAny(); + any2.Namespace = "urn:schemas-microsoft-com:xml-diffgram-v1"; + any2.MinOccurs = new decimal(1); + any2.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax; + sequence.Items.Add(any2); + global::System.Xml.Schema.XmlSchemaAttribute attribute1 = new global::System.Xml.Schema.XmlSchemaAttribute(); + attribute1.Name = "namespace"; + attribute1.FixedValue = ds.Namespace; + type.Attributes.Add(attribute1); + global::System.Xml.Schema.XmlSchemaAttribute attribute2 = new global::System.Xml.Schema.XmlSchemaAttribute(); + attribute2.Name = "tableTypeName"; + attribute2.FixedValue = "ODGEOLAYERSDataTable"; + type.Attributes.Add(attribute2); + type.Particle = sequence; + global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable(); + if (xs.Contains(dsSchema.TargetNamespace)) { + global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream(); + global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream(); + try { + global::System.Xml.Schema.XmlSchema schema = null; + dsSchema.Write(s1); + for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext(); ) { + schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current)); + s2.SetLength(0); + schema.Write(s2); + if ((s1.Length == s2.Length)) { + s1.Position = 0; + s2.Position = 0; + for (; ((s1.Position != s1.Length) + && (s1.ReadByte() == s2.ReadByte())); ) { + ; + } + if ((s1.Position == s1.Length)) { + return type; + } + } + } + } + finally { + if ((s1 != null)) { + s1.Close(); + } + if ((s2 != null)) { + s2.Close(); + } + } + } + xs.Add(dsSchema); + return type; + } + } + + /// + ///Represents the strongly named DataTable class. + /// + [global::System.Serializable()] + [global::System.Xml.Serialization.XmlSchemaProviderAttribute("GetTypedTableSchema")] + public partial class MATERIALSDataTable : global::System.Data.TypedTableBase { + + private global::System.Data.DataColumn columnMA_NR; + + private global::System.Data.DataColumn columnMA_NAME; + + private global::System.Data.DataColumn columnMA_DESCR; + + private global::System.Data.DataColumn columnMA_INDEX; + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public MATERIALSDataTable() { + this.TableName = "MATERIALS"; + this.BeginInit(); + this.InitClass(); + this.EndInit(); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + internal MATERIALSDataTable(global::System.Data.DataTable table) { + this.TableName = table.TableName; + if ((table.CaseSensitive != table.DataSet.CaseSensitive)) { + this.CaseSensitive = table.CaseSensitive; + } + if ((table.Locale.ToString() != table.DataSet.Locale.ToString())) { + this.Locale = table.Locale; + } + if ((table.Namespace != table.DataSet.Namespace)) { + this.Namespace = table.Namespace; + } + this.Prefix = table.Prefix; + this.MinimumCapacity = table.MinimumCapacity; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + protected MATERIALSDataTable(global::System.Runtime.Serialization.SerializationInfo info, global::System.Runtime.Serialization.StreamingContext context) : + base(info, context) { + this.InitVars(); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public global::System.Data.DataColumn MA_NRColumn { + get { + return this.columnMA_NR; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public global::System.Data.DataColumn MA_NAMEColumn { + get { + return this.columnMA_NAME; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public global::System.Data.DataColumn MA_DESCRColumn { + get { + return this.columnMA_DESCR; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public global::System.Data.DataColumn MA_INDEXColumn { + get { + return this.columnMA_INDEX; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + [global::System.ComponentModel.Browsable(false)] + public int Count { + get { + return this.Rows.Count; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public MATERIALSRow this[int index] { + get { + return ((MATERIALSRow)(this.Rows[index])); + } + } + + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public event MATERIALSRowChangeEventHandler MATERIALSRowChanging; + + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public event MATERIALSRowChangeEventHandler MATERIALSRowChanged; + + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public event MATERIALSRowChangeEventHandler MATERIALSRowDeleting; + + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public event MATERIALSRowChangeEventHandler MATERIALSRowDeleted; + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public void AddMATERIALSRow(MATERIALSRow row) { + this.Rows.Add(row); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public MATERIALSRow AddMATERIALSRow(string MA_NAME, string MA_DESCR, int MA_INDEX) { + MATERIALSRow rowMATERIALSRow = ((MATERIALSRow)(this.NewRow())); + object[] columnValuesArray = new object[] { + null, + MA_NAME, + MA_DESCR, + MA_INDEX}; + rowMATERIALSRow.ItemArray = columnValuesArray; + this.Rows.Add(rowMATERIALSRow); + return rowMATERIALSRow; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public MATERIALSRow FindByMA_NR(int MA_NR) { + return ((MATERIALSRow)(this.Rows.Find(new object[] { + MA_NR}))); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public override global::System.Data.DataTable Clone() { + MATERIALSDataTable cln = ((MATERIALSDataTable)(base.Clone())); + cln.InitVars(); + return cln; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + protected override global::System.Data.DataTable CreateInstance() { + return new MATERIALSDataTable(); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + internal void InitVars() { + this.columnMA_NR = base.Columns["MA_NR"]; + this.columnMA_NAME = base.Columns["MA_NAME"]; + this.columnMA_DESCR = base.Columns["MA_DESCR"]; + this.columnMA_INDEX = base.Columns["MA_INDEX"]; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + private void InitClass() { + this.columnMA_NR = new global::System.Data.DataColumn("MA_NR", typeof(int), null, global::System.Data.MappingType.Element); + base.Columns.Add(this.columnMA_NR); + this.columnMA_NAME = new global::System.Data.DataColumn("MA_NAME", typeof(string), null, global::System.Data.MappingType.Element); + base.Columns.Add(this.columnMA_NAME); + this.columnMA_DESCR = new global::System.Data.DataColumn("MA_DESCR", typeof(string), null, global::System.Data.MappingType.Element); + base.Columns.Add(this.columnMA_DESCR); + this.columnMA_INDEX = new global::System.Data.DataColumn("MA_INDEX", typeof(int), null, global::System.Data.MappingType.Element); + base.Columns.Add(this.columnMA_INDEX); + this.Constraints.Add(new global::System.Data.UniqueConstraint("Constraint1", new global::System.Data.DataColumn[] { + this.columnMA_NR}, true)); + this.columnMA_NR.AutoIncrement = true; + this.columnMA_NR.AutoIncrementSeed = -1; + this.columnMA_NR.AutoIncrementStep = -1; + this.columnMA_NR.AllowDBNull = false; + this.columnMA_NR.ReadOnly = true; + this.columnMA_NR.Unique = true; + this.columnMA_NAME.MaxLength = 128; + this.columnMA_DESCR.MaxLength = 240; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public MATERIALSRow NewMATERIALSRow() { + return ((MATERIALSRow)(this.NewRow())); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + protected override global::System.Data.DataRow NewRowFromBuilder(global::System.Data.DataRowBuilder builder) { + return new MATERIALSRow(builder); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + protected override global::System.Type GetRowType() { + return typeof(MATERIALSRow); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + protected override void OnRowChanged(global::System.Data.DataRowChangeEventArgs e) { + base.OnRowChanged(e); + if ((this.MATERIALSRowChanged != null)) { + this.MATERIALSRowChanged(this, new MATERIALSRowChangeEvent(((MATERIALSRow)(e.Row)), e.Action)); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + protected override void OnRowChanging(global::System.Data.DataRowChangeEventArgs e) { + base.OnRowChanging(e); + if ((this.MATERIALSRowChanging != null)) { + this.MATERIALSRowChanging(this, new MATERIALSRowChangeEvent(((MATERIALSRow)(e.Row)), e.Action)); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + protected override void OnRowDeleted(global::System.Data.DataRowChangeEventArgs e) { + base.OnRowDeleted(e); + if ((this.MATERIALSRowDeleted != null)) { + this.MATERIALSRowDeleted(this, new MATERIALSRowChangeEvent(((MATERIALSRow)(e.Row)), e.Action)); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + protected override void OnRowDeleting(global::System.Data.DataRowChangeEventArgs e) { + base.OnRowDeleting(e); + if ((this.MATERIALSRowDeleting != null)) { + this.MATERIALSRowDeleting(this, new MATERIALSRowChangeEvent(((MATERIALSRow)(e.Row)), e.Action)); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public void RemoveMATERIALSRow(MATERIALSRow row) { + this.Rows.Remove(row); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedTableSchema(global::System.Xml.Schema.XmlSchemaSet xs) { + global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType(); + global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence(); + SoilProfileDataSet ds = new SoilProfileDataSet(); + global::System.Xml.Schema.XmlSchemaAny any1 = new global::System.Xml.Schema.XmlSchemaAny(); + any1.Namespace = "http://www.w3.org/2001/XMLSchema"; + any1.MinOccurs = new decimal(0); + any1.MaxOccurs = decimal.MaxValue; + any1.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax; + sequence.Items.Add(any1); + global::System.Xml.Schema.XmlSchemaAny any2 = new global::System.Xml.Schema.XmlSchemaAny(); + any2.Namespace = "urn:schemas-microsoft-com:xml-diffgram-v1"; + any2.MinOccurs = new decimal(1); + any2.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax; + sequence.Items.Add(any2); + global::System.Xml.Schema.XmlSchemaAttribute attribute1 = new global::System.Xml.Schema.XmlSchemaAttribute(); + attribute1.Name = "namespace"; + attribute1.FixedValue = ds.Namespace; + type.Attributes.Add(attribute1); + global::System.Xml.Schema.XmlSchemaAttribute attribute2 = new global::System.Xml.Schema.XmlSchemaAttribute(); + attribute2.Name = "tableTypeName"; + attribute2.FixedValue = "MATERIALSDataTable"; + type.Attributes.Add(attribute2); + type.Particle = sequence; + global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable(); + if (xs.Contains(dsSchema.TargetNamespace)) { + global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream(); + global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream(); + try { + global::System.Xml.Schema.XmlSchema schema = null; + dsSchema.Write(s1); + for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext(); ) { + schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current)); + s2.SetLength(0); + schema.Write(s2); + if ((s1.Length == s2.Length)) { + s1.Position = 0; + s2.Position = 0; + for (; ((s1.Position != s1.Length) + && (s1.ReadByte() == s2.ReadByte())); ) { + ; + } + if ((s1.Position == s1.Length)) { + return type; + } + } + } + } + finally { + if ((s1 != null)) { + s1.Close(); + } + if ((s2 != null)) { + s2.Close(); + } + } + } + xs.Add(dsSchema); + return type; + } + } + + /// + ///Represents the strongly named DataTable class. + /// + [global::System.Serializable()] + [global::System.Xml.Serialization.XmlSchemaProviderAttribute("GetTypedTableSchema")] + public partial class PARAMETERNAMESDataTable : global::System.Data.TypedTableBase { + + private global::System.Data.DataColumn columnPN_NR; + + private global::System.Data.DataColumn columnPN_NAME; + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public PARAMETERNAMESDataTable() { + this.TableName = "PARAMETERNAMES"; + this.BeginInit(); + this.InitClass(); + this.EndInit(); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + internal PARAMETERNAMESDataTable(global::System.Data.DataTable table) { + this.TableName = table.TableName; + if ((table.CaseSensitive != table.DataSet.CaseSensitive)) { + this.CaseSensitive = table.CaseSensitive; + } + if ((table.Locale.ToString() != table.DataSet.Locale.ToString())) { + this.Locale = table.Locale; + } + if ((table.Namespace != table.DataSet.Namespace)) { + this.Namespace = table.Namespace; + } + this.Prefix = table.Prefix; + this.MinimumCapacity = table.MinimumCapacity; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + protected PARAMETERNAMESDataTable(global::System.Runtime.Serialization.SerializationInfo info, global::System.Runtime.Serialization.StreamingContext context) : + base(info, context) { + this.InitVars(); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public global::System.Data.DataColumn PN_NRColumn { + get { + return this.columnPN_NR; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public global::System.Data.DataColumn PN_NAMEColumn { + get { + return this.columnPN_NAME; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + [global::System.ComponentModel.Browsable(false)] + public int Count { + get { + return this.Rows.Count; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public PARAMETERNAMESRow this[int index] { + get { + return ((PARAMETERNAMESRow)(this.Rows[index])); + } + } + + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public event PARAMETERNAMESRowChangeEventHandler PARAMETERNAMESRowChanging; + + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public event PARAMETERNAMESRowChangeEventHandler PARAMETERNAMESRowChanged; + + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public event PARAMETERNAMESRowChangeEventHandler PARAMETERNAMESRowDeleting; + + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public event PARAMETERNAMESRowChangeEventHandler PARAMETERNAMESRowDeleted; + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public void AddPARAMETERNAMESRow(PARAMETERNAMESRow row) { + this.Rows.Add(row); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public PARAMETERNAMESRow AddPARAMETERNAMESRow(string PN_NAME) { + PARAMETERNAMESRow rowPARAMETERNAMESRow = ((PARAMETERNAMESRow)(this.NewRow())); + object[] columnValuesArray = new object[] { + null, + PN_NAME}; + rowPARAMETERNAMESRow.ItemArray = columnValuesArray; + this.Rows.Add(rowPARAMETERNAMESRow); + return rowPARAMETERNAMESRow; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public PARAMETERNAMESRow FindByPN_NR(int PN_NR) { + return ((PARAMETERNAMESRow)(this.Rows.Find(new object[] { + PN_NR}))); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public override global::System.Data.DataTable Clone() { + PARAMETERNAMESDataTable cln = ((PARAMETERNAMESDataTable)(base.Clone())); + cln.InitVars(); + return cln; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + protected override global::System.Data.DataTable CreateInstance() { + return new PARAMETERNAMESDataTable(); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + internal void InitVars() { + this.columnPN_NR = base.Columns["PN_NR"]; + this.columnPN_NAME = base.Columns["PN_NAME"]; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + private void InitClass() { + this.columnPN_NR = new global::System.Data.DataColumn("PN_NR", typeof(int), null, global::System.Data.MappingType.Element); + base.Columns.Add(this.columnPN_NR); + this.columnPN_NAME = new global::System.Data.DataColumn("PN_NAME", typeof(string), null, global::System.Data.MappingType.Element); + base.Columns.Add(this.columnPN_NAME); + this.Constraints.Add(new global::System.Data.UniqueConstraint("Constraint1", new global::System.Data.DataColumn[] { + this.columnPN_NR}, true)); + this.columnPN_NR.AutoIncrement = true; + this.columnPN_NR.AutoIncrementSeed = -1; + this.columnPN_NR.AutoIncrementStep = -1; + this.columnPN_NR.AllowDBNull = false; + this.columnPN_NR.ReadOnly = true; + this.columnPN_NR.Unique = true; + this.columnPN_NAME.MaxLength = 64; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public PARAMETERNAMESRow NewPARAMETERNAMESRow() { + return ((PARAMETERNAMESRow)(this.NewRow())); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + protected override global::System.Data.DataRow NewRowFromBuilder(global::System.Data.DataRowBuilder builder) { + return new PARAMETERNAMESRow(builder); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + protected override global::System.Type GetRowType() { + return typeof(PARAMETERNAMESRow); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + protected override void OnRowChanged(global::System.Data.DataRowChangeEventArgs e) { + base.OnRowChanged(e); + if ((this.PARAMETERNAMESRowChanged != null)) { + this.PARAMETERNAMESRowChanged(this, new PARAMETERNAMESRowChangeEvent(((PARAMETERNAMESRow)(e.Row)), e.Action)); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + protected override void OnRowChanging(global::System.Data.DataRowChangeEventArgs e) { + base.OnRowChanging(e); + if ((this.PARAMETERNAMESRowChanging != null)) { + this.PARAMETERNAMESRowChanging(this, new PARAMETERNAMESRowChangeEvent(((PARAMETERNAMESRow)(e.Row)), e.Action)); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + protected override void OnRowDeleted(global::System.Data.DataRowChangeEventArgs e) { + base.OnRowDeleted(e); + if ((this.PARAMETERNAMESRowDeleted != null)) { + this.PARAMETERNAMESRowDeleted(this, new PARAMETERNAMESRowChangeEvent(((PARAMETERNAMESRow)(e.Row)), e.Action)); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + protected override void OnRowDeleting(global::System.Data.DataRowChangeEventArgs e) { + base.OnRowDeleting(e); + if ((this.PARAMETERNAMESRowDeleting != null)) { + this.PARAMETERNAMESRowDeleting(this, new PARAMETERNAMESRowChangeEvent(((PARAMETERNAMESRow)(e.Row)), e.Action)); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public void RemovePARAMETERNAMESRow(PARAMETERNAMESRow row) { + this.Rows.Remove(row); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedTableSchema(global::System.Xml.Schema.XmlSchemaSet xs) { + global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType(); + global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence(); + SoilProfileDataSet ds = new SoilProfileDataSet(); + global::System.Xml.Schema.XmlSchemaAny any1 = new global::System.Xml.Schema.XmlSchemaAny(); + any1.Namespace = "http://www.w3.org/2001/XMLSchema"; + any1.MinOccurs = new decimal(0); + any1.MaxOccurs = decimal.MaxValue; + any1.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax; + sequence.Items.Add(any1); + global::System.Xml.Schema.XmlSchemaAny any2 = new global::System.Xml.Schema.XmlSchemaAny(); + any2.Namespace = "urn:schemas-microsoft-com:xml-diffgram-v1"; + any2.MinOccurs = new decimal(1); + any2.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax; + sequence.Items.Add(any2); + global::System.Xml.Schema.XmlSchemaAttribute attribute1 = new global::System.Xml.Schema.XmlSchemaAttribute(); + attribute1.Name = "namespace"; + attribute1.FixedValue = ds.Namespace; + type.Attributes.Add(attribute1); + global::System.Xml.Schema.XmlSchemaAttribute attribute2 = new global::System.Xml.Schema.XmlSchemaAttribute(); + attribute2.Name = "tableTypeName"; + attribute2.FixedValue = "PARAMETERNAMESDataTable"; + type.Attributes.Add(attribute2); + type.Particle = sequence; + global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable(); + if (xs.Contains(dsSchema.TargetNamespace)) { + global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream(); + global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream(); + try { + global::System.Xml.Schema.XmlSchema schema = null; + dsSchema.Write(s1); + for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext(); ) { + schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current)); + s2.SetLength(0); + schema.Write(s2); + if ((s1.Length == s2.Length)) { + s1.Position = 0; + s2.Position = 0; + for (; ((s1.Position != s1.Length) + && (s1.ReadByte() == s2.ReadByte())); ) { + ; + } + if ((s1.Position == s1.Length)) { + return type; + } + } + } + } + finally { + if ((s1 != null)) { + s1.Close(); + } + if ((s2 != null)) { + s2.Close(); + } + } + } + xs.Add(dsSchema); + return type; + } + } + + /// + ///Represents the strongly named DataTable class. + /// + [global::System.Serializable()] + [global::System.Xml.Serialization.XmlSchemaProviderAttribute("GetTypedTableSchema")] + public partial class PARAMETERVALUESDataTable : global::System.Data.TypedTableBase { + + private global::System.Data.DataColumn columnPV_NR; + + private global::System.Data.DataColumn columnMA_NR; + + private global::System.Data.DataColumn columnPN_NR; + + private global::System.Data.DataColumn columnPV_VALUE; + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public PARAMETERVALUESDataTable() { + this.TableName = "PARAMETERVALUES"; + this.BeginInit(); + this.InitClass(); + this.EndInit(); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + internal PARAMETERVALUESDataTable(global::System.Data.DataTable table) { + this.TableName = table.TableName; + if ((table.CaseSensitive != table.DataSet.CaseSensitive)) { + this.CaseSensitive = table.CaseSensitive; + } + if ((table.Locale.ToString() != table.DataSet.Locale.ToString())) { + this.Locale = table.Locale; + } + if ((table.Namespace != table.DataSet.Namespace)) { + this.Namespace = table.Namespace; + } + this.Prefix = table.Prefix; + this.MinimumCapacity = table.MinimumCapacity; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + protected PARAMETERVALUESDataTable(global::System.Runtime.Serialization.SerializationInfo info, global::System.Runtime.Serialization.StreamingContext context) : + base(info, context) { + this.InitVars(); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public global::System.Data.DataColumn PV_NRColumn { + get { + return this.columnPV_NR; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public global::System.Data.DataColumn MA_NRColumn { + get { + return this.columnMA_NR; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public global::System.Data.DataColumn PN_NRColumn { + get { + return this.columnPN_NR; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public global::System.Data.DataColumn PV_VALUEColumn { + get { + return this.columnPV_VALUE; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + [global::System.ComponentModel.Browsable(false)] + public int Count { + get { + return this.Rows.Count; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public PARAMETERVALUESRow this[int index] { + get { + return ((PARAMETERVALUESRow)(this.Rows[index])); + } + } + + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public event PARAMETERVALUESRowChangeEventHandler PARAMETERVALUESRowChanging; + + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public event PARAMETERVALUESRowChangeEventHandler PARAMETERVALUESRowChanged; + + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public event PARAMETERVALUESRowChangeEventHandler PARAMETERVALUESRowDeleting; + + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public event PARAMETERVALUESRowChangeEventHandler PARAMETERVALUESRowDeleted; + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public void AddPARAMETERVALUESRow(PARAMETERVALUESRow row) { + this.Rows.Add(row); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public PARAMETERVALUESRow AddPARAMETERVALUESRow(MATERIALSRow parentMATERIALSRowByPARAMETERVALUES_MATERIALS, PARAMETERNAMESRow parentPARAMETERNAMESRowByPARAMETERNAMES_PARAMETERVALUES, double PV_VALUE) { + PARAMETERVALUESRow rowPARAMETERVALUESRow = ((PARAMETERVALUESRow)(this.NewRow())); + object[] columnValuesArray = new object[] { + null, + null, + null, + PV_VALUE}; + if ((parentMATERIALSRowByPARAMETERVALUES_MATERIALS != null)) { + columnValuesArray[1] = parentMATERIALSRowByPARAMETERVALUES_MATERIALS[0]; + } + if ((parentPARAMETERNAMESRowByPARAMETERNAMES_PARAMETERVALUES != null)) { + columnValuesArray[2] = parentPARAMETERNAMESRowByPARAMETERNAMES_PARAMETERVALUES[0]; + } + rowPARAMETERVALUESRow.ItemArray = columnValuesArray; + this.Rows.Add(rowPARAMETERVALUESRow); + return rowPARAMETERVALUESRow; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public PARAMETERVALUESRow FindByPV_NR(int PV_NR) { + return ((PARAMETERVALUESRow)(this.Rows.Find(new object[] { + PV_NR}))); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public override global::System.Data.DataTable Clone() { + PARAMETERVALUESDataTable cln = ((PARAMETERVALUESDataTable)(base.Clone())); + cln.InitVars(); + return cln; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + protected override global::System.Data.DataTable CreateInstance() { + return new PARAMETERVALUESDataTable(); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + internal void InitVars() { + this.columnPV_NR = base.Columns["PV_NR"]; + this.columnMA_NR = base.Columns["MA_NR"]; + this.columnPN_NR = base.Columns["PN_NR"]; + this.columnPV_VALUE = base.Columns["PV_VALUE"]; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + private void InitClass() { + this.columnPV_NR = new global::System.Data.DataColumn("PV_NR", typeof(int), null, global::System.Data.MappingType.Element); + base.Columns.Add(this.columnPV_NR); + this.columnMA_NR = new global::System.Data.DataColumn("MA_NR", typeof(int), null, global::System.Data.MappingType.Element); + base.Columns.Add(this.columnMA_NR); + this.columnPN_NR = new global::System.Data.DataColumn("PN_NR", typeof(int), null, global::System.Data.MappingType.Element); + base.Columns.Add(this.columnPN_NR); + this.columnPV_VALUE = new global::System.Data.DataColumn("PV_VALUE", typeof(double), null, global::System.Data.MappingType.Element); + base.Columns.Add(this.columnPV_VALUE); + this.Constraints.Add(new global::System.Data.UniqueConstraint("Constraint1", new global::System.Data.DataColumn[] { + this.columnPV_NR}, true)); + this.columnPV_NR.AutoIncrement = true; + this.columnPV_NR.AutoIncrementSeed = -1; + this.columnPV_NR.AutoIncrementStep = -1; + this.columnPV_NR.AllowDBNull = false; + this.columnPV_NR.ReadOnly = true; + this.columnPV_NR.Unique = true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public PARAMETERVALUESRow NewPARAMETERVALUESRow() { + return ((PARAMETERVALUESRow)(this.NewRow())); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + protected override global::System.Data.DataRow NewRowFromBuilder(global::System.Data.DataRowBuilder builder) { + return new PARAMETERVALUESRow(builder); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + protected override global::System.Type GetRowType() { + return typeof(PARAMETERVALUESRow); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + protected override void OnRowChanged(global::System.Data.DataRowChangeEventArgs e) { + base.OnRowChanged(e); + if ((this.PARAMETERVALUESRowChanged != null)) { + this.PARAMETERVALUESRowChanged(this, new PARAMETERVALUESRowChangeEvent(((PARAMETERVALUESRow)(e.Row)), e.Action)); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + protected override void OnRowChanging(global::System.Data.DataRowChangeEventArgs e) { + base.OnRowChanging(e); + if ((this.PARAMETERVALUESRowChanging != null)) { + this.PARAMETERVALUESRowChanging(this, new PARAMETERVALUESRowChangeEvent(((PARAMETERVALUESRow)(e.Row)), e.Action)); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + protected override void OnRowDeleted(global::System.Data.DataRowChangeEventArgs e) { + base.OnRowDeleted(e); + if ((this.PARAMETERVALUESRowDeleted != null)) { + this.PARAMETERVALUESRowDeleted(this, new PARAMETERVALUESRowChangeEvent(((PARAMETERVALUESRow)(e.Row)), e.Action)); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + protected override void OnRowDeleting(global::System.Data.DataRowChangeEventArgs e) { + base.OnRowDeleting(e); + if ((this.PARAMETERVALUESRowDeleting != null)) { + this.PARAMETERVALUESRowDeleting(this, new PARAMETERVALUESRowChangeEvent(((PARAMETERVALUESRow)(e.Row)), e.Action)); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public void RemovePARAMETERVALUESRow(PARAMETERVALUESRow row) { + this.Rows.Remove(row); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedTableSchema(global::System.Xml.Schema.XmlSchemaSet xs) { + global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType(); + global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence(); + SoilProfileDataSet ds = new SoilProfileDataSet(); + global::System.Xml.Schema.XmlSchemaAny any1 = new global::System.Xml.Schema.XmlSchemaAny(); + any1.Namespace = "http://www.w3.org/2001/XMLSchema"; + any1.MinOccurs = new decimal(0); + any1.MaxOccurs = decimal.MaxValue; + any1.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax; + sequence.Items.Add(any1); + global::System.Xml.Schema.XmlSchemaAny any2 = new global::System.Xml.Schema.XmlSchemaAny(); + any2.Namespace = "urn:schemas-microsoft-com:xml-diffgram-v1"; + any2.MinOccurs = new decimal(1); + any2.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax; + sequence.Items.Add(any2); + global::System.Xml.Schema.XmlSchemaAttribute attribute1 = new global::System.Xml.Schema.XmlSchemaAttribute(); + attribute1.Name = "namespace"; + attribute1.FixedValue = ds.Namespace; + type.Attributes.Add(attribute1); + global::System.Xml.Schema.XmlSchemaAttribute attribute2 = new global::System.Xml.Schema.XmlSchemaAttribute(); + attribute2.Name = "tableTypeName"; + attribute2.FixedValue = "PARAMETERVALUESDataTable"; + type.Attributes.Add(attribute2); + type.Particle = sequence; + global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable(); + if (xs.Contains(dsSchema.TargetNamespace)) { + global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream(); + global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream(); + try { + global::System.Xml.Schema.XmlSchema schema = null; + dsSchema.Write(s1); + for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext(); ) { + schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current)); + s2.SetLength(0); + schema.Write(s2); + if ((s1.Length == s2.Length)) { + s1.Position = 0; + s2.Position = 0; + for (; ((s1.Position != s1.Length) + && (s1.ReadByte() == s2.ReadByte())); ) { + ; + } + if ((s1.Position == s1.Length)) { + return type; + } + } + } + } + finally { + if ((s1 != null)) { + s1.Close(); + } + if ((s2 != null)) { + s2.Close(); + } + } + } + xs.Add(dsSchema); + return type; + } + } + + /// + ///Represents strongly named DataRow class. + /// + public partial class ODGEOMETRIESRow : global::System.Data.DataRow { + + private ODGEOMETRIESDataTable tableODGEOMETRIES; + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + internal ODGEOMETRIESRow(global::System.Data.DataRowBuilder rb) : + base(rb) { + this.tableODGEOMETRIES = ((ODGEOMETRIESDataTable)(this.Table)); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public int OD_NR { + get { + return ((int)(this[this.tableODGEOMETRIES.OD_NRColumn])); + } + set { + this[this.tableODGEOMETRIES.OD_NRColumn] = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public string OD_NAME { + get { + try { + return ((string)(this[this.tableODGEOMETRIES.OD_NAMEColumn])); + } + catch (global::System.InvalidCastException e) { + throw new global::System.Data.StrongTypingException("The value for column \'OD_NAME\' in table \'ODGEOMETRIES\' is DBNull.", e); + } + } + set { + this[this.tableODGEOMETRIES.OD_NAMEColumn] = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public string OD_DESCR { + get { + try { + return ((string)(this[this.tableODGEOMETRIES.OD_DESCRColumn])); + } + catch (global::System.InvalidCastException e) { + throw new global::System.Data.StrongTypingException("The value for column \'OD_DESCR\' in table \'ODGEOMETRIES\' is DBNull.", e); + } + } + set { + this[this.tableODGEOMETRIES.OD_DESCRColumn] = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public double OD_RDX { + get { + try { + return ((double)(this[this.tableODGEOMETRIES.OD_RDXColumn])); + } + catch (global::System.InvalidCastException e) { + throw new global::System.Data.StrongTypingException("The value for column \'OD_RDX\' in table \'ODGEOMETRIES\' is DBNull.", e); + } + } + set { + this[this.tableODGEOMETRIES.OD_RDXColumn] = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public double OD_RDY { + get { + try { + return ((double)(this[this.tableODGEOMETRIES.OD_RDYColumn])); + } + catch (global::System.InvalidCastException e) { + throw new global::System.Data.StrongTypingException("The value for column \'OD_RDY\' in table \'ODGEOMETRIES\' is DBNull.", e); + } + } + set { + this[this.tableODGEOMETRIES.OD_RDYColumn] = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public int OD_CPTNR { + get { + try { + return ((int)(this[this.tableODGEOMETRIES.OD_CPTNRColumn])); + } + catch (global::System.InvalidCastException e) { + throw new global::System.Data.StrongTypingException("The value for column \'OD_CPTNR\' in table \'ODGEOMETRIES\' is DBNull.", e); + } + } + set { + this[this.tableODGEOMETRIES.OD_CPTNRColumn] = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public int OD_BORINGNR { + get { + try { + return ((int)(this[this.tableODGEOMETRIES.OD_BORINGNRColumn])); + } + catch (global::System.InvalidCastException e) { + throw new global::System.Data.StrongTypingException("The value for column \'OD_BORINGNR\' in table \'ODGEOMETRIES\' is DBNull.", e); + } + } + set { + this[this.tableODGEOMETRIES.OD_BORINGNRColumn] = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public int OD_GEOL_ZONE { + get { + try { + return ((int)(this[this.tableODGEOMETRIES.OD_GEOL_ZONEColumn])); + } + catch (global::System.InvalidCastException e) { + throw new global::System.Data.StrongTypingException("The value for column \'OD_GEOL_ZONE\' in table \'ODGEOMETRIES\' is DBNull.", e); + } + } + set { + this[this.tableODGEOMETRIES.OD_GEOL_ZONEColumn] = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public double OD_CHANCE_OCCUR { + get { + try { + return ((double)(this[this.tableODGEOMETRIES.OD_CHANCE_OCCURColumn])); + } + catch (global::System.InvalidCastException e) { + throw new global::System.Data.StrongTypingException("The value for column \'OD_CHANCE_OCCUR\' in table \'ODGEOMETRIES\' is DBNull.", e); + } + } + set { + this[this.tableODGEOMETRIES.OD_CHANCE_OCCURColumn] = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public bool IsOD_NAMENull() { + return this.IsNull(this.tableODGEOMETRIES.OD_NAMEColumn); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public void SetOD_NAMENull() { + this[this.tableODGEOMETRIES.OD_NAMEColumn] = global::System.Convert.DBNull; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public bool IsOD_DESCRNull() { + return this.IsNull(this.tableODGEOMETRIES.OD_DESCRColumn); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public void SetOD_DESCRNull() { + this[this.tableODGEOMETRIES.OD_DESCRColumn] = global::System.Convert.DBNull; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public bool IsOD_RDXNull() { + return this.IsNull(this.tableODGEOMETRIES.OD_RDXColumn); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public void SetOD_RDXNull() { + this[this.tableODGEOMETRIES.OD_RDXColumn] = global::System.Convert.DBNull; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public bool IsOD_RDYNull() { + return this.IsNull(this.tableODGEOMETRIES.OD_RDYColumn); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public void SetOD_RDYNull() { + this[this.tableODGEOMETRIES.OD_RDYColumn] = global::System.Convert.DBNull; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public bool IsOD_CPTNRNull() { + return this.IsNull(this.tableODGEOMETRIES.OD_CPTNRColumn); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public void SetOD_CPTNRNull() { + this[this.tableODGEOMETRIES.OD_CPTNRColumn] = global::System.Convert.DBNull; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public bool IsOD_BORINGNRNull() { + return this.IsNull(this.tableODGEOMETRIES.OD_BORINGNRColumn); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public void SetOD_BORINGNRNull() { + this[this.tableODGEOMETRIES.OD_BORINGNRColumn] = global::System.Convert.DBNull; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public bool IsOD_GEOL_ZONENull() { + return this.IsNull(this.tableODGEOMETRIES.OD_GEOL_ZONEColumn); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public void SetOD_GEOL_ZONENull() { + this[this.tableODGEOMETRIES.OD_GEOL_ZONEColumn] = global::System.Convert.DBNull; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public bool IsOD_CHANCE_OCCURNull() { + return this.IsNull(this.tableODGEOMETRIES.OD_CHANCE_OCCURColumn); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public void SetOD_CHANCE_OCCURNull() { + this[this.tableODGEOMETRIES.OD_CHANCE_OCCURColumn] = global::System.Convert.DBNull; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public ODGEOLAYERSRow[] GetODGEOLAYERSRows() { + if ((this.Table.ChildRelations["ODGEOMETRIES_ODGEOLAYERS"] == null)) { + return new ODGEOLAYERSRow[0]; + } + else { + return ((ODGEOLAYERSRow[])(base.GetChildRows(this.Table.ChildRelations["ODGEOMETRIES_ODGEOLAYERS"]))); + } + } + } + + /// + ///Represents strongly named DataRow class. + /// + public partial class ODGEOLAYERSRow : global::System.Data.DataRow { + + private ODGEOLAYERSDataTable tableODGEOLAYERS; + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + internal ODGEOLAYERSRow(global::System.Data.DataRowBuilder rb) : + base(rb) { + this.tableODGEOLAYERS = ((ODGEOLAYERSDataTable)(this.Table)); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public int OL_NR { + get { + return ((int)(this[this.tableODGEOLAYERS.OL_NRColumn])); + } + set { + this[this.tableODGEOLAYERS.OL_NRColumn] = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public int OD_NR { + get { + try { + return ((int)(this[this.tableODGEOLAYERS.OD_NRColumn])); + } + catch (global::System.InvalidCastException e) { + throw new global::System.Data.StrongTypingException("The value for column \'OD_NR\' in table \'ODGEOLAYERS\' is DBNull.", e); + } + } + set { + this[this.tableODGEOLAYERS.OD_NRColumn] = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public int MA_NR { + get { + try { + return ((int)(this[this.tableODGEOLAYERS.MA_NRColumn])); + } + catch (global::System.InvalidCastException e) { + throw new global::System.Data.StrongTypingException("The value for column \'MA_NR\' in table \'ODGEOLAYERS\' is DBNull.", e); + } + } + set { + this[this.tableODGEOLAYERS.MA_NRColumn] = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public int OL_LAYERNR { + get { + try { + return ((int)(this[this.tableODGEOLAYERS.OL_LAYERNRColumn])); + } + catch (global::System.InvalidCastException e) { + throw new global::System.Data.StrongTypingException("The value for column \'OL_LAYERNR\' in table \'ODGEOLAYERS\' is DBNull.", e); + } + } + set { + this[this.tableODGEOLAYERS.OL_LAYERNRColumn] = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public double OL_LEVEL { + get { + try { + return ((double)(this[this.tableODGEOLAYERS.OL_LEVELColumn])); + } + catch (global::System.InvalidCastException e) { + throw new global::System.Data.StrongTypingException("The value for column \'OL_LEVEL\' in table \'ODGEOLAYERS\' is DBNull.", e); + } + } + set { + this[this.tableODGEOLAYERS.OL_LEVELColumn] = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public int OL_PLATTOP { + get { + try { + return ((int)(this[this.tableODGEOLAYERS.OL_PLATTOPColumn])); + } + catch (global::System.InvalidCastException e) { + throw new global::System.Data.StrongTypingException("The value for column \'OL_PLATTOP\' in table \'ODGEOLAYERS\' is DBNull.", e); + } + } + set { + this[this.tableODGEOLAYERS.OL_PLATTOPColumn] = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public int OL_PLATBOTTOM { + get { + try { + return ((int)(this[this.tableODGEOLAYERS.OL_PLATBOTTOMColumn])); + } + catch (global::System.InvalidCastException e) { + throw new global::System.Data.StrongTypingException("The value for column \'OL_PLATBOTTOM\' in table \'ODGEOLAYERS\' is DBNull.", e); + } + } + set { + this[this.tableODGEOLAYERS.OL_PLATBOTTOMColumn] = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public double OL_TOPEXCESSPP { + get { + try { + return ((double)(this[this.tableODGEOLAYERS.OL_TOPEXCESSPPColumn])); + } + catch (global::System.InvalidCastException e) { + throw new global::System.Data.StrongTypingException("The value for column \'OL_TOPEXCESSPP\' in table \'ODGEOLAYERS\' is DBNull.", e); + } + } + set { + this[this.tableODGEOLAYERS.OL_TOPEXCESSPPColumn] = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public double OL_BOTEXCESSPP { + get { + try { + return ((double)(this[this.tableODGEOLAYERS.OL_BOTEXCESSPPColumn])); + } + catch (global::System.InvalidCastException e) { + throw new global::System.Data.StrongTypingException("The value for column \'OL_BOTEXCESSPP\' in table \'ODGEOLAYERS\' is DBNull.", e); + } + } + set { + this[this.tableODGEOLAYERS.OL_BOTEXCESSPPColumn] = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public double OL_OCR { + get { + try { + return ((double)(this[this.tableODGEOLAYERS.OL_OCRColumn])); + } + catch (global::System.InvalidCastException e) { + throw new global::System.Data.StrongTypingException("The value for column \'OL_OCR\' in table \'ODGEOLAYERS\' is DBNull.", e); + } + } + set { + this[this.tableODGEOLAYERS.OL_OCRColumn] = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public ODGEOMETRIESRow ODGEOMETRIESRow { + get { + return ((ODGEOMETRIESRow)(this.GetParentRow(this.Table.ParentRelations["ODGEOMETRIES_ODGEOLAYERS"]))); + } + set { + this.SetParentRow(value, this.Table.ParentRelations["ODGEOMETRIES_ODGEOLAYERS"]); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public MATERIALSRow MATERIALSRow { + get { + return ((MATERIALSRow)(this.GetParentRow(this.Table.ParentRelations["ODGEOLAYERS_MATERIALS"]))); + } + set { + this.SetParentRow(value, this.Table.ParentRelations["ODGEOLAYERS_MATERIALS"]); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public bool IsOD_NRNull() { + return this.IsNull(this.tableODGEOLAYERS.OD_NRColumn); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public void SetOD_NRNull() { + this[this.tableODGEOLAYERS.OD_NRColumn] = global::System.Convert.DBNull; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public bool IsMA_NRNull() { + return this.IsNull(this.tableODGEOLAYERS.MA_NRColumn); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public void SetMA_NRNull() { + this[this.tableODGEOLAYERS.MA_NRColumn] = global::System.Convert.DBNull; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public bool IsOL_LAYERNRNull() { + return this.IsNull(this.tableODGEOLAYERS.OL_LAYERNRColumn); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public void SetOL_LAYERNRNull() { + this[this.tableODGEOLAYERS.OL_LAYERNRColumn] = global::System.Convert.DBNull; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public bool IsOL_LEVELNull() { + return this.IsNull(this.tableODGEOLAYERS.OL_LEVELColumn); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public void SetOL_LEVELNull() { + this[this.tableODGEOLAYERS.OL_LEVELColumn] = global::System.Convert.DBNull; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public bool IsOL_PLATTOPNull() { + return this.IsNull(this.tableODGEOLAYERS.OL_PLATTOPColumn); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public void SetOL_PLATTOPNull() { + this[this.tableODGEOLAYERS.OL_PLATTOPColumn] = global::System.Convert.DBNull; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public bool IsOL_PLATBOTTOMNull() { + return this.IsNull(this.tableODGEOLAYERS.OL_PLATBOTTOMColumn); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public void SetOL_PLATBOTTOMNull() { + this[this.tableODGEOLAYERS.OL_PLATBOTTOMColumn] = global::System.Convert.DBNull; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public bool IsOL_TOPEXCESSPPNull() { + return this.IsNull(this.tableODGEOLAYERS.OL_TOPEXCESSPPColumn); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public void SetOL_TOPEXCESSPPNull() { + this[this.tableODGEOLAYERS.OL_TOPEXCESSPPColumn] = global::System.Convert.DBNull; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public bool IsOL_BOTEXCESSPPNull() { + return this.IsNull(this.tableODGEOLAYERS.OL_BOTEXCESSPPColumn); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public void SetOL_BOTEXCESSPPNull() { + this[this.tableODGEOLAYERS.OL_BOTEXCESSPPColumn] = global::System.Convert.DBNull; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public bool IsOL_OCRNull() { + return this.IsNull(this.tableODGEOLAYERS.OL_OCRColumn); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public void SetOL_OCRNull() { + this[this.tableODGEOLAYERS.OL_OCRColumn] = global::System.Convert.DBNull; + } + } + + /// + ///Represents strongly named DataRow class. + /// + public partial class MATERIALSRow : global::System.Data.DataRow { + + private MATERIALSDataTable tableMATERIALS; + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + internal MATERIALSRow(global::System.Data.DataRowBuilder rb) : + base(rb) { + this.tableMATERIALS = ((MATERIALSDataTable)(this.Table)); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public int MA_NR { + get { + return ((int)(this[this.tableMATERIALS.MA_NRColumn])); + } + set { + this[this.tableMATERIALS.MA_NRColumn] = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public string MA_NAME { + get { + try { + return ((string)(this[this.tableMATERIALS.MA_NAMEColumn])); + } + catch (global::System.InvalidCastException e) { + throw new global::System.Data.StrongTypingException("The value for column \'MA_NAME\' in table \'MATERIALS\' is DBNull.", e); + } + } + set { + this[this.tableMATERIALS.MA_NAMEColumn] = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public string MA_DESCR { + get { + try { + return ((string)(this[this.tableMATERIALS.MA_DESCRColumn])); + } + catch (global::System.InvalidCastException e) { + throw new global::System.Data.StrongTypingException("The value for column \'MA_DESCR\' in table \'MATERIALS\' is DBNull.", e); + } + } + set { + this[this.tableMATERIALS.MA_DESCRColumn] = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public int MA_INDEX { + get { + try { + return ((int)(this[this.tableMATERIALS.MA_INDEXColumn])); + } + catch (global::System.InvalidCastException e) { + throw new global::System.Data.StrongTypingException("The value for column \'MA_INDEX\' in table \'MATERIALS\' is DBNull.", e); + } + } + set { + this[this.tableMATERIALS.MA_INDEXColumn] = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public bool IsMA_NAMENull() { + return this.IsNull(this.tableMATERIALS.MA_NAMEColumn); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public void SetMA_NAMENull() { + this[this.tableMATERIALS.MA_NAMEColumn] = global::System.Convert.DBNull; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public bool IsMA_DESCRNull() { + return this.IsNull(this.tableMATERIALS.MA_DESCRColumn); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public void SetMA_DESCRNull() { + this[this.tableMATERIALS.MA_DESCRColumn] = global::System.Convert.DBNull; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public bool IsMA_INDEXNull() { + return this.IsNull(this.tableMATERIALS.MA_INDEXColumn); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public void SetMA_INDEXNull() { + this[this.tableMATERIALS.MA_INDEXColumn] = global::System.Convert.DBNull; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public ODGEOLAYERSRow[] GetODGEOLAYERSRows() { + if ((this.Table.ChildRelations["ODGEOLAYERS_MATERIALS"] == null)) { + return new ODGEOLAYERSRow[0]; + } + else { + return ((ODGEOLAYERSRow[])(base.GetChildRows(this.Table.ChildRelations["ODGEOLAYERS_MATERIALS"]))); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public PARAMETERVALUESRow[] GetPARAMETERVALUESRows() { + if ((this.Table.ChildRelations["PARAMETERVALUES_MATERIALS"] == null)) { + return new PARAMETERVALUESRow[0]; + } + else { + return ((PARAMETERVALUESRow[])(base.GetChildRows(this.Table.ChildRelations["PARAMETERVALUES_MATERIALS"]))); + } + } + } + + /// + ///Represents strongly named DataRow class. + /// + public partial class PARAMETERNAMESRow : global::System.Data.DataRow { + + private PARAMETERNAMESDataTable tablePARAMETERNAMES; + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + internal PARAMETERNAMESRow(global::System.Data.DataRowBuilder rb) : + base(rb) { + this.tablePARAMETERNAMES = ((PARAMETERNAMESDataTable)(this.Table)); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public int PN_NR { + get { + return ((int)(this[this.tablePARAMETERNAMES.PN_NRColumn])); + } + set { + this[this.tablePARAMETERNAMES.PN_NRColumn] = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public string PN_NAME { + get { + try { + return ((string)(this[this.tablePARAMETERNAMES.PN_NAMEColumn])); + } + catch (global::System.InvalidCastException e) { + throw new global::System.Data.StrongTypingException("The value for column \'PN_NAME\' in table \'PARAMETERNAMES\' is DBNull.", e); + } + } + set { + this[this.tablePARAMETERNAMES.PN_NAMEColumn] = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public bool IsPN_NAMENull() { + return this.IsNull(this.tablePARAMETERNAMES.PN_NAMEColumn); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public void SetPN_NAMENull() { + this[this.tablePARAMETERNAMES.PN_NAMEColumn] = global::System.Convert.DBNull; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public PARAMETERVALUESRow[] GetPARAMETERVALUESRows() { + if ((this.Table.ChildRelations["PARAMETERNAMES_PARAMETERVALUES"] == null)) { + return new PARAMETERVALUESRow[0]; + } + else { + return ((PARAMETERVALUESRow[])(base.GetChildRows(this.Table.ChildRelations["PARAMETERNAMES_PARAMETERVALUES"]))); + } + } + } + + /// + ///Represents strongly named DataRow class. + /// + public partial class PARAMETERVALUESRow : global::System.Data.DataRow { + + private PARAMETERVALUESDataTable tablePARAMETERVALUES; + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + internal PARAMETERVALUESRow(global::System.Data.DataRowBuilder rb) : + base(rb) { + this.tablePARAMETERVALUES = ((PARAMETERVALUESDataTable)(this.Table)); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public int PV_NR { + get { + return ((int)(this[this.tablePARAMETERVALUES.PV_NRColumn])); + } + set { + this[this.tablePARAMETERVALUES.PV_NRColumn] = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public int MA_NR { + get { + try { + return ((int)(this[this.tablePARAMETERVALUES.MA_NRColumn])); + } + catch (global::System.InvalidCastException e) { + throw new global::System.Data.StrongTypingException("The value for column \'MA_NR\' in table \'PARAMETERVALUES\' is DBNull.", e); + } + } + set { + this[this.tablePARAMETERVALUES.MA_NRColumn] = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public int PN_NR { + get { + try { + return ((int)(this[this.tablePARAMETERVALUES.PN_NRColumn])); + } + catch (global::System.InvalidCastException e) { + throw new global::System.Data.StrongTypingException("The value for column \'PN_NR\' in table \'PARAMETERVALUES\' is DBNull.", e); + } + } + set { + this[this.tablePARAMETERVALUES.PN_NRColumn] = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public double PV_VALUE { + get { + try { + return ((double)(this[this.tablePARAMETERVALUES.PV_VALUEColumn])); + } + catch (global::System.InvalidCastException e) { + throw new global::System.Data.StrongTypingException("The value for column \'PV_VALUE\' in table \'PARAMETERVALUES\' is DBNull.", e); + } + } + set { + this[this.tablePARAMETERVALUES.PV_VALUEColumn] = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public MATERIALSRow MATERIALSRow { + get { + return ((MATERIALSRow)(this.GetParentRow(this.Table.ParentRelations["PARAMETERVALUES_MATERIALS"]))); + } + set { + this.SetParentRow(value, this.Table.ParentRelations["PARAMETERVALUES_MATERIALS"]); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public PARAMETERNAMESRow PARAMETERNAMESRow { + get { + return ((PARAMETERNAMESRow)(this.GetParentRow(this.Table.ParentRelations["PARAMETERNAMES_PARAMETERVALUES"]))); + } + set { + this.SetParentRow(value, this.Table.ParentRelations["PARAMETERNAMES_PARAMETERVALUES"]); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public bool IsMA_NRNull() { + return this.IsNull(this.tablePARAMETERVALUES.MA_NRColumn); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public void SetMA_NRNull() { + this[this.tablePARAMETERVALUES.MA_NRColumn] = global::System.Convert.DBNull; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public bool IsPN_NRNull() { + return this.IsNull(this.tablePARAMETERVALUES.PN_NRColumn); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public void SetPN_NRNull() { + this[this.tablePARAMETERVALUES.PN_NRColumn] = global::System.Convert.DBNull; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public bool IsPV_VALUENull() { + return this.IsNull(this.tablePARAMETERVALUES.PV_VALUEColumn); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public void SetPV_VALUENull() { + this[this.tablePARAMETERVALUES.PV_VALUEColumn] = global::System.Convert.DBNull; + } + } + + /// + ///Row event argument class + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public class ODGEOMETRIESRowChangeEvent : global::System.EventArgs { + + private ODGEOMETRIESRow eventRow; + + private global::System.Data.DataRowAction eventAction; + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public ODGEOMETRIESRowChangeEvent(ODGEOMETRIESRow row, global::System.Data.DataRowAction action) { + this.eventRow = row; + this.eventAction = action; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public ODGEOMETRIESRow Row { + get { + return this.eventRow; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public global::System.Data.DataRowAction Action { + get { + return this.eventAction; + } + } + } + + /// + ///Row event argument class + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public class ODGEOLAYERSRowChangeEvent : global::System.EventArgs { + + private ODGEOLAYERSRow eventRow; + + private global::System.Data.DataRowAction eventAction; + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public ODGEOLAYERSRowChangeEvent(ODGEOLAYERSRow row, global::System.Data.DataRowAction action) { + this.eventRow = row; + this.eventAction = action; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public ODGEOLAYERSRow Row { + get { + return this.eventRow; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public global::System.Data.DataRowAction Action { + get { + return this.eventAction; + } + } + } + + /// + ///Row event argument class + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public class MATERIALSRowChangeEvent : global::System.EventArgs { + + private MATERIALSRow eventRow; + + private global::System.Data.DataRowAction eventAction; + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public MATERIALSRowChangeEvent(MATERIALSRow row, global::System.Data.DataRowAction action) { + this.eventRow = row; + this.eventAction = action; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public MATERIALSRow Row { + get { + return this.eventRow; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public global::System.Data.DataRowAction Action { + get { + return this.eventAction; + } + } + } + + /// + ///Row event argument class + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public class PARAMETERNAMESRowChangeEvent : global::System.EventArgs { + + private PARAMETERNAMESRow eventRow; + + private global::System.Data.DataRowAction eventAction; + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public PARAMETERNAMESRowChangeEvent(PARAMETERNAMESRow row, global::System.Data.DataRowAction action) { + this.eventRow = row; + this.eventAction = action; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public PARAMETERNAMESRow Row { + get { + return this.eventRow; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public global::System.Data.DataRowAction Action { + get { + return this.eventAction; + } + } + } + + /// + ///Row event argument class + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public class PARAMETERVALUESRowChangeEvent : global::System.EventArgs { + + private PARAMETERVALUESRow eventRow; + + private global::System.Data.DataRowAction eventAction; + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public PARAMETERVALUESRowChangeEvent(PARAMETERVALUESRow row, global::System.Data.DataRowAction action) { + this.eventRow = row; + this.eventAction = action; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public PARAMETERVALUESRow Row { + get { + return this.eventRow; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public global::System.Data.DataRowAction Action { + get { + return this.eventAction; + } + } + } + } +} +namespace Deltares.Dam.Data.Xsd.SoilProfileDataSetTableAdapters { + + + /// + ///Represents the connection and commands used to retrieve and save data. + /// + [global::System.ComponentModel.DesignerCategoryAttribute("code")] + [global::System.ComponentModel.ToolboxItem(true)] + [global::System.ComponentModel.DataObjectAttribute(true)] + [global::System.ComponentModel.DesignerAttribute("Microsoft.VSDesigner.DataSource.Design.TableAdapterDesigner, Microsoft.VSDesigner" + + ", Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] + [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] + public partial class ODGEOMETRIESTableAdapter : global::System.ComponentModel.Component { + + private global::System.Data.Odbc.OdbcDataAdapter _adapter; + + private global::System.Data.Odbc.OdbcConnection _connection; + + private global::System.Data.Odbc.OdbcTransaction _transaction; + + private global::System.Data.Odbc.OdbcCommand[] _commandCollection; + + private bool _clearBeforeFill; + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public ODGEOMETRIESTableAdapter() { + this.ClearBeforeFill = true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + protected internal global::System.Data.Odbc.OdbcDataAdapter Adapter { + get { + if ((this._adapter == null)) { + this.InitAdapter(); + } + return this._adapter; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + internal global::System.Data.Odbc.OdbcConnection Connection { + get { + if ((this._connection == null)) { + this.InitConnection(); + } + return this._connection; + } + set { + this._connection = value; + if ((this.Adapter.InsertCommand != null)) { + this.Adapter.InsertCommand.Connection = value; + } + if ((this.Adapter.DeleteCommand != null)) { + this.Adapter.DeleteCommand.Connection = value; + } + if ((this.Adapter.UpdateCommand != null)) { + this.Adapter.UpdateCommand.Connection = value; + } + for (int i = 0; (i < this.CommandCollection.Length); i = (i + 1)) { + if ((this.CommandCollection[i] != null)) { + ((global::System.Data.Odbc.OdbcCommand)(this.CommandCollection[i])).Connection = value; + } + } + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + internal global::System.Data.Odbc.OdbcTransaction Transaction { + get { + return this._transaction; + } + set { + this._transaction = value; + for (int i = 0; (i < this.CommandCollection.Length); i = (i + 1)) { + this.CommandCollection[i].Transaction = this._transaction; + } + if (((this.Adapter != null) + && (this.Adapter.DeleteCommand != null))) { + this.Adapter.DeleteCommand.Transaction = this._transaction; + } + if (((this.Adapter != null) + && (this.Adapter.InsertCommand != null))) { + this.Adapter.InsertCommand.Transaction = this._transaction; + } + if (((this.Adapter != null) + && (this.Adapter.UpdateCommand != null))) { + this.Adapter.UpdateCommand.Transaction = this._transaction; + } + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + protected global::System.Data.Odbc.OdbcCommand[] CommandCollection { + get { + if ((this._commandCollection == null)) { + this.InitCommandCollection(); + } + return this._commandCollection; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public bool ClearBeforeFill { + get { + return this._clearBeforeFill; + } + set { + this._clearBeforeFill = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + private void InitAdapter() { + this._adapter = new global::System.Data.Odbc.OdbcDataAdapter(); + global::System.Data.Common.DataTableMapping tableMapping = new global::System.Data.Common.DataTableMapping(); + tableMapping.SourceTable = "Table"; + tableMapping.DataSetTable = "ODGEOMETRIES"; + tableMapping.ColumnMappings.Add("OD_NR", "OD_NR"); + tableMapping.ColumnMappings.Add("OD_NAME", "OD_NAME"); + tableMapping.ColumnMappings.Add("OD_DESCR", "OD_DESCR"); + tableMapping.ColumnMappings.Add("OD_RDX", "OD_RDX"); + tableMapping.ColumnMappings.Add("OD_RDY", "OD_RDY"); + tableMapping.ColumnMappings.Add("OD_CPTNR", "OD_CPTNR"); + tableMapping.ColumnMappings.Add("OD_BORINGNR", "OD_BORINGNR"); + tableMapping.ColumnMappings.Add("OD_GEOL_ZONE", "OD_GEOL_ZONE"); + tableMapping.ColumnMappings.Add("OD_CHANCE_OCCUR", "OD_CHANCE_OCCUR"); + this._adapter.TableMappings.Add(tableMapping); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + private void InitConnection() { + this._connection = new global::System.Data.Odbc.OdbcConnection(); + this._connection.ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + private void InitCommandCollection() { + this._commandCollection = new global::System.Data.Odbc.OdbcCommand[1]; + this._commandCollection[0] = new global::System.Data.Odbc.OdbcCommand(); + this._commandCollection[0].Connection = this.Connection; + this._commandCollection[0].CommandText = "SELECT OD_NR, OD_NAME, OD_DESCR, OD_RDX, OD_RDY, OD_CPTNR, OD_BORINGNR, OD_GEOL_Z" + + "ONE, OD_CHANCE_OCCUR FROM ODGEOMETRIES"; + this._commandCollection[0].CommandType = global::System.Data.CommandType.Text; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] + [global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Select, true)] + public virtual SoilProfileDataSet.ODGEOMETRIESDataTable GetData() { + this.Adapter.SelectCommand = this.CommandCollection[0]; + SoilProfileDataSet.ODGEOMETRIESDataTable dataTable = new SoilProfileDataSet.ODGEOMETRIESDataTable(); + this.Adapter.Fill(dataTable); + return dataTable; + } + } + + /// + ///Represents the connection and commands used to retrieve and save data. + /// + [global::System.ComponentModel.DesignerCategoryAttribute("code")] + [global::System.ComponentModel.ToolboxItem(true)] + [global::System.ComponentModel.DataObjectAttribute(true)] + [global::System.ComponentModel.DesignerAttribute("Microsoft.VSDesigner.DataSource.Design.TableAdapterDesigner, Microsoft.VSDesigner" + + ", Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] + [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] + public partial class ODGEOLAYERSTableAdapter : global::System.ComponentModel.Component { + + private global::System.Data.Odbc.OdbcDataAdapter _adapter; + + private global::System.Data.Odbc.OdbcConnection _connection; + + private global::System.Data.Odbc.OdbcTransaction _transaction; + + private global::System.Data.Odbc.OdbcCommand[] _commandCollection; + + private bool _clearBeforeFill; + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public ODGEOLAYERSTableAdapter() { + this.ClearBeforeFill = true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + protected internal global::System.Data.Odbc.OdbcDataAdapter Adapter { + get { + if ((this._adapter == null)) { + this.InitAdapter(); + } + return this._adapter; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + internal global::System.Data.Odbc.OdbcConnection Connection { + get { + if ((this._connection == null)) { + this.InitConnection(); + } + return this._connection; + } + set { + this._connection = value; + if ((this.Adapter.InsertCommand != null)) { + this.Adapter.InsertCommand.Connection = value; + } + if ((this.Adapter.DeleteCommand != null)) { + this.Adapter.DeleteCommand.Connection = value; + } + if ((this.Adapter.UpdateCommand != null)) { + this.Adapter.UpdateCommand.Connection = value; + } + for (int i = 0; (i < this.CommandCollection.Length); i = (i + 1)) { + if ((this.CommandCollection[i] != null)) { + ((global::System.Data.Odbc.OdbcCommand)(this.CommandCollection[i])).Connection = value; + } + } + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + internal global::System.Data.Odbc.OdbcTransaction Transaction { + get { + return this._transaction; + } + set { + this._transaction = value; + for (int i = 0; (i < this.CommandCollection.Length); i = (i + 1)) { + this.CommandCollection[i].Transaction = this._transaction; + } + if (((this.Adapter != null) + && (this.Adapter.DeleteCommand != null))) { + this.Adapter.DeleteCommand.Transaction = this._transaction; + } + if (((this.Adapter != null) + && (this.Adapter.InsertCommand != null))) { + this.Adapter.InsertCommand.Transaction = this._transaction; + } + if (((this.Adapter != null) + && (this.Adapter.UpdateCommand != null))) { + this.Adapter.UpdateCommand.Transaction = this._transaction; + } + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + protected global::System.Data.Odbc.OdbcCommand[] CommandCollection { + get { + if ((this._commandCollection == null)) { + this.InitCommandCollection(); + } + return this._commandCollection; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public bool ClearBeforeFill { + get { + return this._clearBeforeFill; + } + set { + this._clearBeforeFill = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + private void InitAdapter() { + this._adapter = new global::System.Data.Odbc.OdbcDataAdapter(); + global::System.Data.Common.DataTableMapping tableMapping = new global::System.Data.Common.DataTableMapping(); + tableMapping.SourceTable = "Table"; + tableMapping.DataSetTable = "ODGEOLAYERS"; + tableMapping.ColumnMappings.Add("OL_NR", "OL_NR"); + tableMapping.ColumnMappings.Add("OD_NR", "OD_NR"); + tableMapping.ColumnMappings.Add("MA_NR", "MA_NR"); + tableMapping.ColumnMappings.Add("OL_LAYERNR", "OL_LAYERNR"); + tableMapping.ColumnMappings.Add("OL_LEVEL", "OL_LEVEL"); + tableMapping.ColumnMappings.Add("OL_PLATTOP", "OL_PLATTOP"); + tableMapping.ColumnMappings.Add("OL_PLATBOTTOM", "OL_PLATBOTTOM"); + tableMapping.ColumnMappings.Add("OL_TOPEXCESSPP", "OL_TOPEXCESSPP"); + tableMapping.ColumnMappings.Add("OL_BOTEXCESSPP", "OL_BOTEXCESSPP"); + tableMapping.ColumnMappings.Add("OL_OCR", "OL_OCR"); + this._adapter.TableMappings.Add(tableMapping); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + private void InitConnection() { + this._connection = new global::System.Data.Odbc.OdbcConnection(); + this._connection.ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + private void InitCommandCollection() { + this._commandCollection = new global::System.Data.Odbc.OdbcCommand[1]; + this._commandCollection[0] = new global::System.Data.Odbc.OdbcCommand(); + this._commandCollection[0].Connection = this.Connection; + this._commandCollection[0].CommandText = "SELECT OL_NR, OD_NR, MA_NR, OL_LAYERNR, OL_LEVEL, OL_PLATTOP, OL_PLATBOTTOM, OL_T" + + "OPEXCESSPP, OL_BOTEXCESSPP, OL_OCR FROM ODGEOLAYERS"; + this._commandCollection[0].CommandType = global::System.Data.CommandType.Text; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] + [global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Select, true)] + public virtual SoilProfileDataSet.ODGEOLAYERSDataTable GetData() { + this.Adapter.SelectCommand = this.CommandCollection[0]; + SoilProfileDataSet.ODGEOLAYERSDataTable dataTable = new SoilProfileDataSet.ODGEOLAYERSDataTable(); + this.Adapter.Fill(dataTable); + return dataTable; + } + } + + /// + ///Represents the connection and commands used to retrieve and save data. + /// + [global::System.ComponentModel.DesignerCategoryAttribute("code")] + [global::System.ComponentModel.ToolboxItem(true)] + [global::System.ComponentModel.DataObjectAttribute(true)] + [global::System.ComponentModel.DesignerAttribute("Microsoft.VSDesigner.DataSource.Design.TableAdapterDesigner, Microsoft.VSDesigner" + + ", Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] + [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] + public partial class MATERIALSTableAdapter : global::System.ComponentModel.Component { + + private global::System.Data.Odbc.OdbcDataAdapter _adapter; + + private global::System.Data.Odbc.OdbcConnection _connection; + + private global::System.Data.Odbc.OdbcTransaction _transaction; + + private global::System.Data.Odbc.OdbcCommand[] _commandCollection; + + private bool _clearBeforeFill; + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public MATERIALSTableAdapter() { + this.ClearBeforeFill = true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + protected internal global::System.Data.Odbc.OdbcDataAdapter Adapter { + get { + if ((this._adapter == null)) { + this.InitAdapter(); + } + return this._adapter; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + internal global::System.Data.Odbc.OdbcConnection Connection { + get { + if ((this._connection == null)) { + this.InitConnection(); + } + return this._connection; + } + set { + this._connection = value; + if ((this.Adapter.InsertCommand != null)) { + this.Adapter.InsertCommand.Connection = value; + } + if ((this.Adapter.DeleteCommand != null)) { + this.Adapter.DeleteCommand.Connection = value; + } + if ((this.Adapter.UpdateCommand != null)) { + this.Adapter.UpdateCommand.Connection = value; + } + for (int i = 0; (i < this.CommandCollection.Length); i = (i + 1)) { + if ((this.CommandCollection[i] != null)) { + ((global::System.Data.Odbc.OdbcCommand)(this.CommandCollection[i])).Connection = value; + } + } + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + internal global::System.Data.Odbc.OdbcTransaction Transaction { + get { + return this._transaction; + } + set { + this._transaction = value; + for (int i = 0; (i < this.CommandCollection.Length); i = (i + 1)) { + this.CommandCollection[i].Transaction = this._transaction; + } + if (((this.Adapter != null) + && (this.Adapter.DeleteCommand != null))) { + this.Adapter.DeleteCommand.Transaction = this._transaction; + } + if (((this.Adapter != null) + && (this.Adapter.InsertCommand != null))) { + this.Adapter.InsertCommand.Transaction = this._transaction; + } + if (((this.Adapter != null) + && (this.Adapter.UpdateCommand != null))) { + this.Adapter.UpdateCommand.Transaction = this._transaction; + } + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + protected global::System.Data.Odbc.OdbcCommand[] CommandCollection { + get { + if ((this._commandCollection == null)) { + this.InitCommandCollection(); + } + return this._commandCollection; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public bool ClearBeforeFill { + get { + return this._clearBeforeFill; + } + set { + this._clearBeforeFill = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + private void InitAdapter() { + this._adapter = new global::System.Data.Odbc.OdbcDataAdapter(); + global::System.Data.Common.DataTableMapping tableMapping = new global::System.Data.Common.DataTableMapping(); + tableMapping.SourceTable = "Table"; + tableMapping.DataSetTable = "MATERIALS"; + tableMapping.ColumnMappings.Add("MA_NR", "MA_NR"); + tableMapping.ColumnMappings.Add("MA_NAME", "MA_NAME"); + tableMapping.ColumnMappings.Add("MA_DESCR", "MA_DESCR"); + tableMapping.ColumnMappings.Add("MA_INDEX", "MA_INDEX"); + this._adapter.TableMappings.Add(tableMapping); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + private void InitConnection() { + this._connection = new global::System.Data.Odbc.OdbcConnection(); + this._connection.ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + private void InitCommandCollection() { + this._commandCollection = new global::System.Data.Odbc.OdbcCommand[1]; + this._commandCollection[0] = new global::System.Data.Odbc.OdbcCommand(); + this._commandCollection[0].Connection = this.Connection; + this._commandCollection[0].CommandText = "SELECT MA_NR, MA_NAME, MA_DESCR, MA_INDEX FROM MATERIALS"; + this._commandCollection[0].CommandType = global::System.Data.CommandType.Text; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] + [global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Select, true)] + public virtual SoilProfileDataSet.MATERIALSDataTable GetData() { + this.Adapter.SelectCommand = this.CommandCollection[0]; + SoilProfileDataSet.MATERIALSDataTable dataTable = new SoilProfileDataSet.MATERIALSDataTable(); + this.Adapter.Fill(dataTable); + return dataTable; + } + } + + /// + ///Represents the connection and commands used to retrieve and save data. + /// + [global::System.ComponentModel.DesignerCategoryAttribute("code")] + [global::System.ComponentModel.ToolboxItem(true)] + [global::System.ComponentModel.DataObjectAttribute(true)] + [global::System.ComponentModel.DesignerAttribute("Microsoft.VSDesigner.DataSource.Design.TableAdapterDesigner, Microsoft.VSDesigner" + + ", Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] + [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] + public partial class PARAMETERNAMESTableAdapter : global::System.ComponentModel.Component { + + private global::System.Data.Odbc.OdbcDataAdapter _adapter; + + private global::System.Data.Odbc.OdbcConnection _connection; + + private global::System.Data.Odbc.OdbcTransaction _transaction; + + private global::System.Data.Odbc.OdbcCommand[] _commandCollection; + + private bool _clearBeforeFill; + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public PARAMETERNAMESTableAdapter() { + this.ClearBeforeFill = true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + protected internal global::System.Data.Odbc.OdbcDataAdapter Adapter { + get { + if ((this._adapter == null)) { + this.InitAdapter(); + } + return this._adapter; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + internal global::System.Data.Odbc.OdbcConnection Connection { + get { + if ((this._connection == null)) { + this.InitConnection(); + } + return this._connection; + } + set { + this._connection = value; + if ((this.Adapter.InsertCommand != null)) { + this.Adapter.InsertCommand.Connection = value; + } + if ((this.Adapter.DeleteCommand != null)) { + this.Adapter.DeleteCommand.Connection = value; + } + if ((this.Adapter.UpdateCommand != null)) { + this.Adapter.UpdateCommand.Connection = value; + } + for (int i = 0; (i < this.CommandCollection.Length); i = (i + 1)) { + if ((this.CommandCollection[i] != null)) { + ((global::System.Data.Odbc.OdbcCommand)(this.CommandCollection[i])).Connection = value; + } + } + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + internal global::System.Data.Odbc.OdbcTransaction Transaction { + get { + return this._transaction; + } + set { + this._transaction = value; + for (int i = 0; (i < this.CommandCollection.Length); i = (i + 1)) { + this.CommandCollection[i].Transaction = this._transaction; + } + if (((this.Adapter != null) + && (this.Adapter.DeleteCommand != null))) { + this.Adapter.DeleteCommand.Transaction = this._transaction; + } + if (((this.Adapter != null) + && (this.Adapter.InsertCommand != null))) { + this.Adapter.InsertCommand.Transaction = this._transaction; + } + if (((this.Adapter != null) + && (this.Adapter.UpdateCommand != null))) { + this.Adapter.UpdateCommand.Transaction = this._transaction; + } + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + protected global::System.Data.Odbc.OdbcCommand[] CommandCollection { + get { + if ((this._commandCollection == null)) { + this.InitCommandCollection(); + } + return this._commandCollection; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public bool ClearBeforeFill { + get { + return this._clearBeforeFill; + } + set { + this._clearBeforeFill = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + private void InitAdapter() { + this._adapter = new global::System.Data.Odbc.OdbcDataAdapter(); + global::System.Data.Common.DataTableMapping tableMapping = new global::System.Data.Common.DataTableMapping(); + tableMapping.SourceTable = "Table"; + tableMapping.DataSetTable = "PARAMETERNAMES"; + tableMapping.ColumnMappings.Add("PN_NR", "PN_NR"); + tableMapping.ColumnMappings.Add("PN_NAME", "PN_NAME"); + this._adapter.TableMappings.Add(tableMapping); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + private void InitConnection() { + this._connection = new global::System.Data.Odbc.OdbcConnection(); + this._connection.ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + private void InitCommandCollection() { + this._commandCollection = new global::System.Data.Odbc.OdbcCommand[1]; + this._commandCollection[0] = new global::System.Data.Odbc.OdbcCommand(); + this._commandCollection[0].Connection = this.Connection; + this._commandCollection[0].CommandText = "SELECT PN_NR, PN_NAME FROM PARAMETERNAMES"; + this._commandCollection[0].CommandType = global::System.Data.CommandType.Text; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] + [global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Select, true)] + public virtual SoilProfileDataSet.PARAMETERNAMESDataTable GetData() { + this.Adapter.SelectCommand = this.CommandCollection[0]; + SoilProfileDataSet.PARAMETERNAMESDataTable dataTable = new SoilProfileDataSet.PARAMETERNAMESDataTable(); + this.Adapter.Fill(dataTable); + return dataTable; + } + } + + /// + ///Represents the connection and commands used to retrieve and save data. + /// + [global::System.ComponentModel.DesignerCategoryAttribute("code")] + [global::System.ComponentModel.ToolboxItem(true)] + [global::System.ComponentModel.DataObjectAttribute(true)] + [global::System.ComponentModel.DesignerAttribute("Microsoft.VSDesigner.DataSource.Design.TableAdapterDesigner, Microsoft.VSDesigner" + + ", Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] + [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] + public partial class PARAMETERVALUESTableAdapter : global::System.ComponentModel.Component { + + private global::System.Data.Odbc.OdbcDataAdapter _adapter; + + private global::System.Data.Odbc.OdbcConnection _connection; + + private global::System.Data.Odbc.OdbcTransaction _transaction; + + private global::System.Data.Odbc.OdbcCommand[] _commandCollection; + + private bool _clearBeforeFill; + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public PARAMETERVALUESTableAdapter() { + this.ClearBeforeFill = true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + protected internal global::System.Data.Odbc.OdbcDataAdapter Adapter { + get { + if ((this._adapter == null)) { + this.InitAdapter(); + } + return this._adapter; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + internal global::System.Data.Odbc.OdbcConnection Connection { + get { + if ((this._connection == null)) { + this.InitConnection(); + } + return this._connection; + } + set { + this._connection = value; + if ((this.Adapter.InsertCommand != null)) { + this.Adapter.InsertCommand.Connection = value; + } + if ((this.Adapter.DeleteCommand != null)) { + this.Adapter.DeleteCommand.Connection = value; + } + if ((this.Adapter.UpdateCommand != null)) { + this.Adapter.UpdateCommand.Connection = value; + } + for (int i = 0; (i < this.CommandCollection.Length); i = (i + 1)) { + if ((this.CommandCollection[i] != null)) { + ((global::System.Data.Odbc.OdbcCommand)(this.CommandCollection[i])).Connection = value; + } + } + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + internal global::System.Data.Odbc.OdbcTransaction Transaction { + get { + return this._transaction; + } + set { + this._transaction = value; + for (int i = 0; (i < this.CommandCollection.Length); i = (i + 1)) { + this.CommandCollection[i].Transaction = this._transaction; + } + if (((this.Adapter != null) + && (this.Adapter.DeleteCommand != null))) { + this.Adapter.DeleteCommand.Transaction = this._transaction; + } + if (((this.Adapter != null) + && (this.Adapter.InsertCommand != null))) { + this.Adapter.InsertCommand.Transaction = this._transaction; + } + if (((this.Adapter != null) + && (this.Adapter.UpdateCommand != null))) { + this.Adapter.UpdateCommand.Transaction = this._transaction; + } + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + protected global::System.Data.Odbc.OdbcCommand[] CommandCollection { + get { + if ((this._commandCollection == null)) { + this.InitCommandCollection(); + } + return this._commandCollection; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public bool ClearBeforeFill { + get { + return this._clearBeforeFill; + } + set { + this._clearBeforeFill = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + private void InitAdapter() { + this._adapter = new global::System.Data.Odbc.OdbcDataAdapter(); + global::System.Data.Common.DataTableMapping tableMapping = new global::System.Data.Common.DataTableMapping(); + tableMapping.SourceTable = "Table"; + tableMapping.DataSetTable = "PARAMETERVALUES"; + tableMapping.ColumnMappings.Add("PV_NR", "PV_NR"); + tableMapping.ColumnMappings.Add("MA_NR", "MA_NR"); + tableMapping.ColumnMappings.Add("PN_NR", "PN_NR"); + tableMapping.ColumnMappings.Add("PV_VALUE", "PV_VALUE"); + this._adapter.TableMappings.Add(tableMapping); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + private void InitConnection() { + this._connection = new global::System.Data.Odbc.OdbcConnection(); + this._connection.ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + private void InitCommandCollection() { + this._commandCollection = new global::System.Data.Odbc.OdbcCommand[1]; + this._commandCollection[0] = new global::System.Data.Odbc.OdbcCommand(); + this._commandCollection[0].Connection = this.Connection; + this._commandCollection[0].CommandText = "SELECT PV_NR, MA_NR, PN_NR, PV_VALUE FROM PARAMETERVALUES"; + this._commandCollection[0].CommandType = global::System.Data.CommandType.Text; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] + [global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Select, true)] + public virtual SoilProfileDataSet.PARAMETERVALUESDataTable GetData() { + this.Adapter.SelectCommand = this.CommandCollection[0]; + SoilProfileDataSet.PARAMETERVALUESDataTable dataTable = new SoilProfileDataSet.PARAMETERVALUESDataTable(); + this.Adapter.Fill(dataTable); + return dataTable; + } + } + + /// + ///TableAdapterManager is used to coordinate TableAdapters in the dataset to enable Hierarchical Update scenarios + /// + [global::System.ComponentModel.DesignerCategoryAttribute("code")] + [global::System.ComponentModel.ToolboxItem(true)] + [global::System.ComponentModel.DesignerAttribute("Microsoft.VSDesigner.DataSource.Design.TableAdapterManagerDesigner, Microsoft.VSD" + + "esigner, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] + [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapterManager")] + public partial class TableAdapterManager : global::System.ComponentModel.Component { + + private UpdateOrderOption _updateOrder; + + private bool _backupDataSetBeforeUpdate; + + private global::System.Data.IDbConnection _connection; + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public UpdateOrderOption UpdateOrder { + get { + return this._updateOrder; + } + set { + this._updateOrder = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public bool BackupDataSetBeforeUpdate { + get { + return this._backupDataSetBeforeUpdate; + } + set { + this._backupDataSetBeforeUpdate = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + [global::System.ComponentModel.Browsable(false)] + public global::System.Data.IDbConnection Connection { + get { + if ((this._connection != null)) { + return this._connection; + } + return null; + } + set { + this._connection = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + [global::System.ComponentModel.Browsable(false)] + public int TableAdapterInstanceCount { + get { + int count = 0; + return count; + } + } + + /// + ///Update rows in top-down order. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + private int UpdateUpdatedRows(SoilProfileDataSet dataSet, global::System.Collections.Generic.List allChangedRows, global::System.Collections.Generic.List allAddedRows) { + int result = 0; + return result; + } + + /// + ///Insert rows in top-down order. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + private int UpdateInsertedRows(SoilProfileDataSet dataSet, global::System.Collections.Generic.List allAddedRows) { + int result = 0; + return result; + } + + /// + ///Delete rows in bottom-up order. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + private int UpdateDeletedRows(SoilProfileDataSet dataSet, global::System.Collections.Generic.List allChangedRows) { + int result = 0; + return result; + } + + /// + ///Remove inserted rows that become updated rows after calling TableAdapter.Update(inserted rows) first + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + private global::System.Data.DataRow[] GetRealUpdatedRows(global::System.Data.DataRow[] updatedRows, global::System.Collections.Generic.List allAddedRows) { + if (((updatedRows == null) + || (updatedRows.Length < 1))) { + return updatedRows; + } + if (((allAddedRows == null) + || (allAddedRows.Count < 1))) { + return updatedRows; + } + global::System.Collections.Generic.List realUpdatedRows = new global::System.Collections.Generic.List(); + for (int i = 0; (i < updatedRows.Length); i = (i + 1)) { + global::System.Data.DataRow row = updatedRows[i]; + if ((allAddedRows.Contains(row) == false)) { + realUpdatedRows.Add(row); + } + } + return realUpdatedRows.ToArray(); + } + + /// + ///Update all changes to the dataset. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public virtual int UpdateAll(SoilProfileDataSet dataSet) { + if ((dataSet == null)) { + throw new global::System.ArgumentNullException("dataSet"); + } + if ((dataSet.HasChanges() == false)) { + return 0; + } + global::System.Data.IDbConnection workConnection = this.Connection; + if ((workConnection == null)) { + throw new global::System.ApplicationException("TableAdapterManager contains no connection information. Set each TableAdapterMana" + + "ger TableAdapter property to a valid TableAdapter instance."); + } + bool workConnOpened = false; + if (((workConnection.State & global::System.Data.ConnectionState.Broken) + == global::System.Data.ConnectionState.Broken)) { + workConnection.Close(); + } + if ((workConnection.State == global::System.Data.ConnectionState.Closed)) { + workConnection.Open(); + workConnOpened = true; + } + global::System.Data.IDbTransaction workTransaction = workConnection.BeginTransaction(); + if ((workTransaction == null)) { + throw new global::System.ApplicationException("The transaction cannot begin. The current data connection does not support transa" + + "ctions or the current state is not allowing the transaction to begin."); + } + global::System.Collections.Generic.List allChangedRows = new global::System.Collections.Generic.List(); + global::System.Collections.Generic.List allAddedRows = new global::System.Collections.Generic.List(); + global::System.Collections.Generic.List adaptersWithAcceptChangesDuringUpdate = new global::System.Collections.Generic.List(); + global::System.Collections.Generic.Dictionary revertConnections = new global::System.Collections.Generic.Dictionary(); + int result = 0; + global::System.Data.DataSet backupDataSet = null; + if (this.BackupDataSetBeforeUpdate) { + backupDataSet = new global::System.Data.DataSet(); + backupDataSet.Merge(dataSet); + } + try { + // ---- Prepare for update ----------- + // + // + //---- Perform updates ----------- + // + if ((this.UpdateOrder == UpdateOrderOption.UpdateInsertDelete)) { + result = (result + this.UpdateUpdatedRows(dataSet, allChangedRows, allAddedRows)); + result = (result + this.UpdateInsertedRows(dataSet, allAddedRows)); + } + else { + result = (result + this.UpdateInsertedRows(dataSet, allAddedRows)); + result = (result + this.UpdateUpdatedRows(dataSet, allChangedRows, allAddedRows)); + } + result = (result + this.UpdateDeletedRows(dataSet, allChangedRows)); + // + //---- Commit updates ----------- + // + workTransaction.Commit(); + if ((0 < allAddedRows.Count)) { + global::System.Data.DataRow[] rows = new System.Data.DataRow[allAddedRows.Count]; + allAddedRows.CopyTo(rows); + for (int i = 0; (i < rows.Length); i = (i + 1)) { + global::System.Data.DataRow row = rows[i]; + row.AcceptChanges(); + } + } + if ((0 < allChangedRows.Count)) { + global::System.Data.DataRow[] rows = new System.Data.DataRow[allChangedRows.Count]; + allChangedRows.CopyTo(rows); + for (int i = 0; (i < rows.Length); i = (i + 1)) { + global::System.Data.DataRow row = rows[i]; + row.AcceptChanges(); + } + } + } + catch (global::System.Exception ex) { + workTransaction.Rollback(); + // ---- Restore the dataset ----------- + if (this.BackupDataSetBeforeUpdate) { + global::System.Diagnostics.Debug.Assert((backupDataSet != null)); + dataSet.Clear(); + dataSet.Merge(backupDataSet); + } + else { + if ((0 < allAddedRows.Count)) { + global::System.Data.DataRow[] rows = new System.Data.DataRow[allAddedRows.Count]; + allAddedRows.CopyTo(rows); + for (int i = 0; (i < rows.Length); i = (i + 1)) { + global::System.Data.DataRow row = rows[i]; + row.AcceptChanges(); + row.SetAdded(); + } + } + } + throw ex; + } + finally { + if (workConnOpened) { + workConnection.Close(); + } + if ((0 < adaptersWithAcceptChangesDuringUpdate.Count)) { + global::System.Data.Common.DataAdapter[] adapters = new System.Data.Common.DataAdapter[adaptersWithAcceptChangesDuringUpdate.Count]; + adaptersWithAcceptChangesDuringUpdate.CopyTo(adapters); + for (int i = 0; (i < adapters.Length); i = (i + 1)) { + global::System.Data.Common.DataAdapter adapter = adapters[i]; + adapter.AcceptChangesDuringUpdate = true; + } + } + } + return result; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + protected virtual void SortSelfReferenceRows(global::System.Data.DataRow[] rows, global::System.Data.DataRelation relation, bool childFirst) { + global::System.Array.Sort(rows, new SelfReferenceComparer(relation, childFirst)); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + protected virtual bool MatchTableAdapterConnection(global::System.Data.IDbConnection inputConnection) { + if ((this._connection != null)) { + return true; + } + if (((this.Connection == null) + || (inputConnection == null))) { + return true; + } + if (string.Equals(this.Connection.ConnectionString, inputConnection.ConnectionString, global::System.StringComparison.Ordinal)) { + return true; + } + return false; + } + + /// + ///Update Order Option + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public enum UpdateOrderOption { + + InsertUpdateDelete = 0, + + UpdateInsertDelete = 1, + } + + /// + ///Used to sort self-referenced table's rows + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + private class SelfReferenceComparer : object, global::System.Collections.Generic.IComparer { + + private global::System.Data.DataRelation _relation; + + private int _childFirst; + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + internal SelfReferenceComparer(global::System.Data.DataRelation relation, bool childFirst) { + this._relation = relation; + if (childFirst) { + this._childFirst = -1; + } + else { + this._childFirst = 1; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + private global::System.Data.DataRow GetRoot(global::System.Data.DataRow row, out int distance) { + global::System.Diagnostics.Debug.Assert((row != null)); + global::System.Data.DataRow root = row; + distance = 0; + + global::System.Collections.Generic.IDictionary traversedRows = new global::System.Collections.Generic.Dictionary(); + traversedRows[row] = row; + + global::System.Data.DataRow parent = row.GetParentRow(this._relation, global::System.Data.DataRowVersion.Default); + for ( + ; ((parent != null) + && (traversedRows.ContainsKey(parent) == false)); + ) { + distance = (distance + 1); + root = parent; + traversedRows[parent] = parent; + parent = parent.GetParentRow(this._relation, global::System.Data.DataRowVersion.Default); + } + + if ((distance == 0)) { + traversedRows.Clear(); + traversedRows[row] = row; + parent = row.GetParentRow(this._relation, global::System.Data.DataRowVersion.Original); + for ( + ; ((parent != null) + && (traversedRows.ContainsKey(parent) == false)); + ) { + distance = (distance + 1); + root = parent; + traversedRows[parent] = parent; + parent = parent.GetParentRow(this._relation, global::System.Data.DataRowVersion.Original); + } + } + + return root; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public int Compare(global::System.Data.DataRow row1, global::System.Data.DataRow row2) { + if (object.ReferenceEquals(row1, row2)) { + return 0; + } + if ((row1 == null)) { + return -1; + } + if ((row2 == null)) { + return 1; + } + + int distance1 = 0; + global::System.Data.DataRow root1 = this.GetRoot(row1, out distance1); + + int distance2 = 0; + global::System.Data.DataRow root2 = this.GetRoot(row2, out distance2); + + if (object.ReferenceEquals(root1, root2)) { + return (this._childFirst * distance1.CompareTo(distance2)); + } + else { + global::System.Diagnostics.Debug.Assert(((root1.Table != null) + && (root2.Table != null))); + if ((root1.Table.Rows.IndexOf(root1) < root2.Table.Rows.IndexOf(root2))) { + return -1; + } + else { + return 1; + } + } + } + } + } +} + +#pragma warning restore 1591 \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/GenericLine.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/GenericLine.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/GenericLine.cs (revision 3305) @@ -0,0 +1,42 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU 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.Geometry; + +namespace Deltares.Dam.Data +{ + public class GenericLineException : Exception + { + public GenericLineException(string message) : base(message) + { + } + } + + public class GenericLine : PolyLine + { + public GenericLine() + : base() + { + } + } + +} Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Sensors/IPLLineCreator.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Sensors/IPLLineCreator.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Sensors/IPLLineCreator.cs (revision 3305) @@ -0,0 +1,28 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +namespace Deltares.Dam.Data.Sensors +{ + public interface IPLLineCreator + { + PLLine CreatePLLine(); + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DamEngineIo/FillDamUiFromXmlHelper.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DamEngineIo/FillDamUiFromXmlHelper.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DamEngineIo/FillDamUiFromXmlHelper.cs (revision 3305) @@ -0,0 +1,61 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Deltares.Geometry; +using Deltares.Geotechnics.GeotechnicalGeometry; +using Deltares.Geotechnics.SurfaceLines; +using SurfaceLine = Deltares.DamEngine.Io.XmlInput.SurfaceLine; + +namespace Deltares.Dam.Data.DamEngineIo +{ + public class FillDamUiFromXmlHelper + { + public static SurfaceLine2 ConvertXmlSurfaceLineToSurfaceLine2(SurfaceLine inputSurfaceLine) + { + var surfaceLine = new SurfaceLine2(); + surfaceLine.Name = inputSurfaceLine.Name; + surfaceLine.CharacteristicPoints.Geometry = surfaceLine.Geometry; + AddPointsToSurfaceLine(inputSurfaceLine, surfaceLine); + return surfaceLine; + } + + private static void AddPointsToSurfaceLine(SurfaceLine inputSurfaceLine, SurfaceLine2 surfaceLine) + { + surfaceLine.Geometry = new LocalizedGeometryPointString(); + for (int j = 0; j < inputSurfaceLine.Points.Length; j++) + { + var inputPoint = inputSurfaceLine.Points[j]; + var geometryPoint = new GeometryPoint() + { + X = inputPoint.X, + Y = 0.0, + Z = inputPoint.Z + }; + surfaceLine.AddCharacteristicPoint(geometryPoint, ConversionHelper.ConvertToDamPointType(inputPoint.PointType)); + } + } + } +} Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/RdLatLngConverter.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/RdLatLngConverter.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/RdLatLngConverter.cs (revision 3305) @@ -0,0 +1,156 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using Deltares.Geometry; + +namespace Deltares.Dam.Data +{ + using System; + + public class RdLatLngConverter + { + private const double A01 = 3236.0331637; + private const double A02 = -0.2472814; + private const double A03 = -0.0655238; + private const double A04 = 0.0000371; + private const double A20 = -32.5915821; + private const double A21 = -0.8501341; + private const double A22 = -0.0171137; + private const double A23 = -0.0003859; + private const double A24 = -0.0000090; + private const double A40 = 0.0052771; + private const double A41 = 0.0003314; + private const double A42 = 0.0000143; + + private const double B10 = 5261.3028966; + private const double B11 = 105.9780241; + private const double B12 = 2.4576469; + private const double B13 = 0.0560089; + private const double B14 = 0.0012770; + private const double B15 = 0.0000291; + private const double B30 = -0.8192156; + private const double B31 = -0.0560092; + private const double B32 = -0.0025614; + private const double B33 = -0.0000973; + private const double B50 = 0.0002574; + private const double B51 = 0.0000293; + + private const double C01 = 190066.98903; + private const double C03 = -32.38360; + private const double C05 = -0.00661; + private const double C11 = -11830.85831; + private const double C13 = -0.60639; + private const double C21 = -114.19754; + private const double C23 = 0.15774; + private const double C31 = -2.34078; + private const double C41 = -0.04158; + private const double D02 = 3638.36193; + private const double D04 = 0.09351; + private const double D10 = 309020.31810; + private const double D12 = -157.95222; + private const double D14 = -0.05419; + private const double D20 = 72.97141; + private const double D22 = -6.43481; + private const double D30 = 59.79734; + private const double D32 = -0.07379; + private const double D40 = -0.03444; + private const double Lam0 = 5.387638889; + private const double Phi0 = 52.156160556; + + private const double X0 = 155000.00; + private const double Y0 = 463000.00; + + public static GeometryPoint RdToLatLng(double xRd, double yRd) + { + var phi = GetPhi(xRd, yRd); + var lam = GetLam(xRd, yRd); + var lat = GetLat(lam, phi); + var lng = GetLng(lam, phi); + + return new GeometryPoint() {X = lat, Y = lng}; + } + + public static GeometryPoint LatLngToRd(double latitude, double longitude) + { + var x = GetX(latitude, longitude); + var y = GetY(latitude, longitude); + + return new GeometryPoint() {X = x, Y = y}; + } + + + private static double GetLng(double lam, double phi) + { + return lam + (-37.902 + 0.329*(phi - 52) - 14.667*(lam - 5))/100000; + } + + private static double GetLat(double lam, double phi) + { + return phi + (-96.862 - 11.714*(phi - 52) - 0.125*(lam - 5))/100000; + } + + private static double GetPhi(double x, double y) + { + var dX = (x - X0)*Math.Pow(10, -5); + var dY = (y - Y0)*Math.Pow(10, -5); + var dPhi = A01*dY + A20*Math.Pow(dX, 2) + A02*Math.Pow(dY, 2) + A21*Math.Pow(dX, 2)*dY + + A03*Math.Pow(dY, 3) + A40*Math.Pow(dX, 4) + + A22*Math.Pow(dX, 2)*Math.Pow(dY, 2) + A04*Math.Pow(dY, 4) + A41*Math.Pow(dX, 4)*dY + + A23*Math.Pow(dX, 2)*Math.Pow(dY, 3) + + A42*Math.Pow(dX, 4)*Math.Pow(dY, 2) + A24*Math.Pow(dX, 2)*Math.Pow(dY, 4); + return Phi0 + (dPhi/3600.00); + } + + private static double GetLam(double x, double y) + { + var dX = (x - X0)*Math.Pow(10, -5); + var dY = (y - Y0)*Math.Pow(10, -5); + var dLam = B10*dX + B11*dX*dY + B30*Math.Pow(dX, 3) + B12*dX*Math.Pow(dY, 2) + B31*Math.Pow(dX, 3)*dY + + B13*dX*Math.Pow(dY, 3) + + B50*Math.Pow(dX, 5) + B32*Math.Pow(dX, 3)*Math.Pow(dY, 2) + B14*dX*Math.Pow(dY, 4) + + B51*Math.Pow(dX, 5)*dY + + B33*Math.Pow(dX, 3)*Math.Pow(dY, 3) + B15*dX*Math.Pow(dY, 5); + return Lam0 + (dLam/3600.00); + } + + private static double GetX(double lat, double lng) + { + var dPhi = (lat - Phi0)*0.36; + var dLam = (lng - Lam0)*0.36; + var dX = C01*dLam + C11*dPhi*dLam + C21*Math.Pow(dPhi, 2)*dLam + C03*Math.Pow(dLam, 3) + + C31*Math.Pow(dPhi, 3)*dLam + C13*dPhi*Math.Pow(dLam, 3) + + C23*Math.Pow(dPhi, 2)*Math.Pow(dLam, 3) + + C41*Math.Pow(dPhi, 4)*dLam + C05*Math.Pow(dLam, 5); + return X0 + dX; + } + + private static double GetY(double lat, double lng) + { + var dPhi = (lat - Phi0)*0.36; + var dLam = (lng - Lam0)*0.36; + var dY = D10*dPhi + D20*Math.Pow(dPhi, 2) + D02*Math.Pow(dLam, 2) + D12*dPhi*Math.Pow(dLam, 2) + + D30*Math.Pow(dPhi, 3) + D22*Math.Pow(dPhi, 2)*Math.Pow(dLam, 2) + D40*Math.Pow(dPhi, 4) + + D04*Math.Pow(dLam, 4) + + D32*Math.Pow(dPhi, 3)*Math.Pow(dLam, 2) + D14*dPhi*Math.Pow(dLam, 4); + return Y0 + dY; + } + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/PointNotExistsException.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/PointNotExistsException.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/PointNotExistsException.cs (revision 3305) @@ -0,0 +1,59 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU 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; +using Deltares.Geometry; +using Deltares.Geotechnics.SurfaceLines; + +namespace Deltares.Dam.Data +{ + + [Serializable] + public class PointNotExistsException : Exception + { + public PointNotExistsException() + { + } + + public PointNotExistsException(string surfaceLineId, CharacteristicPointType pointType, GeometryPoint point, string messageFormat) + : base(string.Format(messageFormat, pointType, point, surfaceLineId)) + { + } + + public PointNotExistsException(string message) + : base(message) + { + } + + public PointNotExistsException(string message, Exception inner) + : base(message, inner) + { + } + + protected PointNotExistsException( + SerializationInfo info, + StreamingContext context) + : base(info, context) + { + } + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Copying.GPL.licenseheader =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Copying.GPL.licenseheader (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Copying.GPL.licenseheader (revision 3305) @@ -0,0 +1,45 @@ +extensions: .cs +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU 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. + +extensions: .xml .config .xsd .wxs + \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/IAttributeImporter.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/IAttributeImporter.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/IAttributeImporter.cs (revision 3305) @@ -0,0 +1,69 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Collections.Generic; + +namespace Deltares.Maps +{ + public interface IAttributeImporter + { + /// + /// Gets or sets the target object lookup table + /// + IEnumerable Targets { set; } + + /// + /// + IFeatureRepository AttributeRepository { set; } + + /// + /// + IEnumerable Errors { get; } + + string FileName { set; } + + void AddError(Exception exception); + + /// + /// Sets the attribute mappings + /// + IEnumerable> AttributeMappings { set; } + + /// + /// + /// + /// Preconditions: + /// - A valid data folder needs to given + /// - A set of "targets" with their characteristic points table and initialized id's available from the waterboard + /// - The required files need to be in the data folder (one for the characteristics points, + /// - A set of (characteristic) lines wich have to be retrieved from the files + /// Postconditions: + /// - Some targets (the result of a join from the Location shape file and the existing location list from the + /// Waterboard) have new characteristic point values + /// + /// + /// + /// + /// + void Import(); + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DamProject.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DamProject.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DamProject.cs (revision 3305) @@ -0,0 +1,769 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU 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.Linq; +using Deltares.Dam.Data.DataPlugins.Configuration; +using Deltares.Soilbase; +using Deltares.Standard.EventPublisher; +using Deltares.Standard.IO.DtoAssembler; +using Deltares.Standard.Reflection; +using System.IO; +using System.Xml; +using Deltares.Dam.Data.IO; +using Deltares.Geotechnics.Soils; +using Deltares.Standard; +using Deltares.Standard.IO; +using Deltares.Standard.IO.Xml; +using Deltares.Standard.Logging; + +namespace Deltares.Dam.Data +{ + public class DamProjectException : ApplicationException + { + public DamProjectException(string message) + : base(message) + { + } + } + + public class DamProject : IDisposable + { + private string projectFileName; + private static string testProgramVersion; + private DamProjectData damProjectData; + + public static ProjectPathLocation ProjectWorkingPathLocation = ProjectPathLocation.InApplicationMap; + public static string UserWorkingPath = DamProject.GetNewTempDirectory(); + public static string ProjectMapWorkingPath = DamProject.GetNewTempDirectory(); + + public DamProject() + { + this.damProjectData = new DamProjectData(); + } + + public static string GetNewTempDirectory() + { + int counter = 1; + + while (true) + { + string dir = Path.GetTempPath() + Path.DirectorySeparatorChar + "DAM" + counter.ToString(); + + if (!Directory.Exists(dir) && !File.Exists(dir)) + { + return dir; + } + else + { + counter++; + } + } + } + + //[XmlIgnore] + public static string ProjectMap { get; set; } + + //[XmlIgnore] + public static string CalculationMap { get; set; } + + public string ProjectFileName + { + get { return this.projectFileName; } + set + { + DataEventPublisher.BeforeChange(this, "ProjectFileName"); + this.projectFileName = value; + ProjectMap = Path.GetDirectoryName(Path.GetFullPath(value)); + CalculationMap = Path.GetFileName(Path.ChangeExtension(value, "Calc")); + ProjectMapWorkingPath = Path.Combine(Path.GetDirectoryName(Path.GetFullPath(value)), CalculationMap); + //damProjectFolder = Path.GetDirectoryName(value); + DataEventPublisher.AfterChange(this, "ProjectFileName"); + } + } + + //[XmlIgnore] + public DamProjectData DamProjectData + { + get { return damProjectData; } + set + { + var propertyName = this.GetMemberName(x => x.DamProjectData); + DataEventPublisher.BeforeChange(this, propertyName); + damProjectData = value; + DataEventPublisher.AfterChange(this, propertyName); + } + } + + public object ImportWithDefinitionFile(string fileName, DamProjectType damProjectType, DamEngine.Data.Standard.Calculation.ProgressDelegate progress) + { + var dataSourceContainer = DataSourceContainer.Deserialize(fileName); + ProjectFileName = fileName; + var definitionFileProjectFolder = Path.GetDirectoryName(fileName); + + List logMessages; + + // import + var waterBoard = WaterBoardImporter.ImportAllData( + definitionFileProjectFolder, dataSourceContainer, damProjectType, + progress, out logMessages); + //var importer = new WaterBoardImporter(); + //var waterBoard = importer.ImportAllData( + // definitionFileProjectFolder, dataSourceContainer, progress); + //logMessages = importer.importLogMessages.ToList(); + + // create data + DamProjectData = new DamProjectData { WaterBoard = waterBoard }; + + // handle log messages + if (logMessages.Count > 0) + { + LogManager.Messages.AddRange(logMessages); + } + + // Add stability as standard mechanism when not yet available. + if (damProjectData.DamProjectCalculationSpecification.DamCalculationSpecifications.Count == 0) + { + damProjectData.DamProjectCalculationSpecification.DamCalculationSpecifications + .Add(new DamFailureMechanismeCalculationSpecification()); + } + return DamProjectData; + } + + /// + /// Imports all the data + /// + /// The data folder. + /// The data source container. + /// The dike ring ids. + /// Type of the dam project. + /// The progress. + /// + public object Import(string dataFolder, DataSourceContainer dataSourceContainer, + IEnumerable dikeRingIds, DamProjectType damProjectType, DamEngine.Data.Standard.Calculation.ProgressDelegate progress) + { + var damProjectFolder = Path.GetDirectoryName(projectFileName); + + DataSourceManager.DataSources = DamProjectData.DataSources; + List logMessages; + + // import + var waterBoard = WaterBoardImporter.ImportDataForDikeRings( + damProjectFolder, dataFolder, dataSourceContainer, + dikeRingIds, damProjectType, progress, out logMessages); + + // create data + DamProjectData = new DamProjectData { WaterBoard = waterBoard, DataSourceEsriProjection = dataSourceContainer.DataSourceEsriProjection }; + + // Make sure Soil properties are same as in database, also build IsAquifer dictionary + UpdateSoilPropertiesToSoilDatabase(); + + // handle logs + if (logMessages.Any()) + { + LogManager.Messages.Clear(); + LogManager.Messages.AddRange(logMessages); + } + // Add stability as standard mechanism when not yet available. + if (damProjectData.DamProjectCalculationSpecification.DamCalculationSpecifications.Count == 0) + { + this.damProjectData.DamProjectCalculationSpecification.DamCalculationSpecifications. + Add(new DamFailureMechanismeCalculationSpecification()); + } + return this.DamProjectData; + } + + /// + /// Loads DAM project data from the given .damx file. + /// + /// Name of the file. + /// The project data + /// + /// + public static DamProjectData LoadData(string fileName) + { + if (string.IsNullOrWhiteSpace(fileName)) throw new ArgumentException("fileName"); + if (!File.Exists(fileName)) throw new FileNotFoundException(fileName); + if (!fileName.EndsWith("damx")) throw new ArgumentException("No damx file", "fileName"); + using (var damProject = new DamProject()) + { + return damProject.OpenXMLProject(fileName) as DamProjectData; + } + } + + + /// + /// Saves DAM project data to the given .damx file. + /// + /// If the file already exists it will be overriden + /// Name of the file. + /// The DAM project data to be saved. + public static void SaveData(string fileName, DamProjectData data) + { + if (string.IsNullOrWhiteSpace(fileName)) throw new ArgumentException("fileName"); + var project = new DamProject() { DamProjectData = data }; + + project.SaveXMLProject(fileName, null); + } + + /// + /// Gets the main version (first two numbers of full version). + /// + /// The full version. + /// + private string GetMainVersion(string fullVersion) + { + if (fullVersion.Contains(".")) + { + string[] currentVer = fullVersion.Split(".".ToCharArray()); + var main = currentVer[0]; + var sec = currentVer[1]; + return main + "." + sec; + } + return fullVersion; + } + + /// + /// Sets the test program version. + /// Note: To be used by unit tests only. + /// + /// The test version. + public static void SetTestProgramVersion(string testVersion) + { + testProgramVersion = testVersion; + } + + /// + /// Opens the XML project. + /// + /// Name of the file. + /// + public object OpenXMLProject(string fileName) + { + // To retrieve file version from xml, add handler. + var damProjectVersionXmlHandler = new DamProjectVersionXmlHandler(); + XmlHandler.RegisterObjectHandler(damProjectVersionXmlHandler); + + ClearProject(); + this.ProjectFileName = fileName; + DataEventPublisher.InvokeWithoutPublishingEvents(() => + { + string damProjectFolder = Path.GetDirectoryName(fileName); + var xmlSerializer = new XmlDeserializer(); + object project = xmlSerializer.XmlDeserialize(fileName, typeof(DamProjectData), new DefaultClassFactory()); + + this.damProjectData = (DamProjectData)project; + if (damProjectData != null) + { + damProjectData.VersionInfo.InitVersionInfoAfterRead(); + } + if (damProjectData.DamProjectType == DamProjectType.AssessOld) + { + ClearProject(); + damProjectData.DamProjectType = DamProjectType.AssessOld; + } + else + { + var damProjectVersion = damProjectVersionXmlHandler.GetDamProjectVersion(); + damProjectVersion = GetMainVersion(damProjectVersion); + if (damProjectVersion != null) + { + var currentProgramVersion = About.Version; + if (currentProgramVersion == null) + { + currentProgramVersion = testProgramVersion; + } + currentProgramVersion = GetMainVersion(currentProgramVersion); + if (!currentProgramVersion.Equals(damProjectVersion)) + { + damProjectData.ClearResults(); + } + } + } + // Project still needs a reference to soilmaterials database; to be resolved later. + // This will become obsolete as soon as Delphi DGeoStability version is no longer used. + ResolveBackwardCompatibility(); + UpdateSoilDatabaseReferences(damProjectFolder); + UpdateSoilPropertiesToSoilDatabase(); + }); + + // Add stability as standard mechanism when not yet available. + if ((damProjectData.DamProjectCalculationSpecification.DamCalculationSpecifications.Count == 0) && (damProjectData.DamProjectType != DamProjectType.AssessOld)) + { + damProjectData.DamProjectCalculationSpecification.DamCalculationSpecifications.Add(new DamFailureMechanismeCalculationSpecification()); + UpdateForOlderProjects(); + } + return damProjectData; + } + + private void ResolveBackwardCompatibility() + { + if (DamProjectData.VersionInfo.FileVersionAsRead == 0) + { + XmlDocument xmlDocument = new XmlDocument(); + xmlDocument.Load(this.ProjectFileName); + } + } + + /// + /// Updates older projects for missing data or changed data model. + /// + private void UpdateForOlderProjects() + { + UpdateMStabParametersSlipCircleDefinition(); + } + + /// + /// Updates the soil properties to the values in the soil database, to avoid discrepancies. + /// If the use of the soil database is not necessary anymore (and the soil parameters can be edited in the UI) + /// then this method is not needed anymore. + /// Also all references of soil in the layers are forced to point to a soil in the SoilList. + /// + /// After this method every soil has only 1 instance, and is present in the soillist + /// + private void UpdateSoilPropertiesToSoilDatabase() + { + foreach (Dike dike in DamProjectData.WaterBoard.Dikes) + { + UpdateSoilListFromDatabase(dike); + + Dictionary aquiferDictionary = dike.SoilList.AquiferDictionary; + foreach (Location location in dike.Locations) + { + + location.SoilList = dike.SoilList; + if (location.Segment != null) + { + foreach (SoilGeometryProbability soilGeometryProbability in location.Segment.SoilProfileProbabilities) + { + if (soilGeometryProbability.SoilProfileType == SoilProfileType.SoilProfile1D) + { + foreach (SoilLayer1D layer in soilGeometryProbability.SoilProfile.Layers) + { + bool isAquifer; + // Assign correct soil to layer + Soil newSoil; + var index = dike.SoilList.GetSoilIndexByName(layer.Soil.Name); + if (index < 0) + { + Soil databaseSoil = dike.SoilBaseDB.GetSoil(layer.Soil.Name, out isAquifer); + newSoil = databaseSoil; + dike.SoilList.Soils.Add(newSoil); + } + else + { + newSoil = dike.SoilList.Soils[index]; + isAquifer = aquiferDictionary[newSoil]; + } + // Set correct IsAquifer property in layer + layer.IsAquifer = isAquifer; + layer.Soil = newSoil; + } + } + } + } + } + } + } + + /// + /// Update all soil parameters to the data read from database + /// + /// + private static void UpdateSoilListFromDatabase(Dike dike) + { + using (var geoDatabase = new GeoDatabase(dike.SoilDatabaseName)) + { + geoDatabase.ReUseSoils = true; + // read list from old DB and put them in a dictonary by name + var soilList = geoDatabase.ReadSoils(dike.SoilList.Soils); + Dictionary soils = soilList.Soils.ToDictionary(s => s.Name); + CleanDikeAquiferDictionary(dike); + foreach (Soil soil in dike.SoilList.Soils) + { + var newSoil = soils[soil.Name]; + // if the current soil was found in the db list, update the params for the current soil + if (newSoil != null) + { + soil.Assign(newSoil); + } + // update aquifer dictionary too + if (soilList.AquiferDictionary.ContainsKey(newSoil)) + { + if (dike.SoilList.AquiferDictionary.ContainsKey(soil)) + { + dike.SoilList.AquiferDictionary[soil] = soilList.AquiferDictionary[newSoil]; + } + else + { + dike.SoilList.AquiferDictionary.Add(soil, soilList.AquiferDictionary[newSoil]); + } + } + } + } + } + + private static void CleanDikeAquiferDictionary(Dike dike) + { + var newDict = new Dictionary(); + foreach (var soil in dike.SoilList.Soils) + { + if (dike.SoilList.AquiferDictionary.ContainsKey(soil)) + { + newDict[soil] = dike.SoilList.AquiferDictionary[soil]; + } + } + dike.SoilList.AquiferDictionary.Clear(); + dike.SoilList.AquiferDictionary = newDict; + } + + /// + /// Update soil database references: + /// Soildatabase should always be in the project path + /// Make sure the file reference is adjusted to this + /// + /// + private void UpdateSoilDatabaseReferences(string damProjectFolder) + { + if (!string.IsNullOrWhiteSpace(damProjectFolder)) + { + foreach (Dike dike in damProjectData.WaterBoard.Dikes) + { + if (!string.IsNullOrWhiteSpace(dike.SoilDatabaseName)) + { + dike.SoilDatabaseName = Path.Combine(damProjectFolder, Path.GetFileName(dike.SoilDatabaseName)); + } + + foreach (Location location in dike.Locations) + { + location.SoildatabaseName = dike.SoilDatabaseName; + } + } + } + } + + /// + /// Updates the MStab parameters slip circle definition. + /// For older projects, when slip circle definition was not yet defined we have to provide the default values + /// + private void UpdateMStabParametersSlipCircleDefinition() + { + foreach (DamFailureMechanismeCalculationSpecification damCalculationSpecification in this.damProjectData.DamProjectCalculationSpecification.DamCalculationSpecifications) + { + if (damCalculationSpecification.FailureMechanismSystemType == FailureMechanismSystemType.StabilityInside) + { + if (damCalculationSpecification.IsSlipCircleDefinitionUndefined()) + { + damCalculationSpecification.ReadUserSettingsSlipCircleDefinition(); + } + } + } + + } + + /// + /// Assigns the specified 2D-geometry mapname for all dikes where it is not assigned. + /// + /// Name of the map. + public void AssignGeometry2DMapnameIfNotAssigned(string mapName) + { + foreach (var dike in damProjectData.WaterBoard.Dikes) + { + if (String.IsNullOrEmpty(dike.MapForSoilGeometries2D)) + { + dike.MapForSoilGeometries2D = mapName; + foreach (Location location in dike.Locations) + { + location.MapForSoilGeometries2D = mapName; + } + } + } + } + + /// + /// Create a destination filename for new location of soilmaterials database + /// + /// + /// + /// + /// + public static string CreateNewGeometry2DMapname(string projectFilename, string orgMapName, int dikeIndex) + { + string destMapname = Path.GetFileNameWithoutExtension(projectFilename) + ".geometries2D." + dikeIndex.ToString(CultureInfo.InvariantCulture) + @"\"; + return destMapname; + } + + /// + /// Copies the 2D-geometries. + /// + /// The original mapname. + /// The destination mapname. + private void CopyGeometries(string orgMapname, string destMapname) + { + if (Directory.Exists(orgMapname)) + { + if (!Directory.Exists(destMapname)) + { + Directory.CreateDirectory(destMapname); + } + foreach (var file in Directory.GetFiles(orgMapname)) + { + string fileName = Path.GetFileName(file); + if (fileName != null) + { + var destFile = Path.Combine(destMapname, fileName); + if (File.Exists(destFile)) + { + File.Delete(destFile); + } + File.Copy(file, destFile); + } + } + } + } + + /// + /// Make sure the map with 2d_geometries is copied besides the project file + /// and reference to the map is set to it + /// + /// the filename of the project + /// The org project map in case of file save as. + /// The directory in which the .defx file resides. + private void EnsureGeometries2DMapWithProject(string fileName, string projectDirectory, string dataSourceDirectory) + { + for (int dikeIndex = 0; dikeIndex < damProjectData.WaterBoard.Dikes.Count; dikeIndex++) + { + if (!String.IsNullOrEmpty(damProjectData.WaterBoard.Dikes[dikeIndex].MapForSoilGeometries2D)) + { + string mapForSoilGeometries = damProjectData.WaterBoard.Dikes[dikeIndex].MapForSoilGeometries2D; + string sourceMapName = DetermineGeometriesSource(mapForSoilGeometries, projectDirectory, dataSourceDirectory); + + // Only copy files if map of geometries is assigned and exists + if (!String.IsNullOrEmpty(sourceMapName) && Directory.Exists(sourceMapName)) + { + string destMapname = CreateNewGeometry2DMapname(fileName, sourceMapName, dikeIndex); + string fullFilename = Path.GetFullPath(fileName); + string destFullMapname = Path.Combine(Path.GetDirectoryName(fullFilename), destMapname); + string orgFullMapname = Path.GetFullPath(sourceMapName); + if (!orgFullMapname.Equals(destFullMapname)) + { + CopyGeometries(orgFullMapname, destFullMapname); + } + // Store the relative path to the 2d-geometries + damProjectData.WaterBoard.Dikes[dikeIndex].MapForSoilGeometries2D = destMapname; + foreach (Location location in damProjectData.WaterBoard.Dikes[dikeIndex].Locations) + { + location.MapForSoilGeometries2D = destMapname; + } + } + } + } + } + + /// + /// Determines from which folder the soil geometry definitions should be retrieved from. + /// + /// The directory of the soil geometries as specified by the .defx file + /// The directory of the .damx project file. + /// The directory of the .defx file. + /// The directory of where the soil geometries reside. + private static string DetermineGeometriesSource(string soilGeometryDirectory, string projectDirectory, string dataSourceDirectory) + { + if (Directory.Exists(soilGeometryDirectory)) + { + return soilGeometryDirectory; + } + + var directory = Path.Combine(projectDirectory, soilGeometryDirectory); + return Directory.Exists(directory) ? directory : Path.Combine(dataSourceDirectory, soilGeometryDirectory); + } + + /// + /// Create a destination filename for new location of soilmaterials database + /// + /// + /// + /// + public static string CreateNewSoilMaterialsFilename(string projectFilename, string soilmaterialsFilename, int dikeIndex) + { + string destsoilmaterialsFilename = Path.GetFileNameWithoutExtension(projectFilename) + dikeIndex.ToString(CultureInfo.InvariantCulture) + ".soilmaterials.mdb"; + return destsoilmaterialsFilename; + } + + /// + /// Make sure soilamterials file is copied besides the project file + /// and reference to the file is set to it + /// + /// the filename of the project + private void EnsureSoilmaterialsFileWithProject(string fileName) + { + for (int dikeIndex = 0; dikeIndex < damProjectData.WaterBoard.Dikes.Count; dikeIndex++) + { + string path = Path.GetFullPath(damProjectData.WaterBoard.Dikes[dikeIndex].SoilDatabaseName); + // ThrowIfMoreThanOneDikeInProject(); + Dike dike = this.DamProjectData.WaterBoard.Dikes[dikeIndex]; + string sourceSoilmaterialsFilename = damProjectData.WaterBoard.Dikes[dikeIndex].SoilDatabaseName; + string destSoilmaterialsFilename = CreateNewSoilMaterialsFilename(fileName, sourceSoilmaterialsFilename, dikeIndex); + string fullFilename = Path.GetFullPath(fileName); + string destSoilmaterialsFullFilename = Path.Combine(Path.GetDirectoryName(fullFilename), destSoilmaterialsFilename); + string orgSoilmaterialsFullFilename = Path.GetFullPath(sourceSoilmaterialsFilename); + if (!orgSoilmaterialsFullFilename.Equals(destSoilmaterialsFullFilename)) + { + if (File.Exists(destSoilmaterialsFullFilename)) + { + File.Delete(destSoilmaterialsFullFilename); + } + + if (File.Exists(orgSoilmaterialsFullFilename)) + { + File.Copy(orgSoilmaterialsFullFilename, destSoilmaterialsFullFilename); + } + } + damProjectData.WaterBoard.Dikes[dikeIndex].SoilDatabaseName = destSoilmaterialsFullFilename; + foreach (var location in damProjectData.WaterBoard.Dikes[dikeIndex].Locations) + { + location.SoildatabaseName = destSoilmaterialsFullFilename; + } + } + } + + /// + /// Save the project in XML format + /// + /// + /// + public void SaveXMLProject(string fileName, object project) + { + // Try to retrieve the data source folder from this object. + string dataSourceFolder = null; + if (DamProjectData != null) + { + string damDataSourceFilePath = DamProjectData.DamDataSourceFileName; + dataSourceFolder = string.IsNullOrEmpty(damDataSourceFilePath) + ? damDataSourceFilePath + : Path.GetDirectoryName(damDataSourceFilePath); + } + + // If the data source is not available, try to retrieve it from + // the argument. The data source folder must be set in order to + // create the geometries 2D.0 folder + var damProject = project as DamProject; + if (damProject != null && dataSourceFolder == null) + { + dataSourceFolder = Path.GetDirectoryName(damProject.DamProjectData.DamDataSourceFileName); + } + + fileName = Path.ChangeExtension(fileName, "damx"); + string savedProjectMap = ProjectMap; + ProjectFileName = fileName; + if (savedProjectMap == null) + { + savedProjectMap = ProjectMap; + } + + damProjectData.VersionInfo.InitVersionInfo(); + + DataEventPublisher.InvokeWithoutPublishingEvents(() => + { + EnsureSoilmaterialsFileWithProject(fileName); + EnsureGeometries2DMapWithProject(fileName, savedProjectMap, dataSourceFolder); + + var xmlSerializer = new XmlSerializer(); + xmlSerializer.Serialize(damProjectData, fileName); + }); + } + + public void ImportWaterLevelTimeSeries() + { + + if (DamProjectData.DamProjectCalculationSpecification == null) return; + var file = DamProjectData.WaterBoard.WaterLevelTimeSeriesFileName; + + // check if file exists + if (!file.HasValidStringValue()) return; + if (!File.Exists(file)) return; + + // load file + var fewsInputTimeSerieCollection = TimeSerieCollection.LoadFromFile(file); + var waterBoardJob = DamProjectData.WaterBoardJob as WaterBoardJob; + WaterBoardJobImporter.ImportWaterlevels(waterBoardJob, fewsInputTimeSerieCollection); + } + + public static string ProjectWorkingPath + { + get + { + switch (ProjectWorkingPathLocation) + { + case ProjectPathLocation.InUserMap: + return UserWorkingPath; + case ProjectPathLocation.InProjectMap: + return ProjectMapWorkingPath; + default: + return Path.GetDirectoryName(typeof(DamProject).Assembly.Location) + @"\DamCalculation"; + } + } + } + + private void DeleteResultData() + { + damProjectData.DeleteResults(); + } + + public void DeleteResults() + { + DeleteResultData(); + RemoveCalculationFolder(); + } + + public void ClearProject() + { + // DeleteResultData(); + damProjectData = null; + DamProject.CalculationMap = ""; + DamProject.ProjectMap = ""; + damProjectData = new DamProjectData(); + + LogManager.Clear(); + } + + private static void RemoveCalculationFolder() + { + if (!Directory.Exists(ProjectWorkingPath)) return; + + try + { + Directory.Delete(ProjectWorkingPath, true); + } + catch (IOException e) + { + throw new DamProjectException(e.Message); + } + } + + public void Dispose() + { + DamProjectData.Dispose(); + } + } +} Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Sensors/SensorData.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Sensors/SensorData.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Sensors/SensorData.cs (revision 3305) @@ -0,0 +1,172 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using Deltares.Standard.EventPublisher; + +namespace Deltares.Dam.Data.Sensors +{ + /// + /// Class to hold the collected sensor data + /// + public class SensorData : IDisposable + { + private List sensors = new List(); + private List sensorGroups = new List(); + private List sensorLocations = new List(); + + public SensorData() + { + DataEventPublisher.OnAfterChange += DataEventPublisher_OnAfterChange; + DataEventPublisher.OnDataListModified += DataEventPublisher_OnDataListModified; + } + + private void DataEventPublisher_OnDataListModified(object sender, PublishEventArgs e) + { + if (sender is List) + { + var dma = (DataListModifiedArgs)e; + if (dma.Action == ListModifyAction.Delete) + { + UpdatePickSensorsForGroups(); + foreach (var sensorGroup in sensorGroups) + { + sensorGroup.Remove((Sensor)e.Objects[0]); + // Next lines just to force an update of the group table content + var ms = sensorGroup.SelectionAsString; + sensorGroup.SelectionAsString = ms; + } + } + } + if (sender is List) + { + var dma = (DataListModifiedArgs)e; + if (dma.Action == ListModifyAction.Delete) + { + var delList = new List(); + foreach (var sensorLocation in sensorLocations) + { + if (sensorLocation.Group == (Group) e.Objects[0]) + { + delList.Add(sensorLocation); + } + } + foreach (var delLocation in delList) + { + sensorLocations.Remove(delLocation); + } + DataEventPublisher.DataListModified(sensorLocations,null); + } + } + } + + private void DataEventPublisher_OnAfterChange(object sender, PublishEventArgs e) + { + if (sender is Sensor || sender is Group) + { + UpdatePickSensorsForGroups(); + } + } + + /// + /// Updates the pick sensors for groups. + /// + public void UpdatePickSensorsForGroups() + { + foreach (var sensorGroup in sensorGroups) + { + sensorGroup.PickSensors = sensors; + } + } + + /// + /// Gets or sets the sensors. + /// + /// + /// The sensors. + /// + public List Sensors + { + get { return sensors; } + set { sensors = value; } + } + + /// + /// Gets or sets the sensor groups. + /// + /// + /// The sensor groups. + /// + public List SensorGroups + { + get { return sensorGroups; } + set { sensorGroups = value; } + } + + /// + /// Gets or sets the sensor locations. + /// + /// + /// The sensor locations. + /// + [Browsable(false)] + [ReadOnly(true)] + public List SensorLocations + { + get { return sensorLocations; } + } + + public Sensor GetSensorById(int id) + { + return sensors.FirstOrDefault(sensor => sensor.ID == id); + } + + public Group GetGroupById(int id) + { + return sensorGroups.FirstOrDefault(sensorGroup => sensorGroup.ID == id); + } + + public SensorLocation GetSensorLocationByLocationName(string name) + { + return sensorLocations.FirstOrDefault(sensorLocation => sensorLocation.LocationName == name); + } + + /// + /// Gets the groups for use in selection lists in de UI. + /// + /// The sensoLocation. + /// + public IEnumerable GetGroups(SensorLocation sensorLocation) + { + var list = new List(); + list.AddRange(sensorGroups); + return list; + } + + public void Dispose() + { + DataEventPublisher.OnAfterChange -= DataEventPublisher_OnAfterChange; + } + } +} Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Xsd/SoilProfileDataSet.Designer.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Xsd/SoilProfileDataSet.Designer.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Xsd/SoilProfileDataSet.Designer.cs (revision 3305) @@ -0,0 +1,3991 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU 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. + +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:2.0.50727.3607 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +#pragma warning disable 1591 + +namespace WebApplication1 { + + + /// + ///Represents a strongly typed in-memory cache of data. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "2.0.0.0")] + [global::System.Serializable()] + [global::System.ComponentModel.DesignerCategoryAttribute("code")] + [global::System.ComponentModel.ToolboxItem(true)] + [global::System.Xml.Serialization.XmlSchemaProviderAttribute("GetTypedDataSetSchema")] + [global::System.Xml.Serialization.XmlRootAttribute("SoilProfileDataSet")] + [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.DataSet")] + public partial class SoilProfileDataSet : global::System.Data.DataSet { + + private ODGEOMETRIESDataTable tableODGEOMETRIES; + + private ODGEOLAYERSDataTable tableODGEOLAYERS; + + private MATERIALSDataTable tableMATERIALS; + + private PARAMETERNAMESDataTable tablePARAMETERNAMES; + + private PARAMETERVALUESDataTable tablePARAMETERVALUES; + + private global::System.Data.DataRelation relationODGEOMETRIES_ODGEOLAYERS; + + private global::System.Data.DataRelation relationODGEOLAYERS_MATERIALS; + + private global::System.Data.DataRelation relationPARAMETERVALUES_MATERIALS; + + private global::System.Data.DataRelation relationPARAMETERNAMES_PARAMETERVALUES; + + private global::System.Data.SchemaSerializationMode _schemaSerializationMode = global::System.Data.SchemaSerializationMode.IncludeSchema; + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public SoilProfileDataSet() { + this.BeginInit(); + this.InitClass(); + global::System.ComponentModel.CollectionChangeEventHandler schemaChangedHandler = new global::System.ComponentModel.CollectionChangeEventHandler(this.SchemaChanged); + base.Tables.CollectionChanged += schemaChangedHandler; + base.Relations.CollectionChanged += schemaChangedHandler; + this.EndInit(); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + protected SoilProfileDataSet(global::System.Runtime.Serialization.SerializationInfo info, global::System.Runtime.Serialization.StreamingContext context) : + base(info, context, false) { + if ((this.IsBinarySerialized(info, context) == true)) { + this.InitVars(false); + global::System.ComponentModel.CollectionChangeEventHandler schemaChangedHandler1 = new global::System.ComponentModel.CollectionChangeEventHandler(this.SchemaChanged); + this.Tables.CollectionChanged += schemaChangedHandler1; + this.Relations.CollectionChanged += schemaChangedHandler1; + return; + } + string strSchema = ((string)(info.GetValue("XmlSchema", typeof(string)))); + if ((this.DetermineSchemaSerializationMode(info, context) == global::System.Data.SchemaSerializationMode.IncludeSchema)) { + global::System.Data.DataSet ds = new global::System.Data.DataSet(); + ds.ReadXmlSchema(new global::System.Xml.XmlTextReader(new global::System.IO.StringReader(strSchema))); + if ((ds.Tables["ODGEOMETRIES"] != null)) { + base.Tables.Add(new ODGEOMETRIESDataTable(ds.Tables["ODGEOMETRIES"])); + } + if ((ds.Tables["ODGEOLAYERS"] != null)) { + base.Tables.Add(new ODGEOLAYERSDataTable(ds.Tables["ODGEOLAYERS"])); + } + if ((ds.Tables["MATERIALS"] != null)) { + base.Tables.Add(new MATERIALSDataTable(ds.Tables["MATERIALS"])); + } + if ((ds.Tables["PARAMETERNAMES"] != null)) { + base.Tables.Add(new PARAMETERNAMESDataTable(ds.Tables["PARAMETERNAMES"])); + } + if ((ds.Tables["PARAMETERVALUES"] != null)) { + base.Tables.Add(new PARAMETERVALUESDataTable(ds.Tables["PARAMETERVALUES"])); + } + this.DataSetName = ds.DataSetName; + this.Prefix = ds.Prefix; + this.Namespace = ds.Namespace; + this.Locale = ds.Locale; + this.CaseSensitive = ds.CaseSensitive; + this.EnforceConstraints = ds.EnforceConstraints; + this.Merge(ds, false, global::System.Data.MissingSchemaAction.Add); + this.InitVars(); + } + else { + this.ReadXmlSchema(new global::System.Xml.XmlTextReader(new global::System.IO.StringReader(strSchema))); + } + this.GetSerializationData(info, context); + global::System.ComponentModel.CollectionChangeEventHandler schemaChangedHandler = new global::System.ComponentModel.CollectionChangeEventHandler(this.SchemaChanged); + base.Tables.CollectionChanged += schemaChangedHandler; + this.Relations.CollectionChanged += schemaChangedHandler; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.ComponentModel.Browsable(false)] + [global::System.ComponentModel.DesignerSerializationVisibility(global::System.ComponentModel.DesignerSerializationVisibility.Content)] + public ODGEOMETRIESDataTable ODGEOMETRIES { + get { + return this.tableODGEOMETRIES; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.ComponentModel.Browsable(false)] + [global::System.ComponentModel.DesignerSerializationVisibility(global::System.ComponentModel.DesignerSerializationVisibility.Content)] + public ODGEOLAYERSDataTable ODGEOLAYERS { + get { + return this.tableODGEOLAYERS; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.ComponentModel.Browsable(false)] + [global::System.ComponentModel.DesignerSerializationVisibility(global::System.ComponentModel.DesignerSerializationVisibility.Content)] + public MATERIALSDataTable MATERIALS { + get { + return this.tableMATERIALS; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.ComponentModel.Browsable(false)] + [global::System.ComponentModel.DesignerSerializationVisibility(global::System.ComponentModel.DesignerSerializationVisibility.Content)] + public PARAMETERNAMESDataTable PARAMETERNAMES { + get { + return this.tablePARAMETERNAMES; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.ComponentModel.Browsable(false)] + [global::System.ComponentModel.DesignerSerializationVisibility(global::System.ComponentModel.DesignerSerializationVisibility.Content)] + public PARAMETERVALUESDataTable PARAMETERVALUES { + get { + return this.tablePARAMETERVALUES; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.ComponentModel.BrowsableAttribute(true)] + [global::System.ComponentModel.DesignerSerializationVisibilityAttribute(global::System.ComponentModel.DesignerSerializationVisibility.Visible)] + public override global::System.Data.SchemaSerializationMode SchemaSerializationMode { + get { + return this._schemaSerializationMode; + } + set { + this._schemaSerializationMode = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.ComponentModel.DesignerSerializationVisibilityAttribute(global::System.ComponentModel.DesignerSerializationVisibility.Hidden)] + public new global::System.Data.DataTableCollection Tables { + get { + return base.Tables; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.ComponentModel.DesignerSerializationVisibilityAttribute(global::System.ComponentModel.DesignerSerializationVisibility.Hidden)] + public new global::System.Data.DataRelationCollection Relations { + get { + return base.Relations; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + protected override void InitializeDerivedDataSet() { + this.BeginInit(); + this.InitClass(); + this.EndInit(); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public override global::System.Data.DataSet Clone() { + SoilProfileDataSet cln = ((SoilProfileDataSet)(base.Clone())); + cln.InitVars(); + cln.SchemaSerializationMode = this.SchemaSerializationMode; + return cln; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + protected override bool ShouldSerializeTables() { + return false; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + protected override bool ShouldSerializeRelations() { + return false; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + protected override void ReadXmlSerializable(global::System.Xml.XmlReader reader) { + if ((this.DetermineSchemaSerializationMode(reader) == global::System.Data.SchemaSerializationMode.IncludeSchema)) { + this.Reset(); + global::System.Data.DataSet ds = new global::System.Data.DataSet(); + ds.ReadXml(reader); + if ((ds.Tables["ODGEOMETRIES"] != null)) { + base.Tables.Add(new ODGEOMETRIESDataTable(ds.Tables["ODGEOMETRIES"])); + } + if ((ds.Tables["ODGEOLAYERS"] != null)) { + base.Tables.Add(new ODGEOLAYERSDataTable(ds.Tables["ODGEOLAYERS"])); + } + if ((ds.Tables["MATERIALS"] != null)) { + base.Tables.Add(new MATERIALSDataTable(ds.Tables["MATERIALS"])); + } + if ((ds.Tables["PARAMETERNAMES"] != null)) { + base.Tables.Add(new PARAMETERNAMESDataTable(ds.Tables["PARAMETERNAMES"])); + } + if ((ds.Tables["PARAMETERVALUES"] != null)) { + base.Tables.Add(new PARAMETERVALUESDataTable(ds.Tables["PARAMETERVALUES"])); + } + this.DataSetName = ds.DataSetName; + this.Prefix = ds.Prefix; + this.Namespace = ds.Namespace; + this.Locale = ds.Locale; + this.CaseSensitive = ds.CaseSensitive; + this.EnforceConstraints = ds.EnforceConstraints; + this.Merge(ds, false, global::System.Data.MissingSchemaAction.Add); + this.InitVars(); + } + else { + this.ReadXml(reader); + this.InitVars(); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + protected override global::System.Xml.Schema.XmlSchema GetSchemaSerializable() { + global::System.IO.MemoryStream stream = new global::System.IO.MemoryStream(); + this.WriteXmlSchema(new global::System.Xml.XmlTextWriter(stream, null)); + stream.Position = 0; + return global::System.Xml.Schema.XmlSchema.Read(new global::System.Xml.XmlTextReader(stream), null); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + internal void InitVars() { + this.InitVars(true); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + internal void InitVars(bool initTable) { + this.tableODGEOMETRIES = ((ODGEOMETRIESDataTable)(base.Tables["ODGEOMETRIES"])); + if ((initTable == true)) { + if ((this.tableODGEOMETRIES != null)) { + this.tableODGEOMETRIES.InitVars(); + } + } + this.tableODGEOLAYERS = ((ODGEOLAYERSDataTable)(base.Tables["ODGEOLAYERS"])); + if ((initTable == true)) { + if ((this.tableODGEOLAYERS != null)) { + this.tableODGEOLAYERS.InitVars(); + } + } + this.tableMATERIALS = ((MATERIALSDataTable)(base.Tables["MATERIALS"])); + if ((initTable == true)) { + if ((this.tableMATERIALS != null)) { + this.tableMATERIALS.InitVars(); + } + } + this.tablePARAMETERNAMES = ((PARAMETERNAMESDataTable)(base.Tables["PARAMETERNAMES"])); + if ((initTable == true)) { + if ((this.tablePARAMETERNAMES != null)) { + this.tablePARAMETERNAMES.InitVars(); + } + } + this.tablePARAMETERVALUES = ((PARAMETERVALUESDataTable)(base.Tables["PARAMETERVALUES"])); + if ((initTable == true)) { + if ((this.tablePARAMETERVALUES != null)) { + this.tablePARAMETERVALUES.InitVars(); + } + } + this.relationODGEOMETRIES_ODGEOLAYERS = this.Relations["ODGEOMETRIES_ODGEOLAYERS"]; + this.relationODGEOLAYERS_MATERIALS = this.Relations["ODGEOLAYERS_MATERIALS"]; + this.relationPARAMETERVALUES_MATERIALS = this.Relations["PARAMETERVALUES_MATERIALS"]; + this.relationPARAMETERNAMES_PARAMETERVALUES = this.Relations["PARAMETERNAMES_PARAMETERVALUES"]; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + private void InitClass() { + this.DataSetName = "SoilProfileDataSet"; + this.Prefix = ""; + this.Namespace = "http://tempuri.org/DataSet1.xsd"; + this.EnforceConstraints = true; + this.SchemaSerializationMode = global::System.Data.SchemaSerializationMode.IncludeSchema; + this.tableODGEOMETRIES = new ODGEOMETRIESDataTable(); + base.Tables.Add(this.tableODGEOMETRIES); + this.tableODGEOLAYERS = new ODGEOLAYERSDataTable(); + base.Tables.Add(this.tableODGEOLAYERS); + this.tableMATERIALS = new MATERIALSDataTable(); + base.Tables.Add(this.tableMATERIALS); + this.tablePARAMETERNAMES = new PARAMETERNAMESDataTable(); + base.Tables.Add(this.tablePARAMETERNAMES); + this.tablePARAMETERVALUES = new PARAMETERVALUESDataTable(); + base.Tables.Add(this.tablePARAMETERVALUES); + this.relationODGEOMETRIES_ODGEOLAYERS = new global::System.Data.DataRelation("ODGEOMETRIES_ODGEOLAYERS", new global::System.Data.DataColumn[] { + this.tableODGEOMETRIES.OD_NRColumn}, new global::System.Data.DataColumn[] { + this.tableODGEOLAYERS.OD_NRColumn}, false); + this.Relations.Add(this.relationODGEOMETRIES_ODGEOLAYERS); + this.relationODGEOLAYERS_MATERIALS = new global::System.Data.DataRelation("ODGEOLAYERS_MATERIALS", new global::System.Data.DataColumn[] { + this.tableMATERIALS.MA_NRColumn}, new global::System.Data.DataColumn[] { + this.tableODGEOLAYERS.MA_NRColumn}, false); + this.Relations.Add(this.relationODGEOLAYERS_MATERIALS); + this.relationPARAMETERVALUES_MATERIALS = new global::System.Data.DataRelation("PARAMETERVALUES_MATERIALS", new global::System.Data.DataColumn[] { + this.tableMATERIALS.MA_NRColumn}, new global::System.Data.DataColumn[] { + this.tablePARAMETERVALUES.MA_NRColumn}, false); + this.Relations.Add(this.relationPARAMETERVALUES_MATERIALS); + this.relationPARAMETERNAMES_PARAMETERVALUES = new global::System.Data.DataRelation("PARAMETERNAMES_PARAMETERVALUES", new global::System.Data.DataColumn[] { + this.tablePARAMETERNAMES.PN_NRColumn}, new global::System.Data.DataColumn[] { + this.tablePARAMETERVALUES.PN_NRColumn}, false); + this.Relations.Add(this.relationPARAMETERNAMES_PARAMETERVALUES); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + private bool ShouldSerializeODGEOMETRIES() { + return false; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + private bool ShouldSerializeODGEOLAYERS() { + return false; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + private bool ShouldSerializeMATERIALS() { + return false; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + private bool ShouldSerializePARAMETERNAMES() { + return false; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + private bool ShouldSerializePARAMETERVALUES() { + return false; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + private void SchemaChanged(object sender, global::System.ComponentModel.CollectionChangeEventArgs e) { + if ((e.Action == global::System.ComponentModel.CollectionChangeAction.Remove)) { + this.InitVars(); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedDataSetSchema(global::System.Xml.Schema.XmlSchemaSet xs) { + SoilProfileDataSet ds = new SoilProfileDataSet(); + global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType(); + global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence(); + global::System.Xml.Schema.XmlSchemaAny any = new global::System.Xml.Schema.XmlSchemaAny(); + any.Namespace = ds.Namespace; + sequence.Items.Add(any); + type.Particle = sequence; + global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable(); + if (xs.Contains(dsSchema.TargetNamespace)) { + global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream(); + global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream(); + try { + global::System.Xml.Schema.XmlSchema schema = null; + dsSchema.Write(s1); + for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext(); ) { + schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current)); + s2.SetLength(0); + schema.Write(s2); + if ((s1.Length == s2.Length)) { + s1.Position = 0; + s2.Position = 0; + for (; ((s1.Position != s1.Length) + && (s1.ReadByte() == s2.ReadByte())); ) { + ; + } + if ((s1.Position == s1.Length)) { + return type; + } + } + } + } + finally { + if ((s1 != null)) { + s1.Close(); + } + if ((s2 != null)) { + s2.Close(); + } + } + } + xs.Add(dsSchema); + return type; + } + + public delegate void ODGEOMETRIESRowChangeEventHandler(object sender, ODGEOMETRIESRowChangeEvent e); + + public delegate void ODGEOLAYERSRowChangeEventHandler(object sender, ODGEOLAYERSRowChangeEvent e); + + public delegate void MATERIALSRowChangeEventHandler(object sender, MATERIALSRowChangeEvent e); + + public delegate void PARAMETERNAMESRowChangeEventHandler(object sender, PARAMETERNAMESRowChangeEvent e); + + public delegate void PARAMETERVALUESRowChangeEventHandler(object sender, PARAMETERVALUESRowChangeEvent e); + + /// + ///Represents the strongly named DataTable class. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "2.0.0.0")] + [global::System.Serializable()] + [global::System.Xml.Serialization.XmlSchemaProviderAttribute("GetTypedTableSchema")] + public partial class ODGEOMETRIESDataTable : global::System.Data.TypedTableBase { + + private global::System.Data.DataColumn columnOD_NR; + + private global::System.Data.DataColumn columnOD_NAME; + + private global::System.Data.DataColumn columnOD_DESCR; + + private global::System.Data.DataColumn columnOD_RDX; + + private global::System.Data.DataColumn columnOD_RDY; + + private global::System.Data.DataColumn columnOD_CPTNR; + + private global::System.Data.DataColumn columnOD_BORINGNR; + + private global::System.Data.DataColumn columnOD_GEOL_ZONE; + + private global::System.Data.DataColumn columnOD_CHANCE_OCCUR; + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public ODGEOMETRIESDataTable() { + this.TableName = "ODGEOMETRIES"; + this.BeginInit(); + this.InitClass(); + this.EndInit(); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + internal ODGEOMETRIESDataTable(global::System.Data.DataTable table) { + this.TableName = table.TableName; + if ((table.CaseSensitive != table.DataSet.CaseSensitive)) { + this.CaseSensitive = table.CaseSensitive; + } + if ((table.Locale.ToString() != table.DataSet.Locale.ToString())) { + this.Locale = table.Locale; + } + if ((table.Namespace != table.DataSet.Namespace)) { + this.Namespace = table.Namespace; + } + this.Prefix = table.Prefix; + this.MinimumCapacity = table.MinimumCapacity; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + protected ODGEOMETRIESDataTable(global::System.Runtime.Serialization.SerializationInfo info, global::System.Runtime.Serialization.StreamingContext context) : + base(info, context) { + this.InitVars(); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public global::System.Data.DataColumn OD_NRColumn { + get { + return this.columnOD_NR; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public global::System.Data.DataColumn OD_NAMEColumn { + get { + return this.columnOD_NAME; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public global::System.Data.DataColumn OD_DESCRColumn { + get { + return this.columnOD_DESCR; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public global::System.Data.DataColumn OD_RDXColumn { + get { + return this.columnOD_RDX; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public global::System.Data.DataColumn OD_RDYColumn { + get { + return this.columnOD_RDY; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public global::System.Data.DataColumn OD_CPTNRColumn { + get { + return this.columnOD_CPTNR; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public global::System.Data.DataColumn OD_BORINGNRColumn { + get { + return this.columnOD_BORINGNR; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public global::System.Data.DataColumn OD_GEOL_ZONEColumn { + get { + return this.columnOD_GEOL_ZONE; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public global::System.Data.DataColumn OD_CHANCE_OCCURColumn { + get { + return this.columnOD_CHANCE_OCCUR; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.ComponentModel.Browsable(false)] + public int Count { + get { + return this.Rows.Count; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public ODGEOMETRIESRow this[int index] { + get { + return ((ODGEOMETRIESRow)(this.Rows[index])); + } + } + + public event ODGEOMETRIESRowChangeEventHandler ODGEOMETRIESRowChanging; + + public event ODGEOMETRIESRowChangeEventHandler ODGEOMETRIESRowChanged; + + public event ODGEOMETRIESRowChangeEventHandler ODGEOMETRIESRowDeleting; + + public event ODGEOMETRIESRowChangeEventHandler ODGEOMETRIESRowDeleted; + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public void AddODGEOMETRIESRow(ODGEOMETRIESRow row) { + this.Rows.Add(row); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public ODGEOMETRIESRow AddODGEOMETRIESRow(string OD_NAME, string OD_DESCR, double OD_RDX, double OD_RDY, int OD_CPTNR, int OD_BORINGNR, int OD_GEOL_ZONE, double OD_CHANCE_OCCUR) { + ODGEOMETRIESRow rowODGEOMETRIESRow = ((ODGEOMETRIESRow)(this.NewRow())); + object[] columnValuesArray = new object[] { + null, + OD_NAME, + OD_DESCR, + OD_RDX, + OD_RDY, + OD_CPTNR, + OD_BORINGNR, + OD_GEOL_ZONE, + OD_CHANCE_OCCUR}; + rowODGEOMETRIESRow.ItemArray = columnValuesArray; + this.Rows.Add(rowODGEOMETRIESRow); + return rowODGEOMETRIESRow; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public ODGEOMETRIESRow FindByOD_NR(int OD_NR) { + return ((ODGEOMETRIESRow)(this.Rows.Find(new object[] { + OD_NR}))); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public override global::System.Data.DataTable Clone() { + ODGEOMETRIESDataTable cln = ((ODGEOMETRIESDataTable)(base.Clone())); + cln.InitVars(); + return cln; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + protected override global::System.Data.DataTable CreateInstance() { + return new ODGEOMETRIESDataTable(); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + internal void InitVars() { + this.columnOD_NR = base.Columns["OD_NR"]; + this.columnOD_NAME = base.Columns["OD_NAME"]; + this.columnOD_DESCR = base.Columns["OD_DESCR"]; + this.columnOD_RDX = base.Columns["OD_RDX"]; + this.columnOD_RDY = base.Columns["OD_RDY"]; + this.columnOD_CPTNR = base.Columns["OD_CPTNR"]; + this.columnOD_BORINGNR = base.Columns["OD_BORINGNR"]; + this.columnOD_GEOL_ZONE = base.Columns["OD_GEOL_ZONE"]; + this.columnOD_CHANCE_OCCUR = base.Columns["OD_CHANCE_OCCUR"]; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + private void InitClass() { + this.columnOD_NR = new global::System.Data.DataColumn("OD_NR", typeof(int), null, global::System.Data.MappingType.Element); + base.Columns.Add(this.columnOD_NR); + this.columnOD_NAME = new global::System.Data.DataColumn("OD_NAME", typeof(string), null, global::System.Data.MappingType.Element); + base.Columns.Add(this.columnOD_NAME); + this.columnOD_DESCR = new global::System.Data.DataColumn("OD_DESCR", typeof(string), null, global::System.Data.MappingType.Element); + base.Columns.Add(this.columnOD_DESCR); + this.columnOD_RDX = new global::System.Data.DataColumn("OD_RDX", typeof(double), null, global::System.Data.MappingType.Element); + base.Columns.Add(this.columnOD_RDX); + this.columnOD_RDY = new global::System.Data.DataColumn("OD_RDY", typeof(double), null, global::System.Data.MappingType.Element); + base.Columns.Add(this.columnOD_RDY); + this.columnOD_CPTNR = new global::System.Data.DataColumn("OD_CPTNR", typeof(int), null, global::System.Data.MappingType.Element); + base.Columns.Add(this.columnOD_CPTNR); + this.columnOD_BORINGNR = new global::System.Data.DataColumn("OD_BORINGNR", typeof(int), null, global::System.Data.MappingType.Element); + base.Columns.Add(this.columnOD_BORINGNR); + this.columnOD_GEOL_ZONE = new global::System.Data.DataColumn("OD_GEOL_ZONE", typeof(int), null, global::System.Data.MappingType.Element); + base.Columns.Add(this.columnOD_GEOL_ZONE); + this.columnOD_CHANCE_OCCUR = new global::System.Data.DataColumn("OD_CHANCE_OCCUR", typeof(double), null, global::System.Data.MappingType.Element); + base.Columns.Add(this.columnOD_CHANCE_OCCUR); + this.Constraints.Add(new global::System.Data.UniqueConstraint("Constraint1", new global::System.Data.DataColumn[] { + this.columnOD_NR}, true)); + this.columnOD_NR.AutoIncrement = true; + this.columnOD_NR.AutoIncrementSeed = -1; + this.columnOD_NR.AutoIncrementStep = -1; + this.columnOD_NR.AllowDBNull = false; + this.columnOD_NR.ReadOnly = true; + this.columnOD_NR.Unique = true; + this.columnOD_NAME.MaxLength = 64; + this.columnOD_DESCR.MaxLength = 240; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public ODGEOMETRIESRow NewODGEOMETRIESRow() { + return ((ODGEOMETRIESRow)(this.NewRow())); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + protected override global::System.Data.DataRow NewRowFromBuilder(global::System.Data.DataRowBuilder builder) { + return new ODGEOMETRIESRow(builder); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + protected override global::System.Type GetRowType() { + return typeof(ODGEOMETRIESRow); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + protected override void OnRowChanged(global::System.Data.DataRowChangeEventArgs e) { + base.OnRowChanged(e); + if ((this.ODGEOMETRIESRowChanged != null)) { + this.ODGEOMETRIESRowChanged(this, new ODGEOMETRIESRowChangeEvent(((ODGEOMETRIESRow)(e.Row)), e.Action)); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + protected override void OnRowChanging(global::System.Data.DataRowChangeEventArgs e) { + base.OnRowChanging(e); + if ((this.ODGEOMETRIESRowChanging != null)) { + this.ODGEOMETRIESRowChanging(this, new ODGEOMETRIESRowChangeEvent(((ODGEOMETRIESRow)(e.Row)), e.Action)); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + protected override void OnRowDeleted(global::System.Data.DataRowChangeEventArgs e) { + base.OnRowDeleted(e); + if ((this.ODGEOMETRIESRowDeleted != null)) { + this.ODGEOMETRIESRowDeleted(this, new ODGEOMETRIESRowChangeEvent(((ODGEOMETRIESRow)(e.Row)), e.Action)); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + protected override void OnRowDeleting(global::System.Data.DataRowChangeEventArgs e) { + base.OnRowDeleting(e); + if ((this.ODGEOMETRIESRowDeleting != null)) { + this.ODGEOMETRIESRowDeleting(this, new ODGEOMETRIESRowChangeEvent(((ODGEOMETRIESRow)(e.Row)), e.Action)); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public void RemoveODGEOMETRIESRow(ODGEOMETRIESRow row) { + this.Rows.Remove(row); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedTableSchema(global::System.Xml.Schema.XmlSchemaSet xs) { + global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType(); + global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence(); + SoilProfileDataSet ds = new SoilProfileDataSet(); + global::System.Xml.Schema.XmlSchemaAny any1 = new global::System.Xml.Schema.XmlSchemaAny(); + any1.Namespace = "http://www.w3.org/2001/XMLSchema"; + any1.MinOccurs = new decimal(0); + any1.MaxOccurs = decimal.MaxValue; + any1.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax; + sequence.Items.Add(any1); + global::System.Xml.Schema.XmlSchemaAny any2 = new global::System.Xml.Schema.XmlSchemaAny(); + any2.Namespace = "urn:schemas-microsoft-com:xml-diffgram-v1"; + any2.MinOccurs = new decimal(1); + any2.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax; + sequence.Items.Add(any2); + global::System.Xml.Schema.XmlSchemaAttribute attribute1 = new global::System.Xml.Schema.XmlSchemaAttribute(); + attribute1.Name = "namespace"; + attribute1.FixedValue = ds.Namespace; + type.Attributes.Add(attribute1); + global::System.Xml.Schema.XmlSchemaAttribute attribute2 = new global::System.Xml.Schema.XmlSchemaAttribute(); + attribute2.Name = "tableTypeName"; + attribute2.FixedValue = "ODGEOMETRIESDataTable"; + type.Attributes.Add(attribute2); + type.Particle = sequence; + global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable(); + if (xs.Contains(dsSchema.TargetNamespace)) { + global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream(); + global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream(); + try { + global::System.Xml.Schema.XmlSchema schema = null; + dsSchema.Write(s1); + for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext(); ) { + schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current)); + s2.SetLength(0); + schema.Write(s2); + if ((s1.Length == s2.Length)) { + s1.Position = 0; + s2.Position = 0; + for (; ((s1.Position != s1.Length) + && (s1.ReadByte() == s2.ReadByte())); ) { + ; + } + if ((s1.Position == s1.Length)) { + return type; + } + } + } + } + finally { + if ((s1 != null)) { + s1.Close(); + } + if ((s2 != null)) { + s2.Close(); + } + } + } + xs.Add(dsSchema); + return type; + } + } + + /// + ///Represents the strongly named DataTable class. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "2.0.0.0")] + [global::System.Serializable()] + [global::System.Xml.Serialization.XmlSchemaProviderAttribute("GetTypedTableSchema")] + public partial class ODGEOLAYERSDataTable : global::System.Data.TypedTableBase { + + private global::System.Data.DataColumn columnOL_NR; + + private global::System.Data.DataColumn columnOD_NR; + + private global::System.Data.DataColumn columnMA_NR; + + private global::System.Data.DataColumn columnOL_LAYERNR; + + private global::System.Data.DataColumn columnOL_LEVEL; + + private global::System.Data.DataColumn columnOL_PLATTOP; + + private global::System.Data.DataColumn columnOL_PLATBOTTOM; + + private global::System.Data.DataColumn columnOL_TOPEXCESSPP; + + private global::System.Data.DataColumn columnOL_BOTEXCESSPP; + + private global::System.Data.DataColumn columnOL_OCR; + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public ODGEOLAYERSDataTable() { + this.TableName = "ODGEOLAYERS"; + this.BeginInit(); + this.InitClass(); + this.EndInit(); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + internal ODGEOLAYERSDataTable(global::System.Data.DataTable table) { + this.TableName = table.TableName; + if ((table.CaseSensitive != table.DataSet.CaseSensitive)) { + this.CaseSensitive = table.CaseSensitive; + } + if ((table.Locale.ToString() != table.DataSet.Locale.ToString())) { + this.Locale = table.Locale; + } + if ((table.Namespace != table.DataSet.Namespace)) { + this.Namespace = table.Namespace; + } + this.Prefix = table.Prefix; + this.MinimumCapacity = table.MinimumCapacity; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + protected ODGEOLAYERSDataTable(global::System.Runtime.Serialization.SerializationInfo info, global::System.Runtime.Serialization.StreamingContext context) : + base(info, context) { + this.InitVars(); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public global::System.Data.DataColumn OL_NRColumn { + get { + return this.columnOL_NR; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public global::System.Data.DataColumn OD_NRColumn { + get { + return this.columnOD_NR; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public global::System.Data.DataColumn MA_NRColumn { + get { + return this.columnMA_NR; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public global::System.Data.DataColumn OL_LAYERNRColumn { + get { + return this.columnOL_LAYERNR; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public global::System.Data.DataColumn OL_LEVELColumn { + get { + return this.columnOL_LEVEL; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public global::System.Data.DataColumn OL_PLATTOPColumn { + get { + return this.columnOL_PLATTOP; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public global::System.Data.DataColumn OL_PLATBOTTOMColumn { + get { + return this.columnOL_PLATBOTTOM; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public global::System.Data.DataColumn OL_TOPEXCESSPPColumn { + get { + return this.columnOL_TOPEXCESSPP; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public global::System.Data.DataColumn OL_BOTEXCESSPPColumn { + get { + return this.columnOL_BOTEXCESSPP; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public global::System.Data.DataColumn OL_OCRColumn { + get { + return this.columnOL_OCR; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.ComponentModel.Browsable(false)] + public int Count { + get { + return this.Rows.Count; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public ODGEOLAYERSRow this[int index] { + get { + return ((ODGEOLAYERSRow)(this.Rows[index])); + } + } + + public event ODGEOLAYERSRowChangeEventHandler ODGEOLAYERSRowChanging; + + public event ODGEOLAYERSRowChangeEventHandler ODGEOLAYERSRowChanged; + + public event ODGEOLAYERSRowChangeEventHandler ODGEOLAYERSRowDeleting; + + public event ODGEOLAYERSRowChangeEventHandler ODGEOLAYERSRowDeleted; + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public void AddODGEOLAYERSRow(ODGEOLAYERSRow row) { + this.Rows.Add(row); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public ODGEOLAYERSRow AddODGEOLAYERSRow(ODGEOMETRIESRow parentODGEOMETRIESRowByODGEOMETRIES_ODGEOLAYERS, MATERIALSRow parentMATERIALSRowByODGEOLAYERS_MATERIALS, int OL_LAYERNR, double OL_LEVEL, int OL_PLATTOP, int OL_PLATBOTTOM, double OL_TOPEXCESSPP, double OL_BOTEXCESSPP, double OL_OCR) { + ODGEOLAYERSRow rowODGEOLAYERSRow = ((ODGEOLAYERSRow)(this.NewRow())); + object[] columnValuesArray = new object[] { + null, + null, + null, + OL_LAYERNR, + OL_LEVEL, + OL_PLATTOP, + OL_PLATBOTTOM, + OL_TOPEXCESSPP, + OL_BOTEXCESSPP, + OL_OCR}; + if ((parentODGEOMETRIESRowByODGEOMETRIES_ODGEOLAYERS != null)) { + columnValuesArray[1] = parentODGEOMETRIESRowByODGEOMETRIES_ODGEOLAYERS[0]; + } + if ((parentMATERIALSRowByODGEOLAYERS_MATERIALS != null)) { + columnValuesArray[2] = parentMATERIALSRowByODGEOLAYERS_MATERIALS[0]; + } + rowODGEOLAYERSRow.ItemArray = columnValuesArray; + this.Rows.Add(rowODGEOLAYERSRow); + return rowODGEOLAYERSRow; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public ODGEOLAYERSRow FindByOL_NR(int OL_NR) { + return ((ODGEOLAYERSRow)(this.Rows.Find(new object[] { + OL_NR}))); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public override global::System.Data.DataTable Clone() { + ODGEOLAYERSDataTable cln = ((ODGEOLAYERSDataTable)(base.Clone())); + cln.InitVars(); + return cln; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + protected override global::System.Data.DataTable CreateInstance() { + return new ODGEOLAYERSDataTable(); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + internal void InitVars() { + this.columnOL_NR = base.Columns["OL_NR"]; + this.columnOD_NR = base.Columns["OD_NR"]; + this.columnMA_NR = base.Columns["MA_NR"]; + this.columnOL_LAYERNR = base.Columns["OL_LAYERNR"]; + this.columnOL_LEVEL = base.Columns["OL_LEVEL"]; + this.columnOL_PLATTOP = base.Columns["OL_PLATTOP"]; + this.columnOL_PLATBOTTOM = base.Columns["OL_PLATBOTTOM"]; + this.columnOL_TOPEXCESSPP = base.Columns["OL_TOPEXCESSPP"]; + this.columnOL_BOTEXCESSPP = base.Columns["OL_BOTEXCESSPP"]; + this.columnOL_OCR = base.Columns["OL_OCR"]; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + private void InitClass() { + this.columnOL_NR = new global::System.Data.DataColumn("OL_NR", typeof(int), null, global::System.Data.MappingType.Element); + base.Columns.Add(this.columnOL_NR); + this.columnOD_NR = new global::System.Data.DataColumn("OD_NR", typeof(int), null, global::System.Data.MappingType.Element); + base.Columns.Add(this.columnOD_NR); + this.columnMA_NR = new global::System.Data.DataColumn("MA_NR", typeof(int), null, global::System.Data.MappingType.Element); + base.Columns.Add(this.columnMA_NR); + this.columnOL_LAYERNR = new global::System.Data.DataColumn("OL_LAYERNR", typeof(int), null, global::System.Data.MappingType.Element); + base.Columns.Add(this.columnOL_LAYERNR); + this.columnOL_LEVEL = new global::System.Data.DataColumn("OL_LEVEL", typeof(double), null, global::System.Data.MappingType.Element); + base.Columns.Add(this.columnOL_LEVEL); + this.columnOL_PLATTOP = new global::System.Data.DataColumn("OL_PLATTOP", typeof(int), null, global::System.Data.MappingType.Element); + base.Columns.Add(this.columnOL_PLATTOP); + this.columnOL_PLATBOTTOM = new global::System.Data.DataColumn("OL_PLATBOTTOM", typeof(int), null, global::System.Data.MappingType.Element); + base.Columns.Add(this.columnOL_PLATBOTTOM); + this.columnOL_TOPEXCESSPP = new global::System.Data.DataColumn("OL_TOPEXCESSPP", typeof(double), null, global::System.Data.MappingType.Element); + base.Columns.Add(this.columnOL_TOPEXCESSPP); + this.columnOL_BOTEXCESSPP = new global::System.Data.DataColumn("OL_BOTEXCESSPP", typeof(double), null, global::System.Data.MappingType.Element); + base.Columns.Add(this.columnOL_BOTEXCESSPP); + this.columnOL_OCR = new global::System.Data.DataColumn("OL_OCR", typeof(double), null, global::System.Data.MappingType.Element); + base.Columns.Add(this.columnOL_OCR); + this.Constraints.Add(new global::System.Data.UniqueConstraint("Constraint1", new global::System.Data.DataColumn[] { + this.columnOL_NR}, true)); + this.columnOL_NR.AutoIncrement = true; + this.columnOL_NR.AutoIncrementSeed = -1; + this.columnOL_NR.AutoIncrementStep = -1; + this.columnOL_NR.AllowDBNull = false; + this.columnOL_NR.ReadOnly = true; + this.columnOL_NR.Unique = true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public ODGEOLAYERSRow NewODGEOLAYERSRow() { + return ((ODGEOLAYERSRow)(this.NewRow())); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + protected override global::System.Data.DataRow NewRowFromBuilder(global::System.Data.DataRowBuilder builder) { + return new ODGEOLAYERSRow(builder); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + protected override global::System.Type GetRowType() { + return typeof(ODGEOLAYERSRow); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + protected override void OnRowChanged(global::System.Data.DataRowChangeEventArgs e) { + base.OnRowChanged(e); + if ((this.ODGEOLAYERSRowChanged != null)) { + this.ODGEOLAYERSRowChanged(this, new ODGEOLAYERSRowChangeEvent(((ODGEOLAYERSRow)(e.Row)), e.Action)); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + protected override void OnRowChanging(global::System.Data.DataRowChangeEventArgs e) { + base.OnRowChanging(e); + if ((this.ODGEOLAYERSRowChanging != null)) { + this.ODGEOLAYERSRowChanging(this, new ODGEOLAYERSRowChangeEvent(((ODGEOLAYERSRow)(e.Row)), e.Action)); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + protected override void OnRowDeleted(global::System.Data.DataRowChangeEventArgs e) { + base.OnRowDeleted(e); + if ((this.ODGEOLAYERSRowDeleted != null)) { + this.ODGEOLAYERSRowDeleted(this, new ODGEOLAYERSRowChangeEvent(((ODGEOLAYERSRow)(e.Row)), e.Action)); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + protected override void OnRowDeleting(global::System.Data.DataRowChangeEventArgs e) { + base.OnRowDeleting(e); + if ((this.ODGEOLAYERSRowDeleting != null)) { + this.ODGEOLAYERSRowDeleting(this, new ODGEOLAYERSRowChangeEvent(((ODGEOLAYERSRow)(e.Row)), e.Action)); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public void RemoveODGEOLAYERSRow(ODGEOLAYERSRow row) { + this.Rows.Remove(row); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedTableSchema(global::System.Xml.Schema.XmlSchemaSet xs) { + global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType(); + global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence(); + SoilProfileDataSet ds = new SoilProfileDataSet(); + global::System.Xml.Schema.XmlSchemaAny any1 = new global::System.Xml.Schema.XmlSchemaAny(); + any1.Namespace = "http://www.w3.org/2001/XMLSchema"; + any1.MinOccurs = new decimal(0); + any1.MaxOccurs = decimal.MaxValue; + any1.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax; + sequence.Items.Add(any1); + global::System.Xml.Schema.XmlSchemaAny any2 = new global::System.Xml.Schema.XmlSchemaAny(); + any2.Namespace = "urn:schemas-microsoft-com:xml-diffgram-v1"; + any2.MinOccurs = new decimal(1); + any2.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax; + sequence.Items.Add(any2); + global::System.Xml.Schema.XmlSchemaAttribute attribute1 = new global::System.Xml.Schema.XmlSchemaAttribute(); + attribute1.Name = "namespace"; + attribute1.FixedValue = ds.Namespace; + type.Attributes.Add(attribute1); + global::System.Xml.Schema.XmlSchemaAttribute attribute2 = new global::System.Xml.Schema.XmlSchemaAttribute(); + attribute2.Name = "tableTypeName"; + attribute2.FixedValue = "ODGEOLAYERSDataTable"; + type.Attributes.Add(attribute2); + type.Particle = sequence; + global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable(); + if (xs.Contains(dsSchema.TargetNamespace)) { + global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream(); + global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream(); + try { + global::System.Xml.Schema.XmlSchema schema = null; + dsSchema.Write(s1); + for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext(); ) { + schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current)); + s2.SetLength(0); + schema.Write(s2); + if ((s1.Length == s2.Length)) { + s1.Position = 0; + s2.Position = 0; + for (; ((s1.Position != s1.Length) + && (s1.ReadByte() == s2.ReadByte())); ) { + ; + } + if ((s1.Position == s1.Length)) { + return type; + } + } + } + } + finally { + if ((s1 != null)) { + s1.Close(); + } + if ((s2 != null)) { + s2.Close(); + } + } + } + xs.Add(dsSchema); + return type; + } + } + + /// + ///Represents the strongly named DataTable class. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "2.0.0.0")] + [global::System.Serializable()] + [global::System.Xml.Serialization.XmlSchemaProviderAttribute("GetTypedTableSchema")] + public partial class MATERIALSDataTable : global::System.Data.TypedTableBase { + + private global::System.Data.DataColumn columnMA_NR; + + private global::System.Data.DataColumn columnMA_NAME; + + private global::System.Data.DataColumn columnMA_DESCR; + + private global::System.Data.DataColumn columnMA_INDEX; + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public MATERIALSDataTable() { + this.TableName = "MATERIALS"; + this.BeginInit(); + this.InitClass(); + this.EndInit(); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + internal MATERIALSDataTable(global::System.Data.DataTable table) { + this.TableName = table.TableName; + if ((table.CaseSensitive != table.DataSet.CaseSensitive)) { + this.CaseSensitive = table.CaseSensitive; + } + if ((table.Locale.ToString() != table.DataSet.Locale.ToString())) { + this.Locale = table.Locale; + } + if ((table.Namespace != table.DataSet.Namespace)) { + this.Namespace = table.Namespace; + } + this.Prefix = table.Prefix; + this.MinimumCapacity = table.MinimumCapacity; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + protected MATERIALSDataTable(global::System.Runtime.Serialization.SerializationInfo info, global::System.Runtime.Serialization.StreamingContext context) : + base(info, context) { + this.InitVars(); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public global::System.Data.DataColumn MA_NRColumn { + get { + return this.columnMA_NR; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public global::System.Data.DataColumn MA_NAMEColumn { + get { + return this.columnMA_NAME; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public global::System.Data.DataColumn MA_DESCRColumn { + get { + return this.columnMA_DESCR; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public global::System.Data.DataColumn MA_INDEXColumn { + get { + return this.columnMA_INDEX; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.ComponentModel.Browsable(false)] + public int Count { + get { + return this.Rows.Count; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public MATERIALSRow this[int index] { + get { + return ((MATERIALSRow)(this.Rows[index])); + } + } + + public event MATERIALSRowChangeEventHandler MATERIALSRowChanging; + + public event MATERIALSRowChangeEventHandler MATERIALSRowChanged; + + public event MATERIALSRowChangeEventHandler MATERIALSRowDeleting; + + public event MATERIALSRowChangeEventHandler MATERIALSRowDeleted; + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public void AddMATERIALSRow(MATERIALSRow row) { + this.Rows.Add(row); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public MATERIALSRow AddMATERIALSRow(string MA_NAME, string MA_DESCR, int MA_INDEX) { + MATERIALSRow rowMATERIALSRow = ((MATERIALSRow)(this.NewRow())); + object[] columnValuesArray = new object[] { + null, + MA_NAME, + MA_DESCR, + MA_INDEX}; + rowMATERIALSRow.ItemArray = columnValuesArray; + this.Rows.Add(rowMATERIALSRow); + return rowMATERIALSRow; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public MATERIALSRow FindByMA_NR(int MA_NR) { + return ((MATERIALSRow)(this.Rows.Find(new object[] { + MA_NR}))); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public override global::System.Data.DataTable Clone() { + MATERIALSDataTable cln = ((MATERIALSDataTable)(base.Clone())); + cln.InitVars(); + return cln; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + protected override global::System.Data.DataTable CreateInstance() { + return new MATERIALSDataTable(); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + internal void InitVars() { + this.columnMA_NR = base.Columns["MA_NR"]; + this.columnMA_NAME = base.Columns["MA_NAME"]; + this.columnMA_DESCR = base.Columns["MA_DESCR"]; + this.columnMA_INDEX = base.Columns["MA_INDEX"]; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + private void InitClass() { + this.columnMA_NR = new global::System.Data.DataColumn("MA_NR", typeof(int), null, global::System.Data.MappingType.Element); + base.Columns.Add(this.columnMA_NR); + this.columnMA_NAME = new global::System.Data.DataColumn("MA_NAME", typeof(string), null, global::System.Data.MappingType.Element); + base.Columns.Add(this.columnMA_NAME); + this.columnMA_DESCR = new global::System.Data.DataColumn("MA_DESCR", typeof(string), null, global::System.Data.MappingType.Element); + base.Columns.Add(this.columnMA_DESCR); + this.columnMA_INDEX = new global::System.Data.DataColumn("MA_INDEX", typeof(int), null, global::System.Data.MappingType.Element); + base.Columns.Add(this.columnMA_INDEX); + this.Constraints.Add(new global::System.Data.UniqueConstraint("Constraint1", new global::System.Data.DataColumn[] { + this.columnMA_NR}, true)); + this.columnMA_NR.AutoIncrement = true; + this.columnMA_NR.AutoIncrementSeed = -1; + this.columnMA_NR.AutoIncrementStep = -1; + this.columnMA_NR.AllowDBNull = false; + this.columnMA_NR.ReadOnly = true; + this.columnMA_NR.Unique = true; + this.columnMA_NAME.MaxLength = 128; + this.columnMA_DESCR.MaxLength = 240; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public MATERIALSRow NewMATERIALSRow() { + return ((MATERIALSRow)(this.NewRow())); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + protected override global::System.Data.DataRow NewRowFromBuilder(global::System.Data.DataRowBuilder builder) { + return new MATERIALSRow(builder); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + protected override global::System.Type GetRowType() { + return typeof(MATERIALSRow); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + protected override void OnRowChanged(global::System.Data.DataRowChangeEventArgs e) { + base.OnRowChanged(e); + if ((this.MATERIALSRowChanged != null)) { + this.MATERIALSRowChanged(this, new MATERIALSRowChangeEvent(((MATERIALSRow)(e.Row)), e.Action)); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + protected override void OnRowChanging(global::System.Data.DataRowChangeEventArgs e) { + base.OnRowChanging(e); + if ((this.MATERIALSRowChanging != null)) { + this.MATERIALSRowChanging(this, new MATERIALSRowChangeEvent(((MATERIALSRow)(e.Row)), e.Action)); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + protected override void OnRowDeleted(global::System.Data.DataRowChangeEventArgs e) { + base.OnRowDeleted(e); + if ((this.MATERIALSRowDeleted != null)) { + this.MATERIALSRowDeleted(this, new MATERIALSRowChangeEvent(((MATERIALSRow)(e.Row)), e.Action)); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + protected override void OnRowDeleting(global::System.Data.DataRowChangeEventArgs e) { + base.OnRowDeleting(e); + if ((this.MATERIALSRowDeleting != null)) { + this.MATERIALSRowDeleting(this, new MATERIALSRowChangeEvent(((MATERIALSRow)(e.Row)), e.Action)); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public void RemoveMATERIALSRow(MATERIALSRow row) { + this.Rows.Remove(row); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedTableSchema(global::System.Xml.Schema.XmlSchemaSet xs) { + global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType(); + global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence(); + SoilProfileDataSet ds = new SoilProfileDataSet(); + global::System.Xml.Schema.XmlSchemaAny any1 = new global::System.Xml.Schema.XmlSchemaAny(); + any1.Namespace = "http://www.w3.org/2001/XMLSchema"; + any1.MinOccurs = new decimal(0); + any1.MaxOccurs = decimal.MaxValue; + any1.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax; + sequence.Items.Add(any1); + global::System.Xml.Schema.XmlSchemaAny any2 = new global::System.Xml.Schema.XmlSchemaAny(); + any2.Namespace = "urn:schemas-microsoft-com:xml-diffgram-v1"; + any2.MinOccurs = new decimal(1); + any2.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax; + sequence.Items.Add(any2); + global::System.Xml.Schema.XmlSchemaAttribute attribute1 = new global::System.Xml.Schema.XmlSchemaAttribute(); + attribute1.Name = "namespace"; + attribute1.FixedValue = ds.Namespace; + type.Attributes.Add(attribute1); + global::System.Xml.Schema.XmlSchemaAttribute attribute2 = new global::System.Xml.Schema.XmlSchemaAttribute(); + attribute2.Name = "tableTypeName"; + attribute2.FixedValue = "MATERIALSDataTable"; + type.Attributes.Add(attribute2); + type.Particle = sequence; + global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable(); + if (xs.Contains(dsSchema.TargetNamespace)) { + global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream(); + global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream(); + try { + global::System.Xml.Schema.XmlSchema schema = null; + dsSchema.Write(s1); + for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext(); ) { + schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current)); + s2.SetLength(0); + schema.Write(s2); + if ((s1.Length == s2.Length)) { + s1.Position = 0; + s2.Position = 0; + for (; ((s1.Position != s1.Length) + && (s1.ReadByte() == s2.ReadByte())); ) { + ; + } + if ((s1.Position == s1.Length)) { + return type; + } + } + } + } + finally { + if ((s1 != null)) { + s1.Close(); + } + if ((s2 != null)) { + s2.Close(); + } + } + } + xs.Add(dsSchema); + return type; + } + } + + /// + ///Represents the strongly named DataTable class. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "2.0.0.0")] + [global::System.Serializable()] + [global::System.Xml.Serialization.XmlSchemaProviderAttribute("GetTypedTableSchema")] + public partial class PARAMETERNAMESDataTable : global::System.Data.TypedTableBase { + + private global::System.Data.DataColumn columnPN_NR; + + private global::System.Data.DataColumn columnPN_NAME; + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public PARAMETERNAMESDataTable() { + this.TableName = "PARAMETERNAMES"; + this.BeginInit(); + this.InitClass(); + this.EndInit(); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + internal PARAMETERNAMESDataTable(global::System.Data.DataTable table) { + this.TableName = table.TableName; + if ((table.CaseSensitive != table.DataSet.CaseSensitive)) { + this.CaseSensitive = table.CaseSensitive; + } + if ((table.Locale.ToString() != table.DataSet.Locale.ToString())) { + this.Locale = table.Locale; + } + if ((table.Namespace != table.DataSet.Namespace)) { + this.Namespace = table.Namespace; + } + this.Prefix = table.Prefix; + this.MinimumCapacity = table.MinimumCapacity; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + protected PARAMETERNAMESDataTable(global::System.Runtime.Serialization.SerializationInfo info, global::System.Runtime.Serialization.StreamingContext context) : + base(info, context) { + this.InitVars(); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public global::System.Data.DataColumn PN_NRColumn { + get { + return this.columnPN_NR; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public global::System.Data.DataColumn PN_NAMEColumn { + get { + return this.columnPN_NAME; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.ComponentModel.Browsable(false)] + public int Count { + get { + return this.Rows.Count; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public PARAMETERNAMESRow this[int index] { + get { + return ((PARAMETERNAMESRow)(this.Rows[index])); + } + } + + public event PARAMETERNAMESRowChangeEventHandler PARAMETERNAMESRowChanging; + + public event PARAMETERNAMESRowChangeEventHandler PARAMETERNAMESRowChanged; + + public event PARAMETERNAMESRowChangeEventHandler PARAMETERNAMESRowDeleting; + + public event PARAMETERNAMESRowChangeEventHandler PARAMETERNAMESRowDeleted; + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public void AddPARAMETERNAMESRow(PARAMETERNAMESRow row) { + this.Rows.Add(row); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public PARAMETERNAMESRow AddPARAMETERNAMESRow(string PN_NAME) { + PARAMETERNAMESRow rowPARAMETERNAMESRow = ((PARAMETERNAMESRow)(this.NewRow())); + object[] columnValuesArray = new object[] { + null, + PN_NAME}; + rowPARAMETERNAMESRow.ItemArray = columnValuesArray; + this.Rows.Add(rowPARAMETERNAMESRow); + return rowPARAMETERNAMESRow; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public PARAMETERNAMESRow FindByPN_NR(int PN_NR) { + return ((PARAMETERNAMESRow)(this.Rows.Find(new object[] { + PN_NR}))); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public override global::System.Data.DataTable Clone() { + PARAMETERNAMESDataTable cln = ((PARAMETERNAMESDataTable)(base.Clone())); + cln.InitVars(); + return cln; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + protected override global::System.Data.DataTable CreateInstance() { + return new PARAMETERNAMESDataTable(); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + internal void InitVars() { + this.columnPN_NR = base.Columns["PN_NR"]; + this.columnPN_NAME = base.Columns["PN_NAME"]; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + private void InitClass() { + this.columnPN_NR = new global::System.Data.DataColumn("PN_NR", typeof(int), null, global::System.Data.MappingType.Element); + base.Columns.Add(this.columnPN_NR); + this.columnPN_NAME = new global::System.Data.DataColumn("PN_NAME", typeof(string), null, global::System.Data.MappingType.Element); + base.Columns.Add(this.columnPN_NAME); + this.Constraints.Add(new global::System.Data.UniqueConstraint("Constraint1", new global::System.Data.DataColumn[] { + this.columnPN_NR}, true)); + this.columnPN_NR.AutoIncrement = true; + this.columnPN_NR.AutoIncrementSeed = -1; + this.columnPN_NR.AutoIncrementStep = -1; + this.columnPN_NR.AllowDBNull = false; + this.columnPN_NR.ReadOnly = true; + this.columnPN_NR.Unique = true; + this.columnPN_NAME.MaxLength = 64; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public PARAMETERNAMESRow NewPARAMETERNAMESRow() { + return ((PARAMETERNAMESRow)(this.NewRow())); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + protected override global::System.Data.DataRow NewRowFromBuilder(global::System.Data.DataRowBuilder builder) { + return new PARAMETERNAMESRow(builder); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + protected override global::System.Type GetRowType() { + return typeof(PARAMETERNAMESRow); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + protected override void OnRowChanged(global::System.Data.DataRowChangeEventArgs e) { + base.OnRowChanged(e); + if ((this.PARAMETERNAMESRowChanged != null)) { + this.PARAMETERNAMESRowChanged(this, new PARAMETERNAMESRowChangeEvent(((PARAMETERNAMESRow)(e.Row)), e.Action)); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + protected override void OnRowChanging(global::System.Data.DataRowChangeEventArgs e) { + base.OnRowChanging(e); + if ((this.PARAMETERNAMESRowChanging != null)) { + this.PARAMETERNAMESRowChanging(this, new PARAMETERNAMESRowChangeEvent(((PARAMETERNAMESRow)(e.Row)), e.Action)); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + protected override void OnRowDeleted(global::System.Data.DataRowChangeEventArgs e) { + base.OnRowDeleted(e); + if ((this.PARAMETERNAMESRowDeleted != null)) { + this.PARAMETERNAMESRowDeleted(this, new PARAMETERNAMESRowChangeEvent(((PARAMETERNAMESRow)(e.Row)), e.Action)); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + protected override void OnRowDeleting(global::System.Data.DataRowChangeEventArgs e) { + base.OnRowDeleting(e); + if ((this.PARAMETERNAMESRowDeleting != null)) { + this.PARAMETERNAMESRowDeleting(this, new PARAMETERNAMESRowChangeEvent(((PARAMETERNAMESRow)(e.Row)), e.Action)); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public void RemovePARAMETERNAMESRow(PARAMETERNAMESRow row) { + this.Rows.Remove(row); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedTableSchema(global::System.Xml.Schema.XmlSchemaSet xs) { + global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType(); + global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence(); + SoilProfileDataSet ds = new SoilProfileDataSet(); + global::System.Xml.Schema.XmlSchemaAny any1 = new global::System.Xml.Schema.XmlSchemaAny(); + any1.Namespace = "http://www.w3.org/2001/XMLSchema"; + any1.MinOccurs = new decimal(0); + any1.MaxOccurs = decimal.MaxValue; + any1.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax; + sequence.Items.Add(any1); + global::System.Xml.Schema.XmlSchemaAny any2 = new global::System.Xml.Schema.XmlSchemaAny(); + any2.Namespace = "urn:schemas-microsoft-com:xml-diffgram-v1"; + any2.MinOccurs = new decimal(1); + any2.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax; + sequence.Items.Add(any2); + global::System.Xml.Schema.XmlSchemaAttribute attribute1 = new global::System.Xml.Schema.XmlSchemaAttribute(); + attribute1.Name = "namespace"; + attribute1.FixedValue = ds.Namespace; + type.Attributes.Add(attribute1); + global::System.Xml.Schema.XmlSchemaAttribute attribute2 = new global::System.Xml.Schema.XmlSchemaAttribute(); + attribute2.Name = "tableTypeName"; + attribute2.FixedValue = "PARAMETERNAMESDataTable"; + type.Attributes.Add(attribute2); + type.Particle = sequence; + global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable(); + if (xs.Contains(dsSchema.TargetNamespace)) { + global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream(); + global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream(); + try { + global::System.Xml.Schema.XmlSchema schema = null; + dsSchema.Write(s1); + for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext(); ) { + schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current)); + s2.SetLength(0); + schema.Write(s2); + if ((s1.Length == s2.Length)) { + s1.Position = 0; + s2.Position = 0; + for (; ((s1.Position != s1.Length) + && (s1.ReadByte() == s2.ReadByte())); ) { + ; + } + if ((s1.Position == s1.Length)) { + return type; + } + } + } + } + finally { + if ((s1 != null)) { + s1.Close(); + } + if ((s2 != null)) { + s2.Close(); + } + } + } + xs.Add(dsSchema); + return type; + } + } + + /// + ///Represents the strongly named DataTable class. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "2.0.0.0")] + [global::System.Serializable()] + [global::System.Xml.Serialization.XmlSchemaProviderAttribute("GetTypedTableSchema")] + public partial class PARAMETERVALUESDataTable : global::System.Data.TypedTableBase { + + private global::System.Data.DataColumn columnPV_NR; + + private global::System.Data.DataColumn columnMA_NR; + + private global::System.Data.DataColumn columnPN_NR; + + private global::System.Data.DataColumn columnPV_VALUE; + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public PARAMETERVALUESDataTable() { + this.TableName = "PARAMETERVALUES"; + this.BeginInit(); + this.InitClass(); + this.EndInit(); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + internal PARAMETERVALUESDataTable(global::System.Data.DataTable table) { + this.TableName = table.TableName; + if ((table.CaseSensitive != table.DataSet.CaseSensitive)) { + this.CaseSensitive = table.CaseSensitive; + } + if ((table.Locale.ToString() != table.DataSet.Locale.ToString())) { + this.Locale = table.Locale; + } + if ((table.Namespace != table.DataSet.Namespace)) { + this.Namespace = table.Namespace; + } + this.Prefix = table.Prefix; + this.MinimumCapacity = table.MinimumCapacity; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + protected PARAMETERVALUESDataTable(global::System.Runtime.Serialization.SerializationInfo info, global::System.Runtime.Serialization.StreamingContext context) : + base(info, context) { + this.InitVars(); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public global::System.Data.DataColumn PV_NRColumn { + get { + return this.columnPV_NR; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public global::System.Data.DataColumn MA_NRColumn { + get { + return this.columnMA_NR; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public global::System.Data.DataColumn PN_NRColumn { + get { + return this.columnPN_NR; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public global::System.Data.DataColumn PV_VALUEColumn { + get { + return this.columnPV_VALUE; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.ComponentModel.Browsable(false)] + public int Count { + get { + return this.Rows.Count; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public PARAMETERVALUESRow this[int index] { + get { + return ((PARAMETERVALUESRow)(this.Rows[index])); + } + } + + public event PARAMETERVALUESRowChangeEventHandler PARAMETERVALUESRowChanging; + + public event PARAMETERVALUESRowChangeEventHandler PARAMETERVALUESRowChanged; + + public event PARAMETERVALUESRowChangeEventHandler PARAMETERVALUESRowDeleting; + + public event PARAMETERVALUESRowChangeEventHandler PARAMETERVALUESRowDeleted; + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public void AddPARAMETERVALUESRow(PARAMETERVALUESRow row) { + this.Rows.Add(row); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public PARAMETERVALUESRow AddPARAMETERVALUESRow(MATERIALSRow parentMATERIALSRowByPARAMETERVALUES_MATERIALS, PARAMETERNAMESRow parentPARAMETERNAMESRowByPARAMETERNAMES_PARAMETERVALUES, double PV_VALUE) { + PARAMETERVALUESRow rowPARAMETERVALUESRow = ((PARAMETERVALUESRow)(this.NewRow())); + object[] columnValuesArray = new object[] { + null, + null, + null, + PV_VALUE}; + if ((parentMATERIALSRowByPARAMETERVALUES_MATERIALS != null)) { + columnValuesArray[1] = parentMATERIALSRowByPARAMETERVALUES_MATERIALS[0]; + } + if ((parentPARAMETERNAMESRowByPARAMETERNAMES_PARAMETERVALUES != null)) { + columnValuesArray[2] = parentPARAMETERNAMESRowByPARAMETERNAMES_PARAMETERVALUES[0]; + } + rowPARAMETERVALUESRow.ItemArray = columnValuesArray; + this.Rows.Add(rowPARAMETERVALUESRow); + return rowPARAMETERVALUESRow; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public PARAMETERVALUESRow FindByPV_NR(int PV_NR) { + return ((PARAMETERVALUESRow)(this.Rows.Find(new object[] { + PV_NR}))); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public override global::System.Data.DataTable Clone() { + PARAMETERVALUESDataTable cln = ((PARAMETERVALUESDataTable)(base.Clone())); + cln.InitVars(); + return cln; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + protected override global::System.Data.DataTable CreateInstance() { + return new PARAMETERVALUESDataTable(); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + internal void InitVars() { + this.columnPV_NR = base.Columns["PV_NR"]; + this.columnMA_NR = base.Columns["MA_NR"]; + this.columnPN_NR = base.Columns["PN_NR"]; + this.columnPV_VALUE = base.Columns["PV_VALUE"]; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + private void InitClass() { + this.columnPV_NR = new global::System.Data.DataColumn("PV_NR", typeof(int), null, global::System.Data.MappingType.Element); + base.Columns.Add(this.columnPV_NR); + this.columnMA_NR = new global::System.Data.DataColumn("MA_NR", typeof(int), null, global::System.Data.MappingType.Element); + base.Columns.Add(this.columnMA_NR); + this.columnPN_NR = new global::System.Data.DataColumn("PN_NR", typeof(int), null, global::System.Data.MappingType.Element); + base.Columns.Add(this.columnPN_NR); + this.columnPV_VALUE = new global::System.Data.DataColumn("PV_VALUE", typeof(double), null, global::System.Data.MappingType.Element); + base.Columns.Add(this.columnPV_VALUE); + this.Constraints.Add(new global::System.Data.UniqueConstraint("Constraint1", new global::System.Data.DataColumn[] { + this.columnPV_NR}, true)); + this.columnPV_NR.AutoIncrement = true; + this.columnPV_NR.AutoIncrementSeed = -1; + this.columnPV_NR.AutoIncrementStep = -1; + this.columnPV_NR.AllowDBNull = false; + this.columnPV_NR.ReadOnly = true; + this.columnPV_NR.Unique = true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public PARAMETERVALUESRow NewPARAMETERVALUESRow() { + return ((PARAMETERVALUESRow)(this.NewRow())); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + protected override global::System.Data.DataRow NewRowFromBuilder(global::System.Data.DataRowBuilder builder) { + return new PARAMETERVALUESRow(builder); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + protected override global::System.Type GetRowType() { + return typeof(PARAMETERVALUESRow); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + protected override void OnRowChanged(global::System.Data.DataRowChangeEventArgs e) { + base.OnRowChanged(e); + if ((this.PARAMETERVALUESRowChanged != null)) { + this.PARAMETERVALUESRowChanged(this, new PARAMETERVALUESRowChangeEvent(((PARAMETERVALUESRow)(e.Row)), e.Action)); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + protected override void OnRowChanging(global::System.Data.DataRowChangeEventArgs e) { + base.OnRowChanging(e); + if ((this.PARAMETERVALUESRowChanging != null)) { + this.PARAMETERVALUESRowChanging(this, new PARAMETERVALUESRowChangeEvent(((PARAMETERVALUESRow)(e.Row)), e.Action)); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + protected override void OnRowDeleted(global::System.Data.DataRowChangeEventArgs e) { + base.OnRowDeleted(e); + if ((this.PARAMETERVALUESRowDeleted != null)) { + this.PARAMETERVALUESRowDeleted(this, new PARAMETERVALUESRowChangeEvent(((PARAMETERVALUESRow)(e.Row)), e.Action)); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + protected override void OnRowDeleting(global::System.Data.DataRowChangeEventArgs e) { + base.OnRowDeleting(e); + if ((this.PARAMETERVALUESRowDeleting != null)) { + this.PARAMETERVALUESRowDeleting(this, new PARAMETERVALUESRowChangeEvent(((PARAMETERVALUESRow)(e.Row)), e.Action)); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public void RemovePARAMETERVALUESRow(PARAMETERVALUESRow row) { + this.Rows.Remove(row); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedTableSchema(global::System.Xml.Schema.XmlSchemaSet xs) { + global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType(); + global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence(); + SoilProfileDataSet ds = new SoilProfileDataSet(); + global::System.Xml.Schema.XmlSchemaAny any1 = new global::System.Xml.Schema.XmlSchemaAny(); + any1.Namespace = "http://www.w3.org/2001/XMLSchema"; + any1.MinOccurs = new decimal(0); + any1.MaxOccurs = decimal.MaxValue; + any1.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax; + sequence.Items.Add(any1); + global::System.Xml.Schema.XmlSchemaAny any2 = new global::System.Xml.Schema.XmlSchemaAny(); + any2.Namespace = "urn:schemas-microsoft-com:xml-diffgram-v1"; + any2.MinOccurs = new decimal(1); + any2.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax; + sequence.Items.Add(any2); + global::System.Xml.Schema.XmlSchemaAttribute attribute1 = new global::System.Xml.Schema.XmlSchemaAttribute(); + attribute1.Name = "namespace"; + attribute1.FixedValue = ds.Namespace; + type.Attributes.Add(attribute1); + global::System.Xml.Schema.XmlSchemaAttribute attribute2 = new global::System.Xml.Schema.XmlSchemaAttribute(); + attribute2.Name = "tableTypeName"; + attribute2.FixedValue = "PARAMETERVALUESDataTable"; + type.Attributes.Add(attribute2); + type.Particle = sequence; + global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable(); + if (xs.Contains(dsSchema.TargetNamespace)) { + global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream(); + global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream(); + try { + global::System.Xml.Schema.XmlSchema schema = null; + dsSchema.Write(s1); + for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext(); ) { + schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current)); + s2.SetLength(0); + schema.Write(s2); + if ((s1.Length == s2.Length)) { + s1.Position = 0; + s2.Position = 0; + for (; ((s1.Position != s1.Length) + && (s1.ReadByte() == s2.ReadByte())); ) { + ; + } + if ((s1.Position == s1.Length)) { + return type; + } + } + } + } + finally { + if ((s1 != null)) { + s1.Close(); + } + if ((s2 != null)) { + s2.Close(); + } + } + } + xs.Add(dsSchema); + return type; + } + } + + /// + ///Represents strongly named DataRow class. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "2.0.0.0")] + public partial class ODGEOMETRIESRow : global::System.Data.DataRow { + + private ODGEOMETRIESDataTable tableODGEOMETRIES; + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + internal ODGEOMETRIESRow(global::System.Data.DataRowBuilder rb) : + base(rb) { + this.tableODGEOMETRIES = ((ODGEOMETRIESDataTable)(this.Table)); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public int OD_NR { + get { + return ((int)(this[this.tableODGEOMETRIES.OD_NRColumn])); + } + set { + this[this.tableODGEOMETRIES.OD_NRColumn] = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public string OD_NAME { + get { + try { + return ((string)(this[this.tableODGEOMETRIES.OD_NAMEColumn])); + } + catch (global::System.InvalidCastException e) { + throw new global::System.Data.StrongTypingException("The value for column \'OD_NAME\' in table \'ODGEOMETRIES\' is DBNull.", e); + } + } + set { + this[this.tableODGEOMETRIES.OD_NAMEColumn] = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public string OD_DESCR { + get { + try { + return ((string)(this[this.tableODGEOMETRIES.OD_DESCRColumn])); + } + catch (global::System.InvalidCastException e) { + throw new global::System.Data.StrongTypingException("The value for column \'OD_DESCR\' in table \'ODGEOMETRIES\' is DBNull.", e); + } + } + set { + this[this.tableODGEOMETRIES.OD_DESCRColumn] = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public double OD_RDX { + get { + try { + return ((double)(this[this.tableODGEOMETRIES.OD_RDXColumn])); + } + catch (global::System.InvalidCastException e) { + throw new global::System.Data.StrongTypingException("The value for column \'OD_RDX\' in table \'ODGEOMETRIES\' is DBNull.", e); + } + } + set { + this[this.tableODGEOMETRIES.OD_RDXColumn] = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public double OD_RDY { + get { + try { + return ((double)(this[this.tableODGEOMETRIES.OD_RDYColumn])); + } + catch (global::System.InvalidCastException e) { + throw new global::System.Data.StrongTypingException("The value for column \'OD_RDY\' in table \'ODGEOMETRIES\' is DBNull.", e); + } + } + set { + this[this.tableODGEOMETRIES.OD_RDYColumn] = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public int OD_CPTNR { + get { + try { + return ((int)(this[this.tableODGEOMETRIES.OD_CPTNRColumn])); + } + catch (global::System.InvalidCastException e) { + throw new global::System.Data.StrongTypingException("The value for column \'OD_CPTNR\' in table \'ODGEOMETRIES\' is DBNull.", e); + } + } + set { + this[this.tableODGEOMETRIES.OD_CPTNRColumn] = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public int OD_BORINGNR { + get { + try { + return ((int)(this[this.tableODGEOMETRIES.OD_BORINGNRColumn])); + } + catch (global::System.InvalidCastException e) { + throw new global::System.Data.StrongTypingException("The value for column \'OD_BORINGNR\' in table \'ODGEOMETRIES\' is DBNull.", e); + } + } + set { + this[this.tableODGEOMETRIES.OD_BORINGNRColumn] = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public int OD_GEOL_ZONE { + get { + try { + return ((int)(this[this.tableODGEOMETRIES.OD_GEOL_ZONEColumn])); + } + catch (global::System.InvalidCastException e) { + throw new global::System.Data.StrongTypingException("The value for column \'OD_GEOL_ZONE\' in table \'ODGEOMETRIES\' is DBNull.", e); + } + } + set { + this[this.tableODGEOMETRIES.OD_GEOL_ZONEColumn] = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public double OD_CHANCE_OCCUR { + get { + try { + return ((double)(this[this.tableODGEOMETRIES.OD_CHANCE_OCCURColumn])); + } + catch (global::System.InvalidCastException e) { + throw new global::System.Data.StrongTypingException("The value for column \'OD_CHANCE_OCCUR\' in table \'ODGEOMETRIES\' is DBNull.", e); + } + } + set { + this[this.tableODGEOMETRIES.OD_CHANCE_OCCURColumn] = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public bool IsOD_NAMENull() { + return this.IsNull(this.tableODGEOMETRIES.OD_NAMEColumn); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public void SetOD_NAMENull() { + this[this.tableODGEOMETRIES.OD_NAMEColumn] = global::System.Convert.DBNull; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public bool IsOD_DESCRNull() { + return this.IsNull(this.tableODGEOMETRIES.OD_DESCRColumn); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public void SetOD_DESCRNull() { + this[this.tableODGEOMETRIES.OD_DESCRColumn] = global::System.Convert.DBNull; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public bool IsOD_RDXNull() { + return this.IsNull(this.tableODGEOMETRIES.OD_RDXColumn); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public void SetOD_RDXNull() { + this[this.tableODGEOMETRIES.OD_RDXColumn] = global::System.Convert.DBNull; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public bool IsOD_RDYNull() { + return this.IsNull(this.tableODGEOMETRIES.OD_RDYColumn); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public void SetOD_RDYNull() { + this[this.tableODGEOMETRIES.OD_RDYColumn] = global::System.Convert.DBNull; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public bool IsOD_CPTNRNull() { + return this.IsNull(this.tableODGEOMETRIES.OD_CPTNRColumn); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public void SetOD_CPTNRNull() { + this[this.tableODGEOMETRIES.OD_CPTNRColumn] = global::System.Convert.DBNull; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public bool IsOD_BORINGNRNull() { + return this.IsNull(this.tableODGEOMETRIES.OD_BORINGNRColumn); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public void SetOD_BORINGNRNull() { + this[this.tableODGEOMETRIES.OD_BORINGNRColumn] = global::System.Convert.DBNull; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public bool IsOD_GEOL_ZONENull() { + return this.IsNull(this.tableODGEOMETRIES.OD_GEOL_ZONEColumn); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public void SetOD_GEOL_ZONENull() { + this[this.tableODGEOMETRIES.OD_GEOL_ZONEColumn] = global::System.Convert.DBNull; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public bool IsOD_CHANCE_OCCURNull() { + return this.IsNull(this.tableODGEOMETRIES.OD_CHANCE_OCCURColumn); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public void SetOD_CHANCE_OCCURNull() { + this[this.tableODGEOMETRIES.OD_CHANCE_OCCURColumn] = global::System.Convert.DBNull; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public ODGEOLAYERSRow[] GetODGEOLAYERSRows() { + if ((this.Table.ChildRelations["ODGEOMETRIES_ODGEOLAYERS"] == null)) { + return new ODGEOLAYERSRow[0]; + } + else { + return ((ODGEOLAYERSRow[])(base.GetChildRows(this.Table.ChildRelations["ODGEOMETRIES_ODGEOLAYERS"]))); + } + } + } + + /// + ///Represents strongly named DataRow class. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "2.0.0.0")] + public partial class ODGEOLAYERSRow : global::System.Data.DataRow { + + private ODGEOLAYERSDataTable tableODGEOLAYERS; + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + internal ODGEOLAYERSRow(global::System.Data.DataRowBuilder rb) : + base(rb) { + this.tableODGEOLAYERS = ((ODGEOLAYERSDataTable)(this.Table)); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public int OL_NR { + get { + return ((int)(this[this.tableODGEOLAYERS.OL_NRColumn])); + } + set { + this[this.tableODGEOLAYERS.OL_NRColumn] = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public int OD_NR { + get { + try { + return ((int)(this[this.tableODGEOLAYERS.OD_NRColumn])); + } + catch (global::System.InvalidCastException e) { + throw new global::System.Data.StrongTypingException("The value for column \'OD_NR\' in table \'ODGEOLAYERS\' is DBNull.", e); + } + } + set { + this[this.tableODGEOLAYERS.OD_NRColumn] = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public int MA_NR { + get { + try { + return ((int)(this[this.tableODGEOLAYERS.MA_NRColumn])); + } + catch (global::System.InvalidCastException e) { + throw new global::System.Data.StrongTypingException("The value for column \'MA_NR\' in table \'ODGEOLAYERS\' is DBNull.", e); + } + } + set { + this[this.tableODGEOLAYERS.MA_NRColumn] = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public int OL_LAYERNR { + get { + try { + return ((int)(this[this.tableODGEOLAYERS.OL_LAYERNRColumn])); + } + catch (global::System.InvalidCastException e) { + throw new global::System.Data.StrongTypingException("The value for column \'OL_LAYERNR\' in table \'ODGEOLAYERS\' is DBNull.", e); + } + } + set { + this[this.tableODGEOLAYERS.OL_LAYERNRColumn] = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public double OL_LEVEL { + get { + try { + return ((double)(this[this.tableODGEOLAYERS.OL_LEVELColumn])); + } + catch (global::System.InvalidCastException e) { + throw new global::System.Data.StrongTypingException("The value for column \'OL_LEVEL\' in table \'ODGEOLAYERS\' is DBNull.", e); + } + } + set { + this[this.tableODGEOLAYERS.OL_LEVELColumn] = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public int OL_PLATTOP { + get { + try { + return ((int)(this[this.tableODGEOLAYERS.OL_PLATTOPColumn])); + } + catch (global::System.InvalidCastException e) { + throw new global::System.Data.StrongTypingException("The value for column \'OL_PLATTOP\' in table \'ODGEOLAYERS\' is DBNull.", e); + } + } + set { + this[this.tableODGEOLAYERS.OL_PLATTOPColumn] = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public int OL_PLATBOTTOM { + get { + try { + return ((int)(this[this.tableODGEOLAYERS.OL_PLATBOTTOMColumn])); + } + catch (global::System.InvalidCastException e) { + throw new global::System.Data.StrongTypingException("The value for column \'OL_PLATBOTTOM\' in table \'ODGEOLAYERS\' is DBNull.", e); + } + } + set { + this[this.tableODGEOLAYERS.OL_PLATBOTTOMColumn] = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public double OL_TOPEXCESSPP { + get { + try { + return ((double)(this[this.tableODGEOLAYERS.OL_TOPEXCESSPPColumn])); + } + catch (global::System.InvalidCastException e) { + throw new global::System.Data.StrongTypingException("The value for column \'OL_TOPEXCESSPP\' in table \'ODGEOLAYERS\' is DBNull.", e); + } + } + set { + this[this.tableODGEOLAYERS.OL_TOPEXCESSPPColumn] = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public double OL_BOTEXCESSPP { + get { + try { + return ((double)(this[this.tableODGEOLAYERS.OL_BOTEXCESSPPColumn])); + } + catch (global::System.InvalidCastException e) { + throw new global::System.Data.StrongTypingException("The value for column \'OL_BOTEXCESSPP\' in table \'ODGEOLAYERS\' is DBNull.", e); + } + } + set { + this[this.tableODGEOLAYERS.OL_BOTEXCESSPPColumn] = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public double OL_OCR { + get { + try { + return ((double)(this[this.tableODGEOLAYERS.OL_OCRColumn])); + } + catch (global::System.InvalidCastException e) { + throw new global::System.Data.StrongTypingException("The value for column \'OL_OCR\' in table \'ODGEOLAYERS\' is DBNull.", e); + } + } + set { + this[this.tableODGEOLAYERS.OL_OCRColumn] = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public ODGEOMETRIESRow ODGEOMETRIESRow { + get { + return ((ODGEOMETRIESRow)(this.GetParentRow(this.Table.ParentRelations["ODGEOMETRIES_ODGEOLAYERS"]))); + } + set { + this.SetParentRow(value, this.Table.ParentRelations["ODGEOMETRIES_ODGEOLAYERS"]); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public MATERIALSRow MATERIALSRow { + get { + return ((MATERIALSRow)(this.GetParentRow(this.Table.ParentRelations["ODGEOLAYERS_MATERIALS"]))); + } + set { + this.SetParentRow(value, this.Table.ParentRelations["ODGEOLAYERS_MATERIALS"]); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public bool IsOD_NRNull() { + return this.IsNull(this.tableODGEOLAYERS.OD_NRColumn); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public void SetOD_NRNull() { + this[this.tableODGEOLAYERS.OD_NRColumn] = global::System.Convert.DBNull; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public bool IsMA_NRNull() { + return this.IsNull(this.tableODGEOLAYERS.MA_NRColumn); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public void SetMA_NRNull() { + this[this.tableODGEOLAYERS.MA_NRColumn] = global::System.Convert.DBNull; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public bool IsOL_LAYERNRNull() { + return this.IsNull(this.tableODGEOLAYERS.OL_LAYERNRColumn); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public void SetOL_LAYERNRNull() { + this[this.tableODGEOLAYERS.OL_LAYERNRColumn] = global::System.Convert.DBNull; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public bool IsOL_LEVELNull() { + return this.IsNull(this.tableODGEOLAYERS.OL_LEVELColumn); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public void SetOL_LEVELNull() { + this[this.tableODGEOLAYERS.OL_LEVELColumn] = global::System.Convert.DBNull; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public bool IsOL_PLATTOPNull() { + return this.IsNull(this.tableODGEOLAYERS.OL_PLATTOPColumn); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public void SetOL_PLATTOPNull() { + this[this.tableODGEOLAYERS.OL_PLATTOPColumn] = global::System.Convert.DBNull; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public bool IsOL_PLATBOTTOMNull() { + return this.IsNull(this.tableODGEOLAYERS.OL_PLATBOTTOMColumn); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public void SetOL_PLATBOTTOMNull() { + this[this.tableODGEOLAYERS.OL_PLATBOTTOMColumn] = global::System.Convert.DBNull; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public bool IsOL_TOPEXCESSPPNull() { + return this.IsNull(this.tableODGEOLAYERS.OL_TOPEXCESSPPColumn); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public void SetOL_TOPEXCESSPPNull() { + this[this.tableODGEOLAYERS.OL_TOPEXCESSPPColumn] = global::System.Convert.DBNull; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public bool IsOL_BOTEXCESSPPNull() { + return this.IsNull(this.tableODGEOLAYERS.OL_BOTEXCESSPPColumn); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public void SetOL_BOTEXCESSPPNull() { + this[this.tableODGEOLAYERS.OL_BOTEXCESSPPColumn] = global::System.Convert.DBNull; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public bool IsOL_OCRNull() { + return this.IsNull(this.tableODGEOLAYERS.OL_OCRColumn); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public void SetOL_OCRNull() { + this[this.tableODGEOLAYERS.OL_OCRColumn] = global::System.Convert.DBNull; + } + } + + /// + ///Represents strongly named DataRow class. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "2.0.0.0")] + public partial class MATERIALSRow : global::System.Data.DataRow { + + private MATERIALSDataTable tableMATERIALS; + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + internal MATERIALSRow(global::System.Data.DataRowBuilder rb) : + base(rb) { + this.tableMATERIALS = ((MATERIALSDataTable)(this.Table)); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public int MA_NR { + get { + return ((int)(this[this.tableMATERIALS.MA_NRColumn])); + } + set { + this[this.tableMATERIALS.MA_NRColumn] = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public string MA_NAME { + get { + try { + return ((string)(this[this.tableMATERIALS.MA_NAMEColumn])); + } + catch (global::System.InvalidCastException e) { + throw new global::System.Data.StrongTypingException("The value for column \'MA_NAME\' in table \'MATERIALS\' is DBNull.", e); + } + } + set { + this[this.tableMATERIALS.MA_NAMEColumn] = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public string MA_DESCR { + get { + try { + return ((string)(this[this.tableMATERIALS.MA_DESCRColumn])); + } + catch (global::System.InvalidCastException e) { + throw new global::System.Data.StrongTypingException("The value for column \'MA_DESCR\' in table \'MATERIALS\' is DBNull.", e); + } + } + set { + this[this.tableMATERIALS.MA_DESCRColumn] = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public int MA_INDEX { + get { + try { + return ((int)(this[this.tableMATERIALS.MA_INDEXColumn])); + } + catch (global::System.InvalidCastException e) { + throw new global::System.Data.StrongTypingException("The value for column \'MA_INDEX\' in table \'MATERIALS\' is DBNull.", e); + } + } + set { + this[this.tableMATERIALS.MA_INDEXColumn] = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public bool IsMA_NAMENull() { + return this.IsNull(this.tableMATERIALS.MA_NAMEColumn); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public void SetMA_NAMENull() { + this[this.tableMATERIALS.MA_NAMEColumn] = global::System.Convert.DBNull; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public bool IsMA_DESCRNull() { + return this.IsNull(this.tableMATERIALS.MA_DESCRColumn); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public void SetMA_DESCRNull() { + this[this.tableMATERIALS.MA_DESCRColumn] = global::System.Convert.DBNull; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public bool IsMA_INDEXNull() { + return this.IsNull(this.tableMATERIALS.MA_INDEXColumn); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public void SetMA_INDEXNull() { + this[this.tableMATERIALS.MA_INDEXColumn] = global::System.Convert.DBNull; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public ODGEOLAYERSRow[] GetODGEOLAYERSRows() { + if ((this.Table.ChildRelations["ODGEOLAYERS_MATERIALS"] == null)) { + return new ODGEOLAYERSRow[0]; + } + else { + return ((ODGEOLAYERSRow[])(base.GetChildRows(this.Table.ChildRelations["ODGEOLAYERS_MATERIALS"]))); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public PARAMETERVALUESRow[] GetPARAMETERVALUESRows() { + if ((this.Table.ChildRelations["PARAMETERVALUES_MATERIALS"] == null)) { + return new PARAMETERVALUESRow[0]; + } + else { + return ((PARAMETERVALUESRow[])(base.GetChildRows(this.Table.ChildRelations["PARAMETERVALUES_MATERIALS"]))); + } + } + } + + /// + ///Represents strongly named DataRow class. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "2.0.0.0")] + public partial class PARAMETERNAMESRow : global::System.Data.DataRow { + + private PARAMETERNAMESDataTable tablePARAMETERNAMES; + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + internal PARAMETERNAMESRow(global::System.Data.DataRowBuilder rb) : + base(rb) { + this.tablePARAMETERNAMES = ((PARAMETERNAMESDataTable)(this.Table)); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public int PN_NR { + get { + return ((int)(this[this.tablePARAMETERNAMES.PN_NRColumn])); + } + set { + this[this.tablePARAMETERNAMES.PN_NRColumn] = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public string PN_NAME { + get { + try { + return ((string)(this[this.tablePARAMETERNAMES.PN_NAMEColumn])); + } + catch (global::System.InvalidCastException e) { + throw new global::System.Data.StrongTypingException("The value for column \'PN_NAME\' in table \'PARAMETERNAMES\' is DBNull.", e); + } + } + set { + this[this.tablePARAMETERNAMES.PN_NAMEColumn] = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public bool IsPN_NAMENull() { + return this.IsNull(this.tablePARAMETERNAMES.PN_NAMEColumn); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public void SetPN_NAMENull() { + this[this.tablePARAMETERNAMES.PN_NAMEColumn] = global::System.Convert.DBNull; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public PARAMETERVALUESRow[] GetPARAMETERVALUESRows() { + if ((this.Table.ChildRelations["PARAMETERNAMES_PARAMETERVALUES"] == null)) { + return new PARAMETERVALUESRow[0]; + } + else { + return ((PARAMETERVALUESRow[])(base.GetChildRows(this.Table.ChildRelations["PARAMETERNAMES_PARAMETERVALUES"]))); + } + } + } + + /// + ///Represents strongly named DataRow class. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "2.0.0.0")] + public partial class PARAMETERVALUESRow : global::System.Data.DataRow { + + private PARAMETERVALUESDataTable tablePARAMETERVALUES; + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + internal PARAMETERVALUESRow(global::System.Data.DataRowBuilder rb) : + base(rb) { + this.tablePARAMETERVALUES = ((PARAMETERVALUESDataTable)(this.Table)); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public int PV_NR { + get { + return ((int)(this[this.tablePARAMETERVALUES.PV_NRColumn])); + } + set { + this[this.tablePARAMETERVALUES.PV_NRColumn] = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public int MA_NR { + get { + try { + return ((int)(this[this.tablePARAMETERVALUES.MA_NRColumn])); + } + catch (global::System.InvalidCastException e) { + throw new global::System.Data.StrongTypingException("The value for column \'MA_NR\' in table \'PARAMETERVALUES\' is DBNull.", e); + } + } + set { + this[this.tablePARAMETERVALUES.MA_NRColumn] = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public int PN_NR { + get { + try { + return ((int)(this[this.tablePARAMETERVALUES.PN_NRColumn])); + } + catch (global::System.InvalidCastException e) { + throw new global::System.Data.StrongTypingException("The value for column \'PN_NR\' in table \'PARAMETERVALUES\' is DBNull.", e); + } + } + set { + this[this.tablePARAMETERVALUES.PN_NRColumn] = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public double PV_VALUE { + get { + try { + return ((double)(this[this.tablePARAMETERVALUES.PV_VALUEColumn])); + } + catch (global::System.InvalidCastException e) { + throw new global::System.Data.StrongTypingException("The value for column \'PV_VALUE\' in table \'PARAMETERVALUES\' is DBNull.", e); + } + } + set { + this[this.tablePARAMETERVALUES.PV_VALUEColumn] = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public MATERIALSRow MATERIALSRow { + get { + return ((MATERIALSRow)(this.GetParentRow(this.Table.ParentRelations["PARAMETERVALUES_MATERIALS"]))); + } + set { + this.SetParentRow(value, this.Table.ParentRelations["PARAMETERVALUES_MATERIALS"]); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public PARAMETERNAMESRow PARAMETERNAMESRow { + get { + return ((PARAMETERNAMESRow)(this.GetParentRow(this.Table.ParentRelations["PARAMETERNAMES_PARAMETERVALUES"]))); + } + set { + this.SetParentRow(value, this.Table.ParentRelations["PARAMETERNAMES_PARAMETERVALUES"]); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public bool IsMA_NRNull() { + return this.IsNull(this.tablePARAMETERVALUES.MA_NRColumn); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public void SetMA_NRNull() { + this[this.tablePARAMETERVALUES.MA_NRColumn] = global::System.Convert.DBNull; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public bool IsPN_NRNull() { + return this.IsNull(this.tablePARAMETERVALUES.PN_NRColumn); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public void SetPN_NRNull() { + this[this.tablePARAMETERVALUES.PN_NRColumn] = global::System.Convert.DBNull; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public bool IsPV_VALUENull() { + return this.IsNull(this.tablePARAMETERVALUES.PV_VALUEColumn); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public void SetPV_VALUENull() { + this[this.tablePARAMETERVALUES.PV_VALUEColumn] = global::System.Convert.DBNull; + } + } + + /// + ///Row event argument class + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "2.0.0.0")] + public class ODGEOMETRIESRowChangeEvent : global::System.EventArgs { + + private ODGEOMETRIESRow eventRow; + + private global::System.Data.DataRowAction eventAction; + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public ODGEOMETRIESRowChangeEvent(ODGEOMETRIESRow row, global::System.Data.DataRowAction action) { + this.eventRow = row; + this.eventAction = action; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public ODGEOMETRIESRow Row { + get { + return this.eventRow; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public global::System.Data.DataRowAction Action { + get { + return this.eventAction; + } + } + } + + /// + ///Row event argument class + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "2.0.0.0")] + public class ODGEOLAYERSRowChangeEvent : global::System.EventArgs { + + private ODGEOLAYERSRow eventRow; + + private global::System.Data.DataRowAction eventAction; + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public ODGEOLAYERSRowChangeEvent(ODGEOLAYERSRow row, global::System.Data.DataRowAction action) { + this.eventRow = row; + this.eventAction = action; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public ODGEOLAYERSRow Row { + get { + return this.eventRow; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public global::System.Data.DataRowAction Action { + get { + return this.eventAction; + } + } + } + + /// + ///Row event argument class + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "2.0.0.0")] + public class MATERIALSRowChangeEvent : global::System.EventArgs { + + private MATERIALSRow eventRow; + + private global::System.Data.DataRowAction eventAction; + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public MATERIALSRowChangeEvent(MATERIALSRow row, global::System.Data.DataRowAction action) { + this.eventRow = row; + this.eventAction = action; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public MATERIALSRow Row { + get { + return this.eventRow; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public global::System.Data.DataRowAction Action { + get { + return this.eventAction; + } + } + } + + /// + ///Row event argument class + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "2.0.0.0")] + public class PARAMETERNAMESRowChangeEvent : global::System.EventArgs { + + private PARAMETERNAMESRow eventRow; + + private global::System.Data.DataRowAction eventAction; + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public PARAMETERNAMESRowChangeEvent(PARAMETERNAMESRow row, global::System.Data.DataRowAction action) { + this.eventRow = row; + this.eventAction = action; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public PARAMETERNAMESRow Row { + get { + return this.eventRow; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public global::System.Data.DataRowAction Action { + get { + return this.eventAction; + } + } + } + + /// + ///Row event argument class + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "2.0.0.0")] + public class PARAMETERVALUESRowChangeEvent : global::System.EventArgs { + + private PARAMETERVALUESRow eventRow; + + private global::System.Data.DataRowAction eventAction; + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public PARAMETERVALUESRowChangeEvent(PARAMETERVALUESRow row, global::System.Data.DataRowAction action) { + this.eventRow = row; + this.eventAction = action; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public PARAMETERVALUESRow Row { + get { + return this.eventRow; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public global::System.Data.DataRowAction Action { + get { + return this.eventAction; + } + } + } + } +} +namespace WebApplication1.SoilProfileDataSetTableAdapters { + + + /// + ///Represents the connection and commands used to retrieve and save data. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "2.0.0.0")] + [global::System.ComponentModel.DesignerCategoryAttribute("code")] + [global::System.ComponentModel.ToolboxItem(true)] + [global::System.ComponentModel.DataObjectAttribute(true)] + [global::System.ComponentModel.DesignerAttribute("Microsoft.VSDesigner.DataSource.Design.TableAdapterDesigner, Microsoft.VSDesigner" + + ", Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] + [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] + public partial class ODGEOMETRIESTableAdapter : global::System.ComponentModel.Component { + + private global::System.Data.Odbc.OdbcDataAdapter _adapter; + + private global::System.Data.Odbc.OdbcConnection _connection; + + private global::System.Data.Odbc.OdbcTransaction _transaction; + + private global::System.Data.Odbc.OdbcCommand[] _commandCollection; + + private bool _clearBeforeFill; + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public ODGEOMETRIESTableAdapter() { + this.ClearBeforeFill = true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + protected internal global::System.Data.Odbc.OdbcDataAdapter Adapter { + get { + if ((this._adapter == null)) { + this.InitAdapter(); + } + return this._adapter; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + internal global::System.Data.Odbc.OdbcConnection Connection { + get { + if ((this._connection == null)) { + this.InitConnection(); + } + return this._connection; + } + set { + this._connection = value; + if ((this.Adapter.InsertCommand != null)) { + this.Adapter.InsertCommand.Connection = value; + } + if ((this.Adapter.DeleteCommand != null)) { + this.Adapter.DeleteCommand.Connection = value; + } + if ((this.Adapter.UpdateCommand != null)) { + this.Adapter.UpdateCommand.Connection = value; + } + for (int i = 0; (i < this.CommandCollection.Length); i = (i + 1)) { + if ((this.CommandCollection[i] != null)) { + ((global::System.Data.Odbc.OdbcCommand)(this.CommandCollection[i])).Connection = value; + } + } + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + internal global::System.Data.Odbc.OdbcTransaction Transaction { + get { + return this._transaction; + } + set { + this._transaction = value; + for (int i = 0; (i < this.CommandCollection.Length); i = (i + 1)) { + this.CommandCollection[i].Transaction = this._transaction; + } + if (((this.Adapter != null) + && (this.Adapter.DeleteCommand != null))) { + this.Adapter.DeleteCommand.Transaction = this._transaction; + } + if (((this.Adapter != null) + && (this.Adapter.InsertCommand != null))) { + this.Adapter.InsertCommand.Transaction = this._transaction; + } + if (((this.Adapter != null) + && (this.Adapter.UpdateCommand != null))) { + this.Adapter.UpdateCommand.Transaction = this._transaction; + } + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + protected global::System.Data.Odbc.OdbcCommand[] CommandCollection { + get { + if ((this._commandCollection == null)) { + this.InitCommandCollection(); + } + return this._commandCollection; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public bool ClearBeforeFill { + get { + return this._clearBeforeFill; + } + set { + this._clearBeforeFill = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + private void InitAdapter() { + this._adapter = new global::System.Data.Odbc.OdbcDataAdapter(); + global::System.Data.Common.DataTableMapping tableMapping = new global::System.Data.Common.DataTableMapping(); + tableMapping.SourceTable = "Table"; + tableMapping.DataSetTable = "ODGEOMETRIES"; + tableMapping.ColumnMappings.Add("OD_NR", "OD_NR"); + tableMapping.ColumnMappings.Add("OD_NAME", "OD_NAME"); + tableMapping.ColumnMappings.Add("OD_DESCR", "OD_DESCR"); + tableMapping.ColumnMappings.Add("OD_RDX", "OD_RDX"); + tableMapping.ColumnMappings.Add("OD_RDY", "OD_RDY"); + tableMapping.ColumnMappings.Add("OD_CPTNR", "OD_CPTNR"); + tableMapping.ColumnMappings.Add("OD_BORINGNR", "OD_BORINGNR"); + tableMapping.ColumnMappings.Add("OD_GEOL_ZONE", "OD_GEOL_ZONE"); + tableMapping.ColumnMappings.Add("OD_CHANCE_OCCUR", "OD_CHANCE_OCCUR"); + this._adapter.TableMappings.Add(tableMapping); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + private void InitConnection() { + this._connection = new global::System.Data.Odbc.OdbcConnection(); + this._connection.ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + private void InitCommandCollection() { + this._commandCollection = new global::System.Data.Odbc.OdbcCommand[1]; + this._commandCollection[0] = new global::System.Data.Odbc.OdbcCommand(); + this._commandCollection[0].Connection = this.Connection; + this._commandCollection[0].CommandText = "SELECT OD_NR, OD_NAME, OD_DESCR, OD_RDX, OD_RDY, OD_CPTNR, OD_BORINGNR, OD_GEOL_Z" + + "ONE, OD_CHANCE_OCCUR FROM ODGEOMETRIES"; + this._commandCollection[0].CommandType = global::System.Data.CommandType.Text; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] + [global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Select, true)] + public virtual SoilProfileDataSet.ODGEOMETRIESDataTable GetData() { + this.Adapter.SelectCommand = this.CommandCollection[0]; + SoilProfileDataSet.ODGEOMETRIESDataTable dataTable = new SoilProfileDataSet.ODGEOMETRIESDataTable(); + this.Adapter.Fill(dataTable); + return dataTable; + } + } + + /// + ///Represents the connection and commands used to retrieve and save data. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "2.0.0.0")] + [global::System.ComponentModel.DesignerCategoryAttribute("code")] + [global::System.ComponentModel.ToolboxItem(true)] + [global::System.ComponentModel.DataObjectAttribute(true)] + [global::System.ComponentModel.DesignerAttribute("Microsoft.VSDesigner.DataSource.Design.TableAdapterDesigner, Microsoft.VSDesigner" + + ", Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] + [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] + public partial class ODGEOLAYERSTableAdapter : global::System.ComponentModel.Component { + + private global::System.Data.Odbc.OdbcDataAdapter _adapter; + + private global::System.Data.Odbc.OdbcConnection _connection; + + private global::System.Data.Odbc.OdbcTransaction _transaction; + + private global::System.Data.Odbc.OdbcCommand[] _commandCollection; + + private bool _clearBeforeFill; + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public ODGEOLAYERSTableAdapter() { + this.ClearBeforeFill = true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + protected internal global::System.Data.Odbc.OdbcDataAdapter Adapter { + get { + if ((this._adapter == null)) { + this.InitAdapter(); + } + return this._adapter; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + internal global::System.Data.Odbc.OdbcConnection Connection { + get { + if ((this._connection == null)) { + this.InitConnection(); + } + return this._connection; + } + set { + this._connection = value; + if ((this.Adapter.InsertCommand != null)) { + this.Adapter.InsertCommand.Connection = value; + } + if ((this.Adapter.DeleteCommand != null)) { + this.Adapter.DeleteCommand.Connection = value; + } + if ((this.Adapter.UpdateCommand != null)) { + this.Adapter.UpdateCommand.Connection = value; + } + for (int i = 0; (i < this.CommandCollection.Length); i = (i + 1)) { + if ((this.CommandCollection[i] != null)) { + ((global::System.Data.Odbc.OdbcCommand)(this.CommandCollection[i])).Connection = value; + } + } + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + internal global::System.Data.Odbc.OdbcTransaction Transaction { + get { + return this._transaction; + } + set { + this._transaction = value; + for (int i = 0; (i < this.CommandCollection.Length); i = (i + 1)) { + this.CommandCollection[i].Transaction = this._transaction; + } + if (((this.Adapter != null) + && (this.Adapter.DeleteCommand != null))) { + this.Adapter.DeleteCommand.Transaction = this._transaction; + } + if (((this.Adapter != null) + && (this.Adapter.InsertCommand != null))) { + this.Adapter.InsertCommand.Transaction = this._transaction; + } + if (((this.Adapter != null) + && (this.Adapter.UpdateCommand != null))) { + this.Adapter.UpdateCommand.Transaction = this._transaction; + } + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + protected global::System.Data.Odbc.OdbcCommand[] CommandCollection { + get { + if ((this._commandCollection == null)) { + this.InitCommandCollection(); + } + return this._commandCollection; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public bool ClearBeforeFill { + get { + return this._clearBeforeFill; + } + set { + this._clearBeforeFill = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + private void InitAdapter() { + this._adapter = new global::System.Data.Odbc.OdbcDataAdapter(); + global::System.Data.Common.DataTableMapping tableMapping = new global::System.Data.Common.DataTableMapping(); + tableMapping.SourceTable = "Table"; + tableMapping.DataSetTable = "ODGEOLAYERS"; + tableMapping.ColumnMappings.Add("OL_NR", "OL_NR"); + tableMapping.ColumnMappings.Add("OD_NR", "OD_NR"); + tableMapping.ColumnMappings.Add("MA_NR", "MA_NR"); + tableMapping.ColumnMappings.Add("OL_LAYERNR", "OL_LAYERNR"); + tableMapping.ColumnMappings.Add("OL_LEVEL", "OL_LEVEL"); + tableMapping.ColumnMappings.Add("OL_PLATTOP", "OL_PLATTOP"); + tableMapping.ColumnMappings.Add("OL_PLATBOTTOM", "OL_PLATBOTTOM"); + tableMapping.ColumnMappings.Add("OL_TOPEXCESSPP", "OL_TOPEXCESSPP"); + tableMapping.ColumnMappings.Add("OL_BOTEXCESSPP", "OL_BOTEXCESSPP"); + tableMapping.ColumnMappings.Add("OL_OCR", "OL_OCR"); + this._adapter.TableMappings.Add(tableMapping); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + private void InitConnection() { + this._connection = new global::System.Data.Odbc.OdbcConnection(); + this._connection.ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + private void InitCommandCollection() { + this._commandCollection = new global::System.Data.Odbc.OdbcCommand[1]; + this._commandCollection[0] = new global::System.Data.Odbc.OdbcCommand(); + this._commandCollection[0].Connection = this.Connection; + this._commandCollection[0].CommandText = "SELECT OL_NR, OD_NR, MA_NR, OL_LAYERNR, OL_LEVEL, OL_PLATTOP, OL_PLATBOTTOM, OL_T" + + "OPEXCESSPP, OL_BOTEXCESSPP, OL_OCR FROM ODGEOLAYERS"; + this._commandCollection[0].CommandType = global::System.Data.CommandType.Text; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] + [global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Select, true)] + public virtual SoilProfileDataSet.ODGEOLAYERSDataTable GetData() { + this.Adapter.SelectCommand = this.CommandCollection[0]; + SoilProfileDataSet.ODGEOLAYERSDataTable dataTable = new SoilProfileDataSet.ODGEOLAYERSDataTable(); + this.Adapter.Fill(dataTable); + return dataTable; + } + } + + /// + ///Represents the connection and commands used to retrieve and save data. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "2.0.0.0")] + [global::System.ComponentModel.DesignerCategoryAttribute("code")] + [global::System.ComponentModel.ToolboxItem(true)] + [global::System.ComponentModel.DataObjectAttribute(true)] + [global::System.ComponentModel.DesignerAttribute("Microsoft.VSDesigner.DataSource.Design.TableAdapterDesigner, Microsoft.VSDesigner" + + ", Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] + [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] + public partial class MATERIALSTableAdapter : global::System.ComponentModel.Component { + + private global::System.Data.Odbc.OdbcDataAdapter _adapter; + + private global::System.Data.Odbc.OdbcConnection _connection; + + private global::System.Data.Odbc.OdbcTransaction _transaction; + + private global::System.Data.Odbc.OdbcCommand[] _commandCollection; + + private bool _clearBeforeFill; + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public MATERIALSTableAdapter() { + this.ClearBeforeFill = true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + protected internal global::System.Data.Odbc.OdbcDataAdapter Adapter { + get { + if ((this._adapter == null)) { + this.InitAdapter(); + } + return this._adapter; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + internal global::System.Data.Odbc.OdbcConnection Connection { + get { + if ((this._connection == null)) { + this.InitConnection(); + } + return this._connection; + } + set { + this._connection = value; + if ((this.Adapter.InsertCommand != null)) { + this.Adapter.InsertCommand.Connection = value; + } + if ((this.Adapter.DeleteCommand != null)) { + this.Adapter.DeleteCommand.Connection = value; + } + if ((this.Adapter.UpdateCommand != null)) { + this.Adapter.UpdateCommand.Connection = value; + } + for (int i = 0; (i < this.CommandCollection.Length); i = (i + 1)) { + if ((this.CommandCollection[i] != null)) { + ((global::System.Data.Odbc.OdbcCommand)(this.CommandCollection[i])).Connection = value; + } + } + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + internal global::System.Data.Odbc.OdbcTransaction Transaction { + get { + return this._transaction; + } + set { + this._transaction = value; + for (int i = 0; (i < this.CommandCollection.Length); i = (i + 1)) { + this.CommandCollection[i].Transaction = this._transaction; + } + if (((this.Adapter != null) + && (this.Adapter.DeleteCommand != null))) { + this.Adapter.DeleteCommand.Transaction = this._transaction; + } + if (((this.Adapter != null) + && (this.Adapter.InsertCommand != null))) { + this.Adapter.InsertCommand.Transaction = this._transaction; + } + if (((this.Adapter != null) + && (this.Adapter.UpdateCommand != null))) { + this.Adapter.UpdateCommand.Transaction = this._transaction; + } + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + protected global::System.Data.Odbc.OdbcCommand[] CommandCollection { + get { + if ((this._commandCollection == null)) { + this.InitCommandCollection(); + } + return this._commandCollection; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public bool ClearBeforeFill { + get { + return this._clearBeforeFill; + } + set { + this._clearBeforeFill = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + private void InitAdapter() { + this._adapter = new global::System.Data.Odbc.OdbcDataAdapter(); + global::System.Data.Common.DataTableMapping tableMapping = new global::System.Data.Common.DataTableMapping(); + tableMapping.SourceTable = "Table"; + tableMapping.DataSetTable = "MATERIALS"; + tableMapping.ColumnMappings.Add("MA_NR", "MA_NR"); + tableMapping.ColumnMappings.Add("MA_NAME", "MA_NAME"); + tableMapping.ColumnMappings.Add("MA_DESCR", "MA_DESCR"); + tableMapping.ColumnMappings.Add("MA_INDEX", "MA_INDEX"); + this._adapter.TableMappings.Add(tableMapping); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + private void InitConnection() { + this._connection = new global::System.Data.Odbc.OdbcConnection(); + this._connection.ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + private void InitCommandCollection() { + this._commandCollection = new global::System.Data.Odbc.OdbcCommand[1]; + this._commandCollection[0] = new global::System.Data.Odbc.OdbcCommand(); + this._commandCollection[0].Connection = this.Connection; + this._commandCollection[0].CommandText = "SELECT MA_NR, MA_NAME, MA_DESCR, MA_INDEX FROM MATERIALS"; + this._commandCollection[0].CommandType = global::System.Data.CommandType.Text; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] + [global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Select, true)] + public virtual SoilProfileDataSet.MATERIALSDataTable GetData() { + this.Adapter.SelectCommand = this.CommandCollection[0]; + SoilProfileDataSet.MATERIALSDataTable dataTable = new SoilProfileDataSet.MATERIALSDataTable(); + this.Adapter.Fill(dataTable); + return dataTable; + } + } + + /// + ///Represents the connection and commands used to retrieve and save data. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "2.0.0.0")] + [global::System.ComponentModel.DesignerCategoryAttribute("code")] + [global::System.ComponentModel.ToolboxItem(true)] + [global::System.ComponentModel.DataObjectAttribute(true)] + [global::System.ComponentModel.DesignerAttribute("Microsoft.VSDesigner.DataSource.Design.TableAdapterDesigner, Microsoft.VSDesigner" + + ", Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] + [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] + public partial class PARAMETERNAMESTableAdapter : global::System.ComponentModel.Component { + + private global::System.Data.Odbc.OdbcDataAdapter _adapter; + + private global::System.Data.Odbc.OdbcConnection _connection; + + private global::System.Data.Odbc.OdbcTransaction _transaction; + + private global::System.Data.Odbc.OdbcCommand[] _commandCollection; + + private bool _clearBeforeFill; + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public PARAMETERNAMESTableAdapter() { + this.ClearBeforeFill = true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + protected internal global::System.Data.Odbc.OdbcDataAdapter Adapter { + get { + if ((this._adapter == null)) { + this.InitAdapter(); + } + return this._adapter; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + internal global::System.Data.Odbc.OdbcConnection Connection { + get { + if ((this._connection == null)) { + this.InitConnection(); + } + return this._connection; + } + set { + this._connection = value; + if ((this.Adapter.InsertCommand != null)) { + this.Adapter.InsertCommand.Connection = value; + } + if ((this.Adapter.DeleteCommand != null)) { + this.Adapter.DeleteCommand.Connection = value; + } + if ((this.Adapter.UpdateCommand != null)) { + this.Adapter.UpdateCommand.Connection = value; + } + for (int i = 0; (i < this.CommandCollection.Length); i = (i + 1)) { + if ((this.CommandCollection[i] != null)) { + ((global::System.Data.Odbc.OdbcCommand)(this.CommandCollection[i])).Connection = value; + } + } + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + internal global::System.Data.Odbc.OdbcTransaction Transaction { + get { + return this._transaction; + } + set { + this._transaction = value; + for (int i = 0; (i < this.CommandCollection.Length); i = (i + 1)) { + this.CommandCollection[i].Transaction = this._transaction; + } + if (((this.Adapter != null) + && (this.Adapter.DeleteCommand != null))) { + this.Adapter.DeleteCommand.Transaction = this._transaction; + } + if (((this.Adapter != null) + && (this.Adapter.InsertCommand != null))) { + this.Adapter.InsertCommand.Transaction = this._transaction; + } + if (((this.Adapter != null) + && (this.Adapter.UpdateCommand != null))) { + this.Adapter.UpdateCommand.Transaction = this._transaction; + } + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + protected global::System.Data.Odbc.OdbcCommand[] CommandCollection { + get { + if ((this._commandCollection == null)) { + this.InitCommandCollection(); + } + return this._commandCollection; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public bool ClearBeforeFill { + get { + return this._clearBeforeFill; + } + set { + this._clearBeforeFill = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + private void InitAdapter() { + this._adapter = new global::System.Data.Odbc.OdbcDataAdapter(); + global::System.Data.Common.DataTableMapping tableMapping = new global::System.Data.Common.DataTableMapping(); + tableMapping.SourceTable = "Table"; + tableMapping.DataSetTable = "PARAMETERNAMES"; + tableMapping.ColumnMappings.Add("PN_NR", "PN_NR"); + tableMapping.ColumnMappings.Add("PN_NAME", "PN_NAME"); + this._adapter.TableMappings.Add(tableMapping); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + private void InitConnection() { + this._connection = new global::System.Data.Odbc.OdbcConnection(); + this._connection.ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + private void InitCommandCollection() { + this._commandCollection = new global::System.Data.Odbc.OdbcCommand[1]; + this._commandCollection[0] = new global::System.Data.Odbc.OdbcCommand(); + this._commandCollection[0].Connection = this.Connection; + this._commandCollection[0].CommandText = "SELECT PN_NR, PN_NAME FROM PARAMETERNAMES"; + this._commandCollection[0].CommandType = global::System.Data.CommandType.Text; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] + [global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Select, true)] + public virtual SoilProfileDataSet.PARAMETERNAMESDataTable GetData() { + this.Adapter.SelectCommand = this.CommandCollection[0]; + SoilProfileDataSet.PARAMETERNAMESDataTable dataTable = new SoilProfileDataSet.PARAMETERNAMESDataTable(); + this.Adapter.Fill(dataTable); + return dataTable; + } + } + + /// + ///Represents the connection and commands used to retrieve and save data. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "2.0.0.0")] + [global::System.ComponentModel.DesignerCategoryAttribute("code")] + [global::System.ComponentModel.ToolboxItem(true)] + [global::System.ComponentModel.DataObjectAttribute(true)] + [global::System.ComponentModel.DesignerAttribute("Microsoft.VSDesigner.DataSource.Design.TableAdapterDesigner, Microsoft.VSDesigner" + + ", Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] + [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] + public partial class PARAMETERVALUESTableAdapter : global::System.ComponentModel.Component { + + private global::System.Data.Odbc.OdbcDataAdapter _adapter; + + private global::System.Data.Odbc.OdbcConnection _connection; + + private global::System.Data.Odbc.OdbcTransaction _transaction; + + private global::System.Data.Odbc.OdbcCommand[] _commandCollection; + + private bool _clearBeforeFill; + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public PARAMETERVALUESTableAdapter() { + this.ClearBeforeFill = true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + protected internal global::System.Data.Odbc.OdbcDataAdapter Adapter { + get { + if ((this._adapter == null)) { + this.InitAdapter(); + } + return this._adapter; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + internal global::System.Data.Odbc.OdbcConnection Connection { + get { + if ((this._connection == null)) { + this.InitConnection(); + } + return this._connection; + } + set { + this._connection = value; + if ((this.Adapter.InsertCommand != null)) { + this.Adapter.InsertCommand.Connection = value; + } + if ((this.Adapter.DeleteCommand != null)) { + this.Adapter.DeleteCommand.Connection = value; + } + if ((this.Adapter.UpdateCommand != null)) { + this.Adapter.UpdateCommand.Connection = value; + } + for (int i = 0; (i < this.CommandCollection.Length); i = (i + 1)) { + if ((this.CommandCollection[i] != null)) { + ((global::System.Data.Odbc.OdbcCommand)(this.CommandCollection[i])).Connection = value; + } + } + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + internal global::System.Data.Odbc.OdbcTransaction Transaction { + get { + return this._transaction; + } + set { + this._transaction = value; + for (int i = 0; (i < this.CommandCollection.Length); i = (i + 1)) { + this.CommandCollection[i].Transaction = this._transaction; + } + if (((this.Adapter != null) + && (this.Adapter.DeleteCommand != null))) { + this.Adapter.DeleteCommand.Transaction = this._transaction; + } + if (((this.Adapter != null) + && (this.Adapter.InsertCommand != null))) { + this.Adapter.InsertCommand.Transaction = this._transaction; + } + if (((this.Adapter != null) + && (this.Adapter.UpdateCommand != null))) { + this.Adapter.UpdateCommand.Transaction = this._transaction; + } + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + protected global::System.Data.Odbc.OdbcCommand[] CommandCollection { + get { + if ((this._commandCollection == null)) { + this.InitCommandCollection(); + } + return this._commandCollection; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public bool ClearBeforeFill { + get { + return this._clearBeforeFill; + } + set { + this._clearBeforeFill = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + private void InitAdapter() { + this._adapter = new global::System.Data.Odbc.OdbcDataAdapter(); + global::System.Data.Common.DataTableMapping tableMapping = new global::System.Data.Common.DataTableMapping(); + tableMapping.SourceTable = "Table"; + tableMapping.DataSetTable = "PARAMETERVALUES"; + tableMapping.ColumnMappings.Add("PV_NR", "PV_NR"); + tableMapping.ColumnMappings.Add("MA_NR", "MA_NR"); + tableMapping.ColumnMappings.Add("PN_NR", "PN_NR"); + tableMapping.ColumnMappings.Add("PV_VALUE", "PV_VALUE"); + this._adapter.TableMappings.Add(tableMapping); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + private void InitConnection() { + this._connection = new global::System.Data.Odbc.OdbcConnection(); + this._connection.ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + private void InitCommandCollection() { + this._commandCollection = new global::System.Data.Odbc.OdbcCommand[1]; + this._commandCollection[0] = new global::System.Data.Odbc.OdbcCommand(); + this._commandCollection[0].Connection = this.Connection; + this._commandCollection[0].CommandText = "SELECT PV_NR, MA_NR, PN_NR, PV_VALUE FROM PARAMETERVALUES"; + this._commandCollection[0].CommandType = global::System.Data.CommandType.Text; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] + [global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Select, true)] + public virtual SoilProfileDataSet.PARAMETERVALUESDataTable GetData() { + this.Adapter.SelectCommand = this.CommandCollection[0]; + SoilProfileDataSet.PARAMETERVALUESDataTable dataTable = new SoilProfileDataSet.PARAMETERVALUESDataTable(); + this.Adapter.Fill(dataTable); + return dataTable; + } + } + + /// + ///TableAdapterManager is used to coordinate TableAdapters in the dataset to enable Hierarchical Update scenarios + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "2.0.0.0")] + [global::System.ComponentModel.DesignerCategoryAttribute("code")] + [global::System.ComponentModel.ToolboxItem(true)] + [global::System.ComponentModel.DesignerAttribute("Microsoft.VSDesigner.DataSource.Design.TableAdapterManagerDesigner, Microsoft.VSD" + + "esigner, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] + [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapterManager")] + public partial class TableAdapterManager : global::System.ComponentModel.Component { + + private UpdateOrderOption _updateOrder; + + private bool _backupDataSetBeforeUpdate; + + private global::System.Data.IDbConnection _connection; + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public UpdateOrderOption UpdateOrder { + get { + return this._updateOrder; + } + set { + this._updateOrder = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public bool BackupDataSetBeforeUpdate { + get { + return this._backupDataSetBeforeUpdate; + } + set { + this._backupDataSetBeforeUpdate = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.ComponentModel.Browsable(false)] + public global::System.Data.IDbConnection Connection { + get { + if ((this._connection != null)) { + return this._connection; + } + return null; + } + set { + this._connection = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.ComponentModel.Browsable(false)] + public int TableAdapterInstanceCount { + get { + int count = 0; + return count; + } + } + + /// + ///Update rows in top-down order. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + private int UpdateUpdatedRows(SoilProfileDataSet dataSet, global::System.Collections.Generic.List allChangedRows, global::System.Collections.Generic.List allAddedRows) { + int result = 0; + return result; + } + + /// + ///Insert rows in top-down order. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + private int UpdateInsertedRows(SoilProfileDataSet dataSet, global::System.Collections.Generic.List allAddedRows) { + int result = 0; + return result; + } + + /// + ///Delete rows in bottom-up order. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + private int UpdateDeletedRows(SoilProfileDataSet dataSet, global::System.Collections.Generic.List allChangedRows) { + int result = 0; + return result; + } + + /// + ///Remove inserted rows that become updated rows after calling TableAdapter.Update(inserted rows) first + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + private global::System.Data.DataRow[] GetRealUpdatedRows(global::System.Data.DataRow[] updatedRows, global::System.Collections.Generic.List allAddedRows) { + if (((updatedRows == null) + || (updatedRows.Length < 1))) { + return updatedRows; + } + if (((allAddedRows == null) + || (allAddedRows.Count < 1))) { + return updatedRows; + } + global::System.Collections.Generic.List realUpdatedRows = new global::System.Collections.Generic.List(); + for (int i = 0; (i < updatedRows.Length); i = (i + 1)) { + global::System.Data.DataRow row = updatedRows[i]; + if ((allAddedRows.Contains(row) == false)) { + realUpdatedRows.Add(row); + } + } + return realUpdatedRows.ToArray(); + } + + /// + ///Update all changes to the dataset. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public virtual int UpdateAll(SoilProfileDataSet dataSet) { + if ((dataSet == null)) { + throw new global::System.ArgumentNullException("dataSet"); + } + if ((dataSet.HasChanges() == false)) { + return 0; + } + global::System.Data.IDbConnection workConnection = this.Connection; + if ((workConnection == null)) { + throw new global::System.ApplicationException("TableAdapterManager contains no connection information. Set each TableAdapterMana" + + "ger TableAdapter property to a valid TableAdapter instance."); + } + bool workConnOpened = false; + if (((workConnection.State & global::System.Data.ConnectionState.Broken) + == global::System.Data.ConnectionState.Broken)) { + workConnection.Close(); + } + if ((workConnection.State == global::System.Data.ConnectionState.Closed)) { + workConnection.Open(); + workConnOpened = true; + } + global::System.Data.IDbTransaction workTransaction = workConnection.BeginTransaction(); + if ((workTransaction == null)) { + throw new global::System.ApplicationException("The transaction cannot begin. The current data connection does not support transa" + + "ctions or the current state is not allowing the transaction to begin."); + } + global::System.Collections.Generic.List allChangedRows = new global::System.Collections.Generic.List(); + global::System.Collections.Generic.List allAddedRows = new global::System.Collections.Generic.List(); + global::System.Collections.Generic.List adaptersWithAcceptChangesDuringUpdate = new global::System.Collections.Generic.List(); + global::System.Collections.Generic.Dictionary revertConnections = new global::System.Collections.Generic.Dictionary(); + int result = 0; + global::System.Data.DataSet backupDataSet = null; + if (this.BackupDataSetBeforeUpdate) { + backupDataSet = new global::System.Data.DataSet(); + backupDataSet.Merge(dataSet); + } + try { + // ---- Prepare for update ----------- + // + // + //---- Perform updates ----------- + // + if ((this.UpdateOrder == UpdateOrderOption.UpdateInsertDelete)) { + result = (result + this.UpdateUpdatedRows(dataSet, allChangedRows, allAddedRows)); + result = (result + this.UpdateInsertedRows(dataSet, allAddedRows)); + } + else { + result = (result + this.UpdateInsertedRows(dataSet, allAddedRows)); + result = (result + this.UpdateUpdatedRows(dataSet, allChangedRows, allAddedRows)); + } + result = (result + this.UpdateDeletedRows(dataSet, allChangedRows)); + // + //---- Commit updates ----------- + // + workTransaction.Commit(); + if ((0 < allAddedRows.Count)) { + global::System.Data.DataRow[] rows = new System.Data.DataRow[allAddedRows.Count]; + allAddedRows.CopyTo(rows); + for (int i = 0; (i < rows.Length); i = (i + 1)) { + global::System.Data.DataRow row = rows[i]; + row.AcceptChanges(); + } + } + if ((0 < allChangedRows.Count)) { + global::System.Data.DataRow[] rows = new System.Data.DataRow[allChangedRows.Count]; + allChangedRows.CopyTo(rows); + for (int i = 0; (i < rows.Length); i = (i + 1)) { + global::System.Data.DataRow row = rows[i]; + row.AcceptChanges(); + } + } + } + catch (global::System.Exception ex) { + workTransaction.Rollback(); + // ---- Restore the dataset ----------- + if (this.BackupDataSetBeforeUpdate) { + global::System.Diagnostics.Debug.Assert((backupDataSet != null)); + dataSet.Clear(); + dataSet.Merge(backupDataSet); + } + else { + if ((0 < allAddedRows.Count)) { + global::System.Data.DataRow[] rows = new System.Data.DataRow[allAddedRows.Count]; + allAddedRows.CopyTo(rows); + for (int i = 0; (i < rows.Length); i = (i + 1)) { + global::System.Data.DataRow row = rows[i]; + row.AcceptChanges(); + row.SetAdded(); + } + } + } + throw ex; + } + finally { + if (workConnOpened) { + workConnection.Close(); + } + if ((0 < adaptersWithAcceptChangesDuringUpdate.Count)) { + global::System.Data.Common.DataAdapter[] adapters = new System.Data.Common.DataAdapter[adaptersWithAcceptChangesDuringUpdate.Count]; + adaptersWithAcceptChangesDuringUpdate.CopyTo(adapters); + for (int i = 0; (i < adapters.Length); i = (i + 1)) { + global::System.Data.Common.DataAdapter adapter = adapters[i]; + adapter.AcceptChangesDuringUpdate = true; + } + } + } + return result; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + protected virtual void SortSelfReferenceRows(global::System.Data.DataRow[] rows, global::System.Data.DataRelation relation, bool childFirst) { + global::System.Array.Sort(rows, new SelfReferenceComparer(relation, childFirst)); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + protected virtual bool MatchTableAdapterConnection(global::System.Data.IDbConnection inputConnection) { + if ((this._connection != null)) { + return true; + } + if (((this.Connection == null) + || (inputConnection == null))) { + return true; + } + if (string.Equals(this.Connection.ConnectionString, inputConnection.ConnectionString, global::System.StringComparison.Ordinal)) { + return true; + } + return false; + } + + /// + ///Update Order Option + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "2.0.0.0")] + public enum UpdateOrderOption { + + InsertUpdateDelete = 0, + + UpdateInsertDelete = 1, + } + + /// + ///Used to sort self-referenced table's rows + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "2.0.0.0")] + private class SelfReferenceComparer : object, global::System.Collections.Generic.IComparer { + + private global::System.Data.DataRelation _relation; + + private int _childFirst; + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + internal SelfReferenceComparer(global::System.Data.DataRelation relation, bool childFirst) { + this._relation = relation; + if (childFirst) { + this._childFirst = -1; + } + else { + this._childFirst = 1; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + private bool IsChildAndParent(global::System.Data.DataRow child, global::System.Data.DataRow parent) { + global::System.Diagnostics.Debug.Assert((child != null)); + global::System.Diagnostics.Debug.Assert((parent != null)); + global::System.Data.DataRow newParent = child.GetParentRow(this._relation, global::System.Data.DataRowVersion.Default); + for ( + ; ((newParent != null) + && ((object.ReferenceEquals(newParent, child) == false) + && (object.ReferenceEquals(newParent, parent) == false))); + ) { + newParent = newParent.GetParentRow(this._relation, global::System.Data.DataRowVersion.Default); + } + if ((newParent == null)) { + for (newParent = child.GetParentRow(this._relation, global::System.Data.DataRowVersion.Original); ((newParent != null) + && ((object.ReferenceEquals(newParent, child) == false) + && (object.ReferenceEquals(newParent, parent) == false))); + ) { + newParent = newParent.GetParentRow(this._relation, global::System.Data.DataRowVersion.Original); + } + } + if (object.ReferenceEquals(newParent, parent)) { + return true; + } + return false; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public int Compare(global::System.Data.DataRow row1, global::System.Data.DataRow row2) { + if (object.ReferenceEquals(row1, row2)) { + return 0; + } + if ((row1 == null)) { + return -1; + } + if ((row2 == null)) { + return 1; + } + + // Is row1 the child or grandchild of row2 + if (this.IsChildAndParent(row1, row2)) { + return this._childFirst; + } + + // Is row2 the child or grandchild of row1 + if (this.IsChildAndParent(row2, row1)) { + return (-1 * this._childFirst); + } + return 0; + } + } + } +} + +#pragma warning restore 1591 \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DtoAssembler/DtoHelperServices.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DtoAssembler/DtoHelperServices.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DtoAssembler/DtoHelperServices.cs (revision 3305) @@ -0,0 +1,585 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU 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.IO; +using System.Linq; +using System.Reflection; +using System.Xml.Linq; +using Deltares.Standard.Extensions; + +namespace Deltares.Standard.IO.DtoAssembler +{ + /// + /// Extnesion helper methods + /// + public static class DtoHelperServices + { + /// + /// TODO: Solve this hack in a good way!!! + /// + /// + /// + public static string ToUtf8EncodedStringFix(this XDocument doc) + { + string xmlData = doc.ToString(); + + // Hack to + if (!xmlData.Contains("encoding")) + xmlData = "" + Environment.NewLine + xmlData; + + return xmlData; + } + + /// + /// Assembles a XElement from a domain object + /// + /// + /// Only public properties will be used + /// + /// + /// + /// + /// + public static XElement ToXElement(this TDomaiObject domainObject, string elementName) + { + return ToXElement(domainObject, elementName, null); + } + + /// + /// Assembles a XElement from a domain object + /// + /// + /// Only public properties will be used + /// + /// + /// + /// + /// + /// + public static XElement ToXElement(this TDomaiObject domainObject, string elementName, string elementNamespace) + { + if (elementNamespace.HasValidStringValue()) + { + XNamespace ns = elementNamespace; + return ToXElement(domainObject, elementName, ns); + } + + return ToXElement(domainObject, elementName, null); + } + + /// + /// Assembles a XElement from a domain object + /// + /// + /// Only public properties will be used + /// + /// + /// + /// + /// + /// + public static XElement ToXElement(this TDomaiObject domainObject, string elementName, XNamespace elementNamespace) + { + if (domainObject.Equals(default(TDomaiObject))) + return null; + + if (!elementName.HasValidStringValue()) + throw new DtoAssemblerException("There is no element name specified"); + + if (elementNamespace != null) + { + return new XElement(elementNamespace + elementName).Materialize(domainObject); + } + + return new XElement(elementName).Materialize(domainObject); + } + + /// + /// + /// + /// + /// + /// + /// + /// + public static XElement ToDto(this TDomainObject domainObj, IDtoAssembler assembler, XNamespace elementNamespace) + where TDomainObject : new() + { + XElement element = assembler.CreateDataTransferObject(domainObj); + + if (element == null) + return null; + + // replace the element name with the given namespace + var tmp = new XElement(elementNamespace + assembler.ElementName); + element.Name = tmp.Name; + + return element; + } + + /// + /// + /// + /// + /// + /// + /// + public static XElement ToDto(this IEnumerable collection, XName elementName, XName itemElementName) + { + return ToDto(collection, elementName, itemElementName, null); + } + + /// + /// + /// + /// + /// + /// + /// + /// + /// + public static XElement ToDto(this IEnumerable collection, XName elementName, XName itemElementName, XName itemAttributeName) + { + if (elementName == null) + throw new ArgumentNullException("elementName"); + + if (itemElementName == null) + throw new ArgumentNullException("itemElementName"); + + var el = new XElement(elementName); + if (itemAttributeName == null) + { + foreach (TDomainObject item in collection) + el.Add(new XElement(itemElementName, item)); + } + else + { + foreach (TDomainObject item in collection) + el.Add(new XElement(itemElementName, new XAttribute(itemAttributeName, item))); + } + return el; + } + + /// + /// + /// + /// + /// + /// + /// + /// + public static XElement ToDto(this IEnumerable domainObjCollection, IDtoCollectionAssembler assembler, XNamespace elementNamespace) + where TDomainObject : new() + { + XElement element = assembler.CreateDataTransferObject(domainObjCollection); + + if (element == null) + return null; + + // replace the element name with the given namespace + var tmp = new XElement(elementNamespace + assembler.ElementName); + element.Name = tmp.Name; + + return element; + } + + /// + /// + /// + /// + /// + /// + /// + public static IEnumerable ToDtoIterator(this IEnumerable domainObjColl, IDtoAssembler assembler) + { + foreach (T item in domainObjColl) + yield return assembler.CreateDataTransferObject(item); + } + + /// + /// + /// + /// + /// + /// + /// + public static IEnumerable ToDomainObjectIterator(this IEnumerable dtoObjColl, IDtoAssembler assembler) + { + foreach (XElement item in dtoObjColl) + yield return assembler.CreateDomainObject(item); + } + + /// + /// + /// + /// + /// + /// + /// + public static IEnumerable ToDomainObjectIterator(XElement element, string elementName, string itemElementName, string itemAttributeName) + { + IEnumerable dto = from x in element.Descendants() + where x.Name.LocalName == itemElementName && x.Parent.Name.LocalName == elementName + select x; + + foreach (XElement item in dto) + yield return item.AttributeAs(itemAttributeName); + } + + public static XElement GetFirstOrDefaultElementByLocalName(this XDocument doc, string localName) + { + return (from x in doc.Descendants() + where x.Name.LocalName == localName + select x).FirstOrDefault(); + } + + /// + /// + /// + /// + /// + /// + /// + public static IEnumerable ToPropertyMap(this T type, Stream xsdStream) + { + return null; + } + + /// + /// + /// + /// + /// + /// + /// + public static IEnumerable ToPropertyMap(this T type, XDocument xsdDocument) + { + return null; + } + + /// + /// + /// + /// + /// + /// + public static IEnumerable ToPropertyMap(this T type) + { + foreach (PropertyInfo pInfo in type.GetType().GetProperties()) + { + object val = null; + try + { + val = pInfo.GetValue(type, null); + } + catch + { + throw new DtoPropertyMapException(string.Format("Error reading property {0} of type {1}", pInfo.Name, pInfo.ReflectedType.Name)); + } + + if (val != null) + { + yield return new DtoPropertyAttriubteMapping() + { + PropertyName = pInfo.Name, + AttributeName = pInfo.Name, + Importance = DtoPropertyImportance.Optional + }; + } + } + } + + private static IEnumerable GetAttributes(XDocument doc, string elementName) + { + IEnumerable element = from x in doc.Descendants() + where x.Attribute("name") != null && x.Attribute("name").Value == elementName + select x; + + if (element.Any()) + { + if (element.First().Name.LocalName == "complexType") + { + IEnumerable q1 = from x in element.Elements() + where x.Name.LocalName == "attribute" + select new AttributeInfo() + { + Name = x.Attribute("name").Value, + Use = x.Attribute("use") == null ? "optional" : x.Attribute("use").Value + }; + + return q1; + } + if (element.First().Name.LocalName == "element" && + element.ElementAt(0).HasElements && + element.ElementAt(0).Elements().ElementAt(0).Name.LocalName == "complexType") + { + IEnumerable q2 = from x in element.ElementAt(0).Elements().ElementAt(0).Elements() + where x.Name.LocalName == "attribute" + select new AttributeInfo() + { + Name = x.Attribute("name").Value, + Use = x.Attribute("use") == null ? "optional" : x.Attribute("use").Value + }; + + return q2; + } + } + + return new List() {}; + } + + /// + /// + /// + /// + /// + /// + public static IEnumerable ToPropertyMap(this T type, string elementName, XDocument doc) + { + IEnumerable refTable = GetAttributes(doc, elementName); + + foreach (PropertyInfo pInfo in type.GetType().GetProperties()) + { + if (refTable.Count() > 0) + { + // does the property exist in the xsd? + IEnumerable q = from x in refTable + where x.Name.Equals(pInfo.Name, StringComparison.InvariantCultureIgnoreCase) + select x; + + if (q.Any()) + { + // ok we have a property attribute match we can now + // safely create and return the mapping object + AttributeInfo item = q.Single(); + yield return new DtoPropertyAttriubteMapping() + { + PropertyName = pInfo.Name, + AttributeName = item.Name, + Importance = item.Use == "optional" ? + DtoPropertyImportance.Optional : DtoPropertyImportance.Required + }; + } + } + } + } + + /// + /// Materializes a simple object with the data from a xml file + /// + /// + /// Materialization happens on equal name basis. So the attribute + /// local name should be the same as the property name. Also the property type should + /// be known by the this method + /// + /// + /// + /// + public static T Materialize(this T dest, XElement src) + { + return Materialize(dest, src, null); + } + + /// + /// Materializes a domain object with the data from a xml file based on a property map + /// + /// + /// + /// + /// + public static T Materialize(this T dest, XElement src, DtoPropertyAttributeMap propertyMap) + { + bool hasPropertyMap = propertyMap != null && propertyMap.Count > 0; + + if (src.HasAttributes) + { + XAttribute att = src.FirstAttribute; + try + { + do + { + string attName = att.Name.LocalName; + object v = att.Value; + if (v != null) + { + PropertyInfo pInfo = null; + DtoPropertyAttriubteMapping mapItem = null; + if (hasPropertyMap) + { + mapItem = propertyMap.GetByAttributeName(attName); + + // Is the property found in the map? + if (mapItem != null) + pInfo = typeof (T).GetProperty(mapItem.PropertyName); + // else throw ? + } + else + // No property map so try to get property name based on + // the attribute name + pInfo = typeof (T).GetProperty(attName); + + if (pInfo != null) + { + // does the mapping contains a translation rule for + // the object to parse? + if (mapItem != null && mapItem.ToPropertyTranslationRule != null) + { + pInfo.SetObjectValue(dest, v, mapItem.ToPropertyTranslationRule); + } + else + { + pInfo.SetObjectValue(dest, v, null); + } + } + } + } while ((att = att.NextAttribute) != null); + } + catch (DtoAssemblerConversionException ex) + { + throw new DtoAssemblerConversionException(ex.Message); + } + catch + { + throw; + } + } + return dest; + } + + /// + /// Extension helper method which materializes a xml element with attributes and its values + /// + /// + /// + /// + /// + public static XElement Materialize(this XElement element, T src) + { + var map = new DtoPropertyAttributeMap(); + + foreach (PropertyInfo pInfo in src.GetType().GetProperties()) + { + object val = pInfo.GetValue(src, null); + if (val != null) + { + map.Add(pInfo.Name, new DtoPropertyAttriubteMapping() + { + PropertyName = pInfo.Name, + AttributeName = pInfo.Name, + Importance = DtoPropertyImportance.Optional + }); + } + } + return element.Materialize(src, map); + } + + /// + /// Extension helper method which materializes an xml element with attributes and its values + /// + /// Throws a required field exception if property is set to required in property map + /// + /// + /// + /// + /// + public static XElement Materialize(this XElement element, T src, DtoPropertyAttributeMap propertyMap) + { + PropertyInfo pInfo; + foreach (var item in propertyMap) + { + pInfo = typeof (T).GetProperty(item.Key); + object val = pInfo.GetValue(src, null); + if (val != null) + { + string attName = item.Value.AttributeName; + element.Add(new XAttribute(attName, val)); + } + else + { + // Throw required field exception.. + if (item.Value.Importance == DtoPropertyImportance.Required) + throw new MissingRequiredValueException(item.Key); + } + } + return element; + } + + /// + /// + /// + /// + /// + /// + /// + public static XElement SetNamespace(this XElement element, string elementName, string elementNamespace) + { + XNamespace ns = elementNamespace; + element.Name = new XElement(ns + elementName).Name; + return element; + } + + public static XElement SetNamespace(this XElement element, XNamespace elementNamespace) + { + element.Name = elementNamespace.GetName(element.Name.LocalName); + return element; + } + + /// + /// + /// + /// + /// + public static bool HasValidStringValue(this string value) + { + return !string.IsNullOrEmpty(value) && value.Trim() != ""; + } + + public static T ToEnum(this object value, IDictionary lookup) + { + if (value == null) + throw new ArgumentNullException("value"); + + return value.ToEnumType(lookup); + } + + public static T AttributeAs(this XElement element, XName name) + { + var xAttribute = element.Attribute(name); + if (xAttribute != null) + return xAttribute.Value.ToType(); + + return default(T); + } + + #region Nested type: AttributeInfo + + private struct AttributeInfo + { + public string Name; + public string Use; + //public string Type; + } + + #endregion + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/Test/Domain/CoverageFunctionTest.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/Test/Domain/CoverageFunctionTest.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/Test/Domain/CoverageFunctionTest.cs (revision 3305) @@ -0,0 +1,333 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of the application DAM - UI. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU 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 GeoAPI.Geometries; + +using NetTopologySuite.Geometries; + +using NUnit.Framework; + +using Rhino.Mocks; + +namespace Deltares.Maps.Tests.Domain +{ + [TestFixture] + public class CoverageFunctionTest + { + private MockRepository mocks; + private IFeatureRepository repository; + + #region Setup + + [TestFixtureSetUp] + public void FixtureSetup() + { + mocks = new MockRepository(); + } + + [TestFixtureTearDown] + public void FixtureTearDown() + { + } + + [SetUp] + public void TestSetup() + { + repository = mocks.DynamicMock(); + } + + [TearDown] + public void TestTearDown() + { + mocks.VerifyAll(); + } + + #endregion + + [Test] + [ExpectedException(typeof(ArgumentException))] + public void GetCoverageFunction_NoAttributesInList_Throws() + { + mocks.ReplayAll(); + CoverageFunction.GetCoverageFunc(repository, new List()); + } + + [Test] + [ExpectedException(typeof(ArgumentException))] + public void GetCoverageFunction_AttributeListContainsInvalidString_Throws() + { + mocks.ReplayAll(); + CoverageFunction.GetCoverageFunc(repository, new List { "" }); + } + + [Test] + [ExpectedException(typeof(ArgumentNullException))] + public void GetCoverageFunction_SupportedAttributeListIsNull_Throws() + { + mocks.ReplayAll(); + repository.GetCoverageFunc("SomeAttribute", null); + } + + [Test] + [ExpectedException(typeof(ArgumentNullException))] + public void GetCoverageFunction_RepositoryIsNull_Throws() + { + mocks.ReplayAll(); + CoverageFunction.GetCoverageFunc(null, new[] { "SomeAttribute" }); + } + + [Test] + [ExpectedException(typeof(ArgumentNullException))] + public void UsingCoverageFunction_AttributeNameIsNullOrEmpty_Throws() + { + mocks.ReplayAll(); + Func func = CoverageFunction.GetCoverageFunc(repository, new[] { "SomeAttribute" }); + func("", 0, 0); + } + + [Test] + public void CoverageFunction_AttributeNamesAndDifferentCase_ReturnsExpectedValue() + { + var lineString = new LineString(new[] { new Coordinate(1, 1), new Coordinate(1, 2) }); + + var rep = new FeatureRepository(); + + Feature geom = Feature.Create(lineString); + rep.Add(geom); + + //Expect.Call(repository.Features).Return(new[] { geom }); + + const string attribute = "SomeAttribute"; + const string expected = "test"; + geom.AddAttribute(attribute, expected); + + //Expect.Call(repository.SupportedAttributes).Return(new[] { attribute }); + + Func func = rep.GetCoverageFunc(); + var actual = (string)func(attribute.ToUpper(), 1, 1); + Assert.IsNotNull(actual); + Assert.AreEqual(expected, actual); + + actual = (string)func(attribute.ToLower(), 1, 1); + Assert.IsNotNull(actual); + Assert.AreEqual(expected, actual); + + mocks.ReplayAll(); + } + + [Test] + [ExpectedException(typeof(AttributeMissingException))] + public void UsingCoverageFunction_AttributeNamenotContainedInAttributeList_Throws() + { + mocks.ReplayAll(); + Func func = CoverageFunction.GetCoverageFunc(repository, new[] { "SomeAttribute" }); + func("AnotherAttribute", 0, 0); + } + + [Test] + [ExpectedException(typeof(FeatureCoverageException), ExpectedMessage = "Multiple geometries found covering point (0 0)")] + public void UsingCoverageFunction_MoreThenOneGeometyFoundAtGivenLocation_Throws() + { + var square = new Polygon(new LinearRing(new[] + { + new Coordinate(-1, 1), + new Coordinate(1, 1), + new Coordinate(1, -1), + new Coordinate(-1, -1), + new Coordinate(-1, 1) + })); + + Feature geom = Feature.Create(square); + //Expect.Call(repository.Features).Return(new[] {geom, geom}); + Expect.Call(repository.Query((IGeometry)null)).IgnoreArguments().Return(new[] { geom, geom }); + + const string attribute = "SomeAttribute"; + Expect.Call(repository.SupportedAttributes).Return(new[] + { + attribute.ToUpper() + }); + + mocks.ReplayAll(); + + Func func = repository.GetCoverageFunc(); + + func(attribute, 0, 0); + } + + [Test] + [ExpectedException(typeof(FeatureCoverageException), ExpectedMessage = "No geometries found covering point (10 10)")] + public void UsingCoverageFunction_NoGeometyFoundAtGivenLocation_Throws() + { + var square = new Polygon(new LinearRing(new[] + { + new Coordinate(-1, 1), + new Coordinate(1, 1), + new Coordinate(1, -1), + new Coordinate(-1, -1), + new Coordinate(-1, 1) + })); + + const string attribute = "SomeAttribute"; + Expect.Call(repository.SupportedAttributes).Return(new[] + { + attribute.ToUpper() + }); + + Feature geom = Feature.Create(square); + //Expect.Call(repository.Features).Return(new[] { geom }); + Expect.Call(repository.Query((IGeometry)null)).IgnoreArguments().Return(new[] { geom }); + + mocks.ReplayAll(); + + Func func = repository.GetCoverageFunc(); + func("SomeAttribute", 10, 10); + } + + [Test] + public void UsingCoverageFunction_GeometyFoundAtGivenLocation_ReturnsAttributeValueAsDouble() + { + var square = new Polygon(new LinearRing(new[] + { + new Coordinate(-1, 1), + new Coordinate(1, 1), + new Coordinate(1, -1), + new Coordinate(-1, -1), + new Coordinate(-1, 1) + })); + + Feature geom = Feature.Create(square); + //Expect.Call(repository.Features).Return(new[] { geom }); + Expect.Call(repository.Query((IGeometry)null)).IgnoreArguments().Return(new[] { geom }); + + const string attribute = "SomeAttribute"; + const double expected = 20; + geom.AddAttribute(attribute, expected); + + Expect.Call(repository.SupportedAttributes).Return(new[] + { + attribute.ToUpper() + }); + + mocks.ReplayAll(); + + Func func = repository.GetCoverageFunc(); + var actual = (double)func(attribute, 0, 0); + Assert.IsNotNull(actual); + Assert.AreEqual(expected, actual, 0.0001); + } + + [Test] + public void UsingCoverageFunction_GeometyFoundAtGivenLocation_ReturnsAttributeValueAsStringType() + { + var square = new Polygon(new LinearRing(new[] + { + new Coordinate(-1, 1), + new Coordinate(1, 1), + new Coordinate(1, -1), + new Coordinate(-1, -1), + new Coordinate(-1, 1) + })); + + Feature geom = Feature.Create(square); + //Expect.Call(repository.Features).Return(new[] { geom }); + Expect.Call(repository.Query((IGeometry)null)).IgnoreArguments().Return(new[] { geom }); + + const string attribute = "SomeAttribute"; + const string expected = "test"; + geom.AddAttribute(attribute, expected); + + Expect.Call(repository.SupportedAttributes).Return(new[] { attribute }); + + mocks.ReplayAll(); + + Func func = repository.GetCoverageFunc(); + var actual = (string)func(attribute, 0, 0); + Assert.IsNotNull(actual); + Assert.AreEqual(expected, actual); + } + + [Test] + public void UsingCoverageFunctionForGivenLocation_RepositoryContainsLinestringGeometryType_ReturnsValue() + { + var lineString = new LineString(new[] { new Coordinate(1, 1), new Coordinate(1, 2) }); + + Feature geom = Feature.Create(lineString); + //Expect.Call(repository.Features).Return(new[] { geom }); + Expect.Call(repository.Query((IGeometry)null)).IgnoreArguments().Return(new[] { geom }); + + const string attribute = "SomeAttribute"; + const double expected = 5; + geom.AddAttribute(attribute, expected); + + Expect.Call(repository.SupportedAttributes).Return(new[] { attribute }); + + mocks.ReplayAll(); + + Func func = repository.GetCoverageFunc(); + var actual = (double)func(attribute, 1, 1); + Assert.IsNotNull(actual); + Assert.AreEqual(expected, actual); + + actual = (double)func(attribute, 1, 2); + Assert.IsNotNull(actual); + Assert.AreEqual(expected, actual); + + actual = (double)func(attribute, 1, 1.5); + Assert.IsNotNull(actual); + Assert.AreEqual(expected, actual); + } + + [Test] + public void UsingCoverageFunctionCreatedByGeometryRepository_GeometyFoundAtGivenLocation_ReturnsAttributeValue() + { + const string attribute = "SomeAttribute"; + const double expected = 20; + + var square = new Polygon(new LinearRing(new[] + { + new Coordinate(-1, 1), + new Coordinate(1, 1), + new Coordinate(1, -1), + new Coordinate(-1, -1), + new Coordinate(-1, 1) + })); + + Feature geom = Feature.Create(square); + geom.AddAttribute(attribute, expected); + //Expect.Call(repository.Features).Return(new[] { geom }); + Expect.Call(repository.Query((IGeometry)null)).IgnoreArguments().Return(new[] { geom }); + Expect.Call(repository.SupportedAttributes).Return(new[] + { + attribute.ToUpper() + }); + + mocks.ReplayAll(); + + Func func = repository.GetCoverageFunc(attribute); + var actual = (double)func(0, 0); + Assert.IsNotNull(actual); + Assert.AreEqual(expected, actual, 0.0001); + } + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Sensors/PLLineConstructor.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Sensors/PLLineConstructor.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Sensors/PLLineConstructor.cs (revision 3305) @@ -0,0 +1,72 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System.Collections.Generic; + +namespace Deltares.Dam.Data.Sensors +{ + /// + /// This class is responsible for creating a PL line where the coordinates are sorted on x. + /// No logic will be applied on how the PL is constructed. Just a simple data structure with an + /// insert method to insert new points. + /// + internal class PLLineConstructor + { + readonly IDictionary line = new SortedDictionary(); + + /// + /// Inserts the specified point. + /// + /// The point will be inserted in the line based on the X value + /// The point. + public void Insert(PLLinePoint point) + { + if (line.ContainsKey(point.X)) + line[point.X] = point; + else + line.Add(point.X, point); + } + + /// + /// Inserts the specified point. + /// + /// The point will be inserted in the line based on the X value + /// The x. + /// The z. + public void Insert(double x, double z) + { + Insert(new PLLinePoint(x, z)); + } + + /// + /// Gets the PL line from the internal constructed line. + /// + public PLLine CreatePLLine(PLLineType type) + { + var plLine = new PLLine() { PLLineType = type }; + foreach (var kvp in line) + { + plLine.Points.Add(kvp.Value); + } + return plLine; + } + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/IFileReader.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/IFileReader.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/IFileReader.cs (revision 3305) @@ -0,0 +1,65 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Collections.Generic; + +namespace Deltares.Maps +{ + public interface IReader + { + IEnumerable Read(); + } + + public interface IFileReader : IReader + { + TFile File { get; } + } + + public abstract class FileReader : IFileReader + // note: restricted to geometry stuff for now, this can change in the future + where TFile : class, IFile + where TObject : IFeature + { + private readonly TFile file; + + protected FileReader(TFile file) + { + if (file == null) + { + throw new ArgumentNullException("file"); + } + + this.file = file; + } + + #region Implementation of IFileReader + + public TFile File + { + get { return file; } + } + + public abstract IEnumerable Read(); + + #endregion + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/UpliftFactorToBetaCalculator.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/UpliftFactorToBetaCalculator.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/UpliftFactorToBetaCalculator.cs (revision 3305) @@ -0,0 +1,64 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU 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; + +namespace Deltares.Dam.Data +{ + + /// + /// Exception class for UpliftFactorToBetaCalculator + /// + public class UpliftFactorToBetaCalculatorException : ApplicationException + { + public UpliftFactorToBetaCalculatorException(string message) : base(message) { } + } + + /// + /// Class to calculate the probability of uplift from upliftfactor + /// + public class UpliftFactorToBetaCalculator + { + /// + /// Compute the Beta from the Upliftfactor + /// + /// + /// + static public double ComputeBetaFromUpliftFactor(double upliftFactor) + { + ThrowWhenUpliftFactorOutOfRange(upliftFactor); + return ((upliftFactor - 1) * 18.0); + } + + /// + /// Check if upliftfactor in correct range + /// + /// + /// + static public void ThrowWhenUpliftFactorOutOfRange(double upliftFactor) + { + if (upliftFactor < 0) + { + throw new UpliftFactorToBetaCalculatorException(String.Format("Upliftfactor of {0} is < 0.0 not allowed", upliftFactor)); + } + } + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Segment.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Segment.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Segment.cs (revision 3305) @@ -0,0 +1,258 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU 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.Linq; +using System.Text; +using Deltares.Geotechnics.Soils; +using Deltares.Standard.Attributes; + +namespace Deltares.Dam.Data +{ + + public class SoilGeometryProbability : IComparable + { + public virtual SoilProfile1D SoilProfile { get; set; } + public virtual string SoilGeometry2DName { get; set; } + public virtual SoilProfile2D SoilProfile2D { get; set; } + public virtual FailureMechanismSystemType? SegmentFailureMechanismType { get; set; } + public virtual double Probability { get; set; } // Probability of occurance; number between 0.0 and 100.0 + + /// + /// Assigns the specified soil geometry probability. + /// + /// The soil geometry probability. + public void Assign(SoilGeometryProbability soilGeometryProbability) + { + if (soilGeometryProbability.SoilProfile != null) + { + SoilProfile = new SoilProfile1D(); + SoilProfile.Assign(soilGeometryProbability.SoilProfile); + } + SegmentFailureMechanismType = soilGeometryProbability.SegmentFailureMechanismType; + Probability = soilGeometryProbability.Probability; + SoilGeometry2DName = soilGeometryProbability.SoilGeometry2DName; + } + + [XmlOldName("SoilGeometryType")] + public SoilProfileType SoilProfileType + { + get + { + if (SoilProfile2D == null && SoilProfile != null) + { + return SoilProfileType.SoilProfile1D; + } + if (SoilProfile2D != null) + { + return SoilProfileType.SoilProfile2D; + } + if (SoilGeometry2DName == null) + { + throw new Exception("No soilprofile assigned"); + } + return SoilProfileType.SoilGeometryStiFile; + } + } + + /// + /// Returns either the 1D-geometry or the 2D-geometry name + /// + public virtual string SoilGeometryName + { + get + { + if (SoilProfile2D == null && SoilProfile != null) + { + return SoilProfile.Name; + } + if (SoilProfile2D != null) + { + return SoilProfile2D.Name; + } + return SoilGeometry2DName; + } + } + + public int CompareTo(SoilGeometryProbability other) + { + return - this.Probability.CompareTo(other.Probability); + } + } + + public class Segment + { + private List soilGeometryProbabilities = new List(); + + public virtual string Name { get; set; } + + /// + /// Gets the soil probalilities for this segment + /// + public virtual List SoilProfileProbabilities + { + get { return this.soilGeometryProbabilities; } + } + + public SoilProfile1D GetMostProbableProfile(FailureMechanismSystemType? segmentFailureMechanismType) + { + IEnumerable spps = from SoilGeometryProbability spp in this.soilGeometryProbabilities + where !spp.SegmentFailureMechanismType.HasValue || !segmentFailureMechanismType.HasValue || spp.SegmentFailureMechanismType == segmentFailureMechanismType + orderby spp.Probability descending + select spp; + if (spps.Count() > 0) + return spps.First().SoilProfile; + else + return null; + } + + public string GetMostProbableGeometry2DName(FailureMechanismSystemType? segmentFailureMechanismType) + { + IEnumerable spps = from SoilGeometryProbability spp in this.soilGeometryProbabilities + where !spp.SegmentFailureMechanismType.HasValue || !segmentFailureMechanismType.HasValue || spp.SegmentFailureMechanismType == segmentFailureMechanismType + orderby spp.Probability descending + select spp; + if (spps.Count() > 0) + return spps.First().SoilGeometry2DName; + else + return null; + } + + public void AddSoilProfileProbability(SoilProfile1D soilProfile, double probability, FailureMechanismSystemType? segmentFailureMechanismType) + { + if (this.soilGeometryProbabilities.Where(x => x.SoilProfile == soilProfile && x.SegmentFailureMechanismType == segmentFailureMechanismType).Count() == 0) + this.soilGeometryProbabilities.Add(new SoilGeometryProbability() { SoilProfile = soilProfile, Probability = probability, SegmentFailureMechanismType = segmentFailureMechanismType, SoilGeometry2DName = null }); + } + + public double? GetSoilProfileProbability(SoilProfile1D soilProfile, FailureMechanismSystemType? segmentFailureMechanismType) + { + if (soilProfile != null) + { + IEnumerable probs = + soilGeometryProbabilities.Where(x => (x.SoilProfile.Name == soilProfile.Name)); + if ((segmentFailureMechanismType != null) && (probs.Count() > 0)) + { + probs = probs.Where(x => + (x.SegmentFailureMechanismType == segmentFailureMechanismType) || + (x.SegmentFailureMechanismType == null)); + } + + if (probs.Count() > 0) + return probs.Select(x => x.Probability).Average(); + } + return null; + } + + public void AddSoilGeometry2DProbability(string soilGeometry2DName, double probability, FailureMechanismSystemType? segmentFailureMechanismType) + { + if (this.soilGeometryProbabilities.Where(x => x.SoilGeometry2DName == soilGeometry2DName && x.SegmentFailureMechanismType == segmentFailureMechanismType).Count() == 0) + this.soilGeometryProbabilities.Add(new SoilGeometryProbability() { SoilProfile = null, Probability = probability, SegmentFailureMechanismType = segmentFailureMechanismType, SoilGeometry2DName = soilGeometry2DName }); + } + + public double? GetSoilGeometry2DProbability(string soilGeometry2DName, FailureMechanismSystemType? segmentFailureMechanismType) + { + IEnumerable probs = this.soilGeometryProbabilities.Where( + x => (x.SoilGeometry2DName == soilGeometry2DName) && + (segmentFailureMechanismType == null || x.SegmentFailureMechanismType == segmentFailureMechanismType || x.SegmentFailureMechanismType == null)); + + if (probs.Count() > 0) + return probs.Select(x => x.Probability).Average(); + else + return null; + } + + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append(this.Name); + sb.Append(": "); + foreach (FailureMechanismSystemType type in Enum.GetValues(typeof(FailureMechanismSystemType))) + { + sb.Append(type.ToString()); + sb.Append(": "); + foreach (SoilGeometryProbability spp in this.SoilProfileProbabilities.Where(x => x.SegmentFailureMechanismType == null || x.SegmentFailureMechanismType == type)) + { + if (spp.SoilProfile != null) + { + sb.Append(String.Format("(1D) {0} ({1}%) ", spp.SoilProfile.Name, spp.Probability)); + } + else + { + sb.Append(String.Format("(2D) {0} ({1}%) ", spp.SoilGeometry2DName, spp.Probability)); + } + } + } + + return sb.ToString(); + } + + /// + /// Assemble a list of key/value pairs with the relevant parameters for the specified 1d-profile + /// + /// + public Dictionary GetParametersForSoilProfile1DAsNameValuePairs(string soilProfile1DId, FailureMechanismSystemType failureMechanismSystemType) + { + SoilGeometryProbability soilProfileProbability = this.SoilProfileProbabilities.FirstOrDefault(x => (x.SoilProfile != null && + x.SoilProfile.Name.Equals(soilProfile1DId) && + x.SegmentFailureMechanismType == failureMechanismSystemType + )); + if (soilProfileProbability != null) + { + var nameValuePairs = new Dictionary(); + var numberFormatInfo = new NumberFormatInfo(); + numberFormatInfo.NumberDecimalSeparator = "."; + nameValuePairs.Add("Probability", soilProfileProbability.Probability.ToString(numberFormatInfo)); + nameValuePairs.Add("FailureMechanismType", soilProfileProbability.SegmentFailureMechanismType.ToString()); + return nameValuePairs; + } + else + { + return null; + } + } + + /// + /// Assemble a list of key/value pairs with the relevant parameters for the specified 2d-profile + /// + /// + public Dictionary GetParametersForSoilProfile2DAsNameValuePairs(string soilProfile2DId, FailureMechanismSystemType failureMechanismSystemType) + { + SoilGeometryProbability soilProfileProbability = this.SoilProfileProbabilities.FirstOrDefault(x => x.SoilGeometry2DName.Equals(soilProfile2DId) && + x.SegmentFailureMechanismType == failureMechanismSystemType); + if (soilProfileProbability != null) + { + var nameValuePairs = new Dictionary(); + var numberFormatInfo = new NumberFormatInfo(); + numberFormatInfo.NumberDecimalSeparator = "."; + nameValuePairs.Add("Probability", soilProfileProbability.Probability.ToString(numberFormatInfo)); + nameValuePairs.Add("FailureMechanismType", soilProfileProbability.SegmentFailureMechanismType.ToString()); + return nameValuePairs; + } + else + { + return null; + } + } + } + +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/CsvImporters/CsvImporterScenarios.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/CsvImporters/CsvImporterScenarios.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/CsvImporters/CsvImporterScenarios.cs (revision 3305) @@ -0,0 +1,307 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU 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.IO; +using System.Linq; +using System.Threading; +using Deltares.Dam.Data.Importers; +using Deltares.Standard.IO; +using Deltares.Standard.Language; +using LumenWorks.Framework.IO.Csv; + +namespace Deltares.Dam.Data.CsvImporters +{ + public class CsvImporterScenariosException : ApplicationException + { + public CsvImporterScenariosException(string message) + : base(message) + { + } + } + + public class CsvImporterScenarios + { + private List scenarioRecords = new List(); + private List errorMessages = new List(); + + public class ScenarioRecord + { + public ScenarioRecord() + { + LocationScenarioId = null; + } + + public int ScenarioRecordId { get; set; } + public string LocationId { get; set; } //required + public string LocationScenarioId { get; set; } //required + public double? RiverLevel { get; set; } //optional + public double? RiverLevelLow { get; set; } //optional + public double? DikeTableHeight { get; set; } //optional + public double? PlLineOffsetBelowDikeTopAtRiver { get; set; } //optional + public double? PlLineOffsetBelowDikeTopAtPolder { get; set; } //optional + public double? PlLineOffsetBelowShoulderBaseInside { get; set; } //optional + public double? PlLineOffsetBelowDikeToeAtPolder { get; set; } //optional + public double? PlLineOffsetBelowDikeCrestMiddle { get; set; } //optional + public double? PlLineOffsetFactorBelowShoulderCrest { get; set; } //optional + public bool? UsePlLineOffsetBelowDikeCrestMiddle { get; set; } //optional + public bool? UsePlLineOffsetFactorBelowShoulderCrest { get; set; } //optional + public double? HeadPl3 { get; set; } //optional + public double? HeadPl4 { get; set; } //optional + + public double? PolderLevel { get; set; } // optional + + public double? HeadPl2 { get; set; } // Optional + + public double? UpliftCriterionPiping { get; set; } //optional + public double? UpliftCriterionStability { get; set; } //optional + public double? RequiredSafetyFactorPiping { get; set; } //optional + public double? RequiredSafetyFactorStabilityInnerSlope { get; set; } //optional + public double? RequiredSafetyFactorStabilityOuterSlope { get; set; } //optional + } + + private void CheckColumn(int index, string fileName, string fieldName) + { + if (index < 0) + { + var csvHeaderFieldError = LocalizationManager.GetTranslatedText(this.GetType(), "csvHeaderFieldError"); + throw new CsvImporterScenariosException(String.Format("{0} : {1} {2}", fileName, csvHeaderFieldError, fieldName)); + } + } + + public CsvImporterScenarios(string fileName) + { + errorMessages.Clear(); + ThrowHelper.ThrowIfStringArgumentNullOrEmpty(fileName, StringResourceNames.CsvFileNotValid); + ThrowHelper.ThrowIfFileNotExist(fileName, StringResourceNames.CsvFileNotFound); + + + var oldcur = Thread.CurrentThread.CurrentCulture; + try + { + Thread.CurrentThread.CurrentCulture = CsvReaderUtilities.DetermineCultureForFile(fileName); + using (CsvReader csv = new CsvReader(new StreamReader(fileName), true, ';')) + { + string[] headers = CsvImporterHelper.GetFieldHeaders(this, csv); + if (headers.Count() < 2) + { + var csvHeaderError = LocalizationManager.GetTranslatedText(this.GetType(), "csvHeaderError"); + throw new CsvImporterSegmentsException(String.Format("{0} : {1}", fileName, csvHeaderError)); + } + + const string fieldLocationId = CsvColumnNames.LocationColumnName; + int colIndexLocationId = CsvReaderUtilities.GetHeaderIndexByString(headers, fieldLocationId); + CheckColumn(colIndexLocationId, fileName, fieldLocationId); + + const string fieldLocationScenarioId = CsvColumnNames.LocationScenarioColumnName; + int colIndexLocationScenarioId = CsvReaderUtilities.GetHeaderIndexByString(headers, fieldLocationScenarioId); + CheckColumn(colIndexLocationScenarioId, fileName, fieldLocationScenarioId); + + int colIndexRiverLevel = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.RiverLevelColumnName); + int colIndexRiverLevelLow = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.RiverLevelLowColumnName); + int colIndexDikeTableHeight = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.DikeTableHeightColumnName); + + int colIndexSafetyFactorPiping = CsvReaderUtilities.GetHeaderIndexByString(headers, ModelFactorCsvIdentifiers.SafetyFactorPiping); + int colIndexSafetyFactorStabilityInnerSlope = CsvReaderUtilities.GetHeaderIndexByString(headers, ModelFactorCsvIdentifiers.SafetyFactorStabilityInnerslope); + int colIndexSafetyFactorStabilityOuterSlope = CsvReaderUtilities.GetHeaderIndexByString(headers, ModelFactorCsvIdentifiers.SafetyFactorStabilityOuterslope); + int colIndexUpliftCriterionPiping = CsvReaderUtilities.GetHeaderIndexByString(headers, ModelFactorCsvIdentifiers.UpliftCriterionPiping); + int colIndexUpliftCriterionStability = CsvReaderUtilities.GetHeaderIndexByString(headers, ModelFactorCsvIdentifiers.UpliftCriterionStability); + + int colIndexPlLineOffsetBelowDikeTopAtRiver = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.PlLineOffsetBelowDikeTopAtRiverColumnName); + int colIndexPlLineOffsetBelowDikeTopAtPolder = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.PlLineOffsetBelowDikeTopAtPolderColumnName); + int colIndexPlLineOffsetBelowShoulderBaseInside = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.PlLineOffsetBelowShoulderBaseInsideColumnName); + int colIndexPlLineOffsetBelowDikeToeAtPolder = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.PlLineOffsetBelowDikeToeAtPolderColumnName); + int colIndexPlLineOffsetBelowDikeCrestMiddle = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.PlLineOffsetBelowDikeCrestMiddleColumnName); + int colIndexPlLineOffsetFactorBelowShoulderCrest = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.PlLineOffsetFactorBelowShoulderCrestColumnName); + int colIndexUsePlLineOffsetBelowDikeCrestMiddle = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.UsePlLineOffsetBelowDikeCrestMiddleColumnName); + int colIndexUsePlLineOffsetFactorBelowShoulderCrest = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.UsePlLineOffsetFactorBelowShoulderCrestColumnName); + int colIndexHeadPl3 = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.HeadPl3ColumnName); + int colIndexHeadPl4 = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.HeadPl4ColumnName); + int colIndexHeadPl3OldFormat = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.HeadPl3OldFormatColumnName); + int colIndexHeadPl4OldFormat = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.HeadPl4OldFormatColumnName); + int colIndexPolderLevel = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.PolderLevelColumnName); + int colIndexHeadPl2 = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.HeadPl2ColumnName); + + var index = 1; + while (csv.ReadNextRecord()) + { + ScenarioRecord scenario = new ScenarioRecord(); + int colIndex = -1; // Keep track of column for error message + try + { + scenario.ScenarioRecordId = index; + index++; + + scenario.LocationId = csv[colIndexLocationId]; + + // faassen: changed location scenario id type from int to string (default value was -1 now null is used) + string value = csv[colIndexLocationScenarioId]; + scenario.LocationScenarioId = string.IsNullOrWhiteSpace(value) ? null : value; + + if (colIndexRiverLevel > -1) + { + colIndex = colIndexRiverLevel; + scenario.RiverLevel = Convert.ToDouble(csv[colIndexRiverLevel]); + } + if (colIndexRiverLevelLow > -1) + { + colIndex = colIndexRiverLevelLow; + scenario.RiverLevelLow = Convert.ToDouble(csv[colIndex]); + } + if (colIndexDikeTableHeight > -1) + { + colIndex = colIndexDikeTableHeight; + scenario.DikeTableHeight = Convert.ToDouble(csv[colIndexDikeTableHeight]); + } + if (colIndexSafetyFactorPiping > -1) + { + colIndex = colIndexSafetyFactorPiping; + scenario.RequiredSafetyFactorPiping = Convert.ToDouble(csv[colIndex]); + } + if (colIndexSafetyFactorStabilityInnerSlope > -1) + { + colIndex = colIndexSafetyFactorStabilityInnerSlope; + scenario.RequiredSafetyFactorStabilityInnerSlope = Convert.ToDouble(csv[colIndex]); + } + if (colIndexSafetyFactorStabilityOuterSlope > -1) + { + colIndex = colIndexSafetyFactorStabilityOuterSlope; + scenario.RequiredSafetyFactorStabilityOuterSlope = Convert.ToDouble(csv[colIndex]); + } + if (colIndexUpliftCriterionPiping > -1) + { + colIndex = colIndexUpliftCriterionPiping; + scenario.UpliftCriterionPiping = Convert.ToDouble(csv[colIndex]); + } + if (colIndexUpliftCriterionStability > -1) + { + colIndex = colIndexUpliftCriterionStability; + scenario.UpliftCriterionStability = Convert.ToDouble(csv[colIndex]); + } + if (colIndexPlLineOffsetBelowDikeTopAtRiver > -1) + { + colIndex = colIndexPlLineOffsetBelowDikeTopAtRiver; + scenario.PlLineOffsetBelowDikeTopAtRiver = Convert.ToDouble(csv[colIndex]); + } + if (colIndexPlLineOffsetBelowDikeTopAtPolder > -1) + { + colIndex = colIndexPlLineOffsetBelowDikeTopAtPolder; + scenario.PlLineOffsetBelowDikeTopAtPolder = Convert.ToDouble(csv[colIndex]); + } + if (colIndexPlLineOffsetBelowShoulderBaseInside > -1) + { + colIndex = colIndexPlLineOffsetBelowShoulderBaseInside; + scenario.PlLineOffsetBelowShoulderBaseInside = Convert.ToDouble(csv[colIndex]); + } + if (colIndexPlLineOffsetBelowDikeToeAtPolder > -1) + { + colIndex = colIndexPlLineOffsetBelowDikeToeAtPolder; + scenario.PlLineOffsetBelowDikeToeAtPolder = Convert.ToDouble(csv[colIndex]); + } + if (colIndexPlLineOffsetBelowDikeCrestMiddle > -1) + { + colIndex = colIndexPlLineOffsetBelowDikeCrestMiddle; + scenario.PlLineOffsetBelowDikeCrestMiddle = Convert.ToDouble(csv[colIndex]); + } + if (colIndexPlLineOffsetFactorBelowShoulderCrest > -1) + { + colIndex = colIndexPlLineOffsetFactorBelowShoulderCrest; + scenario.PlLineOffsetFactorBelowShoulderCrest = Convert.ToDouble(csv[colIndex]); + } + if (colIndexUsePlLineOffsetBelowDikeCrestMiddle > -1) + { + colIndex = colIndexUsePlLineOffsetBelowDikeCrestMiddle; + scenario.UsePlLineOffsetBelowDikeCrestMiddle = Convert.ToBoolean(csv[colIndex]); + } + if (colIndexUsePlLineOffsetFactorBelowShoulderCrest > -1) + { + colIndex = colIndexUsePlLineOffsetFactorBelowShoulderCrest; + scenario.UsePlLineOffsetFactorBelowShoulderCrest = Convert.ToBoolean(csv[colIndex]); + } + if (colIndexHeadPl3 > -1) + { + colIndex = colIndexHeadPl3; + scenario.HeadPl3 = Convert.ToDouble(csv[colIndex]); + } + else + { + if (colIndexHeadPl3OldFormat > -1) + { + colIndex = colIndexHeadPl3OldFormat; + scenario.HeadPl3 = Convert.ToDouble(csv[colIndex]); + } + } + if (colIndexHeadPl4 > -1) + { + colIndex = colIndexHeadPl4; + scenario.HeadPl4 = Convert.ToDouble(csv[colIndex]); + } + else + { + if (colIndexHeadPl4OldFormat > -1) + { + colIndex = colIndexHeadPl4OldFormat; + scenario.HeadPl4 = Convert.ToDouble(csv[colIndex]); + } + } + + if (colIndexPolderLevel > -1) + { + colIndex = colIndexPolderLevel; + scenario.PolderLevel = Convert.ToDouble(csv[colIndex]); + } + + if (colIndexHeadPl2 > -1) + { + colIndex = colIndexHeadPl2; + scenario.HeadPl2 = Convert.ToDouble(csv[colIndex]); + } + + scenarioRecords.Add(scenario); + } + catch (Exception e) + { + var csvScenarioError = String.Format(LocalizationManager.GetTranslatedText(this.GetType(), "csvScenarioError"), scenario.LocationId, colIndex + 1); + errorMessages.Add(csvScenarioError + e.Message); + } + } + } + } + finally + { + Thread.CurrentThread.CurrentCulture = oldcur; + } + } + + public List ImportedItems + { + get { return scenarioRecords; } + } + + public List ErrorMessages + { + get { return errorMessages; } + set { errorMessages = value; } + } + + } +} Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DikeJob.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DikeJob.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DikeJob.cs (revision 3305) @@ -0,0 +1,62 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU 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.Xml.Serialization; + +namespace Deltares.Dam.Data +{ + public class DikeJob : CompositeJob + { + public DikeJob() + { + } + + public DikeJob(object subject) : base(subject) + { + } + + [XmlIgnore] + public Dike Dike + { + get + { + return this.Subject as Dike; + } + set + { + this.Subject = value; + } + } + + public bool AreAllLocationWaterLevelTimeSeriesAssigned() + { + bool areAssigned = true; + foreach (DamJob damJob in Jobs) + { + if (damJob.GetType() == typeof(LocationJob)) + { + areAssigned = areAssigned && (((LocationJob)damJob).WaterLevelTimeSerie != null); + } + } + return areAssigned; + } + } +} Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/RequiredEntityNotExistException.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/RequiredEntityNotExistException.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/RequiredEntityNotExistException.cs (revision 3305) @@ -0,0 +1,46 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU 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.Dam.Data +{ + [Serializable] + public class RequiredEntityNotExistException : Exception + { + public RequiredEntityNotExistException(string messageFormat, Type type, object idValue) + : base(string.Format(messageFormat, type.Name, idValue), null) + { + } + + public RequiredEntityNotExistException(string messageFormat, Type type, object idValue, Exception inner) + : base(string.Format(messageFormat, type.Name, idValue), inner) + { + } + + protected RequiredEntityNotExistException( + SerializationInfo info, + StreamingContext context) : base(info, context) + { + } + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/ThrowHelper.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/ThrowHelper.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/ThrowHelper.cs (revision 3305) @@ -0,0 +1,293 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU 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.IO; +using System.Linq; +using System.Resources; +using System.Reflection; +using System.Globalization; + +namespace Deltares.Dam.Data +{ + + /// + /// Declares the string resource names + /// + internal enum StringResourceNames + { + CsvFileNotFound, + CsvFileNotValid, + CsvHeaderNullOrEmpty, + 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, + NoDikeDefined, + NoLocationsDefined, + NoCalculationTypeSpecified, + NoScenariosDefinedInLocation, + NoRiverLevel, + NoSurfaceLines, + NoSoilsDefinedInProject, + NoSoilprofiles1DDefinedInProject + } + + /// + /// 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, string parameter, StringResourceNames resourceNamesName) + { + if (value == null) + throw new ArgumentNullException(parameter, GetResourceString(resourceNamesName)); + } + + internal static void ThrowIfArgumentNull(object value, string parameter, string message) + { + if (value == null) + throw new ArgumentNullException(parameter, message); + } + + 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 ?? ""), DamProject.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: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Specifications/MinimumAttribute.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Specifications/MinimumAttribute.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Specifications/MinimumAttribute.cs (revision 3305) @@ -0,0 +1,41 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU 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; + +namespace Deltares.Standard.Specifications +{ + [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, Inherited = false, AllowMultiple = true)] + public sealed class MinimumAttribute : Attribute + { + private readonly double attributeValue; + + public MinimumAttribute(double minValue) + { + this.attributeValue = minValue; + } + + public double AttributeValue + { + get { return this.attributeValue; } + } + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Xsd/SoilbaseDataSet.xss =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Xsd/SoilbaseDataSet.xss (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Xsd/SoilbaseDataSet.xss (revision 3305) @@ -0,0 +1,43 @@ + + + + + + + + + + + + + 302 + 267 + + + 302 + 355 + + + 343 + 355 + + + + + + + 490 + 266 + + + 490 + 338 + + + + + \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/Test/TestData/Gemeenten.dbf =================================================================== diff -u Binary files differ Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Sensors/SensorFactory.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Sensors/SensorFactory.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Sensors/SensorFactory.cs (revision 3305) @@ -0,0 +1,83 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU 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 Deltares.Standard; +using Deltares.Standard.Extensions; + +namespace Deltares.Dam.Data.Sensors +{ + public class SensorFactory + { + /// + /// Creates a unique sensor. The name and id are generated and set in the + /// context of the given sensor collection + /// + /// The sensors. + /// + internal Sensor CreateUniqueSensor(IEnumerable sensors) + { + if (sensors == null) throw new ArgumentNullException("sensors"); + + // TODO: see of these calls can be combined for performance reason + var id = sensors.GetUniqueID(x => x.ID); + + Sensor sensor = new Sensor { ID = id, Type = SensorType.PiezometricHead }; + UniqueNameProvider.ProvideUniqueName(new List(sensors), sensor); + + return sensor; + } + + /// + /// Creates a sensor location. + /// + /// The location. + /// + internal SensorLocation CreateSensorLocation(Location location) + { + return CreateSensorLocation(location, new Group()); + } + + /// + /// Creates a sensor location. + /// + /// The location. + /// The group to associate the location with + /// Should return a valid instance + internal SensorLocation CreateSensorLocation(Location location, Group group) + { + return new SensorLocation + { + Group = group, + Location = location, + SourceTypePl1WaterLevelAtRiver = DataSourceTypeSensors.LocationData, + SourceTypePl1PlLineOffsetBelowDikeToeAtPolder = DataSourceTypeSensors.LocationData, + SourceTypePl1PlLineOffsetBelowDikeTopAtPolder = DataSourceTypeSensors.LocationData, + SourceTypePl1PlLineOffsetBelowDikeTopAtRiver = DataSourceTypeSensors.LocationData, + SourceTypePl1PlLineOffsetBelowShoulderBaseInside = DataSourceTypeSensors.LocationData, + SourceTypePl1WaterLevelAtPolder = DataSourceTypeSensors.LocationData, + SourceTypePl3 = DataSourceTypeSensors.LocationData, + SourceTypePl4 = DataSourceTypeSensors.LocationData + }; + } + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/WaterBoardImporter.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/WaterBoardImporter.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/WaterBoardImporter.cs (revision 3305) @@ -0,0 +1,785 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU 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 Deltares.Standard.EventPublisher; +using Deltares.Geotechnics.GeotechnicalGeometry; +using Deltares.Geotechnics.IO; +using Deltares.Geotechnics.Soils; +using Deltares.Geotechnics.SurfaceLines; +using Deltares.Standard.Logging; + +namespace Deltares.Dam.Data +{ + using DataPlugins.Configuration; + using DataPlugins; + using Standard; + using Maps; + + public class WaterBoardImporterException : Exception + { + public WaterBoardImporterException(string message) + : base(message) + { + } + } + + /// + /// Import all data into Waterboard + /// + public class WaterBoardImporter + { + // + // Members & Properties + // + private readonly IDataPlugin importer; + + private readonly WaterBoard waterBoard = new WaterBoard(); + + private readonly DamProjectType damProjectType; + private readonly List importCsvLogMessages = new List(); + + /// + /// Gets the import CSV log messages. + /// + /// + /// The import CSV log messages. + /// + public List ImportCsvLogMessages + { + get { return importCsvLogMessages; } + } + + /// + /// Gets all dike ring ids. + /// + /// + /// All dike ring i ds. + /// + private IEnumerable AllDikeRingIDs + { + get + { + importCsvLogMessages.Clear(); + var dikeRingIdList = importer.GetDikeRingIdList().ToList(); + importCsvLogMessages.AddRange(importer.ImportLogMessages); + return dikeRingIdList; + } + } + + /// + /// Gets the data source list. + /// + /// + /// The data source list. + /// + private IEnumerable DataSourceList + { + get { return importer.DataSources; } + } + + /// + /// Gets the data folder. + /// + /// + /// The data folder. + /// + private string DataFolder + { + get { return importer.DataFolder; } + } + + /// + /// Initializes a new instance of the class. + /// + public WaterBoardImporter() + { + } + + /// + /// Initializes a new instance of the class. + /// + /// The data folder. + /// The data source container. + /// Type of the dam project. + private WaterBoardImporter(string dataFolder, DataSourceContainer dataSourceContainer, DamProjectType damProjectType) + { + this.damProjectType = damProjectType; + importer = CreateDataPlugin(dataFolder, dataSourceContainer); + importer.DamProjectType = damProjectType; + } + + /// + /// Creates the data plugin. + /// + /// The data folder. + /// The data source container. + /// + private static DataPluginImporter CreateDataPlugin(string dataFolder, DataSourceContainer dataSourceContainer) + { + var plugin = new DataPluginImporter(); + plugin.SetDataSources(dataFolder, dataSourceContainer.DataSourceList); + plugin.Attributes = dataSourceContainer.DataAttributes; + + return plugin; + } + + /// + /// Imports the dike ring ids. + /// + /// The data folder. + /// The data source container. + /// Type of the dam project. + /// The import log messages. + /// + public static IEnumerable ImportDikeRingIds( + string dataFolder, DataSourceContainer dataSourceContainer, DamProjectType damProjectType, out List importLogMessages) + { + var importer = new WaterBoardImporter(dataFolder, dataSourceContainer, damProjectType); + + var allDikeRingIds = importer.AllDikeRingIDs; + importLogMessages = new List(importer.ImportCsvLogMessages); + + return allDikeRingIds; + } + + /// + /// Imports all data. + /// + /// The data folder. + /// The data source container. + /// Type of the dam project. + /// The progress. + /// The log messages. + /// + public static WaterBoard ImportAllData(string dataFolder, + DataSourceContainer dataSourceContainer, DamProjectType damProjectType, DamEngine.Data.Standard.Calculation.ProgressDelegate progress, + out List logMessages) + { + var importer = CreateDataPlugin(dataFolder, dataSourceContainer); + var dikeRingIds = importer.GetDikeRingIdList(); + WaterBoard waterboard = ImportDataForDikeRings("", dataFolder, dataSourceContainer, + dikeRingIds, damProjectType, progress, out logMessages); + return waterboard; + } + + /// + /// Imports all data. + /// + /// The data folder. + /// The data source container. + /// Type of the dam project. + /// The progress. + /// + public static WaterBoard ImportAllData(string dataFolder, + DataSourceContainer dataSourceContainer, DamProjectType damProjectType, DamEngine.Data.Standard.Calculation.ProgressDelegate progress) + { + List dummy; + return ImportAllData(dataFolder, dataSourceContainer, damProjectType, progress, out dummy); + } + + /// + /// Imports the data for dike rings. + /// + /// The dam project folder. + /// The data folder. + /// The data source container. + /// The dike ring ids. + /// Type of the dam project. + /// The progress. + /// + public static WaterBoard ImportDataForDikeRings(string damProjectFolder, string dataFolder, + DataSourceContainer dataSourceContainer, IEnumerable dikeRingIds, + DamProjectType damProjectType, DamEngine.Data.Standard.Calculation.ProgressDelegate progress) + { + List dummy; + return ImportDataForDikeRings(damProjectFolder, dataFolder, dataSourceContainer, + dikeRingIds, damProjectType, progress, out dummy); + } + + /// + /// Imports the data for dike rings. + /// + /// The dam project folder. + /// The data folder. + /// The data source container. + /// The dike ring ids. + /// Type of the dam project. + /// The progress. + /// The log messages. + /// + public static WaterBoard ImportDataForDikeRings(string damProjectFolder, string dataFolder, + DataSourceContainer dataSourceContainer, IEnumerable dikeRingIds, + DamProjectType damProjectType, DamEngine.Data.Standard.Calculation.ProgressDelegate progress, out List logMessages) + { + var importer = new WaterBoardImporter(dataFolder, dataSourceContainer, damProjectType); + + logMessages = new List(); + WaterBoard waterBoard = new WaterBoard(); + try + { + waterBoard = importer.ImportDataForDikeRings(damProjectFolder, dikeRingIds, progress); + foreach (Dike dike in waterBoard.Dikes) + { + if (String.IsNullOrEmpty(dike.MapForSoilGeometries2D) && !String.IsNullOrEmpty(dataSourceContainer.MapSoilProfile2D)) + { + dike.MapForSoilGeometries2D = dataSourceContainer.MapSoilProfile2D; + } + } + } + catch (Exception e) + { + string errorMessage = e.Message; + Exception innerException = e.InnerException; + while (innerException != null) + { + errorMessage = errorMessage + ";" + innerException.Message; + innerException = innerException.InnerException; + } + logMessages.Add(new LogMessage(LogMessageType.FatalError, null, errorMessage)); + } + + logMessages.AddRange(importer.ImportCsvLogMessages); + + return waterBoard; + } + + /// + /// Imports the data for dike rings. + /// + /// The dam project folder. + /// The dike ring ids. + /// The progress. + /// + private WaterBoard ImportDataForDikeRings(string damProjectFolder, IEnumerable dikeRingIds, DamEngine.Data.Standard.Calculation.ProgressDelegate progress) + { + var dikeRingList = ValidateDikeRingIDs(dikeRingIds); + + importer.DamProjectFolder = damProjectFolder; + + // Import dikes + var importOk = ImportDikes(dikeRingList, progress); + + if (!importOk) return waterBoard; + + // import data for dike rings + foreach (var dikeRingId in dikeRingList) + { + // Add dikes to waterboard + var dike = ImportDataForDikeRing(dikeRingId); + waterBoard.Dikes.Add(dike); + } + + ImportBackground(); + return waterBoard; + } + + + + /// + /// Validates the dike ring i ds. + /// + /// The dike ring ids. + /// + private List ValidateDikeRingIDs(IEnumerable dikeRingIds) + { + // if no dike ring IDs specified, take all + return dikeRingIds == null + ? importer.GetDikeRingIdList().ToList() + : (dikeRingIds as List ?? dikeRingIds.ToList()); + } + + /// + /// Creates the soil base for dike. + /// + /// The dike. + private void CreateSoilBaseForDike(Dike dike) + { + // TODO: soildatabase should be created. Now we make a direct link + // must be based on dike.SoilDatabaseName + } + + /// + /// Determines the database name from data sources. + /// + /// The dike. + private void DetermineDatabaseNameFromDataSources(Dike dike) + { + var sources = DataSourceList.ToList(); + + // get the data base name from the data sources + var dataSource = + sources.FirstOrDefault(ds => ds.DataSourceType == DataSourceType.MSoilBase) ?? + sources.FirstOrDefault(ds => ds.DataSourceType == DataSourceType.CsvFiles); + + if (dataSource != null) + { + if (dataSource.DataSourceType == DataSourceType.MSoilBase) + { + dike.SoilDatabaseName = Path.Combine(DataFolder, dataSource.DataLocation); + } + else + { + var subFolder = Path.Combine(DataFolder, dataSource.DataLocation); + dike.SoilDatabaseName = Path.Combine(subFolder, "soilmaterials.mdb"); + } + } + } + + /// + /// Imports the soils. + /// + /// The dike ring identifier. + /// The dike. + private void ImportSoils(string dikeRingID, Dike dike) + { + dike.SoilList = GetSoils(dikeRingID); + DetermineDatabaseNameFromDataSources(dike); + dike.FillDataBaseSoilListFromSoilBase(); + } + + /// + /// Gets the soils. + /// + /// The dike ring identifier. + /// + private SoilList GetSoils(string dikeRingID) + { + var soilIdList = importer.GetSoilIdList(dikeRingID); + var soils = soilIdList + .Select(soilID => ImportSoil(dikeRingID, soilID)) + .ToList(); + + var aquifers = importer.GetSoilAquiferValues(dikeRingID); + var soilList = new SoilList(); + soilList.Soils = soils; + + foreach (var nameValueParameter in aquifers) + { + bool vala; + bool.TryParse(nameValueParameter.ParameterValue, out vala); + soilList.AquiferDictionary.Add(soilList.GetSoilByName(nameValueParameter.ParameterName), vala); + } + return soilList; + } + + /// + /// Imports a soil. + /// + /// The dike ring identifier. + /// The soil identifier. + /// + private Soil ImportSoil(string dikeRingID, string soilID) + { + var soil = new Soil { Name = soilID }; + var soilDetails = importer.GetSoilDetails(dikeRingID, soilID); + + foreach (var soilDetail in soilDetails) + { + SoilUtils.SetParameterFromNameValuePair(soil, soilDetail.ParameterName, soilDetail.ParameterValue); + DataSourceManager.SetSource(soil, soilDetail.ParameterName, soilDetail.Source); + } + + return soil; + } + + /// + /// Imports the data for dike ring. + /// + /// The dike ring identifier. + /// + private Dike ImportDataForDikeRing(string dikeRingId) + { + var dike = new Dike { Name = dikeRingId }; + ImportSoils(dikeRingId, dike); + + ImportSoilProfiles1D(dikeRingId, dike); + + ImportSegments(dikeRingId, dike); + + ImportSurfaceLines(dikeRingId, dike); + + ImportModelParameters(dikeRingId, dike); + + // TODO: Import PL1-lines + + ImportLocations(dikeRingId, dike); + + //ImportScenarios(importer, dikeRingId, dike, waterBoard); + ImportScenarios(dikeRingId, dike); + + // Use InvokeWithoutPublishingEvents for performance reasons after introducint SurfaceLine2 + DataEventPublisher.InvokeWithoutPublishingEvents(() => + { + var dikeCoordinateSystemConverter = new DikeCoordinateSystemConverter(); + if (dike.Locations.Count > 0) + { + dikeCoordinateSystemConverter.CreateLocalXZObjects(dike); + } + }); + + ImportCsvLogMessages.AddRange(dike.MakeDataConsistent()); + + CreateSoilBaseForDike(dike); + + DisposeImportedItem(dikeRingId); + + return dike; + } + + private void DisposeImportedItem(string dikeRingId) + { + importer.DisposeImportedItem(dikeRingId); + } + + /// + /// Imports all specified dikes. + /// + /// The dike ring ids. + /// The progress. + /// + private bool ImportDikes(IEnumerable dikeRingIds, DamEngine.Data.Standard.Calculation.ProgressDelegate progress) + { + // Import dikes + importer.ImportDataForDikeRings(dikeRingIds, progress); + + // add log messages + ImportCsvLogMessages.AddRange(importer.ImportLogMessages); + + // import is ok if no fatal messages + return ImportCsvLogMessages.All(message => message.MessageType != LogMessageType.FatalError); + } + + /// + /// Imports the background layer. + /// + private void ImportBackground() + { + var geometryFeatures = importer.MapGeometryIdList + .Select(id => importer.GetMapGeometry(id)) + .Select(Feature.Create); + + foreach (var geometry in geometryFeatures) + { + waterBoard.AddBackgroundGeometry(geometry); + } + waterBoard.FillFeatureList(); + } + + /// + /// Imports the scenarios. + /// + /// The dike ring identifier. + /// The dike. + private void ImportScenarios(string dikeRingId, Dike dike) + { + + AddScenariosToLocations(dike, dikeRingId); + + } + + /// + /// Adds the scenarios to locations. + /// + /// The dike. + /// The dike ring identifier. + private void AddScenariosToLocations(Dike dike, string dikeRingId) + { + foreach (var location in dike.Locations) + { + var scenarioList = importer.GetScenarioList(dikeRingId, location.Name); + foreach (var scenarioId in scenarioList) + { + var nameValues = + importer.GetScenarioDetails(dikeRingId, location.Name, scenarioId); + var scenario = new Scenario { LocationScenarioID = scenarioId }; + foreach (var nameValueParameter in nameValues) + { + scenario.SetParameterFromNameValuePair( + nameValueParameter.ParameterName, + nameValueParameter.ParameterValue); + } + scenario.Location = location; + location.Scenarios.Add(scenario); + } + } + } + + /// + /// Imports the locations. + /// + /// The dike ring identifier. + /// The dike. + private void ImportLocations(string dikeRingId, Dike dike) + { + var locationIdList = importer.GetLocationIdList(dikeRingId); + + foreach (string locationId in locationIdList) + { + var location = new Location + { + Name = locationId + }; + + Info locationInfo = importer.GetLocationInfo(dikeRingId, locationId); + + location.Name = locationInfo.Name; + DataSourceManager.SetSource(location, "Name", locationInfo.Source); + + location.Description = locationInfo.Description; + DataSourceManager.SetSource(location, "Description", locationInfo.Source); + + IEnumerable locationDetails = importer.GetLocationDetails(dikeRingId, locationId); + foreach (NameValueParameter locationDetail in locationDetails) + { + location.SetParameterFromNameValuePair(locationDetail.ParameterName, locationDetail.ParameterValue); + DataSourceManager.SetSource(location, locationDetail.ParameterName, locationDetail.Source); + if (locationDetail.ParameterName.Equals(LocationParameterNames.SegmentId)) + { + Segment segment = waterBoard.Segments.FirstOrDefault(x => x.Name.Equals(locationDetail.ParameterValue)); + location.Segment = segment; + } + // See comment below: the test WaterBoardImportedWithCsvFilesHasValidData using Groot Salland\Binnenwaarts proves Erik wrong + if (locationDetail.ParameterName.Equals(LocationParameterNames.SurfaceLineId)) + { + SurfaceLine2 surfaceLine = dike.SurfaceLines2.FirstOrDefault(x => x.Name.Equals(locationDetail.ParameterValue)); + location.SurfaceLine2 = surfaceLine; + } + // TODO: Assign PL1-line + } + // According to Erik Vastenburg, locations and surfacelines must match for matching pairs! So to find proper surfaceline + // for location, just search for it by name in surfacelines. SurfaceLineId can and should be removed entirely! But see above! + if (location.SurfaceLine2 == null) + { + location.SurfaceLine2 = dike.SurfaceLines2.FirstOrDefault(s => s.Name == location.Name); + } + location.SoilList = dike.SoilList; + dike.Locations.Add(location); + } + dike.SortLocations(); + } + + /// + /// Imports the model parameters. + /// + /// The dike ring identifier. + /// The dike. + private void ImportModelParameters(string dikeRingId, Dike dike) + { + var modelParameters = importer.GetDikeParameters(dikeRingId); + foreach (NameValueParameter modelParameter in modelParameters) + { + dike.SetParameterFromNameValuePair(modelParameter.ParameterName, modelParameter.ParameterValue); + DataSourceManager.SetSource(dike, modelParameter.ParameterName, modelParameter.Source); + } + } + + /// + /// Imports the surface lines. + /// + /// The dike ring identifier. + /// The dike. + private void ImportSurfaceLines(string dikeRingId, Dike dike) + { + // Use InvokeWithoutPublishingEvents for performance reasons after introducint SurfaceLine2 + DataEventPublisher.InvokeWithoutPublishingEvents(() => + { + var surfaceLineIdList = importer.GetSurfaceLineIdList(dikeRingId); + foreach (var surfaceLineId in surfaceLineIdList) + { + var surfaceLine = new SurfaceLine2 + { + Name = surfaceLineId, + Geometry = new LocalizedGeometryPointString(), + CharacteristicPoints = { GeometryMustContainPoint = true } + }; + + // load the surface line points + var surfaceLinePoints = importer.GetSurfaceLinePoints(dikeRingId, surfaceLineId); + foreach (var surfaceLinePoint in surfaceLinePoints) + { + surfaceLine.AddCharacteristicPoint(surfaceLinePoint); + } + + // load the characteristic points + var characteristicPoints = importer.GetSurfaceLineCharacteristicPoints(dikeRingId, surfaceLineId); + foreach (var cp in characteristicPoints) + { + var cpType = (CharacteristicPointType)Enum.Parse( + typeof(CharacteristicPointType), cp.Id); + surfaceLine.EnsurePointOfType(cp.X, cp.Y, cp.Z, cpType); + } + + // add the surface line to the dike + dike.SurfaceLines2.Add(surfaceLine); + } + }); + } + + /// + /// Imports the segments. + /// + /// The dike ring identifier. + /// The dike. + private void ImportSegments(string dikeRingID, Dike dike) + { + var segmentIdList = importer.GetSegmentIdList(dikeRingID); + foreach (var segmentID in segmentIdList) + { + var segment = new Segment { Name = segmentID }; + + foreach (FailureMechanismSystemType failureMechanismSystemType in Enum.GetValues(typeof(FailureMechanismSystemType))) + { + AddSoilProfiles(segment, dikeRingID, segmentID, failureMechanismSystemType, dike); + AddSoilGeometry(segment, dikeRingID, segmentID, failureMechanismSystemType); + } + + waterBoard.Segments.Add(segment); + } + } + + /// + /// Adds the soil profiles. + /// + /// The segment. + /// The dike ring identifier. + /// The segment identifier. + /// Type of the failure mechanism system. + /// The dike. + private void AddSoilProfiles(Segment segment, string dikeRingID, string segmentID, FailureMechanismSystemType failureMechanismSystemType, Dike dike) + { + var profile1DIdListForSegment = importer.GetProfile1DIdListForSegment(dikeRingID, segmentID, failureMechanismSystemType); + + foreach (var soilProfile1DId in profile1DIdListForSegment) + { + var numberFormatInfo = new NumberFormatInfo { NumberDecimalSeparator = "." }; + + // get soil profile + var soilProfile1DDetails = importer.GetSegmentProfile1DDetails(dikeRingID, segmentID, soilProfile1DId, failureMechanismSystemType); + var soilProfile1D = dike.SoilProfiles.FirstOrDefault(x => x.Name.Equals(soilProfile1DId)); + + double probability = 0; + foreach (var nameValueparameter in soilProfile1DDetails) + { + if (nameValueparameter.ParameterName.Equals("Probability")) + probability = Convert.ToDouble(nameValueparameter.ParameterValue, numberFormatInfo); + } + segment.AddSoilProfileProbability(soilProfile1D, probability, failureMechanismSystemType); + } + } + + /// + /// Adds the soil geometry. + /// + /// The segment. + /// The dike ring identifier. + /// The segment identifier. + /// Type of the failure mechanism system. + private void AddSoilGeometry(Segment segment, string dikeRingID, string segmentID, FailureMechanismSystemType failureMechanismSystemType) + { + var profile2DIdListForSegment = importer.GetProfile2DIdListForSegment(dikeRingID, segmentID, failureMechanismSystemType); + foreach (string soilGeometry2DName in profile2DIdListForSegment) + { + var numberFormatInfo = new NumberFormatInfo { NumberDecimalSeparator = "." }; + var soilProfile2DDetails = importer.GetSegmentProfile2DDetails(dikeRingID, segmentID, soilGeometry2DName, failureMechanismSystemType); + double probability = 0.0; + foreach (var nameValueparameter in soilProfile2DDetails) + { + if (nameValueparameter.ParameterName.Equals("Probability")) + probability = Convert.ToDouble(nameValueparameter.ParameterValue, numberFormatInfo); + } + segment.AddSoilGeometry2DProbability(soilGeometry2DName, probability, failureMechanismSystemType); + } + } + + /// + /// Imports the soil profiles1 d. + /// + /// The dike ring identifier. + /// The dike. + private void ImportSoilProfiles1D(string dikeRingId, Dike dike) + { + var soilProfile1DIdList = importer.GetSoilProfile1DIdList(dikeRingId); + foreach (var soilProfile1DId in soilProfile1DIdList) + { + dike.SoilProfiles.Add(ImportProfile(soilProfile1DId, dikeRingId, dike)); + } + } + + /// + /// Imports a profile. + /// + /// The soil profile1 d identifier. + /// The dike ring identifier. + /// The dike. + /// + /// + /// + private SoilProfile1D ImportProfile(string soilProfile1DId, string dikeRingId, Dike dike) + { + var soilProfile = new SoilProfile1D { Name = soilProfile1DId }; + double bottomLevel = 0.0; + + var dpSoilProfile = importer.GetSoilProfile1DDetails(dikeRingId, soilProfile1DId); + for (int layerIndex = 0; layerIndex < dpSoilProfile.Layers.Count; layerIndex++) + { + var layer = dpSoilProfile.Layers[layerIndex]; + if (layer.SoilName == SoilProfile1D.SoilProfileBottomLevelId) + { + // This is a hack to communicate the bottomlevel via a layer + bottomLevel = layer.TopLevel; + } + else + { + int soilIndex = dike.SoilList.GetSoilIndexByName(layer.SoilName); + if (soilIndex < 0) + { + throw new WaterBoardImporterException(String.Format("Soil '{0}' not found in 1d-profile '{1}'", + dpSoilProfile.Layers[layerIndex].SoilName, soilProfile1DId)); + + } + soilProfile.Layers.Add(new SoilLayer1D + { + TopLevel = layer.TopLevel, + Soil = dike.SoilList.Soils[soilIndex] + }); + + } + } + soilProfile.EnsureUniqueLayerIds(); + soilProfile.BottomLevel = bottomLevel; + if (soilProfile.LayerCount > 0) + { + soilProfile.EnsureLastLayerHasHeight(); + } + else + { + throw new WaterBoardImporterException(String.Format("Soil 1d-profile '{0}' has no layers", soilProfile.Name)); + } + + return soilProfile; + } + } +} Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/PolyLine.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/PolyLine.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/PolyLine.cs (revision 3305) @@ -0,0 +1,351 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using Deltares.Geometry; + +namespace Deltares.Dam.Data +{ + using System; + using System.Collections.Generic; + using System.Linq; + using System.Text; + + public class PolyLineException : Exception + { + public PolyLineException(string message) + : base(message) + { + } + } + + public class PolyLine where T : GeometryPoint, new() + { + protected IList points; + + public PolyLine() + { + this.points = new List(); + } + + public virtual int Id { get; private set; } + + public virtual string Name { get; set; } + + public virtual IList Points { get { return this.points; } private set { this.points = value; } } + + /// + /// Check if lines are equal + /// + /// + /// + public virtual bool Equals(PolyLine other) + { + bool isEqual = (other.Points.Count == this.Points.Count); + if (isEqual) + { + for (int pointIndex = 0; pointIndex < this.Points.Count; pointIndex++) + { + isEqual = isEqual && (this.Points[pointIndex].LocationEquals(other.Points[pointIndex])); + } + } + return isEqual; + } + + /// + /// Check if line has a minimum of two points + /// + /// + public bool Exists() + { + return (this.Points.Count > 1); + } + + /// + /// Check if all the points are in strict ascending X order + /// + /// + public bool IsXStrictAscending() + { + bool isStrictAscending = true; + for (int pointIndex = 0; pointIndex < this.Points.Count - 1; pointIndex++) + { + if (this.Points[pointIndex + 1].X <= this.Points[pointIndex].X) + { + isStrictAscending = false; + break; + } + } + return isStrictAscending; + } + + /// + /// Check if all the points are in ascending X order + /// + /// + public bool IsXAscending() + { + bool isAscending = true; + for (int pointIndex = 0; pointIndex < this.Points.Count - 1; pointIndex++) + { + if (this.Points[pointIndex + 1].X < this.Points[pointIndex].X) + { + isAscending = false; + break; + } + } + return isAscending; + } + + /// + /// Gets point at X if present within tolerance or null if not present. + /// + /// + public T GetPointAtX(double X, double tolerance) + { + return (from T point in this.points + where Math.Abs(point.X - X) < tolerance + select point).FirstOrDefault(); + } + + private T InsertPointAtX(double X) + { + T newPoint = new T(); + newPoint.X = X; + try + { + T pointAfter = (from T point in this.points + where point.X > X + select point).First(); + + this.points.Insert(this.points.IndexOf(pointAfter), newPoint); + } + catch + { + this.points.Add(newPoint); + } + return newPoint; + } + + /// + /// Gets point at X if present within tolerance; creates one there if not present. + /// + /// + public T EnsurePointAtX(double X, double tolerance) + { + T point = GetPointAtX(X, tolerance); + if (point == null) + { + point = InsertPointAtX(X); + } + return point; + } + + /// + /// If IsXStrictAscending then return the interpolated value for any X-value + /// + /// + /// + public double YFromX(double X) + { + return YZFromX(X, PointType.XY); + } + + public double ZFromX(double X) + { + return YZFromX(X, PointType.XZ); + } + + private double YZFromX(double X, PointType pointType) + { + if (!this.IsXAscending()) + { + throw new PolyLineException("Interpolation only possible with ascending polyline"); + } + + double valueYZ = 0.0; + + // Less then first X + if (X <= this.Points[0].X) + { + valueYZ = pointType == PointType.XZ ? this.Points[0].Z : this.Points[0].Y; + } + // More then last X + else if (X >= this.Points[this.Points.Count - 1].X) + { + valueYZ = pointType == PointType.XZ ? this.Points[this.Points.Count - 1].Z : this.Points[this.Points.Count - 1].Y; + } + else + { + // X is inside boundaries + for (int pointIndex = 0; pointIndex < this.Points.Count - 1; pointIndex++) + { + if ((X > this.Points[pointIndex].X) && (X <= this.Points[pointIndex + 1].X)) + { + // interpolate in this section + double fractionX = (X - this.Points[pointIndex].X) / (this.Points[pointIndex + 1].X - this.Points[pointIndex].X); + if (pointType == PointType.XZ) + valueYZ = this.Points[pointIndex].Z + fractionX * (this.Points[pointIndex + 1].Z - this.Points[pointIndex].Z); + else + valueYZ = this.Points[pointIndex].Y + fractionX * (this.Points[pointIndex + 1].Y - this.Points[pointIndex].Y); + break; + } + } + } + return valueYZ; + } + + public IList IntersectionsXAtZ(double z) + { + var intersectionsX = new List(); + + if (this.points.Count >= 2) + { //#bka: Tom is dit geen circular reference? Line staat PLLinesCreator! Die dit weer roept!? + var lineAtZ = new Deltares.Geometry.Line { BeginPoint = new GeometryPoint(this.points.First().X, 0, z), EndPoint = new GeometryPoint(this.points.Last().X, 0, z) }; + + for (int pointIndex = 0; pointIndex < this.points.Count - 1; pointIndex++) + { + var line = new Deltares.Geometry.Line { BeginPoint = this.points[pointIndex], EndPoint = this.points[pointIndex + 1] }; + + GeometryPoint intersectionPoint = new GeometryPoint(); + if (LineHelper.GetStrictIntersectionPoint(line, lineAtZ, ref intersectionPoint)) + { + intersectionsX.Add(intersectionPoint.X); + } + } + } + + return intersectionsX; + } + + public IList IntersectionPointsXzWithLineXz(Deltares.Geometry.Line line) + { + var intersectionPointsWithLine = new List(); + + if (this.points.Count >= 2) + { + for (int pointIndex = 0; pointIndex < this.points.Count - 1; pointIndex++) + { + var lineInPoly = new Deltares.Geometry.Line { BeginPoint = this.points[pointIndex], EndPoint = this.points[pointIndex + 1] }; + + GeometryPoint intersectionPoint = new GeometryPoint(); + if (LineHelper.GetStrictIntersectionPoint(lineInPoly, line, ref intersectionPoint)) + { + intersectionPointsWithLine.Add(intersectionPoint); + } + } + } + + return intersectionPointsWithLine; + } + + public override string ToString() + { + StringBuilder stringBuilder = new StringBuilder(); + + stringBuilder.Append(this.Name); + stringBuilder.Append(" ["); + foreach (T point in this.points) + { + if (this.points.IndexOf(point) > 0) + stringBuilder.Append(", "); + stringBuilder.Append(point.ToString()); + } + stringBuilder.Append("]"); + + return stringBuilder.ToString(); + } + + public virtual void CopyPoints(PolyLine polyLine) + { + foreach (T point in polyLine.Points) + { + points.Add(point); + } + } + + /// + /// Deletes the coinsiding points. + /// + /// The tolerance. + public virtual void DeleteCoinsidingPoints(double tolerance) + { + // First build a list of indices of points that have to be removed (from end of list to start) + var indicesToDelete = new List(); + for (int pointIndex = Points.Count - 1; pointIndex > 0; pointIndex--) + { + for (int i = pointIndex - 1; i >= 0; i--) + { + if (Points[pointIndex].LocationEquals(Points[i], tolerance)) + { + indicesToDelete.Add(i); + } + } + } + + // Remove duplicate points beginning from the end + for (int index = 0; index < indicesToDelete.Count; index++) + { + Points.RemoveAt(indicesToDelete[index]); + } + + } + + public virtual void DeleteCoinsidingPoints() + { + const double defaultTolerance = 0.001; + DeleteCoinsidingPoints(defaultTolerance); + } + + public virtual double MinZ() + { + if (this.Points.Count > 1) + { + double minZ = this.points.First().Z; + foreach (T point in this.points) + { + minZ = Math.Min(minZ, point.Z); + } + return minZ; + } + else + { + return 0.0; + } + } + + public virtual double MaxZ() + { + if (this.Points.Count > 1) + { + double maxZ = this.points.First().Z; + foreach (T point in this.points) + { + maxZ = Math.Max(maxZ, point.Z); + } + return maxZ; + } + else + { + return 0.0; + } + } + } +} Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/CsvExporterException.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/CsvExporterException.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/CsvExporterException.cs (revision 3305) @@ -0,0 +1,49 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU 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.Dam.Data +{ + + [Serializable] + public class CsvExporterException : Exception + { + public CsvExporterException() + { + } + + public CsvExporterException(string message) : base(message) + { + } + + public CsvExporterException(string message, Exception inner) : base(message, inner) + { + } + + protected CsvExporterException( + SerializationInfo info, + StreamingContext context) : base(info, context) + { + } + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Dike.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Dike.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Dike.cs (revision 3305) @@ -0,0 +1,526 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using Deltares.Geotechnics.Converter; +using Deltares.Geotechnics.Soils; +using Deltares.Geotechnics.SurfaceLines; +using Deltares.Geotechnics.Validation; +using Deltares.Standard.Attributes; +using Deltares.Standard.Data; +using Deltares.Standard.Language; +using Deltares.Standard.Logging; + +namespace Deltares.Dam.Data +{ + using System; + using System.Collections.Generic; + using System.IO; + using System.Linq; + using Soilbase; + using Standard; + using Geotechnics; + using System.ComponentModel; + using System.Xml.Serialization; + + using Standard.Extensions; + + public class DikeException : Exception + { + public DikeException(string message) + : base(message) + { + } + } + + public class DikeParameterNames + { + public const string MapForSoilGeometries2D = "MapForSoilGeometries2D"; + } + + [TrackChanges] + public class Dike: IVisibleEnabled, IDisposable + { + private string description = ""; + public virtual string MapForSoilGeometries2D { get; set; } + private IList locations; + + private IList pl1Lines; + private bool removeStiFiles; + private MStabShearStrength shearmodel; + private SoilList soilList; + private IList gauges = new List(); + private IList gaugePLLines = new List(); + private IList soilProfiles; + private string soilDatabaseName = ""; + private List databaseSoils = new List(); + + public Dike() + { + this.Name = "Dijkring"; + this.MapForSoilGeometries2D = ""; + + this.locations = new List(); + this.soilProfiles = new List(); + + this.surfaceLines = new DelegatedList { AddMethod = ConvertAddedOldSurfaceLineToNewFormat }; + SurfaceLines2 = new List(); + this.pl1Lines = new List(); + this.soilList = new SoilList(); + removeStiFiles = true; + } + + public bool IsRemoveStiFiles { get { return removeStiFiles; } set { removeStiFiles = value; } } + public MStabShearStrength ShearStrengthModel { get { return shearmodel; } set { shearmodel = value; } } + + public virtual string Name { get; set; } + + public virtual string SoilDatabaseName + { + get { return this.soilDatabaseName; } + set + { + this.soilDatabaseName = value; + UpdateLocationsDatabaseName(); + } + } + + /// + /// Updates the locations for scenarios. + /// + public void UpdateLocationsForScenarios() + { + foreach (Location location in this.Locations) + { + foreach (Scenario scenario in location.Scenarios) + { + scenario.Location = location; + } + } + } + + /// + /// Updates the name soil database for all locations. + /// + public void UpdateLocationsDatabaseName() + { + foreach (Location location in this.Locations) + { + location.SoildatabaseName = this.SoilDatabaseName; + } + + } + + [XmlIgnore] + public SoilbaseDB SoilBaseDB { get; set; } + + /// + /// Gets the locations. + /// + /// + /// The locations. + /// + public virtual IList Locations + { + get { return this.locations; } + private set { this.locations = value; } + } + + /// + /// Sorts the locations. + /// + public void SortLocations() + { + this.locations = this.Locations.OrderBy(o => o.Name).ToList(); + } + + public IList SurfaceLines2 { get; set; } + + public virtual IList PL1Lines + { + get { return this.pl1Lines; } + set { this.pl1Lines = value; } + } + + public virtual IList SoilProfiles + { + get { return this.soilProfiles; } + set { this.soilProfiles = value; } + } + + public virtual SoilList SoilList + { + get { return this.soilList; } + set { this.soilList = value; } + } + + [Browsable(false)] + public virtual IList Gauges + { + get { return this.gauges; } + set { this.gauges = value; } + } + + [Browsable(false)] + public virtual IList GaugePLLines + { + get { return this.gaugePLLines; } + set { this.gaugePLLines = value; } + } + + public bool UsesGauges { get { return this.GaugePLLines != null && this.GaugePLLines.Count > 0 && this.Gauges != null; } } + + public virtual List Scenarios + { + get + { + var scenarios = new List(); + foreach (Location location in Locations) + { + scenarios.AddRange(location.Scenarios); + } + return scenarios; + } + } + + public string Description + { + get { return description; } + set { description = value; } + } + + public void Validate() + { + if (Locations == null || Locations.Count < 1) + { + throw new DikeException("The dike ring has no locations defined"); + } + foreach (Location location in Locations) + { + if (location.LocalXZSurfaceLine2 != null) + { + var validator = new SurfaceLine2Validator(); + var validationResults = validator.ValidateCharacteristicPointsAreOrdered(location.LocalXZSurfaceLine2) + .Concat(validator.ValidateGeometryPointsAreOrdered(location.LocalXZSurfaceLine2)).ToArray(); + if (validationResults.Length > 0) + { + throw new SurfaceLineException(validationResults[0].Text); + } + } + } + } + + public void CreateSoilBase() + { + if (this.SoilDatabaseName == null || !File.Exists(this.SoilDatabaseName)) + { + throw new DikeException(String.Format("The soil database '{0}' cannot be found", this.SoilDatabaseName)); + } + this.SoilBaseDB = SoilbaseDB.Create(this.SoilDatabaseName); + } + + /// + /// Read all the soils and their parameters from the database + /// + public void FillDataBaseSoilListFromSoilBase() + { + using (var geoDatabase = new GeoDatabase(this.SoilDatabaseName)) + { + geoDatabase.ReUseSoils = true; + var newSoilList = geoDatabase.ReadSoils(soilList.Soils); + databaseSoils = newSoilList.Soils; + } + } + + /// + /// Add 1D-soilprofiles from MGeobase database + /// + public void AddSoilProfilesFromDB() + { + if (this.SoilDatabaseName == null || !File.Exists(this.SoilDatabaseName)) + { + throw new DikeException(String.Format("The MGeobase database '{0}' cannot be found", this.SoilDatabaseName)); + } + if (soilList.Soils.Count == 0) + { + FillDataBaseSoilListFromSoilBase(); + soilList.Soils.AddRange(databaseSoils); + } + if (soilList.Soils.Count == 0) + { + throw new DikeException(String.Format("The MGeobase database '{0}' does not contain soils and can not be used.", this.SoilDatabaseName)); + } + MGeobaseDB mgbDB = new MGeobaseDB(soilList); + IList addedSoilProfiles = mgbDB.AddSoilProfiles(this.SoilDatabaseName); + foreach (var addedSoilProfile in addedSoilProfiles) + { + soilProfiles.Add(addedSoilProfile); + } + } + + /// + /// Adapt data so it is consistent + /// + public List MakeDataConsistent() + { + var errorSoils = TryToMakeSoilDataConsistent(); + var logMessages = new List(); + // Delete all locations without surfaceline + logMessages.AddRange(DeleteLocationsWithoutSurfaceLines()); + // Delete all locations that have profiles (in their segment) which hold soils + // that are not in the soil database and so have no parameters. + logMessages.AddRange(DeleteLocationsWithProfilesWithUnknownSoils(errorSoils)); + return logMessages; + } + + /// + /// Tries to make the soil data as read for 1D profiles consistent with the data in the soil database. + /// In the end we have a neat soil list with parameters for every soil as read from the database. + /// We might have a list with errors (soils that were not to be found in the database so soils for which + /// no parameters could be found). + /// + /// + private List TryToMakeSoilDataConsistent() + { + var errorSoils = new List(); + // Fill the list of errorSoils with soils that are in the current soillist (as result of importing + // 1D profiles) but that are not found in the soil database because that are errors + foreach (var soil in soilList.Soils) + { + var fs = databaseSoils.Find(t => String.Equals(t.Name, soil.Name, StringComparison.CurrentCultureIgnoreCase)); + if (fs == null) + { + errorSoils.Add(soil); + } + } + // Remove the error soils form the list + foreach (var errorSoil in errorSoils) + { + soilList.Soils.Remove(errorSoil); + } + // Get the parameters for every soil in the now proper soil list from the database. Add soils + // that are in the database but not yet in the soil list. + foreach (Soil soil in databaseSoils) + { + Soil existingSoil = this.soilList.GetSoilByName(soil.Name); + if (existingSoil == null) + { + this.soilList.Soils.Add(soil); + } + else + { + existingSoil.Assign(soil); + } + } + return errorSoils; + } + + /// + /// Removes all locations which have profiles that have invalid soils + /// + private List DeleteLocationsWithProfilesWithUnknownSoils(List invalidSoils) + { + var logMessages = new List(); + var invalidLocations = new List(); + string soilProf; + string invSoil; + foreach (var location in locations) + { + bool isInValid; + string message = ""; + if (location.Segment == null) + { + isInValid = true; + message = String.Format(LocalizationManager.GetTranslatedText(this.GetType(), "LocationWitNameHasNoSegment"), location.Name); + } + else + { + isInValid = DoesLocationHaveInvalidSoils(invalidSoils, location, out soilProf, out invSoil); + if (isInValid) + { + message = String.Format(LocalizationManager.GetTranslatedText(this.GetType(), "LocationHasProfileWithInvalidSoils"), location.Name, soilProf, invSoil); + } + } + if (isInValid) + { + invalidLocations.Add(location); + logMessages.Add(new LogMessage(LogMessageType.Warning, this, message)); + } + } + foreach (var invalidLocation in invalidLocations) + { + + locations.Remove(invalidLocation); + } + return logMessages; + } + + /// + /// Checks wether a location (or rather the soilprofiles in the segement of the location) contains invalid soils. + /// A soil is hereby considered invalid if it is not found in the database. + /// + /// + /// + /// + /// + /// + private bool DoesLocationHaveInvalidSoils(List invalidSoils, Location location, out string soilProf, out string invSoil) + { + soilProf = " "; + invSoil = " "; + foreach (var spp in location.Segment.SoilProfileProbabilities) + { + foreach (var invalidSoil in invalidSoils) + { + var fl = spp.SoilProfile.Layers.Find(l => String.Equals(l.Soil.Name, invalidSoil.Name, StringComparison.CurrentCultureIgnoreCase)); + + if (fl != null) + { + soilProf = spp.SoilProfile.Name; + invSoil = invalidSoil.Name; + return true; + } + } + } + return false; + } + + /// + /// Delete all locations without surfacelines + /// + private List DeleteLocationsWithoutSurfaceLines() + { + var logMessages = new List(); + + //Add all locations with valid surfaceline + var newLocations = new List(); + newLocations.AddRange(this.Locations.Where(loc => loc.SurfaceLine2 != null)); + + // Report which locations are not added because no valid surfaceline is found + var deletedLocations = new List(); + deletedLocations.AddRange(this.Locations.Where(loc => loc.SurfaceLine2 == null)); + foreach (var deletedLocation in deletedLocations) + { + var locationHasNoSurfaceLine = LocalizationManager.GetTranslatedText(this.GetType(), "LocationHasNoSurfaceLine"); + logMessages.Add(new LogMessage(LogMessageType.Warning, this, + String.Format(locationHasNoSurfaceLine, deletedLocation.Name))); + } + + this.Locations = newLocations; + return logMessages; + } + + public override string ToString() + { + return this.Name; + } + + public Dictionary GetParametersAsNameValuePairs() + { + var nameValuePairs = new Dictionary(); + nameValuePairs.Add(DikeParameterNames.MapForSoilGeometries2D, MapForSoilGeometries2D); + return nameValuePairs; + } + + public void SetParameterFromNameValuePair(string parameterName, string parameterValue) + { + if (parameterName.Equals(DikeParameterNames.MapForSoilGeometries2D)) + this.MapForSoilGeometries2D = parameterValue; + } + + public void UpdateLocation(Location location) + { + location.SoildatabaseName = this.SoilDatabaseName; + location.SoilList = this.SoilList; + location.MapForSoilGeometries2D = this.MapForSoilGeometries2D; + + location.Gauges.Clear(); + location.Gauges.AddRange(this.Gauges); + + location.GaugePLLines.Clear(); + location.GaugePLLines.AddRange(this.GaugePLLines); + } + + public bool IsVisible(string property) + { + return true; + } + + public bool IsEnabled(string property) + { + switch (property) + { + case "Name": return false; + case "SoilList": return false; + default: return true; + } + } + + #region Backwards compatibility + + private IList surfaceLines; + + /// + /// Gets or sets all surface lines instances associated with this dike. + /// + /// Composite owner of all that are part of the + /// application that are associated with this dike. + [Obsolete("Do not use this member; Only exists for backwards compatibility.", true)] + public virtual IList SurfaceLines + { + get { return surfaceLines; } + set { surfaceLines = value; } + } + + /// + /// Performs backwards compatibility conversion from old-style surfaceline to new-style + /// surfaceline, and ensures that shared references are set correctly. + /// + /// Persisted version of the old-style surfaceline. + private void ConvertAddedOldSurfaceLineToNewFormat(SurfaceLine argument) + { + var surfaceLine2 = new OldSurfaceLineToNewConverter().Convert(argument); + SurfaceLines2.Add(surfaceLine2); + + foreach (var location in Locations) + { + location.SetNewSurfaceLineIfMatchesWithOldPersistedSurfaceLine(surfaceLine2); + } + + // Remove old entry; it is no longer required. + surfaceLines.Remove(argument); + argument.Dispose(); + } + + #endregion + + public void Dispose() + { + foreach (var location in Locations) + { + location.Dispose(); + } + foreach (var surfaceLine2 in SurfaceLines2) + { + surfaceLine2.Dispose(); + } + } + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Sensors/Specifications/DitchWaterLevelSensorSpecification.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Sensors/Specifications/DitchWaterLevelSensorSpecification.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Sensors/Specifications/DitchWaterLevelSensorSpecification.cs (revision 3305) @@ -0,0 +1,46 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using Deltares.Standard.Specifications; + +namespace Deltares.Dam.Data.Sensors.Specifications +{ + internal class DitchWaterLevelSensorSpecification : PredicateSpecification + { + private readonly double xDitchDikeSide; + private readonly double xDitchPolderSide; + + public DitchWaterLevelSensorSpecification(double xDitchDikeSide, double xDitchPolderSide) : + base(s => s.Type == SensorType.PolderLevel) + { + this.xDitchDikeSide = xDitchDikeSide; + this.xDitchPolderSide = xDitchPolderSide; + } + + public override bool IsSatisfiedBy(Sensor candidate) + { + if (base.IsSatisfiedBy(candidate)) + return true; + + return candidate.RelativeLocation > xDitchDikeSide && candidate.RelativeLocation < xDitchPolderSide; + } + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DataPlugins/IDataPlugin.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DataPlugins/IDataPlugin.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DataPlugins/IDataPlugin.cs (revision 3305) @@ -0,0 +1,133 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using Deltares.Dam.Data.DataPlugins.Configuration; +using Deltares.Geometry; +using Deltares.Standard; +using System.Collections.Generic; +using Deltares.Standard.Logging; + +namespace Deltares.Dam.Data.DataPlugins +{ + public struct Info + { + public string Name; + public string Description; + public DataSourceSystemType Source; + } + + public struct NameValueParameter + { + public string ParameterName; + public string ParameterValue; + public DataSourceSystemType Source; + } + + public struct DpCharacteristicPoint + { + public string Id; + public double X; + public double Y; + public double Z; + } + + public struct DpLayer + { + public double TopLevel; + public string SoilName; + } + + public struct DpSoilProfile + { + public List Layers; + } + + + interface IDataPlugin + { + IEnumerable DataSources { get; } + + IEnumerable MapGeometryIdList { get; } + + Info WaterBoardInfo { get; } + + string DataFolder { get; } + string DamProjectFolder { get; set; } + List ImportLogMessages { get; } + DamProjectType DamProjectType { set; } + + void SetDataSources(string dataFolder, IEnumerable dataSources); + + IEnumerable GetDikeRingIdList(); + + void ImportDataForDikeRings(IEnumerable dikeRingIds, + DamEngine.Data.Standard.Calculation.ProgressDelegate progress); + + Info GetDikeRingInfo(string dikeRingId); + + IEnumerable GetDikeParameters(string dikeRingId); + + IEnumerable GetLocationIdList(string dikeRingId); + + Info GetLocationInfo(string dikeRingId, string locationId); + + IEnumerable GetLocationDetails(string dikeRingId, string locationId); + + IEnumerable GetSurfaceLineIdList(string dikeRingId); + + IList GetSurfaceLinePoints(string dikeRingId, string surfaceLineId); + + IEnumerable GetSurfaceLineCharacteristicPoints(string dikeRingId, string surfaceLineId); + + IEnumerable GetSegmentIdList(string dikeRingId); + + IEnumerable GetProfile1DIdListForSegment(string dikeRingId, string segmentId, FailureMechanismSystemType segmentFailureMechanismType); + + IEnumerable GetProfile2DIdListForSegment(string dikeRingId, string segmentId, FailureMechanismSystemType segmentFailureMechanismType); + + IEnumerable GetSegmentProfile1DDetails(string dikeRingId, string segmentId, string profileId, FailureMechanismSystemType failureMechanismSystemType); + + IEnumerable GetSegmentProfile2DDetails(string dikeRingId, string segmentId, string profileId, FailureMechanismSystemType failureMechanismSystemType); + + IEnumerable GetSoilProfile1DIdList(string dikeRingId); + + DpSoilProfile GetSoilProfile1DDetails(string dikeRingId, string soilProfile1DId); + + IEnumerable GetSoilProfile2DIdList(string dikeRingId); + + string GetSoilProfile2DDetails(string dikeRingId, string soilProfile2DId); + + IEnumerable GetSoilIdList(string dikeRingId); + + IEnumerable GetSoilAquiferValues(string dikeRingId); + + IEnumerable GetSoilDetails(string dikeRingId, string soilId); + + string GetMapGeometry(string mapGeometryId); + + IEnumerable GetMapGeometryAttributes(string mapGeometryId); + + IEnumerable GetScenarioList(string dikeRingId, string name); + IEnumerable GetScenarioDetails(string dikeRingId, string name, string scenarioId); + + void DisposeImportedItem(string dikeRingId); + } +} Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DamEngineIo/FillXmlOutputFromDamUi.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DamEngineIo/FillXmlOutputFromDamUi.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DamEngineIo/FillXmlOutputFromDamUi.cs (revision 3305) @@ -0,0 +1,123 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System.Collections.Generic; +using Deltares.DamEngine.Io.XmlOutput; + +namespace Deltares.Dam.Data.DamEngineIo +{ + /// + /// + /// + public class FillXmlOutputFromDamUi + { + /// + /// Class to fill the output xml based on the results in DamProjectData + /// + public static Output CreateOutput(DamProjectData damProjectData) + { + var output = new Output(); + output.Results = new OutputResults(); + output.Results.CalculationMessages = new Message[damProjectData.CalculationMessages.Count]; + TransferOutputCalculationMessages(damProjectData.CalculationMessages, output.Results); + if (damProjectData.OutputTimeSerieCollection != null) + { + output.Results.OperationalOutputTimeSeries = new DamEngine.Io.XmlOutput.TimeSerie[damProjectData.OutputTimeSerieCollection.Series.Count]; + TransferOutputTimeSeries(damProjectData.OutputTimeSerieCollection, output.Results.OperationalOutputTimeSeries); + } + return output; + } + + private static void TransferOutputTimeSeries(TimeSerieCollection outputTimeSerieCollection, DamEngine.Io.XmlOutput.TimeSerie[] outputTimeSeries) + { + int timeSerieIndex = 0; + foreach (var damTimeSerie in outputTimeSerieCollection.Series) + { + var outputTimeSerie = new DamEngine.Io.XmlOutput.TimeSerie(); + outputTimeSerie.Entries = new TimeSerieEntries(); + outputTimeSerie.Entries.TimeSerieEntry = new TimeSerieEntriesTimeSerieEntry[damTimeSerie.Entries.Count]; + outputTimeSerie.TimeStep = new TimeSerieTimeStep(); + outputTimeSerie.LocationId = damTimeSerie.LocationId; + outputTimeSerie.ParameterId = damTimeSerie.ParameterId; + outputTimeSerie.ForecastDateTime = damTimeSerie.ForecastDateTime; + outputTimeSerie.Type = damTimeSerie.Type; + outputTimeSerie.StartDateTime = damTimeSerie.StartDateTime; + outputTimeSerie.EndDateTime = damTimeSerie.EndDateTime; + outputTimeSerie.MissVal = damTimeSerie.MissVal; + outputTimeSerie.LongName = damTimeSerie.LongName; + outputTimeSerie.StationName = damTimeSerie.StationName; + outputTimeSerie.Units = damTimeSerie.Units; + outputTimeSerie.SourceOrganisation = damTimeSerie.SourceOrganisation; + outputTimeSerie.SourceSystem = damTimeSerie.SourceSystem; + outputTimeSerie.FileDescription = damTimeSerie.FileDescription; + outputTimeSerie.Region = damTimeSerie.Region; + outputTimeSerie.TimeStep.Multiplier = damTimeSerie.TimeStep.Multiplier; + outputTimeSerie.TimeStep.Divider = damTimeSerie.TimeStep.Divider; + outputTimeSerie.TimeStep.MultiplierSpecified1 = damTimeSerie.TimeStep.MultiplierSpecified; + outputTimeSerie.TimeStep.DividerSpecified1 = damTimeSerie.TimeStep.DividerSpecified; + outputTimeSerie.TimeStep.TimeStepUnit = ConversionHelper.ConvertToInputTimeStepUnit(damTimeSerie.TimeStep.Unit); + int timeSerieEntryIndex = 0; + foreach (var timestepEntry in damTimeSerie.Entries) + { + TimeSerieEntriesTimeSerieEntryStochastValue stochastValue = null; + if (timestepEntry.StochastValue != null) + { + stochastValue = new TimeSerieEntriesTimeSerieEntryStochastValue() + { + Distribution = timestepEntry.StochastValue.Distribution, + Mean = timestepEntry.StochastValue.Mean, + StandardDeviation = timestepEntry.StochastValue.StandardDeviation + }; + } + TimeSerieEntriesTimeSerieEntry timeStep = new TimeSerieEntriesTimeSerieEntry() + { + DateTime = timestepEntry.DateTime, + Value = timestepEntry.Value, + BasisFileNameWMF = timestepEntry.BasisFileName, + Flagnietechtgebruikt = timestepEntry.Flag, + RelativeCalculationPathName = timestepEntry.RelativeCalculationPathName, + StochastValue = stochastValue + }; + outputTimeSerie.Entries.TimeSerieEntry[timeSerieEntryIndex] = timeStep; + timeSerieEntryIndex++; + } + outputTimeSeries[timeSerieIndex] = outputTimeSerie; + timeSerieIndex++; + } + } + + private static void TransferOutputCalculationMessages(List calculationMessages, OutputResults outputResults) + { + //var calculationMessages = damProjectData.CalculationMessages; + if (calculationMessages != null) + { + outputResults.CalculationMessages = new Message[calculationMessages.Count]; + for (int i = 0; i < calculationMessages.Count; i++) + { + var message = new Message(); + message.MessageType = ConversionHelper.ConvertToInputMessageType(calculationMessages[i].MessageType); + message.Message1 = calculationMessages[i].Message; + outputResults.CalculationMessages[i] = message; + } + } + } + } +} Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Deltares.Dam.Data.csproj =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Deltares.Dam.Data.csproj (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Deltares.Dam.Data.csproj (revision 3305) @@ -0,0 +1,473 @@ + + + + Debug + x86 + 9.0.30729 + 2.0 + {F1CD9620-15CF-41F8-AF70-5AE004A50F60} + Library + Properties + Deltares.Dam.Data + Deltares.Dam.Data + v4.5 + 512 + + + 3.5 + + + 0 + ..\..\ + true + + + true + ..\..\bin\Debug\ + DEBUG;TRACE + full + x86 + prompt + true + true + False + False + True + False + False + False + True + True + False + False + False + True + True + False + False + False + True + False + True + True + False + False + + + + + + + + True + False + Full + DoNotBuild + 0 + false + + + ..\..\bin\Release\ + TRACE + true + pdbonly + x86 + prompt + true + true + false + + + + False + ..\..\..\lib\Authorization\x86\Deltares.Authorization.dll + + + False + ..\..\..\lib\DamEngine\Deltares.DamEngine.Data.dll + + + False + ..\..\..\lib\DamEngine\Deltares.DamEngine.Io.dll + + + ..\..\..\lib\DSL-Geographic\Deltares.Geographic.dll + + + ..\..\..\lib\DSL-Geo\Deltares.Geometry.dll + + + ..\..\..\lib\DSL-Geo\Deltares.Geotechnics.dll + + + False + ..\..\..\lib\DSL-GeoIO\Deltares.Geotechnics.IO.dll + + + False + ..\..\..\lib\DSL-Core\Deltares.Mathematics.dll + + + False + ..\..\..\lib\DSL-GeoIO\Deltares.Soilbase.dll + + + False + ..\..\..\lib\DSL-Core\Deltares.Standard.dll + + + False + ..\..\..\lib\DotSpatial\DotSpatial.Data.dll + + + False + ..\..\..\lib\DotSpatial\DotSpatial.Projections.dll + + + False + ..\..\..\lib\DotSpatial\DotSpatial.Topology.dll + + + ..\..\packages\GeoAPI.1.7.1.1\lib\net403-client\GeoAPI.dll + True + + + ..\..\packages\log4net.2.0.3\lib\net40-full\log4net.dll + True + + + ..\..\packages\LumenWorks.Framework.IO.3.8.0\lib\net20\LumenWorks.Framework.IO.dll + True + + + ..\..\packages\NetTopologySuite.1.13.1\lib\net403-client\NetTopologySuite.dll + True + + + ..\..\packages\NetTopologySuite.1.13.1\lib\net403-client\PowerCollections.dll + True + + + + + 3.5 + + + + 3.5 + + + 3.5 + + + + + 3.0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Code + + + + + + + + + + + + + + + + + True + True + Resources.resx + + + True + True + Settings.settings + + + + + + + + + + + + + + + + + + + + + SoilProfileDataSet.xsd + + + SoilProfileDataSet.cs + + + True + True + SoilProfileDataSet.xsd + + + + + Copying.GPL.licenseheader + + + Designer + + + + + Designer + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + + + + + + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + + + DGeoStability.exe + PreserveNewest + + + DGSMStabDAM.dll + PreserveNewest + + + MPipingCalc2.dll + PreserveNewest + + + PreserveNewest + + + Designer + + + SoilbaseDataSet.xsd + + + Designer + + + SoilbaseDataSet.xsd + + + SoilProfileDataSet.xsd + + + MSDataSetGenerator + SoilProfileDataSet1.Designer.cs + Designer + + + SoilProfileDataSet.xsd + + + Designer + + + + + {17F76A8E-C9F4-415F-8D4B-0E8A3B36E665} + Deltares.Maps + + + + + + + + + + + This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + + + + + \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Specifications/NotEmptySpecification.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Specifications/NotEmptySpecification.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Specifications/NotEmptySpecification.cs (revision 3305) @@ -0,0 +1,39 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +namespace Deltares.Standard.Specifications +{ + /// + /// Checks if the candidate is not empty null or contians only whitespace + /// + public class NotEmptySpecification : SpecificationBase + { + public NotEmptySpecification() + { + Name = "Not empty specification"; + Description = "The candidate should have a value. It is not allowed to be null, empty or a string that contains white spaces only"; + } + public override bool IsSatisfiedBy(string candidate) + { + return !string.IsNullOrWhiteSpace(candidate); + } + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/CsvImporters/csvImporterException.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/CsvImporters/csvImporterException.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/CsvImporters/csvImporterException.cs (revision 3305) @@ -0,0 +1,35 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU 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; + +namespace Deltares.Dam.Data.CsvImporters +{ + /// + /// Exception class for CsvImporter + /// + public class CsvImporterException : Exception + { + public CsvImporterException(string message): base(message) + { + } + } +} Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/IAssignable.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/IAssignable.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/IAssignable.cs (revision 3305) @@ -0,0 +1,31 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU 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.Dam.Data +{ + [ComVisible(true)] + public interface IAssignable + { + void Assign(T t); + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/packages.config =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/packages.config (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/packages.config (revision 3305) @@ -0,0 +1,29 @@ + + + + + + + + \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/CsvImporters/CsvImporter.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/CsvImporters/CsvImporter.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/CsvImporters/CsvImporter.cs (revision 3305) @@ -0,0 +1,324 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU 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.IO; +using Deltares.Standard.Logging; + +namespace Deltares.Dam.Data.CsvImporters +{ + public class CsvImporter + { + private string folderName; + private const string FileExtension = "csv"; + private const string FilePattern = "{0}\\{1}." + FileExtension; + + private string locationsFileNamePart = "locations"; + private string segmentsFileNamePart = "segments"; + private string soilProfilesFileNamePart = "soilprofiles"; + private string surfaceLinesFileNamePart = "surfacelines"; + private string characteristicPointFileNamePart = "characteristicpoints"; + private string ScenariosFileNamePart = "scenarios"; + + + private List errorMessages = new List(); + private List locationRecords = new List(); + private List segmentRecords = new List(); + private List characteristicPointsRecords = new List(); + private List soilProfilesRecords = new List(); + private List surfaceLinesRecords = new List(); + private List scenariosRecords = new List(); + + private string ImportFolderLocation + { + get { return folderName != null && folderName.EndsWith("\\") ? folderName.Substring(0, folderName.Length - 1) : folderName; } + } + + private string LocationsFileName + { + get { return string.Format(FilePattern, ImportFolderLocation, locationsFileNamePart); } + } + + private string SegmentsFileName + { + get { return string.Format(FilePattern, ImportFolderLocation, segmentsFileNamePart); } + } + + private string SoilProfilesFileName + { + get { return string.Format(FilePattern, ImportFolderLocation, soilProfilesFileNamePart); } + } + + private string SurfaceLinesFileName + { + get { return string.Format(FilePattern, ImportFolderLocation, surfaceLinesFileNamePart); } + } + + private string CharacteristicPointsFileName + { + get { return string.Format(FilePattern, ImportFolderLocation, characteristicPointFileNamePart); } + } + + private string ScenariosFileName + { + get { return string.Format(FilePattern, ImportFolderLocation, ScenariosFileNamePart); } + } + + + public List ErrorMessages + { + get { return errorMessages; } + set { errorMessages = value; } + } + + public List LocationRecords + { + get { return locationRecords; } + set { locationRecords = value; } + } + + public List SegmentRecords + { + get { return segmentRecords; } + } + + public List CharacteristicPointsRecords + { + get { return characteristicPointsRecords; } + } + + public List SoilProfilesRecords + { + get { return soilProfilesRecords; } + } + + public List SurfaceLinesRecords + { + get { return surfaceLinesRecords; } + } + + public List ScenariosRecords + { + get { return scenariosRecords; } + } + + /// + /// Imports the locations. + /// + /// Name of the file. + private void ImportLocations(string fileName) + { + // Locations are optional, so check if the locations are available before trying to import + if (File.Exists(fileName)) + { + try + { + var csvImporterLocations = new CsvImporterLocations(fileName); + locationRecords = csvImporterLocations.ImportedItems; + foreach (var errorMessage in csvImporterLocations.ErrorMessages) + { + LogMessage logmessage = new LogMessage(LogMessageType.Error, this, errorMessage); + errorMessages.Add(logmessage); + } + } + catch (CsvImporterSegmentsException e) + { + LogMessage logmessage = new LogMessage(LogMessageType.FatalError, this, e.Message); + errorMessages.Add(logmessage); + } + + } + } + + /// + /// Imports the segments. + /// + /// Name of the file. + private void ImportSegments(string fileName) + { + try + { + CsvImporterSegments csvImporterSegments = new CsvImporterSegments(fileName); + segmentRecords = csvImporterSegments.ImportedItems; + foreach (var errorMessage in csvImporterSegments.ErrorMessages) + { + LogMessage logmessage = new LogMessage(LogMessageType.Error, this, errorMessage); + errorMessages.Add(logmessage); + } + } + catch (CsvImporterSegmentsException e) + { + LogMessage logmessage = new LogMessage(LogMessageType.FatalError, this, e.Message); + errorMessages.Add(logmessage); + } + + } + + /// + /// Imports the characteristic points. + /// + /// Name of the file. + private void ImportCharacteristicPoints(string fileName) + { + try + { + CsvImporterCharacteristicPoints csvImporterCharacteristicPoints = new CsvImporterCharacteristicPoints(fileName); + characteristicPointsRecords = csvImporterCharacteristicPoints.ImportedItems; + foreach (var errorMessage in csvImporterCharacteristicPoints.ErrorMessages) + { + LogMessage logmessage = new LogMessage(LogMessageType.Error, this, errorMessage); + errorMessages.Add(logmessage); + } + } + catch (CsvImporterCharacteristicPointsException e) + { + LogMessage logmessage = new LogMessage(LogMessageType.FatalError, this, e.Message); + errorMessages.Add(logmessage); + } + } + + /// + /// Imports the soil profiles. + /// + /// Name of the file. + private void ImportSoilProfiles(string fileName) + { + // 1D Soilprofiles are not mandatory. The project can use 2D-geometries + if (File.Exists(fileName)) + { + try + { + CsvImporterSoilProfiles csvImporterSoilProfiles = new CsvImporterSoilProfiles(fileName); + soilProfilesRecords = csvImporterSoilProfiles.ImportedItems; + foreach (var errorMessage in csvImporterSoilProfiles.ErrorMessages) + { + LogMessage logmessage = new LogMessage(LogMessageType.Error, this, errorMessage); + errorMessages.Add(logmessage); + } + } + catch (CsvImporterSoilProfilesException e) + { + LogMessage logmessage = new LogMessage(LogMessageType.FatalError, this, e.Message); + errorMessages.Add(logmessage); + } + } + } + + /// + /// Imports the surface lines. + /// + /// Name of the file. + private void ImportSurfaceLines(string fileName) + { + try + { + CsvImporterSurfaceLines csvImporterSurfaceLines = new CsvImporterSurfaceLines(fileName); + surfaceLinesRecords = csvImporterSurfaceLines.ImportedItems; + foreach (var errorMessage in csvImporterSurfaceLines.ErrorMessages) + { + LogMessage logmessage = new LogMessage(LogMessageType.Error, this, errorMessage); + errorMessages.Add(logmessage); + } + } + catch (CsvImporterSurfaceLinesException e) + { + LogMessage logmessage = new LogMessage(LogMessageType.FatalError, this, e.Message); + errorMessages.Add(logmessage); + } + } + + /// + /// Imports the scenarios. + /// + /// Name of the file. + private void ImportScenarios(string fileName) + { + try + { + var csvImporterScenarios = new CsvImporterScenarios(fileName); + scenariosRecords = csvImporterScenarios.ImportedItems; + foreach (var errorMessage in csvImporterScenarios.ErrorMessages) + { + var logmessage = new LogMessage(LogMessageType.Error, this, errorMessage); + errorMessages.Add(logmessage); + } + } + catch (CsvImporterScenariosException e) + { + var logmessage = new LogMessage(LogMessageType.FatalError, this, e.Message); + errorMessages.Add(logmessage); + } + catch(Exception e) + { + var logmessage = new LogMessage(LogMessageType.FatalError, this, e.Message); + errorMessages.Add(logmessage); + } + } + + /// + /// Imports the CSV data from directory. + /// + /// The CSV dir. + /// if set to true [is import only locations]. + /// The progress. + /// Type of the dam project. + public void ImportCsvDataFromDirectory(string csvDir, bool isImportOnlyLocations, + DamEngine.Data.Standard.Calculation.ProgressDelegate progress, DamProjectType damProjectType) + { + folderName = csvDir; + if (progress != null) progress(0.03); + ImportLocations(LocationsFileName); + if (!isImportOnlyLocations) + { + if (progress != null) progress(0.08); + ImportSegments(SegmentsFileName); + if (progress != null) progress(0.12); + ImportCharacteristicPoints(CharacteristicPointsFileName); + if (progress != null) progress(0.16); + ImportSoilProfiles(SoilProfilesFileName); + if (progress != null) progress(0.2); + ImportSurfaceLines(SurfaceLinesFileName); + // Scenario file is required for design projects and optional for the rest + if (damProjectType == DamProjectType.Design) + { + if (progress != null) progress(0.25); + ImportScenarios(ScenariosFileName); + } + else + { + if (File.Exists(ScenariosFileName)) + { + if (progress != null) progress(0.25); + ImportScenarios(ScenariosFileName); + } + } + if (progress != null) progress(0.30); + } + } + + public override string ToString() + { + return "CsvImporter"; + } + + } +} Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Sensors/Specifications/WaterLevelSensorSpecification.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Sensors/Specifications/WaterLevelSensorSpecification.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Sensors/Specifications/WaterLevelSensorSpecification.cs (revision 3305) @@ -0,0 +1,34 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using Deltares.Standard.Specifications; + +namespace Deltares.Dam.Data.Sensors.Specifications +{ + internal class WaterLevelSensorSpecification : PredicateSpecification + { + public WaterLevelSensorSpecification() : + base(s => s.Type == SensorType.WaterLevel) + { + } + } + +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/Test/Domain/FeatureRepositoryTest.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/Test/Domain/FeatureRepositoryTest.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/Test/Domain/FeatureRepositoryTest.cs (revision 3305) @@ -0,0 +1,64 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of the application DAM - UI. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU 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 NUnit.Framework; + +namespace Deltares.Maps.Tests.Domain +{ + [TestFixture] + public class FeatureRepositoryTest + { + private IFeatureRepository repository; + + #region Setup + + [TestFixtureSetUp] + public void FixtureSetup() + { + } + + [TestFixtureTearDown] + public void FixtureTearDown() + { + } + + [SetUp] + public void TestSetup() + { + repository = new FeatureRepository(); + } + + [TearDown] + public void TestTearDown() + { + } + + #endregion + + /// + /// TODO: make tests + /// + [Test] + public void TestMethod() + { + } + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/IntersectionResult.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/IntersectionResult.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/IntersectionResult.cs (revision 3305) @@ -0,0 +1,34 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System.Collections.Generic; + +using GeoAPI.Geometries; + +namespace Deltares.Maps +{ + public class IntersectionResult + { + public IFeature Source { get; set; } + public IFeature Target { get; set; } + public IEnumerable IntersectionPoints { get; set; } + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/CsvImporters/CsvImporterLocations.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/CsvImporters/CsvImporterLocations.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/CsvImporters/CsvImporterLocations.cs (revision 3305) @@ -0,0 +1,566 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU 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.IO; +using System.Linq; +using System.Threading; +using Deltares.Dam.Data.Importers; +using Deltares.Standard.IO; +using Deltares.Standard.Language; +using LumenWorks.Framework.IO.Csv; + +namespace Deltares.Dam.Data.CsvImporters +{ + public class CsvImporterLocations + { + private List locationRecords = new List(); + private List errorMessages = new List(); + + public class LocationRecord + { + public int LocationRecordId { get; set; } + public string LocationId { get; set; } + public string SurfaceLineId { get; set; } + public string SegmentId { get; set; } + + public string DikeRingId { get; set; } + public double? GeoX { get; set; } + public double? GeoY { get; set; } + public double? XSoilGeometry2DOrigin { get; set; } + public double? PolderLevel { get; set; } + public double? HeadPl2 { get; set; } + public double? HeadPl3 { get; set; } + public double? HeadPl4 { get; set; } + public string DikeEmbankmentMaterial { get; set; } + public string ShoulderEmbankmentMaterial { get; set; } + public double? PenetrationLength { get; set; } + public double? TrafficLoad { get; set; } + public double? TL_DegreeOfConsolidation { get; set; } + public double? MinimalCircleDepth { get; set; } + public double? DampingFactorPl3 { get; set; } + public double? DampingFactorPl4 { get; set; } + public PLLineCreationMethod? PLLineCreationMethod { get; set; } + public double? RequiredSafetyFactorPiping { get; set; } + public double? RequiredSafetyFactorStabilityInnerSlope { get; set; } + public double? RequiredSafetyFactorStabilityOuterSlope { get; set; } + public double? UpliftCriterionPiping { get; set; } + public double? UpliftCriterionStability { get; set; } + public double? DistanceToEntryPoint { get; set; } + public double? PlLineOffsetBelowDikeTopAtRiver { get; set; } + public double? PlLineOffsetBelowDikeTopAtPolder { get; set; } + public double? PlLineOffsetBelowShoulderBaseInside { get; set; } + public double? PlLineOffsetBelowDikeToeAtPolder { get; set; } + public double? PlLineOffsetBelowDikeCrestMiddle { get; set; } + public double? PlLineOffsetFactorBelowShoulderCrest { get; set; } + public bool? UsePlLineOffsetBelowDikeCrestMiddle { get; set; } + public bool? UsePlLineOffsetFactorBelowShoulderCrest { get; set; } + + public IntrusionVerticalWaterPressureType? IntrusionVerticalWaterPressure; + public double? StabilityShoulderGrowSlope { get; set; } + public double? StabilityShoulderGrowDeltaX { get; set; } + public double? StabilitySlopeAdaptionDeltaX { get; set; } + public double? SlopeDampingPiezometricHeightPolderSide { get; set; } + public StabilityDesignMethod? StabilityDesignMethod { get; set; } + public MStabZonesType? StabilityZoneType { get; set; } + public double? ForbiddenZoneFactor { get; set; } + public double? ZoneAreaRestSlopeCrestWidth { get; set; } + public double? SlopeAdaptionStartCotangent { get; set; } + public double? SlopeAdaptionEndCotangent { get; set; } + public double? SlopeAdaptionStepCotangent { get; set; } + public double? NewDikeTopWidth { get; set; } + public bool? UseNewDikeTopWidth { get; set; } + public double? NewDikeSlopeInside { get; set; } + public bool? UseNewDikeSlopeInside { get; set; } + public double? NewDikeSlopeOutside { get; set; } + public bool? UseNewDikeSlopeOutside { get; set; } + public double? NewShoulderTopSlope { get; set; } + public bool? UseNewShoulderTopSlope { get; set; } + public double? NewShoulderBaseSlope { get; set; } + public bool? UseNewShoulderBaseSlope { get; set; } + public double? NewMaxHeightShoulderAsFraction { get; set; } + public bool? UseNewMaxHeightShoulderAsFraction { get; set; } + public double? NewMinDistanceDikeToeStartDitch { get; set; } + public bool? UseNewMinDistanceDikeToeStartDitch { get; set; } + public bool? UseNewDitchDefinition { get; set; } + public double? NewWidthDitchBottom { get; set; } + public double? NewSlopeAngleDitch { get; set; } + public double? NewDepthDitch { get; set; } + public double? DikeTableHeight { get; set; } + public double? RiverLevel { get; set; } + public double? RiverLevelLow { get; set; } + } + + public CsvImporterLocations(string fileName) + { + errorMessages.Clear(); + ThrowHelper.ThrowIfStringArgumentNullOrEmpty(fileName, StringResourceNames.CsvFileNotValid); + ThrowHelper.ThrowIfFileNotExist(fileName, StringResourceNames.CsvFileNotFound); + + + var oldcur = Thread.CurrentThread.CurrentCulture; + try + { + Thread.CurrentThread.CurrentCulture = CsvReaderUtilities.DetermineCultureForFile(fileName); + using (var csv = new CsvReader(new StreamReader(fileName), true, ';')) + { + string[] headers = CsvImporterHelper.GetFieldHeaders(this, csv); + if (headers.Count() < 3) + { + var csvHeaderError = LocalizationManager.GetTranslatedText(this.GetType(), "csvHeaderError"); + throw new CsvImporterSegmentsException(String.Format("{0} : {1}", fileName, csvHeaderError)); + } + + int colIndexLocationId = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.LocationColumnName); + int colIndexSurfacelineId = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.SurfaceLineColumnName); + int colIndexSegmentId = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.SegmentColumnName); + int colIndexDikeRingId = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.DikeRingColumnName); + int colIndexGeoX = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.XValueColumnName); + int colIndexGeoY = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.YValueColumnName); + int colIndexXSoilgeometry2DOrigin = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.XSoilGeometry2DOriginColumnName); + int colIndexPolderlevel = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.PolderLevelColumnName); + int colIndexHeadPl2 = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.HeadPl2ColumnName); + int colIndexHeadPl3 = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.HeadPl3ColumnName); + int colIndexHeadPl4 = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.HeadPl4ColumnName); + int colIndexOphoogmateriaaldijk = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.DikeEmbankmentMaterialColumnName); + int colIndexOphoogmateriaalberm = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.ShoulderEmbankmentMaterialColumnName); + int colIndexPenetrationLength = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.PenetrationLengthColumnName); + int colIndexTrafficLoad = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.TrafficLoadColumnName); + int colIndexTL_DegreeOfConsolidation = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.TlDegreeOfConsolidationColumnName); + int colIndexMinimalCircleDepth = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.MinimalCircleDepthColumnName); + int colIndexDempingsfactorPl3 = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.DampingFactorPl3ColumnName); + int colIndexDempingsfactorPl4 = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.DampingFactorPl4ColumnName); + int colIndexPLLineCreationMethod = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.PlLineCreationMethodColumnName); + int colIndexSafetyFactorPiping = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.RequiredSafetyFactorPipingColumnName); + int colIndexSafetyFactorStabilityInnerSlope = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.RequiredSafetyFactorStabilityInnerSlopeColumnName); + int colIndexSafetyFactorStabilityOuterSlope = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.RequiredSafetyFactorStabilityOuterSlopeColumnName); + int colIndexUpliftCriterionPiping = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.UpliftCriterionPipingColumnName); + int colIndexUpliftCriterionStability = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.UpliftCriterionStabilityColumnName); + int colIndexDistanceToEntryPoint = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.DistanceToEntryPointColumnName); + int colIndexPLLineOffsetBelowDikeTopAtRiver = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.PlLineOffsetBelowDikeTopAtRiverColumnName); + int colIndexPLLineOffsetBelowDikeTopAtPolder = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.PlLineOffsetBelowDikeTopAtPolderColumnName); + int colIndexPLLineOffsetBelowShoulderBaseInside = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.PlLineOffsetBelowShoulderBaseInsideColumnName); + int colIndexPLLineOffsetBelowDikeToeAtPolder = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.PlLineOffsetBelowDikeToeAtPolderColumnName); + int colIndexPlLineOffsetBelowDikeCrestMiddle = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.PlLineOffsetBelowDikeCrestMiddleColumnName); + int colIndexPlLineOffsetFactorBelowShoulderCrest = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.PlLineOffsetFactorBelowShoulderCrestColumnName); + int colIndexUsePlLineOffsetBelowDikeCrestMiddle = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.UsePlLineOffsetBelowDikeCrestMiddleColumnName); + int colIndexUsePlLineOffsetFactorBelowShoulderCrest = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.UsePlLineOffsetFactorBelowShoulderCrestColumnName); + int colIndexIntrusionVerticalWaterPressure = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.IntrusionVerticalWaterPressureColumnName); + int colIndexStabilityShoulderGrowSlope = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.StabilityShoulderGrowSlopeColumnName); + int colIndexStabilityShoulderGrowDeltaX = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.StabilityShoulderGrowDeltaXColumnName); + int colIndexStabilitySlopeAdaptionDeltaX = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.StabilitySlopeAdaptionDeltaXColumnName); + int colIndexSlopeDampingPiezometricHeightPolderSide = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.SlopeDampingPiezometricHeightPolderSideColumnName); + int colIndexStabilityDesignMethod = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.StabilityDesignMethodColumnName); + int colIndexStabilityZoneType = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.ZoneTypeColumnName); + int colIndexForbiddenZoneFactor = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.ForbiddenZoneFactorColumnName); + int colIndexZoneAreaRestSlopeCrestWidth = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.ZoneAreaRestSlopeCrestWidthColumnName); + int colIndexSlopeAdaptionStartCotangent = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.SlopeAdaptionStartCotangentColumnName); + int colIndexSlopeAdaptionEndCotangent = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.SlopeAdaptionEndCotangentColumnName); + int colIndexSlopeAdaptionStepCotangent = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.SlopeAdaptionStepCotangentColumnName); + int colIndexNewDikeTopWidth = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.NewDikeTopWidthColumnName); + int colIndexUseNewDikeTopWidth = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.UseNewDikeTopWidthColumnName); + int colIndexNewDikeSlopeInside = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.NewDikeSlopeInsideColumnName); + int colIndexUseNewDikeSlopeInside = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.UseNewDikeSlopeInsideColumnName); + int colIndexNewDikeSlopeOutside = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.NewDikeSlopeOutsideColumnName); + int colIndexUseNewDikeSlopeOutside = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.UseNewDikeSlopeOutsideColumnName); + int colIndexNewShoulderTopSlope = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.NewShoulderTopSlopeColumnName); + int colIndexUseNewShoulderTopSlope = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.UseNewShoulderTopSlopeColumnName); + int colIndexNewShoulderBaseSlope = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.NewShoulderBaseSlopeColumnName); + int colIndexUseNewShoulderBaseSlope = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.UseNewShoulderBaseSlopeColumnName); + int colIndexNewMaxHeightShoulderAsFraction = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.NewMaxHeightShoulderAsFractionColumnName); + int colIndexUseNewMaxHeightShoulderAsFraction = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.UseNewMaxHeightShoulderAsFractionColumnName); + int colIndexNewMinDistanceDikeToeStartDitch = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.NewMinDistanceDikeToeStartDitchColumnName); + int colIndexUseNewMinDistanceDikeToeStartDitch = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.UseNewMinDistanceDikeToeStartDitchColumnName); + int colIndexUseNewDitchDefinition = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.UseNewDitchDefinitionColumnName); + int colIndexNewWidthDitchBottom = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.NewWidthDitchBottomColumnName); + int colIndexNewSlopeAngleDitch = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.NewSlopeAngleDitchColumnName); + int colIndexNewDepthDitch = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.NewDepthDitchColumnName); + int colIndexDikeTableHeight = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.DikeTableHeightColumnName); + int colIndexRiverLevel = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.RiverLevelColumnName); + int colIndexRiverLevelLow = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.RiverLevelLowColumnName); + + var index = 1; + while (csv.ReadNextRecord()) + { + var locationRecord = new LocationRecord(); + var colIndex = -1; // Keep track of column for error message + try + { + locationRecord.LocationRecordId = index++; + + /* + * Required columns + */ + locationRecord.LocationId = csv[colIndexLocationId]; + locationRecord.SurfaceLineId = csv[colIndexSurfacelineId]; + locationRecord.SegmentId = csv[colIndexSegmentId]; + + /* + * Optional columns + */ + if (colIndexDikeRingId > -1) + { + colIndex = colIndexDikeRingId; + locationRecord.DikeRingId = csv[colIndexDikeRingId]; + } + if (colIndexGeoX > -1) + { + colIndex = colIndexGeoX; + locationRecord.GeoX = Convert.ToDouble(csv[colIndexGeoX]); + } + if (colIndexGeoY > -1) + { + colIndex = colIndexGeoY; + locationRecord.GeoY = Convert.ToDouble(csv[colIndexGeoY]); + } + if (colIndexXSoilgeometry2DOrigin > -1) + { + colIndex = colIndexXSoilgeometry2DOrigin; + locationRecord.XSoilGeometry2DOrigin = Convert.ToDouble(csv[colIndexXSoilgeometry2DOrigin]); + } + if (colIndexPolderlevel > -1) + { + colIndex = colIndexPolderlevel; + locationRecord.PolderLevel = Convert.ToDouble(csv[colIndexPolderlevel]); + } + if (colIndexHeadPl2 > -1) + { + colIndex = colIndexHeadPl2; + locationRecord.HeadPl2 = Convert.ToDouble(csv[colIndexHeadPl2]); + } + if (colIndexHeadPl3 > -1) + { + colIndex = colIndexHeadPl3; + locationRecord.HeadPl3 = Convert.ToDouble(csv[colIndexHeadPl3]); + } + if (colIndexHeadPl4 > -1) + { + colIndex = colIndexHeadPl4; + locationRecord.HeadPl4 = Convert.ToDouble(csv[colIndexHeadPl4]); + } + if (colIndexOphoogmateriaaldijk > -1) + { + colIndex = colIndexOphoogmateriaaldijk; + locationRecord.DikeEmbankmentMaterial = csv[colIndexOphoogmateriaaldijk]; + } + if (colIndexOphoogmateriaalberm > -1) + { + colIndex = colIndexOphoogmateriaalberm; + locationRecord.ShoulderEmbankmentMaterial = csv[colIndexOphoogmateriaalberm]; + } + if (colIndexPenetrationLength > -1) + { + colIndex = colIndexPenetrationLength; + locationRecord.PenetrationLength = Convert.ToDouble(csv[colIndexPenetrationLength]); + } + if (colIndexTrafficLoad > -1) + { + colIndex = colIndexTrafficLoad; + locationRecord.TrafficLoad = Convert.ToDouble(csv[colIndexTrafficLoad]); + } + if (colIndexTL_DegreeOfConsolidation > -1) + { + colIndex = colIndexTL_DegreeOfConsolidation; + locationRecord.TL_DegreeOfConsolidation = Convert.ToDouble(csv[colIndexTL_DegreeOfConsolidation]); + } + if (colIndexMinimalCircleDepth > -1) + { + colIndex = colIndexMinimalCircleDepth; + locationRecord.MinimalCircleDepth = Convert.ToDouble(csv[colIndexMinimalCircleDepth]); + } + if (colIndexDempingsfactorPl3 > -1) + { + colIndex = colIndexDempingsfactorPl3; + locationRecord.DampingFactorPl3 = Convert.ToDouble(csv[colIndexDempingsfactorPl3]); + } + if (colIndexDempingsfactorPl4 > -1) + { + colIndex = colIndexDempingsfactorPl4; + locationRecord.DampingFactorPl4 = Convert.ToDouble(csv[colIndexDempingsfactorPl4]); + } + if (colIndexPLLineCreationMethod > -1) + { + colIndex = colIndexPLLineCreationMethod; + locationRecord.PLLineCreationMethod = LocationImportHelper.ToPLLineCreationMethod(csv[colIndexPLLineCreationMethod]); + } + if (colIndexSafetyFactorPiping > -1) + { + colIndex = colIndexSafetyFactorPiping; + locationRecord.RequiredSafetyFactorPiping = Convert.ToDouble(csv[colIndexSafetyFactorPiping]); + } + if (colIndexSafetyFactorStabilityInnerSlope > -1) + { + colIndex = colIndexSafetyFactorStabilityInnerSlope; + locationRecord.RequiredSafetyFactorStabilityInnerSlope = Convert.ToDouble(csv[colIndexSafetyFactorStabilityInnerSlope]); + } + if (colIndexSafetyFactorStabilityOuterSlope > -1) + { + colIndex = colIndexSafetyFactorStabilityOuterSlope; + locationRecord.RequiredSafetyFactorStabilityOuterSlope = Convert.ToDouble(csv[colIndexSafetyFactorStabilityOuterSlope]); + } + if (colIndexUpliftCriterionPiping > -1) + { + colIndex = colIndexUpliftCriterionPiping; + locationRecord.UpliftCriterionPiping = Convert.ToDouble(csv[colIndexUpliftCriterionPiping]); + } + if (colIndexUpliftCriterionStability > -1) + { + colIndex = colIndexUpliftCriterionStability; + locationRecord.UpliftCriterionStability = Convert.ToDouble(csv[colIndexUpliftCriterionStability]); + } + if (colIndexDistanceToEntryPoint > -1) + { + colIndex = colIndexDistanceToEntryPoint; + locationRecord.DistanceToEntryPoint = Convert.ToDouble(csv[colIndexDistanceToEntryPoint]); + } + if (colIndexPLLineOffsetBelowDikeTopAtRiver > -1) + { + colIndex = colIndexPLLineOffsetBelowDikeTopAtRiver; + locationRecord.PlLineOffsetBelowDikeTopAtRiver = Convert.ToDouble(csv[colIndexPLLineOffsetBelowDikeTopAtRiver]); + } + if (colIndexPLLineOffsetBelowDikeTopAtPolder > -1) + { + colIndex = colIndexPLLineOffsetBelowDikeTopAtPolder; + locationRecord.PlLineOffsetBelowDikeTopAtPolder = Convert.ToDouble(csv[colIndexPLLineOffsetBelowDikeTopAtPolder]); + } + if (colIndexPLLineOffsetBelowShoulderBaseInside > -1) + { + colIndex = colIndexPLLineOffsetBelowShoulderBaseInside; + locationRecord.PlLineOffsetBelowShoulderBaseInside = Convert.ToDouble(csv[colIndexPLLineOffsetBelowShoulderBaseInside]); + } + if (colIndexPLLineOffsetBelowDikeToeAtPolder > -1) + { + colIndex = colIndexPLLineOffsetBelowDikeToeAtPolder; + locationRecord.PlLineOffsetBelowDikeToeAtPolder = Convert.ToDouble(csv[colIndexPLLineOffsetBelowDikeToeAtPolder]); + } + if (colIndexPlLineOffsetBelowDikeCrestMiddle > -1) + { + colIndex = colIndexPlLineOffsetBelowDikeCrestMiddle; + locationRecord.PlLineOffsetBelowDikeCrestMiddle = Convert.ToDouble(csv[colIndex]); + } + if (colIndexPlLineOffsetFactorBelowShoulderCrest > -1) + { + colIndex = colIndexPlLineOffsetFactorBelowShoulderCrest; + locationRecord.PlLineOffsetFactorBelowShoulderCrest = Convert.ToDouble(csv[colIndex]); + } + if (colIndexUsePlLineOffsetBelowDikeCrestMiddle > -1) + { + colIndex = colIndexUsePlLineOffsetBelowDikeCrestMiddle; + locationRecord.UsePlLineOffsetBelowDikeCrestMiddle = Convert.ToBoolean(csv[colIndex]); + } + if (colIndexUsePlLineOffsetFactorBelowShoulderCrest > -1) + { + colIndex = colIndexUsePlLineOffsetFactorBelowShoulderCrest; + locationRecord.UsePlLineOffsetFactorBelowShoulderCrest = Convert.ToBoolean(csv[colIndex]); + } + if (colIndexIntrusionVerticalWaterPressure > -1) + { + colIndex = colIndexIntrusionVerticalWaterPressure; + locationRecord.IntrusionVerticalWaterPressure = LocationImportHelper.ToIntrusionVerticalWaterPressure(csv[colIndex]); + } + if (colIndexStabilityShoulderGrowSlope > -1) + { + colIndex = colIndexStabilityShoulderGrowSlope; + locationRecord.StabilityShoulderGrowSlope = Convert.ToDouble(csv[colIndexStabilityShoulderGrowSlope]); + } + if (colIndexStabilityShoulderGrowDeltaX > -1) + { + colIndex = colIndexStabilityShoulderGrowDeltaX; + locationRecord.StabilityShoulderGrowDeltaX = Convert.ToDouble(csv[colIndexStabilityShoulderGrowDeltaX]); + } + if (colIndexStabilitySlopeAdaptionDeltaX > -1) + { + colIndex = colIndexStabilitySlopeAdaptionDeltaX; + locationRecord.StabilitySlopeAdaptionDeltaX = Convert.ToDouble(csv[colIndexStabilitySlopeAdaptionDeltaX]); + } + if (colIndexStabilityDesignMethod > -1) + { + colIndex = colIndexStabilityDesignMethod; + locationRecord.StabilityDesignMethod = LocationImportHelper.ToStabilityDesignMethod(csv[colIndexStabilityDesignMethod]); + } + if (colIndexStabilityZoneType > -1) + { + colIndex = colIndexStabilityZoneType; + locationRecord.StabilityZoneType = LocationImportHelper.ToMStabZonesTypeMethod(csv[colIndexStabilityZoneType]); + } + if (colIndexForbiddenZoneFactor > -1) + { + colIndex = colIndexForbiddenZoneFactor; + locationRecord.ForbiddenZoneFactor = Convert.ToDouble(csv[colIndexForbiddenZoneFactor]); + } + if (colIndexZoneAreaRestSlopeCrestWidth > -1) + { + colIndex = colIndexZoneAreaRestSlopeCrestWidth; + locationRecord.ZoneAreaRestSlopeCrestWidth = Convert.ToDouble(csv[colIndexZoneAreaRestSlopeCrestWidth]); + } + if (colIndexSlopeAdaptionStartCotangent > -1) + { + colIndex = colIndexSlopeAdaptionStartCotangent; + locationRecord.SlopeAdaptionStartCotangent = Convert.ToDouble(csv[colIndexSlopeAdaptionStartCotangent]); + } + if (colIndexSlopeAdaptionEndCotangent > -1) + { + colIndex = colIndexSlopeAdaptionEndCotangent; + locationRecord.SlopeAdaptionEndCotangent = Convert.ToDouble(csv[colIndexSlopeAdaptionEndCotangent]); + } + if (colIndexSlopeAdaptionStepCotangent > -1) + { + colIndex = colIndexSlopeAdaptionStepCotangent; + locationRecord.SlopeAdaptionStepCotangent = Convert.ToDouble(csv[colIndexSlopeAdaptionStepCotangent]); + } + if (colIndexSlopeDampingPiezometricHeightPolderSide > -1) + { + colIndex = colIndexSlopeDampingPiezometricHeightPolderSide; + locationRecord.SlopeDampingPiezometricHeightPolderSide = Convert.ToDouble(csv[colIndexSlopeDampingPiezometricHeightPolderSide]); + } + if (colIndexNewDikeTopWidth > -1) + { + colIndex = colIndexNewDikeTopWidth; + locationRecord.NewDikeTopWidth = Convert.ToDouble(csv[colIndexNewDikeTopWidth]); + } + if (colIndexNewDikeSlopeInside > -1) + { + colIndex = colIndexNewDikeSlopeInside; + locationRecord.NewDikeSlopeInside = Convert.ToDouble(csv[colIndexNewDikeSlopeInside]); + } + if (colIndexNewDikeSlopeOutside > -1) + { + colIndex = colIndexNewDikeSlopeOutside; + locationRecord.NewDikeSlopeOutside = Convert.ToDouble(csv[colIndexNewDikeSlopeOutside]); + } + if (colIndexNewShoulderTopSlope > -1) + { + colIndex = colIndexNewShoulderTopSlope; + locationRecord.NewShoulderTopSlope = Convert.ToDouble(csv[colIndexNewShoulderTopSlope]); + } + if (colIndexNewShoulderBaseSlope > -1) + { + colIndex = colIndexNewShoulderBaseSlope; + locationRecord.NewShoulderBaseSlope = Convert.ToDouble(csv[colIndexNewShoulderBaseSlope]); + } + if (colIndexNewMaxHeightShoulderAsFraction > -1) + { + colIndex = colIndexNewMaxHeightShoulderAsFraction; + locationRecord.NewMaxHeightShoulderAsFraction = Convert.ToDouble(csv[colIndexNewMaxHeightShoulderAsFraction]); + } + if (colIndexNewMinDistanceDikeToeStartDitch > -1) + { + colIndex =colIndexNewMinDistanceDikeToeStartDitch; + locationRecord.NewMinDistanceDikeToeStartDitch = Convert.ToDouble(csv[colIndexNewMinDistanceDikeToeStartDitch]); + } + if (colIndexNewWidthDitchBottom > -1) + { + colIndex = colIndexNewWidthDitchBottom; + locationRecord.NewWidthDitchBottom = Convert.ToDouble(csv[colIndexNewWidthDitchBottom]); + } + if (colIndexNewSlopeAngleDitch > -1) + { + colIndex = colIndexNewSlopeAngleDitch; + locationRecord.NewSlopeAngleDitch = Convert.ToDouble(csv[colIndexNewSlopeAngleDitch]); + } + if (colIndexNewDepthDitch > -1) + { + colIndex = colIndexNewDepthDitch; + locationRecord.NewDepthDitch = Convert.ToDouble(csv[colIndexNewDepthDitch]); + } + if (colIndexUseNewDikeTopWidth > -1) + { + colIndex = colIndexUseNewDikeTopWidth; + locationRecord.UseNewDikeTopWidth = Convert.ToBoolean(csv[colIndexUseNewDikeTopWidth]); + } + if (colIndexUseNewDikeSlopeInside > -1) + { + colIndex =colIndexUseNewDikeSlopeInside; + locationRecord.UseNewDikeSlopeInside = Convert.ToBoolean(csv[colIndexUseNewDikeSlopeInside]); + } + if (colIndexUseNewDikeSlopeOutside > -1) + { + colIndex = colIndexUseNewDikeSlopeOutside; + locationRecord.UseNewDikeSlopeOutside = Convert.ToBoolean(csv[colIndexUseNewDikeSlopeOutside]); + } + if (colIndexUseNewShoulderTopSlope > -1) + { + colIndex = colIndexUseNewShoulderTopSlope; + locationRecord.UseNewShoulderTopSlope = Convert.ToBoolean(csv[colIndexUseNewShoulderTopSlope]); + } + if (colIndexUseNewShoulderBaseSlope > -1) + { + colIndex = colIndexUseNewShoulderBaseSlope; + locationRecord.UseNewShoulderBaseSlope = Convert.ToBoolean(csv[colIndexUseNewShoulderBaseSlope]); + } + if (colIndexUseNewMaxHeightShoulderAsFraction > -1) + { + colIndex = colIndexUseNewMaxHeightShoulderAsFraction; + locationRecord.UseNewMaxHeightShoulderAsFraction = Convert.ToBoolean(csv[colIndexUseNewMaxHeightShoulderAsFraction]); + } + if (colIndexUseNewMinDistanceDikeToeStartDitch > -1) + { + colIndex = colIndexUseNewMinDistanceDikeToeStartDitch; + locationRecord.UseNewMinDistanceDikeToeStartDitch = Convert.ToBoolean(csv[colIndexUseNewMinDistanceDikeToeStartDitch]); + } + if (colIndexUseNewDitchDefinition > -1) + { + colIndex = colIndexUseNewDitchDefinition; + locationRecord.UseNewDitchDefinition = Convert.ToBoolean(csv[colIndexUseNewDitchDefinition]); + } + if (colIndexDikeTableHeight > -1) + { + colIndex = colIndexDikeTableHeight; + locationRecord.DikeTableHeight = Convert.ToDouble(csv[colIndexDikeTableHeight]); + } + if (colIndexRiverLevel > -1) + { + colIndex = colIndexRiverLevel; + locationRecord.RiverLevel = Convert.ToDouble(csv[colIndexRiverLevel]); + } + if (colIndexRiverLevelLow > -1) + { + colIndex = colIndexRiverLevelLow; + locationRecord.RiverLevelLow = Convert.ToDouble(csv[colIndexRiverLevelLow]); + } + locationRecords.Add(locationRecord); + } + catch (Exception e) + { + var csvLocationError = String.Format(LocalizationManager.GetTranslatedText(this.GetType(), "csvLocationError"), locationRecord.LocationId, colIndex + 1); + errorMessages.Add(csvLocationError + e.Message); + } + } + } + } + finally + { + Thread.CurrentThread.CurrentCulture = oldcur; + } + } + public List ImportedItems + { + get { return locationRecords; } + } + + public List ErrorMessages + { + get { return errorMessages; } + set { errorMessages = value; } + } + } +} Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/UISupport/ConfigurationManager.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/UISupport/ConfigurationManager.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/UISupport/ConfigurationManager.cs (revision 3305) @@ -0,0 +1,192 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU 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; + +namespace Deltares.Dam.Data.UISupport +{ + public class ConfigurationManager + { + private const int maxModelCount = 10; // #Bka added SpencerHigh/SpencerLow as quick fix. Should be reset to 8 + + [ThreadStatic] + private static readonly ConfigurationManager instance = new ConfigurationManager(); + + private static ConfigurationStatus[,,,] configurationStatus; + + /// + /// Initializes a new instance of the class. + /// + public ConfigurationManager() + { + InitDefaultStatus(); + } + + public static ConfigurationManager Instance + { + get + { + return instance; + } + } + + /// + /// Indexer + /// + /// + /// + /// + /// + /// + public ConfigurationStatus this[StabilityKernelType kernelType, DamProjectType damProjectType, FailureMechanismSystemType failureMechanismSystemType, int i] + { + get + { + return configurationStatus[(int) kernelType, (int) damProjectType, (int) failureMechanismSystemType, i]; + } + set + { + configurationStatus[(int) kernelType, (int) damProjectType, (int) failureMechanismSystemType, i] = value; + } + } + + /// + /// Gets the available dam project types. + /// + /// + public ICollection GetAvailableDamProjectTypes() + { + return new[] + { + DamProjectType.Calamity, + DamProjectType.Design + }; + } + + /// + /// Gets the available failure mechanisms. + /// + /// + /// Type of the dam project. + /// + public ICollection GetAvailableFailureMechanisms(StabilityKernelType kernelType, DamProjectType damProjectType) + { + var availableList = new List(); + foreach (FailureMechanismSystemType failureMechanismSystemType in Enum.GetValues(typeof(FailureMechanismSystemType))) + { + for (int i = 0; i < maxModelCount; i++) + { + if (this[kernelType, damProjectType, failureMechanismSystemType, i] == ConfigurationStatus.Available) + { + availableList.Add(failureMechanismSystemType); + break; + } + } + } + return availableList; + } + + /// + /// Gets the available mechanism models. + /// + /// + /// Type of the dam project. + /// Type of the failure mechanism system. + /// + public ICollection GetAvailableMechanismModels(StabilityKernelType kernelType, DamProjectType damProjectType, FailureMechanismSystemType failureMechanismSystemType) + { + var availableList = new List(); + for (int i = 0; i < maxModelCount; i++) + { + if (this[kernelType, damProjectType, failureMechanismSystemType, i] == ConfigurationStatus.Available) + { + switch (failureMechanismSystemType) + { + case FailureMechanismSystemType.Piping: + var pipingModeltype = (PipingModelType) i; + availableList.Add(pipingModeltype); + break; + case FailureMechanismSystemType.StabilityInside: + case FailureMechanismSystemType.StabilityOutside: + case FailureMechanismSystemType.HorizontalBalance: + availableList.Add((MStabModelType) i); + break; + case FailureMechanismSystemType.FlowSlide: + availableList.Add((FlowSlideModelType) i); + break; + } + } + } + return availableList; + } + + private static int GetLength() where T : struct + { + return Enum.GetValues(typeof(T)).Length; + } + + /// + /// Inits the default status. + /// + private void InitDefaultStatus() + { + configurationStatus = new ConfigurationStatus[GetLength(), GetLength(), + GetLength(), + maxModelCount]; + foreach (StabilityKernelType kernelType in Enum.GetValues(typeof(StabilityKernelType))) + { + foreach (DamProjectType damProjectType in Enum.GetValues(typeof(DamProjectType))) + { + foreach (FailureMechanismSystemType failureMechanismSystemType in Enum.GetValues(typeof(FailureMechanismSystemType))) + { + for (int i = 0; i < maxModelCount; i++) + { + this[kernelType, damProjectType, failureMechanismSystemType, i] = + ConfigurationStatus.NotImplemented; + } + } + } + } + // This is the place to enable new possible failure mechanisms and models + this[StabilityKernelType.DamClassicStability, DamProjectType.Design, FailureMechanismSystemType.StabilityInside, (int) MStabModelType.Bishop] = ConfigurationStatus.Available; + this[StabilityKernelType.DamClassicStability, DamProjectType.Design, FailureMechanismSystemType.StabilityInside, (int) MStabModelType.UpliftVan] = ConfigurationStatus.Available; + this[StabilityKernelType.DamClassicStability, DamProjectType.Design, FailureMechanismSystemType.StabilityInside, (int) MStabModelType.BishopUpliftVan] = ConfigurationStatus.Available; + this[StabilityKernelType.DamClassicStability, DamProjectType.Design, FailureMechanismSystemType.StabilityOutside, (int) MStabModelType.Bishop] = ConfigurationStatus.Available; + this[StabilityKernelType.DamClassicStability, DamProjectType.Design, FailureMechanismSystemType.Piping, (int) PipingModelType.Sellmeijer] = ConfigurationStatus.Available; + this[StabilityKernelType.DamClassicStability, DamProjectType.Design, FailureMechanismSystemType.Piping, (int) PipingModelType.Sellmeijer2Forces] = ConfigurationStatus.NotAvailable; + this[StabilityKernelType.DamClassicStability, DamProjectType.Design, FailureMechanismSystemType.Piping, (int) PipingModelType.Sellmeijer4Forces] = ConfigurationStatus.Available; + this[StabilityKernelType.DamClassicStability, DamProjectType.Design, FailureMechanismSystemType.Piping, (int) PipingModelType.Bligh] = ConfigurationStatus.Available; + this[StabilityKernelType.DamClassicStability, DamProjectType.Design, FailureMechanismSystemType.Piping, (int) PipingModelType.Wti2017] = ConfigurationStatus.Available; + this[StabilityKernelType.DamClassicStability, DamProjectType.Design, FailureMechanismSystemType.FlowSlide, (int) FlowSlideModelType.All] = ConfigurationStatus.NotAvailable; + + this[StabilityKernelType.DamClassicStability, DamProjectType.Calamity, FailureMechanismSystemType.StabilityInside, (int) MStabModelType.Bishop] = ConfigurationStatus.Available; + this[StabilityKernelType.DamClassicStability, DamProjectType.Calamity, FailureMechanismSystemType.StabilityInside, (int) MStabModelType.UpliftVan] = ConfigurationStatus.Available; + this[StabilityKernelType.DamClassicStability, DamProjectType.Calamity, FailureMechanismSystemType.StabilityOutside, (int) MStabModelType.Bishop] = ConfigurationStatus.Available; + this[StabilityKernelType.DamClassicStability, DamProjectType.Calamity, FailureMechanismSystemType.Piping, (int) PipingModelType.Sellmeijer] = ConfigurationStatus.Available; + this[StabilityKernelType.DamClassicStability, DamProjectType.Calamity, FailureMechanismSystemType.Piping, (int) PipingModelType.Sellmeijer4Forces] = ConfigurationStatus.Available; + this[StabilityKernelType.DamClassicStability, DamProjectType.Calamity, FailureMechanismSystemType.Piping, (int) PipingModelType.Bligh] = ConfigurationStatus.Available; + + this[StabilityKernelType.WtiMacroStabilityKernel, DamProjectType.Design, FailureMechanismSystemType.StabilityInside, (int) MStabModelType.UpliftVan] = ConfigurationStatus.Available; + } + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/IO/ShapeFileExporter.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/IO/ShapeFileExporter.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/IO/ShapeFileExporter.cs (revision 3305) @@ -0,0 +1,38 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using Deltares.Maps; + +namespace Deltares.Dam.Data.IO +{ + public class ShapeFileExporter : AbstractExporter + { + public ShapeFileExporter(string name, string outputFolder, IFeatureRepository repository) + : base(name, outputFolder, repository) + { + } + + protected override void Export(string fileName, IFeatureRepository data) + { + ShapeFileCreator.Create(this.Path, this.Name, data); + } + } +} Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DamProjectCalculationSpecification.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DamProjectCalculationSpecification.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DamProjectCalculationSpecification.cs (revision 3305) @@ -0,0 +1,245 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU 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.Xml.Serialization; +using Deltares.Dam.Data.UISupport; +using Deltares.Standard; +using Deltares.Standard.Attributes; +using Deltares.Standard.EventPublisher; +using Deltares.Standard.Language; +using Deltares.Standard.Validation; + +namespace Deltares.Dam.Data +{ + /// + /// Represents the calculation specifications at project level for DAM. + /// These are the main choices that specify the calculation + /// + public class DamProjectCalculationSpecification : IVisibleEnabled, IDomain, IRepairer, IDisposable + { + private readonly List damCalculationSpecifications; + + private static AnalysisType selectedAnalysisType = AnalysisType.AdaptGeometry; + private DamFailureMechanismeCalculationSpecification currentSpecification = null; + private StabilityKernelType selectedStabilityKernelType; + private IVisibleEnabledProvider visibleEnabledProvider; + + public DamProjectCalculationSpecification() + { + damCalculationSpecifications = new List(); + //waterLevelTimeSeriesFileName = @"d:\src\delftgeosystems\trunk\data\Dam\RRD\Groot Salland\DAM UI Testdata\inputshortstart_dam.xml"; + + DataEventPublisher.OnAfterChange += DataEventPublisher_OnAfterChange; + } + + private void DataEventPublisher_OnAfterChange(object sender, PublishEventArgs e) + { + if (sender == this.currentSpecification) + { + DataEventPublisher.AfterChange(this); + } + } + + [ReadOnly(true)] //For now make read only as only 1 spec is allowed at this moment + [Validate] + public List DamCalculationSpecifications + { + get + { + return damCalculationSpecifications; + } + } + + /// + /// Gets or sets the analysis type for serialization purpose only. + /// This "dummy" property is and must be only used for serialization/deserialization purposes as the real static property + /// SelectedAnalysisType is NOT serialized. This is way its name is deliberately strange. + /// + /// + /// The analysis type for serialization purpose only. + /// + public AnalysisType AnalysisTypeForSerializationPurposeOnly + { + get + { + return selectedAnalysisType; + } + set + { + selectedAnalysisType = value; + } + + } + + /// + /// Gets or sets the type of the selected analysis. + /// + /// + /// The type of the selected analysis. + /// + [Label("Analysis type")] + public static AnalysisType SelectedAnalysisType + { + get { return selectedAnalysisType; } + set + { + // Create local instance of DamProjectCalculationSpecification because event handlers need sender + var r = new DamProjectCalculationSpecification(); + DataEventPublisher.BeforeChange(r, "SelectedAnalysisType"); + selectedAnalysisType = value; + DataEventPublisher.AfterChange(r, "SelectedAnalysisType"); + } + } + + [XmlIgnore] + public DamFailureMechanismeCalculationSpecification CurrentSpecification + { + get + { + if (currentSpecification == null && damCalculationSpecifications.Count > 0) + { + currentSpecification = damCalculationSpecifications[0]; + } + + return currentSpecification; + } + set + { + DataEventPublisher.BeforeChange(this, "CurrentSpecification"); + currentSpecification = value; + DataEventPublisher.AfterChange(this, "CurrentSpecification"); + } + } + + public StabilityKernelType SelectedStabilityKernelType + { + get { return selectedStabilityKernelType; } + set + { + DataEventPublisher.BeforeChange(this, x => x.SelectedStabilityKernelType); + selectedStabilityKernelType = value; + if (currentSpecification != null) + { + currentSpecification.StabilityKernelType = selectedStabilityKernelType; + } + DataEventPublisher.AfterChange(this, x => x.SelectedStabilityKernelType); + } + } + + [XmlIgnore] + [Browsable(false)] + public IVisibleEnabledProvider VisibleEnabledProvider + { + get { return visibleEnabledProvider; } + set { visibleEnabledProvider = value; } + } + + public bool IsVisible(string property) + { + if (damCalculationSpecifications.Count <= 0) return false; + switch (property) + { + case "SelectedAnalysisType": return Location.DamProjectType == DamProjectType.Design; + case "CurrentSpecification": + { + var bol = (damCalculationSpecifications.Count > 0) && + (this.CurrentSpecification.FailureMechanismSystemType == + FailureMechanismSystemType.StabilityInside || + this.CurrentSpecification.FailureMechanismSystemType == + FailureMechanismSystemType.StabilityOutside); + return bol; + } + case "SelectedStabilityKernelType": + { + return visibleEnabledProvider != null && visibleEnabledProvider.IsVisible(this, "SelectedStabilityKernelType"); + } + default : return true; + } + } + + public bool IsEnabled(string property) + { + switch (property) + { + default: return true; + } + } + + public ICollection GetDomain(string property) + { + switch (property) + { + case "SelectedAnalysisType": return new[] { AnalysisType.AdaptGeometry, AnalysisType.NoAdaption }; + default: return null; + } + } + + [Validate] + public ValidationResult[] Validate() + { + if (damCalculationSpecifications.Count > 1) + { + return new[]{ new ValidationResult(ValidationResultType.Error, LocalizationManager.GetTranslatedText(this, "MaxOneCalculationSpecification"), + this, "DamCalculationSpecifications", "DamCalculationSpecifications", this)}; + } + else + { + return new ValidationResult[0]; + } + + } + + private void RepairTooManySpecifications() + { + for (int i = damCalculationSpecifications.Count - 1; i > 0 ; i--) + { + damCalculationSpecifications.Remove(damCalculationSpecifications[i]); + } + } + + public void Repair(object subject, string property, string id) + { + switch (id) + { + case "DamCalculationSpecifications": this.RepairTooManySpecifications(); break; + } + } + + public string GetRepairDescription(object subject, string property, string id) + { + switch (id) + { + case "DamCalculationSpecifications": + return LocalizationManager.GetTranslatedText(this, "KeepFirstCalculationSpecification"); + default: return ""; + } + } + + public void Dispose() + { + DataEventPublisher.OnAfterChange -= DataEventPublisher_OnAfterChange; + } + } +} Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Importers/LocationShapeFileImporter.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Importers/LocationShapeFileImporter.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Importers/LocationShapeFileImporter.cs (revision 3305) @@ -0,0 +1,145 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU 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.IO; +using System.Linq; +using Deltares.Dam.Data.CsvImporters; +using Deltares.Dam.Data.DataPlugins.Configuration; +using Deltares.Maps; + +namespace Deltares.Dam.Data.Importers +{ + internal class LocationShapeFileImporter : IImporter + { + /// + /// Creates a location shape file importer instance. + /// + /// The existing location list. + /// The configured attributes. + /// The shape file location. + /// + public static LocationShapeFileImporter Create(IEnumerable existingLocationRecords, IEnumerable configuredAttributes, string shapeFileLocation) + { + if (string.IsNullOrEmpty(shapeFileLocation) || shapeFileLocation.Trim() == "") + throw new ArgumentException("shapeFileLocation"); + + const string locationAttrId = LocationShapeFileAttributeMap.LocationAttributeId; + var configuredAttribute = configuredAttributes.SingleOrDefault(a => a.AttributeId.Equals(locationAttrId, StringComparison.InvariantCultureIgnoreCase)); + + if (configuredAttribute == null) + return null; + + var locationMapping = LocationShapeFileAttributeMap.GetAttributeMapping(configuredAttribute, locationAttrId); + + var file = new ShapeFileLocation(shapeFileLocation, locationMapping.File); + if (!file.Exists) + throw new FileNotFoundException(string.Format("The file '{0}' is not found", file.FullPath)); + + var importer = new LocationShapeFileImporter(existingLocationRecords, configuredAttributes) + { + Repository = FeatureRepository.CreateFromShapeFile(file) + }; + + return importer; + } + + private readonly IEnumerable configuredAttributes; + private readonly ICollection locationRecords; + private readonly IList errors; + + /// + /// Constructs a location importer class were data will be imported from ShapeFiles + /// + /// + /// + public LocationShapeFileImporter(IEnumerable existingLocationRecords, IEnumerable configuredAttributes) + { + this.configuredAttributes = configuredAttributes; + this.locationRecords = new List(); + + if (existingLocationRecords != null) + { + foreach (var location in existingLocationRecords.Where(location => location != null)) + { + this.locationRecords.Add(location); + } + } + + this.errors = new List(); + } + + public IEnumerable ImportErrors + { + get { return this.errors; } + } + + internal IFeatureRepository Repository { get; set; } + + #region Implementation of IImporter + + public IEnumerable ImportedItems + { + get { return locationRecords; } + } + + #endregion + + public void Import() + { + if (Repository == null) + return; + + const string locationAttrId = LocationShapeFileAttributeMap.LocationAttributeId; + var configuredAttribute = configuredAttributes.Single(a => a.AttributeId.Equals(locationAttrId, StringComparison.InvariantCultureIgnoreCase)); + var locationMapping = LocationShapeFileAttributeMap.GetAttributeMapping(configuredAttribute, locationAttrId); + + const string dikeRingAttrId = LocationShapeFileAttributeMap.DikeRingAttributeId; + configuredAttribute = configuredAttributes.SingleOrDefault(a => a.AttributeId.Equals(dikeRingAttrId, StringComparison.InvariantCultureIgnoreCase)); + var dikeRingMapping = LocationShapeFileAttributeMap.GetAttributeMapping(configuredAttribute, dikeRingAttrId); + + foreach (var feature in Repository.Features) + { + var locationIDValue = feature.Attributes[locationMapping.Name].ToString(); + var dikeRingIdValue = feature.Attributes[dikeRingMapping.Name].ToString(); + + //Locations are read from shapefile after the locations have been read from locations.csv + //If a location already exists, overwrite the existing location + //otherwise create a new location + var locationRecord = locationRecords.FirstOrDefault(l => l.LocationId == locationIDValue); + var newLocation = locationRecord == null; + if (newLocation) + { + locationRecord = new CsvImporterLocations.LocationRecord(); + } + locationRecord.LocationId = locationIDValue; + locationRecord.DikeRingId = dikeRingIdValue; + locationRecord.GeoX = feature.Geometry.Coordinate.X; + locationRecord.GeoY = feature.Geometry.Coordinate.Y; + if (newLocation) + { + locationRecords.Add(locationRecord); + } + } + } + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Properties/Settings.settings =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Properties/Settings.settings (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Properties/Settings.settings (revision 3305) @@ -0,0 +1,96 @@ + + + + + + segments + + + locations + + + soilprofiles + + + surfacelines + + + characteristicpoints + + + csv + + + Soilbase\soilbase.mdb + + + modelparameters + + + 0.66 + + + pl1lines + + + gauges + + + .\DGeoStability.exe + + + .\GeoStudio.exe + + + Automatic + + + 36 + + + 2 + + + 14 + + + 2 + + + 3 + + + 2 + + + 6 + + + 2 + + + 10 + + + 2.5 + + + 10 + + + 2.5 + + + OnBoundaryLines + + + 0.25 + + + OnBoundaryLines + + + 0.25 + + + \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/StabilityTimeSerieEntry.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/StabilityTimeSerieEntry.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/StabilityTimeSerieEntry.cs (revision 3305) @@ -0,0 +1,36 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +namespace Deltares.Dam.Data +{ +// using System; +// using System.Collections.Specialized; +// +// public class StabilityTimeSerieEntry : TimeSerieEntry +// { +// public StabilityTimeSerieEntry() +// { +// this.MStabProjectPaths = new StringCollection(); +// } +// +// public StringCollection MStabProjectPaths { get; set; } +// } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Specifications/InRangeSpecification.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Specifications/InRangeSpecification.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Specifications/InRangeSpecification.cs (revision 3305) @@ -0,0 +1,46 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +namespace Deltares.Standard.Specifications +{ + /// + /// Checks if the candidate is within the range boundaries. Boundaries are included + /// + public class InRangeSpecification : SpecificationBase + { + private readonly double min; + private readonly double max; + + public InRangeSpecification(double min, double max) + { + this.min = min; + this.max = max; + + Name = "In range specification"; + Description = string.Format("The candidate value should have a value between {0} and {1}. Boundaries are included", min, max); + } + + public override bool IsSatisfiedBy(double candidate) + { + return (min <= candidate && max >= candidate); + } + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DtoAssembler/Common.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DtoAssembler/Common.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DtoAssembler/Common.cs (revision 3305) @@ -0,0 +1,76 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU 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.IO; +using System.Reflection; + +namespace Deltares.Standard +{ + public static class Common + { + /// + /// Extracts an embedded file out of a given assembly. + /// + /// The namespace of you assembly. + /// The name of the file to extract. + /// A stream containing the file data. + public static Stream GetEmbeddedFile(string assemblyName, string fileName) + { + try + { + Assembly a = Assembly.Load(assemblyName); + Stream str = a.GetManifestResourceStream(assemblyName + "." + fileName); + + if (str == null) + throw new Exception("Could not locate embedded resource '" + fileName + "' in assembly '" + assemblyName + "'"); + return str; + } + catch (Exception e) + { + throw new Exception(string.Format("{0}: {1}", assemblyName, e.Message)); + } + } + + /// + /// Extracts an embedded file out of a given assembly. + /// + /// The name of the resource which normally is the namespace of you assembly and the file. + /// A stream containing the file data. + public static Stream GetEmbeddedFile(Assembly assembly, string resourceName) + { + try + { + Stream str = assembly.GetManifestResourceStream(resourceName); + + if (str == null) + throw new Exception( + string.Format("Could not locate embedded resource '{0}' in assembly '{1}'", + resourceName, assembly.GetName())); + return str; + } + catch (Exception e) + { + throw new Exception(string.Format("{0}: {1}", assembly.GetName(), e.Message)); + } + } + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DikeCoordinateSystemConverter.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DikeCoordinateSystemConverter.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DikeCoordinateSystemConverter.cs (revision 3305) @@ -0,0 +1,100 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU 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.Linq; +using Deltares.Geometry; +using Deltares.Geotechnics.SurfaceLines; + +namespace Deltares.Dam.Data +{ + using System; + + /// + /// Exception class for DikeCoordinateSystemConverter + /// + public class DikeCoordinateSystemConverterException : Exception + { + public DikeCoordinateSystemConverterException(string message) + : base(message) + { + } + } + /// + /// class for converting dike object coordinates from global to local system + /// + public class DikeCoordinateSystemConverter + { + public void CreateLocalXZObjects(Dike dike) + { + ThrowIfInvalidDike(dike); + foreach (Location location in dike.Locations.Where(x => null != x.SurfaceLine2)) + { + // This can obviously only be done when SurfaceLine is available + // In unit test situations sometimes the surfaceline is not defined + ThrowIfAlreadyConvertedToLocalCoordinates(location.AreLocalXZObjectsCreated, String.Format("Location {0}", location.Name)); + var coordinateSystemConverter = new CoordinateSystemConverter(); + coordinateSystemConverter.DefineGlobalXYZBasedOnLine(location.SurfaceLine2.Geometry); + PL1Line localPL1Line = (location.PL1Line != null) ? location.PL1Line.Clone() : null; + SurfaceLine2 localSurfaceLine = location.SurfaceLine2.FullDeepClone(); + coordinateSystemConverter.ConvertGlobalXYZToLocalXZ(localSurfaceLine.Geometry); + if (localPL1Line != null) + coordinateSystemConverter.ConvertGlobalXYZToLocalXZ(localPL1Line); + location.LocalXZPL1Line = localPL1Line; + + if (location.LocalXZSurfaceLine2 != null) + { + location.LocalXZSurfaceLine2.Dispose(); + } + location.LocalXZSurfaceLine2 = localSurfaceLine; + location.AreLocalXZObjectsCreated = true; + } + } + + /// + /// Validate dike and throw exception if not valid + /// + /// + private static void ThrowIfInvalidDike(Dike dike) + { + try + { + dike.Validate(); + } + catch (Exception exception) + { + throw new DikeCoordinateSystemConverterException(exception.Message); + } + } + + /// + /// Throws exception if surfaceline already has been converted + /// + /// + private static void ThrowIfAlreadyConvertedToLocalCoordinates(bool isConvertedToLocalCoordinates, string objectDescription) + { + if (isConvertedToLocalCoordinates) + { + throw new DikeCoordinateSystemConverterException(String.Format("{0} has already been converted from global to local coordinates", objectDescription)); + } + } + + } +} Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DamJob.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DamJob.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DamJob.cs (revision 3305) @@ -0,0 +1,72 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU 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.ComponentModel; +using Deltares.Standard.Attributes; +using Deltares.Standard.EventPublisher; + +namespace Deltares.Dam.Data +{ + public class DamJob + { + private bool? run = false; + private object subject = null; + private string name; + + public DamJob() + { + } + + public DamJob(object subject) : this() + { + this.subject = subject; + } + + [Label("Name")] + [ReadOnly(true)] + [PropertyOrder(0,0)] + public virtual string Name + { + get { return this.subject != null ? this.subject.ToString() : ""; } + set { name = value; } + } + + [Label("Run")] + [PropertyOrder(0, 1)] + public virtual bool? Run + { + get { return run; } + set + { + DataEventPublisher.BeforeChange(this, "Run"); + run = value; + DataEventPublisher.AfterChange(this, "Run"); + } + } + + [Browsable(false)] + public virtual object Subject + { + get { return subject; } + set { subject = value; } + } + } +} Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/EntityAlreadyExistException.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/EntityAlreadyExistException.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/EntityAlreadyExistException.cs (revision 3305) @@ -0,0 +1,48 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU 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.Dam.Data +{ + [Serializable] + public class EntityAlreadyExistException : Exception + { + public EntityAlreadyExistException() + { + } + + public EntityAlreadyExistException(string message) : base(message) + { + } + + public EntityAlreadyExistException(string message, Exception inner) : base(message, inner) + { + } + + protected EntityAlreadyExistException( + SerializationInfo info, + StreamingContext context) : base(info, context) + { + } + } +} Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/FeatureCoverageException.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/FeatureCoverageException.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/FeatureCoverageException.cs (revision 3305) @@ -0,0 +1,48 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU 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.Maps +{ + [Serializable] + public class FeatureCoverageException : Exception + { + public FeatureCoverageException() + { + } + + public FeatureCoverageException(string message) : base(message) + { + } + + public FeatureCoverageException(string message, Exception inner) : base(message, inner) + { + } + + protected FeatureCoverageException( + SerializationInfo info, + StreamingContext context) : base(info, context) + { + } + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/Test/FeatureRepositoryTests.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/Test/FeatureRepositoryTests.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/Test/FeatureRepositoryTests.cs (revision 3305) @@ -0,0 +1,38 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of the application DAM - UI. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU 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 NUnit.Framework; + +namespace Deltares.Maps.Tests +{ + [TestFixture] + public class FeatureRepositoryTests + { + [Test] + [Category("Integration")] + [ExpectedException(typeof(FeatureImportException))] + public void CreateFromShapeFile_UsingShapeFileThatContainsOneCompositeShapeAndNRecords_Throws() + { + string plLinesFilename = @"..\..\..\..\data\Dam\Waterboards\HD\shapefiles\PLLINES.shp"; + FeatureRepository.CreateFromShapeFile(new ShapeFileLocation(plLinesFilename)); + } + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/Translations.xml =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/Translations.xml (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/Translations.xml (revision 3305) @@ -0,0 +1,28 @@ + + + + + + \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.DamClientsLibrary.Version/Properties/AssemblyInfo.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.DamClientsLibrary.Version/Properties/AssemblyInfo.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.DamClientsLibrary.Version/Properties/AssemblyInfo.cs (revision 3305) @@ -0,0 +1,28 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU 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.Reflection; +using System.Runtime.InteropServices; + +[assembly: AssemblyTitle("Deltares.DamClientsLibrary.Version")] +[assembly: AssemblyDescription("")] +[assembly: ComVisible(false)] +[assembly: Guid("48691761-637b-4eff-a04c-2047e5fa9843")] Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/PolygonAttributeImporter.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/PolygonAttributeImporter.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/PolygonAttributeImporter.cs (revision 3305) @@ -0,0 +1,150 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU 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.Diagnostics; +using System.Linq; +using Deltares.Standard.Language; + +namespace Deltares.Maps +{ + /// + /// Sets property values of target objects which are retrieved from the ShapeFile attributes covering a given point + /// + /// + public class PolygonAttributeImporter : IAttributeImporter + { + private readonly IList errors; + + public PolygonAttributeImporter() + { + errors = new List(); + } + + public IEnumerable Errors + { + get { return errors; } + } + + /// + /// Gets or sets the name of the file. + /// + /// + /// The name of the file. + /// + public string FileName { private get; set; } + + public void AddError(Exception exception) + { + errors.Add(exception); + } + + /// + /// Sets the feature repository containing the attribute data + /// + public IFeatureRepository AttributeRepository { private get; set; } + + /// + /// Sets the target objects containing the properties to set the retrieved coverage values on + /// + public IEnumerable Targets { private get; set; } + + /// + /// Sets the x getter function, which is used to get the x value from a target object + /// + public Func XGetter { private get; set; } + + /// + /// Sets the y getter function, which is used to get the y value from the target object + /// + public Func YGetter { private get; set; } + + /// + /// Sets the list of attributes to read from the repository when a match is found + /// + public IEnumerable> AttributeMappings { private get; set; } + + /// + /// Materializes the target object properties using its x and y values in the coverage function + /// + public void Import() + { + if (Targets == null) + { + throw new InvalidOperationException("No targets set"); + } + + if (AttributeRepository == null) + { + throw new InvalidOperationException("No repository set"); + } + + if (!AttributeRepository.SupportedAttributes.Any()) + { + throw new InvalidOperationException("The repository doesn't contain attributes"); + } + + if (AttributeMappings == null) + { + throw new InvalidOperationException("No attribute set"); + } + + foreach (T target in Targets) + { + double x = XGetter(target); + double y = YGetter(target); + + Debug.Write(string.Format("analyzing location at ({0} {1})", x, y)); + + List features = AttributeRepository.GetFeaturesCovering(x, y).ToList(); + if (features.Count == 0) + { + Debug.WriteLine("Error: No match"); + AddError(new FeatureCoverageException(string.Format(LocalizationManager.GetTranslatedText(this, "NoMatchError"), target, FileName, x.ToString("F2"), y.ToString("F2")))); + continue; + } + + if (features.Count > 1) + { + Debug.WriteLine("Error: Multiple matches"); + AddError(new FeatureCoverageException(string.Format("Multiple geometries found covering point ({0} {1})", x.ToString("F2"), y.ToString("F2")))); + continue; + } + + Debug.WriteLine("Success"); + IFeature match = features[0]; + + foreach (var mapping in AttributeMappings) + { + string attributeName = mapping.Name; + if (!match.Attributes.Exists(attributeName)) + { + AddError(new AttributeMissingException(attributeName)); + continue; + } + + mapping.Action(target, match.Attributes[attributeName]); + } + } + } + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/IO/TextFileExporter.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/IO/TextFileExporter.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/IO/TextFileExporter.cs (revision 3305) @@ -0,0 +1,56 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU 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.IO; + +namespace Deltares.Dam.Data.IO +{ + /// + /// Class added to test the export functionality and interface + /// + public class TextFileExporter : AbstractExporter + { + const string Extension = ".txt"; + + /// + /// + /// + /// The name of the file to export to + public TextFileExporter(string name) : base(name) + { + base.FileExtension = Extension; + } + + public TextFileExporter(string name, string outputPath) + : base(name, outputPath) + { + base.FileExtension = Extension; + } + + protected override void Export(string fileName, string data) + { + using (var writer = File.CreateText(fileName)) + { + writer.Write(Data ?? ""); + } + } + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Sensors/SensorLocation.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Sensors/SensorLocation.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/Sensors/SensorLocation.cs (revision 3305) @@ -0,0 +1,523 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU 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.Linq; +using System.Linq.Expressions; +using System.Xml.Serialization; +using Deltares.Dam.Data.Sensors.Specifications; +using Deltares.Geotechnics.SurfaceLines; +using Deltares.Standard; +using Deltares.Standard.Attributes; +using Deltares.Standard.IO.Xml; +using Deltares.Standard.Reflection; +using Deltares.Standard.Specifications; +using Deltares.Standard.Specifications.Extensions; +using Validator = Deltares.Standard.Specifications.Validator; +using XmlSerializer = Deltares.Standard.IO.Xml.XmlSerializer; + +namespace Deltares.Dam.Data.Sensors +{ + /// + /// Association class for sensor data and a location + /// + [Serializable] + public class SensorLocation : IDomain + { + #region Business Rules + + /// + /// Specication to test if the value of the candidate is valid + /// + internal class IgnoreOrLocationData : PredicateSpecification + { + public IgnoreOrLocationData() + : base(x => x == DataSourceTypeSensors.Ignore || x == DataSourceTypeSensors.LocationData) + { + Description = "Only Ignore or LocationData value allowed for this property."; + } + } + + /// + /// Specication to test if the value of the candidate is valid + /// + internal class SensorOrLocationData : PredicateSpecification + { + public SensorOrLocationData() + : base(x => x == DataSourceTypeSensors.Sensor || x == DataSourceTypeSensors.LocationData) + { + Description = "Only Sensor or LocationData value allowed for this property."; + } + } + + #endregion + + /// + /// Constructor is needed for XML deserialization + /// + [Browsable(false)] + public SensorLocation() + { + SourceTypePl1WaterLevelAtRiver = DataSourceTypeSensors.LocationData; + SourceTypePl1WaterLevelAtPolder = DataSourceTypeSensors.LocationData; + } + + /// + /// Gets or sets the DAM location. + /// + /// + /// The location. + /// + [XmlIgnore] + [Specification(typeof(NotNullSpecification))] + [Browsable(false)] + public Location Location { get; set; } + + /// + /// Gets the location Name. + /// + /// + /// If the Name is empty it could indicate that there is no reference + /// to a valid location + /// + [XmlIgnore] + [PropertyOrder(1, 1)] + public string LocationName + { + get { return (Location != null) ? Location.Name : string.Empty; } + } + + /// + /// Gets or sets the sensor group. + /// + /// + /// The group. + /// + [Specification(typeof(NotNullSpecification))] + [PropertyOrder(1, 5)] + public Group Group { get; set; } + + /// + /// Gets the group ID. + /// + /// + /// If the ID has value -1 then the there is no valid reference (null) + /// or the group is transient. + /// + [XmlIgnore] + [Browsable(false)] + public int GroupID + { + get + { + if (Group == null) + return -1; + + return Group.ID; + } + } + + /// + /// Resets the group identifier. + /// + /// The identifier. + public void ResetGroupID(int id) + { + Group.ID = id; + } + + /// + /// Gets the sensor selection. + /// + [XmlIgnore] + [Browsable(false)] + public IEnumerable Sensors + { + get + { + if (Group == null) + return new Sensor[0]; + + return Group.Selection; + } + } + + /// + /// Gets or sets the source type PL3. + /// + /// + /// The source type PL3. + /// + [Specification(typeof(SensorOrLocationData))] + [PropertyOrder(1, 12)] + [XmlOldName("PL3")] + public DataSourceTypeSensors SourceTypePl3 { get; set; } + + /// + /// Gets or sets the source type PL4. + /// + /// + /// The source type PL4. + /// + [Specification(typeof(SensorOrLocationData))] + [PropertyOrder(1, 13)] + [XmlOldName("PL4")] + public DataSourceTypeSensors SourceTypePl4 { get; set; } + + + /// + /// Gets or sets the source type PL1 water level at river. + /// + /// + /// The source type PL1 water level at river. + /// + [Specification(typeof(SensorOrLocationData))] + [PropertyOrder(1, 6)] + [XmlOldName("PL1WaterLevelAtRiver")] + public DataSourceTypeSensors SourceTypePl1WaterLevelAtRiver { get; set; } + + /// + /// Gets or sets the source type PL1 pl line offset below dike top at river. + /// + /// + /// The source type PL1 pl line offset below dike top at river. + /// + [Specification(typeof(IgnoreOrLocationData))] + [PropertyOrder(1, 7)] + [XmlOldName("PL1PLLineOffsetBelowDikeTopAtRiver")] + public DataSourceTypeSensors SourceTypePl1PlLineOffsetBelowDikeTopAtRiver { get; set; } + + /// + /// Gets or sets the source type PL1 pl line offset below dike top at polder. + /// + /// + /// The source type PL1 pl line offset below dike top at polder. + /// + [Specification(typeof(IgnoreOrLocationData))] + [PropertyOrder(1, 8)] + [XmlOldName("PL1PLLineOffsetBelowDikeTopAtPolder")] + public DataSourceTypeSensors SourceTypePl1PlLineOffsetBelowDikeTopAtPolder { get; set; } + + [Specification(typeof(IgnoreOrLocationData))] + [PropertyOrder(1, 9)] + public DataSourceTypeSensors SourceTypePl1PlLineOffsetBelowShoulderBaseInside { get; set; } + + /// + /// Gets or sets the source type PL1 pl line offset below dike toe at polder. + /// + /// + /// The source type PL1 pl line offset below dike toe at polder. + /// + [Specification(typeof(IgnoreOrLocationData))] + [PropertyOrder(1, 10)] + [XmlOldName("PL1PLLineOffsetBelowDikeToeAtPolder")] + public DataSourceTypeSensors SourceTypePl1PlLineOffsetBelowDikeToeAtPolder { get; set; } + + /// + /// Gets or sets the source type PL1 water level at polder. + /// + /// + /// The source type PL1 water level at polder. + /// + [Specification(typeof(SensorOrLocationData))] + [PropertyOrder(1, 11)] + [XmlOldName("PL1WaterLevelAtPolder")] + public DataSourceTypeSensors SourceTypePl1WaterLevelAtPolder { get; set; } + + /// + /// Gets the sensor count. + /// + [Browsable(false)] + public int SensorCount + { + get + { + return Group?.SensorCount ?? 0; + } + } + + [Browsable(false)] + public SurfaceLine2 SurfaceLine + { + get { return Location.SurfaceLine2; } + } + + [PropertyOrder(1, 3)] + public string Alias { get; set; } + + [Browsable(false)] + public string Profile { get; set; } + + /// + /// Gets the PiezometricHead type sensors sorted by relative location along profile. + /// + /// Type of the pl line. + /// + 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; + } + + /// + /// Builds the relative location table. + /// + /// + internal IDictionary BuildRelativeLocationTable() + { + var surfaceLevelOutside = SurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.SurfaceLevelOutside); + if (surfaceLevelOutside == null) + throw new InvalidOperationException("No SurfaceLevelOutside point on surface line defined"); + + double startPoint = surfaceLevelOutside.X; + + var dict = new Dictionary(); + foreach (Sensor sensor in Sensors) + { + double relativeLocation = startPoint + (Location.XRdDikeLine - sensor.XRd); + dict.Add(sensor, relativeLocation); + } + return dict; + } + + internal static class MemberNames + { + internal static readonly string WaterLevelAtRiver = StaticReflection.GetMemberName(x => x.SourceTypePl1WaterLevelAtRiver); + internal static readonly string PolderLevel = StaticReflection.GetMemberName(x => x.SourceTypePl1WaterLevelAtPolder); + internal static readonly string PL3 = StaticReflection.GetMemberName(x => x.SourceTypePl3); + internal static readonly string PL4 = StaticReflection.GetMemberName(x => x.SourceTypePl4); + internal static readonly string Pl1PlLineOffsetBelowDikeToeAtPolder = StaticReflection.GetMemberName(x => x.SourceTypePl1PlLineOffsetBelowDikeToeAtPolder); + internal static readonly string Pl1PlLineOffsetBelowDikeTopAtPolder = StaticReflection.GetMemberName(x => x.SourceTypePl1PlLineOffsetBelowDikeTopAtPolder); + internal static readonly string Pl1PlLineOffsetBelowDikeTopAtRiver = StaticReflection.GetMemberName(x => x.SourceTypePl1PlLineOffsetBelowDikeTopAtRiver); + internal static readonly string Pl1PlLineOffsetBelowShoulderBaseInside = StaticReflection.GetMemberName(x => x.SourceTypePl1PlLineOffsetBelowShoulderBaseInside); + } + + /// + /// Gets the requested sensor value. + /// + /// The expression. + /// The sensor values. + /// The sensor. + /// + /// + /// sensorValues + /// or + /// sensor + /// + /// The given sensor is not an item/key in the table of sensor values + public double? GetValue(Expression> expression, IDictionary sensorValues, Sensor sensor) + { + if (sensorValues == null) throw new ArgumentNullException("sensorValues"); + if (sensor == null) throw new ArgumentNullException("sensor"); + + if (!sensorValues.ContainsKey(sensor)) + throw new ArgumentException("The given sensor is not an item/key in the table of sensor values"); + + var memberName = StaticReflection.GetMemberName(expression); + + if (memberName == MemberNames.WaterLevelAtRiver) + { + if (SourceTypePl1WaterLevelAtRiver == DataSourceTypeSensors.Sensor) + return sensorValues[sensor]; + if (SourceTypePl1WaterLevelAtRiver == DataSourceTypeSensors.LocationData) + return Location.Scenarios[0].RiverLevel; + } + + if (memberName == MemberNames.PolderLevel) + { + if (SourceTypePl1WaterLevelAtPolder == DataSourceTypeSensors.LocationData) + return Location.Scenarios[0].PolderLevel; + + if (SourceTypePl1WaterLevelAtPolder == DataSourceTypeSensors.Sensor) + return sensorValues[sensor]; + } + + if (memberName == MemberNames.PL3) + { + if (SourceTypePl3 == DataSourceTypeSensors.Sensor) + return sensorValues[sensor]; + if (SourceTypePl3 == DataSourceTypeSensors.LocationData) + return Location.Scenarios[0].HeadPl3; + } + + if (memberName == MemberNames.PL4) + { + if (SourceTypePl4 == DataSourceTypeSensors.Sensor) + return sensorValues[sensor]; + if (SourceTypePl4 == DataSourceTypeSensors.LocationData) + return Location.Scenarios[0].HeadPl4; + } + + if (memberName == MemberNames.Pl1PlLineOffsetBelowDikeToeAtPolder) + { + if (SourceTypePl1PlLineOffsetBelowDikeToeAtPolder == DataSourceTypeSensors.LocationData) + return Location.Scenarios[0].PlLineOffsetBelowDikeToeAtPolder; + } + + if (memberName == MemberNames.Pl1PlLineOffsetBelowDikeTopAtPolder) + { + if (SourceTypePl1PlLineOffsetBelowDikeTopAtPolder == DataSourceTypeSensors.LocationData) + return Location.Scenarios[0].PlLineOffsetBelowDikeTopAtPolder; + } + if (memberName == MemberNames.Pl1PlLineOffsetBelowDikeTopAtRiver) + { + if (SourceTypePl1PlLineOffsetBelowDikeTopAtRiver == DataSourceTypeSensors.LocationData) + return Location.Scenarios[0].PlLineOffsetBelowDikeTopAtRiver; + } + + if (memberName == MemberNames.Pl1PlLineOffsetBelowShoulderBaseInside) + { + if (SourceTypePl1PlLineOffsetBelowShoulderBaseInside == DataSourceTypeSensors.LocationData) + return Location.Scenarios[0].PlLineOffsetBelowShoulderBaseInside; + } + + return null; + } + + /// + /// Determines whether this instance is valid. + /// + /// + /// true if this instance is valid; otherwise, false. + /// + public bool IsValid() + { + + if (IsLocationDataAsDataSourceUsed() && Location != null) + { + if (Location.Scenarios.Count != 1) + { + return false; + } + } + + if (Validator.Validate(this).Any()) + { + return false; + } + + return true; + } + + /// + /// Checks if LocationData is used as a source. + /// + /// + private bool IsLocationDataAsDataSourceUsed() + { + if (SourceTypePl1WaterLevelAtRiver == DataSourceTypeSensors.LocationData || + SourceTypePl1WaterLevelAtPolder == DataSourceTypeSensors.LocationData || + SourceTypePl3 == DataSourceTypeSensors.LocationData || + SourceTypePl4 == DataSourceTypeSensors.LocationData || + SourceTypePl1PlLineOffsetBelowDikeToeAtPolder == DataSourceTypeSensors.LocationData || + SourceTypePl1PlLineOffsetBelowDikeTopAtPolder == DataSourceTypeSensors.LocationData || + SourceTypePl1PlLineOffsetBelowDikeTopAtRiver == DataSourceTypeSensors.LocationData || + SourceTypePl1PlLineOffsetBelowShoulderBaseInside == DataSourceTypeSensors.LocationData) + { + return true; + } + return false; + } + + /// + /// Serializes this instance. + /// + /// + public string Serialize() + { + var xmlSerializer = new XmlSerializer(); + return xmlSerializer.SerializeToString(this); + } + + /// + /// Deserializes the specified XML. + /// + /// The XML. + /// + public static SensorLocation Deserialize(string xml) + { + var xmlDeserializer = new XmlDeserializer(); + return (SensorLocation)xmlDeserializer.XmlDeserializeFromString(xml, typeof(SensorLocation)); + } + + /// + /// Gets or sets the GetGroups function (injectable list, for UI purposes). + /// + /// + /// The list of available Groups. + /// + [XmlIgnore] + [Browsable(false)] + public static Func> GetGroups { get; set; } + + private ICollection GetGroupsDomain() + { + if (GetGroups == null) + { + return null; + } + + return GetGroups(this).ToList(); + } + + /// + /// Gets the domain for properties in the UI. + /// + /// The property. + /// + public ICollection GetDomain(string property) + { + switch (property) + { + case "Group": + return GetGroupsDomain(); + default: + return null; + } + } + } +} Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DtoAssembler/CollectionRequirementsNotSatisfiedException.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DtoAssembler/CollectionRequirementsNotSatisfiedException.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DtoAssembler/CollectionRequirementsNotSatisfiedException.cs (revision 3305) @@ -0,0 +1,51 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU 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.Standard +{ + [Serializable] + public class CollectionRequirementsNotSatisfiedException : Exception + { + public CollectionRequirementsNotSatisfiedException() + { + } + + public CollectionRequirementsNotSatisfiedException(string collectionElementName, string itemElementName, object coll) : base(GetMessage(collectionElementName, itemElementName, coll)) + { + } + + protected CollectionRequirementsNotSatisfiedException( + SerializationInfo info, + StreamingContext context) + : base(info, context) + { + } + + private static string GetMessage(string collectionElementName, string itemElementName, object coll) + { + string msg = "Cannot write the xml sequence '{0}' with the element '{1}', because it doesn't satisfy the requirements in the xsd schema. See the schema for min and max occurences"; + return string.Format(msg, collectionElementName, itemElementName); + } + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/Deltares.Maps.csproj =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/Deltares.Maps.csproj (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/Deltares.Maps.csproj (revision 3305) @@ -0,0 +1,168 @@ + + + + Debug + x86 + 9.0.30729 + 2.0 + {17F76A8E-C9F4-415F-8D4B-0E8A3B36E665} + Library + Properties + Deltares.Maps + Deltares.Maps + v4.5 + 512 + + + 3.5 + + + 0 + ..\ + true + + + true + ..\..\bin\Debug\ + DEBUG;TRACE + full + x86 + prompt + true + true + true + False + False + True + False + False + False + True + True + False + False + False + True + True + False + False + False + True + False + True + True + False + False + + + + + + + + True + False + Full + DoNotBuild + 0 + false + + + ..\..\bin\Release\ + TRACE + true + pdbonly + x86 + prompt + true + true + true + false + + + + False + ..\..\..\lib\DSL-Core\Deltares.Standard.dll + + + ..\..\packages\GeoAPI.1.7.1.1\lib\net403-client\GeoAPI.dll + True + + + ..\..\packages\NetTopologySuite.1.13.1\lib\net403-client\NetTopologySuite.dll + True + + + ..\..\packages\NetTopologySuite.IO.1.13.1\lib\net403-client\NetTopologySuite.IO.GeoTools.dll + True + + + ..\..\packages\NetTopologySuite.IO.1.13.1\lib\net403-client\NetTopologySuite.IO.MsSqlSpatial.dll + True + + + ..\..\packages\NetTopologySuite.IO.1.13.1\lib\net403-client\NetTopologySuite.IO.PostGis.dll + True + + + ..\..\packages\NetTopologySuite.1.13.1\lib\net403-client\PowerCollections.dll + True + + + + 3.5 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Copying.GPL.licenseheader + + + + + + + + + + This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/IFeatureImporter.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/IFeatureImporter.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Maps/IFeatureImporter.cs (revision 3305) @@ -0,0 +1,31 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +namespace Deltares.Maps +{ + public interface IFeatureImporter + { + IFeatureRepository Repository { get; } + IReader Reader { set; } + + void Import(); + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DamEngineIo/FillDamUiFromXmlInput.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DamEngineIo/FillDamUiFromXmlInput.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DamEngineIo/FillDamUiFromXmlInput.cs (revision 3305) @@ -0,0 +1,607 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Collections.Generic; +using System.Linq; +using Deltares.Dam.Data.Sensors; +using Deltares.DamEngine.Io.XmlInput; +using Deltares.Geotechnics; +using Deltares.Geotechnics.Soils; +using Deltares.Geotechnics.SurfaceLines; +using Deltares.Standard.Extensions; +using Soil = Deltares.Geotechnics.Soils.Soil; +using SoilProfile1D = Deltares.Geotechnics.Soils.SoilProfile1D; +using SurfaceLine = Deltares.DamEngine.Io.XmlInput.SurfaceLine; + +namespace Deltares.Dam.Data.DamEngineIo +{ + /// + /// Create DAM UI project from XML Input object + /// + public class FillDamUiFromXmlInput + { + /// + /// Creates the dam project data. + /// + /// The input. + /// + public static DamProjectData CreateDamProjectData(Input input) + { + ValidateInput(input); + var damProjectData = new DamProjectData(); + + if (input.MaxCalculationCoresSpecified) + { + damProjectData.MaxCalculationCores = input.MaxCalculationCores; + } + + damProjectData.WaterBoard = new WaterBoard(); + damProjectData.WaterBoard.Dikes = new List(); + damProjectData.WaterBoard.Dikes.Add(new Dike()); + Dike dike = damProjectData.WaterBoard.Dikes[0]; + + TransferAnalysisSpecification(input, damProjectData); + TransferStabilityParameters(input, damProjectData); + + var localSurfaceLines = new List(); + TransferSurfaceLines(input.SurfaceLines, localSurfaceLines); + dike.SoilList = new SoilList(); + TransferSoils(input.Soils, dike.SoilList); + TransferAquiferSoils(input.AquiferSoils, dike.SoilList); + TransferSoilProfiles1D(input.SoilProfiles1D, dike.SoilProfiles, dike.SoilList); + TransferSegments(input.Segments, dike.SoilProfiles, damProjectData.WaterBoard.Segments); + TransferLocations(input.Locations, dike.Locations, localSurfaceLines, damProjectData.WaterBoard.Segments); + if (input.OperationalInputTimeSeries != null) + { + damProjectData.InputTimeSerieCollection = new TimeSerieCollection(); + TransferInputTimeSeries(input.OperationalInputTimeSeries, damProjectData.InputTimeSerieCollection); + } + if (input.SensorData != null) + { + damProjectData.SensorData = new SensorData(); + TransferSensorData(input.SensorData, damProjectData.SensorData, dike.Locations); + } + return damProjectData; + } + + private static void TransferSensorData(InputSensorData inputSensorData, SensorData sensorData, IList locations) + { + // Transfer sensors + foreach (var inputSensor in inputSensorData.Sensors) + { + var plLineMappings = new PLLineType[inputSensor.PlLineMapping.Length]; + int plLineMappingIndex = 0; + foreach (var plLineMapping in inputSensor.PlLineMapping) + { + plLineMappings[plLineMappingIndex] = ConversionHelper.ConvertToPlLineType(plLineMapping.PLineType); + plLineMappingIndex++; + } + sensorData.Sensors.Add(new Sensors.Sensor() + { + ID = inputSensor.Id, + Name = inputSensor.Name, + RelativeLocation = inputSensor.RelativeLocation, + Type = ConversionHelper.ConvertToSensorType(inputSensor.SensorType), + PLLineMappings = plLineMappings + }); + } + + // Transfer sensorgroups + foreach (var inputSensorGroup in inputSensorData.SensorGroups) + { + var sensorGroup = new Data.Sensors.Group(); + sensorGroup.ID = inputSensorGroup.Id; + foreach (var sensorId in inputSensorGroup.SensorIds) + { + var sensor = sensorData.Sensors.First(s => s.ID.Equals(sensorId.SensorId)); + sensorGroup.Add(sensor); + } + sensorData.SensorGroups.Add(sensorGroup); + } + + // Transfer sensorlocations + foreach (var inputSensorLocation in inputSensorData.SensorLocations) + { + var sensorLocation = new Data.Sensors.SensorLocation(); + sensorLocation.Location = locations.First(l => l.Name.Equals(inputSensorLocation.LocationId)); + sensorLocation.Location.SensorLocation = sensorLocation; + sensorLocation.Group = sensorData.SensorGroups.First(sg => sg.ID.Equals(inputSensorLocation.GroupId)); + sensorLocation.SourceTypePl1PlLineOffsetBelowDikeTopAtPolder = ConversionHelper.ConvertToDataSourceTypeSensors(inputSensorLocation.SourceTypePl1PlLineOffsetBelowDikeTopAtPolder); + sensorLocation.SourceTypePl1PlLineOffsetBelowDikeToeAtPolder = ConversionHelper.ConvertToDataSourceTypeSensors(inputSensorLocation.SourceTypePl1PlLineOffsetBelowDikeToeAtPolder); + sensorLocation.SourceTypePl1PlLineOffsetBelowDikeTopAtRiver = ConversionHelper.ConvertToDataSourceTypeSensors(inputSensorLocation.SourceTypePl1PlLineOffsetBelowDikeTopAtRiver); + sensorLocation.SourceTypePl1PlLineOffsetBelowShoulderBaseInside = ConversionHelper.ConvertToDataSourceTypeSensors(inputSensorLocation.SourceTypePl1PlLineOffsetBelowShoulderBaseInside); + sensorLocation.SourceTypePl1WaterLevelAtPolder = ConversionHelper.ConvertToDataSourceTypeSensors(inputSensorLocation.SourceTypePl1WaterLevelAtPolder); + sensorLocation.SourceTypePl1WaterLevelAtRiver = ConversionHelper.ConvertToDataSourceTypeSensors(inputSensorLocation.SourceTypePl1WaterLevelAtRiver); + sensorLocation.SourceTypePl3 = ConversionHelper.ConvertToDataSourceTypeSensors(inputSensorLocation.SourceTypePl3); + sensorLocation.SourceTypePl4 = ConversionHelper.ConvertToDataSourceTypeSensors(inputSensorLocation.SourceTypePl4); + sensorData.SensorLocations.Add(sensorLocation); + } + } + + private static void TransferInputTimeSeries(DamEngine.Io.XmlInput.TimeSerie[] inputOperationalInputTimeSeries, TimeSerieCollection timeSerieCollection) + { + foreach (var inputTimeSerie in inputOperationalInputTimeSeries) + { + var timeSerie = timeSerieCollection.AddNewSeries(inputTimeSerie.LocationId); + timeSerie.ParameterId = inputTimeSerie.ParameterId; + timeSerie.ForecastDateTime = inputTimeSerie.ForecastDateTime; + timeSerie.Type = inputTimeSerie.Type; + timeSerie.StartDateTime = inputTimeSerie.StartDateTime; + timeSerie.EndDateTime = inputTimeSerie.EndDateTime; + timeSerie.MissVal = inputTimeSerie.MissVal; + timeSerie.LongName = inputTimeSerie.LongName; + timeSerie.StationName = inputTimeSerie.StationName; + timeSerie.Units = inputTimeSerie.Units; + timeSerie.SourceOrganisation = inputTimeSerie.SourceOrganisation; + timeSerie.SourceSystem = inputTimeSerie.SourceSystem; + timeSerie.FileDescription = inputTimeSerie.FileDescription; + timeSerie.Region = inputTimeSerie.Region; + timeSerie.TimeStep.Multiplier = inputTimeSerie.TimeStep.Multiplier; + timeSerie.TimeStep.Divider = inputTimeSerie.TimeStep.Divider; + timeSerie.TimeStep.MultiplierSpecified = inputTimeSerie.TimeStep.MultiplierSpecified1; + timeSerie.TimeStep.DividerSpecified = inputTimeSerie.TimeStep.DividerSpecified1; + timeSerie.TimeStep.Unit = ConversionHelper.ConvertToTimeStepUnit(inputTimeSerie.TimeStep.TimeStepUnit); + for (int i = 0; i < inputTimeSerie.Entries.TimeSerieEntry.Length; i++) + { + var entry = inputTimeSerie.Entries.TimeSerieEntry[i]; + Stochast stochastValue = null; + if (entry.StochastValue != null) + { + stochastValue = new Stochast() + { + Distribution = entry.StochastValue.Distribution, + Mean = entry.StochastValue.Mean, + StandardDeviation = entry.StochastValue.StandardDeviation + }; + } + TimeSerieEntry timeSerieEntry = new TimeSerieEntry() + { + DateTime = entry.DateTime, + Value = entry.Value, + BasisFileName = entry.BasisFileNameWMF, + Flag = entry.Flagnietechtgebruikt, + RelativeCalculationPathName = entry.RelativeCalculationPathName, + StochastValue = stochastValue + }; + timeSerie.Entries.Add(timeSerieEntry); + } + } + } + private static void TransferAquiferSoils(InputAquiferSoil[] inputAquiferSoils, SoilList soilList) + { + if (inputAquiferSoils != null) + { + soilList.AquiferDictionary = new Dictionary(); + foreach (InputAquiferSoil aquiferSoil in inputAquiferSoils) + { + soilList.AquiferDictionary.Add(soilList.GetSoilByName(aquiferSoil.Soilname), aquiferSoil.IsAquifer); + } + } + } + + private static void TransferAnalysisSpecification(Input input, DamProjectData damProjectData) + { + damProjectData.DamProjectType = ConversionHelper.ConvertToDamProjectType(input.DamProjectType); + + var calculationSpecification = new DamFailureMechanismeCalculationSpecification(); + + calculationSpecification.FailureMechanismSystemType = ConversionHelper.ConvertToFailureMechanismSystemType(input.FailureMechanismSystemType); + + if (input.AnalysisTypeSpecified) + { + DamProjectCalculationSpecification.SelectedAnalysisType = ConversionHelper.ConvertToAnalysisType(input.AnalysisType); + } + + if (input.PipingModelTypeSpecified) + { + calculationSpecification.PipingModelType = ConversionHelper.ConvertToPipingModelType(input.PipingModelType); + } + + if (input.StabilityModelTypeSpecified) + { + calculationSpecification.StabilityModelType = ConversionHelper.ConvertToStabilityModelType(input.StabilityModelType); + } + damProjectData.DamProjectCalculationSpecification.DamCalculationSpecifications.Add(calculationSpecification); + } + + private static void TransferStabilityParameters(Input input, DamProjectData damProjectData) + { + if (input.StabilityParameters != null) + { + if (damProjectData.DamProjectCalculationSpecification != null) + { + var curSpec = damProjectData.DamProjectCalculationSpecification.CurrentSpecification; + if (curSpec != null) + { + curSpec.FailureMechanismeParamatersMStab = new FailureMechanismeParamatersMStab(); + curSpec.FailureMechanismeParamatersMStab.MStabParameters = new MStabParameters(); + var curStabParamas = curSpec.FailureMechanismeParamatersMStab.MStabParameters; + curStabParamas.SearchMethod = ConversionHelper.ConvertToSearchMethod(input.StabilityParameters.SearchMethod); + curStabParamas.SlipCircleDefinition = new SlipCircleDefinition(); + var slipCircleDefinition = curStabParamas.SlipCircleDefinition; + slipCircleDefinition.GridSizeDetermination = ConversionHelper.ConvertToGridDetermination(input.StabilityParameters.GridDetermination); + + if (input.StabilityParameters.BishopTangentLinesDefinitionSpecified) + { + slipCircleDefinition.BishopTangentLinesDefinition = ConversionHelper.ConvertToTangentLinesDefinition(input.StabilityParameters.BishopTangentLinesDefinition); + } + if (input.StabilityParameters.BishopTangentLinesDistanceSpecified) + { + slipCircleDefinition.BishopTangentLinesDistance = input.StabilityParameters.BishopTangentLinesDistance; + } + if (input.StabilityParameters.BishopGridVerticalPointsCountSpecified) + { + slipCircleDefinition.BishopGridVerticalPointCount = input.StabilityParameters.BishopGridVerticalPointsCount; + } + if (input.StabilityParameters.BishopGridVerticalPointsDistanceSpecified) + { + slipCircleDefinition.BishopGridVerticalPointDistance = input.StabilityParameters.BishopGridVerticalPointsDistance; + } + if (input.StabilityParameters.BishopGridHorizontalPointsCountSpecified) + { + slipCircleDefinition.BishopGridHorizontalPointCount = input.StabilityParameters.BishopGridHorizontalPointsCount; + } + if (input.StabilityParameters.BishopGridHorizontalPointsDistanceSpecified) + { + slipCircleDefinition.BishopGridHorizontalPointDistance = input.StabilityParameters.BishopGridHorizontalPointsDistance; + } + if (input.StabilityParameters.UpliftVanTangentLinesDefinitionSpecified) + { + slipCircleDefinition.UpliftVanTangentLinesDefinition = ConversionHelper.ConvertToTangentLinesDefinition(input.StabilityParameters.UpliftVanTangentLinesDefinition); + } + if (input.StabilityParameters.UpliftVanTangentLinesDistanceSpecified) + { + slipCircleDefinition.UpliftVanTangentLinesDistance = input.StabilityParameters.UpliftVanTangentLinesDistance; + } + if (input.StabilityParameters.UpliftVanGridLeftVerticalPointsCountSpecified) + { + slipCircleDefinition.UpliftVanLeftGridVerticalPointCount = input.StabilityParameters.UpliftVanGridLeftVerticalPointsCount; + } + if (input.StabilityParameters.UpliftVanGridLeftVerticalPointsDistanceSpecified) + { + slipCircleDefinition.UpliftVanLeftGridVerticalPointDistance = input.StabilityParameters.UpliftVanGridLeftVerticalPointsDistance; + } + if (input.StabilityParameters.UpliftVanGridLeftHorizontalPointsCountSpecified) + { + slipCircleDefinition.UpliftVanLeftGridHorizontalPointCount = input.StabilityParameters.UpliftVanGridLeftHorizontalPointsCount; + } + if (input.StabilityParameters.UpliftVanGridLeftHorizontalPointsDistanceSpecified) + { + slipCircleDefinition.UpliftVanLeftGridHorizontalPointDistance = input.StabilityParameters.UpliftVanGridLeftHorizontalPointsDistance; + } + if (input.StabilityParameters.UpliftVanGridRightVerticalPointsCountSpecified) + { + slipCircleDefinition.UpliftVanRightGridVerticalPointCount = input.StabilityParameters.UpliftVanGridRightVerticalPointsCount; + } + if (input.StabilityParameters.UpliftVanGridRightVerticalPointsDistanceSpecified) + { + slipCircleDefinition.UpliftVanRightGridVerticalPointDistance = input.StabilityParameters.UpliftVanGridRightVerticalPointsDistance; + } + if (input.StabilityParameters.UpliftVanGridRightHorizontalPointsCountSpecified) + { + slipCircleDefinition.UpliftVanRightGridHorizontalPointCount = input.StabilityParameters.UpliftVanGridRightHorizontalPointsCount; + } + if (input.StabilityParameters.UpliftVanGridRightHorizontalPointsDistanceSpecified) + { + slipCircleDefinition.UpliftVanRightGridHorizontalPointDistance = input.StabilityParameters.UpliftVanGridRightHorizontalPointsDistance; + } + } + } + } + } + + private static void ValidateInput(Input input) + { + if (input == null) + { + throw new NullReferenceException("No input defined"); + } + if (input.Locations == null) + { + throw new NullReferenceException("No locations defined in the input"); + } + foreach (DamEngine.Io.XmlInput.Location location in input.Locations) + { + if (location.DesignScenarios == null) + { + throw new NullReferenceException("No design scenarios defined in location"); + } + } + if (input.SurfaceLines == null) + { + throw new NullReferenceException("No surfacelines defined in the input"); + } + else + { + foreach (var surfaceLine in input.SurfaceLines) + { + if ((surfaceLine.Points == null) || (surfaceLine.Points.Length < 1)) + { + throw new NullReferenceException(string.Format("Surfaceline '{0}' has no points", surfaceLine.Name)); + } + } + } + if (input.Soils == null) + { + throw new NullReferenceException("No soils defined in the input"); + } + } + + private static void TransferSoils(DamEngine.Io.XmlInput.Soil[] inputSoils, SoilList dikeSoilList) + { + var soils = dikeSoilList.Soils; + for (int i = 0; i < inputSoils.Length; i++) + { + var soil = new Soil(); + var inputSoil = inputSoils[i]; + soil.Name = inputSoil.Name; + soil.AbovePhreaticLevel = inputSoil.AbovePhreaticLevelSpecified ? inputSoil.AbovePhreaticLevel : Double.NaN; + soil.BelowPhreaticLevel = inputSoil.BelowPhreaticLevelSpecified ? inputSoil.BelowPhreaticLevel : Double.NaN; + soil.DryUnitWeight = inputSoil.DryUnitWeightSpecified ? inputSoil.DryUnitWeight : Double.NaN; + soil.BeddingAngle = inputSoil.BeddingAngleSpecified ? inputSoil.BeddingAngle : Double.NaN; + soil.DiameterD70 = inputSoil.DiameterD70Specified ? inputSoil.DiameterD70 : Double.NaN; + soil.DiameterD90 = inputSoil.DiameterD90Specified ? inputSoil.DiameterD90 : Double.NaN; + soil.PermeabKx = inputSoil.PermeabKxSpecified ? inputSoil.PermeabKx : Double.NaN; + soil.WhitesConstant = inputSoil.WhitesConstantSpecified ? inputSoil.WhitesConstant : Double.NaN; + soil.ShearStrengthModel = inputSoil.ShearStrengthModelSpecified ? + ConversionHelper.ConvertToShearStrengthModel(inputSoil.ShearStrengthModel) : ShearStrengthModel.CPhi; + soil.UseDefaultShearStrengthModel = inputSoil.UseDefaultShearStrengthModelSpecified ? + inputSoil.UseDefaultShearStrengthModel : true; + soil.Cohesion = inputSoil.CohesionSpecified ? inputSoil.Cohesion : Double.NaN; + soil.FrictionAngle = inputSoil.FrictionAngleSpecified ? inputSoil.FrictionAngle : Double.NaN; + soil.OCR = inputSoil.OcrSpecified ? inputSoil.Ocr : Double.NaN; + soil.RestSlope = inputSoil.SlopeRestProfileSpecified ? inputSoil.SlopeRestProfile : Double.NaN; + soil.DilatancyType = inputSoil.DilatancyTypeSpecified ? + ConversionHelper.ConvertToDilatancyType(inputSoil.DilatancyType) : DilatancyType.Phi; + soils.Add(soil); + } + } + + private static void TransferSurfaceLines(SurfaceLine[] inputSurfaceLines, IList dikeSurfaceLines) + { + for (int i = 0; i < inputSurfaceLines.Length; i++) + { + var inputSurfaceLine = inputSurfaceLines[i]; + var surfaceLine = FillDamUiFromXmlHelper.ConvertXmlSurfaceLineToSurfaceLine2(inputSurfaceLine); + dikeSurfaceLines.Add(surfaceLine); + } + } + + private static void TransferLocations(DamEngine.Io.XmlInput.Location[] inputLocations, IList dikeLocations, IList dikeSurfaceLines, IList segments) + { + for (int i = 0; i < inputLocations.Length; i++) + { + var location = new Location(); + var inputLocation = inputLocations[i]; + var waternetOptions = inputLocation.WaternetOptions; + location.Name = inputLocation.Name; + if (inputLocation.DistanceToEntryPointSpecified) + { + location.DistanceToEntryPoint = inputLocation.DistanceToEntryPoint; + } + location.XSoilGeometry2DOrigin = inputLocation.XSoilGeometry2DOrigin; + location.PLLineCreationMethod = ConversionHelper.ConvertToPhreaticLineCreationMethod(waternetOptions.PhreaticLineCreationMethod); + location.IntrusionVerticalWaterPressure = ConversionHelper.ConvertToIntrusionVerticalWaterPressure(waternetOptions.IntrusionVerticalWaterPressure); + location.DampingFactorPL3 = waternetOptions.DampingFactorPl3; + location.DampingFactorPL4 = waternetOptions.DampingFactorPl4; + location.PenetrationLength = waternetOptions.PenetrationLength; + location.SlopeDampingPiezometricHeightPolderSide = waternetOptions.SlopeDampingFactor; + + SurfaceLine2 surfaceLine = dikeSurfaceLines.First(n => n.Name.Equals(inputLocation.SurfaceLineName)); + location.LocalXZSurfaceLine2 = surfaceLine; + + Segment segment = segments.First(s => s.Name.Equals(inputLocation.SegmentName)); + location.Segment = segment; + + if (inputLocation.DesignScenarios != null) + { + for (int j = 0; j < inputLocation.DesignScenarios.Length; j++) + { + var designScenario = new Scenario(); + var inputLocationDesignScenario = inputLocation.DesignScenarios[j]; + designScenario.LocationScenarioID = inputLocationDesignScenario.Id; + designScenario.RiverLevel = inputLocationDesignScenario.RiverLevel; + designScenario.RiverLevelLow = (inputLocationDesignScenario.RiverLevelLowSpecified ? (double?)inputLocationDesignScenario.RiverLevelLow : null); + designScenario.DikeTableHeight = (inputLocationDesignScenario.DikeTableHeightSpecified ? (double?)inputLocationDesignScenario.DikeTableHeight : null); + designScenario.PlLineOffsetBelowDikeTopAtRiver = inputLocationDesignScenario.PlLineOffsetBelowDikeTopAtRiver; + designScenario.PlLineOffsetBelowDikeTopAtPolder = inputLocationDesignScenario.PlLineOffsetBelowDikeTopAtPolder; + designScenario.PlLineOffsetBelowShoulderBaseInside = inputLocationDesignScenario.PlLineOffsetBelowShoulderBaseInside; + designScenario.PlLineOffsetBelowDikeToeAtPolder = inputLocationDesignScenario.PlLineOffsetBelowDikeToeAtPolder; + designScenario.UsePlLineOffsetBelowDikeCrestMiddle = inputLocationDesignScenario.PlLineOffsetBelowDikeCrestMiddleSpecified; + designScenario.PlLineOffsetBelowDikeCrestMiddle = inputLocationDesignScenario.PlLineOffsetBelowDikeCrestMiddle; + designScenario.UsePlLineOffsetFactorBelowShoulderCrest = inputLocationDesignScenario.PlLineOffsetFactorBelowShoulderCrestSpecified; + designScenario.PlLineOffsetFactorBelowShoulderCrest = inputLocationDesignScenario.PlLineOffsetFactorBelowShoulderCrest; + designScenario.HeadPl3 = (inputLocationDesignScenario.HeadPl3Specified ? (double?)inputLocationDesignScenario.HeadPl3 : null); + designScenario.HeadPl4 = (inputLocationDesignScenario.HeadPl4Specified ? (double?)inputLocationDesignScenario.HeadPl4 : null); + designScenario.UpliftCriterionStability = inputLocationDesignScenario.UpliftCriterionStability; + designScenario.UpliftCriterionPiping = inputLocationDesignScenario.UpliftCriterionPiping; + designScenario.RequiredSafetyFactorStabilityInnerSlope = inputLocationDesignScenario.RequiredSafetyFactorStabilityInnerSlope; + designScenario.RequiredSafetyFactorStabilityOuterSlope = inputLocationDesignScenario.RequiredSafetyFactorStabilityOuterSlope; + designScenario.RequiredSafetyFactorPiping = inputLocationDesignScenario.RequiredSafetyFactorPiping; + designScenario.PolderLevel = inputLocationDesignScenario.PolderLevel; + designScenario.HeadPl2 = (inputLocationDesignScenario.HeadPl2Specified ? (double?)inputLocationDesignScenario.HeadPl2 : null); + location.Scenarios.Add(designScenario); + } + } + location.DikeEmbankmentMaterial = inputLocation.DikeEmbankmentMaterial; + if (inputLocation.StabilityOptions != null) + { + location.MapForSoilGeometries2D = inputLocation.StabilityOptions.MapForSoilgeometries2D; + location.SoildatabaseName = inputLocation.StabilityOptions.SoilDatabaseName; + location.StabilityZoneType = ConversionHelper.ConvertToZoneType(inputLocation.StabilityOptions.ZoneType); + if (inputLocation.StabilityOptions.ForbiddenZoneFactorSpecified) + { + location.ForbiddenZoneFactor = inputLocation.StabilityOptions.ForbiddenZoneFactor; + } + if (inputLocation.StabilityOptions.ZoneAreaRestSlopeCrestWidthSpecified) + { + location.ZoneAreaRestSlopeCrestWidth = inputLocation.StabilityOptions.ZoneAreaRestSlopeCrestWidth; + } + if (inputLocation.StabilityOptions.TrafficLoadSpecified) + { + location.TrafficLoad = inputLocation.StabilityOptions.TrafficLoad; + } + if (inputLocation.StabilityOptions.TrafficLoadDegreeOfConsolidationSpecified) + { + location.TL_DegreeOfConsolidation = inputLocation.StabilityOptions.TrafficLoadDegreeOfConsolidation; + } + if (inputLocation.StabilityOptions.MinimumCircleDepthSpecified) + { + location.MinimalCircleDepth = inputLocation.StabilityOptions.MinimumCircleDepth; + } + } + + // Design options + var designOptions = inputLocation.DesignOptions; + if (designOptions != null) + { + location.RedesignDikeHeight = designOptions.RedesignDikeHeight; + location.RedesignDikeShoulder = designOptions.RedesignDikeShoulder; + location.ShoulderEmbankmentMaterial = designOptions.ShoulderEmbankmentMaterial; + location.StabilityShoulderGrowSlope = designOptions.StabilityShoulderGrowSlope; + location.StabilityShoulderGrowDeltaX = designOptions.StabilityShoulderGrowDeltaX; + location.StabilitySlopeAdaptionDeltaX = designOptions.StabilitySlopeAdaptionDeltaX; + location.SlopeAdaptionStartCotangent = designOptions.SlopeAdaptionStartCotangent; + location.SlopeAdaptionEndCotangent = designOptions.SlopeAdaptionEndCotangent; + location.SlopeAdaptionStepCotangent = designOptions.SlopeAdaptionStepCotangent; + + location.UseNewDikeTopWidth = designOptions.NewDikeTopWidthSpecified; + if (designOptions.NewDikeTopWidthSpecified) location.NewDikeTopWidth = designOptions.NewDikeTopWidth; + location.UseNewDikeSlopeInside = designOptions.NewDikeSlopeInsideSpecified; + if (designOptions.NewDikeSlopeInsideSpecified) location.NewDikeSlopeInside = designOptions.NewDikeSlopeInside; + location.UseNewDikeSlopeOutside = designOptions.NewDikeSlopeOutsideSpecified; + if (designOptions.NewDikeSlopeOutsideSpecified) location.NewDikeSlopeOutside = designOptions.NewDikeSlopeOutside; + location.UseNewShoulderTopSlope = designOptions.NewShoulderTopSlopeSpecified; + if (designOptions.NewShoulderTopSlopeSpecified) location.NewShoulderTopSlope = designOptions.NewShoulderTopSlope; + location.UseNewShoulderBaseSlope = designOptions.NewShoulderBaseSlopeSpecified; + if (designOptions.NewShoulderBaseSlopeSpecified) location.NewShoulderBaseSlope = designOptions.NewShoulderBaseSlope; + location.UseNewMaxHeightShoulderAsFraction = designOptions.NewMaxHeightShoulderAsFractionSpecified; + if (designOptions.NewMaxHeightShoulderAsFractionSpecified) location.NewMaxHeightShoulderAsFraction = designOptions.NewMaxHeightShoulderAsFraction; + location.UseNewMinDistanceDikeToeStartDitch = designOptions.NewMinDistanceDikeToeStartDitchSpecified; + if (designOptions.NewMinDistanceDikeToeStartDitchSpecified) location.NewMinDistanceDikeToeStartDitch = designOptions.NewMinDistanceDikeToeStartDitch; + location.UseNewDitchDefinition = designOptions.UseNewDitchDefinition; + if (designOptions.NewWidthDitchBottomSpecified) location.NewWidthDitchBottom = designOptions.NewWidthDitchBottom; + if (designOptions.NewSlopeAngleDitchSpecified) location.NewSlopeAngleDitch = designOptions.NewSlopeAngleDitch; + if (designOptions.NewDepthDitchSpecified) location.NewDepthDitch = designOptions.NewDepthDitch; + + location.StabilityDesignMethod = ConversionHelper.ConvertToDamStabilityDesignMethod(designOptions.StabilityDesignMethod); + } + dikeLocations.Add(location); + } + } + private static void TransferSoilProfiles1D(DamEngine.Io.XmlInput.SoilProfile1D[] inputSoilProfiles1D, + IList dikeSoilProfiles, SoilList soils) + { + if (inputSoilProfiles1D != null) + { + for (int i = 0; i < inputSoilProfiles1D.Length; i++) + { + var soilProfile1D = new SoilProfile1D(); + var inputSoilProfile1D = inputSoilProfiles1D[i]; + soilProfile1D.Name = inputSoilProfile1D.Name; + soilProfile1D.BottomLevel = inputSoilProfile1D.BottomLevel; + AddLayers1D(inputSoilProfile1D, soilProfile1D, soils); + dikeSoilProfiles.Add(soilProfile1D); + } + } + } + + private static void AddLayers1D(DamEngine.Io.XmlInput.SoilProfile1D inputSoilProfile1D, SoilProfile1D soilProfile1D, SoilList soils) + { + if (inputSoilProfile1D != null) + { + for (int i = 0; i < inputSoilProfile1D.Layers1D.Length; i++) + { + var layer = new SoilLayer1D(); + var inputLayer = inputSoilProfile1D.Layers1D[i]; + layer.Id = inputLayer.Name; + layer.Soil = soils.GetSoilByName(inputLayer.SoilName); + layer.TopLevel = inputLayer.TopLevel; + layer.IsAquifer = inputLayer.IsAquifer; + layer.WaterpressureInterpolationModel = ConversionHelper.ConvertToWaterpressureInterpolationModel( + inputLayer.WaterpressureInterpolationModel); + soilProfile1D.Layers.Add(layer); + } + } + } + + private static void TransferSegments(DamEngine.Io.XmlInput.Segment[] inputSegments, IList dikeSoilProfiles, IList segments) + { + for (int i = 0; i < inputSegments.Length; i++) + { + var segment = new Segment(); + var inputSegment = inputSegments[i]; + segment.Name = inputSegment.Name; + AddSoilProfileProbabilities(inputSegment, dikeSoilProfiles, segment); + segments.Add(segment); + } + } + + private static void AddSoilProfileProbabilities(DamEngine.Io.XmlInput.Segment inputSegment, IList dikeSoilProfiles, Segment segment) + { + for (int i = 0; i < inputSegment.SoilGeometryProbability.Length; i++) + { + var soilGeometryProbability = new SoilGeometryProbability(); + var inputSoilGeometryProbability = inputSegment.SoilGeometryProbability[i]; + soilGeometryProbability.Probability = inputSoilGeometryProbability.Probability; + if (inputSoilGeometryProbability.SegmentFailureMechanismTypeSpecified) + { + soilGeometryProbability.SegmentFailureMechanismType = ConversionHelper.ConvertToSegmentFailureMechanismType(inputSoilGeometryProbability.SegmentFailureMechanismType); + } + else + { + soilGeometryProbability.SegmentFailureMechanismType = null; + } + if (inputSoilGeometryProbability.SoilProfileType == 0) + { + soilGeometryProbability.SoilProfile = FindSoilProfile1DByName(dikeSoilProfiles, inputSoilGeometryProbability.SoilProfileName); + } + else + { + soilGeometryProbability.SoilGeometry2DName = inputSoilGeometryProbability.SoilProfileName; + } + if (soilGeometryProbability.SoilProfileType != ConversionHelper.ConvertToSoilProfileType(inputSoilGeometryProbability.SoilProfileType)) + { + throw new ConversionException(typeof(SegmentSoilGeometryProbability), soilGeometryProbability.SoilProfileType); + } + segment.SoilProfileProbabilities.Add(soilGeometryProbability); + } + } + + /// + /// Finds the SoilProfile1D by name. + /// + /// The soil profiles. + /// The name. + /// + public static SoilProfile1D FindSoilProfile1DByName(IList soilProfiles, string name) + { + foreach (var soilProfile1D in soilProfiles) + { + if (soilProfile1D.Name == name) + return soilProfile1D; + } + return null; + } + + } +} Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DtoAssembler/DtoPropertyAttributeMapping.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DtoAssembler/DtoPropertyAttributeMapping.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/DtoAssembler/DtoPropertyAttributeMapping.cs (revision 3305) @@ -0,0 +1,110 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU 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; + +namespace Deltares.Standard +{ + /// + /// Importance or the requiremen for a value in the domain object + /// before it can be used in a dto + /// + public enum DtoPropertyImportance + { + /// + /// Use this setting when the property or attribute must have a value + /// + Required, + + /// + /// Use this setting when the property or attribute value is optional + /// + Optional + } + + /// + /// Defines a mapping class which can be used in the DtoAssemler for creating + /// mappings between class properties and xml attributes + /// + public class DtoPropertyAttriubteMapping + { + /// + /// Holds the property to attribute translation rule + /// + private Func toAttributeTranslationRule; + + /// + /// Holds the attribute to property translation rule. + /// + private Func toPropTranslationRule; + + + /// + /// Initializes a new instance of the DtoPropertyAttriubteMapping class + /// + public DtoPropertyAttriubteMapping() + { + this.Importance = DtoPropertyImportance.Optional; + } + + /// + /// Gets or sets the name of the property in the domain object + /// + public string PropertyName { get; set; } + + /// + /// Gets or sets the name of the xml attribute of the dto + /// + public string AttributeName { get; set; } + + /// + /// Gets or sets the importance of the value. Required or optional? + /// + public DtoPropertyImportance Importance { get; set; } + + /// + /// Gets or sets the attribute to property translation rule + /// + /// + /// Use this property when a string value in the xml needs to be specifically translated. This can be useful + /// in scenario's when a string value needs to be translated to a specific enum value. + /// For example when the enum string value "Belgian Bessel" needs to be translated to the enum type CoordinateSystem.BelgianBessel + /// + public Func ToPropertyTranslationRule + { + get { return this.toPropTranslationRule; } + set { this.toPropTranslationRule = new Func(value); } + } + + /// + /// Gets or sets the property to attribute translation rule + /// + /// + /// Use this property when a property value needs to be translated to a specific string value. + /// For example when the enum type CoordinateSystem.BelgianBessel needs to be translated to the enum string value "Belgian Bessel" + /// + public Func ToAttributeTranslationRule + { + get { return this.toAttributeTranslationRule; } + set { this.toAttributeTranslationRule = new Func(value); } + } + } +} \ No newline at end of file Index: DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/WaterBoard.cs =================================================================== diff -u --- DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/WaterBoard.cs (revision 0) +++ DamClients/DamLive/branches/DamLive 19.2/src/DamClientsLibrary/Deltares.Dam.Data/WaterBoard.cs (revision 3305) @@ -0,0 +1,272 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - Clients Library. +// +// DAM - UI is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Xml.Serialization; +using Deltares.Maps; +using Deltares.Standard; +using Deltares.Standard.Attributes; +using Deltares.Standard.EventPublisher; +using Deltares.Standard.Language; + +namespace Deltares.Dam.Data +{ + public class WaterBoard : IVisibleEnabled, IDisposable + { + private string description = ""; + private IList dikes; + private List locations = null; + private readonly FeatureRepository backgroundRepository; + private IList featureList = null; + private IList segments; + private IList soilgeometry2DNames; + private string waterLevelTimeSeriesFileName; + private IVisibleEnabledProvider visibleEnabledProvider; + private Dike selectedDike; + + public WaterBoard() + { + this.dikes = new List(); + this.featureList = new List(); + this.backgroundRepository = new FeatureRepository(); + this.segments = new List(); + this.soilgeometry2DNames = new List(); + } + + public virtual IList Segments + { + get { return this.segments; } + set { this.segments = value; } + } + + public virtual IList SoilGeometry2DNames + { + get { return this.soilgeometry2DNames; } + set { this.soilgeometry2DNames = value; } + } + + public void FillGeometry2DNamesFromSegments() + { + // Add soilgeometry2D names into list + foreach (Segment segment in Segments) + { + foreach (SoilGeometryProbability soilGeometryProbability in segment.SoilProfileProbabilities) + { + if (soilGeometryProbability.SoilGeometry2DName != null && !SoilGeometry2DNamesContains(soilGeometryProbability.SoilGeometry2DName)) + { + SoilGeometry2DName soilGeometry2DName = new SoilGeometry2DName(); + soilGeometry2DName.Geometry2DName = soilGeometryProbability.SoilGeometry2DName; + SoilGeometry2DNames.Add(soilGeometry2DName); + } + } + } + } + + public void FillFeatureList() + { + foreach (var feature in backgroundRepository.Features) + { + BackgroundRepositoryFeature featureStr = new BackgroundRepositoryFeature(); + featureStr.Feature = feature.WktFormat; + featureList.Add(featureStr); + } + } + + /// + /// Updates the locations for scenarios. + /// + public void UpdateLocationsForScenarios() + { + foreach (Dike dike in this.Dikes) + { + dike.UpdateLocationsForScenarios(); + } + } + + /// + /// Gets the selected dike. + /// Is a helper property to be able to show the soil table. When more Dikes than one are allowed, + /// this has to become a "real" property set by the onselectionchanged event. + /// + /// + /// The selected dike. + /// + public Dike SelectedDike + { + get + { + if (selectedDike != null) + { + return selectedDike; + } + return dikes.Count > 0 ? dikes[0] : null; + } + set + { + DataEventPublisher.BeforeChange(this, x => x.SelectedDike); + selectedDike = value; + DataEventPublisher.AfterChange(this, x => x.SelectedDike); + } + } + + private bool SoilGeometry2DNamesContains(string Name) + { + foreach (var soilGeometry2DName in SoilGeometry2DNames) + { + if (soilGeometry2DName.Geometry2DName == Name) + return true; + } + return false; + } + + private void FillBackGroundRepos() + { + if (featureList != null) + { + backgroundRepository.Clear(); + foreach (BackgroundRepositoryFeature s in featureList) + { + backgroundRepository.Add(Feature.Create(s.Feature)); + } + } + + } + + public virtual IList BackgroundRepositoryFeatures + { + get + { + return this.featureList; + } + set + { + this.featureList = value; + FillBackGroundRepos(); + } + } + + public virtual IList Dikes + { + get { return this.dikes; } + set { this.dikes = value; } + } + + [XmlIgnore] + [Browsable(false)] + [ReadOnly(true)] + [Label("Locations")] + public List Locations + { + get + { + if (locations == null) + { + locations = new List(); + foreach (Dike dike in this.Dikes) + { + locations.AddRange(dike.Locations); + } + } + + return locations; + } + } + + [Label("Number of Dikes")] + public virtual string NumberOfDikes + { + get { return this.dikes.Count.ToString(); } + } + + public virtual string Name + { + get { return String.Format(LocalizationManager.GetTranslatedText(this, "WaterBoard")); } + } + + public virtual string Description + { + get { return description; } + set { description = value; } + } + + public override string ToString() + { + return Name; + } + + public bool IsVisible(string property) + { + switch (property) + { + case "SelectedDike": return visibleEnabledProvider != null && visibleEnabledProvider.IsVisible(this, "SelectedDike"); + case "WaterLevelTimeSeriesFileName": return Location.DamProjectType == DamProjectType.Calamity; + default : return true; + } + } + + [XmlIgnore] + [Browsable(false)] + public IVisibleEnabledProvider VisibleEnabledProvider + { + get { return visibleEnabledProvider; } + set { visibleEnabledProvider = value; } + } + + public bool IsEnabled(string property) + { + return true; + } + + public void AddBackgroundGeometry(IFeature geometry) + { + this.backgroundRepository.Add(geometry); + } + + [Label("Waterlevel timeseries filename")] + public string WaterLevelTimeSeriesFileName + { + get { return waterLevelTimeSeriesFileName; } + set + { + DataEventPublisher.BeforeChange(this, "WaterLevelTimeSeriesFileName"); + waterLevelTimeSeriesFileName = value; + DataEventPublisher.AfterChange(this, "WaterLevelTimeSeriesFileName"); + } + } + + public Segment GetSegmentByName(string segmentId) + { + Segment segment = this.segments.Where(x => ((x.Name == segmentId))).FirstOrDefault(); + return segment; + } + + public void Dispose() + { + foreach (var dike in Dikes) + { + dike.Dispose(); + } + } + } +}