// Copyright (C) Stichting Deltares 2019. All rights reserved. // // This file is part of the application DAM - Clients Library. // // 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.ComponentModel; using Deltares.Standard; using Deltares.Standard.Attributes; using Deltares.Standard.EventPublisher; namespace Deltares.Dam.Data { public class RWResult : IVisibleEnabled { private RWResultType _rwResultType = RWResultType.ProbabilityOfFailure; private double safetyFactor = -1; private double probabilityOfFailure = -1; private CalculationResult calculationResult = CalculationResult.NoRun; private ResultEvaluation resultEvaluation = ResultEvaluation.NotEvaluated; private string notes = ""; public const string ResultCategory = "Results"; public RWResult() { } [Browsable(false)] [Label("Result type")] public virtual RWResultType RwResultType { get { return _rwResultType; } set { _rwResultType = value; } } [ReadOnly(true)] [Label("Safety factor")] [Format("F3")] [PropertyOrder(1, 1)] [Category(ResultCategory)] public virtual double SafetyFactor { get { return safetyFactor; } set { safetyFactor = value; } } [ReadOnly(true)] [Label("Probability of failure")] [Format("F3")] [PropertyOrder(1, 2)] [Category(ResultCategory)] public virtual double ProbabilityOfFailure { get { return probabilityOfFailure; } set { probabilityOfFailure = value; } } [ReadOnly(true)] [Label("Calculation result")] [PropertyOrder(1,0)] [Category(ResultCategory)] public virtual CalculationResult CalculationResult { get { return calculationResult; } set { calculationResult = value; } } [Label("Evaluation")] [PropertyOrder(5, 1)] [Category(ResultCategory)] public ResultEvaluation ResultEvaluation { get { return resultEvaluation; } set { DataEventPublisher.BeforeChange(this, "ResultEvaluation"); resultEvaluation = value; DataEventPublisher.AfterChange(this, "ResultEvaluation"); } } [Label("Notes")] [Description("Use this area to explain the valuation and for any further remarks")] [PropertyOrder(5, 2)] [Category(ResultCategory)] public string Notes { get { return notes; } set { DataEventPublisher.BeforeChange(this, "Notes"); notes = value; DataEventPublisher.AfterChange(this, "Notes"); } } #region IVisibleEnabled Members public bool IsEnabled(string property) { return true; } public bool IsVisible(string property) { switch (property) { case "SafetyFactor": return RwResultType == RWResultType.SafetyFactor; case "ProbabilityOfFailure": return RwResultType == RWResultType.ProbabilityOfFailure; default : return true; } } #endregion } }