mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2026-01-01 22:30:14 +01:00
Version 2.8.0: Improved MapImageLayer.
This commit is contained in:
parent
1f18c48285
commit
de5576447d
|
|
@ -1,5 +1,5 @@
|
|||
// XAML Map Control - http://xamlmapcontrol.codeplex.com/
|
||||
// © 2015 Clemens Fischer
|
||||
// © 2016 Clemens Fischer
|
||||
// Licensed under the Microsoft Public License (Ms-PL)
|
||||
|
||||
using System;
|
||||
|
|
|
|||
|
|
@ -5,10 +5,10 @@ using System.Runtime.InteropServices;
|
|||
[assembly: AssemblyDescription("ObjectCache implementation based on EzTools FileDb")]
|
||||
[assembly: AssemblyProduct("XAML Map Control")]
|
||||
[assembly: AssemblyCompany("Clemens Fischer")]
|
||||
[assembly: AssemblyCopyright("© 2015 Clemens Fischer")]
|
||||
[assembly: AssemblyCopyright("© 2016 Clemens Fischer")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyVersion("2.7.2")]
|
||||
[assembly: AssemblyFileVersion("2.7.2")]
|
||||
[assembly: AssemblyVersion("2.8.0")]
|
||||
[assembly: AssemblyFileVersion("2.8.0")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
[assembly: ComVisible(false)]
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// XAML Map Control - http://xamlmapcontrol.codeplex.com/
|
||||
// © 2015 Clemens Fischer
|
||||
// © 2016 Clemens Fischer
|
||||
// Licensed under the Microsoft Public License (Ms-PL)
|
||||
|
||||
using System;
|
||||
|
|
|
|||
|
|
@ -5,10 +5,10 @@ using System.Runtime.InteropServices;
|
|||
[assembly: AssemblyDescription("IImageCache implementation based on EzTools FileDb")]
|
||||
[assembly: AssemblyProduct("XAML Map Control")]
|
||||
[assembly: AssemblyCompany("Clemens Fischer")]
|
||||
[assembly: AssemblyCopyright("© 2015 Clemens Fischer")]
|
||||
[assembly: AssemblyCopyright("© 2016 Clemens Fischer")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyVersion("2.7.2")]
|
||||
[assembly: AssemblyFileVersion("2.7.2")]
|
||||
[assembly: AssemblyVersion("2.8.0")]
|
||||
[assembly: AssemblyFileVersion("2.8.0")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
[assembly: ComVisible(false)]
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// XAML Map Control - http://xamlmapcontrol.codeplex.com/
|
||||
// © 2015 Clemens Fischer
|
||||
// © 2016 Clemens Fischer
|
||||
// Licensed under the Microsoft Public License (Ms-PL)
|
||||
|
||||
using System;
|
||||
|
|
|
|||
|
|
@ -5,10 +5,10 @@ using System.Runtime.InteropServices;
|
|||
[assembly: AssemblyDescription("ObjectCache implementation based on local image files")]
|
||||
[assembly: AssemblyProduct("XAML Map Control")]
|
||||
[assembly: AssemblyCompany("Clemens Fischer")]
|
||||
[assembly: AssemblyCopyright("© 2015 Clemens Fischer")]
|
||||
[assembly: AssemblyCopyright("© 2016 Clemens Fischer")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyVersion("2.7.2")]
|
||||
[assembly: AssemblyFileVersion("2.7.2")]
|
||||
[assembly: AssemblyVersion("2.8.0")]
|
||||
[assembly: AssemblyFileVersion("2.8.0")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
[assembly: ComVisible(false)]
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// XAML Map Control - http://xamlmapcontrol.codeplex.com/
|
||||
// © 2015 Clemens Fischer
|
||||
// © 2016 Clemens Fischer
|
||||
// Licensed under the Microsoft Public License (Ms-PL)
|
||||
|
||||
using System;
|
||||
|
|
|
|||
|
|
@ -5,10 +5,10 @@ using System.Runtime.InteropServices;
|
|||
[assembly: AssemblyDescription("IImageCache implementation based on local image files")]
|
||||
[assembly: AssemblyProduct("XAML Map Control")]
|
||||
[assembly: AssemblyCompany("Clemens Fischer")]
|
||||
[assembly: AssemblyCopyright("© 2015 Clemens Fischer")]
|
||||
[assembly: AssemblyCopyright("© 2016 Clemens Fischer")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyVersion("2.7.2")]
|
||||
[assembly: AssemblyFileVersion("2.7.2")]
|
||||
[assembly: AssemblyVersion("2.8.0")]
|
||||
[assembly: AssemblyFileVersion("2.8.0")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
[assembly: ComVisible(false)]
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 14
|
||||
VisualStudioVersion = 14.0.23107.0
|
||||
VisualStudioVersion = 14.0.24720.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}"
|
||||
EndProject
|
||||
|
|
@ -17,8 +17,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MapControl.WinRT", "MapCont
|
|||
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}") = "PhoneApplication", "SampleApps\PhoneApplication\PhoneApplication.csproj", "{8D0A57DF-FABF-4AEE-8768-9C18B2B43CA9}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SilverlightApplication", "SampleApps\SilverlightApplication\SilverlightApplication.csproj", "{CBA8C535-CCA3-4F60-8D3E-0E25791CBD21}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SilverlightApplication.Web", "SampleApps\SilverlightApplication.Web\SilverlightApplication.Web.csproj", "{177C4EF8-0B0A-426E-BDCC-168DC10AC1C1}"
|
||||
|
|
@ -155,30 +153,6 @@ Global
|
|||
{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
|
||||
{8D0A57DF-FABF-4AEE-8768-9C18B2B43CA9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{8D0A57DF-FABF-4AEE-8768-9C18B2B43CA9}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{8D0A57DF-FABF-4AEE-8768-9C18B2B43CA9}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
|
||||
{8D0A57DF-FABF-4AEE-8768-9C18B2B43CA9}.Debug|ARM.ActiveCfg = Debug|Any CPU
|
||||
{8D0A57DF-FABF-4AEE-8768-9C18B2B43CA9}.Debug|ARM.Build.0 = Debug|Any CPU
|
||||
{8D0A57DF-FABF-4AEE-8768-9C18B2B43CA9}.Debug|ARM.Deploy.0 = Debug|Any CPU
|
||||
{8D0A57DF-FABF-4AEE-8768-9C18B2B43CA9}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{8D0A57DF-FABF-4AEE-8768-9C18B2B43CA9}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{8D0A57DF-FABF-4AEE-8768-9C18B2B43CA9}.Debug|x64.Deploy.0 = Debug|Any CPU
|
||||
{8D0A57DF-FABF-4AEE-8768-9C18B2B43CA9}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{8D0A57DF-FABF-4AEE-8768-9C18B2B43CA9}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{8D0A57DF-FABF-4AEE-8768-9C18B2B43CA9}.Debug|x86.Deploy.0 = Debug|Any CPU
|
||||
{8D0A57DF-FABF-4AEE-8768-9C18B2B43CA9}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{8D0A57DF-FABF-4AEE-8768-9C18B2B43CA9}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{8D0A57DF-FABF-4AEE-8768-9C18B2B43CA9}.Release|Any CPU.Deploy.0 = Release|Any CPU
|
||||
{8D0A57DF-FABF-4AEE-8768-9C18B2B43CA9}.Release|ARM.ActiveCfg = Release|Any CPU
|
||||
{8D0A57DF-FABF-4AEE-8768-9C18B2B43CA9}.Release|ARM.Build.0 = Release|Any CPU
|
||||
{8D0A57DF-FABF-4AEE-8768-9C18B2B43CA9}.Release|ARM.Deploy.0 = Release|Any CPU
|
||||
{8D0A57DF-FABF-4AEE-8768-9C18B2B43CA9}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{8D0A57DF-FABF-4AEE-8768-9C18B2B43CA9}.Release|x64.Build.0 = Release|Any CPU
|
||||
{8D0A57DF-FABF-4AEE-8768-9C18B2B43CA9}.Release|x64.Deploy.0 = Release|Any CPU
|
||||
{8D0A57DF-FABF-4AEE-8768-9C18B2B43CA9}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{8D0A57DF-FABF-4AEE-8768-9C18B2B43CA9}.Release|x86.Build.0 = Release|Any CPU
|
||||
{8D0A57DF-FABF-4AEE-8768-9C18B2B43CA9}.Release|x86.Deploy.0 = Release|Any CPU
|
||||
{CBA8C535-CCA3-4F60-8D3E-0E25791CBD21}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{CBA8C535-CCA3-4F60-8D3E-0E25791CBD21}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{CBA8C535-CCA3-4F60-8D3E-0E25791CBD21}.Debug|ARM.ActiveCfg = Debug|Any CPU
|
||||
|
|
@ -256,7 +230,6 @@ Global
|
|||
{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}
|
||||
{8D0A57DF-FABF-4AEE-8768-9C18B2B43CA9} = {100879CC-8910-459E-856E-253D629E45DE}
|
||||
{CBA8C535-CCA3-4F60-8D3E-0E25791CBD21} = {100879CC-8910-459E-856E-253D629E45DE}
|
||||
{177C4EF8-0B0A-426E-BDCC-168DC10AC1C1} = {100879CC-8910-459E-856E-253D629E45DE}
|
||||
{9949326E-9261-4F95-89B1-151F60498951} = {100879CC-8910-459E-856E-253D629E45DE}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// XAML Map Control - http://xamlmapcontrol.codeplex.com/
|
||||
// © 2015 Clemens Fischer
|
||||
// © 2016 Clemens Fischer
|
||||
// Licensed under the Microsoft Public License (Ms-PL)
|
||||
|
||||
using System;
|
||||
|
|
@ -56,7 +56,7 @@ namespace MapControl
|
|||
}
|
||||
|
||||
var uri = string.Format("http://dev.virtualearth.net/REST/V1/Imagery/Metadata/{0}?output=xml&key={1}", Mode, ApiKey);
|
||||
var request = HttpWebRequest.CreateHttp(uri);
|
||||
var request = WebRequest.CreateHttp(uri);
|
||||
|
||||
request.BeginGetResponse(HandleImageryMetadataResponse, request);
|
||||
}
|
||||
|
|
@ -122,7 +122,7 @@ namespace MapControl
|
|||
|
||||
if (!string.IsNullOrEmpty(imageUrl) && imageUrlSubdomains != null && imageUrlSubdomains.Length > 0)
|
||||
{
|
||||
Dispatcher.BeginInvoke(new Action(() =>
|
||||
var _ = Dispatcher.BeginInvoke(new Action(() =>
|
||||
{
|
||||
if (string.IsNullOrEmpty(Culture))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// XAML Map Control - http://xamlmapcontrol.codeplex.com/
|
||||
// © 2015 Clemens Fischer
|
||||
// © 2016 Clemens Fischer
|
||||
// Licensed under the Microsoft Public License (Ms-PL)
|
||||
|
||||
using System;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// XAML Map Control - http://xamlmapcontrol.codeplex.com/
|
||||
// © 2015 Clemens Fischer
|
||||
// © 2016 Clemens Fischer
|
||||
// Licensed under the Microsoft Public License (Ms-PL)
|
||||
|
||||
using System.Windows;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// XAML Map Control - http://xamlmapcontrol.codeplex.com/
|
||||
// © 2015 Clemens Fischer
|
||||
// © 2016 Clemens Fischer
|
||||
// Licensed under the Microsoft Public License (Ms-PL)
|
||||
|
||||
using System;
|
||||
|
|
@ -13,9 +13,9 @@ namespace MapControl
|
|||
{
|
||||
internal static class Extensions
|
||||
{
|
||||
public static void BeginInvoke(this CoreDispatcher dispatcher, Action action)
|
||||
public static IAsyncAction BeginInvoke(this CoreDispatcher dispatcher, Action action)
|
||||
{
|
||||
var asyncAction = dispatcher.RunAsync(CoreDispatcherPriority.Normal, new DispatchedHandler(action));
|
||||
return dispatcher.RunAsync(CoreDispatcherPriority.Normal, new DispatchedHandler(action));
|
||||
}
|
||||
|
||||
public static Point Transform(this GeneralTransform transform, Point point)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// XAML Map Control - http://xamlmapcontrol.codeplex.com/
|
||||
// © 2015 Clemens Fischer
|
||||
// © 2016 Clemens Fischer
|
||||
// Licensed under the Microsoft Public License (Ms-PL)
|
||||
|
||||
using System;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// XAML Map Control - http://xamlmapcontrol.codeplex.com/
|
||||
// © 2015 Clemens Fischer
|
||||
// © 2016 Clemens Fischer
|
||||
// Licensed under the Microsoft Public License (Ms-PL)
|
||||
|
||||
namespace MapControl
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// XAML Map Control - http://xamlmapcontrol.codeplex.com/
|
||||
// © 2015 Clemens Fischer
|
||||
// © 2016 Clemens Fischer
|
||||
// Licensed under the Microsoft Public License (Ms-PL)
|
||||
|
||||
using System.Collections.Generic;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// XAML Map Control - http://xamlmapcontrol.codeplex.com/
|
||||
// © 2015 Clemens Fischer
|
||||
// © 2016 Clemens Fischer
|
||||
// Licensed under the Microsoft Public License (Ms-PL)
|
||||
|
||||
using System;
|
||||
|
|
|
|||
53
MapControl/ImageLoader.cs
Normal file
53
MapControl/ImageLoader.cs
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
// XAML Map Control - http://xamlmapcontrol.codeplex.com/
|
||||
// © 2016 Clemens Fischer
|
||||
// Licensed under the Microsoft Public License (Ms-PL)
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Windows.Media.Imaging;
|
||||
|
||||
namespace MapControl
|
||||
{
|
||||
internal static class ImageLoader
|
||||
{
|
||||
public static BitmapSource FromStream(Stream stream)
|
||||
{
|
||||
var bitmap = new BitmapImage();
|
||||
|
||||
bitmap.BeginInit();
|
||||
bitmap.CacheOption = BitmapCacheOption.OnLoad;
|
||||
bitmap.StreamSource = stream;
|
||||
bitmap.EndInit();
|
||||
bitmap.Freeze();
|
||||
|
||||
return bitmap;
|
||||
}
|
||||
|
||||
public static BitmapSource FromUri(Uri uri)
|
||||
{
|
||||
BitmapSource bitmap = null;
|
||||
|
||||
try
|
||||
{
|
||||
var request = WebRequest.Create(uri);
|
||||
|
||||
using (var response = request.GetResponse())
|
||||
using (var responseStream = response.GetResponseStream())
|
||||
using (var memoryStream = new MemoryStream())
|
||||
{
|
||||
responseStream.CopyTo(memoryStream);
|
||||
memoryStream.Seek(0, SeekOrigin.Begin);
|
||||
bitmap = FromStream(memoryStream);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.WriteLine(ex.Message);
|
||||
}
|
||||
|
||||
return bitmap;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
// XAML Map Control - http://xamlmapcontrol.codeplex.com/
|
||||
// © 2015 Clemens Fischer
|
||||
// © 2016 Clemens Fischer
|
||||
// Licensed under the Microsoft Public License (Ms-PL)
|
||||
|
||||
#if NETFX_CORE
|
||||
|
|
|
|||
|
|
@ -1,9 +1,7 @@
|
|||
// XAML Map Control - http://xamlmapcontrol.codeplex.com/
|
||||
// © 2015 Clemens Fischer
|
||||
// © 2016 Clemens Fischer
|
||||
// Licensed under the Microsoft Public License (Ms-PL)
|
||||
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
|
||||
|
|
@ -30,20 +28,11 @@ namespace MapControl
|
|||
{
|
||||
if (IsAsync)
|
||||
{
|
||||
var request = HttpWebRequest.CreateHttp(uri);
|
||||
|
||||
using (var response = (HttpWebResponse)request.GetResponse())
|
||||
using (var responseStream = response.GetResponseStream())
|
||||
using (var memoryStream = new MemoryStream())
|
||||
{
|
||||
responseStream.CopyTo(memoryStream);
|
||||
memoryStream.Position = 0;
|
||||
image = BitmapFrame.Create(memoryStream, BitmapCreateOptions.None, BitmapCacheOption.OnLoad);
|
||||
}
|
||||
image = ImageLoader.FromUri(uri);
|
||||
}
|
||||
else
|
||||
{
|
||||
image = BitmapFrame.Create(uri);
|
||||
image = new BitmapImage(uri);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// XAML Map Control - http://xamlmapcontrol.codeplex.com/
|
||||
// © 2015 Clemens Fischer
|
||||
// © 2016 Clemens Fischer
|
||||
// Licensed under the Microsoft Public License (Ms-PL)
|
||||
|
||||
using System;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// XAML Map Control - http://xamlmapcontrol.codeplex.com/
|
||||
// © 2015 Clemens Fischer
|
||||
// © 2016 Clemens Fischer
|
||||
// Licensed under the Microsoft Public License (Ms-PL)
|
||||
|
||||
using System;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// XAML Map Control - http://xamlmapcontrol.codeplex.com/
|
||||
// © 2015 Clemens Fischer
|
||||
// © 2016 Clemens Fischer
|
||||
// Licensed under the Microsoft Public License (Ms-PL)
|
||||
|
||||
using System;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// XAML Map Control - http://xamlmapcontrol.codeplex.com/
|
||||
// © 2015 Clemens Fischer
|
||||
// © 2016 Clemens Fischer
|
||||
// Licensed under the Microsoft Public License (Ms-PL)
|
||||
|
||||
using System;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// XAML Map Control - http://xamlmapcontrol.codeplex.com/
|
||||
// © 2015 Clemens Fischer
|
||||
// © 2016 Clemens Fischer
|
||||
// Licensed under the Microsoft Public License (Ms-PL)
|
||||
|
||||
using System.Windows;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// XAML Map Control - http://xamlmapcontrol.codeplex.com/
|
||||
// © 2015 Clemens Fischer
|
||||
// © 2016 Clemens Fischer
|
||||
// Licensed under the Microsoft Public License (Ms-PL)
|
||||
|
||||
using System.Windows;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// XAML Map Control - http://xamlmapcontrol.codeplex.com/
|
||||
// © 2015 Clemens Fischer
|
||||
// © 2016 Clemens Fischer
|
||||
// Licensed under the Microsoft Public License (Ms-PL)
|
||||
|
||||
using Windows.UI.Xaml;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// XAML Map Control - http://xamlmapcontrol.codeplex.com/
|
||||
// © 2015 Clemens Fischer
|
||||
// © 2016 Clemens Fischer
|
||||
// Licensed under the Microsoft Public License (Ms-PL)
|
||||
|
||||
using System;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// XAML Map Control - http://xamlmapcontrol.codeplex.com/
|
||||
// © 2015 Clemens Fischer
|
||||
// © 2016 Clemens Fischer
|
||||
// Licensed under the Microsoft Public License (Ms-PL)
|
||||
|
||||
using System;
|
||||
|
|
@ -53,6 +53,11 @@ namespace MapControl
|
|||
typeof(MapBase), new FrameworkPropertyMetadata(Brushes.Transparent));
|
||||
}
|
||||
|
||||
partial void RemoveAnimation(DependencyProperty property)
|
||||
{
|
||||
BeginAnimation(property, null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Changes the Center property according to the specified translation in viewport coordinates.
|
||||
/// </summary>
|
||||
|
|
@ -71,11 +76,6 @@ namespace MapControl
|
|||
TransformMap(origin, (Point)translation, rotation, scale);
|
||||
}
|
||||
|
||||
partial void RemoveAnimation(DependencyProperty property)
|
||||
{
|
||||
BeginAnimation(property, null);
|
||||
}
|
||||
|
||||
protected override void OnRenderSizeChanged(SizeChangedInfo sizeInfo)
|
||||
{
|
||||
base.OnRenderSizeChanged(sizeInfo);
|
||||
|
|
|
|||
|
|
@ -54,6 +54,7 @@
|
|||
<ItemGroup>
|
||||
<Compile Include="BingMapsTileLayer.cs" />
|
||||
<Compile Include="BingMapsTileSource.cs" />
|
||||
<Compile Include="ImageLoader.cs" />
|
||||
<Compile Include="HyperlinkText.cs" />
|
||||
<Compile Include="ImageTileSource.WPF.cs" />
|
||||
<Compile Include="IMapElement.cs" />
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// XAML Map Control - http://xamlmapcontrol.codeplex.com/
|
||||
// © 2015 Clemens Fischer
|
||||
// © 2016 Clemens Fischer
|
||||
// Licensed under the Microsoft Public License (Ms-PL)
|
||||
|
||||
using System;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// XAML Map Control - http://xamlmapcontrol.codeplex.com/
|
||||
// © 2015 Clemens Fischer
|
||||
// © 2016 Clemens Fischer
|
||||
// Licensed under the Microsoft Public License (Ms-PL)
|
||||
|
||||
using System;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// XAML Map Control - http://xamlmapcontrol.codeplex.com/
|
||||
// © 2015 Clemens Fischer
|
||||
// © 2016 Clemens Fischer
|
||||
// Licensed under the Microsoft Public License (Ms-PL)
|
||||
|
||||
using System;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// XAML Map Control - http://xamlmapcontrol.codeplex.com/
|
||||
// © 2015 Clemens Fischer
|
||||
// © 2016 Clemens Fischer
|
||||
// Licensed under the Microsoft Public License (Ms-PL)
|
||||
|
||||
#if NETFX_CORE
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
// XAML Map Control - http://xamlmapcontrol.codeplex.com/
|
||||
// © 2015 Clemens Fischer
|
||||
// © 2016 Clemens Fischer
|
||||
// Licensed under the Microsoft Public License (Ms-PL)
|
||||
|
||||
using System;
|
||||
#if NETFX_CORE
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Media.Imaging;
|
||||
|
|
@ -14,8 +15,15 @@ namespace MapControl
|
|||
{
|
||||
public partial class MapImageLayer
|
||||
{
|
||||
private void ImageUpdated(BitmapSource bitmap)
|
||||
protected virtual void UpdateImage(BoundingBox boundingBox, Uri uri)
|
||||
{
|
||||
UpdateImage(boundingBox, new BitmapImage(uri));
|
||||
}
|
||||
|
||||
protected void UpdateImage(BoundingBox boundingBox, BitmapSource bitmap)
|
||||
{
|
||||
SetTopImage(boundingBox, bitmap);
|
||||
|
||||
var bitmapImage = bitmap as BitmapImage;
|
||||
|
||||
if (bitmapImage != null)
|
||||
|
|
|
|||
|
|
@ -1,8 +1,9 @@
|
|||
// XAML Map Control - http://xamlmapcontrol.codeplex.com/
|
||||
// © 2015 Clemens Fischer
|
||||
// © 2016 Clemens Fischer
|
||||
// Licensed under the Microsoft Public License (Ms-PL)
|
||||
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
|
||||
|
|
@ -10,8 +11,19 @@ namespace MapControl
|
|||
{
|
||||
public partial class MapImageLayer
|
||||
{
|
||||
private void ImageUpdated(BitmapSource bitmap)
|
||||
protected virtual void UpdateImage(BoundingBox boundingBox, Uri uri)
|
||||
{
|
||||
Task.Run(() =>
|
||||
{
|
||||
var image = ImageLoader.FromUri(uri);
|
||||
Dispatcher.BeginInvoke(new Action(() => UpdateImage(boundingBox, image)));
|
||||
});
|
||||
}
|
||||
|
||||
protected void UpdateImage(BoundingBox boundingBox, BitmapSource bitmap)
|
||||
{
|
||||
SetTopImage(boundingBox, bitmap);
|
||||
|
||||
if (bitmap != null && !bitmap.IsFrozen && bitmap.IsDownloading)
|
||||
{
|
||||
bitmap.DownloadCompleted += BitmapDownloadCompleted;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// XAML Map Control - http://xamlmapcontrol.codeplex.com/
|
||||
// © 2015 Clemens Fischer
|
||||
// © 2016 Clemens Fischer
|
||||
// Licensed under the Microsoft Public License (Ms-PL)
|
||||
|
||||
using System;
|
||||
|
|
@ -26,10 +26,38 @@ namespace MapControl
|
|||
/// </summary>
|
||||
public partial class MapImageLayer : MapPanel
|
||||
{
|
||||
public struct BoundingBox
|
||||
{
|
||||
public readonly double West;
|
||||
public readonly double East;
|
||||
public readonly double South;
|
||||
public readonly double North;
|
||||
|
||||
public BoundingBox(double west, double east, double south, double north)
|
||||
{
|
||||
West = west;
|
||||
East = east;
|
||||
South = south;
|
||||
North = north;
|
||||
}
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty UriFormatProperty = DependencyProperty.Register(
|
||||
"UriFormat", typeof(string), typeof(MapImageLayer),
|
||||
new PropertyMetadata(null, (o, e) => ((MapImageLayer)o).UpdateImage()));
|
||||
|
||||
public static readonly DependencyProperty MinLongitudeProperty = DependencyProperty.Register(
|
||||
"MinLongitude", typeof(double), typeof(MapImageLayer), new PropertyMetadata(double.NaN));
|
||||
|
||||
public static readonly DependencyProperty MaxLongitudeProperty = DependencyProperty.Register(
|
||||
"MaxLongitude", typeof(double), typeof(MapImageLayer), new PropertyMetadata(double.NaN));
|
||||
|
||||
public static readonly DependencyProperty MinLatitudeProperty = DependencyProperty.Register(
|
||||
"MinLatitude", typeof(double), typeof(MapImageLayer), new PropertyMetadata(double.NaN));
|
||||
|
||||
public static readonly DependencyProperty MaxLatitudeProperty = DependencyProperty.Register(
|
||||
"MaxLatitude", typeof(double), typeof(MapImageLayer), new PropertyMetadata(double.NaN));
|
||||
|
||||
public static readonly DependencyProperty RelativeImageSizeProperty = DependencyProperty.Register(
|
||||
"RelativeImageSize", typeof(double), typeof(MapImageLayer), new PropertyMetadata(1d));
|
||||
|
||||
|
|
@ -53,8 +81,8 @@ namespace MapControl
|
|||
/// <summary>
|
||||
/// The format string of the image request Uri. The format must contain
|
||||
/// {X} and {Y} format specifiers for the map width and height in pixels and either
|
||||
/// {w},{s},{e},{n} for the bounding box in lat/lon (like EPSG:4326) or
|
||||
/// {W},{S},{E},{N} for the bounding box in meters (like EPSG:3857).
|
||||
/// {w},{s},{e},{n} for a latitude/longitude bounding box (like EPSG:4326) or
|
||||
/// {W},{S},{E},{N} for a projected bounding box (e.g. in meters like EPSG:3857).
|
||||
/// </summary>
|
||||
public string UriFormat
|
||||
{
|
||||
|
|
@ -62,6 +90,42 @@ namespace MapControl
|
|||
set { SetValue(UriFormatProperty, value); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Optional minimum longitude value. Default is NaN.
|
||||
/// </summary>
|
||||
public double MinLongitude
|
||||
{
|
||||
get { return (double)GetValue(MinLongitudeProperty); }
|
||||
set { SetValue(MinLongitudeProperty, value); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Optional maximum longitude value. Default is NaN.
|
||||
/// </summary>
|
||||
public double MaxLongitude
|
||||
{
|
||||
get { return (double)GetValue(MaxLongitudeProperty); }
|
||||
set { SetValue(MaxLongitudeProperty, value); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Optional minimum latitude value. Default is NaN.
|
||||
/// </summary>
|
||||
public double MinLatitude
|
||||
{
|
||||
get { return (double)GetValue(MinLatitudeProperty); }
|
||||
set { SetValue(MinLatitudeProperty, value); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Optional maximum latitude value. Default is NaN.
|
||||
/// </summary>
|
||||
public double MaxLatitude
|
||||
{
|
||||
get { return (double)GetValue(MaxLatitudeProperty); }
|
||||
set { SetValue(MaxLatitudeProperty, value); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Relative size of the map images in relation to the current viewport size.
|
||||
/// Setting a value greater than one will let MapImageLayer request images that
|
||||
|
|
@ -82,6 +146,16 @@ namespace MapControl
|
|||
set { SetValue(UpdateIntervalProperty, value); }
|
||||
}
|
||||
|
||||
protected virtual BoundingBox ProjectBoundingBox(BoundingBox boundingBox)
|
||||
{
|
||||
var p1 = ParentMap.MapTransform.Transform(new Location(boundingBox.South, boundingBox.West));
|
||||
var p2 = ParentMap.MapTransform.Transform(new Location(boundingBox.North, boundingBox.East));
|
||||
|
||||
return new BoundingBox(
|
||||
TileSource.MetersPerDegree * p1.X, TileSource.MetersPerDegree * p2.X,
|
||||
TileSource.MetersPerDegree * p1.Y, TileSource.MetersPerDegree * p2.Y);
|
||||
}
|
||||
|
||||
protected override void OnViewportChanged()
|
||||
{
|
||||
base.OnViewportChanged();
|
||||
|
|
@ -98,15 +172,15 @@ namespace MapControl
|
|||
{
|
||||
updateTimer.Start(); // update image on next timer tick
|
||||
}
|
||||
else if (ParentMap != null && RenderSize.Width > 0 && RenderSize.Height > 0)
|
||||
else if (ParentMap != null && ParentMap.RenderSize.Width > 0 && ParentMap.RenderSize.Height > 0)
|
||||
{
|
||||
updateInProgress = true;
|
||||
|
||||
var relativeSize = Math.Max(RelativeImageSize, 1d);
|
||||
var width = RenderSize.Width * relativeSize;
|
||||
var height = RenderSize.Height * relativeSize;
|
||||
var dx = (RenderSize.Width - width) / 2d;
|
||||
var dy = (RenderSize.Height - height) / 2d;
|
||||
var width = ParentMap.RenderSize.Width * relativeSize;
|
||||
var height = ParentMap.RenderSize.Height * relativeSize;
|
||||
var dx = (ParentMap.RenderSize.Width - width) / 2d;
|
||||
var dy = (ParentMap.RenderSize.Height - height) / 2d;
|
||||
|
||||
var loc1 = ParentMap.ViewportPointToLocation(new Point(dx, dy));
|
||||
var loc2 = ParentMap.ViewportPointToLocation(new Point(dx + width, dy));
|
||||
|
|
@ -118,17 +192,36 @@ namespace MapControl
|
|||
var south = Math.Min(loc1.Latitude, Math.Min(loc2.Latitude, Math.Min(loc3.Latitude, loc4.Latitude)));
|
||||
var north = Math.Max(loc1.Latitude, Math.Max(loc2.Latitude, Math.Max(loc3.Latitude, loc4.Latitude)));
|
||||
|
||||
if (!double.IsNaN(MinLongitude) && west < MinLongitude)
|
||||
{
|
||||
west = MinLongitude;
|
||||
}
|
||||
|
||||
if (!double.IsNaN(MaxLongitude) && east > MaxLongitude)
|
||||
{
|
||||
east = MaxLongitude;
|
||||
}
|
||||
|
||||
if (!double.IsNaN(MinLatitude) && south < MinLatitude)
|
||||
{
|
||||
south = MinLatitude;
|
||||
}
|
||||
|
||||
if (!double.IsNaN(MaxLatitude) && north > MaxLatitude)
|
||||
{
|
||||
north = MaxLatitude;
|
||||
}
|
||||
|
||||
var p1 = ParentMap.MapTransform.Transform(new Location(south, west));
|
||||
var p2 = ParentMap.MapTransform.Transform(new Location(north, east));
|
||||
|
||||
width = Math.Round((p2.X - p1.X) * ParentMap.ViewportScale);
|
||||
height = Math.Round((p2.Y - p1.Y) * ParentMap.ViewportScale);
|
||||
|
||||
UpdateImage(west, east, south, north, (int)width, (int)height);
|
||||
UpdateImage(new BoundingBox(west, east, south, north),
|
||||
(int)Math.Round((p2.X - p1.X) * ParentMap.ViewportScale),
|
||||
(int)Math.Round((p2.Y - p1.Y) * ParentMap.ViewportScale));
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void UpdateImage(double west, double east, double south, double north, int width, int height)
|
||||
protected virtual void UpdateImage(BoundingBox boundingBox, int width, int height)
|
||||
{
|
||||
if (UriFormat != null && width > 0 && height > 0)
|
||||
{
|
||||
|
|
@ -136,48 +229,40 @@ namespace MapControl
|
|||
.Replace("{X}", width.ToString())
|
||||
.Replace("{Y}", height.ToString());
|
||||
|
||||
if (uri.Contains("{W}") && uri.Contains("{S}") && uri.Contains("{E}") && uri.Contains("{N}"))
|
||||
if (uri.Contains("{W}") && uri.Contains("{E}") && uri.Contains("{S}") && uri.Contains("{N}"))
|
||||
{
|
||||
var p1 = ParentMap.MapTransform.Transform(new Location(south, west));
|
||||
var p2 = ParentMap.MapTransform.Transform(new Location(north, east));
|
||||
var projectedBoundingBox = ProjectBoundingBox(boundingBox);
|
||||
|
||||
uri = uri
|
||||
.Replace("{W}", (TileSource.MetersPerDegree * p1.X).ToString(CultureInfo.InvariantCulture))
|
||||
.Replace("{S}", (TileSource.MetersPerDegree * p1.Y).ToString(CultureInfo.InvariantCulture))
|
||||
.Replace("{E}", (TileSource.MetersPerDegree * p2.X).ToString(CultureInfo.InvariantCulture))
|
||||
.Replace("{N}", (TileSource.MetersPerDegree * p2.Y).ToString(CultureInfo.InvariantCulture));
|
||||
.Replace("{W}", projectedBoundingBox.West.ToString(CultureInfo.InvariantCulture))
|
||||
.Replace("{S}", projectedBoundingBox.South.ToString(CultureInfo.InvariantCulture))
|
||||
.Replace("{E}", projectedBoundingBox.East.ToString(CultureInfo.InvariantCulture))
|
||||
.Replace("{N}", projectedBoundingBox.North.ToString(CultureInfo.InvariantCulture));
|
||||
}
|
||||
else
|
||||
{
|
||||
uri = uri
|
||||
.Replace("{w}", west.ToString(CultureInfo.InvariantCulture))
|
||||
.Replace("{s}", south.ToString(CultureInfo.InvariantCulture))
|
||||
.Replace("{e}", east.ToString(CultureInfo.InvariantCulture))
|
||||
.Replace("{n}", north.ToString(CultureInfo.InvariantCulture));
|
||||
.Replace("{w}", boundingBox.West.ToString(CultureInfo.InvariantCulture))
|
||||
.Replace("{s}", boundingBox.South.ToString(CultureInfo.InvariantCulture))
|
||||
.Replace("{e}", boundingBox.East.ToString(CultureInfo.InvariantCulture))
|
||||
.Replace("{n}", boundingBox.North.ToString(CultureInfo.InvariantCulture));
|
||||
}
|
||||
|
||||
UpdateImage(west, east, south, north, new Uri(uri));
|
||||
UpdateImage(boundingBox, new Uri(uri));
|
||||
}
|
||||
else
|
||||
{
|
||||
UpdateImage(west, east, south, north, (BitmapSource)null);
|
||||
UpdateImage(boundingBox, (BitmapSource)null);
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void UpdateImage(double west, double east, double south, double north, Uri uri)
|
||||
{
|
||||
UpdateImage(west, east, south, north, new BitmapImage(uri));
|
||||
}
|
||||
|
||||
protected void UpdateImage(double west, double east, double south, double north, BitmapSource bitmap)
|
||||
private void SetTopImage(BoundingBox boundingBox, BitmapSource bitmap)
|
||||
{
|
||||
currentImageIndex = (currentImageIndex + 1) % 2;
|
||||
var mapImage = (MapImage)Children[currentImageIndex];
|
||||
var topImage = (MapImage)Children[currentImageIndex];
|
||||
|
||||
mapImage.SetBoundingBox(west, east, south, north);
|
||||
mapImage.Source = bitmap;
|
||||
|
||||
ImageUpdated(bitmap);
|
||||
topImage.SetBoundingBox(boundingBox.West, boundingBox.East, boundingBox.South, boundingBox.North);
|
||||
topImage.Source = bitmap;
|
||||
}
|
||||
|
||||
private void SwapImages()
|
||||
|
|
@ -198,7 +283,11 @@ namespace MapControl
|
|||
FillBehavior = FillBehavior.Stop
|
||||
};
|
||||
|
||||
fadeAnimation.Completed += (s, e) => bottomImage.Opacity = 0d;
|
||||
fadeAnimation.Completed += (s, e) =>
|
||||
{
|
||||
bottomImage.Opacity = 0d;
|
||||
bottomImage.Source = null;
|
||||
};
|
||||
|
||||
topImage.BeginAnimation(UIElement.OpacityProperty, fadeAnimation);
|
||||
topImage.Opacity = 1d;
|
||||
|
|
@ -207,6 +296,7 @@ namespace MapControl
|
|||
{
|
||||
topImage.Opacity = 0d;
|
||||
bottomImage.Opacity = 0d;
|
||||
bottomImage.Source = null;
|
||||
}
|
||||
|
||||
updateInProgress = false;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// XAML Map Control - http://xamlmapcontrol.codeplex.com/
|
||||
// © 2015 Clemens Fischer
|
||||
// © 2016 Clemens Fischer
|
||||
// Licensed under the Microsoft Public License (Ms-PL)
|
||||
|
||||
#if NETFX_CORE
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// XAML Map Control - http://xamlmapcontrol.codeplex.com/
|
||||
// © 2015 Clemens Fischer
|
||||
// © 2016 Clemens Fischer
|
||||
// Licensed under the Microsoft Public License (Ms-PL)
|
||||
|
||||
using System.Windows;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// XAML Map Control - http://xamlmapcontrol.codeplex.com/
|
||||
// © 2015 Clemens Fischer
|
||||
// © 2016 Clemens Fischer
|
||||
// Licensed under the Microsoft Public License (Ms-PL)
|
||||
|
||||
#if NETFX_CORE
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// XAML Map Control - http://xamlmapcontrol.codeplex.com/
|
||||
// © 2015 Clemens Fischer
|
||||
// © 2016 Clemens Fischer
|
||||
// Licensed under the Microsoft Public License (Ms-PL)
|
||||
|
||||
using System.Windows;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// XAML Map Control - http://xamlmapcontrol.codeplex.com/
|
||||
// © 2015 Clemens Fischer
|
||||
// © 2016 Clemens Fischer
|
||||
// Licensed under the Microsoft Public License (Ms-PL)
|
||||
|
||||
#if !NETFX_CORE
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// XAML Map Control - http://xamlmapcontrol.codeplex.com/
|
||||
// © 2015 Clemens Fischer
|
||||
// © 2016 Clemens Fischer
|
||||
// Licensed under the Microsoft Public License (Ms-PL)
|
||||
|
||||
using System.Windows;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// XAML Map Control - http://xamlmapcontrol.codeplex.com/
|
||||
// © 2015 Clemens Fischer
|
||||
// © 2016 Clemens Fischer
|
||||
// Licensed under the Microsoft Public License (Ms-PL)
|
||||
|
||||
#if NETFX_CORE
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// XAML Map Control - http://xamlmapcontrol.codeplex.com/
|
||||
// © 2015 Clemens Fischer
|
||||
// © 2016 Clemens Fischer
|
||||
// Licensed under the Microsoft Public License (Ms-PL)
|
||||
|
||||
#if NETFX_CORE
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// XAML Map Control - http://xamlmapcontrol.codeplex.com/
|
||||
// © 2015 Clemens Fischer
|
||||
// © 2016 Clemens Fischer
|
||||
// Licensed under the Microsoft Public License (Ms-PL)
|
||||
|
||||
using System.Windows;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// XAML Map Control - http://xamlmapcontrol.codeplex.com/
|
||||
// © 2015 Clemens Fischer
|
||||
// © 2016 Clemens Fischer
|
||||
// Licensed under the Microsoft Public License (Ms-PL)
|
||||
|
||||
using System;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// XAML Map Control - http://xamlmapcontrol.codeplex.com/
|
||||
// © 2015 Clemens Fischer
|
||||
// © 2016 Clemens Fischer
|
||||
// Licensed under the Microsoft Public License (Ms-PL)
|
||||
|
||||
#if NETFX_CORE
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// XAML Map Control - http://xamlmapcontrol.codeplex.com/
|
||||
// © 2015 Clemens Fischer
|
||||
// © 2016 Clemens Fischer
|
||||
// Licensed under the Microsoft Public License (Ms-PL)
|
||||
|
||||
using System.Windows;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// XAML Map Control - http://xamlmapcontrol.codeplex.com/
|
||||
// © 2015 Clemens Fischer
|
||||
// © 2016 Clemens Fischer
|
||||
// Licensed under the Microsoft Public License (Ms-PL)
|
||||
|
||||
#if NETFX_CORE
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// XAML Map Control - http://xamlmapcontrol.codeplex.com/
|
||||
// © 2015 Clemens Fischer
|
||||
// © 2016 Clemens Fischer
|
||||
// Licensed under the Microsoft Public License (Ms-PL)
|
||||
|
||||
using System.Linq;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// XAML Map Control - http://xamlmapcontrol.codeplex.com/
|
||||
// © 2015 Clemens Fischer
|
||||
// © 2016 Clemens Fischer
|
||||
// Licensed under the Microsoft Public License (Ms-PL)
|
||||
|
||||
using System.Linq;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// XAML Map Control - http://xamlmapcontrol.codeplex.com/
|
||||
// © 2015 Clemens Fischer
|
||||
// © 2016 Clemens Fischer
|
||||
// Licensed under the Microsoft Public License (Ms-PL)
|
||||
|
||||
using System.Collections.Generic;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// XAML Map Control - http://xamlmapcontrol.codeplex.com/
|
||||
// © 2015 Clemens Fischer
|
||||
// © 2016 Clemens Fischer
|
||||
// Licensed under the Microsoft Public License (Ms-PL)
|
||||
|
||||
using System.Windows;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// XAML Map Control - http://xamlmapcontrol.codeplex.com/
|
||||
// © 2015 Clemens Fischer
|
||||
// © 2016 Clemens Fischer
|
||||
// Licensed under the Microsoft Public License (Ms-PL)
|
||||
|
||||
#if NETFX_CORE
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// XAML Map Control - http://xamlmapcontrol.codeplex.com/
|
||||
// © 2015 Clemens Fischer
|
||||
// © 2016 Clemens Fischer
|
||||
// Licensed under the Microsoft Public License (Ms-PL)
|
||||
|
||||
using System;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// XAML Map Control - http://xamlmapcontrol.codeplex.com/
|
||||
// © 2015 Clemens Fischer
|
||||
// © 2016 Clemens Fischer
|
||||
// Licensed under the Microsoft Public License (Ms-PL)
|
||||
|
||||
#if NETFX_CORE
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// XAML Map Control - http://xamlmapcontrol.codeplex.com/
|
||||
// © 2015 Clemens Fischer
|
||||
// © 2016 Clemens Fischer
|
||||
// Licensed under the Microsoft Public License (Ms-PL)
|
||||
|
||||
using System;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// XAML Map Control - http://xamlmapcontrol.codeplex.com/
|
||||
// © 2015 Clemens Fischer
|
||||
// © 2016 Clemens Fischer
|
||||
// Licensed under the Microsoft Public License (Ms-PL)
|
||||
|
||||
using System;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// XAML Map Control - http://xamlmapcontrol.codeplex.com/
|
||||
// © 2015 Clemens Fischer
|
||||
// © 2016 Clemens Fischer
|
||||
// Licensed under the Microsoft Public License (Ms-PL)
|
||||
|
||||
#if NETFX_CORE
|
||||
|
|
|
|||
|
|
@ -12,10 +12,10 @@ using System.Windows;
|
|||
#endif
|
||||
[assembly: AssemblyProduct("XAML Map Control")]
|
||||
[assembly: AssemblyCompany("Clemens Fischer")]
|
||||
[assembly: AssemblyCopyright("© 2015 Clemens Fischer")]
|
||||
[assembly: AssemblyCopyright("© 2016 Clemens Fischer")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyVersion("2.7.2")]
|
||||
[assembly: AssemblyFileVersion("2.7.2")]
|
||||
[assembly: AssemblyVersion("2.8.0")]
|
||||
[assembly: AssemblyFileVersion("2.8.0")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
[assembly: ComVisible(false)]
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// XAML Map Control - http://xamlmapcontrol.codeplex.com/
|
||||
// © 2015 Clemens Fischer
|
||||
// © 2016 Clemens Fischer
|
||||
// Licensed under the Microsoft Public License (Ms-PL)
|
||||
|
||||
#if NETFX_CORE
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// XAML Map Control - http://xamlmapcontrol.codeplex.com/
|
||||
// © 2015 Clemens Fischer
|
||||
// © 2016 Clemens Fischer
|
||||
// Licensed under the Microsoft Public License (Ms-PL)
|
||||
|
||||
using System.Windows;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// XAML Map Control - http://xamlmapcontrol.codeplex.com/
|
||||
// © 2015 Clemens Fischer
|
||||
// © 2016 Clemens Fischer
|
||||
// Licensed under the Microsoft Public License (Ms-PL)
|
||||
|
||||
using System;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// XAML Map Control - http://xamlmapcontrol.codeplex.com/
|
||||
// © 2015 Clemens Fischer
|
||||
// © 2016 Clemens Fischer
|
||||
// Licensed under the Microsoft Public License (Ms-PL)
|
||||
|
||||
using System;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// XAML Map Control - http://xamlmapcontrol.codeplex.com/
|
||||
// © 2015 Clemens Fischer
|
||||
// © 2016 Clemens Fischer
|
||||
// Licensed under the Microsoft Public License (Ms-PL)
|
||||
|
||||
using System;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// XAML Map Control - http://xamlmapcontrol.codeplex.com/
|
||||
// © 2015 Clemens Fischer
|
||||
// © 2016 Clemens Fischer
|
||||
// Licensed under the Microsoft Public License (Ms-PL)
|
||||
|
||||
using System;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// XAML Map Control - http://xamlmapcontrol.codeplex.com/
|
||||
// © 2015 Clemens Fischer
|
||||
// © 2016 Clemens Fischer
|
||||
// Licensed under the Microsoft Public License (Ms-PL)
|
||||
|
||||
using System;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// XAML Map Control - http://xamlmapcontrol.codeplex.com/
|
||||
// © 2015 Clemens Fischer
|
||||
// © 2016 Clemens Fischer
|
||||
// Licensed under the Microsoft Public License (Ms-PL)
|
||||
|
||||
using System;
|
||||
|
|
@ -14,7 +14,6 @@ using System.Text;
|
|||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Threading;
|
||||
|
||||
namespace MapControl
|
||||
|
|
@ -122,7 +121,7 @@ namespace MapControl
|
|||
|
||||
foreach (var tile in tiles)
|
||||
{
|
||||
BitmapSource cachedImage = null;
|
||||
ImageSource cachedImage = null;
|
||||
|
||||
if (useCache && GetCachedImage(CacheKey(sourceName, tile), out cachedImage))
|
||||
{
|
||||
|
|
@ -219,7 +218,7 @@ namespace MapControl
|
|||
{
|
||||
using (var fileStream = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read))
|
||||
{
|
||||
image = BitmapFrame.Create(fileStream, BitmapCreateOptions.None, BitmapCacheOption.OnLoad);
|
||||
image = ImageLoader.FromStream(fileStream);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
|
@ -233,11 +232,11 @@ namespace MapControl
|
|||
|
||||
private static ImageSource DownloadImage(Uri uri, string cacheKey)
|
||||
{
|
||||
BitmapSource image = null;
|
||||
ImageSource image = null;
|
||||
|
||||
try
|
||||
{
|
||||
var request = HttpWebRequest.CreateHttp(uri);
|
||||
var request = WebRequest.CreateHttp(uri);
|
||||
|
||||
if (HttpUserAgent != null)
|
||||
{
|
||||
|
|
@ -251,8 +250,7 @@ namespace MapControl
|
|||
{
|
||||
responseStream.CopyTo(memoryStream);
|
||||
memoryStream.Seek(0, SeekOrigin.Begin);
|
||||
|
||||
image = BitmapFrame.Create(memoryStream, BitmapCreateOptions.None, BitmapCacheOption.OnLoad);
|
||||
image = ImageLoader.FromStream(memoryStream);
|
||||
|
||||
if (cacheKey != null)
|
||||
{
|
||||
|
|
@ -283,7 +281,7 @@ namespace MapControl
|
|||
return string.IsNullOrEmpty(sourceName) ? null : string.Format("{0}/{1}/{2}/{3}", sourceName, tile.ZoomLevel, tile.XIndex, tile.Y);
|
||||
}
|
||||
|
||||
private static bool GetCachedImage(string cacheKey, out BitmapSource image)
|
||||
private static bool GetCachedImage(string cacheKey, out ImageSource image)
|
||||
{
|
||||
image = null;
|
||||
|
||||
|
|
@ -295,7 +293,7 @@ namespace MapControl
|
|||
{
|
||||
using (var memoryStream = new MemoryStream(buffer))
|
||||
{
|
||||
image = BitmapFrame.Create(memoryStream, BitmapCreateOptions.None, BitmapCacheOption.OnLoad);
|
||||
image = ImageLoader.FromStream(memoryStream);
|
||||
}
|
||||
|
||||
DateTime expiration = DateTime.MinValue;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// XAML Map Control - http://xamlmapcontrol.codeplex.com/
|
||||
// © 2015 Clemens Fischer
|
||||
// © 2016 Clemens Fischer
|
||||
// Licensed under the Microsoft Public License (Ms-PL)
|
||||
|
||||
using System;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// XAML Map Control - http://xamlmapcontrol.codeplex.com/
|
||||
// © 2015 Clemens Fischer
|
||||
// © 2016 Clemens Fischer
|
||||
// Licensed under the Microsoft Public License (Ms-PL)
|
||||
|
||||
using System;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// XAML Map Control - http://xamlmapcontrol.codeplex.com/
|
||||
// © 2015 Clemens Fischer
|
||||
// © 2016 Clemens Fischer
|
||||
// Licensed under the Microsoft Public License (Ms-PL)
|
||||
|
||||
using System;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// XAML Map Control - http://xamlmapcontrol.codeplex.com/
|
||||
// © 2015 Clemens Fischer
|
||||
// © 2016 Clemens Fischer
|
||||
// Licensed under the Microsoft Public License (Ms-PL)
|
||||
|
||||
using System;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// XAML Map Control - http://xamlmapcontrol.codeplex.com/
|
||||
// © 2015 Clemens Fischer
|
||||
// © 2016 Clemens Fischer
|
||||
// Licensed under the Microsoft Public License (Ms-PL)
|
||||
|
||||
using System.Collections.ObjectModel;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// XAML Map Control - http://xamlmapcontrol.codeplex.com/
|
||||
// © 2015 Clemens Fischer
|
||||
// © 2016 Clemens Fischer
|
||||
// Licensed under the Microsoft Public License (Ms-PL)
|
||||
|
||||
using System;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// XAML Map Control - http://xamlmapcontrol.codeplex.com/
|
||||
// © 2015 Clemens Fischer
|
||||
// © 2016 Clemens Fischer
|
||||
// Licensed under the Microsoft Public License (Ms-PL)
|
||||
|
||||
using System;
|
||||
|
|
|
|||
|
|
@ -5,10 +5,10 @@ using System.Runtime.InteropServices;
|
|||
[assembly: AssemblyDescription("XAML Map Control Library for Windows Runtime")]
|
||||
[assembly: AssemblyProduct("XAML Map Control")]
|
||||
[assembly: AssemblyCompany("Clemens Fischer")]
|
||||
[assembly: AssemblyCopyright("© 2015 Clemens Fischer")]
|
||||
[assembly: AssemblyCopyright("© 2016 Clemens Fischer")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyVersion("2.7.2")]
|
||||
[assembly: AssemblyFileVersion("2.7.2")]
|
||||
[assembly: AssemblyVersion("2.8.0")]
|
||||
[assembly: AssemblyFileVersion("2.8.0")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
[assembly: ComVisible(false)]
|
||||
|
|
|
|||
|
|
@ -5,10 +5,10 @@ using System.Runtime.InteropServices;
|
|||
[assembly: AssemblyDescription("XAML Map Control Windows Phone Sample Application")]
|
||||
[assembly: AssemblyProduct("XAML Map Control")]
|
||||
[assembly: AssemblyCompany("Clemens Fischer")]
|
||||
[assembly: AssemblyCopyright("© 2015 Clemens Fischer")]
|
||||
[assembly: AssemblyCopyright("© 2016 Clemens Fischer")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyVersion("2.7.2")]
|
||||
[assembly: AssemblyFileVersion("2.7.2")]
|
||||
[assembly: AssemblyVersion("2.8.0")]
|
||||
[assembly: AssemblyFileVersion("2.8.0")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
[assembly: ComVisible(false)]
|
||||
|
|
|
|||
|
|
@ -5,10 +5,10 @@ using System.Runtime.InteropServices;
|
|||
[assembly: AssemblyDescription("XAML Map Control Silverlight/Web Sample Application")]
|
||||
[assembly: AssemblyProduct("XAML Map Control")]
|
||||
[assembly: AssemblyCompany("Clemens Fischer")]
|
||||
[assembly: AssemblyCopyright("© 2015 Clemens Fischer")]
|
||||
[assembly: AssemblyCopyright("© 2016 Clemens Fischer")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyVersion("2.7.2")]
|
||||
[assembly: AssemblyFileVersion("2.7.2")]
|
||||
[assembly: AssemblyVersion("2.8.0")]
|
||||
[assembly: AssemblyFileVersion("2.8.0")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
[assembly: ComVisible(false)]
|
||||
|
|
|
|||
|
|
@ -5,10 +5,10 @@ using System.Runtime.InteropServices;
|
|||
[assembly: AssemblyDescription("XAML Map Control Silverlight Sample Application")]
|
||||
[assembly: AssemblyProduct("XAML Map Control")]
|
||||
[assembly: AssemblyCompany("Clemens Fischer")]
|
||||
[assembly: AssemblyCopyright("© 2015 Clemens Fischer")]
|
||||
[assembly: AssemblyCopyright("© 2016 Clemens Fischer")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyVersion("2.7.2")]
|
||||
[assembly: AssemblyFileVersion("2.7.2")]
|
||||
[assembly: AssemblyVersion("2.8.0")]
|
||||
[assembly: AssemblyFileVersion("2.8.0")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
[assembly: ComVisible(false)]
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ using System.Runtime.InteropServices;
|
|||
[assembly: AssemblyCopyright("© 2015 Clemens Fischer")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
[assembly: AssemblyVersion("2.7.2")]
|
||||
[assembly: AssemblyFileVersion("2.7.2")]
|
||||
[assembly: AssemblyVersion("2.8.0")]
|
||||
[assembly: AssemblyFileVersion("2.8.0")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: ComVisible(false)]
|
||||
|
|
|
|||
|
|
@ -168,8 +168,10 @@
|
|||
</Grid.RowDefinitions>
|
||||
<map:Map x:Name="map" TileLayer="{Binding [OpenStreetMap], Source={StaticResource TileLayers}}"
|
||||
Center="{Binding MapCenter}" MinZoomLevel="2" ZoomLevel="11" ManipulationMode="All">
|
||||
|
||||
<map:MapImage x:Name="mapImage" South="53.54031" North="53.74871" West="8.08594" East="8.43750"
|
||||
Source="10_535_330.jpg" Opacity="0.5"/>
|
||||
|
||||
<map:MapGraticule Opacity="0.6"/>
|
||||
|
||||
<!-- use ItemTemplate or ItemContainerStyle alternatively -->
|
||||
|
|
|
|||
|
|
@ -5,10 +5,10 @@ using System.Runtime.InteropServices;
|
|||
[assembly: AssemblyDescription("XAML Map Control Universal Windows Sample Application")]
|
||||
[assembly: AssemblyProduct("XAML Map Control")]
|
||||
[assembly: AssemblyCompany("Clemens Fischer")]
|
||||
[assembly: AssemblyCopyright("© 2015 Clemens Fischer")]
|
||||
[assembly: AssemblyCopyright("© 2016 Clemens Fischer")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
[assembly: AssemblyVersion("2.7.2")]
|
||||
[assembly: AssemblyFileVersion("2.7.2")]
|
||||
[assembly: AssemblyVersion("2.8.0")]
|
||||
[assembly: AssemblyFileVersion("2.8.0")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: ComVisible(false)]
|
||||
|
|
|
|||
|
|
@ -5,10 +5,10 @@ using System.Runtime.InteropServices;
|
|||
[assembly: AssemblyDescription("XAML Map Control WPF Sample Application")]
|
||||
[assembly: AssemblyProduct("XAML Map Control")]
|
||||
[assembly: AssemblyCompany("Clemens Fischer")]
|
||||
[assembly: AssemblyCopyright("© 2015 Clemens Fischer")]
|
||||
[assembly: AssemblyCopyright("© 2016 Clemens Fischer")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyVersion("2.7.2")]
|
||||
[assembly: AssemblyFileVersion("2.7.2")]
|
||||
[assembly: AssemblyVersion("2.8.0")]
|
||||
[assembly: AssemblyFileVersion("2.8.0")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
[assembly: ComVisible(false)]
|
||||
|
|
|
|||
Loading…
Reference in a new issue