@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,5 +1,180 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.webworkerStr = void 0;
4
- var webworkerStr = "\n\nconst WORLD_RADIUS_3D = 6378.137;\nconst WORLD_RADIUS_MERCATOR = 6378136.99911;\n\nconst dot3 = (a, b) => {\n return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];\n}\n\nconst sphericalLinearInterpolation_UnitVector = (normalizedA, normalizedB, ratio) => {\n const theta = Math.acos(dot3(normalizedA, normalizedB));\n if (theta < 0.000001) return normalizedA; // CALIBRATE?\n const sinTheta = Math.sin(theta);\n const result = [\n (Math.sin((1.0 - ratio) * theta) * normalizedA[0] + Math.sin(ratio * theta) * normalizedB[0]) / sinTheta,\n (Math.sin((1.0 - ratio) * theta) * normalizedA[1] + Math.sin(ratio * theta) * normalizedB[1]) / sinTheta,\n (Math.sin((1.0 - ratio) * theta) * normalizedA[2] + Math.sin(ratio * theta) * normalizedB[2]) / sinTheta\n ];\n return result;\n}\n\nconst radianToMercator = (xy) => {\n return [WORLD_RADIUS_MERCATOR * xy[0], WORLD_RADIUS_MERCATOR * Math.log(Math.tan(Math.PI / 4 + xy[1] / 2))];\n}\n\n\nconst cartesian3dToRadian = (cartesian) => {\n const x = cartesian[0];\n const y = cartesian[1];\n const z = cartesian[2];\n // const length = Math.sqrt(x * x + y * y + z * z);\n const long = Math.atan2(y, x);\n const lat = Math.asin(z)// length);\n return [long, lat];\n}\n\n\nconst sphericalLinearInterpolation_Mercator = (normalizedA, normalizedB, ratio) => {\n const unitVector = sphericalLinearInterpolation_UnitVector(normalizedA, normalizedB, ratio);\n const angles = cartesian3dToRadian(unitVector);\n return radianToMercator(angles);\n}\n\nconst sphericalLinearInterpolation_Cartesian3d = (a, b, ratio) => {\n const unitVector = sphericalLinearInterpolation_UnitVector(a, b, ratio);\n const height = a[3] + (b[3] - a[3]) * ratio;\n return [unitVector[0] * height, unitVector[1] * height, unitVector[2] * height];\n}\n\nconst findFirstIndexInRange = (container, value) => {\n let start = 0;\n let end = container.length - 1;\n let mid = 0;\n while (start <= end) {\n mid = Math.floor((start + end) / 2);\n if (container[mid] <= value && value <= container[mid + 1]) return mid;\n if (container[mid] < value) start = mid + 1;\n else end = mid - 1;\n }\n return null;\n}\n\nconst GEOMETRY = Object.freeze({\n CARTESIAN3D: 0,\n MERCATOR: 1,\n});\n\nclass TimeTrackInterpolator {\n /**\n * @typedef Timetrack\n * @property {Array<vec4>}} coordinates [x,y,z, length]\n * @property {Array<Number>} times\n * @param {Array<Timetrack>} timeTracks\n */\n constructor({ timeTracks, bbox = null, geometry = GEOMETRY.CARTESIAN3D } = {}) {\n this.timeTracks = null;\n this.timeTracksStartTimes = null;\n this.geometry = geometry;\n if (timeTracks) this.setTimetracks(timeTracks);\n if (bbox) this.setBbox(bbox);\n }\n\n\n setGeometry(geometry) {\n if (geometry !== GEOMETRY.CARTESIAN3D && geometry !== GEOMETRY.MERCATOR) {\n throw new Error('Invalid geometry');\n }\n this.geometry = geometry;\n }\n\n setTimetracks(timeTracks) {\n this.timeTracks = timeTracks;\n }\n\n\n interpolate(time) {\n const { timeTracks, geometry } = this;\n if (!timeTracks) { return null; }\n const resultArray = [];\n const info = {\n outOfRange: 0,\n processed: 0,\n }\n for (let i = 0; i < timeTracks.length; i++) {\n const { times, coordinates } = timeTracks[i];\n\n if (times[times.length - 1] < time) continue;\n info.processed++;\n const timeIndex = findFirstIndexInRange(times, time);\n if (timeIndex === null) { info.outOfRange++; continue; }\n const timeFraction = (time - times[timeIndex]) / (times[timeIndex + 1] - times[timeIndex]);\n const interpolated = (geometry === GEOMETRY.CARTESIAN3D) ?\n sphericalLinearInterpolation_Cartesian3d(coordinates[timeIndex], coordinates[timeIndex + 1], timeFraction) :\n sphericalLinearInterpolation_Mercator(coordinates[timeIndex], coordinates[timeIndex + 1], timeFraction);\n resultArray.push(...interpolated);\n }\n return new Float32Array(resultArray);\n }\n\n\n // implicit methods\n\n _orderTimeTracks() {\n this.timeTracks.sort((a, b) => a.times[0] - b.times[0]);\n }\n\n _setStartTimes() {\n this.timeTracksStartTimes = this.timeTracks.map(tt => tt.times[0]);\n }\n}\n\nconst interpolator = new TimeTrackInterpolator({ geometry: GEOMETRY.CARTESIAN3D });\n\n/* eslint-disable-next-line no-restricted-globals */\nself.onmessage = function (e) {\n\n const { geometry = null, timeTracks = null, time = null } = e.data;\n\n if (geometry !== null) {\n try {\n interpolator.setGeometry(geometry);\n } catch (error) {\n /* eslint-disable-next-line no-restricted-globals */\n self.postMessage({ error: error.message });\n return;\n }\n }\n\n if (timeTracks !== null) {\n try {\n interpolator.setTimetracks(timeTracks);\n } catch (error) {\n /* eslint-disable-next-line no-restricted-globals */\n self.postMessage({ error: error.message });\n return;\n }\n }\n\n if (time !== null) {\n try {\n const result = interpolator.interpolate(time);\n if(result === null) {\n /* eslint-disable-next-line no-restricted-globals */\n self.postMessage({ error: 'No TimeTracks Data' });\n return;\n }\n /* eslint-disable-next-line no-restricted-globals */\n self.postMessage(result, [result.buffer]);\n return;\n } catch (error) {\n /* eslint-disable-next-line no-restricted-globals */\n self.postMessage({ error: error.message });\n return;\n }\n }\n /* eslint-disable-next-line no-restricted-globals */\n self.postMessage(true);\n}\n ";
5
- exports.webworkerStr = webworkerStr;
1
+ const webworkerStr = `
2
+
3
+ const WORLD_RADIUS_3D = 6378.137;
4
+ const WORLD_RADIUS_MERCATOR = 6378136.99911;
5
+
6
+ const dot3 = (a, b) => {
7
+ return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
8
+ }
9
+
10
+ const sphericalLinearInterpolation_UnitVector = (normalizedA, normalizedB, ratio) => {
11
+ const theta = Math.acos(dot3(normalizedA, normalizedB));
12
+ if (theta < 0.000001) return normalizedA; // CALIBRATE?
13
+ const sinTheta = Math.sin(theta);
14
+ const result = [
15
+ (Math.sin((1.0 - ratio) * theta) * normalizedA[0] + Math.sin(ratio * theta) * normalizedB[0]) / sinTheta,
16
+ (Math.sin((1.0 - ratio) * theta) * normalizedA[1] + Math.sin(ratio * theta) * normalizedB[1]) / sinTheta,
17
+ (Math.sin((1.0 - ratio) * theta) * normalizedA[2] + Math.sin(ratio * theta) * normalizedB[2]) / sinTheta
18
+ ];
19
+ return result;
20
+ }
21
+
22
+ const radianToMercator = (xy) => {
23
+ return [WORLD_RADIUS_MERCATOR * xy[0], WORLD_RADIUS_MERCATOR * Math.log(Math.tan(Math.PI / 4 + xy[1] / 2))];
24
+ }
25
+
26
+
27
+ const cartesian3dToRadian = (cartesian) => {
28
+ const x = cartesian[0];
29
+ const y = cartesian[1];
30
+ const z = cartesian[2];
31
+ // const length = Math.sqrt(x * x + y * y + z * z);
32
+ const long = Math.atan2(y, x);
33
+ const lat = Math.asin(z)// length);
34
+ return [long, lat];
35
+ }
36
+
37
+
38
+ const sphericalLinearInterpolation_Mercator = (normalizedA, normalizedB, ratio) => {
39
+ const unitVector = sphericalLinearInterpolation_UnitVector(normalizedA, normalizedB, ratio);
40
+ const angles = cartesian3dToRadian(unitVector);
41
+ return radianToMercator(angles);
42
+ }
43
+
44
+ const sphericalLinearInterpolation_Cartesian3d = (a, b, ratio) => {
45
+ const unitVector = sphericalLinearInterpolation_UnitVector(a, b, ratio);
46
+ const height = a[3] + (b[3] - a[3]) * ratio;
47
+ return [unitVector[0] * height, unitVector[1] * height, unitVector[2] * height];
48
+ }
49
+
50
+ const findFirstIndexInRange = (container, value) => {
51
+ let start = 0;
52
+ let end = container.length - 1;
53
+ let mid = 0;
54
+ while (start <= end) {
55
+ mid = Math.floor((start + end) / 2);
56
+ if (container[mid] <= value && value <= container[mid + 1]) return mid;
57
+ if (container[mid] < value) start = mid + 1;
58
+ else end = mid - 1;
59
+ }
60
+ return null;
61
+ }
62
+
63
+ const GEOMETRY = Object.freeze({
64
+ CARTESIAN3D: 0,
65
+ MERCATOR: 1,
66
+ });
67
+
68
+ class TimeTrackInterpolator {
69
+ /**
70
+ * @typedef Timetrack
71
+ * @property {Array<vec4>}} coordinates [x,y,z, length]
72
+ * @property {Array<Number>} times
73
+ * @param {Array<Timetrack>} timeTracks
74
+ */
75
+ constructor({ timeTracks, bbox = null, geometry = GEOMETRY.CARTESIAN3D } = {}) {
76
+ this.timeTracks = null;
77
+ this.timeTracksStartTimes = null;
78
+ this.geometry = geometry;
79
+ if (timeTracks) this.setTimetracks(timeTracks);
80
+ if (bbox) this.setBbox(bbox);
81
+ }
82
+
83
+
84
+ setGeometry(geometry) {
85
+ if (geometry !== GEOMETRY.CARTESIAN3D && geometry !== GEOMETRY.MERCATOR) {
86
+ throw new Error('Invalid geometry');
87
+ }
88
+ this.geometry = geometry;
89
+ }
90
+
91
+ setTimetracks(timeTracks) {
92
+ this.timeTracks = timeTracks;
93
+ }
94
+
95
+
96
+ interpolate(time) {
97
+ const { timeTracks, geometry } = this;
98
+ if (!timeTracks) { return null; }
99
+ const resultArray = [];
100
+ const info = {
101
+ outOfRange: 0,
102
+ processed: 0,
103
+ }
104
+ for (let i = 0; i < timeTracks.length; i++) {
105
+ const { times, coordinates } = timeTracks[i];
106
+
107
+ if (times[times.length - 1] < time) continue;
108
+ info.processed++;
109
+ const timeIndex = findFirstIndexInRange(times, time);
110
+ if (timeIndex === null) { info.outOfRange++; continue; }
111
+ const timeFraction = (time - times[timeIndex]) / (times[timeIndex + 1] - times[timeIndex]);
112
+ const interpolated = (geometry === GEOMETRY.CARTESIAN3D) ?
113
+ sphericalLinearInterpolation_Cartesian3d(coordinates[timeIndex], coordinates[timeIndex + 1], timeFraction) :
114
+ sphericalLinearInterpolation_Mercator(coordinates[timeIndex], coordinates[timeIndex + 1], timeFraction);
115
+ resultArray.push(...interpolated);
116
+ }
117
+ return new Float32Array(resultArray);
118
+ }
119
+
120
+
121
+ // implicit methods
122
+
123
+ _orderTimeTracks() {
124
+ this.timeTracks.sort((a, b) => a.times[0] - b.times[0]);
125
+ }
126
+
127
+ _setStartTimes() {
128
+ this.timeTracksStartTimes = this.timeTracks.map(tt => tt.times[0]);
129
+ }
130
+ }
131
+
132
+ const interpolator = new TimeTrackInterpolator({ geometry: GEOMETRY.CARTESIAN3D });
133
+
134
+ /* eslint-disable-next-line no-restricted-globals */
135
+ self.onmessage = function (e) {
136
+
137
+ const { geometry = null, timeTracks = null, time = null } = e.data;
138
+
139
+ if (geometry !== null) {
140
+ try {
141
+ interpolator.setGeometry(geometry);
142
+ } catch (error) {
143
+ /* eslint-disable-next-line no-restricted-globals */
144
+ self.postMessage({ error: error.message });
145
+ return;
146
+ }
147
+ }
148
+
149
+ if (timeTracks !== null) {
150
+ try {
151
+ interpolator.setTimetracks(timeTracks);
152
+ } catch (error) {
153
+ /* eslint-disable-next-line no-restricted-globals */
154
+ self.postMessage({ error: error.message });
155
+ return;
156
+ }
157
+ }
158
+
159
+ if (time !== null) {
160
+ try {
161
+ const result = interpolator.interpolate(time);
162
+ if(result === null) {
163
+ /* eslint-disable-next-line no-restricted-globals */
164
+ self.postMessage({ error: 'No TimeTracks Data' });
165
+ return;
166
+ }
167
+ /* eslint-disable-next-line no-restricted-globals */
168
+ self.postMessage(result, [result.buffer]);
169
+ return;
170
+ } catch (error) {
171
+ /* eslint-disable-next-line no-restricted-globals */
172
+ self.postMessage({ error: error.message });
173
+ return;
174
+ }
175
+ }
176
+ /* eslint-disable-next-line no-restricted-globals */
177
+ self.postMessage(true);
178
+ }
179
+ `;
180
+ export { webworkerStr };
@@ -1,10 +1,8 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- var timetrack_interpolator_1 = require("./timetrack-interpolator");
4
- var interpolator = new timetrack_interpolator_1.TimeTrackInterpolator({ geometry: timetrack_interpolator_1.GEOMETRY.CARTESIAN3D });
1
+ import { TimeTrackInterpolator, GEOMETRY } from './timetrack-interpolator';
2
+ const interpolator = new TimeTrackInterpolator({ geometry: GEOMETRY.CARTESIAN3D });
5
3
  /* eslint-disable-next-line no-restricted-globals */
6
4
  self.onmessage = function (e) {
7
- var _a = e.data, _b = _a.geometry, geometry = _b === void 0 ? null : _b, _c = _a.timeTracks, timeTracks = _c === void 0 ? null : _c, _d = _a.time, time = _d === void 0 ? null : _d;
5
+ const { geometry = null, timeTracks = null, time = null } = e.data;
8
6
  if (geometry !== null) {
9
7
  try {
10
8
  interpolator.setGeometry(geometry);
@@ -27,7 +25,7 @@ self.onmessage = function (e) {
27
25
  }
28
26
  if (time !== null) {
29
27
  try {
30
- var result = interpolator.interpolate(time);
28
+ const result = interpolator.interpolate(time);
31
29
  if (result === null) {
32
30
  /* eslint-disable-next-line no-restricted-globals */
33
31
  self.postMessage({ error: 'No TimeTracks Data' });
@@ -1,20 +1,17 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.populateFloat32Array = void 0;
4
- var populateFloat32Array = Object.freeze({
5
- fillFloat32Array: function (length, data) {
6
- var result = new Float32Array(length);
1
+ const populateFloat32Array = Object.freeze({
2
+ fillFloat32Array: (length, data) => {
3
+ const result = new Float32Array(length);
7
4
  result.fill(data);
8
5
  return result;
9
6
  },
10
- fillWithListData: function (length, listdata) {
11
- var result = new Float32Array(length * listdata.length);
12
- var offset = 0;
13
- for (var i = 0; i < length; i++) {
7
+ fillWithListData: (length, listdata) => {
8
+ const result = new Float32Array(length * listdata.length);
9
+ let offset = 0;
10
+ for (let i = 0; i < length; i++) {
14
11
  result.set(listdata, offset);
15
12
  offset += listdata.length;
16
13
  }
17
14
  return result;
18
15
  }
19
16
  });
20
- exports.populateFloat32Array = populateFloat32Array;
17
+ export { populateFloat32Array };
@@ -1,6 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.arraysEqual = arraysEqual;
4
1
  function arraysEqual(a, b) {
5
2
  if (a === b)
6
3
  return true;
@@ -18,3 +15,4 @@ function arraysEqual(a, b) {
18
15
  }
19
16
  return true;
20
17
  }
18
+ export { arraysEqual };
@@ -1,37 +1,2 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.timefilters = void 0;
37
- exports.timefilters = __importStar(require("./timefilters"));
1
+ import * as timefilters_1 from './timefilters';
2
+ export { timefilters_1 as timefilters };
@@ -1,15 +1,12 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.instantDebounce = instantDebounce;
4
1
  // TODO: fix logic error in instantDebounce
5
2
  function instantDebounce(func, delay) {
6
- var timeout = null;
7
- var lastArgs = null;
8
- var runAtEnd = false;
9
- var timeoutMethod = function () {
10
- setTimeout(function () {
3
+ let timeout = null;
4
+ let lastArgs = null;
5
+ let runAtEnd = false;
6
+ const timeoutMethod = () => {
7
+ setTimeout(() => {
11
8
  if (runAtEnd) {
12
- func.apply(void 0, lastArgs);
9
+ func(...lastArgs);
13
10
  lastArgs = null;
14
11
  // console.log("processed with delay")
15
12
  runAtEnd = false;
@@ -24,9 +21,10 @@ function instantDebounce(func, delay) {
24
21
  return;
25
22
  }
26
23
  else {
27
- func.apply(void 0, args);
24
+ func(...args);
28
25
  // console.log("processed instantly")
29
26
  timeout = timeoutMethod();
30
27
  }
31
28
  };
32
29
  }
30
+ export { instantDebounce };
@@ -1,17 +1,14 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.fence = void 0;
4
- var fence = function (gl) { return new Promise(function (resolve, reject) {
1
+ const fence = (gl) => new Promise((resolve, reject) => {
5
2
  // This will create a fence. If this follows a `readPixels()` call, then it
6
3
  // will signal to WebGL that the read instruction should be asynchronous.
7
4
  // This means JS can continue to work on other tasks while the read instruction
8
5
  // completes.
9
- var sync = gl.fenceSync(gl.SYNC_GPU_COMMANDS_COMPLETE, 0);
6
+ const sync = gl.fenceSync(gl.SYNC_GPU_COMMANDS_COMPLETE, 0);
10
7
  gl.flush();
11
8
  // There are TWO possible ways to check on the status of a WebGLSync object.
12
9
  // 1. This will check it using clientWaitSync()
13
- var checkStatus_v1 = function () {
14
- var status = gl.clientWaitSync(sync, 0, 0);
10
+ const checkStatus_v1 = () => {
11
+ const status = gl.clientWaitSync(sync, 0, 0);
15
12
  // There are four possible values for status:
16
13
  // a. ALREADY_SIGNALED and CONDITION_SATISFIED (done)
17
14
  // b. TIMEOUT_EXPIRED (check again later)
@@ -29,8 +26,8 @@ var fence = function (gl) { return new Promise(function (resolve, reject) {
29
26
  }
30
27
  };
31
28
  // 2. This will check with getSyncParameter(s, gl.SYNC_STATUS)
32
- var checkStatus_v2 = function () {
33
- var status = gl.getSyncParameter(sync, gl.SYNC_STATUS);
29
+ const checkStatus_v2 = () => {
30
+ const status = gl.getSyncParameter(sync, gl.SYNC_STATUS);
34
31
  // There are only two possible values for status: SIGNALED and UNSIGNALED
35
32
  // Note that there is no `error` signal, so there is no reason to use `reject()` here
36
33
  if (status === gl.SIGNALED) {
@@ -42,5 +39,5 @@ var fence = function (gl) { return new Promise(function (resolve, reject) {
42
39
  }
43
40
  };
44
41
  setTimeout(checkStatus_v2, 1);
45
- }); };
46
- exports.fence = fence;
42
+ });
43
+ export { fence };
@@ -1,59 +1,54 @@
1
- "use strict";
2
1
  /**
3
2
  * add implicit texture display program for color
4
3
  * add fence on query return and return id.
5
4
  */
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.PickerDisplayer = void 0;
8
- var draw_texture_on_canvas_1 = require("../programs/draw-texture-on-canvas");
9
- var fence_1 = require("./fence");
10
- var ESCAPE_VALUE = -1;
11
- var PickerDisplayer = /** @class */ (function () {
12
- function PickerDisplayer(globe) {
5
+ import { textureOnCanvasProgramCache } from "../programs/draw-texture-on-canvas";
6
+ import { fence } from "./fence";
7
+ const ESCAPE_VALUE = -1;
8
+ class PickerDisplayer {
9
+ constructor(globe) {
13
10
  this.globe = globe;
14
11
  this.gl = globe.gl;
15
- var gl = this.gl;
12
+ const gl = this.gl;
16
13
  this.colorTexture = gl.createTexture(); // bind to color attachment 0
17
14
  this.indexTexture = gl.createTexture(); // bind to color attachment 1
18
15
  this.fbo = gl.createFramebuffer();
19
16
  this._pbo = undefined;
20
17
  this._pboSize = 0;
21
18
  this.resize();
22
- this.displayer = draw_texture_on_canvas_1.textureOnCanvasProgramCache.get(this.gl);
19
+ this.displayer = textureOnCanvasProgramCache.get(this.gl);
23
20
  }
24
- PickerDisplayer.prototype.resize = function (width, height) {
25
- if (width === void 0) { width = null; }
26
- if (height === void 0) { height = null; }
21
+ resize(width = null, height = null) {
27
22
  if (width === null || height === null) {
28
23
  width = this.globe.api_ScrW();
29
24
  height = this.globe.api_ScrH();
30
25
  }
31
- var _a = this, gl = _a.gl, colorTexture = _a.colorTexture, indexTexture = _a.indexTexture;
26
+ const { gl, colorTexture, indexTexture } = this;
32
27
  gl.deleteTexture(colorTexture);
33
28
  gl.deleteTexture(indexTexture);
34
- var colorTextureNew = gl.createTexture();
29
+ const colorTextureNew = gl.createTexture();
35
30
  gl.bindTexture(gl.TEXTURE_2D, colorTextureNew);
36
31
  gl.texStorage2D(gl.TEXTURE_2D, 1, gl.RGBA8, width, height);
37
- var indexTextureNew = gl.createTexture();
32
+ const indexTextureNew = gl.createTexture();
38
33
  gl.bindTexture(gl.TEXTURE_2D, indexTextureNew);
39
34
  // gl.texStorage2D(gl.TEXTURE_2D, 1, gl.R16I, width, height);
40
35
  gl.texStorage2D(gl.TEXTURE_2D, 1, gl.R32I, width, height);
41
36
  gl.bindTexture(gl.TEXTURE_2D, null);
42
37
  this.colorTexture = colorTextureNew;
43
38
  this.indexTexture = indexTextureNew;
44
- };
45
- PickerDisplayer.prototype.clearTextures = function () {
46
- var _a = this, gl = _a.gl, colorTexture = _a.colorTexture, indexTexture = _a.indexTexture;
39
+ }
40
+ clearTextures() {
41
+ const { gl, colorTexture, indexTexture } = this;
47
42
  gl.activeTexture(gl.TEXTURE1);
48
43
  gl.bindTexture(gl.TEXTURE_2D, indexTexture);
49
44
  gl.clearBufferiv(gl.COLOR, 1, new Int32Array([-1, -1, -1, -1]));
50
45
  gl.activeTexture(gl.TEXTURE0);
51
46
  gl.bindTexture(gl.TEXTURE_2D, colorTexture);
52
47
  gl.clearBufferfv(gl.COLOR, 0, new Float32Array([0, 0, 0, 0]));
53
- };
48
+ }
54
49
  // call before drawing the scene with gl picker shader
55
- PickerDisplayer.prototype.bindFBO = function () {
56
- var _a = this, gl = _a.gl, colorTexture = _a.colorTexture, indexTexture = _a.indexTexture, fbo = _a.fbo;
50
+ bindFBO() {
51
+ const { gl, colorTexture, indexTexture, fbo } = this;
57
52
  gl.activeTexture(gl.TEXTURE1);
58
53
  gl.bindTexture(gl.TEXTURE_2D, indexTexture);
59
54
  gl.activeTexture(gl.TEXTURE0);
@@ -64,30 +59,27 @@ var PickerDisplayer = /** @class */ (function () {
64
59
  gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT1, gl.TEXTURE_2D, this.indexTexture, 0);
65
60
  gl.drawBuffers([gl.COLOR_ATTACHMENT0, gl.COLOR_ATTACHMENT1]);
66
61
  }
67
- };
62
+ }
68
63
  // call after drawing the scene with gl picker shader
69
- PickerDisplayer.prototype.drawColorTexture = function () {
70
- var colorTexture = this.colorTexture;
64
+ drawColorTexture() {
65
+ const { colorTexture } = this;
71
66
  this.gl.bindFramebuffer(this.gl.FRAMEBUFFER, null);
72
67
  this.displayer.draw(colorTexture);
73
- };
74
- PickerDisplayer.prototype.pickXY = function (x, y, selectionPointFilling, callback) {
75
- if (selectionPointFilling === void 0) { selectionPointFilling = 1; }
76
- if (callback === void 0) { callback = function () { }; }
77
- var size = Math.pow(1 + 2 * selectionPointFilling, 2);
68
+ }
69
+ pickXY(x, y, selectionPointFilling = 1, callback = () => { }) {
70
+ const size = Math.pow(1 + 2 * selectionPointFilling, 2);
78
71
  this._pick(size, x - selectionPointFilling, y - selectionPointFilling, 1 + 2 * selectionPointFilling, 1 + 2 * selectionPointFilling, callback);
79
- };
80
- PickerDisplayer.prototype.pickBbox = function (left, top, right, bottom, callback) {
81
- var size = (right - left) * (bottom - top) * 4;
72
+ }
73
+ pickBbox(left, top, right, bottom, callback) {
74
+ const size = (right - left) * (bottom - top) * 4;
82
75
  this._pick(size, left, top, right - left, bottom - top, callback);
83
- };
84
- PickerDisplayer.prototype._pick = function (size, startX, startY, lengthX, lengthY, callback) {
85
- var _this = this;
76
+ }
77
+ _pick(size, startX, startY, lengthX, lengthY, callback) {
86
78
  if (this._inProgress)
87
79
  return false;
88
80
  this._inProgress = true;
89
81
  this._initHoldBuffer(size * 4);
90
- var _a = this, gl = _a.gl, _pbo = _a._pbo;
82
+ const { gl, _pbo } = this;
91
83
  gl.bindBuffer(gl.PIXEL_PACK_BUFFER, _pbo);
92
84
  this.bindFBO();
93
85
  gl.readBuffer(gl.COLOR_ATTACHMENT1); // This is the attachment we want to read
@@ -95,35 +87,35 @@ var PickerDisplayer = /** @class */ (function () {
95
87
  startX, startY, lengthX, lengthY, gl.RED_INTEGER, gl.INT, 0);
96
88
  gl.bindFramebuffer(gl.FRAMEBUFFER, null);
97
89
  gl.bindBuffer(gl.PIXEL_PACK_BUFFER, null);
98
- (0, fence_1.fence)(this.gl).then(function () {
90
+ fence(this.gl).then(() => {
99
91
  gl.bindBuffer(gl.PIXEL_PACK_BUFFER, _pbo);
100
92
  // const data = new Int16Array(size);
101
- var data = new Int32Array(size);
93
+ const data = new Int32Array(size);
102
94
  gl.getBufferSubData(gl.PIXEL_PACK_BUFFER, 0, data);
103
95
  gl.bindBuffer(gl.PIXEL_PACK_BUFFER, null);
104
- var result = _this._pickFromBuffer(data, size);
96
+ const result = this._pickFromBuffer(data, size);
105
97
  callback(result);
106
98
  // gl.deleteBuffer(pbo);
107
- _this._inProgress = false;
99
+ this._inProgress = false;
108
100
  });
109
101
  return true;
110
- };
111
- PickerDisplayer.prototype._pickFromBuffer = function (array, size) {
112
- var selectedObjects = new Set();
113
- for (var i = 0; i < size; i += 1) {
114
- var id = array[i];
102
+ }
103
+ _pickFromBuffer(array, size) {
104
+ const selectedObjects = new Set();
105
+ for (let i = 0; i < size; i += 1) {
106
+ const id = array[i];
115
107
  if (id !== ESCAPE_VALUE) {
116
108
  selectedObjects.add(id);
117
109
  }
118
110
  }
119
111
  return selectedObjects;
120
- };
121
- PickerDisplayer.prototype._initHoldBuffer = function (size) {
112
+ }
113
+ _initHoldBuffer(size) {
122
114
  if (this._pbo && this._pboSize >= size) {
123
115
  return;
124
116
  }
125
- var gl = this.gl;
126
- var pbo = gl.createBuffer();
117
+ const { gl } = this;
118
+ const pbo = gl.createBuffer();
127
119
  gl.bindBuffer(gl.PIXEL_PACK_BUFFER, pbo);
128
120
  gl.bufferData(gl.PIXEL_PACK_BUFFER, size, gl.STREAM_READ);
129
121
  gl.bindBuffer(gl.PIXEL_PACK_BUFFER, null);
@@ -132,14 +124,13 @@ var PickerDisplayer = /** @class */ (function () {
132
124
  gl.deleteBuffer(this._pbo);
133
125
  }
134
126
  this._pbo = pbo;
135
- };
136
- PickerDisplayer.prototype.free = function () {
137
- var _a = this, gl = _a.gl, colorTexture = _a.colorTexture, indexTexture = _a.indexTexture, fbo = _a.fbo;
127
+ }
128
+ free() {
129
+ const { gl, colorTexture, indexTexture, fbo } = this;
138
130
  gl.deleteTexture(colorTexture);
139
131
  gl.deleteTexture(indexTexture);
140
132
  gl.deleteFramebuffer(fbo);
141
- draw_texture_on_canvas_1.textureOnCanvasProgramCache.release(this.gl);
142
- };
143
- return PickerDisplayer;
144
- }());
145
- exports.PickerDisplayer = PickerDisplayer;
133
+ textureOnCanvasProgramCache.release(this.gl);
134
+ }
135
+ }
136
+ export { PickerDisplayer };