Index: Riskeer/Integration/src/Riskeer.Integration.Forms/Controls/AssemblyOverviewControl.xaml =================================================================== diff -u --- Riskeer/Integration/src/Riskeer.Integration.Forms/Controls/AssemblyOverviewControl.xaml (revision 0) +++ Riskeer/Integration/src/Riskeer.Integration.Forms/Controls/AssemblyOverviewControl.xaml (revision 5c4439cfe69707040fe375e5be03b524bb968d28) @@ -0,0 +1,36 @@ + + + + + + + Index: Riskeer/Integration/src/Riskeer.Integration.Forms/Controls/AssemblyOverviewControl.xaml.cs =================================================================== diff -u --- Riskeer/Integration/src/Riskeer.Integration.Forms/Controls/AssemblyOverviewControl.xaml.cs (revision 0) +++ Riskeer/Integration/src/Riskeer.Integration.Forms/Controls/AssemblyOverviewControl.xaml.cs (revision 5c4439cfe69707040fe375e5be03b524bb968d28) @@ -0,0 +1,109 @@ +// 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 Lesser 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 Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser 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.Controls; +using System.Windows.Data; +using Riskeer.AssemblyTool.Data; +using Riskeer.Common.Data.AssessmentSection; +using Riskeer.Common.Data.FailureMechanism; +using Riskeer.Common.Forms.Helpers; +using Riskeer.Integration.Data.Assembly; + +namespace Riskeer.Integration.Forms.Controls +{ + /// + /// Interaction logic for . + /// + public partial class AssemblyOverviewControl + { + private readonly AssemblyOverviewViewModel viewModel; + + /// + /// Creates a new instance of . + /// + public AssemblyOverviewControl(AssemblyOverviewViewModel viewModel) + { + this.viewModel = viewModel; + InitializeComponent(); + + dataGrid.Columns.Add(new DataGridTextColumn + { + Binding = new Binding("Name") + }); + + var index = 0; + foreach (CombinedFailureMechanismSectionAssemblyResult combinedAssemblyResult in viewModel.CombinedAssemblyResults) + { + dataGrid.Columns.Add(new DataGridTextColumn + { + Binding = new Binding($"Results_{index}"), + Width = CalculateWidth(viewModel.AssessmentSection.ReferenceLine, combinedAssemblyResult) + }); + } + + var rowNumber = 0; + foreach (Tuple> failureMechanism in viewModel.FailureMechanisms) + { + dataGrid.Items.Add(new + { + Name = failureMechanism.Item1, + Results = failureMechanism.Item2.Select(i => FailureMechanismSectionAssemblyGroupDisplayHelper.GetAssemblyGroupDisplayName(i.Value.AssemblyGroup)) + }); + + var failureMechanismSectionIndex = 0; + var combinedFailureMechanismSectionIndex = 0; + double previousSectionLength = 0; + + // foreach (CombinedFailureMechanismSectionAssemblyResult combinedAssemblyResult in viewModel.CombinedAssemblyResults) + // { + // FailureMechanismSection failureMechanismSection = failureMechanism.Item2.Keys.ElementAt(failureMechanismSectionIndex); + // double combinedAssemblyResultLength = combinedAssemblyResult.SectionEnd - combinedAssemblyResult.SectionStart; + // + // if (failureMechanismSection.Length > combinedAssemblyResultLength - previousSectionLength) + // { + // var dataGridCellInfo = new DataGridCellInfo(dataGrid.Items[rowNumber], dataGrid.Columns[combinedFailureMechanismSectionIndex + 1]); + // FrameworkElement frameworkElement = dataGridCellInfo.Column.GetCellContent(dataGridCellInfo.Item); + // var cell = (DataGridCell) frameworkElement.Parent; + // cell.BorderThickness = new Thickness(0); + + // previousSectionLength = combinedAssemblyResultLength; + // combinedFailureMechanismSectionIndex++; + // } + + // failureMechanismSectionIndex++; + // } + // + // rowNumber++; + } + } + + private DataGridLength CalculateWidth(ReferenceLine referenceLine, CombinedFailureMechanismSectionAssemblyResult combinedAssemblyResult) + { + double referenceLineLength = referenceLine.Length; + double combinedAssemblyResultSectionLength = combinedAssemblyResult.SectionEnd - combinedAssemblyResult.SectionStart; + + return new DataGridLength(dataGrid.ActualWidth * (combinedAssemblyResultSectionLength / referenceLineLength) / 100); + } + } +} \ No newline at end of file Index: Riskeer/Integration/src/Riskeer.Integration.Forms/Controls/AssemblyOverviewViewModel.cs =================================================================== diff -u --- Riskeer/Integration/src/Riskeer.Integration.Forms/Controls/AssemblyOverviewViewModel.cs (revision 0) +++ Riskeer/Integration/src/Riskeer.Integration.Forms/Controls/AssemblyOverviewViewModel.cs (revision 5c4439cfe69707040fe375e5be03b524bb968d28) @@ -0,0 +1,138 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Riskeer.AssemblyTool.Data; +using Riskeer.ClosingStructures.Data; +using Riskeer.Common.Data.AssemblyTool; +using Riskeer.Common.Data.FailureMechanism; +using Riskeer.Common.Data.Structures; +using Riskeer.GrassCoverErosionInwards.Data; +using Riskeer.GrassCoverErosionOutwards.Data; +using Riskeer.HeightStructures.Data; +using Riskeer.Integration.Data; +using Riskeer.Integration.Data.Assembly; +using Riskeer.Integration.Data.StandAlone.AssemblyFactories; +using Riskeer.MacroStabilityInwards.Data; +using Riskeer.Piping.Data; +using Riskeer.StabilityPointStructures.Data; +using Riskeer.StabilityStoneCover.Data; +using Riskeer.WaveImpactAsphaltCover.Data; + +namespace Riskeer.Integration.Forms.Controls +{ + public class AssemblyOverviewViewModel + { + public AssemblyOverviewViewModel(AssessmentSection assessmentSection) + { + AssessmentSection = assessmentSection; + try + { + CombinedAssemblyResults = AssessmentSectionAssemblyFactory.AssembleCombinedPerFailureMechanismSection(assessmentSection) + .ToArray(); + } + catch (Exception) + { + CombinedAssemblyResults = Array.Empty(); + } + FailureMechanisms = new List>>(); + CreateRows(); + } + + private void CreateRows() + { + foreach (IFailureMechanism failureMechanism in AssessmentSection.GetFailureMechanisms().Where(fm => fm.InAssembly)) + { + if (failureMechanism is PipingFailureMechanism piping) + { + FailureMechanisms.Add(CreateResults(piping, PipingAssemblyFunc)); + } + + if (failureMechanism is GrassCoverErosionInwardsFailureMechanism gekb) + { + FailureMechanisms.Add(CreateResults(gekb, GrassCoverErosionInwardsAssemblyFunc)); + } + } + } + + private Tuple> CreateResults( + TFailureMechanism failureMechanism, Func performAssemblyFunc) + where TFailureMechanism : IHasSectionResults + where TSectionResult : FailureMechanismSectionResult + { + Dictionary failureMechanismSectionAssemblyResults = failureMechanism.SectionResults.ToDictionary( + sectionResult => sectionResult.Section, + sectionResult => AssemblyToolHelper.AssembleFailureMechanismSection(sectionResult, sr => performAssemblyFunc(sr, AssessmentSection))); + + return new Tuple>( + failureMechanism.Name, failureMechanismSectionAssemblyResults); + } + + public AssessmentSection AssessmentSection { get; } + + public CombinedFailureMechanismSectionAssemblyResult[] CombinedAssemblyResults { get; } + + public List>> FailureMechanisms { get; } + + #region Assembly Funcs + + private static Func PipingAssemblyFunc => + (sectionResult, assessmentSection) => PipingFailureMechanismAssemblyFactory.AssembleSection( + sectionResult, assessmentSection.Piping, assessmentSection); + + private static Func GrassCoverErosionInwardsAssemblyFunc => + (sectionResult, assessmentSection) => GrassCoverErosionInwardsFailureMechanismAssemblyFactory.AssembleSection( + sectionResult, assessmentSection.GrassCoverErosionInwards, assessmentSection); + + private static Func MacroStabilityInwardsAssemblyFunc => + (sectionResult, assessmentSection) => MacroStabilityInwardsFailureMechanismAssemblyFactory.AssembleSection( + sectionResult, assessmentSection.MacroStabilityInwards, assessmentSection); + + private static Func MicrostabilityAssemblyFunc => + (sectionResult, assessmentSection) => StandAloneFailureMechanismAssemblyFactory.AssembleSection( + sectionResult, assessmentSection.Microstability, assessmentSection); + + private static Func HeightStructuresAssemblyFunc => + (sectionResult, assessmentSection) => StructuresFailureMechanismAssemblyFactory.AssembleSection( + sectionResult, assessmentSection.HeightStructures, assessmentSection); + + private static Func ClosingStructuresAssemblyFunc => + (sectionResult, assessmentSection) => StructuresFailureMechanismAssemblyFactory.AssembleSection( + sectionResult, assessmentSection.HeightStructures, assessmentSection); + + private static Func StabilityPointStructuresAssemblyFunc => + (sectionResult, assessmentSection) => StructuresFailureMechanismAssemblyFactory.AssembleSection( + sectionResult, assessmentSection.HeightStructures, assessmentSection); + + private static Func GrassCoverErosionOutwardsAssemblyFunc => + (sectionResult, assessmentSection) => GrassCoverErosionOutwardsFailureMechanismAssemblyFactory.AssembleSection( + sectionResult, assessmentSection.GrassCoverErosionOutwards, assessmentSection); + + private static Func StabilityStoneCoverAssemblyFunc => + (sectionResult, assessmentSection) => StabilityStoneCoverFailureMechanismAssemblyFactory.AssembleSection( + sectionResult, assessmentSection.StabilityStoneCover, assessmentSection); + + private static Func WaveImpactAsphaltCoverAssemblyFunc => + (sectionResult, assessmentSection) => WaveImpactAsphaltCoverFailureMechanismAssemblyFactory.AssembleSection( + sectionResult, assessmentSection.WaveImpactAsphaltCover, assessmentSection); + + private static Func WaterPressureAsphaltCoverAssemblyFunc => + (sectionResult, assessmentSection) => StandAloneFailureMechanismAssemblyFactory.AssembleSection( + sectionResult, assessmentSection.WaterPressureAsphaltCover, assessmentSection); + + private static Func GrassCoverSlipOffOutwardsAssemblyFunc => + (sectionResult, assessmentSection) => StandAloneFailureMechanismAssemblyFactory.AssembleSection( + sectionResult, assessmentSection.GrassCoverSlipOffOutwards, assessmentSection); + + private static Func GrassCoverSlipOffInwardsAssemblyFunc => + (sectionResult, assessmentSection) => StandAloneFailureMechanismAssemblyFactory.AssembleSection( + sectionResult, assessmentSection.GrassCoverSlipOffInwards, assessmentSection); + + private static Func PipingStructureAssemblyFunc => + FailureMechanismSectionAssemblyResultFactory.AssembleSection; + + private static Func DuneErosionAssemblyFunc => + FailureMechanismSectionAssemblyResultFactory.AssembleSection; + + #endregion + } +} \ No newline at end of file Index: Riskeer/Integration/src/Riskeer.Integration.Forms/PresentationObjects/AssemblyOverviewContext.cs =================================================================== diff -u --- Riskeer/Integration/src/Riskeer.Integration.Forms/PresentationObjects/AssemblyOverviewContext.cs (revision 0) +++ Riskeer/Integration/src/Riskeer.Integration.Forms/PresentationObjects/AssemblyOverviewContext.cs (revision 5c4439cfe69707040fe375e5be03b524bb968d28) @@ -0,0 +1,16 @@ +using System; +using Core.Common.Controls.PresentationObjects; +using Riskeer.Integration.Data; + +namespace Riskeer.Integration.Forms.PresentationObjects +{ + public class AssemblyOverviewContext : ObservableWrappedObjectContextBase + { + /// + /// Creates a new instance of . + /// + /// The assessment section to present the assembly results for on a per section basis. + /// Thrown when is null. + public AssemblyOverviewContext(AssessmentSection assessmentSection) : base(assessmentSection) {} + } +} \ No newline at end of file Index: Riskeer/Integration/src/Riskeer.Integration.Forms/Riskeer.Integration.Forms.csproj =================================================================== diff -u -r09326eaed3005c8461c379f0d5e9a44311e22502 -r5c4439cfe69707040fe375e5be03b524bb968d28 --- Riskeer/Integration/src/Riskeer.Integration.Forms/Riskeer.Integration.Forms.csproj (.../Riskeer.Integration.Forms.csproj) (revision 09326eaed3005c8461c379f0d5e9a44311e22502) +++ Riskeer/Integration/src/Riskeer.Integration.Forms/Riskeer.Integration.Forms.csproj (.../Riskeer.Integration.Forms.csproj) (revision 5c4439cfe69707040fe375e5be03b524bb968d28) @@ -1,11 +1,17 @@  + + + + + + @@ -58,6 +64,9 @@ UserControl + + UserControl + @@ -72,6 +81,12 @@ all + + + MSBuild:Compile + Designer + + Index: Riskeer/Integration/src/Riskeer.Integration.Forms/Views/AssemblyResultsOverviewView.Designer.cs =================================================================== diff -u --- Riskeer/Integration/src/Riskeer.Integration.Forms/Views/AssemblyResultsOverviewView.Designer.cs (revision 0) +++ Riskeer/Integration/src/Riskeer.Integration.Forms/Views/AssemblyResultsOverviewView.Designer.cs (revision 5c4439cfe69707040fe375e5be03b524bb968d28) @@ -0,0 +1,62 @@ +using System.ComponentModel; +using Riskeer.Integration.Forms.Controls; + +namespace Riskeer.Integration.Forms.Views +{ + partial class AssemblyResultsOverviewView + { + /// + /// Required designer variable. + /// + private 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.wpfElementHost = new System.Windows.Forms.Integration.ElementHost(); + this.SuspendLayout(); + // + // wpfElementHost + // + this.wpfElementHost.Dock = System.Windows.Forms.DockStyle.Fill; + this.wpfElementHost.Location = new System.Drawing.Point(0, 0); + this.wpfElementHost.Name = "wpfElementHost"; + this.wpfElementHost.Size = new System.Drawing.Size(150, 150); + this.wpfElementHost.TabIndex = 0; + this.wpfElementHost.Text = "elementHost1"; + this.wpfElementHost.Child = null; + // + // AssemblyResultsOverviewView + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.wpfElementHost); + this.Name = "AssemblyResultsOverviewView"; + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.Integration.ElementHost wpfElementHost; + } +} \ No newline at end of file Index: Riskeer/Integration/src/Riskeer.Integration.Forms/Views/AssemblyResultsOverviewView.cs =================================================================== diff -u --- Riskeer/Integration/src/Riskeer.Integration.Forms/Views/AssemblyResultsOverviewView.cs (revision 0) +++ Riskeer/Integration/src/Riskeer.Integration.Forms/Views/AssemblyResultsOverviewView.cs (revision 5c4439cfe69707040fe375e5be03b524bb968d28) @@ -0,0 +1,22 @@ +using System.Windows.Forms; +using Core.Common.Controls.Views; +using Riskeer.Integration.Data; +using Riskeer.Integration.Forms.Controls; + +namespace Riskeer.Integration.Forms.Views +{ + public partial class AssemblyResultsOverviewView : UserControl, IView + { + public AssemblyResultsOverviewView(AssessmentSection assessmentSection) + { + AssessmentSection = assessmentSection; + InitializeComponent(); + + wpfElementHost.Child = new AssemblyOverviewControl(new AssemblyOverviewViewModel(assessmentSection)); + } + + public AssessmentSection AssessmentSection { get; } + + public object Data { get; set; } + } +} \ No newline at end of file Index: Riskeer/Integration/src/Riskeer.Integration.Forms/Views/AssemblyResultsOverviewView.resx =================================================================== diff -u --- Riskeer/Integration/src/Riskeer.Integration.Forms/Views/AssemblyResultsOverviewView.resx (revision 0) +++ Riskeer/Integration/src/Riskeer.Integration.Forms/Views/AssemblyResultsOverviewView.resx (revision 5c4439cfe69707040fe375e5be03b524bb968d28) @@ -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: Riskeer/Integration/src/Riskeer.Integration.Plugin/RiskeerPlugin.cs =================================================================== diff -u -r09486786d73dcf29f225c4aad4a3ac89ca44d21a -r5c4439cfe69707040fe375e5be03b524bb968d28 --- Riskeer/Integration/src/Riskeer.Integration.Plugin/RiskeerPlugin.cs (.../RiskeerPlugin.cs) (revision 09486786d73dcf29f225c4aad4a3ac89ca44d21a) +++ Riskeer/Integration/src/Riskeer.Integration.Plugin/RiskeerPlugin.cs (.../RiskeerPlugin.cs) (revision 5c4439cfe69707040fe375e5be03b524bb968d28) @@ -480,6 +480,13 @@ CreateInstance = context => new AssemblyResultPerSectionMapView(context.WrappedData) }; + yield return new RiskeerViewInfo(() => Gui) + { + GetViewName = (view, context) => RiskeerFormsResources.AssemblyResultPerSectionMapView_DisplayName, + CloseForData = (view, dataToCloseFor) => ReferenceEquals(view.AssessmentSection, dataToCloseFor), + CreateInstance = context => new AssemblyResultsOverviewView(context.WrappedData) + }; + yield return new RiskeerViewInfo(() => Gui) { GetViewName = (view, context) => RiskeerCommonFormsResources.AssemblyGroups_DisplayName, @@ -1017,6 +1024,15 @@ .Build() }; + yield return new TreeNodeInfo + { + Text = context => "Overzicht", + Image = context => Resources.AssemblyResultPerSection, + ContextMenuStrip = (nodeData, parentData, treeViewControl) => Gui.Get(nodeData, treeViewControl) + .AddOpenItem() + .Build() + }; + yield return new TreeNodeInfo { Text = context => Resources.AssemblyResultsCategoryTreeFolder_DisplayName, @@ -2741,6 +2757,7 @@ AssessmentSection assessmentSection = context.WrappedData; return new object[] { + new AssemblyOverviewContext(assessmentSection), new NormClassesContext(assessmentSection), new AssemblyResultTotalContext(assessmentSection), new AssemblyResultPerSectionContext(assessmentSection),