Reworked sample applications

This commit is contained in:
Clemens 2022-01-14 00:22:41 +01:00
parent 1d1b2942b4
commit 5a9f97d32e
7 changed files with 88 additions and 117 deletions

View file

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<AuthenticationMode>Windows</AuthenticationMode>
</PropertyGroup>
</Project>

View file

@ -1,5 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup />
<ItemGroup />
</Project>

View file

@ -7,8 +7,12 @@
Title="XAML MapControl - WPF Sample Application" Height="600" Width="900"
Stylus.IsPressAndHoldEnabled="False">
<Grid>
<Grid.Resources>
<Window.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="MapLayers.xaml"/>
</ResourceDictionary.MergedDictionaries>
<DataTemplate DataType="{x:Type local:PolylineItem}">
<map:MapPolyline Locations="{Binding Locations}" Stroke="Red" StrokeThickness="3"/>
</DataTemplate>
@ -28,8 +32,8 @@
<VisualState x:Name="MouseOver">
<Storyboard>
<DoubleAnimation Storyboard.TargetName="hoverPath"
Storyboard.TargetProperty="Opacity"
To="0.7" Duration="0:0:0.1"/>
Storyboard.TargetProperty="Opacity"
To="0.7" Duration="0:0:0.1"/>
</Storyboard>
</VisualState>
</VisualStateGroup>
@ -38,8 +42,8 @@
<VisualState x:Name="Selected">
<Storyboard>
<DoubleAnimation Storyboard.TargetName="selectedPath"
Storyboard.TargetProperty="Opacity"
To="0.7" Duration="0:0:0.1"/>
Storyboard.TargetProperty="Opacity"
To="0.7" Duration="0:0:0.1"/>
</Storyboard>
</VisualState>
</VisualStateGroup>
@ -61,7 +65,7 @@
</Path>
<Grid Canvas.Left="15" Canvas.Top="-8">
<local:OutlinedText Margin="1" OutlineThickness="1.5" Text="{Binding Name}"
Background="{Binding Background, RelativeSource={RelativeSource AncestorType=map:MapBase}}"/>
Background="{Binding Background, RelativeSource={RelativeSource AncestorType=map:MapBase}}"/>
</Grid>
</Canvas>
</ControlTemplate>
@ -93,15 +97,10 @@
</Trigger>
</Style.Triggers>
</Style>
</ResourceDictionary>
</Window.Resources>
<map:WebMercatorProjection x:Key="WebMercatorProjection"/>
<map:WorldMercatorProjection x:Key="WorldMercatorProjection"/>
<map:EquirectangularProjection x:Key="EquirectangularProjection"/>
<map:OrthographicProjection x:Key="OrthographicProjection"/>
<map:GnomonicProjection x:Key="GnomonicProjection"/>
<map:StereographicProjection x:Key="StereographicProjection"/>
</Grid.Resources>
<Grid>
<Grid.DataContext>
<local:MapViewModel/>
</Grid.DataContext>
@ -146,54 +145,15 @@
<tools:MapLayersMenuButton x:Name="mapLayersMenuButton"
Margin="2" Padding="6" FontSize="16" ToolTip="Map Layers and Overlays"
Map="{Binding ElementName=map}">
<tools:MapLayerItem Text="OpenStreetMap">
<map:MapTileLayer
TileSource="https://tile.openstreetmap.org/{z}/{x}/{y}.png"
SourceName="OpenStreetMap"
Description="© [OpenStreetMap contributors](http://www.openstreetmap.org/copyright)"/>
</tools:MapLayerItem>
<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:MapLayerItem Text="OpenStreetMap" Layer="{StaticResource OpenStreetMap}"/>
<tools:MapLayerItem Text="OpenStreetMap German" Layer="{StaticResource OpenStreetMapGerman}"/>
<tools:MapLayerItem Text="OpenStreetMap French" Layer="{StaticResource OpenStreetMapFrench}"/>
<tools:MapLayerItem Text="OpenTopoMap" Layer="{StaticResource OpenTopoMap}"/>
<tools:MapLayerItem Text="TopPlusOpen WMTS" Layer="{StaticResource TopPlusOpenWMTS}"/>
<tools:MapLayerItem Text="TopPlusOpen WMS" Layer="{StaticResource TopPlusOpenWMS}"/>
<tools:MapLayerItem Text="OpenStreetMap WMS" Layer="{StaticResource OpenStreetMapWMS}"/>
<tools:MapLayersMenuButton.MapOverlays>
<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="Seamarks" Layer="{StaticResource Seamarks}"/>
<tools:MapLayerItem Text="Graticule">
<map:MapGraticule Opacity="0.7"/>
</tools:MapLayerItem>

View file

@ -40,38 +40,19 @@ namespace SampleApplication
mapLayersMenuButton.MapLayers.Add(new MapLayerItem
{
Text = "Bing Maps Road",
Layer = new BingMapsTileLayer
{
Mode = BingMapsTileLayer.MapMode.Road,
SourceName = "Bing Maps Road",
Description = "© [Microsoft](http://www.bing.com/maps/)"
}
Layer = (UIElement)Resources["BingMapsRoad"]
});
mapLayersMenuButton.MapLayers.Add(new MapLayerItem
{
Text = "Bing Maps Aerial",
Layer = new BingMapsTileLayer
{
Mode = BingMapsTileLayer.MapMode.Aerial,
SourceName = "Bing Maps Aerial",
Description = "© [Microsoft](http://www.bing.com/maps/)",
MapForeground = new SolidColorBrush(Colors.White),
MapBackground = new SolidColorBrush(Colors.Black)
}
Layer = (UIElement)Resources["BingMapsAerial"]
});
mapLayersMenuButton.MapLayers.Add(new MapLayerItem
{
Text = "Bing Maps Aerial with Labels",
Layer = new BingMapsTileLayer
{
Mode = BingMapsTileLayer.MapMode.AerialWithLabels,
SourceName = "Bing Maps Hybrid",
Description = "© [Microsoft](http://www.bing.com/maps/)",
MapForeground = new SolidColorBrush(Colors.White),
MapBackground = new SolidColorBrush(Colors.Black)
}
Layer = (UIElement)Resources["BingMapsHybrid"]
});
}

View file

@ -0,0 +1,63 @@
<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="http://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)"/>
<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)"/>
</ResourceDictionary>

View file

@ -31,10 +31,4 @@
<Reference Include="System.Net.Http" />
<Reference Include="System.Runtime.Caching" />
</ItemGroup>
<ItemGroup>
<None Update="App.config">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>

View file

@ -1,16 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ActiveDebugFramework>net6.0-windows</ActiveDebugFramework>
</PropertyGroup>
<ItemGroup>
<ApplicationDefinition Update="App.xaml">
<SubType>Designer</SubType>
</ApplicationDefinition>
</ItemGroup>
<ItemGroup>
<Page Update="MainWindow.xaml">
<SubType>Designer</SubType>
</Page>
</ItemGroup>
</Project>