@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
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.findFirstIndexInRange = void 0;
4
- var findFirstIndexInRange = function (container, value) {
5
- var start = 0;
6
- var end = container.length - 1;
7
- var mid = 0;
4
+ const findFirstIndexInRange = (container, value) => {
5
+ let start = 0;
6
+ let end = container.length - 1;
7
+ let mid = 0;
8
8
  while (start <= end) {
9
9
  mid = Math.floor((start + end) / 2);
10
10
  if (container[mid] <= value && value <= container[mid + 1])
@@ -5,15 +5,14 @@ require("./types");
5
5
  * @param {DrawSubsetOptions} drawSubsetOptions
6
6
  */
7
7
  // TODO: Draw all is an optional property for the target plugin, with this approach.
8
- var DrawSubsetOptionRegistry = /** @class */ (function () {
9
- function DrawSubsetOptionRegistry() {
8
+ class DrawSubsetOptionRegistry {
9
+ constructor() {
10
10
  this._drawSubsetOptions = new Map();
11
11
  }
12
- DrawSubsetOptionRegistry.prototype.register = function (key, drawSubsetOptions) {
12
+ register(key, drawSubsetOptions) {
13
13
  this._drawSubsetOptions.set(key, drawSubsetOptions);
14
- };
15
- DrawSubsetOptionRegistry.prototype.unregister = function (key) {
14
+ }
15
+ unregister(key) {
16
16
  this._drawSubsetOptions.delete(key);
17
- };
18
- return DrawSubsetOptionRegistry;
19
- }());
17
+ }
18
+ }
@@ -1,33 +1,23 @@
1
1
  "use strict";
2
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
3
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
4
- if (ar || !(i in from)) {
5
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
6
- ar[i] = from[i];
7
- }
8
- }
9
- return to.concat(ar || Array.prototype.slice.call(from));
10
- };
11
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
3
  exports.PointGlowLineToEarthPlugin = void 0;
13
4
  require("./types.js");
14
- var pickable_renderer_js_1 = require("../programs/picking/pickable-renderer.js");
15
- var element_point_glow_js_1 = require("../programs/point-on-globe/element-point-glow.js");
16
- var element_globe_surface_glow_js_1 = require("../programs/point-on-globe/element-globe-surface-glow.js");
17
- var naive_accurate_flexible_js_1 = require("../programs/line-on-globe/naive-accurate-flexible.js");
18
- var account_1 = require("../util/account");
19
- var picker_displayer_js_1 = require("../util/picking/picker-displayer.js");
20
- var methods_js_1 = require("../Math/methods.js");
21
- var typecheck_js_1 = require("../util/check/typecheck.js");
22
- var attribute_loader_1 = require("../util/gl-util/buffer/attribute-loader");
23
- var camerauniformblock_js_1 = require("../programs/totems/camerauniformblock.js");
5
+ const pickable_renderer_js_1 = require("../programs/picking/pickable-renderer.js");
6
+ const element_point_glow_js_1 = require("../programs/point-on-globe/element-point-glow.js");
7
+ const element_globe_surface_glow_js_1 = require("../programs/point-on-globe/element-globe-surface-glow.js");
8
+ const naive_accurate_flexible_js_1 = require("../programs/line-on-globe/naive-accurate-flexible.js");
9
+ const account_1 = require("../util/account");
10
+ const picker_displayer_js_1 = require("../util/picking/picker-displayer.js");
11
+ const methods_js_1 = require("../Math/methods.js");
12
+ const typecheck_js_1 = require("../util/check/typecheck.js");
13
+ const attribute_loader_1 = require("../util/gl-util/buffer/attribute-loader");
14
+ const camerauniformblock_js_1 = require("../programs/totems/camerauniformblock.js");
24
15
  /**
25
16
  * is used with depth we can create a line from surface to the point.
26
17
  */
27
- var glowOverSize = 1.35; // 1.25 is the default value in the shader
28
- var PointGlowLineToEarthPlugin = /** @class */ (function () {
29
- function PointGlowLineToEarthPlugin(_a) {
30
- var _b = _a.isGlowPointOn, isGlowPointOn = _b === void 0 ? true : _b, _c = _a.isGlowSurfaceOn, isGlowSurfaceOn = _c === void 0 ? true : _c;
18
+ const glowOverSize = 1.35; // 1.25 is the default value in the shader
19
+ class PointGlowLineToEarthPlugin {
20
+ constructor({ isGlowPointOn = true, isGlowSurfaceOn = true }) {
31
21
  this.globe = null;
32
22
  this.gl = null;
33
23
  this._pickableWrapper = {};
@@ -35,8 +25,8 @@ var PointGlowLineToEarthPlugin = /** @class */ (function () {
35
25
  this._glowSurfaceWrapper = {};
36
26
  this._lineProgramWrapper = {};
37
27
  this._modes = {
38
- isGlowPointOn: isGlowPointOn,
39
- isGlowSurfaceOn: isGlowSurfaceOn
28
+ isGlowPointOn,
29
+ isGlowSurfaceOn
40
30
  };
41
31
  this._hoveredObjectId = null;
42
32
  this._lastWH = { w: 0, h: 0 };
@@ -50,46 +40,44 @@ var PointGlowLineToEarthPlugin = /** @class */ (function () {
50
40
  this._tickPhase = 0;
51
41
  this._parametersChanged = false;
52
42
  }
53
- PointGlowLineToEarthPlugin.prototype.init = function (globe, gl) {
43
+ init(globe, gl) {
54
44
  this.globe = globe;
55
45
  this.gl = gl;
56
46
  this._init();
57
47
  this._cameraBlockTotem = camerauniformblock_js_1.CameraUniformBlockTotemCache.get(this.globe);
58
- };
59
- PointGlowLineToEarthPlugin.prototype._init = function () {
60
- var _a, _b;
61
- var _this = this;
62
- var _c = this, globe = _c.globe, gl = _c.gl, _pickableWrapper = _c._pickableWrapper, _glowPointWrapper = _c._glowPointWrapper, _glowSurfaceWrapper = _c._glowSurfaceWrapper, _lineProgramWrapper = _c._lineProgramWrapper;
63
- var bufferType = "STATIC_DRAW";
64
- var initialCapacity = 50;
65
- this._bufferOrchestrator = new account_1.BufferOrchestrator({ initialCapacity: initialCapacity });
48
+ }
49
+ _init() {
50
+ const { globe, gl, _pickableWrapper, _glowPointWrapper, _glowSurfaceWrapper, _lineProgramWrapper } = this;
51
+ const bufferType = "STATIC_DRAW";
52
+ const initialCapacity = 50;
53
+ this._bufferOrchestrator = new account_1.BufferOrchestrator({ initialCapacity });
66
54
  this._bufferManagersMap = new Map([
67
55
  ['pos3D', {
68
- bufferManager: new account_1.BufferManager(gl, 6, { bufferType: bufferType, initialCapacity: initialCapacity }),
69
- adaptor: function (item) { return new Float32Array(__spreadArray(__spreadArray([], (0, methods_js_1.wgs84ToCartesian3d)(item.long, item.lat, item.altitude / 1000), true), (0, methods_js_1.wgs84ToCartesian3d)(item.long, item.lat, 0 / 1000), true)); }
56
+ bufferManager: new account_1.BufferManager(gl, 6, { bufferType, initialCapacity }),
57
+ adaptor: (item) => new Float32Array([...(0, methods_js_1.wgs84ToCartesian3d)(item.long, item.lat, item.altitude / 1000), ...(0, methods_js_1.wgs84ToCartesian3d)(item.long, item.lat, 0 / 1000)])
70
58
  }],
71
59
  ['pos2D', {
72
- bufferManager: new account_1.BufferManager(gl, 2, { bufferType: bufferType, initialCapacity: initialCapacity }),
73
- adaptor: function (item) { return new Float32Array((0, methods_js_1.wgs84ToMercator)(item.long, item.lat)); }
60
+ bufferManager: new account_1.BufferManager(gl, 2, { bufferType, initialCapacity }),
61
+ adaptor: (item) => new Float32Array((0, methods_js_1.wgs84ToMercator)(item.long, item.lat))
74
62
  }],
75
63
  ['rgba', {
76
- bufferManager: new account_1.BufferManager(gl, 8, { bufferType: bufferType, initialCapacity: initialCapacity }),
77
- adaptor: function (item) { return new Float32Array(__spreadArray(__spreadArray([], item.color, true), item.color, true)); }
64
+ bufferManager: new account_1.BufferManager(gl, 8, { bufferType, initialCapacity }),
65
+ adaptor: (item) => new Float32Array([...item.color, ...item.color])
78
66
  }],
79
67
  ['size', {
80
- bufferManager: new account_1.BufferManager(gl, 1, { bufferType: bufferType, initialCapacity: initialCapacity }),
81
- adaptor: function (item) { return new Float32Array([item.size]); }
68
+ bufferManager: new account_1.BufferManager(gl, 1, { bufferType, initialCapacity }),
69
+ adaptor: (item) => new Float32Array([item.size])
82
70
  }],
83
71
  ]);
84
72
  _pickableWrapper.program = pickable_renderer_js_1.PickableRendererProgramCache.get(globe);
85
73
  _glowPointWrapper.program = element_point_glow_js_1.ElementPointGlowProgramCache.get(globe);
86
74
  _lineProgramWrapper.program = naive_accurate_flexible_js_1.LineOnGlobeCache.get(globe);
87
75
  this._pickerDisplayer = new picker_displayer_js_1.PickerDisplayer(globe);
88
- var obj = function (key) { return key === null ? null : (0, attribute_loader_1.createBufferAndReadInfo)(_this._bufferManagersMap.get(key).bufferManager.buffer); };
76
+ const obj = (key) => key === null ? null : (0, attribute_loader_1.createBufferAndReadInfo)(this._bufferManagersMap.get(key).bufferManager.buffer);
89
77
  _pickableWrapper.vao = _pickableWrapper.program.createVAO((0, attribute_loader_1.createBufferAndReadInfo)(this._bufferManagersMap.get('pos3D').bufferManager.buffer, 6 * 4, 0), (0, attribute_loader_1.createBufferAndReadInfo)(this._bufferManagersMap.get('pos2D').bufferManager.buffer), (0, attribute_loader_1.createBufferAndReadInfo)(this._bufferManagersMap.get('rgba').bufferManager.buffer, 8 * 4, 0), (0, attribute_loader_1.createBufferAndReadInfo)(this._bufferManagersMap.get('size').bufferManager.buffer));
90
- _pickableWrapper.vaoLine = (_a = _pickableWrapper.program).createVAO.apply(_a, ['pos3D', 'pos2D', 'rgba', null].map(obj));
78
+ _pickableWrapper.vaoLine = _pickableWrapper.program.createVAO(...['pos3D', 'pos2D', 'rgba', null].map(obj));
91
79
  _pickableWrapper.vaoHoverPoint = _pickableWrapper.program.createVAO((0, attribute_loader_1.createBufferAndReadInfo)(this._bufferManagersMap.get('pos3D').bufferManager.buffer, 6 * 4, 0), (0, attribute_loader_1.createBufferAndReadInfo)(this._bufferManagersMap.get('pos2D').bufferManager.buffer), null, (0, attribute_loader_1.createBufferAndReadInfo)(this._bufferManagersMap.get('size').bufferManager.buffer));
92
- _pickableWrapper.vaoHoverLine = (_b = _pickableWrapper.program).createVAO.apply(_b, ['pos3D', 'pos2D', null, null].map(obj));
80
+ _pickableWrapper.vaoHoverLine = _pickableWrapper.program.createVAO(...['pos3D', 'pos2D', null, null].map(obj));
93
81
  _glowPointWrapper.vao = _glowPointWrapper.program.createVAO((0, attribute_loader_1.createBufferAndReadInfo)(this._bufferManagersMap.get('pos3D').bufferManager.buffer, 6 * 4, 0), (0, attribute_loader_1.createBufferAndReadInfo)(this._bufferManagersMap.get('pos2D').bufferManager.buffer), null, (0, attribute_loader_1.createBufferAndReadInfo)(this._bufferManagersMap.get('size').bufferManager.buffer));
94
82
  // _lineProgramWrapper.vao = _lineProgramWrapper.program.createVAO(
95
83
  // ...[null, 'pos3D', null, 'reverse3D', null, null, "rgba"].map(obj)
@@ -154,38 +142,37 @@ var PointGlowLineToEarthPlugin = /** @class */ (function () {
154
142
  // }
155
143
  // _glowPointWrapper.ubo.update(new Map([["u_phase", [_glowPointWrapper._phase]]]));
156
144
  // }
157
- };
145
+ }
158
146
  /**
159
147
  *
160
148
  * @param {Array<PointGlowData>} data
161
149
  */
162
- PointGlowLineToEarthPlugin.prototype.insertBulk = function (data) {
163
- var _a = this, _bufferManagersMap = _a._bufferManagersMap, _bufferOrchestrator = _a._bufferOrchestrator, globe = _a.globe;
150
+ insertBulk(data) {
151
+ const { _bufferManagersMap, _bufferOrchestrator, globe } = this;
164
152
  _bufferOrchestrator.insertBulk(data, _bufferManagersMap);
165
153
  this._changed();
166
- };
167
- PointGlowLineToEarthPlugin.prototype.setPointSizeMultiplier = function (sizeMultiplier) {
154
+ }
155
+ setPointSizeMultiplier(sizeMultiplier) {
168
156
  (0, typecheck_js_1.constraintFloat)(sizeMultiplier, 0.1, null);
169
157
  this._pickableWrapper.ubo.update(new Map([["u_size_multiplier", [sizeMultiplier]]]));
170
158
  this._glowPointWrapper.ubo.update(new Map([["u_size_multiplier", [sizeMultiplier * 1.25]]]));
171
159
  this._changed();
172
- };
160
+ }
173
161
  /**
174
162
  * @param {DrawRange} drawRange if null draws all
175
163
  * @returns
176
164
  */
177
- PointGlowLineToEarthPlugin.prototype.setDrawRange = function (drawRange) {
178
- if (drawRange === void 0) { drawRange = null; }
165
+ setDrawRange(drawRange = null) {
179
166
  this._drawRange = drawRange;
180
167
  this._changed();
181
- };
168
+ }
182
169
  /**
183
170
  *
184
171
  * sophisticated setDrawRange,
185
172
  * 3 concepts:
186
173
  */
187
- PointGlowLineToEarthPlugin.prototype.setGlowIndexes = function (glowIndexes) {
188
- var gl = this.gl;
174
+ setGlowIndexes(glowIndexes) {
175
+ const { gl } = this;
189
176
  if (!this._elementBuffer) {
190
177
  this._elementBuffer = gl.createBuffer();
191
178
  }
@@ -193,24 +180,24 @@ var PointGlowLineToEarthPlugin = /** @class */ (function () {
193
180
  gl.bindElementArrayBuffer(this._elementBuffer);
194
181
  this._parametersChanged = true;
195
182
  gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, new Uint32Array(glowIndexes), gl.DYNAMIC_DRAW);
196
- };
197
- PointGlowLineToEarthPlugin.prototype.setOpacity = function (opacity) {
183
+ }
184
+ setOpacity(opacity) {
198
185
  (0, typecheck_js_1.opacityCheck)(opacity);
199
186
  this._opacity = opacity;
200
187
  this._pickableWrapper.ubo.update(new Map([["u_opacity", [opacity]]]));
201
188
  this._pickableWrapper.uboLine.update(new Map([["u_opacity", [opacity]]]));
202
189
  this._glowPointWrapper.ubo.update(new Map([["u_opacity", [opacity * glowOverSize]]]));
203
190
  this._changed();
204
- };
205
- PointGlowLineToEarthPlugin.prototype.draw3D = function () {
206
- var _a = this, _pickableWrapper = _a._pickableWrapper, _bufferOrchestrator = _a._bufferOrchestrator, _drawRange = _a._drawRange, _pickerDisplayer = _a._pickerDisplayer;
207
- var _b = this, globe = _b.globe, gl = _b.gl;
191
+ }
192
+ draw3D() {
193
+ const { _pickableWrapper, _bufferOrchestrator, _drawRange, _pickerDisplayer } = this;
194
+ const { globe, gl } = this;
208
195
  this._hoverAgent();
209
196
  this.resize();
210
- var is3D = globe.api_GetCurrentGeometry() == 0;
211
- var drawRange = _drawRange || { first: 0, count: _bufferOrchestrator.length };
212
- var drawOptionsPoint = {
213
- drawRange: drawRange,
197
+ const is3D = globe.api_GetCurrentGeometry() == 0;
198
+ const drawRange = _drawRange || { first: 0, count: _bufferOrchestrator.length };
199
+ const drawOptionsPoint = {
200
+ drawRange,
214
201
  };
215
202
  this._doDraw(drawOptionsPoint, is3D, drawRange);
216
203
  _pickerDisplayer.drawColorTexture();
@@ -219,8 +206,8 @@ var PointGlowLineToEarthPlugin = /** @class */ (function () {
219
206
  }
220
207
  // hover draw
221
208
  gl.disable(gl.DEPTH_TEST);
222
- var program = _pickableWrapper.program, vaoHoverPoint = _pickableWrapper.vaoHoverPoint, vaoHoverLine = _pickableWrapper.vaoHoverLine, uboLineGlow = _pickableWrapper.uboLineGlow;
223
- var drawOptionsHoveredPoint = {
209
+ const { program, vaoHoverPoint, vaoHoverLine, uboLineGlow } = _pickableWrapper;
210
+ const drawOptionsHoveredPoint = {
224
211
  drawRange: {
225
212
  first: this._hoveredObjectId,
226
213
  count: 1
@@ -228,15 +215,15 @@ var PointGlowLineToEarthPlugin = /** @class */ (function () {
228
215
  };
229
216
  // program.draw(vaoHoverPoint, drawptionsHoveredPoint, ubo);
230
217
  if (true || this._modes.isGlowPointOn) {
231
- var _c = this._glowPointWrapper, program_1 = _c.program, vao = _c.vao, ubo = _c.ubo;
218
+ const { program, vao, ubo } = this._glowPointWrapper;
232
219
  // this._glowPointWrapper.phaseTick();
233
- program_1.draw(vao, drawOptionsHoveredPoint, ubo);
220
+ program.draw(vao, drawOptionsHoveredPoint, ubo);
234
221
  }
235
222
  else {
236
223
  }
237
224
  this.globe.DrawRender();
238
225
  if (is3D) {
239
- var drawOptionsHoveredLine = {
226
+ const drawOptionsHoveredLine = {
240
227
  drawRange: {
241
228
  first: this._hoveredObjectId * 2,
242
229
  count: 2
@@ -248,10 +235,10 @@ var PointGlowLineToEarthPlugin = /** @class */ (function () {
248
235
  }
249
236
  this._phaseTick();
250
237
  gl.enable(gl.DEPTH_TEST);
251
- };
252
- PointGlowLineToEarthPlugin.prototype._doDraw = function (drawOptionsPoint, is3D, drawRange) {
253
- var _a = this, gl = _a.gl, _pickableWrapper = _a._pickableWrapper, _pickerDisplayer = _a._pickerDisplayer;
254
- var program = _pickableWrapper.program, vao = _pickableWrapper.vao, ubo = _pickableWrapper.ubo, uboLine = _pickableWrapper.uboLine, vaoLine = _pickableWrapper.vaoLine;
238
+ }
239
+ _doDraw(drawOptionsPoint, is3D, drawRange) {
240
+ const { gl, _pickableWrapper, _pickerDisplayer } = this;
241
+ const { program, vao, ubo, uboLine, vaoLine } = _pickableWrapper;
255
242
  if (this._doesChanged()) {
256
243
  _pickerDisplayer.bindFBO();
257
244
  _pickerDisplayer.clearTextures();
@@ -259,7 +246,7 @@ var PointGlowLineToEarthPlugin = /** @class */ (function () {
259
246
  program.draw(vao, drawOptionsPoint, ubo);
260
247
  }
261
248
  if (is3D) {
262
- var drawOptionsLine = {
249
+ const drawOptionsLine = {
263
250
  drawRange: {
264
251
  first: drawRange.first * 2,
265
252
  count: drawRange.count * 2
@@ -278,27 +265,26 @@ var PointGlowLineToEarthPlugin = /** @class */ (function () {
278
265
  ]));
279
266
  program.draw(vaoLine, drawOptionsLine, uboLine);
280
267
  }
281
- };
282
- PointGlowLineToEarthPlugin.prototype.getCurrentSelection = function () {
268
+ }
269
+ getCurrentSelection() {
283
270
  return this._hoveredObjectId;
284
- };
285
- PointGlowLineToEarthPlugin.prototype.resize = function () {
286
- var w = this.globe.api_ScrW();
287
- var h = this.globe.api_ScrH();
271
+ }
272
+ resize() {
273
+ const w = this.globe.api_ScrW();
274
+ const h = this.globe.api_ScrH();
288
275
  if (w === this._lastWH.w && h === this._lastWH.h)
289
276
  return;
290
277
  this._lastWH.w = w;
291
278
  this._lastWH.h = h;
292
279
  this._pickerDisplayer.resize();
293
280
  this._changed();
294
- };
295
- PointGlowLineToEarthPlugin.prototype.free = function () {
296
- var _this = this;
297
- var _a = this, _pickableWrapper = _a._pickableWrapper, _glowPointWrapper = _a._glowPointWrapper, _glowSurfaceWrapper = _a._glowSurfaceWrapper, _lineProgramWrapper = _a._lineProgramWrapper;
298
- [_pickableWrapper, _glowPointWrapper, _glowSurfaceWrapper, _lineProgramWrapper].forEach(function (item) {
299
- var vao = item.vao, ubo = item.ubo;
300
- ubo === null || ubo === void 0 ? void 0 : ubo.free();
301
- _this.gl.deleteVertexArray(vao);
281
+ }
282
+ free() {
283
+ const { _pickableWrapper, _glowPointWrapper, _glowSurfaceWrapper, _lineProgramWrapper } = this;
284
+ [_pickableWrapper, _glowPointWrapper, _glowSurfaceWrapper, _lineProgramWrapper].forEach((item) => {
285
+ const { vao, ubo } = item;
286
+ ubo?.free();
287
+ this.gl.deleteVertexArray(vao);
302
288
  });
303
289
  pickable_renderer_js_1.PickableRendererProgramCache.release(this.globe);
304
290
  element_point_glow_js_1.ElementPointGlowProgramCache.release(this.globe);
@@ -307,51 +293,49 @@ var PointGlowLineToEarthPlugin = /** @class */ (function () {
307
293
  if (this._elementBuffer)
308
294
  this.gl.deleteBuffer(this._elementBuffer);
309
295
  this._pickerDisplayer.free();
310
- this._bufferManagersMap.forEach(function (item) { return item.bufferManager.free(); });
296
+ this._bufferManagersMap.forEach((item) => item.bufferManager.free());
311
297
  this._bufferManagersMap.clear();
312
298
  camerauniformblock_js_1.CameraUniformBlockTotemCache.release(this.globe);
313
- };
314
- PointGlowLineToEarthPlugin.prototype._phaseTick = function () {
299
+ }
300
+ _phaseTick() {
315
301
  this._tickPhase += 0.003;
316
302
  if (this._tickPhase > 1) {
317
303
  this._tickPhase = 0;
318
304
  }
319
305
  this._glowPointWrapper.ubo.update(new Map([["u_phase", [this._tickPhase * 2]]]));
320
306
  this._pickableWrapper.uboLineGlow.update(new Map([["u_dash_phase", [1 - this._tickPhase]]]));
321
- };
322
- PointGlowLineToEarthPlugin.prototype._hoverAgent = function () {
323
- var _this = this;
324
- var _a = this, globe = _a.globe, _hoverAgentParams = _a._hoverAgentParams;
325
- var pos = globe.api_GetMousePos();
326
- var currentTime = new Date().getTime();
307
+ }
308
+ _hoverAgent() {
309
+ const { globe, _hoverAgentParams } = this;
310
+ const pos = globe.api_GetMousePos();
311
+ const currentTime = new Date().getTime();
327
312
  if (_hoverAgentParams.stillPicking || _hoverAgentParams.timePass > currentTime) {
328
313
  return;
329
314
  }
330
315
  ;
331
316
  _hoverAgentParams.timePass = currentTime + _hoverAgentParams.timeGap;
332
- var x = pos.canvasX;
333
- var y = globe.api_ScrH() - pos.canvasY;
317
+ const x = pos.canvasX;
318
+ const y = globe.api_ScrH() - pos.canvasY;
334
319
  _hoverAgentParams.stillPicking = true;
335
- this._pickerDisplayer.pickXY(x, y, 1, function (idSet) {
320
+ this._pickerDisplayer.pickXY(x, y, 1, (idSet) => {
336
321
  _hoverAgentParams.stillPicking = false;
337
322
  if (idSet.size === 0) {
338
- _this._hoveredObjectId = -1;
323
+ this._hoveredObjectId = -1;
339
324
  return;
340
325
  }
341
- var index = __spreadArray([], idSet, true)[0];
342
- if (index !== _this._hoveredObjectId) {
343
- _this._hoveredObjectId = index;
344
- _this.globe.DrawRender();
326
+ const index = [...idSet][0];
327
+ if (index !== this._hoveredObjectId) {
328
+ this._hoveredObjectId = index;
329
+ this.globe.DrawRender();
345
330
  }
346
331
  });
347
- };
348
- PointGlowLineToEarthPlugin.prototype._doesChanged = function () {
332
+ }
333
+ _doesChanged() {
349
334
  return this._cameraBlockTotem.isMoved() || this._parametersChanged; // TODO: implement
350
- };
351
- PointGlowLineToEarthPlugin.prototype._changed = function () {
335
+ }
336
+ _changed() {
352
337
  this._parametersChanged = true;
353
338
  this.globe.DrawRender();
354
- };
355
- return PointGlowLineToEarthPlugin;
356
- }());
339
+ }
340
+ }
357
341
  exports.PointGlowLineToEarthPlugin = PointGlowLineToEarthPlugin;
@@ -1,10 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.centigradePlus90ToRadians = centigradePlus90ToRadians;
4
- function centigradePlus90ToRadians(centigradeArray, noDataValue) {
5
- if (noDataValue === void 0) { noDataValue = -9999; }
6
- var radiansArray = new Float32Array(centigradeArray.length);
7
- for (var i = 0; i < centigradeArray.length; i++) {
4
+ function centigradePlus90ToRadians(centigradeArray, noDataValue = -9999) {
5
+ const radiansArray = new Float32Array(centigradeArray.length);
6
+ for (let i = 0; i < centigradeArray.length; i++) {
8
7
  if (centigradeArray[i] === noDataValue) {
9
8
  radiansArray[i] = noDataValue;
10
9
  continue;
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.centigradePlus90ToRadians = exports.ArrowField = void 0;
7
- var plugin_1 = __importDefault(require("./plugin"));
7
+ const plugin_1 = __importDefault(require("./plugin"));
8
8
  exports.ArrowField = plugin_1.default;
9
- var adaptor_1 = require("./adaptor");
9
+ const adaptor_1 = require("./adaptor");
10
10
  Object.defineProperty(exports, "centigradePlus90ToRadians", { enumerable: true, get: function () { return adaptor_1.centigradePlus90ToRadians; } });
@@ -1,89 +1,86 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- var programs_1 = require("../programs");
4
- var ArrowFieldPlugin = /** @class */ (function () {
5
- function ArrowFieldPlugin(id, _a) {
6
- var _b = _a === void 0 ? {} : _a, _c = _b.minLon, minLon = _c === void 0 ? -180 : _c, _d = _b.maxLon, maxLon = _d === void 0 ? 180 : _d, _e = _b.minLat, minLat = _e === void 0 ? -90 : _e, _f = _b.maxLat, maxLat = _f === void 0 ? 90 : _f, _g = _b.height, height = _g === void 0 ? 0 : _g, _h = _b.opacity, opacity = _h === void 0 ? 1 : _h, _j = _b.tailLengthRatio, tailLengthRatio = _j === void 0 ? 1 : _j, _k = _b.wingLengthRatio, wingLengthRatio = _k === void 0 ? 0.5 : _k, _l = _b.color, color = _l === void 0 ? [0.04, 0.2, 0.8] : _l, _m = _b.targetWidth, targetWidth = _m === void 0 ? 100 : _m, _o = _b.targetHeight, targetHeight = _o === void 0 ? 100 : _o, _p = _b.data, data = _p === void 0 ? null : _p, _q = _b.dataWidth, dataWidth = _q === void 0 ? null : _q, _r = _b.dataHeight, dataHeight = _r === void 0 ? null : _r, _s = _b.maxMagnitude, maxMagnitude = _s === void 0 ? null : _s, _t = _b.noDataValue, noDataValue = _t === void 0 ? null : _t;
3
+ const programs_1 = require("../programs");
4
+ class ArrowFieldPlugin {
5
+ constructor(id, { minLon = -180, maxLon = 180, minLat = -90, maxLat = 90, height = 0, opacity = 1, tailLengthRatio = 1, wingLengthRatio = 0.5, color = [0.04, 0.2, 0.8], targetWidth = 100, targetHeight = 100, data = null, dataWidth = null, dataHeight = null, maxMagnitude = null, noDataValue = null } = {}) {
7
6
  this.id = id;
8
7
  this.options = {
9
- minLon: minLon,
10
- maxLon: maxLon,
11
- minLat: minLat,
12
- maxLat: maxLat,
13
- height: height,
14
- tailLengthRatio: tailLengthRatio,
15
- wingLengthRatio: wingLengthRatio,
16
- opacity: opacity,
17
- color: color,
18
- data: data,
19
- targetHeight: targetHeight,
20
- targetWidth: targetWidth,
21
- dataWidth: dataWidth,
22
- dataHeight: dataHeight,
23
- maxMagnitude: maxMagnitude,
24
- noDataValue: noDataValue
8
+ minLon,
9
+ maxLon,
10
+ minLat,
11
+ maxLat,
12
+ height,
13
+ tailLengthRatio,
14
+ wingLengthRatio,
15
+ opacity,
16
+ color,
17
+ data,
18
+ targetHeight,
19
+ targetWidth,
20
+ dataWidth,
21
+ dataHeight,
22
+ maxMagnitude,
23
+ noDataValue
25
24
  };
26
25
  this.arrowFieldObj = null;
27
26
  this._doDraw = true;
28
27
  }
29
- ArrowFieldPlugin.prototype.init = function (globe, gl) {
28
+ init(globe, gl) {
30
29
  this.globe = globe;
31
30
  this.gl = gl;
32
31
  this.arrowFieldObj = new programs_1.ArrowField(gl, globe, this.options);
33
- };
34
- ArrowFieldPlugin.prototype.draw3D = function () {
32
+ }
33
+ draw3D() {
35
34
  if (this._doDraw) {
36
- var _a = this, gl = _a.gl, arrowFieldObj = _a.arrowFieldObj;
35
+ const { gl, arrowFieldObj } = this;
37
36
  gl.disable(gl.DEPTH_TEST);
38
37
  arrowFieldObj.draw();
39
38
  gl.enable(gl.DEPTH_TEST);
40
39
  }
41
- };
42
- ArrowFieldPlugin.prototype.free = function () {
40
+ }
41
+ free() {
43
42
  this.arrowFieldObj.free();
44
43
  this.arrowFieldObj = null;
45
- };
44
+ }
46
45
  // user interaction methods
47
- ArrowFieldPlugin.prototype.on = function () {
46
+ on() {
48
47
  this._doDraw = true;
49
- };
50
- ArrowFieldPlugin.prototype.off = function () {
48
+ }
49
+ off() {
51
50
  this._doDraw = false;
52
- };
53
- ArrowFieldPlugin.prototype.setBBox = function (_a) {
54
- var _b = _a === void 0 ? {} : _a, _c = _b.minLon, minLon = _c === void 0 ? -180 : _c, _d = _b.maxLon, maxLon = _d === void 0 ? 180 : _d, _e = _b.minLat, minLat = _e === void 0 ? -90 : _e, _f = _b.maxLat, maxLat = _f === void 0 ? 90 : _f;
55
- this.arrowFieldObj.setBBox({ minLon: minLon, maxLon: maxLon, minLat: minLat, maxLat: maxLat });
56
- };
57
- ArrowFieldPlugin.prototype.setHeight = function (height) {
58
- this.arrowFieldObj.update({ height: height });
59
- };
60
- ArrowFieldPlugin.prototype.setColor = function (color) {
61
- this.arrowFieldObj.update({ color: color });
62
- };
63
- ArrowFieldPlugin.prototype.setOpacity = function (opacity) {
64
- this.arrowFieldObj.update({ opacity: opacity });
65
- };
66
- ArrowFieldPlugin.prototype.setTailLengthRatio = function (tailLengthRatio) {
67
- this.arrowFieldObj.update({ tailLengthRatio: tailLengthRatio });
68
- };
69
- ArrowFieldPlugin.prototype.setWingLengthRatio = function (wingLengthRatio) {
70
- this.arrowFieldObj.update({ wingLengthRatio: wingLengthRatio });
71
- };
72
- ArrowFieldPlugin.prototype.setDataResolution = function (dataWidth, dataHeight) {
73
- this.arrowFieldObj.update({ dataWidth: dataWidth, dataHeight: dataHeight });
74
- };
75
- ArrowFieldPlugin.prototype.setTargetResolution = function (targetWidth, targetHeight) {
51
+ }
52
+ setBBox({ minLon = -180, maxLon = 180, minLat = -90, maxLat = 90 } = {}) {
53
+ this.arrowFieldObj.setBBox({ minLon, maxLon, minLat, maxLat });
54
+ }
55
+ setHeight(height) {
56
+ this.arrowFieldObj.update({ height });
57
+ }
58
+ setColor(color) {
59
+ this.arrowFieldObj.update({ color });
60
+ }
61
+ setOpacity(opacity) {
62
+ this.arrowFieldObj.update({ opacity });
63
+ }
64
+ setTailLengthRatio(tailLengthRatio) {
65
+ this.arrowFieldObj.update({ tailLengthRatio });
66
+ }
67
+ setWingLengthRatio(wingLengthRatio) {
68
+ this.arrowFieldObj.update({ wingLengthRatio });
69
+ }
70
+ setDataResolution(dataWidth, dataHeight) {
71
+ this.arrowFieldObj.update({ dataWidth, dataHeight });
72
+ }
73
+ setTargetResolution(targetWidth, targetHeight) {
76
74
  this.arrowFieldObj.update({ resolution: [targetWidth, targetHeight] });
77
- };
78
- ArrowFieldPlugin.prototype.setMaxMagnitude = function (maxMagnitude) {
79
- this.arrowFieldObj.update({ maxMagnitude: maxMagnitude });
80
- };
81
- ArrowFieldPlugin.prototype.setNoDataValue = function (noDataValue) {
82
- this.arrowFieldObj.update({ noDataValue: noDataValue });
83
- };
84
- ArrowFieldPlugin.prototype.setData = function (rotationData) {
75
+ }
76
+ setMaxMagnitude(maxMagnitude) {
77
+ this.arrowFieldObj.update({ maxMagnitude });
78
+ }
79
+ setNoDataValue(noDataValue) {
80
+ this.arrowFieldObj.update({ noDataValue });
81
+ }
82
+ setData(rotationData) {
85
83
  this.arrowFieldObj.setData(rotationData);
86
- };
87
- return ArrowFieldPlugin;
88
- }());
84
+ }
85
+ }
89
86
  exports.default = ArrowFieldPlugin;
@@ -4,5 +4,5 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.BearingLinePlugin = void 0;
7
- var plugin_1 = __importDefault(require("./plugin"));
7
+ const plugin_1 = __importDefault(require("./plugin"));
8
8
  exports.BearingLinePlugin = plugin_1.default;