@pirireis/webglobeplugins 0.9.9 → 0.9.11
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 +15 -0
- package/Math/arc.js +65 -0
- package/Math/bounds/line-bbox.js +190 -0
- package/Math/constants.js +9 -0
- package/Math/frustum/camera.js +24 -0
- package/Math/frustum/from-globeinfo.js +48 -0
- package/Math/frustum/types.js +2 -0
- package/Math/globe-util/horizon-plane.js +112 -0
- package/Math/index.js +1 -0
- package/Math/juction/arc-plane.js +83 -0
- package/Math/juction/line-sphere.js +25 -0
- package/Math/juction/plane-plane.js +58 -0
- package/Math/line.js +58 -0
- package/Math/matrix4.js +1 -0
- package/Math/methods.js +206 -0
- package/Math/plane.js +62 -0
- package/Math/quaternion.js +108 -0
- package/Math/types.js +2 -0
- package/Math/utils.js +4 -0
- package/Math/vec3.js +129 -0
- package/algorithms/search-binary.js +19 -0
- package/altitude-locator/adaptors.js +1 -0
- package/altitude-locator/draw-subset-obj.js +19 -0
- package/altitude-locator/keymethod.js +1 -0
- package/altitude-locator/plugin.js +357 -0
- package/altitude-locator/types.js +23 -0
- package/arrowfield/adaptor.js +15 -0
- package/arrowfield/index.js +10 -0
- package/arrowfield/plugin.js +89 -0
- package/bearing-line/index.js +8 -0
- package/bearing-line/plugin.js +474 -0
- package/circle-line-chain/chain-list-map.js +211 -0
- package/circle-line-chain/init.js +1 -0
- package/circle-line-chain/plugin.js +449 -0
- package/circle-line-chain/util.js +5 -0
- package/compass-rose/compass-rose-padding-flat.js +247 -0
- package/compass-rose/compass-text-writer.js +161 -0
- package/compass-rose/index.js +7 -0
- package/compassrose/compassrose.js +300 -0
- package/compassrose/index.js +8 -0
- package/globe-types.js +1 -0
- package/heatwave/index.js +10 -0
- package/heatwave/isobar/objectarraylabels.js +206 -0
- package/heatwave/isobar/plugin.js +362 -0
- package/heatwave/isobar/quadtreecontours.js +316 -0
- package/heatwave/plugins/heatwaveglobeshell.js +224 -0
- package/index.js +11 -11
- package/jest.config.js +7 -0
- package/package.json +4 -4
- package/partialrings/buffer-manager.js +113 -0
- package/partialrings/index.js +41 -0
- package/partialrings/plugin.js +171 -0
- package/partialrings/program.js +197 -0
- package/pin/pin-object-array.js +308 -0
- package/pin/pin-point-totem.js +61 -0
- package/point-heat-map/adaptors/timetracksplugin-format-to-this.js +66 -0
- package/point-heat-map/index.js +1 -0
- package/point-heat-map/plugin-webworker.js +131 -0
- package/point-heat-map/point-to-heat-map-flow.js +129 -0
- package/point-tracks/key-methods.js +5 -0
- package/point-tracks/plugin.js +353 -0
- package/programs/arrowfield/index.js +7 -0
- package/programs/arrowfield/logic.js +149 -0
- package/programs/arrowfield/object.js +68 -0
- package/programs/data2legend/density-to-legend.js +77 -0
- package/programs/data2legend/point-to-density-texture.js +75 -0
- package/programs/float2legendwithratio/index.js +8 -0
- package/programs/float2legendwithratio/logic.js +125 -0
- package/programs/float2legendwithratio/object.js +113 -0
- package/programs/globe-util/is-globe-moved.js +22 -0
- package/programs/globeshell/index.js +8 -0
- package/programs/globeshell/noise/noises.js +1 -0
- package/programs/globeshell/wiggle/index.js +8 -0
- package/programs/globeshell/wiggle/logic.js +252 -0
- package/programs/globeshell/wiggle/object.js +74 -0
- package/programs/helpers/blender/index.js +1 -0
- package/programs/helpers/blender/program.js +62 -0
- package/programs/helpers/fadeaway/index.js +7 -0
- package/programs/helpers/fadeaway/logic.js +50 -0
- package/programs/helpers/fadeaway/object.js +21 -0
- package/programs/helpers/index.js +8 -0
- package/programs/index.js +58 -0
- package/programs/interface.js +1 -0
- package/programs/line-on-globe/angled-line.js +117 -0
- package/programs/line-on-globe/circle-accurate-3d.js +91 -0
- package/programs/line-on-globe/circle-accurate-flat.js +158 -0
- package/programs/line-on-globe/circle-accurate.js +108 -0
- package/programs/line-on-globe/circle.js +102 -0
- package/programs/line-on-globe/degree-padding-around-circle-3d.js +109 -0
- package/programs/line-on-globe/index.js +1 -0
- package/programs/line-on-globe/lines-color-instanced-flat.js +91 -0
- package/programs/line-on-globe/linestrip.js +110 -0
- package/programs/line-on-globe/naive-accurate-flexible.js +125 -0
- package/programs/line-on-globe/to-the-surface.js +82 -0
- package/programs/line-on-globe/util.js +8 -0
- package/programs/picking/pickable-renderer.js +104 -0
- package/programs/point-on-globe/element-globe-surface-glow.js +102 -0
- package/programs/point-on-globe/element-point-glow.js +85 -0
- package/programs/point-on-globe/square-pixel-point.js +125 -0
- package/programs/programcache.js +131 -0
- package/programs/rings/distancering/circleflatprogram.js +114 -0
- package/programs/rings/distancering/circlepaddingfreeangleprogram.js +358 -0
- package/programs/rings/distancering/circlepaddysharedbuffer.js +433 -0
- package/programs/rings/distancering/index.js +14 -0
- package/programs/rings/distancering/paddyflatprogram.js +119 -0
- package/programs/rings/distancering/paddyflatprogram2d.js +121 -0
- package/programs/rings/distancering/paddyflatprogram3d.js +119 -0
- package/programs/rings/distancering/shader.js +1 -0
- package/programs/rings/index.js +17 -0
- package/programs/rings/partial-ring/piece-of-pie.js +173 -0
- package/programs/totems/camerauniformblock.js +147 -0
- package/programs/totems/canvas-webglobe-info.js +102 -0
- package/programs/totems/gpu-selection-uniform-block.js +104 -0
- package/programs/totems/index.js +40 -0
- package/programs/two-d/pixel-circle.js +1 -0
- package/programs/two-d/pixel-padding-for-compass.js +101 -0
- package/programs/util.js +18 -0
- package/programs/vectorfields/index.js +23 -0
- package/programs/vectorfields/logics/drawrectangleparticles.js +66 -0
- package/programs/vectorfields/logics/index.js +12 -0
- package/programs/vectorfields/logics/pixelbased.js +86 -0
- package/programs/vectorfields/logics/ubo.js +57 -0
- package/programs/vectorfields/pingpongbuffermanager.js +80 -0
- package/rangerings/enum.js +5 -0
- package/rangerings/index.js +15 -0
- package/rangerings/plugin.js +610 -0
- package/rangerings/rangeringangletext.js +341 -0
- package/rangerings/ring-account.js +134 -0
- package/shaders/fragment-toy/firework.js +4 -0
- package/shaders/fragment-toy/singularity.js +5 -0
- package/shape-on-terrain/arc/naive/plugin.js +252 -0
- package/timetracks/adaptors-line-strip.js +82 -0
- package/timetracks/adaptors.js +136 -0
- package/timetracks/index.js +19 -0
- package/timetracks/plugin-line-strip.js +254 -0
- package/timetracks/plugin.js +262 -0
- package/timetracks/program-line-strip.js +418 -0
- package/timetracks/program.js +466 -0
- package/timetracks/programpoint-line-strip.js +101 -0
- package/timetracks/programpoint.js +101 -0
- package/types.js +15 -0
- package/util/account/bufferoffsetmanager.js +202 -0
- package/util/account/index.js +23 -0
- package/util/account/single-attribute-buffer-management/buffer-manager.js +112 -0
- package/util/account/single-attribute-buffer-management/buffer-orchestrator.js +180 -0
- package/util/account/single-attribute-buffer-management/index.js +9 -0
- package/util/account/single-attribute-buffer-management/object-store.js +53 -0
- package/util/account/single-attribute-buffer-management/types.js +2 -0
- package/util/account/util.js +24 -0
- package/util/algorithms/index.js +1 -0
- package/util/algorithms/search-binary.js +28 -0
- package/util/check/get.js +18 -0
- package/util/check/index.js +1 -0
- package/util/check/typecheck.js +51 -0
- package/util/geometry/index.js +53 -0
- package/util/gl-util/buffer/attribute-loader.js +81 -0
- package/util/gl-util/buffer/index.js +6 -0
- package/util/gl-util/buffer/types.js +1 -0
- package/util/gl-util/draw-options/methods.js +38 -0
- package/util/gl-util/draw-options/types.js +15 -0
- package/util/gl-util/uniform-block/manager.js +168 -0
- package/util/gl-util/uniform-block/shader.js +1 -0
- package/util/gl-util/uniform-block/types.js +8 -0
- package/util/heatwavedatamanager/datamanager.js +212 -0
- package/util/heatwavedatamanager/index.js +10 -0
- package/util/heatwavedatamanager/pointcoordinatesdatacalculator.js +125 -0
- package/util/heatwavedatamanager/pointcoordsmeta.js +21 -0
- package/util/index.js +57 -0
- package/util/interpolation/index.js +1 -0
- package/util/interpolation/timetrack/index.js +5 -0
- package/util/interpolation/timetrack/timetrack-interpolator.js +81 -0
- package/util/interpolation/timetrack/web-worker-str.js +5 -0
- package/util/interpolation/timetrack/web-worker.js +48 -0
- package/util/jshelpers/data-filler.js +20 -0
- package/util/jshelpers/equality.js +20 -0
- package/util/jshelpers/index.js +37 -0
- package/util/jshelpers/timefilters.js +32 -0
- package/util/picking/fence.js +46 -0
- package/util/picking/picker-displayer.js +145 -0
- package/util/programs/draw-texture-on-canvas.js +71 -0
- package/util/programs/index.js +17 -0
- package/util/programs/shapesonglobe.js +174 -0
- package/util/programs/supersampletotextures.js +107 -0
- package/util/programs/texturetoglobe.js +132 -0
- package/util/shaderfunctions/geometrytransformations.js +45 -0
- package/util/shaderfunctions/index.js +18 -0
- package/util/shaderfunctions/nodata.js +5 -0
- package/util/shaderfunctions/noisefunctions.js +13 -0
- package/util/surface-line-data/arc-bboxes.js +25 -0
- package/util/surface-line-data/arcs-to-cuts.js +53 -0
- package/util/surface-line-data/cut-arc.js +1 -0
- package/util/surface-line-data/flow.js +28 -0
- package/util/surface-line-data/rbush-manager.js +1 -0
- package/util/surface-line-data/types.js +1 -0
- package/util/surface-line-data/web-worker.js +1 -0
- package/util/webglobe/gldefaultstates.js +7 -0
- package/util/webglobe/index.js +18 -0
- package/util/webglobe/rasteroverlay.js +80 -0
- package/util/webglobjectbuilders.js +393 -0
- package/util/webglobjectbuilders1.js +238 -0
- package/waveparticles/adaptor.js +18 -0
- package/waveparticles/index.js +10 -0
- package/waveparticles/plugin.js +271 -0
- package/wind/imagetovectorfieldandmagnitude.js +35 -0
- package/wind/index.js +14 -0
- package/wind/plugin.js +724 -0
- package/wind/vectorfieldimage.js +25 -0
- package/write-text/attached-text-writer.js +93 -0
- package/write-text/context-text.js +105 -0
- package/write-text/context-text3.js +160 -0
- package/write-text/index.js +5 -0
- package/write-text/writer-plugin.js +8 -0
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* todo:
|
|
4
|
+
* data must be processed before being set to the cache
|
|
5
|
+
*/
|
|
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 () {
|
|
53
|
+
/**
|
|
54
|
+
*
|
|
55
|
+
* @param {Array<number>} timeEpocs | array of time epocs
|
|
56
|
+
* @param {Function} fetchMethod | fetchMethod(time) => Promise<data>
|
|
57
|
+
* @param {boolean} autoDownload | auto download data or not
|
|
58
|
+
*/
|
|
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; });
|
|
62
|
+
this._datas = [];
|
|
63
|
+
this._datas.length = timeEpocs.length;
|
|
64
|
+
// in construction
|
|
65
|
+
this._dataPromises = [];
|
|
66
|
+
this._dataPromises.length = timeEpocs.length;
|
|
67
|
+
this._fetchMethod = fetchMethod;
|
|
68
|
+
this._callbackmethods = [];
|
|
69
|
+
this._callbackmethodOwners = [];
|
|
70
|
+
this._lastTime = -1;
|
|
71
|
+
this._lastIndex = -1;
|
|
72
|
+
this.autoDownload(autoDownload);
|
|
73
|
+
}
|
|
74
|
+
DataManager.prototype.autoDownload = function (bool, time) {
|
|
75
|
+
var _this = this;
|
|
76
|
+
if (!bool) {
|
|
77
|
+
this._autoDownload = false;
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
var index = this._lastIndex === -1 ? 0 : this._lastIndex;
|
|
81
|
+
if (time !== undefined) {
|
|
82
|
+
if (time < this._timeEpocs[0] || time > this._timeEpocs[this._timeEpocs.length - 1]) {
|
|
83
|
+
this._autoDownload = bool;
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
index = this._findIndex(time);
|
|
87
|
+
}
|
|
88
|
+
if (this._downloadStartIndex === index && this._autoDownload === bool)
|
|
89
|
+
return;
|
|
90
|
+
this._downloadStartIndex = index;
|
|
91
|
+
this._autoDownload = bool;
|
|
92
|
+
var recursion = function (startId, currentDownloadId) {
|
|
93
|
+
if (startId !== _this._downloadStartIndex)
|
|
94
|
+
return;
|
|
95
|
+
if (currentDownloadId < _this._timeEpocs.length && _this._autoDownload) {
|
|
96
|
+
_this._getData(currentDownloadId).then(function () {
|
|
97
|
+
recursion(startId, currentDownloadId + 1);
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
recursion(index, index);
|
|
102
|
+
// save index as start index
|
|
103
|
+
//start recursive download
|
|
104
|
+
// use started id as a flag to stop the download
|
|
105
|
+
};
|
|
106
|
+
/**
|
|
107
|
+
* @param {number} time
|
|
108
|
+
* It looks like async function is not needed here. changes just overwrites the previous changes.
|
|
109
|
+
*/
|
|
110
|
+
DataManager.prototype.updateTime = function (time) {
|
|
111
|
+
var _this = this;
|
|
112
|
+
if (time < this._timeEpocs[0] || time > this._timeEpocs[this._timeEpocs.length - 1]) {
|
|
113
|
+
this._dontRender();
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
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);
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
};
|
|
127
|
+
DataManager.prototype.register = function (key, callback) {
|
|
128
|
+
if (this._callbackmethodOwners.indexOf(key) !== -1) {
|
|
129
|
+
console.warn("key already registered, old one is unregistered");
|
|
130
|
+
this.unregister(key);
|
|
131
|
+
}
|
|
132
|
+
this._callbackmethods.push(callback);
|
|
133
|
+
this._callbackmethodOwners.push(key);
|
|
134
|
+
if (this._lastIndex !== -1)
|
|
135
|
+
callback(this._ratio, this._datas[this._lastIndex - 1], this._datas[this._lastIndex]);
|
|
136
|
+
};
|
|
137
|
+
/**
|
|
138
|
+
* @param {*} key | id of the owner of the callback
|
|
139
|
+
*/
|
|
140
|
+
DataManager.prototype.unregister = function (key) {
|
|
141
|
+
var index = this._callbackmethodOwners.indexOf(key);
|
|
142
|
+
if (index !== -1) {
|
|
143
|
+
this._callbackmethods.splice(index, 1);
|
|
144
|
+
this._callbackmethodOwners.splice(index, 1);
|
|
145
|
+
}
|
|
146
|
+
if (this._callbackmethods.length === 0) {
|
|
147
|
+
this.free();
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
DataManager.prototype.free = function () {
|
|
151
|
+
this._callbackmethods = [];
|
|
152
|
+
this._callbackmethodOwners = [];
|
|
153
|
+
this._autoDownload = false;
|
|
154
|
+
};
|
|
155
|
+
DataManager.prototype._findIndex = function (time) {
|
|
156
|
+
var _timeEpocs = this._timeEpocs;
|
|
157
|
+
var index = this._lastIndex === -1 ? 1 : this._lastIndex;
|
|
158
|
+
if (this)
|
|
159
|
+
if (time < _timeEpocs[index - 1]) {
|
|
160
|
+
while (index > 1 && time < _timeEpocs[index - 1]) {
|
|
161
|
+
index--;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
else if (time > _timeEpocs[index]) {
|
|
165
|
+
while (index < _timeEpocs.length - 1 && time > _timeEpocs[index]) {
|
|
166
|
+
index++;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
return index;
|
|
170
|
+
};
|
|
171
|
+
DataManager.prototype._getRatio = function (time, index) {
|
|
172
|
+
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));
|
|
178
|
+
}
|
|
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 () {
|
|
208
|
+
this._pushCallback(0, [null, null]);
|
|
209
|
+
};
|
|
210
|
+
return DataManager;
|
|
211
|
+
}());
|
|
212
|
+
exports.default = DataManager;
|
|
@@ -0,0 +1,10 @@
|
|
|
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;
|
|
@@ -0,0 +1,125 @@
|
|
|
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
|
+
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) {
|
|
12
|
+
this._pointObjects = {};
|
|
13
|
+
this._ratio = 0.0;
|
|
14
|
+
this._bbox = bbox;
|
|
15
|
+
this._width = width;
|
|
16
|
+
this._height = height;
|
|
17
|
+
this._metaCalculater = new pointcoordsmeta_1.default(bbox, width, height);
|
|
18
|
+
this._texture0 = null;
|
|
19
|
+
this._texture1 = null;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
*
|
|
23
|
+
* @param {*} key
|
|
24
|
+
* @param {*} lat
|
|
25
|
+
* @param {*} long
|
|
26
|
+
* @param {*} callback | callback(data0, data1, interpolated)
|
|
27
|
+
*/
|
|
28
|
+
PointCoordinatesDataCalculator.prototype.registerPoint = function (key, long, lat, callback) {
|
|
29
|
+
if (key in this._pointObjects) {
|
|
30
|
+
console.warn("key already registered, old one is unregistered");
|
|
31
|
+
this.unregisterPoint(key);
|
|
32
|
+
}
|
|
33
|
+
if (!this._isInBBox(long, lat))
|
|
34
|
+
return false;
|
|
35
|
+
var meta = this._metaCalculater.getFlooredMeta(long, lat);
|
|
36
|
+
this._pointObjects[key] = pointObject(long, lat, meta.index, callback);
|
|
37
|
+
if (this._texture0 && this._texture1) {
|
|
38
|
+
var _a = this._findAPoint(meta.index), data0 = _a.data0, data1 = _a.data1, interpolated = _a.interpolated;
|
|
39
|
+
callback(data0, data1, interpolated);
|
|
40
|
+
}
|
|
41
|
+
return true;
|
|
42
|
+
};
|
|
43
|
+
PointCoordinatesDataCalculator.prototype._isInBBox = function (long, lat) {
|
|
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) {
|
|
47
|
+
if (!(key in this._pointObjects))
|
|
48
|
+
return false;
|
|
49
|
+
delete this._pointObjects[key];
|
|
50
|
+
return true;
|
|
51
|
+
};
|
|
52
|
+
PointCoordinatesDataCalculator.prototype.updatePoint = function (key, long, lat) {
|
|
53
|
+
if (!(key in this._pointObjects))
|
|
54
|
+
return false;
|
|
55
|
+
if (!this._isInBBox(long, lat))
|
|
56
|
+
return false;
|
|
57
|
+
this._pointObjects[key].long = long;
|
|
58
|
+
this._pointObjects[key].lat = lat;
|
|
59
|
+
var meta = this._metaCalculater.getFlooredMeta(long, lat);
|
|
60
|
+
this._pointObjects[key].posIndex = meta.index;
|
|
61
|
+
var _a = this._findAPoint(meta.index), data0 = _a.data0, data1 = _a.data1, interpolated = _a.interpolated;
|
|
62
|
+
this._pointObjects[key].callback(data0, data1, interpolated);
|
|
63
|
+
return true;
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* @param {Number} ratio 0-1
|
|
67
|
+
* @param {} textureData0
|
|
68
|
+
* @param {*} textureData1
|
|
69
|
+
*/
|
|
70
|
+
PointCoordinatesDataCalculator.prototype.updateData = function (ratio, textureData0, textureData1) {
|
|
71
|
+
if (textureData0 === void 0) { textureData0 = null; }
|
|
72
|
+
if (textureData1 === void 0) { textureData1 = null; }
|
|
73
|
+
if (!textureData0 && !textureData1) {
|
|
74
|
+
this._pushPointCallBackEmpty();
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
if (textureData0 && textureData1) {
|
|
78
|
+
this._texture0 = textureData0;
|
|
79
|
+
this._texture1 = textureData1;
|
|
80
|
+
}
|
|
81
|
+
this._ratio = ratio;
|
|
82
|
+
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;
|
|
94
|
+
callback(data0, data1, interpolated);
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
PointCoordinatesDataCalculator.prototype._pushPointCallBackEmpty = function () {
|
|
98
|
+
for (var key in this._pointObjects) {
|
|
99
|
+
var callback = this._pointObjects[key].callback;
|
|
100
|
+
callback(null, null, null);
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
PointCoordinatesDataCalculator.prototype.flush = function () {
|
|
104
|
+
this._pointObjects = {};
|
|
105
|
+
};
|
|
106
|
+
return PointCoordinatesDataCalculator;
|
|
107
|
+
}());
|
|
108
|
+
exports.default = PointCoordinatesDataCalculator;
|
|
109
|
+
// function test() {
|
|
110
|
+
// const cp = window.plugin.getPointCoordinatesDataCalculator();
|
|
111
|
+
// const bbox = [-15, 25, 70, 60];
|
|
112
|
+
// cp.registerPoint("left up", -15, 60, (data0, data1, interpolated) => {
|
|
113
|
+
// console.log("left up", data0, data1, interpolated);
|
|
114
|
+
// });
|
|
115
|
+
// cp.registerPoint("right up", 70, 60, (data0, data1, interpolated) => {
|
|
116
|
+
// console.log("right up", data0, data1, interpolated);
|
|
117
|
+
// });
|
|
118
|
+
// cp.registerPoint("left down", -15, 25, (data0, data1, interpolated) => {
|
|
119
|
+
// console.log("right down", data0, data1, interpolated);
|
|
120
|
+
// });
|
|
121
|
+
// cp.registerPoint("right down", 70, 25, (data0, data1, interpolated) => {
|
|
122
|
+
// console.log("right down", data0, data1, interpolated);
|
|
123
|
+
// });
|
|
124
|
+
// return cp;
|
|
125
|
+
// }
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var PointCoordsMeta = /** @class */ (function () {
|
|
4
|
+
function PointCoordsMeta(bbox, width, height) {
|
|
5
|
+
this._bbox = bbox;
|
|
6
|
+
this._width = width;
|
|
7
|
+
this._height = height;
|
|
8
|
+
this._xRatio = this._width / (this._bbox[2] - this._bbox[0]);
|
|
9
|
+
this._yRatio = this._height / (this._bbox[3] - this._bbox[1]);
|
|
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;
|
|
14
|
+
x = x > 0 ? x - 1 : 0;
|
|
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
|
+
}());
|
|
21
|
+
exports.default = PointCoordsMeta;
|
package/util/index.js
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
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);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1,5 @@
|
|
|
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;
|
|
@@ -0,0 +1,81 @@
|
|
|
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");
|
|
6
|
+
/**
|
|
7
|
+
* @typedef {Array<number>} vec3 [x, y, z]
|
|
8
|
+
* @typedef {Array<number>} vec2 [x, y]
|
|
9
|
+
* @typedef {Array<number>} vec4 [x, y, z, w]
|
|
10
|
+
* @typedef {number} fraction a number between 0 and 1
|
|
11
|
+
* @typedef {Array<number>} wgs84 [long, lat]
|
|
12
|
+
*/
|
|
13
|
+
var GEOMETRY = Object.freeze({
|
|
14
|
+
CARTESIAN3D: 0,
|
|
15
|
+
MERCATOR: 1,
|
|
16
|
+
});
|
|
17
|
+
exports.GEOMETRY = GEOMETRY;
|
|
18
|
+
var TimeTrackInterpolator = /** @class */ (function () {
|
|
19
|
+
/**
|
|
20
|
+
* @typedef Timetrack
|
|
21
|
+
* @property {Array<vec4>}} coordinates [x,y,z, length]
|
|
22
|
+
* @property {Array<Number>} times
|
|
23
|
+
* @param {Array<Timetrack>} timeTracks
|
|
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;
|
|
27
|
+
this.timeTracks = null;
|
|
28
|
+
this.timeTracksStartTimes = null;
|
|
29
|
+
this.geometry = geometry;
|
|
30
|
+
if (timeTracks)
|
|
31
|
+
this.setTimetracks(timeTracks);
|
|
32
|
+
if (bbox)
|
|
33
|
+
this.setBbox(bbox);
|
|
34
|
+
}
|
|
35
|
+
TimeTrackInterpolator.prototype.setGeometry = function (geometry) {
|
|
36
|
+
if (geometry !== GEOMETRY.CARTESIAN3D && geometry !== GEOMETRY.MERCATOR) {
|
|
37
|
+
throw new Error('Invalid geometry');
|
|
38
|
+
}
|
|
39
|
+
this.geometry = geometry;
|
|
40
|
+
};
|
|
41
|
+
TimeTrackInterpolator.prototype.setTimetracks = function (timeTracks) {
|
|
42
|
+
this.timeTracks = timeTracks;
|
|
43
|
+
};
|
|
44
|
+
TimeTrackInterpolator.prototype.interpolate = function (time) {
|
|
45
|
+
var _a = this, timeTracks = _a.timeTracks, geometry = _a.geometry;
|
|
46
|
+
if (!timeTracks) {
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
var resultArray = [];
|
|
50
|
+
var info = {
|
|
51
|
+
outOfRange: 0,
|
|
52
|
+
processed: 0,
|
|
53
|
+
};
|
|
54
|
+
for (var i = 0; i < timeTracks.length; i++) {
|
|
55
|
+
var _b = timeTracks[i], times = _b.times, coordinates = _b.coordinates;
|
|
56
|
+
if (times[times.length - 1] < time)
|
|
57
|
+
continue;
|
|
58
|
+
info.processed++;
|
|
59
|
+
var timeIndex = (0, search_binary_1.findFirstIndexInRange)(times, time);
|
|
60
|
+
if (timeIndex === null) {
|
|
61
|
+
info.outOfRange++;
|
|
62
|
+
continue;
|
|
63
|
+
}
|
|
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);
|
|
69
|
+
}
|
|
70
|
+
return new Float32Array(resultArray);
|
|
71
|
+
};
|
|
72
|
+
// 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;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
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 ";
|
|
5
|
+
exports.webworkerStr = webworkerStr;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
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 });
|
|
5
|
+
/* eslint-disable-next-line no-restricted-globals */
|
|
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;
|
|
8
|
+
if (geometry !== null) {
|
|
9
|
+
try {
|
|
10
|
+
interpolator.setGeometry(geometry);
|
|
11
|
+
}
|
|
12
|
+
catch (error) {
|
|
13
|
+
/* eslint-disable-next-line no-restricted-globals */
|
|
14
|
+
self.postMessage({ error: error.message });
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
if (timeTracks !== null) {
|
|
19
|
+
try {
|
|
20
|
+
interpolator.setTimetracks(timeTracks);
|
|
21
|
+
}
|
|
22
|
+
catch (error) {
|
|
23
|
+
/* eslint-disable-next-line no-restricted-globals */
|
|
24
|
+
self.postMessage({ error: error.message });
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
if (time !== null) {
|
|
29
|
+
try {
|
|
30
|
+
var result = interpolator.interpolate(time);
|
|
31
|
+
if (result === null) {
|
|
32
|
+
/* eslint-disable-next-line no-restricted-globals */
|
|
33
|
+
self.postMessage({ error: 'No TimeTracks Data' });
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
/* eslint-disable-next-line no-restricted-globals */
|
|
37
|
+
self.postMessage(result, [result.buffer]);
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
catch (error) {
|
|
41
|
+
/* eslint-disable-next-line no-restricted-globals */
|
|
42
|
+
self.postMessage({ error: error.message });
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
/* eslint-disable-next-line no-restricted-globals */
|
|
47
|
+
self.postMessage(true);
|
|
48
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.populateFloat32Array = void 0;
|
|
4
|
+
var populateFloat32Array = Object.freeze({
|
|
5
|
+
fillFloat32Array: function (length, data) {
|
|
6
|
+
var result = new Float32Array(length);
|
|
7
|
+
result.fill(data);
|
|
8
|
+
return result;
|
|
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++) {
|
|
14
|
+
result.set(listdata, offset);
|
|
15
|
+
offset += listdata.length;
|
|
16
|
+
}
|
|
17
|
+
return result;
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
exports.populateFloat32Array = populateFloat32Array;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.arraysEqual = arraysEqual;
|
|
4
|
+
function arraysEqual(a, b) {
|
|
5
|
+
if (a === b)
|
|
6
|
+
return true;
|
|
7
|
+
if (a == null || b == null)
|
|
8
|
+
return false;
|
|
9
|
+
if (a.length !== b.length)
|
|
10
|
+
return false;
|
|
11
|
+
// If you don't care about the order of the elements inside
|
|
12
|
+
// the array, you should sort both arrays here.
|
|
13
|
+
// Please note that calling sort on an array will modify that array.
|
|
14
|
+
// you might want to clone your array first.
|
|
15
|
+
for (var i = 0; i < a.length; ++i) {
|
|
16
|
+
if (a[i] !== b[i])
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
return true;
|
|
20
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.timefilters = void 0;
|
|
37
|
+
exports.timefilters = __importStar(require("./timefilters"));
|