@pirireis/webglobeplugins 0.9.6 → 0.9.7
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/package.json +5 -2
- package/Math/angle-calculation.js +0 -14
- package/Math/arc.ts +0 -76
- package/Math/bounds/line-bbox.js +0 -225
- package/Math/constants.ts +0 -11
- package/Math/frustum/camera.ts +0 -32
- package/Math/frustum/from-globeinfo.ts +0 -63
- package/Math/frustum/types.ts +0 -11
- package/Math/globe-util/horizon-plane.ts +0 -137
- package/Math/index.js +0 -0
- package/Math/juction/arc-plane.ts +0 -114
- package/Math/juction/line-sphere.ts +0 -30
- package/Math/juction/plane-plane.ts +0 -66
- package/Math/line.ts +0 -70
- package/Math/matrix4.ts +0 -0
- package/Math/methods.js +0 -237
- package/Math/plane.ts +0 -86
- package/Math/quaternion.ts +0 -120
- package/Math/roadmap.md +0 -10
- package/Math/types.ts +0 -45
- package/Math/utils.js +0 -3
- package/Math/vec3.ts +0 -155
- package/algorithms/search-binary.js +0 -14
- package/altitude-locator/adaptors.js +0 -0
- package/altitude-locator/draw-subset-obj.js +0 -27
- package/altitude-locator/keymethod.js +0 -0
- package/altitude-locator/plugin.js +0 -439
- package/altitude-locator/types.js +0 -26
- package/arrowfield/adaptor.js +0 -11
- package/arrowfield/index.js +0 -3
- package/arrowfield/plugin.js +0 -128
- package/bearing-line/index.js +0 -2
- package/bearing-line/plugin.js +0 -512
- package/circle-line-chain/chain-list-map.js +0 -221
- package/circle-line-chain/init.js +0 -0
- package/circle-line-chain/plugin.js +0 -469
- package/circle-line-chain/readme.md +0 -57
- package/circle-line-chain/util.js +0 -1
- package/compass-rose/compass-rose-padding-flat.js +0 -266
- package/compass-rose/compass-text-writer.js +0 -173
- package/compass-rose/index.js +0 -3
- package/compassrose/compassrose.js +0 -341
- package/compassrose/index.js +0 -2
- package/depth-locator/readme.md +0 -26
- package/globe-types.ts +0 -13
- package/heatwave/index.js +0 -4
- package/heatwave/isobar/objectarraylabels.js +0 -247
- package/heatwave/isobar/plugin.js +0 -340
- package/heatwave/isobar/quadtreecontours.js +0 -336
- package/heatwave/plugins/heatwaveglobeshell.js +0 -258
- package/jest.config.js +0 -6
- package/partialrings/buffer-manager.js +0 -89
- package/partialrings/goals.md +0 -17
- package/partialrings/index.js +0 -3
- package/partialrings/plugin.js +0 -160
- package/partialrings/program.js +0 -324
- package/pin/pin-object-array.js +0 -381
- package/pin/pin-point-totem.js +0 -77
- package/point-heat-map/adaptors/timetracksplugin-format-to-this.js +0 -78
- package/point-heat-map/index.js +0 -0
- package/point-heat-map/plugin-webworker.js +0 -151
- package/point-heat-map/point-to-heat-map-flow.js +0 -150
- package/point-heat-map/readme.md +0 -15
- package/point-tracks/key-methods.js +0 -3
- package/point-tracks/plugin.js +0 -394
- package/programs/arrowfield/index.js +0 -2
- package/programs/arrowfield/logic.js +0 -286
- package/programs/arrowfield/object.js +0 -89
- package/programs/data2legend/density-to-legend.js +0 -115
- package/programs/data2legend/point-to-density-texture.js +0 -114
- package/programs/float2legendwithratio/index.js +0 -3
- package/programs/float2legendwithratio/logic.js +0 -194
- package/programs/float2legendwithratio/object.js +0 -141
- package/programs/globe-util/is-globe-moved.js +0 -27
- package/programs/globeshell/index.js +0 -2
- package/programs/globeshell/noise/noises.js +0 -0
- package/programs/globeshell/wiggle/index.js +0 -6
- package/programs/globeshell/wiggle/logic.js +0 -371
- package/programs/globeshell/wiggle/object.js +0 -93
- package/programs/helpers/blender/index.js +0 -0
- package/programs/helpers/blender/program.js +0 -91
- package/programs/helpers/fadeaway/index.js +0 -3
- package/programs/helpers/fadeaway/logic.js +0 -76
- package/programs/helpers/fadeaway/object.js +0 -20
- package/programs/helpers/index.js +0 -2
- package/programs/index.js +0 -21
- package/programs/interface.ts +0 -7
- package/programs/line-on-globe/angled-line.js +0 -206
- package/programs/line-on-globe/circle-accurate-3d.js +0 -167
- package/programs/line-on-globe/circle-accurate-flat.js +0 -262
- package/programs/line-on-globe/circle-accurate.js +0 -202
- package/programs/line-on-globe/circle.js +0 -191
- package/programs/line-on-globe/degree-padding-around-circle-3d.js +0 -188
- package/programs/line-on-globe/index.js +0 -0
- package/programs/line-on-globe/lines-color-instanced-flat.js +0 -151
- package/programs/line-on-globe/linestrip.ts +0 -228
- package/programs/line-on-globe/naive-accurate-flexible.js +0 -239
- package/programs/line-on-globe/to-the-surface.js +0 -129
- package/programs/line-on-globe/util.js +0 -8
- package/programs/picking/pickable-renderer.js +0 -216
- package/programs/point-on-globe/element-globe-surface-glow.js +0 -168
- package/programs/point-on-globe/element-point-glow.js +0 -184
- package/programs/point-on-globe/square-pixel-point.js +0 -189
- package/programs/programcache.ts +0 -131
- package/programs/rings/distancering/circleflatprogram.js +0 -136
- package/programs/rings/distancering/circlepaddingfreeangleprogram.js +0 -378
- package/programs/rings/distancering/circlepaddysharedbuffer.js +0 -420
- package/programs/rings/distancering/index.js +0 -5
- package/programs/rings/distancering/paddyflatprogram.js +0 -146
- package/programs/rings/distancering/paddyflatprogram2d.js +0 -150
- package/programs/rings/distancering/paddyflatprogram3d.js +0 -146
- package/programs/rings/distancering/shader.js +0 -0
- package/programs/rings/index.js +0 -1
- package/programs/rings/partial-ring/piece-of-pie.js +0 -315
- package/programs/totems/camerauniformblock.d.ts +0 -48
- package/programs/totems/camerauniformblock.js +0 -197
- package/programs/totems/canvas-webglobe-info.js +0 -136
- package/programs/totems/gpu-selection-uniform-block.js +0 -132
- package/programs/totems/index.ts +0 -2
- package/programs/two-d/pixel-circle.js +0 -0
- package/programs/two-d/pixel-padding-for-compass.js +0 -174
- package/programs/util.js +0 -20
- package/programs/vectorfields/index.js +0 -3
- package/programs/vectorfields/logics/drawrectangleparticles.js +0 -125
- package/programs/vectorfields/logics/index.js +0 -5
- package/programs/vectorfields/logics/pixelbased.js +0 -161
- package/programs/vectorfields/logics/ubo.js +0 -64
- package/programs/vectorfields/pingpongbuffermanager.js +0 -80
- package/publish.bat +0 -60
- package/rangerings/enum.js +0 -3
- package/rangerings/index.js +0 -5
- package/rangerings/plugin.js +0 -649
- package/rangerings/rangeringangletext.js +0 -368
- package/rangerings/ring-account.js +0 -129
- package/shaders/fragment-toy/firework.js +0 -55
- package/shaders/fragment-toy/singularity.js +0 -59
- package/shape-on-terrain/arc/naive/plugin.ts +0 -304
- package/shape-on-terrain/goal.md +0 -12
- package/tests/Math/junction/arc-plane.test.ts +0 -133
- package/tests/Math/junction/plane-plane.test.ts +0 -82
- package/tests/Math/plane.test.ts +0 -43
- package/tests/Math/vec3.test.ts +0 -14
- package/timetracks/adaptors-line-strip.js +0 -80
- package/timetracks/adaptors.js +0 -133
- package/timetracks/index.js +0 -6
- package/timetracks/plugin-line-strip.js +0 -295
- package/timetracks/plugin.js +0 -304
- package/timetracks/program-line-strip.js +0 -688
- package/timetracks/program.js +0 -850
- package/timetracks/programpoint-line-strip.js +0 -175
- package/timetracks/programpoint.js +0 -168
- package/timetracks/readme.md +0 -1
- package/tsconfig.json +0 -22
- package/types.ts +0 -17
- package/util/account/bufferoffsetmanager.js +0 -209
- package/util/account/index.js +0 -6
- package/util/account/single-attribute-buffer-management/buffer-manager.ts +0 -119
- package/util/account/single-attribute-buffer-management/buffer-orchestrator.ts +0 -173
- package/util/account/single-attribute-buffer-management/index.ts +0 -13
- package/util/account/single-attribute-buffer-management/object-store.ts +0 -65
- package/util/account/single-attribute-buffer-management/types.ts +0 -39
- package/util/account/util.js +0 -22
- package/util/algorithms/index.js +0 -0
- package/util/algorithms/search-binary.js +0 -26
- package/util/check/get.js +0 -13
- package/util/check/index.js +0 -0
- package/util/check/typecheck.js +0 -39
- package/util/geometry/index.js +0 -53
- package/util/gl-util/buffer/attribute-loader.ts +0 -85
- package/util/gl-util/buffer/index.ts +0 -6
- package/util/gl-util/buffer/types.ts +0 -13
- package/util/gl-util/draw-options/methods.ts +0 -66
- package/util/gl-util/draw-options/types.ts +0 -28
- package/util/gl-util/uniform-block/manager.ts +0 -187
- package/util/gl-util/uniform-block/roadmap.md +0 -70
- package/util/gl-util/uniform-block/shader.js +0 -0
- package/util/gl-util/uniform-block/types.ts +0 -27
- package/util/heatwavedatamanager/datamanager.js +0 -168
- package/util/heatwavedatamanager/index.js +0 -3
- package/util/heatwavedatamanager/pointcoordinatesdatacalculator.js +0 -133
- package/util/heatwavedatamanager/pointcoordsmeta.js +0 -22
- package/util/index.js +0 -13
- package/util/interpolation/index.js +0 -0
- package/util/interpolation/timetrack/index.js +0 -9
- package/util/interpolation/timetrack/timetrack-interpolator.js +0 -88
- package/util/interpolation/timetrack/web-worker-str.js +0 -180
- package/util/interpolation/timetrack/web-worker.js +0 -51
- package/util/jshelpers/data-filler.js +0 -19
- package/util/jshelpers/equality.js +0 -17
- package/util/jshelpers/index.js +0 -1
- package/util/jshelpers/timefilters.js +0 -32
- package/util/picking/fence.js +0 -46
- package/util/picking/picker-displayer.js +0 -177
- package/util/programs/draw-texture-on-canvas.js +0 -102
- package/util/programs/index.js +0 -1
- package/util/programs/shapesonglobe.js +0 -246
- package/util/programs/supersampletotextures.js +0 -142
- package/util/programs/texturetoglobe.js +0 -203
- package/util/shaderfunctions/geometrytransformations.ts +0 -388
- package/util/shaderfunctions/index.js +0 -2
- package/util/shaderfunctions/nodata.js +0 -10
- package/util/shaderfunctions/noisefunctions.js +0 -44
- package/util/surface-line-data/arc-bboxes.ts +0 -42
- package/util/surface-line-data/arcs-to-cuts.js +0 -74
- package/util/surface-line-data/cut-arc.js +0 -0
- package/util/surface-line-data/flow.ts +0 -52
- package/util/surface-line-data/rbush-manager.js +0 -0
- package/util/surface-line-data/types.ts +0 -27
- package/util/surface-line-data/web-worker.js +0 -0
- package/util/webglobe/gldefaultstates.js +0 -5
- package/util/webglobe/index.js +0 -2
- package/util/webglobe/rasteroverlay.js +0 -96
- package/util/webglobjectbuilders.ts +0 -456
- package/util/webglobjectbuilders1.js +0 -271
- package/waveparticles/adaptor.js +0 -16
- package/waveparticles/index.js +0 -3
- package/waveparticles/plugin.js +0 -313
- package/wind/imagetovectorfieldandmagnitude.js +0 -39
- package/wind/index.js +0 -5
- package/wind/plugin.js +0 -1057
- package/wind/vectorfieldimage.js +0 -27
- package/write-text/attached-text-writer.js +0 -105
- package/write-text/context-text.js +0 -125
- package/write-text/context-text3.js +0 -178
- package/write-text/index.js +0 -1
- package/write-text/writer-plugin.js +0 -7
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
export default class PointCoordsMeta {
|
|
2
|
-
|
|
3
|
-
constructor(bbox, width, height) {
|
|
4
|
-
this._bbox = bbox;
|
|
5
|
-
this._width = width;
|
|
6
|
-
this._height = height;
|
|
7
|
-
this._xRatio = this._width / (this._bbox[2] - this._bbox[0]);
|
|
8
|
-
this._yRatio = this._height / (this._bbox[3] - this._bbox[1]);
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
getFlooredMeta(long, lat) {
|
|
13
|
-
let x = (long - this._bbox[0]) * this._xRatio;
|
|
14
|
-
let y = (this._bbox[3] - lat) * this._yRatio;
|
|
15
|
-
x = x > 0 ? x - 1 : 0;
|
|
16
|
-
y = y > 0 ? y - 1 : 0;
|
|
17
|
-
const index = Math.floor(y) * this._width + Math.floor(x);
|
|
18
|
-
return { index };
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
|
package/util/index.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
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';
|
|
File without changes
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import { findFirstIndexInRange } from '../../algorithms/search-binary';
|
|
2
|
-
import {
|
|
3
|
-
sphericalLinearInterpolation_Cartesian3d,
|
|
4
|
-
sphericalLinearInterpolation_Mercator,
|
|
5
|
-
} from '../../../Math/methods';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* @typedef {Array<number>} vec3 [x, y, z]
|
|
10
|
-
* @typedef {Array<number>} vec2 [x, y]
|
|
11
|
-
* @typedef {Array<number>} vec4 [x, y, z, w]
|
|
12
|
-
* @typedef {number} fraction a number between 0 and 1
|
|
13
|
-
* @typedef {Array<number>} wgs84 [long, lat]
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
const GEOMETRY = Object.freeze({
|
|
17
|
-
CARTESIAN3D: 0,
|
|
18
|
-
MERCATOR: 1,
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
class TimeTrackInterpolator {
|
|
22
|
-
/**
|
|
23
|
-
* @typedef Timetrack
|
|
24
|
-
* @property {Array<vec4>}} coordinates [x,y,z, length]
|
|
25
|
-
* @property {Array<Number>} times
|
|
26
|
-
* @param {Array<Timetrack>} timeTracks
|
|
27
|
-
*/
|
|
28
|
-
constructor({ timeTracks, bbox = null, geometry = GEOMETRY.CARTESIAN3D } = {}) {
|
|
29
|
-
this.timeTracks = null;
|
|
30
|
-
this.timeTracksStartTimes = null;
|
|
31
|
-
this.geometry = geometry;
|
|
32
|
-
if (timeTracks) this.setTimetracks(timeTracks);
|
|
33
|
-
if (bbox) this.setBbox(bbox);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
setGeometry(geometry) {
|
|
38
|
-
if (geometry !== GEOMETRY.CARTESIAN3D && geometry !== GEOMETRY.MERCATOR) {
|
|
39
|
-
throw new Error('Invalid geometry');
|
|
40
|
-
}
|
|
41
|
-
this.geometry = geometry;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
setTimetracks(timeTracks) {
|
|
45
|
-
this.timeTracks = timeTracks;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
interpolate(time) {
|
|
50
|
-
const { timeTracks, geometry } = this;
|
|
51
|
-
if (!timeTracks) { return null; }
|
|
52
|
-
const resultArray = [];
|
|
53
|
-
const info = {
|
|
54
|
-
outOfRange: 0,
|
|
55
|
-
processed: 0,
|
|
56
|
-
}
|
|
57
|
-
for (let i = 0; i < timeTracks.length; i++) {
|
|
58
|
-
const { times, coordinates } = timeTracks[i];
|
|
59
|
-
|
|
60
|
-
if (times[times.length - 1] < time) continue;
|
|
61
|
-
info.processed++;
|
|
62
|
-
const timeIndex = findFirstIndexInRange(times, time);
|
|
63
|
-
if (timeIndex === null) { info.outOfRange++; continue; }
|
|
64
|
-
const timeFraction = (time - times[timeIndex]) / (times[timeIndex + 1] - times[timeIndex]);
|
|
65
|
-
const interpolated = (geometry === GEOMETRY.CARTESIAN3D) ?
|
|
66
|
-
sphericalLinearInterpolation_Cartesian3d(coordinates[timeIndex], coordinates[timeIndex + 1], timeFraction) :
|
|
67
|
-
sphericalLinearInterpolation_Mercator(coordinates[timeIndex], coordinates[timeIndex + 1], timeFraction);
|
|
68
|
-
resultArray.push(...interpolated);
|
|
69
|
-
}
|
|
70
|
-
return new Float32Array(resultArray);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
// implicit methods
|
|
75
|
-
|
|
76
|
-
_orderTimeTracks() {
|
|
77
|
-
this.timeTracks.sort((a, b) => a.times[0] - b.times[0]);
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
_setStartTimes() {
|
|
81
|
-
this.timeTracksStartTimes = this.timeTracks.map(tt => tt.times[0]);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
export { TimeTrackInterpolator, GEOMETRY };
|
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
const webworkerStr = `
|
|
2
|
-
|
|
3
|
-
const WORLD_RADIUS_3D = 6378.137;
|
|
4
|
-
const WORLD_RADIUS_MERCATOR = 6378136.99911;
|
|
5
|
-
|
|
6
|
-
const dot3 = (a, b) => {
|
|
7
|
-
return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
const sphericalLinearInterpolation_UnitVector = (normalizedA, normalizedB, ratio) => {
|
|
11
|
-
const theta = Math.acos(dot3(normalizedA, normalizedB));
|
|
12
|
-
if (theta < 0.000001) return normalizedA; // CALIBRATE?
|
|
13
|
-
const sinTheta = Math.sin(theta);
|
|
14
|
-
const result = [
|
|
15
|
-
(Math.sin((1.0 - ratio) * theta) * normalizedA[0] + Math.sin(ratio * theta) * normalizedB[0]) / sinTheta,
|
|
16
|
-
(Math.sin((1.0 - ratio) * theta) * normalizedA[1] + Math.sin(ratio * theta) * normalizedB[1]) / sinTheta,
|
|
17
|
-
(Math.sin((1.0 - ratio) * theta) * normalizedA[2] + Math.sin(ratio * theta) * normalizedB[2]) / sinTheta
|
|
18
|
-
];
|
|
19
|
-
return result;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const radianToMercator = (xy) => {
|
|
23
|
-
return [WORLD_RADIUS_MERCATOR * xy[0], WORLD_RADIUS_MERCATOR * Math.log(Math.tan(Math.PI / 4 + xy[1] / 2))];
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
const cartesian3dToRadian = (cartesian) => {
|
|
28
|
-
const x = cartesian[0];
|
|
29
|
-
const y = cartesian[1];
|
|
30
|
-
const z = cartesian[2];
|
|
31
|
-
// const length = Math.sqrt(x * x + y * y + z * z);
|
|
32
|
-
const long = Math.atan2(y, x);
|
|
33
|
-
const lat = Math.asin(z)// length);
|
|
34
|
-
return [long, lat];
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
const sphericalLinearInterpolation_Mercator = (normalizedA, normalizedB, ratio) => {
|
|
39
|
-
const unitVector = sphericalLinearInterpolation_UnitVector(normalizedA, normalizedB, ratio);
|
|
40
|
-
const angles = cartesian3dToRadian(unitVector);
|
|
41
|
-
return radianToMercator(angles);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
const sphericalLinearInterpolation_Cartesian3d = (a, b, ratio) => {
|
|
45
|
-
const unitVector = sphericalLinearInterpolation_UnitVector(a, b, ratio);
|
|
46
|
-
const height = a[3] + (b[3] - a[3]) * ratio;
|
|
47
|
-
return [unitVector[0] * height, unitVector[1] * height, unitVector[2] * height];
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
const findFirstIndexInRange = (container, value) => {
|
|
51
|
-
let start = 0;
|
|
52
|
-
let end = container.length - 1;
|
|
53
|
-
let mid = 0;
|
|
54
|
-
while (start <= end) {
|
|
55
|
-
mid = Math.floor((start + end) / 2);
|
|
56
|
-
if (container[mid] <= value && value <= container[mid + 1]) return mid;
|
|
57
|
-
if (container[mid] < value) start = mid + 1;
|
|
58
|
-
else end = mid - 1;
|
|
59
|
-
}
|
|
60
|
-
return null;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
const GEOMETRY = Object.freeze({
|
|
64
|
-
CARTESIAN3D: 0,
|
|
65
|
-
MERCATOR: 1,
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
class TimeTrackInterpolator {
|
|
69
|
-
/**
|
|
70
|
-
* @typedef Timetrack
|
|
71
|
-
* @property {Array<vec4>}} coordinates [x,y,z, length]
|
|
72
|
-
* @property {Array<Number>} times
|
|
73
|
-
* @param {Array<Timetrack>} timeTracks
|
|
74
|
-
*/
|
|
75
|
-
constructor({ timeTracks, bbox = null, geometry = GEOMETRY.CARTESIAN3D } = {}) {
|
|
76
|
-
this.timeTracks = null;
|
|
77
|
-
this.timeTracksStartTimes = null;
|
|
78
|
-
this.geometry = geometry;
|
|
79
|
-
if (timeTracks) this.setTimetracks(timeTracks);
|
|
80
|
-
if (bbox) this.setBbox(bbox);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
setGeometry(geometry) {
|
|
85
|
-
if (geometry !== GEOMETRY.CARTESIAN3D && geometry !== GEOMETRY.MERCATOR) {
|
|
86
|
-
throw new Error('Invalid geometry');
|
|
87
|
-
}
|
|
88
|
-
this.geometry = geometry;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
setTimetracks(timeTracks) {
|
|
92
|
-
this.timeTracks = timeTracks;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
interpolate(time) {
|
|
97
|
-
const { timeTracks, geometry } = this;
|
|
98
|
-
if (!timeTracks) { return null; }
|
|
99
|
-
const resultArray = [];
|
|
100
|
-
const info = {
|
|
101
|
-
outOfRange: 0,
|
|
102
|
-
processed: 0,
|
|
103
|
-
}
|
|
104
|
-
for (let i = 0; i < timeTracks.length; i++) {
|
|
105
|
-
const { times, coordinates } = timeTracks[i];
|
|
106
|
-
|
|
107
|
-
if (times[times.length - 1] < time) continue;
|
|
108
|
-
info.processed++;
|
|
109
|
-
const timeIndex = findFirstIndexInRange(times, time);
|
|
110
|
-
if (timeIndex === null) { info.outOfRange++; continue; }
|
|
111
|
-
const timeFraction = (time - times[timeIndex]) / (times[timeIndex + 1] - times[timeIndex]);
|
|
112
|
-
const interpolated = (geometry === GEOMETRY.CARTESIAN3D) ?
|
|
113
|
-
sphericalLinearInterpolation_Cartesian3d(coordinates[timeIndex], coordinates[timeIndex + 1], timeFraction) :
|
|
114
|
-
sphericalLinearInterpolation_Mercator(coordinates[timeIndex], coordinates[timeIndex + 1], timeFraction);
|
|
115
|
-
resultArray.push(...interpolated);
|
|
116
|
-
}
|
|
117
|
-
return new Float32Array(resultArray);
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
// implicit methods
|
|
122
|
-
|
|
123
|
-
_orderTimeTracks() {
|
|
124
|
-
this.timeTracks.sort((a, b) => a.times[0] - b.times[0]);
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
_setStartTimes() {
|
|
128
|
-
this.timeTracksStartTimes = this.timeTracks.map(tt => tt.times[0]);
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
const interpolator = new TimeTrackInterpolator({ geometry: GEOMETRY.CARTESIAN3D });
|
|
133
|
-
|
|
134
|
-
/* eslint-disable-next-line no-restricted-globals */
|
|
135
|
-
self.onmessage = function (e) {
|
|
136
|
-
|
|
137
|
-
const { geometry = null, timeTracks = null, time = null } = e.data;
|
|
138
|
-
|
|
139
|
-
if (geometry !== null) {
|
|
140
|
-
try {
|
|
141
|
-
interpolator.setGeometry(geometry);
|
|
142
|
-
} catch (error) {
|
|
143
|
-
/* eslint-disable-next-line no-restricted-globals */
|
|
144
|
-
self.postMessage({ error: error.message });
|
|
145
|
-
return;
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
if (timeTracks !== null) {
|
|
150
|
-
try {
|
|
151
|
-
interpolator.setTimetracks(timeTracks);
|
|
152
|
-
} catch (error) {
|
|
153
|
-
/* eslint-disable-next-line no-restricted-globals */
|
|
154
|
-
self.postMessage({ error: error.message });
|
|
155
|
-
return;
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
if (time !== null) {
|
|
160
|
-
try {
|
|
161
|
-
const result = interpolator.interpolate(time);
|
|
162
|
-
if(result === null) {
|
|
163
|
-
/* eslint-disable-next-line no-restricted-globals */
|
|
164
|
-
self.postMessage({ error: 'No TimeTracks Data' });
|
|
165
|
-
return;
|
|
166
|
-
}
|
|
167
|
-
/* eslint-disable-next-line no-restricted-globals */
|
|
168
|
-
self.postMessage(result, [result.buffer]);
|
|
169
|
-
return;
|
|
170
|
-
} catch (error) {
|
|
171
|
-
/* eslint-disable-next-line no-restricted-globals */
|
|
172
|
-
self.postMessage({ error: error.message });
|
|
173
|
-
return;
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
/* eslint-disable-next-line no-restricted-globals */
|
|
177
|
-
self.postMessage(true);
|
|
178
|
-
}
|
|
179
|
-
`;
|
|
180
|
-
export { webworkerStr };
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { TimeTrackInterpolator, GEOMETRY } from './timetrack-interpolator';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const interpolator = new TimeTrackInterpolator({ geometry: GEOMETRY.CARTESIAN3D });
|
|
5
|
-
|
|
6
|
-
/* eslint-disable-next-line no-restricted-globals */
|
|
7
|
-
self.onmessage = function (e) {
|
|
8
|
-
|
|
9
|
-
const { geometry = null, timeTracks = null, time = null } = e.data;
|
|
10
|
-
|
|
11
|
-
if (geometry !== null) {
|
|
12
|
-
try {
|
|
13
|
-
interpolator.setGeometry(geometry);
|
|
14
|
-
} catch (error) {
|
|
15
|
-
/* eslint-disable-next-line no-restricted-globals */
|
|
16
|
-
self.postMessage({ error: error.message });
|
|
17
|
-
return;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
if (timeTracks !== null) {
|
|
22
|
-
try {
|
|
23
|
-
interpolator.setTimetracks(timeTracks);
|
|
24
|
-
} catch (error) {
|
|
25
|
-
/* eslint-disable-next-line no-restricted-globals */
|
|
26
|
-
self.postMessage({ error: error.message });
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
if (time !== null) {
|
|
32
|
-
try {
|
|
33
|
-
const result = interpolator.interpolate(time);
|
|
34
|
-
if (result === null) {
|
|
35
|
-
/* eslint-disable-next-line no-restricted-globals */
|
|
36
|
-
self.postMessage({ error: 'No TimeTracks Data' });
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
/* eslint-disable-next-line no-restricted-globals */
|
|
40
|
-
self.postMessage(result, [result.buffer]);
|
|
41
|
-
return;
|
|
42
|
-
} catch (error) {
|
|
43
|
-
/* eslint-disable-next-line no-restricted-globals */
|
|
44
|
-
self.postMessage({ error: error.message });
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
/* eslint-disable-next-line no-restricted-globals */
|
|
49
|
-
self.postMessage(true);
|
|
50
|
-
}
|
|
51
|
-
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
const populateFloat32Array = Object.freeze({
|
|
2
|
-
fillFloat32Array: (length, data) => {
|
|
3
|
-
const result = new Float32Array(length);
|
|
4
|
-
result.fill(data);
|
|
5
|
-
return result;
|
|
6
|
-
},
|
|
7
|
-
|
|
8
|
-
fillWithListData: (length, listdata) => {
|
|
9
|
-
const result = new Float32Array(length * listdata.length);
|
|
10
|
-
let offset = 0;
|
|
11
|
-
for (let i = 0; i < length; i++) {
|
|
12
|
-
result.set(listdata, offset);
|
|
13
|
-
offset += listdata.length;
|
|
14
|
-
}
|
|
15
|
-
return result
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
export { populateFloat32Array };
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
function arraysEqual(a, b) {
|
|
2
|
-
if (a === b) return true;
|
|
3
|
-
if (a == null || b == null) return false;
|
|
4
|
-
if (a.length !== b.length) return false;
|
|
5
|
-
|
|
6
|
-
// If you don't care about the order of the elements inside
|
|
7
|
-
// the array, you should sort both arrays here.
|
|
8
|
-
// Please note that calling sort on an array will modify that array.
|
|
9
|
-
// you might want to clone your array first.
|
|
10
|
-
|
|
11
|
-
for (var i = 0; i < a.length; ++i) {
|
|
12
|
-
if (a[i] !== b[i]) return false;
|
|
13
|
-
}
|
|
14
|
-
return true;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export { arraysEqual };
|
package/util/jshelpers/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * as timefilters from './timefilters';
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
// TODO: fix logic error in instantDebounce
|
|
2
|
-
function instantDebounce(func, delay) {
|
|
3
|
-
let timeout = null;
|
|
4
|
-
let lastArgs = null;
|
|
5
|
-
let runAtEnd = false;
|
|
6
|
-
|
|
7
|
-
const timeoutMethod = () => {
|
|
8
|
-
setTimeout(() => {
|
|
9
|
-
if (runAtEnd) {
|
|
10
|
-
func(...lastArgs);
|
|
11
|
-
lastArgs = null;
|
|
12
|
-
// console.log("processed with delay")
|
|
13
|
-
runAtEnd = false;
|
|
14
|
-
}
|
|
15
|
-
timeout = null;
|
|
16
|
-
}, delay);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
return function () {
|
|
20
|
-
if (timeout) {
|
|
21
|
-
lastArgs = arguments;
|
|
22
|
-
runAtEnd = true;
|
|
23
|
-
return;
|
|
24
|
-
} else {
|
|
25
|
-
func(...args);
|
|
26
|
-
// console.log("processed instantly")
|
|
27
|
-
timeout = timeoutMethod();
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export { instantDebounce };
|
package/util/picking/fence.js
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
const fence = (gl) => new Promise((resolve, reject) => {
|
|
2
|
-
// This will create a fence. If this follows a `readPixels()` call, then it
|
|
3
|
-
// will signal to WebGL that the read instruction should be asynchronous.
|
|
4
|
-
// This means JS can continue to work on other tasks while the read instruction
|
|
5
|
-
// completes.
|
|
6
|
-
const sync = gl.fenceSync(gl.SYNC_GPU_COMMANDS_COMPLETE, 0);
|
|
7
|
-
gl.flush();
|
|
8
|
-
|
|
9
|
-
// There are TWO possible ways to check on the status of a WebGLSync object.
|
|
10
|
-
|
|
11
|
-
// 1. This will check it using clientWaitSync()
|
|
12
|
-
const checkStatus_v1 = () => {
|
|
13
|
-
const status = gl.clientWaitSync(sync, 0, 0);
|
|
14
|
-
|
|
15
|
-
// There are four possible values for status:
|
|
16
|
-
// a. ALREADY_SIGNALED and CONDITION_SATISFIED (done)
|
|
17
|
-
// b. TIMEOUT_EXPIRED (check again later)
|
|
18
|
-
// c. WAIT_FAILED (there was an error)
|
|
19
|
-
if (status === gl.TIMEOUT_EXPIRED) {
|
|
20
|
-
setTimeout(checkStatus_v1, 1);
|
|
21
|
-
} else if (status === gl.ALREADY_SIGNALED || status === gl.CONDITION_SATISFIED) {
|
|
22
|
-
gl.deleteSync(sync);
|
|
23
|
-
resolve();
|
|
24
|
-
} else {
|
|
25
|
-
gl.deleteSync(sync);
|
|
26
|
-
reject(new Error('Fence did not resolve normally for some reason'));
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
// 2. This will check with getSyncParameter(s, gl.SYNC_STATUS)
|
|
31
|
-
const checkStatus_v2 = () => {
|
|
32
|
-
const status = gl.getSyncParameter(sync, gl.SYNC_STATUS);
|
|
33
|
-
|
|
34
|
-
// There are only two possible values for status: SIGNALED and UNSIGNALED
|
|
35
|
-
// Note that there is no `error` signal, so there is no reason to use `reject()` here
|
|
36
|
-
if (status === gl.SIGNALED) {
|
|
37
|
-
gl.deleteSync(sync);
|
|
38
|
-
resolve();
|
|
39
|
-
} else {
|
|
40
|
-
setTimeout(checkStatus_v2, 1);
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
setTimeout(checkStatus_v2, 1);
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
export { fence };
|
|
@@ -1,177 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* add implicit texture display program for color
|
|
3
|
-
* add fence on query return and return id.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { textureOnCanvasProgramCache } from "../programs/draw-texture-on-canvas";
|
|
7
|
-
import { fence } from "./fence";
|
|
8
|
-
|
|
9
|
-
const ESCAPE_VALUE = -1;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
class PickerDisplayer {
|
|
13
|
-
constructor(globe) {
|
|
14
|
-
this.globe = globe;
|
|
15
|
-
this.gl = globe.gl;
|
|
16
|
-
const gl = this.gl;
|
|
17
|
-
this.colorTexture = gl.createTexture(); // bind to color attachment 0
|
|
18
|
-
this.indexTexture = gl.createTexture(); // bind to color attachment 1
|
|
19
|
-
this.fbo = gl.createFramebuffer();
|
|
20
|
-
|
|
21
|
-
this._pbo = undefined;
|
|
22
|
-
this._pboSize = 0;
|
|
23
|
-
this.resize();
|
|
24
|
-
|
|
25
|
-
this.displayer = textureOnCanvasProgramCache.get(this.gl);
|
|
26
|
-
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
resize(width = null, height = null) {
|
|
30
|
-
if (width === null || height === null) {
|
|
31
|
-
width = this.globe.api_ScrW();
|
|
32
|
-
height = this.globe.api_ScrH();
|
|
33
|
-
}
|
|
34
|
-
const { gl, colorTexture, indexTexture } = this;
|
|
35
|
-
|
|
36
|
-
gl.deleteTexture(colorTexture);
|
|
37
|
-
gl.deleteTexture(indexTexture);
|
|
38
|
-
const colorTextureNew = gl.createTexture();
|
|
39
|
-
gl.bindTexture(gl.TEXTURE_2D, colorTextureNew);
|
|
40
|
-
gl.texStorage2D(gl.TEXTURE_2D, 1, gl.RGBA8, width, height);
|
|
41
|
-
const indexTextureNew = gl.createTexture();
|
|
42
|
-
gl.bindTexture(gl.TEXTURE_2D, indexTextureNew);
|
|
43
|
-
// gl.texStorage2D(gl.TEXTURE_2D, 1, gl.R16I, width, height);
|
|
44
|
-
gl.texStorage2D(gl.TEXTURE_2D, 1, gl.R32I, width, height);
|
|
45
|
-
gl.bindTexture(gl.TEXTURE_2D, null);
|
|
46
|
-
|
|
47
|
-
this.colorTexture = colorTextureNew;
|
|
48
|
-
this.indexTexture = indexTextureNew;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
clearTextures() {
|
|
53
|
-
const { gl, colorTexture, indexTexture } = this;
|
|
54
|
-
gl.activeTexture(gl.TEXTURE1);
|
|
55
|
-
gl.bindTexture(gl.TEXTURE_2D, indexTexture);
|
|
56
|
-
gl.clearBufferiv(gl.COLOR, 1, new Int32Array([-1, -1, -1, -1]));
|
|
57
|
-
|
|
58
|
-
gl.activeTexture(gl.TEXTURE0);
|
|
59
|
-
gl.bindTexture(gl.TEXTURE_2D, colorTexture);
|
|
60
|
-
gl.clearBufferfv(gl.COLOR, 0, new Float32Array([0, 0, 0, 0]));
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
// call before drawing the scene with gl picker shader
|
|
65
|
-
bindFBO() {
|
|
66
|
-
const { gl, colorTexture, indexTexture, fbo } = this;
|
|
67
|
-
gl.activeTexture(gl.TEXTURE1);
|
|
68
|
-
gl.bindTexture(gl.TEXTURE_2D, indexTexture);
|
|
69
|
-
gl.activeTexture(gl.TEXTURE0);
|
|
70
|
-
gl.bindTexture(gl.TEXTURE_2D, colorTexture);
|
|
71
|
-
{ // bind framebuffer
|
|
72
|
-
gl.bindFramebuffer(gl.FRAMEBUFFER, fbo);
|
|
73
|
-
gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, this.colorTexture, 0);
|
|
74
|
-
gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT1, gl.TEXTURE_2D, this.indexTexture, 0);
|
|
75
|
-
gl.drawBuffers([gl.COLOR_ATTACHMENT0, gl.COLOR_ATTACHMENT1]);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
// call after drawing the scene with gl picker shader
|
|
81
|
-
drawColorTexture() {
|
|
82
|
-
const { colorTexture } = this;
|
|
83
|
-
this.gl.bindFramebuffer(this.gl.FRAMEBUFFER, null);
|
|
84
|
-
this.displayer.draw(colorTexture);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
pickXY(x, y, selectionPointFilling = 1, callback = () => { }) {
|
|
89
|
-
const size = Math.pow(1 + 2 * selectionPointFilling, 2);
|
|
90
|
-
this._pick(size,
|
|
91
|
-
x - selectionPointFilling,
|
|
92
|
-
y - selectionPointFilling,
|
|
93
|
-
1 + 2 * selectionPointFilling,
|
|
94
|
-
1 + 2 * selectionPointFilling,
|
|
95
|
-
callback);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
pickBbox(left, top, right, bottom, callback) {
|
|
101
|
-
const size = (right - left) * (bottom - top) * 4;
|
|
102
|
-
this._pick(size, left, top, right - left, bottom - top, callback);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
_pick(size, startX, startY, lengthX, lengthY, callback) {
|
|
107
|
-
if (this._inProgress) return false;
|
|
108
|
-
this._inProgress = true;
|
|
109
|
-
|
|
110
|
-
this._initHoldBuffer(size * 4);
|
|
111
|
-
const { gl, _pbo } = this;
|
|
112
|
-
gl.bindBuffer(gl.PIXEL_PACK_BUFFER, _pbo);
|
|
113
|
-
this.bindFBO();
|
|
114
|
-
gl.readBuffer(gl.COLOR_ATTACHMENT1); // This is the attachment we want to read
|
|
115
|
-
gl.readPixels( // This will read the pixels to the buffer asynchronously
|
|
116
|
-
startX, startY, lengthX, lengthY,
|
|
117
|
-
gl.RED_INTEGER, gl.INT,
|
|
118
|
-
0
|
|
119
|
-
);
|
|
120
|
-
gl.bindFramebuffer(gl.FRAMEBUFFER, null);
|
|
121
|
-
gl.bindBuffer(gl.PIXEL_PACK_BUFFER, null);
|
|
122
|
-
fence(this.gl).then(() => {
|
|
123
|
-
gl.bindBuffer(gl.PIXEL_PACK_BUFFER, _pbo);
|
|
124
|
-
// const data = new Int16Array(size);
|
|
125
|
-
const data = new Int32Array(size);
|
|
126
|
-
gl.getBufferSubData(gl.PIXEL_PACK_BUFFER, 0, data);
|
|
127
|
-
gl.bindBuffer(gl.PIXEL_PACK_BUFFER, null);
|
|
128
|
-
const result = this._pickFromBuffer(data, size);
|
|
129
|
-
callback(result);
|
|
130
|
-
// gl.deleteBuffer(pbo);
|
|
131
|
-
this._inProgress = false
|
|
132
|
-
}
|
|
133
|
-
);
|
|
134
|
-
return true;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
_pickFromBuffer(array, size) {
|
|
139
|
-
const selectedObjects = new Set();
|
|
140
|
-
for (let i = 0; i < size; i += 1) {
|
|
141
|
-
const id = array[i];
|
|
142
|
-
if (id !== ESCAPE_VALUE) {
|
|
143
|
-
selectedObjects.add(id);
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
return selectedObjects;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
_initHoldBuffer(size) {
|
|
151
|
-
if (this._pbo && this._pboSize >= size) {
|
|
152
|
-
return
|
|
153
|
-
}
|
|
154
|
-
const { gl } = this;
|
|
155
|
-
const pbo = gl.createBuffer();
|
|
156
|
-
gl.bindBuffer(gl.PIXEL_PACK_BUFFER, pbo);
|
|
157
|
-
gl.bufferData(gl.PIXEL_PACK_BUFFER, size, gl.STREAM_READ);
|
|
158
|
-
gl.bindBuffer(gl.PIXEL_PACK_BUFFER, null);
|
|
159
|
-
this._pboSize = size;
|
|
160
|
-
if (this._pbo !== undefined) {
|
|
161
|
-
gl.deleteBuffer(this._pbo);
|
|
162
|
-
}
|
|
163
|
-
this._pbo = pbo;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
free() {
|
|
168
|
-
const { gl, colorTexture, indexTexture, fbo } = this;
|
|
169
|
-
gl.deleteTexture(colorTexture);
|
|
170
|
-
gl.deleteTexture(indexTexture);
|
|
171
|
-
gl.deleteFramebuffer(fbo);
|
|
172
|
-
textureOnCanvasProgramCache.release(this.gl);
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
export { PickerDisplayer };
|