2017-06-25 23:05:48 +02:00
|
|
|
|
// XAML Map Control - https://github.com/ClemensFischer/XAML-Map-Control
|
2019-03-27 18:39:59 +01:00
|
|
|
|
// © 2019 Clemens Fischer
|
2014-07-01 18:57:44 +02:00
|
|
|
|
// Licensed under the Microsoft Public License (Ms-PL)
|
|
|
|
|
|
|
|
|
|
|
|
using System.Windows;
|
2018-05-01 12:45:19 +02:00
|
|
|
|
using System.Windows.Documents;
|
2018-04-30 23:13:50 +02:00
|
|
|
|
using System.Windows.Media;
|
2014-07-01 18:57:44 +02:00
|
|
|
|
using System.Windows.Shapes;
|
|
|
|
|
|
|
|
|
|
|
|
namespace MapControl
|
|
|
|
|
|
{
|
|
|
|
|
|
public partial class MapOverlay
|
|
|
|
|
|
{
|
2018-05-01 12:45:19 +02:00
|
|
|
|
public static readonly DependencyProperty FontFamilyProperty = TextElement.FontFamilyProperty.AddOwner(
|
2018-05-01 13:53:24 +02:00
|
|
|
|
typeof(MapOverlay), new FrameworkPropertyMetadata { AffectsRender = true, Inherits = true });
|
2014-07-01 18:57:44 +02:00
|
|
|
|
|
2018-05-01 12:45:19 +02:00
|
|
|
|
public static readonly DependencyProperty FontSizeProperty = TextElement.FontSizeProperty.AddOwner(
|
2018-05-01 13:53:24 +02:00
|
|
|
|
typeof(MapOverlay), new FrameworkPropertyMetadata { AffectsRender = true, Inherits = true });
|
2018-04-30 23:13:50 +02:00
|
|
|
|
|
2018-05-01 12:45:19 +02:00
|
|
|
|
public static readonly DependencyProperty FontStyleProperty = TextElement.FontStyleProperty.AddOwner(
|
2018-05-01 13:53:24 +02:00
|
|
|
|
typeof(MapOverlay), new FrameworkPropertyMetadata { AffectsRender = true, Inherits = true });
|
2014-07-01 18:57:44 +02:00
|
|
|
|
|
2018-05-01 12:45:19 +02:00
|
|
|
|
public static readonly DependencyProperty FontStretchProperty = TextElement.FontStretchProperty.AddOwner(
|
2018-05-01 13:53:24 +02:00
|
|
|
|
typeof(MapOverlay), new FrameworkPropertyMetadata { AffectsRender = true, Inherits = true });
|
2014-07-01 18:57:44 +02:00
|
|
|
|
|
2018-05-01 12:45:19 +02:00
|
|
|
|
public static readonly DependencyProperty FontWeightProperty = TextElement.FontWeightProperty.AddOwner(
|
2018-05-01 13:53:24 +02:00
|
|
|
|
typeof(MapOverlay), new FrameworkPropertyMetadata { AffectsRender = true, Inherits = true });
|
2014-07-01 18:57:44 +02:00
|
|
|
|
|
2018-05-01 12:45:19 +02:00
|
|
|
|
public static readonly DependencyProperty ForegroundProperty = TextElement.ForegroundProperty.AddOwner(
|
2018-05-01 13:53:24 +02:00
|
|
|
|
typeof(MapOverlay), new FrameworkPropertyMetadata { AffectsRender = true, Inherits = true });
|
2014-07-01 18:57:44 +02:00
|
|
|
|
|
2018-05-01 12:45:19 +02:00
|
|
|
|
public static readonly DependencyProperty StrokeProperty = Shape.StrokeProperty.AddOwner(
|
2018-05-01 13:53:24 +02:00
|
|
|
|
typeof(MapOverlay), new FrameworkPropertyMetadata { AffectsRender = true });
|
2014-07-01 18:57:44 +02:00
|
|
|
|
|
2018-05-01 12:45:19 +02:00
|
|
|
|
public static readonly DependencyProperty StrokeThicknessProperty = Shape.StrokeThicknessProperty.AddOwner(
|
|
|
|
|
|
typeof(MapOverlay), new FrameworkPropertyMetadata { AffectsRender = true });
|
2014-07-01 18:57:44 +02:00
|
|
|
|
|
2018-05-01 12:45:19 +02:00
|
|
|
|
public static readonly DependencyProperty StrokeDashArrayProperty = Shape.StrokeDashArrayProperty.AddOwner(
|
|
|
|
|
|
typeof(MapOverlay), new FrameworkPropertyMetadata { AffectsRender = true });
|
2014-07-01 18:57:44 +02:00
|
|
|
|
|
2018-05-01 12:45:19 +02:00
|
|
|
|
public static readonly DependencyProperty StrokeDashOffsetProperty = Shape.StrokeDashOffsetProperty.AddOwner(
|
|
|
|
|
|
typeof(MapOverlay), new FrameworkPropertyMetadata { AffectsRender = true });
|
|
|
|
|
|
|
|
|
|
|
|
public static readonly DependencyProperty StrokeDashCapProperty = Shape.StrokeDashCapProperty.AddOwner(
|
|
|
|
|
|
typeof(MapOverlay), new FrameworkPropertyMetadata { AffectsRender = true });
|
|
|
|
|
|
|
|
|
|
|
|
public static readonly DependencyProperty StrokeStartLineCapProperty = Shape.StrokeStartLineCapProperty.AddOwner(
|
|
|
|
|
|
typeof(MapOverlay), new FrameworkPropertyMetadata { AffectsRender = true });
|
|
|
|
|
|
|
|
|
|
|
|
public static readonly DependencyProperty StrokeEndLineCapProperty = Shape.StrokeEndLineCapProperty.AddOwner(
|
|
|
|
|
|
typeof(MapOverlay), new FrameworkPropertyMetadata { AffectsRender = true });
|
|
|
|
|
|
|
|
|
|
|
|
public static readonly DependencyProperty StrokeLineJoinProperty = Shape.StrokeLineJoinProperty.AddOwner(
|
|
|
|
|
|
typeof(MapOverlay), new FrameworkPropertyMetadata { AffectsRender = true });
|
|
|
|
|
|
|
|
|
|
|
|
public static readonly DependencyProperty StrokeMiterLimitProperty = Shape.StrokeMiterLimitProperty.AddOwner(
|
|
|
|
|
|
typeof(MapOverlay), new FrameworkPropertyMetadata { AffectsRender = true });
|
2014-07-01 18:57:44 +02:00
|
|
|
|
|
2018-05-01 12:59:47 +02:00
|
|
|
|
public MapOverlay()
|
|
|
|
|
|
{
|
2018-05-01 13:53:24 +02:00
|
|
|
|
// Set Stroke Binding in a Loaded handler to allow Stroke value from a Style Setter.
|
|
|
|
|
|
// SetParentMap is called too early.
|
|
|
|
|
|
|
2018-05-01 12:59:47 +02:00
|
|
|
|
Loaded += (s, e) =>
|
|
|
|
|
|
{
|
|
|
|
|
|
if (Stroke == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
SetBinding(StrokeProperty, GetBinding(ForegroundProperty, nameof(Foreground)));
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2018-04-30 23:13:50 +02:00
|
|
|
|
public Pen CreatePen()
|
|
|
|
|
|
{
|
|
|
|
|
|
return new Pen
|
|
|
|
|
|
{
|
|
|
|
|
|
Brush = Stroke,
|
|
|
|
|
|
Thickness = StrokeThickness,
|
|
|
|
|
|
LineJoin = StrokeLineJoin,
|
|
|
|
|
|
MiterLimit = StrokeMiterLimit,
|
|
|
|
|
|
StartLineCap = StrokeStartLineCap,
|
|
|
|
|
|
EndLineCap = StrokeEndLineCap,
|
|
|
|
|
|
DashCap = StrokeDashCap,
|
|
|
|
|
|
DashStyle = new DashStyle(StrokeDashArray, StrokeDashOffset)
|
|
|
|
|
|
};
|
|
|
|
|
|
}
|
2014-07-01 18:57:44 +02:00
|
|
|
|
}
|
|
|
|
|
|
}
|