@@ -8,25 +8,35 @@ public static class GeometryExtensions
8
8
{
9
9
internal static Com . Mapbox . Geojson . Point ToGeoPoint ( this GeoJSON . Text . Geometry . IPosition xvalue )
10
10
{
11
- return Com . Mapbox . Geojson . Point . FromLngLat (
11
+ return xvalue . Altitude is not null
12
+ ? Com . Mapbox . Geojson . Point . FromLngLat (
13
+ xvalue . Longitude ,
14
+ xvalue . Latitude ,
15
+ xvalue . Altitude . Value )
16
+ : Com . Mapbox . Geojson . Point . FromLngLat (
12
17
xvalue . Longitude ,
13
18
xvalue . Latitude ) ;
14
19
}
15
-
20
+
21
+ public static IPosition ToMapPosition ( this Com . Mapbox . Geojson . Point point )
22
+ {
23
+ return new MapPosition (
24
+ point . Latitude ( ) ,
25
+ point . Longitude ( ) ,
26
+ point . Altitude ( ) ) ;
27
+ }
28
+
16
29
internal static MapTappedPosition ToMapTappedPosition ( this Com . Mapbox . Geojson . Point point , ScreenCoordinate screenCoordinate )
17
30
{
18
- return new MapTappedPosition
19
- {
20
- ScreenPosition = new ScreenPosition (
31
+ return new MapTappedPosition (
32
+ new ScreenPosition (
21
33
screenCoordinate . GetX ( ) . PixelToPoint ( ) ,
22
34
screenCoordinate . GetY ( ) . PixelToPoint ( ) ) ,
23
- Point = new GeoJSON . Text . Geometry . Point (
24
- new Position (
25
- screenCoordinate . GetX ( ) . PixelToPoint ( ) ,
26
- screenCoordinate . GetY ( ) . PixelToPoint ( ) ,
27
- point . HasAltitude ? point . Altitude ( ) : null )
28
- )
29
- } ;
35
+ new MapPosition (
36
+ point . Latitude ( ) ,
37
+ point . Longitude ( ) ,
38
+ point . HasAltitude ? point . Altitude ( ) : null )
39
+ ) ;
30
40
}
31
41
32
42
internal static Com . Mapbox . Geojson . IGeometry ToNative ( this GeoJSON . Text . Geometry . IGeometryObject xvalue )
@@ -84,6 +94,11 @@ internal static Com.Mapbox.Geojson.Point ToNative(this Point xvalue)
84
94
return Com . Mapbox . Geojson . Point . FromLngLat ( xvalue . Y , xvalue . X ) ;
85
95
}
86
96
97
+ internal static Com . Mapbox . Maps . ScreenCoordinate ToScreenCoordinate ( this Point xvalue )
98
+ {
99
+ return new Com . Mapbox . Maps . ScreenCoordinate ( xvalue . Y , xvalue . X ) ;
100
+ }
101
+
87
102
internal static GeoJSON . Text . Feature . Feature ToX ( this Com . Mapbox . Geojson . Feature src )
88
103
=> new GeoJSON . Text . Feature . Feature (
89
104
src . Geometry ( ) . ToX ( ) ,
@@ -96,7 +111,7 @@ internal static IGeometryObject ToX(this Com.Mapbox.Geojson.IGeometry src)
96
111
{
97
112
case Com . Mapbox . Geojson . Point point :
98
113
return new GeoJSON . Text . Geometry . Point (
99
- new Position (
114
+ new MapPosition (
100
115
point . Latitude ( ) , point . Longitude ( ) ,
101
116
point . HasAltitude ? point . Altitude ( ) : null
102
117
)
0 commit comments