-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathindex.js
224 lines (210 loc) · 5.5 KB
/
index.js
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
import React from 'react'
import './styles.module.css'
import Globe from './encom/ReactGlobe';
import PropTypes from 'prop-types';
import grid from './encom/data/grid';
import pinLocations from './encom/data/pin-locations';
import "./load-font.js";
/**
* Entrypoint for the Encom Globe.
*/
export const EncomGlobe = props => {
return <Globe {...props} />
}
EncomGlobe.defaultProps = {
globeConfig:{
//NOTE: For an example of loading this font check the example/src/index.css @font-face
font: "Inconsolata",
pinsData: pinLocations,
tiles: grid.tiles,
baseColor: "blue",
markerColor: "red",
pinColor: "green",
satelliteColor: "yellow",
scale: 1.0,
dayLength: 1000 * 28,
introLinesDuration: 2000,
maxPins: 500,
maxMarkers: 4,
viewAngle: 0.1
}
}
const satOpts = PropTypes.exact({
/**
* Number of dashes visible for the animated diffused signal emitted by the satellites.
*/
numWaves: PropTypes.number,
/**
* color for the individual wave lines
*/
waveColor: PropTypes.string,
/**
* Color for the center circle of the satellite
*/
coreColor: PropTypes.string,
/**
* Color for the outer shell of the satellite
*/
shieldColor: PropTypes.string,
/**
* Size for the satellite
*/
size: PropTypes.number
});
EncomGlobe.propTypes = {
/**
* Width of the div/canvas element that will contain the globe
*/
width: PropTypes.number.isRequired,
/**
* Height of the div/canvas element that will contain the globe
*/
height: PropTypes.number.isRequired,
/**
* Callback notified when the globe is fully mounted
*/
globeReadyCb: PropTypes.func.isRequired,
/**
* Parameters for drawing the globe
*/
globeConfig: PropTypes.exact({
/**
* Font used for the labels on the top of the Pins and the Markers
*/
font: PropTypes.string.isRequired,
/**
* Data for the pins that will be placed on the globe
*/
pinsData: PropTypes.arrayOf(
PropTypes.exact({
/**
* Lattitude for the pin
*/
lat: PropTypes.number,
/**
* Longitude for the pin
*/
lng: PropTypes.number,
/**
* Label that shows up at the top of the pin
*/
label: PropTypes.string,
})
).isRequired,
/**
* Data for the hexagons that outline the continents
*/
tiles: PropTypes.arrayOf(
PropTypes.exact({
lat: PropTypes.number,
lon: PropTypes.number,
/**
* Triangles that make up a tile
*/
b: PropTypes.arrayOf(
PropTypes.exact({
x: PropTypes.number,
y: PropTypes.number,
z: PropTypes.number,
})
)
})
).isRequired,
/**
* Base color that will be used by pusher.color to generate a set of hues
* for the tiles
*/
baseColor: PropTypes.string.isRequired,
/**
* Color for the markers
*/
markerColor: PropTypes.string.isRequired,
/**
* Color for the pins
*/
pinColor: PropTypes.string.isRequired,
/**
* Color for the satellites
*/
satelliteColor: PropTypes.string.isRequired,
/**
* Scale of the globe relative to the canvas.
* 1.0: take full advantage of the canvas
* 0.5: draw the globe in half the size of the canvas
*/
scale: PropTypes.number.isRequired,
/**
* Time in milliseconds that will take the globe to complete a rotation
*/
dayLength: PropTypes.number.isRequired,
/**
* Time in milliseconds for the duration of the intro animation
*/
introLinesDuration: PropTypes.number.isRequired,
/**
* Maximum number of pins to allow
* Note: the more pins present, the slower the animation runs
*/
maxPins: PropTypes.number.isRequired,
/**
* Maximum number of markers to allow
*/
maxMarkers: PropTypes.number.isRequired,
/**
* Camera angle framing the globe.
* 1.0: camera towards the north pole
* 0.0: camera at equator ecuator
* -1.0: camera towards the south pole
*/
viewAngle: PropTypes.number.isRequired,
}),
/**
* Markers to be displayed in the globe
*/
markers: PropTypes.arrayOf(
PropTypes.exact({
lat: PropTypes.number.isRequired,
lon: PropTypes.number.isRequired,
/**
* Label shown alongside the marker
*/
label: PropTypes.string,
/**
* Flag for showing a connecting line between the markers
*/
connected: PropTypes.bool,
})
),
/**
* List of individual satellites (as opposed to a constellation of stas) to be drawn on the globe
*/
satellites: PropTypes.arrayOf(
PropTypes.exact({
lat: PropTypes.number.isRequired,
lon: PropTypes.number.isRequired,
altitude: PropTypes.number.isRequired,
/**
* Data to configure the style of the satellite
*/
opts: satOpts
})
),
/**
* List of satellites drawn as a unit.
*/
constellations: PropTypes.arrayOf(
PropTypes.exact({
/**
* Data to configure the style of the satellite
*/
opts: satOpts,
sats: PropTypes.arrayOf(
PropTypes.exact({
lat: PropTypes.number.isRequired,
lon: PropTypes.number.isRequired,
altitude: PropTypes.number.isRequired,
})
)
})
)
}