2014-07-01 18:57:44 +02:00
|
|
|
|
// XAML Map Control - http://xamlmapcontrol.codeplex.com/
|
2016-02-23 20:07:30 +01:00
|
|
|
|
// © 2016 Clemens Fischer
|
2014-07-01 18:57:44 +02:00
|
|
|
|
// Licensed under the Microsoft Public License (Ms-PL)
|
|
|
|
|
|
|
2016-08-08 20:36:02 +02:00
|
|
|
|
#if NETFX_CORE
|
2014-07-01 18:57:44 +02:00
|
|
|
|
using Windows.UI.Text;
|
|
|
|
|
|
using Windows.UI.Xaml;
|
|
|
|
|
|
using Windows.UI.Xaml.Data;
|
|
|
|
|
|
using Windows.UI.Xaml.Media;
|
2016-08-08 20:36:02 +02:00
|
|
|
|
#else
|
|
|
|
|
|
using System.Windows;
|
|
|
|
|
|
using System.Windows.Data;
|
|
|
|
|
|
using System.Windows.Media;
|
|
|
|
|
|
#endif
|
2015-08-09 20:04:44 +02:00
|
|
|
|
|
|
|
|
|
|
namespace MapControl
|
|
|
|
|
|
{
|
2016-08-08 20:36:02 +02:00
|
|
|
|
#if NETFX_CORE
|
2015-08-09 20:04:44 +02:00
|
|
|
|
class FontStyles { public const FontStyle Normal = FontStyle.Normal; }
|
|
|
|
|
|
class FontStretches { public const FontStretch Normal = FontStretch.Normal; }
|
2014-07-01 18:57:44 +02:00
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
public partial class MapOverlay
|
|
|
|
|
|
{
|
|
|
|
|
|
public static readonly DependencyProperty FontSizeProperty = DependencyProperty.Register(
|
|
|
|
|
|
"FontSize", typeof(double), typeof(MapOverlay), new PropertyMetadata(10d));
|
|
|
|
|
|
|
|
|
|
|
|
public static readonly DependencyProperty FontFamilyProperty = DependencyProperty.Register(
|
2015-08-09 20:04:44 +02:00
|
|
|
|
"FontFamily", typeof(FontFamily), typeof(MapOverlay), new PropertyMetadata(null));
|
2014-07-01 18:57:44 +02:00
|
|
|
|
|
|
|
|
|
|
public static readonly DependencyProperty FontStyleProperty = DependencyProperty.Register(
|
2015-08-09 20:04:44 +02:00
|
|
|
|
"FontStyle", typeof(FontStyle), typeof(MapOverlay), new PropertyMetadata(FontStyles.Normal));
|
2014-07-01 18:57:44 +02:00
|
|
|
|
|
|
|
|
|
|
public static readonly DependencyProperty FontStretchProperty = DependencyProperty.Register(
|
2015-08-09 20:04:44 +02:00
|
|
|
|
"FontStretch", typeof(FontStretch), typeof(MapOverlay), new PropertyMetadata(FontStretches.Normal));
|
2014-07-01 18:57:44 +02:00
|
|
|
|
|
|
|
|
|
|
public static readonly DependencyProperty FontWeightProperty = DependencyProperty.Register(
|
2015-08-09 20:04:44 +02:00
|
|
|
|
"FontWeight", typeof(FontWeight), typeof(MapOverlay), new PropertyMetadata(FontWeights.Normal));
|
2014-07-01 18:57:44 +02:00
|
|
|
|
|
|
|
|
|
|
public static readonly DependencyProperty ForegroundProperty = DependencyProperty.Register(
|
|
|
|
|
|
"Foreground", typeof(Brush), typeof(MapOverlay), new PropertyMetadata(null));
|
|
|
|
|
|
|
|
|
|
|
|
public static readonly DependencyProperty StrokeProperty = DependencyProperty.Register(
|
|
|
|
|
|
"Stroke", typeof(Brush), typeof(MapOverlay), new PropertyMetadata(null));
|
|
|
|
|
|
|
|
|
|
|
|
public static readonly DependencyProperty StrokeThicknessProperty = DependencyProperty.Register(
|
|
|
|
|
|
"StrokeThickness", typeof(double), typeof(MapOverlay), new PropertyMetadata(1d));
|
|
|
|
|
|
|
|
|
|
|
|
public static readonly DependencyProperty StrokeDashArrayProperty = DependencyProperty.Register(
|
|
|
|
|
|
"StrokeDashArray", typeof(DoubleCollection), typeof(MapOverlay), new PropertyMetadata(null));
|
|
|
|
|
|
|
|
|
|
|
|
public static readonly DependencyProperty StrokeDashOffsetProperty = DependencyProperty.Register(
|
|
|
|
|
|
"StrokeDashOffset", typeof(double), typeof(MapOverlay), new PropertyMetadata(0d));
|
|
|
|
|
|
|
|
|
|
|
|
public static readonly DependencyProperty StrokeDashCapProperty = DependencyProperty.Register(
|
2015-08-09 20:04:44 +02:00
|
|
|
|
"StrokeDashCap", typeof(PenLineCap), typeof(MapOverlay), new PropertyMetadata(PenLineCap.Flat));
|
2014-07-01 18:57:44 +02:00
|
|
|
|
|
|
|
|
|
|
public static readonly DependencyProperty StrokeStartLineCapProperty = DependencyProperty.Register(
|
2015-08-09 20:04:44 +02:00
|
|
|
|
"StrokeStartLineCap", typeof(PenLineCap), typeof(MapOverlay), new PropertyMetadata(PenLineCap.Flat));
|
2014-07-01 18:57:44 +02:00
|
|
|
|
|
|
|
|
|
|
public static readonly DependencyProperty StrokeEndLineCapProperty = DependencyProperty.Register(
|
2015-08-09 20:04:44 +02:00
|
|
|
|
"StrokeEndLineCap", typeof(PenLineCap), typeof(MapOverlay), new PropertyMetadata(PenLineCap.Flat));
|
2014-07-01 18:57:44 +02:00
|
|
|
|
|
|
|
|
|
|
public static readonly DependencyProperty StrokeLineJoinProperty = DependencyProperty.Register(
|
2015-08-09 20:04:44 +02:00
|
|
|
|
"StrokeLineJoin", typeof(PenLineJoin), typeof(MapOverlay), new PropertyMetadata(PenLineJoin.Miter));
|
2014-07-01 18:57:44 +02:00
|
|
|
|
|
|
|
|
|
|
public static readonly DependencyProperty StrokeMiterLimitProperty = DependencyProperty.Register(
|
|
|
|
|
|
"StrokeMiterLimit", typeof(double), typeof(MapOverlay), new PropertyMetadata(1d));
|
|
|
|
|
|
|
2014-07-22 20:02:30 +02:00
|
|
|
|
protected override void SetParentMapOverride(MapBase parentMap)
|
2014-07-01 18:57:44 +02:00
|
|
|
|
{
|
2016-08-08 20:36:02 +02:00
|
|
|
|
if (GetBindingExpression(ForegroundProperty) != null)
|
2014-07-01 18:57:44 +02:00
|
|
|
|
{
|
2014-07-22 20:02:30 +02:00
|
|
|
|
ClearValue(ForegroundProperty);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2016-08-08 20:36:02 +02:00
|
|
|
|
if (GetBindingExpression(StrokeProperty) != null)
|
2014-07-22 20:02:30 +02:00
|
|
|
|
{
|
|
|
|
|
|
ClearValue(StrokeProperty);
|
|
|
|
|
|
}
|
2014-07-01 18:57:44 +02:00
|
|
|
|
|
2014-07-22 20:02:30 +02:00
|
|
|
|
if (parentMap != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (Foreground == null)
|
2014-07-01 18:57:44 +02:00
|
|
|
|
{
|
2016-08-08 20:36:02 +02:00
|
|
|
|
SetBinding(ForegroundProperty, new Binding
|
2014-07-22 20:02:30 +02:00
|
|
|
|
{
|
|
|
|
|
|
Source = parentMap,
|
|
|
|
|
|
Path = new PropertyPath("Foreground")
|
2016-08-08 20:36:02 +02:00
|
|
|
|
});
|
2014-07-01 18:57:44 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2014-07-22 20:02:30 +02:00
|
|
|
|
if (Stroke == null)
|
2014-07-01 18:57:44 +02:00
|
|
|
|
{
|
2016-08-08 20:36:02 +02:00
|
|
|
|
SetBinding(StrokeProperty, new Binding
|
2014-07-01 18:57:44 +02:00
|
|
|
|
{
|
2014-07-22 20:02:30 +02:00
|
|
|
|
Source = parentMap,
|
|
|
|
|
|
Path = new PropertyPath("Foreground")
|
2016-08-08 20:36:02 +02:00
|
|
|
|
});
|
2014-07-01 18:57:44 +02:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2014-07-22 20:02:30 +02:00
|
|
|
|
|
|
|
|
|
|
base.SetParentMapOverride(parentMap);
|
2014-07-01 18:57:44 +02:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|