@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
package/pin/pin-point-totem.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* This class registered as globe plugin one for each globe. to the head of plugin call stack.
|
|
4
4
|
*/
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
class PinPointTotem {
|
|
6
|
+
constructor(globe) {
|
|
7
7
|
this.objectArrayMap = new Map();
|
|
8
8
|
}
|
|
9
9
|
/**
|
|
@@ -18,44 +18,43 @@ var PinPointTotem = /** @class */ (function () {
|
|
|
18
18
|
* keyUp
|
|
19
19
|
* }
|
|
20
20
|
*/
|
|
21
|
-
|
|
21
|
+
registerPinMap(objectArray, callbacks) {
|
|
22
22
|
this.objectArrayMap.set(objectArray, callbacks);
|
|
23
|
-
}
|
|
24
|
-
|
|
23
|
+
}
|
|
24
|
+
unregisterPinMap(objectArray) {
|
|
25
25
|
if (this.objectArrayMap.has(objectArray)) {
|
|
26
26
|
this.objectArrayMap.delete(objectArray);
|
|
27
27
|
}
|
|
28
28
|
else {
|
|
29
29
|
console.warn('PinPointTotem objectArrayMap does not contain the objectArray');
|
|
30
30
|
}
|
|
31
|
-
}
|
|
31
|
+
}
|
|
32
32
|
// GlobeMethods
|
|
33
33
|
// haritada sol butona basıldığında çağrılır
|
|
34
|
-
|
|
34
|
+
mouseDown(x, y, event) {
|
|
35
35
|
return false;
|
|
36
|
-
}
|
|
36
|
+
}
|
|
37
37
|
// mouse'a basılıp hareket ettirildiğinde, mouseDown'dan true dönmüşse çağrılır
|
|
38
|
-
|
|
39
|
-
}
|
|
38
|
+
mouseMove(x, y, event) {
|
|
39
|
+
}
|
|
40
40
|
// mouse up'ın left'i mouseDown'dan true dönmüşse çağrılır, edit mode içindir
|
|
41
41
|
// right'i ise sağ tıka basılıp bırakıldığında çağrılır
|
|
42
|
-
|
|
43
|
-
}
|
|
42
|
+
mouseUp(x, y, event) {
|
|
43
|
+
}
|
|
44
44
|
// harita üzerinde tıklandığında çağrılır
|
|
45
|
-
|
|
45
|
+
mouseClick(x, y, event) {
|
|
46
46
|
return false;
|
|
47
|
-
}
|
|
47
|
+
}
|
|
48
48
|
// harita üzerinde çift tıklandığında çağrılır
|
|
49
|
-
|
|
49
|
+
mouseDblClick(x, y, event) {
|
|
50
50
|
return false;
|
|
51
|
-
}
|
|
51
|
+
}
|
|
52
52
|
// klavyeden bir tuşa basıldığı anda ve tuşa basılı kalınmaya devam edildiği durumlarda çalışır
|
|
53
|
-
|
|
53
|
+
keyDown(event) {
|
|
54
54
|
return false;
|
|
55
|
-
}
|
|
55
|
+
}
|
|
56
56
|
// klavyedeki bir tuştan parmak çekildiği anda çalışır
|
|
57
|
-
|
|
57
|
+
keyUp(event) {
|
|
58
58
|
return false;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
}());
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/**
|
|
3
2
|
* @typedef {Float32Array} TimeTrackMultiColorData | A linestring is representation, let A{a1, a2, a3}, B{b1, b2} be the points of the line.
|
|
4
3
|
* TimeTrackMultiColorData is [
|
|
@@ -12,8 +11,6 @@
|
|
|
12
11
|
* there is a cutting point between A and B
|
|
13
12
|
*
|
|
14
13
|
*/
|
|
15
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
-
exports.timeTrackPluginDataToPointHeatInterpolatorAdapter = void 0;
|
|
17
14
|
/**
|
|
18
15
|
* ABOVE
|
|
19
16
|
* TO
|
|
@@ -32,18 +29,18 @@ exports.timeTrackPluginDataToPointHeatInterpolatorAdapter = void 0;
|
|
|
32
29
|
* @property {Array<Number>} times
|
|
33
30
|
* @param {Array<Timetrack>} timeTracks
|
|
34
31
|
*/
|
|
35
|
-
|
|
36
|
-
|
|
32
|
+
import { pixelXYLenghtToUnitVectorWithHeight } from "../../Math/methods";
|
|
33
|
+
const processACut = (array, offset) => {
|
|
37
34
|
// first 3 values of array
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
35
|
+
const v3 = array.slice(offset, offset + 3);
|
|
36
|
+
const v4 = pixelXYLenghtToUnitVectorWithHeight(v3);
|
|
37
|
+
const time = array[offset + 3];
|
|
41
38
|
return [v4, time];
|
|
42
39
|
};
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
40
|
+
const timeTrackPluginDataToPointHeatInterpolatorAdapter = (timeTrackPluginData) => {
|
|
41
|
+
const timeTracks = [];
|
|
42
|
+
let offset = 0;
|
|
43
|
+
let timeTrack = {
|
|
47
44
|
coordinates: [],
|
|
48
45
|
times: []
|
|
49
46
|
};
|
|
@@ -56,11 +53,11 @@ var timeTrackPluginDataToPointHeatInterpolatorAdapter = function (timeTrackPlugi
|
|
|
56
53
|
};
|
|
57
54
|
offset += 9;
|
|
58
55
|
}
|
|
59
|
-
|
|
56
|
+
const point = processACut(timeTrackPluginData, offset);
|
|
60
57
|
offset += 9;
|
|
61
58
|
timeTrack.coordinates.push(point[0]);
|
|
62
59
|
timeTrack.times.push(point[1]);
|
|
63
60
|
}
|
|
64
61
|
return timeTracks;
|
|
65
62
|
};
|
|
66
|
-
|
|
63
|
+
export { timeTrackPluginDataToPointHeatInterpolatorAdapter };
|
|
@@ -1,15 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PointHeatmapPlugin = void 0;
|
|
4
|
-
var point_to_heat_map_flow_1 = require("./point-to-heat-map-flow");
|
|
1
|
+
import { PointHeatmapFlow } from "./point-to-heat-map-flow";
|
|
5
2
|
// import { webworkerStr } from "../util/interpolation/timetrack/web-worker-str"; // TODO: Delete When this plugin is tested on production
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
var _b = _a === void 0 ? {} : _a, _c = _b.opacity, opacity = _c === void 0 ? 1.0 : _c, _d = _b.pointSize, pointSize = _d === void 0 ? 5.0 : _d, _e = _b.onInterpolationComplete, onInterpolationComplete = _e === void 0 ? function () { } : _e;
|
|
12
|
-
var _this = this;
|
|
3
|
+
import { createWorker } from "../util/interpolation/timetrack/index";
|
|
4
|
+
import { createTexture, getColorRampModed } from "../util";
|
|
5
|
+
import { opacityCheck, constraintFloat } from "../util/check/typecheck";
|
|
6
|
+
class PointHeatmapPlugin {
|
|
7
|
+
constructor(id, { opacity = 1.0, pointSize = 5.0, onInterpolationComplete = () => { } } = {}) {
|
|
13
8
|
this.id = id;
|
|
14
9
|
this.globe = null;
|
|
15
10
|
this.gl = null;
|
|
@@ -22,8 +17,8 @@ var PointHeatmapPlugin = /** @class */ (function () {
|
|
|
22
17
|
this._timeTracksAreSet = false;
|
|
23
18
|
// const blob = new Blob([webworkerStr], { type: 'application/javascript' });
|
|
24
19
|
// this.timeTrackInterpolationWorker = new Worker(URL.createObjectURL(blob), { type: 'module' });
|
|
25
|
-
this.timeTrackInterpolationWorker =
|
|
26
|
-
this.timeTrackInterpolationWorker.onmessage =
|
|
20
|
+
this.timeTrackInterpolationWorker = createWorker();
|
|
21
|
+
this.timeTrackInterpolationWorker.onmessage = (e) => {
|
|
27
22
|
if (e.data.error) {
|
|
28
23
|
throw new Error(e.data.error);
|
|
29
24
|
}
|
|
@@ -31,89 +26,87 @@ var PointHeatmapPlugin = /** @class */ (function () {
|
|
|
31
26
|
onInterpolationComplete();
|
|
32
27
|
}
|
|
33
28
|
if (e.data instanceof Float32Array) {
|
|
34
|
-
|
|
35
|
-
|
|
29
|
+
this.flow.setData(e.data);
|
|
30
|
+
this._throttleListener = null;
|
|
36
31
|
onInterpolationComplete();
|
|
37
32
|
}
|
|
38
33
|
};
|
|
39
34
|
}
|
|
40
35
|
// globe interaction
|
|
41
|
-
|
|
36
|
+
init(globe, gl) {
|
|
42
37
|
this.globe = globe;
|
|
43
38
|
this.gl = gl;
|
|
44
|
-
this.flow = new
|
|
39
|
+
this.flow = new PointHeatmapFlow(globe);
|
|
45
40
|
this.setGeometry();
|
|
46
41
|
this.resize();
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
|
|
42
|
+
}
|
|
43
|
+
setPointSize(pointSize) {
|
|
44
|
+
constraintFloat(pointSize, 1);
|
|
50
45
|
this._pointSize = pointSize;
|
|
51
46
|
this.globe.DrawRender();
|
|
52
|
-
}
|
|
47
|
+
}
|
|
53
48
|
/**
|
|
54
49
|
* @param {Array<string>}
|
|
55
50
|
* @param {string} mode "interpolated" | "discrete"
|
|
56
51
|
*/
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
var gl = this.gl;
|
|
52
|
+
setColorRamp(values, thresholds, mode = "interpolated") {
|
|
53
|
+
const gl = this.gl;
|
|
60
54
|
if (this.gl === null) {
|
|
61
55
|
throw new Error('Plugin not initialized');
|
|
62
56
|
}
|
|
63
57
|
;
|
|
64
|
-
|
|
65
|
-
|
|
58
|
+
const rampData = getColorRampModed(values, thresholds, mode);
|
|
59
|
+
const texture = createTexture(gl, gl.LINEAR, rampData, 256, 1);
|
|
66
60
|
if (this._legendTexture) {
|
|
67
61
|
this.gl.deleteTexture(this._legendTexture);
|
|
68
62
|
}
|
|
69
63
|
this._legendTexture = texture;
|
|
70
64
|
this.globe.DrawRender();
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
var _this = this;
|
|
65
|
+
}
|
|
66
|
+
setTime(time) {
|
|
74
67
|
// TODO: WORK ON THIS
|
|
75
68
|
this._time = time;
|
|
76
69
|
if (this.isReady() && this._throttleListener === null) {
|
|
77
|
-
this._throttleListener = setTimeout(
|
|
78
|
-
|
|
70
|
+
this._throttleListener = setTimeout(() => {
|
|
71
|
+
this.timeTrackInterpolationWorker.postMessage({ time: this._time });
|
|
79
72
|
}, 0);
|
|
80
73
|
}
|
|
81
|
-
}
|
|
82
|
-
|
|
74
|
+
}
|
|
75
|
+
setTimetracks(timeTracks) {
|
|
83
76
|
this._timeTracksAreSet = true;
|
|
84
|
-
this.timeTrackInterpolationWorker.postMessage({ timeTracks
|
|
77
|
+
this.timeTrackInterpolationWorker.postMessage({ timeTracks });
|
|
85
78
|
if (this._time !== null) {
|
|
86
79
|
this.setTime(this._time);
|
|
87
80
|
}
|
|
88
81
|
this.globe.DrawRender();
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
|
|
82
|
+
}
|
|
83
|
+
setOpacity(opacity) {
|
|
84
|
+
opacityCheck(opacity);
|
|
92
85
|
this._opacity = opacity;
|
|
93
86
|
this.globe.DrawRender();
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
this.timeTrackInterpolationWorker.postMessage({ geometry
|
|
87
|
+
}
|
|
88
|
+
setGeometry() {
|
|
89
|
+
const geometry = this.globe.api_GetCurrentGeometry();
|
|
90
|
+
this.timeTrackInterpolationWorker.postMessage({ geometry });
|
|
98
91
|
if (this._time !== null) {
|
|
99
92
|
this.setTime(this._time);
|
|
100
93
|
}
|
|
101
|
-
}
|
|
102
|
-
|
|
94
|
+
}
|
|
95
|
+
draw3D() {
|
|
103
96
|
if (this.isReady()) {
|
|
104
97
|
this.flow.draw(this._legendTexture, this._pointSize, this._opacity);
|
|
105
98
|
}
|
|
106
|
-
}
|
|
107
|
-
|
|
99
|
+
}
|
|
100
|
+
resize() {
|
|
108
101
|
this.flow.resize();
|
|
109
102
|
if (this._time !== null) {
|
|
110
103
|
this.setTime(this._time);
|
|
111
104
|
}
|
|
112
|
-
}
|
|
113
|
-
|
|
105
|
+
}
|
|
106
|
+
isReady() {
|
|
114
107
|
return (this.gl !== null && this._legendTexture !== null && this._timeTracksAreSet);
|
|
115
|
-
}
|
|
116
|
-
|
|
108
|
+
}
|
|
109
|
+
free() {
|
|
117
110
|
if (this._isFreed)
|
|
118
111
|
return;
|
|
119
112
|
this.gl.deleteTexture(this._legendTexture);
|
|
@@ -125,7 +118,6 @@ var PointHeatmapPlugin = /** @class */ (function () {
|
|
|
125
118
|
this._legendTexture = null;
|
|
126
119
|
this.timeTrackInterpolationWorker.terminate();
|
|
127
120
|
this.timeTrackInterpolationWorker = null;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
}
|
|
131
|
-
exports.PointHeatmapPlugin = PointHeatmapPlugin;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
export { PointHeatmapPlugin };
|
|
@@ -1,23 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.PointHeatmapFlow = void 0;
|
|
4
|
-
var density_to_legend_1 = require("../programs/data2legend/density-to-legend");
|
|
5
|
-
var point_to_density_texture_1 = require("../programs/data2legend/point-to-density-texture");
|
|
1
|
+
import { densityToLegendProgramCache } from "../programs/data2legend/density-to-legend";
|
|
2
|
+
import { pointToDensityTextureCache } from "../programs/data2legend/point-to-density-texture";
|
|
6
3
|
// import { textureOnCanvasProgramCache } from "../util/programs/draw-texture-on-canvas";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
import { defaultblendfunction } from "../util/webglobe/gldefaultstates";
|
|
5
|
+
class PointHeatmapFlow {
|
|
6
|
+
constructor(globe) {
|
|
10
7
|
this.globe = null;
|
|
11
8
|
this.gl = null;
|
|
12
9
|
this.program = null;
|
|
13
10
|
this.densityToLegendProgram = null;
|
|
14
11
|
this.globe = globe;
|
|
15
12
|
this.gl = globe.gl;
|
|
16
|
-
this.pointToDensityProgram =
|
|
17
|
-
this.densityToLegendProgram =
|
|
13
|
+
this.pointToDensityProgram = pointToDensityTextureCache.get(globe);
|
|
14
|
+
this.densityToLegendProgram = densityToLegendProgramCache.get(globe);
|
|
18
15
|
// this.testTextureProgram = textureOnCanvasProgramCache.get(globe.gl);
|
|
19
16
|
this._lookInfo = globe.api_GetCurrentLookInfo();
|
|
20
|
-
|
|
17
|
+
const { gl } = this;
|
|
21
18
|
{
|
|
22
19
|
this.buffer = gl.createBuffer();
|
|
23
20
|
this.vao2D = this.pointToDensityProgram.createVAO(this.buffer, 2);
|
|
@@ -29,15 +26,14 @@ var PointHeatmapFlow = /** @class */ (function () {
|
|
|
29
26
|
this._bindTextureToFramebuffer();
|
|
30
27
|
}
|
|
31
28
|
}
|
|
32
|
-
|
|
33
|
-
|
|
29
|
+
_bindTextureToFramebuffer() {
|
|
30
|
+
const { gl, densityTexture, framebuffer } = this;
|
|
34
31
|
gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer);
|
|
35
32
|
gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, densityTexture, 0);
|
|
36
33
|
gl.bindFramebuffer(gl.FRAMEBUFFER, null);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
var _a = this, gl = _a.gl, globe = _a.globe, framebuffer = _a.framebuffer;
|
|
34
|
+
}
|
|
35
|
+
draw(legendTexture, pointSize, opacity = 1.0) {
|
|
36
|
+
const { gl, globe, framebuffer } = this;
|
|
41
37
|
if (this._drawDensityRequired || this._isVisionChanged()) {
|
|
42
38
|
gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer);
|
|
43
39
|
gl.clearColor(0, 0, 0, 0);
|
|
@@ -46,36 +42,36 @@ var PointHeatmapFlow = /** @class */ (function () {
|
|
|
46
42
|
this._drawDensity(pointSize);
|
|
47
43
|
gl.bindFramebuffer(gl.FRAMEBUFFER, null);
|
|
48
44
|
}
|
|
49
|
-
|
|
45
|
+
defaultblendfunction(gl);
|
|
50
46
|
this._drawLegend(legendTexture, opacity);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
|
|
47
|
+
}
|
|
48
|
+
resize() {
|
|
49
|
+
const { gl, densityTexture } = this;
|
|
54
50
|
gl.deleteTexture(densityTexture);
|
|
55
51
|
this.densityTexture = this._createDensityTexture();
|
|
56
52
|
this._bindTextureToFramebuffer();
|
|
57
53
|
this._drawDensityRequired = true;
|
|
58
|
-
}
|
|
54
|
+
}
|
|
59
55
|
// USER API
|
|
60
56
|
/**
|
|
61
57
|
* @param {Float32Array} data
|
|
62
58
|
* @format [x, y, z, height] x,y,z is normalized 3d cartesian coordinates. Height in kilometers. Set 6378.137 for ground level.
|
|
63
59
|
*/
|
|
64
|
-
|
|
65
|
-
|
|
60
|
+
setData(data) {
|
|
61
|
+
const { gl, buffer } = this;
|
|
66
62
|
gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
|
|
67
63
|
gl.bufferData(gl.ARRAY_BUFFER, data, gl.STATIC_DRAW);
|
|
68
64
|
// use program
|
|
69
65
|
this.dataLength = data.length;
|
|
70
66
|
this._drawDensityRequired = true;
|
|
71
67
|
this.globe.DrawRender();
|
|
72
|
-
}
|
|
68
|
+
}
|
|
73
69
|
// implicit Methods
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
70
|
+
_createDensityTexture() {
|
|
71
|
+
const { gl, globe } = this;
|
|
72
|
+
const width = Math.floor(globe.api_ScrW());
|
|
73
|
+
const height = Math.floor(globe.api_ScrH());
|
|
74
|
+
const texture = gl.createTexture();
|
|
79
75
|
gl.bindTexture(gl.TEXTURE_2D, texture);
|
|
80
76
|
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, width, height, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
|
|
81
77
|
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
|
|
@@ -83,24 +79,24 @@ var PointHeatmapFlow = /** @class */ (function () {
|
|
|
83
79
|
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
|
|
84
80
|
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
|
|
85
81
|
return texture;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
82
|
+
}
|
|
83
|
+
_drawDensity(pointSize) {
|
|
84
|
+
const { gl, globe, pointToDensityProgram, vao2D, vao3D, dataLength } = this;
|
|
85
|
+
const is3D = globe.api_GetCurrentGeometry() === 0;
|
|
86
|
+
const vao = is3D ? vao3D : vao2D;
|
|
87
|
+
const length = dataLength / (is3D ? 3 : 2);
|
|
92
88
|
gl.blendEquation(gl.FUNC_ADD);
|
|
93
89
|
gl.blendFuncSeparate(gl.SRC_ALPHA, gl.ONE, gl.SRC_ALPHA, gl.ONE);
|
|
94
90
|
pointToDensityProgram.draw(vao, length, pointSize);
|
|
95
91
|
this._drawDensityRequired = false;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
|
|
92
|
+
}
|
|
93
|
+
_drawLegend(legendTexture, opacity) {
|
|
94
|
+
const { densityToLegendProgram, densityTexture } = this;
|
|
99
95
|
densityToLegendProgram.draw(densityTexture, legendTexture, opacity);
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
96
|
+
}
|
|
97
|
+
_isVisionChanged() {
|
|
98
|
+
const currentLookInfo = this.globe.api_GetCurrentLookInfo();
|
|
99
|
+
const _lookInfo = this._lookInfo;
|
|
104
100
|
if (currentLookInfo.CenterLong !== _lookInfo.CenterLong ||
|
|
105
101
|
currentLookInfo.CenterLat !== _lookInfo.CenterLat ||
|
|
106
102
|
currentLookInfo.Distance !== _lookInfo.Distance ||
|
|
@@ -110,20 +106,19 @@ var PointHeatmapFlow = /** @class */ (function () {
|
|
|
110
106
|
return true;
|
|
111
107
|
}
|
|
112
108
|
return false;
|
|
113
|
-
}
|
|
114
|
-
|
|
109
|
+
}
|
|
110
|
+
free() {
|
|
115
111
|
if (this._isFreed)
|
|
116
112
|
return;
|
|
117
113
|
this._isFreed = true;
|
|
118
|
-
|
|
119
|
-
|
|
114
|
+
densityToLegendProgramCache.release(this.globe);
|
|
115
|
+
pointToDensityTextureCache.release(this.globe);
|
|
120
116
|
// textureOnCanvasProgramCache.release(this.gl);
|
|
121
117
|
this.gl.deleteTexture(this.densityTexture);
|
|
122
118
|
this.gl.deleteFramebuffer(this.framebuffer);
|
|
123
119
|
this.gl.deleteBuffer(this.buffer);
|
|
124
120
|
this.gl.deleteVertexArray(this.vao2D);
|
|
125
121
|
this.gl.deleteVertexArray(this.vao3D);
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
}
|
|
129
|
-
exports.PointHeatmapFlow = PointHeatmapFlow;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
export { PointHeatmapFlow };
|
|
@@ -1,5 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.pointKeyMeyhod = void 0;
|
|
4
|
-
var pointKeyMeyhod = function (trackId, pointID) { return "".concat(trackId, "-").concat(pointID); };
|
|
5
|
-
exports.pointKeyMeyhod = pointKeyMeyhod;
|
|
1
|
+
const pointKeyMeyhod = (trackId, pointID) => `${trackId}-${pointID}`;
|
|
2
|
+
export { pointKeyMeyhod };
|