@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
|
@@ -1,20 +1,30 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
3
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
4
|
+
if (ar || !(i in from)) {
|
|
5
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
6
|
+
ar[i] = from[i];
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
10
|
+
};
|
|
2
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
12
|
exports.scaleParameters = scaleParameters;
|
|
4
13
|
// © 2019 3D Robotics. License: Apache-2.0
|
|
5
14
|
/* eslint no-plusplus: "off", prefer-rest-params: "off" */
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
15
|
+
var OUTSIDE = 0;
|
|
16
|
+
var ABOVE = 1;
|
|
17
|
+
var BELOW = 2;
|
|
18
|
+
var WITHIN = 3;
|
|
10
19
|
// Build mipmap layer N from layer N+1
|
|
11
|
-
function mipmapReduce(
|
|
12
|
-
|
|
13
|
-
|
|
20
|
+
function mipmapReduce(_a) {
|
|
21
|
+
var min = _a.min, max = _a.max, width = _a.width, height = _a.height, scale = _a.scale;
|
|
22
|
+
var outWidth = Math.ceil(width / 2);
|
|
23
|
+
var outHeight = Math.ceil(height / 2);
|
|
14
24
|
function reduceWith(data, reduce) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
25
|
+
var out = new Float32Array(outWidth * outHeight);
|
|
26
|
+
var x;
|
|
27
|
+
var y;
|
|
18
28
|
for (y = 0; y < Math.floor(height / 2); y++) {
|
|
19
29
|
for (x = 0; x < Math.floor(width / 2); x++) {
|
|
20
30
|
out[y * outWidth + x] = reduce(data[(y * 2 + 0) * width + (x * 2 + 0)], data[(y * 2 + 0) * width + (x * 2 + 1)], data[(y * 2 + 1) * width + (x * 2 + 0)], data[(y * 2 + 1) * width + (x * 2 + 1)]);
|
|
@@ -34,18 +44,18 @@ function mipmapReduce({ min, max, width, height, scale }) {
|
|
|
34
44
|
return out;
|
|
35
45
|
}
|
|
36
46
|
function minFinite() {
|
|
37
|
-
|
|
38
|
-
for (
|
|
39
|
-
|
|
47
|
+
var r = Infinity;
|
|
48
|
+
for (var i = 0; i < arguments.length; i++) { // significantly faster than the code Babel generates for ...args
|
|
49
|
+
var v = arguments[i];
|
|
40
50
|
if (v < r)
|
|
41
51
|
r = v;
|
|
42
52
|
}
|
|
43
53
|
return r;
|
|
44
54
|
}
|
|
45
55
|
function maxFinite() {
|
|
46
|
-
|
|
47
|
-
for (
|
|
48
|
-
|
|
56
|
+
var r = -Infinity;
|
|
57
|
+
for (var i = 0; i < arguments.length; i++) {
|
|
58
|
+
var v = arguments[i];
|
|
49
59
|
if (v > r)
|
|
50
60
|
r = v;
|
|
51
61
|
}
|
|
@@ -59,43 +69,45 @@ function mipmapReduce({ min, max, width, height, scale }) {
|
|
|
59
69
|
scale: scale * 2,
|
|
60
70
|
};
|
|
61
71
|
}
|
|
62
|
-
|
|
63
|
-
|
|
72
|
+
var ContourMipmap = /** @class */ (function () {
|
|
73
|
+
function ContourMipmap(raster, width, height) {
|
|
64
74
|
// Bottom mipmap layer is just the raster: at each pixel the minimum and maximum are the same
|
|
65
|
-
this.levels = [{ min: raster, max: raster, width, height, scale: 1 }];
|
|
75
|
+
this.levels = [{ min: raster, max: raster, width: width, height: height, scale: 1 }];
|
|
66
76
|
while (this.levels[0].width > 1 || this.levels[0].height > 1) {
|
|
67
77
|
this.levels.unshift(mipmapReduce(this.levels[0]));
|
|
68
78
|
}
|
|
69
79
|
}
|
|
70
80
|
// Get the minimum elevation in the mipmap
|
|
71
|
-
min() { return this.levels[0].min[0]; }
|
|
81
|
+
ContourMipmap.prototype.min = function () { return this.levels[0].min[0]; };
|
|
72
82
|
// Get the maximum elevation in the mipmap
|
|
73
|
-
max() { return this.levels[0].max[0]; }
|
|
83
|
+
ContourMipmap.prototype.max = function () { return this.levels[0].max[0]; };
|
|
74
84
|
// Get an array of contour levels for a specified contour interval
|
|
75
|
-
intervals(interval) {
|
|
85
|
+
ContourMipmap.prototype.intervals = function (interval) {
|
|
76
86
|
if (interval <= 0)
|
|
77
87
|
throw new Error('Contour interval must be positive');
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
88
|
+
var min = this.min();
|
|
89
|
+
var max = this.max();
|
|
90
|
+
var levels = [];
|
|
91
|
+
var level = Math.ceil(min / interval) * interval;
|
|
82
92
|
while (level < max) {
|
|
83
93
|
levels.push(level);
|
|
84
94
|
level += interval;
|
|
85
95
|
}
|
|
86
96
|
return levels;
|
|
87
|
-
}
|
|
97
|
+
};
|
|
88
98
|
// Walk the quadtree for a specified contour level, and pass quadtree nodes
|
|
89
99
|
// and contour line segments to the callbacks. This is used for visualizing
|
|
90
100
|
// the quadtree; in most cases you should use .contour() instead, which
|
|
91
101
|
// assembles the line segments into lines and rings.
|
|
92
|
-
evaluateContour(contourLevel,
|
|
102
|
+
ContourMipmap.prototype.evaluateContour = function (contourLevel, _a, addLine, addNode) {
|
|
103
|
+
var _this = this;
|
|
104
|
+
var maxMipmapLevel = _a.maxMipmapLevel;
|
|
93
105
|
maxMipmapLevel = maxMipmapLevel || this.levels.length - 1;
|
|
94
106
|
// Test the mipmap at the given coordinate and level, returning whether the contour line is ABOVE, BELOW, or WITHIN this mipmap cell
|
|
95
107
|
// If the mipmap is out of bounds or NaN at that point, OUTSIDE is returned.
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
108
|
+
var evaluate = function (l, x, y) {
|
|
109
|
+
var ml = _this.levels[l];
|
|
110
|
+
var i = ml.width * y + x;
|
|
99
111
|
if (x >= ml.width || y >= ml.height || !Number.isFinite(ml.min[i]) || !Number.isFinite(ml.max[i]))
|
|
100
112
|
return OUTSIDE;
|
|
101
113
|
if (ml.min[i] >= contourLevel)
|
|
@@ -113,8 +125,8 @@ class ContourMipmap {
|
|
|
113
125
|
// level, it is added directly, otherwise split the edge and recurse at a
|
|
114
126
|
// more detailed mipmap level.
|
|
115
127
|
function edgeH(l, x, y) {
|
|
116
|
-
|
|
117
|
-
|
|
128
|
+
var e1 = evaluate(l, x, y);
|
|
129
|
+
var e2 = evaluate(l, x + 1, y);
|
|
118
130
|
if (e1 === ABOVE && e2 === BELOW) {
|
|
119
131
|
addLine(l, x + 1, y + 1, x + 1, y);
|
|
120
132
|
}
|
|
@@ -131,8 +143,8 @@ class ContourMipmap {
|
|
|
131
143
|
// Like edgeH, but for horizontal contour lines between the passed cell
|
|
132
144
|
// and its vertical neighbor below.
|
|
133
145
|
function edgeV(l, x, y) {
|
|
134
|
-
|
|
135
|
-
|
|
146
|
+
var e1 = evaluate(l, x, y);
|
|
147
|
+
var e2 = evaluate(l, x, y + 1);
|
|
136
148
|
if (e1 === ABOVE && e2 === BELOW) {
|
|
137
149
|
addLine(l, x, y + 1, x + 1, y + 1);
|
|
138
150
|
}
|
|
@@ -148,7 +160,7 @@ class ContourMipmap {
|
|
|
148
160
|
// It recurses into the four quadrants of the cell, and also uses edgeH and
|
|
149
161
|
// edgeV to add the contour lines that exist between quadrants.
|
|
150
162
|
function node(l, x, y) {
|
|
151
|
-
|
|
163
|
+
var e = evaluate(l, x, y);
|
|
152
164
|
if (e === WITHIN) {
|
|
153
165
|
node(l + 1, x * 2 + 0, y * 2 + 0);
|
|
154
166
|
node(l + 1, x * 2 + 1, y * 2 + 0);
|
|
@@ -165,7 +177,7 @@ class ContourMipmap {
|
|
|
165
177
|
}
|
|
166
178
|
}
|
|
167
179
|
node(0, 0, 0);
|
|
168
|
-
}
|
|
180
|
+
};
|
|
169
181
|
// Generate a contour line for a specified value
|
|
170
182
|
//
|
|
171
183
|
// level: Value in the input array at which to draw a contour line
|
|
@@ -179,25 +191,28 @@ class ContourMipmap {
|
|
|
179
191
|
// }
|
|
180
192
|
//
|
|
181
193
|
// Returns an array of lines, where each line is an array of [x, y] pairs.
|
|
182
|
-
contour
|
|
194
|
+
ContourMipmap.prototype.contour = function (level, _a) {
|
|
195
|
+
var _this = this;
|
|
196
|
+
var _b = _a === void 0 ? {} : _a, maxMipmapLevel = _b.maxMipmapLevel, _c = _b.smoothKernelWidth, smoothKernelWidth = _c === void 0 ? 2 : _c, _d = _b.smoothCycles, smoothCycles = _d === void 0 ? 2 : _d, _e = _b.minPoints, minPoints = _e === void 0 ? 0 : _e;
|
|
183
197
|
// Use the quadtree algorithm to generate line segments that make up the contour
|
|
184
|
-
|
|
185
|
-
this.evaluateContour(level, { maxMipmapLevel }, (l, x1, y1, x2, y2)
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
segments.push({ start, end });
|
|
198
|
+
var segments = [];
|
|
199
|
+
this.evaluateContour(level, { maxMipmapLevel: maxMipmapLevel }, function (l, x1, y1, x2, y2) {
|
|
200
|
+
var scale = _this.levels[l].scale;
|
|
201
|
+
var start = [scale * x1, scale * y1];
|
|
202
|
+
var end = [scale * x2, scale * y2];
|
|
203
|
+
segments.push({ start: start, end: end });
|
|
190
204
|
});
|
|
191
|
-
segments.sort((a, b)
|
|
205
|
+
segments.sort(function (a, b) { return key(a.start) - key(b.start); });
|
|
192
206
|
// .. and then join them together into rings
|
|
193
207
|
// An arbitrary function to use a 2D point as a Map key
|
|
194
208
|
function key(a) { return a[0] + a[1] * 65536; }
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
segments.forEach((
|
|
199
|
-
|
|
200
|
-
|
|
209
|
+
var fragmentStart = new Map();
|
|
210
|
+
var fragmentEnd = new Map();
|
|
211
|
+
var rings = [];
|
|
212
|
+
segments.forEach(function (_a) {
|
|
213
|
+
var start = _a.start, end = _a.end;
|
|
214
|
+
var a = fragmentEnd.get(key(start));
|
|
215
|
+
var b = fragmentStart.get(key(end));
|
|
201
216
|
if (a && b) {
|
|
202
217
|
fragmentEnd.delete(key(start));
|
|
203
218
|
fragmentStart.delete(key(end));
|
|
@@ -208,7 +223,7 @@ class ContourMipmap {
|
|
|
208
223
|
}
|
|
209
224
|
else {
|
|
210
225
|
// Join two lines together
|
|
211
|
-
|
|
226
|
+
var c = a.concat(b);
|
|
212
227
|
fragmentStart.set(key(c[0]), c);
|
|
213
228
|
fragmentEnd.set(key(c[c.length - 1]), c);
|
|
214
229
|
}
|
|
@@ -227,45 +242,46 @@ class ContourMipmap {
|
|
|
227
242
|
}
|
|
228
243
|
else {
|
|
229
244
|
// New line doesn't connect to any existing line
|
|
230
|
-
|
|
245
|
+
var c = [start, end];
|
|
231
246
|
fragmentStart.set(key(start), c);
|
|
232
247
|
fragmentEnd.set(key(end), c);
|
|
233
248
|
}
|
|
234
249
|
if (fragmentStart.size !== fragmentEnd.size) {
|
|
235
|
-
console.error(
|
|
250
|
+
console.error("Contour remaining fragment size mismatch ".concat(fragmentStart.size, " ").concat(fragmentEnd.size));
|
|
236
251
|
}
|
|
237
252
|
});
|
|
238
|
-
|
|
253
|
+
var smoothOpts = {
|
|
239
254
|
kernelWidth: smoothKernelWidth,
|
|
240
255
|
cycles: smoothCycles,
|
|
241
256
|
};
|
|
242
257
|
// Closed rings and any unclosed line strings
|
|
243
|
-
return [
|
|
244
|
-
.
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
}
|
|
258
|
+
return __spreadArray(__spreadArray([], rings, true), fragmentStart.values(), true).filter(function (l) { return l.length >= minPoints && l.length >= smoothKernelWidth * 2; })
|
|
259
|
+
.map(function (l) { return smooth(l, smoothOpts); });
|
|
260
|
+
};
|
|
261
|
+
return ContourMipmap;
|
|
262
|
+
}());
|
|
248
263
|
// Smooth a line by repeatedly applying a rectangular filter to approximate
|
|
249
264
|
// a gaussian filter. It detects closed loops and preserves them.
|
|
250
265
|
// The line is passed as an array of `[x, y]` pairs.
|
|
251
266
|
//
|
|
252
267
|
// kernelWidth: Width of the rectangular filter kernel
|
|
253
268
|
// cycles: Number of times to apply the kernel
|
|
254
|
-
function smooth(line,
|
|
255
|
-
|
|
256
|
-
|
|
269
|
+
function smooth(line, _a) {
|
|
270
|
+
var _b = _a.kernelWidth, kernelWidth = _b === void 0 ? 2 : _b, _c = _a.cycles, cycles = _c === void 0 ? 2 : _c;
|
|
271
|
+
var isLoop = line[0][0] === line[line.length - 1][0] && line[0][1] === line[line.length - 1][1];
|
|
272
|
+
var pointAt;
|
|
257
273
|
if (isLoop) {
|
|
258
|
-
pointAt = i
|
|
274
|
+
pointAt = function (i) { return line[(i + line.length) % line.length]; };
|
|
259
275
|
}
|
|
260
276
|
else {
|
|
261
|
-
pointAt = i
|
|
277
|
+
pointAt = function (i) { return line[Math.min(Math.max(i, 0), line.length - 1)]; };
|
|
262
278
|
}
|
|
263
|
-
|
|
264
|
-
for (
|
|
265
|
-
|
|
266
|
-
|
|
279
|
+
var sc = 1.0 / (kernelWidth * 2);
|
|
280
|
+
for (var cycle = 0; cycle < cycles; cycle++) {
|
|
281
|
+
var px = 0;
|
|
282
|
+
var py = 0;
|
|
267
283
|
if (isLoop) {
|
|
268
|
-
for (
|
|
284
|
+
for (var i = line.length - kernelWidth; i < line.length; i++) {
|
|
269
285
|
px += line[i][0];
|
|
270
286
|
py += line[i][1];
|
|
271
287
|
}
|
|
@@ -274,12 +290,12 @@ function smooth(line, { kernelWidth = 2, cycles = 2 }) {
|
|
|
274
290
|
px = line[0][0] * kernelWidth;
|
|
275
291
|
py = line[0][1] * kernelWidth;
|
|
276
292
|
}
|
|
277
|
-
for (
|
|
293
|
+
for (var i = 0; i < kernelWidth; i++) {
|
|
278
294
|
px += line[i][0];
|
|
279
295
|
py += line[i][1];
|
|
280
296
|
}
|
|
281
|
-
|
|
282
|
-
for (
|
|
297
|
+
var res = line.slice();
|
|
298
|
+
for (var i = 0; i < line.length; i++) {
|
|
283
299
|
res[i] = [px * sc, py * sc];
|
|
284
300
|
px += pointAt(i + kernelWidth)[0] - pointAt(i - kernelWidth)[0];
|
|
285
301
|
py += pointAt(i + kernelWidth)[1] - pointAt(i - kernelWidth)[1];
|
|
@@ -293,8 +309,8 @@ function smooth(line, { kernelWidth = 2, cycles = 2 }) {
|
|
|
293
309
|
return line;
|
|
294
310
|
}
|
|
295
311
|
function scaleParameters(minLongitude, minLatitude, maxLongitude, maxLatitude, width, height) {
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
return { scaleX, scaleY };
|
|
312
|
+
var scaleX = (maxLongitude - minLongitude) / width;
|
|
313
|
+
var scaleY = (maxLatitude - minLatitude) / height;
|
|
314
|
+
return { scaleX: scaleX, scaleY: scaleY };
|
|
299
315
|
}
|
|
300
316
|
exports.default = ContourMipmap;
|
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
3
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
4
|
+
if (ar || !(i in from)) {
|
|
5
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
6
|
+
ar[i] = from[i];
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
10
|
+
};
|
|
2
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
12
|
+
var util_1 = require("../../util");
|
|
13
|
+
var programs_1 = require("../../programs");
|
|
14
|
+
var typecheck_1 = require("../../util/check/typecheck");
|
|
6
15
|
/**
|
|
7
16
|
* @param id : string
|
|
8
17
|
* @param dataManager : DataManager
|
|
@@ -10,8 +19,9 @@ const typecheck_1 = require("../../util/check/typecheck");
|
|
|
10
19
|
* @param dataWidthHeight : {width: number, height: number}
|
|
11
20
|
* @param options : {bbox: number[], minMaxEdges: {min: number, max: number}, escapeValue: number, resolution: number[], meshPartition: number[]}
|
|
12
21
|
*/
|
|
13
|
-
|
|
14
|
-
|
|
22
|
+
var HeatWaveGlobeShellPlugin = /** @class */ (function () {
|
|
23
|
+
function HeatWaveGlobeShellPlugin(id, dataManager, colorRampData, dataWidthHeight, _a) {
|
|
24
|
+
var _b = _a === void 0 ? {} : _a, _c = _b.bbox, bbox = _c === void 0 ? [-180, -90, 180, 90] : _c, _d = _b.minMaxEdges, minMaxEdges = _d === void 0 ? { min: -99999, max: 99999 } : _d, _e = _b.escapeValue, escapeValue = _e === void 0 ? 99999 : _e, _f = _b.resolution, resolution = _f === void 0 ? [2056, 2056] : _f, _g = _b.yFlip, yFlip = _g === void 0 ? true : _g;
|
|
15
25
|
this.id = id;
|
|
16
26
|
this.dataManager = dataManager;
|
|
17
27
|
this._dataWidthHeight = dataWidthHeight;
|
|
@@ -30,60 +40,63 @@ class HeatWaveGlobeShellPlugin {
|
|
|
30
40
|
this.enabled = false;
|
|
31
41
|
this.isAble = false;
|
|
32
42
|
}
|
|
33
|
-
setHeight(height) {
|
|
43
|
+
HeatWaveGlobeShellPlugin.prototype.setHeight = function (height) {
|
|
34
44
|
this.globeShell.setHeight(height);
|
|
35
|
-
}
|
|
36
|
-
drawHeat() {
|
|
37
|
-
|
|
45
|
+
};
|
|
46
|
+
HeatWaveGlobeShellPlugin.prototype.drawHeat = function () {
|
|
47
|
+
var gl = this.gl;
|
|
38
48
|
gl.bindFramebuffer(gl.FRAMEBUFFER, this._frameBuffer);
|
|
39
49
|
gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, this._coloredHeatTexture, 0);
|
|
40
50
|
gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
gl.viewport(0, 0,
|
|
51
|
+
var currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
|
|
52
|
+
var currentWidth = gl.canvas.width;
|
|
53
|
+
var currentHeight = gl.canvas.height;
|
|
54
|
+
gl.viewport.apply(gl, __spreadArray([0, 0], this._resolution, false));
|
|
45
55
|
this.heatProgram.draw();
|
|
46
56
|
gl.viewport(0, 0, currentWidth, currentHeight);
|
|
47
57
|
gl.bindFramebuffer(gl.FRAMEBUFFER, null);
|
|
48
58
|
gl.useProgram(currentProgram);
|
|
49
59
|
this.globe.DrawRender();
|
|
50
|
-
}
|
|
51
|
-
setEscapeValue(escapeValue) {
|
|
60
|
+
};
|
|
61
|
+
HeatWaveGlobeShellPlugin.prototype.setEscapeValue = function (escapeValue) {
|
|
52
62
|
this._escapeValue = escapeValue;
|
|
53
63
|
this.heatProgram.setEscapeValue(escapeValue);
|
|
54
|
-
}
|
|
55
|
-
_createPointCoordinatesDataCalculator() {
|
|
64
|
+
};
|
|
65
|
+
HeatWaveGlobeShellPlugin.prototype._createPointCoordinatesDataCalculator = function () {
|
|
56
66
|
this.coordinatesDataCalculator = new util_1.PointCoordinatesDataCalculator(this._bbox, this._dataWidthHeight.width, this._dataWidthHeight.height);
|
|
57
67
|
this.dataManager.register(this._coordinatesDataCalculatorID(), this.coordinatesDataCalculator.updateData.bind(this.coordinatesDataCalculator));
|
|
58
|
-
}
|
|
59
|
-
_coordinatesDataCalculatorID() {
|
|
68
|
+
};
|
|
69
|
+
HeatWaveGlobeShellPlugin.prototype._coordinatesDataCalculatorID = function () {
|
|
60
70
|
return this.id + "_coordinatesDataCalculator";
|
|
61
|
-
}
|
|
62
|
-
updateTime(time) {
|
|
71
|
+
};
|
|
72
|
+
HeatWaveGlobeShellPlugin.prototype.updateTime = function (time) {
|
|
63
73
|
this.dataManager.updateTime(time);
|
|
64
74
|
this.globe.DrawRender();
|
|
65
|
-
}
|
|
66
|
-
setWiggle
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
75
|
+
};
|
|
76
|
+
HeatWaveGlobeShellPlugin.prototype.setWiggle = function (_a) {
|
|
77
|
+
var _b = _a === void 0 ? {} : _a, _c = _b.wiggleInKm, wiggleInKm = _c === void 0 ? null : _c, _d = _b.wiggleSpeed, wiggleSpeed = _d === void 0 ? null : _d;
|
|
78
|
+
this.globeShell.setWiggle({ wiggleInKm: wiggleInKm, wiggleSpeed: wiggleSpeed });
|
|
79
|
+
};
|
|
80
|
+
HeatWaveGlobeShellPlugin.prototype.setMinMaxEdges = function (min, max) {
|
|
81
|
+
if (min === void 0) { min = null; }
|
|
82
|
+
if (max === void 0) { max = null; }
|
|
70
83
|
if (min)
|
|
71
84
|
this._minMaxEdges.min = min;
|
|
72
85
|
if (max)
|
|
73
86
|
this._minMaxEdges.max = max;
|
|
74
87
|
this.heatProgram.setMinMaxEdges(this._minMaxEdges.min, this._minMaxEdges.max);
|
|
75
88
|
this.drawHeat();
|
|
76
|
-
}
|
|
77
|
-
setBBox(minLon, minLat, maxLon, maxLat) {
|
|
89
|
+
};
|
|
90
|
+
HeatWaveGlobeShellPlugin.prototype.setBBox = function (minLon, minLat, maxLon, maxLat) {
|
|
78
91
|
this._bbox = [minLon, minLat, maxLon, maxLat];
|
|
79
|
-
this.globeShell.setBBox({ minLon, minLat, maxLon, maxLat });
|
|
92
|
+
this.globeShell.setBBox({ minLon: minLon, minLat: minLat, maxLon: maxLon, maxLat: maxLat });
|
|
80
93
|
this.drawHeat();
|
|
81
|
-
}
|
|
82
|
-
getPointCoordinatesDataCalculator() {
|
|
94
|
+
};
|
|
95
|
+
HeatWaveGlobeShellPlugin.prototype.getPointCoordinatesDataCalculator = function () {
|
|
83
96
|
if (!this.coordinatesDataCalculator)
|
|
84
97
|
this._createPointCoordinatesDataCalculator();
|
|
85
98
|
return this.coordinatesDataCalculator;
|
|
86
|
-
}
|
|
99
|
+
};
|
|
87
100
|
/**
|
|
88
101
|
* @param {*} values n + 1 number of color hex values without alpha channel. Ex: ["#ff0000", "#00ff00", "#0000ff"]
|
|
89
102
|
* @param {*} thresholds n number of thresholds. Ex: [0, 10, 20]
|
|
@@ -92,23 +105,26 @@ class HeatWaveGlobeShellPlugin {
|
|
|
92
105
|
* There are maximum 256 pixels in the color ramp.
|
|
93
106
|
* The first values array is minimum edge value which is the first pixel, the second comes one pixel after the first.
|
|
94
107
|
*/
|
|
95
|
-
setColorRamp(values, thresholds, mode
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
108
|
+
HeatWaveGlobeShellPlugin.prototype.setColorRamp = function (values, thresholds, mode) {
|
|
109
|
+
if (mode === void 0) { mode = "interpolated"; }
|
|
110
|
+
var lowest = thresholds[0];
|
|
111
|
+
var highest = thresholds[thresholds.length - 1];
|
|
112
|
+
var range = highest - lowest;
|
|
113
|
+
var clampedThresholds = thresholds.map(function (t) { return (t - lowest) / range; });
|
|
114
|
+
var colors = (0, util_1.getColorRampModed)(values, clampedThresholds, mode);
|
|
101
115
|
this.heatProgram.setColorRampTextureData(colors, 256);
|
|
102
116
|
this.heatProgram.setColorRampRange(lowest, highest);
|
|
103
117
|
this.drawHeat();
|
|
104
|
-
}
|
|
105
|
-
off() {
|
|
118
|
+
};
|
|
119
|
+
HeatWaveGlobeShellPlugin.prototype.off = function () {
|
|
106
120
|
this._isOn = false;
|
|
107
|
-
}
|
|
108
|
-
on() {
|
|
121
|
+
};
|
|
122
|
+
HeatWaveGlobeShellPlugin.prototype.on = function () {
|
|
109
123
|
this._isOn = true;
|
|
110
|
-
}
|
|
111
|
-
_updateData(ratio, textureData0
|
|
124
|
+
};
|
|
125
|
+
HeatWaveGlobeShellPlugin.prototype._updateData = function (ratio, textureData0, textureData1) {
|
|
126
|
+
if (textureData0 === void 0) { textureData0 = null; }
|
|
127
|
+
if (textureData1 === void 0) { textureData1 = null; }
|
|
112
128
|
if (!textureData0 || !textureData1) {
|
|
113
129
|
if (this._disCarded)
|
|
114
130
|
return;
|
|
@@ -126,33 +142,34 @@ class HeatWaveGlobeShellPlugin {
|
|
|
126
142
|
this.heatProgram.setFloatTextureData(textureData0, textureData1, this._dataWidthHeight.width, this._dataWidthHeight.height, this._yFlip);
|
|
127
143
|
}
|
|
128
144
|
this.drawHeat();
|
|
129
|
-
}
|
|
130
|
-
setDataWidthHeight(width, height) {
|
|
131
|
-
this._dataWidthHeight = { width, height };
|
|
145
|
+
};
|
|
146
|
+
HeatWaveGlobeShellPlugin.prototype.setDataWidthHeight = function (width, height) {
|
|
147
|
+
this._dataWidthHeight = { width: width, height: height };
|
|
132
148
|
this.heatProgram.setDataWidthHeight(width, height);
|
|
133
149
|
this.setGeometry();
|
|
134
|
-
}
|
|
135
|
-
draw3D() {
|
|
150
|
+
};
|
|
151
|
+
HeatWaveGlobeShellPlugin.prototype.draw3D = function () {
|
|
136
152
|
if (!this._isOn)
|
|
137
153
|
return;
|
|
138
154
|
// if (!this.isAble) return;
|
|
139
155
|
this.gl.disable(this.gl.DEPTH_TEST);
|
|
140
156
|
this.globeShell.draw();
|
|
141
157
|
this.gl.enable(this.gl.DEPTH_TEST);
|
|
142
|
-
}
|
|
143
|
-
setOpacity(opacity) {
|
|
158
|
+
};
|
|
159
|
+
HeatWaveGlobeShellPlugin.prototype.setOpacity = function (opacity) {
|
|
144
160
|
(0, typecheck_1.opacityCheck)(opacity);
|
|
145
161
|
this.globeShell.setOpacity(opacity);
|
|
146
|
-
}
|
|
147
|
-
_setAfterInit() {
|
|
148
|
-
|
|
149
|
-
this.globeShell.setBBox({ minLon, minLat, maxLon, maxLat });
|
|
162
|
+
};
|
|
163
|
+
HeatWaveGlobeShellPlugin.prototype._setAfterInit = function () {
|
|
164
|
+
var _a = this._bbox, minLon = _a[0], minLat = _a[1], maxLon = _a[2], maxLat = _a[3];
|
|
165
|
+
this.globeShell.setBBox({ minLon: minLon, minLat: minLat, maxLon: maxLon, maxLat: maxLat });
|
|
150
166
|
this.setColorRamp(this._colorRampData.values, this._colorRampData.thresholds, this._colorRampData.mode);
|
|
151
167
|
delete this._colorRampData;
|
|
152
168
|
this.setMinMaxEdges(this._minMaxEdges.min, this._minMaxEdges.max);
|
|
153
169
|
this.setEscapeValue(this._escapeValue);
|
|
154
|
-
}
|
|
155
|
-
_init(globe, gl) {
|
|
170
|
+
};
|
|
171
|
+
HeatWaveGlobeShellPlugin.prototype._init = function (globe, gl) {
|
|
172
|
+
var _this = this;
|
|
156
173
|
this.globeShell = new programs_1.GlobeShellWiggle(gl, globe, {
|
|
157
174
|
minLon: this._bbox[0],
|
|
158
175
|
minLat: this._bbox[1],
|
|
@@ -166,22 +183,22 @@ class HeatWaveGlobeShellPlugin {
|
|
|
166
183
|
});
|
|
167
184
|
this.heatProgram = new programs_1.Float2LegendWithRatio(gl);
|
|
168
185
|
this._frameBuffer = gl.createFramebuffer();
|
|
169
|
-
this.dataManager.register(this.id, (ratio, t1, t2)
|
|
186
|
+
this.dataManager.register(this.id, function (ratio, t1, t2) { return _this._updateData(ratio, t1, t2); });
|
|
170
187
|
this.setResolution(this._resolution[0], this._resolution[1]);
|
|
171
|
-
}
|
|
172
|
-
init(globe, gl) {
|
|
188
|
+
};
|
|
189
|
+
HeatWaveGlobeShellPlugin.prototype.init = function (globe, gl) {
|
|
173
190
|
this.globe = globe;
|
|
174
191
|
this.gl = gl;
|
|
175
192
|
this._init(globe, gl);
|
|
176
193
|
this._setAfterInit();
|
|
177
|
-
}
|
|
178
|
-
setGeometry() {
|
|
194
|
+
};
|
|
195
|
+
HeatWaveGlobeShellPlugin.prototype.setGeometry = function () {
|
|
179
196
|
// globeShell has an implicit program, registered and sets its own geometry.
|
|
180
197
|
return;
|
|
181
|
-
}
|
|
198
|
+
};
|
|
182
199
|
// sets Density of middle texture which is used with framebuffers
|
|
183
|
-
setResolution(width, height) {
|
|
184
|
-
|
|
200
|
+
HeatWaveGlobeShellPlugin.prototype.setResolution = function (width, height) {
|
|
201
|
+
var gl = this.gl;
|
|
185
202
|
this._resolution = [width, height];
|
|
186
203
|
this._coloredHeatTexture = gl.createTexture();
|
|
187
204
|
gl.bindTexture(gl.TEXTURE_2D, this._coloredHeatTexture);
|
|
@@ -192,8 +209,8 @@ class HeatWaveGlobeShellPlugin {
|
|
|
192
209
|
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
|
|
193
210
|
gl.bindTexture(gl.TEXTURE_2D, null);
|
|
194
211
|
this.globeShell.setTexture(this._coloredHeatTexture);
|
|
195
|
-
}
|
|
196
|
-
free() {
|
|
212
|
+
};
|
|
213
|
+
HeatWaveGlobeShellPlugin.prototype.free = function () {
|
|
197
214
|
if (this.coordinatesDataCalculator) {
|
|
198
215
|
this.dataManager.unregister(this._coordinatesDataCalculatorID());
|
|
199
216
|
this.coordinatesDataCalculator = null;
|
|
@@ -201,6 +218,7 @@ class HeatWaveGlobeShellPlugin {
|
|
|
201
218
|
this.dataManager.unregister(this.id);
|
|
202
219
|
this.globeShell.free();
|
|
203
220
|
this.heatProgram.free();
|
|
204
|
-
}
|
|
205
|
-
|
|
221
|
+
};
|
|
222
|
+
return HeatWaveGlobeShellPlugin;
|
|
223
|
+
}());
|
|
206
224
|
exports.default = HeatWaveGlobeShellPlugin;
|
package/index.js
CHANGED
|
@@ -34,25 +34,25 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.pointheatmap = exports.partialring = exports.arrowfield = exports.programs = exports.util = exports.heatwave = exports.compassrose = exports.rangerings = exports.timetracks = exports.waveparticles = exports.wind = void 0;
|
|
37
|
-
|
|
37
|
+
var wind = __importStar(require("./wind"));
|
|
38
38
|
exports.wind = wind;
|
|
39
|
-
|
|
39
|
+
var waveparticles = __importStar(require("./waveparticles"));
|
|
40
40
|
exports.waveparticles = waveparticles;
|
|
41
|
-
|
|
41
|
+
var timetracks = __importStar(require("./timetracks"));
|
|
42
42
|
exports.timetracks = timetracks;
|
|
43
|
-
|
|
43
|
+
var arrowfield = __importStar(require("./arrowfield"));
|
|
44
44
|
exports.arrowfield = arrowfield;
|
|
45
|
-
|
|
45
|
+
var rangerings = __importStar(require("./rangerings"));
|
|
46
46
|
exports.rangerings = rangerings;
|
|
47
|
-
|
|
47
|
+
var partialring = __importStar(require("./partialrings"));
|
|
48
48
|
exports.partialring = partialring;
|
|
49
|
-
|
|
49
|
+
var compassrose = __importStar(require("./compassrose"));
|
|
50
50
|
exports.compassrose = compassrose;
|
|
51
|
-
|
|
51
|
+
var heatwave = __importStar(require("./heatwave"));
|
|
52
52
|
exports.heatwave = heatwave;
|
|
53
|
-
|
|
53
|
+
var util = __importStar(require("./util"));
|
|
54
54
|
exports.util = util;
|
|
55
|
-
|
|
55
|
+
var programs = __importStar(require("./programs"));
|
|
56
56
|
exports.programs = programs;
|
|
57
|
-
|
|
57
|
+
var pointheatmap = __importStar(require("./point-heat-map"));
|
|
58
58
|
exports.pointheatmap = pointheatmap;
|