Index: Riskeer/GrassCoverErosionInwards/src/Riskeer.GrassCoverErosionInwards.Forms/Views/GrassCoverErosionInwardsCalculationsView.cs =================================================================== diff -u -r15848ed2f711ee0e7d03b0a93f681603ecf642fe -r008d97db20107c50db05a25767a4baa4edad7944 --- Riskeer/GrassCoverErosionInwards/src/Riskeer.GrassCoverErosionInwards.Forms/Views/GrassCoverErosionInwardsCalculationsView.cs (.../GrassCoverErosionInwardsCalculationsView.cs) (revision 15848ed2f711ee0e7d03b0a93f681603ecf642fe) +++ Riskeer/GrassCoverErosionInwards/src/Riskeer.GrassCoverErosionInwards.Forms/Views/GrassCoverErosionInwardsCalculationsView.cs (.../GrassCoverErosionInwardsCalculationsView.cs) (revision 008d97db20107c50db05a25767a4baa4edad7944) @@ -50,7 +50,7 @@ { private const int selectableHydraulicBoundaryLocationColumnIndex = 1; private const int selectableDikeProfileColumnIndex = 2; - private int selectableBreakWaterTypesColumnIndex = 4; + private const int selectableBreakWaterTypesColumnIndex = 4; private readonly Observer grassCoverErosionInwardsFailureMechanismObserver; private readonly Observer hydraulicBoundaryLocationsObserver; private readonly RecursiveObserver grassCoverErosionInwardsInputObserver; @@ -60,7 +60,7 @@ private CalculationGroup calculationGroup; private IAssessmentSection assessmentSection; private GrassCoverErosionInwardsFailureMechanism grassCoverErosionInwardsFailureMechanism; - + public event EventHandler SelectionChanged; /// @@ -279,6 +279,29 @@ hydraulicBoundaryLocations, referencePoint); } + private void UpdateDikeProfilesColumn() + { + var column = (DataGridViewComboBoxColumn)dataGridViewControl.GetColumnFromIndex(selectableDikeProfileColumnIndex); + + using (new SuspendDataGridViewColumnResizes(column)) + { + foreach (DataGridViewRow dataGridViewRow in dataGridViewControl.Rows) + { + FillAvailableDikeProfilesList(dataGridViewRow); + } + } + } + + private void FillAvailableDikeProfilesList(DataGridViewRow dataGridViewRow) + { + var rowData = (GrassCoverErosionInwardsCalculationRow) dataGridViewRow.DataBoundItem; + IEnumerable locations = GetSelectableHydraulicBoundaryLocationsForCalculation(rowData.GrassCoverErosionInwardsCalculationScenario.InputParameters.); + + var cell = (DataGridViewComboBoxCell)dataGridViewRow.Cells[selectableHydraulicBoundaryLocationColumnIndex]; + DataGridViewComboBoxItemWrapper[] dataGridViewComboBoxItemWrappers = GetSelectableHydraulicBoundaryLocationsDataSource(locations).ToArray(); + SetItemsOnObjectCollection(cell.Items, dataGridViewComboBoxItemWrappers); + } + private static void SetItemsOnObjectCollection(DataGridViewComboBoxCell.ObjectCollection objectCollection, object[] comboBoxItems) { objectCollection.Clear(); @@ -321,8 +344,8 @@ IEnumerable lineSegments = Math2D.ConvertPointsToLineSegments(failureMechanismSection.Points); IEnumerable grassCoverErosionInwardsCalculationScenarios = calculationGroup .GetCalculations() - .OfType(); - //.Where(cs => cs.IsDikeProfileIntersectionWithReferenceLineInSection(lineSegments)); + .OfType() + .Where(cs => cs.IsDikeProfileIntersectionWithReferenceLineInSection(lineSegments)); PrefillComboBoxListItemsAtColumnLevel(); @@ -331,6 +354,7 @@ dataGridViewControl.ClearCurrentCell(); UpdateSelectableHydraulicBoundaryLocationsColumn(); + UpdateDikeProfilesColumn(); } #endregion @@ -357,8 +381,7 @@ SetItemsOnObjectCollection(selectableDikeProfileColumn.Items, grassCoverErosionInwardsFailureMechanism.DikeProfiles.ToArray()); } - // Enum van damtypes. - var selectableBreakWaterTypesColumn = (DataGridViewComboBoxColumn)dataGridViewControl.GetColumnFromIndex(selectableBreakWaterTypesColumnIndex); + var selectableBreakWaterTypesColumn = (DataGridViewComboBoxColumn) dataGridViewControl.GetColumnFromIndex(selectableBreakWaterTypesColumnIndex); var breakWaterTypes = new object[] { BreakWaterType.Wall,