Index: Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/StructuresInputBaseProperties.cs =================================================================== diff -u -ra0c177d1a014bd96761b14bcdb148f3d0ede49ff -r722cd6ca2d37bf0f325c17a8208a33735ea98cb4 --- Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/StructuresInputBaseProperties.cs (.../StructuresInputBaseProperties.cs) (revision a0c177d1a014bd96761b14bcdb148f3d0ede49ff) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/StructuresInputBaseProperties.cs (.../StructuresInputBaseProperties.cs) (revision 722cd6ca2d37bf0f325c17a8208a33735ea98cb4) @@ -23,11 +23,13 @@ using System.Collections.Generic; using System.ComponentModel; using System.Drawing.Design; +using System.Linq.Expressions; using Core.Common.Base.Data; using Core.Common.Base.Geometry; using Core.Common.Gui.Attributes; using Core.Common.Gui.PropertyBag; using Core.Common.Utils.Attributes; +using Core.Common.Utils.Reflection; using Ringtoets.Common.Data; using Ringtoets.Common.Data.Calculation; using Ringtoets.Common.Data.DikeProfiles; @@ -58,7 +60,7 @@ where TCalculation : ICalculation where TFailureMechanism : IFailureMechanism { - private readonly ConstructionProperties constructionProperties; + private Dictionary propertyIndexLookup; /// /// Creates a new instance of the class. @@ -72,7 +74,54 @@ throw new ArgumentNullException("constructionProperties"); } - this.constructionProperties = constructionProperties; + propertyIndexLookup = new Dictionary + { + { + GetMemberName(p => p.ModelFactorSuperCriticalFlow), constructionProperties.ModelFactorSuperCriticalFlowPropertyIndex + }, + { + GetMemberName(p => p.Structure), constructionProperties.StructurePropertyIndex + }, + { + GetMemberName(p => p.StructureLocation), constructionProperties.StructureLocationPropertyIndex + }, + { + GetMemberName(p => p.StructureNormalOrientation), constructionProperties.StructureNormalOrientationPropertyIndex + }, + { + GetMemberName(p => p.FlowWidthAtBottomProtection), constructionProperties.FlowWidthAtBottomProtectionPropertyIndex + }, + { + GetMemberName(p => p.WidthFlowApertures), constructionProperties.WidthFlowAperturesPropertyIndex + }, + { + GetMemberName(p => p.StorageStructureArea), constructionProperties.StorageStructureAreaPropertyIndex + }, + { + GetMemberName(p => p.AllowedLevelIncreaseStorage), constructionProperties.AllowedLevelIncreaseStoragePropertyIndex + }, + { + GetMemberName(p => p.CriticalOvertoppingDischarge), constructionProperties.CriticalOvertoppingDischargePropertyIndex + }, + { + GetMemberName(p => p.FailureProbabilityStructureWithErosion), constructionProperties.FailureProbabilityStructureWithErosionPropertyIndex + }, + { + GetMemberName(p => p.ForeshoreProfile), constructionProperties.ForeshoreProfilePropertyIndex + }, + { + GetMemberName(p => p.UseBreakWater), constructionProperties.UseBreakWaterPropertyIndex + }, + { + GetMemberName(p => p.UseForeshore), constructionProperties.UseForeshorePropertyIndex + }, + { + GetMemberName(p => p.HydraulicBoundaryLocation), constructionProperties.HydraulicBoundaryLocationPropertyIndex + }, + { + GetMemberName(p => p.StormDuration), constructionProperties.StormDurationPropertyIndex + } + }; } #region Model factors @@ -95,6 +144,16 @@ #endregion + [DynamicPropertyOrderEvaluationMethod] + public int DynamicPropertyOrderEvaluationMethod(string propertyName) + { + int propertyIndex; + + propertyIndexLookup.TryGetValue(propertyName, out propertyIndex); + + return propertyIndex; + } + public abstract IEnumerable GetAvailableForeshoreProfiles(); public IEnumerable GetAvailableHydraulicBoundaryLocations() @@ -109,6 +168,11 @@ /// protected abstract void AfterSettingStructure(); + private static string GetMemberName(Expression, object>> expression) + { + return TypeUtils.GetMemberName(expression); + } + /// /// Class holding the various construction parameters for . /// @@ -133,7 +197,7 @@ /// /// Gets or sets the property index for the location of . /// - public int HeightStructureLocationPropertyIndex { get; set; } + public int StructureLocationPropertyIndex { get; set; } /// /// Gets or sets the property index for . @@ -227,7 +291,7 @@ [ResourcesCategory(typeof(Resources), "Categories_Schematization")] [ResourcesDisplayName(typeof(Resources), "Structure_Location_DisplayName")] [ResourcesDescription(typeof(Resources), "Structure_Location_Description")] - public Point2D HeightStructureLocation + public Point2D StructureLocation { get {