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