Minor changes to sample apps

This commit is contained in:
Clemens 2021-05-02 18:50:35 +02:00
parent ad9a5267ee
commit 4fc8594563
4 changed files with 49 additions and 36 deletions

View file

@ -57,15 +57,6 @@ namespace ViewModel
MaxZoomLevel = 17 MaxZoomLevel = 17
} }
}, },
{
"Hike & Bike",
new MapTileLayer
{
TileSource = new TileSource { UriFormat = "https://tiles.wmflabs.org/hikebike/{z}/{x}/{y}.png" },
SourceName = "HikeBike",
Description = "© [OpenStreetMap contributors](http://www.openstreetmap.org/copyright)"
}
},
{ {
"Seamarks", "Seamarks",
new MapTileLayer new MapTileLayer
@ -135,7 +126,7 @@ namespace ViewModel
{ {
"SevenCs ChartServer WMS", "SevenCs ChartServer WMS",
new ChartServerLayer() new ChartServerLayer()
}, }
}; };
private string currentMapLayerName = "OpenStreetMap"; private string currentMapLayerName = "OpenStreetMap";
@ -167,7 +158,6 @@ namespace ViewModel
"OpenStreetMap German", "OpenStreetMap German",
"OpenStreetMap French", "OpenStreetMap French",
"OpenTopoMap", "OpenTopoMap",
"Hike & Bike",
"TopPlusOpen WMTS", "TopPlusOpen WMTS",
"TopPlusOpen WMS", "TopPlusOpen WMS",
"OpenStreetMap WMS", "OpenStreetMap WMS",
@ -195,7 +185,7 @@ namespace ViewModel
public ChartServerLayer() public ChartServerLayer()
{ {
Description = "© [SevenCs GmbH](http://www.sevencs.com)"; Description = "© [SevenCs GmbH](http://www.sevencs.com)";
ServiceUri = new Uri("https://wms.sevencs.com:9090"); ServiceUri = new Uri("http://wms.sevencs.com");
Layers = "ENC"; Layers = "ENC";
MaxBoundingBoxWidth = 360; MaxBoundingBoxWidth = 360;
} }

View file

@ -114,7 +114,9 @@
</map:MapPanel.BoundingBox> </map:MapPanel.BoundingBox>
</Image> </Image>
<map:MapGraticule x:Name="mapGraticule" Opacity="0.6"/> <map:MapGraticule x:Name="graticule" Opacity="0.6"
Visibility="{Binding IsChecked, ElementName=graticuleCheckBox}"/>
<map:MapScale HorizontalAlignment="Left" VerticalAlignment="Bottom"/> <map:MapScale HorizontalAlignment="Left" VerticalAlignment="Bottom"/>
<!-- use ItemTemplate or ItemContainerStyle alternatively --> <!-- use ItemTemplate or ItemContainerStyle alternatively -->
@ -149,27 +151,35 @@
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<StackPanel Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Right"> <StackPanel Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Right">
<StackPanel Margin="5"> <StackPanel Margin="5">
<TextBlock Text="Zoom Level" HorizontalAlignment="Center" Foreground="Gray" FontSize="14"/> <TextBlock Text="Zoom Level" HorizontalAlignment="Center" FontSize="12"/>
<Slider Margin="10,-10,10,-10" Width="100" SmallChange="0.1" <Slider Margin="10,-10,10,0" Width="100" SmallChange="0.1"
Minimum="{Binding MinZoomLevel, ElementName=map}" Minimum="{Binding MinZoomLevel, ElementName=map}"
Maximum="{Binding MaxZoomLevel, ElementName=map}" Maximum="{Binding MaxZoomLevel, ElementName=map}"
Value="{Binding TargetZoomLevel, ElementName=map, Mode=TwoWay}"/> Value="{Binding TargetZoomLevel, ElementName=map, Mode=TwoWay}"/>
</StackPanel> </StackPanel>
<StackPanel Margin="5"> <StackPanel Margin="5">
<TextBlock Text="Heading" HorizontalAlignment="Center" Foreground="Gray" FontSize="14"/> <TextBlock Text="Heading" HorizontalAlignment="Center" FontSize="12"/>
<Slider Margin="10,-10,10,-10" Width="100" Minimum="0" Maximum="360" SmallChange="5" LargeChange="45" <Slider Margin="10,-10,10,0" Width="100" Minimum="0" Maximum="360" SmallChange="5" LargeChange="45"
Value="{Binding Heading, ElementName=map, Mode=TwoWay}"/> Value="{Binding Heading, ElementName=map, Mode=TwoWay}"/>
</StackPanel> </StackPanel>
<StackPanel Margin="5">
<TextBlock Text="Image Opacity" HorizontalAlignment="Center" Foreground="Gray" FontSize="14"/> <StackPanel Margin="5,5,25,5">
<Slider Margin="10,-10,10,-10" Width="100" Value="50" ValueChanged="ImageOpacitySliderValueChanged"/> <TextBlock Text="Image Opacity" HorizontalAlignment="Center" FontSize="12"/>
<Slider Margin="10,-10,10,0" Width="100" Value="50" ValueChanged="ImageOpacitySliderValueChanged"/>
</StackPanel> </StackPanel>
<CheckBox Margin="10" VerticalAlignment="Center" Content="Seamarks"
<CheckBox x:Name="graticuleCheckBox"
VerticalAlignment="Center" Content="Graticule"/>
<CheckBox VerticalAlignment="Center" Content="Seamarks"
Checked="SeamarksChecked" Unchecked="SeamarksUnchecked"/> Checked="SeamarksChecked" Unchecked="SeamarksUnchecked"/>
<ComboBox Width="250" Margin="10" VerticalAlignment="Center"
<ComboBox Width="250" VerticalAlignment="Center" Margin="0,5"
ItemsSource="{Binding MapLayers.MapLayerNames}" ItemsSource="{Binding MapLayers.MapLayerNames}"
SelectedItem="{Binding MapLayers.CurrentMapLayerName, Mode=TwoWay}"/> SelectedItem="{Binding MapLayers.CurrentMapLayerName, Mode=TwoWay}"/>
<ComboBox x:Name="projectionComboBox" Width="150" Margin="10" VerticalAlignment="Bottom"
<ComboBox x:Name="projectionComboBox" Width="150" VerticalAlignment="Center" Margin="5"
SelectedIndex="0" SelectedValuePath="Tag" SelectedIndex="0" SelectedValuePath="Tag"
SelectedValue="{Binding MapProjection, ElementName=map, Mode=TwoWay}"> SelectedValue="{Binding MapProjection, ElementName=map, Mode=TwoWay}">
<ComboBoxItem Content="Web Mercator" Tag="{StaticResource WebMercatorProjection}"/> <ComboBoxItem Content="Web Mercator" Tag="{StaticResource WebMercatorProjection}"/>

View file

@ -102,6 +102,8 @@
</Style.Triggers> </Style.Triggers>
</Style> </Style>
<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
<map:WebMercatorProjection x:Key="WebMercatorProjection"/> <map:WebMercatorProjection x:Key="WebMercatorProjection"/>
<map:WorldMercatorProjection x:Key="WorldMercatorProjection"/> <map:WorldMercatorProjection x:Key="WorldMercatorProjection"/>
<map:EquirectangularProjection x:Key="EquirectangularProjection"/> <map:EquirectangularProjection x:Key="EquirectangularProjection"/>
@ -130,10 +132,14 @@
MouseMove="MapMouseMove" MouseLeave="MapMouseLeave" MouseMove="MapMouseMove" MouseLeave="MapMouseLeave"
ManipulationInertiaStarting="MapManipulationInertiaStarting"> ManipulationInertiaStarting="MapManipulationInertiaStarting">
<Image x:Name="mapImage" Source="10_535_330.jpg" Opacity="0.5" Stretch="Fill" <Image Source="10_535_330.jpg" Stretch="Fill"
Opacity="{Binding Value, ElementName=imageOpacitySlider}"
map:MapPanel.BoundingBox="53.54031,8.08594,53.74871,8.43750"/> map:MapPanel.BoundingBox="53.54031,8.08594,53.74871,8.43750"/>
<map:MapGraticule x:Name="mapGraticule" Opacity="0.6"/> <map:MapGraticule x:Name="graticule" Opacity="0.6"
Visibility="{Binding IsChecked, ElementName=graticuleCheckBox,
Converter={StaticResource BooleanToVisibilityConverter}}"/>
<map:MapScale HorizontalAlignment="Left" VerticalAlignment="Bottom"/> <map:MapScale HorizontalAlignment="Left" VerticalAlignment="Bottom"/>
<!-- use ItemTemplate or ItemContainerStyle alternatively --> <!-- use ItemTemplate or ItemContainerStyle alternatively -->
@ -175,30 +181,37 @@
<TextBlock x:Name="mouseLocation" Margin="5" VerticalAlignment="Bottom" FontFamily="Segoe UI Mono"/> <TextBlock x:Name="mouseLocation" Margin="5" VerticalAlignment="Bottom" FontFamily="Segoe UI Mono"/>
<StackPanel Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Right"> <StackPanel Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Right">
<StackPanel Margin="5"> <StackPanel Margin="5">
<TextBlock Text="Zoom Level" Margin="0,0,0,2" HorizontalAlignment="Center" Foreground="Gray" FontSize="10"/> <TextBlock Text="Zoom Level" Margin="0,0,0,2" HorizontalAlignment="Center" FontSize="10"/>
<Slider AutoToolTipPlacement="TopLeft" AutoToolTipPrecision="0" <Slider AutoToolTipPlacement="TopLeft" AutoToolTipPrecision="0"
Width="100" VerticalAlignment="Center" SmallChange="0.01" Width="75" VerticalAlignment="Center" SmallChange="0.01"
Minimum="{Binding MinZoomLevel, ElementName=map}" Minimum="{Binding MinZoomLevel, ElementName=map}"
Maximum="{Binding MaxZoomLevel, ElementName=map}" Maximum="{Binding MaxZoomLevel, ElementName=map}"
Value="{Binding TargetZoomLevel, ElementName=map}"/> Value="{Binding TargetZoomLevel, ElementName=map}"/>
</StackPanel> </StackPanel>
<StackPanel Margin="5"> <StackPanel Margin="5">
<TextBlock Text="Heading" Margin="0,0,0,2" HorizontalAlignment="Center" Foreground="Gray" FontSize="10"/> <TextBlock Text="Heading" Margin="0,0,0,2" HorizontalAlignment="Center" FontSize="10"/>
<Slider AutoToolTipPlacement="TopLeft" AutoToolTipPrecision="0" <Slider AutoToolTipPlacement="TopLeft" AutoToolTipPrecision="0"
Width="100" VerticalAlignment="Center" SmallChange="5" LargeChange="45" Width="75" VerticalAlignment="Center" SmallChange="5" LargeChange="45"
Minimum="0" Maximum="360" Value="{Binding Heading, ElementName=map}"/> Minimum="0" Maximum="360" Value="{Binding TargetHeading, ElementName=map}"/>
</StackPanel> </StackPanel>
<StackPanel Margin="5"> <StackPanel Margin="5">
<TextBlock Text="Image Opacity" Margin="0,0,0,2" HorizontalAlignment="Center" Foreground="Gray" FontSize="10"/> <TextBlock Text="Image Opacity" Margin="0,0,0,2" HorizontalAlignment="Center" FontSize="10"/>
<Slider AutoToolTipPlacement="TopLeft" AutoToolTipPrecision="1" <Slider x:Name="imageOpacitySlider" AutoToolTipPlacement="TopLeft" AutoToolTipPrecision="1"
Width="100" VerticalAlignment="Center" Width="75" VerticalAlignment="Center" Minimum="0" Maximum="1" Value="0.5"/>
Minimum="0" Maximum="1" Value="{Binding Opacity, ElementName=mapImage}"/>
</StackPanel> </StackPanel>
<CheckBox ToolTip="Seamarks Overlay" Margin="7" VerticalAlignment="Bottom" Content="Seamarks"
<CheckBox x:Name="graticuleCheckBox" ToolTip="Graticule Overlay" Margin="8"
VerticalAlignment="Bottom" Content="Graticule"/>
<CheckBox ToolTip="Seamarks Overlay" Margin="8" VerticalAlignment="Bottom" Content="Seamarks"
Checked="SeamarksChecked" Unchecked="SeamarksUnchecked"/> Checked="SeamarksChecked" Unchecked="SeamarksUnchecked"/>
<ComboBox ToolTip="Map Layer" Width="200" Margin="5" VerticalAlignment="Bottom" <ComboBox ToolTip="Map Layer" Width="200" Margin="5" VerticalAlignment="Bottom"
ItemsSource="{Binding MapLayers.MapLayerNames}" ItemsSource="{Binding MapLayers.MapLayerNames}"
SelectedItem="{Binding MapLayers.CurrentMapLayerName}"/> SelectedItem="{Binding MapLayers.CurrentMapLayerName}"/>
<ComboBox x:Name="projectionComboBox" ToolTip="Map Projection" Width="120" Margin="5" VerticalAlignment="Bottom" <ComboBox x:Name="projectionComboBox" ToolTip="Map Projection" Width="120" Margin="5" VerticalAlignment="Bottom"
SelectedValuePath="Tag" SelectedIndex="0"> SelectedValuePath="Tag" SelectedIndex="0">
<ComboBoxItem Content="Web Mercator" Tag="{StaticResource WebMercatorProjection}"/> <ComboBoxItem Content="Web Mercator" Tag="{StaticResource WebMercatorProjection}"/>

View file

@ -109,7 +109,7 @@ namespace WpfApplication
private void SeamarksChecked(object sender, RoutedEventArgs e) private void SeamarksChecked(object sender, RoutedEventArgs e)
{ {
map.Children.Insert(map.Children.IndexOf(mapGraticule), ((MapViewModel)DataContext).MapLayers.SeamarksLayer); map.Children.Insert(map.Children.IndexOf(graticule), ((MapViewModel)DataContext).MapLayers.SeamarksLayer);
} }
private void SeamarksUnchecked(object sender, RoutedEventArgs e) private void SeamarksUnchecked(object sender, RoutedEventArgs e)