Index: Ringtoets.sln =================================================================== diff -u -r3b368e38644b163189a58233f9fc1fb9701bf68c -rdd3466c892baa253c4b94ee4997b43ebadf4161c --- Ringtoets.sln (.../Ringtoets.sln) (revision 3b368e38644b163189a58233f9fc1fb9701bf68c) +++ Ringtoets.sln (.../Ringtoets.sln) (revision dd3466c892baa253c4b94ee4997b43ebadf4161c) @@ -509,7 +509,7 @@ {C90B77DA-E421-43CC-B82E-529651BC21AC} = {C90B77DA-E421-43CC-B82E-529651BC21AC} EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Riskeer.HydraRing.IO", "Ringtoets\HydraRing\src\Ringtoets.HydraRing.IO\Riskeer.HydraRing.IO.csproj", "{B69D5B6C-6E14-4FA9-9EBC-8F97678CDB70}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Riskeer.HydraRing.IO", "Ringtoets\HydraRing\src\Riskeer.HydraRing.IO\Riskeer.HydraRing.IO.csproj", "{B69D5B6C-6E14-4FA9-9EBC-8F97678CDB70}" ProjectSection(ProjectDependencies) = postProject {C90B77DA-E421-43CC-B82E-529651BC21AC} = {C90B77DA-E421-43CC-B82E-529651BC21AC} EndProjectSection Index: Ringtoets/Common/src/Ringtoets.Common.IO/Ringtoets.Common.IO.csproj =================================================================== diff -u -r3b368e38644b163189a58233f9fc1fb9701bf68c -rdd3466c892baa253c4b94ee4997b43ebadf4161c --- Ringtoets/Common/src/Ringtoets.Common.IO/Ringtoets.Common.IO.csproj (.../Ringtoets.Common.IO.csproj) (revision 3b368e38644b163189a58233f9fc1fb9701bf68c) +++ Ringtoets/Common/src/Ringtoets.Common.IO/Ringtoets.Common.IO.csproj (.../Ringtoets.Common.IO.csproj) (revision dd3466c892baa253c4b94ee4997b43ebadf4161c) @@ -231,7 +231,7 @@ Riskeer.HydraRing.Calculation False - + {B69D5B6C-6E14-4FA9-9EBC-8F97678CDB70} Riskeer.HydraRing.IO False Fisheye: Tag dd3466c892baa253c4b94ee4997b43ebadf4161c refers to a dead (removed) revision in file `Ringtoets/HydraRing/src/Ringtoets.HydraRing.IO/HydraulicBoundaryDatabase/GeneralTableDefinitions.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag dd3466c892baa253c4b94ee4997b43ebadf4161c refers to a dead (removed) revision in file `Ringtoets/HydraRing/src/Ringtoets.HydraRing.IO/HydraulicBoundaryDatabase/HrdLocationsTableDefinitions.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag dd3466c892baa253c4b94ee4997b43ebadf4161c refers to a dead (removed) revision in file `Ringtoets/HydraRing/src/Ringtoets.HydraRing.IO/HydraulicBoundaryDatabase/HydraulicBoundaryDatabaseQueryBuilder.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag dd3466c892baa253c4b94ee4997b43ebadf4161c refers to a dead (removed) revision in file `Ringtoets/HydraRing/src/Ringtoets.HydraRing.IO/HydraulicBoundaryDatabase/HydraulicBoundaryDatabaseReader.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag dd3466c892baa253c4b94ee4997b43ebadf4161c refers to a dead (removed) revision in file `Ringtoets/HydraRing/src/Ringtoets.HydraRing.IO/HydraulicBoundaryDatabase/ReadHydraulicBoundaryDatabase.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag dd3466c892baa253c4b94ee4997b43ebadf4161c refers to a dead (removed) revision in file `Ringtoets/HydraRing/src/Ringtoets.HydraRing.IO/HydraulicBoundaryDatabase/ReadHydraulicBoundaryLocation.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag dd3466c892baa253c4b94ee4997b43ebadf4161c refers to a dead (removed) revision in file `Ringtoets/HydraRing/src/Ringtoets.HydraRing.IO/HydraulicLocationConfigurationDatabase/HydraulicLocationConfigurationDatabaseQueryBuilder.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag dd3466c892baa253c4b94ee4997b43ebadf4161c refers to a dead (removed) revision in file `Ringtoets/HydraRing/src/Ringtoets.HydraRing.IO/HydraulicLocationConfigurationDatabase/HydraulicLocationConfigurationDatabaseReader.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag dd3466c892baa253c4b94ee4997b43ebadf4161c refers to a dead (removed) revision in file `Ringtoets/HydraRing/src/Ringtoets.HydraRing.IO/HydraulicLocationConfigurationDatabase/LocationsTableDefinitions.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag dd3466c892baa253c4b94ee4997b43ebadf4161c refers to a dead (removed) revision in file `Ringtoets/HydraRing/src/Ringtoets.HydraRing.IO/HydraulicLocationConfigurationDatabase/ReadHydraulicLocationConfigurationDatabase.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag dd3466c892baa253c4b94ee4997b43ebadf4161c refers to a dead (removed) revision in file `Ringtoets/HydraRing/src/Ringtoets.HydraRing.IO/HydraulicLocationConfigurationDatabase/ReadHydraulicLocationConfigurationDatabaseSettings.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag dd3466c892baa253c4b94ee4997b43ebadf4161c refers to a dead (removed) revision in file `Ringtoets/HydraRing/src/Ringtoets.HydraRing.IO/HydraulicLocationConfigurationDatabase/ReadHydraulicLocationMapping.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag dd3466c892baa253c4b94ee4997b43ebadf4161c refers to a dead (removed) revision in file `Ringtoets/HydraRing/src/Ringtoets.HydraRing.IO/HydraulicLocationConfigurationDatabase/ScenarioInformationTableDefinitions.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag dd3466c892baa253c4b94ee4997b43ebadf4161c refers to a dead (removed) revision in file `Ringtoets/HydraRing/src/Ringtoets.HydraRing.IO/Properties/AssemblyInfo.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag dd3466c892baa253c4b94ee4997b43ebadf4161c refers to a dead (removed) revision in file `Ringtoets/HydraRing/src/Ringtoets.HydraRing.IO/Properties/Resources.Designer.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag dd3466c892baa253c4b94ee4997b43ebadf4161c refers to a dead (removed) revision in file `Ringtoets/HydraRing/src/Ringtoets.HydraRing.IO/Properties/Resources.resx'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag dd3466c892baa253c4b94ee4997b43ebadf4161c refers to a dead (removed) revision in file `Ringtoets/HydraRing/src/Ringtoets.HydraRing.IO/Riskeer.HydraRing.IO.csproj'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag dd3466c892baa253c4b94ee4997b43ebadf4161c refers to a dead (removed) revision in file `Ringtoets/HydraRing/src/Ringtoets.HydraRing.IO/packages.config'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/HydraRing/src/Riskeer.HydraRing.IO/HydraulicBoundaryDatabase/GeneralTableDefinitions.cs =================================================================== diff -u --- Ringtoets/HydraRing/src/Riskeer.HydraRing.IO/HydraulicBoundaryDatabase/GeneralTableDefinitions.cs (revision 0) +++ Ringtoets/HydraRing/src/Riskeer.HydraRing.IO/HydraulicBoundaryDatabase/GeneralTableDefinitions.cs (revision dd3466c892baa253c4b94ee4997b43ebadf4161c) @@ -0,0 +1,35 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets 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 Riskeer.HydraRing.IO.HydraulicBoundaryDatabase +{ + /// + /// Defines the table and column names of the table 'General' in the hydraulic boundary database. + /// + internal static class GeneralTableDefinitions + { + internal const string TableName = "General"; + internal const string RegionName = "NameRegion"; + internal const string TrackId = "TrackId"; + internal const string CreationDate = "CreationDate"; + internal const string GeneratedVersion = "GeneratedVersion"; + } +} \ No newline at end of file Index: Ringtoets/HydraRing/src/Riskeer.HydraRing.IO/HydraulicBoundaryDatabase/HrdLocationsTableDefinitions.cs =================================================================== diff -u --- Ringtoets/HydraRing/src/Riskeer.HydraRing.IO/HydraulicBoundaryDatabase/HrdLocationsTableDefinitions.cs (revision 0) +++ Ringtoets/HydraRing/src/Riskeer.HydraRing.IO/HydraulicBoundaryDatabase/HrdLocationsTableDefinitions.cs (revision dd3466c892baa253c4b94ee4997b43ebadf4161c) @@ -0,0 +1,37 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets 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 Riskeer.HydraRing.IO.HydraulicBoundaryDatabase +{ + /// + /// Defines the table and column names of the table 'HRDLocations' in the hydraulic boundary database. + /// + public static class HrdLocationsTableDefinitions + { + internal const string TableName = "HRDLocations"; + internal const string HrdLocationId = "HRDLocationId"; + internal const string LocationTypeId = "LocationTypeId"; + internal const string Name = "Name"; + internal const string XCoordinate = "XCoordinate"; + internal const string YCoordinate = "YCoordinate"; + internal const string Count = "nrOfRows"; + } +} \ No newline at end of file Index: Ringtoets/HydraRing/src/Riskeer.HydraRing.IO/HydraulicBoundaryDatabase/HydraulicBoundaryDatabaseQueryBuilder.cs =================================================================== diff -u --- Ringtoets/HydraRing/src/Riskeer.HydraRing.IO/HydraulicBoundaryDatabase/HydraulicBoundaryDatabaseQueryBuilder.cs (revision 0) +++ Ringtoets/HydraRing/src/Riskeer.HydraRing.IO/HydraulicBoundaryDatabase/HydraulicBoundaryDatabaseQueryBuilder.cs (revision dd3466c892baa253c4b94ee4997b43ebadf4161c) @@ -0,0 +1,62 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets 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 Riskeer.HydraRing.IO.HydraulicBoundaryDatabase +{ + /// + /// Defines queries to execute on a hydraulic boundary database. + /// + public static class HydraulicBoundaryDatabaseQueryBuilder + { + /// + /// Returns the query to get the version from the database. + /// + /// The query to get the version from the database. + public static string GetVersionQuery() + { + return $"SELECT ({GeneralTableDefinitions.RegionName} || " + + $"{GeneralTableDefinitions.CreationDate} || " + + $"{GeneralTableDefinitions.TrackId}) as {GeneralTableDefinitions.GeneratedVersion} " + + $"FROM {GeneralTableDefinitions.TableName} LIMIT 0,1;"; + } + + /// + /// Returns the query to get the track id from the database. + /// + /// The query to get the track id from the database. + public static string GetTrackIdQuery() + { + return $"SELECT {GeneralTableDefinitions.TrackId} FROM {GeneralTableDefinitions.TableName} LIMIT 0,1;"; + } + + /// + /// Returns the query to get all relevant locations from the database. + /// + /// The query to get all relevant locations from the database. + public static string GetRelevantLocationsQuery() + { + return $"SELECT {HrdLocationsTableDefinitions.HrdLocationId}, {HrdLocationsTableDefinitions.Name}, " + + $"{HrdLocationsTableDefinitions.XCoordinate}, {HrdLocationsTableDefinitions.YCoordinate} " + + $"FROM {HrdLocationsTableDefinitions.TableName} " + + $"WHERE {HrdLocationsTableDefinitions.LocationTypeId} > 1;"; // Value > 1 makes it relevant + } + } +} \ No newline at end of file Index: Ringtoets/HydraRing/src/Riskeer.HydraRing.IO/HydraulicBoundaryDatabase/HydraulicBoundaryDatabaseReader.cs =================================================================== diff -u --- Ringtoets/HydraRing/src/Riskeer.HydraRing.IO/HydraulicBoundaryDatabase/HydraulicBoundaryDatabaseReader.cs (revision 0) +++ Ringtoets/HydraRing/src/Riskeer.HydraRing.IO/HydraulicBoundaryDatabase/HydraulicBoundaryDatabaseReader.cs (revision dd3466c892baa253c4b94ee4997b43ebadf4161c) @@ -0,0 +1,173 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets 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.SQLite; +using System.Linq; +using Core.Common.Base.IO; +using Core.Common.IO.Exceptions; +using Core.Common.IO.Readers; +using Core.Common.Util.Builders; +using Riskeer.HydraRing.IO.Properties; + +namespace Riskeer.HydraRing.IO.HydraulicBoundaryDatabase +{ + /// + /// This class reads a hydraulic boundary database file and constructs a + /// instance from this database. + /// + public class HydraulicBoundaryDatabaseReader : SqLiteDatabaseReaderBase + { + /// + /// Creates a new instance of , + /// which will use the as its source. + /// + /// The path of the database file to open. + /// Thrown when: + /// + /// The contains invalid characters. + /// No file could be found at . + /// + /// + public HydraulicBoundaryDatabaseReader(string databaseFilePath) : base(databaseFilePath) {} + + /// + /// Reads the hydraulic boundary database. + /// + /// A . + /// Thrown when the database contains incorrect values for required properties. + /// Thrown when the data cannot be read. + public ReadHydraulicBoundaryDatabase Read() + { + return new ReadHydraulicBoundaryDatabase(ReadTrackId(), ReadVersion(), ReadLocations().ToArray()); + } + + /// + /// Reads the track Id from the hydraulic boundary database. + /// + /// The track Id found in the database. + /// Thrown when the database contains incorrect values for required properties. + /// Thrown when the track Id cannot be read. + public long ReadTrackId() + { + try + { + using (IDataReader reader = CreateDataReader(HydraulicBoundaryDatabaseQueryBuilder.GetTrackIdQuery(), + new SQLiteParameter + { + DbType = DbType.String + })) + { + if (reader.Read()) + { + return Convert.ToInt64(reader[GeneralTableDefinitions.TrackId]); + } + + throw new CriticalFileReadException(new FileReaderErrorMessageBuilder(Path) + .Build(Resources.HydraulicBoundaryDatabaseReader_Critical_Unexpected_value_on_column)); + } + } + catch (InvalidCastException exception) + { + string message = new FileReaderErrorMessageBuilder(Path).Build(Resources.HydraulicBoundaryDatabaseReader_Critical_Unexpected_value_on_column); + throw new LineParseException(message, exception); + } + catch (SQLiteException exception) + { + string message = new FileReaderErrorMessageBuilder(Path).Build(Resources.Error_HydraulicBoundaryLocation_read_from_database); + throw new CriticalFileReadException(message, exception); + } + } + + /// + /// Gets the version of the hydraulic boundary database. + /// + /// The version found in the database, or if the version cannot be found. + /// Thrown when the version cannot be read.. + public string ReadVersion() + { + try + { + using (IDataReader reader = CreateDataReader(HydraulicBoundaryDatabaseQueryBuilder.GetVersionQuery(), null)) + { + + if (reader.Read()) + { + string version = Convert.ToString(reader[GeneralTableDefinitions.GeneratedVersion]); + + if (!string.IsNullOrEmpty(version)) + { + return version; + } + } + + string message = new FileReaderErrorMessageBuilder(Path).Build(Resources.HydraulicBoundaryDatabaseReader_Critical_Unexpected_value_on_column); + throw new CriticalFileReadException(message); + } + } + catch (SQLiteException e) + { + string message = new FileReaderErrorMessageBuilder(Path).Build(Resources.Error_HydraulicBoundaryLocation_read_from_database); + throw new CriticalFileReadException(message, e); + } + } + + /// + /// Reads the locations from the database. + /// + /// Thrown when the database contains incorrect values for required properties. + private IEnumerable ReadLocations() + { + using (IDataReader reader = CreateDataReader(HydraulicBoundaryDatabaseQueryBuilder.GetRelevantLocationsQuery())) + { + while (MoveNext(reader)) + { + yield return ReadLocation(reader); + } + } + } + + /// + /// Reads a location from the database. + /// + /// A based on the data read from the database. + /// Thrown when the database contains incorrect values for required properties. + private ReadHydraulicBoundaryLocation ReadLocation(IDataReader reader) + { + try + { + var id = reader.Read(HrdLocationsTableDefinitions.HrdLocationId); + var name = reader.Read(HrdLocationsTableDefinitions.Name); + var x = reader.Read(HrdLocationsTableDefinitions.XCoordinate); + var y = reader.Read(HrdLocationsTableDefinitions.YCoordinate); + + return new ReadHydraulicBoundaryLocation(id, name, x, y); + } + catch (ConversionException e) + { + string message = new FileReaderErrorMessageBuilder(Path).Build(Resources.HydraulicBoundaryDatabaseReader_Critical_Unexpected_value_on_column); + throw new LineParseException(message, e); + } + } + } +} \ No newline at end of file Index: Ringtoets/HydraRing/src/Riskeer.HydraRing.IO/HydraulicBoundaryDatabase/ReadHydraulicBoundaryDatabase.cs =================================================================== diff -u --- Ringtoets/HydraRing/src/Riskeer.HydraRing.IO/HydraulicBoundaryDatabase/ReadHydraulicBoundaryDatabase.cs (revision 0) +++ Ringtoets/HydraRing/src/Riskeer.HydraRing.IO/HydraulicBoundaryDatabase/ReadHydraulicBoundaryDatabase.cs (revision dd3466c892baa253c4b94ee4997b43ebadf4161c) @@ -0,0 +1,59 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets 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 Riskeer.HydraRing.IO.HydraulicBoundaryDatabase +{ + /// + /// Class for holding data that is read from a hydraulic boundary database file. + /// + public class ReadHydraulicBoundaryDatabase + { + /// + /// Creates a new instance of . + /// + /// The track Id of the read hydraulic boundary database. + /// The version of the read hydraulic boundary database. + /// The read hydraulic boundary locations. + internal ReadHydraulicBoundaryDatabase(long trackId, string version, IEnumerable locations) + { + TrackId = trackId; + Version = version; + Locations = locations; + } + + /// + /// Gets the track Id of the read hydraulic boundary database. + /// + public long TrackId { get; } + + /// + /// Gets the version of the read hydraulic boundary database. + /// + public string Version { get; } + + /// + /// Gets the read hydraulic boundary locations. + /// + public IEnumerable Locations { get; } + } +} \ No newline at end of file Index: Ringtoets/HydraRing/src/Riskeer.HydraRing.IO/HydraulicBoundaryDatabase/ReadHydraulicBoundaryLocation.cs =================================================================== diff -u --- Ringtoets/HydraRing/src/Riskeer.HydraRing.IO/HydraulicBoundaryDatabase/ReadHydraulicBoundaryLocation.cs (revision 0) +++ Ringtoets/HydraRing/src/Riskeer.HydraRing.IO/HydraulicBoundaryDatabase/ReadHydraulicBoundaryLocation.cs (revision dd3466c892baa253c4b94ee4997b43ebadf4161c) @@ -0,0 +1,72 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets 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 Riskeer.HydraRing.IO.HydraulicBoundaryDatabase +{ + /// + /// Location that is read from a hydraulic boundary database file. + /// + public class ReadHydraulicBoundaryLocation + { + /// + /// Creates a new instance of . + /// + /// The database id of the read hydraulic boundary location. + /// The name of the read hydraulic boundary location. + /// The x coordinate of the read hydraulic boundary location. + /// The y coordinate of the read hydraulic boundary location. + /// Thrown when is null. + public ReadHydraulicBoundaryLocation(long id, string name, double coordinateX, double coordinateY) + { + if (name == null) + { + throw new ArgumentNullException(nameof(name)); + } + + Id = id; + Name = name; + CoordinateX = coordinateX; + CoordinateY = coordinateY; + } + + /// + /// Gets the database id of the read hydraulic boundary location. + /// + public long Id { get; } + + /// + /// Gets the name of the read hydraulic boundary location. + /// + public string Name { get; } + + /// + /// Gets the x coordinate of the read hydraulic boundary location. + /// + public double CoordinateX { get; } + + /// + /// Gets the y coordinate of the read hydraulic boundary location. + /// + public double CoordinateY { get; } + } +} \ No newline at end of file Index: Ringtoets/HydraRing/src/Riskeer.HydraRing.IO/HydraulicLocationConfigurationDatabase/HydraulicLocationConfigurationDatabaseQueryBuilder.cs =================================================================== diff -u --- Ringtoets/HydraRing/src/Riskeer.HydraRing.IO/HydraulicLocationConfigurationDatabase/HydraulicLocationConfigurationDatabaseQueryBuilder.cs (revision 0) +++ Ringtoets/HydraRing/src/Riskeer.HydraRing.IO/HydraulicLocationConfigurationDatabase/HydraulicLocationConfigurationDatabaseQueryBuilder.cs (revision dd3466c892baa253c4b94ee4997b43ebadf4161c) @@ -0,0 +1,70 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets 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 Riskeer.HydraRing.IO.HydraulicLocationConfigurationDatabase +{ + /// + /// Defines queries to execute on a hydraulic location configuration database. + /// + public static class HydraulicLocationConfigurationDatabaseQueryBuilder + { + /// + /// Gets the query to get location ids from the database. + /// + /// The query to get location ids from the database. + public static string GetLocationIdsByTrackIdQuery() + { + return $"SELECT {LocationsTableDefinitions.LocationId}, {LocationsTableDefinitions.HrdLocationId} " + + $"FROM {LocationsTableDefinitions.TableName} " + + $"WHERE {LocationsTableDefinitions.TrackId} = @{LocationsTableDefinitions.TrackId} " + + $"ORDER BY {LocationsTableDefinitions.HrdLocationId};"; + } + + /// + /// Gets the query to determine whether data related to the scenario information is present in the database. + /// + /// The query to determine the presence of the scenario information in the database. + public static string GetIsScenarioInformationPresentQuery() + { + return $"SELECT COUNT() = 1 AS {ScenarioInformationTableDefinitions.IsScenarioInformationPresent} " + + "FROM sqlite_master WHERE type = 'table' " + + $"AND name='{ScenarioInformationTableDefinitions.TableName}';"; + } + + /// + /// Gets the query to get the scenario information from the database. + /// + /// The query to get the scenario information from the database. + public static string GetScenarioInformationQuery() + { + return $"SELECT {ScenarioInformationTableDefinitions.ScenarioName}, " + + $"{ScenarioInformationTableDefinitions.Year}, " + + $"{ScenarioInformationTableDefinitions.Scope}, " + + $"{ScenarioInformationTableDefinitions.SeaLevel}, " + + $"{ScenarioInformationTableDefinitions.RiverDischarge}, " + + $"{ScenarioInformationTableDefinitions.LakeLevel}, " + + $"{ScenarioInformationTableDefinitions.WindDirection}, " + + $"{ScenarioInformationTableDefinitions.WindSpeed}, " + + $"{ScenarioInformationTableDefinitions.Comment} " + + $"FROM {ScenarioInformationTableDefinitions.TableName};"; + } + } +} \ No newline at end of file Index: Ringtoets/HydraRing/src/Riskeer.HydraRing.IO/HydraulicLocationConfigurationDatabase/HydraulicLocationConfigurationDatabaseReader.cs =================================================================== diff -u --- Ringtoets/HydraRing/src/Riskeer.HydraRing.IO/HydraulicLocationConfigurationDatabase/HydraulicLocationConfigurationDatabaseReader.cs (revision 0) +++ Ringtoets/HydraRing/src/Riskeer.HydraRing.IO/HydraulicLocationConfigurationDatabase/HydraulicLocationConfigurationDatabaseReader.cs (revision dd3466c892baa253c4b94ee4997b43ebadf4161c) @@ -0,0 +1,253 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets 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.SQLite; +using System.Linq; +using Core.Common.Base.IO; +using Core.Common.IO.Exceptions; +using Core.Common.IO.Readers; +using Core.Common.Util.Builders; +using log4net; +using Riskeer.HydraRing.IO.Properties; + +namespace Riskeer.HydraRing.IO.HydraulicLocationConfigurationDatabase +{ + /// + /// Class for reading information from a hydraulic location configuration database (HLCD). + /// + public class HydraulicLocationConfigurationDatabaseReader : SqLiteDatabaseReaderBase + { + private static readonly ILog log = LogManager.GetLogger(typeof(HydraulicLocationConfigurationDatabaseReader)); + + /// + /// Creates a new instance of , + /// which will use the as its source. + /// + /// The path of the database file to open. + /// Thrown when: + /// + /// The contains invalid characters. + /// No file could be found at . + /// + /// + public HydraulicLocationConfigurationDatabaseReader(string databaseFilePath) : base(databaseFilePath) {} + + /// + /// Reads the hydraulic location configuration database. + /// + /// The track id to read the location configurations for. + /// A read hydraulic location configuration database. + /// Thrown when hydraulic location configuration database + /// could not be read. + /// Thrown when the database returned incorrect values for + /// required properties. + public ReadHydraulicLocationConfigurationDatabase Read(long trackId) + { + IEnumerable configurationSettings = IsScenarioInformationTablePresent() + ? GetConfigurationSettings() + : null; + + return new ReadHydraulicLocationConfigurationDatabase(GetLocationIdsByTrackId(trackId), + configurationSettings); + } + + /// + /// Gets the location ids from the database, based upon . + /// + /// The hydraulic boundary track id. + /// A collection of as found in the database. + /// Thrown when the database query failed. + /// Thrown when the database returned incorrect values for + /// required properties. + private IEnumerable GetLocationIdsByTrackId(long trackId) + { + var trackParameter = new SQLiteParameter + { + DbType = DbType.String, + ParameterName = LocationsTableDefinitions.TrackId, + Value = trackId + }; + + try + { + return GetLocationIdsFromDatabase(trackParameter); + } + catch (SQLiteException exception) + { + string message = new FileReaderErrorMessageBuilder(Path).Build(Resources.HydraulicLocationConfigurationDatabaseReader_Critical_Unexpected_Exception); + throw new CriticalFileReadException(message, exception); + } + catch (InvalidCastException exception) + { + string message = new FileReaderErrorMessageBuilder(Path).Build(Resources.HydraulicBoundaryDatabaseReader_Critical_Unexpected_value_on_column); + throw new LineParseException(message, exception); + } + } + + /// + /// Gets the location ids from the database, based upon . + /// + /// A parameter containing the hydraulic boundary track id. + /// A collection of as found in the database. + /// Thrown when the database query failed. + /// Thrown when the database returned incorrect values for + /// required properties. + private IEnumerable GetLocationIdsFromDatabase(SQLiteParameter trackParameter) + { + string query = HydraulicLocationConfigurationDatabaseQueryBuilder.GetLocationIdsByTrackIdQuery(); + var locationLookup = new Dictionary(); + + using (IDataReader dataReader = CreateDataReader(query, trackParameter)) + { + while (MoveNext(dataReader)) + { + long hrdLocationId = Convert.ToInt64(dataReader[LocationsTableDefinitions.HrdLocationId]); + long hlcdLocationId = Convert.ToInt64(dataReader[LocationsTableDefinitions.LocationId]); + + // Must be unique + if (locationLookup.ContainsKey(hrdLocationId)) + { + log.Warn(Resources.HydraulicLocationConfigurationDatabaseReader_GetLocationIdFromDatabase_Ambiguous_Row_Found_Take_First); + } + else + { + locationLookup[hrdLocationId] = hlcdLocationId; + } + } + } + + return locationLookup.Select(lookup => new ReadHydraulicLocationMapping(lookup.Key, lookup.Value)).ToArray(); + } + + /// + /// Gets the hydraulic location configuration settings from the database. + /// + /// A collection of the read hydraulic configuration database settings. + /// Thrown when the database query failed. + /// Thrown when the database returned incorrect values for + /// required properties. + private IEnumerable GetConfigurationSettings() + { + try + { + return GetConfigurationSettingsFromDatabase(); + } + catch (SQLiteException exception) + { + string message = new FileReaderErrorMessageBuilder(Path).Build(Resources.HydraulicLocationConfigurationDatabaseReader_Critical_Unexpected_Exception); + throw new CriticalFileReadException(message, exception); + } + } + + /// + /// Determines whether the table related to the scenario information is present in the database. + /// + /// true if the table is present; false otherwise. + /// Thrown when the information could not be read from the database file. + /// Thrown when the database returned incorrect values for + /// required properties. + private bool IsScenarioInformationTablePresent() + { + string query = HydraulicLocationConfigurationDatabaseQueryBuilder.GetIsScenarioInformationPresentQuery(); + + try + { + using (IDataReader dataReader = CreateDataReader(query)) + { + if (dataReader.Read()) + { + return Convert.ToBoolean(dataReader[ScenarioInformationTableDefinitions.IsScenarioInformationPresent]); + } + + string message = new FileReaderErrorMessageBuilder(Path).Build(Resources.HydraulicBoundaryDatabaseReader_Critical_Unexpected_value_on_column); + throw new CriticalFileReadException(message); + } + } + catch (SQLiteException exception) + { + string message = new FileReaderErrorMessageBuilder(Path).Build(Resources.HydraulicLocationConfigurationDatabaseReader_Critical_Unexpected_Exception); + throw new CriticalFileReadException(message, exception); + } + catch (InvalidCastException exception) + { + string message = new FileReaderErrorMessageBuilder(Path).Build(Resources.HydraulicBoundaryDatabaseReader_Critical_Unexpected_value_on_column); + throw new LineParseException(message, exception); + } + } + + /// + /// Gets the hydraulic location configuration settings from the database. + /// + /// A collection of the read hydraulic configuration database settings. + /// Thrown when the database query failed. + /// Thrown when the database returned incorrect values for + /// required properties. + private IEnumerable GetConfigurationSettingsFromDatabase() + { + string query = HydraulicLocationConfigurationDatabaseQueryBuilder.GetScenarioInformationQuery(); + var readSettings = new List(); + using (IDataReader dataReader = CreateDataReader(query)) + { + while (MoveNext(dataReader)) + { + readSettings.Add(ReadSetting(dataReader)); + } + } + + return readSettings; + } + + /// + /// Reads the hydraulic location configuration setting from the database. + /// + /// The which is used to read the data. + /// The read . + /// Thrown when the database returned incorrect values for + /// required properties. + private ReadHydraulicLocationConfigurationDatabaseSettings ReadSetting(IDataReader reader) + { + try + { + var scenarioName = reader.Read(ScenarioInformationTableDefinitions.ScenarioName); + var year = reader.Read(ScenarioInformationTableDefinitions.Year); + var scope = reader.Read(ScenarioInformationTableDefinitions.Scope); + var seaLevel = reader.Read(ScenarioInformationTableDefinitions.SeaLevel); + var riverDischarge = reader.Read(ScenarioInformationTableDefinitions.RiverDischarge); + var lakeLevel = reader.Read(ScenarioInformationTableDefinitions.LakeLevel); + var windDirection = reader.Read(ScenarioInformationTableDefinitions.WindDirection); + var windSpeed = reader.Read(ScenarioInformationTableDefinitions.WindSpeed); + var comment = reader.Read(ScenarioInformationTableDefinitions.Comment); + + return new ReadHydraulicLocationConfigurationDatabaseSettings(scenarioName, year, scope, + seaLevel, riverDischarge, lakeLevel, + windDirection, windSpeed, comment); + } + catch (ConversionException e) + { + string message = new FileReaderErrorMessageBuilder(Path).Build(Resources.HydraulicBoundaryDatabaseReader_Critical_Unexpected_value_on_column); + throw new LineParseException(message, e); + } + } + } +} \ No newline at end of file Index: Ringtoets/HydraRing/src/Riskeer.HydraRing.IO/HydraulicLocationConfigurationDatabase/LocationsTableDefinitions.cs =================================================================== diff -u --- Ringtoets/HydraRing/src/Riskeer.HydraRing.IO/HydraulicLocationConfigurationDatabase/LocationsTableDefinitions.cs (revision 0) +++ Ringtoets/HydraRing/src/Riskeer.HydraRing.IO/HydraulicLocationConfigurationDatabase/LocationsTableDefinitions.cs (revision dd3466c892baa253c4b94ee4997b43ebadf4161c) @@ -0,0 +1,35 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets 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 Riskeer.HydraRing.IO.HydraulicLocationConfigurationDatabase +{ + /// + /// Defines the table and column names of the table 'Locations' in the hydraulic location + /// configuration database. + /// + internal static class LocationsTableDefinitions + { + public const string TableName = "Locations"; + public const string LocationId = "LocationId"; + public const string HrdLocationId = "HRDLocationId"; + public const string TrackId = "TrackId"; + } +} \ No newline at end of file Index: Ringtoets/HydraRing/src/Riskeer.HydraRing.IO/HydraulicLocationConfigurationDatabase/ReadHydraulicLocationConfigurationDatabase.cs =================================================================== diff -u --- Ringtoets/HydraRing/src/Riskeer.HydraRing.IO/HydraulicLocationConfigurationDatabase/ReadHydraulicLocationConfigurationDatabase.cs (revision 0) +++ Ringtoets/HydraRing/src/Riskeer.HydraRing.IO/HydraulicLocationConfigurationDatabase/ReadHydraulicLocationConfigurationDatabase.cs (revision dd3466c892baa253c4b94ee4997b43ebadf4161c) @@ -0,0 +1,55 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets 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 Riskeer.HydraRing.IO.HydraulicLocationConfigurationDatabase +{ + /// + /// Class for holding data that is read from a hydraulic location configuration database file. + /// + public class ReadHydraulicLocationConfigurationDatabase + { + /// + /// Creates a new instance of . + /// + /// The location id mappings of the read hydraulic location + /// configuration database. + /// The hydraulic location configuration settings + /// of the read hydraulic location database. + internal ReadHydraulicLocationConfigurationDatabase(IEnumerable locationIdMappings, + IEnumerable readHydraulicLocationConfigurationDatabaseSettings) + { + LocationIdMappings = locationIdMappings; + ReadHydraulicLocationConfigurationDatabaseSettings = readHydraulicLocationConfigurationDatabaseSettings; + } + + /// + /// Gets the location id mappings of the read hydraulic location configuration database. + /// + public IEnumerable LocationIdMappings { get; } + + /// + /// Gets the settings of the read hydraulic location configuration database. + /// + public IEnumerable ReadHydraulicLocationConfigurationDatabaseSettings { get; } + } +} \ No newline at end of file Index: Ringtoets/HydraRing/src/Riskeer.HydraRing.IO/HydraulicLocationConfigurationDatabase/ReadHydraulicLocationConfigurationDatabaseSettings.cs =================================================================== diff -u --- Ringtoets/HydraRing/src/Riskeer.HydraRing.IO/HydraulicLocationConfigurationDatabase/ReadHydraulicLocationConfigurationDatabaseSettings.cs (revision 0) +++ Ringtoets/HydraRing/src/Riskeer.HydraRing.IO/HydraulicLocationConfigurationDatabase/ReadHydraulicLocationConfigurationDatabaseSettings.cs (revision dd3466c892baa253c4b94ee4997b43ebadf4161c) @@ -0,0 +1,102 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets 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 Riskeer.HydraRing.IO.HydraulicLocationConfigurationDatabase +{ + /// + /// Class for holding configuration settings that are read from a hydraulic location + /// configuration database file. + /// + public class ReadHydraulicLocationConfigurationDatabaseSettings + { + /// + /// Creates a new instance of . + /// + /// The name of the scenario. + /// The year. + /// The scope. + /// The sea level. + /// The river discharge. + /// The lake level. + /// The wind direction. + /// The wind speed. + /// The comment. + internal ReadHydraulicLocationConfigurationDatabaseSettings(string scenarioName, int year, string scope, + string seaLevel, string riverDischarge, string lakeLevel, + string windDirection, string windSpeed, string comment) + { + ScenarioName = scenarioName; + Year = year; + Scope = scope; + SeaLevel = seaLevel; + RiverDischarge = riverDischarge; + LakeLevel = lakeLevel; + WindDirection = windDirection; + WindSpeed = windSpeed; + Comment = comment; + } + + /// + /// Gets the scenario name. + /// + public string ScenarioName { get; } + + /// + /// Gets the year. + /// + public int Year { get; } + + /// + /// Gets the scope. + /// + public string Scope { get; } + + /// + /// Gets the sea level. + /// + public string SeaLevel { get; } + + /// + /// Gets the river discharge. + /// + public string RiverDischarge { get; } + + /// + /// Gets the lake level. + /// + public string LakeLevel { get; } + + /// + /// Gets the wind direction. + /// + public string WindDirection { get; } + + /// + /// Gets the wind speed. + /// + public string WindSpeed { get; } + + /// + /// Gets the comment. + /// + public string Comment { get; } + } +} \ No newline at end of file Index: Ringtoets/HydraRing/src/Riskeer.HydraRing.IO/HydraulicLocationConfigurationDatabase/ReadHydraulicLocationMapping.cs =================================================================== diff -u --- Ringtoets/HydraRing/src/Riskeer.HydraRing.IO/HydraulicLocationConfigurationDatabase/ReadHydraulicLocationMapping.cs (revision 0) +++ Ringtoets/HydraRing/src/Riskeer.HydraRing.IO/HydraulicLocationConfigurationDatabase/ReadHydraulicLocationMapping.cs (revision dd3466c892baa253c4b94ee4997b43ebadf4161c) @@ -0,0 +1,50 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets 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 Riskeer.HydraRing.IO.HydraulicLocationConfigurationDatabase +{ + /// + /// Class for holding a mapping between the hydraulic boundary location id and hydraulic location configuration id. + /// + public class ReadHydraulicLocationMapping + { + /// + /// Creates a new instance of . + /// + /// The hydraulic boundary location id. + /// The hydraulic location configuration id. + internal ReadHydraulicLocationMapping(long hrdLocationId, long hlcdLocationId) + { + HrdLocationId = hrdLocationId; + HlcdLocationId = hlcdLocationId; + } + + /// + /// Gets the hydraulic boundary location id. + /// + public long HrdLocationId { get; } + + /// + /// Gets the hydraulic location configuration id. + /// + public long HlcdLocationId { get; } + } +} \ No newline at end of file Index: Ringtoets/HydraRing/src/Riskeer.HydraRing.IO/HydraulicLocationConfigurationDatabase/ScenarioInformationTableDefinitions.cs =================================================================== diff -u --- Ringtoets/HydraRing/src/Riskeer.HydraRing.IO/HydraulicLocationConfigurationDatabase/ScenarioInformationTableDefinitions.cs (revision 0) +++ Ringtoets/HydraRing/src/Riskeer.HydraRing.IO/HydraulicLocationConfigurationDatabase/ScenarioInformationTableDefinitions.cs (revision dd3466c892baa253c4b94ee4997b43ebadf4161c) @@ -0,0 +1,42 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets 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 Riskeer.HydraRing.IO.HydraulicLocationConfigurationDatabase +{ + /// + /// Defines the table and column names of the table 'ScenarioInformation' in the hydraulic location + /// configuration database. + /// + public static class ScenarioInformationTableDefinitions + { + public const string ScenarioName = "ScenarioName"; + public const string Year = "Year"; + public const string Scope = "Scope"; + public const string SeaLevel = "SeaLevel"; + public const string RiverDischarge = "RiverDischarge"; + public const string LakeLevel = "LakeLevel"; + public const string WindDirection = "WindDirection"; + public const string WindSpeed = "WindSpeed"; + public const string Comment = "Comment"; + public const string IsScenarioInformationPresent = "IsScenarioInformationPresent"; + public const string TableName = "ScenarioInformation"; + } +} \ No newline at end of file Index: Ringtoets/HydraRing/src/Riskeer.HydraRing.IO/Properties/AssemblyInfo.cs =================================================================== diff -u --- Ringtoets/HydraRing/src/Riskeer.HydraRing.IO/Properties/AssemblyInfo.cs (revision 0) +++ Ringtoets/HydraRing/src/Riskeer.HydraRing.IO/Properties/AssemblyInfo.cs (revision dd3466c892baa253c4b94ee4997b43ebadf4161c) @@ -0,0 +1,28 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets 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.CompilerServices; + +[assembly: AssemblyTitle("Riskeer.HydraRing.IO")] +[assembly: AssemblyProduct("Riskeer.HydraRing.IO")] +[assembly: InternalsVisibleTo("Ringtoets.HydraRing.IO.Test")] +[assembly: InternalsVisibleTo("Ringtoets.HydraRing.IO.TestUtil")] \ No newline at end of file Index: Ringtoets/HydraRing/src/Riskeer.HydraRing.IO/Properties/Resources.Designer.cs =================================================================== diff -u --- Ringtoets/HydraRing/src/Riskeer.HydraRing.IO/Properties/Resources.Designer.cs (revision 0) +++ Ringtoets/HydraRing/src/Riskeer.HydraRing.IO/Properties/Resources.Designer.cs (revision dd3466c892baa253c4b94ee4997b43ebadf4161c) @@ -0,0 +1,109 @@ +//------------------------------------------------------------------------------ +// +// 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 Riskeer.HydraRing.IO.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", "15.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + public 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)] + public static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Riskeer.HydraRing.IO.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)] + public static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Looks up a localized string similar to Kon geen locaties verkrijgen van de database.. + /// + public static string Error_HydraulicBoundaryLocation_read_from_database { + get { + return ResourceManager.GetString("Error_HydraulicBoundaryLocation_read_from_database", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Het opgegeven bestandspad ({0}) is niet geldig.. + /// + public static string HydraulicBoundaryDatabaseHelper_ValidatePathForCalculation_Invalid_path_0_ { + get { + return ResourceManager.GetString("HydraulicBoundaryDatabaseHelper_ValidatePathForCalculation_Invalid_path_0_", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Kritieke fout opgetreden bij het uitlezen van waardes uit kolommen in de database.. + /// + public static string HydraulicBoundaryDatabaseReader_Critical_Unexpected_value_on_column { + get { + return ResourceManager.GetString("HydraulicBoundaryDatabaseReader_Critical_Unexpected_value_on_column", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Het bevragen van de database is mislukt.. + /// + public static string HydraulicLocationConfigurationDatabaseReader_Critical_Unexpected_Exception { + get { + return ResourceManager.GetString("HydraulicLocationConfigurationDatabaseReader_Critical_Unexpected_Exception", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Er zijn meerdere resultaten gevonden, wat niet voor zou mogen komen. Neem contact op met de leverancier. Het eerste resultaat zal worden gebruikt.. + /// + public static string HydraulicLocationConfigurationDatabaseReader_GetLocationIdFromDatabase_Ambiguous_Row_Found_Take_First { + get { + return ResourceManager.GetString("HydraulicLocationConfigurationDatabaseReader_GetLocationIdFromDatabase_Ambiguous_" + + "Row_Found_Take_First", resourceCulture); + } + } + } +} Index: Ringtoets/HydraRing/src/Riskeer.HydraRing.IO/Properties/Resources.resx =================================================================== diff -u --- Ringtoets/HydraRing/src/Riskeer.HydraRing.IO/Properties/Resources.resx (revision 0) +++ Ringtoets/HydraRing/src/Riskeer.HydraRing.IO/Properties/Resources.resx (revision dd3466c892baa253c4b94ee4997b43ebadf4161c) @@ -0,0 +1,135 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Kon geen locaties verkrijgen van de database. + + + Kritieke fout opgetreden bij het uitlezen van waardes uit kolommen in de database. + + + Er zijn meerdere resultaten gevonden, wat niet voor zou mogen komen. Neem contact op met de leverancier. Het eerste resultaat zal worden gebruikt. + + + Het bevragen van de database is mislukt. + + + Het opgegeven bestandspad ({0}) is niet geldig. + + \ No newline at end of file Index: Ringtoets/HydraRing/src/Riskeer.HydraRing.IO/Riskeer.HydraRing.IO.csproj =================================================================== diff -u --- Ringtoets/HydraRing/src/Riskeer.HydraRing.IO/Riskeer.HydraRing.IO.csproj (revision 0) +++ Ringtoets/HydraRing/src/Riskeer.HydraRing.IO/Riskeer.HydraRing.IO.csproj (revision dd3466c892baa253c4b94ee4997b43ebadf4161c) @@ -0,0 +1,80 @@ + + + + {B69D5B6C-6E14-4FA9-9EBC-8F97678CDB70} + Riskeer.HydraRing.IO + Riskeer.HydraRing.IO + + + + + ..\..\..\..\packages\log4net.2.0.4\lib\net40-full\log4net.dll + True + + + + + + ..\..\..\..\packages\System.Data.SQLite.Core.1.0.106.0\lib\net40\System.Data.SQLite.dll + True + + + + + + + + + + + + + + + + + + + True + True + Resources.resx + + + + + Copying.licenseheader + + + + + + {3bbfd65b-b277-4e50-ae6d-bd24c3434609} + Core.Common.Base + False + + + {E344867E-9AC9-44C8-88A5-8185681679A9} + Core.Common.IO + False + + + {F49BD8B2-332A-4C91-A196-8CCE0A2C7D98} + Core.Common.Util + False + + + + + PublicResXFileCodeGenerator + Resources.Designer.cs + Designer + + + + + + This project references NuGet package(s) that are missing on this computer. Use 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: Ringtoets/HydraRing/src/Riskeer.HydraRing.IO/packages.config =================================================================== diff -u --- Ringtoets/HydraRing/src/Riskeer.HydraRing.IO/packages.config (revision 0) +++ Ringtoets/HydraRing/src/Riskeer.HydraRing.IO/packages.config (revision dd3466c892baa253c4b94ee4997b43ebadf4161c) @@ -0,0 +1,26 @@ + + + + + \ No newline at end of file Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.IO.Test/Ringtoets.HydraRing.IO.Test.csproj =================================================================== diff -u -r3b368e38644b163189a58233f9fc1fb9701bf68c -rdd3466c892baa253c4b94ee4997b43ebadf4161c --- Ringtoets/HydraRing/test/Ringtoets.HydraRing.IO.Test/Ringtoets.HydraRing.IO.Test.csproj (.../Ringtoets.HydraRing.IO.Test.csproj) (revision 3b368e38644b163189a58233f9fc1fb9701bf68c) +++ Ringtoets/HydraRing/test/Ringtoets.HydraRing.IO.Test/Ringtoets.HydraRing.IO.Test.csproj (.../Ringtoets.HydraRing.IO.Test.csproj) (revision dd3466c892baa253c4b94ee4997b43ebadf4161c) @@ -58,7 +58,7 @@ {D749EE4C-CE50-4C17-BF01-9A953028C126} Core.Common.TestUtil - + {B69D5B6C-6E14-4FA9-9EBC-8F97678CDB70} Riskeer.HydraRing.IO Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.IO.TestUtil.Test/Ringtoets.HydraRing.IO.TestUtil.Test.csproj =================================================================== diff -u -r3b368e38644b163189a58233f9fc1fb9701bf68c -rdd3466c892baa253c4b94ee4997b43ebadf4161c --- Ringtoets/HydraRing/test/Ringtoets.HydraRing.IO.TestUtil.Test/Ringtoets.HydraRing.IO.TestUtil.Test.csproj (.../Ringtoets.HydraRing.IO.TestUtil.Test.csproj) (revision 3b368e38644b163189a58233f9fc1fb9701bf68c) +++ Ringtoets/HydraRing/test/Ringtoets.HydraRing.IO.TestUtil.Test/Ringtoets.HydraRing.IO.TestUtil.Test.csproj (.../Ringtoets.HydraRing.IO.TestUtil.Test.csproj) (revision dd3466c892baa253c4b94ee4997b43ebadf4161c) @@ -26,7 +26,7 @@ - + {B69D5B6C-6E14-4FA9-9EBC-8F97678CDB70} Riskeer.HydraRing.IO Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.IO.TestUtil/Ringtoets.HydraRing.IO.TestUtil.csproj =================================================================== diff -u -r3b368e38644b163189a58233f9fc1fb9701bf68c -rdd3466c892baa253c4b94ee4997b43ebadf4161c --- Ringtoets/HydraRing/test/Ringtoets.HydraRing.IO.TestUtil/Ringtoets.HydraRing.IO.TestUtil.csproj (.../Ringtoets.HydraRing.IO.TestUtil.csproj) (revision 3b368e38644b163189a58233f9fc1fb9701bf68c) +++ Ringtoets/HydraRing/test/Ringtoets.HydraRing.IO.TestUtil/Ringtoets.HydraRing.IO.TestUtil.csproj (.../Ringtoets.HydraRing.IO.TestUtil.csproj) (revision dd3466c892baa253c4b94ee4997b43ebadf4161c) @@ -22,7 +22,7 @@ - + {B69D5B6C-6E14-4FA9-9EBC-8F97678CDB70} Riskeer.HydraRing.IO Index: Ringtoets/Integration/src/Ringtoets.Integration.IO/Ringtoets.Integration.IO.csproj =================================================================== diff -u -r3b368e38644b163189a58233f9fc1fb9701bf68c -rdd3466c892baa253c4b94ee4997b43ebadf4161c --- Ringtoets/Integration/src/Ringtoets.Integration.IO/Ringtoets.Integration.IO.csproj (.../Ringtoets.Integration.IO.csproj) (revision 3b368e38644b163189a58233f9fc1fb9701bf68c) +++ Ringtoets/Integration/src/Ringtoets.Integration.IO/Ringtoets.Integration.IO.csproj (.../Ringtoets.Integration.IO.csproj) (revision dd3466c892baa253c4b94ee4997b43ebadf4161c) @@ -186,7 +186,7 @@ Ringtoets.HeightStructures.Data False - + {B69D5B6C-6E14-4FA9-9EBC-8F97678CDB70} Riskeer.HydraRing.IO False Index: Ringtoets/Integration/src/Ringtoets.Integration.Plugin/Ringtoets.Integration.Plugin.csproj =================================================================== diff -u -r3b368e38644b163189a58233f9fc1fb9701bf68c -rdd3466c892baa253c4b94ee4997b43ebadf4161c --- Ringtoets/Integration/src/Ringtoets.Integration.Plugin/Ringtoets.Integration.Plugin.csproj (.../Ringtoets.Integration.Plugin.csproj) (revision 3b368e38644b163189a58233f9fc1fb9701bf68c) +++ Ringtoets/Integration/src/Ringtoets.Integration.Plugin/Ringtoets.Integration.Plugin.csproj (.../Ringtoets.Integration.Plugin.csproj) (revision dd3466c892baa253c4b94ee4997b43ebadf4161c) @@ -141,7 +141,7 @@ Ringtoets.DuneErosion.Plugin False - + {B69D5B6C-6E14-4FA9-9EBC-8F97678CDB70} Riskeer.HydraRing.IO False Index: Ringtoets/Integration/test/Ringtoets.Integration.IO.Test/Ringtoets.Integration.IO.Test.csproj =================================================================== diff -u -r3b368e38644b163189a58233f9fc1fb9701bf68c -rdd3466c892baa253c4b94ee4997b43ebadf4161c --- Ringtoets/Integration/test/Ringtoets.Integration.IO.Test/Ringtoets.Integration.IO.Test.csproj (.../Ringtoets.Integration.IO.Test.csproj) (revision 3b368e38644b163189a58233f9fc1fb9701bf68c) +++ Ringtoets/Integration/test/Ringtoets.Integration.IO.Test/Ringtoets.Integration.IO.Test.csproj (.../Ringtoets.Integration.IO.Test.csproj) (revision dd3466c892baa253c4b94ee4997b43ebadf4161c) @@ -175,7 +175,7 @@ {1C0017D8-35B5-4CA0-8FC7-A83F46DBDC99} Ringtoets.HeightStructures.Data - + {B69D5B6C-6E14-4FA9-9EBC-8F97678CDB70} Riskeer.HydraRing.IO Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/Ringtoets.Integration.Plugin.Test.csproj =================================================================== diff -u -r3b368e38644b163189a58233f9fc1fb9701bf68c -rdd3466c892baa253c4b94ee4997b43ebadf4161c --- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/Ringtoets.Integration.Plugin.Test.csproj (.../Ringtoets.Integration.Plugin.Test.csproj) (revision 3b368e38644b163189a58233f9fc1fb9701bf68c) +++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/Ringtoets.Integration.Plugin.Test.csproj (.../Ringtoets.Integration.Plugin.Test.csproj) (revision dd3466c892baa253c4b94ee4997b43ebadf4161c) @@ -352,7 +352,7 @@ {888D4097-8BC2-4703-9FB1-8744C94D525E} Riskeer.HydraRing.Calculation - + {b69d5b6c-6e14-4fa9-9ebc-8f97678cdb70} Riskeer.HydraRing.IO