2020-03-28 21:53:38 +01:00
|
|
|
<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="900"
|
|
|
|
|
Stylus.IsPressAndHoldEnabled="False">
|
2012-05-04 12:52:20 +02:00
|
|
|
<Window.Resources>
|
2012-06-14 10:43:27 +02:00
|
|
|
<DataTemplate x:Key="PolylineItemTemplate">
|
|
|
|
|
<map:MapPolyline Locations="{Binding Locations}" Stroke="Red" StrokeThickness="3"/>
|
|
|
|
|
</DataTemplate>
|
2014-12-17 21:38:28 +01:00
|
|
|
|
2012-11-22 21:42:29 +01:00
|
|
|
<Style x:Key="PolylineItemStyle" TargetType="map:MapItem">
|
|
|
|
|
<Setter Property="Template">
|
|
|
|
|
<Setter.Value>
|
|
|
|
|
<ControlTemplate TargetType="map:MapItem">
|
|
|
|
|
<map:MapPolyline Locations="{Binding Locations}" Stroke="Red" StrokeThickness="3"/>
|
|
|
|
|
</ControlTemplate>
|
|
|
|
|
</Setter.Value>
|
|
|
|
|
</Setter>
|
|
|
|
|
</Style>
|
2014-12-17 21:38:28 +01:00
|
|
|
|
2012-06-14 10:43:27 +02:00
|
|
|
<Style x:Key="PointItemStyle" TargetType="map:MapItem">
|
2015-04-21 19:17:32 +02:00
|
|
|
<EventSetter Event="TouchDown" Handler="MapItemTouchDown"/>
|
2021-01-13 00:08:55 +01:00
|
|
|
<Setter Property="AutoCollapse" Value="True"/>
|
2021-01-11 22:35:17 +01:00
|
|
|
<Setter Property="Location" Value="{Binding Location}"/>
|
2012-05-04 12:52:20 +02:00
|
|
|
<Setter Property="Template">
|
|
|
|
|
<Setter.Value>
|
|
|
|
|
<ControlTemplate TargetType="map:MapItem">
|
|
|
|
|
<Canvas>
|
|
|
|
|
<VisualStateManager.VisualStateGroups>
|
|
|
|
|
<VisualStateGroup x:Name="CommonStates">
|
|
|
|
|
<VisualState x:Name="Normal"/>
|
|
|
|
|
<VisualState x:Name="Disabled"/>
|
|
|
|
|
<VisualState x:Name="MouseOver">
|
|
|
|
|
<Storyboard>
|
2021-01-17 21:39:42 +01:00
|
|
|
<DoubleAnimation Storyboard.TargetName="hoverPath"
|
|
|
|
|
Storyboard.TargetProperty="Opacity"
|
|
|
|
|
To="0.7" Duration="0:0:0.1"/>
|
2012-05-04 12:52:20 +02:00
|
|
|
</Storyboard>
|
|
|
|
|
</VisualState>
|
|
|
|
|
</VisualStateGroup>
|
|
|
|
|
<VisualStateGroup x:Name="SelectionStates">
|
|
|
|
|
<VisualState x:Name="Unselected"/>
|
2012-11-22 21:42:29 +01:00
|
|
|
<VisualState x:Name="Selected">
|
|
|
|
|
<Storyboard>
|
2021-01-17 21:39:42 +01:00
|
|
|
<DoubleAnimation Storyboard.TargetName="selectedPath"
|
|
|
|
|
Storyboard.TargetProperty="Opacity"
|
|
|
|
|
To="0.7" Duration="0:0:0.1"/>
|
2012-11-22 21:42:29 +01:00
|
|
|
</Storyboard>
|
|
|
|
|
</VisualState>
|
2012-05-04 12:52:20 +02:00
|
|
|
</VisualStateGroup>
|
|
|
|
|
</VisualStateManager.VisualStateGroups>
|
2013-08-17 08:41:11 +02:00
|
|
|
<Path x:Name="selectedPath" Fill="White" Opacity="0">
|
2012-11-22 21:42:29 +01:00
|
|
|
<Path.Data>
|
2021-01-17 21:39:42 +01:00
|
|
|
<EllipseGeometry RadiusX="12" RadiusY="12"/>
|
2012-11-22 21:42:29 +01:00
|
|
|
</Path.Data>
|
|
|
|
|
</Path>
|
2021-01-17 21:39:42 +01:00
|
|
|
<Path x:Name="hoverPath" StrokeThickness="6" Stroke="White" Opacity="0">
|
|
|
|
|
<Path.Data>
|
|
|
|
|
<EllipseGeometry RadiusX="8" RadiusY="8"/>
|
|
|
|
|
</Path.Data>
|
|
|
|
|
</Path>
|
|
|
|
|
<Path StrokeThickness="2" Stroke="Gray" Fill="Transparent">
|
2012-05-04 12:52:20 +02:00
|
|
|
<Path.Data>
|
|
|
|
|
<EllipseGeometry RadiusX="8" RadiusY="8"/>
|
|
|
|
|
</Path.Data>
|
|
|
|
|
</Path>
|
2012-11-23 23:00:50 +01:00
|
|
|
<Grid Canvas.Left="15" Canvas.Top="-8">
|
2021-01-17 21:39:42 +01:00
|
|
|
<local:OutlinedText Margin="1" OutlineThickness="1.5" Text="{Binding Name}"
|
|
|
|
|
Background="{Binding Background, RelativeSource={RelativeSource AncestorType=map:MapBase}}"/>
|
2012-05-04 12:52:20 +02:00
|
|
|
</Grid>
|
|
|
|
|
</Canvas>
|
|
|
|
|
</ControlTemplate>
|
|
|
|
|
</Setter.Value>
|
|
|
|
|
</Setter>
|
2015-04-21 19:17:32 +02:00
|
|
|
<Style.Triggers>
|
|
|
|
|
<Trigger Property="IsSelected" Value="True">
|
|
|
|
|
<Setter Property="Panel.ZIndex" Value="1"/>
|
|
|
|
|
</Trigger>
|
|
|
|
|
</Style.Triggers>
|
2012-05-04 12:52:20 +02:00
|
|
|
</Style>
|
2014-12-17 21:38:28 +01:00
|
|
|
|
2012-06-14 10:43:27 +02:00
|
|
|
<Style x:Key="PushpinItemStyle" TargetType="map:MapItem">
|
2015-04-21 19:17:32 +02:00
|
|
|
<EventSetter Event="TouchDown" Handler="MapItemTouchDown"/>
|
2021-01-13 00:08:55 +01:00
|
|
|
<Setter Property="AutoCollapse" Value="True"/>
|
2021-01-11 22:35:17 +01:00
|
|
|
<Setter Property="Location" Value="{Binding Location}"/>
|
2015-04-21 19:17:32 +02:00
|
|
|
<Setter Property="VerticalAlignment" Value="Bottom"/>
|
2012-05-04 12:52:20 +02:00
|
|
|
<Setter Property="Template">
|
|
|
|
|
<Setter.Value>
|
2012-12-06 23:28:12 +01:00
|
|
|
<ControlTemplate TargetType="map:MapItem">
|
2021-01-17 21:39:42 +01:00
|
|
|
<map:Pushpin Content="{Binding Name}"/>
|
2012-05-04 12:52:20 +02:00
|
|
|
</ControlTemplate>
|
|
|
|
|
</Setter.Value>
|
|
|
|
|
</Setter>
|
2012-06-14 10:43:27 +02:00
|
|
|
<Style.Triggers>
|
|
|
|
|
<Trigger Property="IsSelected" Value="True">
|
2015-04-21 19:17:32 +02:00
|
|
|
<Setter Property="Panel.ZIndex" Value="1"/>
|
2012-06-14 10:43:27 +02:00
|
|
|
<Setter Property="Foreground" Value="OrangeRed"/>
|
|
|
|
|
</Trigger>
|
|
|
|
|
</Style.Triggers>
|
2012-05-04 12:52:20 +02:00
|
|
|
</Style>
|
2017-06-25 23:05:48 +02:00
|
|
|
|
|
|
|
|
<map:WebMercatorProjection x:Key="WebMercatorProjection"/>
|
2017-10-27 17:15:18 +02:00
|
|
|
<map:WorldMercatorProjection x:Key="WorldMercatorProjection"/>
|
2017-06-25 23:05:48 +02:00
|
|
|
<map:EquirectangularProjection x:Key="EquirectangularProjection"/>
|
|
|
|
|
<map:OrthographicProjection x:Key="OrthographicProjection"/>
|
|
|
|
|
<map:GnomonicProjection x:Key="GnomonicProjection"/>
|
|
|
|
|
<map:StereographicProjection x:Key="StereographicProjection"/>
|
2012-05-04 12:52:20 +02:00
|
|
|
</Window.Resources>
|
2014-12-17 21:38:28 +01:00
|
|
|
|
2013-11-17 16:52:03 +01:00
|
|
|
<Window.DataContext>
|
2017-06-25 23:05:48 +02:00
|
|
|
<vm:MapViewModel/>
|
2013-11-17 16:52:03 +01:00
|
|
|
</Window.DataContext>
|
2014-12-17 21:38:28 +01:00
|
|
|
|
2012-05-04 12:52:20 +02:00
|
|
|
<Grid>
|
|
|
|
|
<Grid.RowDefinitions>
|
|
|
|
|
<RowDefinition/>
|
|
|
|
|
<RowDefinition Height="Auto"/>
|
|
|
|
|
</Grid.RowDefinitions>
|
2021-01-13 00:08:55 +01:00
|
|
|
<map:Map x:Name="map" ZoomLevel="11" MaxZoomLevel="21" MouseWheelZoomDelta="1"
|
2017-06-25 23:05:48 +02:00
|
|
|
Center="{Binding MapCenter}"
|
|
|
|
|
MapLayer="{Binding MapLayers.CurrentMapLayer}"
|
|
|
|
|
MapProjection="{Binding SelectedValue, ElementName=projectionComboBox,
|
|
|
|
|
FallbackValue={StaticResource WebMercatorProjection},
|
|
|
|
|
TargetNullValue={StaticResource WebMercatorProjection}}"
|
|
|
|
|
MouseLeftButtonDown="MapMouseLeftButtonDown"
|
|
|
|
|
MouseRightButtonDown="MapMouseRightButtonDown"
|
2012-11-22 21:42:29 +01:00
|
|
|
MouseMove="MapMouseMove" MouseLeave="MapMouseLeave"
|
|
|
|
|
ManipulationInertiaStarting="MapManipulationInertiaStarting">
|
2013-05-07 18:12:25 +02:00
|
|
|
|
2017-06-25 23:05:48 +02:00
|
|
|
<Image x:Name="mapImage" Source="10_535_330.jpg" Opacity="0.5" Stretch="Fill"
|
|
|
|
|
map:MapPanel.BoundingBox="53.54031,8.08594,53.74871,8.43750"/>
|
2013-04-21 23:56:08 +02:00
|
|
|
|
2017-06-25 23:05:48 +02:00
|
|
|
<map:MapGraticule x:Name="mapGraticule" Opacity="0.6"/>
|
2018-04-30 23:13:50 +02:00
|
|
|
<map:MapScale HorizontalAlignment="Left" VerticalAlignment="Bottom"/>
|
2012-11-22 21:42:29 +01:00
|
|
|
|
|
|
|
|
<!-- use ItemTemplate or ItemContainerStyle alternatively -->
|
2013-11-17 16:52:03 +01:00
|
|
|
<map:MapItemsControl ItemsSource="{Binding Polylines}"
|
2012-06-14 10:43:27 +02:00
|
|
|
ItemTemplate="{StaticResource PolylineItemTemplate}"/>
|
2013-11-17 16:52:03 +01:00
|
|
|
<!--<map:MapItemsControl ItemsSource="{Binding Polylines}"
|
2012-11-22 21:42:29 +01:00
|
|
|
ItemContainerStyle="{StaticResource PolylineItemStyle}"/>-->
|
|
|
|
|
|
2013-11-17 16:52:03 +01:00
|
|
|
<map:MapItemsControl ItemsSource="{Binding Points}"
|
2012-06-14 10:43:27 +02:00
|
|
|
ItemContainerStyle="{StaticResource PointItemStyle}"
|
2012-11-22 21:42:29 +01:00
|
|
|
SelectionMode="Extended"/>
|
|
|
|
|
|
2013-11-17 16:52:03 +01:00
|
|
|
<map:MapItemsControl ItemsSource="{Binding Pushpins}"
|
2019-06-04 22:03:25 +02:00
|
|
|
ItemContainerStyle="{StaticResource PushpinItemStyle}"/>
|
2012-11-22 21:42:29 +01:00
|
|
|
|
2021-01-13 00:08:55 +01:00
|
|
|
<map:Pushpin AutoCollapse="True" Location="65,-18" Content="Iceland"/>
|
|
|
|
|
<map:Pushpin AutoCollapse="True" Location="71,25" Content="Norway"/>
|
|
|
|
|
<map:Pushpin AutoCollapse="True" Location="35,33" Content="Cyprus"/>
|
|
|
|
|
<map:Pushpin AutoCollapse="True" Location="28.25,-16.5" Content="Tenerife"/>
|
2017-06-25 23:05:48 +02:00
|
|
|
|
2021-01-13 20:54:17 +01:00
|
|
|
<map:MapPath Location="53.5,8.2" Stroke="Blue" StrokeThickness="3" Fill="#1F007F00">
|
2020-03-28 21:53:38 +01:00
|
|
|
<map:MapPath.Data>
|
|
|
|
|
<EllipseGeometry RadiusX="1852" RadiusY="1852"/>
|
|
|
|
|
</map:MapPath.Data>
|
|
|
|
|
</map:MapPath>
|
2014-11-19 21:11:14 +01:00
|
|
|
|
2021-01-17 21:39:42 +01:00
|
|
|
<map:Pushpin AutoCollapse="True" Location="53.5,8.2" Content="N 53°30' E 8°12'"/>
|
2012-05-04 12:52:20 +02:00
|
|
|
</map:Map>
|
2014-11-19 21:11:14 +01:00
|
|
|
|
2020-10-25 16:09:09 +01:00
|
|
|
<Border HorizontalAlignment="Right" VerticalAlignment="Bottom" Background="#AFFFFFFF">
|
|
|
|
|
<TextBlock Margin="4,2" FontSize="10" map:HyperlinkText.InlinesSource="{Binding MapLayer.Description, ElementName=map}"/>
|
2014-10-19 21:50:23 +02:00
|
|
|
</Border>
|
2014-11-19 21:11:14 +01:00
|
|
|
|
2012-11-22 21:42:29 +01:00
|
|
|
<Grid Grid.Row="1">
|
2012-05-04 12:52:20 +02:00
|
|
|
<Grid.ColumnDefinitions>
|
|
|
|
|
<ColumnDefinition/>
|
|
|
|
|
<ColumnDefinition Width="Auto"/>
|
|
|
|
|
</Grid.ColumnDefinitions>
|
2013-08-17 08:41:11 +02:00
|
|
|
<TextBlock x:Name="mouseLocation" Margin="5" VerticalAlignment="Bottom" FontFamily="Segoe UI Mono"/>
|
2012-05-04 12:52:20 +02:00
|
|
|
<StackPanel Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Right">
|
2013-04-12 19:59:16 +02:00
|
|
|
<StackPanel Margin="5">
|
|
|
|
|
<TextBlock Text="Zoom Level" Margin="0,0,0,2" HorizontalAlignment="Center" Foreground="Gray" FontSize="10"/>
|
2020-10-24 19:01:00 +02:00
|
|
|
<Slider AutoToolTipPlacement="TopLeft" AutoToolTipPrecision="0"
|
|
|
|
|
Width="100" VerticalAlignment="Center" SmallChange="0.01"
|
2013-04-12 19:59:16 +02:00
|
|
|
Minimum="{Binding MinZoomLevel, ElementName=map}"
|
|
|
|
|
Maximum="{Binding MaxZoomLevel, ElementName=map}"
|
|
|
|
|
Value="{Binding TargetZoomLevel, ElementName=map}"/>
|
|
|
|
|
</StackPanel>
|
|
|
|
|
<StackPanel Margin="5">
|
|
|
|
|
<TextBlock Text="Heading" Margin="0,0,0,2" HorizontalAlignment="Center" Foreground="Gray" FontSize="10"/>
|
2020-10-24 19:01:00 +02:00
|
|
|
<Slider AutoToolTipPlacement="TopLeft" AutoToolTipPrecision="0"
|
|
|
|
|
Width="100" VerticalAlignment="Center" SmallChange="5" LargeChange="45"
|
2013-04-12 19:59:16 +02:00
|
|
|
Minimum="0" Maximum="360" Value="{Binding TargetHeading, ElementName=map}"/>
|
|
|
|
|
</StackPanel>
|
|
|
|
|
<StackPanel Margin="5">
|
|
|
|
|
<TextBlock Text="Image Opacity" Margin="0,0,0,2" HorizontalAlignment="Center" Foreground="Gray" FontSize="10"/>
|
2020-10-24 19:23:20 +02:00
|
|
|
<Slider AutoToolTipPlacement="TopLeft" AutoToolTipPrecision="1"
|
2020-10-24 19:01:00 +02:00
|
|
|
Width="100" VerticalAlignment="Center"
|
2013-04-12 19:59:16 +02:00
|
|
|
Minimum="0" Maximum="1" Value="{Binding Opacity, ElementName=mapImage}"/>
|
|
|
|
|
</StackPanel>
|
2014-06-11 23:03:13 +02:00
|
|
|
<CheckBox ToolTip="Seamarks Overlay" Margin="7" VerticalAlignment="Bottom" Content="Seamarks"
|
|
|
|
|
Checked="SeamarksChecked" Unchecked="SeamarksUnchecked"/>
|
2017-06-25 23:05:48 +02:00
|
|
|
<ComboBox ToolTip="Map Layer" Width="200" Margin="5" VerticalAlignment="Bottom"
|
|
|
|
|
ItemsSource="{Binding MapLayers.MapLayerNames}"
|
|
|
|
|
SelectedItem="{Binding MapLayers.CurrentMapLayerName}"/>
|
|
|
|
|
<ComboBox x:Name="projectionComboBox" ToolTip="Map Projection" Width="120" Margin="5" VerticalAlignment="Bottom"
|
|
|
|
|
SelectedValuePath="Tag" SelectedIndex="0">
|
|
|
|
|
<ComboBoxItem Content="Web Mercator" Tag="{StaticResource WebMercatorProjection}"/>
|
2017-10-27 17:15:18 +02:00
|
|
|
<ComboBoxItem Content="World Mercator" Tag="{StaticResource WorldMercatorProjection}"/>
|
2017-06-25 23:05:48 +02:00
|
|
|
<ComboBoxItem Content="Equirectangular" Tag="{StaticResource EquirectangularProjection}"/>
|
|
|
|
|
<ComboBoxItem Content="Orthographic" Tag="{StaticResource OrthographicProjection}"/>
|
|
|
|
|
<ComboBoxItem Content="Gnomonic" Tag="{StaticResource GnomonicProjection}"/>
|
|
|
|
|
<ComboBoxItem Content="Stereographic" Tag="{StaticResource StereographicProjection}"/>
|
2014-10-19 21:50:23 +02:00
|
|
|
</ComboBox>
|
2012-05-04 12:52:20 +02:00
|
|
|
</StackPanel>
|
|
|
|
|
</Grid>
|
|
|
|
|
</Grid>
|
|
|
|
|
</Window>
|