2017-06-25 23:05:48 +02:00
|
|
|
|
// XAML Map Control - https://github.com/ClemensFischer/XAML-Map-Control
|
2024-02-03 21:01:53 +01:00
|
|
|
|
// Copyright © 2024 Clemens Fischer
|
2014-07-01 18:57:44 +02:00
|
|
|
|
// Licensed under the Microsoft Public License (Ms-PL)
|
|
|
|
|
|
|
2021-01-17 21:39:42 +01:00
|
|
|
|
using System;
|
2014-07-01 18:57:44 +02:00
|
|
|
|
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
|
|
|
|
|
|
{
|
2024-05-23 18:08:14 +02:00
|
|
|
|
public static readonly DependencyProperty FontFamilyProperty =
|
|
|
|
|
|
DependencyPropertyHelper.AddOwner<MapOverlay>(TextElement.FontFamilyProperty,
|
|
|
|
|
|
FrameworkPropertyMetadataOptions.AffectsRender | FrameworkPropertyMetadataOptions.Inherits);
|
2014-07-01 18:57:44 +02:00
|
|
|
|
|
2024-05-23 18:08:14 +02:00
|
|
|
|
public static readonly DependencyProperty FontSizeProperty =
|
|
|
|
|
|
DependencyPropertyHelper.AddOwner<MapOverlay>(TextElement.FontSizeProperty,
|
|
|
|
|
|
FrameworkPropertyMetadataOptions.AffectsRender | FrameworkPropertyMetadataOptions.Inherits);
|
2018-04-30 23:13:50 +02:00
|
|
|
|
|
2024-05-23 18:08:14 +02:00
|
|
|
|
public static readonly DependencyProperty FontStyleProperty =
|
|
|
|
|
|
DependencyPropertyHelper.AddOwner<MapOverlay>(TextElement.FontStyleProperty,
|
|
|
|
|
|
FrameworkPropertyMetadataOptions.AffectsRender | FrameworkPropertyMetadataOptions.Inherits);
|
2014-07-01 18:57:44 +02:00
|
|
|
|
|
2024-05-23 18:08:14 +02:00
|
|
|
|
public static readonly DependencyProperty FontStretchProperty =
|
|
|
|
|
|
DependencyPropertyHelper.AddOwner<MapOverlay>(TextElement.FontStretchProperty,
|
|
|
|
|
|
FrameworkPropertyMetadataOptions.AffectsRender | FrameworkPropertyMetadataOptions.Inherits);
|
2014-07-01 18:57:44 +02:00
|
|
|
|
|
2024-05-23 18:08:14 +02:00
|
|
|
|
public static readonly DependencyProperty FontWeightProperty =
|
|
|
|
|
|
DependencyPropertyHelper.AddOwner<MapOverlay>(TextElement.FontWeightProperty,
|
|
|
|
|
|
FrameworkPropertyMetadataOptions.AffectsRender | FrameworkPropertyMetadataOptions.Inherits);
|
2014-07-01 18:57:44 +02:00
|
|
|
|
|
2024-05-23 18:08:14 +02:00
|
|
|
|
public static readonly DependencyProperty ForegroundProperty =
|
|
|
|
|
|
DependencyPropertyHelper.AddOwner<MapOverlay>(TextElement.ForegroundProperty,
|
|
|
|
|
|
FrameworkPropertyMetadataOptions.AffectsRender | FrameworkPropertyMetadataOptions.Inherits);
|
2014-07-01 18:57:44 +02:00
|
|
|
|
|
2024-05-23 18:08:14 +02:00
|
|
|
|
public static readonly DependencyProperty StrokeProperty =
|
|
|
|
|
|
DependencyPropertyHelper.AddOwner<MapOverlay>(Shape.StrokeProperty,
|
|
|
|
|
|
FrameworkPropertyMetadataOptions.AffectsRender);
|
2014-07-01 18:57:44 +02:00
|
|
|
|
|
2024-05-23 18:08:14 +02:00
|
|
|
|
public static readonly DependencyProperty StrokeThicknessProperty =
|
|
|
|
|
|
DependencyPropertyHelper.AddOwner<MapOverlay>(Shape.StrokeThicknessProperty,
|
|
|
|
|
|
FrameworkPropertyMetadataOptions.AffectsRender);
|
2014-07-01 18:57:44 +02:00
|
|
|
|
|
2024-05-23 18:08:14 +02:00
|
|
|
|
public static readonly DependencyProperty StrokeDashArrayProperty =
|
|
|
|
|
|
DependencyPropertyHelper.AddOwner<MapOverlay>(Shape.StrokeDashArrayProperty,
|
|
|
|
|
|
FrameworkPropertyMetadataOptions.AffectsRender);
|
2014-07-01 18:57:44 +02:00
|
|
|
|
|
2024-05-23 18:08:14 +02:00
|
|
|
|
public static readonly DependencyProperty StrokeDashOffsetProperty =
|
|
|
|
|
|
DependencyPropertyHelper.AddOwner<MapOverlay>(Shape.StrokeDashOffsetProperty,
|
|
|
|
|
|
FrameworkPropertyMetadataOptions.AffectsRender);
|
2018-05-01 12:45:19 +02:00
|
|
|
|
|
2024-05-23 18:08:14 +02:00
|
|
|
|
public static readonly DependencyProperty StrokeDashCapProperty =
|
|
|
|
|
|
DependencyPropertyHelper.AddOwner<MapOverlay>(Shape.StrokeDashCapProperty,
|
|
|
|
|
|
FrameworkPropertyMetadataOptions.AffectsRender);
|
2018-05-01 12:45:19 +02:00
|
|
|
|
|
2024-05-23 18:08:14 +02:00
|
|
|
|
public static readonly DependencyProperty StrokeStartLineCapProperty =
|
|
|
|
|
|
DependencyPropertyHelper.AddOwner<MapOverlay>(Shape.StrokeStartLineCapProperty,
|
|
|
|
|
|
FrameworkPropertyMetadataOptions.AffectsRender);
|
2018-05-01 12:45:19 +02:00
|
|
|
|
|
2024-05-23 18:08:14 +02:00
|
|
|
|
public static readonly DependencyProperty StrokeEndLineCapProperty =
|
|
|
|
|
|
DependencyPropertyHelper.AddOwner<MapOverlay>(Shape.StrokeEndLineCapProperty,
|
|
|
|
|
|
FrameworkPropertyMetadataOptions.AffectsRender);
|
2018-05-01 12:45:19 +02:00
|
|
|
|
|
2024-05-23 18:08:14 +02:00
|
|
|
|
public static readonly DependencyProperty StrokeLineJoinProperty =
|
|
|
|
|
|
DependencyPropertyHelper.AddOwner<MapOverlay>(Shape.StrokeLineJoinProperty,
|
|
|
|
|
|
FrameworkPropertyMetadataOptions.AffectsRender);
|
2018-05-01 12:45:19 +02:00
|
|
|
|
|
2024-05-23 18:08:14 +02:00
|
|
|
|
public static readonly DependencyProperty StrokeMiterLimitProperty =
|
|
|
|
|
|
DependencyPropertyHelper.AddOwner<MapOverlay>(Shape.StrokeMiterLimitProperty,
|
|
|
|
|
|
FrameworkPropertyMetadataOptions.AffectsRender);
|
2014-07-01 18:57:44 +02:00
|
|
|
|
|
2021-01-17 21:39:42 +01:00
|
|
|
|
protected override void OnInitialized(EventArgs e)
|
2018-05-01 12:59:47 +02:00
|
|
|
|
{
|
2021-01-17 21:39:42 +01:00
|
|
|
|
base.OnInitialized(e);
|
2021-12-01 20:15:48 +01:00
|
|
|
|
|
2022-11-30 22:18:45 +01:00
|
|
|
|
// If this.Stroke is not explicitly set, bind it to this.Foreground.
|
|
|
|
|
|
//
|
2021-12-01 20:15:48 +01:00
|
|
|
|
this.SetBindingOnUnsetProperty(StrokeProperty, this, ForegroundProperty, nameof(Foreground));
|
2018-05-01 12:59:47 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
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
|
|
|
|
}
|
|
|
|
|
|
}
|