@pirireis/webglobeplugins 0.9.10 → 0.9.11

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 +80 -78
  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 +16 -14
  9. package/Math/methods.js +72 -67
  10. package/Math/plane.js +18 -16
  11. package/Math/quaternion.js +49 -45
  12. package/Math/utils.js +2 -2
  13. package/Math/vec3.js +45 -42
  14. package/algorithms/search-binary.js +4 -4
  15. package/altitude-locator/draw-subset-obj.js +8 -7
  16. package/altitude-locator/plugin.js +113 -97
  17. package/arrowfield/adaptor.js +4 -3
  18. package/arrowfield/index.js +2 -2
  19. package/arrowfield/plugin.js +65 -62
  20. package/bearing-line/index.js +1 -1
  21. package/bearing-line/plugin.js +225 -200
  22. package/circle-line-chain/chain-list-map.js +88 -82
  23. package/circle-line-chain/plugin.js +154 -129
  24. package/circle-line-chain/util.js +1 -1
  25. package/compass-rose/compass-rose-padding-flat.js +126 -104
  26. package/compass-rose/compass-text-writer.js +70 -62
  27. package/compass-rose/index.js +2 -2
  28. package/compassrose/compassrose.js +50 -46
  29. package/compassrose/index.js +1 -1
  30. package/heatwave/index.js +2 -2
  31. package/heatwave/isobar/objectarraylabels.js +48 -44
  32. package/heatwave/isobar/plugin.js +123 -104
  33. package/heatwave/isobar/quadtreecontours.js +92 -76
  34. package/heatwave/plugins/heatwaveglobeshell.js +87 -69
  35. package/index.js +11 -11
  36. package/package.json +1 -1
  37. package/partialrings/buffer-manager.js +64 -32
  38. package/partialrings/index.js +1 -1
  39. package/partialrings/plugin.js +84 -48
  40. package/partialrings/program.js +47 -136
  41. package/pin/pin-object-array.js +86 -83
  42. package/pin/pin-point-totem.js +22 -21
  43. package/point-heat-map/adaptors/timetracksplugin-format-to-this.js +10 -10
  44. package/point-heat-map/plugin-webworker.js +45 -40
  45. package/point-heat-map/point-to-heat-map-flow.js +42 -40
  46. package/point-tracks/key-methods.js +1 -1
  47. package/point-tracks/plugin.js +142 -127
  48. package/programs/arrowfield/index.js +1 -1
  49. package/programs/arrowfield/logic.js +62 -170
  50. package/programs/arrowfield/object.js +35 -33
  51. package/programs/data2legend/density-to-legend.js +21 -45
  52. package/programs/data2legend/point-to-density-texture.js +27 -52
  53. package/programs/float2legendwithratio/index.js +1 -1
  54. package/programs/float2legendwithratio/logic.js +42 -88
  55. package/programs/float2legendwithratio/object.js +46 -43
  56. package/programs/globe-util/is-globe-moved.js +11 -10
  57. package/programs/globeshell/index.js +1 -1
  58. package/programs/globeshell/wiggle/index.js +1 -1
  59. package/programs/globeshell/wiggle/logic.js +98 -191
  60. package/programs/globeshell/wiggle/object.js +35 -33
  61. package/programs/helpers/blender/program.js +19 -36
  62. package/programs/helpers/fadeaway/index.js +1 -1
  63. package/programs/helpers/fadeaway/logic.js +13 -35
  64. package/programs/helpers/fadeaway/object.js +10 -9
  65. package/programs/helpers/index.js +1 -1
  66. package/programs/index.js +8 -8
  67. package/programs/line-on-globe/angled-line.js +32 -91
  68. package/programs/line-on-globe/circle-accurate-3d.js +32 -82
  69. package/programs/line-on-globe/circle-accurate-flat.js +50 -108
  70. package/programs/line-on-globe/circle-accurate.js +33 -103
  71. package/programs/line-on-globe/circle.js +32 -97
  72. package/programs/line-on-globe/degree-padding-around-circle-3d.js +33 -83
  73. package/programs/line-on-globe/lines-color-instanced-flat.js +34 -79
  74. package/programs/line-on-globe/linestrip.js +39 -100
  75. package/programs/line-on-globe/naive-accurate-flexible.js +48 -118
  76. package/programs/line-on-globe/to-the-surface.js +29 -58
  77. package/programs/line-on-globe/util.js +1 -1
  78. package/programs/picking/pickable-renderer.js +33 -117
  79. package/programs/point-on-globe/element-globe-surface-glow.js +38 -78
  80. package/programs/point-on-globe/element-point-glow.js +35 -103
  81. package/programs/point-on-globe/square-pixel-point.js +27 -76
  82. package/programs/programcache.js +13 -13
  83. package/programs/rings/distancering/circleflatprogram.js +21 -63
  84. package/programs/rings/distancering/circlepaddingfreeangleprogram.js +145 -156
  85. package/programs/rings/distancering/circlepaddysharedbuffer.js +197 -121
  86. package/programs/rings/distancering/index.js +4 -4
  87. package/programs/rings/distancering/paddyflatprogram.js +20 -73
  88. package/programs/rings/distancering/paddyflatprogram2d.js +22 -75
  89. package/programs/rings/distancering/paddyflatprogram3d.js +20 -73
  90. package/programs/rings/partial-ring/piece-of-pie.js +35 -137
  91. package/programs/totems/camerauniformblock.js +51 -64
  92. package/programs/totems/canvas-webglobe-info.js +40 -48
  93. package/programs/totems/gpu-selection-uniform-block.js +40 -44
  94. package/programs/totems/index.js +1 -1
  95. package/programs/two-d/pixel-padding-for-compass.js +29 -90
  96. package/programs/util.js +7 -6
  97. package/programs/vectorfields/index.js +1 -1
  98. package/programs/vectorfields/logics/drawrectangleparticles.js +29 -70
  99. package/programs/vectorfields/logics/index.js +3 -3
  100. package/programs/vectorfields/logics/pixelbased.js +35 -91
  101. package/programs/vectorfields/logics/ubo.js +25 -31
  102. package/programs/vectorfields/pingpongbuffermanager.js +34 -30
  103. package/rangerings/index.js +4 -4
  104. package/rangerings/plugin.js +252 -202
  105. package/rangerings/rangeringangletext.js +120 -108
  106. package/rangerings/ring-account.js +69 -52
  107. package/shaders/fragment-toy/firework.js +1 -55
  108. package/shaders/fragment-toy/singularity.js +1 -55
  109. package/timetracks/adaptors-line-strip.js +37 -26
  110. package/timetracks/adaptors.js +61 -47
  111. package/timetracks/index.js +4 -4
  112. package/timetracks/plugin-line-strip.js +63 -59
  113. package/timetracks/plugin.js +69 -65
  114. package/timetracks/program-line-strip.js +103 -296
  115. package/timetracks/program.js +113 -419
  116. package/timetracks/programpoint-line-strip.js +44 -97
  117. package/timetracks/programpoint.js +44 -90
  118. package/util/account/bufferoffsetmanager.js +95 -72
  119. package/util/account/index.js +1 -1
  120. package/util/account/single-attribute-buffer-management/buffer-manager.js +43 -39
  121. package/util/account/single-attribute-buffer-management/buffer-orchestrator.js +94 -64
  122. package/util/account/single-attribute-buffer-management/index.js +3 -3
  123. package/util/account/single-attribute-buffer-management/object-store.js +30 -28
  124. package/util/account/util.js +4 -2
  125. package/util/algorithms/search-binary.js +4 -4
  126. package/util/check/get.js +5 -5
  127. package/util/check/typecheck.js +15 -13
  128. package/util/geometry/index.js +11 -9
  129. package/util/gl-util/buffer/attribute-loader.js +20 -8
  130. package/util/gl-util/buffer/index.js +1 -1
  131. package/util/gl-util/draw-options/methods.js +7 -7
  132. package/util/gl-util/uniform-block/manager.js +67 -55
  133. package/util/heatwavedatamanager/datamanager.js +116 -56
  134. package/util/heatwavedatamanager/index.js +2 -2
  135. package/util/heatwavedatamanager/pointcoordinatesdatacalculator.js +40 -37
  136. package/util/heatwavedatamanager/pointcoordsmeta.js +10 -9
  137. package/util/index.js +6 -6
  138. package/util/interpolation/timetrack/index.js +1 -1
  139. package/util/interpolation/timetrack/timetrack-interpolator.js +29 -27
  140. package/util/interpolation/timetrack/web-worker-str.js +1 -179
  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 +52 -46
  146. package/util/programs/draw-texture-on-canvas.js +21 -39
  147. package/util/programs/shapesonglobe.js +64 -104
  148. package/util/programs/supersampletotextures.js +39 -45
  149. package/util/programs/texturetoglobe.js +48 -98
  150. package/util/shaderfunctions/geometrytransformations.js +27 -322
  151. package/util/shaderfunctions/nodata.js +1 -7
  152. package/util/shaderfunctions/noisefunctions.js +9 -39
  153. package/util/surface-line-data/arcs-to-cuts.js +23 -20
  154. package/util/webglobe/rasteroverlay.js +37 -35
  155. package/util/webglobjectbuilders.js +60 -55
  156. package/util/webglobjectbuilders1.js +49 -48
  157. package/waveparticles/adaptor.js +7 -6
  158. package/waveparticles/index.js +2 -2
  159. package/waveparticles/plugin.js +84 -79
  160. package/wind/imagetovectorfieldandmagnitude.js +15 -15
  161. package/wind/index.js +4 -4
  162. package/wind/plugin.js +251 -453
  163. package/wind/vectorfieldimage.js +5 -5
  164. package/write-text/attached-text-writer.js +48 -46
  165. package/write-text/context-text.js +58 -51
  166. package/write-text/context-text3.js +74 -69
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.findFirstIndexInRange = void 0;
4
- const findFirstIndexInRange = (container, value) => {
5
- let start = 0;
6
- let end = container.length - 1;
7
- let mid = 0;
4
+ var findFirstIndexInRange = function (container, value) {
5
+ var start = 0;
6
+ var end = container.length - 1;
7
+ var 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,14 +5,15 @@ 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
- class DrawSubsetOptionRegistry {
9
- constructor() {
8
+ var DrawSubsetOptionRegistry = /** @class */ (function () {
9
+ function DrawSubsetOptionRegistry() {
10
10
  this._drawSubsetOptions = new Map();
11
11
  }
12
- register(key, drawSubsetOptions) {
12
+ DrawSubsetOptionRegistry.prototype.register = function (key, drawSubsetOptions) {
13
13
  this._drawSubsetOptions.set(key, drawSubsetOptions);
14
- }
15
- unregister(key) {
14
+ };
15
+ DrawSubsetOptionRegistry.prototype.unregister = function (key) {
16
16
  this._drawSubsetOptions.delete(key);
17
- }
18
- }
17
+ };
18
+ return DrawSubsetOptionRegistry;
19
+ }());
@@ -1,23 +1,33 @@
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
+ };
2
11
  Object.defineProperty(exports, "__esModule", { value: true });
3
12
  exports.PointGlowLineToEarthPlugin = void 0;
4
13
  require("./types.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");
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");
15
24
  /**
16
25
  * is used with depth we can create a line from surface to the point.
17
26
  */
18
- const glowOverSize = 1.35; // 1.25 is the default value in the shader
19
- class PointGlowLineToEarthPlugin {
20
- constructor({ isGlowPointOn = true, isGlowSurfaceOn = true }) {
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;
21
31
  this.globe = null;
22
32
  this.gl = null;
23
33
  this._pickableWrapper = {};
@@ -25,8 +35,8 @@ class PointGlowLineToEarthPlugin {
25
35
  this._glowSurfaceWrapper = {};
26
36
  this._lineProgramWrapper = {};
27
37
  this._modes = {
28
- isGlowPointOn,
29
- isGlowSurfaceOn
38
+ isGlowPointOn: isGlowPointOn,
39
+ isGlowSurfaceOn: isGlowSurfaceOn
30
40
  };
31
41
  this._hoveredObjectId = null;
32
42
  this._lastWH = { w: 0, h: 0 };
@@ -40,44 +50,46 @@ class PointGlowLineToEarthPlugin {
40
50
  this._tickPhase = 0;
41
51
  this._parametersChanged = false;
42
52
  }
43
- init(globe, gl) {
53
+ PointGlowLineToEarthPlugin.prototype.init = function (globe, gl) {
44
54
  this.globe = globe;
45
55
  this.gl = gl;
46
56
  this._init();
47
57
  this._cameraBlockTotem = camerauniformblock_js_1.CameraUniformBlockTotemCache.get(this.globe);
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 });
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 });
54
66
  this._bufferManagersMap = new Map([
55
67
  ['pos3D', {
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)])
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)); }
58
70
  }],
59
71
  ['pos2D', {
60
- bufferManager: new account_1.BufferManager(gl, 2, { bufferType, initialCapacity }),
61
- adaptor: (item) => new Float32Array((0, methods_js_1.wgs84ToMercator)(item.long, item.lat))
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)); }
62
74
  }],
63
75
  ['rgba', {
64
- bufferManager: new account_1.BufferManager(gl, 8, { bufferType, initialCapacity }),
65
- adaptor: (item) => new Float32Array([...item.color, ...item.color])
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)); }
66
78
  }],
67
79
  ['size', {
68
- bufferManager: new account_1.BufferManager(gl, 1, { bufferType, initialCapacity }),
69
- adaptor: (item) => new Float32Array([item.size])
80
+ bufferManager: new account_1.BufferManager(gl, 1, { bufferType: bufferType, initialCapacity: initialCapacity }),
81
+ adaptor: function (item) { return new Float32Array([item.size]); }
70
82
  }],
71
83
  ]);
72
84
  _pickableWrapper.program = pickable_renderer_js_1.PickableRendererProgramCache.get(globe);
73
85
  _glowPointWrapper.program = element_point_glow_js_1.ElementPointGlowProgramCache.get(globe);
74
86
  _lineProgramWrapper.program = naive_accurate_flexible_js_1.LineOnGlobeCache.get(globe);
75
87
  this._pickerDisplayer = new picker_displayer_js_1.PickerDisplayer(globe);
76
- const obj = (key) => key === null ? null : (0, attribute_loader_1.createBufferAndReadInfo)(this._bufferManagersMap.get(key).bufferManager.buffer);
88
+ var obj = function (key) { return key === null ? null : (0, attribute_loader_1.createBufferAndReadInfo)(_this._bufferManagersMap.get(key).bufferManager.buffer); };
77
89
  _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));
78
- _pickableWrapper.vaoLine = _pickableWrapper.program.createVAO(...['pos3D', 'pos2D', 'rgba', null].map(obj));
90
+ _pickableWrapper.vaoLine = (_a = _pickableWrapper.program).createVAO.apply(_a, ['pos3D', 'pos2D', 'rgba', null].map(obj));
79
91
  _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));
80
- _pickableWrapper.vaoHoverLine = _pickableWrapper.program.createVAO(...['pos3D', 'pos2D', null, null].map(obj));
92
+ _pickableWrapper.vaoHoverLine = (_b = _pickableWrapper.program).createVAO.apply(_b, ['pos3D', 'pos2D', null, null].map(obj));
81
93
  _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));
82
94
  // _lineProgramWrapper.vao = _lineProgramWrapper.program.createVAO(
83
95
  // ...[null, 'pos3D', null, 'reverse3D', null, null, "rgba"].map(obj)
@@ -142,37 +154,38 @@ class PointGlowLineToEarthPlugin {
142
154
  // }
143
155
  // _glowPointWrapper.ubo.update(new Map([["u_phase", [_glowPointWrapper._phase]]]));
144
156
  // }
145
- }
157
+ };
146
158
  /**
147
159
  *
148
160
  * @param {Array<PointGlowData>} data
149
161
  */
150
- insertBulk(data) {
151
- const { _bufferManagersMap, _bufferOrchestrator, globe } = this;
162
+ PointGlowLineToEarthPlugin.prototype.insertBulk = function (data) {
163
+ var _a = this, _bufferManagersMap = _a._bufferManagersMap, _bufferOrchestrator = _a._bufferOrchestrator, globe = _a.globe;
152
164
  _bufferOrchestrator.insertBulk(data, _bufferManagersMap);
153
165
  this._changed();
154
- }
155
- setPointSizeMultiplier(sizeMultiplier) {
166
+ };
167
+ PointGlowLineToEarthPlugin.prototype.setPointSizeMultiplier = function (sizeMultiplier) {
156
168
  (0, typecheck_js_1.constraintFloat)(sizeMultiplier, 0.1, null);
157
169
  this._pickableWrapper.ubo.update(new Map([["u_size_multiplier", [sizeMultiplier]]]));
158
170
  this._glowPointWrapper.ubo.update(new Map([["u_size_multiplier", [sizeMultiplier * 1.25]]]));
159
171
  this._changed();
160
- }
172
+ };
161
173
  /**
162
174
  * @param {DrawRange} drawRange if null draws all
163
175
  * @returns
164
176
  */
165
- setDrawRange(drawRange = null) {
177
+ PointGlowLineToEarthPlugin.prototype.setDrawRange = function (drawRange) {
178
+ if (drawRange === void 0) { drawRange = null; }
166
179
  this._drawRange = drawRange;
167
180
  this._changed();
168
- }
181
+ };
169
182
  /**
170
183
  *
171
184
  * sophisticated setDrawRange,
172
185
  * 3 concepts:
173
186
  */
174
- setGlowIndexes(glowIndexes) {
175
- const { gl } = this;
187
+ PointGlowLineToEarthPlugin.prototype.setGlowIndexes = function (glowIndexes) {
188
+ var gl = this.gl;
176
189
  if (!this._elementBuffer) {
177
190
  this._elementBuffer = gl.createBuffer();
178
191
  }
@@ -180,24 +193,24 @@ class PointGlowLineToEarthPlugin {
180
193
  gl.bindElementArrayBuffer(this._elementBuffer);
181
194
  this._parametersChanged = true;
182
195
  gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, new Uint32Array(glowIndexes), gl.DYNAMIC_DRAW);
183
- }
184
- setOpacity(opacity) {
196
+ };
197
+ PointGlowLineToEarthPlugin.prototype.setOpacity = function (opacity) {
185
198
  (0, typecheck_js_1.opacityCheck)(opacity);
186
199
  this._opacity = opacity;
187
200
  this._pickableWrapper.ubo.update(new Map([["u_opacity", [opacity]]]));
188
201
  this._pickableWrapper.uboLine.update(new Map([["u_opacity", [opacity]]]));
189
202
  this._glowPointWrapper.ubo.update(new Map([["u_opacity", [opacity * glowOverSize]]]));
190
203
  this._changed();
191
- }
192
- draw3D() {
193
- const { _pickableWrapper, _bufferOrchestrator, _drawRange, _pickerDisplayer } = this;
194
- const { globe, gl } = this;
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;
195
208
  this._hoverAgent();
196
209
  this.resize();
197
- const is3D = globe.api_GetCurrentGeometry() == 0;
198
- const drawRange = _drawRange || { first: 0, count: _bufferOrchestrator.length };
199
- const drawOptionsPoint = {
200
- drawRange,
210
+ var is3D = globe.api_GetCurrentGeometry() == 0;
211
+ var drawRange = _drawRange || { first: 0, count: _bufferOrchestrator.length };
212
+ var drawOptionsPoint = {
213
+ drawRange: drawRange,
201
214
  };
202
215
  this._doDraw(drawOptionsPoint, is3D, drawRange);
203
216
  _pickerDisplayer.drawColorTexture();
@@ -206,8 +219,8 @@ class PointGlowLineToEarthPlugin {
206
219
  }
207
220
  // hover draw
208
221
  gl.disable(gl.DEPTH_TEST);
209
- const { program, vaoHoverPoint, vaoHoverLine, uboLineGlow } = _pickableWrapper;
210
- const drawOptionsHoveredPoint = {
222
+ var program = _pickableWrapper.program, vaoHoverPoint = _pickableWrapper.vaoHoverPoint, vaoHoverLine = _pickableWrapper.vaoHoverLine, uboLineGlow = _pickableWrapper.uboLineGlow;
223
+ var drawOptionsHoveredPoint = {
211
224
  drawRange: {
212
225
  first: this._hoveredObjectId,
213
226
  count: 1
@@ -215,15 +228,15 @@ class PointGlowLineToEarthPlugin {
215
228
  };
216
229
  // program.draw(vaoHoverPoint, drawptionsHoveredPoint, ubo);
217
230
  if (true || this._modes.isGlowPointOn) {
218
- const { program, vao, ubo } = this._glowPointWrapper;
231
+ var _c = this._glowPointWrapper, program_1 = _c.program, vao = _c.vao, ubo = _c.ubo;
219
232
  // this._glowPointWrapper.phaseTick();
220
- program.draw(vao, drawOptionsHoveredPoint, ubo);
233
+ program_1.draw(vao, drawOptionsHoveredPoint, ubo);
221
234
  }
222
235
  else {
223
236
  }
224
237
  this.globe.DrawRender();
225
238
  if (is3D) {
226
- const drawOptionsHoveredLine = {
239
+ var drawOptionsHoveredLine = {
227
240
  drawRange: {
228
241
  first: this._hoveredObjectId * 2,
229
242
  count: 2
@@ -235,10 +248,10 @@ class PointGlowLineToEarthPlugin {
235
248
  }
236
249
  this._phaseTick();
237
250
  gl.enable(gl.DEPTH_TEST);
238
- }
239
- _doDraw(drawOptionsPoint, is3D, drawRange) {
240
- const { gl, _pickableWrapper, _pickerDisplayer } = this;
241
- const { program, vao, ubo, uboLine, vaoLine } = _pickableWrapper;
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;
242
255
  if (this._doesChanged()) {
243
256
  _pickerDisplayer.bindFBO();
244
257
  _pickerDisplayer.clearTextures();
@@ -246,7 +259,7 @@ class PointGlowLineToEarthPlugin {
246
259
  program.draw(vao, drawOptionsPoint, ubo);
247
260
  }
248
261
  if (is3D) {
249
- const drawOptionsLine = {
262
+ var drawOptionsLine = {
250
263
  drawRange: {
251
264
  first: drawRange.first * 2,
252
265
  count: drawRange.count * 2
@@ -265,26 +278,27 @@ class PointGlowLineToEarthPlugin {
265
278
  ]));
266
279
  program.draw(vaoLine, drawOptionsLine, uboLine);
267
280
  }
268
- }
269
- getCurrentSelection() {
281
+ };
282
+ PointGlowLineToEarthPlugin.prototype.getCurrentSelection = function () {
270
283
  return this._hoveredObjectId;
271
- }
272
- resize() {
273
- const w = this.globe.api_ScrW();
274
- const h = this.globe.api_ScrH();
284
+ };
285
+ PointGlowLineToEarthPlugin.prototype.resize = function () {
286
+ var w = this.globe.api_ScrW();
287
+ var h = this.globe.api_ScrH();
275
288
  if (w === this._lastWH.w && h === this._lastWH.h)
276
289
  return;
277
290
  this._lastWH.w = w;
278
291
  this._lastWH.h = h;
279
292
  this._pickerDisplayer.resize();
280
293
  this._changed();
281
- }
282
- free() {
283
- const { _pickableWrapper, _glowPointWrapper, _glowSurfaceWrapper, _lineProgramWrapper } = this;
284
- [_pickableWrapper, _glowPointWrapper, _glowSurfaceWrapper, _lineProgramWrapper].forEach((item) => {
285
- const { vao, ubo } = item;
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;
286
300
  ubo === null || ubo === void 0 ? void 0 : ubo.free();
287
- this.gl.deleteVertexArray(vao);
301
+ _this.gl.deleteVertexArray(vao);
288
302
  });
289
303
  pickable_renderer_js_1.PickableRendererProgramCache.release(this.globe);
290
304
  element_point_glow_js_1.ElementPointGlowProgramCache.release(this.globe);
@@ -293,49 +307,51 @@ class PointGlowLineToEarthPlugin {
293
307
  if (this._elementBuffer)
294
308
  this.gl.deleteBuffer(this._elementBuffer);
295
309
  this._pickerDisplayer.free();
296
- this._bufferManagersMap.forEach((item) => item.bufferManager.free());
310
+ this._bufferManagersMap.forEach(function (item) { return item.bufferManager.free(); });
297
311
  this._bufferManagersMap.clear();
298
312
  camerauniformblock_js_1.CameraUniformBlockTotemCache.release(this.globe);
299
- }
300
- _phaseTick() {
313
+ };
314
+ PointGlowLineToEarthPlugin.prototype._phaseTick = function () {
301
315
  this._tickPhase += 0.003;
302
316
  if (this._tickPhase > 1) {
303
317
  this._tickPhase = 0;
304
318
  }
305
319
  this._glowPointWrapper.ubo.update(new Map([["u_phase", [this._tickPhase * 2]]]));
306
320
  this._pickableWrapper.uboLineGlow.update(new Map([["u_dash_phase", [1 - this._tickPhase]]]));
307
- }
308
- _hoverAgent() {
309
- const { globe, _hoverAgentParams } = this;
310
- const pos = globe.api_GetMousePos();
311
- const currentTime = new Date().getTime();
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();
312
327
  if (_hoverAgentParams.stillPicking || _hoverAgentParams.timePass > currentTime) {
313
328
  return;
314
329
  }
315
330
  ;
316
331
  _hoverAgentParams.timePass = currentTime + _hoverAgentParams.timeGap;
317
- const x = pos.canvasX;
318
- const y = globe.api_ScrH() - pos.canvasY;
332
+ var x = pos.canvasX;
333
+ var y = globe.api_ScrH() - pos.canvasY;
319
334
  _hoverAgentParams.stillPicking = true;
320
- this._pickerDisplayer.pickXY(x, y, 1, (idSet) => {
335
+ this._pickerDisplayer.pickXY(x, y, 1, function (idSet) {
321
336
  _hoverAgentParams.stillPicking = false;
322
337
  if (idSet.size === 0) {
323
- this._hoveredObjectId = -1;
338
+ _this._hoveredObjectId = -1;
324
339
  return;
325
340
  }
326
- const index = [...idSet][0];
327
- if (index !== this._hoveredObjectId) {
328
- this._hoveredObjectId = index;
329
- this.globe.DrawRender();
341
+ var index = __spreadArray([], idSet, true)[0];
342
+ if (index !== _this._hoveredObjectId) {
343
+ _this._hoveredObjectId = index;
344
+ _this.globe.DrawRender();
330
345
  }
331
346
  });
332
- }
333
- _doesChanged() {
347
+ };
348
+ PointGlowLineToEarthPlugin.prototype._doesChanged = function () {
334
349
  return this._cameraBlockTotem.isMoved() || this._parametersChanged; // TODO: implement
335
- }
336
- _changed() {
350
+ };
351
+ PointGlowLineToEarthPlugin.prototype._changed = function () {
337
352
  this._parametersChanged = true;
338
353
  this.globe.DrawRender();
339
- }
340
- }
354
+ };
355
+ return PointGlowLineToEarthPlugin;
356
+ }());
341
357
  exports.PointGlowLineToEarthPlugin = PointGlowLineToEarthPlugin;
@@ -1,9 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.centigradePlus90ToRadians = centigradePlus90ToRadians;
4
- function centigradePlus90ToRadians(centigradeArray, noDataValue = -9999) {
5
- const radiansArray = new Float32Array(centigradeArray.length);
6
- for (let i = 0; i < centigradeArray.length; i++) {
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++) {
7
8
  if (centigradeArray[i] === noDataValue) {
8
9
  radiansArray[i] = noDataValue;
9
10
  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
- const plugin_1 = __importDefault(require("./plugin"));
7
+ var plugin_1 = __importDefault(require("./plugin"));
8
8
  exports.ArrowField = plugin_1.default;
9
- const adaptor_1 = require("./adaptor");
9
+ var adaptor_1 = require("./adaptor");
10
10
  Object.defineProperty(exports, "centigradePlus90ToRadians", { enumerable: true, get: function () { return adaptor_1.centigradePlus90ToRadians; } });
@@ -1,86 +1,89 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
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 } = {}) {
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;
6
7
  this.id = id;
7
8
  this.options = {
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
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
24
25
  };
25
26
  this.arrowFieldObj = null;
26
27
  this._doDraw = true;
27
28
  }
28
- init(globe, gl) {
29
+ ArrowFieldPlugin.prototype.init = function (globe, gl) {
29
30
  this.globe = globe;
30
31
  this.gl = gl;
31
32
  this.arrowFieldObj = new programs_1.ArrowField(gl, globe, this.options);
32
- }
33
- draw3D() {
33
+ };
34
+ ArrowFieldPlugin.prototype.draw3D = function () {
34
35
  if (this._doDraw) {
35
- const { gl, arrowFieldObj } = this;
36
+ var _a = this, gl = _a.gl, arrowFieldObj = _a.arrowFieldObj;
36
37
  gl.disable(gl.DEPTH_TEST);
37
38
  arrowFieldObj.draw();
38
39
  gl.enable(gl.DEPTH_TEST);
39
40
  }
40
- }
41
- free() {
41
+ };
42
+ ArrowFieldPlugin.prototype.free = function () {
42
43
  this.arrowFieldObj.free();
43
44
  this.arrowFieldObj = null;
44
- }
45
+ };
45
46
  // user interaction methods
46
- on() {
47
+ ArrowFieldPlugin.prototype.on = function () {
47
48
  this._doDraw = true;
48
- }
49
- off() {
49
+ };
50
+ ArrowFieldPlugin.prototype.off = function () {
50
51
  this._doDraw = false;
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) {
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) {
74
76
  this.arrowFieldObj.update({ resolution: [targetWidth, targetHeight] });
75
- }
76
- setMaxMagnitude(maxMagnitude) {
77
- this.arrowFieldObj.update({ maxMagnitude });
78
- }
79
- setNoDataValue(noDataValue) {
80
- this.arrowFieldObj.update({ noDataValue });
81
- }
82
- setData(rotationData) {
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) {
83
85
  this.arrowFieldObj.setData(rotationData);
84
- }
85
- }
86
+ };
87
+ return ArrowFieldPlugin;
88
+ }());
86
89
  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
- const plugin_1 = __importDefault(require("./plugin"));
7
+ var plugin_1 = __importDefault(require("./plugin"));
8
8
  exports.BearingLinePlugin = plugin_1.default;