2017-06-25 23:05:48 +02:00
|
|
|
|
// XAML Map Control - https://github.com/ClemensFischer/XAML-Map-Control
|
2020-01-09 19:40:10 +01:00
|
|
|
|
// © 2020 Clemens Fischer
|
2012-05-04 12:52:20 +02:00
|
|
|
|
// Licensed under the Microsoft Public License (Ms-PL)
|
|
|
|
|
|
|
2013-06-07 15:09:59 +02:00
|
|
|
|
using System;
|
2018-04-30 23:13:50 +02:00
|
|
|
|
using System.Linq;
|
2017-08-04 21:38:58 +02:00
|
|
|
|
#if WINDOWS_UWP
|
2012-11-22 21:42:29 +01:00
|
|
|
|
using Windows.Foundation;
|
|
|
|
|
|
using Windows.UI.Xaml;
|
2017-06-25 23:05:48 +02:00
|
|
|
|
using Windows.UI.Xaml.Controls;
|
2012-11-22 21:42:29 +01:00
|
|
|
|
using Windows.UI.Xaml.Media;
|
|
|
|
|
|
#else
|
2012-04-25 22:02:53 +02:00
|
|
|
|
using System.Windows;
|
2017-06-25 23:05:48 +02:00
|
|
|
|
using System.Windows.Controls;
|
2012-11-22 21:42:29 +01:00
|
|
|
|
using System.Windows.Media;
|
|
|
|
|
|
#endif
|
2012-04-25 22:02:53 +02:00
|
|
|
|
|
|
|
|
|
|
namespace MapControl
|
|
|
|
|
|
{
|
2017-09-05 20:57:17 +02:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Optional interface to hold the value of the MapPanel.ParentMap attached property.
|
|
|
|
|
|
/// </summary>
|
2017-06-25 23:05:48 +02:00
|
|
|
|
public interface IMapElement
|
|
|
|
|
|
{
|
|
|
|
|
|
MapBase ParentMap { get; set; }
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2012-05-04 12:52:20 +02:00
|
|
|
|
/// <summary>
|
2017-06-25 23:05:48 +02:00
|
|
|
|
/// Arranges child elements on a Map at positions specified by the attached property Location,
|
|
|
|
|
|
/// or in rectangles specified by the attached property BoundingBox.
|
2012-05-04 12:52:20 +02:00
|
|
|
|
/// </summary>
|
2017-06-25 23:05:48 +02:00
|
|
|
|
public partial class MapPanel : Panel, IMapElement
|
2012-04-25 22:02:53 +02:00
|
|
|
|
{
|
2021-01-13 00:08:55 +01:00
|
|
|
|
public static readonly DependencyProperty AutoCollapseProperty = DependencyProperty.RegisterAttached(
|
|
|
|
|
|
"AutoCollapse", typeof(bool), typeof(MapPanel), new PropertyMetadata(false));
|
2020-07-14 17:03:36 +02:00
|
|
|
|
|
2017-09-05 20:57:17 +02:00
|
|
|
|
private MapBase parentMap;
|
|
|
|
|
|
|
2020-07-14 17:03:36 +02:00
|
|
|
|
public MapBase ParentMap
|
|
|
|
|
|
{
|
|
|
|
|
|
get { return parentMap; }
|
|
|
|
|
|
set { SetParentMap(value); }
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2017-09-05 20:57:17 +02:00
|
|
|
|
public MapPanel()
|
|
|
|
|
|
{
|
|
|
|
|
|
InitMapElement(this);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2021-01-13 00:08:55 +01:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Gets a value that controls whether an element's Visibility is automatically
|
|
|
|
|
|
/// set to Collapsed when it is located outside the visible viewport area.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public static bool GetAutoCollapse(FrameworkElement element)
|
|
|
|
|
|
{
|
|
|
|
|
|
return (bool)element.GetValue(AutoCollapseProperty);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Sets the AutoCollapse property.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public static void SetAutoCollapse(FrameworkElement element, bool value)
|
|
|
|
|
|
{
|
|
|
|
|
|
element.SetValue(AutoCollapseProperty, value);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Gets the geodetic Location of an element.
|
|
|
|
|
|
/// </summary>
|
2018-04-30 23:13:50 +02:00
|
|
|
|
public static Location GetLocation(FrameworkElement element)
|
2012-04-25 22:02:53 +02:00
|
|
|
|
{
|
2012-05-04 12:52:20 +02:00
|
|
|
|
return (Location)element.GetValue(LocationProperty);
|
2012-04-25 22:02:53 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2021-01-13 00:08:55 +01:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Sets the geodetic Location of an element.
|
|
|
|
|
|
/// </summary>
|
2018-04-30 23:13:50 +02:00
|
|
|
|
public static void SetLocation(FrameworkElement element, Location value)
|
2012-04-25 22:02:53 +02:00
|
|
|
|
{
|
|
|
|
|
|
element.SetValue(LocationProperty, value);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2021-01-13 00:08:55 +01:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Gets the BoundingBox of an element.
|
|
|
|
|
|
/// </summary>
|
2018-04-30 23:13:50 +02:00
|
|
|
|
public static BoundingBox GetBoundingBox(FrameworkElement element)
|
2017-06-25 23:05:48 +02:00
|
|
|
|
{
|
|
|
|
|
|
return (BoundingBox)element.GetValue(BoundingBoxProperty);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2021-01-13 00:08:55 +01:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Sets the BoundingBox of an element.
|
|
|
|
|
|
/// </summary>
|
2018-04-30 23:13:50 +02:00
|
|
|
|
public static void SetBoundingBox(FrameworkElement element, BoundingBox value)
|
2017-06-25 23:05:48 +02:00
|
|
|
|
{
|
|
|
|
|
|
element.SetValue(BoundingBoxProperty, value);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2021-01-13 00:08:55 +01:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Gets the position of an element in view coordinates.
|
|
|
|
|
|
/// </summary>
|
2020-03-28 21:53:38 +01:00
|
|
|
|
public static Point? GetViewPosition(FrameworkElement element)
|
2018-04-30 23:13:50 +02:00
|
|
|
|
{
|
2020-03-28 21:53:38 +01:00
|
|
|
|
return (Point?)element.GetValue(ViewPositionProperty);
|
2018-04-30 23:13:50 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2020-07-14 17:03:36 +02:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Returns the view position of a Location.
|
|
|
|
|
|
/// </summary>
|
2021-01-13 00:08:55 +01:00
|
|
|
|
public Point? GetViewPosition(Location location)
|
2013-04-12 19:59:16 +02:00
|
|
|
|
{
|
2021-01-13 00:08:55 +01:00
|
|
|
|
if (location == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
return null;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-07-14 17:03:36 +02:00
|
|
|
|
var pos = parentMap.LocationToView(location);
|
|
|
|
|
|
|
|
|
|
|
|
if (parentMap.MapProjection.IsNormalCylindrical &&
|
|
|
|
|
|
(pos.X < 0d || pos.X > parentMap.RenderSize.Width ||
|
|
|
|
|
|
pos.Y < 0d || pos.Y > parentMap.RenderSize.Height))
|
|
|
|
|
|
{
|
|
|
|
|
|
location = new Location(location.Latitude, parentMap.ConstrainedLongitude(location.Longitude));
|
|
|
|
|
|
|
|
|
|
|
|
pos = parentMap.LocationToView(location);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return pos;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Returns the potentially rotated view rectangle of a BoundingBox.
|
|
|
|
|
|
/// </summary>
|
2020-09-01 07:34:28 +02:00
|
|
|
|
public ViewRect GetViewRect(BoundingBox boundingBox)
|
2020-07-14 17:03:36 +02:00
|
|
|
|
{
|
2020-09-01 07:34:28 +02:00
|
|
|
|
return GetViewRect(parentMap.MapProjection.BoundingBoxToRect(boundingBox));
|
2020-07-15 16:40:33 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Returns the potentially rotated view rectangle of a map coordinate rectangle.
|
|
|
|
|
|
/// </summary>
|
2020-09-01 07:34:28 +02:00
|
|
|
|
public ViewRect GetViewRect(Rect rect)
|
2020-07-15 16:40:33 +02:00
|
|
|
|
{
|
2020-07-14 17:03:36 +02:00
|
|
|
|
var center = new Point(rect.X + rect.Width / 2d, rect.Y + rect.Height / 2d);
|
|
|
|
|
|
var pos = parentMap.ViewTransform.MapToView(center);
|
|
|
|
|
|
|
2020-07-15 16:40:33 +02:00
|
|
|
|
if (parentMap.MapProjection.IsNormalCylindrical &&
|
2020-07-14 17:03:36 +02:00
|
|
|
|
(pos.X < 0d || pos.X > parentMap.RenderSize.Width ||
|
|
|
|
|
|
pos.Y < 0d || pos.Y > parentMap.RenderSize.Height))
|
|
|
|
|
|
{
|
2020-07-15 16:40:33 +02:00
|
|
|
|
var location = parentMap.MapProjection.MapToLocation(center);
|
2020-07-14 17:03:36 +02:00
|
|
|
|
location.Longitude = parentMap.ConstrainedLongitude(location.Longitude);
|
|
|
|
|
|
|
|
|
|
|
|
pos = parentMap.LocationToView(location);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var width = rect.Width * parentMap.ViewTransform.Scale;
|
|
|
|
|
|
var height = rect.Height * parentMap.ViewTransform.Scale;
|
|
|
|
|
|
var x = pos.X - width / 2d;
|
|
|
|
|
|
var y = pos.Y - height / 2d;
|
|
|
|
|
|
|
|
|
|
|
|
return new ViewRect(x, y, width, height, parentMap.ViewTransform.Rotation);
|
2018-05-01 02:06:22 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected virtual void SetParentMap(MapBase map)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (parentMap != null && parentMap != this)
|
2018-04-30 23:13:50 +02:00
|
|
|
|
{
|
2018-05-01 02:06:22 +02:00
|
|
|
|
parentMap.ViewportChanged -= OnViewportChanged;
|
|
|
|
|
|
}
|
2018-04-30 23:13:50 +02:00
|
|
|
|
|
2018-05-01 02:06:22 +02:00
|
|
|
|
parentMap = map;
|
2018-04-30 23:13:50 +02:00
|
|
|
|
|
2018-05-01 02:06:22 +02:00
|
|
|
|
if (parentMap != null && parentMap != this)
|
|
|
|
|
|
{
|
|
|
|
|
|
parentMap.ViewportChanged += OnViewportChanged;
|
2018-04-30 23:13:50 +02:00
|
|
|
|
|
2018-05-01 02:06:22 +02:00
|
|
|
|
OnViewportChanged(new ViewportChangedEventArgs());
|
2018-04-30 23:13:50 +02:00
|
|
|
|
}
|
2014-07-22 20:02:30 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2018-05-01 12:45:19 +02:00
|
|
|
|
private void OnViewportChanged(object sender, ViewportChangedEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
OnViewportChanged(e);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected virtual void OnViewportChanged(ViewportChangedEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
InvalidateArrange();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2017-06-25 23:05:48 +02:00
|
|
|
|
protected override Size MeasureOverride(Size availableSize)
|
|
|
|
|
|
{
|
|
|
|
|
|
availableSize = new Size(double.PositiveInfinity, double.PositiveInfinity);
|
|
|
|
|
|
|
2018-04-30 23:13:50 +02:00
|
|
|
|
foreach (var element in Children.OfType<FrameworkElement>())
|
2017-06-25 23:05:48 +02:00
|
|
|
|
{
|
|
|
|
|
|
element.Measure(availableSize);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return new Size();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2012-04-25 22:02:53 +02:00
|
|
|
|
protected override Size ArrangeOverride(Size finalSize)
|
|
|
|
|
|
{
|
2019-07-08 23:00:57 +02:00
|
|
|
|
if (parentMap != null)
|
2012-04-25 22:02:53 +02:00
|
|
|
|
{
|
2019-07-08 23:00:57 +02:00
|
|
|
|
foreach (var element in Children.OfType<FrameworkElement>())
|
2014-06-11 23:03:13 +02:00
|
|
|
|
{
|
2021-01-13 00:08:55 +01:00
|
|
|
|
var position = GetViewPosition(GetLocation(element));
|
2019-07-08 23:00:57 +02:00
|
|
|
|
|
2021-01-13 00:08:55 +01:00
|
|
|
|
SetViewPosition(element, position);
|
|
|
|
|
|
|
|
|
|
|
|
if (GetAutoCollapse(element))
|
2019-07-08 23:00:57 +02:00
|
|
|
|
{
|
2021-01-13 00:08:55 +01:00
|
|
|
|
if (position.HasValue &&
|
|
|
|
|
|
(position.Value.X < 0d ||
|
|
|
|
|
|
position.Value.Y < 0d ||
|
|
|
|
|
|
position.Value.X > parentMap.RenderSize.Width ||
|
|
|
|
|
|
position.Value.Y > parentMap.RenderSize.Height))
|
|
|
|
|
|
{
|
|
|
|
|
|
element.SetValue(VisibilityProperty, Visibility.Collapsed);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
element.ClearValue(VisibilityProperty);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2019-07-08 23:00:57 +02:00
|
|
|
|
|
2021-01-13 00:08:55 +01:00
|
|
|
|
if (position.HasValue)
|
|
|
|
|
|
{
|
|
|
|
|
|
ArrangeElement(element, position.Value);
|
2019-07-08 23:00:57 +02:00
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
var boundingBox = GetBoundingBox(element);
|
|
|
|
|
|
|
|
|
|
|
|
if (boundingBox != null)
|
|
|
|
|
|
{
|
2020-09-01 07:34:28 +02:00
|
|
|
|
ArrangeElement(element, GetViewRect(boundingBox));
|
2019-07-08 23:00:57 +02:00
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
ArrangeElement(element, finalSize);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2014-06-11 23:03:13 +02:00
|
|
|
|
}
|
2015-08-09 20:04:44 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2018-04-30 23:13:50 +02:00
|
|
|
|
return finalSize;
|
2015-08-09 20:04:44 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2020-07-14 17:03:36 +02:00
|
|
|
|
private static void ArrangeElement(FrameworkElement element, ViewRect rect)
|
2017-06-25 23:05:48 +02:00
|
|
|
|
{
|
2020-07-14 17:03:36 +02:00
|
|
|
|
element.Width = rect.Width;
|
|
|
|
|
|
element.Height = rect.Height;
|
2020-07-15 16:40:33 +02:00
|
|
|
|
|
|
|
|
|
|
ArrangeElement(element, new Rect(rect.X, rect.Y, rect.Width, rect.Height));
|
2017-06-25 23:05:48 +02:00
|
|
|
|
|
2020-07-14 17:03:36 +02:00
|
|
|
|
if (element.RenderTransform is RotateTransform rotateTransform)
|
2017-06-25 23:05:48 +02:00
|
|
|
|
{
|
2020-07-14 17:03:36 +02:00
|
|
|
|
rotateTransform.Angle = rect.Rotation;
|
2017-06-25 23:05:48 +02:00
|
|
|
|
}
|
2020-07-14 17:03:36 +02:00
|
|
|
|
else if (rect.Rotation != 0d)
|
|
|
|
|
|
{
|
|
|
|
|
|
rotateTransform = new RotateTransform { Angle = rect.Rotation };
|
|
|
|
|
|
element.RenderTransform = rotateTransform;
|
|
|
|
|
|
element.RenderTransformOrigin = new Point(0.5, 0.5);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2017-06-25 23:05:48 +02:00
|
|
|
|
|
2020-07-14 17:03:36 +02:00
|
|
|
|
private static void ArrangeElement(FrameworkElement element, Point position)
|
|
|
|
|
|
{
|
|
|
|
|
|
var rect = new Rect(position, element.DesiredSize);
|
2012-08-09 23:41:47 +02:00
|
|
|
|
|
2018-04-30 23:13:50 +02:00
|
|
|
|
switch (element.HorizontalAlignment)
|
2012-08-09 23:41:47 +02:00
|
|
|
|
{
|
2018-04-30 23:13:50 +02:00
|
|
|
|
case HorizontalAlignment.Center:
|
2019-07-08 23:00:57 +02:00
|
|
|
|
rect.X -= rect.Width / 2d;
|
2018-04-30 23:13:50 +02:00
|
|
|
|
break;
|
2016-06-04 08:42:38 +02:00
|
|
|
|
|
2018-04-30 23:13:50 +02:00
|
|
|
|
case HorizontalAlignment.Right:
|
2019-07-08 23:00:57 +02:00
|
|
|
|
rect.X -= rect.Width;
|
2018-04-30 23:13:50 +02:00
|
|
|
|
break;
|
2012-04-25 22:02:53 +02:00
|
|
|
|
|
2018-04-30 23:13:50 +02:00
|
|
|
|
default:
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
2012-04-25 22:02:53 +02:00
|
|
|
|
|
2018-04-30 23:13:50 +02:00
|
|
|
|
switch (element.VerticalAlignment)
|
2012-04-25 22:02:53 +02:00
|
|
|
|
{
|
2018-04-30 23:13:50 +02:00
|
|
|
|
case VerticalAlignment.Center:
|
2019-07-08 23:00:57 +02:00
|
|
|
|
rect.Y -= rect.Height / 2d;
|
2018-04-30 23:13:50 +02:00
|
|
|
|
break;
|
2012-11-26 19:17:12 +01:00
|
|
|
|
|
2018-04-30 23:13:50 +02:00
|
|
|
|
case VerticalAlignment.Bottom:
|
2019-07-08 23:00:57 +02:00
|
|
|
|
rect.Y -= rect.Height;
|
2018-04-30 23:13:50 +02:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-07-15 16:40:33 +02:00
|
|
|
|
ArrangeElement(element, rect);
|
2019-07-08 23:00:57 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2020-07-14 17:03:36 +02:00
|
|
|
|
private static void ArrangeElement(FrameworkElement element, Size parentSize)
|
2019-07-08 23:00:57 +02:00
|
|
|
|
{
|
|
|
|
|
|
var rect = new Rect(new Point(), element.DesiredSize);
|
2017-06-25 23:05:48 +02:00
|
|
|
|
|
2018-04-30 23:13:50 +02:00
|
|
|
|
switch (element.HorizontalAlignment)
|
2017-06-25 23:05:48 +02:00
|
|
|
|
{
|
2018-04-30 23:13:50 +02:00
|
|
|
|
case HorizontalAlignment.Center:
|
2019-07-08 23:00:57 +02:00
|
|
|
|
rect.X = (parentSize.Width - rect.Width) / 2d;
|
2018-04-30 23:13:50 +02:00
|
|
|
|
break;
|
2017-06-25 23:05:48 +02:00
|
|
|
|
|
2018-04-30 23:13:50 +02:00
|
|
|
|
case HorizontalAlignment.Right:
|
2019-07-08 23:00:57 +02:00
|
|
|
|
rect.X = parentSize.Width - rect.Width;
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case HorizontalAlignment.Stretch:
|
|
|
|
|
|
rect.Width = parentSize.Width;
|
2018-04-30 23:13:50 +02:00
|
|
|
|
break;
|
2012-12-07 17:04:44 +01:00
|
|
|
|
|
2018-04-30 23:13:50 +02:00
|
|
|
|
default:
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
2013-05-25 08:53:50 +02:00
|
|
|
|
|
2018-04-30 23:13:50 +02:00
|
|
|
|
switch (element.VerticalAlignment)
|
2012-12-07 17:04:44 +01:00
|
|
|
|
{
|
2018-04-30 23:13:50 +02:00
|
|
|
|
case VerticalAlignment.Center:
|
2019-07-08 23:00:57 +02:00
|
|
|
|
rect.Y = (parentSize.Height - rect.Height) / 2d;
|
2018-04-30 23:13:50 +02:00
|
|
|
|
break;
|
2012-12-07 17:04:44 +01:00
|
|
|
|
|
2018-04-30 23:13:50 +02:00
|
|
|
|
case VerticalAlignment.Bottom:
|
2019-07-08 23:00:57 +02:00
|
|
|
|
rect.Y = parentSize.Height - rect.Height;
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case VerticalAlignment.Stretch:
|
|
|
|
|
|
rect.Height = parentSize.Height;
|
2018-04-30 23:13:50 +02:00
|
|
|
|
break;
|
2012-12-07 17:04:44 +01:00
|
|
|
|
|
2018-04-30 23:13:50 +02:00
|
|
|
|
default:
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
2012-12-07 17:04:44 +01:00
|
|
|
|
|
2020-07-15 16:40:33 +02:00
|
|
|
|
ArrangeElement(element, rect);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private static void ArrangeElement(FrameworkElement element, Rect rect)
|
|
|
|
|
|
{
|
2018-04-30 23:13:50 +02:00
|
|
|
|
if (element.UseLayoutRounding)
|
|
|
|
|
|
{
|
|
|
|
|
|
rect.X = Math.Round(rect.X);
|
|
|
|
|
|
rect.Y = Math.Round(rect.Y);
|
2020-07-14 17:03:36 +02:00
|
|
|
|
rect.Width = Math.Round(rect.Width);
|
|
|
|
|
|
rect.Height = Math.Round(rect.Height);
|
2014-06-11 23:03:13 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
element.Arrange(rect);
|
|
|
|
|
|
}
|
2021-01-13 00:08:55 +01:00
|
|
|
|
|
|
|
|
|
|
private static void ParentMapPropertyChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (obj is IMapElement mapElement)
|
|
|
|
|
|
{
|
|
|
|
|
|
mapElement.ParentMap = e.NewValue as MapBase;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2012-04-25 22:02:53 +02:00
|
|
|
|
}
|
|
|
|
|
|
}
|