mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2026-04-05 22:46:58 +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
|
|
@ -7,30 +7,58 @@
|
|||
xmlns:local="using:StoreApplication">
|
||||
<Page.Resources>
|
||||
<map:TileLayerCollection x:Key="TileLayers">
|
||||
<map:TileLayer SourceName="OpenStreetMap" Description="© {y} OpenStreetMap Contributors, CC-BY-SA">
|
||||
<!--
|
||||
TileLayers with OpenStreetMap data.
|
||||
-->
|
||||
<map:TileLayer SourceName="OpenStreetMap"
|
||||
Description="Maps © [OpenStreetMap Contributors](http://www.openstreetmap.org/copyright)"
|
||||
MaxZoomLevel="19">
|
||||
<map:TileSource UriFormat="http://{c}.tile.openstreetmap.org/{z}/{x}/{y}.png"/>
|
||||
</map:TileLayer>
|
||||
<map:TileLayer SourceName="OpenCycleMap" Description="OpenCycleMap - © {y} Andy Allen & OpenStreetMap Contributors, CC-BY-SA">
|
||||
<map:TileSource UriFormat="http://{c}.tile.opencyclemap.org/cycle/{z}/{x}/{y}.png"/>
|
||||
<map:TileLayer SourceName="Thunderforest OpenCycleMap"
|
||||
Description="Maps © [Thunderforest](http://www.thunderforest.com/), Data © [OpenStreetMap Contributors](http://www.openstreetmap.org/copyright)">
|
||||
<map:TileSource UriFormat="http://{c}.tile.thunderforest.com/cycle/{z}/{x}/{y}.png"/>
|
||||
</map:TileLayer>
|
||||
<map:TileLayer SourceName="OCM Transport" Description="OpenCycleMap Transport - © {y} Andy Allen & OpenStreetMap Contributors, CC-BY-SA">
|
||||
<map:TileSource UriFormat="http://{c}.tile2.opencyclemap.org/transport/{z}/{x}/{y}.png"/>
|
||||
<map:TileLayer SourceName="Thunderforest Landscape"
|
||||
Description="Maps © [Thunderforest](http://www.thunderforest.com/), Data © [OpenStreetMap Contributors](http://www.openstreetmap.org/copyright)">
|
||||
<map:TileSource UriFormat="http://{c}.tile.thunderforest.com/landscape/{z}/{x}/{y}.png"/>
|
||||
</map:TileLayer>
|
||||
<map:TileLayer SourceName="OCM Landscape" Description="OpenCycleMap Landscape - © {y} Andy Allen & OpenStreetMap Contributors, CC-BY-SA">
|
||||
<map:TileSource UriFormat="http://{c}.tile3.opencyclemap.org/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)">
|
||||
<map:TileSource UriFormat="http://{c}.tile.thunderforest.com/outdoors/{z}/{x}/{y}.png"/>
|
||||
</map:TileLayer>
|
||||
<map:TileLayer SourceName="MapQuest OSM" Description="MapQuest OSM - © {y} MapQuest & OpenStreetMap Contributors">
|
||||
<map:TileLayer SourceName="Thunderforest Transport"
|
||||
Description="Maps © [Thunderforest](http://www.thunderforest.com/), Data © [OpenStreetMap Contributors](http://www.openstreetmap.org/copyright)">
|
||||
<map:TileSource UriFormat="http://{c}.tile.thunderforest.com/transport/{z}/{x}/{y}.png"/>
|
||||
</map:TileLayer>
|
||||
<map:TileLayer SourceName="Thunderforest Transport Dark"
|
||||
Description="Maps © [Thunderforest](http://www.thunderforest.com/), Data © [OpenStreetMap Contributors](http://www.openstreetmap.org/copyright)">
|
||||
<map:TileSource UriFormat="http://{c}.tile.thunderforest.com/transport-dark/{z}/{x}/{y}.png"/>
|
||||
</map:TileLayer>
|
||||
<map:TileLayer SourceName="MapQuest OpenStreetMap"
|
||||
Description="Maps © [MapQuest](http://www.mapquest.com/), Data © [OpenStreetMap Contributors](http://www.openstreetmap.org/copyright)">
|
||||
<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&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:TileLayer SourceName="Seamarks" Description="© OpenSeaMap Contributors"
|
||||
MinZoomLevel="10" MaxZoomLevel="18">
|
||||
<map:TileSource UriFormat="http://tiles.openseamap.org/seamark/{z}/{x}/{y}.png"/>
|
||||
</map:TileLayer>
|
||||
|
||||
<!--
|
||||
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="Bing Maps - © Microsoft Corporation"
|
||||
Mode="Road" MaxZoomLevel="19"/>
|
||||
<map:BingMapsTileLayer SourceName="Bing Maps Aerial"
|
||||
Description="Bing Maps - © Microsoft Corporation"
|
||||
Mode="Aerial" MaxZoomLevel="19" Foreground="White" Background="Black"/>
|
||||
<map:BingMapsTileLayer SourceName="Bing Maps Hybrid"
|
||||
Description="Bing Maps - © Microsoft Corporation"
|
||||
Mode="AerialWithLabels" MaxZoomLevel="19" Foreground="White" Background="Black"/>
|
||||
</map:TileLayerCollection>
|
||||
<DataTemplate x:Key="PolylineItemTemplate">
|
||||
<map:MapPolyline Locations="{Binding Locations}" Stroke="Red" StrokeThickness="3"/>
|
||||
|
|
@ -162,10 +190,10 @@
|
|||
<map:Location Latitude="53.5" Longitude="8.2"/>
|
||||
</map:MapPanel.Location>
|
||||
</map:Pushpin>
|
||||
|
||||
<TextBlock HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="4" FontSize="10"
|
||||
Text="{Binding TileLayer.Description, ElementName=map}"/>
|
||||
</map:Map>
|
||||
<Border HorizontalAlignment="Right" VerticalAlignment="Bottom" Background="#BFFFFFFF">
|
||||
<TextBlock x:Name="mapLegend" Margin="2" FontSize="10" Foreground="Black"/>
|
||||
</Border>
|
||||
<Grid Grid.Row="1">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition/>
|
||||
|
|
@ -188,16 +216,20 @@
|
|||
<TextBlock Text="Image Opacity" HorizontalAlignment="Center" Foreground="Gray" FontSize="14"/>
|
||||
<Slider Margin="10,-10,10,-10" Width="200" Value="50" ValueChanged="ImageOpacitySliderValueChanged"/>
|
||||
</StackPanel>
|
||||
<CheckBox Margin="10" VerticalAlignment="Center" Content="Seamarks" Checked="SeamarksChecked" Unchecked="SeamarksUnchecked"/>
|
||||
<ComboBox Margin="10" Width="200" VerticalAlignment="Center" SelectedValuePath="Content"
|
||||
Loaded="TileLayerComboBoxLoaded" SelectionChanged="TileLayerSelectionChanged">
|
||||
<ComboBoxItem>OpenStreetMap</ComboBoxItem>
|
||||
<ComboBoxItem>OpenCycleMap</ComboBoxItem>
|
||||
<ComboBoxItem>OCM Transport</ComboBoxItem>
|
||||
<ComboBoxItem>OCM Landscape</ComboBoxItem>
|
||||
<ComboBoxItem>MapQuest OSM</ComboBoxItem>
|
||||
<!--<ComboBoxItem>Bing Maps</ComboBoxItem>
|
||||
<ComboBoxItem>Bing Images</ComboBoxItem>-->
|
||||
<CheckBox Margin="10" VerticalAlignment="Center" Content="Seamarks"
|
||||
Checked="SeamarksChecked" Unchecked="SeamarksUnchecked"/>
|
||||
<ComboBox x:Name="tileLayerComboBox" Width="200" Margin="10" VerticalAlignment="Center"
|
||||
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>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using MapControl;
|
||||
using Windows.Storage;
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
using Windows.UI.Xaml.Controls.Primitives;
|
||||
|
|
@ -8,14 +7,17 @@ namespace StoreApplication
|
|||
{
|
||||
public sealed partial class MainPage : Page
|
||||
{
|
||||
private TileLayerCollection tileLayers;
|
||||
|
||||
public MainPage()
|
||||
{
|
||||
TileImageLoader.Cache = new ImageFileCache();
|
||||
//BingMapsTileLayer.ApiKey = ...
|
||||
|
||||
this.InitializeComponent();
|
||||
|
||||
var tileLayers = (TileLayerCollection)Resources["TileLayers"];
|
||||
map.TileLayer = tileLayers[0];
|
||||
tileLayers = (TileLayerCollection)Resources["TileLayers"];
|
||||
tileLayerComboBox.SelectedIndex = 0;
|
||||
}
|
||||
|
||||
private void ImageOpacitySliderValueChanged(object sender, RangeBaseValueChangedEventArgs e)
|
||||
|
|
@ -26,28 +28,28 @@ namespace StoreApplication
|
|||
}
|
||||
}
|
||||
|
||||
private void TileLayerComboBoxLoaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
((ComboBox)sender).SelectedIndex = 0;
|
||||
}
|
||||
|
||||
private void TileLayerSelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
var selectedValue = (string)((ComboBox)sender).SelectedValue;
|
||||
var tileLayers = (TileLayerCollection)Resources["TileLayers"];
|
||||
map.TileLayer = tileLayers[selectedValue];
|
||||
var selectedItem = (ComboBoxItem)tileLayerComboBox.SelectedItem;
|
||||
|
||||
map.TileLayer = tileLayers[(string)selectedItem.Tag];
|
||||
|
||||
mapLegend.Inlines.Clear();
|
||||
|
||||
foreach (var inline in map.TileLayer.DescriptionInlines)
|
||||
{
|
||||
mapLegend.Inlines.Add(inline);
|
||||
}
|
||||
}
|
||||
|
||||
private void SeamarksChecked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var tileLayers = (TileLayerCollection)Resources["TileLayers"];
|
||||
map.TileLayers.Add((TileLayer)tileLayers["Seamarks"]);
|
||||
map.TileLayers.Add(tileLayers["Seamarks"]);
|
||||
}
|
||||
|
||||
private void SeamarksUnchecked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var tileLayers = (TileLayerCollection)Resources["TileLayers"];
|
||||
map.TileLayers.Remove((TileLayer)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