Index: src/Deltares.DSoilModel.Tests/DSoilModelContextTest.cs =================================================================== diff -u -r132 -r139 --- src/Deltares.DSoilModel.Tests/DSoilModelContextTest.cs (.../DSoilModelContextTest.cs) (revision 132) +++ src/Deltares.DSoilModel.Tests/DSoilModelContextTest.cs (.../DSoilModelContextTest.cs) (revision 139) @@ -132,6 +132,37 @@ } [Test] + public void DSoilModelContext_SoilMemberIsEnabled_AdhereToFilterMacrostabilityBasicModule() + { + var context = SetupDSoilModelContext(UserColumnFilters.MacrostabilityBasicModule); + var soil = new Soil + { + ShearStrengthModel = ShearStrengthModel.CPhi, + UseDefaultShearStrengthModel = false, // or it will mess up this test ! + + }; + Assert.AreEqual(true, context.IsEnabled(soil, soil.GetMemberName(s => s.Cohesion))); + Assert.AreEqual(true, context.IsEnabled(soil, soil.GetMemberName(s => s.FrictionAngle))); + Assert.AreEqual(false, context.IsEnabled(soil, soil.GetMemberName(s => s.UsePop))); + Assert.AreEqual(false, context.IsEnabled(soil, soil.GetMemberName(s => s.POP))); + Assert.AreEqual(false, context.IsEnabled(soil, soil.GetMemberName(s => s.RatioCuPc))); + Assert.AreEqual(false, context.IsEnabled(soil, soil.GetMemberName(s => s.StrengthIncreaseExponent))); + + soil.ShearStrengthModel = ShearStrengthModel.CuCalculated; + Assert.AreEqual(false, context.IsEnabled(soil, soil.GetMemberName(s => s.Cohesion))); + Assert.AreEqual(false, context.IsEnabled(soil, soil.GetMemberName(s => s.FrictionAngle))); + Assert.AreEqual(true, context.IsEnabled(soil, soil.GetMemberName(s => s.UsePop))); + soil.UsePop = true; + Assert.AreEqual(true, context.IsEnabled(soil, soil.GetMemberName(s => s.POP))); + Assert.AreEqual(false, context.IsEnabled(soil, soil.GetMemberName(s => s.RatioCuPc))); + Assert.AreEqual(false, context.IsEnabled(soil, soil.GetMemberName(s => s.StrengthIncreaseExponent))); + soil.UsePop = false; + Assert.AreEqual(false, context.IsEnabled(soil, soil.GetMemberName(s => s.POP))); + Assert.AreEqual(true, context.IsEnabled(soil, soil.GetMemberName(s => s.RatioCuPc))); + Assert.AreEqual(true, context.IsEnabled(soil, soil.GetMemberName(s => s.StrengthIncreaseExponent))); + } + + [Test] public void DSoilModelContext_SoilMemberIsVisible_AdhereToFilterPipingRingToets() { var visibleProperties = new List Index: src/Deltares.DSoilModel.Forms/DSoilModelContext.cs =================================================================== diff -u -r132 -r139 --- src/Deltares.DSoilModel.Forms/DSoilModelContext.cs (.../DSoilModelContext.cs) (revision 132) +++ src/Deltares.DSoilModel.Forms/DSoilModelContext.cs (.../DSoilModelContext.cs) (revision 139) @@ -26,13 +26,13 @@ { StaticReflection.GetMemberName(s => s.AbovePhreaticLevel), StaticReflection.GetMemberName(s => s.BelowPhreaticLevel), + StaticReflection.GetMemberName(s => s.ShearStrengthModel), StaticReflection.GetMemberName(s => s.Cohesion), StaticReflection.GetMemberName(s => s.FrictionAngle), + StaticReflection.GetMemberName(s => s.UsePop), + StaticReflection.GetMemberName(s => s.POP), StaticReflection.GetMemberName(s => s.RatioCuPc), StaticReflection.GetMemberName(s => s.StrengthIncreaseExponent), - StaticReflection.GetMemberName(s => s.POP), - StaticReflection.GetMemberName(s => s.ShearStrengthModel), - StaticReflection.GetMemberName(s => s.UsePop) }; private readonly HashSet pipingRingtoetsProperties = new HashSet @@ -50,6 +50,14 @@ /// public ParameterViewSettings ParameterView { get; set; } + /// + /// Method indicating a visibility override value for a given instance object. + /// + /// Object being evaluated. + /// Name of the member which is part of . + /// + /// True if visible; False if hidden; Null if no override. + /// public override bool? IsVisible(object source, string member) { if (source is BaseControlBinding || source is GridViewControl) @@ -193,6 +201,14 @@ return base.IsVisible(source, member); } + /// + /// Method indicating if the enabled override value for a given instance object. + /// + /// Object being evaluated. + /// Name of the member which is part of . + /// + /// True if enabled; False if disabled; Null if no override. + /// public override bool? IsEnabled(object source, string member) { if (source is ConePenetrationTestData) @@ -215,7 +231,8 @@ return false; } - if (source is Soil) + var soil = source as Soil; + if (soil != null) { BindPropertyInfo propertyInfo = PropertyInfoSupport.GetPropertyInfo(typeof(Soil), member); if (propertyInfo != null) @@ -228,17 +245,61 @@ if (member.EndsWith("Stochast")) { - return ParameterView != ParameterViewSettings.AsIsParameters; + if (ParameterView == ParameterViewSettings.AsIsParameters) + { + return false; + } } if (!alwaysVisibleProperties.Contains(member)) { - return ParameterView != ParameterViewSettings.ProbabilisticParameters; + if (ParameterView == ParameterViewSettings.ProbabilisticParameters) + { + return false; + } } + if (member == soil.GetMemberName(s => s.Cohesion) || + member == soil.GetMemberName(s => s.FrictionAngle)) + { + return soil.ShearStrengthModel == ShearStrengthModel.CPhi; + } + if (member == soil.GetMemberName(s => s.UsePop)) + { + return (soil.ShearStrengthModel == ShearStrengthModel.CuCalculated); + } + if (member == soil.GetMemberName(s => s.POP) || + member == soil.GetMemberName(s => s.RatioCuPc) || + member == soil.GetMemberName(s => s.StrengthIncreaseExponent)) + { + if (soil.ShearStrengthModel != ShearStrengthModel.CuCalculated) + { + return false; + } + } } return base.IsEnabled(source, member); } + /// + /// Method returning a collection of domain object for list or enum type members; + /// + /// Object being evaluated. + /// Name of the member which is part of . + /// A collection of domain object; Null if no override. + public override ICollection GetDomain(object source, string member) + { + // not yet implemented here (yet) + if (source is Soil && member == StaticReflection.GetMemberName(s => s.ShearStrengthModel)) + { + return new List + { + ShearStrengthModel.CPhi, + ShearStrengthModel.CuCalculated + }; + } + return null; + } + protected override HashSet GetFilteredProperties(object soilUserFilter) { if (soilUserFilter is UserColumnFilters)