-
-
Notifications
You must be signed in to change notification settings - Fork 7
/
DebugMapExample.cs
103 lines (93 loc) · 2.59 KB
/
DebugMapExample.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
namespace MapboxMauiQs;
public class DebugMapExample : ContentPage, IExamplePage, IQueryAttributable
{
MapboxView map;
IExampleInfo info;
bool mapReady;
DebugOptionItem[] debugOptionItems = new[]
{
new DebugOptionItem
{
DebugOption = DebugOption.Collision,
Title = "Debug collision",
},
new DebugOptionItem
{
DebugOption = DebugOption.DepthBuffer,
Title = "Show depth buffer",
},
new DebugOptionItem
{
DebugOption = DebugOption.Overdraw,
Title = "Debug overdraw",
},
new DebugOptionItem
{
DebugOption = DebugOption.ParseStatus,
Title = "Show tile coordinate",
},
new DebugOptionItem
{
DebugOption = DebugOption.RenderCache,
Title = "Render Cache",
},
new DebugOptionItem
{
DebugOption = DebugOption.StencilClip,
Title = "Show stencil buffer",
},
new DebugOptionItem
{
DebugOption = DebugOption.TileBorders,
Title = "Debug tile clipping",
},
new DebugOptionItem
{
DebugOption = DebugOption.Timestamps,
Title = "Show tile loaded time",
},
};
public DebugMapExample()
{
iOSPage.SetUseSafeArea(this, false);
Content = map = new MapboxView();
ToolbarItems.Add(new ToolbarItem
{
Text = "Edit",
Command = new Command(() => Shell.Current.GoToAsync(
typeof(DebugOptionsPage).FullName,
new Dictionary<string, object> {
{ "options", debugOptionItems }
}
)),
});
map.MapReady += Map_MapReady;
}
private void Map_MapReady(object sender, EventArgs e)
{
mapReady = true;
}
protected override void OnAppearing()
{
base.OnAppearing();
if (mapReady) {
var debugOptions = this.debugOptionItems
.Select(x => x.DebugOption)
.ToArray();
map.DebugOptions = debugOptions;
}
}
public void ApplyQueryAttributes(IDictionary<string, object> query)
{
info = query["example"] as IExampleInfo;
if (info != null)
{
Title = info.Title;
}
if (query.TryGetValue("options", out var value) &&
value is DebugOptionItem[] debugOptions)
{
this.debugOptionItems = debugOptions;
}
}
}