Index: Ringtoets/Piping/src/Ringtoets.Piping.IO/PipingSurfaceLinesCsvReader.cs
===================================================================
diff -u -r33d4f4e7e5404dcc6470dd3d34168b30410109eb -r7caaadff2fc6cb1b4b3936401a4c6281e120496d
--- Ringtoets/Piping/src/Ringtoets.Piping.IO/PipingSurfaceLinesCsvReader.cs (.../PipingSurfaceLinesCsvReader.cs) (revision 33d4f4e7e5404dcc6470dd3d34168b30410109eb)
+++ Ringtoets/Piping/src/Ringtoets.Piping.IO/PipingSurfaceLinesCsvReader.cs (.../PipingSurfaceLinesCsvReader.cs) (revision 7caaadff2fc6cb1b4b3936401a4c6281e120496d)
@@ -121,7 +121,7 @@
var tokenizedString = TokenizeString(readText);
var surfaceLineName = GetSurfaceLineName(tokenizedString);
- var points = GetSurfaceLinePoints(tokenizedString);
+ var points = GetSurfaceLinePoints(tokenizedString, surfaceLineName);
var surfaceLine = new RingtoetsPipingSurfaceLine
{
@@ -142,15 +142,20 @@
return null;
}
+ ///
+ /// Checks if the geometry dfining the surface line is valid.
+ ///
+ /// The surface line to be checked.
+ /// Surface line geometry is invalid
private void CheckIfGeometryIsValid(RingtoetsPipingSurfaceLine surfaceLine)
{
double[] lCoordinates = surfaceLine.ProjectGeometryToLZ().Select(p => p.X).ToArray();
for (int i = 1; i < lCoordinates.Length; i++)
{
if (lCoordinates[i - 1] > lCoordinates[i])
{
- var message = string.Format(Resources.PipingSurfaceLinesCsvReader_ReadLine_File_0_Line_1_has_reclining_geometry,
- filePath, 2);
+ var message = string.Format(Resources.PipingSurfaceLinesCsvReader_ReadLine_File_0_SurfaceLineName_1_has_reclining_geometry,
+ filePath, surfaceLine.Name);
throw new LineParseException(message);
}
}
@@ -188,6 +193,7 @@
/// Gets the 3D surface line points.
///
/// The tokenized string.
+ ///
/// Set of all 3D world coordinate points.
/// A parse error has occurred for the current row, which may be caused by:
///
@@ -196,15 +202,15 @@
/// - is missing coordinate values to define a proper surface line point.
///
///
- private IEnumerable GetSurfaceLinePoints(string[] tokenizedString)
+ private IEnumerable GetSurfaceLinePoints(string[] tokenizedString, string surfaceLineName)
{
const int expectedValuesForPoint = 3;
- var worldCoordinateValues = ParseWorldCoordinateValuesAndHandleParseErrors(tokenizedString);
+ var worldCoordinateValues = ParseWorldCoordinateValuesAndHandleParseErrors(tokenizedString, surfaceLineName);
if (worldCoordinateValues.Length % expectedValuesForPoint != 0)
{
- var message = string.Format(Resources.PipingSurfaceLinesCsvReader_ReadLine_File_0_Line_1_lacks_values_for_coordinate_triplet,
- filePath, lineNumber);
+ var message = string.Format(Resources.PipingSurfaceLinesCsvReader_ReadLine_File_0_SurfaceLineName_1_lacks_values_for_coordinate_triplet,
+ filePath, surfaceLineName);
throw new LineParseException(message);
}
@@ -244,14 +250,15 @@
/// Parses the world coordinate values and handles parse errors.
///
/// The tokenized string.
+ ///
///
/// A parse error has occurred for the current row, which may be caused by:
///
/// - The row contains a coordinate value that cannot be parsed as a double.
/// - The row contains a number that is too big or too small to be represented with a double.
///
///
- private double[] ParseWorldCoordinateValuesAndHandleParseErrors(string[] tokenizedString)
+ private double[] ParseWorldCoordinateValuesAndHandleParseErrors(string[] tokenizedString, string surfaceLineName)
{
try
{
@@ -261,14 +268,14 @@
}
catch (FormatException e)
{
- var message = string.Format(Resources.Error_File_0_has_not_double_Line_1_,
- filePath, lineNumber);
+ var message = string.Format(Resources.Error_File_0_has_not_double_SurfaceLineName_1_,
+ filePath, surfaceLineName);
throw new LineParseException(message, e);
}
catch (OverflowException e)
{
- var message = string.Format(Resources.Error_File_0_parsing_causes_overflow_Line_1_,
- filePath, lineNumber);
+ var message = string.Format(Resources.Error_File_0_parsing_causes_overflow_SurfaceLineName_1_,
+ filePath, surfaceLineName);
throw new LineParseException(message, e);
}
}
Index: Ringtoets/Piping/src/Ringtoets.Piping.IO/Properties/Resources.Designer.cs
===================================================================
diff -u -r712a020ea0330ece24849c2710641c1ce399ed61 -r7caaadff2fc6cb1b4b3936401a4c6281e120496d
--- Ringtoets/Piping/src/Ringtoets.Piping.IO/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 712a020ea0330ece24849c2710641c1ce399ed61)
+++ Ringtoets/Piping/src/Ringtoets.Piping.IO/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 7caaadff2fc6cb1b4b3936401a4c6281e120496d)
@@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
//
// This code was generated by a tool.
-// Runtime Version:4.0.30319.34209
+// Runtime Version:4.0.30319.18444
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -106,20 +106,20 @@
}
///
- /// Looks up a localized string similar to Het bestand '{0}' heeft op regel {1} een waarde dat geen getal is..
+ /// Looks up a localized string similar to Het bestand '{0}' heeft voor dwarsdoorsnede {1} een waarde dat geen getal is..
///
- public static string Error_File_0_has_not_double_Line_1_ {
+ public static string Error_File_0_has_not_double_SurfaceLineName_1_ {
get {
- return ResourceManager.GetString("Error_File_0_has_not_double_Line_1_", resourceCulture);
+ return ResourceManager.GetString("Error_File_0_has_not_double_SurfaceLineName_1_", resourceCulture);
}
}
///
- /// Looks up a localized string similar to Het bestand '{0}' heeft op regel {1} een waarde dat te groot/klein is om ingelezen te worden..
+ /// Looks up a localized string similar to Het bestand '{0}' heeft voor dwarsdoorsnede {1} een waarde dat te groot/klein is om ingelezen te worden..
///
- public static string Error_File_0_parsing_causes_overflow_Line_1_ {
+ public static string Error_File_0_parsing_causes_overflow_SurfaceLineName_1_ {
get {
- return ResourceManager.GetString("Error_File_0_parsing_causes_overflow_Line_1_", resourceCulture);
+ return ResourceManager.GetString("Error_File_0_parsing_causes_overflow_SurfaceLineName_1_", resourceCulture);
}
}
@@ -232,39 +232,40 @@
}
///
- /// Looks up a localized string similar to Het bestand '{0}' heeft op regel {1} een dwarsdoorsnede met teruglopende geometrie (Punten behoren een oplopende set L-coordinaten te hebben in het lokaal coordinatenstelsel)..
+ /// Looks up a localized string similar to Het bestand '{0}' heeft op regel {1} geen verwacht scheidingsteken (het karakter: {2})..
///
- public static string PipingSurfaceLinesCsvReader_ReadLine_File_0_Line_1_has_reclining_geometry {
+ public static string PipingSurfaceLinesCsvReader_ReadLine_File_0_Line_1_lacks_separator_2_ {
get {
- return ResourceManager.GetString("PipingSurfaceLinesCsvReader_ReadLine_File_0_Line_1_has_reclining_geometry", resourceCulture);
+ return ResourceManager.GetString("PipingSurfaceLinesCsvReader_ReadLine_File_0_Line_1_lacks_separator_2_", resourceCulture);
}
}
///
- /// Looks up a localized string similar to Het bestand '{0}' heeft op regel {1} geen verwacht scheidingsteken (het karakter: {2})..
+ /// Looks up a localized string similar to Het bestand '{0}' heeft geen ID op regel {1}..
///
- public static string PipingSurfaceLinesCsvReader_ReadLine_File_0_Line_1_lacks_separator_2_ {
+ public static string PipingSurfaceLinesCsvReader_ReadLine_File_0_Line_1_no_ID {
get {
- return ResourceManager.GetString("PipingSurfaceLinesCsvReader_ReadLine_File_0_Line_1_lacks_separator_2_", resourceCulture);
+ return ResourceManager.GetString("PipingSurfaceLinesCsvReader_ReadLine_File_0_Line_1_no_ID", resourceCulture);
}
}
///
- /// Looks up a localized string similar to In het bestand '{0}', op regel {1}, ontbreken er waardes om een 3D (X,Y,Z) punt aan te maken..
+ /// Looks up a localized string similar to Dwarsdoorsnede {1} van bestand '{0}' heeft een teruglopende geometrie (Punten behoren een oplopende set L-coordinaten te hebben in het lokaal coordinatenstelsel)..
///
- public static string PipingSurfaceLinesCsvReader_ReadLine_File_0_Line_1_lacks_values_for_coordinate_triplet {
+ public static string PipingSurfaceLinesCsvReader_ReadLine_File_0_SurfaceLineName_1_has_reclining_geometry {
get {
- return ResourceManager.GetString("PipingSurfaceLinesCsvReader_ReadLine_File_0_Line_1_lacks_values_for_coordinate_tr" +
- "iplet", resourceCulture);
+ return ResourceManager.GetString("PipingSurfaceLinesCsvReader_ReadLine_File_0_SurfaceLineName_1_has_reclining_geome" +
+ "try", resourceCulture);
}
}
///
- /// Looks up a localized string similar to Het bestand '{0}' heeft geen ID op regel {1}..
+ /// Looks up a localized string similar to In het bestand '{0}', voor dwarsdoorsnede {1}, ontbreken er waardes om een 3D (X,Y,Z) punt aan te maken..
///
- public static string PipingSurfaceLinesCsvReader_ReadLine_File_0_Line_1_no_ID {
+ public static string PipingSurfaceLinesCsvReader_ReadLine_File_0_SurfaceLineName_1_lacks_values_for_coordinate_triplet {
get {
- return ResourceManager.GetString("PipingSurfaceLinesCsvReader_ReadLine_File_0_Line_1_no_ID", resourceCulture);
+ return ResourceManager.GetString("PipingSurfaceLinesCsvReader_ReadLine_File_0_SurfaceLineName_1_lacks_values_for_co" +
+ "ordinate_triplet", resourceCulture);
}
}
Index: Ringtoets/Piping/src/Ringtoets.Piping.IO/Properties/Resources.resx
===================================================================
diff -u -r712a020ea0330ece24849c2710641c1ce399ed61 -r7caaadff2fc6cb1b4b3936401a4c6281e120496d
--- Ringtoets/Piping/src/Ringtoets.Piping.IO/Properties/Resources.resx (.../Resources.resx) (revision 712a020ea0330ece24849c2710641c1ce399ed61)
+++ Ringtoets/Piping/src/Ringtoets.Piping.IO/Properties/Resources.resx (.../Resources.resx) (revision 7caaadff2fc6cb1b4b3936401a4c6281e120496d)
@@ -132,11 +132,11 @@
Het bestand op '{0}' is leeg.
-
- Het bestand '{0}' heeft op regel {1} een waarde dat geen getal is.
+
+ Het bestand '{0}' heeft voor dwarsdoorsnede {1} een waarde dat geen getal is.
-
- Het bestand '{0}' heeft op regel {1} een waarde dat te groot/klein is om ingelezen te worden.
+
+ Het bestand '{0}' heeft voor dwarsdoorsnede {1} een waarde dat te groot/klein is om ingelezen te worden.
Er is een onverwachte fout opgetreden tijdens het inlezen van het bestand '{0}': {1}
@@ -162,14 +162,14 @@
Het bestand op '{0}' is niet geschikt om dwarsdoorsneden uit te lezen (Verwachte header: locationid;X1;Y1;Z1).
-
- Het bestand '{0}' heeft op regel {1} een dwarsdoorsnede met teruglopende geometrie (Punten behoren een oplopende set L-coordinaten te hebben in het lokaal coordinatenstelsel).
+
+ Dwarsdoorsnede {1} van bestand '{0}' heeft een teruglopende geometrie (Punten behoren een oplopende set L-coordinaten te hebben in het lokaal coordinatenstelsel).
Het bestand '{0}' heeft op regel {1} geen verwacht scheidingsteken (het karakter: {2}).
-
- In het bestand '{0}', op regel {1}, ontbreken er waardes om een 3D (X,Y,Z) punt aan te maken.
+
+ In het bestand '{0}', voor dwarsdoorsnede {1}, ontbreken er waardes om een 3D (X,Y,Z) punt aan te maken.
Het bestand '{0}' heeft geen ID op regel {1}.
Index: Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/PipingSurfaceLinesCsvReaderTest.cs
===================================================================
diff -u -r5eb251659313f12d82ee14e5703572ae09455e07 -r7caaadff2fc6cb1b4b3936401a4c6281e120496d
--- Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/PipingSurfaceLinesCsvReaderTest.cs (.../PipingSurfaceLinesCsvReaderTest.cs) (revision 5eb251659313f12d82ee14e5703572ae09455e07)
+++ Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/PipingSurfaceLinesCsvReaderTest.cs (.../PipingSurfaceLinesCsvReaderTest.cs) (revision 7caaadff2fc6cb1b4b3936401a4c6281e120496d)
@@ -417,7 +417,7 @@
// Assert
var exception = Assert.Throws(call);
- var expectedMessage = string.Format(IOResources.Error_File_0_has_not_double_Line_1_, path, 2);
+ var expectedMessage = string.Format(IOResources.Error_File_0_has_not_double_SurfaceLineName_1_, path, "InvalidSurfaceLine");
Assert.AreEqual(expectedMessage, exception.Message);
Assert.IsInstanceOf(exception.InnerException);
}
@@ -445,7 +445,7 @@
// Assert
var exception = Assert.Throws(call);
- var expectedMessage = string.Format(IOResources.Error_File_0_parsing_causes_overflow_Line_1_, path, 2);
+ var expectedMessage = string.Format(IOResources.Error_File_0_parsing_causes_overflow_SurfaceLineName_1_, path, "InvalidSurfaceLine");
Assert.AreEqual(expectedMessage, exception.Message);
Assert.IsInstanceOf(exception.InnerException);
}
@@ -537,12 +537,12 @@
// Assert
// 1st row lacks 1 coordinate value:
var exception = Assert.Throws(call);
- var expectedMessage = string.Format(IOResources.PipingSurfaceLinesCsvReader_ReadLine_File_0_Line_1_lacks_values_for_coordinate_triplet, path, 2);
+ var expectedMessage = string.Format(IOResources.PipingSurfaceLinesCsvReader_ReadLine_File_0_SurfaceLineName_1_lacks_values_for_coordinate_triplet, path, "LacksOneCoordinate");
Assert.AreEqual(expectedMessage, exception.Message);
// 2nd row lacks 2 coordinate values:
exception = Assert.Throws(call);
- expectedMessage = string.Format(IOResources.PipingSurfaceLinesCsvReader_ReadLine_File_0_Line_1_lacks_values_for_coordinate_triplet, path, 3);
+ expectedMessage = string.Format(IOResources.PipingSurfaceLinesCsvReader_ReadLine_File_0_SurfaceLineName_1_lacks_values_for_coordinate_triplet, path, "LacksTwoCoordinates");
Assert.AreEqual(expectedMessage, exception.Message);
}
}
@@ -563,8 +563,8 @@
// Assert
var exception = Assert.Throws(call);
- var expectedMessage = string.Format(IOResources.PipingSurfaceLinesCsvReader_ReadLine_File_0_Line_1_has_reclining_geometry,
- path, 2);
+ var expectedMessage = string.Format(IOResources.PipingSurfaceLinesCsvReader_ReadLine_File_0_SurfaceLineName_1_has_reclining_geometry,
+ path, "ArtificalLocal");
Assert.AreEqual(expectedMessage, exception.Message);
}
}
Index: Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/test-data/SurfaceLines/InvalidRow_DuplicatePointsCausingRecline.csv
===================================================================
diff -u
--- Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/test-data/SurfaceLines/InvalidRow_DuplicatePointsCausingRecline.csv (revision 0)
+++ Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/test-data/SurfaceLines/InvalidRow_DuplicatePointsCausingRecline.csv (revision 7caaadff2fc6cb1b4b3936401a4c6281e120496d)
@@ -0,0 +1,2 @@
+Profielnaam;X1;Y1;Z1;...;Xn;Yn;Zn
+Rotterdam1;94263.0026213;427776.654093;-1.02;94275.9126686;427811.080886;-1.04;94263.0026213;427776.654093;-1.02;94284.0663827;427831.918156;1.25;94263.0026213;427776.654093;-1.02;94294.9380015;427858.191234;1.45;94305.3566362;427889.900123;1.65;94263.0026213;427776.654093;-1.02;94315.0957947;427913.908281;1.66;94325.0614453;427941.766804;1.55;94331.1767309;427960.112661;1.44
Fisheye: Tag 7caaadff2fc6cb1b4b3936401a4c6281e120496d refers to a dead (removed) revision in file `Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/test-data/SurfaceLines/ValidSurfaceLine_HasDuplicatePoints.csv'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/FileImporter/PipingSurfaceLineCsvImporterTest.cs
===================================================================
diff -u -r20080bce6a7f240532182e73ee3e638b574fb612 -r7caaadff2fc6cb1b4b3936401a4c6281e120496d
--- Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/FileImporter/PipingSurfaceLineCsvImporterTest.cs (.../PipingSurfaceLineCsvImporterTest.cs) (revision 20080bce6a7f240532182e73ee3e638b574fb612)
+++ Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/FileImporter/PipingSurfaceLineCsvImporterTest.cs (.../PipingSurfaceLineCsvImporterTest.cs) (revision 7caaadff2fc6cb1b4b3936401a4c6281e120496d)
@@ -441,8 +441,8 @@
Action call = () => importedItem = importer.ImportItem(corruptPath, observableSurfaceLinesList);
// Assert
- var internalErrorMessage = String.Format(WtiIOResources.Error_File_0_has_not_double_Line_1_,
- corruptPath, 3);
+ var internalErrorMessage = String.Format(WtiIOResources.Error_File_0_has_not_double_SurfaceLineName_1_,
+ corruptPath, "InvalidRow");
var expectedLogMessage = string.Format(ApplicationResources.PipingSurfaceLinesCsvImporter_ReadPipingSurfaceLines_Parse_error_File_0_SurfaceLinesNumber_1_Message_2_,
corruptPath, 2, internalErrorMessage);
TestHelper.AssertLogMessageIsGenerated(call, expectedLogMessage, 1);
@@ -462,7 +462,7 @@
public void ImportItem_ImportingToValidTargetWithInValidFileWithDuplicatePointsCausingRecline_SkipInvalidRowAndLog()
{
// Setup
- var twovalidsurfacelinesCsv = "ValidSurfaceLine_HasDuplicatePoints.csv";
+ var twovalidsurfacelinesCsv = "InvalidRow_DuplicatePointsCausingRecline.csv";
string path = Path.Combine(testDataPath, twovalidsurfacelinesCsv);
var mocks = new MockRepository();
@@ -485,8 +485,8 @@
Action call = () => importedItem = importer.ImportItem(path, observableSurfaceLinesList);
// Assert
- var internalErrorMessage = String.Format(WtiIOResources.PipingSurfaceLinesCsvReader_ReadLine_File_0_Line_1_has_reclining_geometry,
- path, 2);
+ var internalErrorMessage = String.Format(WtiIOResources.PipingSurfaceLinesCsvReader_ReadLine_File_0_SurfaceLineName_1_has_reclining_geometry,
+ path, "Rotterdam1");
var expectedLogMessage = string.Format(ApplicationResources.PipingSurfaceLinesCsvImporter_ReadPipingSurfaceLines_Parse_error_File_0_SurfaceLinesNumber_1_Message_2_,
path, 1, internalErrorMessage);
TestHelper.AssertLogMessageIsGenerated(call, expectedLogMessage, 1);