@pirireis/webglobeplugins 0.9.11 → 0.9.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Math/angle-calculation.js +8 -8
- package/Math/arc.js +18 -18
- package/Math/bounds/line-bbox.js +78 -80
- package/Math/constants.js +3 -3
- package/Math/juction/arc-plane.js +23 -23
- package/Math/juction/line-sphere.js +11 -11
- package/Math/juction/plane-plane.js +11 -11
- package/Math/line.js +14 -16
- package/Math/methods.js +65 -70
- package/Math/plane.js +16 -18
- package/Math/quaternion.js +45 -49
- package/Math/utils.js +2 -2
- package/Math/vec3.js +42 -45
- package/algorithms/search-binary.js +4 -4
- package/altitude-locator/draw-subset-obj.js +7 -8
- package/altitude-locator/plugin.js +98 -114
- package/arrowfield/adaptor.js +3 -4
- package/arrowfield/index.js +2 -2
- package/arrowfield/plugin.js +62 -65
- package/bearing-line/index.js +1 -1
- package/bearing-line/plugin.js +200 -226
- package/circle-line-chain/chain-list-map.js +82 -88
- package/circle-line-chain/plugin.js +134 -165
- package/circle-line-chain/util.js +1 -1
- package/compass-rose/compass-rose-padding-flat.js +108 -133
- package/compass-rose/compass-text-writer.js +62 -70
- package/compass-rose/index.js +2 -2
- package/compassrose/compassrose.js +46 -50
- package/compassrose/index.js +1 -1
- package/heatwave/index.js +2 -2
- package/heatwave/isobar/objectarraylabels.js +44 -48
- package/heatwave/isobar/plugin.js +104 -123
- package/heatwave/isobar/quadtreecontours.js +76 -92
- package/heatwave/plugins/heatwaveglobeshell.js +69 -87
- package/index.js +11 -11
- package/package.json +1 -1
- package/partialrings/buffer-manager.js +32 -64
- package/partialrings/index.js +1 -1
- package/partialrings/plugin.js +48 -84
- package/partialrings/program.js +136 -47
- package/pin/pin-object-array.js +83 -86
- package/pin/pin-point-totem.js +21 -22
- package/point-heat-map/adaptors/timetracksplugin-format-to-this.js +10 -10
- package/point-heat-map/plugin-webworker.js +40 -45
- package/point-heat-map/point-to-heat-map-flow.js +40 -42
- package/point-tracks/key-methods.js +1 -1
- package/point-tracks/plugin.js +137 -162
- package/programs/arrowfield/index.js +1 -1
- package/programs/arrowfield/logic.js +170 -62
- package/programs/arrowfield/object.js +33 -35
- package/programs/data2legend/density-to-legend.js +45 -21
- package/programs/data2legend/point-to-density-texture.js +52 -27
- package/programs/float2legendwithratio/index.js +1 -1
- package/programs/float2legendwithratio/logic.js +88 -42
- package/programs/float2legendwithratio/object.js +43 -46
- package/programs/globe-util/is-globe-moved.js +10 -11
- package/programs/globeshell/index.js +1 -1
- package/programs/globeshell/wiggle/index.js +1 -1
- package/programs/globeshell/wiggle/logic.js +191 -98
- package/programs/globeshell/wiggle/object.js +33 -35
- package/programs/helpers/blender/program.js +36 -19
- package/programs/helpers/fadeaway/index.js +1 -1
- package/programs/helpers/fadeaway/logic.js +35 -13
- package/programs/helpers/fadeaway/object.js +9 -10
- package/programs/helpers/index.js +1 -1
- package/programs/index.js +8 -8
- package/programs/line-on-globe/angled-line.js +91 -32
- package/programs/line-on-globe/circle-accurate-3d.js +82 -32
- package/programs/line-on-globe/circle-accurate-flat.js +108 -50
- package/programs/line-on-globe/circle-accurate.js +103 -33
- package/programs/line-on-globe/circle.js +97 -32
- package/programs/line-on-globe/degree-padding-around-circle-3d.js +83 -33
- package/programs/line-on-globe/lines-color-instanced-flat.js +79 -34
- package/programs/line-on-globe/linestrip.js +111 -45
- package/programs/line-on-globe/naive-accurate-flexible.js +120 -50
- package/programs/line-on-globe/to-the-surface.js +58 -29
- package/programs/line-on-globe/util.js +1 -1
- package/programs/picking/pickable-renderer.js +117 -33
- package/programs/point-on-globe/element-globe-surface-glow.js +78 -38
- package/programs/point-on-globe/element-point-glow.js +103 -35
- package/programs/point-on-globe/square-pixel-point.js +76 -27
- package/programs/programcache.js +13 -13
- package/programs/rings/distancering/circleflatprogram.js +63 -21
- package/programs/rings/distancering/circlepaddingfreeangleprogram.js +156 -145
- package/programs/rings/distancering/circlepaddysharedbuffer.js +121 -197
- package/programs/rings/distancering/index.js +4 -4
- package/programs/rings/distancering/paddyflatprogram.js +73 -20
- package/programs/rings/distancering/paddyflatprogram2d.js +75 -22
- package/programs/rings/distancering/paddyflatprogram3d.js +73 -20
- package/programs/rings/partial-ring/piece-of-pie.js +137 -35
- package/programs/totems/camerauniformblock.js +64 -51
- package/programs/totems/canvas-webglobe-info.js +48 -40
- package/programs/totems/gpu-selection-uniform-block.js +44 -40
- package/programs/totems/index.js +1 -1
- package/programs/two-d/pixel-padding-for-compass.js +90 -29
- package/programs/util.js +6 -7
- package/programs/vectorfields/index.js +1 -1
- package/programs/vectorfields/logics/drawrectangleparticles.js +70 -29
- package/programs/vectorfields/logics/index.js +3 -3
- package/programs/vectorfields/logics/pixelbased.js +91 -35
- package/programs/vectorfields/logics/ubo.js +31 -25
- package/programs/vectorfields/pingpongbuffermanager.js +30 -34
- package/rangerings/index.js +4 -4
- package/rangerings/plugin.js +202 -258
- package/rangerings/rangeringangletext.js +108 -120
- package/rangerings/ring-account.js +52 -69
- package/shaders/fragment-toy/firework.js +55 -1
- package/shaders/fragment-toy/singularity.js +55 -1
- package/timetracks/adaptors-line-strip.js +26 -37
- package/timetracks/adaptors.js +47 -61
- package/timetracks/index.js +4 -4
- package/timetracks/plugin-line-strip.js +63 -71
- package/timetracks/plugin.js +69 -77
- package/timetracks/program-line-strip.js +296 -103
- package/timetracks/program.js +419 -113
- package/timetracks/programpoint-line-strip.js +97 -44
- package/timetracks/programpoint.js +90 -44
- package/util/account/bufferoffsetmanager.js +72 -95
- package/util/account/index.js +1 -1
- package/util/account/single-attribute-buffer-management/buffer-manager.js +44 -44
- package/util/account/single-attribute-buffer-management/buffer-orchestrator.js +68 -94
- package/util/account/single-attribute-buffer-management/index.js +3 -3
- package/util/account/single-attribute-buffer-management/object-store.js +29 -30
- package/util/account/util.js +2 -4
- package/util/algorithms/search-binary.js +4 -4
- package/util/check/get.js +5 -5
- package/util/check/typecheck.js +13 -15
- package/util/geometry/index.js +9 -11
- package/util/gl-util/buffer/attribute-loader.js +8 -20
- package/util/gl-util/buffer/index.js +1 -1
- package/util/gl-util/draw-options/methods.js +8 -9
- package/util/gl-util/uniform-block/manager.js +67 -67
- package/util/heatwavedatamanager/datamanager.js +56 -116
- package/util/heatwavedatamanager/index.js +2 -2
- package/util/heatwavedatamanager/pointcoordinatesdatacalculator.js +37 -40
- package/util/heatwavedatamanager/pointcoordsmeta.js +9 -10
- package/util/index.js +6 -6
- package/util/interpolation/timetrack/index.js +1 -1
- package/util/interpolation/timetrack/timetrack-interpolator.js +27 -29
- package/util/interpolation/timetrack/web-worker-str.js +179 -1
- package/util/interpolation/timetrack/web-worker.js +4 -4
- package/util/jshelpers/data-filler.js +7 -7
- package/util/jshelpers/timefilters.js +7 -7
- package/util/picking/fence.js +7 -7
- package/util/picking/picker-displayer.js +46 -52
- package/util/programs/draw-texture-on-canvas.js +39 -21
- package/util/programs/shapesonglobe.js +104 -64
- package/util/programs/supersampletotextures.js +45 -39
- package/util/programs/texturetoglobe.js +98 -48
- package/util/shaderfunctions/geometrytransformations.js +322 -27
- package/util/shaderfunctions/nodata.js +7 -1
- package/util/shaderfunctions/noisefunctions.js +39 -9
- package/util/surface-line-data/arcs-to-cuts.js +20 -23
- package/util/webglobe/rasteroverlay.js +35 -37
- package/util/webglobjectbuilders.js +55 -60
- package/util/webglobjectbuilders1.js +48 -49
- package/waveparticles/adaptor.js +6 -7
- package/waveparticles/index.js +2 -2
- package/waveparticles/plugin.js +79 -84
- package/wind/imagetovectorfieldandmagnitude.js +15 -15
- package/wind/index.js +4 -4
- package/wind/plugin.js +453 -251
- package/wind/vectorfieldimage.js +5 -5
- package/write-text/attached-text-writer.js +46 -48
- package/write-text/context-text.js +51 -58
- package/write-text/context-text3.js +69 -74
|
@@ -37,11 +37,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.IsobarRasterToVector = void 0;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
40
|
+
const util_1 = require("../../util");
|
|
41
|
+
const quadtreecontours_1 = __importStar(require("./quadtreecontours"));
|
|
42
|
+
const objectarraylabels_1 = __importDefault(require("./objectarraylabels"));
|
|
43
|
+
const typecheck_1 = require("../../util/check/typecheck");
|
|
44
|
+
class IsobarRasterToVector {
|
|
45
45
|
/**
|
|
46
46
|
* @typedef {Object} IsobarData
|
|
47
47
|
* @property {number} threshold
|
|
@@ -59,9 +59,7 @@ var IsobarRasterToVector = /** @class */ (function () {
|
|
|
59
59
|
* @param {boolean} options.isLabelsOn
|
|
60
60
|
* @param {Object} options.labelStyle
|
|
61
61
|
*/
|
|
62
|
-
|
|
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;
|
|
62
|
+
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
63
|
this.id = id;
|
|
66
64
|
this._isobarsCheckAndComplete(isobars);
|
|
67
65
|
this.isobars = isobars;
|
|
@@ -84,8 +82,7 @@ var IsobarRasterToVector = /** @class */ (function () {
|
|
|
84
82
|
// this._transformationMethod = null;
|
|
85
83
|
}
|
|
86
84
|
// API
|
|
87
|
-
|
|
88
|
-
if (on === void 0) { on = false; }
|
|
85
|
+
setData(data, on = false) {
|
|
89
86
|
if (!data)
|
|
90
87
|
return;
|
|
91
88
|
this._data = data;
|
|
@@ -93,42 +90,41 @@ var IsobarRasterToVector = /** @class */ (function () {
|
|
|
93
90
|
this._isOn = true;
|
|
94
91
|
if (this._isOn)
|
|
95
92
|
this._calculateAll(data);
|
|
96
|
-
}
|
|
97
|
-
|
|
93
|
+
}
|
|
94
|
+
on() {
|
|
98
95
|
this._isOn = true;
|
|
99
96
|
if (this._data)
|
|
100
97
|
this._calculateAll(this._data);
|
|
101
|
-
}
|
|
102
|
-
|
|
98
|
+
}
|
|
99
|
+
off() {
|
|
103
100
|
this._isOn = false;
|
|
104
101
|
this.clean();
|
|
105
|
-
}
|
|
106
|
-
|
|
102
|
+
}
|
|
103
|
+
clean() {
|
|
107
104
|
this.flush();
|
|
108
105
|
this.globe.DrawRender();
|
|
109
|
-
}
|
|
110
|
-
|
|
106
|
+
}
|
|
107
|
+
setFlip(xFlip, yFlip) {
|
|
111
108
|
(0, typecheck_1.isBoolean)(xFlip);
|
|
112
109
|
(0, typecheck_1.isBoolean)(yFlip);
|
|
113
110
|
if (this.xFlip === xFlip && this.yFlip === yFlip)
|
|
114
111
|
return;
|
|
115
112
|
this.xFlip = xFlip;
|
|
116
113
|
this.yFlip = yFlip;
|
|
117
|
-
|
|
118
|
-
|
|
114
|
+
const [minLon, minLat, maxLon, maxLat] = this.bbox;
|
|
115
|
+
const { width, height } = this;
|
|
119
116
|
this._transformationMethod = getTransformationMethod(xFlip, yFlip, width, height, minLon, minLat, maxLon, maxLat);
|
|
120
117
|
this._calculateLines();
|
|
121
118
|
this.globe.DrawRender();
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
var minLon = _a[0], minLat = _a[1], maxLon = _a[2], maxLat = _a[3];
|
|
119
|
+
}
|
|
120
|
+
setBoundingBox([minLon, minLat, maxLon, maxLat]) {
|
|
125
121
|
this.bbox = [minLon, minLat, maxLon, maxLat];
|
|
126
|
-
|
|
122
|
+
const { width, height, xFlip, yFlip } = this;
|
|
127
123
|
this._transformationMethod = getTransformationMethod(xFlip, yFlip, width, height, minLon, minLat, maxLon, maxLat);
|
|
128
124
|
this._calculateLines();
|
|
129
125
|
this.globe.DrawRender();
|
|
130
|
-
}
|
|
131
|
-
|
|
126
|
+
}
|
|
127
|
+
setIsLabelsOn(isLabelsOn) {
|
|
132
128
|
(0, typecheck_1.isBoolean)(isLabelsOn);
|
|
133
129
|
if (this._isLabelsOn === isLabelsOn)
|
|
134
130
|
return;
|
|
@@ -142,58 +138,56 @@ var IsobarRasterToVector = /** @class */ (function () {
|
|
|
142
138
|
this._labelsLayer.addToMap();
|
|
143
139
|
this._createBufferData();
|
|
144
140
|
}
|
|
145
|
-
}
|
|
146
|
-
|
|
141
|
+
}
|
|
142
|
+
getIsobars() {
|
|
147
143
|
return this.isobars;
|
|
148
|
-
}
|
|
149
|
-
|
|
144
|
+
}
|
|
145
|
+
setIsobars(isobars) {
|
|
150
146
|
this._isobarsCheckAndComplete(isobars);
|
|
151
147
|
this.isobars = isobars;
|
|
152
148
|
this._calculateLines();
|
|
153
149
|
this.globe.DrawRender();
|
|
154
|
-
}
|
|
155
|
-
|
|
150
|
+
}
|
|
151
|
+
setWidthHeight(width, height) {
|
|
156
152
|
this.width = width;
|
|
157
153
|
this.height = height;
|
|
158
|
-
|
|
159
|
-
|
|
154
|
+
const { xFlip, yFlip } = this;
|
|
155
|
+
const [minLon, minLat, maxLon, maxLat] = this.bbox;
|
|
160
156
|
this._transformationMethod = getTransformationMethod(xFlip, yFlip, width, height, minLon, minLat, maxLon, maxLat);
|
|
161
157
|
this._calculateLines();
|
|
162
158
|
this.globe.DrawRender();
|
|
163
|
-
}
|
|
164
|
-
|
|
159
|
+
}
|
|
160
|
+
getLabelStyle() {
|
|
165
161
|
return this._labelsLayer.getLabelStyle();
|
|
166
|
-
}
|
|
167
|
-
|
|
162
|
+
}
|
|
163
|
+
setOpacity(opacity) {
|
|
168
164
|
(0, typecheck_1.opacityCheck)(opacity);
|
|
169
165
|
this.program.setOpacity(opacity);
|
|
170
|
-
}
|
|
171
|
-
|
|
166
|
+
}
|
|
167
|
+
setLabelStyle(style) {
|
|
172
168
|
this._labelStyle = style;
|
|
173
169
|
if (this._labelsLayer)
|
|
174
170
|
this._labelsLayer.setLabelStyle(style);
|
|
175
|
-
|
|
171
|
+
const lastState = this._isLabelsOn;
|
|
176
172
|
this.setIsLabelsOn(false);
|
|
177
173
|
this.setIsLabelsOn(lastState);
|
|
178
174
|
if (lastState)
|
|
179
175
|
this._createBufferData();
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
if (maxMipmapLevel === void 0) { maxMipmapLevel = null; }
|
|
176
|
+
}
|
|
177
|
+
setMaxMipmapLevel(maxMipmapLevel = null) {
|
|
183
178
|
this._maxMipmapLevel = maxMipmapLevel;
|
|
184
179
|
this._calculateLines();
|
|
185
180
|
this.globe.DrawRender();
|
|
186
|
-
}
|
|
187
|
-
|
|
181
|
+
}
|
|
182
|
+
flush() {
|
|
188
183
|
this.program.setBufferData(new Float32Array(0));
|
|
189
184
|
this._lineStrignRanges = [];
|
|
190
185
|
if (this._isLabelsOn)
|
|
191
186
|
this._labelsLayer.flush();
|
|
192
|
-
}
|
|
187
|
+
}
|
|
193
188
|
//
|
|
194
189
|
// implicit methods
|
|
195
|
-
|
|
196
|
-
var _this = this;
|
|
190
|
+
init(globe, gl) {
|
|
197
191
|
this.gl = gl;
|
|
198
192
|
this.globe = globe;
|
|
199
193
|
this.program = new util_1.ShapesOnGlobeProgram(gl, globe, 'line_strip');
|
|
@@ -201,67 +195,62 @@ var IsobarRasterToVector = /** @class */ (function () {
|
|
|
201
195
|
this._createLabelsLayer();
|
|
202
196
|
this._labelsLayer.addToMap();
|
|
203
197
|
}
|
|
204
|
-
this.dataManager.register(this.id,
|
|
198
|
+
this.dataManager.register(this.id, (ratio, t1, t2) => {
|
|
205
199
|
if (!t1 || !t2) {
|
|
206
|
-
|
|
200
|
+
this.clean();
|
|
207
201
|
return;
|
|
208
202
|
}
|
|
209
|
-
|
|
210
|
-
if (
|
|
211
|
-
|
|
203
|
+
const data = dataMixer(t1, t2, ratio);
|
|
204
|
+
if (this._isOn)
|
|
205
|
+
this.setData(data);
|
|
212
206
|
});
|
|
213
|
-
}
|
|
214
|
-
|
|
207
|
+
}
|
|
208
|
+
resize(width, height) {
|
|
215
209
|
this.program.resize(width, height);
|
|
216
|
-
}
|
|
217
|
-
|
|
210
|
+
}
|
|
211
|
+
draw3D(projMatrix, modelviewMatrix, transPos) {
|
|
218
212
|
if (!this._ready)
|
|
219
213
|
return;
|
|
220
214
|
this._drawContour(projMatrix, modelviewMatrix, transPos);
|
|
221
|
-
}
|
|
222
|
-
|
|
215
|
+
}
|
|
216
|
+
_calculateLines() {
|
|
223
217
|
this._calculateContours();
|
|
224
218
|
this._bufferData = this._createBufferData();
|
|
225
219
|
this.program.setBufferData(this._bufferData);
|
|
226
|
-
}
|
|
227
|
-
|
|
220
|
+
}
|
|
221
|
+
_drawContour(projMatrix, modelviewMatrix, transPos) {
|
|
228
222
|
this.program.draw(projMatrix, modelviewMatrix, transPos, this._lineStrignRanges);
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
return coords.map(
|
|
234
|
-
var x = _a[0], y = _a[1];
|
|
235
|
-
return _transformationMethod(x, y);
|
|
236
|
-
});
|
|
223
|
+
}
|
|
224
|
+
_calculateIntersections(threshold) {
|
|
225
|
+
const { _transformationMethod } = this;
|
|
226
|
+
const lines = this.contourMipmap.contour([threshold], { maxMipmapLevel: this._maxMipmapLevel }).map(coords => {
|
|
227
|
+
return coords.map(([x, y]) => _transformationMethod(x, y));
|
|
237
228
|
});
|
|
238
229
|
return lines;
|
|
239
|
-
}
|
|
240
|
-
|
|
230
|
+
}
|
|
231
|
+
_calculateAll(data) {
|
|
241
232
|
this.contourMipmap = new quadtreecontours_1.default(data, this.width, this.height);
|
|
242
233
|
this._calculateContours();
|
|
243
234
|
this._bufferData = this._createBufferData();
|
|
244
235
|
this.program.setBufferData(this._bufferData);
|
|
245
236
|
this.globe.DrawRender();
|
|
246
237
|
this._ready = true;
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
for (
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
var lines = this._calculateIntersections(threshold);
|
|
238
|
+
}
|
|
239
|
+
_calculateContours() {
|
|
240
|
+
const { isobars } = this;
|
|
241
|
+
for (const isobar of isobars) {
|
|
242
|
+
const { threshold } = isobar;
|
|
243
|
+
const lines = this._calculateIntersections(threshold);
|
|
254
244
|
isobar.lines = lines;
|
|
255
245
|
}
|
|
256
|
-
}
|
|
257
|
-
|
|
246
|
+
}
|
|
247
|
+
_isobarsCheckAndComplete(isobars) {
|
|
258
248
|
window.isobars = isobars;
|
|
259
249
|
if (!Array.isArray(isobars))
|
|
260
250
|
throw new Error("isobars must be an array");
|
|
261
251
|
if (isobars.length === 0)
|
|
262
252
|
throw new Error("isobars must contain at least one element");
|
|
263
|
-
for (
|
|
264
|
-
var isobar = isobars_2[_i];
|
|
253
|
+
for (const isobar of isobars) {
|
|
265
254
|
if (!isobar || typeof isobar !== 'object')
|
|
266
255
|
throw new Error("isobar must be an object");
|
|
267
256
|
if (typeof isobar.threshold !== 'number')
|
|
@@ -269,8 +258,7 @@ var IsobarRasterToVector = /** @class */ (function () {
|
|
|
269
258
|
if (isobar.color) {
|
|
270
259
|
if (!Array.isArray(isobar.color) || isobar.color.length !== 3)
|
|
271
260
|
throw new Error("isobar.color must be an array with 3 elements");
|
|
272
|
-
for (
|
|
273
|
-
var color = _b[_a];
|
|
261
|
+
for (const color of isobar.color) {
|
|
274
262
|
if (color < 0 || color > 1)
|
|
275
263
|
throw new Error("isobar.color elements must be between 0 and 1");
|
|
276
264
|
}
|
|
@@ -278,33 +266,27 @@ var IsobarRasterToVector = /** @class */ (function () {
|
|
|
278
266
|
if (!isobar.color)
|
|
279
267
|
isobar.color = [1, 1, 1];
|
|
280
268
|
}
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
var bufferData = new Float32Array(pointCount * 6);
|
|
289
|
-
var index = 0;
|
|
290
|
-
var pointCounter = 0;
|
|
269
|
+
}
|
|
270
|
+
_createBufferData() {
|
|
271
|
+
const { isobars } = this;
|
|
272
|
+
const pointCount = isobars.reduce((acc, { lines }) => acc + lines.reduce((acc, line) => acc + line.length, 0), 0);
|
|
273
|
+
const bufferData = new Float32Array(pointCount * 6);
|
|
274
|
+
let index = 0;
|
|
275
|
+
let pointCounter = 0;
|
|
291
276
|
this._lineStrignRanges = [];
|
|
292
277
|
// gather label data label
|
|
293
|
-
|
|
278
|
+
const labelPoints = {
|
|
294
279
|
coords: [],
|
|
295
280
|
coordsZ: [],
|
|
296
281
|
attribs: []
|
|
297
282
|
};
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
for (
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
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);
|
|
283
|
+
const { coords, coordsZ, attribs } = labelPoints;
|
|
284
|
+
let fidCounter = 0;
|
|
285
|
+
for (const { lines, color, threshold } of isobars) {
|
|
286
|
+
for (const line of lines) {
|
|
287
|
+
let startIndex = pointCounter;
|
|
288
|
+
for (const [x, y] of line) {
|
|
289
|
+
const pixXY = (0, util_1.latLongToPixelXY)(y, x);
|
|
308
290
|
bufferData[index++] = pixXY.x;
|
|
309
291
|
bufferData[index++] = pixXY.y;
|
|
310
292
|
bufferData[index++] = color[0];
|
|
@@ -322,40 +304,39 @@ var IsobarRasterToVector = /** @class */ (function () {
|
|
|
322
304
|
if (this._isLabelsOn)
|
|
323
305
|
this._labelsLayer.setData(labelPoints);
|
|
324
306
|
return bufferData;
|
|
325
|
-
}
|
|
326
|
-
|
|
307
|
+
}
|
|
308
|
+
_createLabelsLayer() {
|
|
327
309
|
this._labelsLayer = new objectarraylabels_1.default(this._labelsLayerId, this.globe, this._labelStyle);
|
|
328
|
-
}
|
|
329
|
-
|
|
310
|
+
}
|
|
311
|
+
setGeometry() {
|
|
330
312
|
this.program.setGeometry();
|
|
331
|
-
}
|
|
332
|
-
|
|
313
|
+
}
|
|
314
|
+
free() {
|
|
333
315
|
this.flush();
|
|
334
316
|
this.program.free();
|
|
335
317
|
if (this._isLabelsOn)
|
|
336
318
|
this._labelsLayer.removeFromMap();
|
|
337
319
|
this.dataManager.unregister(this.id);
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
}());
|
|
320
|
+
}
|
|
321
|
+
}
|
|
341
322
|
exports.IsobarRasterToVector = IsobarRasterToVector;
|
|
342
|
-
|
|
343
|
-
|
|
323
|
+
const getTransformationMethod = (xFlip, yFlip, width, height, minX, minY, maxX, maxY) => {
|
|
324
|
+
const { scaleX, scaleY } = (0, quadtreecontours_1.scaleParameters)(minX, minY, maxX, maxY, width, height);
|
|
344
325
|
if (xFlip && yFlip)
|
|
345
|
-
return
|
|
326
|
+
return (x, y) => [maxX - x * scaleX, maxY - y * scaleY];
|
|
346
327
|
if (xFlip && !yFlip)
|
|
347
|
-
return
|
|
328
|
+
return (x, y) => [maxX - x * scaleX, minY + y * scaleY];
|
|
348
329
|
if (!xFlip && yFlip)
|
|
349
|
-
return
|
|
350
|
-
return
|
|
330
|
+
return (x, y) => [minX + x * scaleX, maxY - y * scaleY];
|
|
331
|
+
return (x, y) => [minX + x * scaleX, minY + y * scaleY];
|
|
351
332
|
};
|
|
352
333
|
function dataMixer(data1, data2, ratio) {
|
|
353
334
|
if (!data1 || !data2)
|
|
354
335
|
return null;
|
|
355
336
|
if (data1.length !== data2.length)
|
|
356
337
|
throw new Error("Data length mismatch");
|
|
357
|
-
|
|
358
|
-
for (
|
|
338
|
+
const data = new Float32Array(data1.length);
|
|
339
|
+
for (let i = 0; i < data1.length; i++) {
|
|
359
340
|
data[i] = data1[i] * (1 - ratio) + data2[i] * ratio;
|
|
360
341
|
}
|
|
361
342
|
return data;
|