diff --git a/Caching/FileDbCache.WPF/Properties/AssemblyInfo.cs b/Caching/FileDbCache.WPF/Properties/AssemblyInfo.cs
index 5c1138f8..1a3fe8fd 100644
--- a/Caching/FileDbCache.WPF/Properties/AssemblyInfo.cs
+++ b/Caching/FileDbCache.WPF/Properties/AssemblyInfo.cs
@@ -7,8 +7,8 @@ using System.Runtime.InteropServices;
[assembly: AssemblyCompany("Clemens Fischer")]
[assembly: AssemblyCopyright("© 2016 Clemens Fischer")]
[assembly: AssemblyTrademark("")]
-[assembly: AssemblyVersion("2.8.0")]
-[assembly: AssemblyFileVersion("2.8.0")]
+[assembly: AssemblyVersion("2.9.0")]
+[assembly: AssemblyFileVersion("2.9.0")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
diff --git a/Caching/FileDbCache.WinRT/Properties/AssemblyInfo.cs b/Caching/FileDbCache.WinRT/Properties/AssemblyInfo.cs
index a1729790..b0a86cd7 100644
--- a/Caching/FileDbCache.WinRT/Properties/AssemblyInfo.cs
+++ b/Caching/FileDbCache.WinRT/Properties/AssemblyInfo.cs
@@ -7,8 +7,8 @@ using System.Runtime.InteropServices;
[assembly: AssemblyCompany("Clemens Fischer")]
[assembly: AssemblyCopyright("© 2016 Clemens Fischer")]
[assembly: AssemblyTrademark("")]
-[assembly: AssemblyVersion("2.8.0")]
-[assembly: AssemblyFileVersion("2.8.0")]
+[assembly: AssemblyVersion("2.9.0")]
+[assembly: AssemblyFileVersion("2.9.0")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
diff --git a/Caching/ImageFileCache.WPF/Properties/AssemblyInfo.cs b/Caching/ImageFileCache.WPF/Properties/AssemblyInfo.cs
index 842a3ab4..29e80ee7 100644
--- a/Caching/ImageFileCache.WPF/Properties/AssemblyInfo.cs
+++ b/Caching/ImageFileCache.WPF/Properties/AssemblyInfo.cs
@@ -7,8 +7,8 @@ using System.Runtime.InteropServices;
[assembly: AssemblyCompany("Clemens Fischer")]
[assembly: AssemblyCopyright("© 2016 Clemens Fischer")]
[assembly: AssemblyTrademark("")]
-[assembly: AssemblyVersion("2.8.0")]
-[assembly: AssemblyFileVersion("2.8.0")]
+[assembly: AssemblyVersion("2.9.0")]
+[assembly: AssemblyFileVersion("2.9.0")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
diff --git a/Caching/ImageFileCache.WinRT/Properties/AssemblyInfo.cs b/Caching/ImageFileCache.WinRT/Properties/AssemblyInfo.cs
index 9e9b3d47..acdfec75 100644
--- a/Caching/ImageFileCache.WinRT/Properties/AssemblyInfo.cs
+++ b/Caching/ImageFileCache.WinRT/Properties/AssemblyInfo.cs
@@ -7,8 +7,8 @@ using System.Runtime.InteropServices;
[assembly: AssemblyCompany("Clemens Fischer")]
[assembly: AssemblyCopyright("© 2016 Clemens Fischer")]
[assembly: AssemblyTrademark("")]
-[assembly: AssemblyVersion("2.8.0")]
-[assembly: AssemblyFileVersion("2.8.0")]
+[assembly: AssemblyVersion("2.9.0")]
+[assembly: AssemblyFileVersion("2.9.0")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
diff --git a/MapControl/IMapElement.cs b/MapControl/IMapElement.cs
index 4ac2d67e..e356aae9 100644
--- a/MapControl/IMapElement.cs
+++ b/MapControl/IMapElement.cs
@@ -8,4 +8,9 @@ namespace MapControl
{
MapBase ParentMap { get; set; }
}
+
+ public interface IMapShape : IMapElement
+ {
+ void LocationChanged(Location oldValue, Location newValue);
+ }
}
diff --git a/MapControl/Location.cs b/MapControl/Location.cs
index eb8ba689..2c12a28b 100644
--- a/MapControl/Location.cs
+++ b/MapControl/Location.cs
@@ -74,6 +74,9 @@ namespace MapControl
double.Parse(pair[1], NumberStyles.Float, CultureInfo.InvariantCulture));
}
+ ///
+ /// Normalizes a longitude to a value in the interval [-180..180].
+ ///
public static double NormalizeLongitude(double longitude)
{
if (longitude < -180d)
@@ -87,5 +90,21 @@ namespace MapControl
return longitude;
}
+
+ internal static double NearestLongitude(double longitude, double referenceLongitude)
+ {
+ longitude = NormalizeLongitude(longitude);
+
+ if (longitude > referenceLongitude + 180d)
+ {
+ longitude -= 360d;
+ }
+ else if (longitude < referenceLongitude - 180d)
+ {
+ longitude += 360d;
+ }
+
+ return longitude;
+ }
}
}
diff --git a/MapControl/MapBase.cs b/MapControl/MapBase.cs
index 8c2c603c..8e563400 100644
--- a/MapControl/MapBase.cs
+++ b/MapControl/MapBase.cs
@@ -618,8 +618,9 @@ namespace MapControl
// animate private CenterPoint property by PointAnimation
centerAnimation = new PointAnimation
{
- From = mapTransform.Transform(Center),
- To = mapTransform.Transform(targetCenter, Center.Longitude),
+ To = mapTransform.Transform(new Location(
+ targetCenter.Latitude,
+ Location.NearestLongitude(targetCenter.Longitude, Center.Longitude))),
Duration = AnimationDuration,
EasingFunction = AnimationEasingFunction
};
diff --git a/MapControl/MapControl.WPF.csproj b/MapControl/MapControl.WPF.csproj
index 8b4fb464..212d9d93 100644
--- a/MapControl/MapControl.WPF.csproj
+++ b/MapControl/MapControl.WPF.csproj
@@ -98,6 +98,8 @@
+
+
diff --git a/MapControl/MapPanel.cs b/MapControl/MapPanel.cs
index e811f092..e5729333 100644
--- a/MapControl/MapPanel.cs
+++ b/MapControl/MapPanel.cs
@@ -46,9 +46,9 @@ namespace MapControl
{
foreach (UIElement element in Children)
{
- var location = GetLocation(element);
+ Location location;
- if (location != null)
+ if (!(element is IMapShape) && (location = GetLocation(element)) != null)
{
ArrangeElementWithLocation(element);
SetViewportPosition(element, parentMap, location);
@@ -82,9 +82,9 @@ namespace MapControl
{
foreach (UIElement element in Children)
{
- var location = GetLocation(element);
+ Location location;
- if (location != null)
+ if (!(element is IMapShape) && (location = GetLocation(element)) != null)
{
SetViewportPosition(element, parentMap, location);
}
@@ -108,22 +108,25 @@ namespace MapControl
private static void LocationPropertyChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e)
{
- var element = obj as UIElement;
+ var element = (UIElement)obj;
+ var mapShape = element as IMapShape;
- if (element != null)
+ if (mapShape != null)
{
- var location = e.NewValue as Location;
-
- if (location == null)
+ mapShape.LocationChanged((Location)e.OldValue, (Location)e.NewValue);
+ }
+ else
+ {
+ if (e.NewValue == null)
{
ArrangeElementWithoutLocation(element, Size.Empty);
}
else if (e.OldValue == null)
{
- ArrangeElementWithLocation(element); // arrange element when Location was null before
+ ArrangeElementWithLocation(element);
}
- SetViewportPosition(element, GetParentMap(element), location);
+ SetViewportPosition(element, GetParentMap(element), (Location)e.NewValue);
}
}
@@ -133,9 +136,9 @@ namespace MapControl
if (parentMap != null && location != null)
{
- var mapPosition = parentMap.MapTransform.Transform(location, parentMap.Center.Longitude); // nearest to center longitude
-
- viewportPosition = parentMap.ViewportTransform.Transform(mapPosition);
+ viewportPosition = parentMap.LocationToViewportPoint(new Location(
+ location.Latitude,
+ Location.NearestLongitude(location.Longitude, parentMap.Center.Longitude)));
if ((bool)element.GetValue(FrameworkElement.UseLayoutRoundingProperty))
{
diff --git a/MapControl/MapPath.WPF.cs b/MapControl/MapPath.WPF.cs
index 6a93c85d..e3af4fe8 100644
--- a/MapControl/MapPath.WPF.cs
+++ b/MapControl/MapPath.WPF.cs
@@ -13,7 +13,7 @@ namespace MapControl
public static readonly DependencyProperty DataProperty = DependencyProperty.Register(
"Data", typeof(Geometry), typeof(MapPath), new FrameworkPropertyMetadata(
null, FrameworkPropertyMetadataOptions.AffectsRender,
- (o, e) => ((MapPath)o).UpdateData(), CoerceDataProperty));
+ DataPropertyChanged, CoerceDataProperty));
static MapPath()
{
@@ -38,10 +38,18 @@ namespace MapControl
return new Size(1, 1);
}
+ private static void DataPropertyChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e)
+ {
+ if (!object.ReferenceEquals(e.OldValue, e.NewValue))
+ {
+ ((MapPath)obj).UpdateData();
+ }
+ }
+
private static object CoerceDataProperty(DependencyObject obj, object value)
{
var data = (Geometry)value;
- return data != null && data.IsFrozen ? data.CloneCurrentValue() : data;
+ return (data != null && data.IsFrozen) ? data.CloneCurrentValue() : data;
}
}
}
diff --git a/MapControl/MapPath.cs b/MapControl/MapPath.cs
index c4ff55e0..c3c295a6 100644
--- a/MapControl/MapPath.cs
+++ b/MapControl/MapPath.cs
@@ -2,9 +2,12 @@
// © 2016 Clemens Fischer
// Licensed under the Microsoft Public License (Ms-PL)
+using System;
#if NETFX_CORE
+using Windows.UI.Xaml;
using Windows.UI.Xaml.Media;
#else
+using System.Windows;
using System.Windows.Media;
#endif
@@ -14,17 +17,46 @@ namespace MapControl
/// Base class for map shapes. The shape geometry is given by the Data property,
/// which must contain a Geometry defined in cartesian (projected) map coordinates.
/// The Stretch property is meaningless for MapPath, it will be reset to None.
+ /// Optionally, the MapPanel.Location property can by set to move the viewport position
+ /// to a longitude with minimal distance to the longitude of the current map center.
///
- public partial class MapPath : IMapElement
+ public partial class MapPath : IMapShape
{
+ private readonly TransformGroup viewportTransform = new TransformGroup();
private MapBase parentMap;
+ public TransformGroup ViewportTransform
+ {
+ get { return viewportTransform; }
+ }
+
public MapBase ParentMap
{
get { return parentMap; }
set
{
+ var location = MapPanel.GetLocation(this);
+
+ if (parentMap != null && location != null)
+ {
+ parentMap.ViewportChanged -= OnViewportChanged;
+ }
+
+ viewportTransform.Children.Clear();
parentMap = value;
+
+ if (parentMap != null)
+ {
+ viewportTransform.Children.Add(parentMap.ViewportTransform);
+
+ if (location != null)
+ {
+ viewportTransform.Children.Insert(0, new TranslateTransform());
+ parentMap.ViewportChanged += OnViewportChanged;
+ OnViewportChanged(this, EventArgs.Empty);
+ }
+ }
+
UpdateData();
}
}
@@ -33,15 +65,34 @@ namespace MapControl
{
if (Data != null)
{
- if (parentMap != null)
+ Data.Transform = viewportTransform;
+ }
+ }
+
+ void IMapShape.LocationChanged(Location oldValue, Location newValue)
+ {
+ if (parentMap != null)
+ {
+ if (newValue == null)
{
- Data.Transform = ParentMap.ViewportTransform;
+ parentMap.ViewportChanged -= OnViewportChanged;
+ viewportTransform.Children.RemoveAt(0);
}
- else
+ else if (oldValue == null)
{
- Data.ClearValue(Geometry.TransformProperty);
+ viewportTransform.Children.Insert(0, new TranslateTransform());
+ parentMap.ViewportChanged += OnViewportChanged;
+ OnViewportChanged(this, EventArgs.Empty);
}
}
}
+
+ private void OnViewportChanged(object sender, EventArgs e)
+ {
+ var longitude = Location.NormalizeLongitude(MapPanel.GetLocation(this).Longitude);
+
+ ((TranslateTransform)viewportTransform.Children[0]).X =
+ Location.NearestLongitude(longitude, parentMap.Center.Longitude) - longitude;
+ }
}
}
diff --git a/MapControl/MapPolyline.Silverlight.WinRT.cs b/MapControl/MapPolyline.Silverlight.WinRT.cs
index cecaf207..5ea37078 100644
--- a/MapControl/MapPolyline.Silverlight.WinRT.cs
+++ b/MapControl/MapPolyline.Silverlight.WinRT.cs
@@ -21,7 +21,7 @@ namespace MapControl
public MapPolyline()
{
- Data = new PathGeometry();
+ Data = new PathGeometry { Transform = ViewportTransform };
}
protected override void UpdateData()
@@ -49,11 +49,6 @@ namespace MapControl
figure.Segments.Add(segment);
geometry.Figures.Add(figure);
- geometry.Transform = ParentMap.ViewportTransform;
- }
- else
- {
- geometry.ClearValue(Geometry.TransformProperty);
}
}
}
diff --git a/MapControl/MapPolyline.WPF.cs b/MapControl/MapPolyline.WPF.cs
index c788c107..db87d6e0 100644
--- a/MapControl/MapPolyline.WPF.cs
+++ b/MapControl/MapPolyline.WPF.cs
@@ -16,7 +16,7 @@ namespace MapControl
public MapPolyline()
{
- Data = new StreamGeometry();
+ Data = new StreamGeometry { Transform = ViewportTransform };
}
protected override void UpdateData()
@@ -32,13 +32,10 @@ namespace MapControl
context.BeginFigure(points.First(), IsClosed, IsClosed);
context.PolyLineTo(points.Skip(1).ToList(), true, false);
}
-
- geometry.Transform = ParentMap.ViewportTransform;
}
else
{
geometry.Clear();
- geometry.ClearValue(Geometry.TransformProperty);
}
}
}
diff --git a/MapControl/MapRectangle.cs b/MapControl/MapRectangle.cs
index bf30ee55..c56550f6 100644
--- a/MapControl/MapRectangle.cs
+++ b/MapControl/MapRectangle.cs
@@ -94,7 +94,7 @@ namespace MapControl
{
var rect = new Rect(ParentMap.MapTransform.Transform(new Location(South, West)),
ParentMap.MapTransform.Transform(new Location(North, East)));
- Transform transform = ParentMap.ViewportTransform;
+ Transform transform = ViewportTransform;
ScaleRect(ref rect, ref transform);
diff --git a/MapControl/MapTransform.cs b/MapControl/MapTransform.cs
index b812ae2e..ba531750 100644
--- a/MapControl/MapTransform.cs
+++ b/MapControl/MapTransform.cs
@@ -41,28 +41,6 @@ namespace MapControl
///
public abstract Location Transform(Point point);
- ///
- /// Transforms a geographic location to a cartesian coordinate point
- /// with minumum distance to the specified reference longitude value.
- ///
- public Point Transform(Location location, double referenceLongitude)
- {
- var p = Transform(location);
-
- p.X = Location.NormalizeLongitude(p.X);
-
- if (p.X > referenceLongitude + 180d)
- {
- p.X -= 360d;
- }
- else if (p.X < referenceLongitude - 180d)
- {
- p.X += 360d;
- }
-
- return p;
- }
-
///
/// Transforms a geographic location by the specified translation in viewport coordinates.
///
diff --git a/MapControl/MatrixEx.cs b/MapControl/MatrixEx.cs
index 0608fe4a..45a06ade 100644
--- a/MapControl/MatrixEx.cs
+++ b/MapControl/MatrixEx.cs
@@ -21,6 +21,11 @@ namespace MapControl
return matrix;
}
+ public static Matrix TranslatePrepend(this Matrix matrix, double offsetX, double offsetY)
+ {
+ return new Matrix(1d, 0d, 0d, 1d, offsetX, offsetY).Multiply(matrix);
+ }
+
public static Matrix Scale(this Matrix matrix, double scaleX, double scaleY)
{
return Multiply(matrix, new Matrix(scaleX, 0d, 0d, scaleY, 0d, 0d));
diff --git a/MapControl/Properties/AssemblyInfo.cs b/MapControl/Properties/AssemblyInfo.cs
index 36ae684b..777ea6de 100644
--- a/MapControl/Properties/AssemblyInfo.cs
+++ b/MapControl/Properties/AssemblyInfo.cs
@@ -14,8 +14,8 @@ using System.Windows;
[assembly: AssemblyCompany("Clemens Fischer")]
[assembly: AssemblyCopyright("© 2016 Clemens Fischer")]
[assembly: AssemblyTrademark("")]
-[assembly: AssemblyVersion("2.8.0")]
-[assembly: AssemblyFileVersion("2.8.0")]
+[assembly: AssemblyVersion("2.9.0")]
+[assembly: AssemblyFileVersion("2.9.0")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
diff --git a/MapControl/TileLayer.cs b/MapControl/TileLayer.cs
index 8ae1299e..8571c1a5 100644
--- a/MapControl/TileLayer.cs
+++ b/MapControl/TileLayer.cs
@@ -238,14 +238,14 @@ namespace MapControl
{
if (parentMap != null)
{
- parentMap.ViewportChanged -= ViewportChanged;
+ parentMap.ViewportChanged -= OnViewportChanged;
}
parentMap = value;
if (parentMap != null)
{
- parentMap.ViewportChanged += ViewportChanged;
+ parentMap.ViewportChanged += OnViewportChanged;
mapOriginX = parentMap.MapOrigin.X;
}
@@ -253,7 +253,7 @@ namespace MapControl
}
}
- private void ViewportChanged(object sender, EventArgs e)
+ private void OnViewportChanged(object sender, EventArgs e)
{
if (TileGrid == null || Math.Abs(parentMap.MapOrigin.X - mapOriginX) > 180d)
{
diff --git a/MapControl/WinRT/MapControl.WinRT.csproj b/MapControl/WinRT/MapControl.WinRT.csproj
index 23f2cb29..7459f641 100644
--- a/MapControl/WinRT/MapControl.WinRT.csproj
+++ b/MapControl/WinRT/MapControl.WinRT.csproj
@@ -162,6 +162,12 @@
TileSource.cs
+
+ WmsImageLayer.cs
+
+
+ WmsImageLayer.WinRT.cs
+
diff --git a/MapControl/WinRT/Properties/AssemblyInfo.cs b/MapControl/WinRT/Properties/AssemblyInfo.cs
index 2fa391c5..47ee4c3f 100644
--- a/MapControl/WinRT/Properties/AssemblyInfo.cs
+++ b/MapControl/WinRT/Properties/AssemblyInfo.cs
@@ -7,8 +7,8 @@ using System.Runtime.InteropServices;
[assembly: AssemblyCompany("Clemens Fischer")]
[assembly: AssemblyCopyright("© 2016 Clemens Fischer")]
[assembly: AssemblyTrademark("")]
-[assembly: AssemblyVersion("2.8.0")]
-[assembly: AssemblyFileVersion("2.8.0")]
+[assembly: AssemblyVersion("2.9.0")]
+[assembly: AssemblyFileVersion("2.9.0")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
diff --git a/MapControl/WmsImageLayer.WPF.cs b/MapControl/WmsImageLayer.WPF.cs
new file mode 100644
index 00000000..f1b59680
--- /dev/null
+++ b/MapControl/WmsImageLayer.WPF.cs
@@ -0,0 +1,19 @@
+// XAML Map Control - http://xamlmapcontrol.codeplex.com/
+// © 2016 Clemens Fischer
+// Licensed under the Microsoft Public License (Ms-PL)
+
+using System.Threading.Tasks;
+using System.Xml;
+
+namespace MapControl
+{
+ public partial class WmsImageLayer
+ {
+ private static async Task LoadDocument(string requestUri)
+ {
+ var document = new XmlDocument();
+ await Task.Run(() => document.Load(requestUri));
+ return document;
+ }
+ }
+}
diff --git a/MapControl/WmsImageLayer.WinRT.cs b/MapControl/WmsImageLayer.WinRT.cs
new file mode 100644
index 00000000..7fe5976a
--- /dev/null
+++ b/MapControl/WmsImageLayer.WinRT.cs
@@ -0,0 +1,18 @@
+// XAML Map Control - http://xamlmapcontrol.codeplex.com/
+// © 2016 Clemens Fischer
+// Licensed under the Microsoft Public License (Ms-PL)
+
+using System;
+using System.Threading.Tasks;
+using Windows.Data.Xml.Dom;
+
+namespace MapControl
+{
+ public partial class WmsImageLayer
+ {
+ private static async Task LoadDocument(string requestUri)
+ {
+ return await XmlDocument.LoadFromUriAsync(new Uri(requestUri));
+ }
+ }
+}
diff --git a/MapControl/WmsImageLayer.cs b/MapControl/WmsImageLayer.cs
new file mode 100644
index 00000000..71ed3751
--- /dev/null
+++ b/MapControl/WmsImageLayer.cs
@@ -0,0 +1,152 @@
+// XAML Map Control - http://xamlmapcontrol.codeplex.com/
+// © 2016 Clemens Fischer
+// Licensed under the Microsoft Public License (Ms-PL)
+
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Linq;
+using System.Threading.Tasks;
+#if NETFX_CORE
+using Windows.Data.Xml.Dom;
+using Windows.UI.Xaml;
+#else
+using System.Windows;
+using System.Xml;
+#endif
+
+namespace MapControl
+{
+ public partial class WmsImageLayer : MapImageLayer
+ {
+ public static readonly DependencyProperty BaseUriProperty = DependencyProperty.Register(
+ "ServerUri", typeof(string), typeof(WmsImageLayer),
+ new PropertyMetadata(null, async (o, e) => await ((WmsImageLayer)o).UpdateUriFormat(true)));
+
+ public static readonly DependencyProperty LayersProperty = DependencyProperty.Register(
+ "Layers", typeof(string), typeof(WmsImageLayer),
+ new PropertyMetadata(null, async (o, e) => await ((WmsImageLayer)o).UpdateUriFormat()));
+
+ public static readonly DependencyProperty ParametersProperty = DependencyProperty.Register(
+ "Parameters", typeof(string), typeof(WmsImageLayer),
+ new PropertyMetadata(null, async (o, e) => await ((WmsImageLayer)o).UpdateUriFormat()));
+
+ public static readonly DependencyProperty TransparentProperty = DependencyProperty.Register(
+ "Transparent", typeof(bool), typeof(WmsImageLayer),
+ new PropertyMetadata(false, async (o, e) => await ((WmsImageLayer)o).UpdateUriFormat()));
+
+ public string ServerUri
+ {
+ get { return (string)GetValue(BaseUriProperty); }
+ set { SetValue(BaseUriProperty, value); }
+ }
+
+ public string Layers
+ {
+ get { return (string)GetValue(LayersProperty); }
+ set { SetValue(LayersProperty, value); }
+ }
+
+ public string Parameters
+ {
+ get { return (string)GetValue(ParametersProperty); }
+ set { SetValue(ParametersProperty, value); }
+ }
+
+ public bool Transparent
+ {
+ get { return (bool)GetValue(TransparentProperty); }
+ set { SetValue(TransparentProperty, value); }
+ }
+
+ public async Task> GetAllLayers()
+ {
+ var layers = new List();
+
+ if (!string.IsNullOrEmpty(ServerUri))
+ {
+ try
+ {
+ var document = await LoadDocument(ServerUri
+ + "?SERVICE=WMS"
+ + "&VERSION=1.3.0"
+ + "&REQUEST=GetCapabilities");
+
+ var capability = FirstChild(document.DocumentElement, "Capability");
+ if (capability != null)
+ {
+ var rootLayer = FirstChild(capability, "Layer");
+ if (rootLayer != null)
+ {
+ foreach (var layer in ChildElements(rootLayer, "Layer"))
+ {
+ var name = FirstChild(layer, "Name");
+ if (name != null)
+ {
+ layers.Add(name.InnerText);
+ }
+ }
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ Debug.WriteLine(e.Message);
+ }
+ }
+
+ return layers;
+ }
+
+ private string allLayers;
+
+ private async Task UpdateUriFormat(bool baseUriChanged = false)
+ {
+ if (baseUriChanged)
+ {
+ allLayers = null;
+ }
+
+ string uriFormat = null;
+ var layers = Layers;
+
+ if (!string.IsNullOrEmpty(ServerUri) && !string.IsNullOrEmpty(layers))
+ {
+ if (layers == "*")
+ {
+ layers = allLayers ?? (allLayers = string.Join(",", await GetAllLayers()));
+ }
+
+ uriFormat = ServerUri
+ + "?SERVICE=WMS"
+ + "&VERSION=1.3.0"
+ + "&REQUEST=GetMap"
+ + "&LAYERS=" + layers.Replace(" ", "%20")
+ + "&STYLES="
+ + "&CRS=EPSG:3857"
+ + "&BBOX={W},{S},{E},{N}"
+ + "&WIDTH={X}"
+ + "&HEIGHT={Y}"
+ + "&FORMAT=image/png"
+ + "&TRANSPARENT=" + (Transparent ? "TRUE" : "FALSE");
+
+ if (!string.IsNullOrEmpty(Parameters))
+ {
+ uriFormat += "&" + Parameters;
+ }
+ }
+
+ UriFormat = uriFormat;
+ }
+
+ private static IEnumerable ChildElements(XmlElement element, string name)
+ {
+ return element.ChildNodes.OfType().Where(e => (string)e.LocalName == name);
+ }
+
+ private static XmlElement FirstChild(XmlElement element, string name)
+ {
+ return element.ChildNodes.OfType().FirstOrDefault(e => (string)e.LocalName == name);
+ }
+ }
+}
diff --git a/SampleApps/PhoneApplication/Properties/AssemblyInfo.cs b/SampleApps/PhoneApplication/Properties/AssemblyInfo.cs
index 7e7d79dc..14018598 100644
--- a/SampleApps/PhoneApplication/Properties/AssemblyInfo.cs
+++ b/SampleApps/PhoneApplication/Properties/AssemblyInfo.cs
@@ -7,8 +7,8 @@ using System.Runtime.InteropServices;
[assembly: AssemblyCompany("Clemens Fischer")]
[assembly: AssemblyCopyright("© 2016 Clemens Fischer")]
[assembly: AssemblyTrademark("")]
-[assembly: AssemblyVersion("2.8.0")]
-[assembly: AssemblyFileVersion("2.8.0")]
+[assembly: AssemblyVersion("2.9.0")]
+[assembly: AssemblyFileVersion("2.9.0")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
diff --git a/SampleApps/SilverlightApplication.Web/Properties/AssemblyInfo.cs b/SampleApps/SilverlightApplication.Web/Properties/AssemblyInfo.cs
index 81d321e3..e213dbd4 100644
--- a/SampleApps/SilverlightApplication.Web/Properties/AssemblyInfo.cs
+++ b/SampleApps/SilverlightApplication.Web/Properties/AssemblyInfo.cs
@@ -7,8 +7,8 @@ using System.Runtime.InteropServices;
[assembly: AssemblyCompany("Clemens Fischer")]
[assembly: AssemblyCopyright("© 2016 Clemens Fischer")]
[assembly: AssemblyTrademark("")]
-[assembly: AssemblyVersion("2.8.0")]
-[assembly: AssemblyFileVersion("2.8.0")]
+[assembly: AssemblyVersion("2.9.0")]
+[assembly: AssemblyFileVersion("2.9.0")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
diff --git a/SampleApps/SilverlightApplication/Properties/AssemblyInfo.cs b/SampleApps/SilverlightApplication/Properties/AssemblyInfo.cs
index fcb38c12..568257f5 100644
--- a/SampleApps/SilverlightApplication/Properties/AssemblyInfo.cs
+++ b/SampleApps/SilverlightApplication/Properties/AssemblyInfo.cs
@@ -7,8 +7,8 @@ using System.Runtime.InteropServices;
[assembly: AssemblyCompany("Clemens Fischer")]
[assembly: AssemblyCopyright("© 2016 Clemens Fischer")]
[assembly: AssemblyTrademark("")]
-[assembly: AssemblyVersion("2.8.0")]
-[assembly: AssemblyFileVersion("2.8.0")]
+[assembly: AssemblyVersion("2.9.0")]
+[assembly: AssemblyFileVersion("2.9.0")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
diff --git a/SampleApps/StoreApplication/Properties/AssemblyInfo.cs b/SampleApps/StoreApplication/Properties/AssemblyInfo.cs
index 9a6ecfee..728fd766 100644
--- a/SampleApps/StoreApplication/Properties/AssemblyInfo.cs
+++ b/SampleApps/StoreApplication/Properties/AssemblyInfo.cs
@@ -8,7 +8,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyCopyright("© 2015 Clemens Fischer")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
-[assembly: AssemblyVersion("2.8.0")]
-[assembly: AssemblyFileVersion("2.8.0")]
+[assembly: AssemblyVersion("2.9.0")]
+[assembly: AssemblyFileVersion("2.9.0")]
[assembly: AssemblyConfiguration("")]
[assembly: ComVisible(false)]
diff --git a/SampleApps/UniversalApp/MainPage.xaml b/SampleApps/UniversalApp/MainPage.xaml
index 043bdd20..48e4e9f7 100644
--- a/SampleApps/UniversalApp/MainPage.xaml
+++ b/SampleApps/UniversalApp/MainPage.xaml
@@ -211,10 +211,12 @@
+
+
diff --git a/SampleApps/UniversalApp/Properties/AssemblyInfo.cs b/SampleApps/UniversalApp/Properties/AssemblyInfo.cs
index bec13c68..93e8dd50 100644
--- a/SampleApps/UniversalApp/Properties/AssemblyInfo.cs
+++ b/SampleApps/UniversalApp/Properties/AssemblyInfo.cs
@@ -8,7 +8,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyCopyright("© 2016 Clemens Fischer")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
-[assembly: AssemblyVersion("2.8.0")]
-[assembly: AssemblyFileVersion("2.8.0")]
+[assembly: AssemblyVersion("2.9.0")]
+[assembly: AssemblyFileVersion("2.9.0")]
[assembly: AssemblyConfiguration("")]
[assembly: ComVisible(false)]
diff --git a/SampleApps/WpfApplication/MainWindow.xaml b/SampleApps/WpfApplication/MainWindow.xaml
index 81ca600a..804a0dd3 100644
--- a/SampleApps/WpfApplication/MainWindow.xaml
+++ b/SampleApps/WpfApplication/MainWindow.xaml
@@ -194,10 +194,8 @@
ManipulationInertiaStarting="MapManipulationInertiaStarting">
-
-
+
+
diff --git a/SampleApps/WpfApplication/Properties/AssemblyInfo.cs b/SampleApps/WpfApplication/Properties/AssemblyInfo.cs
index 4f299e8f..ffc9d036 100644
--- a/SampleApps/WpfApplication/Properties/AssemblyInfo.cs
+++ b/SampleApps/WpfApplication/Properties/AssemblyInfo.cs
@@ -7,8 +7,8 @@ using System.Runtime.InteropServices;
[assembly: AssemblyCompany("Clemens Fischer")]
[assembly: AssemblyCopyright("© 2016 Clemens Fischer")]
[assembly: AssemblyTrademark("")]
-[assembly: AssemblyVersion("2.8.0")]
-[assembly: AssemblyFileVersion("2.8.0")]
+[assembly: AssemblyVersion("2.9.0")]
+[assembly: AssemblyFileVersion("2.9.0")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]