@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,131 @@
|
|
|
1
|
+
"use strict";
|
|
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");
|
|
5
|
+
// import { webworkerStr } from "../util/interpolation/timetrack/web-worker-str"; // TODO: Delete When this plugin is tested on production
|
|
6
|
+
var index_1 = require("../util/interpolation/timetrack/index");
|
|
7
|
+
var util_1 = require("../util");
|
|
8
|
+
var typecheck_1 = require("../util/check/typecheck");
|
|
9
|
+
var PointHeatmapPlugin = /** @class */ (function () {
|
|
10
|
+
function PointHeatmapPlugin(id, _a) {
|
|
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;
|
|
13
|
+
this.id = id;
|
|
14
|
+
this.globe = null;
|
|
15
|
+
this.gl = null;
|
|
16
|
+
this.densityToLegendProgram = null;
|
|
17
|
+
this._time = null;
|
|
18
|
+
this._opacity = opacity;
|
|
19
|
+
this._pointSize = pointSize;
|
|
20
|
+
this._legendTexture = null;
|
|
21
|
+
this._throttleListener = null;
|
|
22
|
+
this._timeTracksAreSet = false;
|
|
23
|
+
// const blob = new Blob([webworkerStr], { type: 'application/javascript' });
|
|
24
|
+
// this.timeTrackInterpolationWorker = new Worker(URL.createObjectURL(blob), { type: 'module' });
|
|
25
|
+
this.timeTrackInterpolationWorker = (0, index_1.createWorker)();
|
|
26
|
+
this.timeTrackInterpolationWorker.onmessage = function (e) {
|
|
27
|
+
if (e.data.error) {
|
|
28
|
+
throw new Error(e.data.error);
|
|
29
|
+
}
|
|
30
|
+
if (e.data === true) {
|
|
31
|
+
onInterpolationComplete();
|
|
32
|
+
}
|
|
33
|
+
if (e.data instanceof Float32Array) {
|
|
34
|
+
_this.flow.setData(e.data);
|
|
35
|
+
_this._throttleListener = null;
|
|
36
|
+
onInterpolationComplete();
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
// globe interaction
|
|
41
|
+
PointHeatmapPlugin.prototype.init = function (globe, gl) {
|
|
42
|
+
this.globe = globe;
|
|
43
|
+
this.gl = gl;
|
|
44
|
+
this.flow = new point_to_heat_map_flow_1.PointHeatmapFlow(globe);
|
|
45
|
+
this.setGeometry();
|
|
46
|
+
this.resize();
|
|
47
|
+
};
|
|
48
|
+
PointHeatmapPlugin.prototype.setPointSize = function (pointSize) {
|
|
49
|
+
(0, typecheck_1.constraintFloat)(pointSize, 1);
|
|
50
|
+
this._pointSize = pointSize;
|
|
51
|
+
this.globe.DrawRender();
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* @param {Array<string>}
|
|
55
|
+
* @param {string} mode "interpolated" | "discrete"
|
|
56
|
+
*/
|
|
57
|
+
PointHeatmapPlugin.prototype.setColorRamp = function (values, thresholds, mode) {
|
|
58
|
+
if (mode === void 0) { mode = "interpolated"; }
|
|
59
|
+
var gl = this.gl;
|
|
60
|
+
if (this.gl === null) {
|
|
61
|
+
throw new Error('Plugin not initialized');
|
|
62
|
+
}
|
|
63
|
+
;
|
|
64
|
+
var rampData = (0, util_1.getColorRampModed)(values, thresholds, mode);
|
|
65
|
+
var texture = (0, util_1.createTexture)(gl, gl.LINEAR, rampData, 256, 1);
|
|
66
|
+
if (this._legendTexture) {
|
|
67
|
+
this.gl.deleteTexture(this._legendTexture);
|
|
68
|
+
}
|
|
69
|
+
this._legendTexture = texture;
|
|
70
|
+
this.globe.DrawRender();
|
|
71
|
+
};
|
|
72
|
+
PointHeatmapPlugin.prototype.setTime = function (time) {
|
|
73
|
+
var _this = this;
|
|
74
|
+
// TODO: WORK ON THIS
|
|
75
|
+
this._time = time;
|
|
76
|
+
if (this.isReady() && this._throttleListener === null) {
|
|
77
|
+
this._throttleListener = setTimeout(function () {
|
|
78
|
+
_this.timeTrackInterpolationWorker.postMessage({ time: _this._time });
|
|
79
|
+
}, 0);
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
PointHeatmapPlugin.prototype.setTimetracks = function (timeTracks) {
|
|
83
|
+
this._timeTracksAreSet = true;
|
|
84
|
+
this.timeTrackInterpolationWorker.postMessage({ timeTracks: timeTracks });
|
|
85
|
+
if (this._time !== null) {
|
|
86
|
+
this.setTime(this._time);
|
|
87
|
+
}
|
|
88
|
+
this.globe.DrawRender();
|
|
89
|
+
};
|
|
90
|
+
PointHeatmapPlugin.prototype.setOpacity = function (opacity) {
|
|
91
|
+
(0, typecheck_1.opacityCheck)(opacity);
|
|
92
|
+
this._opacity = opacity;
|
|
93
|
+
this.globe.DrawRender();
|
|
94
|
+
};
|
|
95
|
+
PointHeatmapPlugin.prototype.setGeometry = function () {
|
|
96
|
+
var geometry = this.globe.api_GetCurrentGeometry();
|
|
97
|
+
this.timeTrackInterpolationWorker.postMessage({ geometry: geometry });
|
|
98
|
+
if (this._time !== null) {
|
|
99
|
+
this.setTime(this._time);
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
PointHeatmapPlugin.prototype.draw3D = function () {
|
|
103
|
+
if (this.isReady()) {
|
|
104
|
+
this.flow.draw(this._legendTexture, this._pointSize, this._opacity);
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
PointHeatmapPlugin.prototype.resize = function () {
|
|
108
|
+
this.flow.resize();
|
|
109
|
+
if (this._time !== null) {
|
|
110
|
+
this.setTime(this._time);
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
PointHeatmapPlugin.prototype.isReady = function () {
|
|
114
|
+
return (this.gl !== null && this._legendTexture !== null && this._timeTracksAreSet);
|
|
115
|
+
};
|
|
116
|
+
PointHeatmapPlugin.prototype.free = function () {
|
|
117
|
+
if (this._isFreed)
|
|
118
|
+
return;
|
|
119
|
+
this.gl.deleteTexture(this._legendTexture);
|
|
120
|
+
this.flow.free();
|
|
121
|
+
this.flow = null;
|
|
122
|
+
this.gl = null;
|
|
123
|
+
this._isFreed = true;
|
|
124
|
+
this.timeTrackInterpolator = null;
|
|
125
|
+
this._legendTexture = null;
|
|
126
|
+
this.timeTrackInterpolationWorker.terminate();
|
|
127
|
+
this.timeTrackInterpolationWorker = null;
|
|
128
|
+
};
|
|
129
|
+
return PointHeatmapPlugin;
|
|
130
|
+
}());
|
|
131
|
+
exports.PointHeatmapPlugin = PointHeatmapPlugin;
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
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");
|
|
6
|
+
// import { textureOnCanvasProgramCache } from "../util/programs/draw-texture-on-canvas";
|
|
7
|
+
var gldefaultstates_1 = require("../util/webglobe/gldefaultstates");
|
|
8
|
+
var PointHeatmapFlow = /** @class */ (function () {
|
|
9
|
+
function PointHeatmapFlow(globe) {
|
|
10
|
+
this.globe = null;
|
|
11
|
+
this.gl = null;
|
|
12
|
+
this.program = null;
|
|
13
|
+
this.densityToLegendProgram = null;
|
|
14
|
+
this.globe = globe;
|
|
15
|
+
this.gl = globe.gl;
|
|
16
|
+
this.pointToDensityProgram = point_to_density_texture_1.pointToDensityTextureCache.get(globe);
|
|
17
|
+
this.densityToLegendProgram = density_to_legend_1.densityToLegendProgramCache.get(globe);
|
|
18
|
+
// this.testTextureProgram = textureOnCanvasProgramCache.get(globe.gl);
|
|
19
|
+
this._lookInfo = globe.api_GetCurrentLookInfo();
|
|
20
|
+
var gl = this.gl;
|
|
21
|
+
{
|
|
22
|
+
this.buffer = gl.createBuffer();
|
|
23
|
+
this.vao2D = this.pointToDensityProgram.createVAO(this.buffer, 2);
|
|
24
|
+
this.vao3D = this.pointToDensityProgram.createVAO(this.buffer, 3);
|
|
25
|
+
}
|
|
26
|
+
{ // framebuffer and texture
|
|
27
|
+
this.framebuffer = gl.createFramebuffer();
|
|
28
|
+
this.densityTexture = this._createDensityTexture();
|
|
29
|
+
this._bindTextureToFramebuffer();
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
PointHeatmapFlow.prototype._bindTextureToFramebuffer = function () {
|
|
33
|
+
var _a = this, gl = _a.gl, densityTexture = _a.densityTexture, framebuffer = _a.framebuffer;
|
|
34
|
+
gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer);
|
|
35
|
+
gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, densityTexture, 0);
|
|
36
|
+
gl.bindFramebuffer(gl.FRAMEBUFFER, null);
|
|
37
|
+
};
|
|
38
|
+
PointHeatmapFlow.prototype.draw = function (legendTexture, pointSize, opacity) {
|
|
39
|
+
if (opacity === void 0) { opacity = 1.0; }
|
|
40
|
+
var _a = this, gl = _a.gl, globe = _a.globe, framebuffer = _a.framebuffer;
|
|
41
|
+
if (this._drawDensityRequired || this._isVisionChanged()) {
|
|
42
|
+
gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer);
|
|
43
|
+
gl.clearColor(0, 0, 0, 0);
|
|
44
|
+
gl.viewport(0, 0, Math.floor(globe.api_ScrW()), Math.floor(globe.api_ScrH()));
|
|
45
|
+
gl.clear(gl.COLOR_BUFFER_BIT);
|
|
46
|
+
this._drawDensity(pointSize);
|
|
47
|
+
gl.bindFramebuffer(gl.FRAMEBUFFER, null);
|
|
48
|
+
}
|
|
49
|
+
(0, gldefaultstates_1.defaultblendfunction)(gl);
|
|
50
|
+
this._drawLegend(legendTexture, opacity);
|
|
51
|
+
};
|
|
52
|
+
PointHeatmapFlow.prototype.resize = function () {
|
|
53
|
+
var _a = this, gl = _a.gl, densityTexture = _a.densityTexture;
|
|
54
|
+
gl.deleteTexture(densityTexture);
|
|
55
|
+
this.densityTexture = this._createDensityTexture();
|
|
56
|
+
this._bindTextureToFramebuffer();
|
|
57
|
+
this._drawDensityRequired = true;
|
|
58
|
+
};
|
|
59
|
+
// USER API
|
|
60
|
+
/**
|
|
61
|
+
* @param {Float32Array} data
|
|
62
|
+
* @format [x, y, z, height] x,y,z is normalized 3d cartesian coordinates. Height in kilometers. Set 6378.137 for ground level.
|
|
63
|
+
*/
|
|
64
|
+
PointHeatmapFlow.prototype.setData = function (data) {
|
|
65
|
+
var _a = this, gl = _a.gl, buffer = _a.buffer;
|
|
66
|
+
gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
|
|
67
|
+
gl.bufferData(gl.ARRAY_BUFFER, data, gl.STATIC_DRAW);
|
|
68
|
+
// use program
|
|
69
|
+
this.dataLength = data.length;
|
|
70
|
+
this._drawDensityRequired = true;
|
|
71
|
+
this.globe.DrawRender();
|
|
72
|
+
};
|
|
73
|
+
// implicit Methods
|
|
74
|
+
PointHeatmapFlow.prototype._createDensityTexture = function () {
|
|
75
|
+
var _a = this, gl = _a.gl, globe = _a.globe;
|
|
76
|
+
var width = Math.floor(globe.api_ScrW());
|
|
77
|
+
var height = Math.floor(globe.api_ScrH());
|
|
78
|
+
var texture = gl.createTexture();
|
|
79
|
+
gl.bindTexture(gl.TEXTURE_2D, texture);
|
|
80
|
+
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, width, height, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
|
|
81
|
+
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
|
|
82
|
+
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
|
|
83
|
+
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
|
|
84
|
+
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
|
|
85
|
+
return texture;
|
|
86
|
+
};
|
|
87
|
+
PointHeatmapFlow.prototype._drawDensity = function (pointSize) {
|
|
88
|
+
var _a = this, gl = _a.gl, globe = _a.globe, pointToDensityProgram = _a.pointToDensityProgram, vao2D = _a.vao2D, vao3D = _a.vao3D, dataLength = _a.dataLength;
|
|
89
|
+
var is3D = globe.api_GetCurrentGeometry() === 0;
|
|
90
|
+
var vao = is3D ? vao3D : vao2D;
|
|
91
|
+
var length = dataLength / (is3D ? 3 : 2);
|
|
92
|
+
gl.blendEquation(gl.FUNC_ADD);
|
|
93
|
+
gl.blendFuncSeparate(gl.SRC_ALPHA, gl.ONE, gl.SRC_ALPHA, gl.ONE);
|
|
94
|
+
pointToDensityProgram.draw(vao, length, pointSize);
|
|
95
|
+
this._drawDensityRequired = false;
|
|
96
|
+
};
|
|
97
|
+
PointHeatmapFlow.prototype._drawLegend = function (legendTexture, opacity) {
|
|
98
|
+
var _a = this, densityToLegendProgram = _a.densityToLegendProgram, densityTexture = _a.densityTexture;
|
|
99
|
+
densityToLegendProgram.draw(densityTexture, legendTexture, opacity);
|
|
100
|
+
};
|
|
101
|
+
PointHeatmapFlow.prototype._isVisionChanged = function () {
|
|
102
|
+
var currentLookInfo = this.globe.api_GetCurrentLookInfo();
|
|
103
|
+
var _lookInfo = this._lookInfo;
|
|
104
|
+
if (currentLookInfo.CenterLong !== _lookInfo.CenterLong ||
|
|
105
|
+
currentLookInfo.CenterLat !== _lookInfo.CenterLat ||
|
|
106
|
+
currentLookInfo.Distance !== _lookInfo.Distance ||
|
|
107
|
+
currentLookInfo.Tilt !== _lookInfo.Tilt ||
|
|
108
|
+
currentLookInfo.NorthAng !== _lookInfo.NorthAng) {
|
|
109
|
+
this._lookInfo = currentLookInfo;
|
|
110
|
+
return true;
|
|
111
|
+
}
|
|
112
|
+
return false;
|
|
113
|
+
};
|
|
114
|
+
PointHeatmapFlow.prototype.free = function () {
|
|
115
|
+
if (this._isFreed)
|
|
116
|
+
return;
|
|
117
|
+
this._isFreed = true;
|
|
118
|
+
density_to_legend_1.densityToLegendProgramCache.release(this.globe);
|
|
119
|
+
point_to_density_texture_1.pointToDensityTextureCache.release(this.globe);
|
|
120
|
+
// textureOnCanvasProgramCache.release(this.gl);
|
|
121
|
+
this.gl.deleteTexture(this.densityTexture);
|
|
122
|
+
this.gl.deleteFramebuffer(this.framebuffer);
|
|
123
|
+
this.gl.deleteBuffer(this.buffer);
|
|
124
|
+
this.gl.deleteVertexArray(this.vao2D);
|
|
125
|
+
this.gl.deleteVertexArray(this.vao3D);
|
|
126
|
+
};
|
|
127
|
+
return PointHeatmapFlow;
|
|
128
|
+
}());
|
|
129
|
+
exports.PointHeatmapFlow = PointHeatmapFlow;
|
|
@@ -0,0 +1,353 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.keyMethod = exports.PointTracksPlugin = void 0;
|
|
4
|
+
var account_1 = require("../util/account");
|
|
5
|
+
var picker_displayer_1 = require("../util/picking/picker-displayer");
|
|
6
|
+
var square_pixel_point_1 = require("../programs/point-on-globe/square-pixel-point");
|
|
7
|
+
var methods_1 = require("../Math/methods");
|
|
8
|
+
/**
|
|
9
|
+
* @typedef {number} long
|
|
10
|
+
* @typedef {number} lat
|
|
11
|
+
* @typedef {number} height
|
|
12
|
+
* @typedef {string} ID
|
|
13
|
+
* @typedef {string} trackID
|
|
14
|
+
* @typedef {[number, number, number, number]} rgba 0-1
|
|
15
|
+
* @typedef { long ,lat, height, ID } Point
|
|
16
|
+
* @typedef {Array<Point>, rgba, trackID} Track
|
|
17
|
+
*/
|
|
18
|
+
var PointTracksPlugin = /** @class */ (function () {
|
|
19
|
+
function PointTracksPlugin(id, _a) {
|
|
20
|
+
var _b = _a === void 0 ? {} : _a, _c = _b.pointSize, pointSize = _c === void 0 ? 2 : _c, _d = _b.hoveredPointSize, hoveredPointSize = _d === void 0 ? 4 : _d, _e = _b.selectionPointFilling, selectionPointFilling = _e === void 0 ? 4 : _e, _f = _b.opacity, opacity = _f === void 0 ? 1.0 : _f;
|
|
21
|
+
this.id = id;
|
|
22
|
+
this._isFreed = false;
|
|
23
|
+
this._pointProgram = null;
|
|
24
|
+
this._vao = null;
|
|
25
|
+
this._bufferManagersMap = null;
|
|
26
|
+
this._bufferOrchestrator = null;
|
|
27
|
+
this._pickerDisplayer = null;
|
|
28
|
+
this._selectedID = -1;
|
|
29
|
+
this._selectedObj = null;
|
|
30
|
+
this._tracksToPointsMap = new Map(); // one to many
|
|
31
|
+
this._opacity = opacity;
|
|
32
|
+
this.program = null;
|
|
33
|
+
this._lastWH = { w: 0, h: 0 };
|
|
34
|
+
this._focusParams = { on: false, length: 0, elementBuffer: null, trackIDs: [] };
|
|
35
|
+
this.pointSizes = {
|
|
36
|
+
pointSize: pointSize,
|
|
37
|
+
selectionPointFilling: selectionPointFilling,
|
|
38
|
+
hoveredPointSize: hoveredPointSize
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
PointTracksPlugin.prototype.init = function (globe, gl) {
|
|
42
|
+
this.globe = globe;
|
|
43
|
+
this.gl = gl;
|
|
44
|
+
this._pickerDisplayer = new picker_displayer_1.PickerDisplayer(globe);
|
|
45
|
+
this._pointProgram = square_pixel_point_1.PointOnGlobeProgramCache.get(globe);
|
|
46
|
+
this._focusParams.elementBuffer = gl.createBuffer();
|
|
47
|
+
this._initBufferManagers();
|
|
48
|
+
};
|
|
49
|
+
PointTracksPlugin.prototype._initBufferManagers = function () {
|
|
50
|
+
var gl = this.gl;
|
|
51
|
+
var initialCapacity = 10;
|
|
52
|
+
var bufferType = "DYNAMIC_DRAW";
|
|
53
|
+
this._bufferOrchestrator = new account_1.BufferOrchestrator({ initialCapacity: initialCapacity });
|
|
54
|
+
this._bufferManagersMap = new Map([
|
|
55
|
+
["pos3D", {
|
|
56
|
+
bufferManager: new account_1.BufferManager(gl, 3, { bufferType: bufferType, initialCapacity: initialCapacity }),
|
|
57
|
+
adaptor: function (item) { return new Float32Array((0, methods_1.wgs84ToCartesian3d)(item.long, item.lat, item.height / 1000)); } // height is in meters
|
|
58
|
+
}],
|
|
59
|
+
["pos2D", {
|
|
60
|
+
bufferManager: new account_1.BufferManager(gl, 2, { bufferType: bufferType, initialCapacity: initialCapacity }),
|
|
61
|
+
adaptor: function (item) { return new Float32Array((0, methods_1.wgs84ToMercator)(item.long, item.lat)); }
|
|
62
|
+
}],
|
|
63
|
+
["rgba", {
|
|
64
|
+
bufferManager: new account_1.BufferManager(gl, 4, { bufferType: bufferType, initialCapacity: initialCapacity }),
|
|
65
|
+
adaptor: function (item) { return item.rgba; }
|
|
66
|
+
}],
|
|
67
|
+
["objectStore", {
|
|
68
|
+
bufferManager: new account_1.ObjectStore({ initialCapacity: initialCapacity }),
|
|
69
|
+
adaptor: function (item) {
|
|
70
|
+
return {
|
|
71
|
+
trackID: item.trackID, pointID: item.pointID
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
}]
|
|
75
|
+
]);
|
|
76
|
+
this._vao = this._pointProgram.createVAO(this._bufferManagersMap.get("pos3D").bufferManager.buffer, this._bufferManagersMap.get("pos2D").bufferManager.buffer, this._bufferManagersMap.get("rgba").bufferManager.buffer);
|
|
77
|
+
};
|
|
78
|
+
PointTracksPlugin.prototype.setPointSize = function (size) {
|
|
79
|
+
var _a;
|
|
80
|
+
this.pointSizes.pointSize = size;
|
|
81
|
+
(_a = this.globe) === null || _a === void 0 ? void 0 : _a.DrawRender();
|
|
82
|
+
};
|
|
83
|
+
PointTracksPlugin.prototype.setSelectionPointFilling = function (size) {
|
|
84
|
+
var _a;
|
|
85
|
+
this.pointSizes.selectionPointFilling = size;
|
|
86
|
+
(_a = this.globe) === null || _a === void 0 ? void 0 : _a.DrawRender();
|
|
87
|
+
};
|
|
88
|
+
PointTracksPlugin.prototype.setHoveredPointSize = function (size) {
|
|
89
|
+
var _a;
|
|
90
|
+
this.pointSizes.hoveredPointSize = size;
|
|
91
|
+
(_a = this.globe) === null || _a === void 0 ? void 0 : _a.DrawRender();
|
|
92
|
+
};
|
|
93
|
+
PointTracksPlugin.prototype.setOpacity = function (opacity) {
|
|
94
|
+
var _a;
|
|
95
|
+
if (opacity < 0 || opacity > 1)
|
|
96
|
+
return;
|
|
97
|
+
this._opacity = opacity;
|
|
98
|
+
(_a = this.globe) === null || _a === void 0 ? void 0 : _a.DrawRender();
|
|
99
|
+
};
|
|
100
|
+
PointTracksPlugin.prototype.getCurrentSelection = function () {
|
|
101
|
+
return this._selectedObj;
|
|
102
|
+
};
|
|
103
|
+
/**
|
|
104
|
+
*
|
|
105
|
+
* @param {*} x screen x
|
|
106
|
+
* @param {*} y screen y
|
|
107
|
+
* @param {*} callback callback on selection
|
|
108
|
+
*/
|
|
109
|
+
PointTracksPlugin.prototype.screenSelection = function (x, y, callback) {
|
|
110
|
+
var _this = this;
|
|
111
|
+
var _a = this, pointSizes = _a.pointSizes, _pickerDisplayer = _a._pickerDisplayer;
|
|
112
|
+
var objectStore = this._bufferManagersMap.get("objectStore").bufferManager;
|
|
113
|
+
var wrapper = function (selectedIDsSet) {
|
|
114
|
+
var selectedIDs = Array.from(selectedIDsSet);
|
|
115
|
+
if (selectedIDs.length === 0) {
|
|
116
|
+
_this._selectedObj = null;
|
|
117
|
+
_this._selectedID = -1;
|
|
118
|
+
callback([]);
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
var selectedPoints = [];
|
|
122
|
+
for (var i = 0; i < selectedIDs.length; i++) {
|
|
123
|
+
var id = selectedIDs[i];
|
|
124
|
+
if (i === 0) {
|
|
125
|
+
_this._selectedID = id;
|
|
126
|
+
_this._selectedObj = objectStore.get(id);
|
|
127
|
+
}
|
|
128
|
+
var obj = objectStore.get(id);
|
|
129
|
+
selectedPoints.push(obj);
|
|
130
|
+
}
|
|
131
|
+
callback(selectedPoints);
|
|
132
|
+
};
|
|
133
|
+
_pickerDisplayer.pickXY(x, y, pointSizes.selectionPointFilling, wrapper);
|
|
134
|
+
};
|
|
135
|
+
/**
|
|
136
|
+
* @param {Array<Track>} tracks
|
|
137
|
+
* @returns
|
|
138
|
+
*/
|
|
139
|
+
PointTracksPlugin.prototype.insertBulk = function (tracks) {
|
|
140
|
+
var _a;
|
|
141
|
+
this._fillTracksToPointsMap(tracks); // TODO error should be at the top
|
|
142
|
+
var flattenedPoints = tracks.map(trackToFlatPoints).flat();
|
|
143
|
+
var currentLoad = this._bufferOrchestrator.length;
|
|
144
|
+
if (currentLoad + flattenedPoints.length >= 2147483647) {
|
|
145
|
+
throw new Error("Too many points, Point count cannot exceed 2147483647");
|
|
146
|
+
}
|
|
147
|
+
var _b = this, _bufferManagersMap = _b._bufferManagersMap, _bufferOrchestrator = _b._bufferOrchestrator;
|
|
148
|
+
_bufferOrchestrator.insertBulk(flattenedPoints, _bufferManagersMap);
|
|
149
|
+
this._refillFocus();
|
|
150
|
+
(_a = this.globe) === null || _a === void 0 ? void 0 : _a.DrawRender();
|
|
151
|
+
};
|
|
152
|
+
PointTracksPlugin.prototype.flush = function () {
|
|
153
|
+
var _a, _b;
|
|
154
|
+
var capacity = 100;
|
|
155
|
+
(_a = this._bufferOrchestrator) === null || _a === void 0 ? void 0 : _a.flush({ capacity: capacity });
|
|
156
|
+
this._bufferManagersMap.forEach(function (_a) {
|
|
157
|
+
var bufferManager = _a.bufferManager;
|
|
158
|
+
return bufferManager.resetWithCapacity(capacity);
|
|
159
|
+
});
|
|
160
|
+
this._turnOffFocus();
|
|
161
|
+
this._tracksToPointsMap.clear();
|
|
162
|
+
(_b = this.globe) === null || _b === void 0 ? void 0 : _b.DrawRender();
|
|
163
|
+
};
|
|
164
|
+
/**
|
|
165
|
+
* @param {string} trackID
|
|
166
|
+
*/
|
|
167
|
+
PointTracksPlugin.prototype.deleteTrack = function (trackID) {
|
|
168
|
+
var _a;
|
|
169
|
+
var pointSet = this._tracksToPointsMap.get(trackID);
|
|
170
|
+
var points = Array.from(pointSet);
|
|
171
|
+
var _b = this, _bufferOrchestrator = _b._bufferOrchestrator, _bufferManagersMap = _b._bufferManagersMap;
|
|
172
|
+
_bufferOrchestrator.deleteBulk(points.map(function (pointID) { return keyMethod(trackID, pointID); }), _bufferManagersMap);
|
|
173
|
+
this._tracksToPointsMap.delete(trackID);
|
|
174
|
+
this._redraw = true;
|
|
175
|
+
this._refillFocus();
|
|
176
|
+
(_a = this.globe) === null || _a === void 0 ? void 0 : _a.DrawRender();
|
|
177
|
+
};
|
|
178
|
+
/**
|
|
179
|
+
* @param {string} trackID
|
|
180
|
+
* @param {Array<string>} pointIDs
|
|
181
|
+
*/
|
|
182
|
+
PointTracksPlugin.prototype.deletePoints = function (trackID, pointIDs) {
|
|
183
|
+
var _a;
|
|
184
|
+
var _b = this, _bufferOrchestrator = _b._bufferOrchestrator, _bufferManagersMap = _b._bufferManagersMap;
|
|
185
|
+
_bufferOrchestrator.deleteBulk(pointIDs.map(function (pointID) { return keyMethod(trackID, pointID); }), _bufferManagersMap);
|
|
186
|
+
this._deletePointsFromTracksMap(trackID, pointIDs);
|
|
187
|
+
this._refillFocus();
|
|
188
|
+
(_a = this.globe) === null || _a === void 0 ? void 0 : _a.DrawRender();
|
|
189
|
+
};
|
|
190
|
+
PointTracksPlugin.prototype.focusTracks = function (trackIDs) {
|
|
191
|
+
var _a;
|
|
192
|
+
if (trackIDs === void 0) { trackIDs = null; }
|
|
193
|
+
if (!this.globe)
|
|
194
|
+
return;
|
|
195
|
+
if (!trackIDs) {
|
|
196
|
+
this._focusParams.on = false;
|
|
197
|
+
(_a = this.globe) === null || _a === void 0 ? void 0 : _a.DrawRender();
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
|
+
this._focusParams.on = this._fillElementBuffer(trackIDs);
|
|
201
|
+
if (!this._focusParams.on) {
|
|
202
|
+
this._turnOffFocus();
|
|
203
|
+
}
|
|
204
|
+
this.globe.DrawRender();
|
|
205
|
+
};
|
|
206
|
+
// GLOBE API METHODS
|
|
207
|
+
PointTracksPlugin.prototype.free = function () {
|
|
208
|
+
if (this._isFreed)
|
|
209
|
+
return;
|
|
210
|
+
this._isFreed = true;
|
|
211
|
+
this._pickerDisplayer.free();
|
|
212
|
+
square_pixel_point_1.PointOnGlobeProgramCache.release(this.globe);
|
|
213
|
+
this.gl.deleteBuffer(this._focusParams.elementBuffer);
|
|
214
|
+
this._bufferManagersMap.forEach(function (_a) {
|
|
215
|
+
var bufferManager = _a.bufferManager, adaptor = _a.adaptor;
|
|
216
|
+
return bufferManager.free();
|
|
217
|
+
});
|
|
218
|
+
};
|
|
219
|
+
PointTracksPlugin.prototype.draw3D = function () {
|
|
220
|
+
var _a = this, gl = _a.gl, _pointProgram = _a._pointProgram, _pickerDisplayer = _a._pickerDisplayer, _bufferOrchestrator = _a._bufferOrchestrator, _vao = _a._vao;
|
|
221
|
+
this.resize();
|
|
222
|
+
_pickerDisplayer.bindFBO();
|
|
223
|
+
_pickerDisplayer.clearTextures();
|
|
224
|
+
if (this._focusParams.on) {
|
|
225
|
+
_pointProgram.draw(_vao, this._focusParams.length, {
|
|
226
|
+
hoveredID: this._selectedID,
|
|
227
|
+
opacity: this._opacity,
|
|
228
|
+
pointSize: this.pointSizes.pointSize,
|
|
229
|
+
hoveredPointSize: this.pointSizes.hoveredPointSize,
|
|
230
|
+
elementBuffer: this._focusParams.elementBuffer
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
else {
|
|
234
|
+
_pointProgram.draw(_vao, _bufferOrchestrator.length, {
|
|
235
|
+
hoveredID: this._selectedID,
|
|
236
|
+
opacity: this._opacity,
|
|
237
|
+
pointSize: this.pointSizes.pointSize,
|
|
238
|
+
hoveredPointSize: this.pointSizes.hoveredPointSize
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
gl.bindFramebuffer(gl.FRAMEBUFFER, null);
|
|
242
|
+
_pickerDisplayer.drawColorTexture();
|
|
243
|
+
this._selfSelect();
|
|
244
|
+
};
|
|
245
|
+
PointTracksPlugin.prototype.resize = function () {
|
|
246
|
+
var _a;
|
|
247
|
+
var w = this.globe.api_ScrW();
|
|
248
|
+
var h = this.globe.api_ScrH();
|
|
249
|
+
if (w === this._lastWH.w && h === this._lastWH.h)
|
|
250
|
+
return;
|
|
251
|
+
this._lastWH.w = w;
|
|
252
|
+
this._lastWH.h = h;
|
|
253
|
+
this._pickerDisplayer.resize();
|
|
254
|
+
(_a = this.globe) === null || _a === void 0 ? void 0 : _a.DrawRender();
|
|
255
|
+
};
|
|
256
|
+
// IMPLICIT METHODS
|
|
257
|
+
PointTracksPlugin.prototype._fillTracksToPointsMap = function (tracks) {
|
|
258
|
+
for (var _i = 0, tracks_1 = tracks; _i < tracks_1.length; _i++) {
|
|
259
|
+
var track = tracks_1[_i];
|
|
260
|
+
var trackID = track.trackID;
|
|
261
|
+
var points = track.points;
|
|
262
|
+
if (!this._tracksToPointsMap.has(trackID)) {
|
|
263
|
+
this._tracksToPointsMap.set(trackID, new Set());
|
|
264
|
+
}
|
|
265
|
+
var pointSet = this._tracksToPointsMap.get(trackID);
|
|
266
|
+
for (var p = 0; p < points.length; p++) {
|
|
267
|
+
var pointID = points[p].ID;
|
|
268
|
+
pointSet.add(pointID);
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
};
|
|
272
|
+
PointTracksPlugin.prototype._refillFocus = function () {
|
|
273
|
+
if (this._focusParams.on) {
|
|
274
|
+
this.focusTracks(this._focusParams.trackIDs);
|
|
275
|
+
}
|
|
276
|
+
};
|
|
277
|
+
PointTracksPlugin.prototype._deletePointsFromTracksMap = function (trackID, pointIDs) {
|
|
278
|
+
var trackSet = this._tracksToPointsMap.get(trackID);
|
|
279
|
+
for (var _i = 0, pointIDs_1 = pointIDs; _i < pointIDs_1.length; _i++) {
|
|
280
|
+
var pointID = pointIDs_1[_i];
|
|
281
|
+
trackSet.delete(pointID);
|
|
282
|
+
}
|
|
283
|
+
};
|
|
284
|
+
PointTracksPlugin.prototype._selfSelect = function () {
|
|
285
|
+
var globe = this.globe;
|
|
286
|
+
var pos = globe.api_GetMousePos();
|
|
287
|
+
var x = pos.canvasX;
|
|
288
|
+
var y = globe.api_ScrH() - pos.canvasY;
|
|
289
|
+
this.screenSelection(x, y, function (selectedPoints) {
|
|
290
|
+
});
|
|
291
|
+
};
|
|
292
|
+
PointTracksPlugin.prototype._turnOffFocus = function () {
|
|
293
|
+
var gl = this.gl;
|
|
294
|
+
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._focusParams.elementBuffer);
|
|
295
|
+
gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, new Uint32Array([]), gl.STATIC_DRAW);
|
|
296
|
+
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, null);
|
|
297
|
+
this._focusParams.length = 0;
|
|
298
|
+
this._focusParams.on = false;
|
|
299
|
+
};
|
|
300
|
+
PointTracksPlugin.prototype._fillElementBuffer = function (trackIDs) {
|
|
301
|
+
var length = 0;
|
|
302
|
+
var indexes = [];
|
|
303
|
+
var foundTracks = [];
|
|
304
|
+
for (var _i = 0, trackIDs_1 = trackIDs; _i < trackIDs_1.length; _i++) {
|
|
305
|
+
var trackID = trackIDs_1[_i];
|
|
306
|
+
var pointSet = this._tracksToPointsMap.get(trackID);
|
|
307
|
+
if (!pointSet)
|
|
308
|
+
continue;
|
|
309
|
+
foundTracks.push(trackID);
|
|
310
|
+
var points = Array.from(pointSet);
|
|
311
|
+
for (var _a = 0, points_1 = points; _a < points_1.length; _a++) {
|
|
312
|
+
var pointID = points_1[_a];
|
|
313
|
+
var key = keyMethod(trackID, pointID);
|
|
314
|
+
var index = this._bufferOrchestrator.offsetMap.get(key);
|
|
315
|
+
indexes.push(index);
|
|
316
|
+
length++;
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
this._focusParams.trackIDs = foundTracks;
|
|
320
|
+
this._focusParams.length = length;
|
|
321
|
+
if (length === 0) {
|
|
322
|
+
return false;
|
|
323
|
+
}
|
|
324
|
+
var gl = this.gl;
|
|
325
|
+
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._focusParams.elementBuffer);
|
|
326
|
+
gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, new Uint32Array(indexes), gl.STATIC_DRAW);
|
|
327
|
+
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, null);
|
|
328
|
+
return true;
|
|
329
|
+
};
|
|
330
|
+
return PointTracksPlugin;
|
|
331
|
+
}());
|
|
332
|
+
exports.PointTracksPlugin = PointTracksPlugin;
|
|
333
|
+
var trackToFlatPoints = function (track) {
|
|
334
|
+
var trackID = track.trackID;
|
|
335
|
+
var points = track.points;
|
|
336
|
+
var rgba = new Float32Array(track.rgba);
|
|
337
|
+
var flatPoints = [];
|
|
338
|
+
for (var _i = 0, points_2 = points; _i < points_2.length; _i++) {
|
|
339
|
+
var point = points_2[_i];
|
|
340
|
+
flatPoints.push({
|
|
341
|
+
key: keyMethod(trackID, point.ID),
|
|
342
|
+
long: point.long,
|
|
343
|
+
lat: point.lat,
|
|
344
|
+
height: point.height,
|
|
345
|
+
pointID: point.ID,
|
|
346
|
+
rgba: rgba,
|
|
347
|
+
trackID: trackID
|
|
348
|
+
});
|
|
349
|
+
}
|
|
350
|
+
return flatPoints;
|
|
351
|
+
};
|
|
352
|
+
var keyMethod = function (trackID, pointID) { return "".concat(trackID, "_").concat(pointID); };
|
|
353
|
+
exports.keyMethod = keyMethod;
|
|
@@ -0,0 +1,7 @@
|
|
|
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 object_1 = __importDefault(require("./object"));
|
|
7
|
+
exports.default = object_1.default;
|