// Copyright (C) Stichting Deltares 2017. All rights reserved. // // This file is part of the Dam Engine. // // The Dam Engine is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero 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 Affero General Public License for more details. // // You should have received a copy of the GNU Affero 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 System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.Net.Mime; using System.Xml.Serialization; using Deltares.DamEngine.Data.Geometry; using Deltares.DamEngine.Data.Geotechnics; using Deltares.DamEngine.Data.Standard; using Deltares.DamEngine.Data.Standard.Calculation; using Deltares.DamEngine.Data.Standard.Language; using Deltares.DamEngine.Data.Standard.Logging; using Deltares.DamEngine.Data.Standard.Validation; //using XmlSerializer = Deltares.Standard.IO.Xml.XmlSerializer; namespace Deltares.DamEngine.Calculators.Stability { public class MStabProject : ICloneable, IDisposable { public MStabProject Clone() { throw new NotImplementedException(); } public void Dispose() { throw new NotImplementedException(); } } // public class MStabProject : Project, ICloneable, IDisposable // { // public bool IsApplicationCreated; // private List messages = new List(); // // private string originalStiFileName; // private CalculationResult result = CalculationResult.NoRun; // private StabilityModel stabilityModel; //Object of DefinitionModel // // public Func GetGeometryImage; // // //public MStabProject(ICoordinateSystem coordinateSystem) // public MStabProject() // { // originalStiFileName = ""; // // Stability = new StabilityModel(); // // DataEventPublisher.OnAfterChange += DataEventPublisher_OnAfterChange; // } // // // [Label("GeometryPicture")] // [Description("GeometryPicture")] // public MediaTypeNames.Image GeometryPicture // { // get // { // return GetGeometryImage(); // } // } // // [XmlCategory("Identification")] // public string OriginalStiFileName // { // get // { // return originalStiFileName; // } // set // { // originalStiFileName = value; // } // } // // /// // /// //Object of SoilModel // /// // [XmlCategory("Input")] // [XmlElement("Soils")] // [Validate] // public SoilModel SoilModel // { // get // { // return stabilityModel.SoilModel; // } // } // // /// // /// Object of GeometryData // /// // [XmlCategory("Input")] // public GeometryData Geometry // { // get // { // return stabilityModel != null && stabilityModel.SoilProfile1D != null ? stabilityModel.SoilProfile1D.Geometry : null; // } // } // // /// // /// Object of WaternetData // /// // [XmlCategory("Input")] // [XmlElement("WaternetData")] // public GeotechnicsModel Geotechnics // { // get // { // return stabilityModel.GeotechnicsData; // } // } // // /// // /// Object of DefinitionModel // /// // [XmlCategory("Input")] // [XmlElement("Definitions")] // [Validate] // public StabilityModel Stability // { // get // { // return stabilityModel; // } // set // { // if (stabilityModel != null && !ReferenceEquals(stabilityModel, value) && // value != null) // Hack: StabilityCalculation sets this property to null so it can claim owner ship of StabilityModel // { // Stability.Dispose(); // } // stabilityModel = value; // // Soil.SoilPropertyManager = stabilityModel; // } // } // // public void SetStabilityModel(StabilityModel newStabilityModel) // { // stabilityModel = newStabilityModel; // // Soil.SoilPropertyManager = stabilityModel; // } // // /// // /// Units manager object // /// // [XmlCategory("Input")] // public UnitsManager Units // { // get // { // return UnitsManager.Units; // } // } // // [XmlCategory("Output")] // public CalculationResult Result // { // get // { // return result; // } // set // { // if (result != value) // { // DataEventPublisher.BeforeChange(this, "Result"); // result = value; // DataEventPublisher.AfterChange(this, "Result"); // } // } // } // // [XmlCategory("Output")] // [Impact(Impact.Descriptive)] // [XmlIgnore] // public SlidingModel SlidingData // { // get // { // return stabilityModel != null ? stabilityModel.SlidingModel : null; // } // set // { // if (stabilityModel != null) // { // if (value != stabilityModel.SlidingModel) // { // DataEventPublisher.BeforeChange(this, "SlidingData"); // // stabilityModel.SlidingModel = value; // // if (stabilityModel.SlidingModel == null) // { // Result = CalculationResult.NoRun; // } // // DataEventPublisher.AfterChange(this, "SlidingCurve"); // to force update in UI // DataEventPublisher.AfterChange(this, "SlidingData"); // DataEventPublisher.AfterChange(this, "RestProfile"); // DataEventPublisher.AfterChange(this, "SafeProfile"); // } // } // } // } // // [XmlIgnore] // [Browsable(false)] // [Impact(Impact.None)] // public SlidingCurve SlidingCurve // { // get // { // return SlidingData != null ? MinimumSafetyCurve : null; // } // } // // [Impact(Impact.None)] // public RestProfile RestProfile // { // get // { // return SlidingData != null ? SlidingData.RestProfile : null; // } // } // // [Impact(Impact.None)] // public SafeProfile SafeProfile // { // get // { // return SlidingData != null ? SlidingData.SafeProfile : null; // } // } // // [XmlIgnore] // [ReadOnly(true)] // [Translation("Slices")] // public IList MinimumSafetySlices // { // get // { // if (SlidingData != null && SlidingData.CurrentZone != null && MinimumSafetyCurve != null) // { // return MinimumSafetyCurve.Slices; // } // else // { // return new List(); // } // } // } // // [Validate] // public IGeometryModel GeometryDataModel // { // get // { // return Geometry; // } // } // // [Validate] // public IGeometryModel WaternetDataModel // { // get // { // return stabilityModel.GeotechnicsData; // } // } // // public List Messages // { // get // { // return messages; // } // } // // public List GetMStabModels() // { // var models = new List() // { // this, Geometry, SoilModel, WaternetDataModel, // stabilityModel, stabilityModel.ConsolidationMatrix, SlidingData // }; // // return models; // } // // public void ProcessResults(string inputString) // { // var deserializer = new XmlDeserializer(); // try // { // MStabProject newProject = null; // DataEventPublisher.InvokeWithoutPublishingEvents(() => { newProject = (MStabProject)deserializer.XmlDeserializeFromString(inputString, typeof(MStabProject)); }); // // SlidingData = newProject.SlidingData; // newProject.Dispose(); // } // catch { } // } // // public IEnumerable[] GetModelComponents() // { // var lists = new List(); // lists.Add(Geometry.Points); // lists.Add(Geometry.Curves); // lists.AddRange(stabilityModel.GetModelLists()); // // return lists.ToArray(); // } // // /// // /// Update object counters // /// // public void UpdateCounters() // { // Geometry.UpdateCounters(); // stabilityModel.UpdateCounters(); // stabilityModel.GeotechnicsData.UpdateCounters(); // SoilModel.UpdateCounters(); // } // // /// // /// Create Default Library Data // /// // public void CreateDefaultLibraryData() // { // SoilModel.CreateDefaultSoilLibrary(); // } // // /// // /// Renumbers the geometry items // /// // public void RenumberGeometryObjects() // { // UndoRedoManager.Instance.BeginAction(); // // Renumbers all Geometry Points as well // GeometryDataModel.RenumberGeometryObjects(); // stabilityModel.RenumberGeometryObjects(); // DataEventPublisher.Changed(this, "Renumbering"); // DataEventPublisher.DoRefreshView(null); // UndoRedoManager.Instance.EndAction(); // } // // // public MStabProject Clone() // { // MStabProject clone = default(MStabProject); // DataEventPublisher.InvokeWithoutPublishingEvents(() => // { // string xml = new XmlSerializer().SerializeToString(this); // clone = new XmlDeserializer().XmlDeserializeFromString(xml); // }); // return clone; // } // // public void Dispose() // { // DataEventPublisher.OnAfterChange -= DataEventPublisher_OnAfterChange; // // if (Stability != null) // { // Stability.Dispose(); // //Stability = null; // } // } // // private SlidingCurve MinimumSafetyCurve // { // get // { // return SlidingData.CurrentZone.MinimumSafetyCurve; // } // } // // private void DataEventPublisher_OnAfterChange(object sender, PublishEventArgs e) // { // if (HasComputationImpact(sender, e.Property)) // { // if (!UndoRedoManager.Instance.IsUndoingRedoing) // { // SlidingData = null; // } // } // // if (string.IsNullOrWhiteSpace(e.Property)) // { // return; // } // // var slidingData = sender as SlidingModel; // if (slidingData != null && e.Property == "CurrentZone") // { // DataEventPublisher.AfterChange(this, x => x.SlidingCurve); // } // } // // private static bool HasComputationImpact(object sender, string property) // { // return property != null && PropertyInfoSupport.GetPropertyInfo(sender.GetType(), property).GetImpact(sender) == Impact.Computation; // } // } }