Index: Riskeer/Integration/src/Riskeer.Integration.Forms/Views/AssessmentSectionReferenceLineView.cs =================================================================== diff -u -rd04957276dbeb07bf0ab6189ad7d77385b8f20ca -r389bbd8afb76c14374cf23b2802e532ea6059a4e --- Riskeer/Integration/src/Riskeer.Integration.Forms/Views/AssessmentSectionReferenceLineView.cs (.../AssessmentSectionReferenceLineView.cs) (revision d04957276dbeb07bf0ab6189ad7d77385b8f20ca) +++ Riskeer/Integration/src/Riskeer.Integration.Forms/Views/AssessmentSectionReferenceLineView.cs (.../AssessmentSectionReferenceLineView.cs) (revision 389bbd8afb76c14374cf23b2802e532ea6059a4e) @@ -24,18 +24,18 @@ using Core.Common.Base; using Core.Components.Gis.Data; using Core.Components.Gis.Forms; +using Riskeer.Common.Data.AssessmentSection; 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. + /// This class is a view showing reference line map data for an assessment section. /// public partial class AssessmentSectionReferenceLineView : UserControl, IMapView { - private readonly AssessmentSection assessmentSection; + private readonly IAssessmentSection assessmentSection; private readonly MapLineData referenceLineMapData; @@ -48,7 +48,7 @@ /// The assessment section to show the data for. /// Thrown when /// is null. - public AssessmentSectionReferenceLineView(AssessmentSection assessmentSection) + public AssessmentSectionReferenceLineView(IAssessmentSection assessmentSection) { if (assessmentSection == null) { @@ -61,13 +61,13 @@ CreateObservers(); - var mapDataCollection = new MapDataCollection(Resources.AssessmentSectionMap_DisplayName); + MapDataCollection = new MapDataCollection(Resources.AssessmentSectionMap_DisplayName); referenceLineMapData = RiskeerMapDataFactory.CreateReferenceLineMapData(); - mapDataCollection.Add(referenceLineMapData); + MapDataCollection.Add(referenceLineMapData); SetAllMapDataFeatures(); - riskeerMapControl.SetAllData(mapDataCollection, assessmentSection.BackgroundData); + riskeerMapControl.SetAllData(MapDataCollection, assessmentSection.BackgroundData); } public object Data { get; set; } @@ -80,6 +80,8 @@ } } + protected MapDataCollection MapDataCollection { get; } + protected override void Dispose(bool disposing) { assessmentSectionObserver.Dispose(); Index: Riskeer/Integration/src/Riskeer.Integration.Forms/Views/AssessmentSectionView.cs =================================================================== diff -u -rc36b47c2e1e8cf948767cca33f80ad735f370ad0 -r389bbd8afb76c14374cf23b2802e532ea6059a4e --- Riskeer/Integration/src/Riskeer.Integration.Forms/Views/AssessmentSectionView.cs (.../AssessmentSectionView.cs) (revision c36b47c2e1e8cf948767cca33f80ad735f370ad0) +++ Riskeer/Integration/src/Riskeer.Integration.Forms/Views/AssessmentSectionView.cs (.../AssessmentSectionView.cs) (revision 389bbd8afb76c14374cf23b2802e532ea6059a4e) @@ -28,22 +28,20 @@ using Riskeer.Common.Data.Hydraulics; using Riskeer.Common.Forms.Factories; using Riskeer.Common.Forms.Helpers; +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 AssessmentSectionView : UserControl, IMapView + public partial class AssessmentSectionView : AssessmentSectionReferenceLineView, IMapView { private readonly IAssessmentSection assessmentSection; - private readonly MapLineData referenceLineMapData; private readonly MapPointData hydraulicBoundaryLocationsMapData; - private Observer assessmentSectionObserver; - private Observer referenceLineObserver; private Observer hydraulicBoundaryLocationsObserver; private RecursiveObserver, HydraulicBoundaryLocationCalculation> waterLevelCalculationsForFactorizedSignalingNormObserver; private RecursiveObserver, HydraulicBoundaryLocationCalculation> waterLevelCalculationsForSignalingNormObserver; @@ -60,7 +58,7 @@ /// The assessment section to show the data for. /// Thrown when /// is null. - public AssessmentSectionView(IAssessmentSection assessmentSection) + public AssessmentSectionView(IAssessmentSection assessmentSection) : base(assessmentSection) { if (assessmentSection == null) { @@ -73,31 +71,16 @@ CreateObservers(); - var mapDataCollection = new MapDataCollection(Resources.AssessmentSectionMap_DisplayName); - referenceLineMapData = RiskeerMapDataFactory.CreateReferenceLineMapData(); hydraulicBoundaryLocationsMapData = RiskeerMapDataFactory.CreateHydraulicBoundaryLocationsMapData(); - mapDataCollection.Add(referenceLineMapData); - mapDataCollection.Add(hydraulicBoundaryLocationsMapData); + MapDataCollection.Add(hydraulicBoundaryLocationsMapData); SetAllMapDataFeatures(); - riskeerMapControl.SetAllData(mapDataCollection, assessmentSection.BackgroundData); + 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(); waterLevelCalculationsForFactorizedSignalingNormObserver.Dispose(); waterLevelCalculationsForSignalingNormObserver.Dispose(); waterLevelCalculationsForLowerLimitNormObserver.Dispose(); @@ -118,16 +101,6 @@ private void CreateObservers() { - assessmentSectionObserver = new Observer(UpdateReferenceLineMapData) - { - Observable = assessmentSection - }; - - referenceLineObserver = new Observer(UpdateReferenceLineMapData) - { - Observable = assessmentSection.ReferenceLine - }; - waterLevelCalculationsForFactorizedSignalingNormObserver = ObserverHelper.CreateHydraulicBoundaryLocationCalculationsObserver( assessmentSection.WaterLevelCalculationsForFactorizedSignalingNorm, UpdateHydraulicBoundaryLocationsMapData); waterLevelCalculationsForSignalingNormObserver = ObserverHelper.CreateHydraulicBoundaryLocationCalculationsObserver( @@ -153,25 +126,9 @@ private void SetAllMapDataFeatures() { - SetReferenceLineMapData(); SetHydraulicBoundaryLocationsMapData(); } - #region ReferenceLine MapData - - private void UpdateReferenceLineMapData() - { - SetReferenceLineMapData(); - referenceLineMapData.NotifyObservers(); - } - - private void SetReferenceLineMapData() - { - referenceLineMapData.Features = RiskeerMapDataFeaturesFactory.CreateReferenceLineFeatures(assessmentSection.ReferenceLine, assessmentSection.Id, assessmentSection.Name); - } - - #endregion - #region HydraulicBoundaryLocations MapData private void UpdateHydraulicBoundaryLocationsMapData()