Updated ProjectionDemo

This commit is contained in:
ClemensFischer 2025-01-24 20:12:31 +01:00
parent 8745bb9660
commit fdfa8348eb
2 changed files with 21 additions and 20 deletions

View file

@ -4,8 +4,15 @@
xmlns:map="clr-namespace:MapControl;assembly=MapControl.WPF" xmlns:map="clr-namespace:MapControl;assembly=MapControl.WPF"
Title="XAML MapControl - Projection Demo" Height="600" Width="800" Title="XAML MapControl - Projection Demo" Height="600" Width="800"
Loaded="Window_Loaded"> Loaded="Window_Loaded">
<DockPanel> <Grid>
<StackPanel DockPanel.Dock="Bottom" Orientation="Horizontal"> <map:Map MaxZoomLevel="22" ZoomLevel="10" Center="50.1,8.25" MapLayer="{Binding CurrentLayer}"
MapProjection="{Binding CurrentProjection}"
MouseRightButtonUp="Map_MouseRightButtonUp">
<map:Pushpin map:MapPanel.Location="{Binding PushpinLocation}"
Content="{Binding PushpinText}"/>
</map:Map>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Bottom" Margin="4">
<ComboBox Margin="2" <ComboBox Margin="2"
ItemsSource="{Binding Projections}" ItemsSource="{Binding Projections}"
SelectedItem="{Binding CurrentProjection}" SelectedItem="{Binding CurrentProjection}"
@ -16,19 +23,5 @@
SelectedValuePath="Value" SelectedValuePath="Value"
DisplayMemberPath="Key"/> DisplayMemberPath="Key"/>
</StackPanel> </StackPanel>
</Grid>
<map:Map MaxZoomLevel="22" ZoomLevel="8" Center="50,8" MapLayer="{Binding CurrentLayer}"
MouseRightButtonUp="Map_MouseRightButtonUp">
<map:MapBase.MapProjection>
<Binding Path="CurrentProjection">
<Binding.FallbackValue>
<map:WebMercatorProjection/>
</Binding.FallbackValue>
</Binding>
</map:MapBase.MapProjection>
<map:Pushpin map:MapPanel.Location="{Binding PushpinLocation}"
Content="{Binding PushpinText}"/>
</map:Map>
</DockPanel>
</Window> </Window>

View file

@ -39,12 +39,20 @@ namespace ProjectionDemo
WmsLayers = "web" WmsLayers = "web"
}); });
viewModel.Layers.Add(
"Basemap.de WMS",
new WmsImageLayer
{
ServiceUri = new Uri("https://sgx.geodatenzentrum.de/wms_basemapde"),
WmsLayers = "de_basemapde_web_raster_farbe"
});
viewModel.Layers.Add( viewModel.Layers.Add(
"Orthophotos Wiesbaden", "Orthophotos Wiesbaden",
new WmsImageLayer new WmsImageLayer
{ {
ServiceUri = new Uri("https://geoportal.wiesbaden.de/cgi-bin/mapserv.fcgi?map=d:/openwimap/umn/map/orthophoto/orthophotos.map"), ServiceUri = new Uri("https://geoportal.wiesbaden.de/cgi-bin/mapserv.fcgi?map=d:/openwimap/umn/map/orthophoto/orthophotos.map"),
WmsLayers = "orthophoto2017" WmsLayers = "orthophoto2023"
}); });
viewModel.CurrentProjection = viewModel.Projections[0]; viewModel.CurrentProjection = viewModel.Projections[0];
@ -70,9 +78,9 @@ namespace ProjectionDemo
public event PropertyChangedEventHandler PropertyChanged; public event PropertyChangedEventHandler PropertyChanged;
public List<MapProjection> Projections { get; } = new List<MapProjection>(); public List<MapProjection> Projections { get; } = [];
public Dictionary<string, IMapLayer> Layers { get; } = new Dictionary<string, IMapLayer>(); public Dictionary<string, IMapLayer> Layers { get; } = [];
public MapProjection CurrentProjection public MapProjection CurrentProjection
{ {