Index: Riskeer/Integration/src/Riskeer.Integration.Forms/Riskeer.Integration.Forms.csproj =================================================================== diff -u -rfde8e8156c09a1058ff6b6eff55a7fb49d161a5e -r51c955b9d1fd44b643c32b670aa048245b76a8de --- Riskeer/Integration/src/Riskeer.Integration.Forms/Riskeer.Integration.Forms.csproj (.../Riskeer.Integration.Forms.csproj) (revision fde8e8156c09a1058ff6b6eff55a7fb49d161a5e) +++ Riskeer/Integration/src/Riskeer.Integration.Forms/Riskeer.Integration.Forms.csproj (.../Riskeer.Integration.Forms.csproj) (revision 51c955b9d1fd44b643c32b670aa048245b76a8de) @@ -52,6 +52,9 @@ True Resources.resx + + UserControl + Index: Riskeer/Integration/src/Riskeer.Integration.Forms/Views/AssessmentSectionBaseView.Designer.cs =================================================================== diff -u --- Riskeer/Integration/src/Riskeer.Integration.Forms/Views/AssessmentSectionBaseView.Designer.cs (revision 0) +++ Riskeer/Integration/src/Riskeer.Integration.Forms/Views/AssessmentSectionBaseView.Designer.cs (revision 51c955b9d1fd44b643c32b670aa048245b76a8de) @@ -0,0 +1,64 @@ +// Copyright (C) Stichting Deltares 2021. All rights reserved. +// +// This file is part of Riskeer. +// +// Riskeer 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 Riskeer.Integration.Forms.Views +{ + partial class AssessmentSectionBaseView + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + #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.riskeerMapControl = new Riskeer.Common.Forms.Views.RiskeerMapControl(); + this.SuspendLayout(); + // + // riskeerMapControl + // + this.riskeerMapControl.Dock = System.Windows.Forms.DockStyle.Fill; + this.riskeerMapControl.Location = new System.Drawing.Point(0, 0); + this.riskeerMapControl.Name = "riskeerMapControl"; + this.riskeerMapControl.Size = new System.Drawing.Size(150, 150); + this.riskeerMapControl.TabIndex = 0; + // + // AssessmentSectionView + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.riskeerMapControl); + this.Name = "AssessmentSectionBaseView"; + this.ResumeLayout(false); + + } + + #endregion + + private Riskeer.Common.Forms.Views.RiskeerMapControl riskeerMapControl; + } +} Index: Riskeer/Integration/src/Riskeer.Integration.Forms/Views/AssessmentSectionBaseView.cs =================================================================== diff -u --- Riskeer/Integration/src/Riskeer.Integration.Forms/Views/AssessmentSectionBaseView.cs (revision 0) +++ Riskeer/Integration/src/Riskeer.Integration.Forms/Views/AssessmentSectionBaseView.cs (revision 51c955b9d1fd44b643c32b670aa048245b76a8de) @@ -0,0 +1,129 @@ +// Copyright (C) Stichting Deltares 2021. All rights reserved. +// +// This file is part of Riskeer. +// +// Riskeer 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.Common.Base; +using Core.Components.Gis.Data; +using Core.Components.Gis.Forms; +using Riskeer.Common.Forms.Factories; +using Riskeer.Integration.Data; +using Riskeer.Integration.Forms.Properties; + +namespace Riskeer.Integration.Forms.Views +{ + /// + /// This class is a view showing map data for an assessment section. + /// + public partial class AssessmentSectionBaseView : UserControl, IMapView + { + private readonly AssessmentSection assessmentSection; + + private readonly MapLineData referenceLineMapData; + + private Observer assessmentSectionObserver; + private Observer referenceLineObserver; + + /// + /// Creates a new instance of . + /// + /// The assessment section to show the data for. + /// Thrown when + /// is null. + public AssessmentSectionBaseView(AssessmentSection assessmentSection) + { + if (assessmentSection == null) + { + throw new ArgumentNullException(nameof(assessmentSection)); + } + + InitializeComponent(); + + this.assessmentSection = assessmentSection; + + CreateObservers(); + + var mapDataCollection = new MapDataCollection(Resources.AssessmentSectionMap_DisplayName); + referenceLineMapData = RiskeerMapDataFactory.CreateReferenceLineMapData(); + + mapDataCollection.Add(referenceLineMapData); + + SetAllMapDataFeatures(); + riskeerMapControl.SetAllData(mapDataCollection, assessmentSection.BackgroundData); + } + + public object Data { get; set; } + + public IMapControl Map + { + get + { + return riskeerMapControl.MapControl; + } + } + + protected override void Dispose(bool disposing) + { + assessmentSectionObserver.Dispose(); + referenceLineObserver.Dispose(); + + if (disposing) + { + components?.Dispose(); + } + + base.Dispose(disposing); + } + + private void CreateObservers() + { + assessmentSectionObserver = new Observer(UpdateReferenceLineMapData) + { + Observable = assessmentSection + }; + + referenceLineObserver = new Observer(UpdateReferenceLineMapData) + { + Observable = assessmentSection.ReferenceLine + }; + } + + private void SetAllMapDataFeatures() + { + SetReferenceLineMapData(); + } + + #region ReferenceLine MapData + + private void UpdateReferenceLineMapData() + { + SetReferenceLineMapData(); + referenceLineMapData.NotifyObservers(); + } + + private void SetReferenceLineMapData() + { + referenceLineMapData.Features = RiskeerMapDataFeaturesFactory.CreateReferenceLineFeatures(assessmentSection.ReferenceLine, assessmentSection.Id, assessmentSection.Name); + } + + #endregion + } +} \ No newline at end of file Index: Riskeer/Integration/src/Riskeer.Integration.Forms/Views/AssessmentSectionBaseView.resx =================================================================== diff -u --- Riskeer/Integration/src/Riskeer.Integration.Forms/Views/AssessmentSectionBaseView.resx (revision 0) +++ Riskeer/Integration/src/Riskeer.Integration.Forms/Views/AssessmentSectionBaseView.resx (revision 51c955b9d1fd44b643c32b670aa048245b76a8de) @@ -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