@pirireis/webglobeplugins 0.9.11 → 0.9.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (166) hide show
  1. package/Math/angle-calculation.js +8 -8
  2. package/Math/arc.js +18 -18
  3. package/Math/bounds/line-bbox.js +78 -80
  4. package/Math/constants.js +3 -3
  5. package/Math/juction/arc-plane.js +23 -23
  6. package/Math/juction/line-sphere.js +11 -11
  7. package/Math/juction/plane-plane.js +11 -11
  8. package/Math/line.js +14 -16
  9. package/Math/methods.js +65 -70
  10. package/Math/plane.js +16 -18
  11. package/Math/quaternion.js +45 -49
  12. package/Math/utils.js +2 -2
  13. package/Math/vec3.js +42 -45
  14. package/algorithms/search-binary.js +4 -4
  15. package/altitude-locator/draw-subset-obj.js +7 -8
  16. package/altitude-locator/plugin.js +98 -114
  17. package/arrowfield/adaptor.js +3 -4
  18. package/arrowfield/index.js +2 -2
  19. package/arrowfield/plugin.js +62 -65
  20. package/bearing-line/index.js +1 -1
  21. package/bearing-line/plugin.js +200 -226
  22. package/circle-line-chain/chain-list-map.js +82 -88
  23. package/circle-line-chain/plugin.js +134 -165
  24. package/circle-line-chain/util.js +1 -1
  25. package/compass-rose/compass-rose-padding-flat.js +108 -133
  26. package/compass-rose/compass-text-writer.js +62 -70
  27. package/compass-rose/index.js +2 -2
  28. package/compassrose/compassrose.js +46 -50
  29. package/compassrose/index.js +1 -1
  30. package/heatwave/index.js +2 -2
  31. package/heatwave/isobar/objectarraylabels.js +44 -48
  32. package/heatwave/isobar/plugin.js +104 -123
  33. package/heatwave/isobar/quadtreecontours.js +76 -92
  34. package/heatwave/plugins/heatwaveglobeshell.js +69 -87
  35. package/index.js +11 -11
  36. package/package.json +1 -1
  37. package/partialrings/buffer-manager.js +32 -64
  38. package/partialrings/index.js +1 -1
  39. package/partialrings/plugin.js +48 -84
  40. package/partialrings/program.js +136 -47
  41. package/pin/pin-object-array.js +83 -86
  42. package/pin/pin-point-totem.js +21 -22
  43. package/point-heat-map/adaptors/timetracksplugin-format-to-this.js +10 -10
  44. package/point-heat-map/plugin-webworker.js +40 -45
  45. package/point-heat-map/point-to-heat-map-flow.js +40 -42
  46. package/point-tracks/key-methods.js +1 -1
  47. package/point-tracks/plugin.js +137 -162
  48. package/programs/arrowfield/index.js +1 -1
  49. package/programs/arrowfield/logic.js +170 -62
  50. package/programs/arrowfield/object.js +33 -35
  51. package/programs/data2legend/density-to-legend.js +45 -21
  52. package/programs/data2legend/point-to-density-texture.js +52 -27
  53. package/programs/float2legendwithratio/index.js +1 -1
  54. package/programs/float2legendwithratio/logic.js +88 -42
  55. package/programs/float2legendwithratio/object.js +43 -46
  56. package/programs/globe-util/is-globe-moved.js +10 -11
  57. package/programs/globeshell/index.js +1 -1
  58. package/programs/globeshell/wiggle/index.js +1 -1
  59. package/programs/globeshell/wiggle/logic.js +191 -98
  60. package/programs/globeshell/wiggle/object.js +33 -35
  61. package/programs/helpers/blender/program.js +36 -19
  62. package/programs/helpers/fadeaway/index.js +1 -1
  63. package/programs/helpers/fadeaway/logic.js +35 -13
  64. package/programs/helpers/fadeaway/object.js +9 -10
  65. package/programs/helpers/index.js +1 -1
  66. package/programs/index.js +8 -8
  67. package/programs/line-on-globe/angled-line.js +91 -32
  68. package/programs/line-on-globe/circle-accurate-3d.js +82 -32
  69. package/programs/line-on-globe/circle-accurate-flat.js +108 -50
  70. package/programs/line-on-globe/circle-accurate.js +103 -33
  71. package/programs/line-on-globe/circle.js +97 -32
  72. package/programs/line-on-globe/degree-padding-around-circle-3d.js +83 -33
  73. package/programs/line-on-globe/lines-color-instanced-flat.js +79 -34
  74. package/programs/line-on-globe/linestrip.js +111 -45
  75. package/programs/line-on-globe/naive-accurate-flexible.js +120 -50
  76. package/programs/line-on-globe/to-the-surface.js +58 -29
  77. package/programs/line-on-globe/util.js +1 -1
  78. package/programs/picking/pickable-renderer.js +117 -33
  79. package/programs/point-on-globe/element-globe-surface-glow.js +78 -38
  80. package/programs/point-on-globe/element-point-glow.js +103 -35
  81. package/programs/point-on-globe/square-pixel-point.js +76 -27
  82. package/programs/programcache.js +13 -13
  83. package/programs/rings/distancering/circleflatprogram.js +63 -21
  84. package/programs/rings/distancering/circlepaddingfreeangleprogram.js +156 -145
  85. package/programs/rings/distancering/circlepaddysharedbuffer.js +121 -197
  86. package/programs/rings/distancering/index.js +4 -4
  87. package/programs/rings/distancering/paddyflatprogram.js +73 -20
  88. package/programs/rings/distancering/paddyflatprogram2d.js +75 -22
  89. package/programs/rings/distancering/paddyflatprogram3d.js +73 -20
  90. package/programs/rings/partial-ring/piece-of-pie.js +137 -35
  91. package/programs/totems/camerauniformblock.js +64 -51
  92. package/programs/totems/canvas-webglobe-info.js +48 -40
  93. package/programs/totems/gpu-selection-uniform-block.js +44 -40
  94. package/programs/totems/index.js +1 -1
  95. package/programs/two-d/pixel-padding-for-compass.js +90 -29
  96. package/programs/util.js +6 -7
  97. package/programs/vectorfields/index.js +1 -1
  98. package/programs/vectorfields/logics/drawrectangleparticles.js +70 -29
  99. package/programs/vectorfields/logics/index.js +3 -3
  100. package/programs/vectorfields/logics/pixelbased.js +91 -35
  101. package/programs/vectorfields/logics/ubo.js +31 -25
  102. package/programs/vectorfields/pingpongbuffermanager.js +30 -34
  103. package/rangerings/index.js +4 -4
  104. package/rangerings/plugin.js +202 -258
  105. package/rangerings/rangeringangletext.js +108 -120
  106. package/rangerings/ring-account.js +52 -69
  107. package/shaders/fragment-toy/firework.js +55 -1
  108. package/shaders/fragment-toy/singularity.js +55 -1
  109. package/timetracks/adaptors-line-strip.js +26 -37
  110. package/timetracks/adaptors.js +47 -61
  111. package/timetracks/index.js +4 -4
  112. package/timetracks/plugin-line-strip.js +63 -71
  113. package/timetracks/plugin.js +69 -77
  114. package/timetracks/program-line-strip.js +296 -103
  115. package/timetracks/program.js +419 -113
  116. package/timetracks/programpoint-line-strip.js +97 -44
  117. package/timetracks/programpoint.js +90 -44
  118. package/util/account/bufferoffsetmanager.js +72 -95
  119. package/util/account/index.js +1 -1
  120. package/util/account/single-attribute-buffer-management/buffer-manager.js +44 -44
  121. package/util/account/single-attribute-buffer-management/buffer-orchestrator.js +68 -94
  122. package/util/account/single-attribute-buffer-management/index.js +3 -3
  123. package/util/account/single-attribute-buffer-management/object-store.js +29 -30
  124. package/util/account/util.js +2 -4
  125. package/util/algorithms/search-binary.js +4 -4
  126. package/util/check/get.js +5 -5
  127. package/util/check/typecheck.js +13 -15
  128. package/util/geometry/index.js +9 -11
  129. package/util/gl-util/buffer/attribute-loader.js +8 -20
  130. package/util/gl-util/buffer/index.js +1 -1
  131. package/util/gl-util/draw-options/methods.js +8 -9
  132. package/util/gl-util/uniform-block/manager.js +67 -67
  133. package/util/heatwavedatamanager/datamanager.js +56 -116
  134. package/util/heatwavedatamanager/index.js +2 -2
  135. package/util/heatwavedatamanager/pointcoordinatesdatacalculator.js +37 -40
  136. package/util/heatwavedatamanager/pointcoordsmeta.js +9 -10
  137. package/util/index.js +6 -6
  138. package/util/interpolation/timetrack/index.js +1 -1
  139. package/util/interpolation/timetrack/timetrack-interpolator.js +27 -29
  140. package/util/interpolation/timetrack/web-worker-str.js +179 -1
  141. package/util/interpolation/timetrack/web-worker.js +4 -4
  142. package/util/jshelpers/data-filler.js +7 -7
  143. package/util/jshelpers/timefilters.js +7 -7
  144. package/util/picking/fence.js +7 -7
  145. package/util/picking/picker-displayer.js +46 -52
  146. package/util/programs/draw-texture-on-canvas.js +39 -21
  147. package/util/programs/shapesonglobe.js +104 -64
  148. package/util/programs/supersampletotextures.js +45 -39
  149. package/util/programs/texturetoglobe.js +98 -48
  150. package/util/shaderfunctions/geometrytransformations.js +322 -27
  151. package/util/shaderfunctions/nodata.js +7 -1
  152. package/util/shaderfunctions/noisefunctions.js +39 -9
  153. package/util/surface-line-data/arcs-to-cuts.js +20 -23
  154. package/util/webglobe/rasteroverlay.js +35 -37
  155. package/util/webglobjectbuilders.js +55 -60
  156. package/util/webglobjectbuilders1.js +48 -49
  157. package/waveparticles/adaptor.js +6 -7
  158. package/waveparticles/index.js +2 -2
  159. package/waveparticles/plugin.js +79 -84
  160. package/wind/imagetovectorfieldandmagnitude.js +15 -15
  161. package/wind/index.js +4 -4
  162. package/wind/plugin.js +453 -251
  163. package/wind/vectorfieldimage.js +5 -5
  164. package/write-text/attached-text-writer.js +46 -48
  165. package/write-text/context-text.js +51 -58
  166. package/write-text/context-text3.js +69 -74
@@ -3,12 +3,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- var pointcoordsmeta_1 = __importDefault(require("./pointcoordsmeta"));
7
- var pointObject = function (long, lat, posIndex, callback) {
8
- return { long: long, lat: lat, posIndex: posIndex, callback: callback };
6
+ const pointcoordsmeta_1 = __importDefault(require("./pointcoordsmeta"));
7
+ const pointObject = (long, lat, posIndex, callback) => {
8
+ return { long, lat, posIndex, callback };
9
9
  };
10
- var PointCoordinatesDataCalculator = /** @class */ (function () {
11
- function PointCoordinatesDataCalculator(bbox, width, height) {
10
+ class PointCoordinatesDataCalculator {
11
+ constructor(bbox, width, height) {
12
12
  this._pointObjects = {};
13
13
  this._ratio = 0.0;
14
14
  this._bbox = bbox;
@@ -25,51 +25,49 @@ var PointCoordinatesDataCalculator = /** @class */ (function () {
25
25
  * @param {*} long
26
26
  * @param {*} callback | callback(data0, data1, interpolated)
27
27
  */
28
- PointCoordinatesDataCalculator.prototype.registerPoint = function (key, long, lat, callback) {
28
+ registerPoint(key, long, lat, callback) {
29
29
  if (key in this._pointObjects) {
30
30
  console.warn("key already registered, old one is unregistered");
31
31
  this.unregisterPoint(key);
32
32
  }
33
33
  if (!this._isInBBox(long, lat))
34
34
  return false;
35
- var meta = this._metaCalculater.getFlooredMeta(long, lat);
35
+ const meta = this._metaCalculater.getFlooredMeta(long, lat);
36
36
  this._pointObjects[key] = pointObject(long, lat, meta.index, callback);
37
37
  if (this._texture0 && this._texture1) {
38
- var _a = this._findAPoint(meta.index), data0 = _a.data0, data1 = _a.data1, interpolated = _a.interpolated;
38
+ const { data0, data1, interpolated } = this._findAPoint(meta.index);
39
39
  callback(data0, data1, interpolated);
40
40
  }
41
41
  return true;
42
- };
43
- PointCoordinatesDataCalculator.prototype._isInBBox = function (long, lat) {
42
+ }
43
+ _isInBBox(long, lat) {
44
44
  return lat >= this._bbox[1] && lat <= this._bbox[3] && long >= this._bbox[0] && long <= this._bbox[2];
45
- };
46
- PointCoordinatesDataCalculator.prototype.unregisterPoint = function (key) {
45
+ }
46
+ unregisterPoint(key) {
47
47
  if (!(key in this._pointObjects))
48
48
  return false;
49
49
  delete this._pointObjects[key];
50
50
  return true;
51
- };
52
- PointCoordinatesDataCalculator.prototype.updatePoint = function (key, long, lat) {
51
+ }
52
+ updatePoint(key, long, lat) {
53
53
  if (!(key in this._pointObjects))
54
54
  return false;
55
55
  if (!this._isInBBox(long, lat))
56
56
  return false;
57
57
  this._pointObjects[key].long = long;
58
58
  this._pointObjects[key].lat = lat;
59
- var meta = this._metaCalculater.getFlooredMeta(long, lat);
59
+ const meta = this._metaCalculater.getFlooredMeta(long, lat);
60
60
  this._pointObjects[key].posIndex = meta.index;
61
- var _a = this._findAPoint(meta.index), data0 = _a.data0, data1 = _a.data1, interpolated = _a.interpolated;
61
+ const { data0, data1, interpolated } = this._findAPoint(meta.index);
62
62
  this._pointObjects[key].callback(data0, data1, interpolated);
63
63
  return true;
64
- };
64
+ }
65
65
  /**
66
66
  * @param {Number} ratio 0-1
67
67
  * @param {} textureData0
68
68
  * @param {*} textureData1
69
69
  */
70
- PointCoordinatesDataCalculator.prototype.updateData = function (ratio, textureData0, textureData1) {
71
- if (textureData0 === void 0) { textureData0 = null; }
72
- if (textureData1 === void 0) { textureData1 = null; }
70
+ updateData(ratio, textureData0 = null, textureData1 = null) {
73
71
  if (!textureData0 && !textureData1) {
74
72
  this._pushPointCallBackEmpty();
75
73
  return;
@@ -80,31 +78,30 @@ var PointCoordinatesDataCalculator = /** @class */ (function () {
80
78
  }
81
79
  this._ratio = ratio;
82
80
  this._pushPointCallbackAll();
83
- };
84
- PointCoordinatesDataCalculator.prototype._findAPoint = function (posIndex) {
85
- var data0 = this._texture0[posIndex];
86
- var data1 = this._texture1[posIndex];
87
- var interpolated = data0 * (1 - this._ratio) + data1 * this._ratio;
88
- return { data0: data0, data1: data1, interpolated: interpolated };
89
- };
90
- PointCoordinatesDataCalculator.prototype._pushPointCallbackAll = function () {
91
- for (var key in this._pointObjects) {
92
- var _a = this._pointObjects[key], posIndex = _a.posIndex, callback = _a.callback;
93
- var _b = this._findAPoint(posIndex), data0 = _b.data0, data1 = _b.data1, interpolated = _b.interpolated;
81
+ }
82
+ _findAPoint(posIndex) {
83
+ const data0 = this._texture0[posIndex];
84
+ const data1 = this._texture1[posIndex];
85
+ const interpolated = data0 * (1 - this._ratio) + data1 * this._ratio;
86
+ return { data0, data1, interpolated };
87
+ }
88
+ _pushPointCallbackAll() {
89
+ for (const key in this._pointObjects) {
90
+ const { posIndex, callback } = this._pointObjects[key];
91
+ const { data0, data1, interpolated } = this._findAPoint(posIndex);
94
92
  callback(data0, data1, interpolated);
95
93
  }
96
- };
97
- PointCoordinatesDataCalculator.prototype._pushPointCallBackEmpty = function () {
98
- for (var key in this._pointObjects) {
99
- var callback = this._pointObjects[key].callback;
94
+ }
95
+ _pushPointCallBackEmpty() {
96
+ for (const key in this._pointObjects) {
97
+ const { callback } = this._pointObjects[key];
100
98
  callback(null, null, null);
101
99
  }
102
- };
103
- PointCoordinatesDataCalculator.prototype.flush = function () {
100
+ }
101
+ flush() {
104
102
  this._pointObjects = {};
105
- };
106
- return PointCoordinatesDataCalculator;
107
- }());
103
+ }
104
+ }
108
105
  exports.default = PointCoordinatesDataCalculator;
109
106
  // function test() {
110
107
  // const cp = window.plugin.getPointCoordinatesDataCalculator();
@@ -1,21 +1,20 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- var PointCoordsMeta = /** @class */ (function () {
4
- function PointCoordsMeta(bbox, width, height) {
3
+ class PointCoordsMeta {
4
+ constructor(bbox, width, height) {
5
5
  this._bbox = bbox;
6
6
  this._width = width;
7
7
  this._height = height;
8
8
  this._xRatio = this._width / (this._bbox[2] - this._bbox[0]);
9
9
  this._yRatio = this._height / (this._bbox[3] - this._bbox[1]);
10
10
  }
11
- PointCoordsMeta.prototype.getFlooredMeta = function (long, lat) {
12
- var x = (long - this._bbox[0]) * this._xRatio;
13
- var y = (this._bbox[3] - lat) * this._yRatio;
11
+ getFlooredMeta(long, lat) {
12
+ let x = (long - this._bbox[0]) * this._xRatio;
13
+ let y = (this._bbox[3] - lat) * this._yRatio;
14
14
  x = x > 0 ? x - 1 : 0;
15
15
  y = y > 0 ? y - 1 : 0;
16
- var index = Math.floor(y) * this._width + Math.floor(x);
17
- return { index: index };
18
- };
19
- return PointCoordsMeta;
20
- }());
16
+ const index = Math.floor(y) * this._width + Math.floor(x);
17
+ return { index };
18
+ }
19
+ }
21
20
  exports.default = PointCoordsMeta;
package/util/index.js CHANGED
@@ -37,17 +37,17 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.heatwavedatamanager = exports.programs = exports.webglobe = exports.geometry = exports.shaderfunctions = exports.webglobjectbuilders = void 0;
40
- var webglobjectbuilders = __importStar(require("./webglobjectbuilders"));
40
+ const webglobjectbuilders = __importStar(require("./webglobjectbuilders"));
41
41
  exports.webglobjectbuilders = webglobjectbuilders;
42
- var shaderfunctions = __importStar(require("./shaderfunctions"));
42
+ const shaderfunctions = __importStar(require("./shaderfunctions"));
43
43
  exports.shaderfunctions = shaderfunctions;
44
- var geometry = __importStar(require("./geometry"));
44
+ const geometry = __importStar(require("./geometry"));
45
45
  exports.geometry = geometry;
46
- var webglobe = __importStar(require("./webglobe"));
46
+ const webglobe = __importStar(require("./webglobe"));
47
47
  exports.webglobe = webglobe;
48
- var programs = __importStar(require("./programs"));
48
+ const programs = __importStar(require("./programs"));
49
49
  exports.programs = programs;
50
- var heatwavedatamanager = __importStar(require("./heatwavedatamanager"));
50
+ const heatwavedatamanager = __importStar(require("./heatwavedatamanager"));
51
51
  exports.heatwavedatamanager = heatwavedatamanager;
52
52
  __exportStar(require("./webglobe"), exports);
53
53
  __exportStar(require("./webglobjectbuilders"), exports);
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createWorker = void 0;
4
- var createWorker = function () { return new Worker(new URL('./web-worker.js', import.meta.url), { type: 'module' }); };
4
+ const createWorker = () => new Worker(new URL('./web-worker.js', import.meta.url), { type: 'module' });
5
5
  exports.createWorker = createWorker;
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.GEOMETRY = exports.TimeTrackInterpolator = void 0;
4
- var search_binary_1 = require("../../algorithms/search-binary");
5
- var methods_1 = require("../../../Math/methods");
4
+ const search_binary_1 = require("../../algorithms/search-binary");
5
+ const methods_1 = require("../../../Math/methods");
6
6
  /**
7
7
  * @typedef {Array<number>} vec3 [x, y, z]
8
8
  * @typedef {Array<number>} vec2 [x, y]
@@ -10,20 +10,19 @@ var methods_1 = require("../../../Math/methods");
10
10
  * @typedef {number} fraction a number between 0 and 1
11
11
  * @typedef {Array<number>} wgs84 [long, lat]
12
12
  */
13
- var GEOMETRY = Object.freeze({
13
+ const GEOMETRY = Object.freeze({
14
14
  CARTESIAN3D: 0,
15
15
  MERCATOR: 1,
16
16
  });
17
17
  exports.GEOMETRY = GEOMETRY;
18
- var TimeTrackInterpolator = /** @class */ (function () {
18
+ class TimeTrackInterpolator {
19
19
  /**
20
20
  * @typedef Timetrack
21
21
  * @property {Array<vec4>}} coordinates [x,y,z, length]
22
22
  * @property {Array<Number>} times
23
23
  * @param {Array<Timetrack>} timeTracks
24
24
  */
25
- function TimeTrackInterpolator(_a) {
26
- var _b = _a === void 0 ? {} : _a, timeTracks = _b.timeTracks, _c = _b.bbox, bbox = _c === void 0 ? null : _c, _d = _b.geometry, geometry = _d === void 0 ? GEOMETRY.CARTESIAN3D : _d;
25
+ constructor({ timeTracks, bbox = null, geometry = GEOMETRY.CARTESIAN3D } = {}) {
27
26
  this.timeTracks = null;
28
27
  this.timeTracksStartTimes = null;
29
28
  this.geometry = geometry;
@@ -32,50 +31,49 @@ var TimeTrackInterpolator = /** @class */ (function () {
32
31
  if (bbox)
33
32
  this.setBbox(bbox);
34
33
  }
35
- TimeTrackInterpolator.prototype.setGeometry = function (geometry) {
34
+ setGeometry(geometry) {
36
35
  if (geometry !== GEOMETRY.CARTESIAN3D && geometry !== GEOMETRY.MERCATOR) {
37
36
  throw new Error('Invalid geometry');
38
37
  }
39
38
  this.geometry = geometry;
40
- };
41
- TimeTrackInterpolator.prototype.setTimetracks = function (timeTracks) {
39
+ }
40
+ setTimetracks(timeTracks) {
42
41
  this.timeTracks = timeTracks;
43
- };
44
- TimeTrackInterpolator.prototype.interpolate = function (time) {
45
- var _a = this, timeTracks = _a.timeTracks, geometry = _a.geometry;
42
+ }
43
+ interpolate(time) {
44
+ const { timeTracks, geometry } = this;
46
45
  if (!timeTracks) {
47
46
  return null;
48
47
  }
49
- var resultArray = [];
50
- var info = {
48
+ const resultArray = [];
49
+ const info = {
51
50
  outOfRange: 0,
52
51
  processed: 0,
53
52
  };
54
- for (var i = 0; i < timeTracks.length; i++) {
55
- var _b = timeTracks[i], times = _b.times, coordinates = _b.coordinates;
53
+ for (let i = 0; i < timeTracks.length; i++) {
54
+ const { times, coordinates } = timeTracks[i];
56
55
  if (times[times.length - 1] < time)
57
56
  continue;
58
57
  info.processed++;
59
- var timeIndex = (0, search_binary_1.findFirstIndexInRange)(times, time);
58
+ const timeIndex = (0, search_binary_1.findFirstIndexInRange)(times, time);
60
59
  if (timeIndex === null) {
61
60
  info.outOfRange++;
62
61
  continue;
63
62
  }
64
- var timeFraction = (time - times[timeIndex]) / (times[timeIndex + 1] - times[timeIndex]);
65
- var interpolated = (geometry === GEOMETRY.CARTESIAN3D) ?
63
+ const timeFraction = (time - times[timeIndex]) / (times[timeIndex + 1] - times[timeIndex]);
64
+ const interpolated = (geometry === GEOMETRY.CARTESIAN3D) ?
66
65
  (0, methods_1.sphericalLinearInterpolation_Cartesian3d)(coordinates[timeIndex], coordinates[timeIndex + 1], timeFraction) :
67
66
  (0, methods_1.sphericalLinearInterpolation_Mercator)(coordinates[timeIndex], coordinates[timeIndex + 1], timeFraction);
68
- resultArray.push.apply(resultArray, interpolated);
67
+ resultArray.push(...interpolated);
69
68
  }
70
69
  return new Float32Array(resultArray);
71
- };
70
+ }
72
71
  // implicit methods
73
- TimeTrackInterpolator.prototype._orderTimeTracks = function () {
74
- this.timeTracks.sort(function (a, b) { return a.times[0] - b.times[0]; });
75
- };
76
- TimeTrackInterpolator.prototype._setStartTimes = function () {
77
- this.timeTracksStartTimes = this.timeTracks.map(function (tt) { return tt.times[0]; });
78
- };
79
- return TimeTrackInterpolator;
80
- }());
72
+ _orderTimeTracks() {
73
+ this.timeTracks.sort((a, b) => a.times[0] - b.times[0]);
74
+ }
75
+ _setStartTimes() {
76
+ this.timeTracksStartTimes = this.timeTracks.map(tt => tt.times[0]);
77
+ }
78
+ }
81
79
  exports.TimeTrackInterpolator = TimeTrackInterpolator;
@@ -1,5 +1,183 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.webworkerStr = void 0;
4
- var webworkerStr = "\n\nconst WORLD_RADIUS_3D = 6378.137;\nconst WORLD_RADIUS_MERCATOR = 6378136.99911;\n\nconst dot3 = (a, b) => {\n return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];\n}\n\nconst sphericalLinearInterpolation_UnitVector = (normalizedA, normalizedB, ratio) => {\n const theta = Math.acos(dot3(normalizedA, normalizedB));\n if (theta < 0.000001) return normalizedA; // CALIBRATE?\n const sinTheta = Math.sin(theta);\n const result = [\n (Math.sin((1.0 - ratio) * theta) * normalizedA[0] + Math.sin(ratio * theta) * normalizedB[0]) / sinTheta,\n (Math.sin((1.0 - ratio) * theta) * normalizedA[1] + Math.sin(ratio * theta) * normalizedB[1]) / sinTheta,\n (Math.sin((1.0 - ratio) * theta) * normalizedA[2] + Math.sin(ratio * theta) * normalizedB[2]) / sinTheta\n ];\n return result;\n}\n\nconst radianToMercator = (xy) => {\n return [WORLD_RADIUS_MERCATOR * xy[0], WORLD_RADIUS_MERCATOR * Math.log(Math.tan(Math.PI / 4 + xy[1] / 2))];\n}\n\n\nconst cartesian3dToRadian = (cartesian) => {\n const x = cartesian[0];\n const y = cartesian[1];\n const z = cartesian[2];\n // const length = Math.sqrt(x * x + y * y + z * z);\n const long = Math.atan2(y, x);\n const lat = Math.asin(z)// length);\n return [long, lat];\n}\n\n\nconst sphericalLinearInterpolation_Mercator = (normalizedA, normalizedB, ratio) => {\n const unitVector = sphericalLinearInterpolation_UnitVector(normalizedA, normalizedB, ratio);\n const angles = cartesian3dToRadian(unitVector);\n return radianToMercator(angles);\n}\n\nconst sphericalLinearInterpolation_Cartesian3d = (a, b, ratio) => {\n const unitVector = sphericalLinearInterpolation_UnitVector(a, b, ratio);\n const height = a[3] + (b[3] - a[3]) * ratio;\n return [unitVector[0] * height, unitVector[1] * height, unitVector[2] * height];\n}\n\nconst findFirstIndexInRange = (container, value) => {\n let start = 0;\n let end = container.length - 1;\n let mid = 0;\n while (start <= end) {\n mid = Math.floor((start + end) / 2);\n if (container[mid] <= value && value <= container[mid + 1]) return mid;\n if (container[mid] < value) start = mid + 1;\n else end = mid - 1;\n }\n return null;\n}\n\nconst GEOMETRY = Object.freeze({\n CARTESIAN3D: 0,\n MERCATOR: 1,\n});\n\nclass TimeTrackInterpolator {\n /**\n * @typedef Timetrack\n * @property {Array<vec4>}} coordinates [x,y,z, length]\n * @property {Array<Number>} times\n * @param {Array<Timetrack>} timeTracks\n */\n constructor({ timeTracks, bbox = null, geometry = GEOMETRY.CARTESIAN3D } = {}) {\n this.timeTracks = null;\n this.timeTracksStartTimes = null;\n this.geometry = geometry;\n if (timeTracks) this.setTimetracks(timeTracks);\n if (bbox) this.setBbox(bbox);\n }\n\n\n setGeometry(geometry) {\n if (geometry !== GEOMETRY.CARTESIAN3D && geometry !== GEOMETRY.MERCATOR) {\n throw new Error('Invalid geometry');\n }\n this.geometry = geometry;\n }\n\n setTimetracks(timeTracks) {\n this.timeTracks = timeTracks;\n }\n\n\n interpolate(time) {\n const { timeTracks, geometry } = this;\n if (!timeTracks) { return null; }\n const resultArray = [];\n const info = {\n outOfRange: 0,\n processed: 0,\n }\n for (let i = 0; i < timeTracks.length; i++) {\n const { times, coordinates } = timeTracks[i];\n\n if (times[times.length - 1] < time) continue;\n info.processed++;\n const timeIndex = findFirstIndexInRange(times, time);\n if (timeIndex === null) { info.outOfRange++; continue; }\n const timeFraction = (time - times[timeIndex]) / (times[timeIndex + 1] - times[timeIndex]);\n const interpolated = (geometry === GEOMETRY.CARTESIAN3D) ?\n sphericalLinearInterpolation_Cartesian3d(coordinates[timeIndex], coordinates[timeIndex + 1], timeFraction) :\n sphericalLinearInterpolation_Mercator(coordinates[timeIndex], coordinates[timeIndex + 1], timeFraction);\n resultArray.push(...interpolated);\n }\n return new Float32Array(resultArray);\n }\n\n\n // implicit methods\n\n _orderTimeTracks() {\n this.timeTracks.sort((a, b) => a.times[0] - b.times[0]);\n }\n\n _setStartTimes() {\n this.timeTracksStartTimes = this.timeTracks.map(tt => tt.times[0]);\n }\n}\n\nconst interpolator = new TimeTrackInterpolator({ geometry: GEOMETRY.CARTESIAN3D });\n\n/* eslint-disable-next-line no-restricted-globals */\nself.onmessage = function (e) {\n\n const { geometry = null, timeTracks = null, time = null } = e.data;\n\n if (geometry !== null) {\n try {\n interpolator.setGeometry(geometry);\n } catch (error) {\n /* eslint-disable-next-line no-restricted-globals */\n self.postMessage({ error: error.message });\n return;\n }\n }\n\n if (timeTracks !== null) {\n try {\n interpolator.setTimetracks(timeTracks);\n } catch (error) {\n /* eslint-disable-next-line no-restricted-globals */\n self.postMessage({ error: error.message });\n return;\n }\n }\n\n if (time !== null) {\n try {\n const result = interpolator.interpolate(time);\n if(result === null) {\n /* eslint-disable-next-line no-restricted-globals */\n self.postMessage({ error: 'No TimeTracks Data' });\n return;\n }\n /* eslint-disable-next-line no-restricted-globals */\n self.postMessage(result, [result.buffer]);\n return;\n } catch (error) {\n /* eslint-disable-next-line no-restricted-globals */\n self.postMessage({ error: error.message });\n return;\n }\n }\n /* eslint-disable-next-line no-restricted-globals */\n self.postMessage(true);\n}\n ";
4
+ const webworkerStr = `
5
+
6
+ const WORLD_RADIUS_3D = 6378.137;
7
+ const WORLD_RADIUS_MERCATOR = 6378136.99911;
8
+
9
+ const dot3 = (a, b) => {
10
+ return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
11
+ }
12
+
13
+ const sphericalLinearInterpolation_UnitVector = (normalizedA, normalizedB, ratio) => {
14
+ const theta = Math.acos(dot3(normalizedA, normalizedB));
15
+ if (theta < 0.000001) return normalizedA; // CALIBRATE?
16
+ const sinTheta = Math.sin(theta);
17
+ const result = [
18
+ (Math.sin((1.0 - ratio) * theta) * normalizedA[0] + Math.sin(ratio * theta) * normalizedB[0]) / sinTheta,
19
+ (Math.sin((1.0 - ratio) * theta) * normalizedA[1] + Math.sin(ratio * theta) * normalizedB[1]) / sinTheta,
20
+ (Math.sin((1.0 - ratio) * theta) * normalizedA[2] + Math.sin(ratio * theta) * normalizedB[2]) / sinTheta
21
+ ];
22
+ return result;
23
+ }
24
+
25
+ const radianToMercator = (xy) => {
26
+ return [WORLD_RADIUS_MERCATOR * xy[0], WORLD_RADIUS_MERCATOR * Math.log(Math.tan(Math.PI / 4 + xy[1] / 2))];
27
+ }
28
+
29
+
30
+ const cartesian3dToRadian = (cartesian) => {
31
+ const x = cartesian[0];
32
+ const y = cartesian[1];
33
+ const z = cartesian[2];
34
+ // const length = Math.sqrt(x * x + y * y + z * z);
35
+ const long = Math.atan2(y, x);
36
+ const lat = Math.asin(z)// length);
37
+ return [long, lat];
38
+ }
39
+
40
+
41
+ const sphericalLinearInterpolation_Mercator = (normalizedA, normalizedB, ratio) => {
42
+ const unitVector = sphericalLinearInterpolation_UnitVector(normalizedA, normalizedB, ratio);
43
+ const angles = cartesian3dToRadian(unitVector);
44
+ return radianToMercator(angles);
45
+ }
46
+
47
+ const sphericalLinearInterpolation_Cartesian3d = (a, b, ratio) => {
48
+ const unitVector = sphericalLinearInterpolation_UnitVector(a, b, ratio);
49
+ const height = a[3] + (b[3] - a[3]) * ratio;
50
+ return [unitVector[0] * height, unitVector[1] * height, unitVector[2] * height];
51
+ }
52
+
53
+ const findFirstIndexInRange = (container, value) => {
54
+ let start = 0;
55
+ let end = container.length - 1;
56
+ let mid = 0;
57
+ while (start <= end) {
58
+ mid = Math.floor((start + end) / 2);
59
+ if (container[mid] <= value && value <= container[mid + 1]) return mid;
60
+ if (container[mid] < value) start = mid + 1;
61
+ else end = mid - 1;
62
+ }
63
+ return null;
64
+ }
65
+
66
+ const GEOMETRY = Object.freeze({
67
+ CARTESIAN3D: 0,
68
+ MERCATOR: 1,
69
+ });
70
+
71
+ class TimeTrackInterpolator {
72
+ /**
73
+ * @typedef Timetrack
74
+ * @property {Array<vec4>}} coordinates [x,y,z, length]
75
+ * @property {Array<Number>} times
76
+ * @param {Array<Timetrack>} timeTracks
77
+ */
78
+ constructor({ timeTracks, bbox = null, geometry = GEOMETRY.CARTESIAN3D } = {}) {
79
+ this.timeTracks = null;
80
+ this.timeTracksStartTimes = null;
81
+ this.geometry = geometry;
82
+ if (timeTracks) this.setTimetracks(timeTracks);
83
+ if (bbox) this.setBbox(bbox);
84
+ }
85
+
86
+
87
+ setGeometry(geometry) {
88
+ if (geometry !== GEOMETRY.CARTESIAN3D && geometry !== GEOMETRY.MERCATOR) {
89
+ throw new Error('Invalid geometry');
90
+ }
91
+ this.geometry = geometry;
92
+ }
93
+
94
+ setTimetracks(timeTracks) {
95
+ this.timeTracks = timeTracks;
96
+ }
97
+
98
+
99
+ interpolate(time) {
100
+ const { timeTracks, geometry } = this;
101
+ if (!timeTracks) { return null; }
102
+ const resultArray = [];
103
+ const info = {
104
+ outOfRange: 0,
105
+ processed: 0,
106
+ }
107
+ for (let i = 0; i < timeTracks.length; i++) {
108
+ const { times, coordinates } = timeTracks[i];
109
+
110
+ if (times[times.length - 1] < time) continue;
111
+ info.processed++;
112
+ const timeIndex = findFirstIndexInRange(times, time);
113
+ if (timeIndex === null) { info.outOfRange++; continue; }
114
+ const timeFraction = (time - times[timeIndex]) / (times[timeIndex + 1] - times[timeIndex]);
115
+ const interpolated = (geometry === GEOMETRY.CARTESIAN3D) ?
116
+ sphericalLinearInterpolation_Cartesian3d(coordinates[timeIndex], coordinates[timeIndex + 1], timeFraction) :
117
+ sphericalLinearInterpolation_Mercator(coordinates[timeIndex], coordinates[timeIndex + 1], timeFraction);
118
+ resultArray.push(...interpolated);
119
+ }
120
+ return new Float32Array(resultArray);
121
+ }
122
+
123
+
124
+ // implicit methods
125
+
126
+ _orderTimeTracks() {
127
+ this.timeTracks.sort((a, b) => a.times[0] - b.times[0]);
128
+ }
129
+
130
+ _setStartTimes() {
131
+ this.timeTracksStartTimes = this.timeTracks.map(tt => tt.times[0]);
132
+ }
133
+ }
134
+
135
+ const interpolator = new TimeTrackInterpolator({ geometry: GEOMETRY.CARTESIAN3D });
136
+
137
+ /* eslint-disable-next-line no-restricted-globals */
138
+ self.onmessage = function (e) {
139
+
140
+ const { geometry = null, timeTracks = null, time = null } = e.data;
141
+
142
+ if (geometry !== null) {
143
+ try {
144
+ interpolator.setGeometry(geometry);
145
+ } catch (error) {
146
+ /* eslint-disable-next-line no-restricted-globals */
147
+ self.postMessage({ error: error.message });
148
+ return;
149
+ }
150
+ }
151
+
152
+ if (timeTracks !== null) {
153
+ try {
154
+ interpolator.setTimetracks(timeTracks);
155
+ } catch (error) {
156
+ /* eslint-disable-next-line no-restricted-globals */
157
+ self.postMessage({ error: error.message });
158
+ return;
159
+ }
160
+ }
161
+
162
+ if (time !== null) {
163
+ try {
164
+ const result = interpolator.interpolate(time);
165
+ if(result === null) {
166
+ /* eslint-disable-next-line no-restricted-globals */
167
+ self.postMessage({ error: 'No TimeTracks Data' });
168
+ return;
169
+ }
170
+ /* eslint-disable-next-line no-restricted-globals */
171
+ self.postMessage(result, [result.buffer]);
172
+ return;
173
+ } catch (error) {
174
+ /* eslint-disable-next-line no-restricted-globals */
175
+ self.postMessage({ error: error.message });
176
+ return;
177
+ }
178
+ }
179
+ /* eslint-disable-next-line no-restricted-globals */
180
+ self.postMessage(true);
181
+ }
182
+ `;
5
183
  exports.webworkerStr = webworkerStr;
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- var timetrack_interpolator_1 = require("./timetrack-interpolator");
4
- var interpolator = new timetrack_interpolator_1.TimeTrackInterpolator({ geometry: timetrack_interpolator_1.GEOMETRY.CARTESIAN3D });
3
+ const timetrack_interpolator_1 = require("./timetrack-interpolator");
4
+ const interpolator = new timetrack_interpolator_1.TimeTrackInterpolator({ geometry: timetrack_interpolator_1.GEOMETRY.CARTESIAN3D });
5
5
  /* eslint-disable-next-line no-restricted-globals */
6
6
  self.onmessage = function (e) {
7
- var _a = e.data, _b = _a.geometry, geometry = _b === void 0 ? null : _b, _c = _a.timeTracks, timeTracks = _c === void 0 ? null : _c, _d = _a.time, time = _d === void 0 ? null : _d;
7
+ const { geometry = null, timeTracks = null, time = null } = e.data;
8
8
  if (geometry !== null) {
9
9
  try {
10
10
  interpolator.setGeometry(geometry);
@@ -27,7 +27,7 @@ self.onmessage = function (e) {
27
27
  }
28
28
  if (time !== null) {
29
29
  try {
30
- var result = interpolator.interpolate(time);
30
+ const result = interpolator.interpolate(time);
31
31
  if (result === null) {
32
32
  /* eslint-disable-next-line no-restricted-globals */
33
33
  self.postMessage({ error: 'No TimeTracks Data' });
@@ -1,16 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.populateFloat32Array = void 0;
4
- var populateFloat32Array = Object.freeze({
5
- fillFloat32Array: function (length, data) {
6
- var result = new Float32Array(length);
4
+ const populateFloat32Array = Object.freeze({
5
+ fillFloat32Array: (length, data) => {
6
+ const result = new Float32Array(length);
7
7
  result.fill(data);
8
8
  return result;
9
9
  },
10
- fillWithListData: function (length, listdata) {
11
- var result = new Float32Array(length * listdata.length);
12
- var offset = 0;
13
- for (var i = 0; i < length; i++) {
10
+ fillWithListData: (length, listdata) => {
11
+ const result = new Float32Array(length * listdata.length);
12
+ let offset = 0;
13
+ for (let i = 0; i < length; i++) {
14
14
  result.set(listdata, offset);
15
15
  offset += listdata.length;
16
16
  }
@@ -3,13 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.instantDebounce = instantDebounce;
4
4
  // TODO: fix logic error in instantDebounce
5
5
  function instantDebounce(func, delay) {
6
- var timeout = null;
7
- var lastArgs = null;
8
- var runAtEnd = false;
9
- var timeoutMethod = function () {
10
- setTimeout(function () {
6
+ let timeout = null;
7
+ let lastArgs = null;
8
+ let runAtEnd = false;
9
+ const timeoutMethod = () => {
10
+ setTimeout(() => {
11
11
  if (runAtEnd) {
12
- func.apply(void 0, lastArgs);
12
+ func(...lastArgs);
13
13
  lastArgs = null;
14
14
  // console.log("processed with delay")
15
15
  runAtEnd = false;
@@ -24,7 +24,7 @@ function instantDebounce(func, delay) {
24
24
  return;
25
25
  }
26
26
  else {
27
- func.apply(void 0, args);
27
+ func(...args);
28
28
  // console.log("processed instantly")
29
29
  timeout = timeoutMethod();
30
30
  }
@@ -1,17 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.fence = void 0;
4
- var fence = function (gl) { return new Promise(function (resolve, reject) {
4
+ const fence = (gl) => new Promise((resolve, reject) => {
5
5
  // This will create a fence. If this follows a `readPixels()` call, then it
6
6
  // will signal to WebGL that the read instruction should be asynchronous.
7
7
  // This means JS can continue to work on other tasks while the read instruction
8
8
  // completes.
9
- var sync = gl.fenceSync(gl.SYNC_GPU_COMMANDS_COMPLETE, 0);
9
+ const sync = gl.fenceSync(gl.SYNC_GPU_COMMANDS_COMPLETE, 0);
10
10
  gl.flush();
11
11
  // There are TWO possible ways to check on the status of a WebGLSync object.
12
12
  // 1. This will check it using clientWaitSync()
13
- var checkStatus_v1 = function () {
14
- var status = gl.clientWaitSync(sync, 0, 0);
13
+ const checkStatus_v1 = () => {
14
+ const status = gl.clientWaitSync(sync, 0, 0);
15
15
  // There are four possible values for status:
16
16
  // a. ALREADY_SIGNALED and CONDITION_SATISFIED (done)
17
17
  // b. TIMEOUT_EXPIRED (check again later)
@@ -29,8 +29,8 @@ var fence = function (gl) { return new Promise(function (resolve, reject) {
29
29
  }
30
30
  };
31
31
  // 2. This will check with getSyncParameter(s, gl.SYNC_STATUS)
32
- var checkStatus_v2 = function () {
33
- var status = gl.getSyncParameter(sync, gl.SYNC_STATUS);
32
+ const checkStatus_v2 = () => {
33
+ const status = gl.getSyncParameter(sync, gl.SYNC_STATUS);
34
34
  // There are only two possible values for status: SIGNALED and UNSIGNALED
35
35
  // Note that there is no `error` signal, so there is no reason to use `reject()` here
36
36
  if (status === gl.SIGNALED) {
@@ -42,5 +42,5 @@ var fence = function (gl) { return new Promise(function (resolve, reject) {
42
42
  }
43
43
  };
44
44
  setTimeout(checkStatus_v2, 1);
45
- }); };
45
+ });
46
46
  exports.fence = fence;