-
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathTerrainExample.cs
69 lines (59 loc) · 1.87 KB
/
TerrainExample.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
namespace MapboxMauiQs;
public class TerrainExample : ContentPage, IExamplePage, IQueryAttributable
{
MapboxView map;
IExampleInfo info;
public TerrainExample()
{
iOSPage.SetUseSafeArea(this, false);
Content = map = new MapboxView();
map.MapReady += Map_MapReady;
map.StyleLoaded += Map_StyleLoaded;
}
private void Map_StyleLoaded(object sender, EventArgs e)
{
var sourceId = @"mapbox-dem";
var rasterDemSource = new RasterDemSource(sourceId)
{
Url = @"mapbox://mapbox.mapbox-terrain-dem-v1",
TileSize = 514.0,
MaxZoom = 14.0,
};
map.Sources = new List<MapboxSource> {
rasterDemSource,
};
var terrain = new Terrain(sourceId)
{
Exaggeration = new PropertyValue<double>(1.5)
};
map.Terrain = terrain;
var skyLayer = new SkyLayer("sky-layer")
{
SkyType = new PropertyValue<SkyType>(SkyType.Atmosphere),
SkyAtmosphereSun = new PropertyValue<double[]>(new[] { 0.0, 0.0 }),
SkyAtmosphereSunIntensity = new PropertyValue<double>(15.0),
};
map.Layers = new List<MapboxLayer>
{
skyLayer,
};
}
private void Map_MapReady(object sender, EventArgs e)
{
var mapCenter = new MapPosition(32.6141, -114.34411);
var cameraOptions = new CameraOptions
{
Center = mapCenter,
Zoom = 13.1f,
Bearing = 80,
Pitch = 85,
};
map.CameraOptions = cameraOptions;
map.MapboxStyle = (MapboxStyle)@"mapbox://styles/mapbox-map-design/ckhqrf2tz0dt119ny6azh975y";
}
public void ApplyQueryAttributes(IDictionary<string, object> query)
{
info = query["example"] as IExampleInfo;
Title = info?.Title;
}
}