diff --git a/Caching/FileDbCache/FileDbCache.cs b/Caching/FileDbCache/FileDbCache.cs
index dfa699bd..e7f1d87d 100644
--- a/Caching/FileDbCache/FileDbCache.cs
+++ b/Caching/FileDbCache/FileDbCache.cs
@@ -1,4 +1,8 @@
-using System;
+// XAML Map Control - http://xamlmapcontrol.codeplex.com/
+// Copyright © 2012 Clemens Fischer
+// Licensed under the Microsoft Public License (Ms-PL)
+
+using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Diagnostics;
diff --git a/Caching/FileDbCache/FileDbCache.csproj b/Caching/FileDbCache/FileDbCache.csproj
index 8889f87b..30c9400b 100644
--- a/Caching/FileDbCache/FileDbCache.csproj
+++ b/Caching/FileDbCache/FileDbCache.csproj
@@ -10,8 +10,9 @@
Properties
Caching
FileDbCache
- v4.0
+ v4.5
512
+
true
@@ -21,6 +22,7 @@
DEBUG;TRACE
prompt
4
+ false
none
@@ -29,6 +31,7 @@
TRACE
prompt
4
+ false
diff --git a/Caching/FileDbCache/Properties/AssemblyInfo.cs b/Caching/FileDbCache/Properties/AssemblyInfo.cs
index bca33da7..b7d2c29b 100644
--- a/Caching/FileDbCache/Properties/AssemblyInfo.cs
+++ b/Caching/FileDbCache/Properties/AssemblyInfo.cs
@@ -1,36 +1,14 @@
using System.Reflection;
-using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
[assembly: AssemblyTitle("FileDbCache")]
[assembly: AssemblyDescription("ObjectCache implementation based on EzTools FileDb")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Clemens Fischer")]
-[assembly: AssemblyProduct("FileDbCache")]
+[assembly: AssemblyProduct("XAML Map Control")]
[assembly: AssemblyCopyright("Copyright © 2012 Clemens Fischer")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("c1fc4f52-e47c-4f62-9807-7e096db69851")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
+[assembly: ComVisible(false)]
diff --git a/Caching/ImageFileCache/ImageFileCache.cs b/Caching/ImageFileCache/ImageFileCache.cs
index 330c6d50..f69507c0 100644
--- a/Caching/ImageFileCache/ImageFileCache.cs
+++ b/Caching/ImageFileCache/ImageFileCache.cs
@@ -1,4 +1,8 @@
-using System;
+// XAML Map Control - http://xamlmapcontrol.codeplex.com/
+// Copyright © 2012 Clemens Fischer
+// Licensed under the Microsoft Public License (Ms-PL)
+
+using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Diagnostics;
diff --git a/Caching/ImageFileCache/ImageFileCache.csproj b/Caching/ImageFileCache/ImageFileCache.csproj
index c2717585..d8233864 100644
--- a/Caching/ImageFileCache/ImageFileCache.csproj
+++ b/Caching/ImageFileCache/ImageFileCache.csproj
@@ -10,8 +10,9 @@
Properties
Caching
ImageFileCache
- v4.0
+ v4.5
512
+
true
@@ -21,6 +22,7 @@
DEBUG;TRACE
prompt
4
+ false
none
@@ -29,6 +31,7 @@
TRACE
prompt
4
+ false
diff --git a/Caching/ImageFileCache/Properties/AssemblyInfo.cs b/Caching/ImageFileCache/Properties/AssemblyInfo.cs
index ef77d2c5..95c153c3 100644
--- a/Caching/ImageFileCache/Properties/AssemblyInfo.cs
+++ b/Caching/ImageFileCache/Properties/AssemblyInfo.cs
@@ -1,36 +1,14 @@
using System.Reflection;
-using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
[assembly: AssemblyTitle("ImageFileCache")]
[assembly: AssemblyDescription("ObjectCache implementation based on local image files")]
[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("ImageFileCache")]
+[assembly: AssemblyCompany("Clemens Fischer")]
+[assembly: AssemblyProduct("XAML Map Control")]
[assembly: AssemblyCopyright("Copyright © 2012 Clemens Fischer")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("0483659a-9743-41a2-9505-9c1a4d9ecc06")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
+[assembly: ComVisible(false)]
diff --git a/MapControl.sln b/MapControl.sln
index a612b95a..800e97df 100644
--- a/MapControl.sln
+++ b/MapControl.sln
@@ -1,76 +1,202 @@

-Microsoft Visual Studio Solution File, Format Version 11.00
-# Visual Studio 2010
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MapControl", "MapControl\MapControl.csproj", "{06481252-2310-414A-B9FC-D5739FDF6BD3}"
-EndProject
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 2012
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FileDbCache", "Caching\FileDbCache\FileDbCache.csproj", "{EF44F661-B98A-4676-927F-85D138F82300}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SampleApplication", "SampleApps\SampleApplication\SampleApplication.csproj", "{CCBCDAE5-E68F-43A8-930A-0749E476D29D}"
-EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SurfaceApplication", "SampleApps\SurfaceApplication\SurfaceApplication.csproj", "{6285FB9D-B7EA-469A-B464-224077967167}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ImageFileCache", "Caching\ImageFileCache\ImageFileCache.csproj", "{86470440-FEE2-4120-AF5A-3762FB9C536F}"
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}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WpfApplication", "SampleApps\WpfApplication\WpfApplication.csproj", "{CCBCDAE5-E68F-43A8-930A-0749E476D29D}"
+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}") = "MapControl.Silverlight", "MapControl\MapControl.Silverlight.csproj", "{EB133B78-DEFF-416A-8F0C-89E54D766576}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StoreApplication", "SampleApps\StoreApplication\StoreApplication.csproj", "{747A3F84-E11F-4EC8-9463-98BBB1E0D0A4}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MapControl.WinRT", "MapControl\WinRT\MapControl.WinRT.csproj", "{63CEFDF7-5170-43B6-86F8-5C4A383A1615}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
+ Debug|ARM = Debug|ARM
Debug|Mixed Platforms = Debug|Mixed Platforms
+ Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
+ Release|ARM = Release|ARM
Release|Mixed Platforms = Release|Mixed Platforms
+ Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {06481252-2310-414A-B9FC-D5739FDF6BD3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {06481252-2310-414A-B9FC-D5739FDF6BD3}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {06481252-2310-414A-B9FC-D5739FDF6BD3}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
- {06481252-2310-414A-B9FC-D5739FDF6BD3}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
- {06481252-2310-414A-B9FC-D5739FDF6BD3}.Debug|x86.ActiveCfg = Debug|Any CPU
- {06481252-2310-414A-B9FC-D5739FDF6BD3}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {06481252-2310-414A-B9FC-D5739FDF6BD3}.Release|Any CPU.Build.0 = Release|Any CPU
- {06481252-2310-414A-B9FC-D5739FDF6BD3}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
- {06481252-2310-414A-B9FC-D5739FDF6BD3}.Release|Mixed Platforms.Build.0 = Release|Any CPU
- {06481252-2310-414A-B9FC-D5739FDF6BD3}.Release|x86.ActiveCfg = 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|Mixed Platforms.ActiveCfg = Debug|Any CPU
{EF44F661-B98A-4676-927F-85D138F82300}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
+ {EF44F661-B98A-4676-927F-85D138F82300}.Debug|x64.ActiveCfg = Debug|Any CPU
{EF44F661-B98A-4676-927F-85D138F82300}.Debug|x86.ActiveCfg = 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|Mixed Platforms.ActiveCfg = Release|Any CPU
{EF44F661-B98A-4676-927F-85D138F82300}.Release|Mixed Platforms.Build.0 = Release|Any CPU
+ {EF44F661-B98A-4676-927F-85D138F82300}.Release|x64.ActiveCfg = Release|Any CPU
{EF44F661-B98A-4676-927F-85D138F82300}.Release|x86.ActiveCfg = Release|Any CPU
- {CCBCDAE5-E68F-43A8-930A-0749E476D29D}.Debug|Any CPU.ActiveCfg = Debug|x86
- {CCBCDAE5-E68F-43A8-930A-0749E476D29D}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
- {CCBCDAE5-E68F-43A8-930A-0749E476D29D}.Debug|Mixed Platforms.Build.0 = Debug|x86
- {CCBCDAE5-E68F-43A8-930A-0749E476D29D}.Debug|x86.ActiveCfg = Debug|x86
- {CCBCDAE5-E68F-43A8-930A-0749E476D29D}.Debug|x86.Build.0 = Debug|x86
- {CCBCDAE5-E68F-43A8-930A-0749E476D29D}.Release|Any CPU.ActiveCfg = Release|x86
- {CCBCDAE5-E68F-43A8-930A-0749E476D29D}.Release|Mixed Platforms.ActiveCfg = Release|x86
- {CCBCDAE5-E68F-43A8-930A-0749E476D29D}.Release|Mixed Platforms.Build.0 = Release|x86
- {CCBCDAE5-E68F-43A8-930A-0749E476D29D}.Release|x86.ActiveCfg = Release|x86
- {CCBCDAE5-E68F-43A8-930A-0749E476D29D}.Release|x86.Build.0 = Release|x86
{6285FB9D-B7EA-469A-B464-224077967167}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6285FB9D-B7EA-469A-B464-224077967167}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {6285FB9D-B7EA-469A-B464-224077967167}.Debug|ARM.ActiveCfg = Debug|Any CPU
{6285FB9D-B7EA-469A-B464-224077967167}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{6285FB9D-B7EA-469A-B464-224077967167}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
+ {6285FB9D-B7EA-469A-B464-224077967167}.Debug|x64.ActiveCfg = Debug|Any CPU
{6285FB9D-B7EA-469A-B464-224077967167}.Debug|x86.ActiveCfg = Debug|Any CPU
{6285FB9D-B7EA-469A-B464-224077967167}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6285FB9D-B7EA-469A-B464-224077967167}.Release|Any CPU.Build.0 = Release|Any CPU
+ {6285FB9D-B7EA-469A-B464-224077967167}.Release|ARM.ActiveCfg = Release|Any CPU
{6285FB9D-B7EA-469A-B464-224077967167}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{6285FB9D-B7EA-469A-B464-224077967167}.Release|Mixed Platforms.Build.0 = Release|Any CPU
+ {6285FB9D-B7EA-469A-B464-224077967167}.Release|x64.ActiveCfg = Release|Any CPU
{6285FB9D-B7EA-469A-B464-224077967167}.Release|x86.ActiveCfg = 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|Mixed Platforms.ActiveCfg = Debug|Any CPU
{86470440-FEE2-4120-AF5A-3762FB9C536F}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
+ {86470440-FEE2-4120-AF5A-3762FB9C536F}.Debug|x64.ActiveCfg = Debug|Any CPU
{86470440-FEE2-4120-AF5A-3762FB9C536F}.Debug|x86.ActiveCfg = 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|Mixed Platforms.ActiveCfg = Release|Any CPU
{86470440-FEE2-4120-AF5A-3762FB9C536F}.Release|Mixed Platforms.Build.0 = Release|Any CPU
+ {86470440-FEE2-4120-AF5A-3762FB9C536F}.Release|x64.ActiveCfg = Release|Any CPU
{86470440-FEE2-4120-AF5A-3762FB9C536F}.Release|x86.ActiveCfg = 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
+ {CBA8C535-CCA3-4F60-8D3E-0E25791CBD21}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+ {CBA8C535-CCA3-4F60-8D3E-0E25791CBD21}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
+ {CBA8C535-CCA3-4F60-8D3E-0E25791CBD21}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {CBA8C535-CCA3-4F60-8D3E-0E25791CBD21}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {CBA8C535-CCA3-4F60-8D3E-0E25791CBD21}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {CBA8C535-CCA3-4F60-8D3E-0E25791CBD21}.Release|Any CPU.Build.0 = Release|Any CPU
+ {CBA8C535-CCA3-4F60-8D3E-0E25791CBD21}.Release|ARM.ActiveCfg = Release|Any CPU
+ {CBA8C535-CCA3-4F60-8D3E-0E25791CBD21}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
+ {CBA8C535-CCA3-4F60-8D3E-0E25791CBD21}.Release|Mixed Platforms.Build.0 = Release|Any CPU
+ {CBA8C535-CCA3-4F60-8D3E-0E25791CBD21}.Release|x64.ActiveCfg = Release|Any CPU
+ {CBA8C535-CCA3-4F60-8D3E-0E25791CBD21}.Release|x86.ActiveCfg = Release|Any CPU
+ {177C4EF8-0B0A-426E-BDCC-168DC10AC1C1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {177C4EF8-0B0A-426E-BDCC-168DC10AC1C1}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {177C4EF8-0B0A-426E-BDCC-168DC10AC1C1}.Debug|ARM.ActiveCfg = Debug|Any CPU
+ {177C4EF8-0B0A-426E-BDCC-168DC10AC1C1}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+ {177C4EF8-0B0A-426E-BDCC-168DC10AC1C1}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
+ {177C4EF8-0B0A-426E-BDCC-168DC10AC1C1}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {177C4EF8-0B0A-426E-BDCC-168DC10AC1C1}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {177C4EF8-0B0A-426E-BDCC-168DC10AC1C1}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {177C4EF8-0B0A-426E-BDCC-168DC10AC1C1}.Release|Any CPU.Build.0 = Release|Any CPU
+ {177C4EF8-0B0A-426E-BDCC-168DC10AC1C1}.Release|ARM.ActiveCfg = Release|Any CPU
+ {177C4EF8-0B0A-426E-BDCC-168DC10AC1C1}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
+ {177C4EF8-0B0A-426E-BDCC-168DC10AC1C1}.Release|Mixed Platforms.Build.0 = Release|Any CPU
+ {177C4EF8-0B0A-426E-BDCC-168DC10AC1C1}.Release|x64.ActiveCfg = Release|Any CPU
+ {177C4EF8-0B0A-426E-BDCC-168DC10AC1C1}.Release|x86.ActiveCfg = Release|Any CPU
+ {CCBCDAE5-E68F-43A8-930A-0749E476D29D}.Debug|Any CPU.ActiveCfg = Debug|x86
+ {CCBCDAE5-E68F-43A8-930A-0749E476D29D}.Debug|ARM.ActiveCfg = Debug|x86
+ {CCBCDAE5-E68F-43A8-930A-0749E476D29D}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
+ {CCBCDAE5-E68F-43A8-930A-0749E476D29D}.Debug|Mixed Platforms.Build.0 = Debug|x86
+ {CCBCDAE5-E68F-43A8-930A-0749E476D29D}.Debug|x64.ActiveCfg = Debug|x86
+ {CCBCDAE5-E68F-43A8-930A-0749E476D29D}.Debug|x86.ActiveCfg = Debug|x86
+ {CCBCDAE5-E68F-43A8-930A-0749E476D29D}.Debug|x86.Build.0 = Debug|x86
+ {CCBCDAE5-E68F-43A8-930A-0749E476D29D}.Release|Any CPU.ActiveCfg = Release|x86
+ {CCBCDAE5-E68F-43A8-930A-0749E476D29D}.Release|ARM.ActiveCfg = Release|x86
+ {CCBCDAE5-E68F-43A8-930A-0749E476D29D}.Release|Mixed Platforms.ActiveCfg = Release|x86
+ {CCBCDAE5-E68F-43A8-930A-0749E476D29D}.Release|Mixed Platforms.Build.0 = Release|x86
+ {CCBCDAE5-E68F-43A8-930A-0749E476D29D}.Release|x64.ActiveCfg = Release|x86
+ {CCBCDAE5-E68F-43A8-930A-0749E476D29D}.Release|x86.ActiveCfg = Release|x86
+ {CCBCDAE5-E68F-43A8-930A-0749E476D29D}.Release|x86.Build.0 = Release|x86
+ {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|Mixed Platforms.ActiveCfg = Debug|Any CPU
+ {226F3575-B683-446D-A2F0-181291DC8787}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
+ {226F3575-B683-446D-A2F0-181291DC8787}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {226F3575-B683-446D-A2F0-181291DC8787}.Debug|x86.ActiveCfg = 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|Mixed Platforms.ActiveCfg = Release|Any CPU
+ {226F3575-B683-446D-A2F0-181291DC8787}.Release|Mixed Platforms.Build.0 = Release|Any CPU
+ {226F3575-B683-446D-A2F0-181291DC8787}.Release|x64.ActiveCfg = Release|Any CPU
+ {226F3575-B683-446D-A2F0-181291DC8787}.Release|x86.ActiveCfg = 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|Mixed Platforms.ActiveCfg = Debug|Any CPU
+ {EB133B78-DEFF-416A-8F0C-89E54D766576}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
+ {EB133B78-DEFF-416A-8F0C-89E54D766576}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {EB133B78-DEFF-416A-8F0C-89E54D766576}.Debug|x86.ActiveCfg = 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|Mixed Platforms.ActiveCfg = Release|Any CPU
+ {EB133B78-DEFF-416A-8F0C-89E54D766576}.Release|Mixed Platforms.Build.0 = Release|Any CPU
+ {EB133B78-DEFF-416A-8F0C-89E54D766576}.Release|x64.ActiveCfg = Release|Any CPU
+ {EB133B78-DEFF-416A-8F0C-89E54D766576}.Release|x86.ActiveCfg = Release|Any CPU
+ {747A3F84-E11F-4EC8-9463-98BBB1E0D0A4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {747A3F84-E11F-4EC8-9463-98BBB1E0D0A4}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {747A3F84-E11F-4EC8-9463-98BBB1E0D0A4}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
+ {747A3F84-E11F-4EC8-9463-98BBB1E0D0A4}.Debug|ARM.ActiveCfg = Debug|ARM
+ {747A3F84-E11F-4EC8-9463-98BBB1E0D0A4}.Debug|ARM.Build.0 = Debug|ARM
+ {747A3F84-E11F-4EC8-9463-98BBB1E0D0A4}.Debug|ARM.Deploy.0 = Debug|ARM
+ {747A3F84-E11F-4EC8-9463-98BBB1E0D0A4}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
+ {747A3F84-E11F-4EC8-9463-98BBB1E0D0A4}.Debug|Mixed Platforms.Build.0 = Debug|x86
+ {747A3F84-E11F-4EC8-9463-98BBB1E0D0A4}.Debug|Mixed Platforms.Deploy.0 = Debug|x86
+ {747A3F84-E11F-4EC8-9463-98BBB1E0D0A4}.Debug|x64.ActiveCfg = Debug|x64
+ {747A3F84-E11F-4EC8-9463-98BBB1E0D0A4}.Debug|x64.Build.0 = Debug|x64
+ {747A3F84-E11F-4EC8-9463-98BBB1E0D0A4}.Debug|x64.Deploy.0 = Debug|x64
+ {747A3F84-E11F-4EC8-9463-98BBB1E0D0A4}.Debug|x86.ActiveCfg = Debug|x86
+ {747A3F84-E11F-4EC8-9463-98BBB1E0D0A4}.Debug|x86.Build.0 = Debug|x86
+ {747A3F84-E11F-4EC8-9463-98BBB1E0D0A4}.Debug|x86.Deploy.0 = Debug|x86
+ {747A3F84-E11F-4EC8-9463-98BBB1E0D0A4}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {747A3F84-E11F-4EC8-9463-98BBB1E0D0A4}.Release|Any CPU.Build.0 = Release|Any CPU
+ {747A3F84-E11F-4EC8-9463-98BBB1E0D0A4}.Release|Any CPU.Deploy.0 = Release|Any CPU
+ {747A3F84-E11F-4EC8-9463-98BBB1E0D0A4}.Release|ARM.ActiveCfg = Release|ARM
+ {747A3F84-E11F-4EC8-9463-98BBB1E0D0A4}.Release|ARM.Build.0 = Release|ARM
+ {747A3F84-E11F-4EC8-9463-98BBB1E0D0A4}.Release|ARM.Deploy.0 = Release|ARM
+ {747A3F84-E11F-4EC8-9463-98BBB1E0D0A4}.Release|Mixed Platforms.ActiveCfg = Release|x86
+ {747A3F84-E11F-4EC8-9463-98BBB1E0D0A4}.Release|Mixed Platforms.Build.0 = Release|x86
+ {747A3F84-E11F-4EC8-9463-98BBB1E0D0A4}.Release|Mixed Platforms.Deploy.0 = Release|x86
+ {747A3F84-E11F-4EC8-9463-98BBB1E0D0A4}.Release|x64.ActiveCfg = Release|x64
+ {747A3F84-E11F-4EC8-9463-98BBB1E0D0A4}.Release|x64.Build.0 = Release|x64
+ {747A3F84-E11F-4EC8-9463-98BBB1E0D0A4}.Release|x64.Deploy.0 = Release|x64
+ {747A3F84-E11F-4EC8-9463-98BBB1E0D0A4}.Release|x86.ActiveCfg = Release|x86
+ {747A3F84-E11F-4EC8-9463-98BBB1E0D0A4}.Release|x86.Build.0 = Release|x86
+ {747A3F84-E11F-4EC8-9463-98BBB1E0D0A4}.Release|x86.Deploy.0 = Release|x86
+ {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|ARM
+ {63CEFDF7-5170-43B6-86F8-5C4A383A1615}.Debug|ARM.Build.0 = Debug|ARM
+ {63CEFDF7-5170-43B6-86F8-5C4A383A1615}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
+ {63CEFDF7-5170-43B6-86F8-5C4A383A1615}.Debug|Mixed Platforms.Build.0 = Debug|x86
+ {63CEFDF7-5170-43B6-86F8-5C4A383A1615}.Debug|x64.ActiveCfg = Debug|x64
+ {63CEFDF7-5170-43B6-86F8-5C4A383A1615}.Debug|x64.Build.0 = Debug|x64
+ {63CEFDF7-5170-43B6-86F8-5C4A383A1615}.Debug|x86.ActiveCfg = Debug|x86
+ {63CEFDF7-5170-43B6-86F8-5C4A383A1615}.Debug|x86.Build.0 = Debug|x86
+ {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|ARM
+ {63CEFDF7-5170-43B6-86F8-5C4A383A1615}.Release|ARM.Build.0 = Release|ARM
+ {63CEFDF7-5170-43B6-86F8-5C4A383A1615}.Release|Mixed Platforms.ActiveCfg = Release|x86
+ {63CEFDF7-5170-43B6-86F8-5C4A383A1615}.Release|Mixed Platforms.Build.0 = Release|x86
+ {63CEFDF7-5170-43B6-86F8-5C4A383A1615}.Release|x64.ActiveCfg = Release|x64
+ {63CEFDF7-5170-43B6-86F8-5C4A383A1615}.Release|x64.Build.0 = Release|x64
+ {63CEFDF7-5170-43B6-86F8-5C4A383A1615}.Release|x86.ActiveCfg = Release|x86
+ {63CEFDF7-5170-43B6-86F8-5C4A383A1615}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/MapControl/AnimationEx.Silverlight.cs b/MapControl/AnimationEx.Silverlight.cs
new file mode 100644
index 00000000..98e5ea5c
--- /dev/null
+++ b/MapControl/AnimationEx.Silverlight.cs
@@ -0,0 +1,21 @@
+// XAML Map Control - http://xamlmapcontrol.codeplex.com/
+// Copyright © 2012 Clemens Fischer
+// Licensed under the Microsoft Public License (Ms-PL)
+
+using System.Windows;
+using System.Windows.Media.Animation;
+
+namespace MapControl
+{
+ public static class AnimationEx
+ {
+ 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/AnimationEx.WinRT.cs b/MapControl/AnimationEx.WinRT.cs
new file mode 100644
index 00000000..0b8bf532
--- /dev/null
+++ b/MapControl/AnimationEx.WinRT.cs
@@ -0,0 +1,49 @@
+// XAML Map Control - http://xamlmapcontrol.codeplex.com/
+// Copyright © 2012 Clemens Fischer
+// Licensed under the Microsoft Public License (Ms-PL)
+
+using Windows.UI.Xaml;
+using Windows.UI.Xaml.Media.Animation;
+
+namespace MapControl
+{
+ public static class AnimationEx
+ {
+ public static void BeginAnimation(this DependencyObject obj, DependencyProperty property, DoubleAnimation animation)
+ {
+ animation.EnableDependentAnimation = true;
+
+ if (property == UIElement.OpacityProperty)
+ {
+ BeginAnimation(obj, "Opacity", animation);
+ }
+ else if (property == MapBase.ZoomLevelProperty)
+ {
+ BeginAnimation(obj, "ZoomLevel", animation);
+ }
+ else if (property == MapBase.HeadingProperty)
+ {
+ BeginAnimation(obj, "Heading", animation);
+ }
+ }
+
+ public static void BeginAnimation(this DependencyObject obj, DependencyProperty property, PointAnimation animation)
+ {
+ animation.EnableDependentAnimation = true;
+
+ if (property == MapBase.CenterPointProperty)
+ {
+ BeginAnimation(obj, "CenterPoint", animation);
+ }
+ }
+
+ private static void BeginAnimation(DependencyObject obj, string property, Timeline animation)
+ {
+ Storyboard.SetTargetProperty(animation, property);
+ Storyboard.SetTarget(animation, obj);
+ var storyboard = new Storyboard();
+ storyboard.Children.Add(animation);
+ storyboard.Begin();
+ }
+ }
+}
diff --git a/MapControl/GlyphRunText.cs b/MapControl/GlyphRunText.cs
index 0822dc43..9d670bb7 100644
--- a/MapControl/GlyphRunText.cs
+++ b/MapControl/GlyphRunText.cs
@@ -1,4 +1,4 @@
-// WPF MapControl - http://wpfmapcontrol.codeplex.com/
+// XAML Map Control - http://xamlmapcontrol.codeplex.com/
// Copyright © 2012 Clemens Fischer
// Licensed under the Microsoft Public License (Ms-PL)
@@ -22,12 +22,12 @@ namespace MapControl
throw new ArgumentException(string.Format("{0}: no GlyphTypeface found", typeface.FontFamily));
}
- ushort[] glyphIndices = new ushort[text.Length];
- double[] advanceWidths = new double[text.Length];
+ var glyphIndices = new ushort[text.Length];
+ var advanceWidths = new double[text.Length];
for (int i = 0; i < text.Length; i++)
{
- ushort glyphIndex = glyphTypeface.CharacterToGlyphMap[text[i]];
+ var glyphIndex = glyphTypeface.CharacterToGlyphMap[text[i]];
glyphIndices[i] = glyphIndex;
advanceWidths[i] = glyphTypeface.AdvanceWidths[glyphIndex] * emSize;
}
@@ -45,21 +45,20 @@ namespace MapControl
throw new ArgumentException(string.Format("{0}: no GlyphTypeface found", typeface.FontFamily));
}
- ushort[] glyphIndices = new ushort[text.Length];
- double[] advanceWidths = new double[text.Length];
+ var glyphIndices = new ushort[text.Length];
+ var advanceWidths = new double[text.Length];
for (int i = 0; i < text.Length; i++)
{
- ushort glyphIndex = glyphTypeface.CharacterToGlyphMap[text[i]];
+ var glyphIndex = glyphTypeface.CharacterToGlyphMap[text[i]];
glyphIndices[i] = glyphIndex;
advanceWidths[i] = glyphTypeface.AdvanceWidths[glyphIndex] * emSize;
}
- GlyphRun glyphRun = new GlyphRun(glyphTypeface, 0, false, emSize, glyphIndices, new Point(), advanceWidths,
- null, null, null, null, null, null);
-
- Rect bbox = glyphRun.ComputeInkBoundingBox();
- Point baselineOrigin = new Point(centerOffset.X - bbox.X - bbox.Width / 2d, centerOffset.Y - bbox.Y - bbox.Height / 2d);
+ var glyphRun = new GlyphRun(glyphTypeface, 0, false, emSize, glyphIndices, new Point(), advanceWidths,
+ null, null, null, null, null, null);
+ var bbox = glyphRun.ComputeInkBoundingBox();
+ var baselineOrigin = new Point(centerOffset.X - bbox.X - bbox.Width / 2d, centerOffset.Y - bbox.Y - bbox.Height / 2d);
return new GlyphRun(glyphTypeface, 0, false, emSize, glyphIndices, baselineOrigin, advanceWidths,
null, null, null, null, null, null);
diff --git a/MapControl/ImageTileSource.cs b/MapControl/ImageTileSource.cs
index a61cf1d2..82a575f9 100644
--- a/MapControl/ImageTileSource.cs
+++ b/MapControl/ImageTileSource.cs
@@ -1,4 +1,4 @@
-// WPF MapControl - http://wpfmapcontrol.codeplex.com/
+// XAML Map Control - http://xamlmapcontrol.codeplex.com/
// Copyright © 2012 Clemens Fischer
// Licensed under the Microsoft Public License (Ms-PL)
diff --git a/MapControl/Int32Rect.cs b/MapControl/Int32Rect.cs
new file mode 100644
index 00000000..370085a3
--- /dev/null
+++ b/MapControl/Int32Rect.cs
@@ -0,0 +1,43 @@
+// XAML Map Control - http://xamlmapcontrol.codeplex.com/
+// Copyright © 2012 Clemens Fischer
+// Licensed under the Microsoft Public License (Ms-PL)
+
+namespace MapControl
+{
+ public struct Int32Rect
+ {
+ public Int32Rect(int x, int y, int width, int height)
+ : this()
+ {
+ X = x;
+ Y = y;
+ Width = width;
+ Height = height;
+ }
+
+ public int X { get; set; }
+ public int Y { get; set; }
+ public int Width { get; set; }
+ public int Height { get; set; }
+
+ public override int GetHashCode()
+ {
+ return X ^ Y ^ Width ^ Height;
+ }
+
+ public override bool Equals(object obj)
+ {
+ return obj is Int32Rect && (Int32Rect)obj == this;
+ }
+
+ public static bool operator ==(Int32Rect rect1, Int32Rect rect2)
+ {
+ return rect1.X == rect2.X && rect1.Y == rect2.Y && rect1.Width == rect2.Width && rect1.Height == rect2.Height;
+ }
+
+ public static bool operator !=(Int32Rect rect1, Int32Rect rect2)
+ {
+ return !(rect1 == rect2);
+ }
+ }
+}
diff --git a/MapControl/Location.cs b/MapControl/Location.cs
index 79a86956..f5f45d74 100644
--- a/MapControl/Location.cs
+++ b/MapControl/Location.cs
@@ -1,37 +1,39 @@
-// WPF MapControl - http://wpfmapcontrol.codeplex.com/
+// XAML Map Control - http://xamlmapcontrol.codeplex.com/
// Copyright © 2012 Clemens Fischer
// Licensed under the Microsoft Public License (Ms-PL)
using System;
-using System.ComponentModel;
using System.Globalization;
-using System.Windows;
namespace MapControl
{
///
/// A geographic location given as latitude and longitude.
///
- [TypeConverter(typeof(LocationConverter))]
- public class Location
+ public partial class Location : IEquatable
{
private double latitude;
private double longitude;
+ internal double Y;
public Location()
{
}
- public Location(double latitude, double longitude)
+ public Location(double lat, double lon)
{
- Latitude = latitude;
- Longitude = longitude;
+ Latitude = lat;
+ Longitude = lon;
}
public double Latitude
{
get { return latitude; }
- set { latitude = Math.Min(Math.Max(value, -90d), 90d); }
+ set
+ {
+ latitude = Math.Min(Math.Max(value, -90d), 90d);
+ Y = double.NaN;
+ }
}
public double Longitude
@@ -40,36 +42,42 @@ namespace MapControl
set { longitude = value; }
}
- public override string ToString()
+ public bool Equals(Location other)
{
- return string.Format(CultureInfo.InvariantCulture, "{0:0.00000},{1:0.00000}", latitude, longitude);
+ return other != null && other.latitude == latitude && other.longitude == longitude;
}
- public static Location Parse(string source)
+ public override bool Equals(object obj)
{
- Point p = Point.Parse(source);
- return new Location(p.X, p.Y);
+ return Equals(obj as Location);
+ }
+
+ public override int GetHashCode()
+ {
+ return latitude.GetHashCode() ^ longitude.GetHashCode();
+ }
+
+ public override string ToString()
+ {
+ return string.Format(CultureInfo.InvariantCulture, "{0:F5},{1:F5}", latitude, longitude);
+ }
+
+ public static Location Parse(string s)
+ {
+ var tokens = s.Split(new char[] { ',' });
+ if (tokens.Length != 2)
+ {
+ throw new FormatException("Location string must be a comma-separated pair of double values");
+ }
+
+ return new Location(
+ double.Parse(tokens[0], NumberStyles.Float, CultureInfo.InvariantCulture),
+ double.Parse(tokens[1], NumberStyles.Float, CultureInfo.InvariantCulture));
}
public static double NormalizeLongitude(double longitude)
{
- return ((longitude + 180d) % 360d + 360d) % 360d - 180d;
- }
- }
-
- ///
- /// Converts from string to Location.
- ///
- 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);
+ return (longitude >= -180d && longitude <= 180d) ? longitude : ((longitude + 180d) % 360d + 360d) % 360d - 180d;
}
}
}
diff --git a/MapControl/LocationAnimation.cs b/MapControl/LocationAnimation.cs
deleted file mode 100644
index 0fd49e9a..00000000
--- a/MapControl/LocationAnimation.cs
+++ /dev/null
@@ -1,56 +0,0 @@
-// WPF MapControl - http://wpfmapcontrol.codeplex.com/
-// Copyright © 2012 Clemens Fischer
-// Licensed under the Microsoft Public License (Ms-PL)
-
-using System;
-using System.Windows;
-using System.Windows.Media.Animation;
-
-namespace MapControl
-{
- ///
- /// Animates the value of a Location property between two values.
- ///
- public class LocationAnimation : AnimationTimeline
- {
- public Location From { get; set; }
- public Location To { get; set; }
- public IEasingFunction EasingFunction { get; set; }
-
- public override Type TargetPropertyType
- {
- get { return typeof(Location); }
- }
-
- protected override Freezable CreateInstanceCore()
- {
- return new LocationAnimation
- {
- From = From,
- To = To,
- EasingFunction = EasingFunction
- };
- }
-
- public override object GetCurrentValue(object defaultOriginValue, object defaultDestinationValue, AnimationClock animationClock)
- {
- if (!animationClock.CurrentProgress.HasValue)
- {
- return defaultOriginValue;
- }
-
- double progress = animationClock.CurrentProgress.Value;
-
- if (EasingFunction != null)
- {
- progress = EasingFunction.Ease(progress);
- }
-
- double deltaLongitude = progress * Location.NormalizeLongitude(To.Longitude - From.Longitude);
-
- return new Location(
- (1d - progress) * From.Latitude + progress * To.Latitude,
- Location.NormalizeLongitude(From.Longitude + deltaLongitude));
- }
- }
-}
diff --git a/MapControl/LocationCollection.cs b/MapControl/LocationCollection.cs
index 50296464..01509f7c 100644
--- a/MapControl/LocationCollection.cs
+++ b/MapControl/LocationCollection.cs
@@ -1,20 +1,17 @@
-// WPF MapControl - http://wpfmapcontrol.codeplex.com/
+// XAML Map Control - http://xamlmapcontrol.codeplex.com/
// Copyright © 2012 Clemens Fischer
// Licensed under the Microsoft Public License (Ms-PL)
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
-using System.ComponentModel;
-using System.Globalization;
namespace MapControl
{
///
/// A collection of geographic locations.
///
- [TypeConverter(typeof(LocationCollectionConverter))]
- public class LocationCollection : ObservableCollection
+ public partial class LocationCollection : ObservableCollection
{
public LocationCollection()
{
@@ -28,11 +25,11 @@ namespace MapControl
}
}
- public static LocationCollection Parse(string source)
+ public static LocationCollection Parse(string s)
{
LocationCollection locations = new LocationCollection();
- foreach (string locString in source.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries))
+ foreach (var locString in s.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries))
{
locations.Add(Location.Parse(locString));
}
@@ -40,20 +37,4 @@ namespace MapControl
return locations;
}
}
-
- ///
- /// Converts from string to LocationCollection.
- ///
- 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);
- }
- }
}
diff --git a/MapControl/LocationCollectionConverter.cs b/MapControl/LocationCollectionConverter.cs
new file mode 100644
index 00000000..0ef4783e
--- /dev/null
+++ b/MapControl/LocationCollectionConverter.cs
@@ -0,0 +1,28 @@
+// XAML Map Control - http://xamlmapcontrol.codeplex.com/
+// Copyright © 2012 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
new file mode 100644
index 00000000..3528f692
--- /dev/null
+++ b/MapControl/LocationConverter.cs
@@ -0,0 +1,28 @@
+// XAML Map Control - http://xamlmapcontrol.codeplex.com/
+// Copyright © 2012 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))]
+ public partial class Location
+ {
+ }
+}
diff --git a/MapControl/Map.Silverlight.WPF.cs b/MapControl/Map.Silverlight.WPF.cs
new file mode 100644
index 00000000..11c337a9
--- /dev/null
+++ b/MapControl/Map.Silverlight.WPF.cs
@@ -0,0 +1,64 @@
+// XAML Map Control - http://xamlmapcontrol.codeplex.com/
+// Copyright © 2012 Clemens Fischer
+// Licensed under the Microsoft Public License (Ms-PL)
+
+using System;
+using System.Windows;
+using System.Windows.Input;
+
+namespace MapControl
+{
+ public partial class Map
+ {
+ partial void Initialize()
+ {
+#if !SILVERLIGHT
+ ManipulationDelta += OnManipulationDelta;
+#endif
+ MouseWheel += OnMouseWheel;
+ MouseLeftButtonDown += OnMouseLeftButtonDown;
+ MouseLeftButtonUp += OnMouseLeftButtonUp;
+ MouseMove += OnMouseMove;
+ }
+
+#if !SILVERLIGHT
+ private void OnManipulationDelta(object sender, ManipulationDeltaEventArgs e)
+ {
+ var d = e.DeltaManipulation;
+ TransformMap(e.ManipulationOrigin, (Point)d.Translation, d.Rotation, (d.Scale.X + d.Scale.Y) / 2d);
+ }
+#endif
+
+ private void OnMouseWheel(object sender, MouseWheelEventArgs e)
+ {
+ ZoomMap(e.GetPosition(this), TargetZoomLevel + mouseWheelZoom * Math.Sign(e.Delta));
+ }
+
+ 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/Map.WinRT.cs b/MapControl/Map.WinRT.cs
new file mode 100644
index 00000000..9ba36c70
--- /dev/null
+++ b/MapControl/Map.WinRT.cs
@@ -0,0 +1,68 @@
+// XAML Map Control - http://xamlmapcontrol.codeplex.com/
+// Copyright © 2012 Clemens Fischer
+// Licensed under the Microsoft Public License (Ms-PL)
+
+using System;
+using Windows.Devices.Input;
+using Windows.Foundation;
+using Windows.UI.Xaml.Input;
+
+namespace MapControl
+{
+ public partial class Map
+ {
+ partial void Initialize()
+ {
+ ManipulationMode = ManipulationModes.All;
+ ManipulationDelta += OnManipulationDelta;
+ PointerWheelChanged += OnPointerWheelChanged;
+ PointerPressed += OnPointerPressed;
+ PointerReleased += OnPointerReleased;
+ PointerCanceled += OnPointerReleased;
+ PointerCaptureLost += OnPointerReleased;
+ PointerMoved += OnPointerMoved;
+ }
+
+ private void OnManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e)
+ {
+ if (e.PointerDeviceType != PointerDeviceType.Mouse)
+ {
+ TransformMap(e.Position, e.Delta.Translation, e.Delta.Rotation, e.Delta.Scale);
+ }
+ }
+
+ private void OnPointerWheelChanged(object sender, PointerRoutedEventArgs e)
+ {
+ var point = e.GetCurrentPoint(this);
+ ZoomMap(point.Position, TargetZoomLevel + mouseWheelZoom * Math.Sign(point.Properties.MouseWheelDelta));
+ }
+
+ private void OnPointerPressed(object sender, PointerRoutedEventArgs e)
+ {
+ if (e.Pointer.PointerDeviceType == PointerDeviceType.Mouse &&
+ CapturePointer(e.Pointer))
+ {
+ mousePosition = e.GetCurrentPoint(this).Position;
+ }
+ }
+
+ private void OnPointerReleased(object sender, PointerRoutedEventArgs e)
+ {
+ if (e.Pointer.PointerDeviceType == PointerDeviceType.Mouse)
+ {
+ mousePosition = null;
+ ReleasePointerCapture(e.Pointer);
+ }
+ }
+
+ private void OnPointerMoved(object sender, PointerRoutedEventArgs e)
+ {
+ if (mousePosition.HasValue)
+ {
+ var position = e.GetCurrentPoint(this).Position;
+ TranslateMap(new Point(position.X - mousePosition.Value.X, position.Y - mousePosition.Value.Y));
+ mousePosition = position;
+ }
+ }
+ }
+}
diff --git a/MapControl/Map.cs b/MapControl/Map.cs
index 17233df3..a73f290b 100644
--- a/MapControl/Map.cs
+++ b/MapControl/Map.cs
@@ -1,88 +1,34 @@
-// WPF MapControl - http://wpfmapcontrol.codeplex.com/
+// XAML Map Control - http://xamlmapcontrol.codeplex.com/
// Copyright © 2012 Clemens Fischer
// Licensed under the Microsoft Public License (Ms-PL)
-using System;
+#if WINRT
+using Windows.Foundation;
+#else
using System.Windows;
-using System.Windows.Input;
+#endif
namespace MapControl
{
///
/// MapBase with input event handling.
///
- public class Map : MapBase
+ public partial class Map : MapBase
{
private double mouseWheelZoom = 1d;
private Point? mousePosition;
+ public Map()
+ {
+ Initialize();
+ }
+
+ partial void Initialize();
+
public double MouseWheelZoom
{
get { return mouseWheelZoom; }
set { mouseWheelZoom = value; }
}
-
- protected override void OnMouseWheel(MouseWheelEventArgs e)
- {
- base.OnMouseWheel(e);
-
- ZoomMap(e.GetPosition(this), TargetZoomLevel + mouseWheelZoom * Math.Sign(e.Delta));
- }
-
- protected override void OnMouseRightButtonDown(MouseButtonEventArgs e)
- {
- base.OnMouseRightButtonDown(e);
-
- if (e.ClickCount == 2)
- {
- ZoomMap(e.GetPosition(this), Math.Ceiling(ZoomLevel - 1.5));
- }
- }
-
- protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e)
- {
- base.OnMouseLeftButtonDown(e);
-
- if (e.ClickCount == 1)
- {
- mousePosition = e.GetPosition(this);
- CaptureMouse();
- }
- else if (e.ClickCount == 2)
- {
- ZoomMap(e.GetPosition(this), Math.Floor(ZoomLevel + 1.5));
- }
- }
-
- protected override void OnMouseLeftButtonUp(MouseButtonEventArgs e)
- {
- base.OnMouseLeftButtonUp(e);
-
- if (mousePosition.HasValue)
- {
- mousePosition = null;
- ReleaseMouseCapture();
- }
- }
-
- protected override void OnMouseMove(MouseEventArgs e)
- {
- base.OnMouseMove(e);
-
- if (mousePosition.HasValue)
- {
- Point position = e.GetPosition(this);
- TranslateMap(position - mousePosition.Value);
- mousePosition = position;
- }
- }
-
- protected override void OnManipulationDelta(ManipulationDeltaEventArgs e)
- {
- base.OnManipulationDelta(e);
-
- ManipulationDelta d = e.DeltaManipulation;
- TransformMap(e.ManipulationOrigin, d.Translation, d.Rotation, (d.Scale.X + d.Scale.Y) / 2d);
- }
}
}
diff --git a/MapControl/MapBase.Silverlight.WinRT.cs b/MapControl/MapBase.Silverlight.WinRT.cs
new file mode 100644
index 00000000..02b987dc
--- /dev/null
+++ b/MapControl/MapBase.Silverlight.WinRT.cs
@@ -0,0 +1,49 @@
+// XAML Map Control - http://xamlmapcontrol.codeplex.com/
+// Copyright © 2012 Clemens Fischer
+// Licensed under the Microsoft Public License (Ms-PL)
+
+#if WINRT
+using Windows.Foundation;
+using Windows.UI.Xaml;
+using Windows.UI.Xaml.Media;
+using Windows.UI.Xaml.Media.Animation;
+#else
+using System.Windows;
+using System.Windows.Media;
+using System.Windows.Media.Animation;
+#endif
+
+namespace MapControl
+{
+ public partial class MapBase
+ {
+ // Set FillBehavior.HoldEnd to prevent animation from returning
+ // to local value before invoking the Completed handler
+ private const FillBehavior AnimationFillBehavior = FillBehavior.HoldEnd;
+
+ public static readonly DependencyProperty ForegroundProperty = DependencyProperty.Register(
+ "Foreground", typeof(Brush), typeof(MapBase), null);
+
+ partial void Initialize()
+ {
+ Clip = new RectangleGeometry();
+ Children.Add(tileContainer);
+
+ SizeChanged += OnRenderSizeChanged;
+ }
+
+ private void OnRenderSizeChanged(object sender, SizeChangedEventArgs e)
+ {
+ ((RectangleGeometry)Clip).Rect = new Rect(0d, 0d, RenderSize.Width, RenderSize.Height);
+ ResetTransformOrigin();
+ UpdateTransform();
+ }
+
+ private void SetTransformMatrixes(double scale)
+ {
+ scaleTransform.Matrix = new Matrix(scale, 0d, 0d, scale, 0d, 0d);
+ rotateTransform.Matrix = Matrix.Identity.Rotate(Heading);
+ scaleRotateTransform.Matrix = scaleTransform.Matrix.Multiply(rotateTransform.Matrix);
+ }
+ }
+}
diff --git a/MapControl/MapBase.WPF.cs b/MapControl/MapBase.WPF.cs
new file mode 100644
index 00000000..4578b1dd
--- /dev/null
+++ b/MapControl/MapBase.WPF.cs
@@ -0,0 +1,66 @@
+// XAML Map Control - http://xamlmapcontrol.codeplex.com/
+// Copyright © 2012 Clemens Fischer
+// Licensed under the Microsoft Public License (Ms-PL)
+
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Media;
+using System.Windows.Media.Animation;
+
+namespace MapControl
+{
+ public partial class MapBase
+ {
+ // FillBehavior must be set to Stop to re-enable local property values
+ private const FillBehavior AnimationFillBehavior = FillBehavior.Stop;
+
+ public static readonly DependencyProperty ForegroundProperty =
+ System.Windows.Controls.Control.ForegroundProperty.AddOwner(typeof(MapBase));
+
+ static MapBase()
+ {
+ UIElement.ClipToBoundsProperty.OverrideMetadata(
+ typeof(MapBase), new FrameworkPropertyMetadata(true));
+
+ Panel.BackgroundProperty.OverrideMetadata(
+ typeof(MapBase), new FrameworkPropertyMetadata(Brushes.Transparent));
+ }
+
+ partial void Initialize()
+ {
+ AddVisualChild(tileContainer);
+
+ SizeChanged += OnRenderSizeChanged;
+ }
+
+ private void OnRenderSizeChanged(object sender, SizeChangedEventArgs e)
+ {
+ ResetTransformOrigin();
+ UpdateTransform();
+ }
+
+ private void SetTransformMatrixes(double scale)
+ {
+ Matrix rotateMatrix = Matrix.Identity;
+ rotateMatrix.Rotate(Heading);
+ rotateTransform.Matrix = rotateMatrix;
+ scaleTransform.Matrix = new Matrix(scale, 0d, 0d, scale, 0d, 0d);
+ scaleRotateTransform.Matrix = scaleTransform.Matrix * rotateMatrix;
+ }
+
+ protected override int VisualChildrenCount
+ {
+ get { return InternalChildren.Count + 1; }
+ }
+
+ protected override Visual GetVisualChild(int index)
+ {
+ if (index == 0)
+ {
+ return tileContainer;
+ }
+
+ return InternalChildren[index - 1];
+ }
+ }
+}
diff --git a/MapControl/MapBase.cs b/MapControl/MapBase.cs
index ca3d702a..0821bdcd 100644
--- a/MapControl/MapBase.cs
+++ b/MapControl/MapBase.cs
@@ -1,170 +1,127 @@
-// WPF MapControl - http://wpfmapcontrol.codeplex.com/
+// XAML Map Control - http://xamlmapcontrol.codeplex.com/
// Copyright © 2012 Clemens Fischer
// Licensed under the Microsoft Public License (Ms-PL)
using System;
using System.Collections.Specialized;
using System.Linq;
+#if WINRT
+using Windows.Foundation;
+using Windows.UI;
+using Windows.UI.Xaml;
+using Windows.UI.Xaml.Media;
+using Windows.UI.Xaml.Media.Animation;
+#else
using System.Windows;
-using System.Windows.Controls;
using System.Windows.Media;
using System.Windows.Media.Animation;
+#endif
namespace MapControl
{
///
- /// The map control. Draws map content provided by the TileLayers or the BaseTileLayer property.
+ /// The map control. Draws map content provided by the TileLayers or the TileLayer property.
/// The visible map area is defined by the Center and ZoomLevel properties. The map can be rotated
/// by an angle that is given by the Heading property.
/// MapBase is a MapPanel and hence can contain map overlays like other MapPanels or MapItemsControls.
///
- public class MapBase : MapPanel
+ public partial class MapBase : MapPanel
{
public const double MeterPerDegree = 1852d * 60d;
-
- public static readonly DependencyProperty FontSizeProperty = Control.FontSizeProperty.AddOwner(typeof(MapBase));
- public static readonly DependencyProperty FontFamilyProperty = Control.FontFamilyProperty.AddOwner(typeof(MapBase));
- public static readonly DependencyProperty FontStyleProperty = Control.FontStyleProperty.AddOwner(typeof(MapBase));
- public static readonly DependencyProperty FontWeightProperty = Control.FontWeightProperty.AddOwner(typeof(MapBase));
- public static readonly DependencyProperty FontStretchProperty = Control.FontStretchProperty.AddOwner(typeof(MapBase));
- public static readonly DependencyProperty ForegroundProperty = Control.ForegroundProperty.AddOwner(typeof(MapBase));
+ public static TimeSpan AnimationDuration = TimeSpan.FromSeconds(0.5);
+ public static EasingFunctionBase AnimationEasingFunction = new QuadraticEase { EasingMode = EasingMode.EaseOut };
public static readonly DependencyProperty LightForegroundProperty = DependencyProperty.Register(
- "LightForeground", typeof(Brush), typeof(MapBase));
+ "LightForeground", typeof(Brush), typeof(MapBase), null);
public static readonly DependencyProperty DarkForegroundProperty = DependencyProperty.Register(
- "DarkForeground", typeof(Brush), typeof(MapBase));
+ "DarkForeground", typeof(Brush), typeof(MapBase), null);
public static readonly DependencyProperty LightBackgroundProperty = DependencyProperty.Register(
- "LightBackground", typeof(Brush), typeof(MapBase));
+ "LightBackground", typeof(Brush), typeof(MapBase), new PropertyMetadata(new SolidColorBrush(Colors.Transparent), null));
public static readonly DependencyProperty DarkBackgroundProperty = DependencyProperty.Register(
- "DarkBackground", typeof(Brush), typeof(MapBase));
+ "DarkBackground", typeof(Brush), typeof(MapBase), new PropertyMetadata(new SolidColorBrush(Colors.Transparent), null));
public static readonly DependencyProperty TileLayersProperty = DependencyProperty.Register(
- "TileLayers", typeof(TileLayerCollection), typeof(MapBase), new FrameworkPropertyMetadata(
- (o, e) => ((MapBase)o).TileLayersPropertyChanged((TileLayerCollection)e.OldValue, (TileLayerCollection)e.NewValue),
- (o, v) => ((MapBase)o).CoerceTileLayersProperty((TileLayerCollection)v)));
+ "TileLayers", typeof(TileLayerCollection), typeof(MapBase), new PropertyMetadata(null,
+ (o, e) => ((MapBase)o).TileLayersPropertyChanged((TileLayerCollection)e.OldValue, (TileLayerCollection)e.NewValue)));
- public static readonly DependencyProperty BaseTileLayerProperty = DependencyProperty.Register(
- "BaseTileLayer", typeof(TileLayer), typeof(MapBase), new FrameworkPropertyMetadata(
- (o, e) => ((MapBase)o).BaseTileLayerPropertyChanged((TileLayer)e.NewValue),
- (o, v) => ((MapBase)o).CoerceBaseTileLayerProperty((TileLayer)v)));
+ public static readonly DependencyProperty TileLayerProperty = DependencyProperty.Register(
+ "TileLayer", typeof(TileLayer), typeof(MapBase), new PropertyMetadata(null,
+ (o, e) => ((MapBase)o).TileLayerPropertyChanged((TileLayer)e.NewValue)));
public static readonly DependencyProperty TileOpacityProperty = DependencyProperty.Register(
- "TileOpacity", typeof(double), typeof(MapBase), new FrameworkPropertyMetadata(1d,
+ "TileOpacity", typeof(double), typeof(MapBase), new PropertyMetadata(1d,
(o, e) => ((MapBase)o).tileContainer.Opacity = (double)e.NewValue));
public static readonly DependencyProperty CenterProperty = DependencyProperty.Register(
- "Center", typeof(Location), typeof(MapBase), new FrameworkPropertyMetadata(new Location(), FrameworkPropertyMetadataOptions.BindsTwoWayByDefault,
- (o, e) => ((MapBase)o).CenterPropertyChanged((Location)e.NewValue),
- (o, v) => ((MapBase)o).CoerceCenterProperty((Location)v)));
+ "Center", typeof(Location), typeof(MapBase), new PropertyMetadata(new Location(),
+ (o, e) => ((MapBase)o).CenterPropertyChanged((Location)e.NewValue)));
public static readonly DependencyProperty TargetCenterProperty = DependencyProperty.Register(
- "TargetCenter", typeof(Location), typeof(MapBase), new FrameworkPropertyMetadata(new Location(), FrameworkPropertyMetadataOptions.BindsTwoWayByDefault,
- (o, e) => ((MapBase)o).TargetCenterPropertyChanged((Location)e.NewValue),
- (o, v) => ((MapBase)o).CoerceCenterProperty((Location)v)));
+ "TargetCenter", typeof(Location), typeof(MapBase), new PropertyMetadata(new Location(),
+ (o, e) => ((MapBase)o).TargetCenterPropertyChanged((Location)e.NewValue)));
+
+ internal static readonly DependencyProperty CenterPointProperty = DependencyProperty.Register(
+ "CenterPoint", typeof(Point), typeof(MapBase), new PropertyMetadata(new Point(),
+ (o, e) => ((MapBase)o).CenterPointPropertyChanged((Point)e.NewValue)));
+
+ public static readonly DependencyProperty MinZoomLevelProperty = DependencyProperty.Register(
+ "MinZoomLevel", typeof(double), typeof(MapBase), new PropertyMetadata(1d,
+ (o, e) => ((MapBase)o).MinZoomLevelPropertyChanged((double)e.NewValue)));
+
+ public static readonly DependencyProperty MaxZoomLevelProperty = DependencyProperty.Register(
+ "MaxZoomLevel", typeof(double), typeof(MapBase), new PropertyMetadata(18d,
+ (o, e) => ((MapBase)o).MaxZoomLevelPropertyChanged((double)e.NewValue)));
public static readonly DependencyProperty ZoomLevelProperty = DependencyProperty.Register(
- "ZoomLevel", typeof(double), typeof(MapBase), new FrameworkPropertyMetadata(1d, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault,
- (o, e) => ((MapBase)o).ZoomLevelPropertyChanged((double)e.NewValue),
- (o, v) => ((MapBase)o).CoerceZoomLevelProperty((double)v)));
+ "ZoomLevel", typeof(double), typeof(MapBase), new PropertyMetadata(1d,
+ (o, e) => ((MapBase)o).ZoomLevelPropertyChanged((double)e.NewValue)));
public static readonly DependencyProperty TargetZoomLevelProperty = DependencyProperty.Register(
- "TargetZoomLevel", typeof(double), typeof(MapBase), new FrameworkPropertyMetadata(1d, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault,
- (o, e) => ((MapBase)o).TargetZoomLevelPropertyChanged((double)e.NewValue),
- (o, v) => ((MapBase)o).CoerceZoomLevelProperty((double)v)));
+ "TargetZoomLevel", typeof(double), typeof(MapBase), new PropertyMetadata(1d,
+ (o, e) => ((MapBase)o).TargetZoomLevelPropertyChanged((double)e.NewValue)));
public static readonly DependencyProperty HeadingProperty = DependencyProperty.Register(
- "Heading", typeof(double), typeof(MapBase), new FrameworkPropertyMetadata(0d, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault,
- (o, e) => ((MapBase)o).HeadingPropertyChanged((double)e.NewValue),
- (o, v) => ((MapBase)o).CoerceHeadingProperty((double)v)));
+ "Heading", typeof(double), typeof(MapBase), new PropertyMetadata(0d,
+ (o, e) => ((MapBase)o).HeadingPropertyChanged((double)e.NewValue)));
public static readonly DependencyProperty TargetHeadingProperty = DependencyProperty.Register(
- "TargetHeading", typeof(double), typeof(MapBase), new FrameworkPropertyMetadata(0d, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault,
- (o, e) => ((MapBase)o).TargetHeadingPropertyChanged((double)e.NewValue),
- (o, v) => ((MapBase)o).CoerceHeadingProperty((double)v)));
+ "TargetHeading", typeof(double), typeof(MapBase), new PropertyMetadata(0d,
+ (o, e) => ((MapBase)o).TargetHeadingPropertyChanged((double)e.NewValue)));
- private static readonly DependencyPropertyKey CenterScalePropertyKey = DependencyProperty.RegisterReadOnly(
+ public static readonly DependencyProperty CenterScaleProperty = DependencyProperty.Register(
"CenterScale", typeof(double), typeof(MapBase), null);
- public static readonly DependencyProperty CenterScaleProperty = CenterScalePropertyKey.DependencyProperty;
-
private readonly TileContainer tileContainer = new TileContainer();
private readonly MapTransform mapTransform = new MercatorTransform();
- private readonly ScaleTransform scaleTransform = new ScaleTransform();
- private readonly RotateTransform rotateTransform = new RotateTransform();
+ private readonly MatrixTransform scaleTransform = new MatrixTransform();
+ private readonly MatrixTransform rotateTransform = new MatrixTransform();
private readonly MatrixTransform scaleRotateTransform = new MatrixTransform();
private Location transformOrigin;
private Point viewportOrigin;
- private LocationAnimation centerAnimation;
+ private PointAnimation centerAnimation;
private DoubleAnimation zoomLevelAnimation;
private DoubleAnimation headingAnimation;
- private bool updateTransform = true;
+ private bool internalPropertyChange;
public MapBase()
{
- ClipToBounds = true;
- MinZoomLevel = 1;
- MaxZoomLevel = 20;
-
- AddVisualChild(tileContainer);
+ Background = LightBackground;
TileLayers = new TileLayerCollection();
+ Initialize();
- SetValue(ParentMapPropertyKey, this);
-
- Loaded += (o, e) =>
- {
- if (BaseTileLayer == null)
- {
- BaseTileLayer = new TileLayer
- {
- SourceName = "OpenStreetMap",
- Description = "© {y} OpenStreetMap Contributors, CC-BY-SA",
- TileSource = new TileSource("http://{c}.tile.openstreetmap.org/{z}/{x}/{y}.png")
- };
- }
- };
+ Loaded += OnLoaded;
}
+ partial void Initialize();
+
///
/// Raised when the current viewport has changed.
///
public event EventHandler ViewportChanged;
- public double MinZoomLevel { get; set; }
- public double MaxZoomLevel { get; set; }
-
- public double FontSize
- {
- get { return (double)GetValue(FontSizeProperty); }
- set { SetValue(FontSizeProperty, value); }
- }
-
- public FontFamily FontFamily
- {
- get { return (FontFamily)GetValue(FontFamilyProperty); }
- set { SetValue(FontFamilyProperty, value); }
- }
-
- public FontStyle FontStyle
- {
- get { return (FontStyle)GetValue(FontStyleProperty); }
- set { SetValue(FontStyleProperty, value); }
- }
-
- public FontWeight FontWeight
- {
- get { return (FontWeight)GetValue(FontWeightProperty); }
- set { SetValue(FontWeightProperty, value); }
- }
-
- public FontStretch FontStretch
- {
- get { return (FontStretch)GetValue(FontStretchProperty); }
- set { SetValue(FontStretchProperty, value); }
- }
-
public Brush Foreground
{
get { return (Brush)GetValue(ForegroundProperty); }
@@ -207,10 +164,10 @@ namespace MapControl
///
/// Gets or sets the base TileLayer used by this Map, i.e. TileLayers[0].
///
- public TileLayer BaseTileLayer
+ public TileLayer TileLayer
{
- get { return (TileLayer)GetValue(BaseTileLayerProperty); }
- set { SetValue(BaseTileLayerProperty, value); }
+ get { return (TileLayer)GetValue(TileLayerProperty); }
+ set { SetValue(TileLayerProperty, value); }
}
///
@@ -240,6 +197,26 @@ namespace MapControl
set { SetValue(TargetCenterProperty, value); }
}
+ ///
+ /// Gets or sets the minimum value of the ZoomLevel and TargetZommLevel properties.
+ /// Must be greater than or equal to zero and less than or equal to MaxZoomLevel.
+ ///
+ public double MinZoomLevel
+ {
+ get { return (double)GetValue(MinZoomLevelProperty); }
+ set { SetValue(MinZoomLevelProperty, value); }
+ }
+
+ ///
+ /// Gets or sets the maximum value of the ZoomLevel and TargetZommLevel properties.
+ /// Must be greater than or equal to MinZoomLevel and less than or equal to 20.
+ ///
+ public double MaxZoomLevel
+ {
+ get { return (double)GetValue(MaxZoomLevelProperty); }
+ set { SetValue(MaxZoomLevelProperty, value); }
+ }
+
///
/// Gets or sets the map zoom level.
///
@@ -282,7 +259,7 @@ namespace MapControl
public double CenterScale
{
get { return (double)GetValue(CenterScaleProperty); }
- private set { SetValue(CenterScalePropertyKey, value); }
+ private set { SetValue(CenterScaleProperty, value); }
}
///
@@ -326,12 +303,20 @@ namespace MapControl
get { return scaleRotateTransform; }
}
+ ///
+ /// Gets the map scale at the specified location as viewport coordinate units (pixels) per meter.
+ ///
+ public double GetMapScale(Location location)
+ {
+ return mapTransform.RelativeScale(location) * Math.Pow(2d, ZoomLevel) * 256d / (MeterPerDegree * 360d);
+ }
+
///
/// Transforms a geographic location to a viewport coordinates point.
///
public Point LocationToViewportPoint(Location location)
{
- return ViewportTransform.Transform(MapTransform.Transform(location));
+ return ViewportTransform.Transform(mapTransform.Transform(location));
}
///
@@ -339,7 +324,7 @@ namespace MapControl
///
public Location ViewportPointToLocation(Point point)
{
- return MapTransform.TransformBack(ViewportTransform.Inverse.Transform(point));
+ return mapTransform.Transform(ViewportTransform.Inverse.Transform(point));
}
///
@@ -360,7 +345,7 @@ namespace MapControl
{
viewportOrigin.X = Math.Min(Math.Max(origin.X, 0d), RenderSize.Width);
viewportOrigin.Y = Math.Min(Math.Max(origin.Y, 0d), RenderSize.Height);
- transformOrigin = CoerceCenterProperty(ViewportPointToLocation(viewportOrigin));
+ transformOrigin = CoerceLocation(ViewportPointToLocation(viewportOrigin));
}
///
@@ -375,18 +360,19 @@ namespace MapControl
///
/// Changes the Center property according to the specified translation in viewport coordinates.
///
- public void TranslateMap(Vector translation)
+ public void TranslateMap(Point translation)
{
if (translation.X != 0d || translation.Y != 0d)
{
if (transformOrigin != null)
{
- viewportOrigin += translation;
+ viewportOrigin.X += translation.X;
+ viewportOrigin.Y += translation.Y;
UpdateTransform();
}
else
{
- Center = ViewportPointToLocation(viewportOrigin - translation);
+ Center = ViewportPointToLocation(new Point(viewportOrigin.X - translation.X, viewportOrigin.Y - translation.Y));
}
}
}
@@ -396,15 +382,13 @@ namespace MapControl
/// viewport coordinate translation, rotation and scale delta values. Rotation and scaling
/// is performed relative to the specified origin point in viewport coordinates.
///
- public void TransformMap(Point origin, Vector translation, double rotation, double scale)
+ public void TransformMap(Point origin, Point translation, double rotation, double scale)
{
if (rotation != 0d || scale != 1d)
{
SetTransformOrigin(origin);
- updateTransform = false;
- Heading = (((Heading + rotation) % 360d) + 360d) % 360d;
- ZoomLevel += Math.Log(scale, 2d);
- updateTransform = true;
+ SetProperty(HeadingProperty, CoerceHeading(Heading + rotation));
+ SetProperty(ZoomLevelProperty, CoerceZoomLevel(ZoomLevel + Math.Log(scale, 2d)));
UpdateTransform();
}
@@ -418,7 +402,7 @@ namespace MapControl
///
public void ZoomMap(Point origin, double zoomLevel)
{
- double targetZoomLebel = TargetZoomLevel;
+ var targetZoomLebel = TargetZoomLevel;
TargetZoomLevel = zoomLevel;
if (TargetZoomLevel != targetZoomLebel) // TargetZoomLevel might be coerced
@@ -427,37 +411,6 @@ namespace MapControl
}
}
- ///
- /// Gets the map scale at the specified location as viewport coordinate units (pixels) per meter.
- ///
- public double GetMapScale(Location location)
- {
- return mapTransform.RelativeScale(location) * Math.Pow(2d, ZoomLevel) * 256d / (MeterPerDegree * 360d);
- }
-
- protected override int VisualChildrenCount
- {
- get { return InternalChildren.Count + 1; }
- }
-
- protected override Visual GetVisualChild(int index)
- {
- if (index == 0)
- {
- return tileContainer;
- }
-
- return InternalChildren[index - 1];
- }
-
- protected override void OnRenderSizeChanged(SizeChangedInfo sizeInfo)
- {
- base.OnRenderSizeChanged(sizeInfo);
-
- ResetTransformOrigin();
- UpdateTransform();
- }
-
protected override void OnViewportChanged()
{
base.OnViewportChanged();
@@ -468,6 +421,18 @@ namespace MapControl
}
}
+ private void OnLoaded(object sender, RoutedEventArgs e)
+ {
+ Loaded -= OnLoaded;
+
+ if (TileLayer == null)
+ {
+ TileLayer = TileLayer.Default;
+ }
+
+ UpdateTransform();
+ }
+
private void TileLayerCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
{
switch (e.Action)
@@ -477,12 +442,13 @@ namespace MapControl
break;
case NotifyCollectionChangedAction.Remove:
- tileContainer.RemoveTileLayers(e.OldStartingIndex, e.OldItems.Cast());
+ tileContainer.RemoveTileLayers(e.OldStartingIndex, e.OldItems.Count);
break;
-
+#if !SILVERLIGHT
case NotifyCollectionChangedAction.Move:
+#endif
case NotifyCollectionChangedAction.Replace:
- tileContainer.RemoveTileLayers(e.OldStartingIndex, e.OldItems.Cast());
+ tileContainer.RemoveTileLayers(e.NewStartingIndex, e.OldItems.Count);
tileContainer.AddTileLayers(e.NewStartingIndex, e.NewItems.Cast());
break;
@@ -493,9 +459,12 @@ namespace MapControl
tileContainer.AddTileLayers(0, e.NewItems.Cast());
}
break;
+
+ default:
+ break;
}
- UpdateBaseTileLayer();
+ UpdateTileLayer();
}
private void TileLayersPropertyChanged(TileLayerCollection oldTileLayers, TileLayerCollection newTileLayers)
@@ -513,34 +482,29 @@ namespace MapControl
tileContainer.AddTileLayers(0, newTileLayers);
}
- UpdateBaseTileLayer();
+ UpdateTileLayer();
}
- private TileLayerCollection CoerceTileLayersProperty(TileLayerCollection tileLayers)
+ private void TileLayerPropertyChanged(TileLayer tileLayer)
{
- if (tileLayers == null)
+ if (tileLayer != null)
{
- tileLayers = new TileLayerCollection();
- }
+ if (TileLayers == null)
+ {
+ TileLayers = new TileLayerCollection();
+ }
- return tileLayers;
- }
-
- private void BaseTileLayerPropertyChanged(TileLayer baseTileLayer)
- {
- if (baseTileLayer != null)
- {
if (TileLayers.Count == 0)
{
- TileLayers.Add(baseTileLayer);
+ TileLayers.Add(tileLayer);
}
- else if (TileLayers[0] != baseTileLayer)
+ else if (TileLayers[0] != tileLayer)
{
- TileLayers[0] = baseTileLayer;
+ TileLayers[0] = tileLayer;
}
}
- if (baseTileLayer != null && baseTileLayer.HasDarkBackground)
+ if (tileLayer != null && tileLayer.HasDarkBackground)
{
if (DarkForeground != null)
{
@@ -566,93 +530,175 @@ namespace MapControl
}
}
- private TileLayer CoerceBaseTileLayerProperty(TileLayer baseTileLayer)
+ private void UpdateTileLayer()
{
- if (baseTileLayer == null && TileLayers.Count > 0)
- {
- baseTileLayer = TileLayers[0];
- }
+ var tileLayer = TileLayers.FirstOrDefault();
- return baseTileLayer;
+ if (TileLayer != tileLayer)
+ {
+ TileLayer = tileLayer;
+ }
}
- private void UpdateBaseTileLayer()
+ private void SetProperty(DependencyProperty property, object value)
{
- TileLayer baseTileLayer = TileLayers.FirstOrDefault();
+ internalPropertyChange = true;
+ SetValue(property, value);
+ internalPropertyChange = false;
+ }
- if (BaseTileLayer != baseTileLayer)
+ private Location CoerceLocation(Location location)
+ {
+ return new Location(
+ Math.Min(Math.Max(location.Latitude, -mapTransform.MaxLatitude), mapTransform.MaxLatitude),
+ Location.NormalizeLongitude(location.Longitude));
+ }
+
+ private bool CoerceCenterProperty(DependencyProperty property, ref Location value)
+ {
+ Location coercedValue = CoerceLocation(value);
+
+ if (!coercedValue.Equals(value))
{
- BaseTileLayer = baseTileLayer;
+ SetProperty(property, coercedValue);
}
+
+ return coercedValue != value;
}
private void CenterPropertyChanged(Location center)
{
- if (updateTransform)
+ if (!internalPropertyChange)
{
+ CoerceCenterProperty(CenterProperty, ref center);
ResetTransformOrigin();
UpdateTransform();
- }
- if (centerAnimation == null)
- {
- TargetCenter = center;
+ if (centerAnimation == null)
+ {
+ SetProperty(TargetCenterProperty, center);
+ SetProperty(CenterPointProperty, new Point(center.Longitude, center.Latitude));
+ }
}
}
private void TargetCenterPropertyChanged(Location targetCenter)
{
- if (targetCenter != Center)
+ if (!internalPropertyChange)
{
- if (centerAnimation != null)
+ CoerceCenterProperty(TargetCenterProperty, ref targetCenter);
+
+ if (targetCenter != Center)
{
- centerAnimation.Completed -= CenterAnimationCompleted;
+ if (centerAnimation != null)
+ {
+ centerAnimation.Completed -= CenterAnimationCompleted;
+ }
+
+ // animate private CenterPoint property by PointAnimation
+ centerAnimation = new PointAnimation
+ {
+ From = new Point(Center.Longitude, Center.Latitude),
+ To = new Point(targetCenter.Longitude, targetCenter.Latitude),
+ Duration = AnimationDuration,
+ FillBehavior = AnimationFillBehavior,
+ EasingFunction = AnimationEasingFunction
+ };
+
+ centerAnimation.Completed += CenterAnimationCompleted;
+ this.BeginAnimation(CenterPointProperty, centerAnimation);
}
-
- centerAnimation = new LocationAnimation
- {
- From = Center,
- To = targetCenter,
- Duration = TimeSpan.FromSeconds(0.5),
- FillBehavior = FillBehavior.Stop,
- EasingFunction = new QuadraticEase { EasingMode = EasingMode.EaseOut }
- };
-
- centerAnimation.Completed += CenterAnimationCompleted;
- BeginAnimation(CenterProperty, centerAnimation);
}
}
- private void CenterAnimationCompleted(object sender, EventArgs e)
+ private void CenterAnimationCompleted(object sender, object e)
{
- Center = TargetCenter;
- centerAnimation.Completed -= CenterAnimationCompleted;
- centerAnimation = null;
+ if (centerAnimation != null)
+ {
+ centerAnimation.Completed -= CenterAnimationCompleted;
+ centerAnimation = null;
+
+ SetProperty(CenterProperty, TargetCenter);
+ SetProperty(CenterPointProperty, new Point(TargetCenter.Longitude, TargetCenter.Latitude));
+ ResetTransformOrigin();
+ UpdateTransform();
+ }
}
- private Location CoerceCenterProperty(Location location)
+ private void CenterPointPropertyChanged(Point centerPoint)
{
- location.Latitude = Math.Min(Math.Max(location.Latitude, -MapTransform.MaxLatitude), MapTransform.MaxLatitude);
- location.Longitude = Location.NormalizeLongitude(location.Longitude);
- return location;
+ if (!internalPropertyChange)
+ {
+ SetProperty(CenterProperty, new Location(centerPoint.Y, centerPoint.X));
+ ResetTransformOrigin();
+ UpdateTransform();
+ }
+ }
+
+ private void MinZoomLevelPropertyChanged(double minZoomLevel)
+ {
+ var coercedValue = Math.Min(Math.Max(minZoomLevel, 0d), MaxZoomLevel);
+
+ if (coercedValue != minZoomLevel)
+ {
+ SetProperty(MinZoomLevelProperty, coercedValue);
+ }
+ else if (ZoomLevel < minZoomLevel)
+ {
+ ZoomLevel = minZoomLevel;
+ }
+ }
+
+ private void MaxZoomLevelPropertyChanged(double maxZoomLevel)
+ {
+ var coercedValue = Math.Min(Math.Max(maxZoomLevel, MinZoomLevel), 20d);
+
+ if (coercedValue != maxZoomLevel)
+ {
+ SetProperty(MaxZoomLevelProperty, coercedValue);
+ }
+ else if (ZoomLevel > maxZoomLevel)
+ {
+ ZoomLevel = maxZoomLevel;
+ }
+ }
+
+ private double CoerceZoomLevel(double value)
+ {
+ return Math.Min(Math.Max(value, MinZoomLevel), MaxZoomLevel);
+ }
+
+ private bool CoerceZoomLevelProperty(DependencyProperty property, ref double value)
+ {
+ var coercedValue = CoerceZoomLevel(value);
+
+ if (coercedValue != value)
+ {
+ SetProperty(property, coercedValue);
+ }
+
+ return coercedValue != value;
}
private void ZoomLevelPropertyChanged(double zoomLevel)
{
- if (updateTransform)
+ if (!internalPropertyChange &&
+ !CoerceZoomLevelProperty(ZoomLevelProperty, ref zoomLevel))
{
UpdateTransform();
- }
- if (zoomLevelAnimation == null)
- {
- TargetZoomLevel = zoomLevel;
+ if (zoomLevelAnimation == null)
+ {
+ SetProperty(TargetZoomLevelProperty, zoomLevel);
+ }
}
}
private void TargetZoomLevelPropertyChanged(double targetZoomLevel)
{
- if (targetZoomLevel != ZoomLevel)
+ if (!internalPropertyChange &&
+ !CoerceZoomLevelProperty(TargetZoomLevelProperty, ref targetZoomLevel) &&
+ targetZoomLevel != ZoomLevel)
{
if (zoomLevelAnimation != null)
{
@@ -661,88 +707,109 @@ namespace MapControl
zoomLevelAnimation = new DoubleAnimation
{
- From = ZoomLevel,
To = targetZoomLevel,
- Duration = TimeSpan.FromSeconds(0.5),
- FillBehavior = FillBehavior.Stop,
- EasingFunction = new QuadraticEase { EasingMode = EasingMode.EaseOut }
+ Duration = AnimationDuration,
+ FillBehavior = AnimationFillBehavior,
+ EasingFunction = AnimationEasingFunction
};
zoomLevelAnimation.Completed += ZoomLevelAnimationCompleted;
- BeginAnimation(ZoomLevelProperty, zoomLevelAnimation);
+ this.BeginAnimation(ZoomLevelProperty, zoomLevelAnimation);
}
}
- private void ZoomLevelAnimationCompleted(object sender, EventArgs e)
+ private void ZoomLevelAnimationCompleted(object sender, object e)
{
- ZoomLevel = TargetZoomLevel;
- zoomLevelAnimation.Completed -= ZoomLevelAnimationCompleted;
- zoomLevelAnimation = null;
- ResetTransformOrigin();
+ if (zoomLevelAnimation != null)
+ {
+ zoomLevelAnimation.Completed -= ZoomLevelAnimationCompleted;
+ zoomLevelAnimation = null;
+
+ SetProperty(ZoomLevelProperty, TargetZoomLevel);
+ UpdateTransform();
+ ResetTransformOrigin();
+ }
}
- private double CoerceZoomLevelProperty(double zoomLevel)
+ private double CoerceHeading(double value)
{
- return Math.Min(Math.Max(zoomLevel, MinZoomLevel), MaxZoomLevel);
+ return (value >= -180d && value <= 360d) ? value : ((value + 360d) % 360d);
+ }
+
+ private bool CoerceHeadingProperty(DependencyProperty property, ref double value)
+ {
+ var coercedValue = CoerceHeading(value);
+
+ if (coercedValue != value)
+ {
+ SetProperty(property, coercedValue);
+ }
+
+ return coercedValue != value;
}
private void HeadingPropertyChanged(double heading)
{
- if (updateTransform)
+ if (!internalPropertyChange)
{
+ CoerceHeadingProperty(HeadingProperty, ref heading);
UpdateTransform();
- }
- if (headingAnimation == null)
- {
- TargetHeading = heading;
+ if (headingAnimation == null)
+ {
+ SetProperty(TargetHeadingProperty, heading);
+ }
}
}
private void TargetHeadingPropertyChanged(double targetHeading)
{
- if (targetHeading != Heading)
+ if (!internalPropertyChange)
{
- if (headingAnimation != null)
+ CoerceHeadingProperty(TargetHeadingProperty, ref targetHeading);
+
+ if (targetHeading != Heading)
{
- headingAnimation.Completed -= HeadingAnimationCompleted;
+ var delta = targetHeading - Heading;
+
+ if (delta > 180d)
+ {
+ delta -= 360d;
+ }
+ else if (delta < -180d)
+ {
+ delta += 360d;
+ }
+
+ if (headingAnimation != null)
+ {
+ headingAnimation.Completed -= HeadingAnimationCompleted;
+ }
+
+ headingAnimation = new DoubleAnimation
+ {
+ By = delta,
+ Duration = AnimationDuration,
+ FillBehavior = AnimationFillBehavior,
+ EasingFunction = AnimationEasingFunction
+ };
+
+ headingAnimation.Completed += HeadingAnimationCompleted;
+ this.BeginAnimation(HeadingProperty, headingAnimation);
}
-
- double delta = targetHeading - Heading;
-
- if (delta > 180d)
- {
- delta -= 360d;
- }
- else if (delta < -180d)
- {
- delta += 360d;
- }
-
- headingAnimation = new DoubleAnimation
- {
- From = Heading,
- By = delta,
- Duration = TimeSpan.FromSeconds(0.5),
- FillBehavior = FillBehavior.Stop,
- EasingFunction = new QuadraticEase { EasingMode = EasingMode.EaseOut }
- };
-
- headingAnimation.Completed += HeadingAnimationCompleted;
- BeginAnimation(HeadingProperty, headingAnimation);
}
}
- private void HeadingAnimationCompleted(object sender, EventArgs e)
+ private void HeadingAnimationCompleted(object sender, object e)
{
- Heading = TargetHeading;
- headingAnimation.Completed -= HeadingAnimationCompleted;
- headingAnimation = null;
- }
+ if (headingAnimation != null)
+ {
+ headingAnimation.Completed -= HeadingAnimationCompleted;
+ headingAnimation = null;
- private double CoerceHeadingProperty(double heading)
- {
- return ((heading % 360d) + 360d) % 360d;
+ SetProperty(HeadingProperty, TargetHeading);
+ UpdateTransform();
+ }
}
private void UpdateTransform()
@@ -751,23 +818,17 @@ namespace MapControl
if (transformOrigin != null)
{
- scale = tileContainer.SetViewportTransform(ZoomLevel, Heading, MapTransform.Transform(transformOrigin), viewportOrigin, RenderSize);
- updateTransform = false;
- Center = ViewportPointToLocation(new Point(RenderSize.Width / 2d, RenderSize.Height / 2d));
- updateTransform = true;
+ scale = tileContainer.SetViewportTransform(ZoomLevel, Heading, mapTransform.Transform(transformOrigin), viewportOrigin, RenderSize);
+ SetProperty(CenterProperty, ViewportPointToLocation(new Point(RenderSize.Width / 2d, RenderSize.Height / 2d)));
}
else
{
- scale = tileContainer.SetViewportTransform(ZoomLevel, Heading, MapTransform.Transform(Center), viewportOrigin, RenderSize);
+ scale = tileContainer.SetViewportTransform(ZoomLevel, Heading, mapTransform.Transform(Center), viewportOrigin, RenderSize);
}
- scale *= MapTransform.RelativeScale(Center) / MeterPerDegree; // Pixels per meter at center latitude
-
+ scale *= mapTransform.RelativeScale(Center) / MeterPerDegree; // Pixels per meter at center latitude
CenterScale = scale;
- scaleTransform.ScaleX = scale;
- scaleTransform.ScaleY = scale;
- rotateTransform.Angle = Heading;
- scaleRotateTransform.Matrix = scaleTransform.Value * rotateTransform.Value;
+ SetTransformMatrixes(scale);
OnViewportChanged();
}
diff --git a/MapControl/MapControl.Silverlight.csproj b/MapControl/MapControl.Silverlight.csproj
new file mode 100644
index 00000000..f2183a52
--- /dev/null
+++ b/MapControl/MapControl.Silverlight.csproj
@@ -0,0 +1,132 @@
+
+
+
+ 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
+
+
+
+
+
+
+ $(TargetFrameworkDirectory)System.Core.dll
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Designer
+ MSBuild:Compile
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/MapControl/MapControl.Silverlight.csproj.user b/MapControl/MapControl.Silverlight.csproj.user
new file mode 100644
index 00000000..8b80b1f4
--- /dev/null
+++ b/MapControl/MapControl.Silverlight.csproj.user
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+ DynamicPage
+ True
+ False
+ False
+
+
+
+
+
+
+
+
+ True
+
+
+ True
+
+
+
+
+
\ No newline at end of file
diff --git a/MapControl/MapControl.csproj b/MapControl/MapControl.WPF.csproj
similarity index 65%
rename from MapControl/MapControl.csproj
rename to MapControl/MapControl.WPF.csproj
index 7a9ed90e..461cc10d 100644
--- a/MapControl/MapControl.csproj
+++ b/MapControl/MapControl.WPF.csproj
@@ -1,19 +1,17 @@

+
Debug
AnyCPU
- 8.0.30703
- 2.0
- {06481252-2310-414A-B9FC-D5739FDF6BD3}
+ {226F3575-B683-446D-A2F0-181291DC8787}
Library
Properties
MapControl
- MapControl
- v4.0
+ MapControl.WPF
+ v4.5
512
-
-
+
true
@@ -23,17 +21,19 @@
TRACE;DEBUG
prompt
4
- false
+ false
none
true
bin\Release\
-
-
+ TRACE
prompt
4
- false
+ false
+
+
+ OnBuildSuccess
@@ -45,40 +45,62 @@
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+ Code
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
- MSBuild:Compile
Designer
+ MSBuild:Compile
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/MapControl/WinRT/Properties/AssemblyInfo.cs b/MapControl/WinRT/Properties/AssemblyInfo.cs
new file mode 100644
index 00000000..b0b5435a
--- /dev/null
+++ b/MapControl/WinRT/Properties/AssemblyInfo.cs
@@ -0,0 +1,14 @@
+using System.Reflection;
+using System.Runtime.InteropServices;
+
+[assembly: AssemblyTitle("MapControl.WinRT")]
+[assembly: AssemblyDescription("XAML Map Control for Windows Runtime")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("Clemens Fischer")]
+[assembly: AssemblyProduct("XAML Map Control")]
+[assembly: AssemblyCopyright("Copyright © 2012 Clemens Fischer")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
+[assembly: ComVisible(false)]
diff --git a/MapControl/WinRT/ReadMe.txt b/MapControl/WinRT/ReadMe.txt
new file mode 100644
index 00000000..b1640122
--- /dev/null
+++ b/MapControl/WinRT/ReadMe.txt
@@ -0,0 +1,4 @@
+
+The Visual Studio Project for Windows Runtime resides in a seperate folder
+MapControl/WinRT, because it needs to have its own Themes/Generic.xaml file.
+Output is generated to ../bin.
\ No newline at end of file
diff --git a/MapControl/WinRT/Themes/Generic.xaml b/MapControl/WinRT/Themes/Generic.xaml
new file mode 100644
index 00000000..99f00547
--- /dev/null
+++ b/MapControl/WinRT/Themes/Generic.xaml
@@ -0,0 +1,64 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/SampleApps/SampleApplication/Properties/AssemblyInfo.cs b/SampleApps/SampleApplication/Properties/AssemblyInfo.cs
deleted file mode 100644
index 37bee287..00000000
--- a/SampleApps/SampleApplication/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,55 +0,0 @@
-using System.Reflection;
-using System.Resources;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Windows;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("SampleApplication")]
-[assembly: AssemblyDescription("WPF Map Control Sample Application")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("Clemens Fischer")]
-[assembly: AssemblyProduct("WPF Map Control")]
-[assembly: AssemblyCopyright("Copyright © 2012 Clemens Fischer")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-//In order to begin building localizable applications, set
-//CultureYouAreCodingWith in your .csproj file
-//inside a . For example, if you are using US english
-//in your source files, set the to en-US. Then uncomment
-//the NeutralResourceLanguage attribute below. Update the "en-US" in
-//the line below to match the UICulture setting in the project file.
-
-//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
-
-
-[assembly: ThemeInfo(
- ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
- //(used if a resource is not found in the page,
- // or application resource dictionaries)
- ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
- //(used if a resource is not found in the page,
- // app, or any theme specific resource dictionaries)
-)]
-
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/SampleApps/SilverlightApplication.Web/ClientBin/SilverlightApplication.xap b/SampleApps/SilverlightApplication.Web/ClientBin/SilverlightApplication.xap
new file mode 100644
index 00000000..8515eaf1
Binary files /dev/null and b/SampleApps/SilverlightApplication.Web/ClientBin/SilverlightApplication.xap differ
diff --git a/SampleApps/SilverlightApplication.Web/Properties/AssemblyInfo.cs b/SampleApps/SilverlightApplication.Web/Properties/AssemblyInfo.cs
new file mode 100644
index 00000000..a3649625
--- /dev/null
+++ b/SampleApps/SilverlightApplication.Web/Properties/AssemblyInfo.cs
@@ -0,0 +1,14 @@
+using System.Reflection;
+using System.Runtime.InteropServices;
+
+[assembly: AssemblyTitle("SilverlightApplication.Web")]
+[assembly: AssemblyDescription("XAML Map Control Sample Application for Silverlight")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("Clemens Fischer")]
+[assembly: AssemblyProduct("XAML Map Control")]
+[assembly: AssemblyCopyright("Copyright © 2012 Clemens Fischer")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
+[assembly: ComVisible(false)]
diff --git a/SampleApps/SilverlightApplication.Web/Silverlight.js b/SampleApps/SilverlightApplication.Web/Silverlight.js
new file mode 100644
index 00000000..80ff3970
--- /dev/null
+++ b/SampleApps/SilverlightApplication.Web/Silverlight.js
@@ -0,0 +1,2 @@
+//v2.0.30511.0
+if(!window.Silverlight)window.Silverlight={};Silverlight._silverlightCount=0;Silverlight.__onSilverlightInstalledCalled=false;Silverlight.fwlinkRoot="http://go2.microsoft.com/fwlink/?LinkID=";Silverlight.__installationEventFired=false;Silverlight.onGetSilverlight=null;Silverlight.onSilverlightInstalled=function(){window.location.reload(false)};Silverlight.isInstalled=function(b){if(b==undefined)b=null;var a=false,m=null;try{var i=null,j=false;if(window.ActiveXObject)try{i=new ActiveXObject("AgControl.AgControl");if(b===null)a=true;else if(i.IsVersionSupported(b))a=true;i=null}catch(l){j=true}else j=true;if(j){var k=navigator.plugins["Silverlight Plug-In"];if(k)if(b===null)a=true;else{var h=k.description;if(h==="1.0.30226.2")h="2.0.30226.2";var c=h.split(".");while(c.length>3)c.pop();while(c.length<4)c.push(0);var e=b.split(".");while(e.length>4)e.pop();var d,g,f=0;do{d=parseInt(e[f]);g=parseInt(c[f]);f++}while(f");delete a.id;delete a.width;delete a.height;for(var c in a)if(a[c])b.push('');b.push("");return b.join("")};Silverlight.createObjectEx=function(b){var a=b,c=Silverlight.createObject(a.source,a.parentElement,a.id,a.properties,a.events,a.initParams,a.context);if(a.parentElement==null)return c};Silverlight.buildPromptHTML=function(b){var a="",d=Silverlight.fwlinkRoot,c=b.version;if(b.alt)a=b.alt;else{if(!c)c="";a="
";a=a.replace("{1}",c);a=a.replace("{2}",d+"108181")}return a};Silverlight.getSilverlight=function(e){if(Silverlight.onGetSilverlight)Silverlight.onGetSilverlight();var b="",a=String(e).split(".");if(a.length>1){var c=parseInt(a[0]);if(isNaN(c)||c<2)b="1.0";else b=a[0]+"."+a[1]}var d="";if(b.match(/^\d+\056\d+$/))d="&v="+b;Silverlight.followFWLink("149156"+d)};Silverlight.followFWLink=function(a){top.location=Silverlight.fwlinkRoot+String(a)};Silverlight.HtmlAttributeEncode=function(c){var a,b="";if(c==null)return null;for(var d=0;d96&&a<123||a>64&&a<91||a>43&&a<58&&a!=47||a==95)b=b+String.fromCharCode(a);else b=b+""+a+";"}return b};Silverlight.default_error_handler=function(e,b){var d,c=b.ErrorType;d=b.ErrorCode;var a="\nSilverlight error message \n";a+="ErrorCode: "+d+"\n";a+="ErrorType: "+c+" \n";a+="Message: "+b.ErrorMessage+" \n";if(c=="ParserError"){a+="XamlFile: "+b.xamlFile+" \n";a+="Line: "+b.lineNumber+" \n";a+="Position: "+b.charPosition+" \n"}else if(c=="RuntimeError"){if(b.lineNumber!=0){a+="Line: "+b.lineNumber+" \n";a+="Position: "+b.charPosition+" \n"}a+="MethodName: "+b.methodName+" \n"}alert(a)};Silverlight.__cleanup=function(){for(var a=Silverlight._silverlightCount-1;a>=0;a--)window["__slEvent"+a]=null;Silverlight._silverlightCount=0;if(window.removeEventListener)window.removeEventListener("unload",Silverlight.__cleanup,false);else window.detachEvent("onunload",Silverlight.__cleanup)};Silverlight.__getHandlerName=function(b){var a="";if(typeof b=="string")a=b;else if(typeof b=="function"){if(Silverlight._silverlightCount==0)if(window.addEventListener)window.addEventListener("onunload",Silverlight.__cleanup,false);else window.attachEvent("onunload",Silverlight.__cleanup);var c=Silverlight._silverlightCount++;a="__slEvent"+c;window[a]=b}else a=null;return a};Silverlight.onRequiredVersionAvailable=function(){};Silverlight.onRestartRequired=function(){};Silverlight.onUpgradeRequired=function(){};Silverlight.onInstallRequired=function(){};Silverlight.IsVersionAvailableOnError=function(d,a){var b=false;try{if(a.ErrorCode==8001&&!Silverlight.__installationEventFired){Silverlight.onUpgradeRequired();Silverlight.__installationEventFired=true}else if(a.ErrorCode==8002&&!Silverlight.__installationEventFired){Silverlight.onRestartRequired();Silverlight.__installationEventFired=true}else if(a.ErrorCode==5014||a.ErrorCode==2106){if(Silverlight.__verifySilverlight2UpgradeSuccess(a.getHost()))b=true}else b=true}catch(c){}return b};Silverlight.IsVersionAvailableOnLoad=function(b){var a=false;try{if(Silverlight.__verifySilverlight2UpgradeSuccess(b.getHost()))a=true}catch(c){}return a};Silverlight.__verifySilverlight2UpgradeSuccess=function(d){var c=false,b="2.0.31005",a=null;try{if(d.IsVersionSupported(b+".99")){a=Silverlight.onRequiredVersionAvailable;c=true}else if(d.IsVersionSupported(b+".0"))a=Silverlight.onRestartRequired;else a=Silverlight.onUpgradeRequired;if(a&&!Silverlight.__installationEventFired){a();Silverlight.__installationEventFired=true}}catch(e){}return c}
\ No newline at end of file
diff --git a/SampleApps/SilverlightApplication.Web/SilverlightApplication.Web.csproj b/SampleApps/SilverlightApplication.Web/SilverlightApplication.Web.csproj
new file mode 100644
index 00000000..8d49a3da
--- /dev/null
+++ b/SampleApps/SilverlightApplication.Web/SilverlightApplication.Web.csproj
@@ -0,0 +1,111 @@
+
+
+
+
+ Debug
+ AnyCPU
+
+
+ 2.0
+ {177C4EF8-0B0A-426E-BDCC-168DC10AC1C1}
+ {349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}
+ Library
+ Properties
+ SilverlightApplication.Web
+ SilverlightApplication.Web
+ v4.5
+ true
+
+
+
+
+ {CBA8C535-CCA3-4F60-8D3E-0E25791CBD21}|..\SilverlightApplication\SilverlightApplication.csproj|ClientBin|False
+
+
+ true
+ full
+ false
+ bin\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ none
+ true
+ bin\
+ TRACE
+ prompt
+ 4
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Web.config
+
+
+ Web.config
+
+
+
+
+ 10.0
+ $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)
+
+
+
+
+
+
+
+
+ True
+ True
+ 51248
+ /
+ http://localhost:51216/
+ False
+ False
+
+
+ False
+
+
+
+
+
+
\ No newline at end of file
diff --git a/SampleApps/SilverlightApplication.Web/SilverlightApplication.Web.csproj.user b/SampleApps/SilverlightApplication.Web/SilverlightApplication.Web.csproj.user
new file mode 100644
index 00000000..9d7fcd03
--- /dev/null
+++ b/SampleApps/SilverlightApplication.Web/SilverlightApplication.Web.csproj.user
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+ SilverlightApplicationTestPage.aspx
+ SpecificPage
+ True
+ True
+ False
+ False
+
+
+
+
+
+
+
+
+ False
+ True
+
+ [SilverlightApplication.xap]
+
+
+
+
+
+
\ No newline at end of file
diff --git a/SampleApps/SilverlightApplication.Web/SilverlightApplicationTestPage.aspx b/SampleApps/SilverlightApplication.Web/SilverlightApplicationTestPage.aspx
new file mode 100644
index 00000000..1a44243e
--- /dev/null
+++ b/SampleApps/SilverlightApplication.Web/SilverlightApplicationTestPage.aspx
@@ -0,0 +1,74 @@
+<%@ Page Language="C#" AutoEventWireup="true" %>
+
+
+
+
+ SilverlightApplication
+
+
+
+
+
+
+
+
diff --git a/SampleApps/SilverlightApplication.Web/SilverlightApplicationTestPage.html b/SampleApps/SilverlightApplication.Web/SilverlightApplicationTestPage.html
new file mode 100644
index 00000000..ae8695d0
--- /dev/null
+++ b/SampleApps/SilverlightApplication.Web/SilverlightApplicationTestPage.html
@@ -0,0 +1,73 @@
+
+
+
+
+ SilverlightApplication
+
+
+
+
+
+
+
+
diff --git a/SampleApps/SilverlightApplication.Web/Web.Debug.config b/SampleApps/SilverlightApplication.Web/Web.Debug.config
new file mode 100644
index 00000000..2e302f9f
--- /dev/null
+++ b/SampleApps/SilverlightApplication.Web/Web.Debug.config
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/SampleApps/SilverlightApplication.Web/Web.Release.config b/SampleApps/SilverlightApplication.Web/Web.Release.config
new file mode 100644
index 00000000..c3584446
--- /dev/null
+++ b/SampleApps/SilverlightApplication.Web/Web.Release.config
@@ -0,0 +1,31 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/SampleApps/SilverlightApplication.Web/Web.config b/SampleApps/SilverlightApplication.Web/Web.config
new file mode 100644
index 00000000..6da78ec8
--- /dev/null
+++ b/SampleApps/SilverlightApplication.Web/Web.config
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/SampleApps/SilverlightApplication/App.xaml b/SampleApps/SilverlightApplication/App.xaml
new file mode 100644
index 00000000..151ab06a
--- /dev/null
+++ b/SampleApps/SilverlightApplication/App.xaml
@@ -0,0 +1,6 @@
+
+
+
+
diff --git a/SampleApps/SilverlightApplication/App.xaml.cs b/SampleApps/SilverlightApplication/App.xaml.cs
new file mode 100644
index 00000000..16c1ecb2
--- /dev/null
+++ b/SampleApps/SilverlightApplication/App.xaml.cs
@@ -0,0 +1,68 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Net;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Animation;
+using System.Windows.Shapes;
+
+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 the app is running outside of the debugger then report the exception using
+ // the browser's exception mechanism. On IE this will display it a yellow alert
+ // icon in the status bar and Firefox will display a script error.
+ if (!System.Diagnostics.Debugger.IsAttached)
+ {
+
+ // NOTE: This will allow the application to continue running after an exception has been thrown
+ // but not handled.
+ // For production applications this error handling should be replaced with something that will
+ // report the error to the website and stop the application.
+ 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
new file mode 100644
index 00000000..b0223373
--- /dev/null
+++ b/SampleApps/SilverlightApplication/MainPage.xaml
@@ -0,0 +1,152 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ OpenStreetMap
+ OpenCycleMap
+ OCM Transport
+ OCM Landscape
+ MapQuest OSM
+
+
+
+
+
diff --git a/SampleApps/SilverlightApplication/MainPage.xaml.cs b/SampleApps/SilverlightApplication/MainPage.xaml.cs
new file mode 100644
index 00000000..56e59501
--- /dev/null
+++ b/SampleApps/SilverlightApplication/MainPage.xaml.cs
@@ -0,0 +1,153 @@
+using MapControl;
+using System;
+using System.Collections.Generic;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Input;
+using System.Windows.Threading;
+
+namespace SilverlightApplication
+{
+ public partial class MainPage : UserControl
+ {
+ private SamplePoint movingPoint = new SamplePoint
+ {
+ Name = "Moving",
+ Location = new Location(53.5, 8.25)
+ };
+
+ public MainPage()
+ {
+ InitializeComponent();
+
+ ICollection
x86
@@ -37,6 +38,7 @@
prompt
4
false
+ false
@@ -60,7 +62,7 @@
Settings.settings
-
+
MSBuild:Compile
Designer
@@ -89,9 +91,9 @@
{86470440-FEE2-4120-AF5A-3762FB9C536F}
ImageFileCache
-
- {06481252-2310-414A-B9FC-D5739FDF6BD3}
- MapControl
+
+ {226f3575-b683-446d-a2f0-181291dc8787}
+ MapControl.WPF