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;
|
2024-05-24 18:24:44 +02:00
|
|
|
|
using System.Windows.Data;
|
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 =
|
2024-05-24 15:14:05 +02:00
|
|
|
|
DependencyPropertyHelper.AddOwner<MapOverlay, FontFamily>(TextElement.FontFamilyProperty);
|
2014-07-01 18:57:44 +02:00
|
|
|
|
|
2024-05-23 18:08:14 +02:00
|
|
|
|
public static readonly DependencyProperty FontSizeProperty =
|
2024-05-24 15:14:05 +02:00
|
|
|
|
DependencyPropertyHelper.AddOwner<MapOverlay, double>(TextElement.FontSizeProperty);
|
2018-04-30 23:13:50 +02:00
|
|
|
|
|
2024-05-23 18:08:14 +02:00
|
|
|
|
public static readonly DependencyProperty FontStyleProperty =
|
2024-05-24 15:14:05 +02:00
|
|
|
|
DependencyPropertyHelper.AddOwner<MapOverlay, FontStyle>(TextElement.FontStyleProperty);
|
2014-07-01 18:57:44 +02:00
|
|
|
|
|
2024-05-23 18:08:14 +02:00
|
|
|
|
public static readonly DependencyProperty FontStretchProperty =
|
2024-05-24 15:14:05 +02:00
|
|
|
|
DependencyPropertyHelper.AddOwner<MapOverlay, FontStretch>(TextElement.FontStretchProperty);
|
2014-07-01 18:57:44 +02:00
|
|
|
|
|
2024-05-23 18:08:14 +02:00
|
|
|
|
public static readonly DependencyProperty FontWeightProperty =
|
2024-05-24 15:14:05 +02:00
|
|
|
|
DependencyPropertyHelper.AddOwner<MapOverlay, FontWeight>(TextElement.FontWeightProperty);
|
2014-07-01 18:57:44 +02:00
|
|
|
|
|
2024-05-23 18:08:14 +02:00
|
|
|
|
public static readonly DependencyProperty ForegroundProperty =
|
2024-05-24 15:14:05 +02:00
|
|
|
|
DependencyPropertyHelper.AddOwner<MapOverlay, Brush>(TextElement.ForegroundProperty);
|
2014-07-01 18:57:44 +02:00
|
|
|
|
|
2024-05-23 18:08:14 +02:00
|
|
|
|
public static readonly DependencyProperty StrokeProperty =
|
2024-05-24 15:14:05 +02:00
|
|
|
|
DependencyPropertyHelper.AddOwner<MapOverlay, Brush>(Shape.StrokeProperty);
|
2014-07-01 18:57:44 +02:00
|
|
|
|
|
2024-05-23 18:08:14 +02:00
|
|
|
|
public static readonly DependencyProperty StrokeThicknessProperty =
|
2024-05-24 15:14:05 +02:00
|
|
|
|
DependencyPropertyHelper.AddOwner<MapOverlay, double>(Shape.StrokeThicknessProperty);
|
2014-07-01 18:57:44 +02:00
|
|
|
|
|
2024-05-23 18:08:14 +02:00
|
|
|
|
public static readonly DependencyProperty StrokeDashArrayProperty =
|
2024-05-24 15:14:05 +02:00
|
|
|
|
DependencyPropertyHelper.AddOwner<MapOverlay, DoubleCollection>(Shape.StrokeDashArrayProperty);
|
2014-07-01 18:57:44 +02:00
|
|
|
|
|
2024-05-23 18:08:14 +02:00
|
|
|
|
public static readonly DependencyProperty StrokeDashOffsetProperty =
|
2024-05-24 15:14:05 +02:00
|
|
|
|
DependencyPropertyHelper.AddOwner<MapOverlay, double>(Shape.StrokeDashOffsetProperty);
|
2018-05-01 12:45:19 +02:00
|
|
|
|
|
2024-05-24 18:24:44 +02:00
|
|
|
|
public static readonly DependencyProperty StrokeLineCapProperty =
|
2024-05-24 15:14:05 +02:00
|
|
|
|
DependencyPropertyHelper.AddOwner<MapOverlay, PenLineCap>(Shape.StrokeDashCapProperty);
|
2018-05-01 12:45:19 +02:00
|
|
|
|
|
2024-05-23 18:08:14 +02:00
|
|
|
|
public static readonly DependencyProperty StrokeLineJoinProperty =
|
2024-05-24 15:14:05 +02:00
|
|
|
|
DependencyPropertyHelper.AddOwner<MapOverlay, PenLineJoin>(Shape.StrokeLineJoinProperty);
|
2018-05-01 12:45:19 +02:00
|
|
|
|
|
2024-05-23 18:08:14 +02:00
|
|
|
|
public static readonly DependencyProperty StrokeMiterLimitProperty =
|
2024-05-24 15:14:05 +02:00
|
|
|
|
DependencyPropertyHelper.AddOwner<MapOverlay, double>(Shape.StrokeMiterLimitProperty);
|
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
|
|
|
|
|
2024-05-24 18:24:44 +02:00
|
|
|
|
if (Stroke == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
SetBinding(StrokeProperty, this.CreateBinding(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,
|
2024-05-24 18:24:44 +02:00
|
|
|
|
StartLineCap = StrokeLineCap,
|
|
|
|
|
|
EndLineCap = StrokeLineCap,
|
|
|
|
|
|
DashCap = StrokeLineCap,
|
2018-04-30 23:13:50 +02:00
|
|
|
|
DashStyle = new DashStyle(StrokeDashArray, StrokeDashOffset)
|
|
|
|
|
|
};
|
|
|
|
|
|
}
|
2014-07-01 18:57:44 +02:00
|
|
|
|
}
|
|
|
|
|
|
}
|