Index: DamClients/DamUI/trunk/src/Dam/Forms/DamContext.cs =================================================================== diff -u -r2088 -r2238 --- DamClients/DamUI/trunk/src/Dam/Forms/DamContext.cs (.../DamContext.cs) (revision 2088) +++ DamClients/DamUI/trunk/src/Dam/Forms/DamContext.cs (.../DamContext.cs) (revision 2238) @@ -25,6 +25,8 @@ using Deltares.Dam.Data; using Deltares.Geotechnics; using Deltares.Geotechnics.Soils; +using Deltares.Geotechnics.SurfaceLines; +using Deltares.Standard.Forms.DExpress; using Deltares.Standard.Reflection; namespace Deltares.Dam.Forms @@ -95,7 +97,7 @@ /// Returns the possible named filters for a given type. /// /// A type for which named filters will be returned. - /// A of the named filters or null if no named filters exists. + /// A IEnumberable of the named filters or null if no named filters exists. public IEnumerable GetColumnNamedFilters(Type type) { if (filters.ContainsKey(type)) @@ -144,11 +146,30 @@ return false; } + if (source is Location && member == StaticReflection.GetMemberName(x => x.LocalXZSurfaceLine2)) + { + return true; + } + // Make sure unwanted operations are hidden for the surface line grid for now. + var grid = source as GridViewControl; + if (grid != null) + { + if ((member == "AddRowCommand" || member == "DeleteRowCommand" || member == "PasteCommand" || member == "EditCommand") && (grid.Name == "SurfaceLinePointsGridControl")) + { + return false; + } + } return base.IsVisible(source, member); } public override bool? IsEnabled(object source, string member) { + // Make sure CharacteristicPoints can not be edited for now. + if (source is CharacteristicPoint) + { + return false; + } + if (source is Soil && member != StaticReflection.GetMemberName(x => x.StrengthIncreaseExponent)) { return false; Index: DamClients/DamUI/trunk/src/Dam/Forms/DamSurfaceLineControl.resx =================================================================== diff -u --- DamClients/DamUI/trunk/src/Dam/Forms/DamSurfaceLineControl.resx (revision 0) +++ DamClients/DamUI/trunk/src/Dam/Forms/DamSurfaceLineControl.resx (revision 2238) @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Location.cs =================================================================== diff -u -r2190 -r2238 --- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Location.cs (.../Location.cs) (revision 2190) +++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Location.cs (.../Location.cs) (revision 2238) @@ -507,7 +507,7 @@ /// TODO /// /// Composite relationship. - [Browsable(false)] + [ReadOnly(true)] [Validate] public virtual SurfaceLine2 LocalXZSurfaceLine2 { Index: DamClients/DamUI/trunk/src/Dam/Forms/DamSurfaceLineControl.cs =================================================================== diff -u --- DamClients/DamUI/trunk/src/Dam/Forms/DamSurfaceLineControl.cs (revision 0) +++ DamClients/DamUI/trunk/src/Dam/Forms/DamSurfaceLineControl.cs (revision 2238) @@ -0,0 +1,115 @@ +// Copyright (C) Stichting Deltares 2017. All rights reserved. +// +// This file is part of the Delta Shell Light Library. +// +// The Delta Shell Light Library 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.Windows.Forms; +using Deltares.Dam.Data; +using Deltares.Geometry; +using Deltares.Geotechnics.SurfaceLines; +using Deltares.Standard.EventPublisher.Enum; +using Deltares.Standard.Forms; +using Deltares.Standard.Forms.DExpress; +using DevExpress.Utils; +using DevExpress.XtraGrid.Columns; + +namespace Deltares.Dam.Forms +{ + public partial class DamSurfaceLineControl : UserControl, IPropertyControl + { + public DamSurfaceLineControl() + { + InitializeComponent(); + SurfaceLinePointsGridControl.PropertyEditorReactionType = PropertyEditorReactionType.Ignore; + + ((IPropertyControl) this).Name = "SurfaceLine"; + + BindSupport.Bind(this, SurfaceLinePointsGridControl, sl => sl.CharacteristicPoints); + LocalizationSupport.RegisterAndTranslate(typeof(SurfaceLine2), PointsGroup); + + FormsSupport.RepairRightAnchoredControls(this); + + SurfaceLinePointsGridControl.CreateNew = CreateNewCharacteristicPointListItem; + // Disable sorting for this table! + var gridView = SurfaceLinePointsGridControl.gridView1; + foreach (GridColumn column in gridView.Columns) + { + column.OptionsColumn.AllowSort = DefaultBoolean.False; + } + } + + public bool IsVisible + { + get + { + return true; + } + } + + public object SelectedObject + { + get + { + return CharacteristicPoints; + } + set + { + var pointSet = GetCharacteristicPointSetFromSelectedObject(value); + if (pointSet != null) + { + CharacteristicPoints = pointSet; + BindSupport.Assign(this, this); + } + else + { + var locJob = value as LocationJob; + if (locJob != null) + { + CharacteristicPoints = locJob.Location.SurfaceLine2.CharacteristicPoints; + BindSupport.Assign(this, this); + } + } + } + } + + private CharacteristicPointSet CharacteristicPoints { get; set; } + + private CharacteristicPoint CreateNewCharacteristicPointListItem() + { + return new CharacteristicPoint(CharacteristicPoints, new GeometryPoint()); + } + + private static CharacteristicPointSet GetCharacteristicPointSetFromSelectedObject(object value) + { + var line = value as SurfaceLine2; + if (line != null) + { + return line.CharacteristicPoints; + } + + var characteristicPoint = value as CharacteristicPoint; + if (characteristicPoint != null) + { + return characteristicPoint.PointSet; + } + + return null; + } + } +} \ No newline at end of file Index: DamClients/DamUI/trunk/src/Dam/Forms/DamPlugin.cs =================================================================== diff -u -r2235 -r2238 --- DamClients/DamUI/trunk/src/Dam/Forms/DamPlugin.cs (.../DamPlugin.cs) (revision 2235) +++ DamClients/DamUI/trunk/src/Dam/Forms/DamPlugin.cs (.../DamPlugin.cs) (revision 2238) @@ -25,7 +25,6 @@ using System.Drawing; using System.IO; using System.Linq; -using System.Reflection; using System.Windows.Forms; using Deltares.Dam.Data; using Deltares.Dam.Data.DamEngineIo; @@ -129,6 +128,7 @@ private readonly DesignCalculationPropertyControl designCalculationPropertyControl = new DesignCalculationPropertyControl(); private readonly LocationPropertyControl locationPropertyControl = new LocationPropertyControl(); + private readonly DamSurfaceLineControl damSurfaceLineControl = new DamSurfaceLineControl(); private readonly DamProjectCalculationSpecificationPropertyControl damProjectCalculationSpecificationPropertyControl = new DamProjectCalculationSpecificationPropertyControl(); private readonly WaterBoardPropertyControl waterBoardPropertyControl = new WaterBoardPropertyControl(); private readonly BarButtonItem showCalculationOptionsItem = new BarButtonItem(); @@ -277,14 +277,15 @@ private void ConfigurePropertyGrid() { - var dpc = this.mainForm.DynamicPropertyControl; + var dpc = mainForm.DynamicPropertyControl; // deregister the ugly property control provided by the Geotechnics plugin - mainForm.DynamicPropertyControl.ClearRegistrationsForType(typeof(Soil)); - mainForm.DynamicPropertyControl.BuildDelayedPropertyControlForTypes(() => PropertyControlFactory.GetPropertyControl(), typeof(Soil)); + dpc.ClearRegistrationsForType(typeof(Soil)); + dpc.BuildDelayedPropertyControlForTypes(() => PropertyControlFactory.GetPropertyControl(), typeof(Soil)); dpc.BuildPropertyControlTabForTypes(locationPropertyControl, typeof(Location), typeof(LocationJob)); dpc.BuildPropertyControlTabForTypes(new LocationScenariosControl(), typeof(Location), typeof(LocationJob)); - + dpc.BuildPropertyControlTabForTypes(damSurfaceLineControl, typeof(SurfaceLine2), typeof(CharacteristicPoint), typeof(LocationJob)); + this.progressDelegate = waterBoardPropertyControl.DoProgress; dpc.BuildPropertyControlTabForTypes(waterBoardPropertyControl, typeof(WaterBoard), typeof(WaterBoardJob), typeof(DamProjectData)); @@ -719,12 +720,9 @@ catch (Exception) { // when all calculations failed but some old result lingers (which it probably shouldnt't) you trigger - // and event for a non existing designCalculationsControl. For now just ignore this error until it is clear + // an event for a non existing designCalculationsControl. For now just ignore this error until it is clear // how DAM should handle "old" results. } - - - } } } @@ -746,7 +744,8 @@ // Selecting the LocationJob makes sure of proper selected location mainForm.Invoke(new TaskDelegate(DataEventPublisher.SelectionChanged), damProject.DamProjectData.GetFirstLocationJobWithCalamityResults()); - // Set chart as active tab as this is the only control that actually displays the results next to the wmf-pictures diplayed on the image tab + // Set chart as active tab as this is the only control that actually displays the results next to the wmf-pictures + // displayed on the image tab mainForm.SetAsActiveChart(locationChart); } } @@ -862,9 +861,7 @@ private void SelectLocationJob(LocationJob locationJob) { var location = locationJob.Location; - DataEventPublisher.SelectionChanged(location, PropertyEditorReactionType.Ignore); - if (damProject.DamProjectData.DamProjectType == DamProjectType.Calamity) { lastLocationResult = locationJob.GetLocationResultWithStabilityTimeSerie(location.Name); Index: DamClients/DamUI/trunk/src/Dam/Forms/DamSurfaceLineControl.Designer.cs =================================================================== diff -u --- DamClients/DamUI/trunk/src/Dam/Forms/DamSurfaceLineControl.Designer.cs (revision 0) +++ DamClients/DamUI/trunk/src/Dam/Forms/DamSurfaceLineControl.Designer.cs (revision 2238) @@ -0,0 +1,86 @@ +namespace Deltares.Dam.Forms +{ + partial class DamSurfaceLineControl + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.PointsGroup = new DevExpress.XtraEditors.GroupControl(); + this.SurfaceLinePointsGridControl = new Deltares.Standard.Forms.DExpress.GridViewControl(); + ((System.ComponentModel.ISupportInitialize)(this.PointsGroup)).BeginInit(); + this.PointsGroup.SuspendLayout(); + this.SuspendLayout(); + // + // PointsGroup + // + this.PointsGroup.Controls.Add(this.SurfaceLinePointsGridControl); + this.PointsGroup.Dock = System.Windows.Forms.DockStyle.Fill; + this.PointsGroup.Location = new System.Drawing.Point(0, 0); + this.PointsGroup.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.PointsGroup.Name = "PointsGroup"; + this.PointsGroup.Size = new System.Drawing.Size(439, 516); + this.PointsGroup.TabIndex = 4; + this.PointsGroup.Text = "Points"; + // + // SurfaceLinePointsGridControl + // + this.SurfaceLinePointsGridControl.AdjustHeightToFit = false; + this.SurfaceLinePointsGridControl.AllowAddDeleteOnly = false; + this.SurfaceLinePointsGridControl.AllowedUserColumnFilters = null; + this.SurfaceLinePointsGridControl.AllowInserts = true; + this.SurfaceLinePointsGridControl.AllowUserColumnFilterEdit = false; + this.SurfaceLinePointsGridControl.CurrentContext = null; + this.SurfaceLinePointsGridControl.Dock = System.Windows.Forms.DockStyle.Fill; + this.SurfaceLinePointsGridControl.EnableMasterViewMode = true; + this.SurfaceLinePointsGridControl.HideUnusedColumns = false; + this.SurfaceLinePointsGridControl.Location = new System.Drawing.Point(2, 24); + this.SurfaceLinePointsGridControl.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.SurfaceLinePointsGridControl.Name = "SurfaceLinePointsGridControl"; + this.SurfaceLinePointsGridControl.SendSelectionChanged = true; + this.SurfaceLinePointsGridControl.ShowToolbar = true; + this.SurfaceLinePointsGridControl.Size = new System.Drawing.Size(435, 490); + this.SurfaceLinePointsGridControl.TabIndex = 3; + // + // DamSurfaceLineControl + // + this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.PointsGroup); + this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.Name = "SurfaceLine2Control"; + this.Size = new System.Drawing.Size(439, 516); + ((System.ComponentModel.ISupportInitialize)(this.PointsGroup)).EndInit(); + this.PointsGroup.ResumeLayout(false); + this.ResumeLayout(false); + + } + + #endregion + + private DevExpress.XtraEditors.GroupControl PointsGroup; + public Standard.Forms.DExpress.GridViewControl SurfaceLinePointsGridControl; + } +} Index: DamClients/DamUI/trunk/src/Dam/Forms/Deltares.Dam.Forms.csproj =================================================================== diff -u -r2135 -r2238 --- DamClients/DamUI/trunk/src/Dam/Forms/Deltares.Dam.Forms.csproj (.../Deltares.Dam.Forms.csproj) (revision 2135) +++ DamClients/DamUI/trunk/src/Dam/Forms/Deltares.Dam.Forms.csproj (.../Deltares.Dam.Forms.csproj) (revision 2238) @@ -245,6 +245,12 @@ StabilityKernelTypeSpecificationsControl.cs + + UserControl + + + DamSurfaceLineControl.cs + @@ -290,6 +296,9 @@ StabilityKernelTypeSpecificationsControl.cs + + DamSurfaceLineControl.cs + WaterBoardPropertyControl.cs Designer