Index: Core/Gui/src/Core.Gui/GuiCore.cs =================================================================== diff -u -rfa4af6aff7cfd67238db0daaef5560aa86ac9e3e -rb916044feb97e49547eec26fa1b1954e740b879d --- Core/Gui/src/Core.Gui/GuiCore.cs (.../GuiCore.cs) (revision fa4af6aff7cfd67238db0daaef5560aa86ac9e3e) +++ Core/Gui/src/Core.Gui/GuiCore.cs (.../GuiCore.cs) (revision b916044feb97e49547eec26fa1b1954e740b879d) @@ -133,7 +133,9 @@ StorageCommands = new StorageCommandHandler(projectStore, projectMigrator, projectFactory, this, dialogBasedInquiryHelper, MainWindow); - importCommandHandler = new GuiImportHandler(MainWindow, Plugins.SelectMany(p => p.GetImportInfos()), dialogBasedInquiryHelper); + importCommandHandler = new GuiImportHandler(MainWindow, Plugins.SelectMany(p => p.GetImportInfos()) + .Concat(MapImportInfoFactory.Create()), + dialogBasedInquiryHelper); exportCommandHandler = new GuiExportHandler(MainWindow, Plugins.SelectMany(p => p.GetExportInfos())); updateCommandHandler = new GuiUpdateHandler(MainWindow, Plugins.SelectMany(p => p.GetUpdateInfos()), dialogBasedInquiryHelper); Index: Core/Gui/src/Core.Gui/Plugin/Map/MapImportInfoFactory.cs =================================================================== diff -u --- Core/Gui/src/Core.Gui/Plugin/Map/MapImportInfoFactory.cs (revision 0) +++ Core/Gui/src/Core.Gui/Plugin/Map/MapImportInfoFactory.cs (revision b916044feb97e49547eec26fa1b1954e740b879d) @@ -0,0 +1,56 @@ +// Copyright (C) Stichting Deltares 2021. All rights reserved. +// +// This file is part of Riskeer. +// +// Riskeer is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser 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 Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser 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.Generic; +using Core.Common.Util; +using Core.Components.Gis.Data; +using Core.Components.Gis.IO.Importers; +using Core.Gui.Forms.Map; +using Core.Gui.PresentationObjects.Map; +using Core.Gui.Properties; + +namespace Core.Gui.Plugin.Map +{ + /// + /// Factory for creating objects for . + /// + public static class MapImportInfoFactory + { + /// + /// Creates the objects. + /// + /// The creates objects. + public static IEnumerable Create() + { + yield return new ImportInfo + { + Name = Resources.Name_Layer, + Category = Resources.Categories_Layer, + Image = Resources.MapPlusIcon, + FileFilterGenerator = new FileFilterGenerator( + Resources.MapImportInfoFactory_Create_MapDataCollection_filefilter_Extension, + Resources.MapImportInfoFactory_Create_MapDataCollection_filefilter_Description), + IsEnabled = context => true, + CreateFileImporter = (context, filePath) => new FeatureBasedMapDataImporter((MapDataCollection) context.WrappedData, filePath) + }; + } + } +} \ No newline at end of file Index: Core/Gui/src/Core.Gui/Properties/Resources.Designer.cs =================================================================== diff -u -rf0f17d026a0647b413041c182da7dc2f1d001c18 -rb916044feb97e49547eec26fa1b1954e740b879d --- Core/Gui/src/Core.Gui/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision f0f17d026a0647b413041c182da7dc2f1d001c18) +++ Core/Gui/src/Core.Gui/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision b916044feb97e49547eec26fa1b1954e740b879d) @@ -40,7 +40,7 @@ // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] public class Resources { @@ -1355,6 +1355,24 @@ } /// + /// Looks up a localized string similar to Shapebestand. + /// + public static string MapImportInfoFactory_Create_MapDataCollection_filefilter_Description { + get { + return ResourceManager.GetString("MapImportInfoFactory_Create_MapDataCollection_filefilter_Description", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to shp. + /// + public static string MapImportInfoFactory_Create_MapDataCollection_filefilter_Extension { + get { + return ResourceManager.GetString("MapImportInfoFactory_Create_MapDataCollection_filefilter_Extension", resourceCulture); + } + } + + /// /// Looks up a localized string similar to Om het zoomniveau aan te passen moet minstens één van de zichtbare kaartlagen in deze map met kaartlagen elementen bevatten.. /// public static string MapLegendView_CreateZoomToExtentsItem_MapDataCollection_NoFeatures_ZoomToAllDisabled_Tooltip { @@ -1629,6 +1647,15 @@ } /// + /// Looks up a localized string similar to Kaartlaag. + /// + public static string Name_Layer { + get { + return ResourceManager.GetString("Name_Layer", resourceCulture); + } + } + + /// /// Looks up a localized string similar to &Openen. /// public static string Open { Index: Core/Gui/src/Core.Gui/Properties/Resources.resx =================================================================== diff -u -rf0f17d026a0647b413041c182da7dc2f1d001c18 -rb916044feb97e49547eec26fa1b1954e740b879d --- Core/Gui/src/Core.Gui/Properties/Resources.resx (.../Resources.resx) (revision f0f17d026a0647b413041c182da7dc2f1d001c18) +++ Core/Gui/src/Core.Gui/Properties/Resources.resx (.../Resources.resx) (revision b916044feb97e49547eec26fa1b1954e740b879d) @@ -823,4 +823,13 @@ De dikte van de lijn van de vlakken waarmee deze categorie wordt weergegeven. + + Shapebestand + + + shp + + + Kaartlaag + \ No newline at end of file Index: Core/Gui/test/Core.Gui.Test/Plugin/Map/MapDataCollectionImportInfoTest.cs =================================================================== diff -u --- Core/Gui/test/Core.Gui.Test/Plugin/Map/MapDataCollectionImportInfoTest.cs (revision 0) +++ Core/Gui/test/Core.Gui.Test/Plugin/Map/MapDataCollectionImportInfoTest.cs (revision b916044feb97e49547eec26fa1b1954e740b879d) @@ -0,0 +1,111 @@ +// Copyright (C) Stichting Deltares 2021. All rights reserved. +// +// This file is part of Riskeer. +// +// Riskeer is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser 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 Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser 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.Drawing; +using System.Linq; +using Core.Common.Base.IO; +using Core.Common.TestUtil; +using Core.Common.Util; +using Core.Components.Gis.Data; +using Core.Components.Gis.IO.Importers; +using Core.Gui.Plugin; +using Core.Gui.Plugin.Map; +using Core.Gui.PresentationObjects.Map; +using Core.Gui.Properties; +using NUnit.Framework; + +namespace Core.Gui.Test.Plugin.Map +{ + [TestFixture] + public class MapDataCollectionImportInfoTest + { + private ImportInfo importInfo; + + [SetUp] + public void SetUp() + { + importInfo = MapImportInfoFactory.Create().Single(i => i.DataType == typeof(MapDataCollectionContext)); + } + + [Test] + public void Name_Always_ReturnExpectedName() + { + // Call + string name = importInfo.Name; + + // Assert + Assert.AreEqual("Kaartlaag", name); + } + + [Test] + public void Category_Always_ReturnExpectedCategory() + { + // Call + string category = importInfo.Category; + + // Assert + Assert.AreEqual("Kaartlaag", category); + } + + [Test] + public void Image_Always_ReturnExpectedIcon() + { + // Call + Image image = importInfo.Image; + + // Assert + TestHelper.AssertImagesAreEqual(Resources.MapPlusIcon, image); + } + + [Test] + public void IsEnabled_Always_ReturnTrue() + { + // Call + bool isEnabled = importInfo.IsEnabled(null); + + // Assert + Assert.IsTrue(isEnabled); + } + + [Test] + public void FileFilterGenerator_Always_ReturnExpectedFileFilter() + { + // Call + FileFilterGenerator fileFilterGenerator = importInfo.FileFilterGenerator; + + // Assert + Assert.AreEqual("Shapebestand (*.shp)|*.shp", fileFilterGenerator.Filter); + } + + [Test] + public void CreateFileImporter_Always_ReturnFileImporter() + { + // Setup + var importTarget = new MapDataCollectionContext(new MapDataCollection("test"), null); + + // Call + IFileImporter importer = importInfo.CreateFileImporter(importTarget, ""); + + // Assert + Assert.IsInstanceOf(importer); + } + } +} \ No newline at end of file Index: Core/Gui/test/Core.Gui.Test/Plugin/Map/MapImportInfoFactoryTest.cs =================================================================== diff -u --- Core/Gui/test/Core.Gui.Test/Plugin/Map/MapImportInfoFactoryTest.cs (revision 0) +++ Core/Gui/test/Core.Gui.Test/Plugin/Map/MapImportInfoFactoryTest.cs (revision b916044feb97e49547eec26fa1b1954e740b879d) @@ -0,0 +1,44 @@ +// Copyright (C) Stichting Deltares 2021. All rights reserved. +// +// This file is part of Riskeer. +// +// Riskeer is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser 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 Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser 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.Linq; +using Core.Gui.Plugin; +using Core.Gui.Plugin.Map; +using Core.Gui.PresentationObjects.Map; +using NUnit.Framework; + +namespace Core.Gui.Test.Plugin.Map +{ + [TestFixture] + public class MapImportInfoFactoryTest + { + [Test] + public void Create_Always_ReturnsImportInfos() + { + // Call + ImportInfo[] importInfos = MapImportInfoFactory.Create().ToArray(); + + // Assert + Assert.AreEqual(1, importInfos.Length); + Assert.IsTrue(importInfos.Any(i => i.DataType == typeof(MapDataCollectionContext))); + } + } +} \ No newline at end of file Index: Core/Plugins/src/Core.Plugins.Map/MapPlugin.cs =================================================================== diff -u -rfa4af6aff7cfd67238db0daaef5560aa86ac9e3e -rb916044feb97e49547eec26fa1b1954e740b879d --- Core/Plugins/src/Core.Plugins.Map/MapPlugin.cs (.../MapPlugin.cs) (revision fa4af6aff7cfd67238db0daaef5560aa86ac9e3e) +++ Core/Plugins/src/Core.Plugins.Map/MapPlugin.cs (.../MapPlugin.cs) (revision b916044feb97e49547eec26fa1b1954e740b879d) @@ -56,21 +56,6 @@ Gui.ViewHost.ActiveDocumentViewChanged += OnActiveDocumentViewChanged; activated = true; - } - - public override IEnumerable GetImportInfos() - { - yield return new ImportInfo - { - Name = Resources.Name_Layer, - Category = Resources.Categories_Layer, - Image = Resources.MapPlusIcon, - FileFilterGenerator = new FileFilterGenerator( - Resources.MapPlugin_GetImportInfos_MapDataCollection_filefilter_Extension, - Resources.MapPlugin_GetImportInfos_MapDataCollection_filefilter_Description), - IsEnabled = context => true, - CreateFileImporter = (context, filePath) => new FeatureBasedMapDataImporter((MapDataCollection) context.WrappedData, filePath) - }; } protected override void Dispose(bool disposing) Index: Core/Plugins/src/Core.Plugins.Map/Properties/Resources.Designer.cs =================================================================== diff -u -rf0f17d026a0647b413041c182da7dc2f1d001c18 -rb916044feb97e49547eec26fa1b1954e740b879d --- Core/Plugins/src/Core.Plugins.Map/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision f0f17d026a0647b413041c182da7dc2f1d001c18) +++ Core/Plugins/src/Core.Plugins.Map/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision b916044feb97e49547eec26fa1b1954e740b879d) @@ -92,15 +92,6 @@ } /// - /// Looks up a localized string similar to Kaartlaag. - /// - internal static string Categories_Layer { - get { - return ResourceManager.GetString("Categories_Layer", resourceCulture); - } - } - - /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap LineIcon { @@ -121,24 +112,6 @@ } /// - /// Looks up a localized string similar to Shapebestand. - /// - internal static string MapPlugin_GetImportInfos_MapDataCollection_filefilter_Description { - get { - return ResourceManager.GetString("MapPlugin_GetImportInfos_MapDataCollection_filefilter_Description", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to shp. - /// - internal static string MapPlugin_GetImportInfos_MapDataCollection_filefilter_Extension { - get { - return ResourceManager.GetString("MapPlugin_GetImportInfos_MapDataCollection_filefilter_Extension", resourceCulture); - } - } - - /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap MapPlusIcon { @@ -149,15 +122,6 @@ } /// - /// Looks up a localized string similar to Kaartlaag. - /// - internal static string Name_Layer { - get { - return ResourceManager.GetString("Name_Layer", resourceCulture); - } - } - - /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap PointsIcon { Index: Core/Plugins/src/Core.Plugins.Map/Properties/Resources.resx =================================================================== diff -u -rf0f17d026a0647b413041c182da7dc2f1d001c18 -rb916044feb97e49547eec26fa1b1954e740b879d --- Core/Plugins/src/Core.Plugins.Map/Properties/Resources.resx (.../Resources.resx) (revision f0f17d026a0647b413041c182da7dc2f1d001c18) +++ Core/Plugins/src/Core.Plugins.Map/Properties/Resources.resx (.../Resources.resx) (revision b916044feb97e49547eec26fa1b1954e740b879d) @@ -136,16 +136,4 @@ ..\Resources\map--plus.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - Kaartlaag - - - Shapebestand - - - shp - - - Kaartlaag - \ No newline at end of file Fisheye: Tag b916044feb97e49547eec26fa1b1954e740b879d refers to a dead (removed) revision in file `Core/Plugins/test/Core.Plugins.Map.Test/ImportInfos/MapDataCollectionImportInfoTest.cs'. Fisheye: No comparison available. Pass `N' to diff?