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) · 4.5 KB
/
GeoProjection.fs
File metadata and controls
97 lines (83 loc) · 4.5 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
/// <summary>Determines Map rotation in GeoProjections</summary>
type GeoProjectionRotation () =
inherit DynamicObj ()
/// <summary>Initialize a GeoProjectionRotation object that determines Map rotation in GeoProjections</summary>
/// <param name="Longitude">Rotates the map along parallels (in degrees East). Defaults to the center of the `lonaxis.range` values.</param>
/// <param name="Latitude">Rotates the map along meridians (in degrees North).</param>
/// <param name="Roll">Roll the map (in degrees) For example, a roll of "180" makes the map appear upside down.</param>
static member init
(
?Longitude :float,
?Latitude :float,
?Roll :int
) =
GeoProjectionRotation()
|> GeoProjectionRotation.style
(
?Longitude = Longitude,
?Latitude = Latitude ,
?Roll = Roll
)
/// <summary>Create a function that applies the given style parameters to a GeoProjectionRotation object</summary>
/// <param name="Longitude">Rotates the map along parallels (in degrees East). Defaults to the center of the `lonaxis.range` values.</param>
/// <param name="Latitude">Rotates the map along meridians (in degrees North).</param>
/// <param name="Roll">Roll the map (in degrees) For example, a roll of "180" makes the map appear upside down.</param>
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
)
/// <summary>Determines the map projection in geo traces.</summary>
type GeoProjection() =
inherit DynamicObj ()
/// <summary>Initialize a GeoProjection object that determines the map projection in geo traces.</summary>
/// <param name="projectionType">Sets the type of projection</param>
/// <param name="Rotation">Sets the rotation applied to the map</param>
/// <param name="Parallels">For conic projection types only. Sets the parallels (tangent, secant) where the cone intersects the sphere.</param>
/// <param name="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.</param>
static member init
(
projectionType : StyleParam.GeoProjectionType ,
?Rotation : GeoProjectionRotation ,
?Parallels : (float*float) ,
?Scale : float
) =
GeoProjection()
|> GeoProjection.style
(
projectionType = projectionType,
?Rotation = Rotation ,
?Parallels = Parallels ,
?Scale = Scale
)
/// <summary>Create a function that applies the given style parameters to a GeoProjection object.</summary>
/// <param name="projectionType">Sets the type of projection</param>
/// <param name="Rotation">Sets the rotation applied to the map</param>
/// <param name="Parallels">For conic projection types only. Sets the parallels (tangent, secant) where the cone intersects the sphere.</param>
/// <param name="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.</param>
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
)