()
| 198 | } |
| 199 | |
| 200 | function createGlobe() { |
| 201 | if (init == false) { |
| 202 | d3.json('/src/ex_file/json/grid-mq.json', function (world) { |
| 203 | worldData = world |
| 204 | readyGlobe() |
| 205 | $('head').append(`<link rel="preconnect" href="https://fonts.googleapis.com"><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin><link href="https://fonts.googleapis.com/css2?family=Roboto+Mono&display=swap" rel="stylesheet">`) |
| 206 | }); |
| 207 | } else { |
| 208 | readyGlobe() |
| 209 | } |
| 210 | |
| 211 | |
| 212 | function readyGlobe() { |
| 213 | const node = d3.select('#militaryDashEarth').node(); |
| 214 | globe = new t3_rs_geo.Globe(document.getElementById('militaryDashEarth').clientWidth, 600, { |
| 215 | data: initialData, |
| 216 | background: '#1e1e1e', |
| 217 | tiles: worldData.tiles, |
| 218 | globeColor: 'black', |
| 219 | schemeColor: d3.interpolateRainbow, |
| 220 | }); |
| 221 | |
| 222 | node.append(globe.domElement); |
| 223 | |
| 224 | globe.ready |
| 225 | .then(() => { |
| 226 | // we are ready |
| 227 | (function tick() { |
| 228 | globe.tick(); |
| 229 | requestAnimationFrame(tick); |
| 230 | })(); |
| 231 | // Satellite |
| 232 | var constellation = []; |
| 233 | var opts = { |
| 234 | numWaves: parseInt(5) |
| 235 | }; |
| 236 | var alt = parseFloat(1.1); |
| 237 | for (var i = 0; i < 5; i++) { |
| 238 | for (var j = 0; j < 3; j++) { |
| 239 | constellation.push({ |
| 240 | lat: 50 * i - 30 + 15 * Math.random(), |
| 241 | lon: 120 * j - 120 + 30 * i, |
| 242 | altitude: alt |
| 243 | }); |
| 244 | } |
| 245 | } |
| 246 | /* add pins at random locations */ |
| 247 | for (var i = 0; i < 10; i++) { |
| 248 | var lat = Math.random() * 180 - 90, |
| 249 | lon = Math.random() * 360 - 180, |
| 250 | name = '' |
| 251 | globe.addPin(lat, lon, name); |
| 252 | } |
| 253 | globe.addConstellation(constellation, opts); |
| 254 | setTimeout(function () { |
| 255 | addLaunch() |
| 256 | }, 2000); |
| 257 | // Handle window resize events |
no test coverage detected