Removed MapLayers Resources

This commit is contained in:
ClemensFischer 2024-04-23 18:32:07 +02:00
parent 70afff72e0
commit 1b8a89a504
3 changed files with 69 additions and 80 deletions

View file

@ -9,10 +9,6 @@
<Window.Resources> <Window.Resources>
<ResourceDictionary> <ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="MapLayers.xaml"/>
</ResourceDictionary.MergedDictionaries>
<DataTemplate DataType="{x:Type local:PolylineItem}"> <DataTemplate DataType="{x:Type local:PolylineItem}">
<map:MapPolyline Locations="{Binding Locations}" Stroke="Red" StrokeThickness="3"/> <map:MapPolyline Locations="{Binding Locations}" Stroke="Red" StrokeThickness="3"/>
</DataTemplate> </DataTemplate>
@ -189,13 +185,46 @@
<tools:MapLayersMenuButton x:Name="mapLayersMenuButton" <tools:MapLayersMenuButton x:Name="mapLayersMenuButton"
Margin="2" ToolTip="Map Layers and Overlays" Margin="2" ToolTip="Map Layers and Overlays"
Map="{Binding ElementName=map}"> Map="{Binding ElementName=map}">
<tools:MapLayerItem Text="OpenStreetMap" Layer="{StaticResource OpenStreetMap}"/> <tools:MapLayerItem Text="OpenStreetMap">
<tools:MapLayerItem Text="OpenStreetMap German" Layer="{StaticResource OpenStreetMapGerman}"/> <map:MapTileLayer
<tools:MapLayerItem Text="OpenStreetMap French" Layer="{StaticResource OpenStreetMapFrench}"/> TileSource="https://tile.openstreetmap.org/{z}/{x}/{y}.png"
<tools:MapLayerItem Text="OpenTopoMap" Layer="{StaticResource OpenTopoMap}"/> SourceName="OpenStreetMap"
<tools:MapLayerItem Text="TopPlusOpen WMTS" Layer="{StaticResource TopPlusOpenWMTS}"/> Description="© [OpenStreetMap contributors](http://www.openstreetmap.org/copyright)"/>
<tools:MapLayerItem Text="TopPlusOpen WMS" Layer="{StaticResource TopPlusOpenWMS}"/> </tools:MapLayerItem>
<tools:MapLayerItem Text="OpenStreetMap WMS" Layer="{StaticResource OpenStreetMapWMS}"/> <tools:MapLayerItem Text="OpenStreetMap German">
<map:MapTileLayer
TileSource="https://{s}.tile.openstreetmap.de/{z}/{x}/{y}.png"
SourceName="OpenStreetMap German"
Description="© [OpenStreetMap contributors](http://www.openstreetmap.org/copyright)"/>
</tools:MapLayerItem>
<tools:MapLayerItem Text="OpenStreetMap French">
<map:MapTileLayer
TileSource="http://{s}.tile.openstreetmap.fr/osmfr/{z}/{x}/{y}.png"
SourceName="OpenStreetMap French"
Description="© [OpenStreetMap France](https://www.openstreetmap.fr/mentions-legales/) © [OpenStreetMap contributors](http://www.openstreetmap.org/copyright)"/>
</tools:MapLayerItem>
<tools:MapLayerItem Text="OpenTopoMap">
<map:MapTileLayer
TileSource="https://tile.opentopomap.org/{z}/{x}/{y}.png"
SourceName="OpenTopoMap"
Description="© [OpenTopoMap](https://opentopomap.org/) © [OpenStreetMap contributors](http://www.openstreetmap.org/copyright)"/>
</tools:MapLayerItem>
<tools:MapLayerItem Text="TopPlusOpen WMTS">
<map:WmtsTileLayer
CapabilitiesUri="https://sgx.geodatenzentrum.de/wmts_topplus_open/1.0.0/WMTSCapabilities.xml"
SourceName="TopPlusOpen"
Description="© [BKG](https://gdz.bkg.bund.de/index.php/default/webdienste/topplus-produkte/wmts-topplusopen-wmts-topplus-open.html)"/>
</tools:MapLayerItem>
<tools:MapLayerItem Text="TopPlusOpen WMS">
<map:WmsImageLayer
ServiceUri="https://sgx.geodatenzentrum.de/wms_topplus_open"
Description="© [BKG](https://gdz.bkg.bund.de/index.php/default/webdienste/topplus-produkte/wms-topplusopen-mit-layer-fur-normalausgabe-und-druck-wms-topplus-open.html)"/>
</tools:MapLayerItem>
<tools:MapLayerItem Text="OpenStreetMap WMS">
<map:WmsImageLayer
ServiceUri="http://ows.terrestris.de/osm/service"
Description="© [terrestris GmbH &amp; Co. KG](http://ows.terrestris.de/) © [OpenStreetMap contributors](http://www.openstreetmap.org/copyright)"/>
</tools:MapLayerItem>
<tools:MapLayersMenuButton.MapOverlays> <tools:MapLayersMenuButton.MapOverlays>
<tools:MapLayerItem Text="Graticule"> <tools:MapLayerItem Text="Graticule">
<map:MapGraticule Opacity="0.7"/> <map:MapGraticule Opacity="0.7"/>
@ -203,7 +232,12 @@
<tools:MapLayerItem Text="Scale"> <tools:MapLayerItem Text="Scale">
<map:MapScale HorizontalAlignment="Center" VerticalAlignment="Bottom"/> <map:MapScale HorizontalAlignment="Center" VerticalAlignment="Bottom"/>
</tools:MapLayerItem> </tools:MapLayerItem>
<tools:MapLayerItem Text="Seamarks" Layer="{StaticResource Seamarks}"/> <tools:MapLayerItem Text="Seamarks">
<map:MapTileLayer
TileSource="http://tiles.openseamap.org/seamark/{z}/{x}/{y}.png"
SourceName="Seamarks"
MinZoomLevel="9" MaxZoomLevel="18"/>
</tools:MapLayerItem>
<tools:MapLayerItem Text="Sample Image"> <tools:MapLayerItem Text="Sample Image">
<Image Source="10_535_330.jpg" Stretch="Fill" <Image Source="10_535_330.jpg" Stretch="Fill"
map:MapPanel.BoundingBox="53.54031,8.08594,53.74871,8.43750"/> map:MapPanel.BoundingBox="53.54031,8.08594,53.74871,8.43750"/>

View file

@ -7,6 +7,7 @@ using System.IO;
using System.Linq; using System.Linq;
using System.Windows; using System.Windows;
using System.Windows.Input; using System.Windows.Input;
using System.Windows.Media;
namespace SampleApplication namespace SampleApplication
{ {
@ -41,19 +42,38 @@ namespace SampleApplication
mapLayersMenuButton.MapLayers.Add(new MapLayerItem mapLayersMenuButton.MapLayers.Add(new MapLayerItem
{ {
Text = "Bing Maps Road", Text = "Bing Maps Road",
Layer = (UIElement)Resources["BingMapsRoad"] Layer = new BingMapsTileLayer
{
Mode = BingMapsTileLayer.MapMode.Road,
SourceName = "Bing Maps Road",
Description = "© [Microsoft](http://www.bing.com/maps/)"
}
}); });
mapLayersMenuButton.MapLayers.Add(new MapLayerItem mapLayersMenuButton.MapLayers.Add(new MapLayerItem
{ {
Text = "Bing Maps Aerial", Text = "Bing Maps Aerial",
Layer = (UIElement)Resources["BingMapsAerial"] Layer = new BingMapsTileLayer
{
Mode = BingMapsTileLayer.MapMode.Aerial,
SourceName = "Bing Maps Aerial",
Description = "© [Microsoft](http://www.bing.com/maps/)",
MapForeground = Brushes.White,
MapBackground = Brushes.Black
}
}); });
mapLayersMenuButton.MapLayers.Add(new MapLayerItem mapLayersMenuButton.MapLayers.Add(new MapLayerItem
{ {
Text = "Bing Maps Aerial with Labels", Text = "Bing Maps Aerial with Labels",
Layer = (UIElement)Resources["BingMapsHybrid"] Layer = new BingMapsTileLayer
{
Mode = BingMapsTileLayer.MapMode.AerialWithLabels,
SourceName = "Bing Maps Hybrid",
Description = "© [Microsoft](http://www.bing.com/maps/)",
MapForeground = Brushes.White,
MapBackground = Brushes.Black
}
}); });
} }

View file

@ -1,65 +0,0 @@
<ResourceDictionary
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">
<map:MapTileLayer
x:Key="OpenStreetMap"
TileSource="https://tile.openstreetmap.org/{z}/{x}/{y}.png"
SourceName="OpenStreetMap"
Description="© [OpenStreetMap contributors](http://www.openstreetmap.org/copyright)"/>
<map:MapTileLayer
x:Key="OpenStreetMapGerman"
TileSource="https://{s}.tile.openstreetmap.de/{z}/{x}/{y}.png"
SourceName="OpenStreetMap German"
Description="© [OpenStreetMap contributors](http://www.openstreetmap.org/copyright)"/>
<map:MapTileLayer
x:Key="OpenStreetMapFrench"
TileSource="http://{s}.tile.openstreetmap.fr/osmfr/{z}/{x}/{y}.png"
SourceName="OpenStreetMap French"
Description="© [OpenStreetMap France](https://www.openstreetmap.fr/mentions-legales/) © [OpenStreetMap contributors](http://www.openstreetmap.org/copyright)"/>
<map:MapTileLayer
x:Key="OpenTopoMap"
TileSource="https://tile.opentopomap.org/{z}/{x}/{y}.png"
SourceName="OpenTopoMap"
Description="© [OpenTopoMap](https://opentopomap.org/) © [OpenStreetMap contributors](http://www.openstreetmap.org/copyright)"/>
<map:MapTileLayer
x:Key="Seamarks"
TileSource="https://tiles.openseamap.org/seamark/{z}/{x}/{y}.png"
SourceName="Seamarks"
MinZoomLevel="9"
MaxZoomLevel="18"/>
<map:BingMapsTileLayer
x:Key="BingMapsRoad"
Mode="Road"
SourceName="Bing Maps Road"
Description="© [Microsoft](http://www.bing.com/maps/)"/>
<map:BingMapsTileLayer
x:Key="BingMapsAerial"
Mode="Aerial"
SourceName="Bing Maps Aerial"
Description="© [Microsoft](http://www.bing.com/maps/)"
MapBackground="Black"
MapForeground="White"/>
<map:BingMapsTileLayer
x:Key="BingMapsHybrid"
Mode="AerialWithLabels"
SourceName="Bing Maps Hybrid"
Description="© [Microsoft](http://www.bing.com/maps/)"
MapBackground="Black"
MapForeground="White"/>
<map:WmtsTileLayer
x:Key="TopPlusOpenWMTS"
CapabilitiesUri="https://sgx.geodatenzentrum.de/wmts_topplus_open/1.0.0/WMTSCapabilities.xml"
SourceName="TopPlusOpen"
Description="© [BKG](https://gdz.bkg.bund.de/index.php/default/webdienste/topplus-produkte/wmts-topplusopen-wmts-topplus-open.html)"/>
<map:WmsImageLayer
x:Key="TopPlusOpenWMS"
ServiceUri="https://sgx.geodatenzentrum.de/wms_topplus_open"
Description="© [BKG](https://gdz.bkg.bund.de/index.php/default/webdienste/topplus-produkte/wms-topplusopen-mit-layer-fur-normalausgabe-und-druck-wms-topplus-open.html)"
RelativeImageSize="1.2"/>
<map:WmsImageLayer
x:Key="OpenStreetMapWMS"
ServiceUri="http://ows.terrestris.de/osm/service"
Description="© [terrestris GmbH &amp; Co. KG](http://ows.terrestris.de/) © [OpenStreetMap contributors](http://www.openstreetmap.org/copyright)"
RelativeImageSize="1.2"/>
</ResourceDictionary>