Removed common MapOverlay part

This commit is contained in:
ClemensFischer 2024-05-26 14:15:02 +02:00
parent acdfc1861f
commit bbd4f6d6aa
7 changed files with 261 additions and 140 deletions

View file

@ -5,18 +5,16 @@
using Windows.UI.Text;
#if UWP
using Windows.UI.Xaml;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Media;
#else
using Microsoft.UI.Text;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Data;
using Microsoft.UI.Xaml.Media;
#endif
namespace MapControl
{
public partial class MapOverlay
public class MapOverlay : MapPanel
{
public static readonly DependencyProperty FontFamilyProperty =
DependencyPropertyHelper.Register<MapOverlay, FontFamily>(nameof(FontFamily));
@ -57,6 +55,84 @@ namespace MapControl
public static readonly DependencyProperty StrokeMiterLimitProperty =
DependencyPropertyHelper.Register<MapOverlay, double>(nameof(StrokeMiterLimit), 1d);
public FontFamily FontFamily
{
get => (FontFamily)GetValue(FontFamilyProperty);
set => SetValue(FontFamilyProperty, value);
}
public double FontSize
{
get => (double)GetValue(FontSizeProperty);
set => SetValue(FontSizeProperty, value);
}
public FontStyle FontStyle
{
get => (FontStyle)GetValue(FontStyleProperty);
set => SetValue(FontStyleProperty, value);
}
public FontStretch FontStretch
{
get => (FontStretch)GetValue(FontStretchProperty);
set => SetValue(FontStretchProperty, value);
}
public FontWeight FontWeight
{
get => (FontWeight)GetValue(FontWeightProperty);
set => SetValue(FontWeightProperty, value);
}
public Brush Foreground
{
get => (Brush)GetValue(ForegroundProperty);
set => SetValue(ForegroundProperty, value);
}
public Brush Stroke
{
get => (Brush)GetValue(StrokeProperty);
set => SetValue(StrokeProperty, value);
}
public double StrokeThickness
{
get => (double)GetValue(StrokeThicknessProperty);
set => SetValue(StrokeThicknessProperty, value);
}
public DoubleCollection StrokeDashArray
{
get => (DoubleCollection)GetValue(StrokeDashArrayProperty);
set => SetValue(StrokeDashArrayProperty, value);
}
public double StrokeDashOffset
{
get => (double)GetValue(StrokeDashOffsetProperty);
set => SetValue(StrokeDashOffsetProperty, value);
}
public PenLineCap StrokeLineCap
{
get => (PenLineCap)GetValue(StrokeLineCapProperty);
set => SetValue(StrokeLineCapProperty, value);
}
public PenLineJoin StrokeLineJoin
{
get => (PenLineJoin)GetValue(StrokeLineJoinProperty);
set => SetValue(StrokeLineJoinProperty, value);
}
public double StrokeMiterLimit
{
get => (double)GetValue(StrokeMiterLimitProperty);
set => SetValue(StrokeMiterLimitProperty, value);
}
protected override void SetParentMap(MapBase map)
{
if (map != null)

View file

@ -80,13 +80,6 @@ namespace MapControl
if (closed)
{
var segment = new PolyLineSegment();
foreach (var point in points.Skip(1))
{
segment.Points.Add(point);
}
var figure = new PathFigure
{
StartPoint = points.First(),
@ -94,7 +87,14 @@ namespace MapControl
IsFilled = true
};
figure.Segments.Add(segment);
var polyline = new PolyLineSegment();
foreach (var point in points.Skip(1))
{
polyline.Points.Add(point);
}
figure.Segments.Add(polyline);
pathFigures.Add(figure);
}
else
@ -108,7 +108,7 @@ namespace MapControl
var viewport = new Rect(0, 0, ParentMap.RenderSize.Width, ParentMap.RenderSize.Height);
PathFigure figure = null;
PolyLineSegment segment = null;
PolyLineSegment polyline = null;
for (int i = 1; i < pointList.Count; i++)
{
@ -127,12 +127,12 @@ namespace MapControl
IsFilled = true
};
segment = new PolyLineSegment();
figure.Segments.Add(segment);
polyline = new PolyLineSegment();
figure.Segments.Add(polyline);
pathFigures.Add(figure);
}
segment.Points.Add(p2);
polyline.Points.Add(p2);
}
if (!inside || p2 != pointList[i])