Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Application.Ringtoets.Storage.csproj =================================================================== diff -u -r2651fdf110e56d0f48e416fcffc1b4922cff00a5 -rdceba6b3e14e5a6da00dfb14cb90e2e1961257f2 --- Application/Ringtoets/src/Application.Ringtoets.Storage/Application.Ringtoets.Storage.csproj (.../Application.Ringtoets.Storage.csproj) (revision 2651fdf110e56d0f48e416fcffc1b4922cff00a5) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Application.Ringtoets.Storage.csproj (.../Application.Ringtoets.Storage.csproj) (revision dceba6b3e14e5a6da00dfb14cb90e2e1961257f2) @@ -63,6 +63,7 @@ + RingtoetsEntities.tt @@ -192,12 +193,14 @@ RingtoetsEntities.tt + RingtoetsEntities.tt + Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Create/StabilityStoneCover/StabilityStoneCoverWaveConditionsCalculationCreateExtensions.cs =================================================================== diff -u -r0540405a7dbabf85dc02db30c79c3c58b0faeea6 -rdceba6b3e14e5a6da00dfb14cb90e2e1961257f2 --- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/StabilityStoneCover/StabilityStoneCoverWaveConditionsCalculationCreateExtensions.cs (.../StabilityStoneCoverWaveConditionsCalculationCreateExtensions.cs) (revision 0540405a7dbabf85dc02db30c79c3c58b0faeea6) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/StabilityStoneCover/StabilityStoneCoverWaveConditionsCalculationCreateExtensions.cs (.../StabilityStoneCoverWaveConditionsCalculationCreateExtensions.cs) (revision dceba6b3e14e5a6da00dfb14cb90e2e1961257f2) @@ -49,8 +49,8 @@ var entity = new StabilityStoneCoverWaveConditionsCalculationEntity { Order = order, - Name = calculation.Name, - Comments = calculation.Comments, + Name = calculation.Name.DeepClone(), + Comments = calculation.Comments.DeepClone(), Orientation = calculation.InputParameters.Orientation, UseBreakWater = Convert.ToByte(calculation.InputParameters.UseBreakWater), BreakWaterType = (byte) calculation.InputParameters.BreakWater.Type, @@ -72,7 +72,26 @@ entity.ForeshoreProfileEntity = calculation.InputParameters.ForeshoreProfile.Create(registry, 0); } + if (calculation.HasOutput) + { + AddEntityForStabilityStoneCoverWaveConditionsOutput(calculation.Output, registry, entity); + } + return entity; } + + private static void AddEntityForStabilityStoneCoverWaveConditionsOutput(StabilityStoneCoverWaveConditionsOutput stabilityStoneCoverWaveConditionsOutputs, + PersistenceRegistry registry, + StabilityStoneCoverWaveConditionsCalculationEntity entity) + { + foreach (var output in stabilityStoneCoverWaveConditionsOutputs.BlocksOutput) + { + entity.StabilityStoneCoverWaveConditionsOutputEntities.Add(output.CreateStabilityStoneCoverWaveConditionsOutput(WaveConditionsOutputType.Blocks, registry)); + } + foreach (var output in stabilityStoneCoverWaveConditionsOutputs.ColumnsOutput) + { + entity.StabilityStoneCoverWaveConditionsOutputEntities.Add(output.CreateStabilityStoneCoverWaveConditionsOutput(WaveConditionsOutputType.Columns, registry)); + } + } } } \ No newline at end of file Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Create/StabilityStoneCover/StabilityStoneCoverWaveConditionsOutputCreateExtensions.cs =================================================================== diff -u --- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/StabilityStoneCover/StabilityStoneCoverWaveConditionsOutputCreateExtensions.cs (revision 0) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/StabilityStoneCover/StabilityStoneCoverWaveConditionsOutputCreateExtensions.cs (revision dceba6b3e14e5a6da00dfb14cb90e2e1961257f2) @@ -0,0 +1,63 @@ +// Copyright (C) Stichting Deltares 2016. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using Application.Ringtoets.Storage.DbContext; +using Ringtoets.Revetment.Data; +using Ringtoets.StabilityStoneCover.Data; + +namespace Application.Ringtoets.Storage.Create.StabilityStoneCover +{ + /// + /// Extension methods for related to + /// creating a . + /// + internal static class StabilityStoneCoverWaveConditionsOutputCreateExtensions + { + /// + /// Creates a based on the information + /// of the . + /// + /// The calculation output for stability stone cover failure mechanism to + /// create a database entity for. + /// The type of the . + /// The object keeping track of create operations. + /// A new . + /// Thrown when is null. + internal static StabilityStoneCoverWaveConditionsOutputEntity CreateStabilityStoneCoverWaveConditionsOutput( + this WaveConditionsOutput output, WaveConditionsOutputType type, PersistenceRegistry registry) + { + if (registry == null) + { + throw new ArgumentNullException("registry"); + } + var entity = new StabilityStoneCoverWaveConditionsOutputEntity + { + WaterLevel = output.WaterLevel.Value.ToNaNAsNull(), + WaveHeight = output.WaveHeight.Value.ToNaNAsNull(), + WavePeakPeriod = output.WavePeakPeriod.Value.ToNaNAsNull(), + WaveAngle = output.WaveAngle.Value.ToNaNAsNull(), + OutputType = (byte) type + }; + return entity; + } + } +} \ No newline at end of file Index: Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/DatabaseStructure.sql =================================================================== diff -u -r2651fdf110e56d0f48e416fcffc1b4922cff00a5 -rdceba6b3e14e5a6da00dfb14cb90e2e1961257f2 --- Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/DatabaseStructure.sql (.../DatabaseStructure.sql) (revision 2651fdf110e56d0f48e416fcffc1b4922cff00a5) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/DatabaseStructure.sql (.../DatabaseStructure.sql) (revision dceba6b3e14e5a6da00dfb14cb90e2e1961257f2) @@ -1,6 +1,6 @@ /* ---------------------------------------------------- */ /* Generated by Enterprise Architect Version 12.0 */ -/* Created On : 16-sep-2016 15:56:48 */ +/* Created On : 19-Sep-2016 7:51:29 AM */ /* DBMS : SQLite */ /* ---------------------------------------------------- */ @@ -383,6 +383,7 @@ ( 'PipingCalculationOutputEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, 'PipingCalculationEntityId' INTEGER NOT NULL, + 'Order' INT (4) NOT NULL, 'HeaveFactorOfSafety' REAL, 'HeaveZValue' REAL, 'UpliftFactorOfSafety' REAL, @@ -398,6 +399,7 @@ ( 'PipingSemiProbabilisticOutputEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, 'PipingCalculationEntityId' INTEGER NOT NULL, + 'Order' INT (4) NOT NULL, 'UpliftFactorOfSafety' REAL, 'UpliftProbability' REAL, 'HeaveFactorOfSafety' REAL, @@ -630,6 +632,7 @@ ( 'GrassCoverErosionInwardsOutputEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, 'GrassCoverErosionInwardsCalculationEntityId' INTEGER NOT NULL, + 'Order' INT (4) NOT NULL, 'IsOvertoppingDominant' TINYINT (1) NOT NULL, 'WaveHeight' REAL, 'DikeHeight' REAL, -- REAL mapped as string, or DBNull when the value is null. @@ -690,11 +693,12 @@ ( 'StabilityStoneCoverWaveConditionsOutputEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, 'StabilityStoneCoverWaveConditionsCalculationEntityId' INTEGER NOT NULL, + 'Order' INT (4) NOT NULL, + 'OutputType' TINYINT (1) NOT NULL, -- 0 = column 1 = block 'WaterLevel' REAL, 'WaveHeight' REAL, 'WavePeakPeriod' REAL, 'WaveAngle' REAL, - 'OutputType' SMALLINT, -- 0 = column 1 = block CONSTRAINT 'FK_StabilityStoneCoverWaveConditionsOutputEntity_StabilityStoneCoverWaveConditionsCalculationEntity' FOREIGN KEY ('StabilityStoneCoverWaveConditionsCalculationEntityId') REFERENCES 'StabilityStoneCoverWaveConditionsCalculationEntity' ('StabilityStoneCoverWaveConditionsCalculationEntityId') ON DELETE Cascade ON UPDATE Cascade ) ; Index: Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/GrassCoverErosionInwardsOutputEntity.cs =================================================================== diff -u -rfa2d88ba58e524c1d132a21df4e0adf9fa6570c4 -rdceba6b3e14e5a6da00dfb14cb90e2e1961257f2 --- Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/GrassCoverErosionInwardsOutputEntity.cs (.../GrassCoverErosionInwardsOutputEntity.cs) (revision fa2d88ba58e524c1d132a21df4e0adf9fa6570c4) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/GrassCoverErosionInwardsOutputEntity.cs (.../GrassCoverErosionInwardsOutputEntity.cs) (revision dceba6b3e14e5a6da00dfb14cb90e2e1961257f2) @@ -37,6 +37,7 @@ { public long GrassCoverErosionInwardsOutputEntityId { get; set; } public long GrassCoverErosionInwardsCalculationEntityId { get; set; } + public int Order { get; set; } public byte IsOvertoppingDominant { get; set; } public Nullable WaveHeight { get; set; } public Nullable DikeHeight { get; set; } Index: Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/PipingCalculationOutputEntity.cs =================================================================== diff -u -rfa2d88ba58e524c1d132a21df4e0adf9fa6570c4 -rdceba6b3e14e5a6da00dfb14cb90e2e1961257f2 --- Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/PipingCalculationOutputEntity.cs (.../PipingCalculationOutputEntity.cs) (revision fa2d88ba58e524c1d132a21df4e0adf9fa6570c4) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/PipingCalculationOutputEntity.cs (.../PipingCalculationOutputEntity.cs) (revision dceba6b3e14e5a6da00dfb14cb90e2e1961257f2) @@ -37,6 +37,7 @@ { public long PipingCalculationOutputEntityId { get; set; } public long PipingCalculationEntityId { get; set; } + public int Order { get; set; } public Nullable HeaveFactorOfSafety { get; set; } public Nullable HeaveZValue { get; set; } public Nullable UpliftFactorOfSafety { get; set; } Index: Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/PipingSemiProbabilisticOutputEntity.cs =================================================================== diff -u -rfa2d88ba58e524c1d132a21df4e0adf9fa6570c4 -rdceba6b3e14e5a6da00dfb14cb90e2e1961257f2 --- Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/PipingSemiProbabilisticOutputEntity.cs (.../PipingSemiProbabilisticOutputEntity.cs) (revision fa2d88ba58e524c1d132a21df4e0adf9fa6570c4) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/PipingSemiProbabilisticOutputEntity.cs (.../PipingSemiProbabilisticOutputEntity.cs) (revision dceba6b3e14e5a6da00dfb14cb90e2e1961257f2) @@ -37,6 +37,7 @@ { public long PipingSemiProbabilisticOutputEntityId { get; set; } public long PipingCalculationEntityId { get; set; } + public int Order { get; set; } public Nullable UpliftFactorOfSafety { get; set; } public Nullable UpliftProbability { get; set; } public Nullable HeaveFactorOfSafety { get; set; } Index: Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/RingtoetsEntities.Designer.cs =================================================================== diff -u -r2651fdf110e56d0f48e416fcffc1b4922cff00a5 -rdceba6b3e14e5a6da00dfb14cb90e2e1961257f2 --- Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/RingtoetsEntities.Designer.cs (.../RingtoetsEntities.Designer.cs) (revision 2651fdf110e56d0f48e416fcffc1b4922cff00a5) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/RingtoetsEntities.Designer.cs (.../RingtoetsEntities.Designer.cs) (revision dceba6b3e14e5a6da00dfb14cb90e2e1961257f2) @@ -1,4 +1,25 @@ -// T4 code generation is enabled for model 'D:\repos\WettelijkToetsInstrumentarium\Application\Ringtoets\src\Application.Ringtoets.Storage\DbContext\RingtoetsEntities.edmx'. +// Copyright (C) Stichting Deltares 2016. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +// T4 code generation is enabled for model 'D:\Projects\WTI\trunk\Application\Ringtoets\src\Application.Ringtoets.Storage\DbContext\RingtoetsEntities.edmx'. // To enable legacy code generation, change the value of the 'Code Generation Strategy' designer // property to 'Legacy ObjectContext'. This property is available in the Properties Window when the model // is open in the designer. Index: Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/RingtoetsEntities.edmx =================================================================== diff -u -r2651fdf110e56d0f48e416fcffc1b4922cff00a5 -rdceba6b3e14e5a6da00dfb14cb90e2e1961257f2 --- Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/RingtoetsEntities.edmx (.../RingtoetsEntities.edmx) (revision 2651fdf110e56d0f48e416fcffc1b4922cff00a5) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/RingtoetsEntities.edmx (.../RingtoetsEntities.edmx) (revision dceba6b3e14e5a6da00dfb14cb90e2e1961257f2) @@ -4,7 +4,7 @@ - + @@ -150,6 +150,7 @@ + @@ -306,6 +307,7 @@ + @@ -337,6 +339,7 @@ + @@ -432,11 +435,12 @@ + + - @@ -1839,6 +1843,7 @@ + @@ -2017,6 +2022,7 @@ + @@ -2051,6 +2057,7 @@ + @@ -2157,11 +2164,12 @@ + + - @@ -3045,6 +3053,7 @@ + @@ -3211,6 +3220,7 @@ + @@ -3252,6 +3262,7 @@ + @@ -3341,11 +3352,12 @@ - + + Index: Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/RingtoetsEntities.edmx.diagram =================================================================== diff -u -r2651fdf110e56d0f48e416fcffc1b4922cff00a5 -rdceba6b3e14e5a6da00dfb14cb90e2e1961257f2 --- Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/RingtoetsEntities.edmx.diagram (.../RingtoetsEntities.edmx.diagram) (revision 2651fdf110e56d0f48e416fcffc1b4922cff00a5) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/RingtoetsEntities.edmx.diagram (.../RingtoetsEntities.edmx.diagram) (revision dceba6b3e14e5a6da00dfb14cb90e2e1961257f2) @@ -5,50 +5,50 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + Index: Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/StabilityStoneCoverWaveConditionsOutputEntity.cs =================================================================== diff -u -r2651fdf110e56d0f48e416fcffc1b4922cff00a5 -rdceba6b3e14e5a6da00dfb14cb90e2e1961257f2 --- Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/StabilityStoneCoverWaveConditionsOutputEntity.cs (.../StabilityStoneCoverWaveConditionsOutputEntity.cs) (revision 2651fdf110e56d0f48e416fcffc1b4922cff00a5) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/StabilityStoneCoverWaveConditionsOutputEntity.cs (.../StabilityStoneCoverWaveConditionsOutputEntity.cs) (revision dceba6b3e14e5a6da00dfb14cb90e2e1961257f2) @@ -37,11 +37,12 @@ { public long StabilityStoneCoverWaveConditionsOutputEntityId { get; set; } public long StabilityStoneCoverWaveConditionsCalculationEntityId { get; set; } + public int Order { get; set; } + public byte OutputType { get; set; } public Nullable WaterLevel { get; set; } public Nullable WaveHeight { get; set; } public Nullable WavePeakPeriod { get; set; } public Nullable WaveAngle { get; set; } - public Nullable OutputType { get; set; } public virtual StabilityStoneCoverWaveConditionsCalculationEntity StabilityStoneCoverWaveConditionsCalculationEntity { get; set; } } Index: Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/WaveConditionsOutputType.cs =================================================================== diff -u --- Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/WaveConditionsOutputType.cs (revision 0) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/WaveConditionsOutputType.cs (revision dceba6b3e14e5a6da00dfb14cb90e2e1961257f2) @@ -0,0 +1,39 @@ +// Copyright (C) Stichting Deltares 2016. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +namespace Application.Ringtoets.Storage.DbContext +{ + /// + /// The type of wave conditions output. + /// + public enum WaveConditionsOutputType + { + /// + /// Corresponds to the wave conditions output for columns. + /// + Columns = 1, + + /// + /// Corresponds to the wave conditions output for blocks. + /// + Blocks = 2 + } +} \ No newline at end of file Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Read/StabilityStoneCover/StabilityStoneCoverWaveConditionsCalculationEntityReadExtensions.cs =================================================================== diff -u -r0540405a7dbabf85dc02db30c79c3c58b0faeea6 -rdceba6b3e14e5a6da00dfb14cb90e2e1961257f2 --- Application/Ringtoets/src/Application.Ringtoets.Storage/Read/StabilityStoneCover/StabilityStoneCoverWaveConditionsCalculationEntityReadExtensions.cs (.../StabilityStoneCoverWaveConditionsCalculationEntityReadExtensions.cs) (revision 0540405a7dbabf85dc02db30c79c3c58b0faeea6) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Read/StabilityStoneCover/StabilityStoneCoverWaveConditionsCalculationEntityReadExtensions.cs (.../StabilityStoneCoverWaveConditionsCalculationEntityReadExtensions.cs) (revision dceba6b3e14e5a6da00dfb14cb90e2e1961257f2) @@ -20,6 +20,8 @@ // All rights reserved. using System; +using System.Collections.Generic; +using System.Linq; using Application.Ringtoets.Storage.DbContext; using Core.Common.Base.Data; using Ringtoets.Common.Data.DikeProfiles; @@ -71,13 +73,41 @@ LowerBoundaryRevetment = (RoundedDouble) entity.LowerBoundaryRevetment.ToNullAsNaN(), UpperBoundaryWaterLevels = (RoundedDouble) entity.UpperBoundaryWaterLevels.ToNullAsNaN(), LowerBoundaryWaterLevels = (RoundedDouble) entity.LowerBoundaryWaterLevels.ToNullAsNaN(), - StepSize = (WaveConditionsInputStepSize)entity.StepSize + StepSize = (WaveConditionsInputStepSize) entity.StepSize } }; + ReadCalculationOutputs(entity, calculation); + return calculation; } + private static void ReadCalculationOutputs(StabilityStoneCoverWaveConditionsCalculationEntity entity, StabilityStoneCoverWaveConditionsCalculation calculation) + { + if (!entity.StabilityStoneCoverWaveConditionsOutputEntities.Any()) + { + return; + } + + var columnsOutput = new List(); + var blocksOutput = new List(); + + foreach (var conditionsOutputEntity in entity.StabilityStoneCoverWaveConditionsOutputEntities) + { + var output = conditionsOutputEntity.Read(); + if (conditionsOutputEntity.OutputType == (byte) WaveConditionsOutputType.Columns) + { + columnsOutput.Add(output); + } + else if (conditionsOutputEntity.OutputType == (byte) WaveConditionsOutputType.Blocks) + { + blocksOutput.Add(output); + } + } + + calculation.Output = new StabilityStoneCoverWaveConditionsOutput(columnsOutput, blocksOutput); + } + private static ForeshoreProfile GetDikeProfileValue(ForeshoreProfileEntity foreshoreProfileEntity, ReadConversionCollector collector) { if (foreshoreProfileEntity != null) Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Read/StabilityStoneCover/StabilityStoneCoverWaveConditionsOutputEntityReadExtensions.cs =================================================================== diff -u --- Application/Ringtoets/src/Application.Ringtoets.Storage/Read/StabilityStoneCover/StabilityStoneCoverWaveConditionsOutputEntityReadExtensions.cs (revision 0) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Read/StabilityStoneCover/StabilityStoneCoverWaveConditionsOutputEntityReadExtensions.cs (revision dceba6b3e14e5a6da00dfb14cb90e2e1961257f2) @@ -0,0 +1,49 @@ +// Copyright (C) Stichting Deltares 2016. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using Application.Ringtoets.Storage.DbContext; +using Ringtoets.Revetment.Data; +using Ringtoets.StabilityStoneCover.Data; + +namespace Application.Ringtoets.Storage.Read.StabilityStoneCover +{ + /// + /// This class defines extension methods for read operations for a + /// based on the . + /// + internal static class StabilityStoneCoverWaveConditionsOutputEntityReadExtensions + { + /// + /// Reads the + /// and use the information to construct a . + /// + /// The + /// to create for. + /// A new . + internal static WaveConditionsOutput Read(this StabilityStoneCoverWaveConditionsOutputEntity entity) + { + return new WaveConditionsOutput(entity.WaterLevel.ToNullAsNaN(), + entity.WaveHeight.ToNullAsNaN(), + entity.WavePeakPeriod.ToNullAsNaN(), + entity.WaveAngle.ToNullAsNaN()); + } + } +} \ No newline at end of file Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/GrassCoverErosionInwards/GrassCoverErosionInwardsOutputCreateExtensionsTest.cs =================================================================== diff -u -rfa2d88ba58e524c1d132a21df4e0adf9fa6570c4 -rdceba6b3e14e5a6da00dfb14cb90e2e1961257f2 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/GrassCoverErosionInwards/GrassCoverErosionInwardsOutputCreateExtensionsTest.cs (.../GrassCoverErosionInwardsOutputCreateExtensionsTest.cs) (revision fa2d88ba58e524c1d132a21df4e0adf9fa6570c4) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/GrassCoverErosionInwards/GrassCoverErosionInwardsOutputCreateExtensionsTest.cs (.../GrassCoverErosionInwardsOutputCreateExtensionsTest.cs) (revision dceba6b3e14e5a6da00dfb14cb90e2e1961257f2) @@ -33,7 +33,7 @@ public class GrassCoverErosionInwardsOutputCreateExtensionsTest { [Test] - public void Create_PersistenceRegistryIsNull_ThrowArgumenNullException() + public void Create_PersistenceRegistryIsNull_ThrowArgumentNullException() { // Setup var probabilityAssessmentOutput = new ProbabilityAssessmentOutput(1.0, 1.0, 1.0, 1.0, 1.0); @@ -51,8 +51,11 @@ public void Create_ValidInput_ReturnGrassCoverErosionInwardsOutputEntity() { // Setup - var probabilityAssessmentOutput = new ProbabilityAssessmentOutput(0.005, 1.0, 0.06, 0.8, 0.5); - var output = new GrassCoverErosionInwardsOutput(1.1, false, probabilityAssessmentOutput, 2.2); + var random = new Random(456); + var probabilityAssessmentOutput = new ProbabilityAssessmentOutput(random.NextDouble(), random.NextDouble(), + random.NextDouble(), random.NextDouble(), + random.NextDouble()); + var output = new GrassCoverErosionInwardsOutput(random.NextDouble(), false, probabilityAssessmentOutput, random.NextDouble()); var registry = new PersistenceRegistry(); Fisheye: Tag dceba6b3e14e5a6da00dfb14cb90e2e1961257f2 refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/ProbabilisticAssessmentOutputCreateExtensionsTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/StabilityStoneCover/StabilityStoneCoverFailureMechanismCreateExtensionsTest.cs =================================================================== diff -u -r8aaa7b9a8a2826cf8da31d0fd136f2d559933afe -rdceba6b3e14e5a6da00dfb14cb90e2e1961257f2 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/StabilityStoneCover/StabilityStoneCoverFailureMechanismCreateExtensionsTest.cs (.../StabilityStoneCoverFailureMechanismCreateExtensionsTest.cs) (revision 8aaa7b9a8a2826cf8da31d0fd136f2d559933afe) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/StabilityStoneCover/StabilityStoneCoverFailureMechanismCreateExtensionsTest.cs (.../StabilityStoneCoverFailureMechanismCreateExtensionsTest.cs) (revision dceba6b3e14e5a6da00dfb14cb90e2e1961257f2) @@ -25,10 +25,8 @@ using Application.Ringtoets.Storage.Create.StabilityStoneCover; using Application.Ringtoets.Storage.DbContext; using Application.Ringtoets.Storage.TestUtil; -using Core.Common.Base.Geometry; using NUnit.Framework; using Ringtoets.Common.Data.Calculation; -using Ringtoets.Common.Data.DikeProfiles; using Ringtoets.StabilityStoneCover.Data; namespace Application.Ringtoets.Storage.Test.Create.StabilityStoneCover Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/IntegrationTests/StorageSqLiteIntegrationTest.cs =================================================================== diff -u -r83a72354e69c186ca436bbe29e31122b9b8f4c3a -rdceba6b3e14e5a6da00dfb14cb90e2e1961257f2 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/IntegrationTests/StorageSqLiteIntegrationTest.cs (.../StorageSqLiteIntegrationTest.cs) (revision 83a72354e69c186ca436bbe29e31122b9b8f4c3a) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/IntegrationTests/StorageSqLiteIntegrationTest.cs (.../StorageSqLiteIntegrationTest.cs) (revision dceba6b3e14e5a6da00dfb14cb90e2e1961257f2) @@ -1007,16 +1007,15 @@ Assert.AreEqual(expectedOutput.RequiredProbability, actualOutput.RequiredProbability); Assert.AreEqual(expectedOutput.RequiredReliability, actualOutput.RequiredReliability); } - - + private static void AssertStabilityStoneCoverWaveConditionsCalculation(StabilityStoneCoverWaveConditionsCalculation expectedCalculation, StabilityStoneCoverWaveConditionsCalculation actualCalculation) { Assert.AreEqual(expectedCalculation.Name, actualCalculation.Name); Assert.AreEqual(expectedCalculation.Comments, actualCalculation.Comments); AssertWaveConditionsInput(expectedCalculation.InputParameters, actualCalculation.InputParameters); - Assert.IsFalse(actualCalculation.HasOutput); + Assert.IsTrue(actualCalculation.HasOutput); } private static void AssertWaveConditionsInput(WaveConditionsInput expectedInput, WaveConditionsInput actualInput) Index: Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil/RingtoetsProjectTestHelper.cs =================================================================== diff -u -r83a72354e69c186ca436bbe29e31122b9b8f4c3a -rdceba6b3e14e5a6da00dfb14cb90e2e1961257f2 --- Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil/RingtoetsProjectTestHelper.cs (.../RingtoetsProjectTestHelper.cs) (revision 83a72354e69c186ca436bbe29e31122b9b8f4c3a) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil/RingtoetsProjectTestHelper.cs (.../RingtoetsProjectTestHelper.cs) (revision dceba6b3e14e5a6da00dfb14cb90e2e1961257f2) @@ -131,6 +131,224 @@ return fullTestProject; } + private static void SetSectionResults(IEnumerable sectionResults) + { + var random = new Random(21); + foreach (var sectionResult in sectionResults) + { + sectionResult.AssessmentLayerOne = Convert.ToBoolean(random.Next(0, 2)); + sectionResult.AssessmentLayerThree = (RoundedDouble) random.NextDouble(); + } + } + + private static void SetSectionResults(IEnumerable sectionResults) + { + var random = new Random(21); + foreach (var sectionResult in sectionResults) + { + sectionResult.AssessmentLayerOne = Convert.ToBoolean(random.Next(0, 2)); + sectionResult.AssessmentLayerThree = (RoundedDouble) random.NextDouble(); + } + } + + private static void SetSectionResults(IEnumerable sectionResults) + { + var random = new Random(21); + foreach (var sectionResult in sectionResults) + { + sectionResult.AssessmentLayerOne = Convert.ToBoolean(random.Next(0, 2)); + sectionResult.AssessmentLayerThree = (RoundedDouble) random.NextDouble(); + } + } + + private static void SetSectionResults(IEnumerable sectionResults) + { + var random = new Random(21); + foreach (var sectionResult in sectionResults) + { + sectionResult.AssessmentLayerOne = Convert.ToBoolean(random.Next(0, 2)); + sectionResult.AssessmentLayerThree = (RoundedDouble) random.NextDouble(); + } + } + + private static void SetSectionResults(IEnumerable sectionResults) + { + var random = new Random(21); + foreach (var sectionResult in sectionResults) + { + sectionResult.AssessmentLayerOne = Convert.ToBoolean(random.Next(0, 2)); + sectionResult.AssessmentLayerTwoA = (RoundedDouble) random.NextDouble(); + sectionResult.AssessmentLayerThree = (RoundedDouble) random.NextDouble(); + } + } + + private static void SetSectionResults(IEnumerable sectionResults) + { + var random = new Random(21); + foreach (var sectionResult in sectionResults) + { + sectionResult.AssessmentLayerOne = Convert.ToBoolean(random.Next(0, 2)); + sectionResult.AssessmentLayerTwoA = (RoundedDouble) random.NextDouble(); + sectionResult.AssessmentLayerThree = (RoundedDouble) random.NextDouble(); + } + } + + private static void SetSectionResults(IEnumerable sectionResults) + { + var random = new Random(21); + foreach (var sectionResult in sectionResults) + { + sectionResult.AssessmentLayerOne = Convert.ToBoolean(random.Next(0, 2)); + sectionResult.AssessmentLayerTwoA = (RoundedDouble) random.NextDouble(); + sectionResult.AssessmentLayerThree = (RoundedDouble) random.NextDouble(); + } + } + + private static void SetSectionResults(IEnumerable sectionResults) + { + var random = new Random(21); + foreach (var sectionResult in sectionResults) + { + var randomLayer2AResult = (AssessmentLayerTwoAResult) random.Next(0, Enum.GetValues(typeof(AssessmentLayerTwoAResult)).Length); + + sectionResult.AssessmentLayerOne = Convert.ToBoolean(random.Next(0, 2)); + sectionResult.AssessmentLayerTwoA = randomLayer2AResult; + sectionResult.AssessmentLayerThree = (RoundedDouble) random.NextDouble(); + } + } + + private static void SetSectionResults(IEnumerable sectionResults) + { + var random = new Random(21); + foreach (var sectionResult in sectionResults) + { + var randomLayer2AResult = (AssessmentLayerTwoAResult) random.Next(0, Enum.GetValues(typeof(AssessmentLayerTwoAResult)).Length); + + sectionResult.AssessmentLayerOne = Convert.ToBoolean(random.Next(0, 2)); + sectionResult.AssessmentLayerTwoA = randomLayer2AResult; + sectionResult.AssessmentLayerThree = (RoundedDouble) random.NextDouble(); + } + } + + private static void SetSectionResults(IEnumerable sectionResults) + { + var random = new Random(21); + foreach (var sectionResult in sectionResults) + { + var randomLayer2AResult = (AssessmentLayerTwoAResult) random.Next(0, Enum.GetValues(typeof(AssessmentLayerTwoAResult)).Length); + + sectionResult.AssessmentLayerOne = Convert.ToBoolean(random.Next(0, 2)); + sectionResult.AssessmentLayerTwoA = randomLayer2AResult; + sectionResult.AssessmentLayerThree = (RoundedDouble) random.NextDouble(); + } + } + + private static void SetSectionResults(IEnumerable sectionResults) + { + var random = new Random(21); + foreach (var sectionResult in sectionResults) + { + var randomLayer2AResult = (AssessmentLayerTwoAResult) random.Next(0, Enum.GetValues(typeof(AssessmentLayerTwoAResult)).Length); + + sectionResult.AssessmentLayerOne = Convert.ToBoolean(random.Next(0, 2)); + sectionResult.AssessmentLayerTwoA = randomLayer2AResult; + sectionResult.AssessmentLayerThree = (RoundedDouble) random.NextDouble(); + } + } + + private static void SetSectionResults(IEnumerable sectionResults) + { + var random = new Random(21); + foreach (var sectionResult in sectionResults) + { + var randomLayer2AResult = (AssessmentLayerTwoAResult) random.Next(0, Enum.GetValues(typeof(AssessmentLayerTwoAResult)).Length); + + sectionResult.AssessmentLayerTwoA = randomLayer2AResult; + sectionResult.AssessmentLayerThree = (RoundedDouble) random.NextDouble(); + } + } + + private static void SetSectionResults(IEnumerable sectionResults) + { + var random = new Random(21); + foreach (var sectionResult in sectionResults) + { + sectionResult.AssessmentLayerTwoA = (RoundedDouble) random.NextDouble(); + sectionResult.AssessmentLayerThree = (RoundedDouble) random.NextDouble(); + } + } + + private static void AddSections(IFailureMechanism failureMechanism) + { + failureMechanism.AddSection(new FailureMechanismSection("section 1", new[] + { + new Point2D(0, 2), + new Point2D(2, 3) + })); + failureMechanism.AddSection(new FailureMechanismSection("section 2", new[] + { + new Point2D(2, 3), + new Point2D(4, 5) + })); + failureMechanism.AddSection(new FailureMechanismSection("section 3", new[] + { + new Point2D(4, 5), + new Point2D(2, 3) + })); + } + + private static void AddForeshoreProfiles(ObservableList foreshoreProfiles) + { + foreshoreProfiles.Add(new ForeshoreProfile( + new Point2D(2, 5), new[] + { + new Point2D(1, 6), + new Point2D(8, 5), + }, new BreakWater(BreakWaterType.Caisson, 2.5), new ForeshoreProfile.ConstructionProperties + { + Name = "FP", + Orientation = 95.5, + X0 = 22.1 + })); + foreshoreProfiles.Add(new ForeshoreProfile( + new Point2D(2, 5), Enumerable.Empty(), null, new ForeshoreProfile.ConstructionProperties())); + } + + private static ReferenceLine GetReferenceLine() + { + IEnumerable points = new[] + { + new Point2D(2, 3), + new Point2D(5, 4), + new Point2D(5, 8), + new Point2D(-3, 2) + }; + + var referenceLine = new ReferenceLine(); + referenceLine.SetGeometry(points); + return referenceLine; + } + + private static HydraulicBoundaryDatabase GetHydraulicBoundaryDatabase() + { + var hydraulicBoundaryDatabase = new HydraulicBoundaryDatabase + { + FilePath = "/temp/test", + Version = "1.0" + }; + hydraulicBoundaryDatabase.Locations.Add(new HydraulicBoundaryLocation(13001, "test", 152.3, 2938.5) + { + DesignWaterLevel = (RoundedDouble) 12.4, + WaveHeight = (RoundedDouble) 2.4, + DesignWaterLevelCalculationConvergence = CalculationConvergence.NotCalculated, + WaveHeightCalculationConvergence = CalculationConvergence.NotCalculated + }); + + return hydraulicBoundaryDatabase; + } + + #region Piping FailureMechanism + private static void ConfigurePipingFailureMechanism(PipingFailureMechanism pipingFailureMechanism, AssessmentSection assessmentSection) { pipingFailureMechanism.PipingProbabilityAssessmentInput.A = 0.9; @@ -280,6 +498,53 @@ }); } + private static void SetSectionResults(IEnumerable sectionResults) + { + var random = new Random(21); + foreach (var sectionResult in sectionResults) + { + sectionResult.AssessmentLayerOne = Convert.ToBoolean(random.Next(0, 2)); + sectionResult.AssessmentLayerThree = (RoundedDouble) random.NextDouble(); + } + } + + private static RingtoetsPipingSurfaceLine GetSurfaceLine() + { + var surfaceLine = new RingtoetsPipingSurfaceLine + { + Name = "Surfaceline", + ReferenceLineIntersectionWorldPoint = new Point2D(4.0, 6.0) + }; + + var geometryPoints = new[] + { + new Point3D(6.0, 6.0, -2.3), + new Point3D(5.8, 6.0, -2.3), // Dike toe at river + new Point3D(5.6, 6.0, 3.4), + new Point3D(4.2, 6.0, 3.5), + new Point3D(4.0, 6.0, 0.5), // Dike toe at polder + new Point3D(3.8, 6.0, 0.5), // Ditch dike side + new Point3D(3.6, 6.0, 0.2), // Bottom ditch dike side + new Point3D(3.4, 6.0, 0.25), // Bottom ditch polder side + new Point3D(3.2, 6.0, 0.5), // Ditch polder side + new Point3D(3.0, 6.0, 0.5), + }; + surfaceLine.SetGeometry(geometryPoints); + + surfaceLine.SetDikeToeAtRiverAt(geometryPoints[1]); + surfaceLine.SetDikeToeAtPolderAt(geometryPoints[4]); + surfaceLine.SetDitchDikeSideAt(geometryPoints[5]); + surfaceLine.SetBottomDitchDikeSideAt(geometryPoints[6]); + surfaceLine.SetBottomDitchPolderSideAt(geometryPoints[7]); + surfaceLine.SetDitchPolderSideAt(geometryPoints[8]); + + return surfaceLine; + } + + #endregion + + #region GrassCoverErosionInwards FailureMechanism + private static void ConfigureGrassCoverErosionInwardsFailureMechanism(GrassCoverErosionInwardsFailureMechanism failureMechanism, IAssessmentSection assessmentSection) { @@ -364,6 +629,28 @@ }); } + private static void SetSectionResults(IEnumerable sectionResults, IEnumerable calculations) + { + var random = new Random(21); + bool firstSectionResultHasCalculation = false; + var grassCoverErosionInwardsCalculation = calculations.First(); + + foreach (var sectionResult in sectionResults) + { + sectionResult.AssessmentLayerOne = Convert.ToBoolean(random.Next(0, 2)); + sectionResult.AssessmentLayerThree = (RoundedDouble) random.NextDouble(); + if (!firstSectionResultHasCalculation) + { + sectionResult.Calculation = grassCoverErosionInwardsCalculation; + firstSectionResultHasCalculation = true; + } + } + } + + #endregion + + #region GrassCoverErosionOutwards FailureMechanism + private static void ConfigureGrassCoverErosionOutwardsFailureMechanism(GrassCoverErosionOutwardsFailureMechanism failureMechanism) { failureMechanism.GeneralInput.N = 15; @@ -378,18 +665,23 @@ }); } - private static void ConfigureWaveImpactAsphaltCoverFailureMechanism(WaveImpactAsphaltCoverFailureMechanism failureMechanism) + private static void SetSectionResults(IEnumerable sectionResults) { - failureMechanism.WaveConditionsCalculationGroup.Children.Add(new CalculationGroup + var random = new Random(21); + foreach (var sectionResult in sectionResults) { - Name = "GCEO A", - }); - failureMechanism.WaveConditionsCalculationGroup.Children.Add(new CalculationGroup - { - Name = "GCEO A" - }); + var randomLayer2AResult = (AssessmentLayerTwoAResult) random.Next(0, Enum.GetValues(typeof(AssessmentLayerTwoAResult)).Length); + + sectionResult.AssessmentLayerOne = Convert.ToBoolean(random.Next(0, 2)); + sectionResult.AssessmentLayerTwoA = randomLayer2AResult; + sectionResult.AssessmentLayerThree = (RoundedDouble) random.NextDouble(); + } } + #endregion + + #region StabilityStoneCover FailureMechanism + private static void ConfigureStabilityStoneCoverFailureMechanism(StabilityStoneCoverFailureMechanism failureMechanism, IAssessmentSection assessmentSection) { ForeshoreProfile foreshoreProfile = failureMechanism.ForeshoreProfiles[0]; @@ -419,7 +711,14 @@ UpperBoundaryWaterLevels = (RoundedDouble) 15.3, LowerBoundaryWaterLevels = (RoundedDouble) (-2.4), StepSize = WaveConditionsInputStepSize.Two - } + }, + Output = new StabilityStoneCoverWaveConditionsOutput(new[] + { + new WaveConditionsOutput(1, 2, 3, 4) + }, new[] + { + new WaveConditionsOutput(2, 3, 4, 5) + }) } } }); @@ -438,332 +737,67 @@ HydraulicBoundaryLocation = assessmentSection.HydraulicBoundaryDatabase.Locations[0], BreakWater = { - Height = (RoundedDouble)(foreshoreProfile.BreakWater.Height + 0.1), - Type = BreakWaterType.Dam + Height = (RoundedDouble) (foreshoreProfile.BreakWater.Height + 0.1), + Type = BreakWaterType.Dam }, Orientation = foreshoreProfile.Orientation, UseForeshore = false, UseBreakWater = false, - UpperBoundaryRevetment = (RoundedDouble)12.3, - LowerBoundaryRevetment = (RoundedDouble)(-3.5), - UpperBoundaryWaterLevels = (RoundedDouble)13.3, - LowerBoundaryWaterLevels = (RoundedDouble)(-1.9), + UpperBoundaryRevetment = (RoundedDouble) 12.3, + LowerBoundaryRevetment = (RoundedDouble) (-3.5), + UpperBoundaryWaterLevels = (RoundedDouble) 13.3, + LowerBoundaryWaterLevels = (RoundedDouble) (-1.9), StepSize = WaveConditionsInputStepSize.One - } + }, + Output = new StabilityStoneCoverWaveConditionsOutput(new[] + { + new WaveConditionsOutput(5, 6, 7, 8) + }, new[] + { + new WaveConditionsOutput(7, 4, 1, 2) + }) }); } - private static void SetSectionResults(IEnumerable sectionResults) + private static void SetSectionResults(IEnumerable sectionResults) { var random = new Random(21); foreach (var sectionResult in sectionResults) { - sectionResult.AssessmentLayerOne = Convert.ToBoolean(random.Next(0, 2)); - sectionResult.AssessmentLayerThree = (RoundedDouble) random.NextDouble(); - } - } - - private static void SetSectionResults(IEnumerable sectionResults, IEnumerable calculations) - { - var random = new Random(21); - bool firstSectionResultHasCalculation = false; - var grassCoverErosionInwardsCalculation = calculations.First(); - - foreach (var sectionResult in sectionResults) - { - sectionResult.AssessmentLayerOne = Convert.ToBoolean(random.Next(0, 2)); - sectionResult.AssessmentLayerThree = (RoundedDouble) random.NextDouble(); - if (!firstSectionResultHasCalculation) - { - sectionResult.Calculation = grassCoverErosionInwardsCalculation; - firstSectionResultHasCalculation = true; - } - } - } - - private static void SetSectionResults(IEnumerable sectionResults) - { - var random = new Random(21); - foreach (var sectionResult in sectionResults) - { - sectionResult.AssessmentLayerOne = Convert.ToBoolean(random.Next(0, 2)); - sectionResult.AssessmentLayerThree = (RoundedDouble) random.NextDouble(); - } - } - - private static void SetSectionResults(IEnumerable sectionResults) - { - var random = new Random(21); - foreach (var sectionResult in sectionResults) - { - sectionResult.AssessmentLayerOne = Convert.ToBoolean(random.Next(0, 2)); - sectionResult.AssessmentLayerThree = (RoundedDouble) random.NextDouble(); - } - } - - private static void SetSectionResults(IEnumerable sectionResults) - { - var random = new Random(21); - foreach (var sectionResult in sectionResults) - { - sectionResult.AssessmentLayerOne = Convert.ToBoolean(random.Next(0, 2)); - sectionResult.AssessmentLayerThree = (RoundedDouble) random.NextDouble(); - } - } - - private static void SetSectionResults(IEnumerable sectionResults) - { - var random = new Random(21); - foreach (var sectionResult in sectionResults) - { - sectionResult.AssessmentLayerOne = Convert.ToBoolean(random.Next(0, 2)); - sectionResult.AssessmentLayerThree = (RoundedDouble) random.NextDouble(); - } - } - - private static void SetSectionResults(IEnumerable sectionResults) - { - var random = new Random(21); - foreach (var sectionResult in sectionResults) - { - sectionResult.AssessmentLayerOne = Convert.ToBoolean(random.Next(0, 2)); - sectionResult.AssessmentLayerTwoA = (RoundedDouble) random.NextDouble(); - sectionResult.AssessmentLayerThree = (RoundedDouble) random.NextDouble(); - } - } - - private static void SetSectionResults(IEnumerable sectionResults) - { - var random = new Random(21); - foreach (var sectionResult in sectionResults) - { - sectionResult.AssessmentLayerOne = Convert.ToBoolean(random.Next(0, 2)); - sectionResult.AssessmentLayerTwoA = (RoundedDouble) random.NextDouble(); - sectionResult.AssessmentLayerThree = (RoundedDouble) random.NextDouble(); - } - } - - private static void SetSectionResults(IEnumerable sectionResults) - { - var random = new Random(21); - foreach (var sectionResult in sectionResults) - { - sectionResult.AssessmentLayerOne = Convert.ToBoolean(random.Next(0, 2)); - sectionResult.AssessmentLayerTwoA = (RoundedDouble) random.NextDouble(); - sectionResult.AssessmentLayerThree = (RoundedDouble) random.NextDouble(); - } - } - - private static void SetSectionResults(IEnumerable sectionResults) - { - var random = new Random(21); - foreach (var sectionResult in sectionResults) - { - sectionResult.AssessmentLayerOne = Convert.ToBoolean(random.Next(0, 2)); - sectionResult.AssessmentLayerTwoA = (RoundedDouble) random.NextDouble(); - sectionResult.AssessmentLayerThree = (RoundedDouble) random.NextDouble(); - } - } - - private static void SetSectionResults(IEnumerable sectionResults) - { - var random = new Random(21); - foreach (var sectionResult in sectionResults) - { var randomLayer2AResult = (AssessmentLayerTwoAResult) random.Next(0, Enum.GetValues(typeof(AssessmentLayerTwoAResult)).Length); - sectionResult.AssessmentLayerOne = Convert.ToBoolean(random.Next(0, 2)); sectionResult.AssessmentLayerTwoA = randomLayer2AResult; sectionResult.AssessmentLayerThree = (RoundedDouble) random.NextDouble(); } } - private static void SetSectionResults(IEnumerable sectionResults) - { - var random = new Random(21); - foreach (var sectionResult in sectionResults) - { - var randomLayer2AResult = (AssessmentLayerTwoAResult) random.Next(0, Enum.GetValues(typeof(AssessmentLayerTwoAResult)).Length); + #endregion - sectionResult.AssessmentLayerOne = Convert.ToBoolean(random.Next(0, 2)); - sectionResult.AssessmentLayerTwoA = randomLayer2AResult; - sectionResult.AssessmentLayerThree = (RoundedDouble) random.NextDouble(); - } - } + #region WaveImpactAsphaltCover FailureMechanism - private static void SetSectionResults(IEnumerable sectionResults) + private static void ConfigureWaveImpactAsphaltCoverFailureMechanism(WaveImpactAsphaltCoverFailureMechanism failureMechanism) { - var random = new Random(21); - foreach (var sectionResult in sectionResults) + failureMechanism.WaveConditionsCalculationGroup.Children.Add(new CalculationGroup { - var randomLayer2AResult = (AssessmentLayerTwoAResult) random.Next(0, Enum.GetValues(typeof(AssessmentLayerTwoAResult)).Length); - - sectionResult.AssessmentLayerOne = Convert.ToBoolean(random.Next(0, 2)); - sectionResult.AssessmentLayerTwoA = randomLayer2AResult; - sectionResult.AssessmentLayerThree = (RoundedDouble) random.NextDouble(); - } - } - - private static void SetSectionResults(IEnumerable sectionResults) - { - var random = new Random(21); - foreach (var sectionResult in sectionResults) + Name = "GCEO A", + }); + failureMechanism.WaveConditionsCalculationGroup.Children.Add(new CalculationGroup { - var randomLayer2AResult = (AssessmentLayerTwoAResult) random.Next(0, Enum.GetValues(typeof(AssessmentLayerTwoAResult)).Length); - - sectionResult.AssessmentLayerOne = Convert.ToBoolean(random.Next(0, 2)); - sectionResult.AssessmentLayerTwoA = randomLayer2AResult; - sectionResult.AssessmentLayerThree = (RoundedDouble) random.NextDouble(); - } + Name = "GCEO A" + }); } - private static void SetSectionResults(IEnumerable sectionResults) + private static void SetSectionResults(IEnumerable sectionResults) { var random = new Random(21); foreach (var sectionResult in sectionResults) { - var randomLayer2AResult = (AssessmentLayerTwoAResult) random.Next(0, Enum.GetValues(typeof(AssessmentLayerTwoAResult)).Length); - sectionResult.AssessmentLayerOne = Convert.ToBoolean(random.Next(0, 2)); - sectionResult.AssessmentLayerTwoA = randomLayer2AResult; - sectionResult.AssessmentLayerThree = (RoundedDouble) random.NextDouble(); - } - } - - private static void SetSectionResults(IEnumerable sectionResults) - { - var random = new Random(21); - foreach (var sectionResult in sectionResults) - { - var randomLayer2AResult = (AssessmentLayerTwoAResult) random.Next(0, Enum.GetValues(typeof(AssessmentLayerTwoAResult)).Length); - - sectionResult.AssessmentLayerTwoA = randomLayer2AResult; - sectionResult.AssessmentLayerThree = (RoundedDouble) random.NextDouble(); - } - } - - private static void SetSectionResults(IEnumerable sectionResults) - { - var random = new Random(21); - foreach (var sectionResult in sectionResults) - { - var randomLayer2AResult = (AssessmentLayerTwoAResult) random.Next(0, Enum.GetValues(typeof(AssessmentLayerTwoAResult)).Length); - - sectionResult.AssessmentLayerTwoA = randomLayer2AResult; - sectionResult.AssessmentLayerThree = (RoundedDouble) random.NextDouble(); - } - } - - private static void SetSectionResults(IEnumerable sectionResults) - { - var random = new Random(21); - foreach (var sectionResult in sectionResults) - { sectionResult.AssessmentLayerTwoA = (RoundedDouble) random.NextDouble(); sectionResult.AssessmentLayerThree = (RoundedDouble) random.NextDouble(); } } - private static void AddSections(IFailureMechanism failureMechanism) - { - failureMechanism.AddSection(new FailureMechanismSection("section 1", new[] - { - new Point2D(0, 2), - new Point2D(2, 3) - })); - failureMechanism.AddSection(new FailureMechanismSection("section 2", new[] - { - new Point2D(2, 3), - new Point2D(4, 5) - })); - failureMechanism.AddSection(new FailureMechanismSection("section 3", new[] - { - new Point2D(4, 5), - new Point2D(2, 3) - })); - } - - private static void AddForeshoreProfiles(ObservableList foreshoreProfiles) - { - foreshoreProfiles.Add(new ForeshoreProfile( - new Point2D(2, 5), new[] - { - new Point2D(1, 6), - new Point2D(8, 5), - }, new BreakWater(BreakWaterType.Caisson, 2.5), new ForeshoreProfile.ConstructionProperties - { - Name = "FP", - Orientation = 95.5, - X0 = 22.1 - })); - foreshoreProfiles.Add(new ForeshoreProfile( - new Point2D(2, 5), Enumerable.Empty(), null, new ForeshoreProfile.ConstructionProperties())); - } - - private static RingtoetsPipingSurfaceLine GetSurfaceLine() - { - var surfaceLine = new RingtoetsPipingSurfaceLine - { - Name = "Surfaceline", - ReferenceLineIntersectionWorldPoint = new Point2D(4.0, 6.0) - }; - - var geometryPoints = new[] - { - new Point3D(6.0, 6.0, -2.3), - new Point3D(5.8, 6.0, -2.3), // Dike toe at river - new Point3D(5.6, 6.0, 3.4), - new Point3D(4.2, 6.0, 3.5), - new Point3D(4.0, 6.0, 0.5), // Dike toe at polder - new Point3D(3.8, 6.0, 0.5), // Ditch dike side - new Point3D(3.6, 6.0, 0.2), // Bottom ditch dike side - new Point3D(3.4, 6.0, 0.25), // Bottom ditch polder side - new Point3D(3.2, 6.0, 0.5), // Ditch polder side - new Point3D(3.0, 6.0, 0.5), - }; - surfaceLine.SetGeometry(geometryPoints); - - surfaceLine.SetDikeToeAtRiverAt(geometryPoints[1]); - surfaceLine.SetDikeToeAtPolderAt(geometryPoints[4]); - surfaceLine.SetDitchDikeSideAt(geometryPoints[5]); - surfaceLine.SetBottomDitchDikeSideAt(geometryPoints[6]); - surfaceLine.SetBottomDitchPolderSideAt(geometryPoints[7]); - surfaceLine.SetDitchPolderSideAt(geometryPoints[8]); - - return surfaceLine; - } - - private static ReferenceLine GetReferenceLine() - { - IEnumerable points = new[] - { - new Point2D(2, 3), - new Point2D(5, 4), - new Point2D(5, 8), - new Point2D(-3, 2) - }; - - var referenceLine = new ReferenceLine(); - referenceLine.SetGeometry(points); - return referenceLine; - } - - private static HydraulicBoundaryDatabase GetHydraulicBoundaryDatabase() - { - var hydraulicBoundaryDatabase = new HydraulicBoundaryDatabase - { - FilePath = "/temp/test", - Version = "1.0" - }; - hydraulicBoundaryDatabase.Locations.Add(new HydraulicBoundaryLocation(13001, "test", 152.3, 2938.5) - { - DesignWaterLevel = (RoundedDouble) 12.4, - WaveHeight = (RoundedDouble) 2.4, - DesignWaterLevelCalculationConvergence = CalculationConvergence.NotCalculated, - WaveHeightCalculationConvergence = CalculationConvergence.NotCalculated - }); - - return hydraulicBoundaryDatabase; - } + #endregion } } \ No newline at end of file