@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,47 +1,8 @@
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
- var __importDefault = (this && this.__importDefault) || function (mod) {
36
- return (mod && mod.__esModule) ? mod : { "default": mod };
37
- };
38
- Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.IsobarRasterToVector = void 0;
40
- var util_1 = require("../../util");
41
- var quadtreecontours_1 = __importStar(require("./quadtreecontours"));
42
- var objectarraylabels_1 = __importDefault(require("./objectarraylabels"));
43
- var typecheck_1 = require("../../util/check/typecheck");
44
- var IsobarRasterToVector = /** @class */ (function () {
1
+ import { ShapesOnGlobeProgram, latLongToPixelXY } from "../../util";
2
+ import ContourMipmap, { scaleParameters } from "./quadtreecontours";
3
+ import ObjectArrayLabels from "./objectarraylabels";
4
+ import { isBoolean, opacityCheck } from "../../util/check/typecheck";
5
+ export class IsobarRasterToVector {
45
6
  /**
46
7
  * @typedef {Object} IsobarData
47
8
  * @property {number} threshold
@@ -59,9 +20,7 @@ var IsobarRasterToVector = /** @class */ (function () {
59
20
  * @param {boolean} options.isLabelsOn
60
21
  * @param {Object} options.labelStyle
61
22
  */
62
- function IsobarRasterToVector(id, dataManager, isobars, width, height, _a, _b) {
63
- var _c = _a === void 0 ? [-180, -90, 180, 90] : _a, minLon = _c[0], minLat = _c[1], maxLon = _c[2], maxLat = _c[3];
64
- var _d = _b === void 0 ? {} : _b, _e = _d.xFlip, xFlip = _e === void 0 ? false : _e, _f = _d.yFlip, yFlip = _f === void 0 ? true : _f, _g = _d.isOn, isOn = _g === void 0 ? true : _g, _h = _d.isLabelsOn, isLabelsOn = _h === void 0 ? true : _h, _j = _d.labelStyle, labelStyle = _j === void 0 ? null : _j, _k = _d.maxMipmapLevel, maxMipmapLevel = _k === void 0 ? null : _k;
23
+ constructor(id, dataManager, isobars, width, height, [minLon, minLat, maxLon, maxLat] = [-180, -90, 180, 90], { xFlip = false, yFlip = true, isOn = true, isLabelsOn = true, labelStyle = null, maxMipmapLevel = null } = {}) {
65
24
  this.id = id;
66
25
  this._isobarsCheckAndComplete(isobars);
67
26
  this.isobars = isobars;
@@ -84,8 +43,7 @@ var IsobarRasterToVector = /** @class */ (function () {
84
43
  // this._transformationMethod = null;
85
44
  }
86
45
  // API
87
- IsobarRasterToVector.prototype.setData = function (data, on) {
88
- if (on === void 0) { on = false; }
46
+ setData(data, on = false) {
89
47
  if (!data)
90
48
  return;
91
49
  this._data = data;
@@ -93,43 +51,42 @@ var IsobarRasterToVector = /** @class */ (function () {
93
51
  this._isOn = true;
94
52
  if (this._isOn)
95
53
  this._calculateAll(data);
96
- };
97
- IsobarRasterToVector.prototype.on = function () {
54
+ }
55
+ on() {
98
56
  this._isOn = true;
99
57
  if (this._data)
100
58
  this._calculateAll(this._data);
101
- };
102
- IsobarRasterToVector.prototype.off = function () {
59
+ }
60
+ off() {
103
61
  this._isOn = false;
104
62
  this.clean();
105
- };
106
- IsobarRasterToVector.prototype.clean = function () {
63
+ }
64
+ clean() {
107
65
  this.flush();
108
66
  this.globe.DrawRender();
109
- };
110
- IsobarRasterToVector.prototype.setFlip = function (xFlip, yFlip) {
111
- (0, typecheck_1.isBoolean)(xFlip);
112
- (0, typecheck_1.isBoolean)(yFlip);
67
+ }
68
+ setFlip(xFlip, yFlip) {
69
+ isBoolean(xFlip);
70
+ isBoolean(yFlip);
113
71
  if (this.xFlip === xFlip && this.yFlip === yFlip)
114
72
  return;
115
73
  this.xFlip = xFlip;
116
74
  this.yFlip = yFlip;
117
- var _a = this.bbox, minLon = _a[0], minLat = _a[1], maxLon = _a[2], maxLat = _a[3];
118
- var _b = this, width = _b.width, height = _b.height;
75
+ const [minLon, minLat, maxLon, maxLat] = this.bbox;
76
+ const { width, height } = this;
119
77
  this._transformationMethod = getTransformationMethod(xFlip, yFlip, width, height, minLon, minLat, maxLon, maxLat);
120
78
  this._calculateLines();
121
79
  this.globe.DrawRender();
122
- };
123
- IsobarRasterToVector.prototype.setBoundingBox = function (_a) {
124
- var minLon = _a[0], minLat = _a[1], maxLon = _a[2], maxLat = _a[3];
80
+ }
81
+ setBoundingBox([minLon, minLat, maxLon, maxLat]) {
125
82
  this.bbox = [minLon, minLat, maxLon, maxLat];
126
- var _b = this, width = _b.width, height = _b.height, xFlip = _b.xFlip, yFlip = _b.yFlip;
83
+ const { width, height, xFlip, yFlip } = this;
127
84
  this._transformationMethod = getTransformationMethod(xFlip, yFlip, width, height, minLon, minLat, maxLon, maxLat);
128
85
  this._calculateLines();
129
86
  this.globe.DrawRender();
130
- };
131
- IsobarRasterToVector.prototype.setIsLabelsOn = function (isLabelsOn) {
132
- (0, typecheck_1.isBoolean)(isLabelsOn);
87
+ }
88
+ setIsLabelsOn(isLabelsOn) {
89
+ isBoolean(isLabelsOn);
133
90
  if (this._isLabelsOn === isLabelsOn)
134
91
  return;
135
92
  this._isLabelsOn = isLabelsOn;
@@ -142,126 +99,119 @@ var IsobarRasterToVector = /** @class */ (function () {
142
99
  this._labelsLayer.addToMap();
143
100
  this._createBufferData();
144
101
  }
145
- };
146
- IsobarRasterToVector.prototype.getIsobars = function () {
102
+ }
103
+ getIsobars() {
147
104
  return this.isobars;
148
- };
149
- IsobarRasterToVector.prototype.setIsobars = function (isobars) {
105
+ }
106
+ setIsobars(isobars) {
150
107
  this._isobarsCheckAndComplete(isobars);
151
108
  this.isobars = isobars;
152
109
  this._calculateLines();
153
110
  this.globe.DrawRender();
154
- };
155
- IsobarRasterToVector.prototype.setWidthHeight = function (width, height) {
111
+ }
112
+ setWidthHeight(width, height) {
156
113
  this.width = width;
157
114
  this.height = height;
158
- var _a = this, xFlip = _a.xFlip, yFlip = _a.yFlip;
159
- var _b = this.bbox, minLon = _b[0], minLat = _b[1], maxLon = _b[2], maxLat = _b[3];
115
+ const { xFlip, yFlip } = this;
116
+ const [minLon, minLat, maxLon, maxLat] = this.bbox;
160
117
  this._transformationMethod = getTransformationMethod(xFlip, yFlip, width, height, minLon, minLat, maxLon, maxLat);
161
118
  this._calculateLines();
162
119
  this.globe.DrawRender();
163
- };
164
- IsobarRasterToVector.prototype.getLabelStyle = function () {
120
+ }
121
+ getLabelStyle() {
165
122
  return this._labelsLayer.getLabelStyle();
166
- };
167
- IsobarRasterToVector.prototype.setOpacity = function (opacity) {
168
- (0, typecheck_1.opacityCheck)(opacity);
123
+ }
124
+ setOpacity(opacity) {
125
+ opacityCheck(opacity);
169
126
  this.program.setOpacity(opacity);
170
- };
171
- IsobarRasterToVector.prototype.setLabelStyle = function (style) {
127
+ }
128
+ setLabelStyle(style) {
172
129
  this._labelStyle = style;
173
130
  if (this._labelsLayer)
174
131
  this._labelsLayer.setLabelStyle(style);
175
- var lastState = this._isLabelsOn;
132
+ const lastState = this._isLabelsOn;
176
133
  this.setIsLabelsOn(false);
177
134
  this.setIsLabelsOn(lastState);
178
135
  if (lastState)
179
136
  this._createBufferData();
180
- };
181
- IsobarRasterToVector.prototype.setMaxMipmapLevel = function (maxMipmapLevel) {
182
- if (maxMipmapLevel === void 0) { maxMipmapLevel = null; }
137
+ }
138
+ setMaxMipmapLevel(maxMipmapLevel = null) {
183
139
  this._maxMipmapLevel = maxMipmapLevel;
184
140
  this._calculateLines();
185
141
  this.globe.DrawRender();
186
- };
187
- IsobarRasterToVector.prototype.flush = function () {
142
+ }
143
+ flush() {
188
144
  this.program.setBufferData(new Float32Array(0));
189
145
  this._lineStrignRanges = [];
190
146
  if (this._isLabelsOn)
191
147
  this._labelsLayer.flush();
192
- };
148
+ }
193
149
  //
194
150
  // implicit methods
195
- IsobarRasterToVector.prototype.init = function (globe, gl) {
196
- var _this = this;
151
+ init(globe, gl) {
197
152
  this.gl = gl;
198
153
  this.globe = globe;
199
- this.program = new util_1.ShapesOnGlobeProgram(gl, globe, 'line_strip');
154
+ this.program = new ShapesOnGlobeProgram(gl, globe, 'line_strip');
200
155
  if (this._isLabelsOn) {
201
156
  this._createLabelsLayer();
202
157
  this._labelsLayer.addToMap();
203
158
  }
204
- this.dataManager.register(this.id, function (ratio, t1, t2) {
159
+ this.dataManager.register(this.id, (ratio, t1, t2) => {
205
160
  if (!t1 || !t2) {
206
- _this.clean();
161
+ this.clean();
207
162
  return;
208
163
  }
209
- var data = dataMixer(t1, t2, ratio);
210
- if (_this._isOn)
211
- _this.setData(data);
164
+ const data = dataMixer(t1, t2, ratio);
165
+ if (this._isOn)
166
+ this.setData(data);
212
167
  });
213
- };
214
- IsobarRasterToVector.prototype.resize = function (width, height) {
168
+ }
169
+ resize(width, height) {
215
170
  this.program.resize(width, height);
216
- };
217
- IsobarRasterToVector.prototype.draw3D = function (projMatrix, modelviewMatrix, transPos) {
171
+ }
172
+ draw3D(projMatrix, modelviewMatrix, transPos) {
218
173
  if (!this._ready)
219
174
  return;
220
175
  this._drawContour(projMatrix, modelviewMatrix, transPos);
221
- };
222
- IsobarRasterToVector.prototype._calculateLines = function () {
176
+ }
177
+ _calculateLines() {
223
178
  this._calculateContours();
224
179
  this._bufferData = this._createBufferData();
225
180
  this.program.setBufferData(this._bufferData);
226
- };
227
- IsobarRasterToVector.prototype._drawContour = function (projMatrix, modelviewMatrix, transPos) {
181
+ }
182
+ _drawContour(projMatrix, modelviewMatrix, transPos) {
228
183
  this.program.draw(projMatrix, modelviewMatrix, transPos, this._lineStrignRanges);
229
- };
230
- IsobarRasterToVector.prototype._calculateIntersections = function (threshold) {
231
- var _transformationMethod = this._transformationMethod;
232
- var lines = this.contourMipmap.contour([threshold], { maxMipmapLevel: this._maxMipmapLevel }).map(function (coords) {
233
- return coords.map(function (_a) {
234
- var x = _a[0], y = _a[1];
235
- return _transformationMethod(x, y);
236
- });
184
+ }
185
+ _calculateIntersections(threshold) {
186
+ const { _transformationMethod } = this;
187
+ const lines = this.contourMipmap.contour([threshold], { maxMipmapLevel: this._maxMipmapLevel }).map(coords => {
188
+ return coords.map(([x, y]) => _transformationMethod(x, y));
237
189
  });
238
190
  return lines;
239
- };
240
- IsobarRasterToVector.prototype._calculateAll = function (data) {
241
- this.contourMipmap = new quadtreecontours_1.default(data, this.width, this.height);
191
+ }
192
+ _calculateAll(data) {
193
+ this.contourMipmap = new ContourMipmap(data, this.width, this.height);
242
194
  this._calculateContours();
243
195
  this._bufferData = this._createBufferData();
244
196
  this.program.setBufferData(this._bufferData);
245
197
  this.globe.DrawRender();
246
198
  this._ready = true;
247
- };
248
- IsobarRasterToVector.prototype._calculateContours = function () {
249
- var isobars = this.isobars;
250
- for (var _i = 0, isobars_1 = isobars; _i < isobars_1.length; _i++) {
251
- var isobar = isobars_1[_i];
252
- var threshold = isobar.threshold;
253
- var lines = this._calculateIntersections(threshold);
199
+ }
200
+ _calculateContours() {
201
+ const { isobars } = this;
202
+ for (const isobar of isobars) {
203
+ const { threshold } = isobar;
204
+ const lines = this._calculateIntersections(threshold);
254
205
  isobar.lines = lines;
255
206
  }
256
- };
257
- IsobarRasterToVector.prototype._isobarsCheckAndComplete = function (isobars) {
207
+ }
208
+ _isobarsCheckAndComplete(isobars) {
258
209
  window.isobars = isobars;
259
210
  if (!Array.isArray(isobars))
260
211
  throw new Error("isobars must be an array");
261
212
  if (isobars.length === 0)
262
213
  throw new Error("isobars must contain at least one element");
263
- for (var _i = 0, isobars_2 = isobars; _i < isobars_2.length; _i++) {
264
- var isobar = isobars_2[_i];
214
+ for (const isobar of isobars) {
265
215
  if (!isobar || typeof isobar !== 'object')
266
216
  throw new Error("isobar must be an object");
267
217
  if (typeof isobar.threshold !== 'number')
@@ -269,8 +219,7 @@ var IsobarRasterToVector = /** @class */ (function () {
269
219
  if (isobar.color) {
270
220
  if (!Array.isArray(isobar.color) || isobar.color.length !== 3)
271
221
  throw new Error("isobar.color must be an array with 3 elements");
272
- for (var _a = 0, _b = isobar.color; _a < _b.length; _a++) {
273
- var color = _b[_a];
222
+ for (const color of isobar.color) {
274
223
  if (color < 0 || color > 1)
275
224
  throw new Error("isobar.color elements must be between 0 and 1");
276
225
  }
@@ -278,33 +227,27 @@ var IsobarRasterToVector = /** @class */ (function () {
278
227
  if (!isobar.color)
279
228
  isobar.color = [1, 1, 1];
280
229
  }
281
- };
282
- IsobarRasterToVector.prototype._createBufferData = function () {
283
- var isobars = this.isobars;
284
- var pointCount = isobars.reduce(function (acc, _a) {
285
- var lines = _a.lines;
286
- return acc + lines.reduce(function (acc, line) { return acc + line.length; }, 0);
287
- }, 0);
288
- var bufferData = new Float32Array(pointCount * 6);
289
- var index = 0;
290
- var pointCounter = 0;
230
+ }
231
+ _createBufferData() {
232
+ const { isobars } = this;
233
+ const pointCount = isobars.reduce((acc, { lines }) => acc + lines.reduce((acc, line) => acc + line.length, 0), 0);
234
+ const bufferData = new Float32Array(pointCount * 6);
235
+ let index = 0;
236
+ let pointCounter = 0;
291
237
  this._lineStrignRanges = [];
292
238
  // gather label data label
293
- var labelPoints = {
239
+ const labelPoints = {
294
240
  coords: [],
295
241
  coordsZ: [],
296
242
  attribs: []
297
243
  };
298
- var coords = labelPoints.coords, coordsZ = labelPoints.coordsZ, attribs = labelPoints.attribs;
299
- var fidCounter = 0;
300
- for (var _i = 0, isobars_3 = isobars; _i < isobars_3.length; _i++) {
301
- var _a = isobars_3[_i], lines = _a.lines, color = _a.color, threshold = _a.threshold;
302
- for (var _b = 0, lines_1 = lines; _b < lines_1.length; _b++) {
303
- var line = lines_1[_b];
304
- var startIndex = pointCounter;
305
- for (var _c = 0, line_1 = line; _c < line_1.length; _c++) {
306
- var _d = line_1[_c], x = _d[0], y = _d[1];
307
- var pixXY = (0, util_1.latLongToPixelXY)(y, x);
244
+ const { coords, coordsZ, attribs } = labelPoints;
245
+ let fidCounter = 0;
246
+ for (const { lines, color, threshold } of isobars) {
247
+ for (const line of lines) {
248
+ let startIndex = pointCounter;
249
+ for (const [x, y] of line) {
250
+ const pixXY = latLongToPixelXY(y, x);
308
251
  bufferData[index++] = pixXY.x;
309
252
  bufferData[index++] = pixXY.y;
310
253
  bufferData[index++] = color[0];
@@ -322,40 +265,38 @@ var IsobarRasterToVector = /** @class */ (function () {
322
265
  if (this._isLabelsOn)
323
266
  this._labelsLayer.setData(labelPoints);
324
267
  return bufferData;
325
- };
326
- IsobarRasterToVector.prototype._createLabelsLayer = function () {
327
- this._labelsLayer = new objectarraylabels_1.default(this._labelsLayerId, this.globe, this._labelStyle);
328
- };
329
- IsobarRasterToVector.prototype.setGeometry = function () {
268
+ }
269
+ _createLabelsLayer() {
270
+ this._labelsLayer = new ObjectArrayLabels(this._labelsLayerId, this.globe, this._labelStyle);
271
+ }
272
+ setGeometry() {
330
273
  this.program.setGeometry();
331
- };
332
- IsobarRasterToVector.prototype.free = function () {
274
+ }
275
+ free() {
333
276
  this.flush();
334
277
  this.program.free();
335
278
  if (this._isLabelsOn)
336
279
  this._labelsLayer.removeFromMap();
337
280
  this.dataManager.unregister(this.id);
338
- };
339
- return IsobarRasterToVector;
340
- }());
341
- exports.IsobarRasterToVector = IsobarRasterToVector;
342
- var getTransformationMethod = function (xFlip, yFlip, width, height, minX, minY, maxX, maxY) {
343
- var _a = (0, quadtreecontours_1.scaleParameters)(minX, minY, maxX, maxY, width, height), scaleX = _a.scaleX, scaleY = _a.scaleY;
281
+ }
282
+ }
283
+ const getTransformationMethod = (xFlip, yFlip, width, height, minX, minY, maxX, maxY) => {
284
+ const { scaleX, scaleY } = scaleParameters(minX, minY, maxX, maxY, width, height);
344
285
  if (xFlip && yFlip)
345
- return function (x, y) { return [maxX - x * scaleX, maxY - y * scaleY]; };
286
+ return (x, y) => [maxX - x * scaleX, maxY - y * scaleY];
346
287
  if (xFlip && !yFlip)
347
- return function (x, y) { return [maxX - x * scaleX, minY + y * scaleY]; };
288
+ return (x, y) => [maxX - x * scaleX, minY + y * scaleY];
348
289
  if (!xFlip && yFlip)
349
- return function (x, y) { return [minX + x * scaleX, maxY - y * scaleY]; };
350
- return function (x, y) { return [minX + x * scaleX, minY + y * scaleY]; };
290
+ return (x, y) => [minX + x * scaleX, maxY - y * scaleY];
291
+ return (x, y) => [minX + x * scaleX, minY + y * scaleY];
351
292
  };
352
293
  function dataMixer(data1, data2, ratio) {
353
294
  if (!data1 || !data2)
354
295
  return null;
355
296
  if (data1.length !== data2.length)
356
297
  throw new Error("Data length mismatch");
357
- var data = new Float32Array(data1.length);
358
- for (var i = 0; i < data1.length; i++) {
298
+ const data = new Float32Array(data1.length);
299
+ for (let i = 0; i < data1.length; i++) {
359
300
  data[i] = data1[i] * (1 - ratio) + data2[i] * ratio;
360
301
  }
361
302
  return data;