@@ -2,12 +2,12 @@ namespace MapboxMauiQs;
2
2
3
3
public class AnimatedMarkerExample : ContentPage , IExamplePage , IQueryAttributable
4
4
{
5
- static class Constants
5
+ static class Constants
6
6
{
7
7
public const string markerIconId = "marker_icon" ;
8
8
public const string sourceId = "source-id" ;
9
9
public const double animationDuration = 2 ;
10
- }
10
+ }
11
11
12
12
MapboxView map ;
13
13
IExampleInfo info ;
@@ -22,30 +22,30 @@ public AnimatedMarkerExample()
22
22
map . MapReady += Map_MapReady ;
23
23
map . MapLoaded += Map_MapLoaded ;
24
24
map . Command = new Command < MapTappedPosition > ( HandleMapTapped ) ;
25
- }
26
-
25
+ }
26
+
27
27
public void ApplyQueryAttributes ( IDictionary < string , object > query )
28
28
{
29
29
info = query [ "example" ] as IExampleInfo ;
30
30
31
31
Title = info ? . Title ;
32
- }
33
-
34
- private void HandleMapTapped ( MapTappedPosition point )
35
- {
36
- // Create a GeoJSON data source.
37
- var feature = new Feature (
38
- point . Point
39
- ) ;
40
- var source = new GeoJSONSource ( Constants . sourceId )
41
- {
42
- Data = new RawGeoJSONObject (
43
- JsonSerializer . Serialize ( feature )
44
- )
45
- } ;
46
-
47
- map . Sources = new [ ] { source } ;
48
- }
32
+ }
33
+
34
+ private void HandleMapTapped ( MapTappedPosition point )
35
+ {
36
+ // Create a GeoJSON data source.
37
+ var feature = new Feature (
38
+ new GeoJSON . Text . Geometry . Point ( point . MapPosition )
39
+ ) ;
40
+ var source = new GeoJSONSource ( Constants . sourceId )
41
+ {
42
+ Data = new RawGeoJSONObject (
43
+ JsonSerializer . Serialize ( feature )
44
+ )
45
+ } ;
46
+
47
+ map . Sources = new [ ] { source } ;
48
+ }
49
49
50
50
private void Map_MapReady ( object sender , EventArgs e )
51
51
{
@@ -63,27 +63,27 @@ private void Map_MapLoaded(object sender, EventArgs e)
63
63
{
64
64
var image = new ResolvedImage ( Constants . markerIconId , "red_marker" ) ;
65
65
map . Images = new [ ] { image } ;
66
-
67
- // Create a GeoJSON data source.
68
- var feature = new Feature (
69
- new GeoJSON . Text . Geometry . Point ( currentPosition )
70
- ) ;
71
- var source = new GeoJSONSource ( Constants . sourceId )
72
- {
73
- Data = new RawGeoJSONObject (
74
- JsonSerializer . Serialize ( feature )
75
- )
76
- } ;
77
-
78
- map . Sources = new [ ] { source } ;
79
-
80
- // Create a symbol layer
81
- var symbolLayer = new SymbolLayer ( id : "layer-id" ) ;
82
- symbolLayer . Source = Constants . sourceId ;
83
- symbolLayer . IconImage = image ;
84
- symbolLayer . IconIgnorePlacement = true ;
85
- symbolLayer . IconAllowOverlap = true ;
86
-
66
+
67
+ // Create a GeoJSON data source.
68
+ var feature = new Feature (
69
+ new GeoJSON . Text . Geometry . Point ( currentPosition )
70
+ ) ;
71
+ var source = new GeoJSONSource ( Constants . sourceId )
72
+ {
73
+ Data = new RawGeoJSONObject (
74
+ JsonSerializer . Serialize ( feature )
75
+ )
76
+ } ;
77
+
78
+ map . Sources = new [ ] { source } ;
79
+
80
+ // Create a symbol layer
81
+ var symbolLayer = new SymbolLayer ( id : "layer-id" ) ;
82
+ symbolLayer . Source = Constants . sourceId ;
83
+ symbolLayer . IconImage = image ;
84
+ symbolLayer . IconIgnorePlacement = true ;
85
+ symbolLayer . IconAllowOverlap = true ;
86
+
87
87
map . Layers = new [ ] { symbolLayer } ;
88
88
}
89
89
}
0 commit comments