Index: Ringtoets/Piping/src/Ringtoets.Piping.IO/PipingCharacteristicPointsCsvReader.cs
===================================================================
diff -u -rf25d385a604082d8621bd74fe30d40c67c50b6d1 -r3db2c05c87d365e0f6bbd5fefacd7ded1492b980
--- Ringtoets/Piping/src/Ringtoets.Piping.IO/PipingCharacteristicPointsCsvReader.cs (.../PipingCharacteristicPointsCsvReader.cs) (revision f25d385a604082d8621bd74fe30d40c67c50b6d1)
+++ Ringtoets/Piping/src/Ringtoets.Piping.IO/PipingCharacteristicPointsCsvReader.cs (.../PipingCharacteristicPointsCsvReader.cs) (revision 3db2c05c87d365e0f6bbd5fefacd7ded1492b980)
@@ -384,6 +384,11 @@
///
/// A single line read from file.
/// A new with name and characteristic points set.
+ /// Thrown when:
+ ///
+ /// - has too many or few columns.
+ /// - contains a coordinate value which could not be parsed to .
+ ///
private PipingCharacteristicPointsLocation CreatePipingCharacteristicPointsLocation(string readText)
{
var tokenizedString = TokenizeString(readText);
@@ -404,6 +409,8 @@
///
/// The string read from file.
/// The to set the characteristic points for.
+ /// Thrown when
+ /// contains a coordinate value which could not be parsed to .
private void SetCharacteristicPoints(string[] tokenizedString, PipingCharacteristicPointsLocation location)
{
location.SurfaceLevelInside = GetPoint3D(location.Name, tokenizedString, surfaceLevelInsideXKey, surfaceLevelInsideYKey, surfaceLevelInsideZKey);
@@ -427,7 +434,19 @@
location.BottomRiverChannel = GetPoint3D(location.Name, tokenizedString, bottomRiverChannelXKey, bottomRiverChannelYKey, bottomRiverChannelZKey);
}
- private Point3D GetPoint3D(string locationName, string[] points, string xColumn, string yColumn, string zColumn)
+ ///
+ /// Creates a new from the collection of ,
+ ///
+ /// The name of the location used for creating descriptive errors.
+ /// The collection of read data.
+ /// The name of the column to use as x-coordinate of the new point.
+ /// The name of the column to use as y-coordinate of the new point.
+ /// The name of the column to use as z-coordinate of the new point.
+ /// A new with values for x,y,z set.
+ /// Thrown when
+ /// contains value which could not be parsed to a double in column ,
+ /// or .
+ private Point3D GetPoint3D(string locationName, string[] valuesRead, string xColumn, string yColumn, string zColumn)
{
try
{
@@ -438,9 +457,9 @@
{
return new Point3D
{
- X = double.Parse(points[xColumnIndex], CultureInfo.InvariantCulture),
- Y = double.Parse(points[yColumnIndex], CultureInfo.InvariantCulture),
- Z = double.Parse(points[zColumnIndex], CultureInfo.InvariantCulture)
+ X = double.Parse(valuesRead[xColumnIndex], CultureInfo.InvariantCulture),
+ Y = double.Parse(valuesRead[yColumnIndex], CultureInfo.InvariantCulture),
+ Z = double.Parse(valuesRead[zColumnIndex], CultureInfo.InvariantCulture)
};
}
return null;