-
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathPolygonAnnotationManager.cs
59 lines (52 loc) · 2.07 KB
/
PolygonAnnotationManager.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
namespace MapboxMaui.Annotations;
using Com.Mapbox.Maps.Plugins.Annotations;
using System.Collections;
using PlatformPolygonAnnotationManager = Com.Mapbox.Maps.Plugins.Annotations.Generated.PolygonAnnotationManager;
partial class PolygonAnnotationManager
: AnnotationManager<PlatformPolygonAnnotationManager, PolygonAnnotation>
, IPolygonAnnotationManager
{
private readonly PlatformPolygonAnnotationManager nativeManager;
public PolygonAnnotationManager(
string id,
PlatformPolygonAnnotationManager nativeManager)
: base(id, nativeManager)
{
this.nativeManager = nativeManager;
}
public bool? FillAntialias
{
get => nativeManager.FillAntialias?.BooleanValue();
set => nativeManager.FillAntialias = value?.ToPlatform();
}
public double[] FillTranslate
{
get => nativeManager.FillTranslate.GetValue();
set => nativeManager.FillTranslate = value.ToPlatform();
}
public FillTranslateAnchor? FillTranslateAnchor
{
get => nativeManager.FillTranslateAnchor != null
? (FillTranslateAnchor)nativeManager.FillTranslateAnchor.GetValue()
: null;
set => nativeManager.FillTranslateAnchor = value != null
? Com.Mapbox.Maps.Extension.Style.Layers.Properties.Generated.FillTranslateAnchor.ValueOf(value.Value)
: null;
}
protected override IAnnotationOptions ToPlatformAnnotationOption(PolygonAnnotation annotation)
=> annotation.ToPlatformValue();
protected override IList GetNativeAnnotations(params string[] annotationIDs)
{
var itemsToDelete = new List<Com.Mapbox.Maps.Plugins.Annotations.Generated.PolygonAnnotation>();
foreach (var id in annotationIDs)
{
var item = nativeManager
.Annotations
.Cast<Com.Mapbox.Maps.Plugins.Annotations.Generated.PolygonAnnotation>()
.FirstOrDefault(x => x.Id == id);
if (item == null) continue;
itemsToDelete.Add(item);
}
return itemsToDelete;
}
}