@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.
- package/Math/angle-calculation.js +9 -11
- package/Math/arc.js +38 -41
- package/Math/bounds/line-bbox.js +79 -83
- package/Math/constants.js +4 -9
- package/Math/frustum/types.js +1 -2
- package/Math/juction/arc-plane.js +33 -36
- package/Math/juction/line-sphere.js +15 -18
- package/Math/juction/plane-plane.js +20 -23
- package/Math/line.js +42 -47
- package/Math/methods.js +69 -92
- package/Math/plane.js +33 -38
- package/Math/quaternion.js +48 -55
- package/Math/types.js +1 -2
- package/Math/utils.js +2 -4
- package/Math/vec3.js +46 -52
- package/algorithms/search-binary.js +5 -8
- package/altitude-locator/draw-subset-obj.js +8 -11
- package/altitude-locator/plugin.js +114 -133
- package/altitude-locator/types.js +1 -3
- package/arrowfield/adaptor.js +3 -7
- package/arrowfield/index.js +3 -10
- package/arrowfield/plugin.js +63 -69
- package/bearing-line/index.js +2 -8
- package/bearing-line/plugin.js +218 -248
- package/circle-line-chain/chain-list-map.js +82 -92
- package/circle-line-chain/plugin.js +147 -182
- package/circle-line-chain/util.js +1 -5
- package/compass-rose/compass-rose-padding-flat.js +111 -140
- package/compass-rose/compass-text-writer.js +63 -75
- package/compass-rose/index.js +3 -7
- package/compassrose/compassrose.js +50 -57
- package/compassrose/index.js +2 -8
- package/heatwave/index.js +3 -10
- package/heatwave/isobar/objectarraylabels.js +50 -56
- package/heatwave/isobar/plugin.js +111 -170
- package/heatwave/isobar/quadtreecontours.js +78 -96
- package/heatwave/plugins/heatwaveglobeshell.js +73 -94
- package/index.js +12 -58
- package/package.json +1 -1
- package/partialrings/buffer-manager.js +32 -70
- package/partialrings/index.js +2 -41
- package/partialrings/plugin.js +55 -98
- package/partialrings/program.js +141 -59
- package/pin/pin-object-array.js +89 -97
- package/pin/pin-point-totem.js +21 -22
- package/point-heat-map/adaptors/timetracksplugin-format-to-this.js +11 -14
- package/point-heat-map/plugin-webworker.js +45 -53
- package/point-heat-map/point-to-heat-map-flow.js +46 -51
- package/point-tracks/key-methods.js +2 -5
- package/point-tracks/plugin.js +141 -170
- package/programs/arrowfield/index.js +2 -7
- package/programs/arrowfield/logic.js +172 -67
- package/programs/arrowfield/object.js +35 -43
- package/programs/data2legend/density-to-legend.js +47 -26
- package/programs/data2legend/point-to-density-texture.js +56 -34
- package/programs/float2legendwithratio/index.js +2 -8
- package/programs/float2legendwithratio/logic.js +88 -45
- package/programs/float2legendwithratio/object.js +45 -54
- package/programs/globe-util/is-globe-moved.js +10 -13
- package/programs/globeshell/index.js +2 -8
- package/programs/globeshell/wiggle/index.js +2 -8
- package/programs/globeshell/wiggle/logic.js +191 -101
- package/programs/globeshell/wiggle/object.js +35 -43
- package/programs/helpers/blender/program.js +36 -22
- package/programs/helpers/fadeaway/index.js +2 -7
- package/programs/helpers/fadeaway/logic.js +36 -17
- package/programs/helpers/fadeaway/object.js +11 -18
- package/programs/helpers/index.js +2 -8
- package/programs/index.js +9 -58
- package/programs/line-on-globe/angled-line.js +95 -39
- package/programs/line-on-globe/circle-accurate-3d.js +86 -39
- package/programs/line-on-globe/circle-accurate-flat.js +116 -64
- package/programs/line-on-globe/circle-accurate.js +113 -46
- package/programs/line-on-globe/circle.js +106 -44
- package/programs/line-on-globe/degree-padding-around-circle-3d.js +89 -42
- package/programs/line-on-globe/lines-color-instanced-flat.js +84 -43
- package/programs/line-on-globe/linestrip.js +126 -63
- package/programs/line-on-globe/naive-accurate-flexible.js +126 -59
- package/programs/line-on-globe/to-the-surface.js +62 -35
- package/programs/line-on-globe/util.js +2 -5
- package/programs/picking/pickable-renderer.js +127 -46
- package/programs/point-on-globe/element-globe-surface-glow.js +83 -46
- package/programs/point-on-globe/element-point-glow.js +112 -47
- package/programs/point-on-globe/square-pixel-point.js +80 -34
- package/programs/programcache.js +14 -19
- package/programs/rings/distancering/circleflatprogram.js +76 -70
- package/programs/rings/distancering/circlepaddingfreeangleprogram.js +168 -194
- package/programs/rings/distancering/circlepaddysharedbuffer.js +121 -200
- package/programs/rings/distancering/index.js +5 -14
- package/programs/rings/distancering/paddyflatprogram.js +87 -70
- package/programs/rings/distancering/paddyflatprogram2d.js +89 -72
- package/programs/rings/distancering/paddyflatprogram3d.js +87 -70
- package/programs/rings/index.js +1 -17
- package/programs/rings/partial-ring/piece-of-pie.js +144 -44
- package/programs/totems/camerauniformblock.js +65 -56
- package/programs/totems/canvas-webglobe-info.js +49 -45
- package/programs/totems/gpu-selection-uniform-block.js +45 -45
- package/programs/totems/index.js +2 -40
- package/programs/two-d/pixel-padding-for-compass.js +94 -36
- package/programs/util.js +7 -10
- package/programs/vectorfields/index.js +3 -23
- package/programs/vectorfields/logics/drawrectangleparticles.js +73 -35
- package/programs/vectorfields/logics/index.js +4 -12
- package/programs/vectorfields/logics/pixelbased.js +94 -41
- package/programs/vectorfields/logics/ubo.js +32 -32
- package/programs/vectorfields/pingpongbuffermanager.js +30 -37
- package/rangerings/enum.js +2 -5
- package/rangerings/index.js +5 -15
- package/rangerings/plugin.js +223 -286
- package/rangerings/rangeringangletext.js +122 -137
- package/rangerings/ring-account.js +53 -75
- package/shaders/fragment-toy/firework.js +55 -4
- package/shaders/fragment-toy/singularity.js +56 -5
- package/timetracks/adaptors-line-strip.js +27 -44
- package/timetracks/adaptors.js +48 -67
- package/timetracks/index.js +5 -19
- package/timetracks/plugin-line-strip.js +65 -79
- package/timetracks/plugin.js +71 -85
- package/timetracks/program-line-strip.js +297 -107
- package/timetracks/program.js +421 -118
- package/timetracks/programpoint-line-strip.js +98 -48
- package/timetracks/programpoint.js +91 -48
- package/util/account/bufferoffsetmanager.js +72 -98
- package/util/account/index.js +3 -23
- package/util/account/single-attribute-buffer-management/buffer-manager.js +44 -48
- package/util/account/single-attribute-buffer-management/buffer-orchestrator.js +68 -98
- package/util/account/single-attribute-buffer-management/index.js +4 -9
- package/util/account/single-attribute-buffer-management/object-store.js +29 -34
- package/util/account/single-attribute-buffer-management/types.js +1 -2
- package/util/account/util.js +2 -8
- package/util/algorithms/search-binary.js +5 -8
- package/util/check/get.js +5 -9
- package/util/check/typecheck.js +13 -24
- package/util/geometry/index.js +10 -18
- package/util/gl-util/buffer/attribute-loader.js +10 -26
- package/util/gl-util/buffer/index.js +2 -5
- package/util/gl-util/draw-options/methods.js +10 -15
- package/util/gl-util/uniform-block/manager.js +69 -72
- package/util/heatwavedatamanager/datamanager.js +56 -119
- package/util/heatwavedatamanager/index.js +3 -10
- package/util/heatwavedatamanager/pointcoordinatesdatacalculator.js +38 -47
- package/util/heatwavedatamanager/pointcoordsmeta.js +9 -13
- package/util/index.js +13 -57
- package/util/interpolation/timetrack/index.js +2 -5
- package/util/interpolation/timetrack/timetrack-interpolator.js +30 -36
- package/util/interpolation/timetrack/web-worker-str.js +180 -5
- package/util/interpolation/timetrack/web-worker.js +4 -6
- package/util/jshelpers/data-filler.js +8 -11
- package/util/jshelpers/equality.js +1 -3
- package/util/jshelpers/index.js +2 -37
- package/util/jshelpers/timefilters.js +8 -10
- package/util/picking/fence.js +8 -11
- package/util/picking/picker-displayer.js +49 -58
- package/util/programs/draw-texture-on-canvas.js +41 -26
- package/util/programs/index.js +1 -17
- package/util/programs/shapesonglobe.js +104 -68
- package/util/programs/supersampletotextures.js +45 -43
- package/util/programs/texturetoglobe.js +99 -52
- package/util/shaderfunctions/geometrytransformations.js +323 -35
- package/util/shaderfunctions/index.js +2 -18
- package/util/shaderfunctions/nodata.js +8 -5
- package/util/shaderfunctions/noisefunctions.js +40 -12
- package/util/surface-line-data/arcs-to-cuts.js +20 -23
- package/util/webglobe/gldefaultstates.js +1 -4
- package/util/webglobe/index.js +2 -18
- package/util/webglobe/rasteroverlay.js +36 -41
- package/util/webglobjectbuilders.js +70 -93
- package/util/webglobjectbuilders1.js +63 -82
- package/waveparticles/adaptor.js +7 -10
- package/waveparticles/index.js +3 -10
- package/waveparticles/plugin.js +82 -90
- package/wind/imagetovectorfieldandmagnitude.js +16 -19
- package/wind/index.js +5 -14
- package/wind/plugin.js +454 -291
- package/wind/vectorfieldimage.js +6 -8
- package/write-text/attached-text-writer.js +48 -54
- package/write-text/context-text.js +52 -63
- package/write-text/context-text3.js +71 -80
- package/write-text/index.js +1 -5
|
@@ -1,47 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
54
|
+
}
|
|
55
|
+
on() {
|
|
98
56
|
this._isOn = true;
|
|
99
57
|
if (this._data)
|
|
100
58
|
this._calculateAll(this._data);
|
|
101
|
-
}
|
|
102
|
-
|
|
59
|
+
}
|
|
60
|
+
off() {
|
|
103
61
|
this._isOn = false;
|
|
104
62
|
this.clean();
|
|
105
|
-
}
|
|
106
|
-
|
|
63
|
+
}
|
|
64
|
+
clean() {
|
|
107
65
|
this.flush();
|
|
108
66
|
this.globe.DrawRender();
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
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
|
-
|
|
118
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
132
|
-
|
|
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
|
-
|
|
102
|
+
}
|
|
103
|
+
getIsobars() {
|
|
147
104
|
return this.isobars;
|
|
148
|
-
}
|
|
149
|
-
|
|
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
|
-
|
|
111
|
+
}
|
|
112
|
+
setWidthHeight(width, height) {
|
|
156
113
|
this.width = width;
|
|
157
114
|
this.height = height;
|
|
158
|
-
|
|
159
|
-
|
|
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
|
-
|
|
120
|
+
}
|
|
121
|
+
getLabelStyle() {
|
|
165
122
|
return this._labelsLayer.getLabelStyle();
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
|
|
123
|
+
}
|
|
124
|
+
setOpacity(opacity) {
|
|
125
|
+
opacityCheck(opacity);
|
|
169
126
|
this.program.setOpacity(opacity);
|
|
170
|
-
}
|
|
171
|
-
|
|
127
|
+
}
|
|
128
|
+
setLabelStyle(style) {
|
|
172
129
|
this._labelStyle = style;
|
|
173
130
|
if (this._labelsLayer)
|
|
174
131
|
this._labelsLayer.setLabelStyle(style);
|
|
175
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
196
|
-
var _this = this;
|
|
151
|
+
init(globe, gl) {
|
|
197
152
|
this.gl = gl;
|
|
198
153
|
this.globe = globe;
|
|
199
|
-
this.program = new
|
|
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,
|
|
159
|
+
this.dataManager.register(this.id, (ratio, t1, t2) => {
|
|
205
160
|
if (!t1 || !t2) {
|
|
206
|
-
|
|
161
|
+
this.clean();
|
|
207
162
|
return;
|
|
208
163
|
}
|
|
209
|
-
|
|
210
|
-
if (
|
|
211
|
-
|
|
164
|
+
const data = dataMixer(t1, t2, ratio);
|
|
165
|
+
if (this._isOn)
|
|
166
|
+
this.setData(data);
|
|
212
167
|
});
|
|
213
|
-
}
|
|
214
|
-
|
|
168
|
+
}
|
|
169
|
+
resize(width, height) {
|
|
215
170
|
this.program.resize(width, height);
|
|
216
|
-
}
|
|
217
|
-
|
|
171
|
+
}
|
|
172
|
+
draw3D(projMatrix, modelviewMatrix, transPos) {
|
|
218
173
|
if (!this._ready)
|
|
219
174
|
return;
|
|
220
175
|
this._drawContour(projMatrix, modelviewMatrix, transPos);
|
|
221
|
-
}
|
|
222
|
-
|
|
176
|
+
}
|
|
177
|
+
_calculateLines() {
|
|
223
178
|
this._calculateContours();
|
|
224
179
|
this._bufferData = this._createBufferData();
|
|
225
180
|
this.program.setBufferData(this._bufferData);
|
|
226
|
-
}
|
|
227
|
-
|
|
181
|
+
}
|
|
182
|
+
_drawContour(projMatrix, modelviewMatrix, transPos) {
|
|
228
183
|
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
|
-
});
|
|
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
|
-
|
|
241
|
-
this.contourMipmap = new
|
|
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
|
-
|
|
249
|
-
|
|
250
|
-
for (
|
|
251
|
-
|
|
252
|
-
|
|
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
|
-
|
|
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 (
|
|
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 (
|
|
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
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
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
|
-
|
|
239
|
+
const labelPoints = {
|
|
294
240
|
coords: [],
|
|
295
241
|
coordsZ: [],
|
|
296
242
|
attribs: []
|
|
297
243
|
};
|
|
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);
|
|
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
|
-
|
|
327
|
-
this._labelsLayer = new
|
|
328
|
-
}
|
|
329
|
-
|
|
268
|
+
}
|
|
269
|
+
_createLabelsLayer() {
|
|
270
|
+
this._labelsLayer = new ObjectArrayLabels(this._labelsLayerId, this.globe, this._labelStyle);
|
|
271
|
+
}
|
|
272
|
+
setGeometry() {
|
|
330
273
|
this.program.setGeometry();
|
|
331
|
-
}
|
|
332
|
-
|
|
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
|
-
|
|
340
|
-
|
|
341
|
-
|
|
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
|
|
286
|
+
return (x, y) => [maxX - x * scaleX, maxY - y * scaleY];
|
|
346
287
|
if (xFlip && !yFlip)
|
|
347
|
-
return
|
|
288
|
+
return (x, y) => [maxX - x * scaleX, minY + y * scaleY];
|
|
348
289
|
if (!xFlip && yFlip)
|
|
349
|
-
return
|
|
350
|
-
return
|
|
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
|
-
|
|
358
|
-
for (
|
|
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;
|