mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2026-02-06 15:54:14 +01:00
Version 1.3.5. Fixed rendering issue with MapPath (formerly MapShape) and re-arranging of MapPanel child elements when Location is set initially.
This commit is contained in:
parent
e2ef560e36
commit
abfdd89efb
|
|
@ -8,8 +8,8 @@ using System.Runtime.InteropServices;
|
||||||
[assembly: AssemblyCompany("Clemens Fischer")]
|
[assembly: AssemblyCompany("Clemens Fischer")]
|
||||||
[assembly: AssemblyCopyright("Copyright © Clemens Fischer 2012-2013")]
|
[assembly: AssemblyCopyright("Copyright © Clemens Fischer 2012-2013")]
|
||||||
[assembly: AssemblyTrademark("")]
|
[assembly: AssemblyTrademark("")]
|
||||||
[assembly: AssemblyVersion("1.3.4")]
|
[assembly: AssemblyVersion("1.3.5")]
|
||||||
[assembly: AssemblyFileVersion("1.3.4")]
|
[assembly: AssemblyFileVersion("1.3.5")]
|
||||||
[assembly: AssemblyConfiguration("")]
|
[assembly: AssemblyConfiguration("")]
|
||||||
[assembly: AssemblyCulture("")]
|
[assembly: AssemblyCulture("")]
|
||||||
[assembly: ComVisible(false)]
|
[assembly: ComVisible(false)]
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,8 @@ using System.Runtime.InteropServices;
|
||||||
[assembly: AssemblyCompany("Clemens Fischer")]
|
[assembly: AssemblyCompany("Clemens Fischer")]
|
||||||
[assembly: AssemblyCopyright("Copyright © Clemens Fischer 2012-2013")]
|
[assembly: AssemblyCopyright("Copyright © Clemens Fischer 2012-2013")]
|
||||||
[assembly: AssemblyTrademark("")]
|
[assembly: AssemblyTrademark("")]
|
||||||
[assembly: AssemblyVersion("1.3.4")]
|
[assembly: AssemblyVersion("1.3.5")]
|
||||||
[assembly: AssemblyFileVersion("1.3.4")]
|
[assembly: AssemblyFileVersion("1.3.5")]
|
||||||
[assembly: AssemblyConfiguration("")]
|
[assembly: AssemblyConfiguration("")]
|
||||||
[assembly: AssemblyCulture("")]
|
[assembly: AssemblyCulture("")]
|
||||||
[assembly: ComVisible(false)]
|
[assembly: ComVisible(false)]
|
||||||
|
|
|
||||||
|
|
@ -80,11 +80,11 @@
|
||||||
<Compile Include="MapItemsControl.Silverlight.WinRT.cs" />
|
<Compile Include="MapItemsControl.Silverlight.WinRT.cs" />
|
||||||
<Compile Include="MapPanel.cs" />
|
<Compile Include="MapPanel.cs" />
|
||||||
<Compile Include="MapPanel.Silverlight.WinRT.cs" />
|
<Compile Include="MapPanel.Silverlight.WinRT.cs" />
|
||||||
|
<Compile Include="MapPath.cs" />
|
||||||
<Compile Include="MapRectangle.cs" />
|
<Compile Include="MapRectangle.cs" />
|
||||||
<Compile Include="MapShape.cs" />
|
|
||||||
<Compile Include="MapPolyline.cs" />
|
<Compile Include="MapPolyline.cs" />
|
||||||
<Compile Include="MapPolyline.Silverlight.WinRT.cs" />
|
<Compile Include="MapPolyline.Silverlight.WinRT.cs" />
|
||||||
<Compile Include="MapShape.Silverlight.WinRT.cs" />
|
<Compile Include="MapPath.Silverlight.WinRT.cs" />
|
||||||
<Compile Include="MapTransform.cs" />
|
<Compile Include="MapTransform.cs" />
|
||||||
<Compile Include="MatrixEx.cs" />
|
<Compile Include="MatrixEx.cs" />
|
||||||
<Compile Include="MercatorTransform.cs" />
|
<Compile Include="MercatorTransform.cs" />
|
||||||
|
|
|
||||||
|
|
@ -65,8 +65,8 @@
|
||||||
<Compile Include="MapPolyline.cs" />
|
<Compile Include="MapPolyline.cs" />
|
||||||
<Compile Include="MapPolyline.WPF.cs" />
|
<Compile Include="MapPolyline.WPF.cs" />
|
||||||
<Compile Include="MapRectangle.cs" />
|
<Compile Include="MapRectangle.cs" />
|
||||||
<Compile Include="MapShape.cs" />
|
<Compile Include="MapPath.cs" />
|
||||||
<Compile Include="MapShape.WPF.cs" />
|
<Compile Include="MapPath.WPF.cs" />
|
||||||
<Compile Include="MapTransform.cs" />
|
<Compile Include="MapTransform.cs" />
|
||||||
<Compile Include="MercatorTransform.cs" />
|
<Compile Include="MercatorTransform.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
|
|
||||||
|
|
@ -203,7 +203,7 @@ namespace MapControl
|
||||||
currentImageIndex = (currentImageIndex + 1) % 2;
|
currentImageIndex = (currentImageIndex + 1) % 2;
|
||||||
mapImage = (MapImage)Children[currentImageIndex];
|
mapImage = (MapImage)Children[currentImageIndex];
|
||||||
mapImage.Source = null;
|
mapImage.Source = null;
|
||||||
mapImage.North = double.NaN; // avoid frequent MapRectangle.UpdateGeometry() calls
|
mapImage.North = double.NaN; // avoid frequent MapRectangle.UpdateData() calls
|
||||||
mapImage.West = west;
|
mapImage.West = west;
|
||||||
mapImage.East = east;
|
mapImage.East = east;
|
||||||
mapImage.South = south;
|
mapImage.South = south;
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@
|
||||||
// Copyright © Clemens Fischer 2012-2013
|
// Copyright © Clemens Fischer 2012-2013
|
||||||
// Licensed under the Microsoft Public License (Ms-PL)
|
// Licensed under the Microsoft Public License (Ms-PL)
|
||||||
|
|
||||||
using System;
|
|
||||||
#if NETFX_CORE
|
#if NETFX_CORE
|
||||||
using Windows.Foundation;
|
using Windows.Foundation;
|
||||||
using Windows.UI.Xaml;
|
using Windows.UI.Xaml;
|
||||||
|
|
@ -98,28 +97,14 @@ namespace MapControl
|
||||||
{
|
{
|
||||||
foreach (UIElement element in InternalChildren)
|
foreach (UIElement element in InternalChildren)
|
||||||
{
|
{
|
||||||
var rect = new Rect(0d, 0d, element.DesiredSize.Width, element.DesiredSize.Height);
|
|
||||||
var location = GetLocation(element);
|
var location = GetLocation(element);
|
||||||
|
|
||||||
if (element is FrameworkElement)
|
ArrangeElement(element, finalSize, location != null);
|
||||||
{
|
|
||||||
if (location != null)
|
|
||||||
{
|
|
||||||
AlignElementWithLocation((FrameworkElement)element, ref rect);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
AlignElementWithoutLocation((FrameworkElement)element, finalSize, ref rect);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
element.Arrange(rect);
|
|
||||||
|
|
||||||
if (location != null)
|
if (location != null)
|
||||||
{
|
{
|
||||||
SetViewportPosition(element, parentMap, location);
|
SetViewportPosition(element, parentMap, location);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return finalSize;
|
return finalSize;
|
||||||
|
|
@ -143,8 +128,14 @@ namespace MapControl
|
||||||
{
|
{
|
||||||
var mapElement = element as IMapElement;
|
var mapElement = element as IMapElement;
|
||||||
var parentMap = mapElement != null ? mapElement.ParentMap : GetParentMap(element);
|
var parentMap = mapElement != null ? mapElement.ParentMap : GetParentMap(element);
|
||||||
|
var location = e.NewValue as Location;
|
||||||
|
|
||||||
SetViewportPosition(element, parentMap, (Location)e.NewValue);
|
if ((location != null) != (e.OldValue != null))
|
||||||
|
{
|
||||||
|
ArrangeElement(element, null, location != null);
|
||||||
|
}
|
||||||
|
|
||||||
|
SetViewportPosition(element, parentMap, location);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -193,74 +184,90 @@ namespace MapControl
|
||||||
translateTransform.Y = viewportPosition.Y;
|
translateTransform.Y = viewportPosition.Y;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void AlignElementWithLocation(FrameworkElement element, ref Rect arrangeRect)
|
private static void ArrangeElement(UIElement element, Size? panelSize, bool hasLocation)
|
||||||
{
|
{
|
||||||
switch (element.HorizontalAlignment)
|
var rect = new Rect(0d, 0d, element.DesiredSize.Width, element.DesiredSize.Height);
|
||||||
|
var frameworkElement = element as FrameworkElement;
|
||||||
|
|
||||||
|
if (frameworkElement != null)
|
||||||
{
|
{
|
||||||
case HorizontalAlignment.Center:
|
if (hasLocation)
|
||||||
arrangeRect.X = -arrangeRect.Width / 2d;
|
{
|
||||||
break;
|
switch (frameworkElement.HorizontalAlignment)
|
||||||
|
{
|
||||||
|
case HorizontalAlignment.Center:
|
||||||
|
rect.X = -rect.Width / 2d;
|
||||||
|
break;
|
||||||
|
|
||||||
case HorizontalAlignment.Right:
|
case HorizontalAlignment.Right:
|
||||||
arrangeRect.X = -arrangeRect.Width;
|
rect.X = -rect.Width;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (frameworkElement.VerticalAlignment)
|
||||||
|
{
|
||||||
|
case VerticalAlignment.Center:
|
||||||
|
rect.Y = -rect.Height / 2d;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case VerticalAlignment.Bottom:
|
||||||
|
rect.Y = -rect.Height;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!panelSize.HasValue)
|
||||||
|
{
|
||||||
|
var panel = frameworkElement.Parent as Panel;
|
||||||
|
panelSize = panel != null ? panel.RenderSize : Size.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (frameworkElement.HorizontalAlignment)
|
||||||
|
{
|
||||||
|
case HorizontalAlignment.Center:
|
||||||
|
rect.X = (panelSize.Value.Width - rect.Width) / 2d;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case HorizontalAlignment.Right:
|
||||||
|
rect.X = panelSize.Value.Width - rect.Width;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case HorizontalAlignment.Stretch:
|
||||||
|
rect.Width = panelSize.Value.Width;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (frameworkElement.VerticalAlignment)
|
||||||
|
{
|
||||||
|
case VerticalAlignment.Center:
|
||||||
|
rect.Y = (panelSize.Value.Height - rect.Height) / 2d;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case VerticalAlignment.Bottom:
|
||||||
|
rect.Y = panelSize.Value.Height - rect.Height;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case VerticalAlignment.Stretch:
|
||||||
|
rect.Height = panelSize.Value.Height;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (element.VerticalAlignment)
|
element.Arrange(rect);
|
||||||
{
|
|
||||||
case VerticalAlignment.Center:
|
|
||||||
arrangeRect.Y = -arrangeRect.Height / 2d;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case VerticalAlignment.Bottom:
|
|
||||||
arrangeRect.Y = -arrangeRect.Height;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void AlignElementWithoutLocation(FrameworkElement element, Size panelSize, ref Rect arrangeRect)
|
|
||||||
{
|
|
||||||
switch (element.HorizontalAlignment)
|
|
||||||
{
|
|
||||||
case HorizontalAlignment.Center:
|
|
||||||
arrangeRect.X = (panelSize.Width - arrangeRect.Width) / 2d;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case HorizontalAlignment.Right:
|
|
||||||
arrangeRect.X = panelSize.Width - arrangeRect.Width;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case HorizontalAlignment.Stretch:
|
|
||||||
arrangeRect.Width = panelSize.Width;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (element.VerticalAlignment)
|
|
||||||
{
|
|
||||||
case VerticalAlignment.Center:
|
|
||||||
arrangeRect.Y = (panelSize.Height - arrangeRect.Height) / 2d;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case VerticalAlignment.Bottom:
|
|
||||||
arrangeRect.Y = panelSize.Height - arrangeRect.Height;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case VerticalAlignment.Stretch:
|
|
||||||
arrangeRect.Height = panelSize.Height;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,20 +3,17 @@
|
||||||
// Licensed under the Microsoft Public License (Ms-PL)
|
// Licensed under the Microsoft Public License (Ms-PL)
|
||||||
|
|
||||||
#if NETFX_CORE
|
#if NETFX_CORE
|
||||||
using Windows.UI.Xaml.Media;
|
|
||||||
using Windows.UI.Xaml.Shapes;
|
using Windows.UI.Xaml.Shapes;
|
||||||
#else
|
#else
|
||||||
using System.Windows.Media;
|
|
||||||
using System.Windows.Shapes;
|
using System.Windows.Shapes;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace MapControl
|
namespace MapControl
|
||||||
{
|
{
|
||||||
public partial class MapShape : Path
|
public partial class MapPath : Path
|
||||||
{
|
{
|
||||||
public MapShape(Geometry geometry)
|
public MapPath()
|
||||||
{
|
{
|
||||||
Data = Geometry = geometry;
|
|
||||||
MapPanel.AddParentMapHandlers(this);
|
MapPanel.AddParentMapHandlers(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
28
MapControl/MapPath.WPF.cs
Normal file
28
MapControl/MapPath.WPF.cs
Normal file
|
|
@ -0,0 +1,28 @@
|
||||||
|
// XAML Map Control - http://xamlmapcontrol.codeplex.com/
|
||||||
|
// Copyright © Clemens Fischer 2012-2013
|
||||||
|
// Licensed under the Microsoft Public License (Ms-PL)
|
||||||
|
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Shapes;
|
||||||
|
|
||||||
|
namespace MapControl
|
||||||
|
{
|
||||||
|
public partial class MapPath : Shape
|
||||||
|
{
|
||||||
|
public static readonly DependencyProperty DataProperty = DependencyProperty.Register(
|
||||||
|
"Data", typeof(Geometry), typeof(MapPath),
|
||||||
|
new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.AffectsRender));
|
||||||
|
|
||||||
|
public Geometry Data
|
||||||
|
{
|
||||||
|
get { return (Geometry)GetValue(DataProperty); }
|
||||||
|
set { SetValue(DataProperty, value); }
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override Geometry DefiningGeometry
|
||||||
|
{
|
||||||
|
get { return Data; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -4,11 +4,8 @@
|
||||||
|
|
||||||
#if NETFX_CORE
|
#if NETFX_CORE
|
||||||
using Windows.Foundation;
|
using Windows.Foundation;
|
||||||
using Windows.UI.Xaml.Media;
|
|
||||||
using Windows.UI.Xaml.Shapes;
|
|
||||||
#else
|
#else
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Media;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace MapControl
|
namespace MapControl
|
||||||
|
|
@ -16,7 +13,7 @@ namespace MapControl
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Base class for map shapes.
|
/// Base class for map shapes.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class MapShape : IMapElement
|
public partial class MapPath : IMapElement
|
||||||
{
|
{
|
||||||
private MapBase parentMap;
|
private MapBase parentMap;
|
||||||
|
|
||||||
|
|
@ -26,20 +23,18 @@ namespace MapControl
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
parentMap = value;
|
parentMap = value;
|
||||||
UpdateGeometry();
|
UpdateData();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected readonly Geometry Geometry;
|
protected virtual void UpdateData()
|
||||||
|
|
||||||
protected virtual void UpdateGeometry()
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Size MeasureOverride(Size constraint)
|
protected override Size MeasureOverride(Size constraint)
|
||||||
{
|
{
|
||||||
// Shape.MeasureOverride in WPF and WinRT sometimes return a Size with zero
|
// base.MeasureOverride in WPF and WinRT sometimes return a Size with zero
|
||||||
// width or height, whereas Shape.MeasureOverride in Silverlight occasionally
|
// width or height, whereas base.MeasureOverride in Silverlight occasionally
|
||||||
// throws an ArgumentException, as it tries to create a Size from a negative
|
// throws an ArgumentException, as it tries to create a Size from a negative
|
||||||
// width or height, apparently resulting from a transformed Geometry.
|
// width or height, apparently resulting from a transformed Geometry.
|
||||||
// In either case it seems to be sufficient to simply return a non-zero size.
|
// In either case it seems to be sufficient to simply return a non-zero size.
|
||||||
|
|
@ -15,13 +15,13 @@ namespace MapControl
|
||||||
public partial class MapPolyline
|
public partial class MapPolyline
|
||||||
{
|
{
|
||||||
public MapPolyline()
|
public MapPolyline()
|
||||||
: base(new PathGeometry())
|
|
||||||
{
|
{
|
||||||
|
Data = new PathGeometry();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void UpdateGeometry()
|
protected override void UpdateData()
|
||||||
{
|
{
|
||||||
var geometry = (PathGeometry)Geometry;
|
var geometry = (PathGeometry)Data;
|
||||||
var locations = Locations;
|
var locations = Locations;
|
||||||
Location first;
|
Location first;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,13 +10,13 @@ namespace MapControl
|
||||||
public partial class MapPolyline
|
public partial class MapPolyline
|
||||||
{
|
{
|
||||||
public MapPolyline()
|
public MapPolyline()
|
||||||
: base(new StreamGeometry())
|
|
||||||
{
|
{
|
||||||
|
Data = new StreamGeometry();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void UpdateGeometry()
|
protected override void UpdateData()
|
||||||
{
|
{
|
||||||
var geometry = (StreamGeometry)Geometry;
|
var geometry = (StreamGeometry)Data;
|
||||||
var locations = Locations;
|
var locations = Locations;
|
||||||
Location first;
|
Location first;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ using System.Windows;
|
||||||
|
|
||||||
namespace MapControl
|
namespace MapControl
|
||||||
{
|
{
|
||||||
public partial class MapPolyline : MapShape
|
public partial class MapPolyline : MapPath
|
||||||
{
|
{
|
||||||
#if NETFX_CORE
|
#if NETFX_CORE
|
||||||
// For WinRT, the Locations dependency property type is declared as object
|
// For WinRT, the Locations dependency property type is declared as object
|
||||||
|
|
@ -29,7 +29,7 @@ namespace MapControl
|
||||||
|
|
||||||
public static readonly DependencyProperty IsClosedProperty = DependencyProperty.Register(
|
public static readonly DependencyProperty IsClosedProperty = DependencyProperty.Register(
|
||||||
"IsClosed", typeof(bool), typeof(MapPolyline),
|
"IsClosed", typeof(bool), typeof(MapPolyline),
|
||||||
new PropertyMetadata(false, (o, e) => ((MapPolyline)o).UpdateGeometry()));
|
new PropertyMetadata(false, (o, e) => ((MapPolyline)o).UpdateData()));
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the locations that define the polyline points.
|
/// Gets or sets the locations that define the polyline points.
|
||||||
|
|
@ -51,7 +51,7 @@ namespace MapControl
|
||||||
|
|
||||||
private void LocationCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
|
private void LocationCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
|
||||||
{
|
{
|
||||||
UpdateGeometry();
|
UpdateData();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void LocationsPropertyChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e)
|
private static void LocationsPropertyChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e)
|
||||||
|
|
@ -70,7 +70,7 @@ namespace MapControl
|
||||||
newCollection.CollectionChanged += mapPolyline.LocationCollectionChanged;
|
newCollection.CollectionChanged += mapPolyline.LocationCollectionChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
mapPolyline.UpdateGeometry();
|
mapPolyline.UpdateData();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,27 +16,27 @@ namespace MapControl
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Fills a rectangular area defined by South, North, West and East with a Brush.
|
/// Fills a rectangular area defined by South, North, West and East with a Brush.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class MapRectangle : MapShape
|
public class MapRectangle : MapPath
|
||||||
{
|
{
|
||||||
public static readonly DependencyProperty SouthProperty = DependencyProperty.Register(
|
public static readonly DependencyProperty SouthProperty = DependencyProperty.Register(
|
||||||
"South", typeof(double), typeof(MapRectangle),
|
"South", typeof(double), typeof(MapRectangle),
|
||||||
new PropertyMetadata(double.NaN, (o, e) => ((MapRectangle)o).UpdateGeometry()));
|
new PropertyMetadata(double.NaN, (o, e) => ((MapRectangle)o).UpdateData()));
|
||||||
|
|
||||||
public static readonly DependencyProperty NorthProperty = DependencyProperty.Register(
|
public static readonly DependencyProperty NorthProperty = DependencyProperty.Register(
|
||||||
"North", typeof(double), typeof(MapRectangle),
|
"North", typeof(double), typeof(MapRectangle),
|
||||||
new PropertyMetadata(double.NaN, (o, e) => ((MapRectangle)o).UpdateGeometry()));
|
new PropertyMetadata(double.NaN, (o, e) => ((MapRectangle)o).UpdateData()));
|
||||||
|
|
||||||
public static readonly DependencyProperty WestProperty = DependencyProperty.Register(
|
public static readonly DependencyProperty WestProperty = DependencyProperty.Register(
|
||||||
"West", typeof(double), typeof(MapRectangle),
|
"West", typeof(double), typeof(MapRectangle),
|
||||||
new PropertyMetadata(double.NaN, (o, e) => ((MapRectangle)o).UpdateGeometry()));
|
new PropertyMetadata(double.NaN, (o, e) => ((MapRectangle)o).UpdateData()));
|
||||||
|
|
||||||
public static readonly DependencyProperty EastProperty = DependencyProperty.Register(
|
public static readonly DependencyProperty EastProperty = DependencyProperty.Register(
|
||||||
"East", typeof(double), typeof(MapRectangle),
|
"East", typeof(double), typeof(MapRectangle),
|
||||||
new PropertyMetadata(double.NaN, (o, e) => ((MapRectangle)o).UpdateGeometry()));
|
new PropertyMetadata(double.NaN, (o, e) => ((MapRectangle)o).UpdateData()));
|
||||||
|
|
||||||
public MapRectangle()
|
public MapRectangle()
|
||||||
: base(new RectangleGeometry())
|
|
||||||
{
|
{
|
||||||
|
Data = new RectangleGeometry();
|
||||||
}
|
}
|
||||||
|
|
||||||
public double South
|
public double South
|
||||||
|
|
@ -63,9 +63,9 @@ namespace MapControl
|
||||||
set { SetValue(EastProperty, value); }
|
set { SetValue(EastProperty, value); }
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void UpdateGeometry()
|
protected override void UpdateData()
|
||||||
{
|
{
|
||||||
var geometry = (RectangleGeometry)Geometry;
|
var geometry = (RectangleGeometry)Data;
|
||||||
|
|
||||||
if (ParentMap != null &&
|
if (ParentMap != null &&
|
||||||
!double.IsNaN(South) && !double.IsNaN(North) &&
|
!double.IsNaN(South) && !double.IsNaN(North) &&
|
||||||
|
|
|
||||||
|
|
@ -1,22 +0,0 @@
|
||||||
// XAML Map Control - http://xamlmapcontrol.codeplex.com/
|
|
||||||
// Copyright © Clemens Fischer 2012-2013
|
|
||||||
// Licensed under the Microsoft Public License (Ms-PL)
|
|
||||||
|
|
||||||
using System.Windows.Media;
|
|
||||||
using System.Windows.Shapes;
|
|
||||||
|
|
||||||
namespace MapControl
|
|
||||||
{
|
|
||||||
public partial class MapShape : Shape
|
|
||||||
{
|
|
||||||
public MapShape(Geometry geometry)
|
|
||||||
{
|
|
||||||
Geometry = geometry;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override Geometry DefiningGeometry
|
|
||||||
{
|
|
||||||
get { return Geometry; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -15,8 +15,8 @@ using System.Windows;
|
||||||
[assembly: AssemblyCompany("Clemens Fischer")]
|
[assembly: AssemblyCompany("Clemens Fischer")]
|
||||||
[assembly: AssemblyCopyright("Copyright © Clemens Fischer 2012-2013")]
|
[assembly: AssemblyCopyright("Copyright © Clemens Fischer 2012-2013")]
|
||||||
[assembly: AssemblyTrademark("")]
|
[assembly: AssemblyTrademark("")]
|
||||||
[assembly: AssemblyVersion("1.3.4")]
|
[assembly: AssemblyVersion("1.3.5")]
|
||||||
[assembly: AssemblyFileVersion("1.3.4")]
|
[assembly: AssemblyFileVersion("1.3.5")]
|
||||||
[assembly: AssemblyConfiguration("")]
|
[assembly: AssemblyConfiguration("")]
|
||||||
[assembly: AssemblyCulture("")]
|
[assembly: AssemblyCulture("")]
|
||||||
[assembly: ComVisible(false)]
|
[assembly: ComVisible(false)]
|
||||||
|
|
|
||||||
|
|
@ -78,6 +78,12 @@
|
||||||
<Compile Include="..\MapPanel.Silverlight.WinRT.cs">
|
<Compile Include="..\MapPanel.Silverlight.WinRT.cs">
|
||||||
<Link>MapPanel.Silverlight.WinRT.cs</Link>
|
<Link>MapPanel.Silverlight.WinRT.cs</Link>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="..\MapPath.cs">
|
||||||
|
<Link>MapPath.cs</Link>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="..\MapPath.Silverlight.WinRT.cs">
|
||||||
|
<Link>MapPath.Silverlight.WinRT.cs</Link>
|
||||||
|
</Compile>
|
||||||
<Compile Include="..\MapPolyline.cs">
|
<Compile Include="..\MapPolyline.cs">
|
||||||
<Link>MapPolyline.cs</Link>
|
<Link>MapPolyline.cs</Link>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
|
@ -87,12 +93,6 @@
|
||||||
<Compile Include="..\MapRectangle.cs">
|
<Compile Include="..\MapRectangle.cs">
|
||||||
<Link>MapRectangle.cs</Link>
|
<Link>MapRectangle.cs</Link>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="..\MapShape.cs">
|
|
||||||
<Link>MapShape.cs</Link>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="..\MapShape.Silverlight.WinRT.cs">
|
|
||||||
<Link>MapShape.Silverlight.WinRT.cs</Link>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="..\MapTransform.cs">
|
<Compile Include="..\MapTransform.cs">
|
||||||
<Link>MapTransform.cs</Link>
|
<Link>MapTransform.cs</Link>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,8 @@ using System.Runtime.InteropServices;
|
||||||
[assembly: AssemblyCompany("Clemens Fischer")]
|
[assembly: AssemblyCompany("Clemens Fischer")]
|
||||||
[assembly: AssemblyCopyright("Copyright © Clemens Fischer 2012-2013")]
|
[assembly: AssemblyCopyright("Copyright © Clemens Fischer 2012-2013")]
|
||||||
[assembly: AssemblyTrademark("")]
|
[assembly: AssemblyTrademark("")]
|
||||||
[assembly: AssemblyVersion("1.3.4")]
|
[assembly: AssemblyVersion("1.3.5")]
|
||||||
[assembly: AssemblyFileVersion("1.3.4")]
|
[assembly: AssemblyFileVersion("1.3.5")]
|
||||||
[assembly: AssemblyConfiguration("")]
|
[assembly: AssemblyConfiguration("")]
|
||||||
[assembly: AssemblyCulture("")]
|
[assembly: AssemblyCulture("")]
|
||||||
[assembly: ComVisible(false)]
|
[assembly: ComVisible(false)]
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,8 @@ using System.Runtime.InteropServices;
|
||||||
[assembly: AssemblyCompany("Clemens Fischer")]
|
[assembly: AssemblyCompany("Clemens Fischer")]
|
||||||
[assembly: AssemblyCopyright("Copyright © Clemens Fischer 2012-2013")]
|
[assembly: AssemblyCopyright("Copyright © Clemens Fischer 2012-2013")]
|
||||||
[assembly: AssemblyTrademark("")]
|
[assembly: AssemblyTrademark("")]
|
||||||
[assembly: AssemblyVersion("1.3.4")]
|
[assembly: AssemblyVersion("1.3.5")]
|
||||||
[assembly: AssemblyFileVersion("1.3.4")]
|
[assembly: AssemblyFileVersion("1.3.5")]
|
||||||
[assembly: AssemblyConfiguration("")]
|
[assembly: AssemblyConfiguration("")]
|
||||||
[assembly: AssemblyCulture("")]
|
[assembly: AssemblyCulture("")]
|
||||||
[assembly: ComVisible(false)]
|
[assembly: ComVisible(false)]
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,8 @@ using System.Runtime.InteropServices;
|
||||||
[assembly: AssemblyCompany("Clemens Fischer")]
|
[assembly: AssemblyCompany("Clemens Fischer")]
|
||||||
[assembly: AssemblyCopyright("Copyright © Clemens Fischer 2012-2013")]
|
[assembly: AssemblyCopyright("Copyright © Clemens Fischer 2012-2013")]
|
||||||
[assembly: AssemblyTrademark("")]
|
[assembly: AssemblyTrademark("")]
|
||||||
[assembly: AssemblyVersion("1.3.4")]
|
[assembly: AssemblyVersion("1.3.5")]
|
||||||
[assembly: AssemblyFileVersion("1.3.4")]
|
[assembly: AssemblyFileVersion("1.3.5")]
|
||||||
[assembly: AssemblyConfiguration("")]
|
[assembly: AssemblyConfiguration("")]
|
||||||
[assembly: AssemblyCulture("")]
|
[assembly: AssemblyCulture("")]
|
||||||
[assembly: ComVisible(false)]
|
[assembly: ComVisible(false)]
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,8 @@ using System.Runtime.InteropServices;
|
||||||
[assembly: AssemblyCompany("Clemens Fischer")]
|
[assembly: AssemblyCompany("Clemens Fischer")]
|
||||||
[assembly: AssemblyCopyright("Copyright © Clemens Fischer 2012-2013")]
|
[assembly: AssemblyCopyright("Copyright © Clemens Fischer 2012-2013")]
|
||||||
[assembly: AssemblyTrademark("")]
|
[assembly: AssemblyTrademark("")]
|
||||||
[assembly: AssemblyVersion("1.3.4")]
|
[assembly: AssemblyVersion("1.3.5")]
|
||||||
[assembly: AssemblyFileVersion("1.3.4")]
|
[assembly: AssemblyFileVersion("1.3.5")]
|
||||||
[assembly: AssemblyConfiguration("")]
|
[assembly: AssemblyConfiguration("")]
|
||||||
[assembly: AssemblyCulture("")]
|
[assembly: AssemblyCulture("")]
|
||||||
[assembly: ComVisible(false)]
|
[assembly: ComVisible(false)]
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,8 @@ using System.Runtime.InteropServices;
|
||||||
[assembly: AssemblyCompany("Clemens Fischer")]
|
[assembly: AssemblyCompany("Clemens Fischer")]
|
||||||
[assembly: AssemblyCopyright("Copyright © Clemens Fischer 2012-2013")]
|
[assembly: AssemblyCopyright("Copyright © Clemens Fischer 2012-2013")]
|
||||||
[assembly: AssemblyTrademark("")]
|
[assembly: AssemblyTrademark("")]
|
||||||
[assembly: AssemblyVersion("1.3.4")]
|
[assembly: AssemblyVersion("1.3.5")]
|
||||||
[assembly: AssemblyFileVersion("1.3.4")]
|
[assembly: AssemblyFileVersion("1.3.5")]
|
||||||
[assembly: AssemblyConfiguration("")]
|
[assembly: AssemblyConfiguration("")]
|
||||||
[assembly: AssemblyCulture("")]
|
[assembly: AssemblyCulture("")]
|
||||||
[assembly: ComVisible(false)]
|
[assembly: ComVisible(false)]
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,8 @@ using System.Runtime.InteropServices;
|
||||||
[assembly: AssemblyCompany("Clemens Fischer")]
|
[assembly: AssemblyCompany("Clemens Fischer")]
|
||||||
[assembly: AssemblyCopyright("Copyright © Clemens Fischer 2012-2013")]
|
[assembly: AssemblyCopyright("Copyright © Clemens Fischer 2012-2013")]
|
||||||
[assembly: AssemblyTrademark("")]
|
[assembly: AssemblyTrademark("")]
|
||||||
[assembly: AssemblyVersion("1.3.4")]
|
[assembly: AssemblyVersion("1.3.5")]
|
||||||
[assembly: AssemblyFileVersion("1.3.4")]
|
[assembly: AssemblyFileVersion("1.3.5")]
|
||||||
[assembly: AssemblyConfiguration("")]
|
[assembly: AssemblyConfiguration("")]
|
||||||
[assembly: AssemblyCulture("")]
|
[assembly: AssemblyCulture("")]
|
||||||
[assembly: ComVisible(false)]
|
[assembly: ComVisible(false)]
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue