mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2026-04-05 14:37:01 +00:00
Renamed TileLayer.Name property to TileLayer.SourceName, removed TileLayerCollection.Name property.
This commit is contained in:
parent
e52698586b
commit
02b9cb4354
7 changed files with 25 additions and 31 deletions
|
|
@ -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")
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -8,12 +8,5 @@ namespace MapControl
|
|||
{
|
||||
public class TileLayerCollection : ObservableCollection<TileLayer>
|
||||
{
|
||||
private string name;
|
||||
|
||||
public string Name
|
||||
{
|
||||
get { return !string.IsNullOrEmpty(name) ? name : (Count > 0 ? this[0].Name : string.Empty); }
|
||||
set { name = value; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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}"))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue