@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.
- package/Math/angle-calculation.js +9 -11
- package/Math/arc.js +38 -41
- package/Math/bounds/line-bbox.js +79 -83
- package/Math/constants.js +4 -9
- package/Math/frustum/types.js +1 -2
- package/Math/juction/arc-plane.js +33 -36
- package/Math/juction/line-sphere.js +15 -18
- package/Math/juction/plane-plane.js +20 -23
- package/Math/line.js +42 -47
- package/Math/methods.js +69 -92
- package/Math/plane.js +33 -38
- package/Math/quaternion.js +48 -55
- package/Math/types.js +1 -2
- package/Math/utils.js +2 -4
- package/Math/vec3.js +46 -52
- package/algorithms/search-binary.js +5 -8
- package/altitude-locator/draw-subset-obj.js +8 -11
- package/altitude-locator/plugin.js +114 -133
- package/altitude-locator/types.js +1 -3
- package/arrowfield/adaptor.js +3 -7
- package/arrowfield/index.js +3 -10
- package/arrowfield/plugin.js +63 -69
- package/bearing-line/index.js +2 -8
- package/bearing-line/plugin.js +218 -248
- package/circle-line-chain/chain-list-map.js +82 -92
- package/circle-line-chain/plugin.js +147 -182
- package/circle-line-chain/util.js +1 -5
- package/compass-rose/compass-rose-padding-flat.js +111 -140
- package/compass-rose/compass-text-writer.js +63 -75
- package/compass-rose/index.js +3 -7
- package/compassrose/compassrose.js +50 -57
- package/compassrose/index.js +2 -8
- package/heatwave/index.js +3 -10
- package/heatwave/isobar/objectarraylabels.js +50 -56
- package/heatwave/isobar/plugin.js +111 -170
- package/heatwave/isobar/quadtreecontours.js +78 -96
- package/heatwave/plugins/heatwaveglobeshell.js +73 -94
- package/index.js +12 -58
- package/package.json +1 -1
- package/partialrings/buffer-manager.js +32 -70
- package/partialrings/index.js +2 -41
- package/partialrings/plugin.js +55 -98
- package/partialrings/program.js +141 -59
- package/pin/pin-object-array.js +89 -97
- package/pin/pin-point-totem.js +21 -22
- package/point-heat-map/adaptors/timetracksplugin-format-to-this.js +11 -14
- package/point-heat-map/plugin-webworker.js +45 -53
- package/point-heat-map/point-to-heat-map-flow.js +46 -51
- package/point-tracks/key-methods.js +2 -5
- package/point-tracks/plugin.js +141 -170
- package/programs/arrowfield/index.js +2 -7
- package/programs/arrowfield/logic.js +172 -67
- package/programs/arrowfield/object.js +35 -43
- package/programs/data2legend/density-to-legend.js +47 -26
- package/programs/data2legend/point-to-density-texture.js +56 -34
- package/programs/float2legendwithratio/index.js +2 -8
- package/programs/float2legendwithratio/logic.js +88 -45
- package/programs/float2legendwithratio/object.js +45 -54
- package/programs/globe-util/is-globe-moved.js +10 -13
- package/programs/globeshell/index.js +2 -8
- package/programs/globeshell/wiggle/index.js +2 -8
- package/programs/globeshell/wiggle/logic.js +191 -101
- package/programs/globeshell/wiggle/object.js +35 -43
- package/programs/helpers/blender/program.js +36 -22
- package/programs/helpers/fadeaway/index.js +2 -7
- package/programs/helpers/fadeaway/logic.js +36 -17
- package/programs/helpers/fadeaway/object.js +11 -18
- package/programs/helpers/index.js +2 -8
- package/programs/index.js +9 -58
- package/programs/line-on-globe/angled-line.js +95 -39
- package/programs/line-on-globe/circle-accurate-3d.js +86 -39
- package/programs/line-on-globe/circle-accurate-flat.js +116 -64
- package/programs/line-on-globe/circle-accurate.js +113 -46
- package/programs/line-on-globe/circle.js +106 -44
- package/programs/line-on-globe/degree-padding-around-circle-3d.js +89 -42
- package/programs/line-on-globe/lines-color-instanced-flat.js +84 -43
- package/programs/line-on-globe/linestrip.js +126 -63
- package/programs/line-on-globe/naive-accurate-flexible.js +126 -59
- package/programs/line-on-globe/to-the-surface.js +62 -35
- package/programs/line-on-globe/util.js +2 -5
- package/programs/picking/pickable-renderer.js +127 -46
- package/programs/point-on-globe/element-globe-surface-glow.js +83 -46
- package/programs/point-on-globe/element-point-glow.js +112 -47
- package/programs/point-on-globe/square-pixel-point.js +80 -34
- package/programs/programcache.js +14 -19
- package/programs/rings/distancering/circleflatprogram.js +76 -70
- package/programs/rings/distancering/circlepaddingfreeangleprogram.js +168 -194
- package/programs/rings/distancering/circlepaddysharedbuffer.js +121 -200
- package/programs/rings/distancering/index.js +5 -14
- package/programs/rings/distancering/paddyflatprogram.js +87 -70
- package/programs/rings/distancering/paddyflatprogram2d.js +89 -72
- package/programs/rings/distancering/paddyflatprogram3d.js +87 -70
- package/programs/rings/index.js +1 -17
- package/programs/rings/partial-ring/piece-of-pie.js +144 -44
- package/programs/totems/camerauniformblock.js +65 -56
- package/programs/totems/canvas-webglobe-info.js +49 -45
- package/programs/totems/gpu-selection-uniform-block.js +45 -45
- package/programs/totems/index.js +2 -40
- package/programs/two-d/pixel-padding-for-compass.js +94 -36
- package/programs/util.js +7 -10
- package/programs/vectorfields/index.js +3 -23
- package/programs/vectorfields/logics/drawrectangleparticles.js +73 -35
- package/programs/vectorfields/logics/index.js +4 -12
- package/programs/vectorfields/logics/pixelbased.js +94 -41
- package/programs/vectorfields/logics/ubo.js +32 -32
- package/programs/vectorfields/pingpongbuffermanager.js +30 -37
- package/rangerings/enum.js +2 -5
- package/rangerings/index.js +5 -15
- package/rangerings/plugin.js +223 -286
- package/rangerings/rangeringangletext.js +122 -137
- package/rangerings/ring-account.js +53 -75
- package/shaders/fragment-toy/firework.js +55 -4
- package/shaders/fragment-toy/singularity.js +56 -5
- package/timetracks/adaptors-line-strip.js +27 -44
- package/timetracks/adaptors.js +48 -67
- package/timetracks/index.js +5 -19
- package/timetracks/plugin-line-strip.js +65 -79
- package/timetracks/plugin.js +71 -85
- package/timetracks/program-line-strip.js +297 -107
- package/timetracks/program.js +421 -118
- package/timetracks/programpoint-line-strip.js +98 -48
- package/timetracks/programpoint.js +91 -48
- package/util/account/bufferoffsetmanager.js +72 -98
- package/util/account/index.js +3 -23
- package/util/account/single-attribute-buffer-management/buffer-manager.js +44 -48
- package/util/account/single-attribute-buffer-management/buffer-orchestrator.js +68 -98
- package/util/account/single-attribute-buffer-management/index.js +4 -9
- package/util/account/single-attribute-buffer-management/object-store.js +29 -34
- package/util/account/single-attribute-buffer-management/types.js +1 -2
- package/util/account/util.js +2 -8
- package/util/algorithms/search-binary.js +5 -8
- package/util/check/get.js +5 -9
- package/util/check/typecheck.js +13 -24
- package/util/geometry/index.js +10 -18
- package/util/gl-util/buffer/attribute-loader.js +10 -26
- package/util/gl-util/buffer/index.js +2 -5
- package/util/gl-util/draw-options/methods.js +10 -15
- package/util/gl-util/uniform-block/manager.js +69 -72
- package/util/heatwavedatamanager/datamanager.js +56 -119
- package/util/heatwavedatamanager/index.js +3 -10
- package/util/heatwavedatamanager/pointcoordinatesdatacalculator.js +38 -47
- package/util/heatwavedatamanager/pointcoordsmeta.js +9 -13
- package/util/index.js +13 -57
- package/util/interpolation/timetrack/index.js +2 -5
- package/util/interpolation/timetrack/timetrack-interpolator.js +30 -36
- package/util/interpolation/timetrack/web-worker-str.js +180 -5
- package/util/interpolation/timetrack/web-worker.js +4 -6
- package/util/jshelpers/data-filler.js +8 -11
- package/util/jshelpers/equality.js +1 -3
- package/util/jshelpers/index.js +2 -37
- package/util/jshelpers/timefilters.js +8 -10
- package/util/picking/fence.js +8 -11
- package/util/picking/picker-displayer.js +49 -58
- package/util/programs/draw-texture-on-canvas.js +41 -26
- package/util/programs/index.js +1 -17
- package/util/programs/shapesonglobe.js +104 -68
- package/util/programs/supersampletotextures.js +45 -43
- package/util/programs/texturetoglobe.js +99 -52
- package/util/shaderfunctions/geometrytransformations.js +323 -35
- package/util/shaderfunctions/index.js +2 -18
- package/util/shaderfunctions/nodata.js +8 -5
- package/util/shaderfunctions/noisefunctions.js +40 -12
- package/util/surface-line-data/arcs-to-cuts.js +20 -23
- package/util/webglobe/gldefaultstates.js +1 -4
- package/util/webglobe/index.js +2 -18
- package/util/webglobe/rasteroverlay.js +36 -41
- package/util/webglobjectbuilders.js +70 -93
- package/util/webglobjectbuilders1.js +63 -82
- package/waveparticles/adaptor.js +7 -10
- package/waveparticles/index.js +3 -10
- package/waveparticles/plugin.js +82 -90
- package/wind/imagetovectorfieldandmagnitude.js +16 -19
- package/wind/index.js +5 -14
- package/wind/plugin.js +454 -291
- package/wind/vectorfieldimage.js +6 -8
- package/write-text/attached-text-writer.js +48 -54
- package/write-text/context-text.js +52 -63
- package/write-text/context-text3.js +71 -80
- 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
|
-
|
|
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
|
-
|
|
60
|
-
|
|
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
|
-
|
|
75
|
-
var _this = this;
|
|
26
|
+
autoDownload(bool, time) {
|
|
76
27
|
if (!bool) {
|
|
77
28
|
this._autoDownload = false;
|
|
78
29
|
return;
|
|
79
30
|
}
|
|
80
|
-
|
|
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
|
-
|
|
93
|
-
if (startId !==
|
|
43
|
+
const recursion = (startId, currentDownloadId) => {
|
|
44
|
+
if (startId !== this._downloadStartIndex)
|
|
94
45
|
return;
|
|
95
|
-
if (currentDownloadId <
|
|
96
|
-
|
|
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
|
-
|
|
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
|
-
|
|
118
|
-
|
|
119
|
-
Promise.all([this._getData(index - 1), this._getData(index)]).then(
|
|
120
|
-
if (
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
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
|
-
|
|
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
|
-
|
|
141
|
-
|
|
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
|
-
|
|
99
|
+
}
|
|
100
|
+
free() {
|
|
151
101
|
this._callbackmethods = [];
|
|
152
102
|
this._callbackmethodOwners = [];
|
|
153
103
|
this._autoDownload = false;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
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
|
-
|
|
120
|
+
}
|
|
121
|
+
_getRatio(time, index) {
|
|
172
122
|
return (time - this._timeEpocs[index - 1]) / (this._timeEpocs[index] - this._timeEpocs[index - 1]);
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
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
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
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
|
-
|
|
211
|
-
}());
|
|
212
|
-
exports.default = DataManager;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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
|
-
|
|
2
|
-
|
|
3
|
-
return
|
|
1
|
+
import PointCoordsMeta from "./pointcoordsmeta";
|
|
2
|
+
const pointObject = (long, lat, posIndex, callback) => {
|
|
3
|
+
return { long, lat, posIndex, callback };
|
|
4
4
|
};
|
|
5
|
-
|
|
6
|
-
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
33
|
+
const { data0, data1, interpolated } = this._findAPoint(meta.index);
|
|
39
34
|
callback(data0, data1, interpolated);
|
|
40
35
|
}
|
|
41
36
|
return true;
|
|
42
|
-
}
|
|
43
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
54
|
+
const meta = this._metaCalculater.getFlooredMeta(long, lat);
|
|
60
55
|
this._pointObjects[key].posIndex = meta.index;
|
|
61
|
-
|
|
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
|
-
|
|
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
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
return { data0
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
for (
|
|
92
|
-
|
|
93
|
-
|
|
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
|
-
|
|
98
|
-
for (
|
|
99
|
-
|
|
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
|
-
|
|
95
|
+
}
|
|
96
|
+
flush() {
|
|
104
97
|
this._pointObjects = {};
|
|
105
|
-
}
|
|
106
|
-
|
|
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
|
-
|
|
2
|
-
|
|
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
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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
|
-
|
|
17
|
-
return { index
|
|
18
|
-
}
|
|
19
|
-
|
|
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
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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
|
-
|
|
2
|
-
|
|
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
|
-
|
|
2
|
-
|
|
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
|
-
|
|
10
|
+
const GEOMETRY = Object.freeze({
|
|
14
11
|
CARTESIAN3D: 0,
|
|
15
12
|
MERCATOR: 1,
|
|
16
13
|
});
|
|
17
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
35
|
+
}
|
|
36
|
+
setTimetracks(timeTracks) {
|
|
42
37
|
this.timeTracks = timeTracks;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
|
|
38
|
+
}
|
|
39
|
+
interpolate(time) {
|
|
40
|
+
const { timeTracks, geometry } = this;
|
|
46
41
|
if (!timeTracks) {
|
|
47
42
|
return null;
|
|
48
43
|
}
|
|
49
|
-
|
|
50
|
-
|
|
44
|
+
const resultArray = [];
|
|
45
|
+
const info = {
|
|
51
46
|
outOfRange: 0,
|
|
52
47
|
processed: 0,
|
|
53
48
|
};
|
|
54
|
-
for (
|
|
55
|
-
|
|
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
|
-
|
|
54
|
+
const timeIndex = findFirstIndexInRange(times, time);
|
|
60
55
|
if (timeIndex === null) {
|
|
61
56
|
info.outOfRange++;
|
|
62
57
|
continue;
|
|
63
58
|
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
resultArray.push
|
|
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
|
-
|
|
74
|
-
this.timeTracks.sort(
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
this.timeTracksStartTimes = this.timeTracks.map(
|
|
78
|
-
}
|
|
79
|
-
|
|
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 };
|