forked from plotly/Plotly.NET
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGeoProjection.fs
More file actions
97 lines (83 loc) · 3.16 KB
/
Copy pathGeoProjection.fs
File metadata and controls
97 lines (83 loc) · 3.16 KB
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
namespace Plotly.NET
/// Determines Map rotation in GeoProjections
///
/// Parameters :
///
/// Longitude : Rotates the map along parallels (in degrees East). Defaults to the center of the `lonaxis.range` values.
///
/// Latitude : Rotates the map along meridians (in degrees North).
///
/// Roll : Roll the map (in degrees) For example, a roll of "180" makes the map appear upside down.
type GeoProjectionRotation () =
inherit DynamicObj ()
static member init
(
?Longitude :float,
?Latitude :float,
?Roll :int
) =
GeoProjectionRotation()
|> GeoProjectionRotation.style
(
?Longitude = Longitude,
?Latitude = Latitude ,
?Roll = Roll
)
static member style
(
?Longitude :float,
?Latitude :float,
?Roll :int
) =
(fun (rotation:GeoProjectionRotation) ->
Longitude |> DynObj.setValueOpt rotation "lon"
Latitude |> DynObj.setValueOpt rotation "lat"
Roll |> DynObj.setValueOpt rotation "roll"
rotation
)
/// Determines the map projection in geo traces.
///
/// Parameters :
///
/// projectionType : Sets the type of projection
///
/// Rotation : Sets the rotation applied to the map
///
/// Parallels : For conic projection types only. Sets the parallels (tangent, secant) where the cone intersects the sphere.
///
/// Scale : Zooms in or out on the map view. A scale of "1" corresponds to the largest zoom level that fits the map's lon and lat ranges.
type GeoProjection() =
inherit DynamicObj ()
static member init
(
projectionType : StyleParam.GeoProjectionType ,
?Rotation : GeoProjectionRotation ,
?Parallels : (float*float) ,
?Scale : float
) =
GeoProjection()
|> GeoProjection.style
(
projectionType = projectionType,
?Rotation = Rotation ,
?Parallels = Parallels ,
?Scale = Scale
)
static member style
(
projectionType : StyleParam.GeoProjectionType ,
?Rotation : GeoProjectionRotation ,
?Parallels : (float*float) ,
?Scale : float
) =
(fun (projection:GeoProjection) ->
projectionType
|> StyleParam.GeoProjectionType.convert
|> DynObj.setValue projection "type"
Parallels
|> Option.map (fun (a,b) -> sprintf "[%f,%f]" a b)
|> DynObj.setValueOpt projection "parallels"
Rotation |> DynObj.setValueOpt projection "rotation"
Scale |> DynObj.setValueOpt projection "scale"
projection
)