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