Version 2.4.2.:

- added HyperlinkText.InlinesSource attached property
- simplified TileLayerCollection, removed it from MapBase
- simplified MapRectangle and MapImage
This commit is contained in:
ClemensF 2014-12-17 21:38:28 +01:00
parent 1583b10ff3
commit f6a881c674
36 changed files with 456 additions and 372 deletions

View file

@ -61,9 +61,11 @@
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"/>
</DataTemplate>
<Style x:Key="PolylineItemStyle" TargetType="map:MapItem">
<Setter Property="Template">
<Setter.Value>
@ -73,6 +75,7 @@
</Setter.Value>
</Setter>
</Style>
<Style x:Key="PointItemStyle" TargetType="map:MapItem">
<Setter Property="local:BindingHelper.LocationPath" Value="Location"/>
<Setter Property="Foreground" Value="Black"/>
@ -138,6 +141,7 @@
</Setter.Value>
</Setter>
</Style>
<Style x:Key="PushpinItemStyle" TargetType="map:MapItem">
<Setter Property="local:BindingHelper.LocationPath" Value="Location"/>
<Setter Property="VerticalAlignment" Value="Bottom"/>
@ -151,16 +155,18 @@
</Setter>
</Style>
</Page.Resources>
<Page.DataContext>
<vm:ViewModel/>
</Page.DataContext>
<Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<map:Map x:Name="map" Center="{Binding MapCenter}" MinZoomLevel="2" MaxZoomLevel="18" ZoomLevel="11"
Foreground="Black" ManipulationMode="All">
<map:Map x:Name="map" TileLayer="{Binding [OpenStreetMap], Source={StaticResource TileLayers}}"
Center="{Binding MapCenter}" MinZoomLevel="2" MaxZoomLevel="18" ZoomLevel="11" ManipulationMode="All">
<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"/>
@ -194,7 +200,8 @@
</map:Pushpin>
</map:Map>
<Border HorizontalAlignment="Right" VerticalAlignment="Bottom" Background="#BFFFFFFF">
<TextBlock x:Name="mapLegend" Margin="2" FontSize="10" Foreground="Black"/>
<TextBlock Margin="2" FontSize="10" Foreground="Black"
map:HyperlinkText.InlinesSource="{Binding TileLayer.Description, ElementName=map}"/>
</Border>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
@ -220,18 +227,18 @@
</StackPanel>
<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 Width="200" Margin="10" VerticalAlignment="Center"
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>
</StackPanel>
</Grid>

View file

@ -7,8 +7,6 @@ namespace StoreApplication
{
public sealed partial class MainPage : Page
{
private TileLayerCollection tileLayers;
public MainPage()
{
//TileImageLoader.Cache = new MapControl.Caching.ImageFileCache();
@ -16,9 +14,6 @@ namespace StoreApplication
//BingMapsTileLayer.ApiKey = "...";
this.InitializeComponent();
tileLayers = (TileLayerCollection)Resources["TileLayers"];
tileLayerComboBox.SelectedIndex = 0;
}
private void ImageOpacitySliderValueChanged(object sender, RangeBaseValueChangedEventArgs e)
@ -29,28 +24,14 @@ namespace StoreApplication
}
}
private void TileLayerSelectionChanged(object sender, SelectionChangedEventArgs e)
{
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)
{
map.TileLayers.Add(tileLayers["Seamarks"]);
map.TileLayers.Add(((TileLayerCollection)Resources["TileLayers"])["Seamarks"]);
}
private void SeamarksUnchecked(object sender, RoutedEventArgs e)
{
map.TileLayers.Remove(tileLayers["Seamarks"]);
map.TileLayers.Remove(((TileLayerCollection)Resources["TileLayers"])["Seamarks"]);
}
}
}

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.4.1")]
[assembly: AssemblyFileVersion("2.4.1")]
[assembly: AssemblyVersion("2.4.2")]
[assembly: AssemblyFileVersion("2.4.2")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]