Index: Riskeer/Integration/src/Riskeer.Integration.Forms/Riskeer.Integration.Forms.csproj =================================================================== diff -u -r5c4439cfe69707040fe375e5be03b524bb968d28 -r74c106e69e540f960fb7df127bef26a92ba07fa7 --- Riskeer/Integration/src/Riskeer.Integration.Forms/Riskeer.Integration.Forms.csproj (.../Riskeer.Integration.Forms.csproj) (revision 5c4439cfe69707040fe375e5be03b524bb968d28) +++ Riskeer/Integration/src/Riskeer.Integration.Forms/Riskeer.Integration.Forms.csproj (.../Riskeer.Integration.Forms.csproj) (revision 74c106e69e540f960fb7df127bef26a92ba07fa7) @@ -67,6 +67,9 @@ UserControl + + UserControl + Index: Riskeer/Integration/src/Riskeer.Integration.Forms/Views/AssemblyResultsOverviewCanvasView.Designer.cs =================================================================== diff -u --- Riskeer/Integration/src/Riskeer.Integration.Forms/Views/AssemblyResultsOverviewCanvasView.Designer.cs (revision 0) +++ Riskeer/Integration/src/Riskeer.Integration.Forms/Views/AssemblyResultsOverviewCanvasView.Designer.cs (revision 74c106e69e540f960fb7df127bef26a92ba07fa7) @@ -0,0 +1,62 @@ +using System.ComponentModel; + +namespace Riskeer.Integration.Forms.Views +{ + partial class AssemblyResultsOverviewCanvasView + { + /// + /// 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.pictureBox = new System.Windows.Forms.PictureBox(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).BeginInit(); + this.SuspendLayout(); + // + // pictureBox + // + this.pictureBox.Dock = System.Windows.Forms.DockStyle.Fill; + this.pictureBox.Location = new System.Drawing.Point(0, 0); + this.pictureBox.Name = "pictureBox"; + this.pictureBox.Size = new System.Drawing.Size(150, 150); + this.pictureBox.TabIndex = 0; + this.pictureBox.TabStop = false; + // + // AssemblyResultsOverviewCanvasView + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.pictureBox); + this.Name = "AssemblyResultsOverviewCanvasView"; + ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).EndInit(); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.PictureBox pictureBox; + } +} \ No newline at end of file Index: Riskeer/Integration/src/Riskeer.Integration.Forms/Views/AssemblyResultsOverviewCanvasView.cs =================================================================== diff -u --- Riskeer/Integration/src/Riskeer.Integration.Forms/Views/AssemblyResultsOverviewCanvasView.cs (revision 0) +++ Riskeer/Integration/src/Riskeer.Integration.Forms/Views/AssemblyResultsOverviewCanvasView.cs (revision 74c106e69e540f960fb7df127bef26a92ba07fa7) @@ -0,0 +1,96 @@ +using System; +using System.Drawing; +using System.Linq; +using System.Windows.Forms; +using Core.Common.Controls.Views; +using Riskeer.AssemblyTool.Data; +using Riskeer.Common.Data.AssemblyTool; +using Riskeer.Common.Data.FailureMechanism; +using Riskeer.Common.Forms.Helpers; +using Riskeer.GrassCoverErosionInwards.Data; +using Riskeer.Integration.Data; +using Riskeer.Piping.Data; + +namespace Riskeer.Integration.Forms.Views +{ + public partial class AssemblyResultsOverviewCanvasView : UserControl, IView + { + private readonly Pen pen; + private double widthPerMeter; + + public AssemblyResultsOverviewCanvasView(AssessmentSection assessmentSection) + { + AssessmentSection = assessmentSection; + InitializeComponent(); + + pen = new Pen(Color.Black, 2); + } + + protected override void OnLoad(EventArgs e) + { + Graphics g = pictureBox.CreateGraphics(); + + widthPerMeter = g.ClipBounds.Width / AssessmentSection.ReferenceLine.Length; + + var rowCounter = 0; + foreach (IFailureMechanism failureMechanism in AssessmentSection.GetFailureMechanisms().Where(fm => fm.InAssembly)) + { + if (failureMechanism is PipingFailureMechanism piping) + { + CreateRow(piping, PipingAssemblyFunc, rowCounter++, g); + } + + if (failureMechanism is GrassCoverErosionInwardsFailureMechanism gekb) + { + CreateRow(gekb, GrassCoverErosionInwardsAssemblyFunc, rowCounter++, g); + } + } + + OnPaint(new PaintEventArgs(g, Rectangle.Ceiling(g.ClipBounds))); + } + + public AssessmentSection AssessmentSection { get; } + + public object Data { get; set; } + + private void CreateRow(TFailureMechanism failureMechanism, + Func performAssemblyFunc, + int rowNumber, Graphics graphics) + where TFailureMechanism : IHasSectionResults + where TSectionResult : FailureMechanismSectionResult + { + var height = 10; + var xPosition = 0; + int yPosition = height * rowNumber; + + graphics.DrawRectangle(pen, new Rectangle(xPosition, yPosition, 10, height)); + + xPosition = 10; + + foreach (TSectionResult sectionResult in failureMechanism.SectionResults) + { + FailureMechanismSectionAssemblyResult sectionAssemblyResult = AssemblyToolHelper.AssembleFailureMechanismSection( + sectionResult, sr => performAssemblyFunc(sr, AssessmentSection)); + + var sectionWidth = (int) (widthPerMeter * sectionResult.Section.Length); + graphics.FillRectangle(new SolidBrush(AssemblyGroupColorHelper.GetFailureMechanismSectionAssemblyCategoryGroupColor( + sectionAssemblyResult.AssemblyGroup)), + xPosition, yPosition, sectionWidth, height); + + xPosition += sectionWidth; + } + } + + #region 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); + + #endregion + } +} \ No newline at end of file Index: Riskeer/Integration/src/Riskeer.Integration.Forms/Views/AssemblyResultsOverviewCanvasView.resx =================================================================== diff -u --- Riskeer/Integration/src/Riskeer.Integration.Forms/Views/AssemblyResultsOverviewCanvasView.resx (revision 0) +++ Riskeer/Integration/src/Riskeer.Integration.Forms/Views/AssemblyResultsOverviewCanvasView.resx (revision 74c106e69e540f960fb7df127bef26a92ba07fa7) @@ -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 -r5c4439cfe69707040fe375e5be03b524bb968d28 -r74c106e69e540f960fb7df127bef26a92ba07fa7 --- Riskeer/Integration/src/Riskeer.Integration.Plugin/RiskeerPlugin.cs (.../RiskeerPlugin.cs) (revision 5c4439cfe69707040fe375e5be03b524bb968d28) +++ Riskeer/Integration/src/Riskeer.Integration.Plugin/RiskeerPlugin.cs (.../RiskeerPlugin.cs) (revision 74c106e69e540f960fb7df127bef26a92ba07fa7) @@ -480,11 +480,11 @@ CreateInstance = context => new AssemblyResultPerSectionMapView(context.WrappedData) }; - yield return new RiskeerViewInfo(() => Gui) + yield return new RiskeerViewInfo(() => Gui) { GetViewName = (view, context) => RiskeerFormsResources.AssemblyResultPerSectionMapView_DisplayName, CloseForData = (view, dataToCloseFor) => ReferenceEquals(view.AssessmentSection, dataToCloseFor), - CreateInstance = context => new AssemblyResultsOverviewView(context.WrappedData) + CreateInstance = context => new AssemblyResultsOverviewCanvasView(context.WrappedData) }; yield return new RiskeerViewInfo(() => Gui)