Index: Core/Components/src/Core.Components.DotSpatial.Forms/Views/IHasMapData.cs =================================================================== diff -u -r2a9a0a500bc605a383e700b6d8f4b407abd42486 -r3c1b0b97a6f8a5f3df4b9dad0164e69a886d1330 --- Core/Components/src/Core.Components.DotSpatial.Forms/Views/IHasMapData.cs (.../IHasMapData.cs) (revision 2a9a0a500bc605a383e700b6d8f4b407abd42486) +++ Core/Components/src/Core.Components.DotSpatial.Forms/Views/IHasMapData.cs (.../IHasMapData.cs) (revision 3c1b0b97a6f8a5f3df4b9dad0164e69a886d1330) @@ -41,9 +41,9 @@ string DisplayName { get; } /// - /// Gets the selected or null if none selected. + /// Gets the selected or null if none selected. /// - MapData SelectedMapData { get; } + WmtsMapData SelectedMapData { get; } /// /// Gets the user control. Index: Core/Components/src/Core.Components.DotSpatial.Forms/Views/WmtsLocationControl.cs =================================================================== diff -u -r2a9a0a500bc605a383e700b6d8f4b407abd42486 -r3c1b0b97a6f8a5f3df4b9dad0164e69a886d1330 --- Core/Components/src/Core.Components.DotSpatial.Forms/Views/WmtsLocationControl.cs (.../WmtsLocationControl.cs) (revision 2a9a0a500bc605a383e700b6d8f4b407abd42486) +++ Core/Components/src/Core.Components.DotSpatial.Forms/Views/WmtsLocationControl.cs (.../WmtsLocationControl.cs) (revision 3c1b0b97a6f8a5f3df4b9dad0164e69a886d1330) @@ -65,7 +65,7 @@ } } - public MapData SelectedMapData + public WmtsMapData SelectedMapData { get { Index: Core/Components/test/Core.Components.DotSpatial.Forms.Test/Views/WmtsLocationControlTest.cs =================================================================== diff -u -rd506ab6eea64d53852f6419f39493e3a326078b0 -r3c1b0b97a6f8a5f3df4b9dad0164e69a886d1330 --- Core/Components/test/Core.Components.DotSpatial.Forms.Test/Views/WmtsLocationControlTest.cs (.../WmtsLocationControlTest.cs) (revision d506ab6eea64d53852f6419f39493e3a326078b0) +++ Core/Components/test/Core.Components.DotSpatial.Forms.Test/Views/WmtsLocationControlTest.cs (.../WmtsLocationControlTest.cs) (revision 3c1b0b97a6f8a5f3df4b9dad0164e69a886d1330) @@ -225,7 +225,7 @@ dataGridView.CurrentCell = dataGridView.Rows[0].Cells[0]; // Call - WmtsMapData selectedMapData = control.SelectedMapData as WmtsMapData; + WmtsMapData selectedMapData = control.SelectedMapData; // Assert Assert.IsNull(selectedMapData); @@ -244,7 +244,7 @@ dataGridView.CurrentCell = dataGridView.Rows[1].Cells[0]; // Call - WmtsMapData selectedMapData = control.SelectedMapData as WmtsMapData; + WmtsMapData selectedMapData = control.SelectedMapData; // Assert Assert.IsNotNull(selectedMapData); Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.Designer.cs =================================================================== diff -u -r392383a267a69010698aef6948b1e53c6a889bae -r3c1b0b97a6f8a5f3df4b9dad0164e69a886d1330 --- Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 392383a267a69010698aef6948b1e53c6a889bae) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 3c1b0b97a6f8a5f3df4b9dad0164e69a886d1330) @@ -1469,6 +1469,16 @@ } /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + public static System.Drawing.Bitmap MapsIcon { + get { + object obj = ResourceManager.GetObject("MapsIcon", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// /// Looks up a localized string similar to Koppelingsafstand. /// public static string MetaData_Couple_distance { Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.resx =================================================================== diff -u -r392383a267a69010698aef6948b1e53c6a889bae -r3c1b0b97a6f8a5f3df4b9dad0164e69a886d1330 --- Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.resx (.../Resources.resx) (revision 392383a267a69010698aef6948b1e53c6a889bae) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.resx (.../Resources.resx) (revision 3c1b0b97a6f8a5f3df4b9dad0164e69a886d1330) @@ -917,4 +917,7 @@ Bronlocatie + + ..\Resources\MapsIcon.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + \ No newline at end of file Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Resources/MapsIcon.png =================================================================== diff -u Binary files differ Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Ringtoets.Common.Forms.csproj =================================================================== diff -u -r392383a267a69010698aef6948b1e53c6a889bae -r3c1b0b97a6f8a5f3df4b9dad0164e69a886d1330 --- Ringtoets/Common/src/Ringtoets.Common.Forms/Ringtoets.Common.Forms.csproj (.../Ringtoets.Common.Forms.csproj) (revision 392383a267a69010698aef6948b1e53c6a889bae) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/Ringtoets.Common.Forms.csproj (.../Ringtoets.Common.Forms.csproj) (revision 3c1b0b97a6f8a5f3df4b9dad0164e69a886d1330) @@ -289,6 +289,7 @@ + Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/BackgroundMapDataSelectionDialog.cs =================================================================== diff -u -rf06f5ec5e879a3790c3826bcd3d3855bea1ffef9 -r3c1b0b97a6f8a5f3df4b9dad0164e69a886d1330 --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/BackgroundMapDataSelectionDialog.cs (.../BackgroundMapDataSelectionDialog.cs) (revision f06f5ec5e879a3790c3826bcd3d3855bea1ffef9) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/BackgroundMapDataSelectionDialog.cs (.../BackgroundMapDataSelectionDialog.cs) (revision 3c1b0b97a6f8a5f3df4b9dad0164e69a886d1330) @@ -60,9 +60,9 @@ } /// - /// Gets the from the selected row in the . + /// Gets the selected or null if none selected. /// - public MapData SelectedMapData { get; private set; } + public WmtsMapData SelectedMapData { get; private set; } protected override void Dispose(bool disposing) { @@ -105,7 +105,7 @@ private void UpdateSelectButton() { - selectButton.Enabled = SelectedMapData != null; + selectButton.Enabled = currentMapDataControl?.SelectedMapData != null; } protected override Button GetCancelButton() @@ -145,6 +145,7 @@ private void OnSelectButtonClick(object sender, EventArgs e) { SetSelectedMapData(); + DialogResult = DialogResult.OK; Close(); } Index: Ringtoets/Integration/src/Ringtoets.Integration.Plugin/Properties/Resources.Designer.cs =================================================================== diff -u -r4bd863e75942710beedfe1ea7c2c5a097b46497f -r3c1b0b97a6f8a5f3df4b9dad0164e69a886d1330 --- Ringtoets/Integration/src/Ringtoets.Integration.Plugin/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 4bd863e75942710beedfe1ea7c2c5a097b46497f) +++ Ringtoets/Integration/src/Ringtoets.Integration.Plugin/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 3c1b0b97a6f8a5f3df4b9dad0164e69a886d1330) @@ -104,6 +104,24 @@ } /// + /// Looks up a localized string similar to Selecteren. + /// + public static string BackgroundMapData_SelectMapData { + get { + return ResourceManager.GetString("BackgroundMapData_SelectMapData", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Selecteer een kaartlaag.. + /// + public static string BackgroundMapData_SelectMapData_Tooltip { + get { + return ResourceManager.GetString("BackgroundMapData_SelectMapData_Tooltip", resourceCulture); + } + } + + /// /// Looks up a localized string similar to De resultaten van {0} berekeningen zijn verwijderd.. /// public static string ChangeHandler_Results_of_NumberOfCalculations_0_calculations_cleared { Index: Ringtoets/Integration/src/Ringtoets.Integration.Plugin/Properties/Resources.resx =================================================================== diff -u -r4bd863e75942710beedfe1ea7c2c5a097b46497f -r3c1b0b97a6f8a5f3df4b9dad0164e69a886d1330 --- Ringtoets/Integration/src/Ringtoets.Integration.Plugin/Properties/Resources.resx (.../Resources.resx) (revision 4bd863e75942710beedfe1ea7c2c5a097b46497f) +++ Ringtoets/Integration/src/Ringtoets.Integration.Plugin/Properties/Resources.resx (.../Resources.resx) (revision 3c1b0b97a6f8a5f3df4b9dad0164e69a886d1330) @@ -169,4 +169,10 @@ Weet u zeker dat u wilt doorgaan? + + Selecteren + + + Selecteer een kaartlaag. + \ No newline at end of file Index: Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs =================================================================== diff -u -r392383a267a69010698aef6948b1e53c6a889bae -r3c1b0b97a6f8a5f3df4b9dad0164e69a886d1330 --- Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs (.../RingtoetsPlugin.cs) (revision 392383a267a69010698aef6948b1e53c6a889bae) +++ Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs (.../RingtoetsPlugin.cs) (revision 3c1b0b97a6f8a5f3df4b9dad0164e69a886d1330) @@ -70,6 +70,7 @@ using Ringtoets.Integration.Data; using Ringtoets.Integration.Data.StandAlone; using Ringtoets.Integration.Data.StandAlone.SectionResults; +using Ringtoets.Integration.Forms; using Ringtoets.Integration.Forms.Commands; using Ringtoets.Integration.Forms.PresentationObjects; using Ringtoets.Integration.Forms.PropertyClasses; @@ -517,10 +518,7 @@ { Text = context => RingtoetsIntegrationPluginResources.RingtoetsPlugin_BackgroundMapDataContext_Text, Image = context => RingtoetsFormsResources.Map, - ContextMenuStrip = (nodeData, parentData, treeViewControl) => - Gui.Get(nodeData, treeViewControl) - .AddPropertiesItem() - .Build(), + ContextMenuStrip = BackgroundMapDataContextMenuStrip, ForeColor = context => context.WrappedData.IsConfigured ? Color.FromKnownColor(KnownColor.ControlText) : Color.FromKnownColor(KnownColor.GrayText) @@ -885,6 +883,50 @@ } } + #region BackgroundMapDataContext treeNodeInfo + + private ContextMenuStrip BackgroundMapDataContextMenuStrip(BackgroundMapDataContext nodeData, object parentData, TreeViewControl treeViewControl) + { + var assessmentSection = parentData as IAssessmentSection; + + var mapDataItem = new StrictContextMenuItem( + RingtoetsIntegrationPluginResources.BackgroundMapData_SelectMapData, + RingtoetsIntegrationPluginResources.BackgroundMapData_SelectMapData_Tooltip, + RingtoetsCommonFormsResources.MapsIcon, (sender, args) => SelectMapData(assessmentSection)); + + return Gui.Get(nodeData, treeViewControl) + .AddCustomItem(mapDataItem) + .AddPropertiesItem() + .Build(); + } + + private void SelectMapData(IAssessmentSection assessmentSection) + { + if (assessmentSection == null) + { + return; + } + + using (var dialog = new BackgroundMapDataSelectionDialog(Gui.MainWindow)) + { + if (dialog.ShowDialog() == DialogResult.OK) + { + WmtsMapData selectedMapData = dialog.SelectedMapData; + if (selectedMapData == null) + { + return; + } + + ((WmtsMapData) assessmentSection.BackgroundMapData.MapData).Configure(selectedMapData.SourceCapabilitiesUrl, + selectedMapData.SelectedCapabilityIdentifier, + selectedMapData.PreferredFormat); + assessmentSection.BackgroundMapData.MapData.NotifyObservers(); + } + } + } + + #endregion + #region ForeshoreProfile TreeNodeInfo private static bool CanRemoveForeshoreProfile(ForeshoreProfile nodeData, object parentNodeData) @@ -1058,7 +1100,7 @@ { var childNodes = new List { - new BackgroundMapDataContext((WmtsMapData)nodeData.BackgroundMapData.MapData), + new BackgroundMapDataContext((WmtsMapData) nodeData.BackgroundMapData.MapData), new ReferenceLineContext(nodeData), new FailureMechanismContributionContext(nodeData.FailureMechanismContribution, nodeData), new HydraulicBoundaryDatabaseContext(nodeData), Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/TreeNodeInfos/BackgroundMapDataContextTreeNodeInfoTest.cs =================================================================== diff -u -rc990bf404015584981f3ec1d22ecec12a7b037f3 -r3c1b0b97a6f8a5f3df4b9dad0164e69a886d1330 --- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/TreeNodeInfos/BackgroundMapDataContextTreeNodeInfoTest.cs (.../BackgroundMapDataContextTreeNodeInfoTest.cs) (revision c990bf404015584981f3ec1d22ecec12a7b037f3) +++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/TreeNodeInfos/BackgroundMapDataContextTreeNodeInfoTest.cs (.../BackgroundMapDataContextTreeNodeInfoTest.cs) (revision 3c1b0b97a6f8a5f3df4b9dad0164e69a886d1330) @@ -149,6 +149,7 @@ var menuBuilderMock = mockRepository.StrictMock(); using (mockRepository.Ordered()) { + menuBuilderMock.Expect(mb => mb.AddCustomItem(null)).IgnoreArguments().Return(menuBuilderMock); menuBuilderMock.Expect(mb => mb.AddPropertiesItem()).Return(menuBuilderMock); menuBuilderMock.Expect(mb => mb.Build()).Return(null); }