@pirireis/webglobeplugins 0.16.4 → 0.17.0
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 +1 -0
- package/Math/arc.js +92 -2
- package/Math/circle-cdf-points.js +2 -2
- package/Math/circle.js +2 -2
- package/Math/contour/quadtreecontours.js +300 -0
- package/Math/finite-line-2d.js +58 -0
- package/Math/juction/arc-plane.js +67 -12
- package/Math/juction/line-sphere.js +6 -6
- package/Math/juction/plane-plane.js +4 -6
- package/Math/methods.js +5 -5
- package/Math/templete-shapes/grid-visually-equal.js +0 -1
- package/Math/tessellation/earcut/adapters.js +37 -0
- package/Math/tessellation/hybrid-triangle-tessellation-meta.js +123 -0
- package/Math/tessellation/methods.js +46 -0
- package/Math/tessellation/shred-input.js +18 -0
- package/Math/tessellation/tile-merger.js +56 -0
- package/Math/tessellation/tiler.js +50 -0
- package/Math/tessellation/triangle-tessellation-meta.js +516 -0
- package/Math/tessellation/triangle-tessellation.js +14 -0
- package/Math/tessellation/zoom-catch.js +1 -0
- package/Math/vec3.js +26 -1
- package/compass-rose/compass-text-writer.js +39 -33
- package/constants.js +3 -0
- package/{util/heatwavedatamanager → heatwave}/datamanager.js +1 -1
- package/heatwave/{plugins/heatwaveglobeshell.js → heatwave.js} +8 -6
- package/heatwave/index.js +5 -3
- package/heatwave/{isobar/plugin.js → isobar.js} +6 -5
- package/{util/heatwavedatamanager → heatwave}/texture-point-sampler.js +24 -3
- package/package.json +7 -3
- package/programs/arrowfield/{object.js → arrow-field.js} +1 -1
- package/programs/arrowfield/logic.js +1 -1
- package/programs/data2legend/density-to-legend.js +24 -29
- package/programs/data2legend/point-to-density-texture.js +14 -17
- package/programs/float2legendwithratio/logic.js +2 -2
- package/programs/float2legendwithratio/object.js +1 -1
- package/programs/helpers/{blender/program.js → blender.js} +1 -1
- package/programs/helpers/{fadeaway/logic.js → fadeaway.js} +11 -2
- package/programs/index.js +20 -9
- package/programs/line-on-globe/circle-accurate-3d.js +12 -14
- package/programs/line-on-globe/circle-accurate-flat.js +0 -1
- package/programs/line-on-globe/degree-padding-around-circle-3d.js +13 -15
- package/programs/line-on-globe/lines-color-instanced-flat.js +15 -18
- package/programs/line-on-globe/naive-accurate-flexible.js +0 -1
- package/programs/picking/pickable-polygon-renderer.js +1 -1
- package/programs/picking/pickable-renderer.js +2 -2
- package/programs/point-on-globe/element-globe-surface-glow.js +2 -2
- package/programs/point-on-globe/element-point-glow.js +1 -1
- package/programs/point-on-globe/square-pixel-point.js +1 -1
- package/programs/polygon-on-globe/texture-dem-triangle-test-plugin-triangle.js +204 -0
- package/programs/polygon-on-globe/texture-dem-triangle-test-plugin.js +31 -10
- package/programs/polygon-on-globe/texture-dem-triangles.js +81 -12
- package/programs/rings/partial-ring/piece-of-pie.js +26 -29
- package/programs/totems/camerauniformblock.js +34 -45
- package/programs/two-d/pixel-padding-for-compass.js +14 -24
- package/programs/vectorfields/logics/drawrectangleparticles.js +1 -2
- package/programs/vectorfields/logics/pixelbased.js +1 -2
- package/programs/vectorfields/pingpongbuffermanager.js +1 -1
- package/range-tools-on-terrain/bearing-line/adapters.js +1 -1
- package/range-tools-on-terrain/circle-line-chain/adapters.js +0 -5
- package/range-tools-on-terrain/circle-line-chain/plugin.js +1 -1
- package/range-tools-on-terrain/range-ring/plugin.js +4 -6
- package/semiplugins/lightweight/line-plugin.js +0 -1
- package/semiplugins/shape-on-terrain/arc-plugin.js +5 -7
- package/semiplugins/shape-on-terrain/circle-plugin.js +2 -2
- package/semiplugins/shape-on-terrain/padding-1-degree.js +1 -2
- package/semiplugins/shell/bbox-renderer/index.js +2 -0
- package/{programs/globeshell/wiggle → semiplugins/shell/bbox-renderer}/logic.js +101 -102
- package/{programs/globeshell/wiggle → semiplugins/shell/bbox-renderer}/object.js +6 -7
- package/semiplugins/utility/container-plugin.js +94 -0
- package/semiplugins/utility/object-pass-container-plugin.js +80 -0
- package/{point-heat-map → tracks/point-heat-map}/adaptors/timetracksplugin-format-to-this.js +1 -1
- package/{point-heat-map → tracks/point-heat-map}/plugin-webworker.js +3 -3
- package/{point-heat-map → tracks/point-heat-map}/point-to-heat-map-flow.js +11 -14
- package/{point-tracks → tracks/point-tracks}/plugin.js +5 -5
- package/{timetracks → tracks/timetracks}/adaptors-line-strip.js +1 -1
- package/{timetracks → tracks/timetracks}/program-line-strip.js +49 -49
- package/{timetracks → tracks/timetracks}/programpoint-line-strip.js +16 -13
- package/types.js +6 -0
- package/util/account/bufferoffsetmanager.js +1 -1
- package/util/account/single-attribute-buffer-management/buffer-orchestrator.js +9 -95
- package/util/gl-util/uniform-block/manager.js +4 -5
- package/util/gl-util/uniform-block/types.js +0 -7
- package/util/index.js +10 -13
- package/util/picking/fence.js +16 -18
- package/util/picking/picker-displayer.js +4 -6
- package/util/programs/{shapesonglobe.js → draw-from-pixel-coords.js} +4 -7
- package/util/programs/draw-texture-on-canvas.js +1 -1
- package/util/programs/texturetoglobe.js +3 -3
- package/util/shaderfunctions/geometrytransformations.js +6 -0
- package/util/webglobe/rasteroverlay.js +1 -0
- package/vectorfield/arrowfield/index.js +3 -0
- package/{arrowfield → vectorfield/arrowfield}/plugin.js +2 -2
- package/{waveparticles → vectorfield/waveparticles}/plugin.js +12 -12
- package/{wind → vectorfield/wind}/index.js +1 -1
- package/{wind → vectorfield/wind}/plugin.js +32 -32
- package/write-text/attached-text-writer.js +9 -1
- package/write-text/context-text3.js +0 -1
- package/write-text/objectarraylabels/index.js +2 -0
- package/Math/mesh/mapbox-delaunay.js +0 -544
- package/arrowfield/index.js +0 -3
- package/bearing-line/index.js +0 -2
- package/bearing-line/plugin.js +0 -444
- package/circle-line-chain/chain-list-map.js +0 -201
- package/circle-line-chain/plugin.js +0 -411
- package/circle-line-chain/util.js +0 -1
- package/compassrose/compassrose.js +0 -293
- package/compassrose/index.js +0 -2
- package/index.js +0 -12
- package/partialrings/buffer-manager.js +0 -75
- package/partialrings/index.js +0 -2
- package/partialrings/plugin.js +0 -128
- package/partialrings/program.js +0 -279
- package/programs/arrowfield/index.js +0 -2
- package/programs/globe-util/is-globe-moved.js +0 -19
- package/programs/globeshell/index.js +0 -2
- package/programs/globeshell/wiggle/index.js +0 -2
- package/programs/helpers/blender/index.js +0 -1
- package/programs/helpers/fadeaway/index.js +0 -2
- package/programs/helpers/fadeaway/object.js +0 -14
- package/programs/helpers/index.js +0 -2
- package/programs/rings/distancering/circleflatprogram.js +0 -116
- package/programs/rings/distancering/circlepaddingfreeangleprogram.js +0 -326
- package/programs/rings/distancering/circlepaddysharedbuffer.js +0 -368
- package/programs/rings/distancering/index.js +0 -6
- package/programs/rings/distancering/paddyflatprogram.js +0 -127
- package/programs/rings/distancering/paddyflatprogram2d.js +0 -129
- package/programs/rings/distancering/paddyflatprogram3d.js +0 -128
- package/programs/two-d/pixel-circle.js +0 -1
- package/programs/vectorfields/index.js +0 -3
- package/rangerings/enum.js +0 -2
- package/rangerings/index.js +0 -5
- package/rangerings/plugin.js +0 -543
- package/rangerings/rangeringangletext.js +0 -326
- package/rangerings/ring-account.js +0 -112
- package/timetracks/index.js +0 -1
- package/util/build-strategy/general-strategy.js +0 -62
- package/util/gl-util/uniform-block/shader.js +0 -1
- package/util/heatwavedatamanager/index.js +0 -2
- package/util/heatwavedatamanager/pointcoordsmeta.js +0 -22
- package/util/jshelpers/data-filler.js +0 -17
- package/util/jshelpers/equality.js +0 -18
- package/util/jshelpers/index.js +0 -2
- package/util/jshelpers/timefilters.js +0 -30
- package/util/programs/index.js +0 -1
- package/util/surface-line-data/arc-bboxes.js +0 -25
- package/util/surface-line-data/arcs-to-cuts.js +0 -50
- package/util/surface-line-data/cut-arc.js +0 -1
- package/util/surface-line-data/flow.js +0 -28
- package/util/surface-line-data/rbush-manager.js +0 -1
- package/util/surface-line-data/web-worker.js +0 -1
- package/write-text/context-text3old.js +0 -152
- package/write-text/index.js +0 -1
- package/write-text/writer-plugin.js +0 -8
- /package/{heatwave/isobar/quadtreecontours.js → Math/contour/quadtreecontours1.js} +0 -0
- /package/{util/surface-line-data → Math/tessellation}/types.js +0 -0
- /package/pin/{pin-object-array.js → pin-object-array1.js} +0 -0
- /package/pin/{pin-point-totem.js → pin-point-totem1.js} +0 -0
- /package/{circle-line-chain/init.js → programs/polygon-on-globe/partial-tesselation.js} +0 -0
- /package/{point-heat-map → tracks/point-heat-map}/index.js +0 -0
- /package/{point-tracks → tracks/point-tracks}/key-methods.js +0 -0
- /package/{timetracks → tracks/timetracks}/plugin-line-strip.js +0 -0
- /package/{arrowfield → vectorfield/arrowfield}/adaptor.js +0 -0
- /package/{waveparticles → vectorfield/waveparticles}/adaptor.js +0 -0
- /package/{waveparticles → vectorfield/waveparticles}/index.js +0 -0
- /package/{wind → vectorfield/wind}/imagetovectorfieldandmagnitude.js +0 -0
- /package/{wind → vectorfield/wind}/vectorfieldimage.js +0 -0
- /package/write-text/{context-text.js → context-textDELETE.js} +0 -0
- /package/{heatwave/isobar → write-text/objectarraylabels}/objectarraylabels.js +0 -0
|
@@ -1,17 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
// textFont: {
|
|
4
|
-
// name: 'Arial',
|
|
5
|
-
// textColor: '#FFFFFF', // beyaz
|
|
6
|
-
// hollowColor: '#000000', // siyah
|
|
7
|
-
// size: 12, // piksel
|
|
8
|
-
// hollow: true,
|
|
9
|
-
// bold: true,
|
|
10
|
-
// italic: false,
|
|
11
|
-
// },
|
|
12
|
-
// opacity: 1.0,
|
|
13
|
-
// zMode: CSZMode.Z_GROUND_PERVERTEX,
|
|
14
|
-
// }
|
|
1
|
+
// filepath: d:\webglobeplugins\webglobePlugin\src\webglobeplugins\compass-rose\compass-text-writer.ts
|
|
2
|
+
import { CSMeasureTextPositionTypes } from "@pirireis/webglobe";
|
|
15
3
|
/**
|
|
16
4
|
* TODOs:
|
|
17
5
|
* 1) update all if initials change (propably need a context and a callback to iterate over data)
|
|
@@ -21,19 +9,32 @@ import { CSZMode, CSMeasureTextPositionTypes } from "@pirireis/webglobe";
|
|
|
21
9
|
const yGapFit = -2;
|
|
22
10
|
const xGapFit = -5;
|
|
23
11
|
export class PixelPaddingCompassTextWriter {
|
|
12
|
+
globe;
|
|
13
|
+
itemMap;
|
|
14
|
+
font;
|
|
15
|
+
northFont;
|
|
16
|
+
doDraw;
|
|
17
|
+
angle;
|
|
18
|
+
angles;
|
|
19
|
+
texts;
|
|
20
|
+
positions;
|
|
21
|
+
_lastNorthAngle;
|
|
22
|
+
offsets;
|
|
23
|
+
keyAdaptor;
|
|
24
|
+
opacity;
|
|
24
25
|
constructor(globe, { font = {
|
|
25
26
|
name: 'Arial',
|
|
26
|
-
textColor: '#FFFFFF',
|
|
27
|
-
hollowColor: '#000000',
|
|
28
|
-
size: 12,
|
|
27
|
+
textColor: '#FFFFFF',
|
|
28
|
+
hollowColor: '#000000',
|
|
29
|
+
size: 12,
|
|
29
30
|
hollow: true,
|
|
30
31
|
bold: true,
|
|
31
32
|
italic: false,
|
|
32
33
|
}, northFont = {
|
|
33
34
|
name: 'Arial',
|
|
34
|
-
textColor: '#BB0000',
|
|
35
|
-
hollowColor: '#000000',
|
|
36
|
-
size: 14,
|
|
35
|
+
textColor: '#BB0000',
|
|
36
|
+
hollowColor: '#000000',
|
|
37
|
+
size: 14,
|
|
37
38
|
hollow: true,
|
|
38
39
|
bold: true,
|
|
39
40
|
italic: false,
|
|
@@ -56,17 +57,16 @@ export class PixelPaddingCompassTextWriter {
|
|
|
56
57
|
this.positions.push(null);
|
|
57
58
|
}
|
|
58
59
|
this.angles.push(currentAngle);
|
|
59
|
-
if (currentAngle
|
|
60
|
+
if (currentAngle === 0) {
|
|
60
61
|
this.texts.push("K");
|
|
61
62
|
}
|
|
62
63
|
else {
|
|
63
|
-
// to string 3 chars fill left with 0
|
|
64
64
|
this.texts.push(currentAngle.toString().padStart(3, '0'));
|
|
65
65
|
}
|
|
66
66
|
currentAngle += this.angle;
|
|
67
67
|
}
|
|
68
68
|
this._lastNorthAngle = globe.api_GetCurrentLookInfo()["NorthAng"] * (Math.PI / 180);
|
|
69
|
-
this.offsets = this.__offset(
|
|
69
|
+
this.offsets = this.__offset();
|
|
70
70
|
}
|
|
71
71
|
setKeyAdaptor(adaptor) {
|
|
72
72
|
this.keyAdaptor = adaptor;
|
|
@@ -86,7 +86,6 @@ export class PixelPaddingCompassTextWriter {
|
|
|
86
86
|
_checkSetOffsets() {
|
|
87
87
|
const { globe } = this;
|
|
88
88
|
const newAngle = globe.api_GetCurrentLookInfo()["NorthAng"] * (Math.PI / 180);
|
|
89
|
-
;
|
|
90
89
|
if (newAngle !== this._lastNorthAngle) {
|
|
91
90
|
this._lastNorthAngle = newAngle;
|
|
92
91
|
this.offsets = this.__offset();
|
|
@@ -96,42 +95,49 @@ export class PixelPaddingCompassTextWriter {
|
|
|
96
95
|
if (!this.doDraw)
|
|
97
96
|
return;
|
|
98
97
|
const { globe, font, opacity: opacity_, northFont, itemMap, texts, angles, positions } = this;
|
|
99
|
-
this._checkSetOffsets();
|
|
98
|
+
this._checkSetOffsets();
|
|
100
99
|
const offsets = this.offsets;
|
|
101
100
|
for (const [key, { center, radius, opacity = null }] of itemMap) {
|
|
102
|
-
const o = opacity === null ? opacity_ : opacity * opacity_;
|
|
103
|
-
if (center
|
|
101
|
+
const o = opacity === null ? (opacity_ ?? 1.0) : opacity * (opacity_ ?? 1.0);
|
|
102
|
+
if (center && radius !== undefined) {
|
|
103
|
+
const { x, y } = center;
|
|
104
|
+
if (x === null || y === null)
|
|
105
|
+
continue;
|
|
104
106
|
offsets.forEach(({ offsetX, offsetY }, i) => {
|
|
105
107
|
const text = texts[i];
|
|
106
108
|
const angle = angles[i];
|
|
107
109
|
font.position = positions[i];
|
|
108
110
|
if (angle === 0) {
|
|
109
|
-
globe.api_DrawContextTextMultiLine(text, northFont, o, { x:
|
|
111
|
+
globe.api_DrawContextTextMultiLine(text, northFont, o, { x: x + offsetX * radius + xGapFit, y: y + offsetY * radius + yGapFit });
|
|
110
112
|
}
|
|
111
113
|
else {
|
|
112
|
-
globe.api_DrawContextTextMultiLine(text, font, o, { x:
|
|
114
|
+
globe.api_DrawContextTextMultiLine(text, font, o, { x: x + offsetX * radius + xGapFit, y: y + offsetY * radius + yGapFit });
|
|
113
115
|
}
|
|
114
116
|
});
|
|
115
117
|
}
|
|
116
118
|
}
|
|
117
119
|
}
|
|
118
|
-
insertTextItem(key, x, y, radius
|
|
120
|
+
insertTextItem(key, x, y, radius) {
|
|
119
121
|
const item = this.getItem(key);
|
|
120
122
|
item.center = { x, y };
|
|
121
123
|
if (radius === undefined)
|
|
122
124
|
return;
|
|
123
|
-
if (item.radius
|
|
125
|
+
if (item.radius !== undefined && item.radius === radius)
|
|
124
126
|
return;
|
|
125
127
|
item.radius = radius;
|
|
126
128
|
}
|
|
127
129
|
getItem(key) {
|
|
128
|
-
if (!this.itemMap.has(key))
|
|
130
|
+
if (!this.itemMap.has(key)) {
|
|
129
131
|
this.itemMap.set(key, {});
|
|
132
|
+
}
|
|
130
133
|
return this.itemMap.get(key);
|
|
131
134
|
}
|
|
132
135
|
__calculateOffset(angle) {
|
|
133
136
|
const rAngle = (angle - 90) * (Math.PI / 180);
|
|
134
|
-
return {
|
|
137
|
+
return {
|
|
138
|
+
offsetX: Math.cos(rAngle + this._lastNorthAngle),
|
|
139
|
+
offsetY: Math.sin(rAngle + this._lastNorthAngle)
|
|
140
|
+
};
|
|
135
141
|
}
|
|
136
142
|
__offset() {
|
|
137
143
|
const angle = this.angle;
|
package/constants.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { getColorRampModed
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { getColorRampModed } from "../util/webglobjectbuilders";
|
|
2
|
+
import { DataManager } from "./datamanager";
|
|
3
|
+
import { TexturePointSampler } from "./texture-point-sampler";
|
|
4
|
+
import { BBOXGlobeShell } from "../semiplugins/shell/bbox-renderer";
|
|
5
|
+
import { Float2LegendWithRatio } from "../programs/float2legendwithratio";
|
|
6
|
+
import { opacityCheck } from "../util/check/typecheck";
|
|
5
7
|
/**
|
|
6
8
|
* @param id : string
|
|
7
9
|
* @param dataManager : DataManager
|
|
@@ -9,7 +11,7 @@ import { opacityCheck } from "../../util/check/typecheck";
|
|
|
9
11
|
* @param dataWidthHeight : {width: number, height: number}
|
|
10
12
|
* @param options : {bbox: number[], minMaxEdges: {min: number, max: number}, escapeValue: number, resolution: number[], meshPartition: number[]}
|
|
11
13
|
*/
|
|
12
|
-
export
|
|
14
|
+
export class HeatWavePlugin {
|
|
13
15
|
constructor(id, dataManager, colorRampData, dataWidthHeight, { bbox = [-180, -90, 180, 90], minMaxEdges = { min: -99999, max: 99999 }, escapeValue = 99999, resolution = [2056, 2056], yFlip = true, } = {}) {
|
|
14
16
|
this.id = id;
|
|
15
17
|
this.dataManager = dataManager;
|
|
@@ -152,7 +154,7 @@ export default class HeatWaveGlobeShellPlugin {
|
|
|
152
154
|
this.setEscapeValue(this._escapeValue);
|
|
153
155
|
}
|
|
154
156
|
_init(globe, gl) {
|
|
155
|
-
this.globeShell = new
|
|
157
|
+
this.globeShell = new BBOXGlobeShell(gl, globe, {
|
|
156
158
|
minLon: this._bbox[0],
|
|
157
159
|
minLat: this._bbox[1],
|
|
158
160
|
maxLon: this._bbox[2],
|
package/heatwave/index.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import { DataManager } from "./datamanager.js";
|
|
2
|
+
import { HeatWavePlugin } from "./heatwave.js";
|
|
3
|
+
import { IsobarRasterToVector } from "./isobar.js";
|
|
4
|
+
import { TexturePointSampler } from "./texture-point-sampler";
|
|
5
|
+
export { DataManager, HeatWavePlugin, IsobarRasterToVector, TexturePointSampler };
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
1
|
+
import { DrawFromPixelCoords, } from "../util/programs/draw-from-pixel-coords";
|
|
2
|
+
import { latLongToPixelXY } from "../util/geometry/index";
|
|
3
|
+
import ContourMipmap, { scaleParameters } from "../Math/contour/quadtreecontours";
|
|
4
|
+
import ObjectArrayLabels from "../write-text/objectarraylabels";
|
|
5
|
+
import { isBoolean, opacityCheck } from "../util/check/typecheck";
|
|
5
6
|
export class IsobarRasterToVector {
|
|
6
7
|
/**
|
|
7
8
|
* @typedef {Object} IsobarData
|
|
@@ -151,7 +152,7 @@ export class IsobarRasterToVector {
|
|
|
151
152
|
init(globe, gl) {
|
|
152
153
|
this.gl = gl;
|
|
153
154
|
this.globe = globe;
|
|
154
|
-
this.program = new
|
|
155
|
+
this.program = new DrawFromPixelCoords(gl, globe, 'line_strip');
|
|
155
156
|
if (this._isLabelsOn) {
|
|
156
157
|
this._createLabelsLayer();
|
|
157
158
|
this._labelsLayer.addToMap();
|
|
@@ -1,4 +1,25 @@
|
|
|
1
|
-
|
|
1
|
+
class PointCoordsMeta {
|
|
2
|
+
_bbox;
|
|
3
|
+
_width;
|
|
4
|
+
_height;
|
|
5
|
+
_xRatio;
|
|
6
|
+
_yRatio;
|
|
7
|
+
constructor(bbox, width, height) {
|
|
8
|
+
this._bbox = bbox;
|
|
9
|
+
this._width = width;
|
|
10
|
+
this._height = height;
|
|
11
|
+
this._xRatio = this._width / (this._bbox[2] - this._bbox[0]);
|
|
12
|
+
this._yRatio = this._height / (this._bbox[3] - this._bbox[1]);
|
|
13
|
+
}
|
|
14
|
+
getFlooredIndex(long, lat) {
|
|
15
|
+
let x = (long - this._bbox[0]) * this._xRatio;
|
|
16
|
+
let y = (this._bbox[3] - lat) * this._yRatio;
|
|
17
|
+
x = x > 0 ? x - 1 : 0;
|
|
18
|
+
y = y > 0 ? y - 1 : 0;
|
|
19
|
+
const index = Math.floor(y) * this._width + Math.floor(x);
|
|
20
|
+
return index;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
2
23
|
const pointObject = (long, lat, posIndex, callback) => {
|
|
3
24
|
return { long, lat, posIndex, callback };
|
|
4
25
|
};
|
|
@@ -103,7 +124,7 @@ export class TexturePointSampler {
|
|
|
103
124
|
}
|
|
104
125
|
flush(callEmptyCallback = false) {
|
|
105
126
|
if (callEmptyCallback) {
|
|
106
|
-
for (const [
|
|
127
|
+
for (const [, { callback }] of this._pointObjects.entries()) {
|
|
107
128
|
callback(null, null, null);
|
|
108
129
|
}
|
|
109
130
|
}
|
|
@@ -141,7 +162,7 @@ export class TexturePointSampler {
|
|
|
141
162
|
}
|
|
142
163
|
}
|
|
143
164
|
else {
|
|
144
|
-
for (const [
|
|
165
|
+
for (const [, { callback }] of this._pointObjects.entries()) {
|
|
145
166
|
callback(null, null, null);
|
|
146
167
|
}
|
|
147
168
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pirireis/webglobeplugins",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.17.0",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"author": "Toprak Nihat Deniz Ozturk",
|
|
6
6
|
"license": "MIT",
|
|
@@ -8,7 +8,11 @@
|
|
|
8
8
|
"build": "tsc"
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"
|
|
11
|
+
"delaunator": "^5.0.1",
|
|
12
|
+
"earcut": "^3.0.2",
|
|
12
13
|
"rbush": "^4.0.1"
|
|
14
|
+
},
|
|
15
|
+
"peerDependencies": {
|
|
16
|
+
"@pirireis/webglobe": "^6.2.22"
|
|
13
17
|
}
|
|
14
|
-
}
|
|
18
|
+
}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import Logic from './logic';
|
|
5
5
|
import { globeProgramCache } from '../programcache';
|
|
6
6
|
import { longlatbbox2normalbbox } from "../util";
|
|
7
|
-
export
|
|
7
|
+
export class ArrowField {
|
|
8
8
|
constructor(gl, globe, { minLon = -180, maxLon = 180, minLat = -90, maxLat = 90, height = 0, opacity = 1, color = [0.04, 0.2, 0.8], targetWidth = 100, targetHeight = 100, dataWidth = null, dataHeight = null, tailLengthRatio = 1, wingLengthRatio = 0.5, noDataValue = null,
|
|
9
9
|
// maxMagnitude = null
|
|
10
10
|
} = {}) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createProgram } from "../../util/";
|
|
1
|
+
import { createProgram } from "../../util/webglobjectbuilders";
|
|
2
2
|
import { noRegisterGlobeProgramCache } from "../programcache";
|
|
3
3
|
const vs = `#version 300 es
|
|
4
4
|
precision highp float;
|
|
@@ -38,34 +38,29 @@ class DensityToLegendProgram {
|
|
|
38
38
|
legendTexture: gl.getUniformLocation(program, "u_legend_texture"),
|
|
39
39
|
opacity: gl.getUniformLocation(program, "u_opacity"),
|
|
40
40
|
};
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
|
|
65
|
-
gl.useProgram(program);
|
|
66
|
-
gl.uniform1f(this.uniforms.opacity, this._lastOpacity);
|
|
67
|
-
gl.useProgram(currentProgram);
|
|
68
|
-
}
|
|
41
|
+
// assign attribute locations
|
|
42
|
+
gl.bindAttribLocation(program, 0, "a_position");
|
|
43
|
+
this.vao = gl.createVertexArray();
|
|
44
|
+
const a_positionLocation = gl.getAttribLocation(program, "a_position");
|
|
45
|
+
gl.bindVertexArray(this.vao);
|
|
46
|
+
const buffer = gl.createBuffer();
|
|
47
|
+
gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
|
|
48
|
+
gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([
|
|
49
|
+
-1, -1,
|
|
50
|
+
1, -1,
|
|
51
|
+
1, 1,
|
|
52
|
+
-1, 1,
|
|
53
|
+
]), gl.STATIC_DRAW);
|
|
54
|
+
gl.enableVertexAttribArray(a_positionLocation);
|
|
55
|
+
gl.vertexAttribPointer(0, 2, gl.FLOAT, false, 0, 0);
|
|
56
|
+
gl.bindVertexArray(null);
|
|
57
|
+
// gl.bindBuffer(gl.ARRAY_BUFFER, null);
|
|
58
|
+
this._buffer = buffer;
|
|
59
|
+
this._lastOpacity = 1;
|
|
60
|
+
const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
|
|
61
|
+
gl.useProgram(program);
|
|
62
|
+
gl.uniform1f(this.uniforms.opacity, this._lastOpacity);
|
|
63
|
+
gl.useProgram(currentProgram);
|
|
69
64
|
}
|
|
70
65
|
draw(densityTexture, legendTexture, opacity) {
|
|
71
66
|
const { gl, program, uniforms } = this;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createProgram } from "../../util/";
|
|
1
|
+
import { createProgram } from "../../util/webglobjectbuilders";
|
|
2
2
|
import { noRegisterGlobeProgramCache } from "../programcache";
|
|
3
3
|
import { CameraUniformBlockTotemCache, CameraUniformBlockString } from "../totems/camerauniformblock";
|
|
4
4
|
import { mercatorXYToGLPosition, cartesian3DToGLPosition } from "../../util/shaderfunctions/geometrytransformations";
|
|
@@ -41,22 +41,19 @@ class PointHeatmapProgram {
|
|
|
41
41
|
this.uniforms = {
|
|
42
42
|
pointSize: gl.getUniformLocation(this.program, "pointSize"),
|
|
43
43
|
};
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
gl.uniform1f(this.uniforms.pointSize, this._lastPointSize);
|
|
58
|
-
gl.useProgram(currentProgram);
|
|
59
|
-
}
|
|
44
|
+
// assign attribute locations
|
|
45
|
+
gl.bindAttribLocation(program, 0, "position");
|
|
46
|
+
// arrange camera uniform block
|
|
47
|
+
this.cameraBlockBingingPoint = 0;
|
|
48
|
+
this.cameraBlockTotem = CameraUniformBlockTotemCache.get(globe);
|
|
49
|
+
const cameraBlockIndex = gl.getUniformBlockIndex(program, "CameraUniformBlock");
|
|
50
|
+
gl.uniformBlockBinding(program, cameraBlockIndex, this.cameraBlockBingingPoint);
|
|
51
|
+
// last values
|
|
52
|
+
this._lastPointSize = 0;
|
|
53
|
+
const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
|
|
54
|
+
gl.useProgram(program);
|
|
55
|
+
gl.uniform1f(this.uniforms.pointSize, this._lastPointSize);
|
|
56
|
+
gl.useProgram(currentProgram);
|
|
60
57
|
}
|
|
61
58
|
createVAO(positionBuffer, vectorSize) {
|
|
62
59
|
const gl = this.gl;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { createProgram } from "
|
|
1
|
+
import { createProgram } from "../../util/webglobjectbuilders";
|
|
2
|
+
import { glProgramCache } from "../programcache";
|
|
2
3
|
const vertexShaderSource = `#version 300 es
|
|
3
4
|
precision highp float;
|
|
4
5
|
in vec2 a_position;
|
|
@@ -24,7 +25,7 @@ void main() {
|
|
|
24
25
|
outColor = vec4(color.rgb, color.a * opacity);
|
|
25
26
|
}
|
|
26
27
|
`;
|
|
27
|
-
|
|
28
|
+
class FadeAwayProgram {
|
|
28
29
|
constructor(gl) {
|
|
29
30
|
this.gl = gl;
|
|
30
31
|
this.program = createProgram(gl, vertexShaderSource, fragmentShaderSource);
|
|
@@ -67,3 +68,11 @@ export default class FadeAwayProgram {
|
|
|
67
68
|
gl.deleteBuffer(_buffer);
|
|
68
69
|
}
|
|
69
70
|
}
|
|
71
|
+
export const FadeAwayProgramCache = Object.freeze({
|
|
72
|
+
get: (gl) => {
|
|
73
|
+
return glProgramCache.getProgram(gl, FadeAwayProgram);
|
|
74
|
+
},
|
|
75
|
+
release: (gl) => {
|
|
76
|
+
return glProgramCache.releaseProgram(gl, FadeAwayProgram);
|
|
77
|
+
}
|
|
78
|
+
});
|
package/programs/index.js
CHANGED
|
@@ -1,9 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import { FadeAway } from "./helpers";
|
|
8
|
-
import * as rings from "./rings";
|
|
9
|
-
export {
|
|
1
|
+
"use strict";
|
|
2
|
+
// import { Float2LegendWithRatio } from "./float2legendwithratio";
|
|
3
|
+
// import { GlobeShellWiggle } from "./globeshell/wiggle";
|
|
4
|
+
// import { CameraUniformBlockTotem, CameraUniformBlockString } from "./totems/index";
|
|
5
|
+
// import ArrowField from "./arrowfield";
|
|
6
|
+
// import { glProgramCache, globeProgramCache, noRegisterGlobeProgramCache } from "./programcache";
|
|
7
|
+
// import { FadeAway } from "./helpers";
|
|
8
|
+
// import * as rings from "./rings";
|
|
9
|
+
// export {
|
|
10
|
+
// Float2LegendWithRatio,
|
|
11
|
+
// GlobeShellWiggle,
|
|
12
|
+
// ArrowField,
|
|
13
|
+
// CameraUniformBlockTotem,
|
|
14
|
+
// CameraUniformBlockString,
|
|
15
|
+
// glProgramCache,
|
|
16
|
+
// globeProgramCache,
|
|
17
|
+
// noRegisterGlobeProgramCache,
|
|
18
|
+
// FadeAway,
|
|
19
|
+
// rings
|
|
20
|
+
// };
|
|
@@ -3,7 +3,7 @@ import { CameraUniformBlockString, CameraUniformBlockTotemCache } from "../totem
|
|
|
3
3
|
import { noRegisterGlobeProgramCache } from "../programcache";
|
|
4
4
|
// import { vaoAttributeLoader } from "../../util/account/util";
|
|
5
5
|
import { attributeLoader } from "../../util/gl-util/buffer/attribute-loader";
|
|
6
|
-
import { cartesian3DToGLPosition,
|
|
6
|
+
import { cartesian3DToGLPosition, circleOnSphere, POLE, PI } from "../../util/shaderfunctions/geometrytransformations";
|
|
7
7
|
/**
|
|
8
8
|
* TODO:
|
|
9
9
|
* 1. integrate geometry functions for radius angle and center
|
|
@@ -77,19 +77,17 @@ class Logic {
|
|
|
77
77
|
this.program.uniforms = {
|
|
78
78
|
opacity: gl.getUniformLocation(program, "opacity")
|
|
79
79
|
};
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
gl.bindAttribLocation(program, 4, "dash_opacity");
|
|
92
|
-
}
|
|
80
|
+
// initial uniform values
|
|
81
|
+
const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
|
|
82
|
+
gl.useProgram(program);
|
|
83
|
+
gl.uniform1f(program.uniforms.opacity, 1.0);
|
|
84
|
+
gl.useProgram(currentProgram);
|
|
85
|
+
// assign attribute locations
|
|
86
|
+
gl.bindAttribLocation(program, 0, "center_position3d");
|
|
87
|
+
gl.bindAttribLocation(program, 1, "target_position3d");
|
|
88
|
+
gl.bindAttribLocation(program, 2, "color");
|
|
89
|
+
gl.bindAttribLocation(program, 3, "dash_ratio");
|
|
90
|
+
gl.bindAttribLocation(program, 4, "dash_opacity");
|
|
93
91
|
this.cameraBindingPoint = 0;
|
|
94
92
|
this.cameraBlockTotem = CameraUniformBlockTotemCache.get(globe);
|
|
95
93
|
const cameraBlockLocation = gl.getUniformBlockIndex(program, "CameraUniformBlock");
|
|
@@ -3,7 +3,6 @@ import { CameraUniformBlockString, CameraUniformBlockTotemCache } from "../totem
|
|
|
3
3
|
import { noRegisterGlobeProgramCache } from "../programcache";
|
|
4
4
|
import { vaoAttributeLoader } from "../../util/account/util";
|
|
5
5
|
import { mercatorXYToGLPosition, POLE } from "../../util/shaderfunctions/geometrytransformations";
|
|
6
|
-
const Pole = 20037508.34;
|
|
7
6
|
/**
|
|
8
7
|
* Warning:
|
|
9
8
|
* Insert the points from the second index and skip 1 point as you placed 361 points
|
|
@@ -84,21 +84,19 @@ class Logic {
|
|
|
84
84
|
stepAngle: gl.getUniformLocation(program, "step_angle"),
|
|
85
85
|
zAlphaMode: gl.getUniformLocation(program, "z_alpha_on")
|
|
86
86
|
};
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
gl.bindAttribLocation(program, 3, "color");
|
|
101
|
-
}
|
|
87
|
+
// initial uniform values
|
|
88
|
+
const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
|
|
89
|
+
gl.useProgram(program);
|
|
90
|
+
gl.uniform1f(program.uniforms.opacity, 1.0);
|
|
91
|
+
gl.uniform1f(program.uniforms.edgeCount, INITIAL_EDGE_COUNT * 2);
|
|
92
|
+
gl.uniform1f(program.uniforms.stepAngle, this._lastStepAngle * Math.PI / 360);
|
|
93
|
+
gl.uniform1i(program.uniforms.zAlphaMode, Z_ALPHA_MODE.ON);
|
|
94
|
+
gl.useProgram(currentProgram);
|
|
95
|
+
// assign attribute locations
|
|
96
|
+
gl.bindAttribLocation(program, 0, "center_position3d");
|
|
97
|
+
gl.bindAttribLocation(program, 1, "big_radius");
|
|
98
|
+
gl.bindAttribLocation(program, 2, "small_radius");
|
|
99
|
+
gl.bindAttribLocation(program, 3, "color");
|
|
102
100
|
this.cameraBindingPoint = 0;
|
|
103
101
|
this.cameraBlockTotem = CameraUniformBlockTotemCache.get(globe);
|
|
104
102
|
const cameraBlockLocation = gl.getUniformBlockIndex(program, "CameraUniformBlock");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CameraUniformBlockTotemCache, CameraUniformBlockString } from "../totems";
|
|
2
2
|
import { mercatorXYToGLPosition, POLE } from "../../util/shaderfunctions/geometrytransformations";
|
|
3
3
|
import { noRegisterGlobeProgramCache } from "../programcache";
|
|
4
|
-
import { createProgram } from "../../util";
|
|
4
|
+
import { createProgram } from "../../util/webglobjectbuilders";
|
|
5
5
|
import { Z_ALPHA_MODE } from "./util";
|
|
6
6
|
import { attributeLoader } from "../../util/gl-util/buffer/attribute-loader";
|
|
7
7
|
/**
|
|
@@ -68,23 +68,20 @@ class Logic {
|
|
|
68
68
|
const { gl, program } = this;
|
|
69
69
|
const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
|
|
70
70
|
gl.useProgram(program);
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
const cameraBlockBindingIndex = gl.getUniformBlockIndex(program, 'CameraUniformBlock');
|
|
86
|
-
gl.uniformBlockBinding(program, cameraBlockBindingIndex, this._cameraBindingPoint);
|
|
87
|
-
}
|
|
71
|
+
// assign attribute locations
|
|
72
|
+
gl.bindAttribLocation(program, 0, 'posA');
|
|
73
|
+
gl.bindAttribLocation(program, 1, 'posB');
|
|
74
|
+
gl.bindAttribLocation(program, 2, 'color');
|
|
75
|
+
// uniform locations
|
|
76
|
+
this._opacityLocation = gl.getUniformLocation(program, 'opacity');
|
|
77
|
+
this._zAlphaOnLocation = gl.getUniformLocation(program, 'z_alpha_on');
|
|
78
|
+
gl.uniform1i(this._zAlphaOnLocation, this._lastZAlphaOn);
|
|
79
|
+
gl.uniform1f(this._opacityLocation, this._lastOpicity);
|
|
80
|
+
// uniform block
|
|
81
|
+
this._cameraUniformBlock = CameraUniformBlockTotemCache.get(globe);
|
|
82
|
+
this._cameraBindingPoint = 0;
|
|
83
|
+
const cameraBlockBindingIndex = gl.getUniformBlockIndex(program, 'CameraUniformBlock');
|
|
84
|
+
gl.uniformBlockBinding(program, cameraBlockBindingIndex, this._cameraBindingPoint);
|
|
88
85
|
gl.useProgram(currentProgram);
|
|
89
86
|
}
|
|
90
87
|
createVAO(posAObj, posBObj, colorObj) {
|