Index: Riskeer/Piping/src/Riskeer.Piping.Forms/PropertyClasses/Probabilistic/ProbabilisticPipingInputContextProperties.cs =================================================================== diff -u -r4ae39646924c115d80e283044f58b85814b7adbe -re395a3a2043fd5ab83bcc667a5a7d68e1ae159ef --- Riskeer/Piping/src/Riskeer.Piping.Forms/PropertyClasses/Probabilistic/ProbabilisticPipingInputContextProperties.cs (.../ProbabilisticPipingInputContextProperties.cs) (revision 4ae39646924c115d80e283044f58b85814b7adbe) +++ Riskeer/Piping/src/Riskeer.Piping.Forms/PropertyClasses/Probabilistic/ProbabilisticPipingInputContextProperties.cs (.../ProbabilisticPipingInputContextProperties.cs) (revision e395a3a2043fd5ab83bcc667a5a7d68e1ae159ef) @@ -23,13 +23,11 @@ using System.Collections.Generic; using System.ComponentModel; using System.Drawing.Design; -using System.Linq; using Core.Common.Base.Data; using Core.Common.Base.Geometry; using Core.Common.Gui.Attributes; using Core.Common.Gui.PropertyBag; using Core.Common.Util.Attributes; -using Riskeer.Common.Data.FailureMechanism; using Riskeer.Common.Forms.ChangeHandlers; using Riskeer.Common.Forms.Helpers; using Riskeer.Common.Forms.PresentationObjects; @@ -72,13 +70,10 @@ private const int diameter70PropertyIndex = 13; private const int saturatedVolumicWeightOfCoverageLayerPropertyIndex = 14; - private const int sectionNamePropertyIndex = 15; - private const int sectionLengthPropertyIndex = 16; + private const int shouldProfileSpecificIllustrationPointsBeCalculatedPropertyIndex = 15; + private const int shouldSectionSpecificIllustrationPointsBeCalculatedPropertyIndex = 16; + private const int numberOfCategories = 4; - private const int shouldProfileSpecificIllustrationPointsBeCalculatedPropertyIndex = 17; - private const int shouldSectionSpecificIllustrationPointsBeCalculatedPropertyIndex = 18; - private const int numberOfCategories = 5; - private readonly IObservablePropertyChangeHandler propertyChangeHandler; /// @@ -158,13 +153,6 @@ return data.AvailablePipingSurfaceLines; } - private FailureMechanismSection GetSection() - { - return data.FailureMechanism - .Sections - .FirstOrDefault(section => data.PipingCalculation.IsSurfaceLineIntersectionWithReferenceLineInSection(Math2D.ConvertPointsToLineSegments(section.Points))); - } - #region Hydraulic data [PropertyOrder(selectedHydraulicBoundaryLocationPropertyIndex)] @@ -404,40 +392,10 @@ #endregion - #region Section information - - [PropertyOrder(sectionNamePropertyIndex)] - [ResourcesCategory(typeof(Resources), nameof(Resources.Categories_FailureMechanismSection), 3, numberOfCategories)] - [ResourcesDisplayName(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.FailureMechanismSection_Name_DisplayName))] - [ResourcesDescription(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.FailureMechanismSection_Name_Description))] - public string SectionName - { - get - { - FailureMechanismSection failureMechanismSection = GetSection(); - return failureMechanismSection == null ? "-" : failureMechanismSection.Name; - } - } - - [PropertyOrder(sectionLengthPropertyIndex)] - [ResourcesCategory(typeof(Resources), nameof(Resources.Categories_FailureMechanismSection), 3, numberOfCategories)] - [ResourcesDisplayName(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.FailureMechanismSection_Length_Rounded_DisplayName))] - [ResourcesDescription(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.FailureMechanismSection_Length_Rounded_Description))] - public RoundedDouble SectionLength - { - get - { - FailureMechanismSection failureMechanismSection = GetSection(); - return failureMechanismSection == null ? new RoundedDouble(2) : new RoundedDouble(2, failureMechanismSection.Length); - } - } - - #endregion - #region Illustration points [PropertyOrder(shouldProfileSpecificIllustrationPointsBeCalculatedPropertyIndex)] - [ResourcesCategory(typeof(Resources), nameof(Resources.Categories_ProfileSpecificCalculation), 4, numberOfCategories)] + [ResourcesCategory(typeof(Resources), nameof(Resources.Categories_ProfileSpecificCalculation), 3, numberOfCategories)] [ResourcesDisplayName(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.ShouldIllustrationPointsBeCalculated_DisplayName))] [ResourcesDescription(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.ShouldIllustrationPointsBeCalculated_Description))] public bool ShouldProfileSpecificIllustrationPointsBeCalculated @@ -451,7 +409,7 @@ } [PropertyOrder(shouldSectionSpecificIllustrationPointsBeCalculatedPropertyIndex)] - [ResourcesCategory(typeof(Resources), nameof(Resources.Categories_SectionSpecificCalculation), 5, numberOfCategories)] + [ResourcesCategory(typeof(Resources), nameof(Resources.Categories_SectionSpecificCalculation), 4, numberOfCategories)] [ResourcesDisplayName(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.ShouldIllustrationPointsBeCalculated_DisplayName))] [ResourcesDescription(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.ShouldIllustrationPointsBeCalculated_Description))] public bool ShouldSectionSpecificIllustrationPointsBeCalculated Index: Riskeer/Piping/test/Riskeer.Piping.Forms.Test/PropertyClasses/Probabilistic/ProbabilisticPipingInputContextPropertiesTest.cs =================================================================== diff -u -r4ae39646924c115d80e283044f58b85814b7adbe -re395a3a2043fd5ab83bcc667a5a7d68e1ae159ef --- Riskeer/Piping/test/Riskeer.Piping.Forms.Test/PropertyClasses/Probabilistic/ProbabilisticPipingInputContextPropertiesTest.cs (.../ProbabilisticPipingInputContextPropertiesTest.cs) (revision 4ae39646924c115d80e283044f58b85814b7adbe) +++ Riskeer/Piping/test/Riskeer.Piping.Forms.Test/PropertyClasses/Probabilistic/ProbabilisticPipingInputContextPropertiesTest.cs (.../ProbabilisticPipingInputContextPropertiesTest.cs) (revision e395a3a2043fd5ab83bcc667a5a7d68e1ae159ef) @@ -73,12 +73,9 @@ private const int expectedDiameter70PropertyIndex = 13; private const int expectedSaturatedVolumicWeightOfCoverageLayerPropertyIndex = 14; - private const int expectedSectionNamePropertyIndex = 15; - private const int expectedSectionLengthPropertyIndex = 16; + private const int expectedShouldProfileSpecificCalculateIllustrationPointsPropertyIndex = 15; + private const int expectedShouldSectionSpecificCalculateIllustrationPointsPropertyIndex = 16; - private const int expectedShouldProfileSpecificCalculateIllustrationPointsPropertyIndex = 17; - private const int expectedShouldSectionSpecificCalculateIllustrationPointsPropertyIndex = 18; - [Test] public void Constructor_DataNull_ThrowArgumentNullException() { @@ -217,11 +214,10 @@ // Assert PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties); - Assert.AreEqual(19, dynamicProperties.Count); + Assert.AreEqual(17, dynamicProperties.Count); - const string hydraulicDataCategory = "\t\t\t\tHydraulische gegevens"; - const string schematizationCategory = "\t\t\tSchematisatie"; - const string sectionInformationCategory = "\t\tVakinformatie"; + const string hydraulicDataCategory = "\t\t\tHydraulische gegevens"; + const string schematizationCategory = "\t\tSchematisatie"; const string profileSpecificCategory = "\tSterkte berekening doorsnede"; const string sectionSpecificCategory = "Sterkte berekening vak"; @@ -334,22 +330,6 @@ true); Assert.IsInstanceOf(saturatedVolumicWeightOfCoverageLayerProperty.Converter); - PropertyDescriptor sectionNameProperty = dynamicProperties[expectedSectionNamePropertyIndex]; - PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties( - sectionNameProperty, - sectionInformationCategory, - "Vaknaam", - "De naam van het vak.", - true); - - PropertyDescriptor sectionLengthProperty = dynamicProperties[expectedSectionLengthPropertyIndex]; - PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties( - sectionLengthProperty, - sectionInformationCategory, - "Lengte* [m]", - "De totale lengte van het vak in meters (afgerond).", - true); - PropertyDescriptor shouldProfileSpecificCalculateIllustrationPointsProperty = dynamicProperties[expectedShouldProfileSpecificCalculateIllustrationPointsPropertyIndex]; PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties( shouldProfileSpecificCalculateIllustrationPointsProperty, @@ -406,7 +386,7 @@ // Assert PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties); - const string schematizationCategory = "\t\t\tSchematisatie"; + const string schematizationCategory = "\t\tSchematisatie"; PropertyDescriptor entryPointLProperty = dynamicProperties[expectedEntryPointLPropertyIndex]; PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties( @@ -499,51 +479,13 @@ Assert.AreSame(inputParameters.HydraulicBoundaryLocation, properties.SelectedHydraulicBoundaryLocation.HydraulicBoundaryLocation); - FailureMechanismSection expectedSection = failureMechanism.Sections.First( - s => calculation.IsSurfaceLineIntersectionWithReferenceLineInSection( - Math2D.ConvertPointsToLineSegments(s.Points))); - - Assert.AreEqual(expectedSection.Name, properties.SectionName); - Assert.AreEqual(expectedSection.Length, properties.SectionLength, properties.SectionLength.GetAccuracy()); Assert.AreEqual(inputParameters.ShouldProfileSpecificIllustrationPointsBeCalculated, properties.ShouldProfileSpecificIllustrationPointsBeCalculated); Assert.AreEqual(inputParameters.ShouldSectionSpecificIllustrationPointsBeCalculated, properties.ShouldSectionSpecificIllustrationPointsBeCalculated); mocks.VerifyAll(); } [Test] - public void Constructor_CalculationNotInSection_ReturnExpectedValues() - { - // Setup - var mocks = new MockRepository(); - var assessmentSection = mocks.Stub(); - var handler = mocks.Stub(); - mocks.ReplayAll(); - - var failureMechanism = new PipingFailureMechanism(); - var calculation = ProbabilisticPipingCalculationTestFactory.CreateCalculationWithValidInput( - new TestHydraulicBoundaryLocation()); - - ProbabilisticPipingInput inputParameters = calculation.InputParameters; - - var context = new ProbabilisticPipingInputContext(inputParameters, - calculation, - Enumerable.Empty(), - Enumerable.Empty(), - failureMechanism, - assessmentSection); - - // Call - var properties = new ProbabilisticPipingInputContextProperties(context, handler); - - // Assert - Assert.AreEqual("-", properties.SectionName); - Assert.AreEqual(0, properties.SectionLength, properties.SectionLength.GetAccuracy()); - - mocks.VerifyAll(); - } - - [Test] public void GivenPropertiesWithData_WhenChangingProperties_ThenPropertiesSetOnInput() { // Given