mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2026-04-06 06:55:04 +00:00
Version 3.1.Added support for different map projections.
This commit is contained in:
parent
06c3ed56c1
commit
643abeca1e
124 changed files with 3074 additions and 2497 deletions
198
SampleApps/Common/MapLayers.cs
Normal file
198
SampleApps/Common/MapLayers.cs
Normal file
|
|
@ -0,0 +1,198 @@
|
|||
using MapControl;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
#if NETFX_CORE
|
||||
using Windows.UI;
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Media;
|
||||
#else
|
||||
using System.Windows;
|
||||
using System.Windows.Media;
|
||||
#endif
|
||||
|
||||
namespace ViewModel
|
||||
{
|
||||
public class MapLayers : INotifyPropertyChanged
|
||||
{
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
private readonly Dictionary<string, UIElement> mapLayers = new Dictionary<string, UIElement>
|
||||
{
|
||||
{
|
||||
"OpenStreetMap",
|
||||
MapTileLayer.OpenStreetMapTileLayer
|
||||
},
|
||||
{
|
||||
"OpenStreetMap German Style",
|
||||
new MapTileLayer
|
||||
{
|
||||
SourceName = "OpenStreetMap German",
|
||||
Description = "© [OpenStreetMap Contributors](http://www.openstreetmap.org/copyright)",
|
||||
TileSource = new TileSource { UriFormat = "http://{c}.tile.openstreetmap.de/tiles/osmde/{z}/{x}/{y}.png" }
|
||||
}
|
||||
},
|
||||
{
|
||||
"Thunderforest OpenCycleMap",
|
||||
new MapTileLayer
|
||||
{
|
||||
SourceName = "Thunderforest OpenCycleMap",
|
||||
Description = "Maps © [Thunderforest](http://www.thunderforest.com/), Data © [OpenStreetMap Contributors](http://www.openstreetmap.org/copyright)",
|
||||
TileSource = new TileSource { UriFormat = "http://{c}.tile.thunderforest.com/cycle/{z}/{x}/{y}.png" }
|
||||
}
|
||||
},
|
||||
{
|
||||
"Thunderforest Landscape",
|
||||
new MapTileLayer
|
||||
{
|
||||
SourceName = "Thunderforest Landscape",
|
||||
Description = "Maps © [Thunderforest](http://www.thunderforest.com/), Data © [OpenStreetMap Contributors](http://www.openstreetmap.org/copyright)",
|
||||
TileSource = new TileSource { UriFormat = "http://{c}.tile.thunderforest.com/landscape/{z}/{x}/{y}.png" }
|
||||
}
|
||||
},
|
||||
{
|
||||
"Thunderforest Outdoors",
|
||||
new MapTileLayer
|
||||
{
|
||||
SourceName = "Thunderforest Outdoors",
|
||||
Description = "Maps © [Thunderforest](http://www.thunderforest.com/), Data © [OpenStreetMap Contributors](http://www.openstreetmap.org/copyright)",
|
||||
TileSource = new TileSource { UriFormat = "http://{c}.tile.thunderforest.com/outdoors/{z}/{x}/{y}.png" }
|
||||
}
|
||||
},
|
||||
{
|
||||
"Thunderforest Transport",
|
||||
new MapTileLayer
|
||||
{
|
||||
SourceName = "Thunderforest Transport",
|
||||
Description = "Maps © [Thunderforest](http://www.thunderforest.com/), Data © [OpenStreetMap Contributors](http://www.openstreetmap.org/copyright)",
|
||||
TileSource = new TileSource { UriFormat = "http://{c}.tile.thunderforest.com/transport/{z}/{x}/{y}.png" }
|
||||
}
|
||||
},
|
||||
{
|
||||
"Thunderforest Transport Dark",
|
||||
new MapTileLayer
|
||||
{
|
||||
SourceName = "Thunderforest Transport Dark",
|
||||
Description = "Maps © [Thunderforest](http://www.thunderforest.com/), Data © [OpenStreetMap Contributors](http://www.openstreetmap.org/copyright)",
|
||||
TileSource = new TileSource { UriFormat = "http://{c}.tile.thunderforest.com/transport-dark/{z}/{x}/{y}.png" },
|
||||
MapForeground = new SolidColorBrush(Colors.White),
|
||||
MapBackground = new SolidColorBrush(Colors.Black)
|
||||
}
|
||||
},
|
||||
{
|
||||
"Seamarks",
|
||||
new MapTileLayer
|
||||
{
|
||||
SourceName = "OpenSeaMap",
|
||||
TileSource = new TileSource { UriFormat = "http://tiles.openseamap.org/seamark/{z}/{x}/{y}.png" },
|
||||
MinZoomLevel = 9,
|
||||
MaxZoomLevel = 18
|
||||
}
|
||||
},
|
||||
{
|
||||
"Bing Maps Road",
|
||||
new BingMapsTileLayer
|
||||
{
|
||||
SourceName = "Bing Maps Road",
|
||||
Description = "© [Microsoft Corporation](http://www.bing.com/maps/)",
|
||||
Mode = BingMapsTileLayer.MapMode.Road,
|
||||
MaxZoomLevel = 19
|
||||
}
|
||||
},
|
||||
{
|
||||
"Bing Maps Aerial",
|
||||
new BingMapsTileLayer
|
||||
{
|
||||
SourceName = "Bing Maps Aerial",
|
||||
Description = "© [Microsoft Corporation](http://www.bing.com/maps/)",
|
||||
Mode = BingMapsTileLayer.MapMode.Aerial,
|
||||
MaxZoomLevel = 19,
|
||||
MapForeground = new SolidColorBrush(Colors.White),
|
||||
MapBackground = new SolidColorBrush(Colors.Black)
|
||||
}
|
||||
},
|
||||
{
|
||||
"Bing Maps Aerial with Labels",
|
||||
new BingMapsTileLayer
|
||||
{
|
||||
SourceName = "Bing Maps Hybrid",
|
||||
Description = "© [Microsoft Corporation](http://www.bing.com/maps/)",
|
||||
Mode = BingMapsTileLayer.MapMode.AerialWithLabels,
|
||||
MaxZoomLevel = 19,
|
||||
MapForeground = new SolidColorBrush(Colors.White),
|
||||
MapBackground = new SolidColorBrush(Colors.Black)
|
||||
}
|
||||
},
|
||||
{
|
||||
"OpenStreetMap WMS",
|
||||
new WmsImageLayer
|
||||
{
|
||||
Description = "OpenStreetMap WMS",
|
||||
ServerUri = new Uri("http://ows.terrestris.de/osm/service"),
|
||||
Layers = "OSM-WMS",
|
||||
MapBackground = new SolidColorBrush(Colors.LightGray)
|
||||
}
|
||||
},
|
||||
{
|
||||
"OpenStreetMap TOPO WMS",
|
||||
new WmsImageLayer
|
||||
{
|
||||
Description = "OpenStreetMap TOPO WMS",
|
||||
ServerUri = new Uri("http://ows.terrestris.de/osm/service"),
|
||||
Layers = "TOPO-OSM-WMS",
|
||||
MapBackground = new SolidColorBrush(Colors.LightGray)
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
private string currentMapLayerName = "OpenStreetMap";
|
||||
|
||||
public string CurrentMapLayerName
|
||||
{
|
||||
get { return currentMapLayerName; }
|
||||
set
|
||||
{
|
||||
currentMapLayerName = value;
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(CurrentMapLayerName)));
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(CurrentMapLayer)));
|
||||
}
|
||||
}
|
||||
|
||||
public UIElement CurrentMapLayer
|
||||
{
|
||||
get { return mapLayers[currentMapLayerName]; }
|
||||
}
|
||||
|
||||
public UIElement SeamarksLayer
|
||||
{
|
||||
get { return mapLayers["Seamarks"]; }
|
||||
}
|
||||
|
||||
public List<string> MapLayerNames { get; } = new List<string>
|
||||
{
|
||||
"OpenStreetMap",
|
||||
"OpenStreetMap German Style",
|
||||
"Thunderforest OpenCycleMap",
|
||||
//"Thunderforest Landscape",
|
||||
//"Thunderforest Outdoors",
|
||||
//"Thunderforest Transport",
|
||||
//"Thunderforest Transport Dark",
|
||||
"OpenStreetMap WMS",
|
||||
"OpenStreetMap TOPO WMS"
|
||||
};
|
||||
|
||||
public MapLayers()
|
||||
{
|
||||
//BingMapsTileLayer.ApiKey = "...";
|
||||
|
||||
// Bing Maps TileLayers with tile URLs retrieved from the Imagery Metadata Service
|
||||
// (see http://msdn.microsoft.com/en-us/library/ff701716.aspx).
|
||||
// A Bing Maps API Key (see http://msdn.microsoft.com/en-us/library/ff428642.aspx) is required
|
||||
// for using these layers and must be assigned to the static BingMapsTileLayer.ApiKey property.
|
||||
|
||||
//MapLayerNames.Add("Bing Maps Road");
|
||||
//MapLayerNames.Add("Bing Maps Aerial");
|
||||
//MapLayerNames.Add("Bing Maps Aerial with Labels");
|
||||
}
|
||||
}
|
||||
}
|
||||
130
SampleApps/Common/MapViewModel.cs
Normal file
130
SampleApps/Common/MapViewModel.cs
Normal file
|
|
@ -0,0 +1,130 @@
|
|||
using MapControl;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace ViewModel
|
||||
{
|
||||
public class ViewModelBase : INotifyPropertyChanged
|
||||
{
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
protected void RaisePropertyChanged(string propertyName)
|
||||
{
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
}
|
||||
|
||||
public class PointItem : ViewModelBase
|
||||
{
|
||||
private string name;
|
||||
public string Name
|
||||
{
|
||||
get { return name; }
|
||||
set
|
||||
{
|
||||
name = value;
|
||||
RaisePropertyChanged(nameof(Name));
|
||||
}
|
||||
}
|
||||
|
||||
private Location location;
|
||||
public Location Location
|
||||
{
|
||||
get { return location; }
|
||||
set
|
||||
{
|
||||
location = value;
|
||||
RaisePropertyChanged(nameof(Location));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class Polyline
|
||||
{
|
||||
public LocationCollection Locations { get; set; }
|
||||
}
|
||||
|
||||
public class MapViewModel : ViewModelBase
|
||||
{
|
||||
private Location mapCenter = new Location(53.5, 8.2);
|
||||
public Location MapCenter
|
||||
{
|
||||
get { return mapCenter; }
|
||||
set
|
||||
{
|
||||
mapCenter = value;
|
||||
RaisePropertyChanged(nameof(MapCenter));
|
||||
}
|
||||
}
|
||||
|
||||
public ObservableCollection<PointItem> Points { get; } = new ObservableCollection<PointItem>();
|
||||
public ObservableCollection<PointItem> Pushpins { get; } = new ObservableCollection<PointItem>();
|
||||
public ObservableCollection<Polyline> Polylines { get; } = new ObservableCollection<Polyline>();
|
||||
|
||||
public MapLayers MapLayers { get; } = new MapLayers();
|
||||
|
||||
public MapViewModel()
|
||||
{
|
||||
Points.Add(new PointItem
|
||||
{
|
||||
Name = "Steinbake Leitdamm",
|
||||
Location = new Location(53.51217, 8.16603)
|
||||
});
|
||||
Points.Add(new PointItem
|
||||
{
|
||||
Name = "Buhne 2",
|
||||
Location = new Location(53.50926, 8.15815)
|
||||
});
|
||||
Points.Add(new PointItem
|
||||
{
|
||||
Name = "Buhne 4",
|
||||
Location = new Location(53.50468, 8.15343)
|
||||
});
|
||||
Points.Add(new PointItem
|
||||
{
|
||||
Name = "Buhne 6",
|
||||
Location = new Location(53.50092, 8.15267)
|
||||
});
|
||||
Points.Add(new PointItem
|
||||
{
|
||||
Name = "Buhne 8",
|
||||
Location = new Location(53.49871, 8.15321)
|
||||
});
|
||||
Points.Add(new PointItem
|
||||
{
|
||||
Name = "Buhne 10",
|
||||
Location = new Location(53.49350, 8.15563)
|
||||
});
|
||||
|
||||
Pushpins.Add(new PointItem
|
||||
{
|
||||
Name = "WHV - Eckwarderhörne",
|
||||
Location = new Location(53.5495, 8.1877)
|
||||
});
|
||||
Pushpins.Add(new PointItem
|
||||
{
|
||||
Name = "JadeWeserPort",
|
||||
Location = new Location(53.5914, 8.14)
|
||||
});
|
||||
Pushpins.Add(new PointItem
|
||||
{
|
||||
Name = "Kurhaus Dangast",
|
||||
Location = new Location(53.447, 8.1114)
|
||||
});
|
||||
Pushpins.Add(new PointItem
|
||||
{
|
||||
Name = "Eckwarderhörne",
|
||||
Location = new Location(53.5207, 8.2323)
|
||||
});
|
||||
|
||||
Polylines.Add(new Polyline
|
||||
{
|
||||
Locations = LocationCollection.Parse("53.5140,8.1451 53.5123,8.1506 53.5156,8.1623 53.5276,8.1757 53.5491,8.1852 53.5495,8.1877 53.5426,8.1993 53.5184,8.2219 53.5182,8.2386 53.5195,8.2387")
|
||||
});
|
||||
Polylines.Add(new Polyline
|
||||
{
|
||||
Locations = LocationCollection.Parse("53.5978,8.1212 53.6018,8.1494 53.5859,8.1554 53.5852,8.1531 53.5841,8.1539 53.5802,8.1392 53.5826,8.1309 53.5867,8.1317 53.5978,8.1212")
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -5,10 +5,10 @@ using System.Runtime.InteropServices;
|
|||
[assembly: AssemblyDescription("XAML Map Control Silverlight/Web Sample Application")]
|
||||
[assembly: AssemblyProduct("XAML Map Control")]
|
||||
[assembly: AssemblyCompany("Clemens Fischer")]
|
||||
[assembly: AssemblyCopyright("© 2016 Clemens Fischer")]
|
||||
[assembly: AssemblyCopyright("© 2017 Clemens Fischer")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyVersion("2.14.0")]
|
||||
[assembly: AssemblyFileVersion("2.14.0")]
|
||||
[assembly: AssemblyVersion("3.1.0")]
|
||||
[assembly: AssemblyFileVersion("3.1.0")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
[assembly: ComVisible(false)]
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
|
|
@ -7,7 +7,7 @@
|
|||
<ProductVersion>
|
||||
</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{177C4EF8-0B0A-426E-BDCC-168DC10AC1C1}</ProjectGuid>
|
||||
<ProjectGuid>{7FB616E1-E0D4-48FA-8AFD-60E73FCF32E4}</ProjectGuid>
|
||||
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
|
|
@ -19,7 +19,9 @@
|
|||
<IISExpressAnonymousAuthentication />
|
||||
<IISExpressWindowsAuthentication />
|
||||
<IISExpressUseClassicPipelineMode />
|
||||
<SilverlightApplicationList>{CBA8C535-CCA3-4F60-8D3E-0E25791CBD21}|..\SilverlightApplication\SilverlightApplication.csproj|ClientBin|False</SilverlightApplicationList>
|
||||
<UseGlobalApplicationHostFile />
|
||||
<SilverlightApplicationList>{85AACDB7-959D-406D-A8DF-2F1E013F8F40}|..\SilverlightApplication\SilverlightApplication.csproj|ClientBin|False</SilverlightApplicationList>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
|
|
@ -38,25 +40,6 @@
|
|||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Web.DynamicData" />
|
||||
<Reference Include="System.Web.Entity" />
|
||||
<Reference Include="System.Web.ApplicationServices" />
|
||||
<Reference Include="System.ComponentModel.DataAnnotations" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="System.Web.Extensions" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Web" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Web.Services" />
|
||||
<Reference Include="System.EnterpriseServices" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="ClientBin\SilverlightApplication.xap" />
|
||||
<Content Include="Silverlight.js" />
|
||||
|
|
@ -89,7 +72,7 @@
|
|||
<WebProjectProperties>
|
||||
<UseIIS>True</UseIIS>
|
||||
<AutoAssignPort>True</AutoAssignPort>
|
||||
<DevelopmentServerPort>51248</DevelopmentServerPort>
|
||||
<DevelopmentServerPort>54149</DevelopmentServerPort>
|
||||
<DevelopmentServerVPath>/</DevelopmentServerVPath>
|
||||
<IISUrl>http://localhost:51216/</IISUrl>
|
||||
<NTLMAuthentication>False</NTLMAuthentication>
|
||||
|
|
|
|||
|
|
@ -1,14 +1,17 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<UseIISExpress>true</UseIISExpress>
|
||||
<SilverlightApplicationList>{85AACDB7-959D-406D-A8DF-2F1E013F8F40}|..\SilverlightApplication\SilverlightApplication.csproj|ClientBin|False</SilverlightApplicationList>
|
||||
</PropertyGroup>
|
||||
<ProjectExtensions>
|
||||
<VisualStudio>
|
||||
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
|
||||
<WebProjectProperties>
|
||||
<StartPageUrl>
|
||||
</StartPageUrl>
|
||||
<StartAction>CurrentPage</StartAction>
|
||||
<StartPageUrl>SilverlightApplicationTestPage.aspx</StartPageUrl>
|
||||
<StartAction>SpecificPage</StartAction>
|
||||
<AspNetDebugging>True</AspNetDebugging>
|
||||
<SilverlightDebugging>False</SilverlightDebugging>
|
||||
<SilverlightDebugging>True</SilverlightDebugging>
|
||||
<NativeDebugging>False</NativeDebugging>
|
||||
<SQLDebugging>False</SQLDebugging>
|
||||
<ExternalProgram>
|
||||
|
|
@ -22,7 +25,7 @@
|
|||
<EnableENC>True</EnableENC>
|
||||
<AlwaysStartWebServerOnDebug>True</AlwaysStartWebServerOnDebug>
|
||||
<ProjectOutputReferences>
|
||||
<Ref Project="{CBA8C535-CCA3-4F60-8D3E-0E25791CBD21}" Folder="ClientBin">SilverlightApplication.xap</Ref>
|
||||
<Ref Project="{85AACDB7-959D-406D-A8DF-2F1E013F8F40}" Folder="ClientBin">SilverlightApplication.xap</Ref>
|
||||
</ProjectOutputReferences>
|
||||
</WebProjectProperties>
|
||||
</FlavorProperties>
|
||||
|
|
|
|||
|
|
@ -1,14 +1,19 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<!--
|
||||
For more information on how to configure your ASP.NET application, please visit
|
||||
http://go.microsoft.com/fwlink/?LinkId=169433
|
||||
-->
|
||||
|
||||
<configuration>
|
||||
<system.web>
|
||||
<compilation debug="true" targetFramework="4.5" />
|
||||
<httpRuntime targetFramework="4.5" />
|
||||
</system.web>
|
||||
<!--
|
||||
For a description of web.config changes see http://go.microsoft.com/fwlink/?LinkId=235367.
|
||||
|
||||
</configuration>
|
||||
The following attributes can be set on the <httpRuntime> tag.
|
||||
<system.Web>
|
||||
<httpRuntime targetFramework="4.5" />
|
||||
</system.Web>
|
||||
-->
|
||||
<system.web>
|
||||
<compilation debug="true" targetFramework="4.5"/>
|
||||
<httpRuntime targetFramework="4.5"/>
|
||||
</system.web>
|
||||
</configuration>
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
<Application xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
x:Class="SilverlightApplication.App">
|
||||
<Application x:Class="SilverlightApplication.App"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<Application.Resources>
|
||||
</Application.Resources>
|
||||
</Application>
|
||||
|
|
|
|||
|
|
@ -27,16 +27,8 @@ namespace SilverlightApplication
|
|||
|
||||
private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
|
||||
{
|
||||
// If the app is running outside of the debugger then report the exception using
|
||||
// the browser's exception mechanism. On IE this will display it a yellow alert
|
||||
// icon in the status bar and Firefox will display a script error.
|
||||
if (!System.Diagnostics.Debugger.IsAttached)
|
||||
{
|
||||
|
||||
// NOTE: This will allow the application to continue running after an exception has been thrown
|
||||
// but not handled.
|
||||
// For production applications this error handling should be replaced with something that will
|
||||
// report the error to the website and stop the application.
|
||||
e.Handled = true;
|
||||
Deployment.Current.Dispatcher.BeginInvoke(delegate { ReportErrorToDOM(e); });
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,55 +9,6 @@
|
|||
xmlns:local="clr-namespace:SilverlightApplication"
|
||||
mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="400">
|
||||
<UserControl.Resources>
|
||||
<map:TileLayerCollection x:Key="TileLayers">
|
||||
<!--
|
||||
TileLayers with OpenStreetMap data.
|
||||
-->
|
||||
<map:TileLayer SourceName="OpenStreetMap"
|
||||
Description="Maps © [OpenStreetMap Contributors](http://www.openstreetmap.org/copyright)"
|
||||
TileSource="http://{c}.tile.openstreetmap.org/{z}/{x}/{y}.png"
|
||||
MaxZoomLevel="19"/>
|
||||
<map:TileLayer SourceName="Thunderforest OpenCycleMap"
|
||||
Description="Maps © [Thunderforest](http://www.thunderforest.com/), Data © [OpenStreetMap Contributors](http://www.openstreetmap.org/copyright)"
|
||||
TileSource="http://{c}.tile.thunderforest.com/cycle/{z}/{x}/{y}.png"/>
|
||||
<map:TileLayer SourceName="Thunderforest Landscape"
|
||||
Description="Maps © [Thunderforest](http://www.thunderforest.com/), Data © [OpenStreetMap Contributors](http://www.openstreetmap.org/copyright)"
|
||||
TileSource="http://{c}.tile.thunderforest.com/landscape/{z}/{x}/{y}.png"/>
|
||||
<map:TileLayer SourceName="Thunderforest Outdoors"
|
||||
Description="Maps © [Thunderforest](http://www.thunderforest.com/), Data © [OpenStreetMap Contributors](http://www.openstreetmap.org/copyright)"
|
||||
TileSource="http://{c}.tile.thunderforest.com/outdoors/{z}/{x}/{y}.png"/>
|
||||
<map:TileLayer SourceName="Thunderforest Transport"
|
||||
Description="Maps © [Thunderforest](http://www.thunderforest.com/), Data © [OpenStreetMap Contributors](http://www.openstreetmap.org/copyright)"
|
||||
TileSource="http://{c}.tile.thunderforest.com/transport/{z}/{x}/{y}.png"/>
|
||||
<map:TileLayer SourceName="Thunderforest Transport Dark"
|
||||
Description="Maps © [Thunderforest](http://www.thunderforest.com/), Data © [OpenStreetMap Contributors](http://www.openstreetmap.org/copyright)"
|
||||
TileSource="http://{c}.tile.thunderforest.com/transport-dark/{z}/{x}/{y}.png"
|
||||
Foreground="White" Background="Black"/>
|
||||
<map:TileLayer SourceName="MapQuest OpenStreetMap"
|
||||
Description="Maps © [MapQuest](http://www.mapquest.com/), Data © [OpenStreetMap Contributors](http://www.openstreetmap.org/copyright)"
|
||||
TileSource="http://otile{n}.mqcdn.com/tiles/1.0.0/osm/{z}/{x}/{y}.jpg"
|
||||
MaxZoomLevel="19"/>
|
||||
<map:TileLayer SourceName="Seamarks"
|
||||
TileSource="http://tiles.openseamap.org/seamark/{z}/{x}/{y}.png"
|
||||
MinZoomLevel="10" MaxZoomLevel="18"/>
|
||||
|
||||
<!--
|
||||
Bing Maps TileLayers with tile URLs retrieved from the Imagery Metadata Service
|
||||
(see http://msdn.microsoft.com/en-us/library/ff701716.aspx).
|
||||
A Bing Maps API Key (see http://msdn.microsoft.com/en-us/library/ff428642.aspx) is required
|
||||
for using these layers and must be assigned to the static BingMapsTileLayer.ApiKey property.
|
||||
-->
|
||||
<map:BingMapsTileLayer SourceName="Bing Maps Road"
|
||||
Description="© [Microsoft Corporation](http://www.bing.com/maps/)"
|
||||
Mode="Road" MaxZoomLevel="19"/>
|
||||
<map:BingMapsTileLayer SourceName="Bing Maps Aerial"
|
||||
Description="© [Microsoft Corporation](http://www.bing.com/maps/)"
|
||||
Mode="Aerial" MaxZoomLevel="19" Foreground="White" Background="Black"/>
|
||||
<map:BingMapsTileLayer SourceName="Bing Maps Hybrid"
|
||||
Description="© [Microsoft Corporation](http://www.bing.com/maps/)"
|
||||
Mode="AerialWithLabels" MaxZoomLevel="19" Foreground="White" Background="Black"/>
|
||||
</map:TileLayerCollection>
|
||||
|
||||
<DataTemplate x:Key="PolylineItemTemplate">
|
||||
<map:MapPolyline Locations="{Binding Locations}" Stroke="Red" StrokeThickness="3"/>
|
||||
</DataTemplate>
|
||||
|
|
@ -128,10 +79,16 @@
|
|||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<map:WebMercatorProjection x:Key="WebMercatorProjection"/>
|
||||
<map:EquirectangularProjection x:Key="EquirectangularProjection"/>
|
||||
<map:OrthographicProjection x:Key="OrthographicProjection"/>
|
||||
<map:GnomonicProjection x:Key="GnomonicProjection"/>
|
||||
<map:StereographicProjection x:Key="StereographicProjection"/>
|
||||
</UserControl.Resources>
|
||||
|
||||
<UserControl.DataContext>
|
||||
<vm:ViewModel/>
|
||||
<vm:MapViewModel/>
|
||||
</UserControl.DataContext>
|
||||
|
||||
<Grid x:Name="LayoutRoot" Background="White">
|
||||
|
|
@ -139,14 +96,18 @@
|
|||
<RowDefinition/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
<map:Map x:Name="map" TileLayer="{Binding [OpenStreetMap], Source={StaticResource TileLayers}}"
|
||||
Center="{Binding MapCenter}" MinZoomLevel="2" ZoomLevel="11"
|
||||
<map:Map x:Name="map" MinZoomLevel="2" ZoomLevel="11"
|
||||
Center="{Binding MapCenter}"
|
||||
MapLayer="{Binding MapLayers.CurrentMapLayer}"
|
||||
MapProjection="{Binding SelectedValue, ElementName=projectionComboBox,
|
||||
FallbackValue={StaticResource WebMercatorProjection},
|
||||
TargetNullValue={StaticResource WebMercatorProjection}}"
|
||||
MouseMove="MapMouseMove" MouseLeave="MapMouseLeave">
|
||||
|
||||
<map:MapImage x:Name="mapImage" South="53.54031" North="53.74871" West="8.08594" East="8.43750"
|
||||
Source="10_535_330.jpg" Opacity="0.5"/>
|
||||
<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"/>
|
||||
|
||||
<map:MapGraticule Opacity="0.6"/>
|
||||
<map:MapGraticule x:Name="mapGraticule" Opacity="0.6"/>
|
||||
|
||||
<!-- use ItemTemplate or ItemContainerStyle alternatively -->
|
||||
<map:MapItemsControl ItemsSource="{Binding Polylines}"
|
||||
|
|
@ -163,24 +124,15 @@
|
|||
|
||||
<Path map:MapPanel.Location="53.5,8.2" Stroke="Blue" StrokeThickness="3" Fill="#1F007F00">
|
||||
<Path.Data>
|
||||
<EllipseGeometry RadiusX="1852" RadiusY="1852" Transform="{Binding ScaleTransform, ElementName=map}"/>
|
||||
<EllipseGeometry RadiusX="1852" RadiusY="1852" Transform="{Binding ScaleRotateTransform, ElementName=map}"/>
|
||||
</Path.Data>
|
||||
</Path>
|
||||
|
||||
<map:MapPath Stroke="Blue" Fill="Aqua" Opacity="0.5">
|
||||
<map:MapPath.Data>
|
||||
<GeometryGroup FillRule="EvenOdd">
|
||||
<EllipseGeometry Center="8.2,63.5" RadiusX="0.025" RadiusY="0.025"/>
|
||||
<EllipseGeometry Center="8.2,63.51" RadiusX="0.015" RadiusY="0.015"/>
|
||||
</GeometryGroup>
|
||||
</map:MapPath.Data>
|
||||
</map:MapPath>
|
||||
|
||||
<map:Pushpin map:MapPanel.Location="53.5,8.2" Background="Yellow" Foreground="Blue" Content="N 53° 30' E 8° 12'"/>
|
||||
</map:Map>
|
||||
|
||||
<Border HorizontalAlignment="Right" VerticalAlignment="Bottom" Background="#7FFFFFFF">
|
||||
<RichTextBlock Margin="4,2" FontSize="10" map:HyperlinkText.InlinesSource="{Binding TileLayer.Description, ElementName=map}"/>
|
||||
<RichTextBlock Margin="4,2" FontSize="10" map:HyperlinkText.InlinesSource="{Binding MapLayers.CurrentMapLayer.Description}"/>
|
||||
</Border>
|
||||
|
||||
<Grid Grid.Row="1">
|
||||
|
|
@ -209,18 +161,17 @@
|
|||
</StackPanel>
|
||||
<CheckBox Margin="5" VerticalAlignment="Bottom" Content="Seamarks"
|
||||
Checked="SeamarksChecked" Unchecked="SeamarksUnchecked"/>
|
||||
<ComboBox Width="130" Margin="5" VerticalAlignment="Bottom"
|
||||
SelectedValuePath="Tag" SelectedValue="{Binding TileLayer, ElementName=map, Mode=TwoWay}">
|
||||
<ComboBoxItem Tag="{Binding [OpenStreetMap], Source={StaticResource TileLayers}}">OpenStreetMap</ComboBoxItem>
|
||||
<ComboBoxItem Tag="{Binding [Thunderforest OpenCycleMap], Source={StaticResource TileLayers}}">OpenCycleMap</ComboBoxItem>
|
||||
<ComboBoxItem Tag="{Binding [Thunderforest Landscape], Source={StaticResource TileLayers}}">Landscape</ComboBoxItem>
|
||||
<ComboBoxItem Tag="{Binding [Thunderforest Outdoors], Source={StaticResource TileLayers}}">Outdoors</ComboBoxItem>
|
||||
<ComboBoxItem Tag="{Binding [Thunderforest Transport], Source={StaticResource TileLayers}}">Transport</ComboBoxItem>
|
||||
<ComboBoxItem Tag="{Binding [Thunderforest Transport Dark], Source={StaticResource TileLayers}}">Transport Dark</ComboBoxItem>
|
||||
<ComboBoxItem Tag="{Binding [MapQuest OpenStreetMap], Source={StaticResource TileLayers}}">MapQuest Open</ComboBoxItem>
|
||||
<!--<ComboBoxItem Tag="{Binding [Bing Maps Road], Source={StaticResource TileLayers}}">Bing Maps Road</ComboBoxItem>
|
||||
<ComboBoxItem Tag="{Binding [Bing Maps Aerial], Source={StaticResource TileLayers}}">Bing Maps Aerial</ComboBoxItem>
|
||||
<ComboBoxItem Tag="{Binding [Bing Maps Hybrid], Source={StaticResource TileLayers}}">Bing Maps Hybrid</ComboBoxItem>-->
|
||||
<ComboBox Width="200" Margin="5" VerticalAlignment="Bottom"
|
||||
ItemsSource="{Binding MapLayers.MapLayerNames}"
|
||||
SelectedItem="{Binding MapLayers.CurrentMapLayerName, Mode=TwoWay}"/>
|
||||
<ComboBox x:Name="projectionComboBox" Width="120" Margin="5" VerticalAlignment="Bottom"
|
||||
SelectedIndex="0" SelectedValuePath="Tag"
|
||||
SelectedValue="{Binding MapProjection, ElementName=map, Mode=TwoWay}">
|
||||
<ComboBoxItem Content="Web Mercator" Tag="{StaticResource WebMercatorProjection}"/>
|
||||
<ComboBoxItem Content="Equirectangular" Tag="{StaticResource EquirectangularProjection}"/>
|
||||
<ComboBoxItem Content="Orthographic" Tag="{StaticResource OrthographicProjection}"/>
|
||||
<ComboBoxItem Content="Gnomonic" Tag="{StaticResource GnomonicProjection}"/>
|
||||
<ComboBoxItem Content="Stereographic" Tag="{StaticResource StereographicProjection}"/>
|
||||
</ComboBox>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ using System.Windows;
|
|||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using MapControl;
|
||||
using ViewModel;
|
||||
|
||||
namespace SilverlightApplication
|
||||
{
|
||||
|
|
@ -11,8 +12,6 @@ namespace SilverlightApplication
|
|||
{
|
||||
public MainPage()
|
||||
{
|
||||
//BingMapsTileLayer.ApiKey = "...";
|
||||
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
|
|
@ -49,12 +48,12 @@ namespace SilverlightApplication
|
|||
|
||||
private void SeamarksChecked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
map.TileLayers.Add(((TileLayerCollection)Resources["TileLayers"])["Seamarks"]);
|
||||
map.Children.Insert(map.Children.IndexOf(mapGraticule), ((MapViewModel)DataContext).MapLayers.SeamarksLayer);
|
||||
}
|
||||
|
||||
private void SeamarksUnchecked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
map.TileLayers.Remove(((TileLayerCollection)Resources["TileLayers"])["Seamarks"]);
|
||||
map.Children.Remove(((MapViewModel)DataContext).MapLayers.SeamarksLayer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
<Deployment xmlns="http://schemas.microsoft.com/client/2007/deployment"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
>
|
||||
<Deployment.Parts>
|
||||
</Deployment.Parts>
|
||||
</Deployment>
|
||||
|
|
|
|||
|
|
@ -5,10 +5,10 @@ using System.Runtime.InteropServices;
|
|||
[assembly: AssemblyDescription("XAML Map Control Silverlight Sample Application")]
|
||||
[assembly: AssemblyProduct("XAML Map Control")]
|
||||
[assembly: AssemblyCompany("Clemens Fischer")]
|
||||
[assembly: AssemblyCopyright("© 2016 Clemens Fischer")]
|
||||
[assembly: AssemblyCopyright("© 2017 Clemens Fischer")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyVersion("2.14.0")]
|
||||
[assembly: AssemblyFileVersion("2.14.0")]
|
||||
[assembly: AssemblyVersion("3.1.0")]
|
||||
[assembly: AssemblyFileVersion("3.1.0")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
[assembly: ComVisible(false)]
|
||||
|
|
|
|||
|
|
@ -1,10 +1,7 @@
|
|||
<OutOfBrowserSettings ShortName="SilverlightApplication Application" EnableGPUAcceleration="True" ShowInstallMenuItem="True">
|
||||
<OutOfBrowserSettings.Blurb>SilverlightApplication Application on your desktop; at home, at work or on the go.</OutOfBrowserSettings.Blurb>
|
||||
<OutOfBrowserSettings.WindowSettings>
|
||||
<WindowSettings Title="SilverlightApplication Application" />
|
||||
</OutOfBrowserSettings.WindowSettings>
|
||||
<OutOfBrowserSettings.SecuritySettings>
|
||||
<SecuritySettings ElevatedPermissions="NotRequired" />
|
||||
</OutOfBrowserSettings.SecuritySettings>
|
||||
<OutOfBrowserSettings.Icons />
|
||||
<OutOfBrowserSettings.Blurb>SilverlightApplication Application on your desktop; at home, at work or on the go.</OutOfBrowserSettings.Blurb>
|
||||
<OutOfBrowserSettings.WindowSettings>
|
||||
<WindowSettings Title="SilverlightApplication Application" />
|
||||
</OutOfBrowserSettings.WindowSettings>
|
||||
<OutOfBrowserSettings.Icons />
|
||||
</OutOfBrowserSettings>
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>8.0.50727</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{CBA8C535-CCA3-4F60-8D3E-0E25791CBD21}</ProjectGuid>
|
||||
<ProjectGuid>{85AACDB7-959D-406D-A8DF-2F1E013F8F40}</ProjectGuid>
|
||||
<ProjectTypeGuids>{A1591282-1198-4647-A2B1-27E5FF5F6F3B};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
|
|
@ -31,8 +31,6 @@
|
|||
<ThrowErrorsInValidation>true</ThrowErrorsInValidation>
|
||||
<LinkedServerProject>
|
||||
</LinkedServerProject>
|
||||
<InBrowserSettingsFile>Properties\InBrowserSettings.xml</InBrowserSettingsFile>
|
||||
<RequireInBrowserElevation>false</RequireInBrowserElevation>
|
||||
</PropertyGroup>
|
||||
<!-- This property group is only here to support building this project using the
|
||||
MSBuild 3.5 toolset. In order to work correctly with this older toolset, it needs
|
||||
|
|
@ -72,8 +70,11 @@
|
|||
<Reference Include="System.Windows.Browser" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="..\Common\ViewModel.cs">
|
||||
<Link>ViewModel.cs</Link>
|
||||
<Compile Include="..\Common\MapLayers.cs">
|
||||
<Link>MapLayers.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Common\MapViewModel.cs">
|
||||
<Link>MapViewModel.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="App.xaml.cs">
|
||||
<DependentUpon>App.xaml</DependentUpon>
|
||||
|
|
@ -96,18 +97,15 @@
|
|||
<ItemGroup>
|
||||
<None Include="Properties\AppManifest.xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Properties\OutOfBrowserSettings.xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Properties\InBrowserSettings.xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\MapControl\MapControl.Silverlight.csproj">
|
||||
<Project>{eb133b78-deff-416a-8f0c-89e54d766576}</Project>
|
||||
<Name>MapControl.Silverlight</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Properties\OutOfBrowserSettings.xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="..\Common\10_535_330.jpg">
|
||||
<Link>10_535_330.jpg</Link>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ProjectExtensions>
|
||||
<VisualStudio>
|
||||
<FlavorProperties GUID="{A1591282-1198-4647-A2B1-27E5FF5F6F3B}">
|
||||
|
|
|
|||
|
|
@ -3,66 +3,9 @@
|
|||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:map="using:MapControl"
|
||||
xmlns:vm="using:ViewModel"
|
||||
xmlns:local="using:UniversalApp">
|
||||
|
||||
<Page.Resources>
|
||||
<map:TileLayerCollection x:Key="TileLayers">
|
||||
<!--
|
||||
TileLayers with OpenStreetMap data.
|
||||
-->
|
||||
<map:TileLayer SourceName="OpenStreetMap"
|
||||
Description="Maps © [OpenStreetMap Contributors](http://www.openstreetmap.org/copyright)"
|
||||
MaxZoomLevel="19">
|
||||
<map:TileSource UriFormat="http://{c}.tile.openstreetmap.org/{z}/{x}/{y}.png"/>
|
||||
</map:TileLayer>
|
||||
<map:TileLayer SourceName="Thunderforest OpenCycleMap"
|
||||
Description="Maps © [Thunderforest](http://www.thunderforest.com/), Data © [OpenStreetMap Contributors](http://www.openstreetmap.org/copyright)">
|
||||
<map:TileSource UriFormat="http://{c}.tile.thunderforest.com/cycle/{z}/{x}/{y}.png"/>
|
||||
</map:TileLayer>
|
||||
<map:TileLayer SourceName="Thunderforest Landscape"
|
||||
Description="Maps © [Thunderforest](http://www.thunderforest.com/), Data © [OpenStreetMap Contributors](http://www.openstreetmap.org/copyright)">
|
||||
<map:TileSource UriFormat="http://{c}.tile.thunderforest.com/landscape/{z}/{x}/{y}.png"/>
|
||||
</map:TileLayer>
|
||||
<map:TileLayer SourceName="Thunderforest Outdoors"
|
||||
Description="Maps © [Thunderforest](http://www.thunderforest.com/), Data © [OpenStreetMap Contributors](http://www.openstreetmap.org/copyright)">
|
||||
<map:TileSource UriFormat="http://{c}.tile.thunderforest.com/outdoors/{z}/{x}/{y}.png"/>
|
||||
</map:TileLayer>
|
||||
<map:TileLayer SourceName="Thunderforest Transport"
|
||||
Description="Maps © [Thunderforest](http://www.thunderforest.com/), Data © [OpenStreetMap Contributors](http://www.openstreetmap.org/copyright)">
|
||||
<map:TileSource UriFormat="http://{c}.tile.thunderforest.com/transport/{z}/{x}/{y}.png"/>
|
||||
</map:TileLayer>
|
||||
<map:TileLayer SourceName="Thunderforest Transport Dark"
|
||||
Description="Maps © [Thunderforest](http://www.thunderforest.com/), Data © [OpenStreetMap Contributors](http://www.openstreetmap.org/copyright)"
|
||||
Foreground="White" Background="Black">
|
||||
<map:TileSource UriFormat="http://{c}.tile.thunderforest.com/transport-dark/{z}/{x}/{y}.png"/>
|
||||
</map:TileLayer>
|
||||
<map:TileLayer SourceName="MapQuest OpenStreetMap"
|
||||
Description="Maps © [MapQuest](http://www.mapquest.com/), Data © [OpenStreetMap Contributors](http://www.openstreetmap.org/copyright)">
|
||||
<map:TileSource UriFormat="http://otile{n}.mqcdn.com/tiles/1.0.0/osm/{z}/{x}/{y}.jpg"/>
|
||||
</map:TileLayer>
|
||||
<map:TileLayer SourceName="Seamarks" Description="© OpenSeaMap Contributors"
|
||||
MinZoomLevel="10" MaxZoomLevel="18">
|
||||
<map:TileSource UriFormat="http://tiles.openseamap.org/seamark/{z}/{x}/{y}.png"/>
|
||||
</map:TileLayer>
|
||||
|
||||
<!--
|
||||
Bing Maps TileLayers with tile URLs retrieved from the Imagery Metadata Service
|
||||
(see http://msdn.microsoft.com/en-us/library/ff701716.aspx).
|
||||
A Bing Maps API Key (see http://msdn.microsoft.com/en-us/library/ff428642.aspx) is required
|
||||
for using these layers and must be assigned to the static BingMapsTileLayer.ApiKey property.
|
||||
-->
|
||||
<map:BingMapsTileLayer SourceName="Bing Maps Road"
|
||||
Description="Bing Maps - © Microsoft Corporation"
|
||||
Mode="Road" MaxZoomLevel="19"/>
|
||||
<map:BingMapsTileLayer SourceName="Bing Maps Aerial"
|
||||
Description="Bing Maps - © Microsoft Corporation"
|
||||
Mode="Aerial" MaxZoomLevel="19" Foreground="White" Background="Black"/>
|
||||
<map:BingMapsTileLayer SourceName="Bing Maps Hybrid"
|
||||
Description="Bing Maps - © Microsoft Corporation"
|
||||
Mode="AerialWithLabels" MaxZoomLevel="19" Foreground="White" Background="Black"/>
|
||||
</map:TileLayerCollection>
|
||||
|
||||
<DataTemplate x:Key="PolylineItemTemplate">
|
||||
<map:MapPolyline Locations="{Binding Locations}" Stroke="Red" StrokeThickness="3"/>
|
||||
</DataTemplate>
|
||||
|
|
@ -144,24 +87,33 @@
|
|||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</Page.Resources>
|
||||
|
||||
<Page.DataContext>
|
||||
<vm:ViewModel/>
|
||||
</Page.DataContext>
|
||||
<map:WebMercatorProjection x:Key="WebMercatorProjection"/>
|
||||
<map:EquirectangularProjection x:Key="EquirectangularProjection"/>
|
||||
<map:OrthographicProjection x:Key="OrthographicProjection"/>
|
||||
<map:GnomonicProjection x:Key="GnomonicProjection"/>
|
||||
<map:StereographicProjection x:Key="StereographicProjection"/>
|
||||
</Page.Resources>
|
||||
|
||||
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
<map:Map x:Name="map" TileLayer="{Binding [OpenStreetMap], Source={StaticResource TileLayers}}"
|
||||
Center="{Binding MapCenter}" MinZoomLevel="2" ZoomLevel="11" ManipulationMode="All">
|
||||
<map:Map x:Name="map" MinZoomLevel="2" MaxZoomLevel="20" ZoomLevel="11" ManipulationMode="All"
|
||||
Center="{x:Bind ViewModel.MapCenter, Mode=TwoWay}"
|
||||
MapLayer="{x:Bind ViewModel.MapLayers.CurrentMapLayer, Mode=OneWay}"
|
||||
MapProjection="{Binding SelectedValue, ElementName=projectionComboBox,
|
||||
FallbackValue={StaticResource WebMercatorProjection},
|
||||
TargetNullValue={StaticResource WebMercatorProjection}}">
|
||||
|
||||
<map:MapImage x:Name="mapImage" South="53.54031" North="53.74871" West="8.08594" East="8.43750"
|
||||
Source="10_535_330.jpg" Opacity="0.5"/>
|
||||
<Image x:Name="mapImage" Source="10_535_330.jpg" Opacity="0.5" Stretch="Fill">
|
||||
<map:MapPanel.BoundingBox>
|
||||
<map:BoundingBox South="53.54031" North="53.74871" West="8.08594" East="8.43750"/>
|
||||
</map:MapPanel.BoundingBox>
|
||||
</Image>
|
||||
|
||||
<map:MapGraticule Opacity="0.6"/>
|
||||
<map:MapGraticule x:Name="mapGraticule" Opacity="0.6"/>
|
||||
|
||||
<!-- use ItemTemplate or ItemContainerStyle alternatively -->
|
||||
<map:MapItemsControl ItemsSource="{Binding Polylines}"
|
||||
|
|
@ -181,19 +133,10 @@
|
|||
<map:Location Latitude="53.5" Longitude="8.2"/>
|
||||
</map:MapPanel.Location>
|
||||
<Path.Data>
|
||||
<EllipseGeometry RadiusX="1852" RadiusY="1852" Transform="{Binding ScaleTransform, ElementName=map}"/>
|
||||
<EllipseGeometry RadiusX="1852" RadiusY="1852" Transform="{Binding ScaleRotateTransform, ElementName=map}"/>
|
||||
</Path.Data>
|
||||
</Path>
|
||||
|
||||
<map:MapPath Stroke="Blue" Fill="Aqua" Opacity="0.5">
|
||||
<map:MapPath.Data>
|
||||
<GeometryGroup FillRule="EvenOdd">
|
||||
<EllipseGeometry Center="8.2,63.5" RadiusX="0.025" RadiusY="0.025"/>
|
||||
<EllipseGeometry Center="8.2,63.51" RadiusX="0.015" RadiusY="0.015"/>
|
||||
</GeometryGroup>
|
||||
</map:MapPath.Data>
|
||||
</map:MapPath>
|
||||
|
||||
<map:Pushpin Background="Yellow" Foreground="Blue" Content="N 53° 30' E 8° 12'">
|
||||
<map:MapPanel.Location>
|
||||
<map:Location Latitude="53.5" Longitude="8.2"/>
|
||||
|
|
@ -203,7 +146,7 @@
|
|||
|
||||
<Border HorizontalAlignment="Right" VerticalAlignment="Bottom" Background="#BFFFFFFF">
|
||||
<TextBlock Margin="2" FontSize="10" Foreground="Black"
|
||||
map:HyperlinkText.InlinesSource="{Binding TileLayer.Description, ElementName=map}"/>
|
||||
map:HyperlinkText.InlinesSource="{Binding MapLayers.CurrentMapLayer.Description}"/>
|
||||
</Border>
|
||||
|
||||
<Grid Grid.Row="1">
|
||||
|
|
@ -214,34 +157,33 @@
|
|||
<StackPanel Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Right">
|
||||
<StackPanel Margin="5">
|
||||
<TextBlock Text="Zoom Level" HorizontalAlignment="Center" Foreground="Gray" FontSize="14"/>
|
||||
<Slider Margin="10,-10,10,-10" Width="200" SmallChange="0.1"
|
||||
<Slider Margin="10,-10,10,-10" Width="100" SmallChange="0.1"
|
||||
Minimum="{Binding MinZoomLevel, ElementName=map}"
|
||||
Maximum="{Binding MaxZoomLevel, ElementName=map}"
|
||||
Value="{Binding TargetZoomLevel, ElementName=map, Mode=TwoWay}"/>
|
||||
</StackPanel>
|
||||
<StackPanel Margin="5">
|
||||
<TextBlock Text="Heading" HorizontalAlignment="Center" Foreground="Gray" FontSize="14"/>
|
||||
<Slider Margin="10,-10,10,-10" Width="200" Minimum="0" Maximum="360" SmallChange="5" LargeChange="45"
|
||||
<Slider Margin="10,-10,10,-10" Width="100" Minimum="0" Maximum="360" SmallChange="5" LargeChange="45"
|
||||
Value="{Binding Heading, ElementName=map, Mode=TwoWay}"/>
|
||||
</StackPanel>
|
||||
<StackPanel Margin="5">
|
||||
<TextBlock Text="Image Opacity" HorizontalAlignment="Center" Foreground="Gray" FontSize="14"/>
|
||||
<Slider Margin="10,-10,10,-10" Width="200" Value="50" ValueChanged="ImageOpacitySliderValueChanged"/>
|
||||
<Slider Margin="10,-10,10,-10" Width="100" Value="50" ValueChanged="ImageOpacitySliderValueChanged"/>
|
||||
</StackPanel>
|
||||
<CheckBox Margin="10" VerticalAlignment="Center" Content="Seamarks"
|
||||
Checked="SeamarksChecked" Unchecked="SeamarksUnchecked"/>
|
||||
<ComboBox Width="200" Margin="10" VerticalAlignment="Center"
|
||||
SelectedValuePath="Tag" SelectedValue="{Binding TileLayer, ElementName=map, Mode=TwoWay}">
|
||||
<ComboBoxItem Tag="{Binding [OpenStreetMap], Source={StaticResource TileLayers}}">OpenStreetMap</ComboBoxItem>
|
||||
<ComboBoxItem Tag="{Binding [Thunderforest OpenCycleMap], Source={StaticResource TileLayers}}">OpenCycleMap</ComboBoxItem>
|
||||
<ComboBoxItem Tag="{Binding [Thunderforest Landscape], Source={StaticResource TileLayers}}">Landscape</ComboBoxItem>
|
||||
<ComboBoxItem Tag="{Binding [Thunderforest Outdoors], Source={StaticResource TileLayers}}">Outdoors</ComboBoxItem>
|
||||
<ComboBoxItem Tag="{Binding [Thunderforest Transport], Source={StaticResource TileLayers}}">Transport</ComboBoxItem>
|
||||
<ComboBoxItem Tag="{Binding [Thunderforest Transport Dark], Source={StaticResource TileLayers}}">Transport Dark</ComboBoxItem>
|
||||
<ComboBoxItem Tag="{Binding [MapQuest OpenStreetMap], Source={StaticResource TileLayers}}">MapQuest Open</ComboBoxItem>
|
||||
<!--<ComboBoxItem Tag="{Binding [Bing Maps Road], Source={StaticResource TileLayers}}">Bing Maps Road</ComboBoxItem>
|
||||
<ComboBoxItem Tag="{Binding [Bing Maps Aerial], Source={StaticResource TileLayers}}">Bing Maps Aerial</ComboBoxItem>
|
||||
<ComboBoxItem Tag="{Binding [Bing Maps Hybrid], Source={StaticResource TileLayers}}">Bing Maps Hybrid</ComboBoxItem>-->
|
||||
<ComboBox Width="250" Margin="10" VerticalAlignment="Center"
|
||||
ItemsSource="{Binding MapLayers.MapLayerNames}"
|
||||
SelectedItem="{Binding MapLayers.CurrentMapLayerName, Mode=TwoWay}"/>
|
||||
<ComboBox x:Name="projectionComboBox" Width="150" Margin="10" VerticalAlignment="Bottom"
|
||||
SelectedIndex="0" SelectedValuePath="Tag"
|
||||
SelectedValue="{Binding MapProjection, ElementName=map, Mode=TwoWay}">
|
||||
<ComboBoxItem Content="Web Mercator" Tag="{StaticResource WebMercatorProjection}"/>
|
||||
<ComboBoxItem Content="Equirectangular" Tag="{StaticResource EquirectangularProjection}"/>
|
||||
<ComboBoxItem Content="Orthographic" Tag="{StaticResource OrthographicProjection}"/>
|
||||
<ComboBoxItem Content="Gnomonic" Tag="{StaticResource GnomonicProjection}"/>
|
||||
<ComboBoxItem Content="Stereographic" Tag="{StaticResource StereographicProjection}"/>
|
||||
</ComboBox>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using MapControl;
|
||||
using ViewModel;
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
using Windows.UI.Xaml.Controls.Primitives;
|
||||
|
|
@ -7,12 +7,15 @@ namespace UniversalApp
|
|||
{
|
||||
public sealed partial class MainPage : Page
|
||||
{
|
||||
public MapViewModel ViewModel { get; } = new MapViewModel();
|
||||
|
||||
public MainPage()
|
||||
{
|
||||
//TileImageLoader.Cache = new MapControl.Caching.ImageFileCache();
|
||||
//TileImageLoader.Cache = new MapControl.Caching.FileDbCache();
|
||||
|
||||
InitializeComponent();
|
||||
DataContext = ViewModel;
|
||||
}
|
||||
|
||||
private void ImageOpacitySliderValueChanged(object sender, RangeBaseValueChangedEventArgs e)
|
||||
|
|
@ -25,12 +28,12 @@ namespace UniversalApp
|
|||
|
||||
private void SeamarksChecked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
map.TileLayers.Add(((TileLayerCollection)Resources["TileLayers"])["Seamarks"]);
|
||||
map.Children.Insert(map.Children.IndexOf(mapGraticule), ViewModel.MapLayers.SeamarksLayer);
|
||||
}
|
||||
|
||||
private void SeamarksUnchecked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
map.TileLayers.Remove(((TileLayerCollection)Resources["TileLayers"])["Seamarks"]);
|
||||
map.Children.Remove(ViewModel.MapLayers.SeamarksLayer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,10 +5,10 @@ using System.Runtime.InteropServices;
|
|||
[assembly: AssemblyDescription("XAML Map Control Universal Windows Sample Application")]
|
||||
[assembly: AssemblyProduct("XAML Map Control")]
|
||||
[assembly: AssemblyCompany("Clemens Fischer")]
|
||||
[assembly: AssemblyCopyright("© 2016 Clemens Fischer")]
|
||||
[assembly: AssemblyCopyright("© 2017 Clemens Fischer")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
[assembly: AssemblyVersion("2.14.0")]
|
||||
[assembly: AssemblyFileVersion("2.14.0")]
|
||||
[assembly: AssemblyVersion("3.1.0")]
|
||||
[assembly: AssemblyFileVersion("3.1.0")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: ComVisible(false)]
|
||||
|
|
|
|||
|
|
@ -102,8 +102,11 @@
|
|||
<None Include="project.json" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="..\Common\ViewModel.cs">
|
||||
<Link>ViewModel.cs</Link>
|
||||
<Compile Include="..\Common\MapLayers.cs">
|
||||
<Link>MapLayers.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Common\MapViewModel.cs">
|
||||
<Link>MapViewModel.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="App.xaml.cs">
|
||||
<DependentUpon>App.xaml</DependentUpon>
|
||||
|
|
|
|||
|
|
@ -8,76 +8,6 @@
|
|||
Title="XAML MapControl - WPF Test Application" Height="600" Width="800"
|
||||
Stylus.IsPressAndHoldEnabled="False">
|
||||
<Window.Resources>
|
||||
<!--
|
||||
TileLayers with OpenStreetMap data.
|
||||
-->
|
||||
<map:TileLayer x:Key="OpenStreetMap" SourceName="OpenStreetMap"
|
||||
Description="Maps © [OpenStreetMap Contributors](http://www.openstreetmap.org/copyright)"
|
||||
TileSource="http://{c}.tile.openstreetmap.org/{z}/{x}/{y}.png"
|
||||
MaxZoomLevel="19"/>
|
||||
<map:TileLayer x:Key="OpenCycleMap" SourceName="Thunderforest OpenCycleMap"
|
||||
Description="Maps © [Thunderforest](http://www.thunderforest.com/), Data © [OpenStreetMap Contributors](http://www.openstreetmap.org/copyright)"
|
||||
TileSource="http://{c}.tile.thunderforest.com/cycle/{z}/{x}/{y}.png"/>
|
||||
<map:TileLayer x:Key="Landscape" SourceName="Thunderforest Landscape"
|
||||
Description="Maps © [Thunderforest](http://www.thunderforest.com/), Data © [OpenStreetMap Contributors](http://www.openstreetmap.org/copyright)"
|
||||
TileSource="http://{c}.tile.thunderforest.com/landscape/{z}/{x}/{y}.png"/>
|
||||
<map:TileLayer x:Key="Outdoors" SourceName="Thunderforest Outdoors"
|
||||
Description="Maps © [Thunderforest](http://www.thunderforest.com/), Data © [OpenStreetMap Contributors](http://www.openstreetmap.org/copyright)"
|
||||
TileSource="http://{c}.tile.thunderforest.com/outdoors/{z}/{x}/{y}.png"/>
|
||||
<map:TileLayer x:Key="Transport" SourceName="Thunderforest Transport"
|
||||
Description="Maps © [Thunderforest](http://www.thunderforest.com/), Data © [OpenStreetMap Contributors](http://www.openstreetmap.org/copyright)"
|
||||
TileSource="http://{c}.tile.thunderforest.com/transport/{z}/{x}/{y}.png"/>
|
||||
<map:TileLayer x:Key="TransportDark" SourceName="Thunderforest Transport Dark"
|
||||
Description="Maps © [Thunderforest](http://www.thunderforest.com/), Data © [OpenStreetMap Contributors](http://www.openstreetmap.org/copyright)"
|
||||
TileSource="http://{c}.tile.thunderforest.com/transport-dark/{z}/{x}/{y}.png"
|
||||
Foreground="White" Background="Black"/>
|
||||
<map:TileLayer x:Key="MapQuest" SourceName="MapQuest OpenStreetMap"
|
||||
Description="Maps © [MapQuest](http://www.mapquest.com/), Data © [OpenStreetMap Contributors](http://www.openstreetmap.org/copyright)"
|
||||
TileSource="http://otile{n}.mqcdn.com/tiles/1.0.0/osm/{z}/{x}/{y}.jpg"
|
||||
MaxZoomLevel="19"/>
|
||||
<map:TileLayer x:Key="Seamarks" SourceName="Seamarks"
|
||||
TileSource="http://tiles.openseamap.org/seamark/{z}/{x}/{y}.png"
|
||||
MinZoomLevel="9" MaxZoomLevel="18"/>
|
||||
|
||||
<!--
|
||||
A TileLayer using World OSM WMS, a Web Map Service based on OpenStreetMap data.
|
||||
Please contact the provider at http://www.osm-wms.de/ if you intend to use this in an application.
|
||||
-->
|
||||
<map:TileLayer x:Key="WorldOsm" SourceName="World OSM WMS"
|
||||
Description="[World OSM WMS](http://www.osm-wms.de/) © [OpenStreetMap Contributors](http://www.openstreetmap.org/copyright)"
|
||||
TileSource="http://129.206.228.72/cached/osm?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&LAYERS=osm_auto:all&STYLES=&SRS=EPSG:900913&BBOX={W},{S},{E},{N}&WIDTH={X}&HEIGHT={Y}&FORMAT=image/png"/>
|
||||
|
||||
<!--
|
||||
Bing Maps TileLayers with tile URLs retrieved from the Imagery Metadata Service
|
||||
(see http://msdn.microsoft.com/en-us/library/ff701716.aspx).
|
||||
A Bing Maps API Key (see http://msdn.microsoft.com/en-us/library/ff428642.aspx) is required
|
||||
for using these layers and must be assigned to the static BingMapsTileLayer.ApiKey property.
|
||||
-->
|
||||
<map:BingMapsTileLayer x:Key="BingRoad" SourceName="Bing Maps Road"
|
||||
Description="© [Microsoft Corporation](http://www.bing.com/maps/)"
|
||||
Mode="Road" MaxZoomLevel="19"/>
|
||||
<map:BingMapsTileLayer x:Key="BingAerial" SourceName="Bing Maps Aerial"
|
||||
Description="© [Microsoft Corporation](http://www.bing.com/maps/)"
|
||||
Mode="Aerial" MaxZoomLevel="19" Foreground="White" Background="Black"/>
|
||||
<map:BingMapsTileLayer x:Key="BingHybrid" SourceName="Bing Maps Hybrid"
|
||||
Description="© [Microsoft Corporation](http://www.bing.com/maps/)"
|
||||
Mode="AerialWithLabels" MaxZoomLevel="19" Foreground="White" Background="Black"/>
|
||||
|
||||
<!--
|
||||
A TileLayer that uses an ImageTileSource
|
||||
-->
|
||||
<!--<map:TileLayer x:Key="OsmImageTileSource"
|
||||
Description="© [OpenStreetMap Contributors](http://www.openstreetmap.org/copyright)">
|
||||
<map:ImageTileSource IsAsync="True" UriFormat="http://{c}.tile.openstreetmap.org/{z}/{x}/{y}.png"/>
|
||||
</map:TileLayer>-->
|
||||
|
||||
<!--
|
||||
A TileLayer that demonstrates how to access local tile image files (from ImageFileCache here)
|
||||
-->
|
||||
<!--<map:TileLayer x:Key="OsmLocalFiles"
|
||||
Description="© [OpenStreetMap Contributors](http://www.openstreetmap.org/copyright)"
|
||||
TileSource="file:///C:/ProgramData/MapControl/TileCache/OpenStreetMap/{z}/{x}/{y}.png"/>-->
|
||||
|
||||
<local:LocationToVisibilityConverter x:Key="LocationToVisibilityConverter"/>
|
||||
|
||||
<DataTemplate x:Key="PolylineItemTemplate">
|
||||
|
|
@ -176,10 +106,16 @@
|
|||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
<map:WebMercatorProjection x:Key="WebMercatorProjection"/>
|
||||
<map:EquirectangularProjection x:Key="EquirectangularProjection"/>
|
||||
<map:OrthographicProjection x:Key="OrthographicProjection"/>
|
||||
<map:GnomonicProjection x:Key="GnomonicProjection"/>
|
||||
<map:StereographicProjection x:Key="StereographicProjection"/>
|
||||
</Window.Resources>
|
||||
|
||||
<Window.DataContext>
|
||||
<vm:ViewModel/>
|
||||
<vm:MapViewModel/>
|
||||
</Window.DataContext>
|
||||
|
||||
<Grid>
|
||||
|
|
@ -187,20 +123,21 @@
|
|||
<RowDefinition/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
<map:Map x:Name="map" ZoomLevel="11" MaxZoomLevel="20" Center="{Binding MapCenter}"
|
||||
TileLayer="{StaticResource OpenStreetMap}"
|
||||
MouseLeftButtonDown="MapMouseLeftButtonDown" MouseRightButtonDown="MapMouseRightButtonDown"
|
||||
<map:Map x:Name="map" ZoomLevel="11" MaxZoomLevel="20"
|
||||
Center="{Binding MapCenter}"
|
||||
MapLayer="{Binding MapLayers.CurrentMapLayer}"
|
||||
MapProjection="{Binding SelectedValue, ElementName=projectionComboBox,
|
||||
FallbackValue={StaticResource WebMercatorProjection},
|
||||
TargetNullValue={StaticResource WebMercatorProjection}}"
|
||||
MouseLeftButtonDown="MapMouseLeftButtonDown"
|
||||
MouseRightButtonDown="MapMouseRightButtonDown"
|
||||
MouseMove="MapMouseMove" MouseLeave="MapMouseLeave"
|
||||
ManipulationInertiaStarting="MapManipulationInertiaStarting">
|
||||
|
||||
<!-- experimental WMS map layers -->
|
||||
<!--<map:WmsImageLayer ServerUri="http://129.206.228.72/cached/osm" Layers="osm_auto:all"/>-->
|
||||
<!--<map:WmsImageLayer ServerUri="http://ows.terrestris.de/osm/service" Layers="OSM-WMS"/>-->
|
||||
<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"/>
|
||||
|
||||
<map:MapImage x:Name="mapImage" South="53.54031" North="53.74871" West="8.08594" East="8.43750"
|
||||
Source="10_535_330.jpg" Opacity="0.5"/>
|
||||
|
||||
<map:MapGraticule Opacity="0.6"/>
|
||||
<map:MapGraticule x:Name="mapGraticule" Opacity="0.6"/>
|
||||
<map:MapScale Margin="4" Opacity="0.8" HorizontalAlignment="Left" Background="Transparent"/>
|
||||
|
||||
<!-- use ItemTemplate or ItemContainerStyle alternatively -->
|
||||
|
|
@ -218,22 +155,18 @@
|
|||
ItemContainerStyle="{StaticResource PushpinItemStyle}"
|
||||
IsSynchronizedWithCurrentItem="True"/>
|
||||
|
||||
<map:Pushpin Location="65,-18" Content="Iceland"/>
|
||||
<map:Pushpin Location="71,25" Content="Norway"/>
|
||||
<map:Pushpin Location="35,33" Content="Cyprus"/>
|
||||
<map:Pushpin Location="28.25,-16.5" Content="Tenerife"/>
|
||||
|
||||
<Path map:MapPanel.Location="53.5,8.2" Stroke="Blue" StrokeThickness="3" Fill="#1F007F00">
|
||||
<Path.Data>
|
||||
<EllipseGeometry RadiusX="1852" RadiusY="1852" Transform="{Binding ScaleTransform, ElementName=map}"/>
|
||||
<EllipseGeometry RadiusX="1852" RadiusY="1852" Transform="{Binding ScaleRotateTransform, ElementName=map}"/>
|
||||
</Path.Data>
|
||||
</Path>
|
||||
|
||||
<map:MapPath Stroke="Blue" Fill="Aqua" Opacity="0.5">
|
||||
<map:MapPath.Data>
|
||||
<GeometryGroup FillRule="EvenOdd">
|
||||
<EllipseGeometry Center="8.2,63.5" RadiusX="0.025" RadiusY="0.025"/>
|
||||
<EllipseGeometry Center="8.2,63.51" RadiusX="0.015" RadiusY="0.015"/>
|
||||
</GeometryGroup>
|
||||
</map:MapPath.Data>
|
||||
</map:MapPath>
|
||||
|
||||
<map:Pushpin Location="53.5,8.2" Background="Yellow" Foreground="Blue" Content="N 53° 30' E 8° 12'">
|
||||
<map:Pushpin Location="53.5,8.2" Background="Yellow" Foreground="Blue" Content="N 53°30' E 8°12'">
|
||||
<map:Pushpin.Visibility>
|
||||
<MultiBinding Converter="{StaticResource LocationToVisibilityConverter}">
|
||||
<Binding Path="(map:MapPanel.ParentMap)" RelativeSource="{RelativeSource Self}"/>
|
||||
|
|
@ -244,7 +177,7 @@
|
|||
</map:Map>
|
||||
|
||||
<Border HorizontalAlignment="Right" VerticalAlignment="Bottom" Background="#7FFFFFFF">
|
||||
<TextBlock Margin="2" FontSize="10" map:HyperlinkText.InlinesSource="{Binding TileLayer.Description, ElementName=map}"/>
|
||||
<TextBlock Margin="2" FontSize="10" map:HyperlinkText.InlinesSource="{Binding MapLayers.CurrentMapLayer.Description}"/>
|
||||
</Border>
|
||||
|
||||
<Grid Grid.Row="1">
|
||||
|
|
@ -273,19 +206,16 @@
|
|||
</StackPanel>
|
||||
<CheckBox ToolTip="Seamarks Overlay" Margin="7" VerticalAlignment="Bottom" Content="Seamarks"
|
||||
Checked="SeamarksChecked" Unchecked="SeamarksUnchecked"/>
|
||||
<ComboBox ToolTip="Tile Layer" Margin="5" VerticalAlignment="Bottom"
|
||||
SelectedValuePath="Tag" SelectedValue="{Binding TileLayer, ElementName=map, Mode=TwoWay}">
|
||||
<ComboBoxItem Tag="{StaticResource OpenStreetMap}">OpenStreetMap</ComboBoxItem>
|
||||
<ComboBoxItem Tag="{StaticResource OpenCycleMap}">OpenCycleMap</ComboBoxItem>
|
||||
<ComboBoxItem Tag="{StaticResource Landscape}">Landscape</ComboBoxItem>
|
||||
<ComboBoxItem Tag="{StaticResource Outdoors}">Outdoors</ComboBoxItem>
|
||||
<ComboBoxItem Tag="{StaticResource Transport}">Transport</ComboBoxItem>
|
||||
<ComboBoxItem Tag="{StaticResource TransportDark}">Transport Dark</ComboBoxItem>
|
||||
<ComboBoxItem Tag="{StaticResource MapQuest}">MapQuest Open</ComboBoxItem>
|
||||
<!--<ComboBoxItem Tag="{StaticResource WorldOsm}">World OSM WMS</ComboBoxItem>-->
|
||||
<!--<ComboBoxItem Tag="{StaticResource BingRoad}">Bing Maps Road</ComboBoxItem>
|
||||
<ComboBoxItem Tag="{StaticResource BingAerial}">Bing Maps Aerial</ComboBoxItem>
|
||||
<ComboBoxItem Tag="{StaticResource BingHybrid}">Bing Maps Hybrid</ComboBoxItem>-->
|
||||
<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}"/>
|
||||
<ComboBoxItem Content="Equirectangular" Tag="{StaticResource EquirectangularProjection}"/>
|
||||
<ComboBoxItem Content="Orthographic" Tag="{StaticResource OrthographicProjection}"/>
|
||||
<ComboBoxItem Content="Gnomonic" Tag="{StaticResource GnomonicProjection}"/>
|
||||
<ComboBoxItem Content="Stereographic" Tag="{StaticResource StereographicProjection}"/>
|
||||
</ComboBox>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ using System.Globalization;
|
|||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
using MapControl;
|
||||
using ViewModel;
|
||||
|
||||
namespace WpfApplication
|
||||
{
|
||||
|
|
@ -12,7 +13,6 @@ namespace WpfApplication
|
|||
{
|
||||
//TileImageLoader.Cache = new MapControl.Caching.ImageFileCache(TileImageLoader.DefaultCacheName, TileImageLoader.DefaultCacheFolder);
|
||||
//TileImageLoader.Cache = new MapControl.Caching.FileDbCache(TileImageLoader.DefaultCacheName, TileImageLoader.DefaultCacheFolder);
|
||||
//BingMapsTileLayer.ApiKey = "...";
|
||||
|
||||
InitializeComponent();
|
||||
}
|
||||
|
|
@ -21,8 +21,9 @@ namespace WpfApplication
|
|||
{
|
||||
if (e.ClickCount == 2)
|
||||
{
|
||||
map.ZoomMap(e.GetPosition(map), Math.Floor(map.ZoomLevel + 1.5));
|
||||
//map.TargetCenter = map.ViewportPointToLocation(e.GetPosition(map));
|
||||
//map.ZoomMap(e.GetPosition(map), Math.Floor(map.ZoomLevel + 1.5));
|
||||
map.TargetCenter = map.ViewportPointToLocation(e.GetPosition(map));
|
||||
//map.ZoomToBounds(new BoundingBox(53, 7, 54, 9));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -56,8 +57,8 @@ namespace WpfApplication
|
|||
|
||||
mouseLocation.Text = string.Format(CultureInfo.InvariantCulture,
|
||||
"{0} {1:00} {2:00.000}\n{3} {4:000} {5:00.000}",
|
||||
latHemisphere, latitude / 60000, (double)(latitude % 60000) / 1000d,
|
||||
lonHemisphere, longitude / 60000, (double)(longitude % 60000) / 1000d);
|
||||
latHemisphere, latitude / 60000, (latitude % 60000) / 1000d,
|
||||
lonHemisphere, longitude / 60000, (longitude % 60000) / 1000d);
|
||||
}
|
||||
|
||||
private void MapMouseLeave(object sender, MouseEventArgs e)
|
||||
|
|
@ -79,12 +80,12 @@ namespace WpfApplication
|
|||
|
||||
private void SeamarksChecked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
map.TileLayers.Add((TileLayer)Resources["Seamarks"]);
|
||||
map.Children.Insert(map.Children.IndexOf(mapGraticule), ((MapViewModel)DataContext).MapLayers.SeamarksLayer);
|
||||
}
|
||||
|
||||
private void SeamarksUnchecked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
map.TileLayers.Remove((TileLayer)Resources["Seamarks"]);
|
||||
map.Children.Remove(((MapViewModel)DataContext).MapLayers.SeamarksLayer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,10 +5,10 @@ using System.Runtime.InteropServices;
|
|||
[assembly: AssemblyDescription("XAML Map Control WPF Sample Application")]
|
||||
[assembly: AssemblyProduct("XAML Map Control")]
|
||||
[assembly: AssemblyCompany("Clemens Fischer")]
|
||||
[assembly: AssemblyCopyright("© 2016 Clemens Fischer")]
|
||||
[assembly: AssemblyCopyright("© 2017 Clemens Fischer")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyVersion("2.14.0")]
|
||||
[assembly: AssemblyFileVersion("2.14.0")]
|
||||
[assembly: AssemblyVersion("3.1.0")]
|
||||
[assembly: AssemblyFileVersion("3.1.0")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
[assembly: ComVisible(false)]
|
||||
|
|
|
|||
|
|
@ -52,8 +52,11 @@
|
|||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</ApplicationDefinition>
|
||||
<Compile Include="..\Common\ViewModel.cs">
|
||||
<Link>ViewModel.cs</Link>
|
||||
<Compile Include="..\Common\MapLayers.cs">
|
||||
<Link>MapLayers.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Common\MapViewModel.cs">
|
||||
<Link>MapViewModel.cs</Link>
|
||||
</Compile>
|
||||
<Page Include="MainWindow.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue