// Copyright (C) Stichting Deltares 2018. 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 Core.Common.Base; using Ringtoets.Common.Data.Properties; namespace Ringtoets.Common.Data.Hydraulics { /// /// The data object for the hydraulic boundary database. /// public class HydraulicBoundaryDatabase : Observable { private bool canUsePreprocessor; private bool usePreprocessor; private string preprocessorDirectory; /// /// Creates a new instance of . /// /// is set to false. public HydraulicBoundaryDatabase() { CanUsePreprocessor = false; Locations = new ObservableList(); HydraulicLocationConfigurationSettings = new HydraulicLocationConfigurationSettings(); } /// /// Gets or sets the path to the hydraulic boundary database file. /// public string FilePath { get; set; } /// /// Gets or sets the version of the hydraulic boundary database. /// public string Version { get; set; } /// /// Gets the hydraulic boundary locations. /// public ObservableList Locations { get; } /// /// Gets or sets a value indicating whether the Hydra-Ring preprocessor can be used. /// /// When setting this property to false, both /// and are reset. public bool CanUsePreprocessor { get { return canUsePreprocessor; } set { canUsePreprocessor = value; if (!canUsePreprocessor) { usePreprocessor = false; preprocessorDirectory = null; } } } /// /// Gets or sets a value indicating whether the Hydra-Ring preprocessor must be used. /// /// Thrown when set while is false. public bool UsePreprocessor { get { return usePreprocessor; } set { if (!CanUsePreprocessor) { throw new InvalidOperationException($"{nameof(CanUsePreprocessor)} is false."); } usePreprocessor = value; } } /// /// Gets or sets the Hydra-Ring preprocessor directory. /// /// Thrown when set while is false. /// Thrown when setting a value that matches . public string PreprocessorDirectory { get { return preprocessorDirectory; } set { if (!CanUsePreprocessor) { throw new InvalidOperationException($"{nameof(CanUsePreprocessor)} is false."); } if (string.IsNullOrWhiteSpace(value)) { throw new ArgumentException(Resources.HydraulicBoundaryDatabase_PreprocessorDirectory_Path_must_have_a_value); } preprocessorDirectory = value; } } /// /// Gets the . /// public HydraulicLocationConfigurationSettings HydraulicLocationConfigurationSettings { get; } } }