mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2025-12-06 07:12:04 +01:00
Fixed MapPath rendering
This commit is contained in:
parent
1ac9ee6b82
commit
29ffdc4420
|
|
@ -26,6 +26,10 @@ namespace MapControl
|
|||
nameof(Locations), typeof(IEnumerable<Location>), typeof(MapPolygon),
|
||||
new PropertyMetadata(null, (o, e) => ((MapPolygon)o).DataCollectionPropertyChanged(e)));
|
||||
|
||||
public static readonly DependencyProperty FillRuleProperty = DependencyProperty.Register(
|
||||
nameof(FillRule), typeof(FillRule), typeof(MapPolygon),
|
||||
new PropertyMetadata(FillRule.EvenOdd, (o, e) => ((PathGeometry)((MapPolygon)o).Data).FillRule = (FillRule)e.NewValue));
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Locations that define the polygon points.
|
||||
/// </summary>
|
||||
|
|
@ -38,6 +42,12 @@ namespace MapControl
|
|||
set => SetValue(LocationsProperty, value);
|
||||
}
|
||||
|
||||
public FillRule FillRule
|
||||
{
|
||||
get => (FillRule)GetValue(FillRuleProperty);
|
||||
set => SetValue(FillRuleProperty, value);
|
||||
}
|
||||
|
||||
public MapPolygon()
|
||||
{
|
||||
Data = new PathGeometry();
|
||||
|
|
|
|||
|
|
@ -26,6 +26,10 @@ namespace MapControl
|
|||
nameof(Locations), typeof(IEnumerable<Location>), typeof(MapPolyline),
|
||||
new PropertyMetadata(null, (o, e) => ((MapPolyline)o).DataCollectionPropertyChanged(e)));
|
||||
|
||||
public static readonly DependencyProperty FillRuleProperty = DependencyProperty.Register(
|
||||
nameof(FillRule), typeof(FillRule), typeof(MapPolyline),
|
||||
new PropertyMetadata(FillRule.EvenOdd, (o, e) => ((PathGeometry)((MapPolyline)o).Data).FillRule = (FillRule)e.NewValue));
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Locations that define the polyline points.
|
||||
/// </summary>
|
||||
|
|
@ -38,6 +42,12 @@ namespace MapControl
|
|||
set => SetValue(LocationsProperty, value);
|
||||
}
|
||||
|
||||
public FillRule FillRule
|
||||
{
|
||||
get => (FillRule)GetValue(FillRuleProperty);
|
||||
set => SetValue(FillRuleProperty, value);
|
||||
}
|
||||
|
||||
public MapPolyline()
|
||||
{
|
||||
Data = new PathGeometry();
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ namespace MapControl
|
|||
///
|
||||
/// A PolygonCollection (with ObservableCollection of Location elements) may be used
|
||||
/// for the Polygons property if collection changes of the property itself and its
|
||||
/// elements are both supposed to trigger a UI update.
|
||||
/// elements are both supposed to trigger UI updates.
|
||||
/// </summary>
|
||||
public class MapMultiPolygon : MapPath
|
||||
{
|
||||
|
|
@ -22,6 +22,10 @@ namespace MapControl
|
|||
nameof(Polygons), typeof(IEnumerable<IEnumerable<Location>>), typeof(MapMultiPolygon),
|
||||
new PropertyMetadata(null, (o, e) => ((MapMultiPolygon)o).DataCollectionPropertyChanged(e)));
|
||||
|
||||
public static readonly DependencyProperty FillRuleProperty = DependencyProperty.Register(
|
||||
nameof(FillRule), typeof(FillRule), typeof(MapMultiPolygon),
|
||||
new PropertyMetadata(FillRule.EvenOdd, (o, e) => ((PathGeometry)((MapMultiPolygon)o).Data).FillRule = (FillRule)e.NewValue));
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Locations that define the multi-polygon points.
|
||||
/// </summary>
|
||||
|
|
@ -31,6 +35,12 @@ namespace MapControl
|
|||
set => SetValue(PolygonsProperty, value);
|
||||
}
|
||||
|
||||
public FillRule FillRule
|
||||
{
|
||||
get => (FillRule)GetValue(FillRuleProperty);
|
||||
set => SetValue(FillRuleProperty, value);
|
||||
}
|
||||
|
||||
public MapMultiPolygon()
|
||||
{
|
||||
Data = new PathGeometry();
|
||||
|
|
|
|||
|
|
@ -14,6 +14,11 @@ namespace MapControl
|
|||
{
|
||||
public partial class MapPath : Shape, IWeakEventListener
|
||||
{
|
||||
public MapPath()
|
||||
{
|
||||
Stretch = Stretch.None;
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty DataProperty = Path.DataProperty.AddOwner(
|
||||
typeof(MapPath), new PropertyMetadata(null, DataPropertyChanged));
|
||||
|
||||
|
|
@ -25,11 +30,6 @@ namespace MapControl
|
|||
|
||||
protected override Geometry DefiningGeometry => Data;
|
||||
|
||||
protected override Geometry GetLayoutClip(Size layoutSlotSize)
|
||||
{
|
||||
return ClipToBounds ? base.GetLayoutClip(layoutSlotSize) : null;
|
||||
}
|
||||
|
||||
private static void DataPropertyChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
// Check if Data is actually a new Geometry.
|
||||
|
|
@ -98,7 +98,7 @@ namespace MapControl
|
|||
{
|
||||
StartPoint = points.First(),
|
||||
IsClosed = closed,
|
||||
IsFilled = closed
|
||||
IsFilled = true
|
||||
};
|
||||
|
||||
figure.Segments.Add(new PolyLineSegment(points.Skip(1), true));
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ namespace MapControl
|
|||
{
|
||||
public MapPath()
|
||||
{
|
||||
Stretch = Stretch.None;
|
||||
MapPanel.InitMapElement(this);
|
||||
}
|
||||
|
||||
|
|
@ -81,7 +82,7 @@ namespace MapControl
|
|||
{
|
||||
StartPoint = points.First(),
|
||||
IsClosed = closed,
|
||||
IsFilled = closed
|
||||
IsFilled = true
|
||||
};
|
||||
|
||||
figure.Segments.Add(segment);
|
||||
|
|
@ -114,7 +115,7 @@ namespace MapControl
|
|||
{
|
||||
StartPoint = p1,
|
||||
IsClosed = false,
|
||||
IsFilled = false
|
||||
IsFilled = true
|
||||
};
|
||||
|
||||
segment = new PolyLineSegment();
|
||||
|
|
|
|||
Loading…
Reference in a new issue