Index: Core/Common/src/Core.Common.IO/Readers/SqLiteDatabaseReaderBase.cs
===================================================================
diff -u -r06f9145d8180df7fd26eac086a3f431c181e4d64 -r7d124cef8960a865cc8d7db24b3359f7ff9958be
--- Core/Common/src/Core.Common.IO/Readers/SqLiteDatabaseReaderBase.cs (.../SqLiteDatabaseReaderBase.cs) (revision 06f9145d8180df7fd26eac086a3f431c181e4d64)
+++ Core/Common/src/Core.Common.IO/Readers/SqLiteDatabaseReaderBase.cs (.../SqLiteDatabaseReaderBase.cs) (revision 7d124cef8960a865cc8d7db24b3359f7ff9958be)
@@ -89,8 +89,6 @@
Connection.Close();
Connection.Dispose();
}
-
-
}
///
Index: Demo/Ringtoets/src/Demo.Ringtoets/Commands/AddNewDemoDikeAssessmentSectionCommand.cs
===================================================================
diff -u -r06f9145d8180df7fd26eac086a3f431c181e4d64 -r7d124cef8960a865cc8d7db24b3359f7ff9958be
--- Demo/Ringtoets/src/Demo.Ringtoets/Commands/AddNewDemoDikeAssessmentSectionCommand.cs (.../AddNewDemoDikeAssessmentSectionCommand.cs) (revision 06f9145d8180df7fd26eac086a3f431c181e4d64)
+++ Demo/Ringtoets/src/Demo.Ringtoets/Commands/AddNewDemoDikeAssessmentSectionCommand.cs (.../AddNewDemoDikeAssessmentSectionCommand.cs) (revision 7d124cef8960a865cc8d7db24b3359f7ff9958be)
@@ -72,7 +72,7 @@
{
using (var tempPath = new TemporaryImportFile("HRD_dutchcoastsouth.sqlite"))
{
- using (var hydraulicBoundaryDatabaseImporter = new HydraulicBoundaryLocationsImporter())
+ using (var hydraulicBoundaryDatabaseImporter = new HydraulicBoundaryDatabaseImporter())
{
hydraulicBoundaryDatabaseImporter.ValidateAndConnectTo(tempPath.FilePath);
hydraulicBoundaryDatabaseImporter.Import(new HydraulicBoundaryDatabaseContext(demoAssessmentSection), tempPath.FilePath);
Index: Demo/Ringtoets/src/Demo.Ringtoets/Commands/AddNewDemoDuneAssessmentSectionCommand.cs
===================================================================
diff -u -r322e06b66fb0c6f6a0cf133fa6eba67a4f0dd811 -r7d124cef8960a865cc8d7db24b3359f7ff9958be
--- Demo/Ringtoets/src/Demo.Ringtoets/Commands/AddNewDemoDuneAssessmentSectionCommand.cs (.../AddNewDemoDuneAssessmentSectionCommand.cs) (revision 322e06b66fb0c6f6a0cf133fa6eba67a4f0dd811)
+++ Demo/Ringtoets/src/Demo.Ringtoets/Commands/AddNewDemoDuneAssessmentSectionCommand.cs (.../AddNewDemoDuneAssessmentSectionCommand.cs) (revision 7d124cef8960a865cc8d7db24b3359f7ff9958be)
@@ -68,7 +68,7 @@
{
using (var tempPath = new TemporaryImportFile("HRD_dutchcoastsouth.sqlite"))
{
- using (var hydraulicBoundaryDatabaseImporter = new HydraulicBoundaryLocationsImporter())
+ using (var hydraulicBoundaryDatabaseImporter = new HydraulicBoundaryDatabaseImporter())
{
hydraulicBoundaryDatabaseImporter.ValidateAndConnectTo(tempPath.FilePath);
hydraulicBoundaryDatabaseImporter.Import(new HydraulicBoundaryDatabaseContext(demoAssessmentSection), tempPath.FilePath);
Index: Ringtoets/HydraRing/src/Ringtoets.HydraRing.Forms/PresentationObjects/HydraulicBoundaryLocationProperties.cs
===================================================================
diff -u -rd5c512944b347df57c08bb0b281c9b764abe4a36 -r7d124cef8960a865cc8d7db24b3359f7ff9958be
--- Ringtoets/HydraRing/src/Ringtoets.HydraRing.Forms/PresentationObjects/HydraulicBoundaryLocationProperties.cs (.../HydraulicBoundaryLocationProperties.cs) (revision d5c512944b347df57c08bb0b281c9b764abe4a36)
+++ Ringtoets/HydraRing/src/Ringtoets.HydraRing.Forms/PresentationObjects/HydraulicBoundaryLocationProperties.cs (.../HydraulicBoundaryLocationProperties.cs) (revision 7d124cef8960a865cc8d7db24b3359f7ff9958be)
@@ -104,7 +104,7 @@
public override string ToString()
{
- return String.Format("{0} ({1})", Name, Location);
+ return String.Format("{0} {1}", Name, Location);
}
}
}
\ No newline at end of file
Fisheye: Tag 7d124cef8960a865cc8d7db24b3359f7ff9958be refers to a dead (removed) revision in file `Ringtoets/HydraRing/src/Ringtoets.HydraRing.IO/HydraulicBoundaryDatabaseColumns.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 7d124cef8960a865cc8d7db24b3359f7ff9958be refers to a dead (removed) revision in file `Ringtoets/HydraRing/src/Ringtoets.HydraRing.IO/HydraulicBoundaryDatabaseContext/GeneralEntity.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/HydraRing/src/Ringtoets.HydraRing.IO/HydraulicBoundaryDatabaseContext/GeneralTableDefinitions.cs
===================================================================
diff -u
--- Ringtoets/HydraRing/src/Ringtoets.HydraRing.IO/HydraulicBoundaryDatabaseContext/GeneralTableDefinitions.cs (revision 0)
+++ Ringtoets/HydraRing/src/Ringtoets.HydraRing.IO/HydraulicBoundaryDatabaseContext/GeneralTableDefinitions.cs (revision 7d124cef8960a865cc8d7db24b3359f7ff9958be)
@@ -0,0 +1,34 @@
+// Copyright (C) Stichting Deltares 2016. 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 Ringtoets.HydraRing.IO.HydraulicBoundaryDatabaseContext
+{
+ ///
+ /// 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 NameRegion = "NameRegion";
+ internal const string CreationDate = "CreationDate";
+ internal const string GeneratedVersion = "GeneratedVersion";
+ }
+}
\ No newline at end of file
Fisheye: Tag 7d124cef8960a865cc8d7db24b3359f7ff9958be refers to a dead (removed) revision in file `Ringtoets/HydraRing/src/Ringtoets.HydraRing.IO/HydraulicBoundaryDatabaseContext/HrdLocationsEntity.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/HydraRing/src/Ringtoets.HydraRing.IO/HydraulicBoundaryDatabaseContext/HrdLocationsTableDefinitions.cs
===================================================================
diff -u
--- Ringtoets/HydraRing/src/Ringtoets.HydraRing.IO/HydraulicBoundaryDatabaseContext/HrdLocationsTableDefinitions.cs (revision 0)
+++ Ringtoets/HydraRing/src/Ringtoets.HydraRing.IO/HydraulicBoundaryDatabaseContext/HrdLocationsTableDefinitions.cs (revision 7d124cef8960a865cc8d7db24b3359f7ff9958be)
@@ -0,0 +1,37 @@
+// Copyright (C) Stichting Deltares 2016. 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 Ringtoets.HydraRing.IO.HydraulicBoundaryDatabaseContext
+{
+ ///
+ /// 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/Ringtoets.HydraRing.IO/HydraulicBoundaryDatabaseContext/HydraulicBoundaryDatabaseQueryBuilder.cs
===================================================================
diff -u -r06f9145d8180df7fd26eac086a3f431c181e4d64 -r7d124cef8960a865cc8d7db24b3359f7ff9958be
--- Ringtoets/HydraRing/src/Ringtoets.HydraRing.IO/HydraulicBoundaryDatabaseContext/HydraulicBoundaryDatabaseQueryBuilder.cs (.../HydraulicBoundaryDatabaseQueryBuilder.cs) (revision 06f9145d8180df7fd26eac086a3f431c181e4d64)
+++ Ringtoets/HydraRing/src/Ringtoets.HydraRing.IO/HydraulicBoundaryDatabaseContext/HydraulicBoundaryDatabaseQueryBuilder.cs (.../HydraulicBoundaryDatabaseQueryBuilder.cs) (revision 7d124cef8960a865cc8d7db24b3359f7ff9958be)
@@ -21,44 +21,58 @@
namespace Ringtoets.HydraRing.IO.HydraulicBoundaryDatabaseContext
{
+ ///
+ /// 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 string.Format(
"SELECT ({0} || {1}) as {2} FROM {3} LIMIT 0,1;",
- GeneralEntity.NameRegion,
- GeneralEntity.CreationDate,
- HydraulicBoundaryDatabaseColumns.Version,
- GeneralEntity.TableName
+ GeneralTableDefinitions.NameRegion,
+ GeneralTableDefinitions.CreationDate,
+ GeneralTableDefinitions.GeneratedVersion,
+ GeneralTableDefinitions.TableName
);
}
- public static string GetLocationsCountQuery()
+ ///
+ /// Returns the query to get the amount of relevant locations from the database.
+ ///
+ /// Locations are relevant when > 1.
+ /// The query to get the amount of relevant locations from the database.
+ public static string GetRelevantLocationsCountQuery()
{
return string.Format(
"SELECT count({0}) as {1} FROM {2} WHERE {3} > 1 ;",
- HrdLocationsEntity.HrdLocationId,
- HydraulicBoundaryDatabaseColumns.LocationCount,
- HrdLocationsEntity.TableName,
- HrdLocationsEntity.LocationTypeId
+ HrdLocationsTableDefinitions.HrdLocationId,
+ HrdLocationsTableDefinitions.Count,
+ HrdLocationsTableDefinitions.TableName,
+ HrdLocationsTableDefinitions.LocationTypeId
);
}
- public static string GetLocationsQuery()
+ ///
+ /// Returns the query to get the all relevant locations from the database.
+ ///
+ /// Locations are relevant when > 1.
+ /// The query to get the all relevant locations from the database.
+ public static string GetRelevantLocationsQuery()
{
return string.Format(
- "SELECT {0} as {1}, " +
- "{2} as {3}, " +
- "{4} as {5}, " +
- "{6} as {7} FROM " +
- "{8} WHERE {9} > 1;",
- HrdLocationsEntity.HrdLocationId, HydraulicBoundaryDatabaseColumns.LocationId,
- HrdLocationsEntity.Name, HydraulicBoundaryDatabaseColumns.LocationName,
- HrdLocationsEntity.XCoordinate, HydraulicBoundaryDatabaseColumns.LocationX,
- HrdLocationsEntity.YCoordinate, HydraulicBoundaryDatabaseColumns.LocationY,
- HrdLocationsEntity.TableName,
- HrdLocationsEntity.LocationTypeId);
+ "SELECT {0}, {1}, {2}, {3} FROM " +
+ "{4} WHERE {5} > 1;",
+ HrdLocationsTableDefinitions.HrdLocationId,
+ HrdLocationsTableDefinitions.Name,
+ HrdLocationsTableDefinitions.XCoordinate,
+ HrdLocationsTableDefinitions.YCoordinate,
+ HrdLocationsTableDefinitions.TableName,
+ HrdLocationsTableDefinitions.LocationTypeId);
}
}
}
\ No newline at end of file
Index: Ringtoets/HydraRing/src/Ringtoets.HydraRing.IO/HydraulicBoundarySqLiteDatabaseReader.cs
===================================================================
diff -u -r06f9145d8180df7fd26eac086a3f431c181e4d64 -r7d124cef8960a865cc8d7db24b3359f7ff9958be
--- Ringtoets/HydraRing/src/Ringtoets.HydraRing.IO/HydraulicBoundarySqLiteDatabaseReader.cs (.../HydraulicBoundarySqLiteDatabaseReader.cs) (revision 06f9145d8180df7fd26eac086a3f431c181e4d64)
+++ Ringtoets/HydraRing/src/Ringtoets.HydraRing.IO/HydraulicBoundarySqLiteDatabaseReader.cs (.../HydraulicBoundarySqLiteDatabaseReader.cs) (revision 7d124cef8960a865cc8d7db24b3359f7ff9958be)
@@ -37,7 +37,7 @@
///
public class HydraulicBoundarySqLiteDatabaseReader : SqLiteDatabaseReaderBase
{
- private SQLiteDataReader dataReader;
+ private SQLiteDataReader sqliteDataReader;
///
/// Creates a new instance of , which will use
@@ -68,9 +68,11 @@
/// required properties.
public void PrepareReadLocation()
{
- var locationsQuery = HydraulicBoundaryDatabaseQueryBuilder.GetLocationsQuery();
+ CloseDataReader();
+ HasNext = false;
- CreateDataReader(locationsQuery, new SQLiteParameter
+ var locationsQuery = HydraulicBoundaryDatabaseQueryBuilder.GetRelevantLocationsQuery();
+ sqliteDataReader = CreateDataReader(locationsQuery, new SQLiteParameter
{
DbType = DbType.String
});
@@ -99,59 +101,63 @@
///
/// Gets the database version from the metadata table.
///
- ///
+ /// Thrown when the database returned incorrect values for
+ /// required properties.
public string GetVersion()
{
- var versionQuery = HydraulicBoundaryDatabaseQueryBuilder.GetVersionQuery();
+ string versionQuery = HydraulicBoundaryDatabaseQueryBuilder.GetVersionQuery();
var sqliteParameter = new SQLiteParameter
{
DbType = DbType.String
};
- CreateDataReader(versionQuery, sqliteParameter);
-
- if (!dataReader.Read())
+ using (var dataReader = CreateDataReader(versionQuery, sqliteParameter))
{
- return "";
+ if (!dataReader.Read())
+ {
+ return "";
+ }
+ try
+ {
+ return (string) dataReader[GeneralTableDefinitions.GeneratedVersion];
+ }
+ catch (InvalidCastException e)
+ {
+ var message = new FileReaderErrorMessageBuilder(Path).
+ Build(Resources.HydraulicBoundaryDatabaseReader_Critical_Unexpected_value_on_column);
+ throw new LineParseException(message, e);
+ }
}
- try
- {
- return Read(HydraulicBoundaryDatabaseColumns.Version);
- }
- catch (InvalidCastException e)
- {
- var message = new FileReaderErrorMessageBuilder(Path).
- Build(Resources.HydraulicBoundaryDatabaseReader_Critical_Unexpected_value_on_column);
- throw new LineParseException(message, e);
- }
}
///
/// Gets the amount of locations that can be read from the database.
///
- ///
+ /// Thrown when the database returned incorrect values for
+ /// required properties.
public int GetLocationCount()
{
- var locationCountQuery = HydraulicBoundaryDatabaseQueryBuilder.GetLocationsCountQuery();
+ string locationCountQuery = HydraulicBoundaryDatabaseQueryBuilder.GetRelevantLocationsCountQuery();
var sqliteParameter = new SQLiteParameter
{
DbType = DbType.String
};
- CreateDataReader(locationCountQuery, sqliteParameter);
-
- if (!dataReader.Read())
+ using (var dataReader = CreateDataReader(locationCountQuery, sqliteParameter))
{
- return 0;
+ if (!dataReader.Read())
+ {
+ return 0;
+ }
+ try
+ {
+ return (int) (long) dataReader[HrdLocationsTableDefinitions.Count];
+ }
+ catch (InvalidCastException e)
+ {
+ var message = new FileReaderErrorMessageBuilder(Path).
+ Build(Resources.HydraulicBoundaryDatabaseReader_Critical_Unexpected_value_on_column);
+ throw new LineParseException(message, e);
+ }
}
- try
- {
- return (int) Read(HydraulicBoundaryDatabaseColumns.LocationCount);
- }
- catch (InvalidCastException e)
- {
- var message = new FileReaderErrorMessageBuilder(Path).
- Build(Resources.HydraulicBoundaryDatabaseReader_Critical_Unexpected_value_on_column);
- throw new LineParseException(message, e);
- }
}
public override void Dispose()
@@ -165,7 +171,7 @@
///
private void MoveNext()
{
- HasNext = dataReader.Read() || (dataReader.NextResult() && dataReader.Read());
+ HasNext = sqliteDataReader.Read() || (sqliteDataReader.NextResult() && sqliteDataReader.Read());
}
///
@@ -178,7 +184,7 @@
/// .
private T Read(string columnName)
{
- return (T) dataReader[columnName];
+ return (T) sqliteDataReader[columnName];
}
///
@@ -191,10 +197,10 @@
{
try
{
- var id = Read(HydraulicBoundaryDatabaseColumns.LocationId);
- var name = Read(HydraulicBoundaryDatabaseColumns.LocationName);
- var x = Read(HydraulicBoundaryDatabaseColumns.LocationX);
- var y = Read(HydraulicBoundaryDatabaseColumns.LocationY);
+ var id = Read(HrdLocationsTableDefinitions.HrdLocationId);
+ var name = Read(HrdLocationsTableDefinitions.Name);
+ var x = Read(HrdLocationsTableDefinitions.XCoordinate);
+ var y = Read(HrdLocationsTableDefinitions.YCoordinate);
MoveNext();
return new HydraulicBoundaryLocation(id, name, x, y);
}
@@ -214,9 +220,8 @@
/// A query could not be executed on the database schema.
///
///
- private void CreateDataReader(string queryString, params SQLiteParameter[] parameters)
+ private SQLiteDataReader CreateDataReader(string queryString, params SQLiteParameter[] parameters)
{
- CloseDataReader();
using (var query = new SQLiteCommand(Connection)
{
CommandText = queryString
@@ -226,7 +231,7 @@
try
{
- dataReader = query.ExecuteReader();
+ return query.ExecuteReader();
}
catch (SQLiteException exception)
{
@@ -239,10 +244,9 @@
private void CloseDataReader()
{
- if (dataReader != null)
+ if (sqliteDataReader != null)
{
- dataReader.Dispose();
-
+ sqliteDataReader.Dispose();
}
}
}
Index: Ringtoets/HydraRing/src/Ringtoets.HydraRing.IO/Properties/Resources.resx
===================================================================
diff -u -r3ba0c50f3a3548264d60e9f347079d0586c53f28 -r7d124cef8960a865cc8d7db24b3359f7ff9958be
--- Ringtoets/HydraRing/src/Ringtoets.HydraRing.IO/Properties/Resources.resx (.../Resources.resx) (revision 3ba0c50f3a3548264d60e9f347079d0586c53f28)
+++ Ringtoets/HydraRing/src/Ringtoets.HydraRing.IO/Properties/Resources.resx (.../Resources.resx) (revision 7d124cef8960a865cc8d7db24b3359f7ff9958be)
@@ -112,10 +112,10 @@
2.0
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceReader, System.Windows.Forms, GeneratedVersion=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceWriter, System.Windows.Forms, GeneratedVersion=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089Kon geen locaties verkrijgen van de database.
Index: Ringtoets/HydraRing/src/Ringtoets.HydraRing.IO/Ringtoets.HydraRing.IO.csproj
===================================================================
diff -u -r06f9145d8180df7fd26eac086a3f431c181e4d64 -r7d124cef8960a865cc8d7db24b3359f7ff9958be
--- Ringtoets/HydraRing/src/Ringtoets.HydraRing.IO/Ringtoets.HydraRing.IO.csproj (.../Ringtoets.HydraRing.IO.csproj) (revision 06f9145d8180df7fd26eac086a3f431c181e4d64)
+++ Ringtoets/HydraRing/src/Ringtoets.HydraRing.IO/Ringtoets.HydraRing.IO.csproj (.../Ringtoets.HydraRing.IO.csproj) (revision 7d124cef8960a865cc8d7db24b3359f7ff9958be)
@@ -46,10 +46,9 @@
Properties\GlobalAssembly.cs
-
-
+
+
-
Index: Ringtoets/HydraRing/src/Ringtoets.HydraRing.Plugin/HydraulicBoundaryDatabaseImporter.cs
===================================================================
diff -u
--- Ringtoets/HydraRing/src/Ringtoets.HydraRing.Plugin/HydraulicBoundaryDatabaseImporter.cs (revision 0)
+++ Ringtoets/HydraRing/src/Ringtoets.HydraRing.Plugin/HydraulicBoundaryDatabaseImporter.cs (revision 7d124cef8960a865cc8d7db24b3359f7ff9958be)
@@ -0,0 +1,180 @@
+// Copyright (C) Stichting Deltares 2016. 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 Core.Common.Base.IO;
+using Core.Common.IO.Exceptions;
+using log4net;
+using Ringtoets.HydraRing.Data;
+using Ringtoets.HydraRing.Forms.PresentationObjects;
+using Ringtoets.HydraRing.IO;
+using Ringtoets.Integration.Data;
+using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources;
+using RingtoetsHydraRingFormsResources = Ringtoets.HydraRing.Forms.Properties.Resources;
+using ApplicationResources = Ringtoets.HydraRing.Plugin.Properties.Resources;
+using HydraRingResources = Ringtoets.HydraRing.Forms.Properties.Resources;
+
+namespace Ringtoets.HydraRing.Plugin
+{
+ ///
+ /// Imports locations read from an Hydraulic boundary .sqlite file (SqlLite database file) to a
+ /// collection of in a .
+ ///
+ public class HydraulicBoundaryDatabaseImporter : IDisposable
+ {
+ private readonly ILog log = LogManager.GetLogger(typeof(HydraulicBoundaryDatabaseImporter));
+ private bool importIsCancelled;
+
+ private HydraulicBoundarySqLiteDatabaseReader hydraulicBoundaryDatabaseReader;
+
+ public ProgressChangedDelegate ProgressChanged { private get; set; }
+
+ public void Cancel()
+ {
+ importIsCancelled = true;
+ }
+
+ ///
+ /// Validates the file and opens a connection.
+ ///
+ /// The path to the file to read.
+ /// Thrown when the given file at cannot be read.
+ public void ValidateAndConnectTo(string filePath)
+ {
+ hydraulicBoundaryDatabaseReader = new HydraulicBoundarySqLiteDatabaseReader(filePath);
+ }
+
+ ///
+ /// Gets the version of the database.
+ ///
+ /// The database version.
+ public string GetHydraulicBoundaryDatabaseVersion()
+ {
+ return hydraulicBoundaryDatabaseReader.GetVersion();
+ }
+
+ ///
+ /// Based upon the data read from the hydraulic boundary database file located at
+ /// , a new instance of ,
+ /// and saved into .
+ ///
+ /// to set the newly
+ /// created .
+ /// The path of the hydraulic boundary database file to open.
+ /// True if the import was successful, false otherwise.
+ public bool Import(HydraulicBoundaryDatabaseContext targetItem, string filePath)
+ {
+ if (hydraulicBoundaryDatabaseReader == null)
+ {
+ throw new InvalidOperationException(ApplicationResources.HydraulicBoundaryLocationsImporter_Import_The_file_is_not_opened);
+ }
+
+ var importResult = GetHydraulicBoundaryDatabase(filePath);
+
+ if (importIsCancelled)
+ {
+ log.Info(ApplicationResources.HydraulicBoundaryLocationsImporter_Import_cancelled);
+ importIsCancelled = false;
+ return false;
+ }
+
+ if (importResult == null)
+ {
+ return false;
+ }
+
+ AddImportedDataToModel(targetItem.Parent, importResult);
+ log.Info(ApplicationResources.HydraulicBoundaryLocationsImporter_Import_Import_successful);
+ return true;
+ }
+
+ public void Dispose()
+ {
+ if (hydraulicBoundaryDatabaseReader != null)
+ {
+ hydraulicBoundaryDatabaseReader.Dispose();
+ hydraulicBoundaryDatabaseReader = null;
+ }
+ }
+
+ private void NotifyProgress(string currentStepName, int currentStep, int totalNumberOfSteps)
+ {
+ if (ProgressChanged != null)
+ {
+ ProgressChanged(currentStepName, currentStep, totalNumberOfSteps);
+ }
+ }
+
+ private void HandleException(Exception e)
+ {
+ var message = string.Format(ApplicationResources.HydraulicBoundaryLocationsImporter_CriticalErrorMessage_0_File_Skipped, e.Message);
+ log.Error(message);
+ }
+
+ private HydraulicBoundaryDatabase GetHydraulicBoundaryDatabase(string path)
+ {
+ NotifyProgress(ApplicationResources.HydraulicBoundaryLocationsImporter_ReadHydraulicBoundaryLocations, 1, 1);
+
+ try
+ {
+ var hydraulicBoundaryDatabase = new HydraulicBoundaryDatabase()
+ {
+ FilePath = path,
+ Version = hydraulicBoundaryDatabaseReader.GetVersion()
+ };
+ var totalNumberOfSteps = hydraulicBoundaryDatabaseReader.GetLocationCount();
+ var currentStep = 1;
+
+ hydraulicBoundaryDatabaseReader.PrepareReadLocation();
+ while (hydraulicBoundaryDatabaseReader.HasNext)
+ {
+ if (importIsCancelled)
+ {
+ return null;
+ }
+ NotifyProgress(ApplicationResources.HydraulicBoundaryLocationsImporter_GetHydraulicBoundaryLocationReadResult, currentStep++, totalNumberOfSteps);
+ try
+ {
+ hydraulicBoundaryDatabase.Locations.Add(hydraulicBoundaryDatabaseReader.ReadLocation());
+ }
+ catch (CriticalFileReadException e)
+ {
+ var message = string.Format(ApplicationResources.HydraulicBoundaryLocationsImporter_CriticalErrorMessage_0_File_Skipped, path);
+ log.Error(message, e);
+ return null;
+ }
+ }
+ return hydraulicBoundaryDatabase;
+ }
+ catch (LineParseException e)
+ {
+ HandleException(e);
+ }
+
+ return null;
+ }
+
+ private static void AddImportedDataToModel(AssessmentSectionBase assessmentSection, HydraulicBoundaryDatabase importedData)
+ {
+ assessmentSection.HydraulicBoundaryDatabase = importedData;
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag 7d124cef8960a865cc8d7db24b3359f7ff9958be refers to a dead (removed) revision in file `Ringtoets/HydraRing/src/Ringtoets.HydraRing.Plugin/HydraulicBoundaryLocationsImporter.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/HydraRing/src/Ringtoets.HydraRing.Plugin/Ringtoets.HydraRing.Plugin.csproj
===================================================================
diff -u -r3ba0c50f3a3548264d60e9f347079d0586c53f28 -r7d124cef8960a865cc8d7db24b3359f7ff9958be
--- Ringtoets/HydraRing/src/Ringtoets.HydraRing.Plugin/Ringtoets.HydraRing.Plugin.csproj (.../Ringtoets.HydraRing.Plugin.csproj) (revision 3ba0c50f3a3548264d60e9f347079d0586c53f28)
+++ Ringtoets/HydraRing/src/Ringtoets.HydraRing.Plugin/Ringtoets.HydraRing.Plugin.csproj (.../Ringtoets.HydraRing.Plugin.csproj) (revision 7d124cef8960a865cc8d7db24b3359f7ff9958be)
@@ -45,7 +45,7 @@
Properties\GlobalAssembly.cs
-
+ True
Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Forms.Test/PresentationObjects/HydraulicBoundaryLocationPropertiesTest.cs
===================================================================
diff -u -r06f9145d8180df7fd26eac086a3f431c181e4d64 -r7d124cef8960a865cc8d7db24b3359f7ff9958be
--- Ringtoets/HydraRing/test/Ringtoets.HydraRing.Forms.Test/PresentationObjects/HydraulicBoundaryLocationPropertiesTest.cs (.../HydraulicBoundaryLocationPropertiesTest.cs) (revision 06f9145d8180df7fd26eac086a3f431c181e4d64)
+++ Ringtoets/HydraRing/test/Ringtoets.HydraRing.Forms.Test/PresentationObjects/HydraulicBoundaryLocationPropertiesTest.cs (.../HydraulicBoundaryLocationPropertiesTest.cs) (revision 7d124cef8960a865cc8d7db24b3359f7ff9958be)
@@ -104,7 +104,7 @@
var hydraulicBoundaryLocationMock = mockRepository.StrictMock(hydraulicBoundaryLocationArguments);
mockRepository.ReplayAll();
- var expectedString = string.Format("{0} ({1})", name, new Point2D(x, y));
+ var expectedString = string.Format("{0} {1}", name, new Point2D(x, y));
// Call
HydraulicBoundaryLocationProperties hydraulicBoundaryLocationProperties = new HydraulicBoundaryLocationProperties(hydraulicBoundaryLocationMock);
Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.IO.Test/Ringtoets.HydraRing.IO.Test.csproj
===================================================================
diff -u -r06f9145d8180df7fd26eac086a3f431c181e4d64 -r7d124cef8960a865cc8d7db24b3359f7ff9958be
--- Ringtoets/HydraRing/test/Ringtoets.HydraRing.IO.Test/Ringtoets.HydraRing.IO.Test.csproj (.../Ringtoets.HydraRing.IO.Test.csproj) (revision 06f9145d8180df7fd26eac086a3f431c181e4d64)
+++ Ringtoets/HydraRing/test/Ringtoets.HydraRing.IO.Test/Ringtoets.HydraRing.IO.Test.csproj (.../Ringtoets.HydraRing.IO.Test.csproj) (revision 7d124cef8960a865cc8d7db24b3359f7ff9958be)
@@ -84,7 +84,6 @@
Ringtoets.HydraRing.IO
-
Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Plugin.Test/HydraulicBoundaryDatabaseImporterTest.cs
===================================================================
diff -u
--- Ringtoets/HydraRing/test/Ringtoets.HydraRing.Plugin.Test/HydraulicBoundaryDatabaseImporterTest.cs (revision 0)
+++ Ringtoets/HydraRing/test/Ringtoets.HydraRing.Plugin.Test/HydraulicBoundaryDatabaseImporterTest.cs (revision 7d124cef8960a865cc8d7db24b3359f7ff9958be)
@@ -0,0 +1,295 @@
+// Copyright (C) Stichting Deltares 2016. 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.IO;
+using System.Linq;
+using Core.Common.Base;
+using Core.Common.IO.Exceptions;
+using Core.Common.TestUtil;
+using NUnit.Framework;
+using Rhino.Mocks;
+using Ringtoets.HydraRing.Data;
+using Ringtoets.HydraRing.Forms.PresentationObjects;
+using Ringtoets.Integration.Data;
+using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources;
+using RingtoetsHydraRingFormsResources = Ringtoets.HydraRing.Forms.Properties.Resources;
+using RingtoetsHydraRingPluginResources = Ringtoets.HydraRing.Plugin.Properties.Resources;
+using RingtoetsHydraRingIOResources = Ringtoets.HydraRing.IO.Properties.Resources;
+using RingtoetsFormsResources = Ringtoets.Common.Forms.Properties.Resources;
+
+namespace Ringtoets.HydraRing.Plugin.Test
+{
+ [TestFixture]
+ public class HydraulicBoundaryDatabaseImporterTest
+ {
+ private readonly string testDataPath = TestHelper.GetTestDataPath(TestDataPath.Ringtoets.HydraRing.IO, "HydraulicBoundaryLocationReader");
+ private HydraulicBoundaryDatabaseImporter importer;
+
+ [SetUp]
+ public void SetUp()
+ {
+ importer = new HydraulicBoundaryDatabaseImporter();
+ }
+
+ [TearDown]
+ public void TearDown()
+ {
+ importer.Dispose();
+ }
+
+ [Test]
+ public void DefaultConstructor_ExpectedValues()
+ {
+ // Call is done in SetUp
+
+ // Assert
+ Assert.IsInstanceOf(importer);
+ }
+
+ [Test]
+ public void ValidateAndConnectTo_ExistingFile_DoesNotThrowException()
+ {
+ // Setup
+ string validFilePath = Path.Combine(testDataPath, "complete.sqlite");
+
+ // Call
+ TestDelegate test = () => importer.ValidateAndConnectTo(validFilePath);
+
+ // Assert
+ Assert.DoesNotThrow(test);
+ }
+
+ [Test]
+ public void ValidateAndConnectTo_NonExistingFile_ThrowsCriticalFileReadException()
+ {
+ // Setup
+ string filePath = Path.Combine(testDataPath, "nonexisting.sqlite");
+ var expectedExceptionMessage = String.Format("Fout bij het lezen van bestand '{0}': Het bestand bestaat niet.", filePath);
+
+ // Call
+ TestDelegate test = () => importer.ValidateAndConnectTo(filePath);
+
+ // Assert
+ CriticalFileReadException exception = Assert.Throws(test);
+ Assert.AreEqual(expectedExceptionMessage, exception.Message);
+ }
+
+ [Test]
+ public void ValidateAndConnectTo_InvalidFile_ThrowsCriticalFileReadException()
+ {
+ // Setup
+ string filePath = Path.Combine(testDataPath, "/");
+ var expectedExceptionMessage = String.Format("Fout bij het lezen van bestand '{0}': Bestandspad mag niet naar een map verwijzen.", filePath);
+
+ // Call
+ TestDelegate test = () => importer.ValidateAndConnectTo(filePath);
+
+ // Assert
+ CriticalFileReadException exception = Assert.Throws(test);
+ Assert.AreEqual(expectedExceptionMessage, exception.Message);
+ Assert.IsInstanceOf(exception.InnerException);
+ }
+
+ [Test]
+ public void GetHydraulicBoundaryDatabaseVersion_ValidFile_GetDatabaseVersion()
+ {
+ // Setup
+ string validFilePath = Path.Combine(testDataPath, "complete.sqlite");
+ importer.ValidateAndConnectTo(validFilePath);
+
+ // Call
+ string version = importer.GetHydraulicBoundaryDatabaseVersion();
+
+ // Assert
+ Assert.IsNotNullOrEmpty(version);
+ }
+
+ [Test]
+ public void Import_ConnectionNotOpened_ThrowsInValidOperationException()
+ {
+ // Setup
+ string validFilePath = Path.Combine(testDataPath, "complete.sqlite");
+
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.StrictMock();
+ mocks.ReplayAll();
+
+ var context = new HydraulicBoundaryDatabaseContext(assessmentSection);
+
+ var expectedMessage = "Er is nog geen bestand geopend.";
+
+ // Call
+ TestDelegate call = () => importer.Import(context, validFilePath);
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Assert.AreEqual(expectedMessage, exception.Message);
+ }
+
+ [Test]
+ public void Import_ImportingToValidTargetWithValidFile_ImportHydraulicBoundaryLocationsToCollection()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.StrictMock();
+ mocks.ReplayAll();
+
+ var importTarget = new HydraulicBoundaryDatabaseContext(assessmentSection);
+
+ string validFilePath = Path.Combine(testDataPath, "complete.sqlite");
+
+ // Precondition
+ Assert.IsTrue(File.Exists(validFilePath), string.Format("Precodition failed. File does not exist: {0}", validFilePath));
+
+ importer.ValidateAndConnectTo(validFilePath);
+
+ // Call
+ var importResult = false;
+ Action call = () => importResult = importer.Import(importTarget, validFilePath);
+
+ // Assert
+ TestHelper.AssertLogMessages(call, messages =>
+ {
+ string[] messageArray = messages.ToArray();
+ StringAssert.EndsWith(RingtoetsHydraRingPluginResources.HydraulicBoundaryLocationsImporter_Import_Import_successful, messageArray[0]);
+ });
+ Assert.IsTrue(importResult);
+ ICollection importedLocations = importTarget.Parent.HydraulicBoundaryDatabase.Locations;
+ Assert.AreEqual(18, importedLocations.Count);
+ CollectionAssert.AllItemsAreNotNull(importedLocations);
+ CollectionAssert.AllItemsAreUnique(importedLocations);
+ }
+
+ [Test]
+ public void Import_CancelOfImportToValidTargetWithValidFile_CancelImportAndLog()
+ {
+ // Setup
+ string validFilePath = Path.Combine(testDataPath, "complete.sqlite");
+
+ var mocks = new MockRepository();
+ var observer = mocks.StrictMock();
+ var assessmentSection = mocks.StrictMock();
+ mocks.ReplayAll();
+
+ var importTarget = new HydraulicBoundaryDatabaseContext(assessmentSection);
+ importTarget.Attach(observer);
+
+ var progressChanged = new List();
+ importer.ProgressChanged = (description, currentStep, totalSteps) => { progressChanged.Add(description); };
+
+ // Precondition
+ Assert.IsNull(importTarget.Parent.HydraulicBoundaryDatabase);
+ Assert.IsTrue(File.Exists(validFilePath), string.Format("Precodition failed. File does not exist: {0}", validFilePath));
+
+ importer.ValidateAndConnectTo(validFilePath);
+
+ importer.Cancel();
+ var importResult = true;
+
+ // Call
+ Action call = () => importResult = importer.Import(importTarget, validFilePath);
+
+ // Assert
+ TestHelper.AssertLogMessageIsGenerated(call, "Het importeren van hydraulische randvoorwaarden locaties is afgebroken. Er is geen data ingelezen.", 1);
+ Assert.IsFalse(importResult);
+ Assert.IsNull(importTarget.Parent.HydraulicBoundaryDatabase);
+ Assert.AreEqual(1, progressChanged.Count);
+ Assert.AreEqual(RingtoetsHydraRingPluginResources.HydraulicBoundaryLocationsImporter_ReadHydraulicBoundaryLocations, progressChanged[0]);
+
+ mocks.VerifyAll(); // 'observer' should not be notified
+ }
+
+ [Test]
+ public void Import_ReuseOfCancelledImportToValidTargetWithValidFile_ImportHydraulicBoundaryLocationsToCollection()
+ {
+ // Setup
+ string validFilePath = Path.Combine(testDataPath, "complete.sqlite");
+
+ var mocks = new MockRepository();
+ var observer = mocks.StrictMock();
+ var assessmentSection = mocks.StrictMock();
+ observer.Expect(o => o.UpdateObserver());
+ mocks.ReplayAll();
+
+ var importTarget = new HydraulicBoundaryDatabaseContext(assessmentSection);
+ importTarget.Attach(observer);
+
+ // Precondition
+ Assert.IsNull(importTarget.Parent.HydraulicBoundaryDatabase);
+ Assert.IsTrue(File.Exists(validFilePath));
+
+ importer.ValidateAndConnectTo(validFilePath);
+
+ // Setup (second part)
+ importer.Cancel();
+ var importResult = importer.Import(importTarget, validFilePath);
+ Assert.IsFalse(importResult);
+
+ // Call
+ importResult = importer.Import(importTarget, validFilePath);
+
+ // Assert
+ Assert.IsTrue(importResult);
+ Assert.IsNotNull(importTarget.Parent.HydraulicBoundaryDatabase);
+ Assert.AreEqual(18, importTarget.Parent.HydraulicBoundaryDatabase.Locations.Count);
+ CollectionAssert.AllItemsAreNotNull(importTarget.Parent.HydraulicBoundaryDatabase.Locations);
+ CollectionAssert.AllItemsAreUnique(importTarget.Parent.HydraulicBoundaryDatabase.Locations);
+ }
+
+ [Test]
+ public void Import_ImportingFileWithCorruptSchema_AbortAndLog()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var observer = mocks.StrictMock();
+ var assessmentSection = mocks.StrictMock();
+ mocks.ReplayAll();
+
+ var importTarget = new HydraulicBoundaryDatabaseContext(assessmentSection);
+
+ string corruptPath = Path.Combine(testDataPath, "corruptschema.sqlite");
+ var expectedLogMessage = string.Format("Fout bij het lezen van bestand '{0}': Kritieke fout opgetreden bij het uitlezen van waardes uit kolommen in de database. Het bestand wordt overgeslagen.", corruptPath);
+
+ var progressChanged = new List();
+ importer.ProgressChanged = (description, currentStep, totalSteps) => { progressChanged.Add(description); };
+
+ importTarget.Attach(observer);
+
+ var importResult = true;
+
+ importer.ValidateAndConnectTo(corruptPath);
+
+ // Call
+ Action call = () => importResult = importer.Import(importTarget, corruptPath);
+
+ // Assert
+ TestHelper.AssertLogMessageIsGenerated(call, expectedLogMessage, 1);
+ Assert.IsFalse(importResult);
+ Assert.IsNull(importTarget.Parent.HydraulicBoundaryDatabase, "No HydraulicBoundaryDatabase object should be created when import from corrupt database.");
+ Assert.AreEqual(1, progressChanged.Count);
+ Assert.AreEqual(RingtoetsHydraRingPluginResources.HydraulicBoundaryLocationsImporter_ReadHydraulicBoundaryLocations, progressChanged[0]);
+
+ mocks.VerifyAll(); // Expect no calls on 'observer'
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag 7d124cef8960a865cc8d7db24b3359f7ff9958be refers to a dead (removed) revision in file `Ringtoets/HydraRing/test/Ringtoets.HydraRing.Plugin.Test/HydraulicBoundaryLocationsImporterTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Plugin.Test/Ringtoets.HydraRing.Plugin.Test.csproj
===================================================================
diff -u -r06f9145d8180df7fd26eac086a3f431c181e4d64 -r7d124cef8960a865cc8d7db24b3359f7ff9958be
--- Ringtoets/HydraRing/test/Ringtoets.HydraRing.Plugin.Test/Ringtoets.HydraRing.Plugin.Test.csproj (.../Ringtoets.HydraRing.Plugin.Test.csproj) (revision 06f9145d8180df7fd26eac086a3f431c181e4d64)
+++ Ringtoets/HydraRing/test/Ringtoets.HydraRing.Plugin.Test/Ringtoets.HydraRing.Plugin.Test.csproj (.../Ringtoets.HydraRing.Plugin.Test.csproj) (revision 7d124cef8960a865cc8d7db24b3359f7ff9958be)
@@ -58,7 +58,7 @@
-
+
Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/AssessmentSectionView.cs
===================================================================
diff -u -r3d0488bd212547c0c1a3dd4e746f23e050e815a8 -r7d124cef8960a865cc8d7db24b3359f7ff9958be
--- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/AssessmentSectionView.cs (.../AssessmentSectionView.cs) (revision 3d0488bd212547c0c1a3dd4e746f23e050e815a8)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/AssessmentSectionView.cs (.../AssessmentSectionView.cs) (revision 7d124cef8960a865cc8d7db24b3359f7ff9958be)
@@ -23,7 +23,6 @@
using System.Linq;
using System.Windows.Forms;
using Core.Common.Base;
-using Core.Common.Base.Geometry;
using Core.Components.DotSpatial.Forms;
using Core.Components.Gis;
using Core.Components.Gis.Data;
@@ -91,43 +90,39 @@
{
var mapDataList = new List();
- MapData referenceLine = GetReferenceLineData();
-
- if (referenceLine != null)
+ if (HasReferenceLinePoints())
{
- mapDataList.Add(referenceLine);
+ mapDataList.Add(GetReferenceLineData());
}
- MapData hydraulicBoundaryLocations = GetHydraulicBoundaryLocations();
-
- if (hydraulicBoundaryLocations != null)
+ if (HasHydraulicBoundaryLocations())
{
- mapDataList.Add(hydraulicBoundaryLocations);
+ mapDataList.Add(GetHydraulicBoundaryLocations());
}
map.Data = new MapDataCollection(mapDataList);
}
private MapData GetReferenceLineData()
{
- if (data.ReferenceLine == null)
- {
- return null;
- }
-
- List points = data.ReferenceLine.Points.ToList();
- return points.Count > 0 ? new MapLineData(points) : null;
+ var referenceLinePoints = data.ReferenceLine.Points.ToList();
+ return new MapLineData(referenceLinePoints);
}
private MapData GetHydraulicBoundaryLocations()
{
- if (data.HydraulicBoundaryDatabase == null)
- {
- return null;
- }
+ var hrLocations = data.HydraulicBoundaryDatabase.Locations.Select(h => h.Location).ToArray();
+ return new MapPointData(hrLocations);
+ }
- List locations = data.HydraulicBoundaryDatabase.Locations.Select(h => h.Location).ToList();
- return locations.Count > 0 ? new MapPointData(locations) : null;
+ private bool HasReferenceLinePoints()
+ {
+ return data.ReferenceLine != null && data.ReferenceLine.Points.Any();
}
+
+ private bool HasHydraulicBoundaryLocations()
+ {
+ return data.HydraulicBoundaryDatabase != null && data.HydraulicBoundaryDatabase.Locations.Any();
+ }
}
}
\ No newline at end of file
Index: Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsGuiPlugin.cs
===================================================================
diff -u -r46126611487f9674e4b7ec1728f1d6778880df13 -r7d124cef8960a865cc8d7db24b3359f7ff9958be
--- Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsGuiPlugin.cs (.../RingtoetsGuiPlugin.cs) (revision 46126611487f9674e4b7ec1728f1d6778880df13)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsGuiPlugin.cs (.../RingtoetsGuiPlugin.cs) (revision 7d124cef8960a865cc8d7db24b3359f7ff9958be)
@@ -437,7 +437,7 @@
private static void ValidateAndImportSelectedFile(HydraulicBoundaryDatabaseContext nodeData, string selectedFile)
{
- var hydraulicBoundaryLocationsImporter = new HydraulicBoundaryLocationsImporter();
+ var hydraulicBoundaryLocationsImporter = new HydraulicBoundaryDatabaseImporter();
string newVersion;
try
@@ -477,7 +477,7 @@
}
private static void ShowCleanDialog(HydraulicBoundaryDatabaseContext nodeData,
- HydraulicBoundaryLocationsImporter hydraulicBoundaryLocationsImporter,
+ HydraulicBoundaryDatabaseImporter hydraulicBoundaryLocationsImporter,
string filePath)
{
var confirmation = MessageBox.Show(
@@ -507,7 +507,7 @@
}
private static void ImportSelectedFile(HydraulicBoundaryDatabaseContext nodeData,
- HydraulicBoundaryLocationsImporter hydraulicBoundaryLocationsImporter,
+ HydraulicBoundaryDatabaseImporter hydraulicBoundaryLocationsImporter,
string selectedFile)
{
if (hydraulicBoundaryLocationsImporter.Import(nodeData, selectedFile))
Index: Ringtoets/Piping/src/Ringtoets.Piping.Data/Calculation/Math2D.cs
===================================================================
diff -u -r06f9145d8180df7fd26eac086a3f431c181e4d64 -r7d124cef8960a865cc8d7db24b3359f7ff9958be
--- Ringtoets/Piping/src/Ringtoets.Piping.Data/Calculation/Math2D.cs (.../Math2D.cs) (revision 06f9145d8180df7fd26eac086a3f431c181e4d64)
+++ Ringtoets/Piping/src/Ringtoets.Piping.Data/Calculation/Math2D.cs (.../Math2D.cs) (revision 7d124cef8960a865cc8d7db24b3359f7ff9958be)
@@ -23,9 +23,7 @@
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
-
using Core.Common.Base.Geometry;
-
using Ringtoets.Piping.Data.Properties;
namespace Ringtoets.Piping.Data.Calculation
@@ -79,11 +77,9 @@
return null;
}
- return new Point2D
- (
- (bOtherLine*cLine - bLine*cOtherLine)/determinant,
- (aLine*cOtherLine - aOtherLine*cLine)/determinant
- );
+ var x = (bOtherLine*cLine - bLine*cOtherLine)/determinant;
+ var y = (aLine*cOtherLine - aOtherLine*cLine)/determinant;
+ return new Point2D(x, y);
}
///
@@ -128,16 +124,8 @@
/// the points are equal.
private static Point2D LineIntersectionWithVerticalLine(Point2D point1, Point2D point2, double x)
{
- var verticalLineFirstPoint = new Point2D
- (
- x,
- 0
- );
- var verticalLineSecondPoint = new Point2D
- (
- x,
- 1
- );
+ var verticalLineFirstPoint = new Point2D(x, 0);
+ var verticalLineSecondPoint = new Point2D(x, 1);
try
{
Index: Ringtoets/Piping/src/Ringtoets.Piping.Data/RingtoetsPipingSurfaceLine.cs
===================================================================
diff -u -r96e2d588e43f76a8eba5c47805eaaf8560f042d0 -r7d124cef8960a865cc8d7db24b3359f7ff9958be
--- Ringtoets/Piping/src/Ringtoets.Piping.Data/RingtoetsPipingSurfaceLine.cs (.../RingtoetsPipingSurfaceLine.cs) (revision 96e2d588e43f76a8eba5c47805eaaf8560f042d0)
+++ Ringtoets/Piping/src/Ringtoets.Piping.Data/RingtoetsPipingSurfaceLine.cs (.../RingtoetsPipingSurfaceLine.cs) (revision 7d124cef8960a865cc8d7db24b3359f7ff9958be)
@@ -242,32 +242,6 @@
}
///
- /// Finds a point from which is at the same position as .
- ///
- /// The location of a point from .
- /// The from at the same location as .
- /// is null.
- private Point3D GetPointFromGeometry(Point3D point)
- {
- if (point == null)
- {
- throw new ArgumentNullException("point", "Cannot find a point in geometry using a null point.");
- }
- var pointFromGeometry = Points.FirstOrDefault(p => p.Equals(point));
- return pointFromGeometry;
- }
-
- private static ArgumentException CreatePointNotInGeometryException(Point3D point, string characteristicPointDescription)
- {
- var message = string.Format(Resources.RingtoetsPipingSurfaceLine_SetCharacteristicPointAt_Geometry_does_not_contain_point_at_0_1_2_to_assign_as_characteristic_point_3_,
- point.X,
- point.Y,
- point.Z,
- characteristicPointDescription);
- return new ArgumentException(message);
- }
-
- ///
/// Gets the height of the projected at a L=.
///
/// The L coordinate from where to take the height of the .
@@ -283,7 +257,7 @@
Point2D[] pointsInLocalCoordinates = ProjectGeometryToLZ().ToArray();
ValidateInRange(l, pointsInLocalCoordinates);
-
+
var segments = new Collection();
for (int i = 1; i < pointsInLocalCoordinates.Length; i++)
{
@@ -305,38 +279,6 @@
}
///
- /// Checks whether the current collection is not empty.
- ///
- /// is empty.
- private void ValidateHasPoints()
- {
- if (!Points.Any())
- {
- throw new InvalidOperationException(Resources.RingtoetsPipingSurfaceLine_SurfaceLine_has_no_Geometry);
- }
- }
-
- ///
- /// Checks whether is in range of the .
- ///
- /// The value to check for.
- /// Geometry projected in local coordinate system where the points are ordered on the
- /// L-coordinate being monotonically non-decreasing
- /// falls outside the L-coordiante span
- /// defined by .
- private static void ValidateInRange(double localCoordinateL, Point2D[] geometryInLocalCoordinates)
- {
- if (geometryInLocalCoordinates.First().X > localCoordinateL || geometryInLocalCoordinates.Last().X < localCoordinateL)
- {
- var outOfRangeMessage = string.Format(Resources.RingtoetsPipingSurfaceLine_0_L_needs_to_be_in_1_2_range,
- Resources.RingtoetsPipingSurfaceLine_GetZAtL_Cannot_determine_height,
- geometryInLocalCoordinates.First().X,
- geometryInLocalCoordinates.Last().X);
- throw new ArgumentOutOfRangeException("localCoordinateL", outOfRangeMessage);
- }
- }
-
- ///
/// Projects the points in to localized coordinate (LZ-plane) system.
/// Z-values are retained, and the first point is put a L=0.
///
@@ -359,10 +301,9 @@
var result = new Point2D[count];
for (int i = 0; i < count; i++)
{
- result[i] = new Point2D
- (
- localCoordinatesX[i], geometryPoints[i].Z
- );
+ var x = localCoordinatesX[i];
+ var y = geometryPoints[i].Z;
+ result[i] = new Point2D(x, y);
}
return result;
}
@@ -373,6 +314,64 @@
}
///
+ /// Finds a point from which is at the same position as .
+ ///
+ /// The location of a point from .
+ /// The from at the same location as .
+ /// is null.
+ private Point3D GetPointFromGeometry(Point3D point)
+ {
+ if (point == null)
+ {
+ throw new ArgumentNullException("point", "Cannot find a point in geometry using a null point.");
+ }
+ var pointFromGeometry = Points.FirstOrDefault(p => p.Equals(point));
+ return pointFromGeometry;
+ }
+
+ private static ArgumentException CreatePointNotInGeometryException(Point3D point, string characteristicPointDescription)
+ {
+ var message = string.Format(Resources.RingtoetsPipingSurfaceLine_SetCharacteristicPointAt_Geometry_does_not_contain_point_at_0_1_2_to_assign_as_characteristic_point_3_,
+ point.X,
+ point.Y,
+ point.Z,
+ characteristicPointDescription);
+ return new ArgumentException(message);
+ }
+
+ ///
+ /// Checks whether the current collection is not empty.
+ ///
+ /// is empty.
+ private void ValidateHasPoints()
+ {
+ if (!Points.Any())
+ {
+ throw new InvalidOperationException(Resources.RingtoetsPipingSurfaceLine_SurfaceLine_has_no_Geometry);
+ }
+ }
+
+ ///
+ /// Checks whether is in range of the .
+ ///
+ /// The value to check for.
+ /// Geometry projected in local coordinate system where the points are ordered on the
+ /// L-coordinate being monotonically non-decreasing
+ /// falls outside the L-coordiante span
+ /// defined by .
+ private static void ValidateInRange(double localCoordinateL, Point2D[] geometryInLocalCoordinates)
+ {
+ if (geometryInLocalCoordinates.First().X > localCoordinateL || geometryInLocalCoordinates.Last().X < localCoordinateL)
+ {
+ var outOfRangeMessage = string.Format(Resources.RingtoetsPipingSurfaceLine_0_L_needs_to_be_in_1_2_range,
+ Resources.RingtoetsPipingSurfaceLine_GetZAtL_Cannot_determine_height,
+ geometryInLocalCoordinates.First().X,
+ geometryInLocalCoordinates.Last().X);
+ throw new ArgumentOutOfRangeException("localCoordinateL", outOfRangeMessage);
+ }
+ }
+
+ ///
/// This method defines the 'spanning line' as the 2D vector going from start to end
/// of the surface line points. Then all except the first point is projected onto
/// this vector. Then the local coordinates are determined by taking the length of
@@ -385,10 +384,7 @@
{
// Determine the vectors from the first coordinate to each other coordinate point
// in the XY world coordinate plane:
- Point2D[] worldCoordinates = Points.Select(p => new Point2D
- (
- p.X, p.Y
- )).ToArray();
+ Point2D[] worldCoordinates = Points.Select(p => new Point2D(p.X, p.Y)).ToArray();
var worldCoordinateVectors = new Vector[worldCoordinates.Length - 1];
for (int i = 1; i < worldCoordinates.Length; i++)
{
Index: Ringtoets/Piping/src/Ringtoets.Piping.IO/SoilProfile/SoilLayer2DReader.cs
===================================================================
diff -u -r06f9145d8180df7fd26eac086a3f431c181e4d64 -r7d124cef8960a865cc8d7db24b3359f7ff9958be
--- Ringtoets/Piping/src/Ringtoets.Piping.IO/SoilProfile/SoilLayer2DReader.cs (.../SoilLayer2DReader.cs) (revision 06f9145d8180df7fd26eac086a3f431c181e4d64)
+++ Ringtoets/Piping/src/Ringtoets.Piping.IO/SoilProfile/SoilLayer2DReader.cs (.../SoilLayer2DReader.cs) (revision 7d124cef8960a865cc8d7db24b3359f7ff9958be)
@@ -28,10 +28,8 @@
using System.Xml.Linq;
using System.Xml.Schema;
using System.Xml.XPath;
-
using Core.Common.Base.Geometry;
using Core.Common.Utils.Reflection;
-
using Ringtoets.Piping.Data;
using Ringtoets.Piping.IO.Builders;
using Ringtoets.Piping.IO.Properties;
@@ -137,8 +135,8 @@
private XmlSchemaSet LoadXmlSchema()
{
- var schemaFile = AssemblyUtils.GetAssemblyResourceStream(GetType().Assembly,
- "Ringtoets.Piping.IO.SoilProfile.XmlGeometrySchema.xsd");
+ var schemaFile = AssemblyUtils.GetAssemblyResourceStream(GetType().Assembly,
+ "Ringtoets.Piping.IO.SoilProfile.XmlGeometrySchema.xsd");
var xmlSchema = new XmlSchemaSet();
xmlSchema.Add(XmlSchema.Read(schemaFile, null));
return xmlSchema;
@@ -215,17 +213,15 @@
///
private Point2D ParsePoint(XElement point)
{
- var x = point.Element(xElementName);
- var y = point.Element(zElementName);
- if (x != null && y != null)
+ var xElement = point.Element(xElementName);
+ var yElement = point.Element(zElementName);
+ if (xElement != null && yElement != null)
{
try
{
- return new Point2D
- (
- double.Parse(x.Value, CultureInfo.InvariantCulture),
- double.Parse(y.Value, CultureInfo.InvariantCulture)
- );
+ var x = double.Parse(xElement.Value, CultureInfo.InvariantCulture);
+ var y = double.Parse(yElement.Value, CultureInfo.InvariantCulture);
+ return new Point2D(x, y);
}
catch (ArgumentNullException e)
{
Index: Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/Point2DTest.cs
===================================================================
diff -u -r06f9145d8180df7fd26eac086a3f431c181e4d64 -r7d124cef8960a865cc8d7db24b3359f7ff9958be
--- Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/Point2DTest.cs (.../Point2DTest.cs) (revision 06f9145d8180df7fd26eac086a3f431c181e4d64)
+++ Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/Point2DTest.cs (.../Point2DTest.cs) (revision 7d124cef8960a865cc8d7db24b3359f7ff9958be)
@@ -1,9 +1,27 @@
-using System;
+// Copyright (C) Stichting Deltares 2016. 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 Core.Common.Base.Geometry;
-
using MathNet.Numerics.LinearAlgebra.Double;
-
using NUnit.Framework;
namespace Ringtoets.Piping.Data.Test
@@ -31,7 +49,7 @@
var y = random.NextDouble();
// Call
- var point = new Point2D(x,y);
+ var point = new Point2D(x, y);
// Assert
Assert.AreEqual(x, point.X);
@@ -83,8 +101,8 @@
public void Equals_OtherWithSameCoordinates_ReturnsTrue(double x, double y)
{
// Setup
- var point = new Point2D ( x, y );
- var otherPoint = new Point2D ( x, y );
+ var point = new Point2D(x, y);
+ var otherPoint = new Point2D(x, y);
// Call
var result = point.Equals(otherPoint);
Index: Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/Ringtoets.Piping.Data.Test.csproj
===================================================================
diff -u -r9def31196320039cc9075ba0e1fb12ce87c6769e -r7d124cef8960a865cc8d7db24b3359f7ff9958be
--- Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/Ringtoets.Piping.Data.Test.csproj (.../Ringtoets.Piping.Data.Test.csproj) (revision 9def31196320039cc9075ba0e1fb12ce87c6769e)
+++ Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/Ringtoets.Piping.Data.Test.csproj (.../Ringtoets.Piping.Data.Test.csproj) (revision 7d124cef8960a865cc8d7db24b3359f7ff9958be)
@@ -112,6 +112,9 @@
+
+ Copying.licenseheader
+
Index: Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/RingtoetsPipingSurfaceLineTest.cs
===================================================================
diff -u -r96e2d588e43f76a8eba5c47805eaaf8560f042d0 -r7d124cef8960a865cc8d7db24b3359f7ff9958be
--- Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/RingtoetsPipingSurfaceLineTest.cs (.../RingtoetsPipingSurfaceLineTest.cs) (revision 96e2d588e43f76a8eba5c47805eaaf8560f042d0)
+++ Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/RingtoetsPipingSurfaceLineTest.cs (.../RingtoetsPipingSurfaceLineTest.cs) (revision 7d124cef8960a865cc8d7db24b3359f7ff9958be)
@@ -1,4 +1,25 @@
-using System;
+// Copyright (C) Stichting Deltares 2016. 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.Linq;
using Core.Common.Base.Geometry;
@@ -121,14 +142,22 @@
// Setup
var surfaceLine = new RingtoetsPipingSurfaceLine();
const double originalZ = 3.3;
- surfaceLine.SetGeometry(new[]{ new Point3D { X = 1.1, Y = 2.2, Z = originalZ} });
+ surfaceLine.SetGeometry(new[]
+ {
+ new Point3D
+ {
+ X = 1.1, Y = 2.2, Z = originalZ
+ }
+ });
-
// Call
Point2D[] lzCoordinates = surfaceLine.ProjectGeometryToLZ().ToArray();
// Assert
- CollectionAssert.AreEqual(new[]{ new Point2D ( 0.0, originalZ ) }, lzCoordinates);
+ CollectionAssert.AreEqual(new[]
+ {
+ new Point2D(0.0, originalZ)
+ }, lzCoordinates);
}
[Test]
@@ -138,21 +167,30 @@
var surfaceLine = new RingtoetsPipingSurfaceLine();
surfaceLine.SetGeometry(new[]
{
- new Point3D { X = 1.0, Y = 1.0, Z = 2.2 },
- new Point3D { X = 2.0, Y = 3.0, Z = 4.4 }, // Outlier from line specified by extrema
- new Point3D { X = 3.0, Y = 4.0, Z = 7.7 },
+ new Point3D
+ {
+ X = 1.0, Y = 1.0, Z = 2.2
+ },
+ new Point3D
+ {
+ X = 2.0, Y = 3.0, Z = 4.4
+ }, // Outlier from line specified by extrema
+ new Point3D
+ {
+ X = 3.0, Y = 4.0, Z = 7.7
+ },
});
// Call
Point2D[] actual = surfaceLine.ProjectGeometryToLZ().ToArray();
// Assert
- var length = Math.Sqrt(2 * 2 + 3 * 3);
- const double secondCoordinateFactor = (2.0 * 1.0 + 3.0 * 2.0) / (2.0 * 2.0 + 3.0 * 3.0);
+ var length = Math.Sqrt(2*2 + 3*3);
+ const double secondCoordinateFactor = (2.0*1.0 + 3.0*2.0)/(2.0*2.0 + 3.0*3.0);
var expectedCoordinatesX = new[]
{
0.0,
- secondCoordinateFactor * length,
+ secondCoordinateFactor*length,
length
};
CollectionAssert.AreEqual(expectedCoordinatesX, actual.Select(p => p.X).ToArray());
@@ -170,7 +208,7 @@
// Assert
var exception = Assert.Throws(test);
- StringAssert.StartsWith(Properties.Resources.RingtoetsPipingSurfaceLine_Collection_of_points_for_geometry_is_null, exception.Message);
+ StringAssert.StartsWith(Resources.RingtoetsPipingSurfaceLine_Collection_of_points_for_geometry_is_null, exception.Message);
}
[Test]
@@ -180,11 +218,14 @@
var surfaceLine = new RingtoetsPipingSurfaceLine();
// Call
- TestDelegate test = () => surfaceLine.SetGeometry(new Point3D[] { null });
+ TestDelegate test = () => surfaceLine.SetGeometry(new Point3D[]
+ {
+ null
+ });
// Assert
var exception = Assert.Throws(test);
- StringAssert.StartsWith(Properties.Resources.RingtoetsPipingSurfaceLine_A_point_in_the_collection_was_null, exception.Message);
+ StringAssert.StartsWith(Resources.RingtoetsPipingSurfaceLine_A_point_in_the_collection_was_null, exception.Message);
}
[Test]
@@ -199,7 +240,7 @@
// Assert
var exceptionMessage = Assert.Throws(test).Message;
- Assert.AreEqual(Properties.Resources.RingtoetsPipingSurfaceLine_SurfaceLine_has_no_Geometry, exceptionMessage);
+ Assert.AreEqual(Resources.RingtoetsPipingSurfaceLine_SurfaceLine_has_no_Geometry, exceptionMessage);
}
[Test]
@@ -212,9 +253,18 @@
var l = 2.0;
surfaceLine.SetGeometry(new[]
{
- new Point3D { X = 0.0, Y = 0.0, Z = 2.2 },
- new Point3D { X = l, Y = 0.0, Z = testZ },
- new Point3D { X = 3.0, Y = 0.0, Z = 7.7 },
+ new Point3D
+ {
+ X = 0.0, Y = 0.0, Z = 2.2
+ },
+ new Point3D
+ {
+ X = l, Y = 0.0, Z = testZ
+ },
+ new Point3D
+ {
+ X = 3.0, Y = 0.0, Z = 7.7
+ },
});
// Call
@@ -237,17 +287,26 @@
var surfaceLine = new RingtoetsPipingSurfaceLine();
surfaceLine.SetGeometry(new[]
{
- new Point3D { X = 1.0, Y = 0.0, Z = 2.2 },
- new Point3D { X = 2.0, Y = 0.0, Z = testZ },
- new Point3D { X = 4.1, Y = 0.0, Z = 7.7 },
+ new Point3D
+ {
+ X = 1.0, Y = 0.0, Z = 2.2
+ },
+ new Point3D
+ {
+ X = 2.0, Y = 0.0, Z = testZ
+ },
+ new Point3D
+ {
+ X = 4.1, Y = 0.0, Z = 7.7
+ },
});
// Call
TestDelegate test = () => surfaceLine.GetZAtL(l);
// Assert
var expectedMessage = string.Format("Kan geen hoogte bepalen. L moet in het bereik van [{0}, {1}] liggen.",
- 0,3.1);
+ 0, 3.1);
TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, expectedMessage);
}
@@ -261,18 +320,30 @@
var l = 2.0;
surfaceLine.SetGeometry(new[]
{
- new Point3D { X = 0.0, Y = 0.0, Z = 2.2 },
- new Point3D { X = l, Y = 0.0, Z = testZ },
- new Point3D { X = l, Y = 0.0, Z = testZ+1 },
- new Point3D { X = 3.0, Y = 0.0, Z = 7.7 },
+ new Point3D
+ {
+ X = 0.0, Y = 0.0, Z = 2.2
+ },
+ new Point3D
+ {
+ X = l, Y = 0.0, Z = testZ
+ },
+ new Point3D
+ {
+ X = l, Y = 0.0, Z = testZ + 1
+ },
+ new Point3D
+ {
+ X = 3.0, Y = 0.0, Z = 7.7
+ },
});
// Call
TestDelegate test = () => surfaceLine.GetZAtL(l);
// Assert
var exception = Assert.Throws(test);
- var message = string.Format(Properties.Resources.RingtoetsPipingSurfaceLine_Cannot_determine_reliable_z_when_surface_line_is_vertical_in_l, l);
+ var message = string.Format(Resources.RingtoetsPipingSurfaceLine_Cannot_determine_reliable_z_when_surface_line_is_vertical_in_l, l);
Assert.AreEqual(message, exception.Message);
}