Version 2.1.0:

- TileImageLoader with local file caching in WinRT
- Location implements IEquatable
- Removed Surface sample application
This commit is contained in:
ClemensF 2014-07-09 21:27:28 +02:00
parent 10527c3f0d
commit 4e0253aa70
38 changed files with 493 additions and 393 deletions

View file

@ -35,7 +35,7 @@
<local:ObjectReferenceConverter x:Key="ObjectReferenceConverter"/>
</Page.Resources>
<Grid>
<map:MapBase x:Name="map" ZoomLevel="11"
<map:MapBase x:Name="map" ZoomLevel="11" MinZoomLevel="2"
ManipulationMode="Scale,TranslateX,TranslateY,TranslateInertia"
ManipulationStarted="MapManipulationStarted"
ManipulationCompleted="MapManipulationCompleted"

View file

@ -14,7 +14,13 @@ namespace PhoneApplication
public MainPage()
{
TileImageLoader.Cache = new ImageFileCache();
InitializeComponent();
var tileLayers = (TileLayerCollection)Resources["TileLayers"];
map.TileLayer = tileLayers[0];
DataContext = new ViewModel(Dispatcher);
NavigationCacheMode = NavigationCacheMode.Required;
}

View file

@ -7,8 +7,8 @@ using System.Runtime.InteropServices;
[assembly: AssemblyCompany("Clemens Fischer")]
[assembly: AssemblyCopyright("Copyright © 2014 Clemens Fischer")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyVersion("2.0.0")]
[assembly: AssemblyFileVersion("2.0.0")]
[assembly: AssemblyVersion("2.1.0")]
[assembly: AssemblyFileVersion("2.1.0")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: ComVisible(false)]

View file

@ -7,8 +7,8 @@ using System.Runtime.InteropServices;
[assembly: AssemblyCompany("Clemens Fischer")]
[assembly: AssemblyCopyright("Copyright © 2014 Clemens Fischer")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyVersion("2.0.0")]
[assembly: AssemblyFileVersion("2.0.0")]
[assembly: AssemblyVersion("2.1.0")]
[assembly: AssemblyFileVersion("2.1.0")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]

View file

@ -1,4 +1,5 @@
using System.Globalization;
using System;
using System.Globalization;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
@ -22,14 +23,27 @@ namespace SilverlightApplication
private void MapMouseMove(object sender, MouseEventArgs e)
{
var location = map.ViewportPointToLocation(e.GetPosition(map));
var longitude = Location.NormalizeLongitude(location.Longitude);
var latString = location.Latitude < 0 ?
string.Format(CultureInfo.InvariantCulture, "S {0:00.00000}", -location.Latitude) :
string.Format(CultureInfo.InvariantCulture, "N {0:00.00000}", location.Latitude);
var lonString = longitude < 0 ?
string.Format(CultureInfo.InvariantCulture, "W {0:000.00000}", -longitude) :
string.Format(CultureInfo.InvariantCulture, "E {0:000.00000}", longitude);
mouseLocation.Text = latString + "\n" + lonString;
var latitude = (int)Math.Round(location.Latitude * 60000d);
var longitude = (int)Math.Round(Location.NormalizeLongitude(location.Longitude) * 60000d);
var latHemisphere = 'N';
var lonHemisphere = 'E';
if (latitude < 0)
{
latitude = -latitude;
latHemisphere = 'S';
}
if (longitude < 0)
{
longitude = -longitude;
lonHemisphere = 'W';
}
mouseLocation.Text = string.Format(CultureInfo.InvariantCulture,
"{0} {1:00} {2:00.000}\n{3} {4:000} {5:00.000}",
latHemisphere, latitude / 60000, (double)(latitude % 60000) / 1000d,
lonHemisphere, longitude / 60000, (double)(longitude % 60000) / 1000d);
}
private void TileLayerSelectionChanged(object sender, SelectionChangedEventArgs e)

View file

@ -7,8 +7,8 @@ using System.Runtime.InteropServices;
[assembly: AssemblyCompany("Clemens Fischer")]
[assembly: AssemblyCopyright("Copyright © 2014 Clemens Fischer")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyVersion("2.0.0")]
[assembly: AssemblyFileVersion("2.0.0")]
[assembly: AssemblyVersion("2.1.0")]
[assembly: AssemblyFileVersion("2.1.0")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]

View file

@ -22,6 +22,12 @@
<map:TileLayer SourceName="MapQuest OSM" Description="MapQuest OSM - © {y} MapQuest &amp; OpenStreetMap Contributors">
<map:TileSource UriFormat="http://otile{n}.mqcdn.com/tiles/1.0.0/osm/{z}/{x}/{y}.png"/>
</map:TileLayer>
<map:TileLayer SourceName="Bing Maps" Description="Bing Maps - © {y} Microsoft Corporation" MinZoomLevel="1" MaxZoomLevel="19">
<map:TileSource UriFormat="http://ecn.t{i}.tiles.virtualearth.net/tiles/r{q}.png?g=0&amp;stl=h"/>
</map:TileLayer>
<map:TileLayer SourceName="Bing Images" Description="Bing Maps - © {y} Microsoft Corporation" MinZoomLevel="1" MaxZoomLevel="19" Background="#FF3F3F3F" Foreground="White">
<map:TileSource UriFormat="http://ecn.t{i}.tiles.virtualearth.net/tiles/a{q}.jpeg?g=0"/>
</map:TileLayer>
<map:TileLayer SourceName="Seamarks" Description="© {y} OpenSeaMap Contributors, CC-BY-SA" MinZoomLevel="10" MaxZoomLevel="18">
<map:TileSource UriFormat="http://tiles.openseamap.org/seamark/{z}/{x}/{y}.png"/>
</map:TileLayer>
@ -124,7 +130,7 @@
<RowDefinition/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<map:Map x:Name="map" MinZoomLevel="2" Center="{Binding MapCenter}" MaxZoomLevel="18" ZoomLevel="11" Foreground="Black">
<map:Map x:Name="map" Center="{Binding MapCenter}" MinZoomLevel="2" MaxZoomLevel="18" ZoomLevel="11" Foreground="Black">
<map:MapImage x:Name="mapImage" South="53.54031" North="53.74871" West="8.08594" East="8.43750"
Source="10_535_330.jpg" Opacity="0.5"/>
<map:MapGraticule Opacity="0.6"/>
@ -190,6 +196,8 @@
<ComboBoxItem>OCM Transport</ComboBoxItem>
<ComboBoxItem>OCM Landscape</ComboBoxItem>
<ComboBoxItem>MapQuest OSM</ComboBoxItem>
<ComboBoxItem>Bing Maps</ComboBoxItem>
<ComboBoxItem>Bing Images</ComboBoxItem>
</ComboBox>
</StackPanel>
</Grid>

View file

@ -1,4 +1,5 @@
using MapControl;
using Windows.Storage;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
@ -9,7 +10,12 @@ namespace StoreApplication
{
public MainPage()
{
TileImageLoader.Cache = new ImageFileCache();
this.InitializeComponent();
var tileLayers = (TileLayerCollection)Resources["TileLayers"];
map.TileLayer = tileLayers[0];
}
private void ImageOpacitySliderValueChanged(object sender, RangeBaseValueChangedEventArgs e)

View file

@ -7,8 +7,8 @@ using System.Runtime.InteropServices;
[assembly: AssemblyCompany("Clemens Fischer")]
[assembly: AssemblyCopyright("Copyright © 2014 Clemens Fischer")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyVersion("2.0.0")]
[assembly: AssemblyFileVersion("2.0.0")]
[assembly: AssemblyVersion("2.1.0")]
[assembly: AssemblyFileVersion("2.1.0")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]

View file

@ -1,3 +0,0 @@
<?xml version="1.0"?>
<configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/></startup></configuration>

View file

@ -1,12 +0,0 @@
<Application x:Class="SurfaceApplication.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
StartupUri="MainWindow.xaml">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/Microsoft.Surface.Presentation.Generic;v2.0.0.0;31bf3856ad364e35;component/themes\styles.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>

View file

@ -1,8 +0,0 @@
using System.Windows;
namespace SurfaceApplication
{
public partial class App : Application
{
}
}

View file

@ -1,12 +0,0 @@
<s:SurfaceWindow x:Class="SurfaceApplication.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:s="http://schemas.microsoft.com/surface/2008"
xmlns:m="clr-namespace:MapControl;assembly=MapControl.WPF"
Title="SurfaceApplication" WindowStyle="None" WindowState="Maximized">
<Grid>
<m:Map Center="53.5,8.2" ZoomLevel="11" TouchDown="MapTouchDown">
<m:MapGraticule Opacity="0.5" MinLineSpacing="200"/>
</m:Map>
</Grid>
</s:SurfaceWindow>

View file

@ -1,28 +0,0 @@
using System.Windows.Input;
using Microsoft.Surface;
using Microsoft.Surface.Presentation.Controls;
using Microsoft.Surface.Presentation.Input;
namespace SurfaceApplication
{
public partial class MainWindow : SurfaceWindow
{
public MainWindow()
{
InitializeComponent();
}
private void MapTouchDown(object sender, TouchEventArgs e)
{
if (SurfaceEnvironment.IsSurfaceEnvironmentAvailable &&
!e.Device.GetIsFingerRecognized())
{
// If touch event is from a blob or tag, prevent touch capture by setting
// TouchEventArgs.Handled = true. Hence no manipulation will be started.
// See http://msdn.microsoft.com/en-us/library/ms754010#touch_and_manipulation
e.Handled = true;
}
}
}
}

View file

@ -1,15 +0,0 @@
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("Surface Sample Application")]
[assembly: AssemblyDescription("XAML Map Control Sample Application for PixelSense (Surface 2)")]
[assembly: AssemblyProduct("XAML Map Control")]
[assembly: AssemblyCompany("Clemens Fischer")]
[assembly: AssemblyCopyright("Copyright © 2014 Clemens Fischer")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyVersion("2.0.0")]
[assembly: AssemblyFileVersion("2.0.0")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]

View file

@ -1,97 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{6285FB9D-B7EA-469A-B464-224077967167}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>SurfaceApplication</RootNamespace>
<AssemblyName>SurfaceApplication</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<TargetFrameworkProfile>
</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>none</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="Microsoft.Surface" />
<Reference Include="Microsoft.Surface.Presentation" />
<Reference Include="Microsoft.Surface.Presentation.Generic" />
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="App.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Page Include="MainWindow.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Compile Include="App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="MainWindow.xaml.cs">
<DependentUpon>MainWindow.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs">
<SubType>Code</SubType>
</Compile>
<None Include="App.config" />
<AppDesigner Include="Properties\" />
</ItemGroup>
<ItemGroup>
<Content Include="SurfaceApplication.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup />
<ItemGroup>
<ProjectReference Include="..\..\MapControl\MapControl.WPF.csproj">
<Project>{226f3575-b683-446d-a2f0-181291dc8787}</Project>
<Name>MapControl.WPF</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- 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.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View file

@ -1,48 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This file contains the information needed to install your application
with the Surface Shell. Please refer to the documentation for deployment
instructions.
-->
<ss:ApplicationInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ss="http://schemas.microsoft.com/Surface/2007/ApplicationMetadata">
<Application>
<Title>SurfaceApplication</Title>
<Description>SurfaceApplication</Description>
<ExecutableFile>SurfaceApplication.exe</ExecutableFile>
<Arguments>
</Arguments>
<IconImageFile>Resources\icon.png</IconImageFile>
<Tags>
<!--
If your application uses tagged objects, please uncomment this section to register the tags with the Shell.
You can register Tags by using the appropriate instructions below.
-->
<!--
To register a specific value Tag:
1. Please uncomment the Tag Element below.
2. Replace "C0" below with the value of your Tag (in hexadecimal format). Repeat this section (this element and its children) for other Tags
3. Please remove the Launch element if you do not want to register the tag with Object Routing.
-->
<!--
<Tag Value="0xC0">
<Actions>
<Launch />
</Actions>
</Tag>
-->
<!--
To register all Tags in a series:
1. Please uncomment the Tag Element below.
2. Replace "0000000000000000" below with the series of your Tag (in hexadecimal format). Repeat this section (this element and its children) for other Tags
3. Please remove the Launch element if you do not want to register the tag with Object Routing.
-->
<!--
<Tag Series="0x0000000000000000">
<Actions>
<Launch />
</Actions>
</Tag>
-->
</Tags>
</Application>
</ss:ApplicationInfo>

View file

@ -2,7 +2,6 @@
using System.Globalization;
using System.Runtime.Caching;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using Caching;
using MapControl;
@ -56,14 +55,27 @@ namespace WpfApplication
private void MapMouseMove(object sender, MouseEventArgs e)
{
var location = map.ViewportPointToLocation(e.GetPosition(map));
var longitude = Location.NormalizeLongitude(location.Longitude);
var latString = location.Latitude < 0 ?
string.Format(CultureInfo.InvariantCulture, "S {0:00.00000}", -location.Latitude) :
string.Format(CultureInfo.InvariantCulture, "N {0:00.00000}", location.Latitude);
var lonString = longitude < 0 ?
string.Format(CultureInfo.InvariantCulture, "W {0:000.00000}", -longitude) :
string.Format(CultureInfo.InvariantCulture, "E {0:000.00000}", longitude);
mouseLocation.Text = latString + "\n" + lonString;
var latitude = (int)Math.Round(location.Latitude * 60000d);
var longitude = (int)Math.Round(Location.NormalizeLongitude(location.Longitude) * 60000d);
var latHemisphere = 'N';
var lonHemisphere = 'E';
if (latitude < 0)
{
latitude = -latitude;
latHemisphere = 'S';
}
if (longitude < 0)
{
longitude = -longitude;
lonHemisphere = 'W';
}
mouseLocation.Text = string.Format(CultureInfo.InvariantCulture,
"{0} {1:00} {2:00.000}\n{3} {4:000} {5:00.000}",
latHemisphere, latitude / 60000, (double)(latitude % 60000) / 1000d,
lonHemisphere, longitude / 60000, (double)(longitude % 60000) / 1000d);
}
private void MapManipulationInertiaStarting(object sender, ManipulationInertiaStartingEventArgs e)

View file

@ -7,8 +7,8 @@ using System.Runtime.InteropServices;
[assembly: AssemblyCompany("Clemens Fischer")]
[assembly: AssemblyCopyright("Copyright © 2014 Clemens Fischer")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyVersion("2.0.0")]
[assembly: AssemblyFileVersion("2.0.0")]
[assembly: AssemblyVersion("2.1.0")]
[assembly: AssemblyFileVersion("2.1.0")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]