mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2026-04-05 14:37:01 +00:00
Version 2.3.0:
- Added BingMapsTileLayer - Added TileLayer.DescriptionInlines property - Added global Settings class - Added Phone Silverlight 8.1 build target - Use expiration time of downloaded images for caching
This commit is contained in:
parent
8917e1d4cb
commit
91ff46c506
58 changed files with 1225 additions and 491 deletions
|
|
@ -4,25 +4,58 @@
|
|||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:sys="clr-namespace:System;assembly=mscorlib"
|
||||
xmlns:map="clr-namespace:MapControl;assembly=MapControl.Silverlight"
|
||||
xmlns:vm="clr-namespace:ViewModel"
|
||||
xmlns:local="clr-namespace:SilverlightApplication"
|
||||
mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="400">
|
||||
<UserControl.Resources>
|
||||
<map:TileLayerCollection x:Key="TileLayers">
|
||||
<map:TileLayer SourceName="OpenStreetMap" Description="© {y} OpenStreetMap Contributors, CC-BY-SA"
|
||||
TileSource="http://{c}.tile.openstreetmap.org/{z}/{x}/{y}.png"/>
|
||||
<map:TileLayer SourceName="OpenCycleMap" Description="OpenCycleMap - © {y} Andy Allen & OpenStreetMap Contributors, CC-BY-SA"
|
||||
TileSource="http://{c}.tile.opencyclemap.org/cycle/{z}/{x}/{y}.png"/>
|
||||
<map:TileLayer SourceName="OCM Transport" Description="OpenCycleMap Transport - © {y} Andy Allen & OpenStreetMap Contributors, CC-BY-SA"
|
||||
TileSource="http://{c}.tile2.opencyclemap.org/transport/{z}/{x}/{y}.png"/>
|
||||
<map:TileLayer SourceName="OCM Landscape" Description="OpenCycleMap Landscape - © {y} Andy Allen & OpenStreetMap Contributors, CC-BY-SA"
|
||||
TileSource="http://{c}.tile3.opencyclemap.org/landscape/{z}/{x}/{y}.png"/>
|
||||
<map:TileLayer SourceName="MapQuest OSM" Description="MapQuest OSM - © {y} MapQuest & OpenStreetMap Contributors"
|
||||
TileSource="http://otile{n}.mqcdn.com/tiles/1.0.0/osm/{z}/{x}/{y}.png"/>
|
||||
<map:TileLayer SourceName="Seamarks" Description="© {y} OpenSeaMap Contributors, CC-BY-SA"
|
||||
TileSource="http://tiles.openseamap.org/seamark/{z}/{x}/{y}.png" MinZoomLevel="10" MaxZoomLevel="18"/>
|
||||
<!--
|
||||
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"
|
||||
Background="Black" Foreground="White"/>
|
||||
<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}.png"
|
||||
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"/>
|
||||
|
|
@ -127,9 +160,10 @@
|
|||
|
||||
<map:Pushpin map:MapPanel.Location="53.5,8.2" Background="Yellow" Foreground="Blue" Content="N 53° 30' E 8° 12'"/>
|
||||
|
||||
<TextBlock HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="4" FontSize="10"
|
||||
Text="{Binding TileLayer.Description, ElementName=map}"/>
|
||||
</map:Map>
|
||||
<Border HorizontalAlignment="Right" VerticalAlignment="Bottom" Background="#7FFFFFFF">
|
||||
<RichTextBlock x:Name="mapLegend" Margin="4,2" FontSize="10"/>
|
||||
</Border>
|
||||
<Grid Grid.Row="1">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition/>
|
||||
|
|
@ -154,13 +188,20 @@
|
|||
<Slider Width="100" Minimum="0" Maximum="1"
|
||||
Value="{Binding Opacity, ElementName=mapImage, Mode=TwoWay}"/>
|
||||
</StackPanel>
|
||||
<CheckBox Margin="5" VerticalAlignment="Bottom" Content="Seamarks" Checked="SeamarksChecked" Unchecked="SeamarksUnchecked"/>
|
||||
<ComboBox x:Name="tileLayerComboBox" Margin="5" VerticalAlignment="Bottom" Width="120" SelectionChanged="TileLayerSelectionChanged">
|
||||
<sys:String>OpenStreetMap</sys:String>
|
||||
<sys:String>OpenCycleMap</sys:String>
|
||||
<sys:String>OCM Transport</sys:String>
|
||||
<sys:String>OCM Landscape</sys:String>
|
||||
<sys:String>MapQuest OSM</sys:String>
|
||||
<CheckBox Margin="5" VerticalAlignment="Bottom" Content="Seamarks"
|
||||
Checked="SeamarksChecked" Unchecked="SeamarksUnchecked"/>
|
||||
<ComboBox x:Name="tileLayerComboBox" Width="130" Margin="5" VerticalAlignment="Bottom"
|
||||
SelectionChanged="TileLayerSelectionChanged">
|
||||
<ComboBoxItem Tag="OpenStreetMap">OpenStreetMap</ComboBoxItem>
|
||||
<ComboBoxItem Tag="Thunderforest OpenCycleMap">OpenCycleMap</ComboBoxItem>
|
||||
<ComboBoxItem Tag="Thunderforest Landscape">Landscape</ComboBoxItem>
|
||||
<ComboBoxItem Tag="Thunderforest Outdoors">Outdoors</ComboBoxItem>
|
||||
<ComboBoxItem Tag="Thunderforest Transport">Transport</ComboBoxItem>
|
||||
<ComboBoxItem Tag="Thunderforest Transport Dark">Transport Dark</ComboBoxItem>
|
||||
<ComboBoxItem Tag="MapQuest OpenStreetMap">MapQuest Open</ComboBoxItem>
|
||||
<!--<ComboBoxItem Tag="Bing Maps Road">Bing Maps Road</ComboBoxItem>
|
||||
<ComboBoxItem Tag="Bing Maps Aerial">Bing Maps Aerial</ComboBoxItem>
|
||||
<ComboBoxItem Tag="Bing Maps Hybrid">Bing Maps Hybrid</ComboBoxItem>-->
|
||||
</ComboBox>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
using System.Globalization;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using MapControl;
|
||||
|
||||
|
|
@ -9,9 +10,15 @@ namespace SilverlightApplication
|
|||
{
|
||||
public partial class MainPage : UserControl
|
||||
{
|
||||
private TileLayerCollection tileLayers;
|
||||
|
||||
public MainPage()
|
||||
{
|
||||
//BingMapsTileLayer.ApiKey = ...
|
||||
|
||||
InitializeComponent();
|
||||
|
||||
tileLayers = (TileLayerCollection)Resources["TileLayers"];
|
||||
tileLayerComboBox.SelectedIndex = 0;
|
||||
}
|
||||
|
||||
|
|
@ -48,19 +55,29 @@ namespace SilverlightApplication
|
|||
|
||||
private void TileLayerSelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
var comboBox = (ComboBox)sender;
|
||||
var tileLayers = (TileLayerCollection)Resources["TileLayers"];
|
||||
map.TileLayer = tileLayers[(string)comboBox.SelectedItem];
|
||||
var selectedItem = (ComboBoxItem)tileLayerComboBox.SelectedItem;
|
||||
|
||||
map.TileLayer = tileLayers[(string)selectedItem.Tag];
|
||||
|
||||
var paragraph = new Paragraph();
|
||||
|
||||
foreach (var inline in map.TileLayer.DescriptionInlines)
|
||||
{
|
||||
paragraph.Inlines.Add(inline);
|
||||
}
|
||||
|
||||
mapLegend.Blocks.Clear();
|
||||
mapLegend.Blocks.Add(paragraph);
|
||||
}
|
||||
|
||||
private void SeamarksChecked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
map.TileLayers.Add((TileLayer)((TileLayerCollection)Resources["TileLayers"])["Seamarks"]);
|
||||
map.TileLayers.Add(tileLayers["Seamarks"]);
|
||||
}
|
||||
|
||||
private void SeamarksUnchecked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
map.TileLayers.Remove((TileLayer)((TileLayerCollection)Resources["TileLayers"])["Seamarks"]);
|
||||
map.TileLayers.Remove(tileLayers["Seamarks"]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,8 +7,8 @@ using System.Runtime.InteropServices;
|
|||
[assembly: AssemblyCompany("Clemens Fischer")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2014 Clemens Fischer")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyVersion("2.2.0")]
|
||||
[assembly: AssemblyFileVersion("2.2.0")]
|
||||
[assembly: AssemblyVersion("2.3.0")]
|
||||
[assembly: AssemblyFileVersion("2.3.0")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
[assembly: ComVisible(false)]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue