mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2026-04-05 14:37:01 +00:00
Version 1.9.0:
- added MapBase.ZoomToBounds method - fixed coercing property values in MapBase - improved Location property handling in MapPanel to keep viewport positions near map center - use common view model in sample applications
This commit is contained in:
parent
9f4ab0f3e3
commit
5eafa751f8
37 changed files with 391 additions and 571 deletions
|
|
@ -1,11 +1,17 @@
|
|||
<Window x:Class="WpfApplication.MainWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:map="clr-namespace:MapControl;assembly=MapControl.WPF"
|
||||
xmlns:local="clr-namespace:WpfApplication"
|
||||
Title="XAML MapControl - WPF Test Application" Height="600" Width="800">
|
||||
<Window
|
||||
x:Class="WpfApplication.MainWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:map="clr-namespace:MapControl;assembly=MapControl.WPF"
|
||||
xmlns:vm="clr-namespace:ViewModel"
|
||||
xmlns:local="clr-namespace:WpfApplication"
|
||||
Title="XAML MapControl - WPF Test Application" Height="600" Width="800"
|
||||
Stylus.IsPressAndHoldEnabled="False">
|
||||
<Window.Resources>
|
||||
<map:TileLayerCollection x:Key="TileLayers">
|
||||
<!--<map:TileLayer SourceName="OSM Local" Description="© {y} OpenStreetMap Contributors, CC-BY-SA">
|
||||
<local:ImageTileSource UriFormat="file:///C:/ProgramData/MapControl/TileCache/OpenStreetMap/{z}/{x}/{y}.png"/>
|
||||
</map:TileLayer>-->
|
||||
<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"
|
||||
|
|
@ -25,7 +31,7 @@
|
|||
map content without using their APIs (i.e. Google Maps API or Bing Maps API).
|
||||
Hence the declarations shown below are for demonstration purpose only. -->
|
||||
|
||||
<!--<map:TileLayer SourceName="Google Maps" Description="Google Maps - © {y} Google"
|
||||
<map:TileLayer SourceName="Google Maps" Description="Google Maps - © {y} Google"
|
||||
TileSource="http://mt{i}.google.com/vt/x={x}&y={y}&z={z}" MaxZoomLevel="20"/>
|
||||
<map:TileLayer SourceName="Google Images" Description="Google Maps - © {y} Google" Background="#FF3F3F3F" Foreground="White"
|
||||
TileSource="http://khm{i}.google.com/kh/v=135&x={x}&y={y}&z={z}" MaxZoomLevel="20"/>
|
||||
|
|
@ -34,7 +40,7 @@
|
|||
<map:TileLayer SourceName="Bing Images" Description="Bing Maps - © {y} Microsoft Corporation" Background="#FF3F3F3F" Foreground="White"
|
||||
TileSource="http://ecn.t{i}.tiles.virtualearth.net/tiles/a{q}.jpeg?g=0" MaxZoomLevel="20"/>
|
||||
<map:TileLayer SourceName="Bing Hybrid" Description="Bing Maps - © {y} Microsoft Corporation" Background="#FF3F3F3F" Foreground="White"
|
||||
TileSource="http://ecn.t{i}.tiles.virtualearth.net/tiles/h{q}.jpeg?g=0&stl=h" MaxZoomLevel="20"/>-->
|
||||
TileSource="http://ecn.t{i}.tiles.virtualearth.net/tiles/h{q}.jpeg?g=0&stl=h" MaxZoomLevel="20"/>
|
||||
|
||||
<!-- The following TileLayer uses an ImageTileSource, which bypasses caching of map tile images -->
|
||||
<!--<map:TileLayer SourceName="OSM Uncached" Description="© {y} OpenStreetMap Contributors, CC-BY-SA">
|
||||
|
|
@ -109,6 +115,7 @@
|
|||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<EventSetter Event="TouchDown" Handler="MapItemTouchDown"/>
|
||||
</Style>
|
||||
<Style x:Key="PushpinItemStyle" TargetType="map:MapItem">
|
||||
<Setter Property="map:MapPanel.Location" Value="{Binding Location}"/>
|
||||
|
|
@ -129,22 +136,23 @@
|
|||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<EventSetter Event="TouchDown" Handler="MapItemTouchDown"/>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsSelected" Value="True">
|
||||
<Setter Property="Foreground" Value="OrangeRed"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
<local:SampleItemCollection x:Key="Polylines"/>
|
||||
<local:SampleItemCollection x:Key="Points"/>
|
||||
<local:SampleItemCollection x:Key="Pushpins"/>
|
||||
</Window.Resources>
|
||||
<Window.DataContext>
|
||||
<vm:ViewModel/>
|
||||
</Window.DataContext>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
<map:Map x:Name="map" Margin="2" Center="53.5,8.2" ZoomLevel="11" MaxZoomLevel="20"
|
||||
<map:Map x:Name="map" Margin="2" Center="{Binding MapCenter}" ZoomLevel="11" MaxZoomLevel="20"
|
||||
TileLayer="{Binding Source={StaticResource TileLayersViewSource}, Path=CurrentItem}"
|
||||
MouseLeftButtonDown="MapMouseLeftButtonDown" MouseRightButtonDown="MapMouseRightButtonDown"
|
||||
MouseMove="MapMouseMove" MouseLeave="MapMouseLeave"
|
||||
|
|
@ -163,17 +171,17 @@
|
|||
<map:MapScale Margin="4" Opacity="0.8"/>
|
||||
|
||||
<!-- use ItemTemplate or ItemContainerStyle alternatively -->
|
||||
<map:MapItemsControl ItemsSource="{StaticResource Polylines}"
|
||||
<map:MapItemsControl ItemsSource="{Binding Polylines}"
|
||||
ItemTemplate="{StaticResource PolylineItemTemplate}"/>
|
||||
<!--<map:MapItemsControl ItemsSource="{StaticResource Polylines}"
|
||||
<!--<map:MapItemsControl ItemsSource="{Binding Polylines}"
|
||||
ItemContainerStyle="{StaticResource PolylineItemStyle}"/>-->
|
||||
|
||||
<map:MapItemsControl ItemsSource="{StaticResource Points}"
|
||||
<map:MapItemsControl ItemsSource="{Binding Points}"
|
||||
ItemContainerStyle="{StaticResource PointItemStyle}"
|
||||
IsSynchronizedWithCurrentItem="True"
|
||||
SelectionMode="Extended"/>
|
||||
|
||||
<map:MapItemsControl ItemsSource="{StaticResource Pushpins}"
|
||||
<map:MapItemsControl ItemsSource="{Binding Pushpins}"
|
||||
ItemContainerStyle="{StaticResource PushpinItemStyle}"
|
||||
IsSynchronizedWithCurrentItem="True"/>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue