|
| 1 | +/* |
| 2 | + * This file is part of the Buildings and Habitats object Model (BHoM) |
| 3 | + * Copyright (c) 2015 - 2023, the respective contributors. All rights reserved. |
| 4 | + * |
| 5 | + * Each contributor holds copyright over their respective contributions. |
| 6 | + * The project versioning (Git) records all such contribution source information. |
| 7 | + * |
| 8 | + * |
| 9 | + * The BHoM is free software: you can redistribute it and/or modify |
| 10 | + * it under the terms of the GNU Lesser General Public License as published by |
| 11 | + * the Free Software Foundation, either version 3.0 of the License, or |
| 12 | + * (at your option) any later version. |
| 13 | + * |
| 14 | + * The BHoM is distributed in the hope that it will be useful, |
| 15 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 17 | + * GNU Lesser General Public License for more details. |
| 18 | + * |
| 19 | + * You should have received a copy of the GNU Lesser General Public License |
| 20 | + * along with this code. If not, see <https://www.gnu.org/licenses/lgpl-3.0.html>. |
| 21 | + */ |
| 22 | + |
| 23 | +using System; |
| 24 | +using System.Collections.Generic; |
| 25 | +using System.ComponentModel; |
| 26 | +using System.Linq; |
| 27 | +using BH.oM.Base.Attributes; |
| 28 | +using BH.oM.Geometry; |
| 29 | +using BH.oM.Geometry.CoordinateSystem; |
| 30 | +using BH.oM.Ground; |
| 31 | +using BH.Engine.Base; |
| 32 | +using BH.Engine.Geometry; |
| 33 | + |
| 34 | +namespace BH.Engine.Ground |
| 35 | +{ |
| 36 | + public static partial class Create |
| 37 | + { |
| 38 | + /***************************************************/ |
| 39 | + /**** Public Methods ****/ |
| 40 | + /***************************************************/ |
| 41 | + |
| 42 | + [Description("Creates a Stratum element based on its strata, descriptions and optional geological properties. The lists must be of equal length.")] |
| 43 | + [Input("id", "Location identifier for the borehole unique to the project (LOCA_ID).")] |
| 44 | + [Input("top", "Depth to the top of the strata based on the datum provided on the Borehole (GEOL_TOP).")] |
| 45 | + [Input("bottom", "Depth to the bottom of the strata based on the datum provided on the Borehole (GEOL_BOT).")] |
| 46 | + [Input("logDescription", "General descriptions for each strata (GEOL_DESC).")] |
| 47 | + [Input("legend", "Legend codes summarising the LogDescription (GEOL_LEG).")] |
| 48 | + [Input("observedGeology", "Observed geologies expressed as a GeologicalUnit (GEOL_GEOL).")] |
| 49 | + [Input("interpretedGeology", "Interpreted geologies expressed as an EngineeringMaterial (GEOL_GEO2).")] |
| 50 | + [Input("optionalInterpretedGeology", "The optional interpreted geology expressed as an EngineeringMaterial(GEOL_GEO3).")] |
| 51 | + [Input("blankGeology", "The geology to use where blank spaces occur in the observedGeology parameter.")] |
| 52 | + [Input("properties", "A list of properties related to the borehole.")] |
| 53 | + [Output("stratum", "Stratum object containing information for each strata including descriptions, legend codes and optional geological properties.")] |
| 54 | + public static Stratum Stratum(string id, double top, double bottom, string logDescription, string legend, |
| 55 | + string observedGeology, string interpretedGeology = "", string optionalInterpretedGeology = "", string blankGeology = "", List<IStratumProperty> properties = null) |
| 56 | + { |
| 57 | + if(id == "") |
| 58 | + { |
| 59 | + Base.Compute.RecordError("The id identifying the borehole is empty. The strata will not be referenced to a borehole."); |
| 60 | + return null; |
| 61 | + } |
| 62 | + |
| 63 | + if (logDescription.Trim() == "") |
| 64 | + { |
| 65 | + Base.Compute.RecordError("The LogDescription is empty."); |
| 66 | + return null; |
| 67 | + } |
| 68 | + |
| 69 | + if (!blankGeology.Trim().IsNullOrEmpty()) |
| 70 | + { |
| 71 | + if (observedGeology.Trim().IsNullOrEmpty()) |
| 72 | + observedGeology = blankGeology; |
| 73 | + } |
| 74 | + |
| 75 | + return new Stratum() |
| 76 | + { |
| 77 | + Id = id, |
| 78 | + Top = top, |
| 79 | + Bottom = bottom, |
| 80 | + LogDescription = logDescription, |
| 81 | + Legend = legend, |
| 82 | + ObservedGeology = observedGeology, |
| 83 | + InterpretedGeology = interpretedGeology, |
| 84 | + OptionalInterpretedGeology = optionalInterpretedGeology, |
| 85 | + Properties = properties |
| 86 | + }; |
| 87 | + } |
| 88 | + |
| 89 | + /***************************************************/ |
| 90 | + } |
| 91 | +} |
| 92 | + |
| 93 | + |
| 94 | + |
| 95 | + |
0 commit comments