tleWorker.js 643 B

1234567891011121314151617181920212223242526
  1. /* eslint-disable no-undef */
  2. importScripts("../../lib/mars3d/plugins/space/worker/mars3d-tle-worker.js");
  3. let mars3d = mars3dTle;
  4. self.onmessage = function (e) {
  5. let arr = e.data.list;
  6. let time = e.data.time;
  7. let positionObj = {};
  8. for (let i = 0; i < arr.length; i++) {
  9. let item = arr[i];
  10. try {
  11. let position = mars3d.Tle.getEcfPosition(item.tle1, item.tle2, time); //计算卫星位置
  12. if (position) {
  13. positionObj[item.id] = position;
  14. }
  15. } catch (err) {
  16. continue;
  17. }
  18. }
  19. //self代表子线程自身
  20. self.postMessage({ time: time, positionObj: positionObj });
  21. // self.close()
  22. };