mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2026-04-05 14:37:01 +00:00
Version 3.1.Added support for different map projections.
This commit is contained in:
parent
06c3ed56c1
commit
643abeca1e
124 changed files with 3074 additions and 2497 deletions
|
|
@ -1,6 +1,6 @@
|
|||
<Application xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
x:Class="SilverlightApplication.App">
|
||||
<Application x:Class="SilverlightApplication.App"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<Application.Resources>
|
||||
</Application.Resources>
|
||||
</Application>
|
||||
|
|
|
|||
|
|
@ -27,16 +27,8 @@ namespace SilverlightApplication
|
|||
|
||||
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); });
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,55 +9,6 @@
|
|||
xmlns:local="clr-namespace:SilverlightApplication"
|
||||
mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="400">
|
||||
<UserControl.Resources>
|
||||
<map:TileLayerCollection x:Key="TileLayers">
|
||||
<!--
|
||||
TileLayers with OpenStreetMap data.
|
||||
-->
|
||||
<map:TileLayer SourceName="OpenStreetMap"
|
||||
Description="Maps © [OpenStreetMap Contributors](http://www.openstreetmap.org/copyright)"
|
||||
TileSource="http://{c}.tile.openstreetmap.org/{z}/{x}/{y}.png"
|
||||
MaxZoomLevel="19"/>
|
||||
<map:TileLayer SourceName="Thunderforest OpenCycleMap"
|
||||
Description="Maps © [Thunderforest](http://www.thunderforest.com/), Data © [OpenStreetMap Contributors](http://www.openstreetmap.org/copyright)"
|
||||
TileSource="http://{c}.tile.thunderforest.com/cycle/{z}/{x}/{y}.png"/>
|
||||
<map:TileLayer SourceName="Thunderforest Landscape"
|
||||
Description="Maps © [Thunderforest](http://www.thunderforest.com/), Data © [OpenStreetMap Contributors](http://www.openstreetmap.org/copyright)"
|
||||
TileSource="http://{c}.tile.thunderforest.com/landscape/{z}/{x}/{y}.png"/>
|
||||
<map:TileLayer SourceName="Thunderforest Outdoors"
|
||||
Description="Maps © [Thunderforest](http://www.thunderforest.com/), Data © [OpenStreetMap Contributors](http://www.openstreetmap.org/copyright)"
|
||||
TileSource="http://{c}.tile.thunderforest.com/outdoors/{z}/{x}/{y}.png"/>
|
||||
<map:TileLayer SourceName="Thunderforest Transport"
|
||||
Description="Maps © [Thunderforest](http://www.thunderforest.com/), Data © [OpenStreetMap Contributors](http://www.openstreetmap.org/copyright)"
|
||||
TileSource="http://{c}.tile.thunderforest.com/transport/{z}/{x}/{y}.png"/>
|
||||
<map:TileLayer SourceName="Thunderforest Transport Dark"
|
||||
Description="Maps © [Thunderforest](http://www.thunderforest.com/), Data © [OpenStreetMap Contributors](http://www.openstreetmap.org/copyright)"
|
||||
TileSource="http://{c}.tile.thunderforest.com/transport-dark/{z}/{x}/{y}.png"
|
||||
Foreground="White" Background="Black"/>
|
||||
<map:TileLayer SourceName="MapQuest OpenStreetMap"
|
||||
Description="Maps © [MapQuest](http://www.mapquest.com/), Data © [OpenStreetMap Contributors](http://www.openstreetmap.org/copyright)"
|
||||
TileSource="http://otile{n}.mqcdn.com/tiles/1.0.0/osm/{z}/{x}/{y}.jpg"
|
||||
MaxZoomLevel="19"/>
|
||||
<map:TileLayer SourceName="Seamarks"
|
||||
TileSource="http://tiles.openseamap.org/seamark/{z}/{x}/{y}.png"
|
||||
MinZoomLevel="10" MaxZoomLevel="18"/>
|
||||
|
||||
<!--
|
||||
Bing Maps TileLayers with tile URLs retrieved from the Imagery Metadata Service
|
||||
(see http://msdn.microsoft.com/en-us/library/ff701716.aspx).
|
||||
A Bing Maps API Key (see http://msdn.microsoft.com/en-us/library/ff428642.aspx) is required
|
||||
for using these layers and must be assigned to the static BingMapsTileLayer.ApiKey property.
|
||||
-->
|
||||
<map:BingMapsTileLayer SourceName="Bing Maps Road"
|
||||
Description="© [Microsoft Corporation](http://www.bing.com/maps/)"
|
||||
Mode="Road" MaxZoomLevel="19"/>
|
||||
<map:BingMapsTileLayer SourceName="Bing Maps Aerial"
|
||||
Description="© [Microsoft Corporation](http://www.bing.com/maps/)"
|
||||
Mode="Aerial" MaxZoomLevel="19" Foreground="White" Background="Black"/>
|
||||
<map:BingMapsTileLayer SourceName="Bing Maps Hybrid"
|
||||
Description="© [Microsoft Corporation](http://www.bing.com/maps/)"
|
||||
Mode="AerialWithLabels" MaxZoomLevel="19" Foreground="White" Background="Black"/>
|
||||
</map:TileLayerCollection>
|
||||
|
||||
<DataTemplate x:Key="PolylineItemTemplate">
|
||||
<map:MapPolyline Locations="{Binding Locations}" Stroke="Red" StrokeThickness="3"/>
|
||||
</DataTemplate>
|
||||
|
|
@ -128,10 +79,16 @@
|
|||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<map:WebMercatorProjection x:Key="WebMercatorProjection"/>
|
||||
<map:EquirectangularProjection x:Key="EquirectangularProjection"/>
|
||||
<map:OrthographicProjection x:Key="OrthographicProjection"/>
|
||||
<map:GnomonicProjection x:Key="GnomonicProjection"/>
|
||||
<map:StereographicProjection x:Key="StereographicProjection"/>
|
||||
</UserControl.Resources>
|
||||
|
||||
<UserControl.DataContext>
|
||||
<vm:ViewModel/>
|
||||
<vm:MapViewModel/>
|
||||
</UserControl.DataContext>
|
||||
|
||||
<Grid x:Name="LayoutRoot" Background="White">
|
||||
|
|
@ -139,14 +96,18 @@
|
|||
<RowDefinition/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
<map:Map x:Name="map" TileLayer="{Binding [OpenStreetMap], Source={StaticResource TileLayers}}"
|
||||
Center="{Binding MapCenter}" MinZoomLevel="2" ZoomLevel="11"
|
||||
<map:Map x:Name="map" MinZoomLevel="2" ZoomLevel="11"
|
||||
Center="{Binding MapCenter}"
|
||||
MapLayer="{Binding MapLayers.CurrentMapLayer}"
|
||||
MapProjection="{Binding SelectedValue, ElementName=projectionComboBox,
|
||||
FallbackValue={StaticResource WebMercatorProjection},
|
||||
TargetNullValue={StaticResource WebMercatorProjection}}"
|
||||
MouseMove="MapMouseMove" MouseLeave="MapMouseLeave">
|
||||
|
||||
<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"/>
|
||||
<Image x:Name="mapImage" Source="10_535_330.jpg" Opacity="0.5" Stretch="Fill"
|
||||
map:MapPanel.BoundingBox="53.54031,8.08594,53.74871,8.43750"/>
|
||||
|
||||
<map:MapGraticule Opacity="0.6"/>
|
||||
<map:MapGraticule x:Name="mapGraticule" Opacity="0.6"/>
|
||||
|
||||
<!-- use ItemTemplate or ItemContainerStyle alternatively -->
|
||||
<map:MapItemsControl ItemsSource="{Binding Polylines}"
|
||||
|
|
@ -163,24 +124,15 @@
|
|||
|
||||
<Path map:MapPanel.Location="53.5,8.2" Stroke="Blue" StrokeThickness="3" Fill="#1F007F00">
|
||||
<Path.Data>
|
||||
<EllipseGeometry RadiusX="1852" RadiusY="1852" Transform="{Binding ScaleTransform, ElementName=map}"/>
|
||||
<EllipseGeometry RadiusX="1852" RadiusY="1852" Transform="{Binding ScaleRotateTransform, ElementName=map}"/>
|
||||
</Path.Data>
|
||||
</Path>
|
||||
|
||||
<map:MapPath Stroke="Blue" Fill="Aqua" Opacity="0.5">
|
||||
<map:MapPath.Data>
|
||||
<GeometryGroup FillRule="EvenOdd">
|
||||
<EllipseGeometry Center="8.2,63.5" RadiusX="0.025" RadiusY="0.025"/>
|
||||
<EllipseGeometry Center="8.2,63.51" RadiusX="0.015" RadiusY="0.015"/>
|
||||
</GeometryGroup>
|
||||
</map:MapPath.Data>
|
||||
</map:MapPath>
|
||||
|
||||
<map:Pushpin map:MapPanel.Location="53.5,8.2" Background="Yellow" Foreground="Blue" Content="N 53° 30' E 8° 12'"/>
|
||||
</map:Map>
|
||||
|
||||
<Border HorizontalAlignment="Right" VerticalAlignment="Bottom" Background="#7FFFFFFF">
|
||||
<RichTextBlock Margin="4,2" FontSize="10" map:HyperlinkText.InlinesSource="{Binding TileLayer.Description, ElementName=map}"/>
|
||||
<RichTextBlock Margin="4,2" FontSize="10" map:HyperlinkText.InlinesSource="{Binding MapLayers.CurrentMapLayer.Description}"/>
|
||||
</Border>
|
||||
|
||||
<Grid Grid.Row="1">
|
||||
|
|
@ -209,18 +161,17 @@
|
|||
</StackPanel>
|
||||
<CheckBox Margin="5" VerticalAlignment="Bottom" Content="Seamarks"
|
||||
Checked="SeamarksChecked" Unchecked="SeamarksUnchecked"/>
|
||||
<ComboBox Width="130" Margin="5" VerticalAlignment="Bottom"
|
||||
SelectedValuePath="Tag" SelectedValue="{Binding TileLayer, ElementName=map, Mode=TwoWay}">
|
||||
<ComboBoxItem Tag="{Binding [OpenStreetMap], Source={StaticResource TileLayers}}">OpenStreetMap</ComboBoxItem>
|
||||
<ComboBoxItem Tag="{Binding [Thunderforest OpenCycleMap], Source={StaticResource TileLayers}}">OpenCycleMap</ComboBoxItem>
|
||||
<ComboBoxItem Tag="{Binding [Thunderforest Landscape], Source={StaticResource TileLayers}}">Landscape</ComboBoxItem>
|
||||
<ComboBoxItem Tag="{Binding [Thunderforest Outdoors], Source={StaticResource TileLayers}}">Outdoors</ComboBoxItem>
|
||||
<ComboBoxItem Tag="{Binding [Thunderforest Transport], Source={StaticResource TileLayers}}">Transport</ComboBoxItem>
|
||||
<ComboBoxItem Tag="{Binding [Thunderforest Transport Dark], Source={StaticResource TileLayers}}">Transport Dark</ComboBoxItem>
|
||||
<ComboBoxItem Tag="{Binding [MapQuest OpenStreetMap], Source={StaticResource TileLayers}}">MapQuest Open</ComboBoxItem>
|
||||
<!--<ComboBoxItem Tag="{Binding [Bing Maps Road], Source={StaticResource TileLayers}}">Bing Maps Road</ComboBoxItem>
|
||||
<ComboBoxItem Tag="{Binding [Bing Maps Aerial], Source={StaticResource TileLayers}}">Bing Maps Aerial</ComboBoxItem>
|
||||
<ComboBoxItem Tag="{Binding [Bing Maps Hybrid], Source={StaticResource TileLayers}}">Bing Maps Hybrid</ComboBoxItem>-->
|
||||
<ComboBox Width="200" Margin="5" VerticalAlignment="Bottom"
|
||||
ItemsSource="{Binding MapLayers.MapLayerNames}"
|
||||
SelectedItem="{Binding MapLayers.CurrentMapLayerName, Mode=TwoWay}"/>
|
||||
<ComboBox x:Name="projectionComboBox" Width="120" Margin="5" VerticalAlignment="Bottom"
|
||||
SelectedIndex="0" SelectedValuePath="Tag"
|
||||
SelectedValue="{Binding MapProjection, ElementName=map, Mode=TwoWay}">
|
||||
<ComboBoxItem Content="Web Mercator" Tag="{StaticResource WebMercatorProjection}"/>
|
||||
<ComboBoxItem Content="Equirectangular" Tag="{StaticResource EquirectangularProjection}"/>
|
||||
<ComboBoxItem Content="Orthographic" Tag="{StaticResource OrthographicProjection}"/>
|
||||
<ComboBoxItem Content="Gnomonic" Tag="{StaticResource GnomonicProjection}"/>
|
||||
<ComboBoxItem Content="Stereographic" Tag="{StaticResource StereographicProjection}"/>
|
||||
</ComboBox>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ using System.Windows;
|
|||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using MapControl;
|
||||
using ViewModel;
|
||||
|
||||
namespace SilverlightApplication
|
||||
{
|
||||
|
|
@ -11,8 +12,6 @@ namespace SilverlightApplication
|
|||
{
|
||||
public MainPage()
|
||||
{
|
||||
//BingMapsTileLayer.ApiKey = "...";
|
||||
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
|
|
@ -49,12 +48,12 @@ namespace SilverlightApplication
|
|||
|
||||
private void SeamarksChecked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
map.TileLayers.Add(((TileLayerCollection)Resources["TileLayers"])["Seamarks"]);
|
||||
map.Children.Insert(map.Children.IndexOf(mapGraticule), ((MapViewModel)DataContext).MapLayers.SeamarksLayer);
|
||||
}
|
||||
|
||||
private void SeamarksUnchecked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
map.TileLayers.Remove(((TileLayerCollection)Resources["TileLayers"])["Seamarks"]);
|
||||
map.Children.Remove(((MapViewModel)DataContext).MapLayers.SeamarksLayer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
<Deployment xmlns="http://schemas.microsoft.com/client/2007/deployment"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
>
|
||||
<Deployment.Parts>
|
||||
</Deployment.Parts>
|
||||
</Deployment>
|
||||
|
|
|
|||
|
|
@ -5,10 +5,10 @@ using System.Runtime.InteropServices;
|
|||
[assembly: AssemblyDescription("XAML Map Control Silverlight Sample Application")]
|
||||
[assembly: AssemblyProduct("XAML Map Control")]
|
||||
[assembly: AssemblyCompany("Clemens Fischer")]
|
||||
[assembly: AssemblyCopyright("© 2016 Clemens Fischer")]
|
||||
[assembly: AssemblyCopyright("© 2017 Clemens Fischer")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyVersion("2.14.0")]
|
||||
[assembly: AssemblyFileVersion("2.14.0")]
|
||||
[assembly: AssemblyVersion("3.1.0")]
|
||||
[assembly: AssemblyFileVersion("3.1.0")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
[assembly: ComVisible(false)]
|
||||
|
|
|
|||
|
|
@ -1,10 +1,7 @@
|
|||
<OutOfBrowserSettings ShortName="SilverlightApplication Application" EnableGPUAcceleration="True" ShowInstallMenuItem="True">
|
||||
<OutOfBrowserSettings.Blurb>SilverlightApplication Application on your desktop; at home, at work or on the go.</OutOfBrowserSettings.Blurb>
|
||||
<OutOfBrowserSettings.WindowSettings>
|
||||
<WindowSettings Title="SilverlightApplication Application" />
|
||||
</OutOfBrowserSettings.WindowSettings>
|
||||
<OutOfBrowserSettings.SecuritySettings>
|
||||
<SecuritySettings ElevatedPermissions="NotRequired" />
|
||||
</OutOfBrowserSettings.SecuritySettings>
|
||||
<OutOfBrowserSettings.Icons />
|
||||
<OutOfBrowserSettings.Blurb>SilverlightApplication Application on your desktop; at home, at work or on the go.</OutOfBrowserSettings.Blurb>
|
||||
<OutOfBrowserSettings.WindowSettings>
|
||||
<WindowSettings Title="SilverlightApplication Application" />
|
||||
</OutOfBrowserSettings.WindowSettings>
|
||||
<OutOfBrowserSettings.Icons />
|
||||
</OutOfBrowserSettings>
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Project ToolsVersion="14.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.50727</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{CBA8C535-CCA3-4F60-8D3E-0E25791CBD21}</ProjectGuid>
|
||||
<ProjectGuid>{85AACDB7-959D-406D-A8DF-2F1E013F8F40}</ProjectGuid>
|
||||
<ProjectTypeGuids>{A1591282-1198-4647-A2B1-27E5FF5F6F3B};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
|
|
@ -31,8 +31,6 @@
|
|||
<ThrowErrorsInValidation>true</ThrowErrorsInValidation>
|
||||
<LinkedServerProject>
|
||||
</LinkedServerProject>
|
||||
<InBrowserSettingsFile>Properties\InBrowserSettings.xml</InBrowserSettingsFile>
|
||||
<RequireInBrowserElevation>false</RequireInBrowserElevation>
|
||||
</PropertyGroup>
|
||||
<!-- This property group is only here to support building this project using the
|
||||
MSBuild 3.5 toolset. In order to work correctly with this older toolset, it needs
|
||||
|
|
@ -72,8 +70,11 @@
|
|||
<Reference Include="System.Windows.Browser" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="..\Common\ViewModel.cs">
|
||||
<Link>ViewModel.cs</Link>
|
||||
<Compile Include="..\Common\MapLayers.cs">
|
||||
<Link>MapLayers.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Common\MapViewModel.cs">
|
||||
<Link>MapViewModel.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="App.xaml.cs">
|
||||
<DependentUpon>App.xaml</DependentUpon>
|
||||
|
|
@ -96,18 +97,15 @@
|
|||
<ItemGroup>
|
||||
<None Include="Properties\AppManifest.xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Properties\OutOfBrowserSettings.xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Properties\InBrowserSettings.xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\MapControl\MapControl.Silverlight.csproj">
|
||||
<Project>{eb133b78-deff-416a-8f0c-89e54d766576}</Project>
|
||||
<Name>MapControl.Silverlight</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Properties\OutOfBrowserSettings.xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="..\Common\10_535_330.jpg">
|
||||
<Link>10_535_330.jpg</Link>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ProjectExtensions>
|
||||
<VisualStudio>
|
||||
<FlavorProperties GUID="{A1591282-1198-4647-A2B1-27E5FF5F6F3B}">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue