// Copyright (C) Stichting Deltares 2024. 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; using System.Windows.Forms; using Deltares.Dam.Data; using Deltares.Standard; using Deltares.Standard.Forms.DExpress; using Deltares.Standard.Forms.Properties; using Deltares.Standard.Reflection; using DevExpress.XtraBars; using DevExpress.XtraEditors.Controls; using DevExpress.XtraEditors.Repository; namespace Deltares.Dam.Forms { /// /// Cross section spatialEditor for DAM /// public class DamGeometryEditor : IDomain { private readonly Panel panel = new Panel(); /// /// Cross-section geometry spatialEditor /// /// The cross section spatialEditor public DamGeometryEditor(GeometryEditor geometryEditor) { var spatialEditor = new DamSpatialEditorDecorator(geometryEditor.SpatialEditor); var projectTypeComboBox = new RepositoryItemComboBox { TextEditStyle = TextEditStyles.DisableTextEditor }; var projectTypeBarItem = new BarEditItem { Width = 150, Edit = projectTypeComboBox }; var previousButton = new BarButtonItem { Glyph = Resources.Previous }; var nextButton = new BarButtonItem { Glyph = Resources.Next }; var probabilityItem = new BarStaticItem(); var soilProfileLabel = new BarStaticItem(); var editMode = new BarButtonItem { Glyph = Properties.Resources.pencil }; // For some reason, LinkPersistInfo that was used here does not work anymore so replaced it by AddItem (MWDAM-1199) geometryEditor.MainBar.AddItem(projectTypeBarItem); geometryEditor.MainBar.AddItem(previousButton); geometryEditor.MainBar.AddItem(nextButton); geometryEditor.MainBar.AddItem(probabilityItem); geometryEditor.MainBar.AddItem(soilProfileLabel); // geometryEditor.MainBar.LinksPersistInfo.Insert(2, new LinkPersistInfo(editMode)); // Disable line editing of characteristic points (MWDAM-915) BindSupport.Bind(panel, projectTypeBarItem, spatialEditor.GetType(), StaticReflection.GetMemberName(x => x.FailureMechanismType)); BindSupport.Bind(panel, previousButton, spatialEditor.GetType(), StaticReflection.GetMemberName(x => x.Previous())); BindSupport.Bind(panel, nextButton, spatialEditor.GetType(), StaticReflection.GetMemberName(x => x.Next())); BindSupport.Bind(panel, probabilityItem, spatialEditor.GetType(), StaticReflection.GetMemberName(x => x.ProbabilityString)); BindSupport.Bind(panel, soilProfileLabel, spatialEditor.GetType(), StaticReflection.GetMemberName(x => x.ProfileName)); BindSupport.Bind(panel, editMode, spatialEditor.GetType(), StaticReflection.GetMemberName(x => x.EditMode)); BindSupport.Assign(panel, spatialEditor); } public ICollection GetDomain(string property) { switch (property) { case "FailureMechanismType": { switch (LocationJob.DamProjectType) { case DamProjectType.Calamity: return new[] { FailureMechanismSystemType.StabilityInside, FailureMechanismSystemType.StabilityOutside, FailureMechanismSystemType.Piping }; case DamProjectType.Design: { if (DamProjectCalculationSpecification.SelectedAnalysisType == AnalysisType.NoAdaption) { return new[] { FailureMechanismSystemType.StabilityInside, FailureMechanismSystemType.StabilityOutside, FailureMechanismSystemType.Piping }; } return new[] { FailureMechanismSystemType.StabilityInside, FailureMechanismSystemType.Piping }; } } break; } default: return null; } return null; } } }