mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2026-04-06 06:55:04 +00:00
Version 2.4.2.:
- added HyperlinkText.InlinesSource attached property - simplified TileLayerCollection, removed it from MapBase - simplified MapRectangle and MapImage
This commit is contained in:
parent
1583b10ff3
commit
f6a881c674
36 changed files with 456 additions and 372 deletions
|
|
@ -65,9 +65,9 @@
|
|||
</Page.Resources>
|
||||
<Grid>
|
||||
<map:MapBase x:Name="map" ZoomLevel="11" MinZoomLevel="2"
|
||||
TileLayer="{Binding [OpenStreetMap], Source={StaticResource TileLayers}}"
|
||||
ManipulationMode="Scale,TranslateX,TranslateY,TranslateInertia"
|
||||
ManipulationStarted="MapManipulationStarted"
|
||||
ManipulationCompleted="MapManipulationCompleted"
|
||||
ManipulationDelta="MapManipulationDelta">
|
||||
<map:MapBase.Center>
|
||||
<map:Location Latitude="53.5" Longitude="8.2"/>
|
||||
|
|
@ -97,7 +97,7 @@
|
|||
</map:MapBase>
|
||||
|
||||
<Border HorizontalAlignment="Stretch" VerticalAlignment="Top" Background="#7F000000">
|
||||
<TextBlock x:Name="mapLegend" Margin="2" FontSize="12"/>
|
||||
<TextBlock Margin="2" FontSize="12" map:HyperlinkText.InlinesSource="{Binding TileLayer.Description, ElementName=map}"/>
|
||||
</Border>
|
||||
</Grid>
|
||||
|
||||
|
|
|
|||
|
|
@ -10,8 +10,7 @@ namespace PhoneApplication
|
|||
{
|
||||
public sealed partial class MainPage : Page
|
||||
{
|
||||
private TileLayerCollection tileLayers;
|
||||
private bool manipulationActive;
|
||||
private bool mapCentered;
|
||||
|
||||
public MainPage()
|
||||
{
|
||||
|
|
@ -19,66 +18,48 @@ namespace PhoneApplication
|
|||
|
||||
InitializeComponent();
|
||||
|
||||
tileLayers = (TileLayerCollection)Resources["TileLayers"];
|
||||
SetTileLayer(tileLayers[0].SourceName);
|
||||
|
||||
DataContext = new ViewModel(Dispatcher);
|
||||
NavigationCacheMode = NavigationCacheMode.Required;
|
||||
}
|
||||
|
||||
private void SetTileLayer(string tileLayer)
|
||||
private void MapMenuItemClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
map.TileLayer = tileLayers[tileLayer];
|
||||
|
||||
mapLegend.Inlines.Clear();
|
||||
|
||||
foreach (var inline in map.TileLayer.DescriptionInlines)
|
||||
{
|
||||
mapLegend.Inlines.Add(inline);
|
||||
}
|
||||
var tileLayers = (TileLayerCollection)Resources["TileLayers"];
|
||||
map.TileLayer = tileLayers[(string)((FrameworkElement)sender).Tag];
|
||||
}
|
||||
|
||||
private void SeamarksChecked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
map.TileLayers.Add((TileLayer)tileLayers["Seamarks"]);
|
||||
var tileLayers = (TileLayerCollection)Resources["TileLayers"];
|
||||
map.TileLayers.Add(tileLayers["Seamarks"]);
|
||||
}
|
||||
|
||||
private void SeamarksUnchecked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
map.TileLayers.Remove((TileLayer)tileLayers["Seamarks"]);
|
||||
}
|
||||
|
||||
private void MapMenuItemClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var selectedItem = (MenuFlyoutItem)sender;
|
||||
SetTileLayer((string)selectedItem.Tag);
|
||||
var tileLayers = (TileLayerCollection)Resources["TileLayers"];
|
||||
map.TileLayers.Remove(tileLayers["Seamarks"]);
|
||||
}
|
||||
|
||||
private void CenterButtonClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
manipulationActive = false;
|
||||
map.TargetCenter = ((ViewModel)DataContext).Location;
|
||||
mapCentered = true;
|
||||
}
|
||||
|
||||
private void MapManipulationStarted(object sender, ManipulationStartedRoutedEventArgs e)
|
||||
{
|
||||
manipulationActive = true;
|
||||
}
|
||||
|
||||
private void MapManipulationCompleted(object sender, ManipulationCompletedRoutedEventArgs e)
|
||||
{
|
||||
manipulationActive = false;
|
||||
mapCentered = false;
|
||||
}
|
||||
|
||||
private void MapManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e)
|
||||
{
|
||||
if (manipulationActive)
|
||||
if (mapCentered)
|
||||
{
|
||||
map.TransformMap(e.Position, e.Delta.Translation, e.Delta.Rotation, e.Delta.Scale);
|
||||
e.Complete();
|
||||
}
|
||||
else
|
||||
{
|
||||
e.Complete();
|
||||
map.TransformMap(e.Position, e.Delta.Translation, e.Delta.Rotation, e.Delta.Scale);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue