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