// Copyright (C) Stichting Deltares 2025. All rights reserved. // // This file is part of the application DAM - UI. // // DAM - UI 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.Collections.Generic; using System.Drawing; using Components.Persistence.Stability.Version2.Data; namespace Deltares.Dam.StixFileReader.Tests; /// /// Factory for creates a simple . /// public class PersistableDataModelFactory { /// /// Factory for creating a simple . /// /// public static PersistableDataModel CreateSimpleDataModelWithMultipleScenarioAndStages() { return new PersistableDataModel { Scenarios = new List { new() { Stages = new List { new() { GeometryId = "11" }, new() { GeometryId = "12" } } }, new() { Stages = new List { new() { GeometryId = "21" }, new() { GeometryId = "22" } } } }, Geometry = new List { new() { Id = "22", Layers = new List { new() { Id = "44", Points = new List { new(-500, -100), new(-500, 100), new(500, 100), new(500, -100) } } } } }, SoilLayers = new List { new() { SoilLayers = new List { new() { SoilId = "33", LayerId = "44" } } } }, Soils = new PersistableSoilCollection { Soils = new List { new() { Id = "33" } } }, SoilVisualizations = new PersistableSoilVisualizationCollection { SoilVisualizations = new List() } }; } /// /// Factory for creating a simple . /// /// public static PersistableDataModel CreateSimpleDataModelWithMultipleLayers() { return new PersistableDataModel { Scenarios = new List { new() { Stages = new List { new() { GeometryId = "15", SoilLayersId = "20" } } } }, Geometry = new List { new() { Id = "15", Layers = new List { new() { Id = "16", Points = new List { new(12, -5), new(12, 5), new(15, 5), new(15, -5) } }, new() { Id = "17", Points = new List { new(10, -10), new(10, 10), new(20, 10), new(20, -10) } }, new() { Id = "18", Points = new List { new(15, 5), new(18, 5), new(18, -5), new(15, 5) } } } } }, SoilLayers = new List { new() { Id = "20", SoilLayers = new List { new() { LayerId = "16", SoilId = "12" }, new() { LayerId = "17", SoilId = "13" }, new() { LayerId = "18", SoilId = "7" } } } }, Soils = new PersistableSoilCollection { Soils = new List { new() { Id = "7" }, new() { Id = "12" }, new() { Id = "13" } } }, SoilVisualizations = new PersistableSoilVisualizationCollection { SoilVisualizations = new List { new() { SoilId = "7", Color = ColorTranslator.FromHtml("#80657F22") }, new() { SoilId = "12", Color = ColorTranslator.FromHtml("#80FFCC00") }, new() { SoilId = "13", Color = ColorTranslator.FromHtml("#80BB8800") } } } }; } /// /// |-----------------------------------------------------------------| /// | | /// | |---------------------| |---------------------| | /// | | | | | | /// | | |----------| | | | | /// | | | | | | | | /// | | | | | | | | /// | | |----------| | | | | /// | | | | | | /// | |---------------------| |---------------------| | /// | | /// |-----------------------------------------------------------------| /// /// /// Factory for creating a simple containing several inner loops, /// including an inner loop inside an inner loop. /// /// public static PersistableDataModel CreateSimpleDataModelWithInnerLoops() { return new PersistableDataModel { Scenarios = new List { new() { Stages = new List { new() { GeometryId = "15", SoilLayersId = "20" } } } }, Geometry = new List { new() { Id = "15", Layers = new List { new() { Id = "16", Points = new List { new(10, -5), new(10, 5), new(60, 5), new(60, -5) } }, new() { Id = "17", Points = new List { new(20, -4), new(20, 4), new(30, 4), new(30, -4) } }, new() { Id = "18", Points = new List { new(40, 4), new(40, -4), new(50, -4), new(50, 4) } }, new() { Id = "19", Points = new List { new(21, 3), new(21, -3), new(29, -3), new(29, 3) } } } } }, SoilLayers = new List { new() { Id = "20", SoilLayers = new List { new() { LayerId = "16", SoilId = "12" }, new() { LayerId = "17", SoilId = "13" }, new() { LayerId = "18", SoilId = "7" }, new() { LayerId = "19", SoilId = "12" } } } }, Soils = new PersistableSoilCollection { Soils = new List { new() { Id = "7" }, new() { Id = "12" }, new() { Id = "13" } } }, SoilVisualizations = new PersistableSoilVisualizationCollection { SoilVisualizations = new List { new() { SoilId = "7", Color = ColorTranslator.FromHtml("#80657F22") }, new() { SoilId = "12", Color = ColorTranslator.FromHtml("#80FFCC00") }, new() { SoilId = "13", Color = ColorTranslator.FromHtml("#80BB8800") } } } }; } /// /// |-----------------------------------------------------------------| /// | | /// | bottom of layer 2 | /// | |---------------------| | /// | | | | /// | layer 2 | | | /// | | | | /// | | layer 3 | | /// | | | | /// | | | | /// | | | | /// |-----------------|---------------------|-------------------------| /// | layer 1 | /// |-----------------------------------------------------------------| /// /// /// Factory for creating a simple containing a layer /// for which all the points are also in another surrounding layer, /// but it is not an inner loop. /// /// public static PersistableDataModel CreateSimpleDataModelWithLayerThatIsNotAnInnerLoop() { return new PersistableDataModel { Scenarios = new List { new() { Stages = new List { new() { GeometryId = "15", SoilLayersId = "20" } } } }, Geometry = new List { new() { Id = "15", Layers = new List { new() { Id = "16", Points = new List { new(10, -6), new(10, -5), new(60, -5), new(60, -6) } }, new() { Id = "17", Points = new List { new(10, -5), new(10, 5), new(60, 5), new(60, -5), new(30, -5), new(30, 4), new(20, 4), new(20, -5) } }, new() { Id = "18", Points = new List { new(20, -5), new(20, 4), new(30, 4), new(30, -5) } } } } }, SoilLayers = new List { new() { Id = "20", SoilLayers = new List { new() { LayerId = "16", SoilId = "12" }, new() { LayerId = "17", SoilId = "13" }, new() { LayerId = "18", SoilId = "7" } } } }, Soils = new PersistableSoilCollection { Soils = new List { new() { Id = "7" }, new() { Id = "12" }, new() { Id = "13" } } }, SoilVisualizations = new PersistableSoilVisualizationCollection { SoilVisualizations = new List { new() { SoilId = "7", Color = ColorTranslator.FromHtml("#80657F22") }, new() { SoilId = "12", Color = ColorTranslator.FromHtml("#80FFCC00") }, new() { SoilId = "13", Color = ColorTranslator.FromHtml("#80BB8800") } } } }; } }