Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Ringtoets.Integration.Forms.csproj =================================================================== diff -u -r57910b84a73a0bd6745e2adc4739971d3d6a9a21 -r58f11f214e2faa310cf964e68cd1778673fb4b63 --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Ringtoets.Integration.Forms.csproj (.../Ringtoets.Integration.Forms.csproj) (revision 57910b84a73a0bd6745e2adc4739971d3d6a9a21) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Ringtoets.Integration.Forms.csproj (.../Ringtoets.Integration.Forms.csproj) (revision 58f11f214e2faa310cf964e68cd1778673fb4b63) @@ -13,9 +13,11 @@ + + @@ -108,6 +110,12 @@ AssemblyResultCategoriesView.cs + + UserControl + + + AssemblyResultPerSectionMapView.cs + UserControl @@ -351,6 +359,9 @@ AssemblyResultCategoriesView.cs + + AssemblyResultPerSectionMapView.cs + AssemblyResultPerSectionView.cs Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/AssemblyResultPerSectionMapView.Designer.cs =================================================================== diff -u --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/AssemblyResultPerSectionMapView.Designer.cs (revision 0) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/AssemblyResultPerSectionMapView.Designer.cs (revision 58f11f214e2faa310cf964e68cd1778673fb4b63) @@ -0,0 +1,77 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +namespace Ringtoets.Integration.Forms.Views +{ + partial class AssemblyResultPerSectionMapView + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.ringtoetsMapControl = new Ringtoets.Common.Forms.Views.RingtoetsMapControl(); + this.SuspendLayout(); + // + // ringtoetsMapControl1 + // + this.ringtoetsMapControl.Dock = System.Windows.Forms.DockStyle.Fill; + this.ringtoetsMapControl.Location = new System.Drawing.Point(0, 0); + this.ringtoetsMapControl.Name = "ringtoetsMapControl"; + this.ringtoetsMapControl.Size = new System.Drawing.Size(150, 150); + this.ringtoetsMapControl.TabIndex = 0; + // + // AssemblyResultPerSectionMapView + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.ringtoetsMapControl); + this.Name = "AssemblyResultPerSectionMapView"; + this.ResumeLayout(false); + + } + + #endregion + + private Common.Forms.Views.RingtoetsMapControl ringtoetsMapControl; + } +} Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/AssemblyResultPerSectionMapView.cs =================================================================== diff -u --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/AssemblyResultPerSectionMapView.cs (revision 0) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/AssemblyResultPerSectionMapView.cs (revision 58f11f214e2faa310cf964e68cd1778673fb4b63) @@ -0,0 +1,130 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Windows.Forms; +using Core.Components.Gis.Data; +using Core.Components.Gis.Forms; +using Core.Components.Gis.Style; +using Ringtoets.Common.Forms.Factories; +using Ringtoets.Integration.Data; + +namespace Ringtoets.Integration.Forms.Views +{ + /// + /// The map view for the assembly result per section for all failure mechanisms of + /// the . + /// + public partial class AssemblyResultPerSectionMapView : UserControl, IMapView + { + private readonly MapLineData assemblyResultLineData; + private readonly MapLineData referenceLineMapData; + private readonly MapPointData hydraulicBoundaryLocationsMapData; + + /// + /// Creates a new instance of . + /// + /// The to create the view for. + /// Thrown when + /// is null. + public AssemblyResultPerSectionMapView(AssessmentSection assessmentSection) + { + if (assessmentSection == null) + { + throw new ArgumentNullException(nameof(assessmentSection)); + } + + AssessmentSection = assessmentSection; + InitializeComponent(); + + var mapDataCollection = new MapDataCollection("Assemblagekaart"); + assemblyResultLineData = new MapLineData("Gecombineerd vakoordeel", + new LineStyle + { + Width = 6, + DashStyle = LineDashStyle.Solid + }); + referenceLineMapData = RingtoetsMapDataFactory.CreateReferenceLineMapData(); + hydraulicBoundaryLocationsMapData = RingtoetsMapDataFactory.CreateHydraulicBoundaryLocationsMapData(); + + mapDataCollection.Add(assemblyResultLineData); + mapDataCollection.Add(referenceLineMapData); + mapDataCollection.Add(hydraulicBoundaryLocationsMapData); + + SetAllMapDataFeatures(); + + ringtoetsMapControl.SetAllData(mapDataCollection, assessmentSection.BackgroundData); + } + + /// + /// Gets the the view belongs to. + /// + public AssessmentSection AssessmentSection { get; } + + public object Data { get; set; } + + public IMapControl Map + { + get + { + return ringtoetsMapControl.MapControl; + } + } + + private void SetAllMapDataFeatures() + { + SetReferenceLineMapData(); + SetHydraulicBoundaryLocationsMapData(); + } + + #region ReferenceLine MapData + + private void UpdateReferenceLineMapData() + { + SetReferenceLineMapData(); + referenceLineMapData.NotifyObservers(); + } + + private void SetReferenceLineMapData() + { + referenceLineMapData.Features = RingtoetsMapDataFeaturesFactory.CreateReferenceLineFeatures(AssessmentSection.ReferenceLine, + AssessmentSection.Id, + AssessmentSection.Name); + } + + #endregion + + #region HydraulicBoundaryLocations MapData + + private void UpdateHydraulicBoundaryLocationsMapData() + { + SetHydraulicBoundaryLocationsMapData(); + hydraulicBoundaryLocationsMapData.NotifyObservers(); + } + + private void SetHydraulicBoundaryLocationsMapData() + { + hydraulicBoundaryLocationsMapData.Features = RingtoetsMapDataFeaturesFactory.CreateHydraulicBoundaryLocationFeatures(AssessmentSection); + } + + #endregion + } +} \ No newline at end of file Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/AssemblyResultPerSectionMapView.resx =================================================================== diff -u --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/AssemblyResultPerSectionMapView.resx (revision 0) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/AssemblyResultPerSectionMapView.resx (revision 58f11f214e2faa310cf964e68cd1778673fb4b63) @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Ringtoets.Integration.Forms.Test.csproj =================================================================== diff -u -r57910b84a73a0bd6745e2adc4739971d3d6a9a21 -r58f11f214e2faa310cf964e68cd1778673fb4b63 --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Ringtoets.Integration.Forms.Test.csproj (.../Ringtoets.Integration.Forms.Test.csproj) (revision 57910b84a73a0bd6745e2adc4739971d3d6a9a21) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Ringtoets.Integration.Forms.Test.csproj (.../Ringtoets.Integration.Forms.Test.csproj) (revision 58f11f214e2faa310cf964e68cd1778673fb4b63) @@ -94,6 +94,7 @@ + Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/AssemblyResultPerSectionMapViewTest.cs =================================================================== diff -u --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/AssemblyResultPerSectionMapViewTest.cs (revision 0) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/AssemblyResultPerSectionMapViewTest.cs (revision 58f11f214e2faa310cf964e68cd1778673fb4b63) @@ -0,0 +1,108 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Windows.Forms; +using Core.Common.TestUtil; +using Core.Components.Gis.Data; +using Core.Components.Gis.Forms; +using NUnit.Framework; +using Ringtoets.Common.Data.AssessmentSection; +using Ringtoets.Common.Forms.TestUtil; +using Ringtoets.Common.Forms.Views; +using Ringtoets.Integration.Data; +using Ringtoets.Integration.Forms.Views; + +namespace Ringtoets.Integration.Forms.Test.Views +{ + [TestFixture] + public class AssemblyResultPerSectionMapViewTest + { + private const int assemblyResultsIndex = 0; + private const int referenceLineIndex = 1; + private const int hydraulicBoundaryLocationsIndex = 2; + + [Test] + public void Constructor_AssessmentSectionNull_ThrowsArgumentNullException() + { + // Call + TestDelegate call = () => new AssemblyResultPerSectionMapView(null); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("assessmentSection", exception.ParamName); + } + + [Test] + public void Constructor_WithAssessmentSection_ExpectedValues() + { + // Setup + var random = new Random(21); + var assessmentSection = new AssessmentSection(random.NextEnumValue()); + + // Call + using (var view = new AssemblyResultPerSectionMapView(assessmentSection)) + { + // Assert + Assert.IsInstanceOf(view); + Assert.IsInstanceOf(view); + Assert.IsNull(view.Data); + + Assert.AreEqual(1, view.Controls.Count); + Assert.IsInstanceOf(view.Controls[0]); + Assert.AreSame(view.Map, ((RingtoetsMapControl) view.Controls[0]).MapControl); + Assert.AreEqual(DockStyle.Fill, ((Control) view.Map).Dock); + Assert.AreSame(assessmentSection, view.AssessmentSection); + + AssertEmptyMapData(view.Map.Data); + } + } + + private static void AssertEmptyMapData(MapDataCollection mapDataCollection) + { + Assert.AreEqual("Assemblagekaart", mapDataCollection.Name); + + List mapDataList = mapDataCollection.Collection.ToList(); + + Assert.AreEqual(3, mapDataList.Count); + + var assemblyResultsLineMapData = (MapLineData) mapDataList[assemblyResultsIndex]; + var hydraulicBoundaryLocationsMapData = (MapPointData) mapDataList[hydraulicBoundaryLocationsIndex]; + var referenceLineMapData = (MapLineData) mapDataList[referenceLineIndex]; + + CollectionAssert.IsEmpty(assemblyResultsLineMapData.Features); + CollectionAssert.IsEmpty(hydraulicBoundaryLocationsMapData.Features); + CollectionAssert.IsEmpty(referenceLineMapData.Features); + + Assert.AreEqual("Gecombineerd vakoordeel", assemblyResultsLineMapData.Name); + Assert.AreEqual("Hydraulische belastingen", hydraulicBoundaryLocationsMapData.Name); + Assert.AreEqual("Referentielijn", referenceLineMapData.Name); + } + + private static void AssertReferenceLineMapData(ReferenceLine referenceLine, MapData referenceLineMapData) + { + MapDataTestHelper.AssertReferenceLineMapData(referenceLine, referenceLineMapData); + Assert.IsTrue(referenceLineMapData.IsVisible); + } + } +} \ No newline at end of file