@pirireis/webglobeplugins 0.9.9 → 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 +15 -0
- package/Math/arc.js +65 -0
- package/Math/bounds/line-bbox.js +190 -0
- package/Math/constants.js +9 -0
- package/Math/frustum/camera.js +24 -0
- package/Math/frustum/from-globeinfo.js +48 -0
- package/Math/frustum/types.js +2 -0
- package/Math/globe-util/horizon-plane.js +112 -0
- package/Math/index.js +1 -0
- package/Math/juction/arc-plane.js +83 -0
- package/Math/juction/line-sphere.js +25 -0
- package/Math/juction/plane-plane.js +58 -0
- package/Math/line.js +58 -0
- package/Math/matrix4.js +1 -0
- package/Math/methods.js +206 -0
- package/Math/plane.js +62 -0
- package/Math/quaternion.js +108 -0
- package/Math/types.js +2 -0
- package/Math/utils.js +4 -0
- package/Math/vec3.js +129 -0
- package/algorithms/search-binary.js +19 -0
- package/altitude-locator/adaptors.js +1 -0
- package/altitude-locator/draw-subset-obj.js +19 -0
- package/altitude-locator/keymethod.js +1 -0
- package/altitude-locator/plugin.js +357 -0
- package/altitude-locator/types.js +23 -0
- package/arrowfield/adaptor.js +15 -0
- package/arrowfield/index.js +10 -0
- package/arrowfield/plugin.js +89 -0
- package/bearing-line/index.js +8 -0
- package/bearing-line/plugin.js +474 -0
- package/circle-line-chain/chain-list-map.js +211 -0
- package/circle-line-chain/init.js +1 -0
- package/circle-line-chain/plugin.js +449 -0
- package/circle-line-chain/util.js +5 -0
- package/compass-rose/compass-rose-padding-flat.js +247 -0
- package/compass-rose/compass-text-writer.js +161 -0
- package/compass-rose/index.js +7 -0
- package/compassrose/compassrose.js +300 -0
- package/compassrose/index.js +8 -0
- package/globe-types.js +1 -0
- package/heatwave/index.js +10 -0
- package/heatwave/isobar/objectarraylabels.js +206 -0
- package/heatwave/isobar/plugin.js +362 -0
- package/heatwave/isobar/quadtreecontours.js +316 -0
- package/heatwave/plugins/heatwaveglobeshell.js +224 -0
- package/index.js +11 -11
- package/jest.config.js +7 -0
- package/package.json +4 -4
- package/partialrings/buffer-manager.js +113 -0
- package/partialrings/index.js +41 -0
- package/partialrings/plugin.js +171 -0
- package/partialrings/program.js +197 -0
- package/pin/pin-object-array.js +308 -0
- package/pin/pin-point-totem.js +61 -0
- package/point-heat-map/adaptors/timetracksplugin-format-to-this.js +66 -0
- package/point-heat-map/index.js +1 -0
- package/point-heat-map/plugin-webworker.js +131 -0
- package/point-heat-map/point-to-heat-map-flow.js +129 -0
- package/point-tracks/key-methods.js +5 -0
- package/point-tracks/plugin.js +353 -0
- package/programs/arrowfield/index.js +7 -0
- package/programs/arrowfield/logic.js +149 -0
- package/programs/arrowfield/object.js +68 -0
- package/programs/data2legend/density-to-legend.js +77 -0
- package/programs/data2legend/point-to-density-texture.js +75 -0
- package/programs/float2legendwithratio/index.js +8 -0
- package/programs/float2legendwithratio/logic.js +125 -0
- package/programs/float2legendwithratio/object.js +113 -0
- package/programs/globe-util/is-globe-moved.js +22 -0
- package/programs/globeshell/index.js +8 -0
- package/programs/globeshell/noise/noises.js +1 -0
- package/programs/globeshell/wiggle/index.js +8 -0
- package/programs/globeshell/wiggle/logic.js +252 -0
- package/programs/globeshell/wiggle/object.js +74 -0
- package/programs/helpers/blender/index.js +1 -0
- package/programs/helpers/blender/program.js +62 -0
- package/programs/helpers/fadeaway/index.js +7 -0
- package/programs/helpers/fadeaway/logic.js +50 -0
- package/programs/helpers/fadeaway/object.js +21 -0
- package/programs/helpers/index.js +8 -0
- package/programs/index.js +58 -0
- package/programs/interface.js +1 -0
- package/programs/line-on-globe/angled-line.js +117 -0
- package/programs/line-on-globe/circle-accurate-3d.js +91 -0
- package/programs/line-on-globe/circle-accurate-flat.js +158 -0
- package/programs/line-on-globe/circle-accurate.js +108 -0
- package/programs/line-on-globe/circle.js +102 -0
- package/programs/line-on-globe/degree-padding-around-circle-3d.js +109 -0
- package/programs/line-on-globe/index.js +1 -0
- package/programs/line-on-globe/lines-color-instanced-flat.js +91 -0
- package/programs/line-on-globe/linestrip.js +110 -0
- package/programs/line-on-globe/naive-accurate-flexible.js +125 -0
- package/programs/line-on-globe/to-the-surface.js +82 -0
- package/programs/line-on-globe/util.js +8 -0
- package/programs/picking/pickable-renderer.js +104 -0
- package/programs/point-on-globe/element-globe-surface-glow.js +102 -0
- package/programs/point-on-globe/element-point-glow.js +85 -0
- package/programs/point-on-globe/square-pixel-point.js +125 -0
- package/programs/programcache.js +131 -0
- package/programs/rings/distancering/circleflatprogram.js +114 -0
- package/programs/rings/distancering/circlepaddingfreeangleprogram.js +358 -0
- package/programs/rings/distancering/circlepaddysharedbuffer.js +433 -0
- package/programs/rings/distancering/index.js +14 -0
- package/programs/rings/distancering/paddyflatprogram.js +119 -0
- package/programs/rings/distancering/paddyflatprogram2d.js +121 -0
- package/programs/rings/distancering/paddyflatprogram3d.js +119 -0
- package/programs/rings/distancering/shader.js +1 -0
- package/programs/rings/index.js +17 -0
- package/programs/rings/partial-ring/piece-of-pie.js +173 -0
- package/programs/totems/camerauniformblock.js +147 -0
- package/programs/totems/canvas-webglobe-info.js +102 -0
- package/programs/totems/gpu-selection-uniform-block.js +104 -0
- package/programs/totems/index.js +40 -0
- package/programs/two-d/pixel-circle.js +1 -0
- package/programs/two-d/pixel-padding-for-compass.js +101 -0
- package/programs/util.js +18 -0
- package/programs/vectorfields/index.js +23 -0
- package/programs/vectorfields/logics/drawrectangleparticles.js +66 -0
- package/programs/vectorfields/logics/index.js +12 -0
- package/programs/vectorfields/logics/pixelbased.js +86 -0
- package/programs/vectorfields/logics/ubo.js +57 -0
- package/programs/vectorfields/pingpongbuffermanager.js +80 -0
- package/rangerings/enum.js +5 -0
- package/rangerings/index.js +15 -0
- package/rangerings/plugin.js +610 -0
- package/rangerings/rangeringangletext.js +341 -0
- package/rangerings/ring-account.js +134 -0
- package/shaders/fragment-toy/firework.js +4 -0
- package/shaders/fragment-toy/singularity.js +5 -0
- package/shape-on-terrain/arc/naive/plugin.js +252 -0
- package/timetracks/adaptors-line-strip.js +82 -0
- package/timetracks/adaptors.js +136 -0
- package/timetracks/index.js +19 -0
- package/timetracks/plugin-line-strip.js +254 -0
- package/timetracks/plugin.js +262 -0
- package/timetracks/program-line-strip.js +418 -0
- package/timetracks/program.js +466 -0
- package/timetracks/programpoint-line-strip.js +101 -0
- package/timetracks/programpoint.js +101 -0
- package/types.js +15 -0
- package/util/account/bufferoffsetmanager.js +202 -0
- package/util/account/index.js +23 -0
- package/util/account/single-attribute-buffer-management/buffer-manager.js +112 -0
- package/util/account/single-attribute-buffer-management/buffer-orchestrator.js +180 -0
- package/util/account/single-attribute-buffer-management/index.js +9 -0
- package/util/account/single-attribute-buffer-management/object-store.js +53 -0
- package/util/account/single-attribute-buffer-management/types.js +2 -0
- package/util/account/util.js +24 -0
- package/util/algorithms/index.js +1 -0
- package/util/algorithms/search-binary.js +28 -0
- package/util/check/get.js +18 -0
- package/util/check/index.js +1 -0
- package/util/check/typecheck.js +51 -0
- package/util/geometry/index.js +53 -0
- package/util/gl-util/buffer/attribute-loader.js +81 -0
- package/util/gl-util/buffer/index.js +6 -0
- package/util/gl-util/buffer/types.js +1 -0
- package/util/gl-util/draw-options/methods.js +38 -0
- package/util/gl-util/draw-options/types.js +15 -0
- package/util/gl-util/uniform-block/manager.js +168 -0
- package/util/gl-util/uniform-block/shader.js +1 -0
- package/util/gl-util/uniform-block/types.js +8 -0
- package/util/heatwavedatamanager/datamanager.js +212 -0
- package/util/heatwavedatamanager/index.js +10 -0
- package/util/heatwavedatamanager/pointcoordinatesdatacalculator.js +125 -0
- package/util/heatwavedatamanager/pointcoordsmeta.js +21 -0
- package/util/index.js +57 -0
- package/util/interpolation/index.js +1 -0
- package/util/interpolation/timetrack/index.js +5 -0
- package/util/interpolation/timetrack/timetrack-interpolator.js +81 -0
- package/util/interpolation/timetrack/web-worker-str.js +5 -0
- package/util/interpolation/timetrack/web-worker.js +48 -0
- package/util/jshelpers/data-filler.js +20 -0
- package/util/jshelpers/equality.js +20 -0
- package/util/jshelpers/index.js +37 -0
- package/util/jshelpers/timefilters.js +32 -0
- package/util/picking/fence.js +46 -0
- package/util/picking/picker-displayer.js +145 -0
- package/util/programs/draw-texture-on-canvas.js +71 -0
- package/util/programs/index.js +17 -0
- package/util/programs/shapesonglobe.js +174 -0
- package/util/programs/supersampletotextures.js +107 -0
- package/util/programs/texturetoglobe.js +132 -0
- package/util/shaderfunctions/geometrytransformations.js +45 -0
- package/util/shaderfunctions/index.js +18 -0
- package/util/shaderfunctions/nodata.js +5 -0
- package/util/shaderfunctions/noisefunctions.js +13 -0
- package/util/surface-line-data/arc-bboxes.js +25 -0
- package/util/surface-line-data/arcs-to-cuts.js +53 -0
- package/util/surface-line-data/cut-arc.js +1 -0
- package/util/surface-line-data/flow.js +28 -0
- package/util/surface-line-data/rbush-manager.js +1 -0
- package/util/surface-line-data/types.js +1 -0
- package/util/surface-line-data/web-worker.js +1 -0
- package/util/webglobe/gldefaultstates.js +7 -0
- package/util/webglobe/index.js +18 -0
- package/util/webglobe/rasteroverlay.js +80 -0
- package/util/webglobjectbuilders.js +393 -0
- package/util/webglobjectbuilders1.js +238 -0
- package/waveparticles/adaptor.js +18 -0
- package/waveparticles/index.js +10 -0
- package/waveparticles/plugin.js +271 -0
- package/wind/imagetovectorfieldandmagnitude.js +35 -0
- package/wind/index.js +14 -0
- package/wind/plugin.js +724 -0
- package/wind/vectorfieldimage.js +25 -0
- package/write-text/attached-text-writer.js +93 -0
- package/write-text/context-text.js +105 -0
- package/write-text/context-text3.js +160 -0
- package/write-text/index.js +5 -0
- package/write-text/writer-plugin.js +8 -0
|
@@ -0,0 +1,224 @@
|
|
|
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
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
var util_1 = require("../../util");
|
|
13
|
+
var programs_1 = require("../../programs");
|
|
14
|
+
var typecheck_1 = require("../../util/check/typecheck");
|
|
15
|
+
/**
|
|
16
|
+
* @param id : string
|
|
17
|
+
* @param dataManager : DataManager
|
|
18
|
+
* @param colorRampData : {values: string[], thresholds: number[], mode: string}
|
|
19
|
+
* @param dataWidthHeight : {width: number, height: number}
|
|
20
|
+
* @param options : {bbox: number[], minMaxEdges: {min: number, max: number}, escapeValue: number, resolution: number[], meshPartition: number[]}
|
|
21
|
+
*/
|
|
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;
|
|
25
|
+
this.id = id;
|
|
26
|
+
this.dataManager = dataManager;
|
|
27
|
+
this._dataWidthHeight = dataWidthHeight;
|
|
28
|
+
this._isOn = true;
|
|
29
|
+
this._bbox = bbox;
|
|
30
|
+
this._minMaxEdges = minMaxEdges;
|
|
31
|
+
this._escapeValue = escapeValue;
|
|
32
|
+
this._resolution = resolution;
|
|
33
|
+
this._colorRampData = colorRampData; // holds until init
|
|
34
|
+
this._yFlip = yFlip;
|
|
35
|
+
this._lastTexture0data = null;
|
|
36
|
+
this._lastTexture1data = null;
|
|
37
|
+
// output of heatProgram is written to ._coloredHeatTexture
|
|
38
|
+
this._frameBuffer = null;
|
|
39
|
+
this._coloredHeatTexture = null;
|
|
40
|
+
this.enabled = false;
|
|
41
|
+
this.isAble = false;
|
|
42
|
+
}
|
|
43
|
+
HeatWaveGlobeShellPlugin.prototype.setHeight = function (height) {
|
|
44
|
+
this.globeShell.setHeight(height);
|
|
45
|
+
};
|
|
46
|
+
HeatWaveGlobeShellPlugin.prototype.drawHeat = function () {
|
|
47
|
+
var gl = this.gl;
|
|
48
|
+
gl.bindFramebuffer(gl.FRAMEBUFFER, this._frameBuffer);
|
|
49
|
+
gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, this._coloredHeatTexture, 0);
|
|
50
|
+
gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
|
|
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));
|
|
55
|
+
this.heatProgram.draw();
|
|
56
|
+
gl.viewport(0, 0, currentWidth, currentHeight);
|
|
57
|
+
gl.bindFramebuffer(gl.FRAMEBUFFER, null);
|
|
58
|
+
gl.useProgram(currentProgram);
|
|
59
|
+
this.globe.DrawRender();
|
|
60
|
+
};
|
|
61
|
+
HeatWaveGlobeShellPlugin.prototype.setEscapeValue = function (escapeValue) {
|
|
62
|
+
this._escapeValue = escapeValue;
|
|
63
|
+
this.heatProgram.setEscapeValue(escapeValue);
|
|
64
|
+
};
|
|
65
|
+
HeatWaveGlobeShellPlugin.prototype._createPointCoordinatesDataCalculator = function () {
|
|
66
|
+
this.coordinatesDataCalculator = new util_1.PointCoordinatesDataCalculator(this._bbox, this._dataWidthHeight.width, this._dataWidthHeight.height);
|
|
67
|
+
this.dataManager.register(this._coordinatesDataCalculatorID(), this.coordinatesDataCalculator.updateData.bind(this.coordinatesDataCalculator));
|
|
68
|
+
};
|
|
69
|
+
HeatWaveGlobeShellPlugin.prototype._coordinatesDataCalculatorID = function () {
|
|
70
|
+
return this.id + "_coordinatesDataCalculator";
|
|
71
|
+
};
|
|
72
|
+
HeatWaveGlobeShellPlugin.prototype.updateTime = function (time) {
|
|
73
|
+
this.dataManager.updateTime(time);
|
|
74
|
+
this.globe.DrawRender();
|
|
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; }
|
|
83
|
+
if (min)
|
|
84
|
+
this._minMaxEdges.min = min;
|
|
85
|
+
if (max)
|
|
86
|
+
this._minMaxEdges.max = max;
|
|
87
|
+
this.heatProgram.setMinMaxEdges(this._minMaxEdges.min, this._minMaxEdges.max);
|
|
88
|
+
this.drawHeat();
|
|
89
|
+
};
|
|
90
|
+
HeatWaveGlobeShellPlugin.prototype.setBBox = function (minLon, minLat, maxLon, maxLat) {
|
|
91
|
+
this._bbox = [minLon, minLat, maxLon, maxLat];
|
|
92
|
+
this.globeShell.setBBox({ minLon: minLon, minLat: minLat, maxLon: maxLon, maxLat: maxLat });
|
|
93
|
+
this.drawHeat();
|
|
94
|
+
};
|
|
95
|
+
HeatWaveGlobeShellPlugin.prototype.getPointCoordinatesDataCalculator = function () {
|
|
96
|
+
if (!this.coordinatesDataCalculator)
|
|
97
|
+
this._createPointCoordinatesDataCalculator();
|
|
98
|
+
return this.coordinatesDataCalculator;
|
|
99
|
+
};
|
|
100
|
+
/**
|
|
101
|
+
* @param {*} values n + 1 number of color hex values without alpha channel. Ex: ["#ff0000", "#00ff00", "#0000ff"]
|
|
102
|
+
* @param {*} thresholds n number of thresholds. Ex: [0, 10, 20]
|
|
103
|
+
* @param {*} mode "discrete" or "interpolated"
|
|
104
|
+
*
|
|
105
|
+
* There are maximum 256 pixels in the color ramp.
|
|
106
|
+
* The first values array is minimum edge value which is the first pixel, the second comes one pixel after the first.
|
|
107
|
+
*/
|
|
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);
|
|
115
|
+
this.heatProgram.setColorRampTextureData(colors, 256);
|
|
116
|
+
this.heatProgram.setColorRampRange(lowest, highest);
|
|
117
|
+
this.drawHeat();
|
|
118
|
+
};
|
|
119
|
+
HeatWaveGlobeShellPlugin.prototype.off = function () {
|
|
120
|
+
this._isOn = false;
|
|
121
|
+
};
|
|
122
|
+
HeatWaveGlobeShellPlugin.prototype.on = function () {
|
|
123
|
+
this._isOn = true;
|
|
124
|
+
};
|
|
125
|
+
HeatWaveGlobeShellPlugin.prototype._updateData = function (ratio, textureData0, textureData1) {
|
|
126
|
+
if (textureData0 === void 0) { textureData0 = null; }
|
|
127
|
+
if (textureData1 === void 0) { textureData1 = null; }
|
|
128
|
+
if (!textureData0 || !textureData1) {
|
|
129
|
+
if (this._disCarded)
|
|
130
|
+
return;
|
|
131
|
+
this.heatProgram.discard();
|
|
132
|
+
this.drawHeat();
|
|
133
|
+
this._disCarded = true;
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
;
|
|
137
|
+
this.heatProgram.setBlendRatio(ratio);
|
|
138
|
+
if (this._lastTexture0data !== textureData0 || this._lastTexture1data !== textureData1) {
|
|
139
|
+
this._disCarded = false;
|
|
140
|
+
this._lastTexture0data = textureData0;
|
|
141
|
+
this._lastTexture1data = textureData1;
|
|
142
|
+
this.heatProgram.setFloatTextureData(textureData0, textureData1, this._dataWidthHeight.width, this._dataWidthHeight.height, this._yFlip);
|
|
143
|
+
}
|
|
144
|
+
this.drawHeat();
|
|
145
|
+
};
|
|
146
|
+
HeatWaveGlobeShellPlugin.prototype.setDataWidthHeight = function (width, height) {
|
|
147
|
+
this._dataWidthHeight = { width: width, height: height };
|
|
148
|
+
this.heatProgram.setDataWidthHeight(width, height);
|
|
149
|
+
this.setGeometry();
|
|
150
|
+
};
|
|
151
|
+
HeatWaveGlobeShellPlugin.prototype.draw3D = function () {
|
|
152
|
+
if (!this._isOn)
|
|
153
|
+
return;
|
|
154
|
+
// if (!this.isAble) return;
|
|
155
|
+
this.gl.disable(this.gl.DEPTH_TEST);
|
|
156
|
+
this.globeShell.draw();
|
|
157
|
+
this.gl.enable(this.gl.DEPTH_TEST);
|
|
158
|
+
};
|
|
159
|
+
HeatWaveGlobeShellPlugin.prototype.setOpacity = function (opacity) {
|
|
160
|
+
(0, typecheck_1.opacityCheck)(opacity);
|
|
161
|
+
this.globeShell.setOpacity(opacity);
|
|
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 });
|
|
166
|
+
this.setColorRamp(this._colorRampData.values, this._colorRampData.thresholds, this._colorRampData.mode);
|
|
167
|
+
delete this._colorRampData;
|
|
168
|
+
this.setMinMaxEdges(this._minMaxEdges.min, this._minMaxEdges.max);
|
|
169
|
+
this.setEscapeValue(this._escapeValue);
|
|
170
|
+
};
|
|
171
|
+
HeatWaveGlobeShellPlugin.prototype._init = function (globe, gl) {
|
|
172
|
+
var _this = this;
|
|
173
|
+
this.globeShell = new programs_1.GlobeShellWiggle(gl, globe, {
|
|
174
|
+
minLon: this._bbox[0],
|
|
175
|
+
minLat: this._bbox[1],
|
|
176
|
+
maxLon: this._bbox[2],
|
|
177
|
+
maxLat: this._bbox[3],
|
|
178
|
+
color: [1.0, 0.1, 0.4, 0.2],
|
|
179
|
+
height: 0,
|
|
180
|
+
wiggleInKM: 2,
|
|
181
|
+
eastWestTied: false,
|
|
182
|
+
displayMesh: false
|
|
183
|
+
});
|
|
184
|
+
this.heatProgram = new programs_1.Float2LegendWithRatio(gl);
|
|
185
|
+
this._frameBuffer = gl.createFramebuffer();
|
|
186
|
+
this.dataManager.register(this.id, function (ratio, t1, t2) { return _this._updateData(ratio, t1, t2); });
|
|
187
|
+
this.setResolution(this._resolution[0], this._resolution[1]);
|
|
188
|
+
};
|
|
189
|
+
HeatWaveGlobeShellPlugin.prototype.init = function (globe, gl) {
|
|
190
|
+
this.globe = globe;
|
|
191
|
+
this.gl = gl;
|
|
192
|
+
this._init(globe, gl);
|
|
193
|
+
this._setAfterInit();
|
|
194
|
+
};
|
|
195
|
+
HeatWaveGlobeShellPlugin.prototype.setGeometry = function () {
|
|
196
|
+
// globeShell has an implicit program, registered and sets its own geometry.
|
|
197
|
+
return;
|
|
198
|
+
};
|
|
199
|
+
// sets Density of middle texture which is used with framebuffers
|
|
200
|
+
HeatWaveGlobeShellPlugin.prototype.setResolution = function (width, height) {
|
|
201
|
+
var gl = this.gl;
|
|
202
|
+
this._resolution = [width, height];
|
|
203
|
+
this._coloredHeatTexture = gl.createTexture();
|
|
204
|
+
gl.bindTexture(gl.TEXTURE_2D, this._coloredHeatTexture);
|
|
205
|
+
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, width, height, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
|
|
206
|
+
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
|
|
207
|
+
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
|
|
208
|
+
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
|
|
209
|
+
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
|
|
210
|
+
gl.bindTexture(gl.TEXTURE_2D, null);
|
|
211
|
+
this.globeShell.setTexture(this._coloredHeatTexture);
|
|
212
|
+
};
|
|
213
|
+
HeatWaveGlobeShellPlugin.prototype.free = function () {
|
|
214
|
+
if (this.coordinatesDataCalculator) {
|
|
215
|
+
this.dataManager.unregister(this._coordinatesDataCalculatorID());
|
|
216
|
+
this.coordinatesDataCalculator = null;
|
|
217
|
+
}
|
|
218
|
+
this.dataManager.unregister(this.id);
|
|
219
|
+
this.globeShell.free();
|
|
220
|
+
this.heatProgram.free();
|
|
221
|
+
};
|
|
222
|
+
return HeatWaveGlobeShellPlugin;
|
|
223
|
+
}());
|
|
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;
|
package/jest.config.js
ADDED
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pirireis/webglobeplugins",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.11",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"author": "Toprak Nihat Deniz Ozturk",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"build": "tsc"
|
|
9
9
|
},
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
|
|
10
|
+
"devDependencies": {
|
|
11
|
+
"typescript": "^5.0.0"
|
|
12
|
+
}
|
|
13
13
|
}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
18
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
19
|
+
if (ar || !(i in from)) {
|
|
20
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
21
|
+
ar[i] = from[i];
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
25
|
+
};
|
|
26
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
27
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
28
|
+
};
|
|
29
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
+
var bufferoffsetmanager_1 = __importDefault(require("../util/account/bufferoffsetmanager"));
|
|
31
|
+
var ITEM_SIZE = 10;
|
|
32
|
+
var BufferManager = /** @class */ (function (_super) {
|
|
33
|
+
__extends(BufferManager, _super);
|
|
34
|
+
function BufferManager(globe, gl, buffer, _a) {
|
|
35
|
+
var _b = _a === void 0 ? {} : _a, _c = _b.initialCapacity, initialCapacity = _c === void 0 ? 10 : _c, _d = _b.bufferType, bufferType = _d === void 0 ? "DYNAMIC_DRAW" : _d;
|
|
36
|
+
var _this = _super.call(this, ITEM_SIZE, { capacity: initialCapacity }) || this;
|
|
37
|
+
_this.globe = globe;
|
|
38
|
+
_this.gl = gl;
|
|
39
|
+
_this.buffer = buffer;
|
|
40
|
+
_this.bufferType = bufferType;
|
|
41
|
+
gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
|
|
42
|
+
gl.bufferData(gl.ARRAY_BUFFER, initialCapacity * ITEM_SIZE * 4, gl[bufferType]);
|
|
43
|
+
gl.bindBuffer(gl.ARRAY_BUFFER, null);
|
|
44
|
+
return _this;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
*
|
|
48
|
+
* @param { Array<{key, long, lat, startAngle, tailAngle, radius, rgba[4], rgbaMode }>} rings
|
|
49
|
+
* @returns
|
|
50
|
+
*/
|
|
51
|
+
BufferManager.prototype.insertBulk = function (items) {
|
|
52
|
+
if (items.length === 0)
|
|
53
|
+
return;
|
|
54
|
+
this.autoExtendBuffer(items.length);
|
|
55
|
+
var _a = this, gl = _a.gl, buffer = _a.buffer;
|
|
56
|
+
gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
|
|
57
|
+
for (var _i = 0, items_1 = items; _i < items_1.length; _i++) {
|
|
58
|
+
var _b = items_1[_i], key = _b.key, long = _b.long, lat = _b.lat, startAngle = _b.startAngle, tailAngle = _b.tailAngle, rgba = _b.rgba, radius = _b.radius, rgbaMode = _b.rgbaMode;
|
|
59
|
+
var offset = this.getOffset(key) | this.nextOffset();
|
|
60
|
+
this.setOffset(key, offset);
|
|
61
|
+
var block = new Float32Array(__spreadArray(__spreadArray([
|
|
62
|
+
long, lat, startAngle, tailAngle
|
|
63
|
+
], rgba, true), [
|
|
64
|
+
radius, rgbaMode
|
|
65
|
+
], false));
|
|
66
|
+
gl.bufferSubData(gl.ARRAY_BUFFER, offset, block);
|
|
67
|
+
// 2 1 1 1 4 1 = 10
|
|
68
|
+
}
|
|
69
|
+
gl.bindBuffer(gl.ARRAY_BUFFER, null);
|
|
70
|
+
this.globe.DrawRender();
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* @param {Array<{key, long, lat, startAngle, tailAngle}>} items
|
|
74
|
+
*
|
|
75
|
+
* */
|
|
76
|
+
BufferManager.prototype.updateCenterAndAngleBulk = function (items) {
|
|
77
|
+
var _a = this, gl = _a.gl, buffer = _a.buffer;
|
|
78
|
+
gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
|
|
79
|
+
for (var _i = 0, items_2 = items; _i < items_2.length; _i++) {
|
|
80
|
+
var _b = items_2[_i], key = _b.key, long = _b.long, lat = _b.lat, startAngle = _b.startAngle, tailAngle = _b.tailAngle;
|
|
81
|
+
var offset = this.getOffset(key);
|
|
82
|
+
if (offset === null) {
|
|
83
|
+
console.warn("key ".concat(key, " not found"));
|
|
84
|
+
continue;
|
|
85
|
+
}
|
|
86
|
+
var block = new Float32Array([long, lat, startAngle, tailAngle]);
|
|
87
|
+
gl.bufferSubData(gl.ARRAY_BUFFER, offset, block);
|
|
88
|
+
}
|
|
89
|
+
gl.bindBuffer(gl.ARRAY_BUFFER, null);
|
|
90
|
+
this.globe.DrawRender();
|
|
91
|
+
};
|
|
92
|
+
/**
|
|
93
|
+
*
|
|
94
|
+
* @param {Array<{key:string, payload:Float32Array}} items
|
|
95
|
+
* @param {PART_OFFSET_LOOPUP} part | long, lat, START_ANGLE, ROTATION_ANGLE, RADIUS, rgba, rgba_MODE
|
|
96
|
+
* @returns
|
|
97
|
+
*/
|
|
98
|
+
BufferManager.prototype.updatePartial = function (items, part) {
|
|
99
|
+
var _a = this, gl = _a.gl, buffer = _a.buffer;
|
|
100
|
+
this._updatePartial(items, part, gl, buffer);
|
|
101
|
+
this.globe.DrawRender();
|
|
102
|
+
};
|
|
103
|
+
BufferManager.prototype.deleteBulk = function (keys) {
|
|
104
|
+
this._deleteBulk(keys);
|
|
105
|
+
this.globe.DrawRender();
|
|
106
|
+
};
|
|
107
|
+
BufferManager.prototype.free = function () {
|
|
108
|
+
this.gl.deleteBuffer(this.buffer);
|
|
109
|
+
this.buffer = null;
|
|
110
|
+
};
|
|
111
|
+
return BufferManager;
|
|
112
|
+
}(bufferoffsetmanager_1.default));
|
|
113
|
+
exports.default = BufferManager;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.PART_OFFSET_LOOPUP = exports.RINGPARTIAL_DRAW_MODE = exports.RINGPARTIAL_ALPHA_MODE = exports.PartialRing = void 0;
|
|
37
|
+
var plugin_1 = __importStar(require("./plugin"));
|
|
38
|
+
exports.PartialRing = plugin_1.default;
|
|
39
|
+
Object.defineProperty(exports, "RINGPARTIAL_ALPHA_MODE", { enumerable: true, get: function () { return plugin_1.RINGPARTIAL_ALPHA_MODE; } });
|
|
40
|
+
Object.defineProperty(exports, "RINGPARTIAL_DRAW_MODE", { enumerable: true, get: function () { return plugin_1.RINGPARTIAL_DRAW_MODE; } });
|
|
41
|
+
Object.defineProperty(exports, "PART_OFFSET_LOOPUP", { enumerable: true, get: function () { return plugin_1.PART_OFFSET_LOOPUP; } });
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
18
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
19
|
+
if (ar || !(i in from)) {
|
|
20
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
21
|
+
ar[i] = from[i];
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
25
|
+
};
|
|
26
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
27
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
28
|
+
};
|
|
29
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
+
exports.PART_OFFSET_LOOPUP = exports.RINGPARTIAL_ALPHA_MODE = exports.RINGPARTIAL_DRAW_MODE = void 0;
|
|
31
|
+
var bufferoffsetmanager_1 = __importDefault(require("../util/account/bufferoffsetmanager"));
|
|
32
|
+
var program_1 = require("./program");
|
|
33
|
+
var typecheck_1 = require("../util/check/typecheck");
|
|
34
|
+
var emptyBlock = new Float32Array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
|
|
35
|
+
exports.RINGPARTIAL_DRAW_MODE = Object.freeze({
|
|
36
|
+
LINE_STRIP: "LINE_STRIP",
|
|
37
|
+
TRIANGLE_FAN: "TRIANGLE_FAN",
|
|
38
|
+
});
|
|
39
|
+
exports.RINGPARTIAL_ALPHA_MODE = Object.freeze({
|
|
40
|
+
CONSTANT: 0,
|
|
41
|
+
FADING: 1,
|
|
42
|
+
HIDE: 2,
|
|
43
|
+
});
|
|
44
|
+
exports.PART_OFFSET_LOOPUP = Object.freeze({
|
|
45
|
+
LONG: 0,
|
|
46
|
+
LAT: 1,
|
|
47
|
+
START_ANGLE: 2,
|
|
48
|
+
TAIL_ANGLE: 3,
|
|
49
|
+
RGBA: 4,
|
|
50
|
+
RADIUS: 8,
|
|
51
|
+
RGBA_MODE: 9,
|
|
52
|
+
});
|
|
53
|
+
var default_1 = /** @class */ (function () {
|
|
54
|
+
function default_1(id, _a) {
|
|
55
|
+
var _b = _a === void 0 ? {} : _a, _c = _b.edgeCount, edgeCount = _c === void 0 ? 10 : _c, _d = _b.drawMode, drawMode = _d === void 0 ? exports.RINGPARTIAL_DRAW_MODE.LINE_STRIP : _d, _e = _b.startLod, startLod = _e === void 0 ? 3 : _e, _f = _b.endLod, endLod = _f === void 0 ? 13 : _f, _g = _b.alphaMultiplier, alphaMultiplier = _g === void 0 ? 1 : _g;
|
|
56
|
+
this.id = id;
|
|
57
|
+
this.edgeCount = edgeCount;
|
|
58
|
+
this.drawMode = drawMode;
|
|
59
|
+
this.startLod = startLod;
|
|
60
|
+
this.endLod = endLod;
|
|
61
|
+
this.alphaMultiplier = alphaMultiplier;
|
|
62
|
+
}
|
|
63
|
+
default_1.prototype.init = function (globe, gl) {
|
|
64
|
+
this.gl = gl;
|
|
65
|
+
this.globe = globe;
|
|
66
|
+
this.program = program_1.programCache.get(globe);
|
|
67
|
+
var _a = this.program.getVaoBuffer(), vao = _a.vao, buffer = _a.buffer;
|
|
68
|
+
this.vao = vao;
|
|
69
|
+
this.buffer = buffer;
|
|
70
|
+
};
|
|
71
|
+
default_1.prototype.draw3D = function () {
|
|
72
|
+
var LOD = this.globe.api_GetCurrentLOD();
|
|
73
|
+
if (LOD < this.startLod || LOD > this.endLod)
|
|
74
|
+
return;
|
|
75
|
+
this.program.draw(this.bufferManager.length, this.vao, this.edgeCount, this.alphaMultiplier, this.drawMode);
|
|
76
|
+
};
|
|
77
|
+
/**
|
|
78
|
+
*
|
|
79
|
+
* @param {RINGPARTIAL_DRAW_MODE} drawMode
|
|
80
|
+
*/
|
|
81
|
+
default_1.prototype.setDrawMode = function (drawMode) {
|
|
82
|
+
this.drawMode = drawMode;
|
|
83
|
+
};
|
|
84
|
+
default_1.prototype.setOpacity = function (opacity) {
|
|
85
|
+
(0, typecheck_1.opacityCheck)(opacity);
|
|
86
|
+
this.alphaMultiplier = opacity;
|
|
87
|
+
};
|
|
88
|
+
default_1.prototype.setStartEndLOD = function (_a) {
|
|
89
|
+
var _b = _a === void 0 ? {} : _a, _c = _b.startLod, startLod = _c === void 0 ? null : _c, _d = _b.endLod, endLod = _d === void 0 ? null : _d;
|
|
90
|
+
if (startLod !== null)
|
|
91
|
+
this.startLod = startLod;
|
|
92
|
+
if (endLod !== null)
|
|
93
|
+
this.endLod = endLod;
|
|
94
|
+
};
|
|
95
|
+
default_1.prototype.createBufferMAnager = function (initialCapacity, bufferType) {
|
|
96
|
+
if (initialCapacity === void 0) { initialCapacity = 10; }
|
|
97
|
+
if (bufferType === void 0) { bufferType = 'DYNAMIC_DRAW'; }
|
|
98
|
+
if (!this.bufferManager) {
|
|
99
|
+
this.bufferManager = new BufferManager(this.globe, this.gl, this.buffer, { initialCapacity: initialCapacity, bufferType: bufferType, });
|
|
100
|
+
}
|
|
101
|
+
return this.bufferManager;
|
|
102
|
+
};
|
|
103
|
+
default_1.prototype.free = function () {
|
|
104
|
+
program_1.programCache.free(this.globe);
|
|
105
|
+
this.bufferManager.free();
|
|
106
|
+
};
|
|
107
|
+
return default_1;
|
|
108
|
+
}());
|
|
109
|
+
exports.default = default_1;
|
|
110
|
+
var BufferManager = /** @class */ (function (_super) {
|
|
111
|
+
__extends(BufferManager, _super);
|
|
112
|
+
function BufferManager(globe, gl, buffer, _a) {
|
|
113
|
+
var _b = _a === void 0 ? {} : _a, _c = _b.initialCapacity, initialCapacity = _c === void 0 ? 10 : _c, bufferType = _b.bufferType;
|
|
114
|
+
var _this = _super.call(this, 10, { capacity: initialCapacity, bufferType: bufferType, }) || this;
|
|
115
|
+
_this.globe = globe;
|
|
116
|
+
_this.gl = gl;
|
|
117
|
+
_this.buffer = buffer;
|
|
118
|
+
_this.bufferType = bufferType;
|
|
119
|
+
gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
|
|
120
|
+
gl.bufferData(gl.ARRAY_BUFFER, initialCapacity * program_1.ITEM_SIZE * 4, gl[bufferType]);
|
|
121
|
+
gl.bindBuffer(gl.ARRAY_BUFFER, null);
|
|
122
|
+
return _this;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
*
|
|
126
|
+
* @param { Array<{key, long, lat, startAngle, tailAngle, radius, rgba[4], rgbaMode }>} rings
|
|
127
|
+
* @returns
|
|
128
|
+
*/
|
|
129
|
+
BufferManager.prototype.insertBulk = function (items) {
|
|
130
|
+
if (items.length === 0)
|
|
131
|
+
return;
|
|
132
|
+
this.autoExtendBuffer(items.length);
|
|
133
|
+
var _a = this, gl = _a.gl, buffer = _a.buffer;
|
|
134
|
+
gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
|
|
135
|
+
for (var _i = 0, items_1 = items; _i < items_1.length; _i++) {
|
|
136
|
+
var _b = items_1[_i], key = _b.key, long = _b.long, lat = _b.lat, startAngle = _b.startAngle, tailAngle = _b.tailAngle, rgba = _b.rgba, radius = _b.radius, rgbaMode = _b.rgbaMode;
|
|
137
|
+
var offset = this.getOffset(key) | this.nextOffset();
|
|
138
|
+
this.setOffset(key, offset);
|
|
139
|
+
var block = new Float32Array(__spreadArray(__spreadArray([
|
|
140
|
+
long, lat, startAngle, tailAngle
|
|
141
|
+
], rgba, true), [
|
|
142
|
+
radius, rgbaMode
|
|
143
|
+
], false));
|
|
144
|
+
gl.bufferSubData(gl.ARRAY_BUFFER, offset, block);
|
|
145
|
+
// 2 1 1 1 4 1 = 10
|
|
146
|
+
}
|
|
147
|
+
gl.bindBuffer(gl.ARRAY_BUFFER, null);
|
|
148
|
+
this.globe.DrawRender();
|
|
149
|
+
};
|
|
150
|
+
/**
|
|
151
|
+
*
|
|
152
|
+
* @param {Array<{key:string, payload:Float32Array}} items
|
|
153
|
+
* @param {PART_OFFSET_LOOPUP} part | long, lat, START_ANGLE, ROTATION_ANGLE, RADIUS, rgba, rgba_MODE
|
|
154
|
+
* @returns
|
|
155
|
+
*/
|
|
156
|
+
BufferManager.prototype.updatePartial = function (items, part) {
|
|
157
|
+
var _a = this, gl = _a.gl, buffer = _a.buffer;
|
|
158
|
+
this._updatePartial(items, part, gl, buffer);
|
|
159
|
+
this.globe.DrawRender();
|
|
160
|
+
};
|
|
161
|
+
BufferManager.prototype.delete = function (keys) {
|
|
162
|
+
var _a = this, gl = _a.gl, buffer = _a.buffer;
|
|
163
|
+
this._removefromBuffer(gl, buffer, keys, emptyBlock);
|
|
164
|
+
this.globe.DrawRender();
|
|
165
|
+
};
|
|
166
|
+
BufferManager.prototype.free = function () {
|
|
167
|
+
this.gl.deleteBuffer(this.buffer);
|
|
168
|
+
this.buffer = null;
|
|
169
|
+
};
|
|
170
|
+
return BufferManager;
|
|
171
|
+
}(bufferoffsetmanager_1.default));
|