mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2025-12-06 07:12:04 +01:00
Version 1.7.0. Signed assemblies, marked Location as serializable, simplified LocationCollection.
This commit is contained in:
parent
8c97d771ac
commit
8eedb82a9d
|
|
@ -33,6 +33,12 @@
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
<Prefer32Bit>false</Prefer32Bit>
|
<Prefer32Bit>false</Prefer32Bit>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
<PropertyGroup>
|
||||||
|
<SignAssembly>true</SignAssembly>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup>
|
||||||
|
<AssemblyOriginatorKeyFile>..\..\MapControl.snk</AssemblyOriginatorKeyFile>
|
||||||
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="FileDb, Version=3.10.0.0, Culture=neutral, PublicKeyToken=68cc942b9efb3282, processorArchitecture=MSIL">
|
<Reference Include="FileDb, Version=3.10.0.0, Culture=neutral, PublicKeyToken=68cc942b9efb3282, processorArchitecture=MSIL">
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
|
|
@ -50,6 +56,11 @@
|
||||||
<Content Include="FileDb\FileDb.dll" />
|
<Content Include="FileDb\FileDb.dll" />
|
||||||
<Content Include="FileDb\FileDb.txt" />
|
<Content Include="FileDb\FileDb.txt" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="..\..\MapControl.snk">
|
||||||
|
<Link>MapControl.snk</Link>
|
||||||
|
</None>
|
||||||
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
Other similar extension points exist, see Microsoft.Common.targets.
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,8 @@ using System.Runtime.InteropServices;
|
||||||
[assembly: AssemblyCompany("Clemens Fischer")]
|
[assembly: AssemblyCompany("Clemens Fischer")]
|
||||||
[assembly: AssemblyCopyright("Copyright © Clemens Fischer 2012-2013")]
|
[assembly: AssemblyCopyright("Copyright © Clemens Fischer 2012-2013")]
|
||||||
[assembly: AssemblyTrademark("")]
|
[assembly: AssemblyTrademark("")]
|
||||||
[assembly: AssemblyVersion("1.6.1")]
|
[assembly: AssemblyVersion("1.7.0")]
|
||||||
[assembly: AssemblyFileVersion("1.6.1")]
|
[assembly: AssemblyFileVersion("1.7.0")]
|
||||||
[assembly: AssemblyConfiguration("")]
|
[assembly: AssemblyConfiguration("")]
|
||||||
[assembly: AssemblyCulture("")]
|
[assembly: AssemblyCulture("")]
|
||||||
[assembly: ComVisible(false)]
|
[assembly: ComVisible(false)]
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,12 @@
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
<Prefer32Bit>false</Prefer32Bit>
|
<Prefer32Bit>false</Prefer32Bit>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
<PropertyGroup>
|
||||||
|
<SignAssembly>true</SignAssembly>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup>
|
||||||
|
<AssemblyOriginatorKeyFile>..\..\MapControl.snk</AssemblyOriginatorKeyFile>
|
||||||
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Core" />
|
<Reference Include="System.Core" />
|
||||||
|
|
@ -42,6 +48,11 @@
|
||||||
<Compile Include="ImageFileCache.cs" />
|
<Compile Include="ImageFileCache.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="..\..\MapControl.snk">
|
||||||
|
<Link>MapControl.snk</Link>
|
||||||
|
</None>
|
||||||
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
Other similar extension points exist, see Microsoft.Common.targets.
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,8 @@ using System.Runtime.InteropServices;
|
||||||
[assembly: AssemblyCompany("Clemens Fischer")]
|
[assembly: AssemblyCompany("Clemens Fischer")]
|
||||||
[assembly: AssemblyCopyright("Copyright © Clemens Fischer 2012-2013")]
|
[assembly: AssemblyCopyright("Copyright © Clemens Fischer 2012-2013")]
|
||||||
[assembly: AssemblyTrademark("")]
|
[assembly: AssemblyTrademark("")]
|
||||||
[assembly: AssemblyVersion("1.6.1")]
|
[assembly: AssemblyVersion("1.7.0")]
|
||||||
[assembly: AssemblyFileVersion("1.6.1")]
|
[assembly: AssemblyFileVersion("1.7.0")]
|
||||||
[assembly: AssemblyConfiguration("")]
|
[assembly: AssemblyConfiguration("")]
|
||||||
[assembly: AssemblyCulture("")]
|
[assembly: AssemblyCulture("")]
|
||||||
[assembly: ComVisible(false)]
|
[assembly: ComVisible(false)]
|
||||||
|
|
|
||||||
BIN
MapControl.snk
Normal file
BIN
MapControl.snk
Normal file
Binary file not shown.
|
|
@ -8,13 +8,24 @@ using System.Globalization;
|
||||||
namespace MapControl
|
namespace MapControl
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A geographic location given as latitude and longitude.
|
/// A geographic location with latitude and longitude values in degrees.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class Location : IEquatable<Location>
|
#if !SILVERLIGHT && !NETFX_CORE
|
||||||
|
[Serializable]
|
||||||
|
#endif
|
||||||
|
public partial class Location
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// TransformedLatitude is set by the Transform methods in MercatorTransform.
|
||||||
|
/// It holds the transformed latitude value to avoid redundant recalculation.
|
||||||
|
/// </summary>
|
||||||
|
#if !SILVERLIGHT && !NETFX_CORE
|
||||||
|
[NonSerialized]
|
||||||
|
#endif
|
||||||
|
internal double TransformedLatitude;
|
||||||
|
|
||||||
private double latitude;
|
private double latitude;
|
||||||
private double longitude;
|
private double longitude;
|
||||||
internal double Y;
|
|
||||||
|
|
||||||
public Location()
|
public Location()
|
||||||
{
|
{
|
||||||
|
|
@ -32,7 +43,7 @@ namespace MapControl
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
latitude = Math.Min(Math.Max(value, -90d), 90d);
|
latitude = Math.Min(Math.Max(value, -90d), 90d);
|
||||||
Y = double.NaN;
|
TransformedLatitude = double.NaN;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -42,21 +53,6 @@ namespace MapControl
|
||||||
set { longitude = value; }
|
set { longitude = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Equals(Location other)
|
|
||||||
{
|
|
||||||
return other != null && other.latitude == latitude && other.longitude == longitude;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override bool Equals(object obj)
|
|
||||||
{
|
|
||||||
return Equals(obj as Location);
|
|
||||||
}
|
|
||||||
|
|
||||||
public override int GetHashCode()
|
|
||||||
{
|
|
||||||
return latitude.GetHashCode() ^ longitude.GetHashCode();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
return string.Format(CultureInfo.InvariantCulture, "{0:F5},{1:F5}", latitude, longitude);
|
return string.Format(CultureInfo.InvariantCulture, "{0:F5},{1:F5}", latitude, longitude);
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
namespace MapControl
|
namespace MapControl
|
||||||
{
|
{
|
||||||
|
|
@ -18,23 +19,20 @@ namespace MapControl
|
||||||
}
|
}
|
||||||
|
|
||||||
public LocationCollection(IEnumerable<Location> locations)
|
public LocationCollection(IEnumerable<Location> locations)
|
||||||
|
: base(locations)
|
||||||
{
|
{
|
||||||
foreach (var location in locations)
|
|
||||||
{
|
|
||||||
Add(location);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public LocationCollection(List<Location> locations)
|
||||||
|
: base(locations)
|
||||||
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public static LocationCollection Parse(string s)
|
public static LocationCollection Parse(string s)
|
||||||
{
|
{
|
||||||
LocationCollection locations = new LocationCollection();
|
var strings = s.Split(new char[] { ' ', ';' }, StringSplitOptions.RemoveEmptyEntries);
|
||||||
|
|
||||||
foreach (var locString in s.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries))
|
return new LocationCollection(strings.Select(l => Location.Parse(l)));
|
||||||
{
|
|
||||||
locations.Add(Location.Parse(locString));
|
|
||||||
}
|
|
||||||
|
|
||||||
return locations;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -51,6 +51,12 @@
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
|
<RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
<PropertyGroup>
|
||||||
|
<SignAssembly>true</SignAssembly>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup>
|
||||||
|
<AssemblyOriginatorKeyFile>..\MapControl.snk</AssemblyOriginatorKeyFile>
|
||||||
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="mscorlib" />
|
<Reference Include="mscorlib" />
|
||||||
<Reference Include="System.Windows" />
|
<Reference Include="System.Windows" />
|
||||||
|
|
@ -81,10 +87,10 @@
|
||||||
<Compile Include="MapPanel.cs" />
|
<Compile Include="MapPanel.cs" />
|
||||||
<Compile Include="MapPanel.Silverlight.WinRT.cs" />
|
<Compile Include="MapPanel.Silverlight.WinRT.cs" />
|
||||||
<Compile Include="MapPath.cs" />
|
<Compile Include="MapPath.cs" />
|
||||||
<Compile Include="MapRectangle.cs" />
|
<Compile Include="MapPath.Silverlight.WinRT.cs" />
|
||||||
<Compile Include="MapPolyline.cs" />
|
<Compile Include="MapPolyline.cs" />
|
||||||
<Compile Include="MapPolyline.Silverlight.WinRT.cs" />
|
<Compile Include="MapPolyline.Silverlight.WinRT.cs" />
|
||||||
<Compile Include="MapPath.Silverlight.WinRT.cs" />
|
<Compile Include="MapRectangle.cs" />
|
||||||
<Compile Include="MapTransform.cs" />
|
<Compile Include="MapTransform.cs" />
|
||||||
<Compile Include="MatrixEx.cs" />
|
<Compile Include="MatrixEx.cs" />
|
||||||
<Compile Include="MercatorTransform.cs" />
|
<Compile Include="MercatorTransform.cs" />
|
||||||
|
|
@ -101,13 +107,17 @@
|
||||||
<Compile Include="TileSource.cs" />
|
<Compile Include="TileSource.cs" />
|
||||||
<Compile Include="TileSourceConverter.cs" />
|
<Compile Include="TileSourceConverter.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup />
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Page Include="Themes\Generic.xaml">
|
<Page Include="Themes\Generic.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="..\MapControl.snk">
|
||||||
|
<Link>MapControl.snk</Link>
|
||||||
|
</None>
|
||||||
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Silverlight\$(SilverlightVersion)\Microsoft.Silverlight.CSharp.targets" />
|
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Silverlight\$(SilverlightVersion)\Microsoft.Silverlight.CSharp.targets" />
|
||||||
<ProjectExtensions>
|
<ProjectExtensions>
|
||||||
<VisualStudio>
|
<VisualStudio>
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,12 @@
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
|
<RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
<PropertyGroup>
|
||||||
|
<SignAssembly>true</SignAssembly>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup>
|
||||||
|
<AssemblyOriginatorKeyFile>..\MapControl.snk</AssemblyOriginatorKeyFile>
|
||||||
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="PresentationCore" />
|
<Reference Include="PresentationCore" />
|
||||||
<Reference Include="PresentationFramework" />
|
<Reference Include="PresentationFramework" />
|
||||||
|
|
@ -45,27 +51,30 @@
|
||||||
<Reference Include="WindowsBase" />
|
<Reference Include="WindowsBase" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="Map.WPF.cs" />
|
<Compile Include="GlyphRunText.cs" />
|
||||||
<Compile Include="MapGraticule.WPF.cs" />
|
<Compile Include="ImageTileSource.cs" />
|
||||||
<Compile Include="Location.cs" />
|
<Compile Include="Location.cs" />
|
||||||
<Compile Include="LocationCollection.cs" />
|
<Compile Include="LocationCollection.cs" />
|
||||||
<Compile Include="LocationCollectionConverter.cs" />
|
<Compile Include="LocationCollectionConverter.cs" />
|
||||||
<Compile Include="LocationConverter.cs" />
|
<Compile Include="LocationConverter.cs" />
|
||||||
<Compile Include="MapBase.cs">
|
<Compile Include="Map.WPF.cs" />
|
||||||
<SubType>Code</SubType>
|
<Compile Include="MapBase.cs" />
|
||||||
</Compile>
|
|
||||||
<Compile Include="MapBase.WPF.cs" />
|
<Compile Include="MapBase.WPF.cs" />
|
||||||
|
<Compile Include="MapGraticule.cs" />
|
||||||
|
<Compile Include="MapGraticule.WPF.cs" />
|
||||||
<Compile Include="MapImage.cs" />
|
<Compile Include="MapImage.cs" />
|
||||||
<Compile Include="MapImageLayer.cs" />
|
<Compile Include="MapImageLayer.cs" />
|
||||||
<Compile Include="MapItem.WPF.cs" />
|
<Compile Include="MapItem.WPF.cs" />
|
||||||
<Compile Include="MapItemsControl.WPF.cs" />
|
<Compile Include="MapItemsControl.WPF.cs" />
|
||||||
|
<Compile Include="MapOverlay.cs" />
|
||||||
<Compile Include="MapPanel.cs" />
|
<Compile Include="MapPanel.cs" />
|
||||||
<Compile Include="MapPanel.WPF.cs" />
|
<Compile Include="MapPanel.WPF.cs" />
|
||||||
|
<Compile Include="MapPath.cs" />
|
||||||
|
<Compile Include="MapPath.WPF.cs" />
|
||||||
<Compile Include="MapPolyline.cs" />
|
<Compile Include="MapPolyline.cs" />
|
||||||
<Compile Include="MapPolyline.WPF.cs" />
|
<Compile Include="MapPolyline.WPF.cs" />
|
||||||
<Compile Include="MapRectangle.cs" />
|
<Compile Include="MapRectangle.cs" />
|
||||||
<Compile Include="MapPath.cs" />
|
<Compile Include="MapScale.cs" />
|
||||||
<Compile Include="MapPath.WPF.cs" />
|
|
||||||
<Compile Include="MapTransform.cs" />
|
<Compile Include="MapTransform.cs" />
|
||||||
<Compile Include="MercatorTransform.cs" />
|
<Compile Include="MercatorTransform.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
|
@ -74,17 +83,12 @@
|
||||||
<Compile Include="Tile.WPF.cs" />
|
<Compile Include="Tile.WPF.cs" />
|
||||||
<Compile Include="TileContainer.cs" />
|
<Compile Include="TileContainer.cs" />
|
||||||
<Compile Include="TileContainer.WPF.cs" />
|
<Compile Include="TileContainer.WPF.cs" />
|
||||||
|
<Compile Include="TileImageLoader.WPF.cs" />
|
||||||
<Compile Include="TileLayer.cs" />
|
<Compile Include="TileLayer.cs" />
|
||||||
<Compile Include="TileLayer.WPF.cs" />
|
<Compile Include="TileLayer.WPF.cs" />
|
||||||
<Compile Include="TileLayerCollection.cs" />
|
<Compile Include="TileLayerCollection.cs" />
|
||||||
<Compile Include="TileSource.cs" />
|
<Compile Include="TileSource.cs" />
|
||||||
<Compile Include="TileSourceConverter.cs" />
|
<Compile Include="TileSourceConverter.cs" />
|
||||||
<Compile Include="GlyphRunText.cs" />
|
|
||||||
<Compile Include="ImageTileSource.cs" />
|
|
||||||
<Compile Include="MapGraticule.cs" />
|
|
||||||
<Compile Include="MapOverlay.cs" />
|
|
||||||
<Compile Include="MapScale.cs" />
|
|
||||||
<Compile Include="TileImageLoader.WPF.cs" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Page Include="Themes\Generic.xaml">
|
<Page Include="Themes\Generic.xaml">
|
||||||
|
|
@ -92,7 +96,11 @@
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup />
|
<ItemGroup>
|
||||||
|
<None Include="..\MapControl.snk">
|
||||||
|
<Link>MapControl.snk</Link>
|
||||||
|
</None>
|
||||||
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<PreBuildEvent>
|
<PreBuildEvent>
|
||||||
|
|
|
||||||
|
|
@ -41,30 +41,30 @@ namespace MapControl
|
||||||
|
|
||||||
public override Point Transform(Location location)
|
public override Point Transform(Location location)
|
||||||
{
|
{
|
||||||
if (double.IsNaN(location.Y))
|
if (double.IsNaN(location.TransformedLatitude))
|
||||||
{
|
{
|
||||||
if (location.Latitude <= -90d)
|
if (location.Latitude <= -90d)
|
||||||
{
|
{
|
||||||
location.Y = double.NegativeInfinity;
|
location.TransformedLatitude = double.NegativeInfinity;
|
||||||
}
|
}
|
||||||
else if (location.Latitude >= 90d)
|
else if (location.Latitude >= 90d)
|
||||||
{
|
{
|
||||||
location.Y = double.PositiveInfinity;
|
location.TransformedLatitude = double.PositiveInfinity;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var lat = location.Latitude * Math.PI / 180d;
|
var lat = location.Latitude * Math.PI / 180d;
|
||||||
location.Y = Math.Log(Math.Tan(lat) + 1d / Math.Cos(lat)) / Math.PI * 180d;
|
location.TransformedLatitude = Math.Log(Math.Tan(lat) + 1d / Math.Cos(lat)) / Math.PI * 180d;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Point(location.Longitude, location.Y);
|
return new Point(location.Longitude, location.TransformedLatitude);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Location Transform(Point point)
|
public override Location Transform(Point point)
|
||||||
{
|
{
|
||||||
var location = new Location(Math.Atan(Math.Sinh(point.Y * Math.PI / 180d)) / Math.PI * 180d, point.X);
|
var location = new Location(Math.Atan(Math.Sinh(point.Y * Math.PI / 180d)) / Math.PI * 180d, point.X);
|
||||||
location.Y = point.Y;
|
location.TransformedLatitude = point.Y;
|
||||||
return location;
|
return location;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,8 +15,8 @@ using System.Windows;
|
||||||
[assembly: AssemblyCompany("Clemens Fischer")]
|
[assembly: AssemblyCompany("Clemens Fischer")]
|
||||||
[assembly: AssemblyCopyright("Copyright © Clemens Fischer 2012-2013")]
|
[assembly: AssemblyCopyright("Copyright © Clemens Fischer 2012-2013")]
|
||||||
[assembly: AssemblyTrademark("")]
|
[assembly: AssemblyTrademark("")]
|
||||||
[assembly: AssemblyVersion("1.6.1")]
|
[assembly: AssemblyVersion("1.7.0")]
|
||||||
[assembly: AssemblyFileVersion("1.6.1")]
|
[assembly: AssemblyFileVersion("1.7.0")]
|
||||||
[assembly: AssemblyConfiguration("")]
|
[assembly: AssemblyConfiguration("")]
|
||||||
[assembly: AssemblyCulture("")]
|
[assembly: AssemblyCulture("")]
|
||||||
[assembly: ComVisible(false)]
|
[assembly: ComVisible(false)]
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
|
using System.Net.Cache;
|
||||||
using System.Runtime.Caching;
|
using System.Runtime.Caching;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
|
|
@ -73,7 +74,7 @@ namespace MapControl
|
||||||
|
|
||||||
internal void StartGetTiles(IEnumerable<Tile> tiles)
|
internal void StartGetTiles(IEnumerable<Tile> tiles)
|
||||||
{
|
{
|
||||||
if (tiles.Any())
|
if (tileLayer.TileSource != null && tiles.Any())
|
||||||
{
|
{
|
||||||
ThreadPool.QueueUserWorkItem(GetTilesAsync, tiles.ToList());
|
ThreadPool.QueueUserWorkItem(GetTilesAsync, tiles.ToList());
|
||||||
}
|
}
|
||||||
|
|
@ -94,22 +95,21 @@ namespace MapControl
|
||||||
{
|
{
|
||||||
var tiles = (List<Tile>)tileList;
|
var tiles = (List<Tile>)tileList;
|
||||||
var imageTileSource = tileLayer.TileSource as ImageTileSource;
|
var imageTileSource = tileLayer.TileSource as ImageTileSource;
|
||||||
var animateOpacity = tileLayer.AnimateTileOpacity;
|
|
||||||
|
|
||||||
if (imageTileSource != null && !imageTileSource.CanLoadAsync)
|
if (imageTileSource != null && !imageTileSource.CanLoadAsync)
|
||||||
{
|
{
|
||||||
foreach (var tile in tiles)
|
foreach (var tile in tiles)
|
||||||
{
|
{
|
||||||
tileLayer.Dispatcher.BeginInvoke(
|
tileLayer.Dispatcher.BeginInvoke(
|
||||||
(Action<Tile, ImageTileSource>)((t, ts) => t.SetImageSource(ts.LoadImage(t.XIndex, t.Y, t.ZoomLevel), animateOpacity)),
|
(Action<Tile, ImageTileSource>)((t, ts) => t.SetImageSource(ts.LoadImage(t.XIndex, t.Y, t.ZoomLevel), tileLayer.AnimateTileOpacity)),
|
||||||
DispatcherPriority.Background, tile, imageTileSource);
|
DispatcherPriority.Background, tile, imageTileSource);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (imageTileSource == null && Cache != null &&
|
if (imageTileSource == null && Cache != null &&
|
||||||
!tileLayer.TileSource.UriFormat.StartsWith("file://") &&
|
!string.IsNullOrWhiteSpace(tileLayer.SourceName) &&
|
||||||
!string.IsNullOrWhiteSpace(tileLayer.SourceName))
|
!tileLayer.TileSource.UriFormat.StartsWith("file://"))
|
||||||
{
|
{
|
||||||
var outdatedTiles = new List<Tile>(tiles.Count);
|
var outdatedTiles = new List<Tile>(tiles.Count);
|
||||||
|
|
||||||
|
|
@ -122,7 +122,7 @@ namespace MapControl
|
||||||
if (image != null)
|
if (image != null)
|
||||||
{
|
{
|
||||||
tileLayer.Dispatcher.BeginInvoke(
|
tileLayer.Dispatcher.BeginInvoke(
|
||||||
(Action<Tile, ImageSource>)((t, i) => t.SetImageSource(i, animateOpacity)),
|
(Action<Tile, ImageSource>)((t, i) => t.SetImageSource(i, tileLayer.AnimateTileOpacity)),
|
||||||
DispatcherPriority.Background, tile, image);
|
DispatcherPriority.Background, tile, image);
|
||||||
|
|
||||||
long creationTime = BitConverter.ToInt64(buffer, 0);
|
long creationTime = BitConverter.ToInt64(buffer, 0);
|
||||||
|
|
@ -151,13 +151,14 @@ namespace MapControl
|
||||||
{
|
{
|
||||||
Interlocked.Increment(ref downloadThreadCount);
|
Interlocked.Increment(ref downloadThreadCount);
|
||||||
|
|
||||||
ThreadPool.QueueUserWorkItem(o => LoadTiles(imageTileSource, animateOpacity));
|
ThreadPool.QueueUserWorkItem(LoadTiles);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void LoadTiles(ImageTileSource imageTileSource, bool animateOpacity)
|
private void LoadTiles(object o)
|
||||||
{
|
{
|
||||||
|
var imageTileSource = tileLayer.TileSource as ImageTileSource;
|
||||||
Tile tile;
|
Tile tile;
|
||||||
|
|
||||||
while (pendingTiles.TryDequeue(out tile))
|
while (pendingTiles.TryDequeue(out tile))
|
||||||
|
|
@ -197,7 +198,7 @@ namespace MapControl
|
||||||
if (image != null)
|
if (image != null)
|
||||||
{
|
{
|
||||||
tileLayer.Dispatcher.BeginInvoke(
|
tileLayer.Dispatcher.BeginInvoke(
|
||||||
(Action<Tile, ImageSource>)((t, i) => t.SetImageSource(i, animateOpacity)),
|
(Action<Tile, ImageSource>)((t, i) => t.SetImageSource(i, tileLayer.AnimateTileOpacity)),
|
||||||
DispatcherPriority.Background, tile, image);
|
DispatcherPriority.Background, tile, image);
|
||||||
|
|
||||||
if (buffer != null && Cache != null)
|
if (buffer != null && Cache != null)
|
||||||
|
|
@ -268,6 +269,11 @@ namespace MapControl
|
||||||
var request = (HttpWebRequest)WebRequest.Create(uri);
|
var request = (HttpWebRequest)WebRequest.Create(uri);
|
||||||
request.UserAgent = "XAML Map Control";
|
request.UserAgent = "XAML Map Control";
|
||||||
|
|
||||||
|
if (Cache != null)
|
||||||
|
{
|
||||||
|
request.CachePolicy = new HttpRequestCachePolicy(HttpRequestCacheLevel.NoCacheNoStore);
|
||||||
|
}
|
||||||
|
|
||||||
using (var response = (HttpWebResponse)request.GetResponse())
|
using (var response = (HttpWebResponse)request.GetResponse())
|
||||||
using (var responseStream = response.GetResponseStream())
|
using (var responseStream = response.GetResponseStream())
|
||||||
{
|
{
|
||||||
|
|
@ -284,7 +290,7 @@ namespace MapControl
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Trace.TraceInformation("Downloaded {0}", uri);
|
//Trace.TraceInformation("Downloaded {0}", uri);
|
||||||
}
|
}
|
||||||
catch (WebException ex)
|
catch (WebException ex)
|
||||||
{
|
{
|
||||||
|
|
@ -293,7 +299,7 @@ namespace MapControl
|
||||||
var statusCode = ((HttpWebResponse)ex.Response).StatusCode;
|
var statusCode = ((HttpWebResponse)ex.Response).StatusCode;
|
||||||
if (statusCode != HttpStatusCode.NotFound)
|
if (statusCode != HttpStatusCode.NotFound)
|
||||||
{
|
{
|
||||||
Trace.TraceInformation("Downloading {0} failed: {1}", uri, ex.Message);
|
Trace.TraceWarning("Downloading {0} failed: {1}", uri, ex.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -140,7 +140,11 @@
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup />
|
<ItemGroup>
|
||||||
|
<None Include="..\..\MapControl.snk">
|
||||||
|
<Link>MapControl.snk</Link>
|
||||||
|
</None>
|
||||||
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Page Include="Themes\Generic.xaml">
|
<Page Include="Themes\Generic.xaml">
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
|
@ -153,6 +157,12 @@
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
|
<RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
<PropertyGroup>
|
||||||
|
<SignAssembly>true</SignAssembly>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup>
|
||||||
|
<AssemblyOriginatorKeyFile>..\..\MapControl.snk</AssemblyOriginatorKeyFile>
|
||||||
|
</PropertyGroup>
|
||||||
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" />
|
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" />
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<PreBuildEvent>
|
<PreBuildEvent>
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,8 @@ using System.Runtime.InteropServices;
|
||||||
[assembly: AssemblyCompany("Clemens Fischer")]
|
[assembly: AssemblyCompany("Clemens Fischer")]
|
||||||
[assembly: AssemblyCopyright("Copyright © Clemens Fischer 2012-2013")]
|
[assembly: AssemblyCopyright("Copyright © Clemens Fischer 2012-2013")]
|
||||||
[assembly: AssemblyTrademark("")]
|
[assembly: AssemblyTrademark("")]
|
||||||
[assembly: AssemblyVersion("1.6.1")]
|
[assembly: AssemblyVersion("1.7.0")]
|
||||||
[assembly: AssemblyFileVersion("1.6.1")]
|
[assembly: AssemblyFileVersion("1.7.0")]
|
||||||
[assembly: AssemblyConfiguration("")]
|
[assembly: AssemblyConfiguration("")]
|
||||||
[assembly: AssemblyCulture("")]
|
[assembly: AssemblyCulture("")]
|
||||||
[assembly: ComVisible(false)]
|
[assembly: ComVisible(false)]
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,8 @@ using System.Runtime.InteropServices;
|
||||||
[assembly: AssemblyCompany("Clemens Fischer")]
|
[assembly: AssemblyCompany("Clemens Fischer")]
|
||||||
[assembly: AssemblyCopyright("Copyright © Clemens Fischer 2012-2013")]
|
[assembly: AssemblyCopyright("Copyright © Clemens Fischer 2012-2013")]
|
||||||
[assembly: AssemblyTrademark("")]
|
[assembly: AssemblyTrademark("")]
|
||||||
[assembly: AssemblyVersion("1.6.1")]
|
[assembly: AssemblyVersion("1.7.0")]
|
||||||
[assembly: AssemblyFileVersion("1.6.1")]
|
[assembly: AssemblyFileVersion("1.7.0")]
|
||||||
[assembly: AssemblyConfiguration("")]
|
[assembly: AssemblyConfiguration("")]
|
||||||
[assembly: AssemblyCulture("")]
|
[assembly: AssemblyCulture("")]
|
||||||
[assembly: ComVisible(false)]
|
[assembly: ComVisible(false)]
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,8 @@ using System.Runtime.InteropServices;
|
||||||
[assembly: AssemblyCompany("Clemens Fischer")]
|
[assembly: AssemblyCompany("Clemens Fischer")]
|
||||||
[assembly: AssemblyCopyright("Copyright © Clemens Fischer 2012-2013")]
|
[assembly: AssemblyCopyright("Copyright © Clemens Fischer 2012-2013")]
|
||||||
[assembly: AssemblyTrademark("")]
|
[assembly: AssemblyTrademark("")]
|
||||||
[assembly: AssemblyVersion("1.6.1")]
|
[assembly: AssemblyVersion("1.7.0")]
|
||||||
[assembly: AssemblyFileVersion("1.6.1")]
|
[assembly: AssemblyFileVersion("1.7.0")]
|
||||||
[assembly: AssemblyConfiguration("")]
|
[assembly: AssemblyConfiguration("")]
|
||||||
[assembly: AssemblyCulture("")]
|
[assembly: AssemblyCulture("")]
|
||||||
[assembly: ComVisible(false)]
|
[assembly: ComVisible(false)]
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,8 @@ using System.Runtime.InteropServices;
|
||||||
[assembly: AssemblyCompany("Clemens Fischer")]
|
[assembly: AssemblyCompany("Clemens Fischer")]
|
||||||
[assembly: AssemblyCopyright("Copyright © Clemens Fischer 2012-2013")]
|
[assembly: AssemblyCopyright("Copyright © Clemens Fischer 2012-2013")]
|
||||||
[assembly: AssemblyTrademark("")]
|
[assembly: AssemblyTrademark("")]
|
||||||
[assembly: AssemblyVersion("1.6.1")]
|
[assembly: AssemblyVersion("1.7.0")]
|
||||||
[assembly: AssemblyFileVersion("1.6.1")]
|
[assembly: AssemblyFileVersion("1.7.0")]
|
||||||
[assembly: AssemblyConfiguration("")]
|
[assembly: AssemblyConfiguration("")]
|
||||||
[assembly: AssemblyCulture("")]
|
[assembly: AssemblyCulture("")]
|
||||||
[assembly: ComVisible(false)]
|
[assembly: ComVisible(false)]
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,8 @@ using System.Runtime.InteropServices;
|
||||||
[assembly: AssemblyCompany("Clemens Fischer")]
|
[assembly: AssemblyCompany("Clemens Fischer")]
|
||||||
[assembly: AssemblyCopyright("Copyright © Clemens Fischer 2012-2013")]
|
[assembly: AssemblyCopyright("Copyright © Clemens Fischer 2012-2013")]
|
||||||
[assembly: AssemblyTrademark("")]
|
[assembly: AssemblyTrademark("")]
|
||||||
[assembly: AssemblyVersion("1.6.1")]
|
[assembly: AssemblyVersion("1.7.0")]
|
||||||
[assembly: AssemblyFileVersion("1.6.1")]
|
[assembly: AssemblyFileVersion("1.7.0")]
|
||||||
[assembly: AssemblyConfiguration("")]
|
[assembly: AssemblyConfiguration("")]
|
||||||
[assembly: AssemblyCulture("")]
|
[assembly: AssemblyCulture("")]
|
||||||
[assembly: ComVisible(false)]
|
[assembly: ComVisible(false)]
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,8 @@ using System.Runtime.InteropServices;
|
||||||
[assembly: AssemblyCompany("Clemens Fischer")]
|
[assembly: AssemblyCompany("Clemens Fischer")]
|
||||||
[assembly: AssemblyCopyright("Copyright © Clemens Fischer 2012-2013")]
|
[assembly: AssemblyCopyright("Copyright © Clemens Fischer 2012-2013")]
|
||||||
[assembly: AssemblyTrademark("")]
|
[assembly: AssemblyTrademark("")]
|
||||||
[assembly: AssemblyVersion("1.6.1")]
|
[assembly: AssemblyVersion("1.7.0")]
|
||||||
[assembly: AssemblyFileVersion("1.6.1")]
|
[assembly: AssemblyFileVersion("1.7.0")]
|
||||||
[assembly: AssemblyConfiguration("")]
|
[assembly: AssemblyConfiguration("")]
|
||||||
[assembly: AssemblyCulture("")]
|
[assembly: AssemblyCulture("")]
|
||||||
[assembly: ComVisible(false)]
|
[assembly: ComVisible(false)]
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
// <auto-generated>
|
// <auto-generated>
|
||||||
// This code was generated by a tool.
|
// This code was generated by a tool.
|
||||||
// Runtime Version:4.0.30319.33440
|
// Runtime Version:4.0.30319.34003
|
||||||
//
|
//
|
||||||
// Changes to this file may cause incorrect behavior and will be lost if
|
// Changes to this file may cause incorrect behavior and will be lost if
|
||||||
// the code is regenerated.
|
// the code is regenerated.
|
||||||
|
|
@ -12,7 +12,7 @@ namespace WpfApplication.Properties {
|
||||||
|
|
||||||
|
|
||||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
|
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")]
|
||||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||||
|
|
||||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue