From 5336d07704bf4dec78291f0255436a9aae57bc37 Mon Sep 17 00:00:00 2001 From: ClemensF Date: Fri, 23 Oct 2020 23:35:48 +0200 Subject: [PATCH] Version 5.4. Reworked TileSource --- FileDbCache/UWP/Properties/AssemblyInfo.cs | 4 +- FileDbCache/WPF/FileDbCache.WPF.csproj | 2 +- MBTiles/UWP/Properties/AssemblyInfo.cs | 4 +- MBTiles/WPF/MBTiles.WPF.csproj | 2 +- MapControl/Shared/BingMapsTileLayer.cs | 6 +- MapControl/Shared/BingMapsTileSource.cs | 36 ++-- MapControl/Shared/MapTileLayer.cs | 2 +- MapControl/Shared/TileSource.cs | 172 ++++++------------ MapControl/Shared/WmtsCapabilities.cs | 2 +- MapControl/Shared/WmtsTileSource.cs | 7 +- MapControl/UWP/Properties/AssemblyInfo.cs | 4 +- MapControl/WPF/MapControl.WPF.csproj | 2 +- MapImages/UWP/Properties/AssemblyInfo.cs | 4 +- MapImages/WPF/MapImages.WPF.csproj | 2 +- MapProjections/UWP/Properties/AssemblyInfo.cs | 4 +- MapProjections/WPF/MapProjections.WPF.csproj | 2 +- SQLiteCache/UWP/Properties/AssemblyInfo.cs | 4 +- SQLiteCache/WPF/SQLiteCache.WPF.csproj | 2 +- SampleApps/Shared/MapLayers.cs | 110 +++++------ SampleApps/UniversalApp/MainPage.xaml.cs | 1 - .../UniversalApp/Properties/AssemblyInfo.cs | 4 +- .../WpfApplication/WpfApplication.csproj | 2 +- 22 files changed, 145 insertions(+), 233 deletions(-) diff --git a/FileDbCache/UWP/Properties/AssemblyInfo.cs b/FileDbCache/UWP/Properties/AssemblyInfo.cs index db2cc916..3d469c58 100644 --- a/FileDbCache/UWP/Properties/AssemblyInfo.cs +++ b/FileDbCache/UWP/Properties/AssemblyInfo.cs @@ -7,8 +7,8 @@ using System.Runtime.InteropServices; [assembly: AssemblyCompany("Clemens Fischer")] [assembly: AssemblyCopyright("Copyright © 2020 Clemens Fischer")] [assembly: AssemblyTrademark("")] -[assembly: AssemblyVersion("5.3.1")] -[assembly: AssemblyFileVersion("5.3.1")] +[assembly: AssemblyVersion("5.4.0")] +[assembly: AssemblyFileVersion("5.4.0")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] diff --git a/FileDbCache/WPF/FileDbCache.WPF.csproj b/FileDbCache/WPF/FileDbCache.WPF.csproj index eccf41d0..6726aa56 100644 --- a/FileDbCache/WPF/FileDbCache.WPF.csproj +++ b/FileDbCache/WPF/FileDbCache.WPF.csproj @@ -9,7 +9,7 @@ ..\..\MapControl.snk false XAML Map Control - 5.3.1 + 5.4.0 ObjectCache implementation based on EzTools FileDb Clemens Fischer Copyright © 2020 Clemens Fischer diff --git a/MBTiles/UWP/Properties/AssemblyInfo.cs b/MBTiles/UWP/Properties/AssemblyInfo.cs index bde6da2c..1415af19 100644 --- a/MBTiles/UWP/Properties/AssemblyInfo.cs +++ b/MBTiles/UWP/Properties/AssemblyInfo.cs @@ -7,8 +7,8 @@ using System.Runtime.InteropServices; [assembly: AssemblyCompany("Clemens Fischer")] [assembly: AssemblyCopyright("Copyright © 2020 Clemens Fischer")] [assembly: AssemblyTrademark("")] -[assembly: AssemblyVersion("5.3.1")] -[assembly: AssemblyFileVersion("5.3.1")] +[assembly: AssemblyVersion("5.4.0")] +[assembly: AssemblyFileVersion("5.4.0")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] diff --git a/MBTiles/WPF/MBTiles.WPF.csproj b/MBTiles/WPF/MBTiles.WPF.csproj index 33b897c6..ccec2449 100644 --- a/MBTiles/WPF/MBTiles.WPF.csproj +++ b/MBTiles/WPF/MBTiles.WPF.csproj @@ -9,7 +9,7 @@ ..\..\MapControl.snk false XAML Map Control - 5.3.1 + 5.4.0 MBTiles Support Library for XAML Map Control Clemens Fischer Copyright © 2020 Clemens Fischer diff --git a/MapControl/Shared/BingMapsTileLayer.cs b/MapControl/Shared/BingMapsTileLayer.cs index d0e7d93c..190565e6 100644 --- a/MapControl/Shared/BingMapsTileLayer.cs +++ b/MapControl/Shared/BingMapsTileLayer.cs @@ -102,7 +102,11 @@ namespace MapControl Culture = CultureInfo.CurrentUICulture.Name; } - TileSource = new BingMapsTileSource(imageUrl.Replace("{culture}", Culture), subdomains); + TileSource = new BingMapsTileSource + { + UriFormat = imageUrl.Replace("{culture}", Culture), + Subdomains = subdomains + }; } } diff --git a/MapControl/Shared/BingMapsTileSource.cs b/MapControl/Shared/BingMapsTileSource.cs index 0c0865fc..4842ee5c 100644 --- a/MapControl/Shared/BingMapsTileSource.cs +++ b/MapControl/Shared/BingMapsTileSource.cs @@ -8,32 +8,26 @@ namespace MapControl { public class BingMapsTileSource : TileSource { - private readonly string[] subdomains; - - public BingMapsTileSource(string uriFormat, string[] subdomains) - : base(uriFormat) - { - this.subdomains = subdomains; - } - public override Uri GetUri(int x, int y, int zoomLevel) { - if (zoomLevel < 1) + Uri uri = null; + + if (UriFormat != null && Subdomains != null && Subdomains.Length > 0 && zoomLevel > 0) { - return null; + var subdomain = Subdomains[(x + y) % Subdomains.Length]; + var quadkey = new char[zoomLevel]; + + for (var z = zoomLevel - 1; z >= 0; z--, x /= 2, y /= 2) + { + quadkey[z] = (char)('0' + 2 * (y % 2) + (x % 2)); + } + + uri = new Uri(UriFormat + .Replace("{subdomain}", subdomain) + .Replace("{quadkey}", new string(quadkey))); } - var subdomain = subdomains[(x + y) % subdomains.Length]; - var quadkey = new char[zoomLevel]; - - for (var z = zoomLevel - 1; z >= 0; z--, x /= 2, y /= 2) - { - quadkey[z] = (char)('0' + 2 * (y % 2) + (x % 2)); - } - - return new Uri(UriFormat - .Replace("{subdomain}", subdomain) - .Replace("{quadkey}", new string(quadkey))); + return uri; } } } diff --git a/MapControl/Shared/MapTileLayer.cs b/MapControl/Shared/MapTileLayer.cs index 8960048f..a86d241e 100644 --- a/MapControl/Shared/MapTileLayer.cs +++ b/MapControl/Shared/MapTileLayer.cs @@ -35,9 +35,9 @@ namespace MapControl { return new MapTileLayer { + TileSource = new TileSource { UriFormat = "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png" }, SourceName = "OpenStreetMap", Description = "© [OpenStreetMap Contributors](http://www.openstreetmap.org/copyright)", - TileSource = new TileSource { UriFormat = "https://tile.openstreetmap.org/{z}/{x}/{y}.png" }, MaxZoomLevel = 19 }; } diff --git a/MapControl/Shared/TileSource.cs b/MapControl/Shared/TileSource.cs index 331a7618..18afc0d1 100644 --- a/MapControl/Shared/TileSource.cs +++ b/MapControl/Shared/TileSource.cs @@ -22,88 +22,29 @@ namespace MapControl #endif public class TileSource { - private Func getUri; private string uriFormat; - private int subdomainIndex = -1; - - public TileSource() - { - } - - protected TileSource(string uriFormat) - { - this.uriFormat = uriFormat; - } - - public string[] Subdomains { get; set; } /// - /// Gets or sets the format string to produce tile Uris. + /// Gets or sets the format string to produce tile request Uris. /// public string UriFormat { get { return uriFormat; } set { - if (string.IsNullOrEmpty(value)) - { - throw new ArgumentException("The value of the UriFormat property must not be null or empty."); - } - uriFormat = value; - if (uriFormat.Contains("{x}") && uriFormat.Contains("{z}")) + if (Subdomains == null && uriFormat.Contains("{s}")) { - if (uriFormat.Contains("{y}")) - { - getUri = GetDefaultUri; - } - else if (uriFormat.Contains("{v}")) - { - getUri = GetTmsUri; - } - } - else if (uriFormat.Contains("{q}")) // {i} is optional - { - getUri = GetQuadKeyUri; - } - else if (uriFormat.Contains("{W}") && uriFormat.Contains("{S}") && uriFormat.Contains("{E}") && uriFormat.Contains("{N}")) - { - getUri = GetBoundingBoxUri; - } - else if (uriFormat.Contains("{w}") && uriFormat.Contains("{s}") && uriFormat.Contains("{e}") && uriFormat.Contains("{n}")) - { - getUri = GetLatLonBoundingBoxUri; - } - - if (Subdomains == null && uriFormat.Contains("{c}")) - { - Subdomains = new string[] { "a", "b", "c" }; + Subdomains = new string[] { "a", "b", "c" }; // default OpenStreetMap subdomains } } } /// - /// Gets the image Uri for the specified tile indices and zoom level. + /// Gets or sets an array of request subdomain names that are replaced for the {s} format specifier. /// - public virtual Uri GetUri(int x, int y, int zoomLevel) - { - if (getUri == null) - { - return null; - } - - var uri = getUri(x, y, zoomLevel); - - if (Subdomains != null && Subdomains.Length > 0) - { - subdomainIndex = (subdomainIndex + 1) % Subdomains.Length; - - uri = uri.Replace("{c}", Subdomains[subdomainIndex]); - } - - return new Uri(uri, UriKind.RelativeOrAbsolute); - } + public string[] Subdomains { get; set; } /// /// Loads a tile ImageSource asynchronously from GetUri(x, y, zoomLevel). @@ -115,71 +56,62 @@ namespace MapControl return uri != null ? ImageLoader.LoadImageAsync(uri) : Task.FromResult((ImageSource)null); } - private string GetDefaultUri(int x, int y, int zoomLevel) + /// + /// Gets the image Uri for the specified tile indices and zoom level. + /// + public virtual Uri GetUri(int x, int y, int zoomLevel) { - return uriFormat - .Replace("{x}", x.ToString()) - .Replace("{y}", y.ToString()) - .Replace("{z}", zoomLevel.ToString()); - } + Uri uri = null; - private string GetTmsUri(int x, int y, int zoomLevel) - { - y = (1 << zoomLevel) - 1 - y; - - return uriFormat - .Replace("{x}", x.ToString()) - .Replace("{v}", y.ToString()) - .Replace("{z}", zoomLevel.ToString()); - } - - private string GetQuadKeyUri(int x, int y, int zoomLevel) - { - if (zoomLevel < 1) + if (UriFormat != null) { - return null; + var uriString = UriFormat + .Replace("{x}", x.ToString()) + .Replace("{y}", y.ToString()) + .Replace("{z}", zoomLevel.ToString()); + + if (Subdomains != null && Subdomains.Length > 0) + { + uriString = uriString.Replace("{s}", Subdomains[(x + y) % Subdomains.Length]); + } + + uri = new Uri(uriString, UriKind.RelativeOrAbsolute); } - var quadkey = new char[zoomLevel]; + return uri; + } + } - for (var z = zoomLevel - 1; z >= 0; z--, x /= 2, y /= 2) + public class TmsTileSource : TileSource + { + public override Uri GetUri(int x, int y, int zoomLevel) + { + return base.GetUri(x, (1 << zoomLevel) - 1 - y, zoomLevel); + } + } + + public class BoundingBoxTileSource : TileSource + { + public override Uri GetUri(int x, int y, int zoomLevel) + { + Uri uri = null; + + if (UriFormat != null) { - quadkey[z] = (char)('0' + 2 * (y % 2) + (x % 2)); + var tileSize = 360d / (1 << zoomLevel); // tile width in degrees + var west = MapProjection.Wgs84MetersPerDegree * (x * tileSize - 180d); + var east = MapProjection.Wgs84MetersPerDegree * ((x + 1) * tileSize - 180d); + var south = MapProjection.Wgs84MetersPerDegree * (180d - (y + 1) * tileSize); + var north = MapProjection.Wgs84MetersPerDegree * (180d - y * tileSize); + + uri = new Uri(UriFormat + .Replace("{west}", west.ToString(CultureInfo.InvariantCulture)) + .Replace("{south}", south.ToString(CultureInfo.InvariantCulture)) + .Replace("{east}", east.ToString(CultureInfo.InvariantCulture)) + .Replace("{north}", north.ToString(CultureInfo.InvariantCulture))); } - return uriFormat - .Replace("{i}", new string(quadkey, zoomLevel - 1, 1)) - .Replace("{q}", new string(quadkey)); - } - - private string GetBoundingBoxUri(int x, int y, int zoomLevel) - { - var tileSize = 360d / (1 << zoomLevel); // tile width in degrees - var west = MapProjection.Wgs84MetersPerDegree * (x * tileSize - 180d); - var east = MapProjection.Wgs84MetersPerDegree * ((x + 1) * tileSize - 180d); - var south = MapProjection.Wgs84MetersPerDegree * (180d - (y + 1) * tileSize); - var north = MapProjection.Wgs84MetersPerDegree * (180d - y * tileSize); - - return uriFormat - .Replace("{W}", west.ToString(CultureInfo.InvariantCulture)) - .Replace("{S}", south.ToString(CultureInfo.InvariantCulture)) - .Replace("{E}", east.ToString(CultureInfo.InvariantCulture)) - .Replace("{N}", north.ToString(CultureInfo.InvariantCulture)); - } - - private string GetLatLonBoundingBoxUri(int x, int y, int zoomLevel) - { - var tileSize = 360d / (1 << zoomLevel); // tile width in degrees - var west = x * tileSize - 180d; - var east = (x + 1) * tileSize - 180d; - var south = WebMercatorProjection.YToLatitude(180d - (y + 1) * tileSize); - var north = WebMercatorProjection.YToLatitude(180d - y * tileSize); - - return uriFormat - .Replace("{w}", west.ToString(CultureInfo.InvariantCulture)) - .Replace("{s}", south.ToString(CultureInfo.InvariantCulture)) - .Replace("{e}", east.ToString(CultureInfo.InvariantCulture)) - .Replace("{n}", north.ToString(CultureInfo.InvariantCulture)); + return uri; } } } diff --git a/MapControl/Shared/WmtsCapabilities.cs b/MapControl/Shared/WmtsCapabilities.cs index 6f58e046..1ada2614 100644 --- a/MapControl/Shared/WmtsCapabilities.cs +++ b/MapControl/Shared/WmtsCapabilities.cs @@ -123,7 +123,7 @@ namespace MapControl return new WmtsCapabilities { LayerIdentifier = layerIdentifier, - TileSource = new WmtsTileSource(urlTemplate.Replace("{Style}", style)), + TileSource = new WmtsTileSource { UriFormat = urlTemplate.Replace("{Style}", style) }, TileMatrixSets = tileMatrixSets }; } diff --git a/MapControl/Shared/WmtsTileSource.cs b/MapControl/Shared/WmtsTileSource.cs index 05a7a8b2..203f2f48 100644 --- a/MapControl/Shared/WmtsTileSource.cs +++ b/MapControl/Shared/WmtsTileSource.cs @@ -8,18 +8,13 @@ namespace MapControl { public class WmtsTileSource : TileSource { - public WmtsTileSource(string uriFormat) - : base(uriFormat) - { - } - public WmtsTileMatrixSet TileMatrixSet { get; set; } public override Uri GetUri(int x, int y, int zoomLevel) { Uri uri = null; - if (TileMatrixSet != null && zoomLevel >= 0 && zoomLevel < TileMatrixSet.TileMatrixes.Count) + if (UriFormat != null && TileMatrixSet != null && zoomLevel >= 0 && zoomLevel < TileMatrixSet.TileMatrixes.Count) { uri = new Uri(UriFormat .Replace("{TileMatrixSet}", TileMatrixSet.Identifier) diff --git a/MapControl/UWP/Properties/AssemblyInfo.cs b/MapControl/UWP/Properties/AssemblyInfo.cs index 5ec7ad43..b2f603da 100644 --- a/MapControl/UWP/Properties/AssemblyInfo.cs +++ b/MapControl/UWP/Properties/AssemblyInfo.cs @@ -7,8 +7,8 @@ using System.Runtime.InteropServices; [assembly: AssemblyCompany("Clemens Fischer")] [assembly: AssemblyCopyright("Copyright © 2020 Clemens Fischer")] [assembly: AssemblyTrademark("")] -[assembly: AssemblyVersion("5.3.1")] -[assembly: AssemblyFileVersion("5.3.1")] +[assembly: AssemblyVersion("5.4.0")] +[assembly: AssemblyFileVersion("5.4.0")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] diff --git a/MapControl/WPF/MapControl.WPF.csproj b/MapControl/WPF/MapControl.WPF.csproj index 2e848fdc..cacd0be6 100644 --- a/MapControl/WPF/MapControl.WPF.csproj +++ b/MapControl/WPF/MapControl.WPF.csproj @@ -9,7 +9,7 @@ ..\..\MapControl.snk false XAML Map Control - 5.3.1 + 5.4.0 XAML Map Control Library Clemens Fischer Copyright © 2020 Clemens Fischer diff --git a/MapImages/UWP/Properties/AssemblyInfo.cs b/MapImages/UWP/Properties/AssemblyInfo.cs index 9f316d4a..f9821dc7 100644 --- a/MapImages/UWP/Properties/AssemblyInfo.cs +++ b/MapImages/UWP/Properties/AssemblyInfo.cs @@ -7,8 +7,8 @@ using System.Runtime.InteropServices; [assembly: AssemblyCompany("Clemens Fischer")] [assembly: AssemblyCopyright("Copyright © 2020 Clemens Fischer")] [assembly: AssemblyTrademark("")] -[assembly: AssemblyVersion("5.3.1")] -[assembly: AssemblyFileVersion("5.3.1")] +[assembly: AssemblyVersion("5.4.0")] +[assembly: AssemblyFileVersion("5.4.0")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] diff --git a/MapImages/WPF/MapImages.WPF.csproj b/MapImages/WPF/MapImages.WPF.csproj index 320f4ede..db608a21 100644 --- a/MapImages/WPF/MapImages.WPF.csproj +++ b/MapImages/WPF/MapImages.WPF.csproj @@ -9,7 +9,7 @@ ..\..\MapControl.snk false XAML Map Control - 5.3.1 + 5.4.0 Image Support Library for XAML Map Control Clemens Fischer Copyright © 2020 Clemens Fischer diff --git a/MapProjections/UWP/Properties/AssemblyInfo.cs b/MapProjections/UWP/Properties/AssemblyInfo.cs index cb58b8ea..06aa34d8 100644 --- a/MapProjections/UWP/Properties/AssemblyInfo.cs +++ b/MapProjections/UWP/Properties/AssemblyInfo.cs @@ -7,8 +7,8 @@ using System.Runtime.InteropServices; [assembly: AssemblyCompany("Clemens Fischer")] [assembly: AssemblyCopyright("Copyright © 2020 Clemens Fischer")] [assembly: AssemblyTrademark("")] -[assembly: AssemblyVersion("5.3.1")] -[assembly: AssemblyFileVersion("5.3.1")] +[assembly: AssemblyVersion("5.4.0")] +[assembly: AssemblyFileVersion("5.4.0")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] diff --git a/MapProjections/WPF/MapProjections.WPF.csproj b/MapProjections/WPF/MapProjections.WPF.csproj index 2d596a5e..45073e7b 100644 --- a/MapProjections/WPF/MapProjections.WPF.csproj +++ b/MapProjections/WPF/MapProjections.WPF.csproj @@ -9,7 +9,7 @@ ..\..\MapControl.snk false XAML Map Control - 5.3.1 + 5.4.0 Map Projections Library for XAML Map Control Clemens Fischer Copyright © 2020 Clemens Fischer diff --git a/SQLiteCache/UWP/Properties/AssemblyInfo.cs b/SQLiteCache/UWP/Properties/AssemblyInfo.cs index e8666544..59f04a54 100644 --- a/SQLiteCache/UWP/Properties/AssemblyInfo.cs +++ b/SQLiteCache/UWP/Properties/AssemblyInfo.cs @@ -7,8 +7,8 @@ using System.Runtime.InteropServices; [assembly: AssemblyCompany("Clemens Fischer")] [assembly: AssemblyCopyright("Copyright © 2020 Clemens Fischer")] [assembly: AssemblyTrademark("")] -[assembly: AssemblyVersion("5.3.1")] -[assembly: AssemblyFileVersion("5.3.1")] +[assembly: AssemblyVersion("5.4.0")] +[assembly: AssemblyFileVersion("5.4.0")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] diff --git a/SQLiteCache/WPF/SQLiteCache.WPF.csproj b/SQLiteCache/WPF/SQLiteCache.WPF.csproj index 4d08968d..20de4571 100644 --- a/SQLiteCache/WPF/SQLiteCache.WPF.csproj +++ b/SQLiteCache/WPF/SQLiteCache.WPF.csproj @@ -9,7 +9,7 @@ ..\..\MapControl.snk false XAML Map Control - 5.3.1 + 5.4.0 ObjectCache implementation based on SQLite Clemens Fischer Copyright © 2020 Clemens Fischer diff --git a/SampleApps/Shared/MapLayers.cs b/SampleApps/Shared/MapLayers.cs index 17747423..a4198eeb 100644 --- a/SampleApps/Shared/MapLayers.cs +++ b/SampleApps/Shared/MapLayers.cs @@ -23,9 +23,9 @@ namespace ViewModel "OpenStreetMap", new MapTileLayer { + TileSource = new TileSource { UriFormat = "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png" }, SourceName = "OpenStreetMap", Description = "© [OpenStreetMap Contributors](http://www.openstreetmap.org/copyright)", - TileSource = new TileSource { UriFormat = "https://{c}.tile.openstreetmap.org/{z}/{x}/{y}.png" }, MaxZoomLevel = 19 } }, @@ -33,70 +33,39 @@ namespace ViewModel "OpenStreetMap German", new MapTileLayer { + TileSource = new TileSource { UriFormat = "https://{s}.tile.openstreetmap.de/tiles/osmde/{z}/{x}/{y}.png" }, SourceName = "OpenStreetMap German", Description = "© [OpenStreetMap contributors](http://www.openstreetmap.org/copyright)", - TileSource = new TileSource { UriFormat = "https://{c}.tile.openstreetmap.de/tiles/osmde/{z}/{x}/{y}.png" }, MaxZoomLevel = 19 } }, { - "Stamen Terrain", + "OpenTopoMap", new MapTileLayer { - SourceName = "Stamen Terrain", - Description = "Map tiles by [Stamen Design](http://stamen.com/), under [CC BY 3.0](http://creativecommons.org/licenses/by/3.0)\nData by [OpenStreetMap](http://openstreetmap.org/), under [ODbL](http://www.openstreetmap.org/copyright)", - TileSource = new TileSource { UriFormat = "http://tile.stamen.com/terrain/{z}/{x}/{y}.png" }, + TileSource = new TileSource { UriFormat = "https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png" }, + SourceName = "OpenTopoMap", + Description = "© [OpenStreetMap contributors](http://www.openstreetmap.org/copyright)", MaxZoomLevel = 17 } }, { - "Stamen Toner Light", + "Seamarks", new MapTileLayer { - SourceName = "Stamen Toner Light", - Description = "Map tiles by [Stamen Design](http://stamen.com/), under [CC BY 3.0](http://creativecommons.org/licenses/by/3.0)\nData by [OpenStreetMap](http://openstreetmap.org/), under [ODbL](http://www.openstreetmap.org/copyright)", - TileSource = new TileSource { UriFormat = "http://tile.stamen.com/toner-lite/{z}/{x}/{y}.png" }, + TileSource = new TileSource { UriFormat = "http://tiles.openseamap.org/seamark/{z}/{x}/{y}.png" }, + SourceName = "OpenSeaMap", + MinZoomLevel = 9, MaxZoomLevel = 18 } }, { - "Bing Maps Road", - new BingMapsTileLayer + "TopPlusOpen WMTS", + new WmtsTileLayer { - SourceName = "Bing Maps Road", - Description = "© [Microsoft](http://www.bing.com/maps/)", - Mode = BingMapsTileLayer.MapMode.Road - } - }, - { - "Bing Maps Aerial", - new BingMapsTileLayer - { - SourceName = "Bing Maps Aerial", - Description = "© [Microsoft](http://www.bing.com/maps/)", - Mode = BingMapsTileLayer.MapMode.Aerial, - MaxZoomLevel = 21, - MapForeground = new SolidColorBrush(Colors.White), - MapBackground = new SolidColorBrush(Colors.Black) - } - }, - { - "Bing Maps Aerial with Labels", - new BingMapsTileLayer - { - SourceName = "Bing Maps Hybrid", - Description = "© [Microsoft](http://www.bing.com/maps/)", - Mode = BingMapsTileLayer.MapMode.AerialWithLabels, - MapForeground = new SolidColorBrush(Colors.White), - MapBackground = new SolidColorBrush(Colors.Black) - } - }, - { - "OpenStreetMap WMS", - new WmsImageLayer - { - Description = "© [terrestris GmbH & Co. KG](http://ows.terrestris.de/)\nData © [OpenStreetMap contributors](http://www.openstreetmap.org/copyright)", - ServiceUri = new Uri("http://ows.terrestris.de/osm/service") + SourceName = "TopPlusOpen", + Description = "© [BKG](https://gdz.bkg.bund.de/index.php/default/webdienste/topplus-produkte/wmts-topplusopen-wmts-topplus-open.html)", + CapabilitiesUri = new Uri("https://sgx.geodatenzentrum.de/wmts_topplus_open/1.0.0/WMTSCapabilities.xml") } }, { @@ -108,12 +77,11 @@ namespace ViewModel } }, { - "TopPlusOpen WMTS", - new WmtsTileLayer + "OpenStreetMap WMS", + new WmsImageLayer { - Description = "© [BKG](https://gdz.bkg.bund.de/index.php/default/webdienste/topplus-produkte/wmts-topplusopen-wmts-topplus-open.html)", - CapabilitiesUri = new Uri("https://sgx.geodatenzentrum.de/wmts_topplus_open/1.0.0/WMTSCapabilities.xml"), - SourceName = "TopPlusOpen" + Description = "© [terrestris GmbH & Co. KG](http://ows.terrestris.de/)\nData © [OpenStreetMap contributors](http://www.openstreetmap.org/copyright)", + ServiceUri = new Uri("http://ows.terrestris.de/osm/service") } }, { @@ -121,13 +89,34 @@ namespace ViewModel new ChartServerLayer() }, { - "Seamarks", - new MapTileLayer + "Bing Maps Road", + new BingMapsTileLayer { - SourceName = "OpenSeaMap", - TileSource = new TileSource { UriFormat = "http://tiles.openseamap.org/seamark/{z}/{x}/{y}.png" }, - MinZoomLevel = 9, - MaxZoomLevel = 18 + Mode = BingMapsTileLayer.MapMode.Road, + SourceName = "Bing Maps Road", + Description = "© [Microsoft](http://www.bing.com/maps/)" + } + }, + { + "Bing Maps Aerial", + new BingMapsTileLayer + { + Mode = BingMapsTileLayer.MapMode.Aerial, + SourceName = "Bing Maps Aerial", + Description = "© [Microsoft](http://www.bing.com/maps/)", + MapForeground = new SolidColorBrush(Colors.White), + MapBackground = new SolidColorBrush(Colors.Black) + } + }, + { + "Bing Maps Aerial with Labels", + new BingMapsTileLayer + { + Mode = BingMapsTileLayer.MapMode.AerialWithLabels, + SourceName = "Bing Maps Hybrid", + Description = "© [Microsoft](http://www.bing.com/maps/)", + MapForeground = new SolidColorBrush(Colors.White), + MapBackground = new SolidColorBrush(Colors.Black) } }, }; @@ -159,11 +148,10 @@ namespace ViewModel { "OpenStreetMap", "OpenStreetMap German", - "Stamen Terrain", - "Stamen Toner Light", - "OpenStreetMap WMS", - "TopPlusOpen WMS", + "OpenTopoMap", "TopPlusOpen WMTS", + "TopPlusOpen WMS", + "OpenStreetMap WMS", "SevenCs ChartServer WMS", }; diff --git a/SampleApps/UniversalApp/MainPage.xaml.cs b/SampleApps/UniversalApp/MainPage.xaml.cs index 91fbbf81..62ea6081 100644 --- a/SampleApps/UniversalApp/MainPage.xaml.cs +++ b/SampleApps/UniversalApp/MainPage.xaml.cs @@ -1,5 +1,4 @@ using MapControl; -using System; using ViewModel; using Windows.UI.Xaml; using Windows.UI.Xaml.Controls; diff --git a/SampleApps/UniversalApp/Properties/AssemblyInfo.cs b/SampleApps/UniversalApp/Properties/AssemblyInfo.cs index db30e7d8..57cec7ee 100644 --- a/SampleApps/UniversalApp/Properties/AssemblyInfo.cs +++ b/SampleApps/UniversalApp/Properties/AssemblyInfo.cs @@ -8,7 +8,7 @@ using System.Runtime.InteropServices; [assembly: AssemblyCopyright("Copyright © 2020 Clemens Fischer")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] -[assembly: AssemblyVersion("5.3.1")] -[assembly: AssemblyFileVersion("5.3.1")] +[assembly: AssemblyVersion("5.4.0")] +[assembly: AssemblyFileVersion("5.4.0")] [assembly: AssemblyConfiguration("")] [assembly: ComVisible(false)] diff --git a/SampleApps/WpfApplication/WpfApplication.csproj b/SampleApps/WpfApplication/WpfApplication.csproj index 68ffe2f7..f3c4a5b1 100644 --- a/SampleApps/WpfApplication/WpfApplication.csproj +++ b/SampleApps/WpfApplication/WpfApplication.csproj @@ -6,7 +6,7 @@ true WpfApplication XAML Map Control - 5.3.1 + 5.4.0 XAML Map Control WPF Sample Application Clemens Fischer Copyright © 2020 Clemens Fischer