@pirireis/webglobeplugins 0.9.11 → 0.9.13

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 (179) hide show
  1. package/Math/angle-calculation.js +9 -11
  2. package/Math/arc.js +38 -41
  3. package/Math/bounds/line-bbox.js +79 -83
  4. package/Math/constants.js +4 -9
  5. package/Math/frustum/types.js +1 -2
  6. package/Math/juction/arc-plane.js +33 -36
  7. package/Math/juction/line-sphere.js +15 -18
  8. package/Math/juction/plane-plane.js +20 -23
  9. package/Math/line.js +42 -47
  10. package/Math/methods.js +69 -92
  11. package/Math/plane.js +33 -38
  12. package/Math/quaternion.js +48 -55
  13. package/Math/types.js +1 -2
  14. package/Math/utils.js +2 -4
  15. package/Math/vec3.js +46 -52
  16. package/algorithms/search-binary.js +5 -8
  17. package/altitude-locator/draw-subset-obj.js +8 -11
  18. package/altitude-locator/plugin.js +114 -133
  19. package/altitude-locator/types.js +1 -3
  20. package/arrowfield/adaptor.js +3 -7
  21. package/arrowfield/index.js +3 -10
  22. package/arrowfield/plugin.js +63 -69
  23. package/bearing-line/index.js +2 -8
  24. package/bearing-line/plugin.js +218 -248
  25. package/circle-line-chain/chain-list-map.js +82 -92
  26. package/circle-line-chain/plugin.js +147 -182
  27. package/circle-line-chain/util.js +1 -5
  28. package/compass-rose/compass-rose-padding-flat.js +111 -140
  29. package/compass-rose/compass-text-writer.js +63 -75
  30. package/compass-rose/index.js +3 -7
  31. package/compassrose/compassrose.js +50 -57
  32. package/compassrose/index.js +2 -8
  33. package/heatwave/index.js +3 -10
  34. package/heatwave/isobar/objectarraylabels.js +50 -56
  35. package/heatwave/isobar/plugin.js +111 -170
  36. package/heatwave/isobar/quadtreecontours.js +78 -96
  37. package/heatwave/plugins/heatwaveglobeshell.js +73 -94
  38. package/index.js +12 -58
  39. package/package.json +1 -1
  40. package/partialrings/buffer-manager.js +32 -70
  41. package/partialrings/index.js +2 -41
  42. package/partialrings/plugin.js +55 -98
  43. package/partialrings/program.js +141 -59
  44. package/pin/pin-object-array.js +89 -97
  45. package/pin/pin-point-totem.js +21 -22
  46. package/point-heat-map/adaptors/timetracksplugin-format-to-this.js +11 -14
  47. package/point-heat-map/plugin-webworker.js +45 -53
  48. package/point-heat-map/point-to-heat-map-flow.js +46 -51
  49. package/point-tracks/key-methods.js +2 -5
  50. package/point-tracks/plugin.js +141 -170
  51. package/programs/arrowfield/index.js +2 -7
  52. package/programs/arrowfield/logic.js +172 -67
  53. package/programs/arrowfield/object.js +35 -43
  54. package/programs/data2legend/density-to-legend.js +47 -26
  55. package/programs/data2legend/point-to-density-texture.js +56 -34
  56. package/programs/float2legendwithratio/index.js +2 -8
  57. package/programs/float2legendwithratio/logic.js +88 -45
  58. package/programs/float2legendwithratio/object.js +45 -54
  59. package/programs/globe-util/is-globe-moved.js +10 -13
  60. package/programs/globeshell/index.js +2 -8
  61. package/programs/globeshell/wiggle/index.js +2 -8
  62. package/programs/globeshell/wiggle/logic.js +191 -101
  63. package/programs/globeshell/wiggle/object.js +35 -43
  64. package/programs/helpers/blender/program.js +36 -22
  65. package/programs/helpers/fadeaway/index.js +2 -7
  66. package/programs/helpers/fadeaway/logic.js +36 -17
  67. package/programs/helpers/fadeaway/object.js +11 -18
  68. package/programs/helpers/index.js +2 -8
  69. package/programs/index.js +9 -58
  70. package/programs/line-on-globe/angled-line.js +95 -39
  71. package/programs/line-on-globe/circle-accurate-3d.js +86 -39
  72. package/programs/line-on-globe/circle-accurate-flat.js +116 -64
  73. package/programs/line-on-globe/circle-accurate.js +113 -46
  74. package/programs/line-on-globe/circle.js +106 -44
  75. package/programs/line-on-globe/degree-padding-around-circle-3d.js +89 -42
  76. package/programs/line-on-globe/lines-color-instanced-flat.js +84 -43
  77. package/programs/line-on-globe/linestrip.js +126 -63
  78. package/programs/line-on-globe/naive-accurate-flexible.js +126 -59
  79. package/programs/line-on-globe/to-the-surface.js +62 -35
  80. package/programs/line-on-globe/util.js +2 -5
  81. package/programs/picking/pickable-renderer.js +127 -46
  82. package/programs/point-on-globe/element-globe-surface-glow.js +83 -46
  83. package/programs/point-on-globe/element-point-glow.js +112 -47
  84. package/programs/point-on-globe/square-pixel-point.js +80 -34
  85. package/programs/programcache.js +14 -19
  86. package/programs/rings/distancering/circleflatprogram.js +76 -70
  87. package/programs/rings/distancering/circlepaddingfreeangleprogram.js +168 -194
  88. package/programs/rings/distancering/circlepaddysharedbuffer.js +121 -200
  89. package/programs/rings/distancering/index.js +5 -14
  90. package/programs/rings/distancering/paddyflatprogram.js +87 -70
  91. package/programs/rings/distancering/paddyflatprogram2d.js +89 -72
  92. package/programs/rings/distancering/paddyflatprogram3d.js +87 -70
  93. package/programs/rings/index.js +1 -17
  94. package/programs/rings/partial-ring/piece-of-pie.js +144 -44
  95. package/programs/totems/camerauniformblock.js +65 -56
  96. package/programs/totems/canvas-webglobe-info.js +49 -45
  97. package/programs/totems/gpu-selection-uniform-block.js +45 -45
  98. package/programs/totems/index.js +2 -40
  99. package/programs/two-d/pixel-padding-for-compass.js +94 -36
  100. package/programs/util.js +7 -10
  101. package/programs/vectorfields/index.js +3 -23
  102. package/programs/vectorfields/logics/drawrectangleparticles.js +73 -35
  103. package/programs/vectorfields/logics/index.js +4 -12
  104. package/programs/vectorfields/logics/pixelbased.js +94 -41
  105. package/programs/vectorfields/logics/ubo.js +32 -32
  106. package/programs/vectorfields/pingpongbuffermanager.js +30 -37
  107. package/rangerings/enum.js +2 -5
  108. package/rangerings/index.js +5 -15
  109. package/rangerings/plugin.js +223 -286
  110. package/rangerings/rangeringangletext.js +122 -137
  111. package/rangerings/ring-account.js +53 -75
  112. package/shaders/fragment-toy/firework.js +55 -4
  113. package/shaders/fragment-toy/singularity.js +56 -5
  114. package/timetracks/adaptors-line-strip.js +27 -44
  115. package/timetracks/adaptors.js +48 -67
  116. package/timetracks/index.js +5 -19
  117. package/timetracks/plugin-line-strip.js +65 -79
  118. package/timetracks/plugin.js +71 -85
  119. package/timetracks/program-line-strip.js +297 -107
  120. package/timetracks/program.js +421 -118
  121. package/timetracks/programpoint-line-strip.js +98 -48
  122. package/timetracks/programpoint.js +91 -48
  123. package/util/account/bufferoffsetmanager.js +72 -98
  124. package/util/account/index.js +3 -23
  125. package/util/account/single-attribute-buffer-management/buffer-manager.js +44 -48
  126. package/util/account/single-attribute-buffer-management/buffer-orchestrator.js +68 -98
  127. package/util/account/single-attribute-buffer-management/index.js +4 -9
  128. package/util/account/single-attribute-buffer-management/object-store.js +29 -34
  129. package/util/account/single-attribute-buffer-management/types.js +1 -2
  130. package/util/account/util.js +2 -8
  131. package/util/algorithms/search-binary.js +5 -8
  132. package/util/check/get.js +5 -9
  133. package/util/check/typecheck.js +13 -24
  134. package/util/geometry/index.js +10 -18
  135. package/util/gl-util/buffer/attribute-loader.js +10 -26
  136. package/util/gl-util/buffer/index.js +2 -5
  137. package/util/gl-util/draw-options/methods.js +10 -15
  138. package/util/gl-util/uniform-block/manager.js +69 -72
  139. package/util/heatwavedatamanager/datamanager.js +56 -119
  140. package/util/heatwavedatamanager/index.js +3 -10
  141. package/util/heatwavedatamanager/pointcoordinatesdatacalculator.js +38 -47
  142. package/util/heatwavedatamanager/pointcoordsmeta.js +9 -13
  143. package/util/index.js +13 -57
  144. package/util/interpolation/timetrack/index.js +2 -5
  145. package/util/interpolation/timetrack/timetrack-interpolator.js +30 -36
  146. package/util/interpolation/timetrack/web-worker-str.js +180 -5
  147. package/util/interpolation/timetrack/web-worker.js +4 -6
  148. package/util/jshelpers/data-filler.js +8 -11
  149. package/util/jshelpers/equality.js +1 -3
  150. package/util/jshelpers/index.js +2 -37
  151. package/util/jshelpers/timefilters.js +8 -10
  152. package/util/picking/fence.js +8 -11
  153. package/util/picking/picker-displayer.js +49 -58
  154. package/util/programs/draw-texture-on-canvas.js +41 -26
  155. package/util/programs/index.js +1 -17
  156. package/util/programs/shapesonglobe.js +104 -68
  157. package/util/programs/supersampletotextures.js +45 -43
  158. package/util/programs/texturetoglobe.js +99 -52
  159. package/util/shaderfunctions/geometrytransformations.js +323 -35
  160. package/util/shaderfunctions/index.js +2 -18
  161. package/util/shaderfunctions/nodata.js +8 -5
  162. package/util/shaderfunctions/noisefunctions.js +40 -12
  163. package/util/surface-line-data/arcs-to-cuts.js +20 -23
  164. package/util/webglobe/gldefaultstates.js +1 -4
  165. package/util/webglobe/index.js +2 -18
  166. package/util/webglobe/rasteroverlay.js +36 -41
  167. package/util/webglobjectbuilders.js +70 -93
  168. package/util/webglobjectbuilders1.js +63 -82
  169. package/waveparticles/adaptor.js +7 -10
  170. package/waveparticles/index.js +3 -10
  171. package/waveparticles/plugin.js +82 -90
  172. package/wind/imagetovectorfieldandmagnitude.js +16 -19
  173. package/wind/index.js +5 -14
  174. package/wind/plugin.js +454 -291
  175. package/wind/vectorfieldimage.js +6 -8
  176. package/write-text/attached-text-writer.js +48 -54
  177. package/write-text/context-text.js +52 -63
  178. package/write-text/context-text3.js +71 -80
  179. package/write-text/index.js +1 -5
@@ -1,64 +1,16 @@
1
- "use strict";
2
1
  /**
3
2
  * todo:
4
3
  * data must be processed before being set to the cache
5
4
  */
6
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
7
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
8
- return new (P || (P = Promise))(function (resolve, reject) {
9
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
10
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
11
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
12
- step((generator = generator.apply(thisArg, _arguments || [])).next());
13
- });
14
- };
15
- var __generator = (this && this.__generator) || function (thisArg, body) {
16
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
17
- return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
18
- function verb(n) { return function (v) { return step([n, v]); }; }
19
- function step(op) {
20
- if (f) throw new TypeError("Generator is already executing.");
21
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
22
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
23
- if (y = 0, t) op = [op[0] & 2, t.value];
24
- switch (op[0]) {
25
- case 0: case 1: t = op; break;
26
- case 4: _.label++; return { value: op[1], done: false };
27
- case 5: _.label++; y = op[1]; op = [0]; continue;
28
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
29
- default:
30
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
31
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
32
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
33
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
34
- if (t[2]) _.ops.pop();
35
- _.trys.pop(); continue;
36
- }
37
- op = body.call(thisArg, _);
38
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
39
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
40
- }
41
- };
42
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
43
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
44
- if (ar || !(i in from)) {
45
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
46
- ar[i] = from[i];
47
- }
48
- }
49
- return to.concat(ar || Array.prototype.slice.call(from));
50
- };
51
- Object.defineProperty(exports, "__esModule", { value: true });
52
- var DataManager = /** @class */ (function () {
5
+ export default class DataManager {
53
6
  /**
54
7
  *
55
8
  * @param {Array<number>} timeEpocs | array of time epocs
56
9
  * @param {Function} fetchMethod | fetchMethod(time) => Promise<data>
57
10
  * @param {boolean} autoDownload | auto download data or not
58
11
  */
59
- function DataManager(timeEpocs, fetchMethod, _a) {
60
- var _b = _a === void 0 ? {} : _a, _c = _b.autoDownload, autoDownload = _c === void 0 ? true : _c;
61
- this._timeEpocs = timeEpocs.sort(function (a, b) { return a - b; });
12
+ constructor(timeEpocs, fetchMethod, { autoDownload = true } = {}) {
13
+ this._timeEpocs = timeEpocs.sort((a, b) => a - b);
62
14
  this._datas = [];
63
15
  this._datas.length = timeEpocs.length;
64
16
  // in construction
@@ -71,13 +23,12 @@ var DataManager = /** @class */ (function () {
71
23
  this._lastIndex = -1;
72
24
  this.autoDownload(autoDownload);
73
25
  }
74
- DataManager.prototype.autoDownload = function (bool, time) {
75
- var _this = this;
26
+ autoDownload(bool, time) {
76
27
  if (!bool) {
77
28
  this._autoDownload = false;
78
29
  return;
79
30
  }
80
- var index = this._lastIndex === -1 ? 0 : this._lastIndex;
31
+ let index = this._lastIndex === -1 ? 0 : this._lastIndex;
81
32
  if (time !== undefined) {
82
33
  if (time < this._timeEpocs[0] || time > this._timeEpocs[this._timeEpocs.length - 1]) {
83
34
  this._autoDownload = bool;
@@ -89,11 +40,11 @@ var DataManager = /** @class */ (function () {
89
40
  return;
90
41
  this._downloadStartIndex = index;
91
42
  this._autoDownload = bool;
92
- var recursion = function (startId, currentDownloadId) {
93
- if (startId !== _this._downloadStartIndex)
43
+ const recursion = (startId, currentDownloadId) => {
44
+ if (startId !== this._downloadStartIndex)
94
45
  return;
95
- if (currentDownloadId < _this._timeEpocs.length && _this._autoDownload) {
96
- _this._getData(currentDownloadId).then(function () {
46
+ if (currentDownloadId < this._timeEpocs.length && this._autoDownload) {
47
+ this._getData(currentDownloadId).then(() => {
97
48
  recursion(startId, currentDownloadId + 1);
98
49
  });
99
50
  }
@@ -102,29 +53,28 @@ var DataManager = /** @class */ (function () {
102
53
  // save index as start index
103
54
  //start recursive download
104
55
  // use started id as a flag to stop the download
105
- };
56
+ }
106
57
  /**
107
58
  * @param {number} time
108
59
  * It looks like async function is not needed here. changes just overwrites the previous changes.
109
60
  */
110
- DataManager.prototype.updateTime = function (time) {
111
- var _this = this;
61
+ updateTime(time) {
112
62
  if (time < this._timeEpocs[0] || time > this._timeEpocs[this._timeEpocs.length - 1]) {
113
63
  this._dontRender();
114
64
  return;
115
65
  }
116
66
  this._lastTime = time;
117
- var index = this._findIndex(time);
118
- var ratio = this._getRatio(time, index);
119
- Promise.all([this._getData(index - 1), this._getData(index)]).then(function (datas) {
120
- if (_this._lastTime === time) {
121
- _this._lastIndex = index;
122
- _this._ratio = ratio;
123
- _this._pushCallback(ratio, datas);
67
+ const index = this._findIndex(time);
68
+ const ratio = this._getRatio(time, index);
69
+ Promise.all([this._getData(index - 1), this._getData(index)]).then((datas) => {
70
+ if (this._lastTime === time) {
71
+ this._lastIndex = index;
72
+ this._ratio = ratio;
73
+ this._pushCallback(ratio, datas);
124
74
  }
125
75
  });
126
- };
127
- DataManager.prototype.register = function (key, callback) {
76
+ }
77
+ register(key, callback) {
128
78
  if (this._callbackmethodOwners.indexOf(key) !== -1) {
129
79
  console.warn("key already registered, old one is unregistered");
130
80
  this.unregister(key);
@@ -133,12 +83,12 @@ var DataManager = /** @class */ (function () {
133
83
  this._callbackmethodOwners.push(key);
134
84
  if (this._lastIndex !== -1)
135
85
  callback(this._ratio, this._datas[this._lastIndex - 1], this._datas[this._lastIndex]);
136
- };
86
+ }
137
87
  /**
138
88
  * @param {*} key | id of the owner of the callback
139
89
  */
140
- DataManager.prototype.unregister = function (key) {
141
- var index = this._callbackmethodOwners.indexOf(key);
90
+ unregister(key) {
91
+ let index = this._callbackmethodOwners.indexOf(key);
142
92
  if (index !== -1) {
143
93
  this._callbackmethods.splice(index, 1);
144
94
  this._callbackmethodOwners.splice(index, 1);
@@ -146,15 +96,15 @@ var DataManager = /** @class */ (function () {
146
96
  if (this._callbackmethods.length === 0) {
147
97
  this.free();
148
98
  }
149
- };
150
- DataManager.prototype.free = function () {
99
+ }
100
+ free() {
151
101
  this._callbackmethods = [];
152
102
  this._callbackmethodOwners = [];
153
103
  this._autoDownload = false;
154
- };
155
- DataManager.prototype._findIndex = function (time) {
156
- var _timeEpocs = this._timeEpocs;
157
- var index = this._lastIndex === -1 ? 1 : this._lastIndex;
104
+ }
105
+ _findIndex(time) {
106
+ const { _timeEpocs } = this;
107
+ let index = this._lastIndex === -1 ? 1 : this._lastIndex;
158
108
  if (this)
159
109
  if (time < _timeEpocs[index - 1]) {
160
110
  while (index > 1 && time < _timeEpocs[index - 1]) {
@@ -167,46 +117,33 @@ var DataManager = /** @class */ (function () {
167
117
  }
168
118
  }
169
119
  return index;
170
- };
171
- DataManager.prototype._getRatio = function (time, index) {
120
+ }
121
+ _getRatio(time, index) {
172
122
  return (time - this._timeEpocs[index - 1]) / (this._timeEpocs[index] - this._timeEpocs[index - 1]);
173
- };
174
- DataManager.prototype._pushCallback = function (ratio, datas) {
175
- var _a;
176
- for (var i = 0; i < this._callbackmethods.length; i++) {
177
- (_a = this._callbackmethods)[i].apply(_a, __spreadArray([ratio], datas, false));
123
+ }
124
+ _pushCallback(ratio, datas) {
125
+ for (let i = 0; i < this._callbackmethods.length; i++) {
126
+ this._callbackmethods[i](ratio, ...datas);
178
127
  }
179
- };
180
- DataManager.prototype._getData = function (index) {
181
- return __awaiter(this, void 0, void 0, function () {
182
- var _this = this;
183
- return __generator(this, function (_a) {
184
- switch (_a.label) {
185
- case 0:
186
- if (index < 0 || index >= this._timeEpocs.length) {
187
- throw new Error("Index out of range");
188
- }
189
- if (!this._datas[index]) {
190
- if (!this._dataPromises[index])
191
- this._dataPromises[index] = this._fetchMethod(this._timeEpocs[index]).then(function (data) {
192
- _this._datas[index] = data;
193
- }, function (error) {
194
- console.error("error", error);
195
- }).finally(function () {
196
- _this._dataPromises[index] = null;
197
- });
198
- }
199
- return [4 /*yield*/, this._dataPromises[index]];
200
- case 1:
201
- _a.sent();
202
- return [2 /*return*/, this._datas[index]];
203
- }
204
- });
205
- });
206
- };
207
- DataManager.prototype._dontRender = function () {
128
+ }
129
+ async _getData(index) {
130
+ if (index < 0 || index >= this._timeEpocs.length) {
131
+ throw new Error("Index out of range");
132
+ }
133
+ if (!this._datas[index]) {
134
+ if (!this._dataPromises[index])
135
+ this._dataPromises[index] = this._fetchMethod(this._timeEpocs[index]).then((data) => {
136
+ this._datas[index] = data;
137
+ }, (error) => {
138
+ console.error("error", error);
139
+ }).finally(() => {
140
+ this._dataPromises[index] = null;
141
+ });
142
+ }
143
+ await this._dataPromises[index];
144
+ return this._datas[index];
145
+ }
146
+ _dontRender() {
208
147
  this._pushCallback(0, [null, null]);
209
- };
210
- return DataManager;
211
- }());
212
- exports.default = DataManager;
148
+ }
149
+ }
@@ -1,10 +1,3 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.PointCoordinatesDataCalculator = exports.HeatWaveDataManager = void 0;
7
- var pointcoordinatesdatacalculator_1 = __importDefault(require("./pointcoordinatesdatacalculator"));
8
- exports.PointCoordinatesDataCalculator = pointcoordinatesdatacalculator_1.default;
9
- var datamanager_1 = __importDefault(require("./datamanager"));
10
- exports.HeatWaveDataManager = datamanager_1.default;
1
+ import PointCoordinatesDataCalculator from "./pointcoordinatesdatacalculator";
2
+ import HeatWaveDataManager from "./datamanager";
3
+ export { HeatWaveDataManager, PointCoordinatesDataCalculator };
@@ -1,20 +1,15 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
1
+ import PointCoordsMeta from "./pointcoordsmeta";
2
+ const pointObject = (long, lat, posIndex, callback) => {
3
+ return { long, lat, posIndex, callback };
4
4
  };
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 };
9
- };
10
- var PointCoordinatesDataCalculator = /** @class */ (function () {
11
- function PointCoordinatesDataCalculator(bbox, width, height) {
5
+ export default class PointCoordinatesDataCalculator {
6
+ constructor(bbox, width, height) {
12
7
  this._pointObjects = {};
13
8
  this._ratio = 0.0;
14
9
  this._bbox = bbox;
15
10
  this._width = width;
16
11
  this._height = height;
17
- this._metaCalculater = new pointcoordsmeta_1.default(bbox, width, height);
12
+ this._metaCalculater = new PointCoordsMeta(bbox, width, height);
18
13
  this._texture0 = null;
19
14
  this._texture1 = null;
20
15
  }
@@ -25,51 +20,49 @@ var PointCoordinatesDataCalculator = /** @class */ (function () {
25
20
  * @param {*} long
26
21
  * @param {*} callback | callback(data0, data1, interpolated)
27
22
  */
28
- PointCoordinatesDataCalculator.prototype.registerPoint = function (key, long, lat, callback) {
23
+ registerPoint(key, long, lat, callback) {
29
24
  if (key in this._pointObjects) {
30
25
  console.warn("key already registered, old one is unregistered");
31
26
  this.unregisterPoint(key);
32
27
  }
33
28
  if (!this._isInBBox(long, lat))
34
29
  return false;
35
- var meta = this._metaCalculater.getFlooredMeta(long, lat);
30
+ const meta = this._metaCalculater.getFlooredMeta(long, lat);
36
31
  this._pointObjects[key] = pointObject(long, lat, meta.index, callback);
37
32
  if (this._texture0 && this._texture1) {
38
- var _a = this._findAPoint(meta.index), data0 = _a.data0, data1 = _a.data1, interpolated = _a.interpolated;
33
+ const { data0, data1, interpolated } = this._findAPoint(meta.index);
39
34
  callback(data0, data1, interpolated);
40
35
  }
41
36
  return true;
42
- };
43
- PointCoordinatesDataCalculator.prototype._isInBBox = function (long, lat) {
37
+ }
38
+ _isInBBox(long, lat) {
44
39
  return lat >= this._bbox[1] && lat <= this._bbox[3] && long >= this._bbox[0] && long <= this._bbox[2];
45
- };
46
- PointCoordinatesDataCalculator.prototype.unregisterPoint = function (key) {
40
+ }
41
+ unregisterPoint(key) {
47
42
  if (!(key in this._pointObjects))
48
43
  return false;
49
44
  delete this._pointObjects[key];
50
45
  return true;
51
- };
52
- PointCoordinatesDataCalculator.prototype.updatePoint = function (key, long, lat) {
46
+ }
47
+ updatePoint(key, long, lat) {
53
48
  if (!(key in this._pointObjects))
54
49
  return false;
55
50
  if (!this._isInBBox(long, lat))
56
51
  return false;
57
52
  this._pointObjects[key].long = long;
58
53
  this._pointObjects[key].lat = lat;
59
- var meta = this._metaCalculater.getFlooredMeta(long, lat);
54
+ const meta = this._metaCalculater.getFlooredMeta(long, lat);
60
55
  this._pointObjects[key].posIndex = meta.index;
61
- var _a = this._findAPoint(meta.index), data0 = _a.data0, data1 = _a.data1, interpolated = _a.interpolated;
56
+ const { data0, data1, interpolated } = this._findAPoint(meta.index);
62
57
  this._pointObjects[key].callback(data0, data1, interpolated);
63
58
  return true;
64
- };
59
+ }
65
60
  /**
66
61
  * @param {Number} ratio 0-1
67
62
  * @param {} textureData0
68
63
  * @param {*} textureData1
69
64
  */
70
- PointCoordinatesDataCalculator.prototype.updateData = function (ratio, textureData0, textureData1) {
71
- if (textureData0 === void 0) { textureData0 = null; }
72
- if (textureData1 === void 0) { textureData1 = null; }
65
+ updateData(ratio, textureData0 = null, textureData1 = null) {
73
66
  if (!textureData0 && !textureData1) {
74
67
  this._pushPointCallBackEmpty();
75
68
  return;
@@ -80,32 +73,30 @@ var PointCoordinatesDataCalculator = /** @class */ (function () {
80
73
  }
81
74
  this._ratio = ratio;
82
75
  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;
76
+ }
77
+ _findAPoint(posIndex) {
78
+ const data0 = this._texture0[posIndex];
79
+ const data1 = this._texture1[posIndex];
80
+ const interpolated = data0 * (1 - this._ratio) + data1 * this._ratio;
81
+ return { data0, data1, interpolated };
82
+ }
83
+ _pushPointCallbackAll() {
84
+ for (const key in this._pointObjects) {
85
+ const { posIndex, callback } = this._pointObjects[key];
86
+ const { data0, data1, interpolated } = this._findAPoint(posIndex);
94
87
  callback(data0, data1, interpolated);
95
88
  }
96
- };
97
- PointCoordinatesDataCalculator.prototype._pushPointCallBackEmpty = function () {
98
- for (var key in this._pointObjects) {
99
- var callback = this._pointObjects[key].callback;
89
+ }
90
+ _pushPointCallBackEmpty() {
91
+ for (const key in this._pointObjects) {
92
+ const { callback } = this._pointObjects[key];
100
93
  callback(null, null, null);
101
94
  }
102
- };
103
- PointCoordinatesDataCalculator.prototype.flush = function () {
95
+ }
96
+ flush() {
104
97
  this._pointObjects = {};
105
- };
106
- return PointCoordinatesDataCalculator;
107
- }());
108
- exports.default = PointCoordinatesDataCalculator;
98
+ }
99
+ }
109
100
  // function test() {
110
101
  // const cp = window.plugin.getPointCoordinatesDataCalculator();
111
102
  // const bbox = [-15, 25, 70, 60];
@@ -1,21 +1,17 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- var PointCoordsMeta = /** @class */ (function () {
4
- function PointCoordsMeta(bbox, width, height) {
1
+ export default class PointCoordsMeta {
2
+ constructor(bbox, width, height) {
5
3
  this._bbox = bbox;
6
4
  this._width = width;
7
5
  this._height = height;
8
6
  this._xRatio = this._width / (this._bbox[2] - this._bbox[0]);
9
7
  this._yRatio = this._height / (this._bbox[3] - this._bbox[1]);
10
8
  }
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;
9
+ getFlooredMeta(long, lat) {
10
+ let x = (long - this._bbox[0]) * this._xRatio;
11
+ let y = (this._bbox[3] - lat) * this._yRatio;
14
12
  x = x > 0 ? x - 1 : 0;
15
13
  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
- }());
21
- exports.default = PointCoordsMeta;
14
+ const index = Math.floor(y) * this._width + Math.floor(x);
15
+ return { index };
16
+ }
17
+ }
package/util/index.js CHANGED
@@ -1,57 +1,13 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
36
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
37
- };
38
- Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.heatwavedatamanager = exports.programs = exports.webglobe = exports.geometry = exports.shaderfunctions = exports.webglobjectbuilders = void 0;
40
- var webglobjectbuilders = __importStar(require("./webglobjectbuilders"));
41
- exports.webglobjectbuilders = webglobjectbuilders;
42
- var shaderfunctions = __importStar(require("./shaderfunctions"));
43
- exports.shaderfunctions = shaderfunctions;
44
- var geometry = __importStar(require("./geometry"));
45
- exports.geometry = geometry;
46
- var webglobe = __importStar(require("./webglobe"));
47
- exports.webglobe = webglobe;
48
- var programs = __importStar(require("./programs"));
49
- exports.programs = programs;
50
- var heatwavedatamanager = __importStar(require("./heatwavedatamanager"));
51
- exports.heatwavedatamanager = heatwavedatamanager;
52
- __exportStar(require("./webglobe"), exports);
53
- __exportStar(require("./webglobjectbuilders"), exports);
54
- __exportStar(require("./shaderfunctions"), exports);
55
- __exportStar(require("./geometry"), exports);
56
- __exportStar(require("./programs"), exports);
57
- __exportStar(require("./heatwavedatamanager"), exports);
1
+ import * as webglobjectbuilders from './webglobjectbuilders';
2
+ import * as shaderfunctions from './shaderfunctions';
3
+ import * as geometry from './geometry';
4
+ import * as webglobe from './webglobe';
5
+ import * as programs from './programs';
6
+ import * as heatwavedatamanager from './heatwavedatamanager';
7
+ export { webglobjectbuilders, shaderfunctions, geometry, webglobe, programs, heatwavedatamanager };
8
+ export * from './webglobe';
9
+ export * from './webglobjectbuilders';
10
+ export * from './shaderfunctions';
11
+ export * from './geometry';
12
+ export * from './programs';
13
+ export * from './heatwavedatamanager';
@@ -1,5 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createWorker = void 0;
4
- var createWorker = function () { return new Worker(new URL('./web-worker.js', import.meta.url), { type: 'module' }); };
5
- exports.createWorker = createWorker;
1
+ const createWorker = () => new Worker(new URL('./web-worker.js', import.meta.url), { type: 'module' });
2
+ export { createWorker };
@@ -1,8 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GEOMETRY = exports.TimeTrackInterpolator = void 0;
4
- var search_binary_1 = require("../../algorithms/search-binary");
5
- var methods_1 = require("../../../Math/methods");
1
+ import { findFirstIndexInRange } from '../../algorithms/search-binary';
2
+ import { sphericalLinearInterpolation_Cartesian3d, sphericalLinearInterpolation_Mercator, } from '../../../Math/methods';
6
3
  /**
7
4
  * @typedef {Array<number>} vec3 [x, y, z]
8
5
  * @typedef {Array<number>} vec2 [x, y]
@@ -10,20 +7,18 @@ var methods_1 = require("../../../Math/methods");
10
7
  * @typedef {number} fraction a number between 0 and 1
11
8
  * @typedef {Array<number>} wgs84 [long, lat]
12
9
  */
13
- var GEOMETRY = Object.freeze({
10
+ const GEOMETRY = Object.freeze({
14
11
  CARTESIAN3D: 0,
15
12
  MERCATOR: 1,
16
13
  });
17
- exports.GEOMETRY = GEOMETRY;
18
- var TimeTrackInterpolator = /** @class */ (function () {
14
+ class TimeTrackInterpolator {
19
15
  /**
20
16
  * @typedef Timetrack
21
17
  * @property {Array<vec4>}} coordinates [x,y,z, length]
22
18
  * @property {Array<Number>} times
23
19
  * @param {Array<Timetrack>} timeTracks
24
20
  */
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;
21
+ constructor({ timeTracks, bbox = null, geometry = GEOMETRY.CARTESIAN3D } = {}) {
27
22
  this.timeTracks = null;
28
23
  this.timeTracksStartTimes = null;
29
24
  this.geometry = geometry;
@@ -32,50 +27,49 @@ var TimeTrackInterpolator = /** @class */ (function () {
32
27
  if (bbox)
33
28
  this.setBbox(bbox);
34
29
  }
35
- TimeTrackInterpolator.prototype.setGeometry = function (geometry) {
30
+ setGeometry(geometry) {
36
31
  if (geometry !== GEOMETRY.CARTESIAN3D && geometry !== GEOMETRY.MERCATOR) {
37
32
  throw new Error('Invalid geometry');
38
33
  }
39
34
  this.geometry = geometry;
40
- };
41
- TimeTrackInterpolator.prototype.setTimetracks = function (timeTracks) {
35
+ }
36
+ setTimetracks(timeTracks) {
42
37
  this.timeTracks = timeTracks;
43
- };
44
- TimeTrackInterpolator.prototype.interpolate = function (time) {
45
- var _a = this, timeTracks = _a.timeTracks, geometry = _a.geometry;
38
+ }
39
+ interpolate(time) {
40
+ const { timeTracks, geometry } = this;
46
41
  if (!timeTracks) {
47
42
  return null;
48
43
  }
49
- var resultArray = [];
50
- var info = {
44
+ const resultArray = [];
45
+ const info = {
51
46
  outOfRange: 0,
52
47
  processed: 0,
53
48
  };
54
- for (var i = 0; i < timeTracks.length; i++) {
55
- var _b = timeTracks[i], times = _b.times, coordinates = _b.coordinates;
49
+ for (let i = 0; i < timeTracks.length; i++) {
50
+ const { times, coordinates } = timeTracks[i];
56
51
  if (times[times.length - 1] < time)
57
52
  continue;
58
53
  info.processed++;
59
- var timeIndex = (0, search_binary_1.findFirstIndexInRange)(times, time);
54
+ const timeIndex = findFirstIndexInRange(times, time);
60
55
  if (timeIndex === null) {
61
56
  info.outOfRange++;
62
57
  continue;
63
58
  }
64
- var timeFraction = (time - times[timeIndex]) / (times[timeIndex + 1] - times[timeIndex]);
65
- var interpolated = (geometry === GEOMETRY.CARTESIAN3D) ?
66
- (0, methods_1.sphericalLinearInterpolation_Cartesian3d)(coordinates[timeIndex], coordinates[timeIndex + 1], timeFraction) :
67
- (0, methods_1.sphericalLinearInterpolation_Mercator)(coordinates[timeIndex], coordinates[timeIndex + 1], timeFraction);
68
- resultArray.push.apply(resultArray, interpolated);
59
+ const timeFraction = (time - times[timeIndex]) / (times[timeIndex + 1] - times[timeIndex]);
60
+ const interpolated = (geometry === GEOMETRY.CARTESIAN3D) ?
61
+ sphericalLinearInterpolation_Cartesian3d(coordinates[timeIndex], coordinates[timeIndex + 1], timeFraction) :
62
+ sphericalLinearInterpolation_Mercator(coordinates[timeIndex], coordinates[timeIndex + 1], timeFraction);
63
+ resultArray.push(...interpolated);
69
64
  }
70
65
  return new Float32Array(resultArray);
71
- };
66
+ }
72
67
  // 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
- }());
81
- exports.TimeTrackInterpolator = TimeTrackInterpolator;
68
+ _orderTimeTracks() {
69
+ this.timeTracks.sort((a, b) => a.times[0] - b.times[0]);
70
+ }
71
+ _setStartTimes() {
72
+ this.timeTracksStartTimes = this.timeTracks.map(tt => tt.times[0]);
73
+ }
74
+ }
75
+ export { TimeTrackInterpolator, GEOMETRY };