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