From ec47f225b362afd6ecb858ad5db03ca18cdb2d22 Mon Sep 17 00:00:00 2001 From: ClemensF Date: Fri, 4 Aug 2017 21:38:58 +0200 Subject: [PATCH] Version 4: Upgrade to VS 2017 --- .../FileDbCache.UWP.csproj} | 80 +- .../FileDbCache.cs | 63 +- .../Properties/AssemblyInfo.cs | 6 +- .../Properties/FileDbCache.UWP.rd.xml | 5 + Caching/FileDbCache.UWP/project.json | 16 + .../FileDbCache.WPF/FileDbCache.WPF.csproj | 18 +- Caching/FileDbCache.WPF/FileDbCache.cs | 93 +- .../Properties/AssemblyInfo.cs | 6 +- .../ImageFileCache.WPF.csproj | 64 - .../Properties/AssemblyInfo.cs | 14 - .../ImageFileCache.WinRT.csproj | 66 - .../ImageFileCache.WinRT/ImageFileCache.cs | 93 - .../Properties/AssemblyInfo.cs | 14 - MapControl.sln | 284 +- MapControl/BingMapsTileLayer.cs | 179 - MapControl/BitmapSourceHelper.cs | 58 - MapControl/BoundingBoxConverter.cs | 31 - MapControl/Extensions.Silverlight.cs | 21 - .../ImageTileSource.Silverlight.WinRT.cs | 29 - MapControl/ImageTileSource.WPF.cs | 24 - MapControl/LocationCollectionConverter.cs | 28 - MapControl/LocationConverter.cs | 31 - MapControl/Map.Silverlight.cs | 70 - MapControl/MapControl.Silverlight.csproj | 156 - MapControl/MapControl.Silverlight.csproj.user | 29 - MapControl/MapControl.WPF.csproj | 135 - MapControl/MapImageLayer.WPF.cs | 69 - MapControl/MatrixEx.Silverlight.WinRT.cs | 82 - .../AzimuthalEquidistantProjection.cs | 2 +- .../{ => Shared}/AzimuthalProjection.cs | 4 +- MapControl/Shared/BingMapsTileLayer.cs | 138 + MapControl/{ => Shared}/BingMapsTileSource.cs | 2 +- MapControl/{ => Shared}/BoundingBox.cs | 0 .../{ => Shared}/CenteredBoundingBox.cs | 0 .../{ => Shared}/EquirectangularProjection.cs | 2 +- MapControl/{ => Shared}/GnomonicProjection.cs | 2 +- MapControl/{ => Shared}/HyperlinkText.cs | 17 +- MapControl/{ => Shared}/Location.cs | 7 +- MapControl/{ => Shared}/LocationCollection.cs | 0 MapControl/{ => Shared}/MapBase.cs | 2 +- MapControl/{ => Shared}/MapGraticule.cs | 4 +- MapControl/{ => Shared}/MapImageLayer.cs | 8 +- MapControl/{ => Shared}/MapOverlay.cs | 2 +- MapControl/{ => Shared}/MapPanel.cs | 2 +- MapControl/{ => Shared}/MapPath.cs | 2 +- MapControl/{ => Shared}/MapPolyline.cs | 15 +- MapControl/{ => Shared}/MapProjection.cs | 20 +- MapControl/{ => Shared}/MapTileLayer.cs | 29 +- .../{ => Shared}/OrthographicProjection.cs | 2 +- .../{ => Shared}/StereographicProjection.cs | 2 +- MapControl/{ => Shared}/Tile.cs | 2 +- MapControl/{ => Shared}/TileGrid.cs | 5 +- MapControl/Shared/TileImageLoader.cs | 172 + MapControl/{ => Shared}/TileSource.cs | 36 +- .../{ => Shared}/ViewportChangedEventArgs.cs | 0 .../{ => Shared}/WebMercatorProjection.cs | 6 +- MapControl/{ => Shared}/WmsImageLayer.cs | 94 +- MapControl/TileImageLoader.Silverlight.cs | 53 - MapControl/TileImageLoader.WPF.cs | 272 - MapControl/TileImageLoader.WinRT.cs | 295 - MapControl/TileSourceConverter.cs | 28 - .../Extensions.UWP.cs} | 8 +- .../ImageCache.UWP.cs} | 0 MapControl/UWP/ImageFileCache.UWP.cs | 99 + MapControl/{Map.WinRT.cs => UWP/Map.UWP.cs} | 0 .../MapBase.UWP.cs} | 5 - MapControl/UWP/MapControl.UWP.csproj | 180 + .../MapGraticule.UWP.cs} | 8 - .../MapImageLayer.UWP.cs} | 28 +- .../MapItem.UWP.cs} | 4 - .../MapItemsControl.UWP.cs} | 5 - .../MapOverlay.UWP.cs} | 15 +- .../MapPanel.UWP.cs} | 5 - .../MapPath.UWP.cs} | 15 +- .../MapPolyline.UWP.cs} | 16 +- .../MapTileLayer.UWP.cs} | 3 + MapControl/UWP/MatrixEx.UWP.cs | 87 + .../{WinRT => UWP}/Properties/AssemblyInfo.cs | 8 +- .../UWP/Properties/MapControl.UWP.rd.xml | 5 + .../Pushpin.UWP.cs} | 4 - MapControl/{WinRT => UWP}/Themes/Generic.xaml | 2 +- .../Tile.UWP.cs} | 32 +- MapControl/UWP/TileImageLoader.UWP.cs | 114 + MapControl/UWP/project.json | 16 + .../WPF/ImageFileCache.WPF.cs | 88 +- MapControl/{ => WPF}/Map.WPF.cs | 0 MapControl/{ => WPF}/MapBase.WPF.cs | 0 MapControl/WPF/MapControl.WPF.csproj | 183 + MapControl/{ => WPF}/MapGraticule.WPF.cs | 0 MapControl/WPF/MapImageLayer.WPF.cs | 57 + MapControl/{ => WPF}/MapItem.WPF.cs | 0 MapControl/{ => WPF}/MapItemsControl.WPF.cs | 0 MapControl/{ => WPF}/MapOverlay.WPF.cs | 0 MapControl/{ => WPF}/MapPanel.WPF.cs | 0 MapControl/{ => WPF}/MapPath.WPF.cs | 5 +- MapControl/{ => WPF}/MapPolyline.WPF.cs | 19 +- .../{MapScale.cs => WPF/MapScale.WPF.cs} | 0 MapControl/{ => WPF}/MapTileLayer.WPF.cs | 2 + MapControl/{ => WPF}/MatrixEx.WPF.cs | 2 +- .../{ => WPF}/Properties/AssemblyInfo.cs | 13 +- MapControl/{ => WPF}/Pushpin.WPF.cs | 0 MapControl/{ => WPF}/Themes/Generic.xaml | 0 MapControl/{ => WPF}/Tile.WPF.cs | 36 +- MapControl/WPF/TileImageLoader.WPF.cs | 127 + MapControl/WPF/TypeConverters.WPF.cs | 84 + MapControl/WPF/XmlDocument.WPF.cs | 24 + MapControl/WinRT/MapControl.WinRT.csproj | 226 - MapControl/WinRT/MapControl.WinRT.xr.xml | 61 - MapControl/WinRT/ReadMe.txt | 8 - MapControl/WmsLayers.WPF.WinRT.cs | 84 - SampleApps/{Common => Shared}/10_535_330.jpg | Bin SampleApps/{Common => Shared}/MapLayers.cs | 0 SampleApps/{Common => Shared}/MapViewModel.cs | 0 .../Properties/AssemblyInfo.cs | 14 - .../SilverlightApplication.Web/Silverlight.js | 2 - .../SilverlightApplication.Web.csproj | 94 - .../SilverlightApplication.Web.csproj.user | 34 - .../SilverlightApplicationTestPage.aspx | 74 - .../SilverlightApplicationTestPage.html | 73 - .../Web.Debug.config | 30 - .../Web.Release.config | 31 - .../SilverlightApplication.Web/Web.config | 19 - SampleApps/SilverlightApplication/App.xaml | 6 - SampleApps/SilverlightApplication/App.xaml.cs | 51 - .../SilverlightApplication/MainPage.xaml | 179 - .../SilverlightApplication/MainPage.xaml.cs | 59 - .../Properties/AppManifest.xml | 6 - .../Properties/AssemblyInfo.cs | 14 - .../Properties/InBrowserSettings.xml | 5 - .../Properties/OutOfBrowserSettings.xml | 7 - .../SilverlightApplication.csproj | 129 - .../SilverlightApplication.csproj.user | 28 - SampleApps/UniversalApp/MainPage.xaml.cs | 8 +- .../UniversalApp/Properties/AssemblyInfo.cs | 4 +- .../UniversalApp/Properties/Default.rd.xml | 32 +- SampleApps/UniversalApp/UniversalApp.csproj | 27 +- .../UniversalApp_TemporaryKey.pfx | Bin 2454 -> 2512 bytes SampleApps/UniversalApp/project.json | 2 +- SampleApps/UniversalApp/project.lock.json | 14573 ---------------- SampleApps/WpfApplication/MainWindow.xaml.cs | 6 +- .../WpfApplication/Properties/AssemblyInfo.cs | 4 +- .../WpfApplication/WpfApplication.csproj | 34 +- 142 files changed, 1828 insertions(+), 18384 deletions(-) rename Caching/{FileDbCache.WinRT/FileDbCache.WinRT.csproj => FileDbCache.UWP/FileDbCache.UWP.csproj} (55%) rename Caching/{FileDbCache.WinRT => FileDbCache.UWP}/FileDbCache.cs (80%) rename Caching/{FileDbCache.WinRT => FileDbCache.UWP}/Properties/AssemblyInfo.cs (75%) create mode 100644 Caching/FileDbCache.UWP/Properties/FileDbCache.UWP.rd.xml create mode 100644 Caching/FileDbCache.UWP/project.json delete mode 100644 Caching/ImageFileCache.WPF/ImageFileCache.WPF.csproj delete mode 100644 Caching/ImageFileCache.WPF/Properties/AssemblyInfo.cs delete mode 100644 Caching/ImageFileCache.WinRT/ImageFileCache.WinRT.csproj delete mode 100644 Caching/ImageFileCache.WinRT/ImageFileCache.cs delete mode 100644 Caching/ImageFileCache.WinRT/Properties/AssemblyInfo.cs delete mode 100644 MapControl/BingMapsTileLayer.cs delete mode 100644 MapControl/BitmapSourceHelper.cs delete mode 100644 MapControl/BoundingBoxConverter.cs delete mode 100644 MapControl/Extensions.Silverlight.cs delete mode 100644 MapControl/ImageTileSource.Silverlight.WinRT.cs delete mode 100644 MapControl/ImageTileSource.WPF.cs delete mode 100644 MapControl/LocationCollectionConverter.cs delete mode 100644 MapControl/LocationConverter.cs delete mode 100644 MapControl/Map.Silverlight.cs delete mode 100644 MapControl/MapControl.Silverlight.csproj delete mode 100644 MapControl/MapControl.Silverlight.csproj.user delete mode 100644 MapControl/MapControl.WPF.csproj delete mode 100644 MapControl/MapImageLayer.WPF.cs delete mode 100644 MapControl/MatrixEx.Silverlight.WinRT.cs rename MapControl/{ => Shared}/AzimuthalEquidistantProjection.cs (99%) rename MapControl/{ => Shared}/AzimuthalProjection.cs (98%) create mode 100644 MapControl/Shared/BingMapsTileLayer.cs rename MapControl/{ => Shared}/BingMapsTileSource.cs (95%) rename MapControl/{ => Shared}/BoundingBox.cs (100%) rename MapControl/{ => Shared}/CenteredBoundingBox.cs (100%) rename MapControl/{ => Shared}/EquirectangularProjection.cs (98%) rename MapControl/{ => Shared}/GnomonicProjection.cs (99%) rename MapControl/{ => Shared}/HyperlinkText.cs (87%) rename MapControl/{ => Shared}/Location.cs (93%) rename MapControl/{ => Shared}/LocationCollection.cs (100%) rename MapControl/{ => Shared}/MapBase.cs (99%) rename MapControl/{ => Shared}/MapGraticule.cs (94%) rename MapControl/{ => Shared}/MapImageLayer.cs (98%) rename MapControl/{ => Shared}/MapOverlay.cs (99%) rename MapControl/{ => Shared}/MapPanel.cs (99%) rename MapControl/{ => Shared}/MapPath.cs (99%) rename MapControl/{ => Shared}/MapPolyline.cs (84%) rename MapControl/{ => Shared}/MapProjection.cs (90%) rename MapControl/{ => Shared}/MapTileLayer.cs (94%) rename MapControl/{ => Shared}/OrthographicProjection.cs (99%) rename MapControl/{ => Shared}/StereographicProjection.cs (99%) rename MapControl/{ => Shared}/Tile.cs (98%) rename MapControl/{ => Shared}/TileGrid.cs (89%) create mode 100644 MapControl/Shared/TileImageLoader.cs rename MapControl/{ => Shared}/TileSource.cs (85%) rename MapControl/{ => Shared}/ViewportChangedEventArgs.cs (100%) rename MapControl/{ => Shared}/WebMercatorProjection.cs (95%) rename MapControl/{ => Shared}/WmsImageLayer.cs (58%) delete mode 100644 MapControl/TileImageLoader.Silverlight.cs delete mode 100644 MapControl/TileImageLoader.WPF.cs delete mode 100644 MapControl/TileImageLoader.WinRT.cs delete mode 100644 MapControl/TileSourceConverter.cs rename MapControl/{Extensions.WinRT.cs => UWP/Extensions.UWP.cs} (88%) rename MapControl/{ImageCache.WinRT.cs => UWP/ImageCache.UWP.cs} (100%) create mode 100644 MapControl/UWP/ImageFileCache.UWP.cs rename MapControl/{Map.WinRT.cs => UWP/Map.UWP.cs} (100%) rename MapControl/{MapBase.Silverlight.WinRT.cs => UWP/MapBase.UWP.cs} (97%) create mode 100644 MapControl/UWP/MapControl.UWP.csproj rename MapControl/{MapGraticule.Silverlight.WinRT.cs => UWP/MapGraticule.UWP.cs} (98%) rename MapControl/{MapImageLayer.Silverlight.WinRT.cs => UWP/MapImageLayer.UWP.cs} (62%) rename MapControl/{MapItem.Silverlight.WinRT.cs => UWP/MapItem.UWP.cs} (92%) rename MapControl/{MapItemsControl.Silverlight.WinRT.cs => UWP/MapItemsControl.UWP.cs} (91%) rename MapControl/{MapOverlay.Silverlight.WinRT.cs => UWP/MapOverlay.UWP.cs} (91%) rename MapControl/{MapPanel.Silverlight.WinRT.cs => UWP/MapPanel.UWP.cs} (96%) rename MapControl/{MapPath.Silverlight.WinRT.cs => UWP/MapPath.UWP.cs} (62%) rename MapControl/{MapPolyline.Silverlight.WinRT.cs => UWP/MapPolyline.UWP.cs} (81%) rename MapControl/{MapTileLayer.Silverlight.WinRT.cs => UWP/MapTileLayer.UWP.cs} (83%) create mode 100644 MapControl/UWP/MatrixEx.UWP.cs rename MapControl/{WinRT => UWP}/Properties/AssemblyInfo.cs (62%) create mode 100644 MapControl/UWP/Properties/MapControl.UWP.rd.xml rename MapControl/{Pushpin.Silverlight.WinRT.cs => UWP/Pushpin.UWP.cs} (92%) rename MapControl/{WinRT => UWP}/Themes/Generic.xaml (99%) rename MapControl/{Tile.Silverlight.WinRT.cs => UWP/Tile.UWP.cs} (59%) create mode 100644 MapControl/UWP/TileImageLoader.UWP.cs create mode 100644 MapControl/UWP/project.json rename Caching/ImageFileCache.WPF/ImageFileCache.cs => MapControl/WPF/ImageFileCache.WPF.cs (75%) rename MapControl/{ => WPF}/Map.WPF.cs (100%) rename MapControl/{ => WPF}/MapBase.WPF.cs (100%) create mode 100644 MapControl/WPF/MapControl.WPF.csproj rename MapControl/{ => WPF}/MapGraticule.WPF.cs (100%) create mode 100644 MapControl/WPF/MapImageLayer.WPF.cs rename MapControl/{ => WPF}/MapItem.WPF.cs (100%) rename MapControl/{ => WPF}/MapItemsControl.WPF.cs (100%) rename MapControl/{ => WPF}/MapOverlay.WPF.cs (100%) rename MapControl/{ => WPF}/MapPanel.WPF.cs (100%) rename MapControl/{ => WPF}/MapPath.WPF.cs (91%) rename MapControl/{ => WPF}/MapPolyline.WPF.cs (59%) rename MapControl/{MapScale.cs => WPF/MapScale.WPF.cs} (100%) rename MapControl/{ => WPF}/MapTileLayer.WPF.cs (86%) rename MapControl/{ => WPF}/MatrixEx.WPF.cs (90%) rename MapControl/{ => WPF}/Properties/AssemblyInfo.cs (64%) rename MapControl/{ => WPF}/Pushpin.WPF.cs (100%) rename MapControl/{ => WPF}/Themes/Generic.xaml (100%) rename MapControl/{ => WPF}/Tile.WPF.cs (52%) create mode 100644 MapControl/WPF/TileImageLoader.WPF.cs create mode 100644 MapControl/WPF/TypeConverters.WPF.cs create mode 100644 MapControl/WPF/XmlDocument.WPF.cs delete mode 100644 MapControl/WinRT/MapControl.WinRT.csproj delete mode 100644 MapControl/WinRT/MapControl.WinRT.xr.xml delete mode 100644 MapControl/WinRT/ReadMe.txt delete mode 100644 MapControl/WmsLayers.WPF.WinRT.cs rename SampleApps/{Common => Shared}/10_535_330.jpg (100%) rename SampleApps/{Common => Shared}/MapLayers.cs (100%) rename SampleApps/{Common => Shared}/MapViewModel.cs (100%) delete mode 100644 SampleApps/SilverlightApplication.Web/Properties/AssemblyInfo.cs delete mode 100644 SampleApps/SilverlightApplication.Web/Silverlight.js delete mode 100644 SampleApps/SilverlightApplication.Web/SilverlightApplication.Web.csproj delete mode 100644 SampleApps/SilverlightApplication.Web/SilverlightApplication.Web.csproj.user delete mode 100644 SampleApps/SilverlightApplication.Web/SilverlightApplicationTestPage.aspx delete mode 100644 SampleApps/SilverlightApplication.Web/SilverlightApplicationTestPage.html delete mode 100644 SampleApps/SilverlightApplication.Web/Web.Debug.config delete mode 100644 SampleApps/SilverlightApplication.Web/Web.Release.config delete mode 100644 SampleApps/SilverlightApplication.Web/Web.config delete mode 100644 SampleApps/SilverlightApplication/App.xaml delete mode 100644 SampleApps/SilverlightApplication/App.xaml.cs delete mode 100644 SampleApps/SilverlightApplication/MainPage.xaml delete mode 100644 SampleApps/SilverlightApplication/MainPage.xaml.cs delete mode 100644 SampleApps/SilverlightApplication/Properties/AppManifest.xml delete mode 100644 SampleApps/SilverlightApplication/Properties/AssemblyInfo.cs delete mode 100644 SampleApps/SilverlightApplication/Properties/InBrowserSettings.xml delete mode 100644 SampleApps/SilverlightApplication/Properties/OutOfBrowserSettings.xml delete mode 100644 SampleApps/SilverlightApplication/SilverlightApplication.csproj delete mode 100644 SampleApps/SilverlightApplication/SilverlightApplication.csproj.user delete mode 100644 SampleApps/UniversalApp/project.lock.json diff --git a/Caching/FileDbCache.WinRT/FileDbCache.WinRT.csproj b/Caching/FileDbCache.UWP/FileDbCache.UWP.csproj similarity index 55% rename from Caching/FileDbCache.WinRT/FileDbCache.WinRT.csproj rename to Caching/FileDbCache.UWP/FileDbCache.UWP.csproj index a1539756..ff503374 100644 --- a/Caching/FileDbCache.WinRT/FileDbCache.WinRT.csproj +++ b/Caching/FileDbCache.UWP/FileDbCache.UWP.csproj @@ -1,37 +1,69 @@  - + - 12.0 Debug AnyCPU - {C7BF2B18-CC74-430B-BCB2-600304EFA3D8} + {3FF37D40-F770-45B2-95DD-7A84093E1425} Library Properties MapControl.Caching - FileDbCache.WinRT + FileDbCache.UWP en-US + UAP + 10.0.10240.0 + 10.0.10240.0 + 14 512 - {786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - Profile32 - v4.6 + {A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + win10-arm;win10-arm-aot;win10-x86;win10-x86-aot;win10-x64;win10-x64-aot + AnyCPU true full false - bin\Debug\ - DEBUG;TRACE + ..\bin\Debug\ + DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP prompt 4 + true + AnyCPU none true - bin\Release\ - TRACE + ..\bin\Release\ + TRACE;NETFX_CORE;WINDOWS_UWP prompt 4 + true + + + + + MapControl.snk + + + + + + + + + + + ..\FileDb\FileDbPcl.dll + + + + + {951bc5d2-d653-42d9-9a91-21dc50de0182} + MapControl.UWP + + + + 14.0 true @@ -39,31 +71,7 @@ ..\..\MapControl.snk - - - - - - - - - - - MapControl.snk - - - - - {63cefdf7-5170-43b6-86f8-5c4a383a1615} - MapControl.WinRT - - - - - ..\FileDb\FileDbPcl.dll - - - + - \ No newline at end of file diff --git a/Caching/ImageFileCache.WPF/Properties/AssemblyInfo.cs b/Caching/ImageFileCache.WPF/Properties/AssemblyInfo.cs deleted file mode 100644 index 73ce5b1f..00000000 --- a/Caching/ImageFileCache.WPF/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System.Reflection; -using System.Runtime.InteropServices; - -[assembly: AssemblyTitle("XAML Map Control ImageFileCache (WPF)")] -[assembly: AssemblyDescription("ObjectCache implementation based on local image files")] -[assembly: AssemblyProduct("XAML Map Control")] -[assembly: AssemblyCompany("Clemens Fischer")] -[assembly: AssemblyCopyright("© 2017 Clemens Fischer")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyVersion("3.4.1")] -[assembly: AssemblyFileVersion("3.4.1")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCulture("")] -[assembly: ComVisible(false)] diff --git a/Caching/ImageFileCache.WinRT/ImageFileCache.WinRT.csproj b/Caching/ImageFileCache.WinRT/ImageFileCache.WinRT.csproj deleted file mode 100644 index 148d5184..00000000 --- a/Caching/ImageFileCache.WinRT/ImageFileCache.WinRT.csproj +++ /dev/null @@ -1,66 +0,0 @@ - - - - - 12.0 - Debug - AnyCPU - {F789647E-96F7-43E3-A895-FA3FE8D01260} - Library - Properties - MapControl.Caching - ImageFileCache.WinRT - en-US - 512 - {BC8A1FFA-BEE3-4634-8014-F334798102B3};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - Windows - 8.1 - - - true - full - false - bin\Debug\ - DEBUG;TRACE;NETFX_CORE;WINDOWS_APP - prompt - 4 - - - none - true - bin\Release\ - TRACE;NETFX_CORE;WINDOWS_APP - prompt - 4 - - - true - - - ..\..\MapControl.snk - - - - - MapControl.snk - - - - - - - - - {63cefdf7-5170-43b6-86f8-5c4a383a1615} - MapControl.WinRT - - - - - \ No newline at end of file diff --git a/Caching/ImageFileCache.WinRT/ImageFileCache.cs b/Caching/ImageFileCache.WinRT/ImageFileCache.cs deleted file mode 100644 index 51040ec7..00000000 --- a/Caching/ImageFileCache.WinRT/ImageFileCache.cs +++ /dev/null @@ -1,93 +0,0 @@ -// XAML Map Control - https://github.com/ClemensFischer/XAML-Map-Control -// © 2017 Clemens Fischer -// Licensed under the Microsoft Public License (Ms-PL) - -using System; -using System.Diagnostics; -using System.Threading.Tasks; -using Windows.Storage; -using Windows.Storage.Streams; - -namespace MapControl.Caching -{ - public class ImageFileCache : IImageCache - { - private readonly string name; - private StorageFolder rootFolder; - - public ImageFileCache(string name = null, StorageFolder folder = null) - { - if (string.IsNullOrEmpty(name)) - { - name = TileImageLoader.DefaultCacheName; - } - - if (folder == null) - { - folder = TileImageLoader.DefaultCacheFolder; - } - - this.name = name; - - folder.CreateFolderAsync(name, CreationCollisionOption.OpenIfExists).Completed = (o, s) => - { - rootFolder = o.GetResults(); - Debug.WriteLine("Created ImageFileCache in " + rootFolder.Path); - }; - } - - public virtual async Task GetAsync(string key) - { - var item = await rootFolder.TryGetItemAsync(key); - - if (item != null && item.IsOfType(StorageItemTypes.File)) - { - var file = (StorageFile)item; - //Debug.WriteLine("ImageFileCache: Reading " + file.Path); - - try - { - return new ImageCacheItem - { - Buffer = await FileIO.ReadBufferAsync(file), - Expiration = (await file.Properties.GetImagePropertiesAsync()).DateTaken.UtcDateTime - }; - } - catch (Exception ex) - { - Debug.WriteLine("ImageFileCache: Reading {0}: {1}", file.Path, ex.Message); - } - } - - return null; - } - - public virtual async Task SetAsync(string key, IBuffer buffer, DateTime expiration) - { - try - { - var names = key.Split('\\'); - var folder = rootFolder; - - for (int i = 0; i < names.Length - 1; i++) - { - folder = await folder.CreateFolderAsync(names[i], CreationCollisionOption.OpenIfExists); - } - - var file = await folder.CreateFileAsync(names[names.Length - 1], CreationCollisionOption.ReplaceExisting); - //Debug.WriteLine("ImageFileCache: Writing {0}, Expires {1}", file.Path, expiration.ToLocalTime()); - - await FileIO.WriteBufferAsync(file, buffer); - - // Store expiration date in ImageProperties.DateTaken - var properties = await file.Properties.GetImagePropertiesAsync(); - properties.DateTaken = expiration; - await properties.SavePropertiesAsync(); - } - catch (Exception ex) - { - Debug.WriteLine("ImageFileCache: Writing {0}\\{1}: {2}", rootFolder.Path, key, ex.Message); - } - } - } -} diff --git a/Caching/ImageFileCache.WinRT/Properties/AssemblyInfo.cs b/Caching/ImageFileCache.WinRT/Properties/AssemblyInfo.cs deleted file mode 100644 index 11cc5c93..00000000 --- a/Caching/ImageFileCache.WinRT/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System.Reflection; -using System.Runtime.InteropServices; - -[assembly: AssemblyTitle("XAML Map Control ImageFileCache (WinRT)")] -[assembly: AssemblyDescription("IImageCache implementation based on local image files")] -[assembly: AssemblyProduct("XAML Map Control")] -[assembly: AssemblyCompany("Clemens Fischer")] -[assembly: AssemblyCopyright("© 2017 Clemens Fischer")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyVersion("3.4.1")] -[assembly: AssemblyFileVersion("3.4.1")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCulture("")] -[assembly: ComVisible(false)] diff --git a/MapControl.sln b/MapControl.sln index 49a24d8c..b711a639 100644 --- a/MapControl.sln +++ b/MapControl.sln @@ -1,33 +1,25 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 14 -VisualStudioVersion = 14.0.25420.1 +VisualStudioVersion = 14.0.25123.0 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FileDbCache.WinRT", "Caching\FileDbCache.WinRT\FileDbCache.WinRT.csproj", "{C7BF2B18-CC74-430B-BCB2-600304EFA3D8}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "MapControl", "MapControl", "{52AECE49-F314-4F76-98F2-FA800F07824B}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FileDbCache.WPF", "Caching\FileDbCache.WPF\FileDbCache.WPF.csproj", "{EF44F661-B98A-4676-927F-85D138F82300}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MapControl.WPF", "MapControl\WPF\MapControl.WPF.csproj", "{A204A102-C745-4D65-AEC8-7B96FAEDEF2D}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ImageFileCache.WinRT", "Caching\ImageFileCache.WinRT\ImageFileCache.WinRT.csproj", "{F789647E-96F7-43E3-A895-FA3FE8D01260}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MapControl.UWP", "MapControl\UWP\MapControl.UWP.csproj", "{951BC5D2-D653-42D9-9A91-21DC50DE0182}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ImageFileCache.WPF", "Caching\ImageFileCache.WPF\ImageFileCache.WPF.csproj", "{86470440-FEE2-4120-AF5A-3762FB9C536F}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Caching", "Caching", "{6A596588-F93F-47CC-BE5D-58C3B34ADDEB}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MapControl.Silverlight", "MapControl\MapControl.Silverlight.csproj", "{EB133B78-DEFF-416A-8F0C-89E54D766576}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SampleApps", "SampleApps", "{8F2103C2-78AF-4810-8FB9-67572F50C8FC}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MapControl.WinRT", "MapControl\WinRT\MapControl.WinRT.csproj", "{63CEFDF7-5170-43B6-86F8-5C4A383A1615}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MapControl.WPF", "MapControl\MapControl.WPF.csproj", "{226F3575-B683-446D-A2F0-181291DC8787}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WpfApplication", "SampleApps\WpfApplication\WpfApplication.csproj", "{9949326E-9261-4F95-89B1-151F60498951}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SampleApps", "SampleApps", "{100879CC-8910-459E-856E-253D629E45DE}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Caching", "Caching", "{AE8A7E02-0F7D-41B0-AB23-15394150ED17}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WpfApplication", "SampleApps\WpfApplication\WpfApplication.csproj", "{F92DA93D-75DB-4308-A5F9-6B4C3908A675}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UniversalApp", "SampleApps\UniversalApp\UniversalApp.csproj", "{AA62B4AA-1CA3-4C20-BEB7-B824D0FC4BD1}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SilverlightApplication", "SampleApps\SilverlightApplication\SilverlightApplication.csproj", "{85AACDB7-959D-406D-A8DF-2F1E013F8F40}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FileDbCache.WPF", "Caching\FileDbCache.WPF\FileDbCache.WPF.csproj", "{AD1CB53E-7AA4-4EC0-B901-B4E0E2665133}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SilverlightApplication.Web", "SampleApps\SilverlightApplication.Web\SilverlightApplication.Web.csproj", "{7FB616E1-E0D4-48FA-8AFD-60E73FCF32E4}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FileDbCache.UWP", "Caching\FileDbCache.UWP\FileDbCache.UWP.csproj", "{3FF37D40-F770-45B2-95DD-7A84093E1425}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -41,135 +33,57 @@ Global Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {C7BF2B18-CC74-430B-BCB2-600304EFA3D8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {C7BF2B18-CC74-430B-BCB2-600304EFA3D8}.Debug|Any CPU.Build.0 = Debug|Any CPU - {C7BF2B18-CC74-430B-BCB2-600304EFA3D8}.Debug|ARM.ActiveCfg = Debug|Any CPU - {C7BF2B18-CC74-430B-BCB2-600304EFA3D8}.Debug|ARM.Build.0 = Debug|Any CPU - {C7BF2B18-CC74-430B-BCB2-600304EFA3D8}.Debug|x64.ActiveCfg = Debug|Any CPU - {C7BF2B18-CC74-430B-BCB2-600304EFA3D8}.Debug|x64.Build.0 = Debug|Any CPU - {C7BF2B18-CC74-430B-BCB2-600304EFA3D8}.Debug|x86.ActiveCfg = Debug|Any CPU - {C7BF2B18-CC74-430B-BCB2-600304EFA3D8}.Debug|x86.Build.0 = Debug|Any CPU - {C7BF2B18-CC74-430B-BCB2-600304EFA3D8}.Release|Any CPU.ActiveCfg = Release|Any CPU - {C7BF2B18-CC74-430B-BCB2-600304EFA3D8}.Release|Any CPU.Build.0 = Release|Any CPU - {C7BF2B18-CC74-430B-BCB2-600304EFA3D8}.Release|ARM.ActiveCfg = Release|Any CPU - {C7BF2B18-CC74-430B-BCB2-600304EFA3D8}.Release|ARM.Build.0 = Release|Any CPU - {C7BF2B18-CC74-430B-BCB2-600304EFA3D8}.Release|x64.ActiveCfg = Release|Any CPU - {C7BF2B18-CC74-430B-BCB2-600304EFA3D8}.Release|x64.Build.0 = Release|Any CPU - {C7BF2B18-CC74-430B-BCB2-600304EFA3D8}.Release|x86.ActiveCfg = Release|Any CPU - {C7BF2B18-CC74-430B-BCB2-600304EFA3D8}.Release|x86.Build.0 = Release|Any CPU - {EF44F661-B98A-4676-927F-85D138F82300}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {EF44F661-B98A-4676-927F-85D138F82300}.Debug|Any CPU.Build.0 = Debug|Any CPU - {EF44F661-B98A-4676-927F-85D138F82300}.Debug|ARM.ActiveCfg = Debug|Any CPU - {EF44F661-B98A-4676-927F-85D138F82300}.Debug|ARM.Build.0 = Debug|Any CPU - {EF44F661-B98A-4676-927F-85D138F82300}.Debug|x64.ActiveCfg = Debug|Any CPU - {EF44F661-B98A-4676-927F-85D138F82300}.Debug|x64.Build.0 = Debug|Any CPU - {EF44F661-B98A-4676-927F-85D138F82300}.Debug|x86.ActiveCfg = Debug|Any CPU - {EF44F661-B98A-4676-927F-85D138F82300}.Debug|x86.Build.0 = Debug|Any CPU - {EF44F661-B98A-4676-927F-85D138F82300}.Release|Any CPU.ActiveCfg = Release|Any CPU - {EF44F661-B98A-4676-927F-85D138F82300}.Release|Any CPU.Build.0 = Release|Any CPU - {EF44F661-B98A-4676-927F-85D138F82300}.Release|ARM.ActiveCfg = Release|Any CPU - {EF44F661-B98A-4676-927F-85D138F82300}.Release|ARM.Build.0 = Release|Any CPU - {EF44F661-B98A-4676-927F-85D138F82300}.Release|x64.ActiveCfg = Release|Any CPU - {EF44F661-B98A-4676-927F-85D138F82300}.Release|x64.Build.0 = Release|Any CPU - {EF44F661-B98A-4676-927F-85D138F82300}.Release|x86.ActiveCfg = Release|Any CPU - {EF44F661-B98A-4676-927F-85D138F82300}.Release|x86.Build.0 = Release|Any CPU - {F789647E-96F7-43E3-A895-FA3FE8D01260}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {F789647E-96F7-43E3-A895-FA3FE8D01260}.Debug|Any CPU.Build.0 = Debug|Any CPU - {F789647E-96F7-43E3-A895-FA3FE8D01260}.Debug|ARM.ActiveCfg = Debug|Any CPU - {F789647E-96F7-43E3-A895-FA3FE8D01260}.Debug|ARM.Build.0 = Debug|Any CPU - {F789647E-96F7-43E3-A895-FA3FE8D01260}.Debug|x64.ActiveCfg = Debug|Any CPU - {F789647E-96F7-43E3-A895-FA3FE8D01260}.Debug|x64.Build.0 = Debug|Any CPU - {F789647E-96F7-43E3-A895-FA3FE8D01260}.Debug|x86.ActiveCfg = Debug|Any CPU - {F789647E-96F7-43E3-A895-FA3FE8D01260}.Debug|x86.Build.0 = Debug|Any CPU - {F789647E-96F7-43E3-A895-FA3FE8D01260}.Release|Any CPU.ActiveCfg = Release|Any CPU - {F789647E-96F7-43E3-A895-FA3FE8D01260}.Release|Any CPU.Build.0 = Release|Any CPU - {F789647E-96F7-43E3-A895-FA3FE8D01260}.Release|ARM.ActiveCfg = Release|Any CPU - {F789647E-96F7-43E3-A895-FA3FE8D01260}.Release|ARM.Build.0 = Release|Any CPU - {F789647E-96F7-43E3-A895-FA3FE8D01260}.Release|x64.ActiveCfg = Release|Any CPU - {F789647E-96F7-43E3-A895-FA3FE8D01260}.Release|x64.Build.0 = Release|Any CPU - {F789647E-96F7-43E3-A895-FA3FE8D01260}.Release|x86.ActiveCfg = Release|Any CPU - {F789647E-96F7-43E3-A895-FA3FE8D01260}.Release|x86.Build.0 = Release|Any CPU - {86470440-FEE2-4120-AF5A-3762FB9C536F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {86470440-FEE2-4120-AF5A-3762FB9C536F}.Debug|Any CPU.Build.0 = Debug|Any CPU - {86470440-FEE2-4120-AF5A-3762FB9C536F}.Debug|ARM.ActiveCfg = Debug|Any CPU - {86470440-FEE2-4120-AF5A-3762FB9C536F}.Debug|ARM.Build.0 = Debug|Any CPU - {86470440-FEE2-4120-AF5A-3762FB9C536F}.Debug|x64.ActiveCfg = Debug|Any CPU - {86470440-FEE2-4120-AF5A-3762FB9C536F}.Debug|x64.Build.0 = Debug|Any CPU - {86470440-FEE2-4120-AF5A-3762FB9C536F}.Debug|x86.ActiveCfg = Debug|Any CPU - {86470440-FEE2-4120-AF5A-3762FB9C536F}.Debug|x86.Build.0 = Debug|Any CPU - {86470440-FEE2-4120-AF5A-3762FB9C536F}.Release|Any CPU.ActiveCfg = Release|Any CPU - {86470440-FEE2-4120-AF5A-3762FB9C536F}.Release|Any CPU.Build.0 = Release|Any CPU - {86470440-FEE2-4120-AF5A-3762FB9C536F}.Release|ARM.ActiveCfg = Release|Any CPU - {86470440-FEE2-4120-AF5A-3762FB9C536F}.Release|ARM.Build.0 = Release|Any CPU - {86470440-FEE2-4120-AF5A-3762FB9C536F}.Release|x64.ActiveCfg = Release|Any CPU - {86470440-FEE2-4120-AF5A-3762FB9C536F}.Release|x64.Build.0 = Release|Any CPU - {86470440-FEE2-4120-AF5A-3762FB9C536F}.Release|x86.ActiveCfg = Release|Any CPU - {86470440-FEE2-4120-AF5A-3762FB9C536F}.Release|x86.Build.0 = Release|Any CPU - {EB133B78-DEFF-416A-8F0C-89E54D766576}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {EB133B78-DEFF-416A-8F0C-89E54D766576}.Debug|Any CPU.Build.0 = Debug|Any CPU - {EB133B78-DEFF-416A-8F0C-89E54D766576}.Debug|ARM.ActiveCfg = Debug|Any CPU - {EB133B78-DEFF-416A-8F0C-89E54D766576}.Debug|ARM.Build.0 = Debug|Any CPU - {EB133B78-DEFF-416A-8F0C-89E54D766576}.Debug|x64.ActiveCfg = Debug|Any CPU - {EB133B78-DEFF-416A-8F0C-89E54D766576}.Debug|x64.Build.0 = Debug|Any CPU - {EB133B78-DEFF-416A-8F0C-89E54D766576}.Debug|x86.ActiveCfg = Debug|Any CPU - {EB133B78-DEFF-416A-8F0C-89E54D766576}.Debug|x86.Build.0 = Debug|Any CPU - {EB133B78-DEFF-416A-8F0C-89E54D766576}.Release|Any CPU.ActiveCfg = Release|Any CPU - {EB133B78-DEFF-416A-8F0C-89E54D766576}.Release|Any CPU.Build.0 = Release|Any CPU - {EB133B78-DEFF-416A-8F0C-89E54D766576}.Release|ARM.ActiveCfg = Release|Any CPU - {EB133B78-DEFF-416A-8F0C-89E54D766576}.Release|ARM.Build.0 = Release|Any CPU - {EB133B78-DEFF-416A-8F0C-89E54D766576}.Release|x64.ActiveCfg = Release|Any CPU - {EB133B78-DEFF-416A-8F0C-89E54D766576}.Release|x64.Build.0 = Release|Any CPU - {EB133B78-DEFF-416A-8F0C-89E54D766576}.Release|x86.ActiveCfg = Release|Any CPU - {EB133B78-DEFF-416A-8F0C-89E54D766576}.Release|x86.Build.0 = Release|Any CPU - {63CEFDF7-5170-43B6-86F8-5C4A383A1615}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {63CEFDF7-5170-43B6-86F8-5C4A383A1615}.Debug|Any CPU.Build.0 = Debug|Any CPU - {63CEFDF7-5170-43B6-86F8-5C4A383A1615}.Debug|ARM.ActiveCfg = Debug|Any CPU - {63CEFDF7-5170-43B6-86F8-5C4A383A1615}.Debug|ARM.Build.0 = Debug|Any CPU - {63CEFDF7-5170-43B6-86F8-5C4A383A1615}.Debug|x64.ActiveCfg = Debug|Any CPU - {63CEFDF7-5170-43B6-86F8-5C4A383A1615}.Debug|x64.Build.0 = Debug|Any CPU - {63CEFDF7-5170-43B6-86F8-5C4A383A1615}.Debug|x86.ActiveCfg = Debug|Any CPU - {63CEFDF7-5170-43B6-86F8-5C4A383A1615}.Debug|x86.Build.0 = Debug|Any CPU - {63CEFDF7-5170-43B6-86F8-5C4A383A1615}.Release|Any CPU.ActiveCfg = Release|Any CPU - {63CEFDF7-5170-43B6-86F8-5C4A383A1615}.Release|Any CPU.Build.0 = Release|Any CPU - {63CEFDF7-5170-43B6-86F8-5C4A383A1615}.Release|ARM.ActiveCfg = Release|Any CPU - {63CEFDF7-5170-43B6-86F8-5C4A383A1615}.Release|ARM.Build.0 = Release|Any CPU - {63CEFDF7-5170-43B6-86F8-5C4A383A1615}.Release|x64.ActiveCfg = Release|Any CPU - {63CEFDF7-5170-43B6-86F8-5C4A383A1615}.Release|x64.Build.0 = Release|Any CPU - {63CEFDF7-5170-43B6-86F8-5C4A383A1615}.Release|x86.ActiveCfg = Release|Any CPU - {63CEFDF7-5170-43B6-86F8-5C4A383A1615}.Release|x86.Build.0 = Release|Any CPU - {226F3575-B683-446D-A2F0-181291DC8787}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {226F3575-B683-446D-A2F0-181291DC8787}.Debug|Any CPU.Build.0 = Debug|Any CPU - {226F3575-B683-446D-A2F0-181291DC8787}.Debug|ARM.ActiveCfg = Debug|Any CPU - {226F3575-B683-446D-A2F0-181291DC8787}.Debug|ARM.Build.0 = Debug|Any CPU - {226F3575-B683-446D-A2F0-181291DC8787}.Debug|x64.ActiveCfg = Debug|Any CPU - {226F3575-B683-446D-A2F0-181291DC8787}.Debug|x64.Build.0 = Debug|Any CPU - {226F3575-B683-446D-A2F0-181291DC8787}.Debug|x86.ActiveCfg = Debug|Any CPU - {226F3575-B683-446D-A2F0-181291DC8787}.Debug|x86.Build.0 = Debug|Any CPU - {226F3575-B683-446D-A2F0-181291DC8787}.Release|Any CPU.ActiveCfg = Release|Any CPU - {226F3575-B683-446D-A2F0-181291DC8787}.Release|Any CPU.Build.0 = Release|Any CPU - {226F3575-B683-446D-A2F0-181291DC8787}.Release|ARM.ActiveCfg = Release|Any CPU - {226F3575-B683-446D-A2F0-181291DC8787}.Release|ARM.Build.0 = Release|Any CPU - {226F3575-B683-446D-A2F0-181291DC8787}.Release|x64.ActiveCfg = Release|Any CPU - {226F3575-B683-446D-A2F0-181291DC8787}.Release|x64.Build.0 = Release|Any CPU - {226F3575-B683-446D-A2F0-181291DC8787}.Release|x86.ActiveCfg = Release|Any CPU - {226F3575-B683-446D-A2F0-181291DC8787}.Release|x86.Build.0 = Release|Any CPU - {9949326E-9261-4F95-89B1-151F60498951}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {9949326E-9261-4F95-89B1-151F60498951}.Debug|Any CPU.Build.0 = Debug|Any CPU - {9949326E-9261-4F95-89B1-151F60498951}.Debug|ARM.ActiveCfg = Debug|Any CPU - {9949326E-9261-4F95-89B1-151F60498951}.Debug|ARM.Build.0 = Debug|Any CPU - {9949326E-9261-4F95-89B1-151F60498951}.Debug|x64.ActiveCfg = Debug|Any CPU - {9949326E-9261-4F95-89B1-151F60498951}.Debug|x64.Build.0 = Debug|Any CPU - {9949326E-9261-4F95-89B1-151F60498951}.Debug|x86.ActiveCfg = Debug|Any CPU - {9949326E-9261-4F95-89B1-151F60498951}.Debug|x86.Build.0 = Debug|Any CPU - {9949326E-9261-4F95-89B1-151F60498951}.Release|Any CPU.ActiveCfg = Release|Any CPU - {9949326E-9261-4F95-89B1-151F60498951}.Release|Any CPU.Build.0 = Release|Any CPU - {9949326E-9261-4F95-89B1-151F60498951}.Release|ARM.ActiveCfg = Release|Any CPU - {9949326E-9261-4F95-89B1-151F60498951}.Release|ARM.Build.0 = Release|Any CPU - {9949326E-9261-4F95-89B1-151F60498951}.Release|x64.ActiveCfg = Release|Any CPU - {9949326E-9261-4F95-89B1-151F60498951}.Release|x64.Build.0 = Release|Any CPU - {9949326E-9261-4F95-89B1-151F60498951}.Release|x86.ActiveCfg = Release|Any CPU - {9949326E-9261-4F95-89B1-151F60498951}.Release|x86.Build.0 = Release|Any CPU - {AA62B4AA-1CA3-4C20-BEB7-B824D0FC4BD1}.Debug|Any CPU.ActiveCfg = Debug|ARM + {A204A102-C745-4D65-AEC8-7B96FAEDEF2D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A204A102-C745-4D65-AEC8-7B96FAEDEF2D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A204A102-C745-4D65-AEC8-7B96FAEDEF2D}.Debug|ARM.ActiveCfg = Debug|Any CPU + {A204A102-C745-4D65-AEC8-7B96FAEDEF2D}.Debug|ARM.Build.0 = Debug|Any CPU + {A204A102-C745-4D65-AEC8-7B96FAEDEF2D}.Debug|x64.ActiveCfg = Debug|Any CPU + {A204A102-C745-4D65-AEC8-7B96FAEDEF2D}.Debug|x64.Build.0 = Debug|Any CPU + {A204A102-C745-4D65-AEC8-7B96FAEDEF2D}.Debug|x86.ActiveCfg = Debug|Any CPU + {A204A102-C745-4D65-AEC8-7B96FAEDEF2D}.Debug|x86.Build.0 = Debug|Any CPU + {A204A102-C745-4D65-AEC8-7B96FAEDEF2D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A204A102-C745-4D65-AEC8-7B96FAEDEF2D}.Release|Any CPU.Build.0 = Release|Any CPU + {A204A102-C745-4D65-AEC8-7B96FAEDEF2D}.Release|ARM.ActiveCfg = Release|Any CPU + {A204A102-C745-4D65-AEC8-7B96FAEDEF2D}.Release|ARM.Build.0 = Release|Any CPU + {A204A102-C745-4D65-AEC8-7B96FAEDEF2D}.Release|x64.ActiveCfg = Release|Any CPU + {A204A102-C745-4D65-AEC8-7B96FAEDEF2D}.Release|x64.Build.0 = Release|Any CPU + {A204A102-C745-4D65-AEC8-7B96FAEDEF2D}.Release|x86.ActiveCfg = Release|Any CPU + {A204A102-C745-4D65-AEC8-7B96FAEDEF2D}.Release|x86.Build.0 = Release|Any CPU + {951BC5D2-D653-42D9-9A91-21DC50DE0182}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {951BC5D2-D653-42D9-9A91-21DC50DE0182}.Debug|Any CPU.Build.0 = Debug|Any CPU + {951BC5D2-D653-42D9-9A91-21DC50DE0182}.Debug|ARM.ActiveCfg = Debug|Any CPU + {951BC5D2-D653-42D9-9A91-21DC50DE0182}.Debug|ARM.Build.0 = Debug|Any CPU + {951BC5D2-D653-42D9-9A91-21DC50DE0182}.Debug|x64.ActiveCfg = Debug|Any CPU + {951BC5D2-D653-42D9-9A91-21DC50DE0182}.Debug|x64.Build.0 = Debug|Any CPU + {951BC5D2-D653-42D9-9A91-21DC50DE0182}.Debug|x86.ActiveCfg = Debug|Any CPU + {951BC5D2-D653-42D9-9A91-21DC50DE0182}.Debug|x86.Build.0 = Debug|Any CPU + {951BC5D2-D653-42D9-9A91-21DC50DE0182}.Release|Any CPU.ActiveCfg = Release|Any CPU + {951BC5D2-D653-42D9-9A91-21DC50DE0182}.Release|Any CPU.Build.0 = Release|Any CPU + {951BC5D2-D653-42D9-9A91-21DC50DE0182}.Release|ARM.ActiveCfg = Release|Any CPU + {951BC5D2-D653-42D9-9A91-21DC50DE0182}.Release|ARM.Build.0 = Release|Any CPU + {951BC5D2-D653-42D9-9A91-21DC50DE0182}.Release|x64.ActiveCfg = Release|Any CPU + {951BC5D2-D653-42D9-9A91-21DC50DE0182}.Release|x64.Build.0 = Release|Any CPU + {951BC5D2-D653-42D9-9A91-21DC50DE0182}.Release|x86.ActiveCfg = Release|Any CPU + {951BC5D2-D653-42D9-9A91-21DC50DE0182}.Release|x86.Build.0 = Release|Any CPU + {F92DA93D-75DB-4308-A5F9-6B4C3908A675}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F92DA93D-75DB-4308-A5F9-6B4C3908A675}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F92DA93D-75DB-4308-A5F9-6B4C3908A675}.Debug|ARM.ActiveCfg = Debug|Any CPU + {F92DA93D-75DB-4308-A5F9-6B4C3908A675}.Debug|ARM.Build.0 = Debug|Any CPU + {F92DA93D-75DB-4308-A5F9-6B4C3908A675}.Debug|x64.ActiveCfg = Debug|Any CPU + {F92DA93D-75DB-4308-A5F9-6B4C3908A675}.Debug|x64.Build.0 = Debug|Any CPU + {F92DA93D-75DB-4308-A5F9-6B4C3908A675}.Debug|x86.ActiveCfg = Debug|Any CPU + {F92DA93D-75DB-4308-A5F9-6B4C3908A675}.Debug|x86.Build.0 = Debug|Any CPU + {F92DA93D-75DB-4308-A5F9-6B4C3908A675}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F92DA93D-75DB-4308-A5F9-6B4C3908A675}.Release|Any CPU.Build.0 = Release|Any CPU + {F92DA93D-75DB-4308-A5F9-6B4C3908A675}.Release|ARM.ActiveCfg = Release|Any CPU + {F92DA93D-75DB-4308-A5F9-6B4C3908A675}.Release|ARM.Build.0 = Release|Any CPU + {F92DA93D-75DB-4308-A5F9-6B4C3908A675}.Release|x64.ActiveCfg = Release|Any CPU + {F92DA93D-75DB-4308-A5F9-6B4C3908A675}.Release|x64.Build.0 = Release|Any CPU + {F92DA93D-75DB-4308-A5F9-6B4C3908A675}.Release|x86.ActiveCfg = Release|Any CPU + {F92DA93D-75DB-4308-A5F9-6B4C3908A675}.Release|x86.Build.0 = Release|Any CPU + {AA62B4AA-1CA3-4C20-BEB7-B824D0FC4BD1}.Debug|Any CPU.ActiveCfg = Debug|x64 + {AA62B4AA-1CA3-4C20-BEB7-B824D0FC4BD1}.Debug|Any CPU.Build.0 = Debug|x64 + {AA62B4AA-1CA3-4C20-BEB7-B824D0FC4BD1}.Debug|Any CPU.Deploy.0 = Debug|x64 {AA62B4AA-1CA3-4C20-BEB7-B824D0FC4BD1}.Debug|ARM.ActiveCfg = Debug|ARM {AA62B4AA-1CA3-4C20-BEB7-B824D0FC4BD1}.Debug|ARM.Build.0 = Debug|ARM {AA62B4AA-1CA3-4C20-BEB7-B824D0FC4BD1}.Debug|ARM.Deploy.0 = Debug|ARM @@ -189,50 +103,48 @@ Global {AA62B4AA-1CA3-4C20-BEB7-B824D0FC4BD1}.Release|x86.ActiveCfg = Release|x86 {AA62B4AA-1CA3-4C20-BEB7-B824D0FC4BD1}.Release|x86.Build.0 = Release|x86 {AA62B4AA-1CA3-4C20-BEB7-B824D0FC4BD1}.Release|x86.Deploy.0 = Release|x86 - {85AACDB7-959D-406D-A8DF-2F1E013F8F40}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {85AACDB7-959D-406D-A8DF-2F1E013F8F40}.Debug|Any CPU.Build.0 = Debug|Any CPU - {85AACDB7-959D-406D-A8DF-2F1E013F8F40}.Debug|ARM.ActiveCfg = Debug|Any CPU - {85AACDB7-959D-406D-A8DF-2F1E013F8F40}.Debug|ARM.Build.0 = Debug|Any CPU - {85AACDB7-959D-406D-A8DF-2F1E013F8F40}.Debug|x64.ActiveCfg = Debug|Any CPU - {85AACDB7-959D-406D-A8DF-2F1E013F8F40}.Debug|x64.Build.0 = Debug|Any CPU - {85AACDB7-959D-406D-A8DF-2F1E013F8F40}.Debug|x86.ActiveCfg = Debug|Any CPU - {85AACDB7-959D-406D-A8DF-2F1E013F8F40}.Debug|x86.Build.0 = Debug|Any CPU - {85AACDB7-959D-406D-A8DF-2F1E013F8F40}.Release|Any CPU.ActiveCfg = Release|Any CPU - {85AACDB7-959D-406D-A8DF-2F1E013F8F40}.Release|Any CPU.Build.0 = Release|Any CPU - {85AACDB7-959D-406D-A8DF-2F1E013F8F40}.Release|ARM.ActiveCfg = Release|Any CPU - {85AACDB7-959D-406D-A8DF-2F1E013F8F40}.Release|ARM.Build.0 = Release|Any CPU - {85AACDB7-959D-406D-A8DF-2F1E013F8F40}.Release|x64.ActiveCfg = Release|Any CPU - {85AACDB7-959D-406D-A8DF-2F1E013F8F40}.Release|x64.Build.0 = Release|Any CPU - {85AACDB7-959D-406D-A8DF-2F1E013F8F40}.Release|x86.ActiveCfg = Release|Any CPU - {85AACDB7-959D-406D-A8DF-2F1E013F8F40}.Release|x86.Build.0 = Release|Any CPU - {7FB616E1-E0D4-48FA-8AFD-60E73FCF32E4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {7FB616E1-E0D4-48FA-8AFD-60E73FCF32E4}.Debug|Any CPU.Build.0 = Debug|Any CPU - {7FB616E1-E0D4-48FA-8AFD-60E73FCF32E4}.Debug|ARM.ActiveCfg = Debug|Any CPU - {7FB616E1-E0D4-48FA-8AFD-60E73FCF32E4}.Debug|ARM.Build.0 = Debug|Any CPU - {7FB616E1-E0D4-48FA-8AFD-60E73FCF32E4}.Debug|x64.ActiveCfg = Debug|Any CPU - {7FB616E1-E0D4-48FA-8AFD-60E73FCF32E4}.Debug|x64.Build.0 = Debug|Any CPU - {7FB616E1-E0D4-48FA-8AFD-60E73FCF32E4}.Debug|x86.ActiveCfg = Debug|Any CPU - {7FB616E1-E0D4-48FA-8AFD-60E73FCF32E4}.Debug|x86.Build.0 = Debug|Any CPU - {7FB616E1-E0D4-48FA-8AFD-60E73FCF32E4}.Release|Any CPU.ActiveCfg = Release|Any CPU - {7FB616E1-E0D4-48FA-8AFD-60E73FCF32E4}.Release|Any CPU.Build.0 = Release|Any CPU - {7FB616E1-E0D4-48FA-8AFD-60E73FCF32E4}.Release|ARM.ActiveCfg = Release|Any CPU - {7FB616E1-E0D4-48FA-8AFD-60E73FCF32E4}.Release|ARM.Build.0 = Release|Any CPU - {7FB616E1-E0D4-48FA-8AFD-60E73FCF32E4}.Release|x64.ActiveCfg = Release|Any CPU - {7FB616E1-E0D4-48FA-8AFD-60E73FCF32E4}.Release|x64.Build.0 = Release|Any CPU - {7FB616E1-E0D4-48FA-8AFD-60E73FCF32E4}.Release|x86.ActiveCfg = Release|Any CPU - {7FB616E1-E0D4-48FA-8AFD-60E73FCF32E4}.Release|x86.Build.0 = Release|Any CPU + {AD1CB53E-7AA4-4EC0-B901-B4E0E2665133}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {AD1CB53E-7AA4-4EC0-B901-B4E0E2665133}.Debug|Any CPU.Build.0 = Debug|Any CPU + {AD1CB53E-7AA4-4EC0-B901-B4E0E2665133}.Debug|ARM.ActiveCfg = Debug|Any CPU + {AD1CB53E-7AA4-4EC0-B901-B4E0E2665133}.Debug|ARM.Build.0 = Debug|Any CPU + {AD1CB53E-7AA4-4EC0-B901-B4E0E2665133}.Debug|x64.ActiveCfg = Debug|Any CPU + {AD1CB53E-7AA4-4EC0-B901-B4E0E2665133}.Debug|x64.Build.0 = Debug|Any CPU + {AD1CB53E-7AA4-4EC0-B901-B4E0E2665133}.Debug|x86.ActiveCfg = Debug|Any CPU + {AD1CB53E-7AA4-4EC0-B901-B4E0E2665133}.Debug|x86.Build.0 = Debug|Any CPU + {AD1CB53E-7AA4-4EC0-B901-B4E0E2665133}.Release|Any CPU.ActiveCfg = Release|Any CPU + {AD1CB53E-7AA4-4EC0-B901-B4E0E2665133}.Release|Any CPU.Build.0 = Release|Any CPU + {AD1CB53E-7AA4-4EC0-B901-B4E0E2665133}.Release|ARM.ActiveCfg = Release|Any CPU + {AD1CB53E-7AA4-4EC0-B901-B4E0E2665133}.Release|ARM.Build.0 = Release|Any CPU + {AD1CB53E-7AA4-4EC0-B901-B4E0E2665133}.Release|x64.ActiveCfg = Release|Any CPU + {AD1CB53E-7AA4-4EC0-B901-B4E0E2665133}.Release|x64.Build.0 = Release|Any CPU + {AD1CB53E-7AA4-4EC0-B901-B4E0E2665133}.Release|x86.ActiveCfg = Release|Any CPU + {AD1CB53E-7AA4-4EC0-B901-B4E0E2665133}.Release|x86.Build.0 = Release|Any CPU + {3FF37D40-F770-45B2-95DD-7A84093E1425}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3FF37D40-F770-45B2-95DD-7A84093E1425}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3FF37D40-F770-45B2-95DD-7A84093E1425}.Debug|ARM.ActiveCfg = Debug|Any CPU + {3FF37D40-F770-45B2-95DD-7A84093E1425}.Debug|ARM.Build.0 = Debug|Any CPU + {3FF37D40-F770-45B2-95DD-7A84093E1425}.Debug|x64.ActiveCfg = Debug|Any CPU + {3FF37D40-F770-45B2-95DD-7A84093E1425}.Debug|x64.Build.0 = Debug|Any CPU + {3FF37D40-F770-45B2-95DD-7A84093E1425}.Debug|x86.ActiveCfg = Debug|Any CPU + {3FF37D40-F770-45B2-95DD-7A84093E1425}.Debug|x86.Build.0 = Debug|Any CPU + {3FF37D40-F770-45B2-95DD-7A84093E1425}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3FF37D40-F770-45B2-95DD-7A84093E1425}.Release|Any CPU.Build.0 = Release|Any CPU + {3FF37D40-F770-45B2-95DD-7A84093E1425}.Release|ARM.ActiveCfg = Release|Any CPU + {3FF37D40-F770-45B2-95DD-7A84093E1425}.Release|ARM.Build.0 = Release|Any CPU + {3FF37D40-F770-45B2-95DD-7A84093E1425}.Release|x64.ActiveCfg = Release|Any CPU + {3FF37D40-F770-45B2-95DD-7A84093E1425}.Release|x64.Build.0 = Release|Any CPU + {3FF37D40-F770-45B2-95DD-7A84093E1425}.Release|x86.ActiveCfg = Release|Any CPU + {3FF37D40-F770-45B2-95DD-7A84093E1425}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution - {C7BF2B18-CC74-430B-BCB2-600304EFA3D8} = {AE8A7E02-0F7D-41B0-AB23-15394150ED17} - {EF44F661-B98A-4676-927F-85D138F82300} = {AE8A7E02-0F7D-41B0-AB23-15394150ED17} - {F789647E-96F7-43E3-A895-FA3FE8D01260} = {AE8A7E02-0F7D-41B0-AB23-15394150ED17} - {86470440-FEE2-4120-AF5A-3762FB9C536F} = {AE8A7E02-0F7D-41B0-AB23-15394150ED17} - {9949326E-9261-4F95-89B1-151F60498951} = {100879CC-8910-459E-856E-253D629E45DE} - {AA62B4AA-1CA3-4C20-BEB7-B824D0FC4BD1} = {100879CC-8910-459E-856E-253D629E45DE} - {85AACDB7-959D-406D-A8DF-2F1E013F8F40} = {100879CC-8910-459E-856E-253D629E45DE} - {7FB616E1-E0D4-48FA-8AFD-60E73FCF32E4} = {100879CC-8910-459E-856E-253D629E45DE} + {A204A102-C745-4D65-AEC8-7B96FAEDEF2D} = {52AECE49-F314-4F76-98F2-FA800F07824B} + {951BC5D2-D653-42D9-9A91-21DC50DE0182} = {52AECE49-F314-4F76-98F2-FA800F07824B} + {F92DA93D-75DB-4308-A5F9-6B4C3908A675} = {8F2103C2-78AF-4810-8FB9-67572F50C8FC} + {AA62B4AA-1CA3-4C20-BEB7-B824D0FC4BD1} = {8F2103C2-78AF-4810-8FB9-67572F50C8FC} + {AD1CB53E-7AA4-4EC0-B901-B4E0E2665133} = {6A596588-F93F-47CC-BE5D-58C3B34ADDEB} + {3FF37D40-F770-45B2-95DD-7A84093E1425} = {6A596588-F93F-47CC-BE5D-58C3B34ADDEB} EndGlobalSection EndGlobal diff --git a/MapControl/BingMapsTileLayer.cs b/MapControl/BingMapsTileLayer.cs deleted file mode 100644 index 9ebaa46d..00000000 --- a/MapControl/BingMapsTileLayer.cs +++ /dev/null @@ -1,179 +0,0 @@ -// XAML Map Control - https://github.com/ClemensFischer/XAML-Map-Control -// © 2017 Clemens Fischer -// Licensed under the Microsoft Public License (Ms-PL) - -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Globalization; -using System.Net; -using System.Xml; -#if NETFX_CORE -using Windows.UI.Xaml; -using Windows.UI.Xaml.Media; -using Windows.UI.Xaml.Media.Imaging; -#else -using System.Windows; -using System.Windows.Media; -using System.Windows.Media.Imaging; -#endif - -namespace MapControl -{ - /// - /// Displays Bing Maps tiles. The static ApiKey property must be set to a Bing Maps API Key. - /// Tile image URLs and min/max zoom levels are retrieved from the Imagery Metadata Service - /// (see http://msdn.microsoft.com/en-us/library/ff701716.aspx). - /// - public class BingMapsTileLayer : MapTileLayer - { - public enum MapMode - { - Road, Aerial, AerialWithLabels - } - - public BingMapsTileLayer() - : this(new TileImageLoader()) - { - } - - public BingMapsTileLayer(ITileImageLoader tileImageLoader) - : base(tileImageLoader) - { - MinZoomLevel = 1; - MaxZoomLevel = 21; - Loaded += OnLoaded; - } - - public static string ApiKey { get; set; } - - public MapMode Mode { get; set; } - public string Culture { get; set; } - public ImageSource LogoImage { get; set; } - - private void OnLoaded(object sender, RoutedEventArgs e) - { - Loaded -= OnLoaded; - - if (string.IsNullOrEmpty(ApiKey)) - { - Debug.WriteLine("BingMapsTileLayer requires a Bing Maps API Key"); - } - else - { - var uri = string.Format("http://dev.virtualearth.net/REST/V1/Imagery/Metadata/{0}?output=xml&key={1}", Mode, ApiKey); - var request = WebRequest.CreateHttp(uri); - - request.BeginGetResponse(HandleImageryMetadataResponse, request); - } - } - - private void HandleImageryMetadataResponse(IAsyncResult asyncResult) - { - try - { - var request = (HttpWebRequest)asyncResult.AsyncState; - - using (var response = request.EndGetResponse(asyncResult)) - using (var xmlReader = XmlReader.Create(response.GetResponseStream())) - { - ReadImageryMetadataResponse(xmlReader); - } - } - catch (Exception ex) - { - Debug.WriteLine(ex.Message); - } - } - - private void ReadImageryMetadataResponse(XmlReader xmlReader) - { - string logoUri = null; - string imageUrl = null; - string[] imageUrlSubdomains = null; - int? zoomMin = null; - int? zoomMax = null; - - do - { - if (xmlReader.NodeType == XmlNodeType.Element) - { - switch (xmlReader.Name) - { - case "BrandLogoUri": - logoUri = xmlReader.ReadElementContentAsString(); - break; - case "ImageUrl": - imageUrl = xmlReader.ReadElementContentAsString(); - break; - case "ImageUrlSubdomains": - imageUrlSubdomains = ReadStrings(xmlReader.ReadSubtree()); - break; - case "ZoomMin": - zoomMin = xmlReader.ReadElementContentAsInt(); - break; - case "ZoomMax": - zoomMax = xmlReader.ReadElementContentAsInt(); - break; - default: - xmlReader.Read(); - break; - } - } - else - { - xmlReader.Read(); - } - } - while (xmlReader.NodeType != XmlNodeType.None); - - if (!string.IsNullOrEmpty(imageUrl) && imageUrlSubdomains != null && imageUrlSubdomains.Length > 0) - { - var op = Dispatcher.BeginInvoke(new Action(() => - { - if (string.IsNullOrEmpty(Culture)) - { - Culture = CultureInfo.CurrentUICulture.Name; - } - - TileSource = new BingMapsTileSource(imageUrl.Replace("{culture}", Culture), imageUrlSubdomains); - - if (zoomMin.HasValue && zoomMin.Value > MinZoomLevel) - { - MinZoomLevel = zoomMin.Value; - } - - if (zoomMax.HasValue && zoomMax.Value < MaxZoomLevel) - { - MaxZoomLevel = zoomMax.Value; - } - - if (!string.IsNullOrEmpty(logoUri)) - { - LogoImage = new BitmapImage(new Uri(logoUri)); - } - })); - } - } - - private static string[] ReadStrings(XmlReader xmlReader) - { - var strings = new List(); - - do - { - if (xmlReader.NodeType == XmlNodeType.Element && xmlReader.Name == "string") - { - strings.Add(xmlReader.ReadElementContentAsString()); - } - else - { - xmlReader.Read(); - } - } - while (xmlReader.NodeType != XmlNodeType.None); - - return strings.ToArray(); - } - } -} diff --git a/MapControl/BitmapSourceHelper.cs b/MapControl/BitmapSourceHelper.cs deleted file mode 100644 index efb32737..00000000 --- a/MapControl/BitmapSourceHelper.cs +++ /dev/null @@ -1,58 +0,0 @@ -// XAML Map Control - https://github.com/ClemensFischer/XAML-Map-Control -// © 2017 Clemens Fischer -// Licensed under the Microsoft Public License (Ms-PL) - -using System; -using System.IO; -using System.Net; -using System.Windows.Media.Imaging; - -namespace MapControl -{ - /// - /// Creates frozen BitmapSources from Stream, file or Uri. - /// - public static class BitmapSourceHelper - { - public static BitmapSource FromStream(Stream stream) - { - return BitmapFrame.Create(stream, BitmapCreateOptions.None, BitmapCacheOption.OnLoad); - } - - public static BitmapSource FromFile(string path) - { - if (!File.Exists(path)) - { - return null; - } - - using (var fileStream = new FileStream(path, FileMode.Open, FileAccess.Read)) - { - return FromStream(fileStream); - } - } - - public static BitmapSource FromUri(Uri uri) - { - if (!uri.IsAbsoluteUri) - { - return FromFile(uri.OriginalString); - } - - if (uri.Scheme == "file") - { - return FromFile(uri.LocalPath); - } - - using (var response = WebRequest.Create(uri).GetResponse()) - using (var responseStream = response.GetResponseStream()) - using (var memoryStream = new MemoryStream()) - { - responseStream.CopyTo(memoryStream); - memoryStream.Seek(0, SeekOrigin.Begin); - - return FromStream(memoryStream); - } - } - } -} diff --git a/MapControl/BoundingBoxConverter.cs b/MapControl/BoundingBoxConverter.cs deleted file mode 100644 index 6c76f1b7..00000000 --- a/MapControl/BoundingBoxConverter.cs +++ /dev/null @@ -1,31 +0,0 @@ -// XAML Map Control - https://github.com/ClemensFischer/XAML-Map-Control -// © 2017 Clemens Fischer -// Licensed under the Microsoft Public License (Ms-PL) - -using System; -using System.ComponentModel; -using System.Globalization; - -namespace MapControl -{ - public class BoundingBoxConverter : TypeConverter - { - public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) - { - return sourceType == typeof(string); - } - - public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) - { - return BoundingBox.Parse((string)value); - } - } - - [TypeConverter(typeof(BoundingBoxConverter))] -#if !SILVERLIGHT - [Serializable] -#endif - public partial class BoundingBox - { - } -} diff --git a/MapControl/Extensions.Silverlight.cs b/MapControl/Extensions.Silverlight.cs deleted file mode 100644 index eb6352eb..00000000 --- a/MapControl/Extensions.Silverlight.cs +++ /dev/null @@ -1,21 +0,0 @@ -// XAML Map Control - https://github.com/ClemensFischer/XAML-Map-Control -// © 2017 Clemens Fischer -// Licensed under the Microsoft Public License (Ms-PL) - -using System.Windows; -using System.Windows.Media.Animation; - -namespace MapControl -{ - internal static class Extensions - { - public static void BeginAnimation(this DependencyObject obj, DependencyProperty property, Timeline animation) - { - Storyboard.SetTargetProperty(animation, new PropertyPath(property)); - Storyboard.SetTarget(animation, obj); - var storyboard = new Storyboard(); - storyboard.Children.Add(animation); - storyboard.Begin(); - } - } -} diff --git a/MapControl/ImageTileSource.Silverlight.WinRT.cs b/MapControl/ImageTileSource.Silverlight.WinRT.cs deleted file mode 100644 index 824d0a5f..00000000 --- a/MapControl/ImageTileSource.Silverlight.WinRT.cs +++ /dev/null @@ -1,29 +0,0 @@ -// XAML Map Control - https://github.com/ClemensFischer/XAML-Map-Control -// © 2017 Clemens Fischer -// Licensed under the Microsoft Public License (Ms-PL) - -#if NETFX_CORE -using Windows.UI.Xaml.Media; -using Windows.UI.Xaml.Media.Imaging; -#else -using System.Windows.Media; -using System.Windows.Media.Imaging; -#endif - -namespace MapControl -{ - /// - /// Provides the image of a map tile. - /// ImageTileSource bypasses image downloading and optional caching in TileImageLoader. - /// By overriding the LoadImage method, an application can provide tile images from an arbitrary source. - /// - public class ImageTileSource : TileSource - { - public virtual ImageSource LoadImage(int x, int y, int zoomLevel) - { - var uri = GetUri(x, y, zoomLevel); - - return uri != null ? new BitmapImage(uri) : null; - } - } -} diff --git a/MapControl/ImageTileSource.WPF.cs b/MapControl/ImageTileSource.WPF.cs deleted file mode 100644 index fe0711ba..00000000 --- a/MapControl/ImageTileSource.WPF.cs +++ /dev/null @@ -1,24 +0,0 @@ -// XAML Map Control - https://github.com/ClemensFischer/XAML-Map-Control -// © 2017 Clemens Fischer -// Licensed under the Microsoft Public License (Ms-PL) - -using System.Windows.Media; - -namespace MapControl -{ - /// - /// Provides the image of a map tile. - /// ImageTileSource bypasses image downloading and optional caching in TileImageLoader. - /// By overriding the LoadImage method, an application can provide tile images from an arbitrary source. - /// LoadImage will be called from a non-UI thread and must therefore return a frozen ImageSource. - /// - public class ImageTileSource : TileSource - { - public virtual ImageSource LoadImage(int x, int y, int zoomLevel) - { - var uri = GetUri(x, y, zoomLevel); - - return uri != null ? BitmapSourceHelper.FromUri(uri) : null; - } - } -} diff --git a/MapControl/LocationCollectionConverter.cs b/MapControl/LocationCollectionConverter.cs deleted file mode 100644 index 8c9874f0..00000000 --- a/MapControl/LocationCollectionConverter.cs +++ /dev/null @@ -1,28 +0,0 @@ -// XAML Map Control - https://github.com/ClemensFischer/XAML-Map-Control -// © 2017 Clemens Fischer -// Licensed under the Microsoft Public License (Ms-PL) - -using System; -using System.ComponentModel; -using System.Globalization; - -namespace MapControl -{ - public class LocationCollectionConverter : TypeConverter - { - public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) - { - return sourceType == typeof(string); - } - - public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) - { - return LocationCollection.Parse((string)value); - } - } - - [TypeConverter(typeof(LocationCollectionConverter))] - public partial class LocationCollection - { - } -} diff --git a/MapControl/LocationConverter.cs b/MapControl/LocationConverter.cs deleted file mode 100644 index 8318df1b..00000000 --- a/MapControl/LocationConverter.cs +++ /dev/null @@ -1,31 +0,0 @@ -// XAML Map Control - https://github.com/ClemensFischer/XAML-Map-Control -// © 2017 Clemens Fischer -// Licensed under the Microsoft Public License (Ms-PL) - -using System; -using System.ComponentModel; -using System.Globalization; - -namespace MapControl -{ - public class LocationConverter : TypeConverter - { - public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) - { - return sourceType == typeof(string); - } - - public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) - { - return Location.Parse((string)value); - } - } - - [TypeConverter(typeof(LocationConverter))] -#if !SILVERLIGHT - [Serializable] -#endif - public partial class Location - { - } -} diff --git a/MapControl/Map.Silverlight.cs b/MapControl/Map.Silverlight.cs deleted file mode 100644 index fc6c3839..00000000 --- a/MapControl/Map.Silverlight.cs +++ /dev/null @@ -1,70 +0,0 @@ -// XAML Map Control - https://github.com/ClemensFischer/XAML-Map-Control -// © 2017 Clemens Fischer -// Licensed under the Microsoft Public License (Ms-PL) - -using System.Windows; -using System.Windows.Input; - -namespace MapControl -{ - /// - /// MapBase with default input event handling. - /// - public class Map : MapBase - { - public static readonly DependencyProperty MouseWheelZoomDeltaProperty = DependencyProperty.Register( - nameof(MouseWheelZoomDelta), typeof(double), typeof(Map), new PropertyMetadata(1d)); - - private Point? mousePosition; - - public Map() - { - MouseWheel += OnMouseWheel; - MouseLeftButtonDown += OnMouseLeftButtonDown; - MouseLeftButtonUp += OnMouseLeftButtonUp; - MouseMove += OnMouseMove; - } - - /// - /// Gets or sets the amount by which the ZoomLevel property changes during a MouseWheel event. - /// - public double MouseWheelZoomDelta - { - get { return (double)GetValue(MouseWheelZoomDeltaProperty); } - set { SetValue(MouseWheelZoomDeltaProperty, value); } - } - - private void OnMouseWheel(object sender, MouseWheelEventArgs e) - { - var zoomChange = MouseWheelZoomDelta * e.Delta / 120d; - ZoomMap(e.GetPosition(this), TargetZoomLevel + zoomChange); - } - - private void OnMouseLeftButtonDown(object sender, MouseButtonEventArgs e) - { - if (CaptureMouse()) - { - mousePosition = e.GetPosition(this); - } - } - - private void OnMouseLeftButtonUp(object sender, MouseButtonEventArgs e) - { - if (mousePosition.HasValue) - { - mousePosition = null; - ReleaseMouseCapture(); - } - } - - private void OnMouseMove(object sender, MouseEventArgs e) - { - if (mousePosition.HasValue) - { - var position = e.GetPosition(this); - TranslateMap(new Point(position.X - mousePosition.Value.X, position.Y - mousePosition.Value.Y)); - mousePosition = position; - } - } - } -} diff --git a/MapControl/MapControl.Silverlight.csproj b/MapControl/MapControl.Silverlight.csproj deleted file mode 100644 index b928a02f..00000000 --- a/MapControl/MapControl.Silverlight.csproj +++ /dev/null @@ -1,156 +0,0 @@ - - - - Debug - AnyCPU - 8.0.50727 - 2.0 - {EB133B78-DEFF-416A-8F0C-89E54D766576} - {A1591282-1198-4647-A2B1-27E5FF5F6F3B};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} - Library - Properties - MapControl - MapControl.Silverlight - Silverlight - v5.0 - $(TargetFrameworkVersion) - false - true - true - - - - - v3.5 - - - true - full - false - bin\Debug\ - DEBUG;TRACE;SILVERLIGHT - true - true - prompt - 4 - false - - - none - true - bin\Release\ - TRACE;SILVERLIGHT - true - true - prompt - 4 - false - - - OnBuildSuccess - - - true - - - ..\MapControl.snk - - - - - - - $(TargetFrameworkDirectory)System.Core.dll - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Designer - MSBuild:Compile - - - - - MapControl.snk - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/MapControl/MapControl.Silverlight.csproj.user b/MapControl/MapControl.Silverlight.csproj.user deleted file mode 100644 index 8b80b1f4..00000000 --- a/MapControl/MapControl.Silverlight.csproj.user +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - DynamicPage - True - False - False - - - - - - - - - True - - - True - - - - - \ No newline at end of file diff --git a/MapControl/MapControl.WPF.csproj b/MapControl/MapControl.WPF.csproj deleted file mode 100644 index 8686ca08..00000000 --- a/MapControl/MapControl.WPF.csproj +++ /dev/null @@ -1,135 +0,0 @@ - - - - - Debug - AnyCPU - {226F3575-B683-446D-A2F0-181291DC8787} - Library - Properties - MapControl - MapControl.WPF - v4.5 - 512 - - - - true - full - false - bin\Debug\ - TRACE;DEBUG - prompt - 4 - false - - - none - true - bin\Release\ - TRACE - prompt - 4 - false - - - OnBuildSuccess - - - true - - - ..\MapControl.snk - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Designer - MSBuild:Compile - - - - - MapControl.snk - - - - - - - - - - - - - \ No newline at end of file diff --git a/MapControl/MapImageLayer.WPF.cs b/MapControl/MapImageLayer.WPF.cs deleted file mode 100644 index eee4c685..00000000 --- a/MapControl/MapImageLayer.WPF.cs +++ /dev/null @@ -1,69 +0,0 @@ -// XAML Map Control - https://github.com/ClemensFischer/XAML-Map-Control -// © 2017 Clemens Fischer -// Licensed under the Microsoft Public License (Ms-PL) - -using System; -using System.Diagnostics; -using System.Threading.Tasks; -using System.Windows.Controls; -using System.Windows.Media; -using System.Windows.Media.Imaging; - -namespace MapControl -{ - public partial class MapImageLayer - { - protected void UpdateImage(Uri uri) - { - Task.Run(() => - { - BitmapSource image = null; - - try - { - image = BitmapSourceHelper.FromUri(uri); - } - catch (Exception ex) - { - Debug.WriteLine("{0}: {1}", uri, ex.Message); - } - - Dispatcher.BeginInvoke(new Action(() => UpdateImage(image))); - }); - } - - protected void UpdateImage(BitmapSource bitmap) - { - SetTopImage(bitmap); - - if (bitmap != null && !bitmap.IsFrozen && bitmap.IsDownloading) - { - bitmap.DownloadCompleted += BitmapDownloadCompleted; - bitmap.DownloadFailed += BitmapDownloadFailed; - } - else - { - SwapImages(); - } - } - - private void BitmapDownloadCompleted(object sender, EventArgs e) - { - var bitmap = (BitmapSource)sender; - bitmap.DownloadCompleted -= BitmapDownloadCompleted; - bitmap.DownloadFailed -= BitmapDownloadFailed; - - SwapImages(); - } - - private void BitmapDownloadFailed(object sender, ExceptionEventArgs e) - { - var bitmap = (BitmapSource)sender; - bitmap.DownloadCompleted -= BitmapDownloadCompleted; - bitmap.DownloadFailed -= BitmapDownloadFailed; - - ((Image)Children[topImageIndex]).Source = null; - SwapImages(); - } - } -} diff --git a/MapControl/MatrixEx.Silverlight.WinRT.cs b/MapControl/MatrixEx.Silverlight.WinRT.cs deleted file mode 100644 index 1bd346c3..00000000 --- a/MapControl/MatrixEx.Silverlight.WinRT.cs +++ /dev/null @@ -1,82 +0,0 @@ -// XAML Map Control - https://github.com/ClemensFischer/XAML-Map-Control -// © 2017 Clemens Fischer -// Licensed under the Microsoft Public License (Ms-PL) - -using System; -#if NETFX_CORE -using Windows.Foundation; -using Windows.UI.Xaml.Media; -#else -using System.Windows; -using System.Windows.Media; -#endif - -namespace MapControl -{ - internal static class MatrixEx - { - /// - /// Used in MapProjection and MapTileLayer. - /// - public static Matrix TranslateScaleRotateTranslate( - double translation1X, double translation1Y, - double scaleX, double scaleY, double rotationAngle, - double translation2X, double translation2Y) - { - return new Matrix(1d, 0d, 0d, 1d, -translation1X, -translation1Y) - .Scale(scaleX, scaleY) - .Rotate(rotationAngle) - .Translate(translation2X, translation2Y); - } - - private static Matrix Translate(this Matrix matrix, double offsetX, double offsetY) - { - matrix.OffsetX += offsetX; - matrix.OffsetY += offsetY; - return matrix; - } - - private static Matrix Scale(this Matrix matrix, double scaleX, double scaleY) - { - return Multiply(matrix, new Matrix(scaleX, 0d, 0d, scaleY, 0d, 0d)); - } - - private static Matrix Rotate(this Matrix matrix, double angle) - { - if (angle == 0d) - { - return matrix; - } - - angle = (angle % 360d) / 180d * Math.PI; - var cos = Math.Cos(angle); - var sin = Math.Sin(angle); - - return Multiply(matrix, new Matrix(cos, sin, -sin, cos, 0d, 0d)); - } - - private static Matrix Invert(this Matrix matrix) - { - var determinant = matrix.M11 * matrix.M22 - matrix.M12 * matrix.M21; - - return new Matrix( - matrix.M22 / determinant, - -matrix.M12 / determinant, - -matrix.M21 / determinant, - matrix.M11 / determinant, - (matrix.M21 * matrix.OffsetY - matrix.M22 * matrix.OffsetX) / determinant, - (matrix.M12 * matrix.OffsetX - matrix.M11 * matrix.OffsetY) / determinant); - } - - private static Matrix Multiply(this Matrix matrix1, Matrix matrix2) - { - return new Matrix( - matrix1.M11 * matrix2.M11 + matrix1.M12 * matrix2.M21, - matrix1.M11 * matrix2.M12 + matrix1.M12 * matrix2.M22, - matrix1.M21 * matrix2.M11 + matrix1.M22 * matrix2.M21, - matrix1.M21 * matrix2.M12 + matrix1.M22 * matrix2.M22, - (matrix2.M11 * matrix1.OffsetX + matrix2.M21 * matrix1.OffsetY) + matrix2.OffsetX, - (matrix2.M12 * matrix1.OffsetX + matrix2.M22 * matrix1.OffsetY) + matrix2.OffsetY); - } - } -} diff --git a/MapControl/AzimuthalEquidistantProjection.cs b/MapControl/Shared/AzimuthalEquidistantProjection.cs similarity index 99% rename from MapControl/AzimuthalEquidistantProjection.cs rename to MapControl/Shared/AzimuthalEquidistantProjection.cs index 96df920f..732c3ce1 100644 --- a/MapControl/AzimuthalEquidistantProjection.cs +++ b/MapControl/Shared/AzimuthalEquidistantProjection.cs @@ -3,7 +3,7 @@ // Licensed under the Microsoft Public License (Ms-PL) using System; -#if NETFX_CORE +#if WINDOWS_UWP using Windows.Foundation; #else using System.Windows; diff --git a/MapControl/AzimuthalProjection.cs b/MapControl/Shared/AzimuthalProjection.cs similarity index 98% rename from MapControl/AzimuthalProjection.cs rename to MapControl/Shared/AzimuthalProjection.cs index 573bef23..1de51917 100644 --- a/MapControl/AzimuthalProjection.cs +++ b/MapControl/Shared/AzimuthalProjection.cs @@ -4,7 +4,7 @@ using System; using System.Globalization; -#if NETFX_CORE +#if WINDOWS_UWP using Windows.Foundation; #else using System.Windows; @@ -27,7 +27,7 @@ namespace MapControl public override double GetViewportScale(double zoomLevel) { - return base.GetViewportScale(zoomLevel) / MetersPerDegree; + return DegreesToViewportScale(zoomLevel) / MetersPerDegree; } public override Point GetMapScale(Location location) diff --git a/MapControl/Shared/BingMapsTileLayer.cs b/MapControl/Shared/BingMapsTileLayer.cs new file mode 100644 index 00000000..49672a1e --- /dev/null +++ b/MapControl/Shared/BingMapsTileLayer.cs @@ -0,0 +1,138 @@ +// XAML Map Control - https://github.com/ClemensFischer/XAML-Map-Control +// © 2017 Clemens Fischer +// Licensed under the Microsoft Public License (Ms-PL) + +using System; +using System.Diagnostics; +using System.Globalization; +using System.Linq; +#if WINDOWS_UWP +using Windows.Data.Xml.Dom; +using Windows.UI.Xaml; +#else +using System.Windows; +using System.Xml; +#endif + +namespace MapControl +{ + /// + /// Displays Bing Maps tiles. The static ApiKey property must be set to a Bing Maps API Key. + /// Tile image URLs and min/max zoom levels are retrieved from the Imagery Metadata Service + /// (see http://msdn.microsoft.com/en-us/library/ff701716.aspx). + /// + public class BingMapsTileLayer : MapTileLayer + { + public enum MapMode + { + Road, Aerial, AerialWithLabels + } + + public BingMapsTileLayer() + : this(new TileImageLoader()) + { + } + + public BingMapsTileLayer(ITileImageLoader tileImageLoader) + : base(tileImageLoader) + { + MinZoomLevel = 1; + MaxZoomLevel = 21; + Loaded += OnLoaded; + } + + public static string ApiKey { get; set; } + + public MapMode Mode { get; set; } + public string Culture { get; set; } + public Uri LogoImageUri { get; set; } + + private async void OnLoaded(object sender, RoutedEventArgs e) + { + Loaded -= OnLoaded; + + if (string.IsNullOrEmpty(ApiKey)) + { + Debug.WriteLine("BingMapsTileLayer requires a Bing Maps API Key"); + return; + } + + var imageryMetadataUrl = "http://dev.virtualearth.net/REST/V1/Imagery/Metadata/" + Mode; + + try + { + var document = await XmlDocument.LoadFromUriAsync(new Uri(imageryMetadataUrl + "?output=xml&key=" + ApiKey)); + var imageryMetadata = document.DocumentElement.GetElementsByTagName("ImageryMetadata").OfType().FirstOrDefault(); + + if (imageryMetadata != null) + { + ReadImageryMetadata(imageryMetadata); + } + + var brandLogoUri = document.DocumentElement.GetElementsByTagName("BrandLogoUri").OfType().FirstOrDefault(); + + if (brandLogoUri != null) + { + LogoImageUri = new Uri(brandLogoUri.InnerText); + } + } + catch (Exception ex) + { + Debug.WriteLine("BingMapsTileLayer: {0}: {1}", imageryMetadataUrl, ex.Message); + } + } + + private void ReadImageryMetadata(XmlElement imageryMetadata) + { + string imageUrl = null; + string[] imageUrlSubdomains = null; + int? zoomMin = null; + int? zoomMax = null; + + foreach (var element in imageryMetadata.ChildNodes.OfType()) + { + switch ((string)element.LocalName) + { + case "ImageUrl": + imageUrl = element.InnerText; + break; + case "ImageUrlSubdomains": + imageUrlSubdomains = element.ChildNodes + .OfType() + .Where(e => (string)e.LocalName == "string") + .Select(e => e.InnerText) + .ToArray(); + break; + case "ZoomMin": + zoomMin = int.Parse(element.InnerText); + break; + case "ZoomMax": + zoomMax = int.Parse(element.InnerText); + break; + default: + break; + } + } + + if (!string.IsNullOrEmpty(imageUrl) && imageUrlSubdomains != null && imageUrlSubdomains.Length > 0) + { + if (zoomMin.HasValue && zoomMin.Value > MinZoomLevel) + { + MinZoomLevel = zoomMin.Value; + } + + if (zoomMax.HasValue && zoomMax.Value < MaxZoomLevel) + { + MaxZoomLevel = zoomMax.Value; + } + + if (string.IsNullOrEmpty(Culture)) + { + Culture = CultureInfo.CurrentUICulture.Name; + } + + TileSource = new BingMapsTileSource(imageUrl.Replace("{culture}", Culture), imageUrlSubdomains); + } + } + } +} diff --git a/MapControl/BingMapsTileSource.cs b/MapControl/Shared/BingMapsTileSource.cs similarity index 95% rename from MapControl/BingMapsTileSource.cs rename to MapControl/Shared/BingMapsTileSource.cs index 69be1948..7c93c607 100644 --- a/MapControl/BingMapsTileSource.cs +++ b/MapControl/Shared/BingMapsTileSource.cs @@ -6,7 +6,7 @@ using System; namespace MapControl { - internal class BingMapsTileSource : TileSource + public class BingMapsTileSource : TileSource { private readonly string[] subdomains; diff --git a/MapControl/BoundingBox.cs b/MapControl/Shared/BoundingBox.cs similarity index 100% rename from MapControl/BoundingBox.cs rename to MapControl/Shared/BoundingBox.cs diff --git a/MapControl/CenteredBoundingBox.cs b/MapControl/Shared/CenteredBoundingBox.cs similarity index 100% rename from MapControl/CenteredBoundingBox.cs rename to MapControl/Shared/CenteredBoundingBox.cs diff --git a/MapControl/EquirectangularProjection.cs b/MapControl/Shared/EquirectangularProjection.cs similarity index 98% rename from MapControl/EquirectangularProjection.cs rename to MapControl/Shared/EquirectangularProjection.cs index ac100a71..4645b6d7 100644 --- a/MapControl/EquirectangularProjection.cs +++ b/MapControl/Shared/EquirectangularProjection.cs @@ -3,7 +3,7 @@ // Licensed under the Microsoft Public License (Ms-PL) using System; -#if NETFX_CORE +#if WINDOWS_UWP using Windows.Foundation; #else using System.Windows; diff --git a/MapControl/GnomonicProjection.cs b/MapControl/Shared/GnomonicProjection.cs similarity index 99% rename from MapControl/GnomonicProjection.cs rename to MapControl/Shared/GnomonicProjection.cs index 3492f77a..d44e274c 100644 --- a/MapControl/GnomonicProjection.cs +++ b/MapControl/Shared/GnomonicProjection.cs @@ -3,7 +3,7 @@ // Licensed under the Microsoft Public License (Ms-PL) using System; -#if NETFX_CORE +#if WINDOWS_UWP using Windows.Foundation; #else using System.Windows; diff --git a/MapControl/HyperlinkText.cs b/MapControl/Shared/HyperlinkText.cs similarity index 87% rename from MapControl/HyperlinkText.cs rename to MapControl/Shared/HyperlinkText.cs index 442d56ac..01c0d589 100644 --- a/MapControl/HyperlinkText.cs +++ b/MapControl/Shared/HyperlinkText.cs @@ -5,7 +5,7 @@ using System; using System.Collections.Generic; using System.Text.RegularExpressions; -#if NETFX_CORE +#if WINDOWS_UWP using Windows.UI.Xaml; using Windows.UI.Xaml.Controls; using Windows.UI.Xaml.Documents; @@ -43,9 +43,7 @@ namespace MapControl var link = new Hyperlink { NavigateUri = uri }; link.Inlines.Add(new Run { Text = match.Groups[1].Value }); -#if SILVERLIGHT - link.TargetName = "_blank"; -#elif !NETFX_CORE +#if !WINDOWS_UWP link.ToolTip = uri.ToString(); link.RequestNavigate += (s, e) => System.Diagnostics.Process.Start(e.Uri.ToString()); #endif @@ -86,16 +84,7 @@ namespace MapControl { inlines = ((Paragraph)obj).Inlines; } -#if NETFX_CORE || SILVERLIGHT - else if (obj is RichTextBlock) - { - var paragraph = new Paragraph(); - inlines = paragraph.Inlines; - var richTextBlock = (RichTextBlock)obj; - richTextBlock.Blocks.Clear(); - richTextBlock.Blocks.Add(paragraph); - } -#endif + if (inlines != null) { inlines.Clear(); diff --git a/MapControl/Location.cs b/MapControl/Shared/Location.cs similarity index 93% rename from MapControl/Location.cs rename to MapControl/Shared/Location.cs index 73d8b32a..a911fcb5 100644 --- a/MapControl/Location.cs +++ b/MapControl/Shared/Location.cs @@ -39,10 +39,9 @@ namespace MapControl public bool Equals(Location location) { - return ReferenceEquals(this, location) - || (location != null - && location.latitude == latitude - && location.longitude == longitude); + return location != null + && Math.Abs(location.latitude - latitude) < 1e-9 + && Math.Abs(location.longitude - longitude) < 1e-9; } public override bool Equals(object obj) diff --git a/MapControl/LocationCollection.cs b/MapControl/Shared/LocationCollection.cs similarity index 100% rename from MapControl/LocationCollection.cs rename to MapControl/Shared/LocationCollection.cs diff --git a/MapControl/MapBase.cs b/MapControl/Shared/MapBase.cs similarity index 99% rename from MapControl/MapBase.cs rename to MapControl/Shared/MapBase.cs index b0bfe14c..821888b1 100644 --- a/MapControl/MapBase.cs +++ b/MapControl/Shared/MapBase.cs @@ -3,7 +3,7 @@ // Licensed under the Microsoft Public License (Ms-PL) using System; -#if NETFX_CORE +#if WINDOWS_UWP using Windows.Foundation; using Windows.UI.Xaml; using Windows.UI.Xaml.Media; diff --git a/MapControl/MapGraticule.cs b/MapControl/Shared/MapGraticule.cs similarity index 94% rename from MapControl/MapGraticule.cs rename to MapControl/Shared/MapGraticule.cs index d7b9af96..02516aa0 100644 --- a/MapControl/MapGraticule.cs +++ b/MapControl/Shared/MapGraticule.cs @@ -3,7 +3,7 @@ // Licensed under the Microsoft Public License (Ms-PL) using System; -#if NETFX_CORE +#if WINDOWS_UWP using Windows.UI.Xaml; #else using System.Windows; @@ -30,7 +30,7 @@ namespace MapControl private double GetLineDistance() { - var minDistance = MinLineDistance * 360d / (Math.Pow(2d, ParentMap.ZoomLevel) * TileSource.TileSize); + var minDistance = MinLineDistance / MapProjection.DegreesToViewportScale(ParentMap.ZoomLevel); var scale = 1d; if (minDistance < 1d) diff --git a/MapControl/MapImageLayer.cs b/MapControl/Shared/MapImageLayer.cs similarity index 98% rename from MapControl/MapImageLayer.cs rename to MapControl/Shared/MapImageLayer.cs index c440051e..f8e9f62a 100644 --- a/MapControl/MapImageLayer.cs +++ b/MapControl/Shared/MapImageLayer.cs @@ -4,7 +4,7 @@ using System; using System.Diagnostics; -#if NETFX_CORE +#if WINDOWS_UWP using Windows.Foundation; using Windows.UI.Xaml; using Windows.UI.Xaml.Controls; @@ -279,7 +279,7 @@ namespace MapControl } catch (Exception ex) { - Debug.WriteLine(ex.Message); + Debug.WriteLine("MapImageLayer: " + ex.Message); } if (!imageUpdated) @@ -295,12 +295,12 @@ namespace MapControl /// protected abstract bool UpdateImage(BoundingBox boundingBox); - private void SetTopImage(BitmapSource bitmap) + private void SetTopImage(BitmapSource bitmapSource) { topImageIndex = (topImageIndex + 1) % 2; var topImage = (Image)Children[topImageIndex]; - topImage.Source = bitmap; + topImage.Source = bitmapSource; SetBoundingBox(topImage, boundingBox?.Clone()); } diff --git a/MapControl/MapOverlay.cs b/MapControl/Shared/MapOverlay.cs similarity index 99% rename from MapControl/MapOverlay.cs rename to MapControl/Shared/MapOverlay.cs index 48ac4730..2d239ce1 100644 --- a/MapControl/MapOverlay.cs +++ b/MapControl/Shared/MapOverlay.cs @@ -2,7 +2,7 @@ // © 2017 Clemens Fischer // Licensed under the Microsoft Public License (Ms-PL) -#if NETFX_CORE +#if WINDOWS_UWP using Windows.UI.Text; using Windows.UI.Xaml.Media; #else diff --git a/MapControl/MapPanel.cs b/MapControl/Shared/MapPanel.cs similarity index 99% rename from MapControl/MapPanel.cs rename to MapControl/Shared/MapPanel.cs index c5973e05..5a5889d5 100644 --- a/MapControl/MapPanel.cs +++ b/MapControl/Shared/MapPanel.cs @@ -3,7 +3,7 @@ // Licensed under the Microsoft Public License (Ms-PL) using System; -#if NETFX_CORE +#if WINDOWS_UWP using Windows.Foundation; using Windows.UI.Xaml; using Windows.UI.Xaml.Controls; diff --git a/MapControl/MapPath.cs b/MapControl/Shared/MapPath.cs similarity index 99% rename from MapControl/MapPath.cs rename to MapControl/Shared/MapPath.cs index 55cfbe28..4dbf244a 100644 --- a/MapControl/MapPath.cs +++ b/MapControl/Shared/MapPath.cs @@ -2,7 +2,7 @@ // © 2017 Clemens Fischer // Licensed under the Microsoft Public License (Ms-PL) -#if NETFX_CORE +#if WINDOWS_UWP using Windows.UI.Xaml; using Windows.UI.Xaml.Media; #else diff --git a/MapControl/MapPolyline.cs b/MapControl/Shared/MapPolyline.cs similarity index 84% rename from MapControl/MapPolyline.cs rename to MapControl/Shared/MapPolyline.cs index bb0537f0..bcada6ad 100644 --- a/MapControl/MapPolyline.cs +++ b/MapControl/Shared/MapPolyline.cs @@ -4,11 +4,10 @@ using System.Collections.Generic; using System.Collections.Specialized; -#if NETFX_CORE +#if WINDOWS_UWP using Windows.UI.Xaml; using Windows.UI.Xaml.Media; #else -using System.ComponentModel; using System.Windows; using System.Windows.Media; #endif @@ -28,18 +27,6 @@ namespace MapControl nameof(IsClosed), typeof(bool), typeof(MapPolyline), new PropertyMetadata(false, (o, e) => ((MapPolyline)o).UpdateData())); - /// - /// Gets or sets the locations that define the polyline points. - /// -#if !NETFX_CORE - [TypeConverter(typeof(LocationCollectionConverter))] -#endif - public IEnumerable Locations - { - get { return (IEnumerable)GetValue(LocationsProperty); } - set { SetValue(LocationsProperty, value); } - } - /// /// Gets or sets a value that indicates if the polyline is closed, i.e. is a polygon. /// diff --git a/MapControl/MapProjection.cs b/MapControl/Shared/MapProjection.cs similarity index 90% rename from MapControl/MapProjection.cs rename to MapControl/Shared/MapProjection.cs index 82d38d2a..bf94b35d 100644 --- a/MapControl/MapProjection.cs +++ b/MapControl/Shared/MapProjection.cs @@ -4,7 +4,7 @@ using System; using System.Globalization; -#if NETFX_CORE +#if WINDOWS_UWP using Windows.Foundation; using Windows.UI.Xaml.Media; #else @@ -15,14 +15,22 @@ using System.Windows.Media; namespace MapControl { /// - /// Defines a map projection between geographic coordinates and cartesian map coordinates - /// and viewport coordinates, i.e. pixels. + /// Defines a map projection between geographic coordinates, cartesian map coordinates and viewport coordinates. /// - public abstract partial class MapProjection + public abstract class MapProjection { + public const int TileSize = 256; public const double Wgs84EquatorialRadius = 6378137d; public const double MetersPerDegree = Wgs84EquatorialRadius * Math.PI / 180d; + /// + /// Gets the scaling factor from cartesian map coordinates in degrees to viewport coordinates for the specified zoom level. + /// + public static double DegreesToViewportScale(double zoomLevel) + { + return Math.Pow(2d, zoomLevel) * TileSize / 360d; + } + /// /// Gets or sets the WMS 1.3.0 CRS Identifier. /// @@ -64,7 +72,7 @@ namespace MapControl /// public virtual double GetViewportScale(double zoomLevel) { - return Math.Pow(2d, zoomLevel) * TileSource.TileSize / 360d; + return DegreesToViewportScale(zoomLevel); } /// @@ -142,7 +150,7 @@ namespace MapControl var center = LocationToPoint(mapCenter); ViewportTransform.Matrix = MatrixEx.TranslateScaleRotateTranslate( - center.X, center.Y, ViewportScale, -ViewportScale, heading, viewportCenter.X, viewportCenter.Y); + -center.X, -center.Y, ViewportScale, -ViewportScale, heading, viewportCenter.X, viewportCenter.Y); } /// diff --git a/MapControl/MapTileLayer.cs b/MapControl/Shared/MapTileLayer.cs similarity index 94% rename from MapControl/MapTileLayer.cs rename to MapControl/Shared/MapTileLayer.cs index ed2f37de..ccf3e691 100644 --- a/MapControl/MapTileLayer.cs +++ b/MapControl/Shared/MapTileLayer.cs @@ -5,16 +5,14 @@ using System; using System.Collections.Generic; using System.Linq; -#if NETFX_CORE +#if WINDOWS_UWP using Windows.Foundation; using Windows.UI.Xaml; using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Markup; using Windows.UI.Xaml.Media; #else using System.Windows; using System.Windows.Controls; -using System.Windows.Markup; using System.Windows.Media; using System.Windows.Threading; #endif @@ -29,11 +27,6 @@ namespace MapControl /// /// Fills the map viewport with map tiles from a TileSource. /// -#if NETFX_CORE - [ContentProperty(Name = "TileSource")] -#else - [ContentProperty("TileSource")] -#endif public partial class MapTileLayer : Panel, IMapLayer { /// @@ -253,9 +246,9 @@ namespace MapControl { foreach (var tile in Tiles) { - var tileSize = TileSource.TileSize << (TileGrid.ZoomLevel - tile.ZoomLevel); - var x = tileSize * tile.X - TileSource.TileSize * TileGrid.XMin; - var y = tileSize * tile.Y - TileSource.TileSize * TileGrid.YMin; + var tileSize = MapProjection.TileSize << (TileGrid.ZoomLevel - tile.ZoomLevel); + var x = tileSize * tile.X - MapProjection.TileSize * TileGrid.XMin; + var y = tileSize * tile.Y - MapProjection.TileSize * TileGrid.YMin; tile.Image.Width = tileSize; tile.Image.Height = tileSize; @@ -322,8 +315,8 @@ namespace MapControl private TileGrid GetTileGrid() { var tileZoomLevel = Math.Max(0, (int)Math.Round(parentMap.ZoomLevel + ZoomLevelOffset)); - var tileScale = (1 << tileZoomLevel); - var scale = tileScale / (Math.Pow(2d, parentMap.ZoomLevel) * TileSource.TileSize); + var tileScale = (double)(1 << tileZoomLevel); + var scale = tileScale / (Math.Pow(2d, parentMap.ZoomLevel) * MapProjection.TileSize); var tileCenterX = tileScale * (0.5 + parentMap.Center.Longitude / 360d); var tileCenterY = tileScale * (0.5 - WebMercatorProjection.LatitudeToY(parentMap.Center.Latitude) / 360d); var viewCenterX = parentMap.RenderSize.Width / 2d; @@ -331,7 +324,7 @@ namespace MapControl var transform = new MatrixTransform { - Matrix = MatrixEx.TranslateScaleRotateTranslate(viewCenterX, viewCenterY, scale, scale, -parentMap.Heading, tileCenterX, tileCenterY) + Matrix = MatrixEx.TranslateScaleRotateTranslate(-viewCenterX, -viewCenterY, scale, scale, -parentMap.Heading, tileCenterX, tileCenterY) }; var bounds = transform.TransformBounds(new Rect(0d, 0d, parentMap.RenderSize.Width, parentMap.RenderSize.Height)); @@ -343,17 +336,17 @@ namespace MapControl private void SetRenderTransform() { - var tileScale = (1 << TileGrid.ZoomLevel); + var tileScale = (double)(1 << TileGrid.ZoomLevel); var scale = Math.Pow(2d, parentMap.ZoomLevel) / tileScale; var tileCenterX = tileScale * (0.5 + parentMap.Center.Longitude / 360d); var tileCenterY = tileScale * (0.5 - WebMercatorProjection.LatitudeToY(parentMap.Center.Latitude) / 360d); - var tileOriginX = TileSource.TileSize * (tileCenterX - TileGrid.XMin); - var tileOriginY = TileSource.TileSize * (tileCenterY - TileGrid.YMin); + var tileOriginX = MapProjection.TileSize * (tileCenterX - TileGrid.XMin); + var tileOriginY = MapProjection.TileSize * (tileCenterY - TileGrid.YMin); var viewCenterX = parentMap.RenderSize.Width / 2d; var viewCenterY = parentMap.RenderSize.Height / 2d; ((MatrixTransform)RenderTransform).Matrix = MatrixEx.TranslateScaleRotateTranslate( - tileOriginX, tileOriginY, scale, scale, parentMap.Heading, viewCenterX, viewCenterY); + -tileOriginX, -tileOriginY, scale, scale, parentMap.Heading, viewCenterX, viewCenterY); } private void UpdateTiles() diff --git a/MapControl/OrthographicProjection.cs b/MapControl/Shared/OrthographicProjection.cs similarity index 99% rename from MapControl/OrthographicProjection.cs rename to MapControl/Shared/OrthographicProjection.cs index 19892b08..79c7eaf7 100644 --- a/MapControl/OrthographicProjection.cs +++ b/MapControl/Shared/OrthographicProjection.cs @@ -3,7 +3,7 @@ // Licensed under the Microsoft Public License (Ms-PL) using System; -#if NETFX_CORE +#if WINDOWS_UWP using Windows.Foundation; #else using System.Windows; diff --git a/MapControl/StereographicProjection.cs b/MapControl/Shared/StereographicProjection.cs similarity index 99% rename from MapControl/StereographicProjection.cs rename to MapControl/Shared/StereographicProjection.cs index 8ec7fd87..7be1bb89 100644 --- a/MapControl/StereographicProjection.cs +++ b/MapControl/Shared/StereographicProjection.cs @@ -3,7 +3,7 @@ // Licensed under the Microsoft Public License (Ms-PL) using System; -#if NETFX_CORE +#if WINDOWS_UWP using Windows.Foundation; #else using System.Windows; diff --git a/MapControl/Tile.cs b/MapControl/Shared/Tile.cs similarity index 98% rename from MapControl/Tile.cs rename to MapControl/Shared/Tile.cs index d70fc118..6f29f863 100644 --- a/MapControl/Tile.cs +++ b/MapControl/Shared/Tile.cs @@ -3,7 +3,7 @@ // Licensed under the Microsoft Public License (Ms-PL) using System; -#if NETFX_CORE +#if WINDOWS_UWP using Windows.UI.Xaml.Controls; #else using System.Windows.Controls; diff --git a/MapControl/TileGrid.cs b/MapControl/Shared/TileGrid.cs similarity index 89% rename from MapControl/TileGrid.cs rename to MapControl/Shared/TileGrid.cs index e329c0e6..00cc2e3a 100644 --- a/MapControl/TileGrid.cs +++ b/MapControl/Shared/TileGrid.cs @@ -25,13 +25,12 @@ namespace MapControl public bool Equals(TileGrid tileGrid) { - return ReferenceEquals(this, tileGrid) - || (tileGrid != null + return tileGrid != null && tileGrid.ZoomLevel == ZoomLevel && tileGrid.XMin == XMin && tileGrid.YMin == YMin && tileGrid.XMax == XMax - && tileGrid.YMax == YMax); + && tileGrid.YMax == YMax; } public override bool Equals(object obj) diff --git a/MapControl/Shared/TileImageLoader.cs b/MapControl/Shared/TileImageLoader.cs new file mode 100644 index 00000000..51891c95 --- /dev/null +++ b/MapControl/Shared/TileImageLoader.cs @@ -0,0 +1,172 @@ +// XAML Map Control - https://github.com/ClemensFischer/XAML-Map-Control +// © 2017 Clemens Fischer +// Licensed under the Microsoft Public License (Ms-PL) + +using System; +using System.Collections.Concurrent; +using System.Diagnostics; +using System.IO; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +#if WINDOWS_UWP +using Windows.Web.Http; +#else +using System.Net.Http; +#endif + +namespace MapControl +{ + /// + /// Loads and optionally caches map tile images for a MapTileLayer. + /// + public partial class TileImageLoader : ITileImageLoader + { + /// + /// The HttpClient instance used when image data is downloaded from a web resource. + /// + public static HttpClient HttpClient { get; set; } = new HttpClient(); + + /// + /// Default expiration time for cached tile images. Used when no expiration time + /// was transmitted on download. The default value is one day. + /// + public static TimeSpan DefaultCacheExpiration { get; set; } = TimeSpan.FromDays(1); + + /// + /// Minimum expiration time for cached tile images. The default value is one hour. + /// + public static TimeSpan MinimumCacheExpiration { get; set; } = TimeSpan.FromHours(1); + + /// + /// Maximum expiration time for cached tile images. The default value is one week. + /// + public static TimeSpan MaximumCacheExpiration { get; set; } = TimeSpan.FromDays(7); + + /// + /// Format string for creating cache keys from the SourceName property of a TileSource, + /// the ZoomLevel, XIndex, and Y properties of a Tile, and the image file extension. + /// The default value is "{0};{1};{2};{3}{4}". + /// + public static string CacheKeyFormat { get; set; } = "{0};{1};{2};{3}{4}"; + + private const string bingMapsTileInfo = "X-VE-Tile-Info"; + private const string bingMapsNoTile = "no-tile"; + + private readonly ConcurrentStack pendingTiles = new ConcurrentStack(); + private int taskCount; + + public void LoadTiles(MapTileLayer tileLayer) + { + pendingTiles.Clear(); + + var tileSource = tileLayer.TileSource; + var sourceName = tileLayer.SourceName; + var tiles = tileLayer.Tiles.Where(t => t.Pending); + + if (tileSource != null && tiles.Any()) + { + if (Cache == null || string.IsNullOrEmpty(sourceName) || + tileSource.UriFormat == null || !tileSource.UriFormat.StartsWith("http")) + { + // no caching, load tile images in UI thread + + foreach (var tile in tiles) + { + LoadTileImage(tileSource, tile); + } + } + else + { + pendingTiles.PushRange(tiles.Reverse().ToArray()); + + while (taskCount < Math.Min(pendingTiles.Count, tileLayer.MaxParallelDownloads)) + { + Interlocked.Increment(ref taskCount); + + var task = Task.Run(async () => // do not await + { + await LoadPendingTilesAsync(tileSource, sourceName); // run multiple times in parallel + + Interlocked.Decrement(ref taskCount); + }); + } + } + } + } + + private void LoadTileImage(TileSource tileSource, Tile tile) + { + tile.Pending = false; + + try + { + var imageSource = tileSource.LoadImage(tile.XIndex, tile.Y, tile.ZoomLevel); + + if (imageSource != null) + { + tile.SetImage(imageSource); + } + } + catch (Exception ex) + { + Debug.WriteLine("TileImageLoader: {0}/{1}/{2}: {3}", tile.ZoomLevel, tile.XIndex, tile.Y, ex.Message); + } + } + + private async Task LoadPendingTilesAsync(TileSource tileSource, string sourceName) + { + Tile tile; + + while (pendingTiles.TryPop(out tile)) + { + tile.Pending = false; + + try + { + var uri = tileSource.GetUri(tile.XIndex, tile.Y, tile.ZoomLevel); + + if (uri != null) + { + var extension = Path.GetExtension(uri.LocalPath); + + if (string.IsNullOrEmpty(extension) || extension == ".jpeg") + { + extension = ".jpg"; + } + + var cacheKey = string.Format(CacheKeyFormat, sourceName, tile.ZoomLevel, tile.XIndex, tile.Y, extension); + + await LoadTileImageAsync(tile, uri, cacheKey); + } + } + catch (Exception ex) + { + Debug.WriteLine("TileImageLoader: {0}/{1}/{2}: {3}", tile.ZoomLevel, tile.XIndex, tile.Y, ex.Message); + } + } + } + + private static DateTime GetExpiration(HttpResponseMessage response) + { + var expiration = DefaultCacheExpiration; + var headers = response.Headers; + + if (headers.CacheControl != null && headers.CacheControl.MaxAge.HasValue) + { + expiration = headers.CacheControl.MaxAge.Value; + + if (expiration < MinimumCacheExpiration) + { + expiration = MinimumCacheExpiration; + } + else if (expiration > MaximumCacheExpiration) + { + expiration = MaximumCacheExpiration; + } + } + + return DateTime.UtcNow.Add(expiration); + } + } +} diff --git a/MapControl/TileSource.cs b/MapControl/Shared/TileSource.cs similarity index 85% rename from MapControl/TileSource.cs rename to MapControl/Shared/TileSource.cs index 932680f9..cf268663 100644 --- a/MapControl/TileSource.cs +++ b/MapControl/Shared/TileSource.cs @@ -4,16 +4,21 @@ using System; using System.Globalization; +#if WINDOWS_UWP +using Windows.UI.Xaml.Media; +using Windows.UI.Xaml.Media.Imaging; +#else +using System.Windows.Media; +using System.Windows.Media.Imaging; +#endif namespace MapControl { /// - /// Provides the URI of a map tile. + /// Provides the download Uri or ImageSource of map tiles. /// public partial class TileSource { - public const int TileSize = 256; - private Func getUri; private string uriFormat = string.Empty; @@ -26,6 +31,9 @@ namespace MapControl this.uriFormat = uriFormat; } + /// + /// Gets or sets the format string to produce tile Uris. + /// public string UriFormat { get { return uriFormat; } @@ -76,11 +84,25 @@ namespace MapControl } } + /// + /// Gets the map tile Uri. + /// public virtual Uri GetUri(int x, int y, int zoomLevel) { return getUri?.Invoke(x, y, zoomLevel); } + /// + /// Gets the map tile ImageSource without caching in TileImageLoader.Cache. + /// By overriding LoadImage an application can provide arbitrary tile images. + /// + public virtual ImageSource LoadImage(int x, int y, int zoomLevel) + { + var uri = GetUri(x, y, zoomLevel); + + return uri != null ? new BitmapImage(uri) : null; + } + private Uri GetBasicUri(int x, int y, int zoomLevel) { return new Uri(uriFormat @@ -170,8 +192,8 @@ namespace MapControl .Replace("{S}", south.ToString(CultureInfo.InvariantCulture)) .Replace("{E}", east.ToString(CultureInfo.InvariantCulture)) .Replace("{N}", north.ToString(CultureInfo.InvariantCulture)) - .Replace("{X}", TileSize.ToString()) - .Replace("{Y}", TileSize.ToString())); + .Replace("{X}", MapProjection.TileSize.ToString()) + .Replace("{Y}", MapProjection.TileSize.ToString())); } private Uri GetLatLonBoundingBoxUri(int x, int y, int zoomLevel) @@ -187,8 +209,8 @@ namespace MapControl .Replace("{s}", south.ToString(CultureInfo.InvariantCulture)) .Replace("{e}", east.ToString(CultureInfo.InvariantCulture)) .Replace("{n}", north.ToString(CultureInfo.InvariantCulture)) - .Replace("{X}", TileSize.ToString()) - .Replace("{Y}", TileSize.ToString())); + .Replace("{X}", MapProjection.TileSize.ToString()) + .Replace("{Y}", MapProjection.TileSize.ToString())); } } } diff --git a/MapControl/ViewportChangedEventArgs.cs b/MapControl/Shared/ViewportChangedEventArgs.cs similarity index 100% rename from MapControl/ViewportChangedEventArgs.cs rename to MapControl/Shared/ViewportChangedEventArgs.cs diff --git a/MapControl/WebMercatorProjection.cs b/MapControl/Shared/WebMercatorProjection.cs similarity index 95% rename from MapControl/WebMercatorProjection.cs rename to MapControl/Shared/WebMercatorProjection.cs index e5c80823..d8e47c6a 100644 --- a/MapControl/WebMercatorProjection.cs +++ b/MapControl/Shared/WebMercatorProjection.cs @@ -3,7 +3,7 @@ // Licensed under the Microsoft Public License (Ms-PL) using System; -#if NETFX_CORE +#if WINDOWS_UWP using Windows.Foundation; #else using System.Windows; @@ -34,7 +34,7 @@ namespace MapControl public override double GetViewportScale(double zoomLevel) { - return base.GetViewportScale(zoomLevel) / MetersPerDegree; + return DegreesToViewportScale(zoomLevel) / MetersPerDegree; } public override Point GetMapScale(Location location) @@ -70,6 +70,8 @@ namespace MapControl public static double LatitudeToY(double latitude) { + var lat = latitude * Math.PI / 180d; + return latitude <= -90d ? double.NegativeInfinity : latitude >= 90d ? double.PositiveInfinity : Math.Log(Math.Tan((latitude + 90d) * Math.PI / 360d)) / Math.PI * 180d; diff --git a/MapControl/WmsImageLayer.cs b/MapControl/Shared/WmsImageLayer.cs similarity index 58% rename from MapControl/WmsImageLayer.cs rename to MapControl/Shared/WmsImageLayer.cs index 717d01cc..3761abf1 100644 --- a/MapControl/WmsImageLayer.cs +++ b/MapControl/Shared/WmsImageLayer.cs @@ -3,10 +3,16 @@ // Licensed under the Microsoft Public License (Ms-PL) using System; -#if NETFX_CORE +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Threading.Tasks; +#if WINDOWS_UWP +using Windows.Data.Xml.Dom; using Windows.UI.Xaml; #else using System.Windows; +using System.Xml; #endif namespace MapControl @@ -23,15 +29,11 @@ namespace MapControl public static readonly DependencyProperty LayersProperty = DependencyProperty.Register( nameof(Layers), typeof(string), typeof(WmsImageLayer), - new PropertyMetadata(null, (o, e) => ((WmsImageLayer)o).UpdateImage())); + new PropertyMetadata(string.Empty, (o, e) => ((WmsImageLayer)o).UpdateImage())); public static readonly DependencyProperty StylesProperty = DependencyProperty.Register( nameof(Styles), typeof(string), typeof(WmsImageLayer), - new PropertyMetadata(null, (o, e) => ((WmsImageLayer)o).UpdateImage())); - - public static readonly DependencyProperty ParametersProperty = DependencyProperty.Register( - nameof(Parameters), typeof(string), typeof(WmsImageLayer), - new PropertyMetadata(null, (o, e) => ((WmsImageLayer)o).UpdateImage())); + new PropertyMetadata(string.Empty, (o, e) => ((WmsImageLayer)o).UpdateImage())); public static readonly DependencyProperty FormatProperty = DependencyProperty.Register( nameof(Format), typeof(string), typeof(WmsImageLayer), @@ -67,12 +69,6 @@ namespace MapControl set { SetValue(StylesProperty, value); } } - public string Parameters - { - get { return (string)GetValue(ParametersProperty); } - set { SetValue(ParametersProperty, value); } - } - public string Format { get { return (string)GetValue(FormatProperty); } @@ -92,14 +88,60 @@ namespace MapControl return false; } - var version = Version ?? "1.3.0"; - var queryParameters = ParentMap.MapProjection.WmsQueryParameters(boundingBox, version); + var projectionParameters = ParentMap.MapProjection.WmsQueryParameters(boundingBox, Version); - if (string.IsNullOrEmpty(queryParameters)) + if (string.IsNullOrEmpty(projectionParameters)) { return false; } + UpdateImage(GetRequestUri("GetMap" + + "&LAYERS=" + Layers + "&STYLES=" + Styles + "&FORMAT=" + Format + + "&TRANSPARENT=" + (Transparent ? "TRUE" : "FALSE") + "&" + projectionParameters)); + + return true; + } + + public async Task> GetLayerNamesAsync() + { + if (ServerUri == null) + { + return null; + } + + var layerNames = new List(); + + try + { + var document = await XmlDocument.LoadFromUriAsync(GetRequestUri("GetCapabilities")); + + var capability = ChildElements(document.DocumentElement, "Capability").FirstOrDefault(); + if (capability != null) + { + var rootLayer = ChildElements(capability, "Layer").FirstOrDefault(); + if (rootLayer != null) + { + foreach (var layer in ChildElements(rootLayer, "Layer")) + { + var name = ChildElements(layer, "Name").FirstOrDefault(); + if (name != null) + { + layerNames.Add(name.InnerText); + } + } + } + } + } + catch (Exception ex) + { + Debug.WriteLine("WmsImageLayer: {0}: {1}", ServerUri, ex.Message); + } + + return layerNames; + } + + private Uri GetRequestUri(string query) + { var uri = ServerUri.ToString(); if (!uri.EndsWith("?") && !uri.EndsWith("&")) @@ -107,22 +149,14 @@ namespace MapControl uri += "?"; } - uri += "SERVICE=WMS" - + "&VERSION=" + version - + "&REQUEST=GetMap" - + "&LAYERS=" + (Layers ?? string.Empty) - + "&STYLES=" + (Styles ?? string.Empty) - + "&" + queryParameters - + "&FORMAT=" + (Format ?? "image/png") - + "&TRANSPARENT=" + (Transparent ? "TRUE" : "FALSE"); + uri += "SERVICE=WMS&VERSION=" + Version + "&REQUEST=" + query; - if (!string.IsNullOrEmpty(Parameters)) - { - uri += "&" + Parameters; - } + return new Uri(uri.Replace(" ", "%20")); + } - UpdateImage(new Uri(uri.Replace(" ", "%20"))); - return true; + private static IEnumerable ChildElements(XmlElement element, string name) + { + return element.ChildNodes.OfType().Where(e => (string)e.LocalName == name); } } } diff --git a/MapControl/TileImageLoader.Silverlight.cs b/MapControl/TileImageLoader.Silverlight.cs deleted file mode 100644 index 9c613dc9..00000000 --- a/MapControl/TileImageLoader.Silverlight.cs +++ /dev/null @@ -1,53 +0,0 @@ -// XAML Map Control - https://github.com/ClemensFischer/XAML-Map-Control -// © 2017 Clemens Fischer -// Licensed under the Microsoft Public License (Ms-PL) - -using System; -using System.Linq; -using System.Diagnostics; -using System.Windows.Media; -using System.Windows.Media.Imaging; - -namespace MapControl -{ - /// - /// Loads map tile images. - /// - public class TileImageLoader : ITileImageLoader - { - public void LoadTiles(MapTileLayer tileLayer) - { - var tileSource = tileLayer.TileSource; - var imageTileSource = tileSource as ImageTileSource; - - foreach (var tile in tileLayer.Tiles.Where(t => t.Pending)) - { - tile.Pending = false; - - try - { - ImageSource image = null; - Uri uri; - - if (imageTileSource != null) - { - image = imageTileSource.LoadImage(tile.XIndex, tile.Y, tile.ZoomLevel); - } - else if ((uri = tileSource.GetUri(tile.XIndex, tile.Y, tile.ZoomLevel)) != null) - { - image = new BitmapImage(uri); - } - - if (image != null) - { - tile.SetImage(image); - } - } - catch (Exception ex) - { - Debug.WriteLine("{0}/{1}/{2}: {3}", tile.ZoomLevel, tile.XIndex, tile.Y, ex.Message); - } - } - } - } -} diff --git a/MapControl/TileImageLoader.WPF.cs b/MapControl/TileImageLoader.WPF.cs deleted file mode 100644 index f214efcb..00000000 --- a/MapControl/TileImageLoader.WPF.cs +++ /dev/null @@ -1,272 +0,0 @@ -// XAML Map Control - https://github.com/ClemensFischer/XAML-Map-Control -// © 2017 Clemens Fischer -// Licensed under the Microsoft Public License (Ms-PL) - -using System; -using System.Collections.Concurrent; -using System.Diagnostics; -using System.IO; -using System.Linq; -using System.Net; -using System.Runtime.Caching; -using System.Text; -using System.Threading; -using System.Threading.Tasks; -using System.Windows.Media; - -namespace MapControl -{ - /// - /// Loads map tile images and optionally caches them in a System.Runtime.Caching.ObjectCache. - /// - public class TileImageLoader : ITileImageLoader - { - /// - /// Default name of an ObjectCache instance that is assigned to the Cache property. - /// - public const string DefaultCacheName = "TileCache"; - - /// - /// Default folder path where an ObjectCache instance may save cached data. - /// - public static readonly string DefaultCacheFolder = - Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "MapControl"); - - /// - /// Default expiration time for cached tile images. Used when no expiration time - /// was transmitted on download. The default value is one day. - /// - public static TimeSpan DefaultCacheExpiration { get; set; } - - /// - /// Minimum expiration time for cached tile images. Used when an unnecessarily small expiration time - /// was transmitted on download (e.g. Cache-Control: max-age=0). The default value is one hour. - /// - public static TimeSpan MinimumCacheExpiration { get; set; } - - /// - /// The ObjectCache used to cache tile images. The default is MemoryCache.Default. - /// - public static ObjectCache Cache { get; set; } - - /// - /// Optional value to be used for the HttpWebRequest.UserAgent property. The default is null. - /// - public static string HttpUserAgent { get; set; } - - static TileImageLoader() - { - DefaultCacheExpiration = TimeSpan.FromDays(1); - MinimumCacheExpiration = TimeSpan.FromHours(1); - Cache = MemoryCache.Default; - } - - private readonly ConcurrentStack pendingTiles = new ConcurrentStack(); - private int taskCount; - - public void LoadTiles(MapTileLayer tileLayer) - { - pendingTiles.Clear(); - - var tiles = tileLayer.Tiles.Where(t => t.Pending); - - if (tiles.Any()) - { - pendingTiles.PushRange(tiles.Reverse().ToArray()); - - var tileSource = tileLayer.TileSource; - var sourceName = tileLayer.SourceName; - var maxDownloads = tileLayer.MaxParallelDownloads; - - while (taskCount < Math.Min(pendingTiles.Count, maxDownloads)) - { - Interlocked.Increment(ref taskCount); - - Task.Run(() => - { - LoadPendingTiles(tileSource, sourceName); - - Interlocked.Decrement(ref taskCount); - }); - } - } - } - - private void LoadPendingTiles(TileSource tileSource, string sourceName) - { - var imageTileSource = tileSource as ImageTileSource; - Tile tile; - - while (pendingTiles.TryPop(out tile)) - { - tile.Pending = false; - - try - { - ImageSource image = null; - Uri uri; - - if (imageTileSource != null) - { - image = imageTileSource.LoadImage(tile.XIndex, tile.Y, tile.ZoomLevel); - } - else if ((uri = tileSource.GetUri(tile.XIndex, tile.Y, tile.ZoomLevel)) != null) - { - image = LoadImage(uri, sourceName, tile.XIndex, tile.Y, tile.ZoomLevel); - } - - if (image != null) - { - tile.SetImage(image); - } - } - catch (Exception ex) - { - Debug.WriteLine("{0}/{1}/{2}: {3}", tile.ZoomLevel, tile.XIndex, tile.Y, ex.Message); - } - } - } - - private ImageSource LoadImage(Uri uri, string sourceName, int x, int y, int zoomLevel) - { - ImageSource image = null; - - try - { - if (!uri.IsAbsoluteUri) - { - image = BitmapSourceHelper.FromFile(uri.OriginalString); - } - else if (uri.Scheme == "file") - { - image = BitmapSourceHelper.FromFile(uri.LocalPath); - } - else if (Cache == null || string.IsNullOrEmpty(sourceName)) - { - image = DownloadImage(uri, null); - } - else - { - var cacheKey = string.Format("{0}/{1}/{2}/{3}", sourceName, zoomLevel, x, y); - - if (!GetCachedImage(cacheKey, ref image)) - { - // Either no cached image was found or expiration time has expired. - // If download fails use possibly cached but expired image anyway. - image = DownloadImage(uri, cacheKey); - } - } - } - catch (WebException ex) - { - Debug.WriteLine("{0}: {1}: {2}", uri, ex.Status, ex.Message); - } - catch (Exception ex) - { - Debug.WriteLine("{0}: {1}", uri, ex.Message); - } - - return image; - } - - private static ImageSource DownloadImage(Uri uri, string cacheKey) - { - ImageSource image = null; - var request = WebRequest.CreateHttp(uri); - - if (HttpUserAgent != null) - { - request.UserAgent = HttpUserAgent; - } - - using (var response = (HttpWebResponse)request.GetResponse()) - { - if (response.Headers["X-VE-Tile-Info"] != "no-tile") // set by Bing Maps - { - using (var responseStream = response.GetResponseStream()) - using (var memoryStream = new MemoryStream()) - { - responseStream.CopyTo(memoryStream); - memoryStream.Seek(0, SeekOrigin.Begin); - image = BitmapSourceHelper.FromStream(memoryStream); - - if (cacheKey != null) - { - SetCachedImage(cacheKey, memoryStream, GetExpiration(response.Headers)); - } - } - } - } - - return image; - } - - private static bool GetCachedImage(string cacheKey, ref ImageSource image) - { - var result = false; - var buffer = Cache.Get(cacheKey) as byte[]; - - if (buffer != null) - { - try - { - using (var memoryStream = new MemoryStream(buffer)) - { - image = BitmapSourceHelper.FromStream(memoryStream); - } - - DateTime expiration = DateTime.MinValue; - - if (buffer.Length >= 16 && Encoding.ASCII.GetString(buffer, buffer.Length - 16, 8) == "EXPIRES:") - { - expiration = new DateTime(BitConverter.ToInt64(buffer, buffer.Length - 8), DateTimeKind.Utc); - } - - result = expiration > DateTime.UtcNow; - } - catch (Exception ex) - { - Debug.WriteLine("{0}: {1}", cacheKey, ex.Message); - } - } - - return result; - } - - private static void SetCachedImage(string cacheKey, MemoryStream memoryStream, DateTime expiration) - { - memoryStream.Seek(0, SeekOrigin.End); - memoryStream.Write(Encoding.ASCII.GetBytes("EXPIRES:"), 0, 8); - memoryStream.Write(BitConverter.GetBytes(expiration.Ticks), 0, 8); - - Cache.Set(cacheKey, memoryStream.ToArray(), new CacheItemPolicy { AbsoluteExpiration = expiration }); - } - - private static DateTime GetExpiration(WebHeaderCollection headers) - { - var expiration = DefaultCacheExpiration; - var cacheControl = headers["Cache-Control"]; - - if (cacheControl != null) - { - int maxAgeValue; - var maxAgeDirective = cacheControl - .Split(new char[] { ',', ' ' }, StringSplitOptions.RemoveEmptyEntries) - .FirstOrDefault(s => s.StartsWith("max-age=")); - - if (maxAgeDirective != null && - int.TryParse(maxAgeDirective.Substring(8), out maxAgeValue)) - { - expiration = TimeSpan.FromSeconds(maxAgeValue); - - if (expiration < MinimumCacheExpiration) - { - expiration = MinimumCacheExpiration; - } - } - } - - return DateTime.UtcNow.Add(expiration); - } - } -} diff --git a/MapControl/TileImageLoader.WinRT.cs b/MapControl/TileImageLoader.WinRT.cs deleted file mode 100644 index 712cab76..00000000 --- a/MapControl/TileImageLoader.WinRT.cs +++ /dev/null @@ -1,295 +0,0 @@ -// XAML Map Control - https://github.com/ClemensFischer/XAML-Map-Control -// © 2017 Clemens Fischer -// Licensed under the Microsoft Public License (Ms-PL) - -using System; -using System.Collections.Concurrent; -using System.Collections.Generic; -using System.Diagnostics; -using System.IO; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; -using Windows.Storage; -using Windows.Storage.Streams; -using Windows.UI.Core; -using Windows.UI.Xaml.Media.Imaging; -using Windows.Web.Http; -using Windows.Web.Http.Filters; - -namespace MapControl -{ - /// - /// Loads map tile images and optionally caches them in a IImageCache. - /// - public class TileImageLoader : ITileImageLoader - { - /// - /// Default name of an IImageCache instance that is assigned to the Cache property. - /// - public const string DefaultCacheName = "TileCache"; - - /// - /// Default StorageFolder where an IImageCache instance may save cached data. - /// - public static readonly StorageFolder DefaultCacheFolder = ApplicationData.Current.TemporaryFolder; - - /// - /// Default expiration time for cached tile images. Used when no expiration time - /// was transmitted on download. The default value is one day. - /// - public static TimeSpan DefaultCacheExpiration { get; set; } - - /// - /// Minimum expiration time for cached tile images. Used when an unnecessarily small expiration time - /// was transmitted on download (e.g. Cache-Control: max-age=0). The default value is one hour. - /// - public static TimeSpan MinimumCacheExpiration { get; set; } - - /// - /// The IImageCache implementation used to cache tile images. The default is null. - /// - public static Caching.IImageCache Cache; - - static TileImageLoader() - { - DefaultCacheExpiration = TimeSpan.FromDays(1); - MinimumCacheExpiration = TimeSpan.FromHours(1); - } - - private readonly ConcurrentStack pendingTiles = new ConcurrentStack(); - private int taskCount; - - public void LoadTiles(MapTileLayer tileLayer) - { - pendingTiles.Clear(); - - var tiles = tileLayer.Tiles.Where(t => t.Pending); - - if (tiles.Any()) - { - var tileSource = tileLayer.TileSource; - var imageTileSource = tileSource as ImageTileSource; - - if (imageTileSource != null) - { - LoadTiles(tiles, imageTileSource); - } - else - { - pendingTiles.PushRange(tiles.Reverse().ToArray()); - - var sourceName = tileLayer.SourceName; - var maxDownloads = tileLayer.MaxParallelDownloads; - - while (taskCount < Math.Min(pendingTiles.Count, maxDownloads)) - { - Interlocked.Increment(ref taskCount); - - Task.Run(async () => - { - await LoadPendingTiles(tileSource, sourceName); - - Interlocked.Decrement(ref taskCount); - }); - } - } - } - } - - private void LoadTiles(IEnumerable tiles, ImageTileSource tileSource) - { - foreach (var tile in tiles) - { - tile.Pending = false; - - try - { - var image = tileSource.LoadImage(tile.XIndex, tile.Y, tile.ZoomLevel); - - if (image != null) - { - tile.SetImage(image); - } - } - catch (Exception ex) - { - Debug.WriteLine("{0}/{1}/{2}: {3}", tile.ZoomLevel, tile.XIndex, tile.Y, ex.Message); - } - } - } - - private async Task LoadPendingTiles(TileSource tileSource, string sourceName) - { - Tile tile; - - while (pendingTiles.TryPop(out tile)) - { - tile.Pending = false; - - try - { - var uri = tileSource.GetUri(tile.XIndex, tile.Y, tile.ZoomLevel); - - if (uri != null) - { - if (!uri.IsAbsoluteUri) - { - await LoadImageFromFile(tile, uri.OriginalString); - } - else if (uri.Scheme == "file") - { - await LoadImageFromFile(tile, uri.LocalPath); - } - else if (Cache == null || sourceName == null) - { - await DownloadImage(tile, uri, null); - } - else - { - var extension = Path.GetExtension(uri.LocalPath); - - if (string.IsNullOrEmpty(extension) || extension == ".jpeg") - { - extension = ".jpg"; - } - - var cacheKey = string.Format(@"{0}\{1}\{2}\{3}{4}", sourceName, tile.ZoomLevel, tile.XIndex, tile.Y, extension); - var cacheItem = await Cache.GetAsync(cacheKey); - var loaded = false; - - if (cacheItem == null || cacheItem.Expiration <= DateTime.UtcNow) - { - loaded = await DownloadImage(tile, uri, cacheKey); - } - - if (!loaded && cacheItem != null && cacheItem.Buffer != null) - { - using (var stream = new InMemoryRandomAccessStream()) - { - await stream.WriteAsync(cacheItem.Buffer); - await stream.FlushAsync(); - stream.Seek(0); - - await LoadImageFromStream(tile, stream); - } - } - } - } - } - catch (Exception ex) - { - Debug.WriteLine("{0}/{1}/{2}: {3}", tile.ZoomLevel, tile.XIndex, tile.Y, ex.Message); - } - } - } - - private async Task DownloadImage(Tile tile, Uri uri, string cacheKey) - { - try - { - using (var httpClient = new HttpClient(new HttpBaseProtocolFilter { AllowAutoRedirect = false })) - using (var response = await httpClient.GetAsync(uri)) - { - if (response.IsSuccessStatusCode) - { - string tileInfo; - - if (!response.Headers.TryGetValue("X-VE-Tile-Info", out tileInfo) || tileInfo != "no-tile") // set by Bing Maps - { - await LoadImageFromHttpResponse(response, tile, cacheKey); - } - - return true; - } - - Debug.WriteLine("{0}: {1} {2}", uri, (int)response.StatusCode, response.ReasonPhrase); - } - } - catch (Exception ex) - { - Debug.WriteLine("{0}: {1}", uri, ex.Message); - } - - return false; - } - - private async Task LoadImageFromHttpResponse(HttpResponseMessage response, Tile tile, string cacheKey) - { - using (var stream = new InMemoryRandomAccessStream()) - { - using (var content = response.Content) - { - await content.WriteToStreamAsync(stream); - } - - await stream.FlushAsync(); - stream.Seek(0); - - await LoadImageFromStream(tile, stream); - - if (cacheKey != null) - { - var buffer = new Windows.Storage.Streams.Buffer((uint)stream.Size); - - stream.Seek(0); - await stream.ReadAsync(buffer, buffer.Capacity, InputStreamOptions.None); - - var expiration = DefaultCacheExpiration; - - if (response.Headers.CacheControl.MaxAge.HasValue) - { - expiration = response.Headers.CacheControl.MaxAge.Value; - - if (expiration < MinimumCacheExpiration) - { - expiration = MinimumCacheExpiration; - } - } - - await Cache.SetAsync(cacheKey, buffer, DateTime.UtcNow.Add(expiration)); - } - } - } - - private async Task LoadImageFromFile(Tile tile, string path) - { - try - { - var file = await StorageFile.GetFileFromPathAsync(path); - - using (var stream = await file.OpenReadAsync()) - { - await LoadImageFromStream(tile, stream); - } - } - catch (Exception ex) - { - Debug.WriteLine("{0}: {1}", path, ex.Message); - } - } - - private async Task LoadImageFromStream(Tile tile, IRandomAccessStream stream) - { - var tcs = new TaskCompletionSource(); - - await tile.Image.Dispatcher.RunAsync(CoreDispatcherPriority.Low, async () => - { - try - { - var image = new BitmapImage(); - await image.SetSourceAsync(stream); - tile.SetImage(image, true, false); - - tcs.SetResult(null); - } - catch (Exception ex) - { - tcs.SetException(ex); - } - }); - - await tcs.Task; - } - } -} diff --git a/MapControl/TileSourceConverter.cs b/MapControl/TileSourceConverter.cs deleted file mode 100644 index fe9b3a39..00000000 --- a/MapControl/TileSourceConverter.cs +++ /dev/null @@ -1,28 +0,0 @@ -// XAML Map Control - https://github.com/ClemensFischer/XAML-Map-Control -// © 2017 Clemens Fischer -// Licensed under the Microsoft Public License (Ms-PL) - -using System; -using System.ComponentModel; -using System.Globalization; - -namespace MapControl -{ - public class TileSourceConverter : TypeConverter - { - public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) - { - return sourceType == typeof(string); - } - - public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) - { - return new TileSource { UriFormat = value as string }; - } - } - - [TypeConverter(typeof(TileSourceConverter))] - public partial class TileSource - { - } -} diff --git a/MapControl/Extensions.WinRT.cs b/MapControl/UWP/Extensions.UWP.cs similarity index 88% rename from MapControl/Extensions.WinRT.cs rename to MapControl/UWP/Extensions.UWP.cs index b12db969..438c1ebb 100644 --- a/MapControl/Extensions.WinRT.cs +++ b/MapControl/UWP/Extensions.UWP.cs @@ -2,10 +2,8 @@ // © 2017 Clemens Fischer // Licensed under the Microsoft Public License (Ms-PL) -using System; using System.Collections.Generic; using Windows.Foundation; -using Windows.UI.Core; using Windows.UI.Xaml; using Windows.UI.Xaml.Media; using Windows.UI.Xaml.Media.Animation; @@ -14,11 +12,6 @@ namespace MapControl { internal static class Extensions { - public static IAsyncAction BeginInvoke(this CoreDispatcher dispatcher, Action action) - { - return dispatcher.RunAsync(CoreDispatcherPriority.Normal, new DispatchedHandler(action)); - } - public static Point Transform(this GeneralTransform transform, Point point) { return transform.TransformPoint(point); @@ -47,6 +40,7 @@ namespace MapControl private static void BeginAnimation(DependencyObject obj, DependencyProperty property, Timeline animation) { string propertyName; + if (properties.TryGetValue(property, out propertyName)) { Storyboard.SetTargetProperty(animation, propertyName); diff --git a/MapControl/ImageCache.WinRT.cs b/MapControl/UWP/ImageCache.UWP.cs similarity index 100% rename from MapControl/ImageCache.WinRT.cs rename to MapControl/UWP/ImageCache.UWP.cs diff --git a/MapControl/UWP/ImageFileCache.UWP.cs b/MapControl/UWP/ImageFileCache.UWP.cs new file mode 100644 index 00000000..8825cf66 --- /dev/null +++ b/MapControl/UWP/ImageFileCache.UWP.cs @@ -0,0 +1,99 @@ +// XAML Map Control - https://github.com/ClemensFischer/XAML-Map-Control +// © 2017 Clemens Fischer +// Licensed under the Microsoft Public License (Ms-PL) + +using System; +using System.Diagnostics; +using System.IO; +using System.Threading.Tasks; +using Windows.Storage; +using Windows.Storage.Streams; + +namespace MapControl.Caching +{ + public class ImageFileCache : IImageCache + { + private StorageFolder rootFolder; + + public ImageFileCache(StorageFolder rootFolder) + { + if (rootFolder == null) + { + throw new ArgumentNullException("The parameter rootFolder must not be null."); + } + + this.rootFolder = rootFolder; + + Debug.WriteLine("Created ImageFileCache in " + rootFolder.Path); + } + + public virtual async Task GetAsync(string key) + { + string path = null; + + try + { + path = Path.Combine(key.Split('\\', '/', ':', ';')); + } + catch (Exception ex) + { + Debug.WriteLine("ImageFileCache: Invalid key {0}: {1}", key, ex.Message); + } + + if (path != null) + { + var item = await rootFolder.TryGetItemAsync(path); + + if (item != null && item.IsOfType(StorageItemTypes.File)) + { + var file = (StorageFile)item; + //Debug.WriteLine("ImageFileCache: Reading " + file.Path); + + try + { + return new ImageCacheItem + { + Buffer = await FileIO.ReadBufferAsync(file), + Expiration = (await file.Properties.GetImagePropertiesAsync()).DateTaken.UtcDateTime + }; + } + catch (Exception ex) + { + Debug.WriteLine("ImageFileCache: Reading {0}: {1}", file.Path, ex.Message); + } + } + } + + return null; + } + + public virtual async Task SetAsync(string key, IBuffer buffer, DateTime expiration) + { + var paths = key.Split('\\', '/', ':', ';'); + + try + { + var folder = rootFolder; + + for (int i = 0; i < paths.Length - 1; i++) + { + folder = await folder.CreateFolderAsync(paths[i], CreationCollisionOption.OpenIfExists); + } + + var file = await folder.CreateFileAsync(paths[paths.Length - 1], CreationCollisionOption.ReplaceExisting); + //Debug.WriteLine("ImageFileCache: Writing {0}, Expires {1}", file.Path, expiration.ToLocalTime()); + + await FileIO.WriteBufferAsync(file, buffer); + + // Store expiration date in ImageProperties.DateTaken + var properties = await file.Properties.GetImagePropertiesAsync(); + properties.DateTaken = expiration; + await properties.SavePropertiesAsync(); + } + catch (Exception ex) + { + Debug.WriteLine("ImageFileCache: Writing {0}\\{1}: {2}", rootFolder.Path, string.Join("\\", paths), ex.Message); + } + } + } +} diff --git a/MapControl/Map.WinRT.cs b/MapControl/UWP/Map.UWP.cs similarity index 100% rename from MapControl/Map.WinRT.cs rename to MapControl/UWP/Map.UWP.cs diff --git a/MapControl/MapBase.Silverlight.WinRT.cs b/MapControl/UWP/MapBase.UWP.cs similarity index 97% rename from MapControl/MapBase.Silverlight.WinRT.cs rename to MapControl/UWP/MapBase.UWP.cs index 3ee6a594..fe16760c 100644 --- a/MapControl/MapBase.Silverlight.WinRT.cs +++ b/MapControl/UWP/MapBase.UWP.cs @@ -2,15 +2,10 @@ // © 2017 Clemens Fischer // Licensed under the Microsoft Public License (Ms-PL) -#if NETFX_CORE using Windows.Foundation; using Windows.UI; using Windows.UI.Xaml; using Windows.UI.Xaml.Media; -#else -using System.Windows; -using System.Windows.Media; -#endif namespace MapControl { diff --git a/MapControl/UWP/MapControl.UWP.csproj b/MapControl/UWP/MapControl.UWP.csproj new file mode 100644 index 00000000..3b674d9e --- /dev/null +++ b/MapControl/UWP/MapControl.UWP.csproj @@ -0,0 +1,180 @@ + + + + + Debug + AnyCPU + {951BC5D2-D653-42D9-9A91-21DC50DE0182} + Library + Properties + MapControl + MapControl.UWP + en-US + UAP + 10.0.10240.0 + 10.0.10240.0 + 14 + 512 + {A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + + + AnyCPU + true + full + false + ..\bin\Debug\ + DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP + prompt + 4 + true + + + AnyCPU + none + true + ..\bin\Release\ + TRACE;NETFX_CORE;WINDOWS_UWP + prompt + 4 + true + + + + + MapControl.snk + + + + + + AzimuthalEquidistantProjection.cs + + + AzimuthalProjection.cs + + + BingMapsTileLayer.cs + + + BingMapsTileSource.cs + + + BoundingBox.cs + + + CenteredBoundingBox.cs + + + EquirectangularProjection.cs + + + GnomonicProjection.cs + + + HyperlinkText.cs + + + Location.cs + + + LocationCollection.cs + + + MapBase.cs + + + MapGraticule.cs + + + MapImageLayer.cs + + + MapOverlay.cs + + + MapPanel.cs + + + MapPath.cs + + + MapPolyline.cs + + + MapProjection.cs + + + MapTileLayer.cs + + + OrthographicProjection.cs + + + StereographicProjection.cs + + + Tile.cs + + + TileGrid.cs + + + TileImageLoader.cs + + + TileSource.cs + + + ViewportChangedEventArgs.cs + + + WebMercatorProjection.cs + + + WmsImageLayer.cs + + + + + + + + + + + + + + + + + + + + + + + + + MSBuild:Compile + Designer + + + + 14.0 + + + true + + + ..\..\MapControl.snk + + + + \ No newline at end of file diff --git a/MapControl/MapGraticule.Silverlight.WinRT.cs b/MapControl/UWP/MapGraticule.UWP.cs similarity index 98% rename from MapControl/MapGraticule.Silverlight.WinRT.cs rename to MapControl/UWP/MapGraticule.UWP.cs index 5afc34a0..7d2de1e3 100644 --- a/MapControl/MapGraticule.Silverlight.WinRT.cs +++ b/MapControl/UWP/MapGraticule.UWP.cs @@ -3,20 +3,12 @@ // Licensed under the Microsoft Public License (Ms-PL) using System; -#if NETFX_CORE using Windows.Foundation; using Windows.UI.Xaml; using Windows.UI.Xaml.Controls; using Windows.UI.Xaml.Media; using Windows.UI.Xaml.Shapes; using Windows.UI.Xaml.Data; -#else -using System.Windows; -using System.Windows.Controls; -using System.Windows.Media; -using System.Windows.Shapes; -using System.Windows.Data; -#endif namespace MapControl { diff --git a/MapControl/MapImageLayer.Silverlight.WinRT.cs b/MapControl/UWP/MapImageLayer.UWP.cs similarity index 62% rename from MapControl/MapImageLayer.Silverlight.WinRT.cs rename to MapControl/UWP/MapImageLayer.UWP.cs index cfe1183d..aa2141e6 100644 --- a/MapControl/MapImageLayer.Silverlight.WinRT.cs +++ b/MapControl/UWP/MapImageLayer.UWP.cs @@ -3,15 +3,9 @@ // Licensed under the Microsoft Public License (Ms-PL) using System; -#if NETFX_CORE using Windows.UI.Xaml; using Windows.UI.Xaml.Controls; using Windows.UI.Xaml.Media.Imaging; -#else -using System.Windows; -using System.Windows.Controls; -using System.Windows.Media.Imaging; -#endif namespace MapControl { @@ -19,14 +13,14 @@ namespace MapControl { protected void UpdateImage(Uri uri) { - UpdateImage(new BitmapImage(uri)); + UpdateImage(uri != null ? new BitmapImage(uri) : null); } - protected void UpdateImage(BitmapSource bitmap) + protected void UpdateImage(BitmapSource bitmapSource) { - SetTopImage(bitmap); + SetTopImage(bitmapSource); - var bitmapImage = bitmap as BitmapImage; + var bitmapImage = bitmapSource as BitmapImage; if (bitmapImage != null) { @@ -41,18 +35,20 @@ namespace MapControl private void BitmapImageOpened(object sender, RoutedEventArgs e) { - var bitmap = (BitmapImage)sender; - bitmap.ImageOpened -= BitmapImageOpened; - bitmap.ImageFailed -= BitmapImageFailed; + var bitmapImage = (BitmapImage)sender; + + bitmapImage.ImageOpened -= BitmapImageOpened; + bitmapImage.ImageFailed -= BitmapImageFailed; SwapImages(); } private void BitmapImageFailed(object sender, ExceptionRoutedEventArgs e) { - var bitmap = (BitmapImage)sender; - bitmap.ImageOpened -= BitmapImageOpened; - bitmap.ImageFailed -= BitmapImageFailed; + var bitmapImage = (BitmapImage)sender; + + bitmapImage.ImageOpened -= BitmapImageOpened; + bitmapImage.ImageFailed -= BitmapImageFailed; ((Image)Children[topImageIndex]).Source = null; SwapImages(); diff --git a/MapControl/MapItem.Silverlight.WinRT.cs b/MapControl/UWP/MapItem.UWP.cs similarity index 92% rename from MapControl/MapItem.Silverlight.WinRT.cs rename to MapControl/UWP/MapItem.UWP.cs index 530131c1..82189b56 100644 --- a/MapControl/MapItem.Silverlight.WinRT.cs +++ b/MapControl/UWP/MapItem.UWP.cs @@ -2,11 +2,7 @@ // © 2017 Clemens Fischer // Licensed under the Microsoft Public License (Ms-PL) -#if NETFX_CORE using Windows.UI.Xaml.Controls; -#else -using System.Windows.Controls; -#endif namespace MapControl { diff --git a/MapControl/MapItemsControl.Silverlight.WinRT.cs b/MapControl/UWP/MapItemsControl.UWP.cs similarity index 91% rename from MapControl/MapItemsControl.Silverlight.WinRT.cs rename to MapControl/UWP/MapItemsControl.UWP.cs index aca2454a..a01a9d25 100644 --- a/MapControl/MapItemsControl.Silverlight.WinRT.cs +++ b/MapControl/UWP/MapItemsControl.UWP.cs @@ -2,13 +2,8 @@ // © 2017 Clemens Fischer // Licensed under the Microsoft Public License (Ms-PL) -#if NETFX_CORE using Windows.UI.Xaml; using Windows.UI.Xaml.Controls; -#else -using System.Windows; -using System.Windows.Controls; -#endif namespace MapControl { diff --git a/MapControl/MapOverlay.Silverlight.WinRT.cs b/MapControl/UWP/MapOverlay.UWP.cs similarity index 91% rename from MapControl/MapOverlay.Silverlight.WinRT.cs rename to MapControl/UWP/MapOverlay.UWP.cs index 391f67ae..740f43fe 100644 --- a/MapControl/MapOverlay.Silverlight.WinRT.cs +++ b/MapControl/UWP/MapOverlay.UWP.cs @@ -2,24 +2,13 @@ // © 2017 Clemens Fischer // Licensed under the Microsoft Public License (Ms-PL) -#if NETFX_CORE using Windows.UI.Text; using Windows.UI.Xaml; using Windows.UI.Xaml.Data; using Windows.UI.Xaml.Media; -#else -using System.Windows; -using System.Windows.Data; -using System.Windows.Media; -#endif namespace MapControl { -#if NETFX_CORE - class FontStyles { public const FontStyle Normal = FontStyle.Normal; } - class FontStretches { public const FontStretch Normal = FontStretch.Normal; } -#endif - public partial class MapOverlay { public static readonly DependencyProperty FontSizeProperty = DependencyProperty.Register( @@ -29,10 +18,10 @@ namespace MapControl nameof(FontFamily), typeof(FontFamily), typeof(MapOverlay), new PropertyMetadata(null)); public static readonly DependencyProperty FontStyleProperty = DependencyProperty.Register( - nameof(FontStyle), typeof(FontStyle), typeof(MapOverlay), new PropertyMetadata(FontStyles.Normal)); + nameof(FontStyle), typeof(FontStyle), typeof(MapOverlay), new PropertyMetadata(FontStyle.Normal)); public static readonly DependencyProperty FontStretchProperty = DependencyProperty.Register( - nameof(FontStretch), typeof(FontStretch), typeof(MapOverlay), new PropertyMetadata(FontStretches.Normal)); + nameof(FontStretch), typeof(FontStretch), typeof(MapOverlay), new PropertyMetadata(FontStretch.Normal)); public static readonly DependencyProperty FontWeightProperty = DependencyProperty.Register( nameof(FontWeight), typeof(FontWeight), typeof(MapOverlay), new PropertyMetadata(FontWeights.Normal)); diff --git a/MapControl/MapPanel.Silverlight.WinRT.cs b/MapControl/UWP/MapPanel.UWP.cs similarity index 96% rename from MapControl/MapPanel.Silverlight.WinRT.cs rename to MapControl/UWP/MapPanel.UWP.cs index 16539102..50b60b47 100644 --- a/MapControl/MapPanel.Silverlight.WinRT.cs +++ b/MapControl/UWP/MapPanel.UWP.cs @@ -2,13 +2,8 @@ // © 2017 Clemens Fischer // Licensed under the Microsoft Public License (Ms-PL) -#if NETFX_CORE using Windows.UI.Xaml; using Windows.UI.Xaml.Media; -#else -using System.Windows; -using System.Windows.Media; -#endif namespace MapControl { diff --git a/MapControl/MapPath.Silverlight.WinRT.cs b/MapControl/UWP/MapPath.UWP.cs similarity index 62% rename from MapControl/MapPath.Silverlight.WinRT.cs rename to MapControl/UWP/MapPath.UWP.cs index cec3d00c..43335bd6 100644 --- a/MapControl/MapPath.Silverlight.WinRT.cs +++ b/MapControl/UWP/MapPath.UWP.cs @@ -2,15 +2,9 @@ // © 2017 Clemens Fischer // Licensed under the Microsoft Public License (Ms-PL) -#if NETFX_CORE using Windows.Foundation; using Windows.UI.Xaml.Media; using Windows.UI.Xaml.Shapes; -#else -using System.Windows; -using System.Windows.Media; -using System.Windows.Shapes; -#endif namespace MapControl { @@ -23,7 +17,7 @@ namespace MapControl MapPanel.AddParentMapHandlers(this); } - protected override Size MeasureOverride(Size constraint) + protected override Size MeasureOverride(Size availableSize) { if (Stretch != Stretch.None) { @@ -46,12 +40,7 @@ namespace MapControl } } - // Path.MeasureOverride in Windows Runtime sometimes returns an empty Size, - // whereas in Silverlight it occasionally throws an ArgumentException, - // apparently because it tries to create a Size from negative width or height, - // which result from a transformed Geometry. - // In either case it seems to be sufficient to simply return a non-zero size. - return new Size(1, 1); + return new Size(); } } } diff --git a/MapControl/MapPolyline.Silverlight.WinRT.cs b/MapControl/UWP/MapPolyline.UWP.cs similarity index 81% rename from MapControl/MapPolyline.Silverlight.WinRT.cs rename to MapControl/UWP/MapPolyline.UWP.cs index c04b8e73..77e6f260 100644 --- a/MapControl/MapPolyline.Silverlight.WinRT.cs +++ b/MapControl/UWP/MapPolyline.UWP.cs @@ -2,14 +2,10 @@ // © 2017 Clemens Fischer // Licensed under the Microsoft Public License (Ms-PL) +using System.Collections.Generic; using System.Linq; -#if NETFX_CORE using Windows.UI.Xaml; using Windows.UI.Xaml.Media; -#else -using System.Windows; -using System.Windows.Media; -#endif namespace MapControl { @@ -19,11 +15,21 @@ namespace MapControl nameof(FillRule), typeof(FillRule), typeof(MapPolyline), new PropertyMetadata(FillRule.EvenOdd, (o, e) => ((PathGeometry)((MapPolyline)o).Data).FillRule = (FillRule)e.NewValue)); + public MapPolyline() { Data = new PathGeometry(); } + /// + /// Gets or sets the locations that define the polyline points. + /// + public IEnumerable Locations + { + get { return (IEnumerable)GetValue(LocationsProperty); } + set { SetValue(LocationsProperty, value); } + } + protected override void UpdateData() { var geometry = (PathGeometry)Data; diff --git a/MapControl/MapTileLayer.Silverlight.WinRT.cs b/MapControl/UWP/MapTileLayer.UWP.cs similarity index 83% rename from MapControl/MapTileLayer.Silverlight.WinRT.cs rename to MapControl/UWP/MapTileLayer.UWP.cs index d8b05e29..ca564c9e 100644 --- a/MapControl/MapTileLayer.Silverlight.WinRT.cs +++ b/MapControl/UWP/MapTileLayer.UWP.cs @@ -2,8 +2,11 @@ // © 2017 Clemens Fischer // Licensed under the Microsoft Public License (Ms-PL) +using Windows.UI.Xaml.Markup; + namespace MapControl { + [ContentProperty(Name = "TileSource")] public partial class MapTileLayer { partial void Initialize() diff --git a/MapControl/UWP/MatrixEx.UWP.cs b/MapControl/UWP/MatrixEx.UWP.cs new file mode 100644 index 00000000..19ee5793 --- /dev/null +++ b/MapControl/UWP/MatrixEx.UWP.cs @@ -0,0 +1,87 @@ +// XAML Map Control - https://github.com/ClemensFischer/XAML-Map-Control +// © 2017 Clemens Fischer +// Licensed under the Microsoft Public License (Ms-PL) + +using System; +using Windows.UI.Xaml.Media; + +namespace MapControl +{ + internal static class MatrixEx + { + /// + /// Used in MapProjection and MapTileLayer. + /// + public static Matrix TranslateScaleRotateTranslate( + double translation1X, double translation1Y, + double scaleX, double scaleY, double rotationAngle, + double translation2X, double translation2Y) + { + var matrix = new Matrix( + scaleX, 0d, 0d, scaleY, + scaleX * translation1X, + scaleY * translation1Y); + + if (rotationAngle != 0d) + { + rotationAngle = (rotationAngle % 360d) / 180d * Math.PI; + + var cos = Math.Cos(rotationAngle); + var sin = Math.Sin(rotationAngle); + + matrix = new Matrix( + matrix.M11 * cos - matrix.M12 * sin, + matrix.M11 * sin + matrix.M12 * cos, + matrix.M21 * cos - matrix.M22 * sin, + matrix.M21 * sin + matrix.M22 * cos, + cos * matrix.OffsetX - sin * matrix.OffsetY, + sin * matrix.OffsetX + cos * matrix.OffsetY); + } + + matrix.OffsetX += translation2X; + matrix.OffsetY += translation2Y; + + return matrix; + } + + public static Matrix TranslateScaleRotateTranslate_( + double translation1X, double translation1Y, + double scaleX, double scaleY, double rotationAngle, + double translation2X, double translation2Y) + { + var m11 = scaleX; + var m12 = 0d; + var m21 = 0d; + var m22 = scaleY; + var offsetX = scaleX * translation1X; + var offsetY = scaleY * translation1Y; + + if (rotationAngle != 0d) + { + rotationAngle = (rotationAngle % 360d) / 180d * Math.PI; + + var cos = Math.Cos(rotationAngle); + var sin = Math.Sin(rotationAngle); + + var _m11 = m11; + var _m12 = m12; + var _m21 = m21; + var _m22 = m22; + var _offsetX = offsetX; + var _offsetY = offsetY; + + m11 = _m11 * cos - _m12 * sin; + m12 = _m11 * sin + _m12 * cos; + m21 = _m21 * cos - _m22 * sin; + m22 = _m21 * sin + _m22 * cos; + offsetX = cos * _offsetX - sin * _offsetY; + offsetY = sin * _offsetX + cos * _offsetY; + } + + offsetX += translation2X; + offsetY += translation2Y; + + return new Matrix(m11, m12, m21, m22, offsetX, offsetY); + } + } +} diff --git a/MapControl/WinRT/Properties/AssemblyInfo.cs b/MapControl/UWP/Properties/AssemblyInfo.cs similarity index 62% rename from MapControl/WinRT/Properties/AssemblyInfo.cs rename to MapControl/UWP/Properties/AssemblyInfo.cs index a443f499..b839809d 100644 --- a/MapControl/WinRT/Properties/AssemblyInfo.cs +++ b/MapControl/UWP/Properties/AssemblyInfo.cs @@ -1,14 +1,14 @@ using System.Reflection; using System.Runtime.InteropServices; -[assembly: AssemblyTitle("XAML Map Control (WinRT)")] -[assembly: AssemblyDescription("XAML Map Control Library for Windows Runtime")] +[assembly: AssemblyTitle("XAML Map Control for UWP")] +[assembly: AssemblyDescription("XAML Map Control Library for UWP")] [assembly: AssemblyProduct("XAML Map Control")] [assembly: AssemblyCompany("Clemens Fischer")] [assembly: AssemblyCopyright("© 2017 Clemens Fischer")] [assembly: AssemblyTrademark("")] -[assembly: AssemblyVersion("3.4.1")] -[assembly: AssemblyFileVersion("3.4.1")] +[assembly: AssemblyVersion("4.0.0")] +[assembly: AssemblyFileVersion("4.0.0")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] diff --git a/MapControl/UWP/Properties/MapControl.UWP.rd.xml b/MapControl/UWP/Properties/MapControl.UWP.rd.xml new file mode 100644 index 00000000..5ab732e0 --- /dev/null +++ b/MapControl/UWP/Properties/MapControl.UWP.rd.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/MapControl/Pushpin.Silverlight.WinRT.cs b/MapControl/UWP/Pushpin.UWP.cs similarity index 92% rename from MapControl/Pushpin.Silverlight.WinRT.cs rename to MapControl/UWP/Pushpin.UWP.cs index 4446a6fb..2577f4be 100644 --- a/MapControl/Pushpin.Silverlight.WinRT.cs +++ b/MapControl/UWP/Pushpin.UWP.cs @@ -2,11 +2,7 @@ // © 2017 Clemens Fischer // Licensed under the Microsoft Public License (Ms-PL) -#if NETFX_CORE using Windows.UI.Xaml.Controls; -#else -using System.Windows.Controls; -#endif namespace MapControl { diff --git a/MapControl/WinRT/Themes/Generic.xaml b/MapControl/UWP/Themes/Generic.xaml similarity index 99% rename from MapControl/WinRT/Themes/Generic.xaml rename to MapControl/UWP/Themes/Generic.xaml index e25d0977..ddccf0b0 100644 --- a/MapControl/WinRT/Themes/Generic.xaml +++ b/MapControl/UWP/Themes/Generic.xaml @@ -1,4 +1,4 @@ - - - - - -
-
- - - - - - - - Get Microsoft Silverlight - -
-
- - diff --git a/SampleApps/SilverlightApplication.Web/SilverlightApplicationTestPage.html b/SampleApps/SilverlightApplication.Web/SilverlightApplicationTestPage.html deleted file mode 100644 index ae8695d0..00000000 --- a/SampleApps/SilverlightApplication.Web/SilverlightApplicationTestPage.html +++ /dev/null @@ -1,73 +0,0 @@ - - - - - SilverlightApplication - - - - - -
-
- - - - - - - - Get Microsoft Silverlight - -
-
- - diff --git a/SampleApps/SilverlightApplication.Web/Web.Debug.config b/SampleApps/SilverlightApplication.Web/Web.Debug.config deleted file mode 100644 index 2e302f9f..00000000 --- a/SampleApps/SilverlightApplication.Web/Web.Debug.config +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/SampleApps/SilverlightApplication.Web/Web.Release.config b/SampleApps/SilverlightApplication.Web/Web.Release.config deleted file mode 100644 index c3584446..00000000 --- a/SampleApps/SilverlightApplication.Web/Web.Release.config +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/SampleApps/SilverlightApplication.Web/Web.config b/SampleApps/SilverlightApplication.Web/Web.config deleted file mode 100644 index dc645b36..00000000 --- a/SampleApps/SilverlightApplication.Web/Web.config +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/SampleApps/SilverlightApplication/App.xaml b/SampleApps/SilverlightApplication/App.xaml deleted file mode 100644 index 6a0fe86c..00000000 --- a/SampleApps/SilverlightApplication/App.xaml +++ /dev/null @@ -1,6 +0,0 @@ - - - - diff --git a/SampleApps/SilverlightApplication/App.xaml.cs b/SampleApps/SilverlightApplication/App.xaml.cs deleted file mode 100644 index aa5894cc..00000000 --- a/SampleApps/SilverlightApplication/App.xaml.cs +++ /dev/null @@ -1,51 +0,0 @@ -using System; -using System.Windows; - -namespace SilverlightApplication -{ - public partial class App : Application - { - - public App() - { - this.Startup += this.Application_Startup; - this.Exit += this.Application_Exit; - this.UnhandledException += this.Application_UnhandledException; - - InitializeComponent(); - } - - private void Application_Startup(object sender, StartupEventArgs e) - { - this.RootVisual = new MainPage(); - } - - private void Application_Exit(object sender, EventArgs e) - { - - } - - private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e) - { - if (!System.Diagnostics.Debugger.IsAttached) - { - e.Handled = true; - Deployment.Current.Dispatcher.BeginInvoke(delegate { ReportErrorToDOM(e); }); - } - } - - private void ReportErrorToDOM(ApplicationUnhandledExceptionEventArgs e) - { - try - { - string errorMsg = e.ExceptionObject.Message + e.ExceptionObject.StackTrace; - errorMsg = errorMsg.Replace('"', '\'').Replace("\r\n", @"\n"); - - System.Windows.Browser.HtmlPage.Window.Eval("throw new Error(\"Unhandled Error in Silverlight Application " + errorMsg + "\");"); - } - catch (Exception) - { - } - } - } -} diff --git a/SampleApps/SilverlightApplication/MainPage.xaml b/SampleApps/SilverlightApplication/MainPage.xaml deleted file mode 100644 index 7d591726..00000000 --- a/SampleApps/SilverlightApplication/MainPage.xaml +++ /dev/null @@ -1,179 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/SampleApps/SilverlightApplication/MainPage.xaml.cs b/SampleApps/SilverlightApplication/MainPage.xaml.cs deleted file mode 100644 index 85175e66..00000000 --- a/SampleApps/SilverlightApplication/MainPage.xaml.cs +++ /dev/null @@ -1,59 +0,0 @@ -using System; -using System.Globalization; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Input; -using MapControl; -using ViewModel; - -namespace SilverlightApplication -{ - public partial class MainPage : UserControl - { - public MainPage() - { - InitializeComponent(); - } - - private void MapMouseMove(object sender, MouseEventArgs e) - { - var location = map.ViewportPointToLocation(e.GetPosition(map)); - var latitude = (int)Math.Round(location.Latitude * 60000d); - var longitude = (int)Math.Round(Location.NormalizeLongitude(location.Longitude) * 60000d); - var latHemisphere = 'N'; - var lonHemisphere = 'E'; - - if (latitude < 0) - { - latitude = -latitude; - latHemisphere = 'S'; - } - - if (longitude < 0) - { - longitude = -longitude; - lonHemisphere = 'W'; - } - - mouseLocation.Text = string.Format(CultureInfo.InvariantCulture, - "{0} {1:00} {2:00.000}\n{3} {4:000} {5:00.000}", - latHemisphere, latitude / 60000, (double)(latitude % 60000) / 1000d, - lonHemisphere, longitude / 60000, (double)(longitude % 60000) / 1000d); - } - - private void MapMouseLeave(object sender, MouseEventArgs e) - { - mouseLocation.Text = string.Empty; - } - - private void SeamarksChecked(object sender, RoutedEventArgs e) - { - map.Children.Insert(map.Children.IndexOf(mapGraticule), ((MapViewModel)DataContext).MapLayers.SeamarksLayer); - } - - private void SeamarksUnchecked(object sender, RoutedEventArgs e) - { - map.Children.Remove(((MapViewModel)DataContext).MapLayers.SeamarksLayer); - } - } -} diff --git a/SampleApps/SilverlightApplication/Properties/AppManifest.xml b/SampleApps/SilverlightApplication/Properties/AppManifest.xml deleted file mode 100644 index 6712a117..00000000 --- a/SampleApps/SilverlightApplication/Properties/AppManifest.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - diff --git a/SampleApps/SilverlightApplication/Properties/AssemblyInfo.cs b/SampleApps/SilverlightApplication/Properties/AssemblyInfo.cs deleted file mode 100644 index 16ed4465..00000000 --- a/SampleApps/SilverlightApplication/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System.Reflection; -using System.Runtime.InteropServices; - -[assembly: AssemblyTitle("Silverlight Sample Application")] -[assembly: AssemblyDescription("XAML Map Control Silverlight Sample Application")] -[assembly: AssemblyProduct("XAML Map Control")] -[assembly: AssemblyCompany("Clemens Fischer")] -[assembly: AssemblyCopyright("© 2017 Clemens Fischer")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyVersion("3.4.1")] -[assembly: AssemblyFileVersion("3.4.1")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCulture("")] -[assembly: ComVisible(false)] diff --git a/SampleApps/SilverlightApplication/Properties/InBrowserSettings.xml b/SampleApps/SilverlightApplication/Properties/InBrowserSettings.xml deleted file mode 100644 index 823301b0..00000000 --- a/SampleApps/SilverlightApplication/Properties/InBrowserSettings.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/SampleApps/SilverlightApplication/Properties/OutOfBrowserSettings.xml b/SampleApps/SilverlightApplication/Properties/OutOfBrowserSettings.xml deleted file mode 100644 index da4329a5..00000000 --- a/SampleApps/SilverlightApplication/Properties/OutOfBrowserSettings.xml +++ /dev/null @@ -1,7 +0,0 @@ - - SilverlightApplication Application on your desktop; at home, at work or on the go. - - - - - \ No newline at end of file diff --git a/SampleApps/SilverlightApplication/SilverlightApplication.csproj b/SampleApps/SilverlightApplication/SilverlightApplication.csproj deleted file mode 100644 index 1a064eaa..00000000 --- a/SampleApps/SilverlightApplication/SilverlightApplication.csproj +++ /dev/null @@ -1,129 +0,0 @@ - - - - Debug - AnyCPU - 8.0.50727 - 2.0 - {85AACDB7-959D-406D-A8DF-2F1E013F8F40} - {A1591282-1198-4647-A2B1-27E5FF5F6F3B};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} - Library - Properties - SilverlightApplication - SilverlightApplication - Silverlight - v5.0 - $(TargetFrameworkVersion) - true - - - true - true - SilverlightApplication.xap - Properties\AppManifest.xml - SilverlightApplication.App - SilverlightApplicationTestPage.html - true - true - true - Properties\OutOfBrowserSettings.xml - false - true - - - - - - v3.5 - - - true - full - false - Bin\Debug - DEBUG;TRACE;SILVERLIGHT - true - true - prompt - 4 - - - none - true - Bin\Release - TRACE;SILVERLIGHT - true - true - prompt - 4 - - - - - - - $(TargetFrameworkDirectory)System.Core.dll - - - - - - - MapLayers.cs - - - MapViewModel.cs - - - App.xaml - - - MainPage.xaml - - - - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - - - - - - {eb133b78-deff-416a-8f0c-89e54d766576} - MapControl.Silverlight - - - - - - - - 10_535_330.jpg - - - - - - - - - - - - \ No newline at end of file diff --git a/SampleApps/SilverlightApplication/SilverlightApplication.csproj.user b/SampleApps/SilverlightApplication/SilverlightApplication.csproj.user deleted file mode 100644 index 65ef3aff..00000000 --- a/SampleApps/SilverlightApplication/SilverlightApplication.csproj.user +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - OfflineApplication - True - False - False - - - - - - - - - True - SilverlightApplication.Web - True - - - - - \ No newline at end of file diff --git a/SampleApps/UniversalApp/MainPage.xaml.cs b/SampleApps/UniversalApp/MainPage.xaml.cs index 24a6daab..d606a8a5 100644 --- a/SampleApps/UniversalApp/MainPage.xaml.cs +++ b/SampleApps/UniversalApp/MainPage.xaml.cs @@ -1,4 +1,6 @@ -using ViewModel; +using MapControl; +using MapControl.Caching; +using ViewModel; using Windows.UI.Xaml; using Windows.UI.Xaml.Controls; using Windows.UI.Xaml.Controls.Primitives; @@ -11,8 +13,8 @@ namespace UniversalApp public MainPage() { - //MapControl.TileImageLoader.Cache = new MapControl.Caching.ImageFileCache(); - //MapControl.TileImageLoader.Cache = new MapControl.Caching.FileDbCache(); + TileImageLoader.Cache = new ImageFileCache(TileImageLoader.DefaultCacheFolder); + //TileImageLoader.Cache = new FileDbCache(TileImageLoader.DefaultCacheFolder); InitializeComponent(); DataContext = ViewModel; diff --git a/SampleApps/UniversalApp/Properties/AssemblyInfo.cs b/SampleApps/UniversalApp/Properties/AssemblyInfo.cs index 110b313c..7bbc5358 100644 --- a/SampleApps/UniversalApp/Properties/AssemblyInfo.cs +++ b/SampleApps/UniversalApp/Properties/AssemblyInfo.cs @@ -8,7 +8,7 @@ using System.Runtime.InteropServices; [assembly: AssemblyCopyright("© 2017 Clemens Fischer")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] -[assembly: AssemblyVersion("3.4.1")] -[assembly: AssemblyFileVersion("3.4.1")] +[assembly: AssemblyVersion("3.3.0")] +[assembly: AssemblyFileVersion("3.3.0")] [assembly: AssemblyConfiguration("")] [assembly: ComVisible(false)] diff --git a/SampleApps/UniversalApp/Properties/Default.rd.xml b/SampleApps/UniversalApp/Properties/Default.rd.xml index 80a960ce..23c23778 100644 --- a/SampleApps/UniversalApp/Properties/Default.rd.xml +++ b/SampleApps/UniversalApp/Properties/Default.rd.xml @@ -1,31 +1,5 @@ - - - - - - - - - - - + + + \ No newline at end of file diff --git a/SampleApps/UniversalApp/UniversalApp.csproj b/SampleApps/UniversalApp/UniversalApp.csproj index 335903b4..37c26460 100644 --- a/SampleApps/UniversalApp/UniversalApp.csproj +++ b/SampleApps/UniversalApp/UniversalApp.csproj @@ -11,13 +11,14 @@ UniversalApp en-US UAP - 10.0.10586.0 - 10.0.10586.0 + 10.0.10240.0 + 10.0.10240.0 14 true 512 {A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} UniversalApp_TemporaryKey.pfx + 5DCEEAF8B009D22AA0D41EA61710C9CB80E66BD4 true @@ -102,10 +103,10 @@ - + MapLayers.cs - + MapViewModel.cs @@ -124,7 +125,7 @@ - + 10_535_330.jpg @@ -147,17 +148,13 @@ - - {c7bf2b18-cc74-430b-bcb2-600304efa3d8} - FileDbCache.WinRT + + {3ff37d40-f770-45b2-95dd-7a84093e1425} + FileDbCache.UWP - - {f789647e-96f7-43e3-a895-fa3fe8d01260} - ImageFileCache.WinRT - - - {63cefdf7-5170-43b6-86f8-5c4a383a1615} - MapControl.WinRT + + {951bc5d2-d653-42d9-9a91-21dc50de0182} + MapControl.UWP diff --git a/SampleApps/UniversalApp/UniversalApp_TemporaryKey.pfx b/SampleApps/UniversalApp/UniversalApp_TemporaryKey.pfx index 66f065bca92b9143cf7decb3ee0d5f971e165ee1..6fec6f5ce3d6ab5fd242f9644342008078c341ac 100644 GIT binary patch delta 2351 zcmV+~3DEYI6VMYPFoFrp0s#Xsf(eKQ2`Yw2hW8Bt2LYgh33&v933V`n32~7kMt^45 z;7tEp{IvoC2haq91lW938@5lz-5}ykyGs zApJ=?bu3b!XRCwE0$2hEh!vxnAb-mL>Zrr<)-WK7wc~vf4HcS)mfQ%a#Nj8#)o^a{Wad)sTpNvRXt#C`IOB5J2WDD^ujitHh$WHiR| zc%*q=Nl$Yj)wrelMxi+kp$$ATSxd?$5Brx6dmdqa^ZjmWvMUK0W{RwiEPuXe?Hue` zL3ADMZ#RDoU7O=Lr^Q;anVy!qb*FRCqg?u^47@uNv)J5Z+*$2mhMw}hA`Ut;@Iygj!xUCLBUVrmEZt*_K{~!wu4m2fm>s@*e>Q0>(!e_}Ux{e$ELE)a; zw)oZmhZa?%6v{jQYQ51%jO~|3TWji2YHkjp@~n<$qXC@zDm@1UDve7ywYuPj!@Hcn zp(BC5Y$VFH2H1koIdtlH-=NeIUMSzV!e$lY5Q$wQ-sa{#(2R9loPV*4?#X!Sk01pI zy_H|7^!Cct5R=Qa4>>|cVA(H;*zvQTE3{&Owptly^Qgfu>T()GQv)1}DnLD{8JW4D z86gCSt{?uHY~J*>j*J!t%72SAYlKt1crlrSEj4~!r{)N2w$a+!M?S# z8-mH(wZvL-H;C=d!hiDaEErUJDRJiz5W|z46KR=iJW@)vv~zOaqu*PiJJKZ*5iJKF zUSS_($q&Hsil;?@F}pER5YVxYRm~N9`ZWf7zjZUx$&K75{BfVSPSnt;MVNQ>8u|Cl zSOUK1iX~EN5THd%*@|+n-y6T@Ya$ffoJDgg6EF=9RUg`ZE`J0;s=gQ75f}IRUCEW~ zAABRMAwzAU$~s1bP-VdJDU2eP2G`beCH`TmHl3ob1-KDTy}#*oV5x1bL-1VAhHo|Y zYKb~Wj>Fp9zlt!c+7%imJEx|i1UIKX-Pts6x1Ap6fJGcwTM+Z3ei|AjHNz8u-wE)H zQaiNf4}rw&HGe285s$kKM!y|0x|I#s9qE11-$`ug86QA*4N>*07Z7db6FpgtWh6VB6_w>uIq*T zevV9QCiA^t$fG%uVdGU&bBpI42B4S~NwE{@&#Zv@D}R|zNcrXvIhZ}itV>2%(Ia+T z?`+7jmQ3#vf3KQ*Z07T#5u(pvg*h*-*AUG0ZteIviN0Z>hf08nAOiQn)=toHlpnS- z^4NObv-$Ptr+dP!xbh0E#(ylx+bSR?!jSnyGg`@r;a%H#*uAHkfyc+vK4RyjcgZWY z&?CLHKz~k=vjB=7@H9);$nlc2a4DJ{YC8GeDgb1_E5h<%lCNA87uScbzmTcCW4yy6 zG%*CzERX+hMrgZ56g_ZH#k+Bp@7cPjiy z)y1Qa1tLQ_K3BOeHwxY{fz2=z1_>&LNQUn2hf0m11R6OD`4c?OaMbgWe&JrmIwK$c-O~x)+@(V zS6p0?+b=+`j=5R%)PtWiAYJPx)(dltV^8`df`1b|3caO97wuC+%17o!c>`ZBx{X_t zi$9yBwllU}CKd$#nU>fVW@nKuZwitFf*;utaoxUpp?1V^^zzrr{pDU(U@%wicO9gq zK2Q|*SHy(jL+=NzXJgj7l@e0+-#QGj5YEJL$~uKB^d4u3;A#7wa`NNlpsYc_Ydp)m zv40Q0M`s5w@H#5cI*BwC$N^Z!ceZ_AU&Rw6xXa>CPlQC=y9P-Q07AtOktK!~%ia>1 z*X-ZUvK6Y1`Q<@8JXM!XOP;+!{^qSBIiCx+Bi7;G_+Oa;;d43YEs*+)%BTfm{O?2r z4B*N=Cd^S|%B;3}nWBtHb86_=1mL8QCVyoFK1Xfx+ZXW_2HMk-b>;+8{6xyKcz>%| zEhaoX7#erHzJ)tAfN`t`Go)O64O1}fUgx8l)yMjOZ>k8;L|97)}tn&6;G zky(u$X(|Ni04RuI%tbB^6$F+B&MT04f{6`xmZnt#F) zQfL9>%|%VQzcP@+3MRRC_!+HGz7f~kNFp^xeQs)r^~wD8!SGJh7m6-c40@Z{LR;P0 zE{^=?z=PV9&1&!6g=9%Sg&j?RZuRXTOpXV0(NWD#DzRs|`w~FyFniOh8#Q$jQa=+Q zzg>$na!@x1uJ?^FAufLtlD;4|V}I-AXG;g%r=%_);R3{nCrJ-U4?4Fv*@?RL34w6x|bMm}1#0ap%x0`Ee52 zrquxh?2-W4)+S$D)-46;ia|ucbTU`{Awbd+URuu~4W*G6x>&Q3*n#~r%?s* zQJZY4w1{Z*Fgq|GFb4(&D>M!R0vZGq=%_A$#_lc~5Ym%_;l0oP@_DC(1Qa+-fAjlL VPC!`~-Wb4>9k=j0k+A{-2hfi%Ox^$h delta 2292 zcmYjTc{G&m8-CxJF_vcRF-?p$%TT?OEe0P(XhRB-B};w?l{HI-AyoKeNs+Q;31ik3Svm`<6X-}n&oZ9Dz;Eb%^2V3 zpT4F5YbBQ}}fCQR3bKa`RSHSY};>rdbSOV4`1Rs>+U^Xq zjK~;CiTc=|0eoRJwp-3Rs+rn&fvQimQ=z)%eDZ4NaYH4Ncy_Ic8ePTi1EgHOSVemv__k`s3f_2Jw1E-kY5+3*zW9C&fA_Sc^JciAJ(s{ao$R zwr*|C`#05?V}!O;k*m>|{}nNLt|*@C=%tcGH+x5QF1ZUlRl6a6LMnyB7exIgDVABA zaI|*cZoMTnFa2>_3O-|PU;=a3gchRRloS`H4M;i9zWScMcY-X5bU5|%4PCUVyn=I! z@5HCMVy*>ui_dN_S*Nq{t0FkgBiLGh96`g)%v3$>eykG9klIzER_fZ8XOdRE%cSAW zCut4W{bZEt{9HN(ibt-MS?xhViQivnG}rHhu(DLz`85c3nj{H;rE0<0&!NrVp?$fO z>>>Z%q8O^}`gLhEaYRZ?>4CZ$KH_=pg%d_+=i_UEt-3ho3zK_h|pEMo=N)PKC*<*JD27D3>L&9 zc|rWSh}NC{^HvDjR1HzOdfq9UNyeIQ`E=m&RE^_RU;TRWu5ceUZ_?)y^Xn*%4(aP_ z)0mC;Qg)wXm!2Ep#Yx4LhlM<%?y1$2JfF|?p*EzR7UOy}sSV|8+bKdF(}MArmmPbe z)S0jqOX$t+8c#g8i|{L);eLh>C%?bCZ;s8+A&;t4h7q9dEJzIK#BRSBC#N4ZTSOI8 zFnZ0gQBmaJ`mVb{(xvjt7xXR-OcV+gYsV|Qw+?Q)u2i%fmD!yr{PB^rIORjFW-`js z5z8mp>|Y_BflZZmX53R%!o987;Z?}k5^1Di_4Vl~$aUR}toa~zkxBZsp=NnRt;sEW zQp~|Tzd_jy`FK4+HR#Oz z*jv#}QCCgdZVh)?f3MqUUqkIpWxG65pqg)>9??vKTD})D-94x9dK^Jcz82e)WYd7! z`*QKgq$;QB6~P>}JFa6j17!KxF>A^@Xk>YC33cZYY$ZEMsF zmwd8{5Vts14Xv)HLrU9*Bez&8>6oZv{+Y9EUo^bL{=RWLDWM}KJTAs?;7G(#Nf~d? zZ0rW+W3@|`Zk;-Y6pw1 zy~|rtGlZ?_ZNrj^NJ1Glu0fABz4-}my~#$me!QCBc3ka1yE%yPCa!1sNwVaW=D*Vp zwMGV39?L57Rp#kE7+j?1|LDq-k-GJySZXmktfNrvzWROgdS`;hI0dWhIl=j+zzVf$ zwg#(?1NmF*ctSID#Uy{MqV_wtHOf;mJh($yBhABP3lfV7!S5iR--Z}x#U!BX0N4Vj z00qE-5emQ!;5a~FF!q2VBa>%fxqmrZz>bmGGdKqTVpJ#tN{ng(gR^0TJa9U$iOH6% z@VoUduZ2q>C~$@o!*PtjA`ks%!zeZoo=SnOLloEwlI=f|m5(8SjUgzoVFo_{QNa3C zI1GfrIFIhMw)wP+2cMI>v#Fbm+lA1-HvtbZ0T4HV6JkfgjS+AjGBe5LhU*PC4+zJP zCMZCsA$fwb+$n;bIRh&Gf)L?f_^0T%h60NI*&Ad6;1rMpU>t=FMgc*fAAVqCJlgFZ zcBh%;oIkD9X4l@j)9j(nM0~aBIVqpElmPMxN?--VEVPS|=tRTw@(Xd#Cu?R{=UavO zy)>#ggx`x~Uw0c4|Yczzmj^i__52yv?CQriCOij87& z0`8vEE4tAm#qYDykt&Bi5x!nXNL65VM@hFnP7kDW4!<0ZGZ{;srIq+olZ6Zi-6_rO zo16-Ko$wElE`@b~IsIBq2y>a|ajWRY?3e&A{D{X9@g^tN)#wPn_Z0;&I0%3lQji3M zVhmi62LulgFbIJ7exYL^NIpQIAT}h63=(8wVur*294F(d7~=$ivZD194hv{`#1#~# zfkVw1k>zQ&ur0PKh!eO~({pg(6<5)c!>wE|*Q8}d^tLN4&F_(L!Mz(lt9aVPLJLED z{WiEu-)eA4kvmNZc`-fWat$u?NRz<|Vft$(*)*3}UR$zwqJ0%Ky0RS9zx2`BYa_9p zd&WcZs=eN~FJ4dAEQw-UTrcq&DS67sA@6}Vj{VY3e>FOG(Rs|^96c@B_J+$we7XT& z1o1Q3fm@+;!h_oaE!~d-&!ah?bIn+y;<1YJf`?_t(}qMbV>TwX`*inj!cF9FKUMGC z^EDYIrS1Q8Kc1z{o>k-%IGcSfcFl#99JymiMVslWAWmi`u)_$4|9FC|hY3go0t5g6 zB0@qCGm=S$9S*}Hco%Y2<2+p@wtWf=An~zHZxzju7YJT= 5.0.0" - ], - "UAP,Version=v10.0": [] - } -} \ No newline at end of file diff --git a/SampleApps/WpfApplication/MainWindow.xaml.cs b/SampleApps/WpfApplication/MainWindow.xaml.cs index ed2d4449..06723d51 100644 --- a/SampleApps/WpfApplication/MainWindow.xaml.cs +++ b/SampleApps/WpfApplication/MainWindow.xaml.cs @@ -11,8 +11,8 @@ namespace WpfApplication { public MainWindow() { - //TileImageLoader.Cache = new MapControl.Caching.ImageFileCache(TileImageLoader.DefaultCacheName, TileImageLoader.DefaultCacheFolder); - //TileImageLoader.Cache = new MapControl.Caching.FileDbCache(TileImageLoader.DefaultCacheName, TileImageLoader.DefaultCacheFolder); + //TileImageLoader.Cache = new MapControl.Caching.ImageFileCache(TileImageLoader.DefaultCacheFolder); + //TileImageLoader.Cache = new MapControl.Caching.FileDbCache(TileImageLoader.DefaultCacheFolder); InitializeComponent(); } @@ -21,8 +21,8 @@ namespace WpfApplication { if (e.ClickCount == 2) { - //map.ZoomMap(e.GetPosition(map), Math.Floor(map.ZoomLevel + 1.5)); map.TargetCenter = map.ViewportPointToLocation(e.GetPosition(map)); + //map.ZoomMap(e.GetPosition(map), Math.Floor(map.ZoomLevel + 1.5)); //map.ZoomToBounds(new BoundingBox(53, 7, 54, 9)); } } diff --git a/SampleApps/WpfApplication/Properties/AssemblyInfo.cs b/SampleApps/WpfApplication/Properties/AssemblyInfo.cs index e85c3219..0a8d5518 100644 --- a/SampleApps/WpfApplication/Properties/AssemblyInfo.cs +++ b/SampleApps/WpfApplication/Properties/AssemblyInfo.cs @@ -7,8 +7,8 @@ using System.Runtime.InteropServices; [assembly: AssemblyCompany("Clemens Fischer")] [assembly: AssemblyCopyright("© 2017 Clemens Fischer")] [assembly: AssemblyTrademark("")] -[assembly: AssemblyVersion("3.4.1")] -[assembly: AssemblyFileVersion("3.4.1")] +[assembly: AssemblyVersion("4.0.0")] +[assembly: AssemblyFileVersion("4.0.0")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] diff --git a/SampleApps/WpfApplication/WpfApplication.csproj b/SampleApps/WpfApplication/WpfApplication.csproj index 921925e5..8e2bcd77 100644 --- a/SampleApps/WpfApplication/WpfApplication.csproj +++ b/SampleApps/WpfApplication/WpfApplication.csproj @@ -1,10 +1,10 @@  - + Debug AnyCPU - {9949326E-9261-4F95-89B1-151F60498951} + {F92DA93D-75DB-4308-A5F9-6B4C3908A675} WinExe Properties WpfApplication @@ -13,6 +13,7 @@ 512 {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 4 + true @@ -24,21 +25,18 @@ DEBUG;TRACE prompt 4 - false AnyCPU - none + pdbonly true bin\Release\ TRACE prompt 4 - false - 4.0 @@ -52,16 +50,16 @@ MSBuild:Compile Designer - - MapLayers.cs - - - MapViewModel.cs - MSBuild:Compile Designer + + MapLayers.cs + + + MapViewModel.cs + App.xaml Code @@ -84,20 +82,16 @@ - {ef44f661-b98a-4676-927f-85d138f82300} + {ad1cb53e-7aa4-4ec0-b901-b4e0e2665133} FileDbCache.WPF - - {86470440-fee2-4120-af5a-3762fb9c536f} - ImageFileCache.WPF - - - {226f3575-b683-446d-a2f0-181291dc8787} + + {a204a102-c745-4d65-aec8-7b96faedef2d} MapControl.WPF - + 10_535_330.jpg