diff --git a/MapControl/MapBase.cs b/MapControl/MapBase.cs index f6f95bad..f5cfb70a 100644 --- a/MapControl/MapBase.cs +++ b/MapControl/MapBase.cs @@ -119,7 +119,7 @@ namespace MapControl { BaseTileLayer = new TileLayer { - Name = "OpenStreetMap", + SourceName = "OpenStreetMap", Description = "© {y} OpenStreetMap Contributors, CC-BY-SA", TileSource = new TileSource("http://{c}.tile.openstreetmap.org/{z}/{x}/{y}.png") }; diff --git a/MapControl/TileContainer.cs b/MapControl/TileContainer.cs index 48eec5b3..8423dcc7 100644 --- a/MapControl/TileContainer.cs +++ b/MapControl/TileContainer.cs @@ -37,9 +37,9 @@ namespace MapControl foreach (TileLayer tileLayer in tileLayers) { - if (string.IsNullOrEmpty(tileLayer.Name)) + if (string.IsNullOrWhiteSpace(tileLayer.SourceName)) { - throw new ArgumentException("TileLayer.Name property must not be null or empty."); + throw new ArgumentException("TileLayer.SourceName property must not be null or empty or white-space only."); } Children.Insert(index++, tileLayer); diff --git a/MapControl/TileImageLoader.cs b/MapControl/TileImageLoader.cs index d1eb3e76..f0759e6d 100644 --- a/MapControl/TileImageLoader.cs +++ b/MapControl/TileImageLoader.cs @@ -91,7 +91,8 @@ namespace MapControl newTiles.ForEach(tile => { - tileLayer.Dispatcher.BeginInvoke(DispatcherPriority.Background, (Action)(() => tile.Image = imageTileSource.GetImage(tile.XIndex, tile.Y, tile.ZoomLevel))); + tileLayer.Dispatcher.BeginInvoke(DispatcherPriority.Background, + (Action)(() => tile.Image = imageTileSource.GetImage(tile.XIndex, tile.Y, tile.ZoomLevel))); }); } else @@ -138,7 +139,6 @@ namespace MapControl } } - private void DownloadTiles(object o) { Tile tile; @@ -158,7 +158,7 @@ namespace MapControl private string CacheKey(Tile tile) { - return string.Format("{0}/{1}/{2}/{3}", tileLayer.Name, tile.ZoomLevel, tile.XIndex, tile.Y); + return string.Format("{0}/{1}/{2}/{3}", tileLayer.SourceName, tile.ZoomLevel, tile.XIndex, tile.Y); } private bool CreateTileImage(Tile tile, byte[] buffer) diff --git a/MapControl/TileLayer.cs b/MapControl/TileLayer.cs index b2ebc1e4..33a437e9 100644 --- a/MapControl/TileLayer.cs +++ b/MapControl/TileLayer.cs @@ -32,7 +32,7 @@ namespace MapControl MaxParallelDownloads = 8; } - public string Name { get; set; } + public string SourceName { get; set; } public TileSource TileSource { get; set; } public int MinZoomLevel { get; set; } public int MaxZoomLevel { get; set; } @@ -118,7 +118,8 @@ namespace MapControl tiles.Sort((t1, t2) => t1.ZoomLevel - t2.ZoomLevel); - //System.Diagnostics.Trace.TraceInformation("{0} Tiles: {1}", tiles.Count, string.Join(", ", tiles.Select(t => t.ZoomLevel.ToString()))); + //System.Diagnostics.Trace.TraceInformation("{0} Tiles: {1}", tiles.Count, + // string.Join(", ", System.Linq.Enumerable.Select(tiles, t => t.ZoomLevel.ToString()))); } private void RenderTiles() diff --git a/MapControl/TileLayerCollection.cs b/MapControl/TileLayerCollection.cs index 7684e42a..dfcd00f1 100644 --- a/MapControl/TileLayerCollection.cs +++ b/MapControl/TileLayerCollection.cs @@ -8,12 +8,5 @@ namespace MapControl { public class TileLayerCollection : ObservableCollection { - private string name; - - public string Name - { - get { return !string.IsNullOrEmpty(name) ? name : (Count > 0 ? this[0].Name : string.Empty); } - set { name = value; } - } } } diff --git a/MapControl/TileSource.cs b/MapControl/TileSource.cs index 7da01562..59ebf953 100644 --- a/MapControl/TileSource.cs +++ b/MapControl/TileSource.cs @@ -38,7 +38,7 @@ namespace MapControl { if (string.IsNullOrWhiteSpace(value)) { - throw new ArgumentException("The value of the UriFormat proprty must not be null or empty or white-space only."); + throw new ArgumentException("The value of the UriFormat property must not be null or empty or white-space only."); } if (value.Contains("{x}") && value.Contains("{y}") && value.Contains("{z}")) diff --git a/SampleApps/SampleApplication/MainWindow.xaml b/SampleApps/SampleApplication/MainWindow.xaml index e03ce68b..ef42be6d 100644 --- a/SampleApps/SampleApplication/MainWindow.xaml +++ b/SampleApps/SampleApplication/MainWindow.xaml @@ -6,42 +6,42 @@ Title="MainWindow" Height="600" Width="800"> - - - - - - - + - @@ -168,7 +168,7 @@ -