@pirireis/webglobeplugins 0.9.11 → 0.9.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Math/angle-calculation.js +9 -11
- package/Math/arc.js +38 -41
- package/Math/bounds/line-bbox.js +79 -83
- package/Math/constants.js +4 -9
- package/Math/frustum/types.js +1 -2
- package/Math/juction/arc-plane.js +33 -36
- package/Math/juction/line-sphere.js +15 -18
- package/Math/juction/plane-plane.js +20 -23
- package/Math/line.js +42 -47
- package/Math/methods.js +69 -92
- package/Math/plane.js +33 -38
- package/Math/quaternion.js +48 -55
- package/Math/types.js +1 -2
- package/Math/utils.js +2 -4
- package/Math/vec3.js +46 -52
- package/algorithms/search-binary.js +5 -8
- package/altitude-locator/draw-subset-obj.js +8 -11
- package/altitude-locator/plugin.js +114 -133
- package/altitude-locator/types.js +1 -3
- package/arrowfield/adaptor.js +3 -7
- package/arrowfield/index.js +3 -10
- package/arrowfield/plugin.js +63 -69
- package/bearing-line/index.js +2 -8
- package/bearing-line/plugin.js +218 -248
- package/circle-line-chain/chain-list-map.js +82 -92
- package/circle-line-chain/plugin.js +147 -182
- package/circle-line-chain/util.js +1 -5
- package/compass-rose/compass-rose-padding-flat.js +111 -140
- package/compass-rose/compass-text-writer.js +63 -75
- package/compass-rose/index.js +3 -7
- package/compassrose/compassrose.js +50 -57
- package/compassrose/index.js +2 -8
- package/heatwave/index.js +3 -10
- package/heatwave/isobar/objectarraylabels.js +50 -56
- package/heatwave/isobar/plugin.js +111 -170
- package/heatwave/isobar/quadtreecontours.js +78 -96
- package/heatwave/plugins/heatwaveglobeshell.js +73 -94
- package/index.js +12 -58
- package/package.json +1 -1
- package/partialrings/buffer-manager.js +32 -70
- package/partialrings/index.js +2 -41
- package/partialrings/plugin.js +55 -98
- package/partialrings/program.js +141 -59
- package/pin/pin-object-array.js +89 -97
- package/pin/pin-point-totem.js +21 -22
- package/point-heat-map/adaptors/timetracksplugin-format-to-this.js +11 -14
- package/point-heat-map/plugin-webworker.js +45 -53
- package/point-heat-map/point-to-heat-map-flow.js +46 -51
- package/point-tracks/key-methods.js +2 -5
- package/point-tracks/plugin.js +141 -170
- package/programs/arrowfield/index.js +2 -7
- package/programs/arrowfield/logic.js +172 -67
- package/programs/arrowfield/object.js +35 -43
- package/programs/data2legend/density-to-legend.js +47 -26
- package/programs/data2legend/point-to-density-texture.js +56 -34
- package/programs/float2legendwithratio/index.js +2 -8
- package/programs/float2legendwithratio/logic.js +88 -45
- package/programs/float2legendwithratio/object.js +45 -54
- package/programs/globe-util/is-globe-moved.js +10 -13
- package/programs/globeshell/index.js +2 -8
- package/programs/globeshell/wiggle/index.js +2 -8
- package/programs/globeshell/wiggle/logic.js +191 -101
- package/programs/globeshell/wiggle/object.js +35 -43
- package/programs/helpers/blender/program.js +36 -22
- package/programs/helpers/fadeaway/index.js +2 -7
- package/programs/helpers/fadeaway/logic.js +36 -17
- package/programs/helpers/fadeaway/object.js +11 -18
- package/programs/helpers/index.js +2 -8
- package/programs/index.js +9 -58
- package/programs/line-on-globe/angled-line.js +95 -39
- package/programs/line-on-globe/circle-accurate-3d.js +86 -39
- package/programs/line-on-globe/circle-accurate-flat.js +116 -64
- package/programs/line-on-globe/circle-accurate.js +113 -46
- package/programs/line-on-globe/circle.js +106 -44
- package/programs/line-on-globe/degree-padding-around-circle-3d.js +89 -42
- package/programs/line-on-globe/lines-color-instanced-flat.js +84 -43
- package/programs/line-on-globe/linestrip.js +126 -63
- package/programs/line-on-globe/naive-accurate-flexible.js +126 -59
- package/programs/line-on-globe/to-the-surface.js +62 -35
- package/programs/line-on-globe/util.js +2 -5
- package/programs/picking/pickable-renderer.js +127 -46
- package/programs/point-on-globe/element-globe-surface-glow.js +83 -46
- package/programs/point-on-globe/element-point-glow.js +112 -47
- package/programs/point-on-globe/square-pixel-point.js +80 -34
- package/programs/programcache.js +14 -19
- package/programs/rings/distancering/circleflatprogram.js +76 -70
- package/programs/rings/distancering/circlepaddingfreeangleprogram.js +168 -194
- package/programs/rings/distancering/circlepaddysharedbuffer.js +121 -200
- package/programs/rings/distancering/index.js +5 -14
- package/programs/rings/distancering/paddyflatprogram.js +87 -70
- package/programs/rings/distancering/paddyflatprogram2d.js +89 -72
- package/programs/rings/distancering/paddyflatprogram3d.js +87 -70
- package/programs/rings/index.js +1 -17
- package/programs/rings/partial-ring/piece-of-pie.js +144 -44
- package/programs/totems/camerauniformblock.js +65 -56
- package/programs/totems/canvas-webglobe-info.js +49 -45
- package/programs/totems/gpu-selection-uniform-block.js +45 -45
- package/programs/totems/index.js +2 -40
- package/programs/two-d/pixel-padding-for-compass.js +94 -36
- package/programs/util.js +7 -10
- package/programs/vectorfields/index.js +3 -23
- package/programs/vectorfields/logics/drawrectangleparticles.js +73 -35
- package/programs/vectorfields/logics/index.js +4 -12
- package/programs/vectorfields/logics/pixelbased.js +94 -41
- package/programs/vectorfields/logics/ubo.js +32 -32
- package/programs/vectorfields/pingpongbuffermanager.js +30 -37
- package/rangerings/enum.js +2 -5
- package/rangerings/index.js +5 -15
- package/rangerings/plugin.js +223 -286
- package/rangerings/rangeringangletext.js +122 -137
- package/rangerings/ring-account.js +53 -75
- package/shaders/fragment-toy/firework.js +55 -4
- package/shaders/fragment-toy/singularity.js +56 -5
- package/timetracks/adaptors-line-strip.js +27 -44
- package/timetracks/adaptors.js +48 -67
- package/timetracks/index.js +5 -19
- package/timetracks/plugin-line-strip.js +65 -79
- package/timetracks/plugin.js +71 -85
- package/timetracks/program-line-strip.js +297 -107
- package/timetracks/program.js +421 -118
- package/timetracks/programpoint-line-strip.js +98 -48
- package/timetracks/programpoint.js +91 -48
- package/util/account/bufferoffsetmanager.js +72 -98
- package/util/account/index.js +3 -23
- package/util/account/single-attribute-buffer-management/buffer-manager.js +44 -48
- package/util/account/single-attribute-buffer-management/buffer-orchestrator.js +68 -98
- package/util/account/single-attribute-buffer-management/index.js +4 -9
- package/util/account/single-attribute-buffer-management/object-store.js +29 -34
- package/util/account/single-attribute-buffer-management/types.js +1 -2
- package/util/account/util.js +2 -8
- package/util/algorithms/search-binary.js +5 -8
- package/util/check/get.js +5 -9
- package/util/check/typecheck.js +13 -24
- package/util/geometry/index.js +10 -18
- package/util/gl-util/buffer/attribute-loader.js +10 -26
- package/util/gl-util/buffer/index.js +2 -5
- package/util/gl-util/draw-options/methods.js +10 -15
- package/util/gl-util/uniform-block/manager.js +69 -72
- package/util/heatwavedatamanager/datamanager.js +56 -119
- package/util/heatwavedatamanager/index.js +3 -10
- package/util/heatwavedatamanager/pointcoordinatesdatacalculator.js +38 -47
- package/util/heatwavedatamanager/pointcoordsmeta.js +9 -13
- package/util/index.js +13 -57
- package/util/interpolation/timetrack/index.js +2 -5
- package/util/interpolation/timetrack/timetrack-interpolator.js +30 -36
- package/util/interpolation/timetrack/web-worker-str.js +180 -5
- package/util/interpolation/timetrack/web-worker.js +4 -6
- package/util/jshelpers/data-filler.js +8 -11
- package/util/jshelpers/equality.js +1 -3
- package/util/jshelpers/index.js +2 -37
- package/util/jshelpers/timefilters.js +8 -10
- package/util/picking/fence.js +8 -11
- package/util/picking/picker-displayer.js +49 -58
- package/util/programs/draw-texture-on-canvas.js +41 -26
- package/util/programs/index.js +1 -17
- package/util/programs/shapesonglobe.js +104 -68
- package/util/programs/supersampletotextures.js +45 -43
- package/util/programs/texturetoglobe.js +99 -52
- package/util/shaderfunctions/geometrytransformations.js +323 -35
- package/util/shaderfunctions/index.js +2 -18
- package/util/shaderfunctions/nodata.js +8 -5
- package/util/shaderfunctions/noisefunctions.js +40 -12
- package/util/surface-line-data/arcs-to-cuts.js +20 -23
- package/util/webglobe/gldefaultstates.js +1 -4
- package/util/webglobe/index.js +2 -18
- package/util/webglobe/rasteroverlay.js +36 -41
- package/util/webglobjectbuilders.js +70 -93
- package/util/webglobjectbuilders1.js +63 -82
- package/waveparticles/adaptor.js +7 -10
- package/waveparticles/index.js +3 -10
- package/waveparticles/plugin.js +82 -90
- package/wind/imagetovectorfieldandmagnitude.js +16 -19
- package/wind/index.js +5 -14
- package/wind/plugin.js +454 -291
- package/wind/vectorfieldimage.js +6 -8
- package/write-text/attached-text-writer.js +48 -54
- package/write-text/context-text.js +52 -63
- package/write-text/context-text3.js +71 -80
- package/write-text/index.js +1 -5
|
@@ -1,13 +1,8 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/**
|
|
3
2
|
* Author: Toprak Nihat Deniz Ozturk
|
|
4
3
|
*/
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
};
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
var program_line_strip_1 = __importDefault(require("./program-line-strip"));
|
|
10
|
-
var programpoint_line_strip_1 = __importDefault(require("./programpoint-line-strip"));
|
|
4
|
+
import TrackGlowLineProgram from './program-line-strip';
|
|
5
|
+
import PointProgram from './programpoint-line-strip';
|
|
11
6
|
/**
|
|
12
7
|
* @typedef {Float32Array} TimeTrackMultiColorData | A linestring is representation, let A{a1, a2, a3}, B{b1, b2} be the points of the line.
|
|
13
8
|
* TimeTrackMultiColorData is [
|
|
@@ -36,7 +31,7 @@ var programpoint_line_strip_1 = __importDefault(require("./programpoint-line-str
|
|
|
36
31
|
uses float32array in a * {@link TimeTrackMultiColorData} format
|
|
37
32
|
|
|
38
33
|
*/
|
|
39
|
-
|
|
34
|
+
export default class TimeTrackMultiColorPlugin {
|
|
40
35
|
/**
|
|
41
36
|
* @param {String} id
|
|
42
37
|
* @param {Object} options
|
|
@@ -52,9 +47,7 @@ var TimeTrackMultiColorPlugin = /** @class */ (function () {
|
|
|
52
47
|
* @param {number} pointOptions.pointSize 0 ~ inf
|
|
53
48
|
* @param {boolean} pointOptions.isOn true | false
|
|
54
49
|
*/
|
|
55
|
-
|
|
56
|
-
if (options === void 0) { options = {}; }
|
|
57
|
-
var _b = _a === void 0 ? {} : _a, _c = _b.opacity, opacity = _c === void 0 ? 1.0 : _c, _d = _b.pointSize, pointSize = _d === void 0 ? 1 : _d, _e = _b.isOn, isOn = _e === void 0 ? false : _e;
|
|
50
|
+
constructor(id, options = {}, { opacity = 1.0, pointSize = 1, isOn = false } = {}) {
|
|
58
51
|
this.id = id;
|
|
59
52
|
this.globe = null;
|
|
60
53
|
this.gl = null;
|
|
@@ -63,7 +56,7 @@ var TimeTrackMultiColorPlugin = /** @class */ (function () {
|
|
|
63
56
|
this._tailTime = 0;
|
|
64
57
|
this._data = options.data || null;
|
|
65
58
|
this._options = options;
|
|
66
|
-
this._pointOptions = { opacity
|
|
59
|
+
this._pointOptions = { opacity, pointSize, isOn };
|
|
67
60
|
this.program = null;
|
|
68
61
|
this._transporArr = new Float32Array(3);
|
|
69
62
|
this._ready = false;
|
|
@@ -73,86 +66,85 @@ var TimeTrackMultiColorPlugin = /** @class */ (function () {
|
|
|
73
66
|
// ----------------------------------
|
|
74
67
|
// --- user methods ---
|
|
75
68
|
// ----------------------------------
|
|
76
|
-
|
|
77
|
-
var _a;
|
|
69
|
+
setHeadAndTailTime(headTime, tailTime) {
|
|
78
70
|
this._headTime = headTime;
|
|
79
71
|
this._tailTime = tailTime;
|
|
80
72
|
// console.log("setHeadAndTailTime", headTime, tailTime);
|
|
81
|
-
|
|
73
|
+
this.pointProgram?.setHeadTime(headTime);
|
|
82
74
|
this.globe.DrawRender();
|
|
83
|
-
}
|
|
84
|
-
|
|
75
|
+
}
|
|
76
|
+
setBlurWeights(weights) {
|
|
85
77
|
this.program.setBlurWeights(weights);
|
|
86
78
|
this.globe.DrawRender();
|
|
87
|
-
}
|
|
88
|
-
|
|
79
|
+
}
|
|
80
|
+
setHeadPercentage(headPercentage) {
|
|
89
81
|
this.program.setHeadPercentage(headPercentage);
|
|
90
82
|
this.globe.DrawRender();
|
|
91
|
-
}
|
|
92
|
-
|
|
83
|
+
}
|
|
84
|
+
setRouteAlpha(routeAlpha) {
|
|
93
85
|
this.program.setRouteAlpha(routeAlpha);
|
|
94
86
|
this.globe.DrawRender();
|
|
95
|
-
}
|
|
96
|
-
|
|
87
|
+
}
|
|
88
|
+
setFinalAlphaRatio(finalAlphaRatio) {
|
|
97
89
|
this.program.setFinalAlphaRatio(finalAlphaRatio);
|
|
98
90
|
this.globe.DrawRender();
|
|
99
|
-
}
|
|
100
|
-
|
|
91
|
+
}
|
|
92
|
+
setGamma(gamma) {
|
|
101
93
|
this.program.setGamma(gamma);
|
|
102
94
|
this.globe.DrawRender();
|
|
103
|
-
}
|
|
104
|
-
|
|
95
|
+
}
|
|
96
|
+
setExposure(exposure) {
|
|
105
97
|
this.program.setExposure(exposure);
|
|
106
98
|
this.globe.DrawRender();
|
|
107
|
-
}
|
|
108
|
-
|
|
99
|
+
}
|
|
100
|
+
setBlurRepetition(repetition) {
|
|
109
101
|
this.program.setBlurRepetition(repetition);
|
|
110
102
|
this.globe.DrawRender();
|
|
111
|
-
}
|
|
103
|
+
}
|
|
112
104
|
// ---------------point program setters-------------------
|
|
113
|
-
|
|
105
|
+
setPointOpacity(opacity) {
|
|
114
106
|
this._pointOptions.opacity = opacity;
|
|
115
107
|
if (this.pointProgram) {
|
|
116
108
|
this.pointProgram.setOpacity(opacity);
|
|
117
109
|
this.globe.DrawRender();
|
|
118
110
|
}
|
|
119
|
-
}
|
|
120
|
-
|
|
111
|
+
}
|
|
112
|
+
setPointSize(size) {
|
|
121
113
|
this._pointOptions.pointSize = size;
|
|
122
114
|
if (this.pointProgram) {
|
|
123
115
|
this.pointProgram.setPointSize(size);
|
|
124
116
|
this.globe.DrawRender();
|
|
125
117
|
}
|
|
126
|
-
}
|
|
127
|
-
|
|
118
|
+
}
|
|
119
|
+
pointSwitch(isOn) {
|
|
128
120
|
if (isOn && !this.pointProgram) {
|
|
129
121
|
this.pointProgram = this._createPointProgram();
|
|
130
122
|
}
|
|
131
123
|
else {
|
|
132
124
|
this._deletePointProgram();
|
|
133
125
|
}
|
|
134
|
-
}
|
|
126
|
+
}
|
|
135
127
|
// ------------------------------------------------------------
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
128
|
+
_createPointProgram() {
|
|
129
|
+
const { gl } = this;
|
|
130
|
+
const program = new PointProgram(gl, this.globe, this._attrBuffer, this._pointOptions);
|
|
139
131
|
program.setDrawCount(this._totalSize);
|
|
140
132
|
return program;
|
|
141
|
-
}
|
|
142
|
-
|
|
133
|
+
}
|
|
134
|
+
_deletePointProgram() {
|
|
143
135
|
if (this.pointProgram)
|
|
144
136
|
this.pointProgram.free();
|
|
145
137
|
this.pointProgram = null;
|
|
146
|
-
}
|
|
138
|
+
}
|
|
147
139
|
// -------------------------------------------------------------
|
|
148
|
-
|
|
140
|
+
isReady() {
|
|
149
141
|
return this._ready;
|
|
150
|
-
}
|
|
142
|
+
}
|
|
151
143
|
/**
|
|
152
144
|
* @param {TimeTrackMultiColorData} data {@link TimeTrackMultiColorData}
|
|
153
145
|
* Check Class constructor
|
|
154
146
|
*/
|
|
155
|
-
|
|
147
|
+
setData(data) {
|
|
156
148
|
if (this.gl) {
|
|
157
149
|
this._ready = false;
|
|
158
150
|
this.setDataAsFloat32Array(data);
|
|
@@ -162,15 +154,13 @@ var TimeTrackMultiColorPlugin = /** @class */ (function () {
|
|
|
162
154
|
this._data = data;
|
|
163
155
|
this._ready = false;
|
|
164
156
|
}
|
|
165
|
-
}
|
|
157
|
+
}
|
|
166
158
|
/**
|
|
167
159
|
* @param {TimeTrackMultiColorData} data {@link TimeTrackMultiColorData}
|
|
168
160
|
* @param {number} totalSize | if not provided, it is calculated from float32Array.length / 9. Use if you want to draw first n points.
|
|
169
161
|
*/
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
if (totalSize === void 0) { totalSize = null; }
|
|
173
|
-
var _b = this, gl = _b.gl, _attrBuffer = _b._attrBuffer;
|
|
162
|
+
setDataAsFloat32Array(data, totalSize = null) {
|
|
163
|
+
const { gl, _attrBuffer } = this;
|
|
174
164
|
gl.bindBuffer(gl.ARRAY_BUFFER, _attrBuffer);
|
|
175
165
|
gl.bufferData(gl.ARRAY_BUFFER, data, gl.STATIC_DRAW);
|
|
176
166
|
gl.bindBuffer(gl.ARRAY_BUFFER, null);
|
|
@@ -183,45 +173,43 @@ var TimeTrackMultiColorPlugin = /** @class */ (function () {
|
|
|
183
173
|
this._totalSize = data.length / 9;
|
|
184
174
|
}
|
|
185
175
|
this.program.setTotalLength(this._totalSize);
|
|
186
|
-
|
|
176
|
+
this.pointProgram?.setDrawCount(this._totalSize / 2);
|
|
187
177
|
this._ready = true;
|
|
188
|
-
}
|
|
178
|
+
}
|
|
189
179
|
// ------------------------------
|
|
190
180
|
// --- globe Methods ---
|
|
191
181
|
// ------------------------------
|
|
192
|
-
|
|
193
|
-
var _a;
|
|
182
|
+
draw3D(projMatrix, modelviewMatrix, transPos) {
|
|
194
183
|
if (!this._ready)
|
|
195
184
|
return;
|
|
196
|
-
|
|
197
|
-
|
|
185
|
+
const { _headTime, _tailTime, program, _transporArr, globe } = this;
|
|
186
|
+
this.pointProgram?.draw();
|
|
198
187
|
_transporArr.set([transPos.x, transPos.y, transPos.z], 0);
|
|
199
|
-
|
|
188
|
+
const geomType = globe.api_GetCurrentGeometry();
|
|
200
189
|
if (geomType === 0) {
|
|
201
190
|
program.draw(_headTime, _tailTime, projMatrix, modelviewMatrix, _transporArr);
|
|
202
191
|
}
|
|
203
192
|
else if (geomType === 1) {
|
|
204
|
-
|
|
193
|
+
const { width, height } = globe.api_GetCurrentWorldWH();
|
|
205
194
|
program.draw(_headTime, _tailTime, projMatrix, modelviewMatrix, _transporArr, [width, height]);
|
|
206
195
|
}
|
|
207
196
|
else {
|
|
208
197
|
console.error("Unknown geometry type", geomType);
|
|
209
198
|
}
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
|
|
199
|
+
}
|
|
200
|
+
resize(width, height) {
|
|
201
|
+
const { program, globe } = this;
|
|
213
202
|
width = width || globe.api_ScrW();
|
|
214
203
|
height = height || globe.api_ScrH();
|
|
215
204
|
program.resize(width, height);
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
var _a;
|
|
205
|
+
}
|
|
206
|
+
init(globe, gl) {
|
|
219
207
|
this.globe = globe;
|
|
220
208
|
this.gl = gl;
|
|
221
209
|
this._attrBuffer = gl.createBuffer();
|
|
222
|
-
this.program = new
|
|
223
|
-
if (
|
|
224
|
-
this.pointProgram = new
|
|
210
|
+
this.program = new TrackGlowLineProgram(gl, this._attrBuffer, globe.api_ScrW(), globe.api_ScrH(), this._options);
|
|
211
|
+
if (this._pointOptions?.isOn)
|
|
212
|
+
this.pointProgram = new PointProgram(gl, globe, this._attrBuffer);
|
|
225
213
|
// this.pointProgram.setAttrBuffer(_attrBuffer);
|
|
226
214
|
this.setGeometry();
|
|
227
215
|
if (this._data) {
|
|
@@ -230,25 +218,23 @@ var TimeTrackMultiColorPlugin = /** @class */ (function () {
|
|
|
230
218
|
this._data = null;
|
|
231
219
|
}
|
|
232
220
|
this.resize();
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
|
|
221
|
+
}
|
|
222
|
+
free() {
|
|
223
|
+
const { gl, _attrBuffer } = this;
|
|
236
224
|
this.program.free();
|
|
237
225
|
gl.deleteBuffer(_attrBuffer);
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
|
|
226
|
+
}
|
|
227
|
+
setGeometry() {
|
|
228
|
+
const { globe, program } = this;
|
|
241
229
|
program.setIs3D(globe.api_GetCurrentGeometry() === 0);
|
|
242
|
-
}
|
|
230
|
+
}
|
|
243
231
|
// ----------------------------------
|
|
244
232
|
// --- implicit methods ---
|
|
245
233
|
// ----------------------------------
|
|
246
|
-
|
|
234
|
+
_latLongToPixelXY(latitude, longitude) {
|
|
247
235
|
return {
|
|
248
236
|
x: (longitude + 180) / 360,
|
|
249
237
|
y: (90 - latitude) / 180
|
|
250
238
|
};
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
}());
|
|
254
|
-
exports.default = TimeTrackMultiColorPlugin;
|
|
239
|
+
}
|
|
240
|
+
}
|
package/timetracks/plugin.js
CHANGED
|
@@ -1,13 +1,8 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/**
|
|
3
2
|
* Author: Toprak Nihat Deniz Ozturk
|
|
4
3
|
*/
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
};
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
var program_1 = __importDefault(require("./program"));
|
|
10
|
-
var programpoint_1 = __importDefault(require("./programpoint"));
|
|
4
|
+
import TrackGlowLineProgram from './program';
|
|
5
|
+
import PointProgram from './programpoint';
|
|
11
6
|
/**
|
|
12
7
|
* @typedef {Float32Array} TimeTrackMultiColorData | A linestring is representation, let A{a1, a2, a3}, B{b1, b2} be the points of the line.
|
|
13
8
|
* TimeTrackMultiColorData is [
|
|
@@ -33,7 +28,7 @@ var programpoint_1 = __importDefault(require("./programpoint"));
|
|
|
33
28
|
uses float32array in a * {@link TimeTrackMultiColorData} format
|
|
34
29
|
|
|
35
30
|
*/
|
|
36
|
-
|
|
31
|
+
export default class TimeTrackMultiColorPlugin {
|
|
37
32
|
/**
|
|
38
33
|
* @param {String} id
|
|
39
34
|
* @param {Object} options
|
|
@@ -49,9 +44,7 @@ var TimeTrackMultiColorPlugin = /** @class */ (function () {
|
|
|
49
44
|
* @param {number} pointOptions.pointSize 0 ~ inf
|
|
50
45
|
* @param {boolean} pointOptions.isOn true | false
|
|
51
46
|
*/
|
|
52
|
-
|
|
53
|
-
if (options === void 0) { options = {}; }
|
|
54
|
-
var _b = _a === void 0 ? {} : _a, _c = _b.opacity, opacity = _c === void 0 ? 1.0 : _c, _d = _b.pointSize, pointSize = _d === void 0 ? 1 : _d, _e = _b.isOn, isOn = _e === void 0 ? false : _e;
|
|
47
|
+
constructor(id, options = {}, { opacity = 1.0, pointSize = 1, isOn = false } = {}) {
|
|
55
48
|
this.id = id;
|
|
56
49
|
this.globe = null;
|
|
57
50
|
this.gl = null;
|
|
@@ -60,7 +53,7 @@ var TimeTrackMultiColorPlugin = /** @class */ (function () {
|
|
|
60
53
|
this._tailTime = 0;
|
|
61
54
|
this._data = options.data || null;
|
|
62
55
|
this._options = options;
|
|
63
|
-
this._pointOptions = { opacity
|
|
56
|
+
this._pointOptions = { opacity, pointSize, isOn };
|
|
64
57
|
this.program = null;
|
|
65
58
|
this._transporArr = new Float32Array(3);
|
|
66
59
|
this._ready = false;
|
|
@@ -70,97 +63,96 @@ var TimeTrackMultiColorPlugin = /** @class */ (function () {
|
|
|
70
63
|
// ----------------------------------
|
|
71
64
|
// --- user methods ---
|
|
72
65
|
// ----------------------------------
|
|
73
|
-
|
|
74
|
-
var _a;
|
|
66
|
+
setHeadAndTailTime(headTime, tailTime) {
|
|
75
67
|
this._headTime = headTime;
|
|
76
68
|
this._tailTime = tailTime;
|
|
77
|
-
|
|
69
|
+
this.pointProgram?.setHeadTime(headTime);
|
|
78
70
|
this.globe.DrawRender();
|
|
79
|
-
}
|
|
80
|
-
|
|
71
|
+
}
|
|
72
|
+
setGlow(isGlow) {
|
|
81
73
|
this.program.setGlow(isGlow);
|
|
82
74
|
this.globe.DrawRender();
|
|
83
|
-
}
|
|
84
|
-
|
|
75
|
+
}
|
|
76
|
+
setPremultipliedAlpha(isPremultiplied) {
|
|
85
77
|
this.program.setPremultipliedAlpha(isPremultiplied);
|
|
86
78
|
this.globe.DrawRender();
|
|
87
|
-
}
|
|
88
|
-
|
|
79
|
+
}
|
|
80
|
+
setBlurWeights(weights) {
|
|
89
81
|
this.program.setBlurWeights(weights);
|
|
90
82
|
this.globe.DrawRender();
|
|
91
|
-
}
|
|
92
|
-
|
|
83
|
+
}
|
|
84
|
+
setHeadPercentage(headPercentage) {
|
|
93
85
|
this.program.setHeadPercentage(headPercentage);
|
|
94
86
|
this.globe.DrawRender();
|
|
95
|
-
}
|
|
96
|
-
|
|
87
|
+
}
|
|
88
|
+
setRouteAlpha(routeAlpha) {
|
|
97
89
|
this.program.setRouteAlpha(routeAlpha);
|
|
98
90
|
this.globe.DrawRender();
|
|
99
|
-
}
|
|
100
|
-
|
|
91
|
+
}
|
|
92
|
+
setFinalAlphaRatio(finalAlphaRatio) {
|
|
101
93
|
this.program.setFinalAlphaRatio(finalAlphaRatio);
|
|
102
94
|
this.globe.DrawRender();
|
|
103
|
-
}
|
|
104
|
-
|
|
95
|
+
}
|
|
96
|
+
setGamma(gamma) {
|
|
105
97
|
this.program.setGamma(gamma);
|
|
106
98
|
this.globe.DrawRender();
|
|
107
|
-
}
|
|
108
|
-
|
|
99
|
+
}
|
|
100
|
+
setExposure(exposure) {
|
|
109
101
|
this.program.setExposure(exposure);
|
|
110
102
|
this.globe.DrawRender();
|
|
111
|
-
}
|
|
112
|
-
|
|
103
|
+
}
|
|
104
|
+
setBlurRepetition(repetition) {
|
|
113
105
|
this.program.setBlurRepetition(repetition);
|
|
114
106
|
this.globe.DrawRender();
|
|
115
|
-
}
|
|
116
|
-
|
|
107
|
+
}
|
|
108
|
+
setAlphaThreshold(alphaThreshold) {
|
|
117
109
|
this.program.setAlphaThreshold(alphaThreshold);
|
|
118
110
|
this.globe.DrawRender();
|
|
119
|
-
}
|
|
111
|
+
}
|
|
120
112
|
// ---------------point program setters-------------------
|
|
121
|
-
|
|
113
|
+
setPointOpacity(opacity) {
|
|
122
114
|
this._pointOptions.opacity = opacity;
|
|
123
115
|
if (this.pointProgram) {
|
|
124
116
|
this.pointProgram.setOpacity(opacity);
|
|
125
117
|
this.globe.DrawRender();
|
|
126
118
|
}
|
|
127
|
-
}
|
|
128
|
-
|
|
119
|
+
}
|
|
120
|
+
setPointSize(size) {
|
|
129
121
|
this._pointOptions.pointSize = size;
|
|
130
122
|
if (this.pointProgram) {
|
|
131
123
|
this.pointProgram.setPointSize(size);
|
|
132
124
|
this.globe.DrawRender();
|
|
133
125
|
}
|
|
134
|
-
}
|
|
135
|
-
|
|
126
|
+
}
|
|
127
|
+
pointSwitch(isOn) {
|
|
136
128
|
if (isOn && !this.pointProgram) {
|
|
137
129
|
this.pointProgram = this._createPointProgram();
|
|
138
130
|
}
|
|
139
131
|
else {
|
|
140
132
|
this._deletePointProgram();
|
|
141
133
|
}
|
|
142
|
-
}
|
|
134
|
+
}
|
|
143
135
|
// ------------------------------------------------------------
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
136
|
+
_createPointProgram() {
|
|
137
|
+
const { gl } = this;
|
|
138
|
+
const program = new PointProgram(gl, this.globe, this._attrBuffer, this._pointOptions);
|
|
147
139
|
program.setDrawCount(this._totalSize / 2);
|
|
148
140
|
return program;
|
|
149
|
-
}
|
|
150
|
-
|
|
141
|
+
}
|
|
142
|
+
_deletePointProgram() {
|
|
151
143
|
if (this.pointProgram)
|
|
152
144
|
this.pointProgram.free();
|
|
153
145
|
this.pointProgram = null;
|
|
154
|
-
}
|
|
146
|
+
}
|
|
155
147
|
// -------------------------------------------------------------
|
|
156
|
-
|
|
148
|
+
isReady() {
|
|
157
149
|
return this._ready;
|
|
158
|
-
}
|
|
150
|
+
}
|
|
159
151
|
/**
|
|
160
152
|
* @param {TimeTrackMultiColorData} data {@link TimeTrackMultiColorData}
|
|
161
153
|
* Check Class constructor
|
|
162
154
|
*/
|
|
163
|
-
|
|
155
|
+
setData(data) {
|
|
164
156
|
if (this.gl) {
|
|
165
157
|
this._ready = false;
|
|
166
158
|
this.setDataAsFloat32Array(data);
|
|
@@ -170,15 +162,13 @@ var TimeTrackMultiColorPlugin = /** @class */ (function () {
|
|
|
170
162
|
this._data = data;
|
|
171
163
|
this._ready = false;
|
|
172
164
|
}
|
|
173
|
-
}
|
|
165
|
+
}
|
|
174
166
|
/**
|
|
175
167
|
* @param {TimeTrackMultiColorData} data {@link TimeTrackMultiColorData}
|
|
176
168
|
* @param {number} totalSize | if not provided, it is calculated from float32Array.length / 9. Use if you want to draw first n points.
|
|
177
169
|
*/
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
if (totalSize === void 0) { totalSize = null; }
|
|
181
|
-
var _b = this, gl = _b.gl, _attrBuffer = _b._attrBuffer;
|
|
170
|
+
setDataAsFloat32Array(data, totalSize = null) {
|
|
171
|
+
const { gl, _attrBuffer } = this;
|
|
182
172
|
gl.bindBuffer(gl.ARRAY_BUFFER, _attrBuffer);
|
|
183
173
|
gl.bufferData(gl.ARRAY_BUFFER, data, gl.STATIC_DRAW);
|
|
184
174
|
gl.bindBuffer(gl.ARRAY_BUFFER, null);
|
|
@@ -191,45 +181,43 @@ var TimeTrackMultiColorPlugin = /** @class */ (function () {
|
|
|
191
181
|
this._totalSize = data.length / 9;
|
|
192
182
|
}
|
|
193
183
|
this.program.setTotalLength(this._totalSize);
|
|
194
|
-
|
|
184
|
+
this.pointProgram?.setDrawCount(this._totalSize / 2);
|
|
195
185
|
this._ready = true;
|
|
196
|
-
}
|
|
186
|
+
}
|
|
197
187
|
// ------------------------------
|
|
198
188
|
// --- globe Methods ---
|
|
199
189
|
// ------------------------------
|
|
200
|
-
|
|
201
|
-
var _a;
|
|
190
|
+
draw3D(projMatrix, modelviewMatrix, transPos) {
|
|
202
191
|
if (!this._ready)
|
|
203
192
|
return;
|
|
204
|
-
|
|
205
|
-
|
|
193
|
+
const { _headTime, _tailTime, program, _transporArr, globe } = this;
|
|
194
|
+
this.pointProgram?.draw();
|
|
206
195
|
_transporArr.set([transPos.x, transPos.y, transPos.z], 0);
|
|
207
|
-
|
|
196
|
+
const geomType = globe.api_GetCurrentGeometry();
|
|
208
197
|
if (geomType === 0) {
|
|
209
198
|
program.draw(_headTime, _tailTime, projMatrix, modelviewMatrix, _transporArr);
|
|
210
199
|
}
|
|
211
200
|
else if (geomType === 1) {
|
|
212
|
-
|
|
201
|
+
const { width, height } = globe.api_GetCurrentWorldWH();
|
|
213
202
|
program.draw(_headTime, _tailTime, projMatrix, modelviewMatrix, _transporArr, [width, height]);
|
|
214
203
|
}
|
|
215
204
|
else {
|
|
216
205
|
console.error("Unknown geometry type", geomType);
|
|
217
206
|
}
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
|
|
207
|
+
}
|
|
208
|
+
resize(width, height) {
|
|
209
|
+
const { program, globe } = this;
|
|
221
210
|
width = width || globe.api_ScrW();
|
|
222
211
|
height = height || globe.api_ScrH();
|
|
223
212
|
program.resize(width, height);
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
var _a;
|
|
213
|
+
}
|
|
214
|
+
init(globe, gl) {
|
|
227
215
|
this.globe = globe;
|
|
228
216
|
this.gl = gl;
|
|
229
217
|
this._attrBuffer = gl.createBuffer();
|
|
230
|
-
this.program = new
|
|
231
|
-
if (
|
|
232
|
-
this.pointProgram = new
|
|
218
|
+
this.program = new TrackGlowLineProgram(gl, this._attrBuffer, globe.api_ScrW(), globe.api_ScrH(), this._options);
|
|
219
|
+
if (this._pointOptions?.isOn)
|
|
220
|
+
this.pointProgram = new PointProgram(gl, globe, this._attrBuffer);
|
|
233
221
|
// this.pointProgram.setAttrBuffer(_attrBuffer);
|
|
234
222
|
this.setGeometry();
|
|
235
223
|
if (this._data) {
|
|
@@ -238,25 +226,23 @@ var TimeTrackMultiColorPlugin = /** @class */ (function () {
|
|
|
238
226
|
this._data = null;
|
|
239
227
|
}
|
|
240
228
|
this.resize();
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
|
|
229
|
+
}
|
|
230
|
+
free() {
|
|
231
|
+
const { gl, _attrBuffer } = this;
|
|
244
232
|
this.program.free();
|
|
245
233
|
gl.deleteBuffer(_attrBuffer);
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
|
|
234
|
+
}
|
|
235
|
+
setGeometry() {
|
|
236
|
+
const { globe, program } = this;
|
|
249
237
|
program.setIs3D(globe.api_GetCurrentGeometry() === 0);
|
|
250
|
-
}
|
|
238
|
+
}
|
|
251
239
|
// ----------------------------------
|
|
252
240
|
// --- implicit methods ---
|
|
253
241
|
// ----------------------------------
|
|
254
|
-
|
|
242
|
+
_latLongToPixelXY(latitude, longitude) {
|
|
255
243
|
return {
|
|
256
244
|
x: (longitude + 180) / 360,
|
|
257
245
|
y: (90 - latitude) / 180
|
|
258
246
|
};
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
}());
|
|
262
|
-
exports.default = TimeTrackMultiColorPlugin;
|
|
247
|
+
}
|
|
248
|
+
}
|