Index: Core/Components/src/Core.Components.Charting/Styles/ChartLineStyle.cs
===================================================================
diff -u -r67284323e2785c651633d9c52049ba12a9c70e6a -r5fb13b35ed6bba8b867b95826e85dddb064b7036
--- Core/Components/src/Core.Components.Charting/Styles/ChartLineStyle.cs (.../ChartLineStyle.cs) (revision 67284323e2785c651633d9c52049ba12a9c70e6a)
+++ Core/Components/src/Core.Components.Charting/Styles/ChartLineStyle.cs (.../ChartLineStyle.cs) (revision 5fb13b35ed6bba8b867b95826e85dddb064b7036)
@@ -43,6 +43,19 @@
}
///
+ /// Creates a new instance of .
+ ///
+ /// The color of the line.
+ /// The width of the line.
+ /// The dash style definition of the line.
+ public ChartLineStyle(Color color, int width, double[] style)
+ {
+ Color = color;
+ Width = width;
+ Dashes = style;
+ }
+
+ ///
/// Gets the line color.
///
public Color Color { get; private set; }
@@ -56,5 +69,11 @@
/// Gets the line style.
///
public DashStyle Style { get; private set; }
+
+ ///
+ /// Gets the line style.
+ /// Overrides .
+ ///
+ public double[] Dashes { get; private set; }
}
}
\ No newline at end of file
Index: Core/Components/src/Core.Components.OxyPlot/Converter/ChartDataHelper.cs
===================================================================
diff -u -r67284323e2785c651633d9c52049ba12a9c70e6a -r5fb13b35ed6bba8b867b95826e85dddb064b7036
--- Core/Components/src/Core.Components.OxyPlot/Converter/ChartDataHelper.cs (.../ChartDataHelper.cs) (revision 67284323e2785c651633d9c52049ba12a9c70e6a)
+++ Core/Components/src/Core.Components.OxyPlot/Converter/ChartDataHelper.cs (.../ChartDataHelper.cs) (revision 5fb13b35ed6bba8b867b95826e85dddb064b7036)
@@ -96,7 +96,7 @@
markerType = MarkerType.Triangle;
break;
default:
- throw new InvalidEnumArgumentException("symbol",
+ throw new InvalidEnumArgumentException(nameof(symbol),
(int) symbol,
typeof(ChartPointSymbol));
}
Index: Core/Components/src/Core.Components.OxyPlot/Converter/ChartMultipleLineDataConverter.cs
===================================================================
diff -u -rfa07631b4d1fac0c9d34aedfc19de6afc1e01f59 -r5fb13b35ed6bba8b867b95826e85dddb064b7036
--- Core/Components/src/Core.Components.OxyPlot/Converter/ChartMultipleLineDataConverter.cs (.../ChartMultipleLineDataConverter.cs) (revision fa07631b4d1fac0c9d34aedfc19de6afc1e01f59)
+++ Core/Components/src/Core.Components.OxyPlot/Converter/ChartMultipleLineDataConverter.cs (.../ChartMultipleLineDataConverter.cs) (revision 5fb13b35ed6bba8b867b95826e85dddb064b7036)
@@ -19,9 +19,11 @@
// Stichting Deltares and remain full property of Stichting Deltares at all times.
// All rights reserved.
+using System.Drawing.Drawing2D;
using System.Linq;
using Core.Common.Base.Geometry;
using Core.Components.Charting.Data;
+using Core.Components.Charting.Styles;
using Core.Components.OxyPlot.CustomSeries;
using OxyPlot;
@@ -44,11 +46,15 @@
protected override void SetSeriesStyle(ChartMultipleLineData data, MultipleLineSeries series)
{
- if (data.Style != null)
+ ChartLineStyle lineStyle = data.Style;
+ if (lineStyle != null)
{
- series.Color = ChartDataHelper.Convert(data.Style.Color);
- series.StrokeThickness = data.Style.Width;
- series.LineStyle = ChartDataHelper.Convert(data.Style.Style);
+ series.Color = ChartDataHelper.Convert(lineStyle.Color);
+ series.StrokeThickness = lineStyle.Width;
+
+ DashStyle dashStyle = lineStyle.Style;
+ series.Dashes = lineStyle.Dashes;
+ series.LineStyle = ChartDataHelper.Convert(dashStyle);
}
}
}
Index: Core/Components/src/Core.Components.OxyPlot/CustomSeries/MultipleLineSeries.cs
===================================================================
diff -u -raefd4f8600e09ea77d5bc37ffc56766763d5dcde -r5fb13b35ed6bba8b867b95826e85dddb064b7036
--- Core/Components/src/Core.Components.OxyPlot/CustomSeries/MultipleLineSeries.cs (.../MultipleLineSeries.cs) (revision aefd4f8600e09ea77d5bc37ffc56766763d5dcde)
+++ Core/Components/src/Core.Components.OxyPlot/CustomSeries/MultipleLineSeries.cs (.../MultipleLineSeries.cs) (revision 5fb13b35ed6bba8b867b95826e85dddb064b7036)
@@ -74,6 +74,12 @@
///
public LineStyle LineStyle { get; set; }
+ ///
+ /// Gets or sets the definition of a dashed line style.
+ /// Overrides the .
+ ///
+ public double[] Dashes { get; set; }
+
public override void Render(IRenderContext renderContext)
{
if (renderContext == null)
@@ -98,7 +104,7 @@
IList pts0 = new ScreenPoint[n0];
TransformToScreenCoordinates(n0, pts0, line);
- renderContext.DrawLine(pts0, Color, StrokeThickness, LineStyle.GetDashArray());
+ renderContext.DrawLine(pts0, Color, StrokeThickness, Dashes ?? LineStyle.GetDashArray());
}
renderContext.ResetClip();
Index: Core/Components/test/Core.Components.Charting.Test/Styles/ChartLineStyleTest.cs
===================================================================
diff -u -r67284323e2785c651633d9c52049ba12a9c70e6a -r5fb13b35ed6bba8b867b95826e85dddb064b7036
--- Core/Components/test/Core.Components.Charting.Test/Styles/ChartLineStyleTest.cs (.../ChartLineStyleTest.cs) (revision 67284323e2785c651633d9c52049ba12a9c70e6a)
+++ Core/Components/test/Core.Components.Charting.Test/Styles/ChartLineStyleTest.cs (.../ChartLineStyleTest.cs) (revision 5fb13b35ed6bba8b867b95826e85dddb064b7036)
@@ -30,7 +30,7 @@
public class ChartLineStyleTest
{
[Test]
- public void Constructor_WithAllParameters_SetsProperties()
+ public void Constructor_WithStyle_SetsProperties()
{
// Setup
Color color = Color.AliceBlue;
@@ -44,6 +44,25 @@
Assert.AreEqual(color, lineStyle.Color);
Assert.AreEqual(width, lineStyle.Width);
Assert.AreEqual(style, lineStyle.Style);
+ Assert.IsNull(lineStyle.Dashes);
}
+
+ [Test]
+ public void Constructor_WithDashes_SetsProperties()
+ {
+ // Setup
+ Color color = Color.AliceBlue;
+ const int width = 3;
+ double[] style = { 3.6, 5.2 };
+
+ // Call
+ var lineStyle = new ChartLineStyle(color, width, style);
+
+ // Assert
+ Assert.AreEqual(color, lineStyle.Color);
+ Assert.AreEqual(width, lineStyle.Width);
+ Assert.AreEqual(style, lineStyle.Dashes);
+ Assert.AreEqual(DashStyle.Solid, lineStyle.Style);
+ }
}
}
\ No newline at end of file
Index: Core/Components/test/Core.Components.OxyPlot.Test/Converter/ChartMultipleLineDataConverterTest.cs
===================================================================
diff -u -rb28507193a2799b3e4a4e5e447693e17e1e121b5 -r5fb13b35ed6bba8b867b95826e85dddb064b7036
--- Core/Components/test/Core.Components.OxyPlot.Test/Converter/ChartMultipleLineDataConverterTest.cs (.../ChartMultipleLineDataConverterTest.cs) (revision b28507193a2799b3e4a4e5e447693e17e1e121b5)
+++ Core/Components/test/Core.Components.OxyPlot.Test/Converter/ChartMultipleLineDataConverterTest.cs (.../ChartMultipleLineDataConverterTest.cs) (revision 5fb13b35ed6bba8b867b95826e85dddb064b7036)
@@ -150,6 +150,32 @@
// Assert
Assert.AreEqual(expectedLineStyle, multipleLineSeries.LineStyle);
+ Assert.IsNull(multipleLineSeries.Dashes);
}
+
+ [Test]
+ public void ConvertSeriesProperties_ChartLineStyleSetWithDifferentCustomDashStyles_AppliesStyleToSeries()
+ {
+ // Setup
+ var converter = new ChartMultipleLineDataConverter();
+ var multipleLineSeries = new MultipleLineSeries();
+ var random = new Random(21);
+ var dashes = new[]
+ {
+ random.NextDouble(),
+ random.NextDouble()
+ };
+ var data = new ChartMultipleLineData("test")
+ {
+ Style = new ChartLineStyle(Color.Red, 3, dashes)
+ };
+
+ // Call
+ converter.ConvertSeriesProperties(data, multipleLineSeries);
+
+ // Assert
+ Assert.AreEqual(LineStyle.Solid, multipleLineSeries.LineStyle);
+ Assert.AreEqual(dashes, multipleLineSeries.Dashes);
+ }
}
}
\ No newline at end of file
Index: Core/Components/test/Core.Components.OxyPlot.Test/CustomSeries/MultipleLineSeriesTest.cs
===================================================================
diff -u -raefd4f8600e09ea77d5bc37ffc56766763d5dcde -r5fb13b35ed6bba8b867b95826e85dddb064b7036
--- Core/Components/test/Core.Components.OxyPlot.Test/CustomSeries/MultipleLineSeriesTest.cs (.../MultipleLineSeriesTest.cs) (revision aefd4f8600e09ea77d5bc37ffc56766763d5dcde)
+++ Core/Components/test/Core.Components.OxyPlot.Test/CustomSeries/MultipleLineSeriesTest.cs (.../MultipleLineSeriesTest.cs) (revision 5fb13b35ed6bba8b867b95826e85dddb064b7036)
@@ -99,12 +99,28 @@
}
[Test]
- public void Render_NonEmptyLine_RendersThePoints()
+ [TestCase(null, new[]
{
+ 3.0,
+ 2.3
+ })]
+ [TestCase(LineStyle.DashDashDot, null)]
+ [TestCase(LineStyle.DashDashDot, new[]
+ {
+ 4.1,
+ 1.25
+ })]
+ public void Render_NonEmptyLine_RendersThePoints(LineStyle? style, double[] dashes)
+ {
// Setup
var random = new Random(21);
int pointCount = random.Next(5, 455);
var series = new MultipleLineSeries();
+ if (style.HasValue)
+ {
+ series.LineStyle = style.Value;
+ }
+ series.Dashes = dashes;
var model = new PlotModel();
model.Series.Add(series);
@@ -116,7 +132,7 @@
Arg.Matches(sp => sp.Length == pointCount),
Arg.Is.Equal(series.Color),
Arg.Is.Equal(series.StrokeThickness),
- Arg.Is.Anything,
+ Arg.Is.Equal(dashes ?? style.Value.GetDashArray()),
Arg.Is.Anything,
Arg.Is.Anything));
@@ -139,12 +155,28 @@
}
[Test]
- public void Render_MultipleNonEmptyLine_RendersTheLines()
+ [TestCase(null, new[]
{
+ 3.0,
+ 2.3
+ })]
+ [TestCase(LineStyle.DashDashDot, null)]
+ [TestCase(LineStyle.DashDashDot, new[]
+ {
+ 4.1,
+ 1.25
+ })]
+ public void Render_MultipleNonEmptyLine_RendersTheLines(LineStyle? style, double[] dashes)
+ {
// Setup
var random = new Random(21);
int lineCount = random.Next(5, 455);
var series = new MultipleLineSeries();
+ if (style.HasValue)
+ {
+ series.LineStyle = style.Value;
+ }
+ series.Dashes = dashes;
var model = new PlotModel();
model.Series.Add(series);
@@ -156,7 +188,7 @@
Arg.Matches(sp => sp.Length == 1),
Arg.Is.Equal(series.Color),
Arg.Is.Equal(series.StrokeThickness),
- Arg.Is.Anything,
+ Arg.Is.Equal(dashes ?? style.Value.GetDashArray()),
Arg.Is.Anything,
Arg.Is.Anything)).Repeat.Times(lineCount);
Index: Ringtoets/Common/src/Ringtoets.Common.Service/DesignWaterLevelCalculationActivity.cs
===================================================================
diff -u -rb3b6c13cf736c134476b3db34281332d01ca86b1 -r5fb13b35ed6bba8b867b95826e85dddb064b7036
--- Ringtoets/Common/src/Ringtoets.Common.Service/DesignWaterLevelCalculationActivity.cs (.../DesignWaterLevelCalculationActivity.cs) (revision b3b6c13cf736c134476b3db34281332d01ca86b1)
+++ Ringtoets/Common/src/Ringtoets.Common.Service/DesignWaterLevelCalculationActivity.cs (.../DesignWaterLevelCalculationActivity.cs) (revision 5fb13b35ed6bba8b867b95826e85dddb064b7036)
@@ -105,7 +105,7 @@
protected override void OnFinish()
{
- // hydraulicBoundaryLocation.NotifyObservers();
+ hydraulicBoundaryLocation.NotifyObservers();
}
private bool AlreadyCalculated
Index: Ringtoets/Common/src/Ringtoets.Common.Service/WaveHeightCalculationActivity.cs
===================================================================
diff -u -rb3b6c13cf736c134476b3db34281332d01ca86b1 -r5fb13b35ed6bba8b867b95826e85dddb064b7036
--- Ringtoets/Common/src/Ringtoets.Common.Service/WaveHeightCalculationActivity.cs (.../WaveHeightCalculationActivity.cs) (revision b3b6c13cf736c134476b3db34281332d01ca86b1)
+++ Ringtoets/Common/src/Ringtoets.Common.Service/WaveHeightCalculationActivity.cs (.../WaveHeightCalculationActivity.cs) (revision 5fb13b35ed6bba8b867b95826e85dddb064b7036)
@@ -105,7 +105,7 @@
protected override void OnFinish()
{
- // hydraulicBoundaryLocation.NotifyObservers();
+ hydraulicBoundaryLocation.NotifyObservers();
}
private bool AlreadyCalculated
Index: Ringtoets/Common/test/Ringtoets.Common.Service.Test/DesignWaterLevelCalculationActivityTest.cs
===================================================================
diff -u -rb3b6c13cf736c134476b3db34281332d01ca86b1 -r5fb13b35ed6bba8b867b95826e85dddb064b7036
--- Ringtoets/Common/test/Ringtoets.Common.Service.Test/DesignWaterLevelCalculationActivityTest.cs (.../DesignWaterLevelCalculationActivityTest.cs) (revision b3b6c13cf736c134476b3db34281332d01ca86b1)
+++ Ringtoets/Common/test/Ringtoets.Common.Service.Test/DesignWaterLevelCalculationActivityTest.cs (.../DesignWaterLevelCalculationActivityTest.cs) (revision 5fb13b35ed6bba8b867b95826e85dddb064b7036)
@@ -22,6 +22,7 @@
using System;
using System.IO;
using System.Linq;
+using Core.Common.Base;
using Core.Common.Base.Service;
using Core.Common.TestUtil;
using Core.Common.Utils;
@@ -59,8 +60,8 @@
var hydraulicBoundaryLocation = new HydraulicBoundaryLocation(0, locationName, 0, 0);
- var calculationMessageProviderMock = mockRepository.StrictMock();
- calculationMessageProviderMock.Expect(calc => calc.GetActivityName(locationName)).Return(activityName);
+ var calculationMessageProvider = mockRepository.StrictMock();
+ calculationMessageProvider.Expect(calc => calc.GetActivityName(locationName)).Return(activityName);
mockRepository.ReplayAll();
string validFilePath = Path.Combine(testDataPath, validFile);
@@ -69,7 +70,7 @@
var activity = new DesignWaterLevelCalculationActivity(hydraulicBoundaryLocation,
validFilePath,
1,
- calculationMessageProviderMock);
+ calculationMessageProvider);
// Assert
Assert.IsInstanceOf(activity);
@@ -130,15 +131,15 @@
var hydraulicBoundaryLocation = new HydraulicBoundaryLocation(1, locationName, 0, 0);
- var calculationMessageProviderMock = mockRepository.StrictMock();
- calculationMessageProviderMock.Expect(calc => calc.GetActivityName(locationName)).Return(activityName);
- calculationMessageProviderMock.Expect(calc => calc.GetCalculationName(locationName)).Return(calculationName).Repeat.AtLeastOnce();
+ var calculationMessageProvider = mockRepository.StrictMock();
+ calculationMessageProvider.Expect(calc => calc.GetActivityName(locationName)).Return(activityName);
+ calculationMessageProvider.Expect(calc => calc.GetCalculationName(locationName)).Return(calculationName).Repeat.AtLeastOnce();
mockRepository.ReplayAll();
var activity = new DesignWaterLevelCalculationActivity(hydraulicBoundaryLocation,
inValidFilePath,
1,
- calculationMessageProviderMock);
+ calculationMessageProvider);
// Call
Action call = () => activity.Run();
@@ -168,15 +169,15 @@
var hydraulicBoundaryLocation = new HydraulicBoundaryLocation(0, locationName, 0, 0);
- var calculationMessageProviderMock = mockRepository.Stub();
- calculationMessageProviderMock.Stub(calc => calc.GetActivityName(locationName)).Return(activityName);
- calculationMessageProviderMock.Stub(calc => calc.GetCalculationName(locationName)).Return(calculationName);
+ var calculationMessageProvider = mockRepository.Stub();
+ calculationMessageProvider.Stub(calc => calc.GetActivityName(locationName)).Return(activityName);
+ calculationMessageProvider.Stub(calc => calc.GetCalculationName(locationName)).Return(calculationName);
mockRepository.ReplayAll();
var activity = new DesignWaterLevelCalculationActivity(hydraulicBoundaryLocation,
validFilePath,
norm,
- calculationMessageProviderMock);
+ calculationMessageProvider);
using (new HydraRingCalculatorFactoryConfig())
{
@@ -217,9 +218,9 @@
const string activityName = "GetActivityName";
const double norm = 1.0 / 30;
- var calculationMessageProviderMock = mockRepository.Stub();
- calculationMessageProviderMock.Stub(calc => calc.GetActivityName(locationName)).Return(activityName);
- calculationMessageProviderMock.Stub(calc => calc.GetCalculationName(locationName)).Return(activityName);
+ var calculationMessageProvider = mockRepository.Stub();
+ calculationMessageProvider.Stub(calc => calc.GetActivityName(locationName)).Return(activityName);
+ calculationMessageProvider.Stub(calc => calc.GetCalculationName(locationName)).Return(activityName);
mockRepository.ReplayAll();
var hydraulicBoundaryLocation = new HydraulicBoundaryLocation(0, locationName, 0, 0)
@@ -232,7 +233,7 @@
var activity = new DesignWaterLevelCalculationActivity(hydraulicBoundaryLocation,
validFilePath,
norm,
- calculationMessageProviderMock);
+ calculationMessageProvider);
// Call
Action call = () => activity.Run();
@@ -250,9 +251,9 @@
const string locationName = "locationName 1";
var hydraulicBoundaryLocation = new HydraulicBoundaryLocation(0, locationName, 0, 0);
- var calculationMessageProviderMock = mockRepository.StrictMock();
- calculationMessageProviderMock.Expect(calc => calc.GetActivityName(locationName)).Return(string.Empty);
- calculationMessageProviderMock.Expect(calc => calc.GetCalculationName(locationName)).Return(string.Empty).Repeat.AtLeastOnce();
+ var calculationMessageProvider = mockRepository.StrictMock();
+ calculationMessageProvider.Expect(calc => calc.GetActivityName(locationName)).Return(string.Empty);
+ calculationMessageProvider.Expect(calc => calc.GetCalculationName(locationName)).Return(string.Empty).Repeat.AtLeastOnce();
mockRepository.ReplayAll();
string validFilePath = Path.Combine(testDataPath, validFile);
@@ -263,7 +264,7 @@
var activity = new DesignWaterLevelCalculationActivity(hydraulicBoundaryLocation,
validFilePath,
norm,
- calculationMessageProviderMock);
+ calculationMessageProvider);
using (new HydraRingCalculatorFactoryConfig())
{
@@ -288,10 +289,10 @@
const string locationName = "locationName";
const string calculationFailedMessage = "Something went wrong";
- var calculationMessageProviderMock = mockRepository.StrictMock();
- calculationMessageProviderMock.Stub(calc => calc.GetActivityName(locationName)).Return(string.Empty);
- calculationMessageProviderMock.Stub(calc => calc.GetCalculationName(locationName)).Return(string.Empty);
- calculationMessageProviderMock.Stub(calc => calc.GetCalculationFailedMessage(null, null)).IgnoreArguments().Return(calculationFailedMessage);
+ var calculationMessageProvider = mockRepository.Stub();
+ calculationMessageProvider.Stub(calc => calc.GetActivityName(locationName)).Return(string.Empty);
+ calculationMessageProvider.Stub(calc => calc.GetCalculationName(locationName)).Return(string.Empty);
+ calculationMessageProvider.Stub(calc => calc.GetCalculationFailedMessage(null, null)).IgnoreArguments().Return(calculationFailedMessage);
mockRepository.ReplayAll();
var hydraulicBoundaryLocation = new HydraulicBoundaryLocation(0, locationName, 0, 0)
@@ -305,7 +306,7 @@
var activity = new DesignWaterLevelCalculationActivity(hydraulicBoundaryLocation,
validFilePath,
30,
- calculationMessageProviderMock);
+ calculationMessageProvider);
using (new HydraRingCalculatorFactoryConfig())
{
@@ -332,10 +333,10 @@
const string activityName = "getActivityName";
const string calculationNotConvergedMessage = "GetCalculatedNotConvergedMessage";
- var calculationMessageProviderMock = mockRepository.StrictMock();
- calculationMessageProviderMock.Expect(calc => calc.GetActivityName(locationName)).Return(activityName);
- calculationMessageProviderMock.Expect(calc => calc.GetCalculationName(locationName)).Return("GetCalculationName").Repeat.AtLeastOnce();
- calculationMessageProviderMock.Expect(calc => calc.GetCalculatedNotConvergedMessage(locationName)).Return(calculationNotConvergedMessage);
+ var calculationMessageProvider = mockRepository.StrictMock();
+ calculationMessageProvider.Expect(calc => calc.GetActivityName(locationName)).Return(activityName);
+ calculationMessageProvider.Expect(calc => calc.GetCalculationName(locationName)).Return("GetCalculationName").Repeat.AtLeastOnce();
+ calculationMessageProvider.Expect(calc => calc.GetCalculatedNotConvergedMessage(locationName)).Return(calculationNotConvergedMessage);
mockRepository.ReplayAll();
var hydraulicBoundaryLocation = new HydraulicBoundaryLocation(0, locationName, 0, 0)
@@ -350,7 +351,7 @@
var activity = new DesignWaterLevelCalculationActivity(hydraulicBoundaryLocation,
validFilePath,
norm,
- calculationMessageProviderMock);
+ calculationMessageProvider);
using (new HydraRingCalculatorFactoryConfig())
{
@@ -387,12 +388,12 @@
double.NaN, CalculationConvergence.NotCalculated)
};
- var calculationMessageProviderMock = mockRepository.StrictMock();
- calculationMessageProviderMock.Stub(calc => calc.GetActivityName(locationName)).Return(locationName);
- calculationMessageProviderMock.Stub(calc => calc.GetCalculationName(locationName)).Return(locationName);
- calculationMessageProviderMock.Stub(calc => calc.GetCalculationFailedMessage(null, null)).IgnoreArguments().Return(calculationFailedMessage);
- calculationMessageProviderMock.Stub(calc => calc.GetCalculationFailedUnexplainedMessage(locationName)).Return(calculationFailedMessage);
- calculationMessageProviderMock.Stub(calc => calc.GetCalculatedNotConvergedMessage(locationName)).Return(locationName);
+ var calculationMessageProvider = mockRepository.StrictMock();
+ calculationMessageProvider.Stub(calc => calc.GetActivityName(locationName)).Return(locationName);
+ calculationMessageProvider.Stub(calc => calc.GetCalculationName(locationName)).Return(locationName);
+ calculationMessageProvider.Stub(calc => calc.GetCalculationFailedMessage(null, null)).IgnoreArguments().Return(calculationFailedMessage);
+ calculationMessageProvider.Stub(calc => calc.GetCalculationFailedUnexplainedMessage(locationName)).Return(calculationFailedMessage);
+ calculationMessageProvider.Stub(calc => calc.GetCalculatedNotConvergedMessage(locationName)).Return(locationName);
mockRepository.ReplayAll();
string validFilePath = Path.Combine(testDataPath, validFile);
@@ -401,7 +402,7 @@
var activity = new DesignWaterLevelCalculationActivity(hydraulicBoundaryLocation,
validFilePath,
norm,
- calculationMessageProviderMock);
+ calculationMessageProvider);
using (new HydraRingCalculatorFactoryConfig())
{
@@ -417,5 +418,31 @@
}
mockRepository.VerifyAll();
}
+
+ [Test]
+ public void Finish_Always_NotifyHydraulicBoundaryLocation()
+ {
+ // Setup
+ var hydraulicBoundaryLocation = new TestHydraulicBoundaryLocation();
+
+ var calculationMessageProvider = mockRepository.Stub();
+ var observer = mockRepository.StrictMock();
+ observer.Expect(o => o.UpdateObserver());
+ hydraulicBoundaryLocation.Attach(observer);
+ mockRepository.ReplayAll();
+
+ string validFilePath = Path.Combine(testDataPath, validFile);
+ const double norm = 1.0;
+ var activity = new DesignWaterLevelCalculationActivity(hydraulicBoundaryLocation,
+ validFilePath,
+ norm,
+ calculationMessageProvider);
+
+ // Call
+ activity.Finish();
+
+ // Assert
+ mockRepository.VerifyAll();
+ }
}
}
\ No newline at end of file
Index: Ringtoets/Common/test/Ringtoets.Common.Service.Test/WaveHeightCalculationActivityTest.cs
===================================================================
diff -u -rb3b6c13cf736c134476b3db34281332d01ca86b1 -r5fb13b35ed6bba8b867b95826e85dddb064b7036
--- Ringtoets/Common/test/Ringtoets.Common.Service.Test/WaveHeightCalculationActivityTest.cs (.../WaveHeightCalculationActivityTest.cs) (revision b3b6c13cf736c134476b3db34281332d01ca86b1)
+++ Ringtoets/Common/test/Ringtoets.Common.Service.Test/WaveHeightCalculationActivityTest.cs (.../WaveHeightCalculationActivityTest.cs) (revision 5fb13b35ed6bba8b867b95826e85dddb064b7036)
@@ -22,6 +22,7 @@
using System;
using System.IO;
using System.Linq;
+using Core.Common.Base;
using Core.Common.Base.Service;
using Core.Common.TestUtil;
using Core.Common.Utils;
@@ -56,16 +57,16 @@
const string locationName = "locationName";
const string activityName = "GetActivityName";
- var calculationMessageProviderMock = mockRepository.Stub();
- calculationMessageProviderMock.Stub(calc => calc.GetActivityName(locationName)).Return(activityName);
+ var calculationMessageProvider = mockRepository.Stub();
+ calculationMessageProvider.Stub(calc => calc.GetActivityName(locationName)).Return(activityName);
mockRepository.ReplayAll();
var hydraulicBoundaryLocation = new HydraulicBoundaryLocation(0, locationName, 0, 0);
string validFilePath = Path.Combine(testDataPath, validFile);
// Call
- var activity = new WaveHeightCalculationActivity(hydraulicBoundaryLocation, validFilePath, 1, calculationMessageProviderMock);
+ var activity = new WaveHeightCalculationActivity(hydraulicBoundaryLocation, validFilePath, 1, calculationMessageProvider);
// Assert
Assert.IsInstanceOf(activity);
@@ -95,13 +96,13 @@
public void ParameteredConstructor_HydraulicBoundaryLocationNull_ThrowsArgumentNullException()
{
// Setup
- var calculationMessageProviderMock = mockRepository.StrictMock();
+ var calculationMessageProvider = mockRepository.StrictMock();
mockRepository.ReplayAll();
string validFilePath = Path.Combine(testDataPath, validFile);
// Call
- TestDelegate call = () => new WaveHeightCalculationActivity(null, validFilePath, 1, calculationMessageProviderMock);
+ TestDelegate call = () => new WaveHeightCalculationActivity(null, validFilePath, 1, calculationMessageProvider);
// Assert
var exception = Assert.Throws(call);
@@ -118,14 +119,14 @@
const string activityName = "GetActivityName";
const string calculationName = "locationName";
- var calculationMessageProviderMock = mockRepository.StrictMock();
- calculationMessageProviderMock.Stub(calc => calc.GetActivityName(locationName)).Return(activityName);
- calculationMessageProviderMock.Stub(calc => calc.GetCalculationName(locationName)).Return(calculationName).Repeat.AtLeastOnce();
+ var calculationMessageProvider = mockRepository.StrictMock();
+ calculationMessageProvider.Stub(calc => calc.GetActivityName(locationName)).Return(activityName);
+ calculationMessageProvider.Stub(calc => calc.GetCalculationName(locationName)).Return(calculationName).Repeat.AtLeastOnce();
mockRepository.ReplayAll();
var hydraulicBoundaryLocation = new HydraulicBoundaryLocation(1, locationName, 0, 0);
- var activity = new WaveHeightCalculationActivity(hydraulicBoundaryLocation, inValidFilePath, 1, calculationMessageProviderMock);
+ var activity = new WaveHeightCalculationActivity(hydraulicBoundaryLocation, inValidFilePath, 1, calculationMessageProvider);
// Call
Action call = () => activity.Run();
@@ -154,14 +155,14 @@
var hydraulicBoundaryLocation = new HydraulicBoundaryLocation(0, locationName, 0, 0);
- var calculationMessageProviderMock = mockRepository.Stub();
- calculationMessageProviderMock.Stub(calc => calc.GetActivityName(locationName)).Return(activityName);
- calculationMessageProviderMock.Stub(calc => calc.GetCalculationName(locationName)).Return(calculationName);
+ var calculationMessageProvider = mockRepository.Stub();
+ calculationMessageProvider.Stub(calc => calc.GetActivityName(locationName)).Return(activityName);
+ calculationMessageProvider.Stub(calc => calc.GetCalculationName(locationName)).Return(calculationName);
mockRepository.ReplayAll();
var activity = new WaveHeightCalculationActivity(hydraulicBoundaryLocation,
validFilePath,
- norm, calculationMessageProviderMock);
+ norm, calculationMessageProvider);
using (new HydraRingCalculatorFactoryConfig())
{
@@ -201,9 +202,9 @@
const string activityName = "GetActivityName";
const double norm = 1.0 / 30;
- var calculationMessageProviderMock = mockRepository.Stub();
- calculationMessageProviderMock.Stub(calc => calc.GetActivityName(locationName)).Return(activityName);
- calculationMessageProviderMock.Stub(calc => calc.GetCalculationName(locationName)).Return(activityName);
+ var calculationMessageProvider = mockRepository.Stub();
+ calculationMessageProvider.Stub(calc => calc.GetActivityName(locationName)).Return(activityName);
+ calculationMessageProvider.Stub(calc => calc.GetCalculationName(locationName)).Return(activityName);
mockRepository.ReplayAll();
var hydraulicBoundaryLocation = new HydraulicBoundaryLocation(1, locationName, 0, 0)
@@ -216,7 +217,7 @@
var activity = new WaveHeightCalculationActivity(hydraulicBoundaryLocation,
validFilePath,
norm,
- calculationMessageProviderMock);
+ calculationMessageProvider);
// Call
Action call = () => activity.Run();
@@ -233,9 +234,9 @@
// Setup
const string locationName = "locationName";
- var calculationMessageProviderMock = mockRepository.Stub();
- calculationMessageProviderMock.Stub(calc => calc.GetActivityName(locationName)).Return(string.Empty);
- calculationMessageProviderMock.Stub(calc => calc.GetCalculationName(locationName)).Return(string.Empty).Repeat.AtLeastOnce();
+ var calculationMessageProvider = mockRepository.Stub();
+ calculationMessageProvider.Stub(calc => calc.GetActivityName(locationName)).Return(string.Empty);
+ calculationMessageProvider.Stub(calc => calc.GetCalculationName(locationName)).Return(string.Empty).Repeat.AtLeastOnce();
mockRepository.ReplayAll();
var hydraulicBoundaryLocation = new HydraulicBoundaryLocation(1, locationName, 0, 0);
@@ -248,7 +249,7 @@
var activity = new WaveHeightCalculationActivity(hydraulicBoundaryLocation,
validFilePath,
norm,
- calculationMessageProviderMock);
+ calculationMessageProvider);
using (new HydraRingCalculatorFactoryConfig())
{
@@ -273,10 +274,10 @@
const string locationName = "locationName";
const string calculationFailedMessage = "Something went wrong";
- var calculationMessageProviderMock = mockRepository.Stub();
- calculationMessageProviderMock.Stub(calc => calc.GetActivityName(locationName)).Return(string.Empty);
- calculationMessageProviderMock.Stub(calc => calc.GetCalculationName(locationName)).Return(string.Empty);
- calculationMessageProviderMock.Stub(calc => calc.GetCalculationFailedMessage(null, null)).IgnoreArguments().Return(calculationFailedMessage);
+ var calculationMessageProvider = mockRepository.Stub();
+ calculationMessageProvider.Stub(calc => calc.GetActivityName(locationName)).Return(string.Empty);
+ calculationMessageProvider.Stub(calc => calc.GetCalculationName(locationName)).Return(string.Empty);
+ calculationMessageProvider.Stub(calc => calc.GetCalculationFailedMessage(null, null)).IgnoreArguments().Return(calculationFailedMessage);
mockRepository.ReplayAll();
var hydraulicBoundaryLocation = new HydraulicBoundaryLocation(1, locationName, 0, 0)
@@ -291,7 +292,7 @@
var activity = new WaveHeightCalculationActivity(hydraulicBoundaryLocation,
validFilePath,
30,
- calculationMessageProviderMock);
+ calculationMessageProvider);
using (new HydraRingCalculatorFactoryConfig())
{
@@ -318,10 +319,10 @@
const string activityName = "getActivityName";
const string calculationNotConvergedMessage = "GetCalculatedNotConvergedMessage";
- var calculationMessageProviderMock = mockRepository.Stub();
- calculationMessageProviderMock.Stub(calc => calc.GetActivityName(locationName)).Return(activityName);
- calculationMessageProviderMock.Stub(calc => calc.GetCalculationName(locationName)).Return("GetCalculationName").Repeat.AtLeastOnce();
- calculationMessageProviderMock.Stub(calc => calc.GetCalculatedNotConvergedMessage(locationName)).Return(calculationNotConvergedMessage);
+ var calculationMessageProvider = mockRepository.Stub();
+ calculationMessageProvider.Stub(calc => calc.GetActivityName(locationName)).Return(activityName);
+ calculationMessageProvider.Stub(calc => calc.GetCalculationName(locationName)).Return("GetCalculationName").Repeat.AtLeastOnce();
+ calculationMessageProvider.Stub(calc => calc.GetCalculatedNotConvergedMessage(locationName)).Return(calculationNotConvergedMessage);
mockRepository.ReplayAll();
var hydraulicBoundaryLocation = new HydraulicBoundaryLocation(1, locationName, 0, 0)
@@ -335,7 +336,7 @@
const double norm = 1.0 / 300;
var activity = new WaveHeightCalculationActivity(hydraulicBoundaryLocation,
validFilePath,
- norm, calculationMessageProviderMock);
+ norm, calculationMessageProvider);
using (new HydraRingCalculatorFactoryConfig())
{
@@ -373,12 +374,12 @@
double.NaN, CalculationConvergence.NotCalculated)
};
- var calculationMessageProviderMock = mockRepository.StrictMock();
- calculationMessageProviderMock.Stub(calc => calc.GetActivityName(locationName)).Return(locationName);
- calculationMessageProviderMock.Stub(calc => calc.GetCalculationName(locationName)).Return(locationName);
- calculationMessageProviderMock.Stub(calc => calc.GetCalculationFailedMessage(null, null)).IgnoreArguments().Return(calculationFailedMessage);
- calculationMessageProviderMock.Stub(calc => calc.GetCalculationFailedUnexplainedMessage(locationName)).Return(calculationFailedMessage);
- calculationMessageProviderMock.Stub(calc => calc.GetCalculatedNotConvergedMessage(locationName)).Return(locationName);
+ var calculationMessageProvider = mockRepository.StrictMock();
+ calculationMessageProvider.Stub(calc => calc.GetActivityName(locationName)).Return(locationName);
+ calculationMessageProvider.Stub(calc => calc.GetCalculationName(locationName)).Return(locationName);
+ calculationMessageProvider.Stub(calc => calc.GetCalculationFailedMessage(null, null)).IgnoreArguments().Return(calculationFailedMessage);
+ calculationMessageProvider.Stub(calc => calc.GetCalculationFailedUnexplainedMessage(locationName)).Return(calculationFailedMessage);
+ calculationMessageProvider.Stub(calc => calc.GetCalculatedNotConvergedMessage(locationName)).Return(locationName);
mockRepository.ReplayAll();
string validFilePath = Path.Combine(testDataPath, validFile);
@@ -387,7 +388,7 @@
var activity = new WaveHeightCalculationActivity(hydraulicBoundaryLocation,
validFilePath,
norm,
- calculationMessageProviderMock);
+ calculationMessageProvider);
using (new HydraRingCalculatorFactoryConfig())
{
@@ -403,5 +404,31 @@
}
mockRepository.VerifyAll();
}
+
+ [Test]
+ public void Finish_Always_NotifyHydraulicBoundaryLocation()
+ {
+ // Setup
+ var hydraulicBoundaryLocation = new TestHydraulicBoundaryLocation();
+
+ var calculationMessageProvider = mockRepository.Stub();
+ var observer = mockRepository.StrictMock();
+ observer.Expect(o => o.UpdateObserver());
+ hydraulicBoundaryLocation.Attach(observer);
+ mockRepository.ReplayAll();
+
+ string validFilePath = Path.Combine(testDataPath, validFile);
+ const double norm = 1.0;
+ var activity = new WaveHeightCalculationActivity(hydraulicBoundaryLocation,
+ validFilePath,
+ norm,
+ calculationMessageProvider);
+
+ // Call
+ activity.Finish();
+
+ // Assert
+ mockRepository.VerifyAll();
+ }
}
}
\ No newline at end of file
Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ViewInfos/WaveConditionsInputViewInfoTest.cs
===================================================================
diff -u -r4a9779426ab93aa90af783bf4d4f00aed2b32ce5 -r5fb13b35ed6bba8b867b95826e85dddb064b7036
--- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ViewInfos/WaveConditionsInputViewInfoTest.cs (.../WaveConditionsInputViewInfoTest.cs) (revision 4a9779426ab93aa90af783bf4d4f00aed2b32ce5)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ViewInfos/WaveConditionsInputViewInfoTest.cs (.../WaveConditionsInputViewInfoTest.cs) (revision 5fb13b35ed6bba8b867b95826e85dddb064b7036)
@@ -445,19 +445,19 @@
var designWaterLevelChartData = (ChartLineData) chartData.Collection.ElementAt(designWaterLevelChartDataIndex);
Assert.AreEqual(revetmentLineColor, revetmentChartData.Style.Color);
- Assert.AreEqual(revetmentLineColor, revetmentBaseChartData.Style.Color);
+ Assert.AreEqual(Color.FromArgb(120, revetmentLineColor), revetmentBaseChartData.Style.Color);
Assert.AreEqual(revetmentLineColor, lowerBoundaryRevetmentChartData.Style.Color);
Assert.AreEqual(revetmentLineColor, upperBoundaryRevetmentChartData.Style.Color);
Assert.AreEqual(designWaterLevelName, designWaterLevelChartData.Name);
}
#region TestCaseData
- private const int revetmentBaseChartDataIndex = 1;
- private const int revetmentChartDataIndex = 2;
- private const int lowerBoundaryRevetmentChartDataIndex = 3;
- private const int upperBoundaryRevetmentChartDataIndex = 4;
- private const int designWaterLevelChartDataIndex = 8;
+ private const int lowerBoundaryRevetmentChartDataIndex = 1;
+ private const int upperBoundaryRevetmentChartDataIndex = 2;
+ private const int designWaterLevelChartDataIndex = 5;
+ private const int revetmentBaseChartDataIndex = 7;
+ private const int revetmentChartDataIndex = 8;
private static IEnumerable GetInputContextDatas()
{
Index: Ringtoets/Revetment/src/Ringtoets.Revetment.Forms/Factories/WaveConditionsChartDataFactory.cs
===================================================================
diff -u -rb28507193a2799b3e4a4e5e447693e17e1e121b5 -r5fb13b35ed6bba8b867b95826e85dddb064b7036
--- Ringtoets/Revetment/src/Ringtoets.Revetment.Forms/Factories/WaveConditionsChartDataFactory.cs (.../WaveConditionsChartDataFactory.cs) (revision b28507193a2799b3e4a4e5e447693e17e1e121b5)
+++ Ringtoets/Revetment/src/Ringtoets.Revetment.Forms/Factories/WaveConditionsChartDataFactory.cs (.../WaveConditionsChartDataFactory.cs) (revision 5fb13b35ed6bba8b867b95826e85dddb064b7036)
@@ -37,6 +37,9 @@
///
internal static class WaveConditionsChartDataFactory
{
+ private const int revetmentThickness = 8;
+ private const int levelThickness = 3;
+
///
/// Create with default styling for lower boundary revetment.
///
@@ -72,7 +75,7 @@
{
return new ChartLineData(Resources.WaveConditionsChartDataFactory_Revetment_DisplayName)
{
- Style = GetRevetmentBoundaryStyle(lineColor)
+ Style = new ChartLineStyle(lineColor, revetmentThickness, DashStyle.Solid)
};
}
@@ -85,7 +88,7 @@
{
return new ChartLineData(Resources.WaveConditionsChartDataFactory_RevetmentBase_DisplayName)
{
- Style = new ChartLineStyle(lineColor, 2, DashStyle.Dash)
+ Style = new ChartLineStyle(Color.FromArgb(120, lineColor), revetmentThickness, DashStyle.Dash)
};
}
@@ -129,7 +132,7 @@
return new ChartLineData(chartDataName)
{
- Style = new ChartLineStyle(Color.Red, 2, DashStyle.Solid)
+ Style = new ChartLineStyle(Color.LightCoral, levelThickness, DashStyle.Solid)
};
}
@@ -141,7 +144,7 @@
{
return new ChartMultipleLineData(Resources.WaveConditionsChartDataFactory_WaterLevels_DisplayName)
{
- Style = new ChartLineStyle(Color.Blue, 2, DashStyle.Dash)
+ Style = new ChartLineStyle(Color.DarkTurquoise, levelThickness, new [] { 6.0, 6.0 })
};
}
@@ -168,12 +171,12 @@
private static ChartLineStyle GetRevetmentBoundaryStyle(Color lineColor)
{
- return new ChartLineStyle(lineColor, 2, DashStyle.Solid);
+ return new ChartLineStyle(lineColor, levelThickness, DashStyle.Solid);
}
private static ChartLineStyle GetWaterLevelsBoundaryStyle()
{
- return new ChartLineStyle(Color.Blue, 2, DashStyle.Solid);
+ return new ChartLineStyle(Color.MediumBlue, levelThickness, DashStyle.Solid);
}
}
}
\ No newline at end of file
Index: Ringtoets/Revetment/src/Ringtoets.Revetment.Forms/Properties/Resources.Designer.cs
===================================================================
diff -u -r0d801cdc13ca99d460fe072efdcd962654bc9c34 -r5fb13b35ed6bba8b867b95826e85dddb064b7036
--- Ringtoets/Revetment/src/Ringtoets.Revetment.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 0d801cdc13ca99d460fe072efdcd962654bc9c34)
+++ Ringtoets/Revetment/src/Ringtoets.Revetment.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 5fb13b35ed6bba8b867b95826e85dddb064b7036)
@@ -208,7 +208,7 @@
}
///
- /// Looks up a localized string similar to Waterstanden.
+ /// Looks up a localized string similar to Waterstanden in berekening.
///
public static string WaveConditionsChartDataFactory_WaterLevels_DisplayName {
get {
Index: Ringtoets/Revetment/src/Ringtoets.Revetment.Forms/Properties/Resources.resx
===================================================================
diff -u -r0d801cdc13ca99d460fe072efdcd962654bc9c34 -r5fb13b35ed6bba8b867b95826e85dddb064b7036
--- Ringtoets/Revetment/src/Ringtoets.Revetment.Forms/Properties/Resources.resx (.../Resources.resx) (revision 0d801cdc13ca99d460fe072efdcd962654bc9c34)
+++ Ringtoets/Revetment/src/Ringtoets.Revetment.Forms/Properties/Resources.resx (.../Resources.resx) (revision 5fb13b35ed6bba8b867b95826e85dddb064b7036)
@@ -265,7 +265,7 @@
Bovengrens waterstanden
- Waterstanden
+ Waterstanden in berekening
Hulplijn bekleding
Index: Ringtoets/Revetment/src/Ringtoets.Revetment.Forms/Views/WaveConditionsInputView.cs
===================================================================
diff -u -r0d801cdc13ca99d460fe072efdcd962654bc9c34 -r5fb13b35ed6bba8b867b95826e85dddb064b7036
--- Ringtoets/Revetment/src/Ringtoets.Revetment.Forms/Views/WaveConditionsInputView.cs (.../WaveConditionsInputView.cs) (revision 0d801cdc13ca99d460fe072efdcd962654bc9c34)
+++ Ringtoets/Revetment/src/Ringtoets.Revetment.Forms/Views/WaveConditionsInputView.cs (.../WaveConditionsInputView.cs) (revision 5fb13b35ed6bba8b867b95826e85dddb064b7036)
@@ -39,6 +39,7 @@
{
private readonly Observer calculationObserver;
private readonly Observer calculationInputObserver;
+ private readonly Observer hydraulicBoundaryLocationObserver;
private readonly ChartDataCollection chartDataCollection;
private readonly ChartLineData foreshoreChartData;
@@ -70,30 +71,37 @@
InitializeComponent();
calculationObserver = new Observer(UpdateChartTitle);
- calculationInputObserver = new Observer(UpdateChartData);
+ calculationInputObserver = new Observer(UpdateCalculationInput);
+ hydraulicBoundaryLocationObserver = new Observer(UpdateChartData);
chartDataCollection = new ChartDataCollection(RingtoetsCommonFormsResources.Calculation_Input);
foreshoreChartData = RingtoetsChartDataFactory.CreateForeshoreGeometryChartData();
lowerBoundaryRevetmentChartData = WaveConditionsChartDataFactory.CreateLowerRevetmentBoundaryChartData(inputViewStyle.RevetmentLineColor);
upperBoundaryRevetmentChartData = WaveConditionsChartDataFactory.CreateUpperRevetmentBoundaryChartData(inputViewStyle.RevetmentLineColor);
- revetmentChartData = WaveConditionsChartDataFactory.CreateRevetmentChartData(inputViewStyle.RevetmentLineColor);
- revetmentBaseChartData = WaveConditionsChartDataFactory.CreateRevetmentBaseChartData(inputViewStyle.RevetmentLineColor);
lowerBoundaryWaterLevelsChartData = WaveConditionsChartDataFactory.CreateLowerWaterLevelsBoundaryChartData();
upperBoundaryWaterLevelsChartData = WaveConditionsChartDataFactory.CreateUpperWaterLevelsBoundaryChartData();
designWaterLevelChartData = WaveConditionsChartDataFactory.CreateDesignWaterLevelChartData(inputViewStyle.DesignWaterLevelName);
waterLevelsChartData = WaveConditionsChartDataFactory.CreateWaterLevelsChartData();
+ revetmentBaseChartData = WaveConditionsChartDataFactory.CreateRevetmentBaseChartData(inputViewStyle.RevetmentLineColor);
+ revetmentChartData = WaveConditionsChartDataFactory.CreateRevetmentChartData(inputViewStyle.RevetmentLineColor);
chartDataCollection.Add(foreshoreChartData);
- chartDataCollection.Add(revetmentBaseChartData);
- chartDataCollection.Add(revetmentChartData);
chartDataCollection.Add(lowerBoundaryRevetmentChartData);
chartDataCollection.Add(upperBoundaryRevetmentChartData);
- chartDataCollection.Add(waterLevelsChartData);
chartDataCollection.Add(lowerBoundaryWaterLevelsChartData);
chartDataCollection.Add(upperBoundaryWaterLevelsChartData);
chartDataCollection.Add(designWaterLevelChartData);
+ chartDataCollection.Add(waterLevelsChartData);
+ chartDataCollection.Add(revetmentBaseChartData);
+ chartDataCollection.Add(revetmentChartData);
}
+ private void UpdateCalculationInput()
+ {
+ hydraulicBoundaryLocationObserver.Observable = data?.InputParameters.HydraulicBoundaryLocation;
+ UpdateChartData();
+ }
+
public object Data
{
get
@@ -106,6 +114,7 @@
calculationObserver.Observable = data;
calculationInputObserver.Observable = data?.InputParameters;
+ hydraulicBoundaryLocationObserver.Observable = data?.InputParameters.HydraulicBoundaryLocation;
if (data == null)
{
@@ -134,6 +143,7 @@
{
calculationObserver.Dispose();
calculationInputObserver.Dispose();
+ hydraulicBoundaryLocationObserver.Dispose();
if (disposing)
{
Index: Ringtoets/Revetment/test/Ringtoets.Revetment.Forms.Test/Factories/WaveConditionsChartDataFactoryTest.cs
===================================================================
diff -u -r0d801cdc13ca99d460fe072efdcd962654bc9c34 -r5fb13b35ed6bba8b867b95826e85dddb064b7036
--- Ringtoets/Revetment/test/Ringtoets.Revetment.Forms.Test/Factories/WaveConditionsChartDataFactoryTest.cs (.../WaveConditionsChartDataFactoryTest.cs) (revision 0d801cdc13ca99d460fe072efdcd962654bc9c34)
+++ Ringtoets/Revetment/test/Ringtoets.Revetment.Forms.Test/Factories/WaveConditionsChartDataFactoryTest.cs (.../WaveConditionsChartDataFactoryTest.cs) (revision 5fb13b35ed6bba8b867b95826e85dddb064b7036)
@@ -46,7 +46,7 @@
// Assert
Assert.IsEmpty(data.Points);
Assert.AreEqual("Ondergrens bekleding", data.Name);
- AssertEqualStyle(data.Style, lineColor, 2, DashStyle.Solid);
+ AssertEqualStyle(data.Style, lineColor, 3, DashStyle.Solid);
}
[Test]
@@ -61,7 +61,7 @@
// Assert
Assert.IsEmpty(data.Points);
Assert.AreEqual("Bovengrens bekleding", data.Name);
- AssertEqualStyle(data.Style, lineColor, 2, DashStyle.Solid);
+ AssertEqualStyle(data.Style, lineColor, 3, DashStyle.Solid);
}
[Test]
@@ -76,22 +76,22 @@
// Assert
Assert.IsEmpty(data.Points);
Assert.AreEqual("Bekleding", data.Name);
- AssertEqualStyle(data.Style, lineColor, 2, DashStyle.Solid);
+ AssertEqualStyle(data.Style, lineColor, 8, DashStyle.Solid);
}
[Test]
public void CreateRevetmentBaseChartData_ReturnsEmptyChartLineDataWithDefaultStyling()
{
// Setup
- Color lineColor = Color.Gray;
+ Color lineColor = Color.FromArgb(120, Color.Gray);
// Call
ChartLineData data = WaveConditionsChartDataFactory.CreateRevetmentBaseChartData(lineColor);
// Assert
Assert.IsEmpty(data.Points);
Assert.AreEqual("Hulplijn bekleding", data.Name);
- AssertEqualStyle(data.Style, lineColor, 2, DashStyle.Dash);
+ AssertEqualStyle(data.Style, lineColor, 8, DashStyle.Dash);
}
[Test]
@@ -103,7 +103,7 @@
// Assert
Assert.IsEmpty(data.Points);
Assert.AreEqual("Ondergrens waterstanden", data.Name);
- AssertEqualStyle(data.Style, Color.Blue, 2, DashStyle.Solid);
+ AssertEqualStyle(data.Style, Color.MediumBlue, 3, DashStyle.Solid);
}
[Test]
@@ -115,7 +115,7 @@
// Assert
Assert.IsEmpty(data.Points);
Assert.AreEqual("Bovengrens waterstanden", data.Name);
- AssertEqualStyle(data.Style, Color.Blue, 2, DashStyle.Solid);
+ AssertEqualStyle(data.Style, Color.MediumBlue, 3, DashStyle.Solid);
}
[Test]
@@ -141,7 +141,7 @@
// Assert
Assert.IsEmpty(data.Points);
Assert.AreEqual(designWaterLevelName, data.Name);
- AssertEqualStyle(data.Style, Color.Red, 2, DashStyle.Solid);
+ AssertEqualStyle(data.Style, Color.LightCoral, 3, DashStyle.Solid);
}
[Test]
@@ -152,8 +152,8 @@
// Assert
Assert.IsEmpty(data.Lines);
- Assert.AreEqual("Waterstanden", data.Name);
- AssertEqualStyle(data.Style, Color.Blue, 2, DashStyle.Dash);
+ Assert.AreEqual("Waterstanden in berekening", data.Name);
+ AssertEqualStyle(data.Style, Color.DarkTurquoise, 3, new []{ 6.0, 6.0 });
}
[Test]
@@ -229,5 +229,12 @@
Assert.AreEqual(width, lineStyle.Width);
Assert.AreEqual(style, lineStyle.Style);
}
+
+ private static void AssertEqualStyle(ChartLineStyle lineStyle, Color color, int width, double[] style)
+ {
+ Assert.AreEqual(color, lineStyle.Color);
+ Assert.AreEqual(width, lineStyle.Width);
+ Assert.AreEqual(style, lineStyle.Dashes);
+ }
}
}
\ No newline at end of file
Index: Ringtoets/Revetment/test/Ringtoets.Revetment.Forms.Test/Views/WaveConditionsInputViewTest.cs
===================================================================
diff -u -r0d801cdc13ca99d460fe072efdcd962654bc9c34 -r5fb13b35ed6bba8b867b95826e85dddb064b7036
--- Ringtoets/Revetment/test/Ringtoets.Revetment.Forms.Test/Views/WaveConditionsInputViewTest.cs (.../WaveConditionsInputViewTest.cs) (revision 0d801cdc13ca99d460fe072efdcd962654bc9c34)
+++ Ringtoets/Revetment/test/Ringtoets.Revetment.Forms.Test/Views/WaveConditionsInputViewTest.cs (.../WaveConditionsInputViewTest.cs) (revision 5fb13b35ed6bba8b867b95826e85dddb064b7036)
@@ -31,7 +31,9 @@
using NUnit.Framework;
using Rhino.Mocks;
using Ringtoets.Common.Data.DikeProfiles;
+using Ringtoets.Common.Data.Hydraulics;
using Ringtoets.Common.Data.TestUtil;
+using Ringtoets.Common.Forms.Views;
using Ringtoets.Revetment.Forms.TestUtil;
using Ringtoets.Revetment.Forms.Views;
using Ringtoets.Revetment.TestUtil;
@@ -44,14 +46,14 @@
private const int numberOfChartDataLayers = 9;
private const int foreShoreChartDataIndex = 0;
- private const int revetmentBaseChartDataIndex = 1;
- private const int revetmentChartDataIndex = 2;
- private const int lowerBoundaryRevetmentChartDataIndex = 3;
- private const int upperBoundaryRevetmentChartDataIndex = 4;
- private const int waterLevelsChartDataIndex = 5;
- private const int lowerBoundaryWaterLevelsChartDataIndex = 6;
- private const int upperBoundaryWaterLevelsChartDataIndex = 7;
- private const int designWaterLevelChartDataIndex = 8;
+ private const int lowerBoundaryRevetmentChartDataIndex = 1;
+ private const int upperBoundaryRevetmentChartDataIndex = 2;
+ private const int lowerBoundaryWaterLevelsChartDataIndex = 3;
+ private const int upperBoundaryWaterLevelsChartDataIndex = 4;
+ private const int designWaterLevelChartDataIndex = 5;
+ private const int waterLevelsChartDataIndex = 6;
+ private const int revetmentBaseChartDataIndex = 7;
+ private const int revetmentChartDataIndex = 8;
[Test]
public void Constructor_WaveConditionsInputViewStyleNull_ThrowArgumentNullException()
@@ -400,6 +402,105 @@
}
[Test]
+ public void UpdateObserver_WaterLevelUpdated_ChartDataUpdatedAndObserversNotified()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var observer = mocks.StrictMock();
+ observer.Expect(o => o.UpdateObserver()).Repeat.Times(numberOfChartDataLayers);
+ mocks.ReplayAll();
+
+ HydraulicBoundaryLocation testHydraulicBoundaryLocation = new TestHydraulicBoundaryLocation();
+ var profile = new TestForeshoreProfile(new[]
+ {
+ new Point2D(0.0, 0.0),
+ new Point2D(1.0, 1.0),
+ new Point2D(2.0, 2.0)
+ });
+ var calculation = new TestWaveConditionsCalculation
+ {
+ InputParameters =
+ {
+ ForeshoreProfile = profile,
+ LowerBoundaryRevetment = (RoundedDouble) 5,
+ UpperBoundaryRevetment = (RoundedDouble) 8,
+ LowerBoundaryWaterLevels = (RoundedDouble) 3,
+ UpperBoundaryWaterLevels = (RoundedDouble) 7,
+ HydraulicBoundaryLocation = testHydraulicBoundaryLocation
+ }
+ };
+
+ using (var view = new WaveConditionsInputView(new TestWaveConditionsInputViewStyle())
+ {
+ Data = calculation
+ })
+ {
+ var foreshoreChartData = (ChartLineData) view.Chart.Data.Collection.ElementAt(foreShoreChartDataIndex);
+ var revetmentChartData = (ChartLineData) view.Chart.Data.Collection.ElementAt(revetmentChartDataIndex);
+ var revetmentBaseChartData = (ChartLineData) view.Chart.Data.Collection.ElementAt(revetmentBaseChartDataIndex);
+ var lowerBoundaryRevetmentChartData = (ChartLineData) view.Chart.Data.Collection.ElementAt(lowerBoundaryRevetmentChartDataIndex);
+ var upperBoundaryRevetmentChartData = (ChartLineData) view.Chart.Data.Collection.ElementAt(upperBoundaryRevetmentChartDataIndex);
+ var lowerBoundaryWaterLevelsChartData = (ChartLineData) view.Chart.Data.Collection.ElementAt(lowerBoundaryWaterLevelsChartDataIndex);
+ var upperBoundaryWaterLevelsChartData = (ChartLineData) view.Chart.Data.Collection.ElementAt(upperBoundaryWaterLevelsChartDataIndex);
+ var designWaterLevelChartData = (ChartLineData) view.Chart.Data.Collection.ElementAt(designWaterLevelChartDataIndex);
+ var waterLevelsChartData = (ChartMultipleLineData) view.Chart.Data.Collection.ElementAt(waterLevelsChartDataIndex);
+
+ foreshoreChartData.Attach(observer);
+ revetmentChartData.Attach(observer);
+ revetmentBaseChartData.Attach(observer);
+ lowerBoundaryRevetmentChartData.Attach(observer);
+ upperBoundaryRevetmentChartData.Attach(observer);
+ lowerBoundaryWaterLevelsChartData.Attach(observer);
+ upperBoundaryWaterLevelsChartData.Attach(observer);
+ designWaterLevelChartData.Attach(observer);
+ waterLevelsChartData.Attach(observer);
+
+ var expectedWaterLevel = 6.0;
+ testHydraulicBoundaryLocation.DesignWaterLevelOutput = new TestHydraulicBoundaryLocationOutput(expectedWaterLevel, CalculationConvergence.CalculatedConverged);
+
+ // Call
+ calculation.InputParameters.HydraulicBoundaryLocation.NotifyObservers();
+
+ // Assert
+ Assert.AreSame(foreshoreChartData, (ChartLineData) view.Chart.Data.Collection.ElementAt(foreShoreChartDataIndex));
+ Assert.AreSame(revetmentChartData, (ChartLineData) view.Chart.Data.Collection.ElementAt(revetmentChartDataIndex));
+ Assert.AreSame(revetmentBaseChartData, (ChartLineData) view.Chart.Data.Collection.ElementAt(revetmentBaseChartDataIndex));
+ Assert.AreSame(lowerBoundaryRevetmentChartData, (ChartLineData) view.Chart.Data.Collection.ElementAt(lowerBoundaryRevetmentChartDataIndex));
+ Assert.AreSame(upperBoundaryRevetmentChartData, (ChartLineData) view.Chart.Data.Collection.ElementAt(upperBoundaryRevetmentChartDataIndex));
+ Assert.AreSame(lowerBoundaryWaterLevelsChartData, (ChartLineData) view.Chart.Data.Collection.ElementAt(lowerBoundaryWaterLevelsChartDataIndex));
+ Assert.AreSame(upperBoundaryWaterLevelsChartData, (ChartLineData) view.Chart.Data.Collection.ElementAt(upperBoundaryWaterLevelsChartDataIndex));
+ Assert.AreSame(designWaterLevelChartData, (ChartLineData) view.Chart.Data.Collection.ElementAt(designWaterLevelChartDataIndex));
+ Assert.AreSame(waterLevelsChartData, (ChartMultipleLineData) view.Chart.Data.Collection.ElementAt(waterLevelsChartDataIndex));
+
+ AssertForeshoreChartData(profile, foreshoreChartData);
+ AssertRevetmentChartData(profile.Geometry.Last(), calculation.InputParameters.LowerBoundaryRevetment,
+ calculation.InputParameters.UpperBoundaryRevetment, revetmentChartData);
+ AssertRevetmentBaseChartData(profile.Geometry.Last(),
+ calculation.InputParameters.LowerBoundaryRevetment,
+ calculation.InputParameters.LowerBoundaryWaterLevels,
+ revetmentBaseChartData);
+
+ AssertChartData(calculation.InputParameters.ForeshoreGeometry, calculation.InputParameters.LowerBoundaryRevetment,
+ lowerBoundaryRevetmentChartData, "Ondergrens bekleding");
+ AssertChartData(calculation.InputParameters.ForeshoreGeometry, calculation.InputParameters.UpperBoundaryRevetment,
+ upperBoundaryRevetmentChartData, "Bovengrens bekleding");
+
+ AssertChartData(calculation.InputParameters.ForeshoreGeometry, calculation.InputParameters.LowerBoundaryWaterLevels,
+ lowerBoundaryWaterLevelsChartData, "Ondergrens waterstanden");
+ AssertChartData(calculation.InputParameters.ForeshoreGeometry, calculation.InputParameters.UpperBoundaryWaterLevels,
+ upperBoundaryWaterLevelsChartData, "Bovengrens waterstanden");
+
+ AssertChartData(calculation.InputParameters.ForeshoreGeometry, expectedWaterLevel,
+ designWaterLevelChartData, "Toetspeil");
+
+ AssertWaterLevelsChartData(calculation.InputParameters.ForeshoreGeometry,
+ calculation.InputParameters.WaterLevels,
+ waterLevelsChartData);
+ }
+ mocks.VerifyAll();
+ }
+
+ [Test]
public void UpdateObserver_OtherCalculationUpdated_ChartDataNotUpdated()
{
// Setup
@@ -445,32 +546,32 @@
var foreshoreData = (ChartLineData) chartDatasList[foreShoreChartDataIndex];
var lowerBoundaryRevetmentData = (ChartLineData) chartDatasList[lowerBoundaryRevetmentChartDataIndex];
var upperBoundaryRevetmentData = (ChartLineData) chartDatasList[upperBoundaryRevetmentChartDataIndex];
- var revetmentData = (ChartLineData) chartDatasList[revetmentChartDataIndex];
- var revetmentBaseData = (ChartLineData) chartDatasList[revetmentBaseChartDataIndex];
var lowerBoundaryWaterLevelsData = (ChartLineData) chartDatasList[lowerBoundaryWaterLevelsChartDataIndex];
var upperBoundaryWaterLevelsData = (ChartLineData) chartDatasList[upperBoundaryWaterLevelsChartDataIndex];
var designWaterLevelData = (ChartLineData) chartDatasList[designWaterLevelChartDataIndex];
var waterLevelsData = (ChartMultipleLineData) chartDatasList[waterLevelsChartDataIndex];
+ var revetmentData = (ChartLineData) chartDatasList[revetmentChartDataIndex];
+ var revetmentBaseData = (ChartLineData) chartDatasList[revetmentBaseChartDataIndex];
CollectionAssert.IsEmpty(foreshoreData.Points);
CollectionAssert.IsEmpty(lowerBoundaryRevetmentData.Points);
CollectionAssert.IsEmpty(upperBoundaryRevetmentData.Points);
- CollectionAssert.IsEmpty(revetmentData.Points);
- CollectionAssert.IsEmpty(revetmentBaseData.Points);
CollectionAssert.IsEmpty(lowerBoundaryWaterLevelsData.Points);
CollectionAssert.IsEmpty(upperBoundaryWaterLevelsData.Points);
CollectionAssert.IsEmpty(designWaterLevelData.Points);
CollectionAssert.IsEmpty(waterLevelsData.Lines);
+ CollectionAssert.IsEmpty(revetmentData.Points);
+ CollectionAssert.IsEmpty(revetmentBaseData.Points);
Assert.AreEqual("Voorlandprofiel", foreshoreData.Name);
Assert.AreEqual("Ondergrens bekleding", lowerBoundaryRevetmentData.Name);
Assert.AreEqual("Bovengrens bekleding", upperBoundaryRevetmentData.Name);
- Assert.AreEqual("Bekleding", revetmentData.Name);
- Assert.AreEqual("Hulplijn bekleding", revetmentBaseData.Name);
Assert.AreEqual("Ondergrens waterstanden", lowerBoundaryWaterLevelsData.Name);
Assert.AreEqual("Bovengrens waterstanden", upperBoundaryWaterLevelsData.Name);
Assert.AreEqual("Toetspeil", designWaterLevelData.Name);
- Assert.AreEqual("Waterstanden", waterLevelsData.Name);
+ Assert.AreEqual("Waterstanden in berekening", waterLevelsData.Name);
+ Assert.AreEqual("Bekleding", revetmentData.Name);
+ Assert.AreEqual("Hulplijn bekleding", revetmentBaseData.Name);
}
private static void AssertForeshoreChartData(ForeshoreProfile foreshoreProfile, ChartData chartData)
@@ -565,7 +666,7 @@
CollectionAssert.AreEqual(expectedGeometry, chartLineData.Lines);
- Assert.AreEqual("Waterstanden", chartLineData.Name);
+ Assert.AreEqual("Waterstanden in berekening", chartLineData.Name);
}
private static double GetPointX(double pointY, Point2D lastForeshorePoint)