@pirireis/webglobeplugins 0.9.11 → 0.9.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Math/angle-calculation.js +9 -11
- package/Math/arc.js +38 -41
- package/Math/bounds/line-bbox.js +79 -83
- package/Math/constants.js +4 -9
- package/Math/frustum/types.js +1 -2
- package/Math/juction/arc-plane.js +33 -36
- package/Math/juction/line-sphere.js +15 -18
- package/Math/juction/plane-plane.js +20 -23
- package/Math/line.js +42 -47
- package/Math/methods.js +69 -92
- package/Math/plane.js +33 -38
- package/Math/quaternion.js +48 -55
- package/Math/types.js +1 -2
- package/Math/utils.js +2 -4
- package/Math/vec3.js +46 -52
- package/algorithms/search-binary.js +5 -8
- package/altitude-locator/draw-subset-obj.js +8 -11
- package/altitude-locator/plugin.js +114 -133
- package/altitude-locator/types.js +1 -3
- package/arrowfield/adaptor.js +3 -7
- package/arrowfield/index.js +3 -10
- package/arrowfield/plugin.js +63 -69
- package/bearing-line/index.js +2 -8
- package/bearing-line/plugin.js +218 -248
- package/circle-line-chain/chain-list-map.js +82 -92
- package/circle-line-chain/plugin.js +147 -182
- package/circle-line-chain/util.js +1 -5
- package/compass-rose/compass-rose-padding-flat.js +111 -140
- package/compass-rose/compass-text-writer.js +63 -75
- package/compass-rose/index.js +3 -7
- package/compassrose/compassrose.js +50 -57
- package/compassrose/index.js +2 -8
- package/heatwave/index.js +3 -10
- package/heatwave/isobar/objectarraylabels.js +50 -56
- package/heatwave/isobar/plugin.js +111 -170
- package/heatwave/isobar/quadtreecontours.js +78 -96
- package/heatwave/plugins/heatwaveglobeshell.js +73 -94
- package/index.js +12 -58
- package/package.json +1 -1
- package/partialrings/buffer-manager.js +32 -70
- package/partialrings/index.js +2 -41
- package/partialrings/plugin.js +55 -98
- package/partialrings/program.js +141 -59
- package/pin/pin-object-array.js +89 -97
- package/pin/pin-point-totem.js +21 -22
- package/point-heat-map/adaptors/timetracksplugin-format-to-this.js +11 -14
- package/point-heat-map/plugin-webworker.js +45 -53
- package/point-heat-map/point-to-heat-map-flow.js +46 -51
- package/point-tracks/key-methods.js +2 -5
- package/point-tracks/plugin.js +141 -170
- package/programs/arrowfield/index.js +2 -7
- package/programs/arrowfield/logic.js +172 -67
- package/programs/arrowfield/object.js +35 -43
- package/programs/data2legend/density-to-legend.js +47 -26
- package/programs/data2legend/point-to-density-texture.js +56 -34
- package/programs/float2legendwithratio/index.js +2 -8
- package/programs/float2legendwithratio/logic.js +88 -45
- package/programs/float2legendwithratio/object.js +45 -54
- package/programs/globe-util/is-globe-moved.js +10 -13
- package/programs/globeshell/index.js +2 -8
- package/programs/globeshell/wiggle/index.js +2 -8
- package/programs/globeshell/wiggle/logic.js +191 -101
- package/programs/globeshell/wiggle/object.js +35 -43
- package/programs/helpers/blender/program.js +36 -22
- package/programs/helpers/fadeaway/index.js +2 -7
- package/programs/helpers/fadeaway/logic.js +36 -17
- package/programs/helpers/fadeaway/object.js +11 -18
- package/programs/helpers/index.js +2 -8
- package/programs/index.js +9 -58
- package/programs/line-on-globe/angled-line.js +95 -39
- package/programs/line-on-globe/circle-accurate-3d.js +86 -39
- package/programs/line-on-globe/circle-accurate-flat.js +116 -64
- package/programs/line-on-globe/circle-accurate.js +113 -46
- package/programs/line-on-globe/circle.js +106 -44
- package/programs/line-on-globe/degree-padding-around-circle-3d.js +89 -42
- package/programs/line-on-globe/lines-color-instanced-flat.js +84 -43
- package/programs/line-on-globe/linestrip.js +126 -63
- package/programs/line-on-globe/naive-accurate-flexible.js +126 -59
- package/programs/line-on-globe/to-the-surface.js +62 -35
- package/programs/line-on-globe/util.js +2 -5
- package/programs/picking/pickable-renderer.js +127 -46
- package/programs/point-on-globe/element-globe-surface-glow.js +83 -46
- package/programs/point-on-globe/element-point-glow.js +112 -47
- package/programs/point-on-globe/square-pixel-point.js +80 -34
- package/programs/programcache.js +14 -19
- package/programs/rings/distancering/circleflatprogram.js +76 -70
- package/programs/rings/distancering/circlepaddingfreeangleprogram.js +168 -194
- package/programs/rings/distancering/circlepaddysharedbuffer.js +121 -200
- package/programs/rings/distancering/index.js +5 -14
- package/programs/rings/distancering/paddyflatprogram.js +87 -70
- package/programs/rings/distancering/paddyflatprogram2d.js +89 -72
- package/programs/rings/distancering/paddyflatprogram3d.js +87 -70
- package/programs/rings/index.js +1 -17
- package/programs/rings/partial-ring/piece-of-pie.js +144 -44
- package/programs/totems/camerauniformblock.js +65 -56
- package/programs/totems/canvas-webglobe-info.js +49 -45
- package/programs/totems/gpu-selection-uniform-block.js +45 -45
- package/programs/totems/index.js +2 -40
- package/programs/two-d/pixel-padding-for-compass.js +94 -36
- package/programs/util.js +7 -10
- package/programs/vectorfields/index.js +3 -23
- package/programs/vectorfields/logics/drawrectangleparticles.js +73 -35
- package/programs/vectorfields/logics/index.js +4 -12
- package/programs/vectorfields/logics/pixelbased.js +94 -41
- package/programs/vectorfields/logics/ubo.js +32 -32
- package/programs/vectorfields/pingpongbuffermanager.js +30 -37
- package/rangerings/enum.js +2 -5
- package/rangerings/index.js +5 -15
- package/rangerings/plugin.js +223 -286
- package/rangerings/rangeringangletext.js +122 -137
- package/rangerings/ring-account.js +53 -75
- package/shaders/fragment-toy/firework.js +55 -4
- package/shaders/fragment-toy/singularity.js +56 -5
- package/timetracks/adaptors-line-strip.js +27 -44
- package/timetracks/adaptors.js +48 -67
- package/timetracks/index.js +5 -19
- package/timetracks/plugin-line-strip.js +65 -79
- package/timetracks/plugin.js +71 -85
- package/timetracks/program-line-strip.js +297 -107
- package/timetracks/program.js +421 -118
- package/timetracks/programpoint-line-strip.js +98 -48
- package/timetracks/programpoint.js +91 -48
- package/util/account/bufferoffsetmanager.js +72 -98
- package/util/account/index.js +3 -23
- package/util/account/single-attribute-buffer-management/buffer-manager.js +44 -48
- package/util/account/single-attribute-buffer-management/buffer-orchestrator.js +68 -98
- package/util/account/single-attribute-buffer-management/index.js +4 -9
- package/util/account/single-attribute-buffer-management/object-store.js +29 -34
- package/util/account/single-attribute-buffer-management/types.js +1 -2
- package/util/account/util.js +2 -8
- package/util/algorithms/search-binary.js +5 -8
- package/util/check/get.js +5 -9
- package/util/check/typecheck.js +13 -24
- package/util/geometry/index.js +10 -18
- package/util/gl-util/buffer/attribute-loader.js +10 -26
- package/util/gl-util/buffer/index.js +2 -5
- package/util/gl-util/draw-options/methods.js +10 -15
- package/util/gl-util/uniform-block/manager.js +69 -72
- package/util/heatwavedatamanager/datamanager.js +56 -119
- package/util/heatwavedatamanager/index.js +3 -10
- package/util/heatwavedatamanager/pointcoordinatesdatacalculator.js +38 -47
- package/util/heatwavedatamanager/pointcoordsmeta.js +9 -13
- package/util/index.js +13 -57
- package/util/interpolation/timetrack/index.js +2 -5
- package/util/interpolation/timetrack/timetrack-interpolator.js +30 -36
- package/util/interpolation/timetrack/web-worker-str.js +180 -5
- package/util/interpolation/timetrack/web-worker.js +4 -6
- package/util/jshelpers/data-filler.js +8 -11
- package/util/jshelpers/equality.js +1 -3
- package/util/jshelpers/index.js +2 -37
- package/util/jshelpers/timefilters.js +8 -10
- package/util/picking/fence.js +8 -11
- package/util/picking/picker-displayer.js +49 -58
- package/util/programs/draw-texture-on-canvas.js +41 -26
- package/util/programs/index.js +1 -17
- package/util/programs/shapesonglobe.js +104 -68
- package/util/programs/supersampletotextures.js +45 -43
- package/util/programs/texturetoglobe.js +99 -52
- package/util/shaderfunctions/geometrytransformations.js +323 -35
- package/util/shaderfunctions/index.js +2 -18
- package/util/shaderfunctions/nodata.js +8 -5
- package/util/shaderfunctions/noisefunctions.js +40 -12
- package/util/surface-line-data/arcs-to-cuts.js +20 -23
- package/util/webglobe/gldefaultstates.js +1 -4
- package/util/webglobe/index.js +2 -18
- package/util/webglobe/rasteroverlay.js +36 -41
- package/util/webglobjectbuilders.js +70 -93
- package/util/webglobjectbuilders1.js +63 -82
- package/waveparticles/adaptor.js +7 -10
- package/waveparticles/index.js +3 -10
- package/waveparticles/plugin.js +82 -90
- package/wind/imagetovectorfieldandmagnitude.js +16 -19
- package/wind/index.js +5 -14
- package/wind/plugin.js +454 -291
- package/wind/vectorfieldimage.js +6 -8
- package/write-text/attached-text-writer.js +48 -54
- package/write-text/context-text.js +52 -63
- package/write-text/context-text3.js +71 -80
- package/write-text/index.js +1 -5
package/partialrings/program.js
CHANGED
|
@@ -1,34 +1,119 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.programCache = exports.Logic = exports.ITEM_SIZE = void 0;
|
|
7
|
-
var util_1 = require("../util");
|
|
8
|
-
var programs_1 = require("../programs");
|
|
9
|
-
var buffer_manager_1 = __importDefault(require("./buffer-manager"));
|
|
10
|
-
var geometrytransformations_1 = require("../util/shaderfunctions/geometrytransformations");
|
|
1
|
+
import { createProgram, shaderfunctions } from "../util";
|
|
2
|
+
import { CameraUniformBlockTotem, CameraUniformBlockString, noRegisterGlobeProgramCache, globeProgramCache } from "../programs";
|
|
3
|
+
import BufferManager from "./buffer-manager";
|
|
4
|
+
import { POLE, PI, longLatRadToMercator, mercatorXYToGLPosition, longLatRadToCartesian3D, circleLimpFromLongLatRadCenterCartesian3D, circleLimpFromLongLatRadCenterMercatorRealDistance, cartesian3DToGLPosition } from "../util/shaderfunctions/geometrytransformations";
|
|
11
5
|
/**
|
|
12
6
|
* TODO:
|
|
13
7
|
* 1. Triangle face looks at screen. if rotation angle is positive the last vertex must be the faintest.
|
|
14
8
|
*
|
|
15
9
|
*/
|
|
16
|
-
|
|
10
|
+
const drawModeMap = Object.freeze({
|
|
17
11
|
LINE_STRIP: 0,
|
|
18
12
|
TRIANGLE_FAN: 1,
|
|
19
13
|
});
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
14
|
+
const vertexShaderSource = `#version 300 es
|
|
15
|
+
|
|
16
|
+
${CameraUniformBlockString}
|
|
17
|
+
${PI}
|
|
18
|
+
${longLatRadToMercator}
|
|
19
|
+
${mercatorXYToGLPosition}
|
|
20
|
+
${longLatRadToCartesian3D}
|
|
21
|
+
${circleLimpFromLongLatRadCenterCartesian3D}
|
|
22
|
+
${circleLimpFromLongLatRadCenterMercatorRealDistance}
|
|
23
|
+
${cartesian3DToGLPosition}
|
|
24
|
+
|
|
25
|
+
uniform float edge_count;
|
|
26
|
+
uniform int draw_mode; // %2 => 0: LINE_STRIP, 1: TRIANGLE_FAN
|
|
27
|
+
uniform float plugin_alpha_multiplier;
|
|
28
|
+
//, lat, startAngle, tailAngle, ...rgba, radius, rgbaMode
|
|
29
|
+
in vec2 center; // long, lat in radian
|
|
30
|
+
in float start_angle; // the start of partial circle from bearing point
|
|
31
|
+
in float tail_angle; // the rotation of the partial circle
|
|
32
|
+
in vec4 color;
|
|
33
|
+
in float radius; // in meter
|
|
34
|
+
in float color_mode; // 0.0: constant, 1.0: fading, 2.0: hide
|
|
35
|
+
// flat out int vid;
|
|
36
|
+
// flat out float v_phase;
|
|
37
|
+
out vec2 v_pos;
|
|
38
|
+
out vec4 v_color;
|
|
39
|
+
// flat out float v_angle;
|
|
40
|
+
|
|
41
|
+
void main() {
|
|
42
|
+
// vid = gl_VertexID;
|
|
43
|
+
if (color_mode == 2.0 || radius == 0.0) { return; }
|
|
44
|
+
float color_mode_ = color_mode;
|
|
45
|
+
if ( draw_mode == 0 && color_mode == 1.0) {color_mode_ = 0.0;}
|
|
46
|
+
float vertexID = float(gl_VertexID);
|
|
47
|
+
float radius_ = radius;
|
|
48
|
+
float alpha = plugin_alpha_multiplier;
|
|
49
|
+
if (draw_mode == 1) { // TRIANGLE_FAN
|
|
50
|
+
if (gl_VertexID == 0) {
|
|
51
|
+
radius_ = 0.0;
|
|
52
|
+
if ( color_mode == 1.0 ) { alpha = 0.0; }
|
|
53
|
+
}
|
|
54
|
+
vertexID -= 1.0;
|
|
55
|
+
}
|
|
56
|
+
float phase = ( vertexID / (edge_count - 1.0) );
|
|
57
|
+
// v_angle = tail_angle;
|
|
58
|
+
|
|
59
|
+
if ( color_mode_ == 1.0 ) {
|
|
60
|
+
if ( tail_angle < 0.0 ) {
|
|
61
|
+
v_color = vec4( color.rgb , color.a * ( 1.0 - phase ) * alpha );
|
|
62
|
+
} else {
|
|
63
|
+
v_color = vec4( color.rgb , color.a * phase * alpha );
|
|
64
|
+
}
|
|
65
|
+
} else {
|
|
66
|
+
v_color = vec4( color.rgb , color.a * alpha );
|
|
67
|
+
}
|
|
68
|
+
if ( color_mode == 0.0 && draw_mode == 1 ) {
|
|
69
|
+
v_color.a /= 2.0;
|
|
70
|
+
}
|
|
71
|
+
float angle;
|
|
72
|
+
if ( tail_angle > 0.0 ) {
|
|
73
|
+
angle = tail_angle * (-phase + 1.0) + start_angle;
|
|
74
|
+
} else {
|
|
75
|
+
angle = tail_angle * phase + start_angle;
|
|
76
|
+
}
|
|
77
|
+
if (is3D) {
|
|
78
|
+
|
|
79
|
+
vec3 pos = circleLimpFromLongLatRadCenterCartesian3D(center, radius_, angle);
|
|
80
|
+
v_pos = vec2(0.0, 0.0);
|
|
81
|
+
gl_Position = cartesian3DToGLPosition(pos);
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
|
|
85
|
+
vec2 pos = circleLimpFromLongLatRadCenterMercatorRealDistance(center, radius_, angle);
|
|
86
|
+
v_pos = pos;
|
|
87
|
+
gl_Position = mercatorXYToGLPosition(pos);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
gl_PointSize = 10.0;
|
|
91
|
+
}`;
|
|
92
|
+
const fragmentShaderSource = `#version 300 es` + POLE + PI + `
|
|
93
|
+
precision highp float;
|
|
94
|
+
// flat in int vid;
|
|
95
|
+
in vec4 v_color;
|
|
96
|
+
in vec2 v_pos;
|
|
97
|
+
// flat in float v_phase;
|
|
98
|
+
// in float v_angle;
|
|
99
|
+
out vec4 outColor;
|
|
100
|
+
void main() {
|
|
101
|
+
// if( vid % 2 == 0 ) { discard; }
|
|
102
|
+
// if ( mod(v_angle, PI / 36.0 ) < (PI / 72.0)) { discard; }
|
|
103
|
+
// if ( mod(v_angle * v_phase, PI / 90.0 ) < (PI / 180.0)) { discard; }
|
|
104
|
+
if ( v_pos.x < -POLE || v_pos.x > POLE || v_pos.y < -POLE || v_pos.y > POLE ) { discard; }
|
|
105
|
+
outColor = v_color;
|
|
106
|
+
}`;
|
|
107
|
+
export const ITEM_SIZE = 10;
|
|
108
|
+
export class Logic {
|
|
109
|
+
constructor(globe) {
|
|
25
110
|
this.globe = globe;
|
|
26
111
|
this.gl = globe.gl;
|
|
27
112
|
this._lastMode = 0;
|
|
28
113
|
this._lastEdgeCount = 64;
|
|
29
114
|
this._lastAlphaMultiplier = 1.0;
|
|
30
|
-
this.program =
|
|
31
|
-
|
|
115
|
+
this.program = createProgram(this.gl, vertexShaderSource, fragmentShaderSource);
|
|
116
|
+
const { gl, program } = this;
|
|
32
117
|
{ // set attributes locations
|
|
33
118
|
gl.bindAttribLocation(program, 0, 'center');
|
|
34
119
|
gl.bindAttribLocation(program, 1, 'start_angle');
|
|
@@ -43,20 +128,20 @@ var Logic = /** @class */ (function () {
|
|
|
43
128
|
this._edgeCountLocation = gl.getUniformLocation(program, 'edge_count');
|
|
44
129
|
this._draw_modeLocation = gl.getUniformLocation(program, 'draw_mode');
|
|
45
130
|
this._plugin_alpha_multiplierLocation = gl.getUniformLocation(program, 'plugin_alpha_multiplier');
|
|
46
|
-
|
|
131
|
+
const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
|
|
47
132
|
gl.useProgram(program);
|
|
48
133
|
gl.uniform1i(this._draw_modeLocation, this._lastMode);
|
|
49
134
|
gl.uniform1f(this._edgeCountLocation, this._lastEdgeCount);
|
|
50
135
|
gl.uniform1f(this._plugin_alpha_multiplierLocation, 1.0);
|
|
51
136
|
this.cameraBlockBindingPoint = 0;
|
|
52
|
-
this.cameraBlockTotem =
|
|
53
|
-
|
|
137
|
+
this.cameraBlockTotem = globeProgramCache.getProgram(globe, CameraUniformBlockTotem);
|
|
138
|
+
const cameraBlockIndex = gl.getUniformBlockIndex(program, "CameraUniformBlock");
|
|
54
139
|
gl.uniformBlockBinding(program, cameraBlockIndex, this.cameraBlockBindingPoint);
|
|
55
140
|
gl.useProgram(currentProgram);
|
|
56
141
|
}
|
|
57
142
|
}
|
|
58
|
-
|
|
59
|
-
|
|
143
|
+
draw(length, vao, edgeCount, alphaMultiplier, drawMode) {
|
|
144
|
+
const { gl, program, cameraBlockTotem, cameraBlockBindingPoint } = this;
|
|
60
145
|
// gl.disable(gl.DEPTH_TEST);
|
|
61
146
|
gl.useProgram(program);
|
|
62
147
|
if (drawMode !== this._lastMode) {
|
|
@@ -71,27 +156,27 @@ var Logic = /** @class */ (function () {
|
|
|
71
156
|
gl.uniform1f(this._plugin_alpha_multiplierLocation, alphaMultiplier);
|
|
72
157
|
this._lastAlphaMultiplier = alphaMultiplier;
|
|
73
158
|
}
|
|
74
|
-
|
|
159
|
+
const overdraw = drawModeMap[drawMode];
|
|
75
160
|
cameraBlockTotem.bind(cameraBlockBindingPoint);
|
|
76
161
|
gl.bindVertexArray(vao);
|
|
77
162
|
gl.drawArraysInstanced(gl[drawMode], 0, edgeCount + overdraw, length);
|
|
78
163
|
cameraBlockTotem.unbind(cameraBlockBindingPoint);
|
|
79
164
|
gl.bindVertexArray(null);
|
|
80
165
|
// gl.enable(gl.DEPTH_TEST);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
|
|
166
|
+
}
|
|
167
|
+
free() {
|
|
168
|
+
noRegisterGlobeProgramCache.releaseProgram(this.globe, CameraUniformBlockTotem);
|
|
84
169
|
this.gl.deleteProgram(this.program);
|
|
85
170
|
this.program = null;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
171
|
+
}
|
|
172
|
+
getVaoBuffer() {
|
|
173
|
+
const { gl } = this;
|
|
174
|
+
const vao = gl.createVertexArray();
|
|
175
|
+
const buffer = gl.createBuffer();
|
|
91
176
|
gl.bindVertexArray(vao);
|
|
92
177
|
gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
|
|
93
|
-
|
|
94
|
-
|
|
178
|
+
const stride = ITEM_SIZE * 4;
|
|
179
|
+
let offset = 0;
|
|
95
180
|
gl.enableVertexAttribArray(0);
|
|
96
181
|
gl.vertexAttribPointer(0, 2, gl.FLOAT, false, stride, offset);
|
|
97
182
|
offset += 2 * 4;
|
|
@@ -118,10 +203,10 @@ var Logic = /** @class */ (function () {
|
|
|
118
203
|
gl.bindVertexArray(null);
|
|
119
204
|
gl.bindBuffer(gl.ARRAY_BUFFER, null);
|
|
120
205
|
return {
|
|
121
|
-
vao
|
|
122
|
-
buffer
|
|
206
|
+
vao,
|
|
207
|
+
buffer,
|
|
123
208
|
};
|
|
124
|
-
}
|
|
209
|
+
}
|
|
125
210
|
/**
|
|
126
211
|
* in vec2 center; // long, lat in radian
|
|
127
212
|
in float start_angle; // the start of partial circle from bearing point
|
|
@@ -130,47 +215,47 @@ in vec4 color;
|
|
|
130
215
|
in float radius; // in meter
|
|
131
216
|
in float color_mode; // 0.0: constant, 1.0: fading, 2.0: hide
|
|
132
217
|
*/
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
218
|
+
createVAO(centerObj, startAngleObj, tailAngleObj, colorObj, radiusObj, colorModeObj) {
|
|
219
|
+
const { gl } = this;
|
|
220
|
+
const vao = gl.createVertexArray();
|
|
136
221
|
gl.bindVertexArray(vao);
|
|
137
222
|
{
|
|
138
|
-
|
|
223
|
+
const { buffer, stride, offset } = centerObj;
|
|
139
224
|
gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
|
|
140
225
|
gl.enableVertexAttribArray(0);
|
|
141
226
|
gl.vertexAttribPointer(0, 2, gl.FLOAT, false, stride, offset);
|
|
142
227
|
gl.vertexAttribDivisor(0, 1);
|
|
143
228
|
}
|
|
144
229
|
{
|
|
145
|
-
|
|
230
|
+
const { buffer, stride, offset } = startAngleObj;
|
|
146
231
|
gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
|
|
147
232
|
gl.enableVertexAttribArray(1);
|
|
148
233
|
gl.vertexAttribPointer(1, 1, gl.FLOAT, false, stride, offset);
|
|
149
234
|
gl.vertexAttribDivisor(1, 1);
|
|
150
235
|
}
|
|
151
236
|
{
|
|
152
|
-
|
|
237
|
+
const { buffer, stride, offset } = tailAngleObj;
|
|
153
238
|
gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
|
|
154
239
|
gl.enableVertexAttribArray(2);
|
|
155
240
|
gl.vertexAttribPointer(2, 1, gl.FLOAT, false, stride, offset);
|
|
156
241
|
gl.vertexAttribDivisor(2, 1);
|
|
157
242
|
}
|
|
158
243
|
{
|
|
159
|
-
|
|
244
|
+
const { buffer, stride, offset } = colorObj;
|
|
160
245
|
gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
|
|
161
246
|
gl.enableVertexAttribArray(3);
|
|
162
247
|
gl.vertexAttribPointer(3, 4, gl.FLOAT, false, stride, offset);
|
|
163
248
|
gl.vertexAttribDivisor(3, 1);
|
|
164
249
|
}
|
|
165
250
|
{
|
|
166
|
-
|
|
251
|
+
const { buffer, stride, offset } = radiusObj;
|
|
167
252
|
gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
|
|
168
253
|
gl.enableVertexAttribArray(4);
|
|
169
254
|
gl.vertexAttribPointer(4, 1, gl.FLOAT, false, stride, offset);
|
|
170
255
|
gl.vertexAttribDivisor(4, 1);
|
|
171
256
|
}
|
|
172
257
|
{
|
|
173
|
-
|
|
258
|
+
const { buffer, stride, offset } = colorModeObj;
|
|
174
259
|
gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
|
|
175
260
|
gl.enableVertexAttribArray(5);
|
|
176
261
|
gl.vertexAttribPointer(5, 1, gl.FLOAT, false, stride, offset);
|
|
@@ -179,19 +264,16 @@ in float color_mode; // 0.0: constant, 1.0: fading, 2.0: hide
|
|
|
179
264
|
gl.bindVertexArray(null);
|
|
180
265
|
gl.bindBuffer(gl.ARRAY_BUFFER, null);
|
|
181
266
|
return vao;
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
var _e = this.getVaoBuffer(), vao = _e.vao, buffer = _e.buffer;
|
|
267
|
+
}
|
|
268
|
+
getBufferManagerAndVao({ capacity = 10, bufferType = "DYNAMIC_DRAW" } = {}) {
|
|
269
|
+
const { vao, buffer } = this.getVaoBuffer();
|
|
186
270
|
return {
|
|
187
|
-
bufferManager: new
|
|
188
|
-
vao
|
|
271
|
+
bufferManager: new BufferManager(this.globe, this.gl, buffer, { capacity, bufferType }),
|
|
272
|
+
vao
|
|
189
273
|
};
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
get: function (globe) { return programs_1.noRegisterGlobeProgramCache.getProgram(globe, Logic); },
|
|
196
|
-
release: function (globe) { return programs_1.noRegisterGlobeProgramCache.releaseProgram(globe, Logic); }
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
export const programCache = Object.freeze({
|
|
277
|
+
get: (globe) => noRegisterGlobeProgramCache.getProgram(globe, Logic),
|
|
278
|
+
release: (globe) => noRegisterGlobeProgramCache.releaseProgram(globe, Logic)
|
|
197
279
|
});
|
package/pin/pin-object-array.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/**
|
|
3
2
|
* IconData;
|
|
4
3
|
* iconMap, iconCoords for objectArray
|
|
@@ -17,12 +16,8 @@
|
|
|
17
16
|
* keyboard clicks
|
|
18
17
|
* mouse curser changes ( this can be implemented inside above methods)
|
|
19
18
|
*/
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
};
|
|
23
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
-
var webglobe_1 = require("@pirireis/webglobe");
|
|
25
|
-
var AlarmTimeLineFadeInFadeOutPlugin_1 = __importDefault(require("../../plugins/alarms/alarmFadeInFadeOutPlugin/AlarmTimeLineFadeInFadeOutPlugin"));
|
|
19
|
+
import { CSGlobe, CSIconTypes, CSObjectTypes, CSObjectArrayUpdateTypes, } from "@pirireis/webglobe";
|
|
20
|
+
import AlarmTimeLineFadeInFadeOut from "../../plugins/alarms/alarmFadeInFadeOutPlugin/AlarmTimeLineFadeInFadeOutPlugin";
|
|
26
21
|
/**
|
|
27
22
|
* @typedef {Object} IconPayload
|
|
28
23
|
* @property {string} app6DCode
|
|
@@ -44,25 +39,27 @@ var AlarmTimeLineFadeInFadeOutPlugin_1 = __importDefault(require("../../plugins/
|
|
|
44
39
|
* @property {number[]} coordsZ [z1, z2, ....]
|
|
45
40
|
* @property {PointPayload[]} attribs
|
|
46
41
|
*/
|
|
47
|
-
function addIconMap(globe, mapName, ICON_MAP_URL, ICON_MAP_JSON_URL) {
|
|
48
|
-
if (mapName === void 0) { mapName = "IconMapName"; }
|
|
42
|
+
function addIconMap(globe, mapName = "IconMapName", ICON_MAP_URL, ICON_MAP_JSON_URL) {
|
|
49
43
|
globe.api_AddIconMap('IconMapName', ICON_MAP_URL, ICON_MAP_JSON_URL);
|
|
50
44
|
}
|
|
51
|
-
|
|
52
|
-
|
|
45
|
+
class ObjectArray {
|
|
46
|
+
constructor(symbolSet, style) {
|
|
53
47
|
this.symbolSet = symbolSet;
|
|
54
48
|
this.style = style;
|
|
55
49
|
}
|
|
56
|
-
|
|
50
|
+
setSymbolSet(symbolSet) {
|
|
57
51
|
this.symbolSet = symbolSet;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
class PinPointObjectArray {
|
|
55
|
+
constructor(id, globe, symbolSet, // iconMapName
|
|
56
|
+
style, callBacks = {
|
|
57
|
+
mouseDown: (pinItem, event) => { },
|
|
58
|
+
mouseMove: (pinItem, event) => { },
|
|
59
|
+
mouseUp: (pinItem, event) => { },
|
|
60
|
+
mouseClick: (pinItem, event) => { },
|
|
61
|
+
mouseDblClick: (pinItem, event) => { },
|
|
62
|
+
} = {}) {
|
|
66
63
|
this.id = id;
|
|
67
64
|
this.globe = globe;
|
|
68
65
|
this.symbolSet = symbolSet;
|
|
@@ -72,25 +69,25 @@ var PinPointObjectArray = /** @class */ (function () {
|
|
|
72
69
|
// this item will be used
|
|
73
70
|
this.currentItem = null;
|
|
74
71
|
}
|
|
75
|
-
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
|
|
72
|
+
insertPins(pins) {
|
|
73
|
+
}
|
|
74
|
+
deletePins(pinsIDs) {
|
|
75
|
+
const deleteBucket = {
|
|
79
76
|
coords: [],
|
|
80
77
|
coordsZ: [],
|
|
81
78
|
attribs: []
|
|
82
79
|
};
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
for (
|
|
88
|
-
|
|
80
|
+
}
|
|
81
|
+
_queryByScreenFindFirst() {
|
|
82
|
+
const { clientX, clientY } = this.globe.api_GetMousePos();
|
|
83
|
+
const allObjects = this.globe.queryByScreen(clientX, clientY);
|
|
84
|
+
for (let i = 0; i < allObjects.length; i++) {
|
|
85
|
+
const { obj, owner } = allObjects[i];
|
|
89
86
|
if (owner === this.objectArray) {
|
|
90
87
|
return obj;
|
|
91
88
|
}
|
|
92
89
|
}
|
|
93
|
-
}
|
|
90
|
+
}
|
|
94
91
|
// mouseDown(x, y, event) {
|
|
95
92
|
// return false
|
|
96
93
|
// }
|
|
@@ -108,29 +105,27 @@ var PinPointObjectArray = /** @class */ (function () {
|
|
|
108
105
|
// mouseDblClick() {
|
|
109
106
|
// return false
|
|
110
107
|
// }
|
|
111
|
-
|
|
108
|
+
free() {
|
|
112
109
|
this.globe.api_ClearMouseEvents(); // TODO
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
|
|
110
|
+
}
|
|
111
|
+
_setMouseEvent() {
|
|
112
|
+
const { globe } = this;
|
|
116
113
|
globe.api_SetMouseEvents();
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
114
|
+
}
|
|
115
|
+
_getIdForGlobe() {
|
|
116
|
+
const { globe, objectArray } = this;
|
|
117
|
+
const callback = () => {
|
|
118
|
+
const allObjects = globe.api_queryByScreen();
|
|
122
119
|
};
|
|
123
|
-
return
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
var ObjectArrayLabels = /** @class */ (function () {
|
|
120
|
+
return `${this.id}_pinObjectArrayMouseEvent`;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
class ObjectArrayLabels {
|
|
128
124
|
/**
|
|
129
125
|
* @param {number | string} id
|
|
130
126
|
* @param {CSGlobe} globe
|
|
131
127
|
*/
|
|
132
|
-
|
|
133
|
-
if (labelStyle === void 0) { labelStyle = null; }
|
|
128
|
+
constructor(id, globe, labelStyle = null) {
|
|
134
129
|
this.id = id;
|
|
135
130
|
this.setGlobe(globe);
|
|
136
131
|
this.data = [
|
|
@@ -141,7 +136,7 @@ var ObjectArrayLabels = /** @class */ (function () {
|
|
|
141
136
|
},
|
|
142
137
|
];
|
|
143
138
|
this.primaryKey = "id";
|
|
144
|
-
this.objectType =
|
|
139
|
+
this.objectType = CSObjectTypes.POINT;
|
|
145
140
|
this.filter = null;
|
|
146
141
|
this.bbox = null;
|
|
147
142
|
this.startLod = 2;
|
|
@@ -151,7 +146,7 @@ var ObjectArrayLabels = /** @class */ (function () {
|
|
|
151
146
|
this._idCollector = new Set();
|
|
152
147
|
this._setStyle(labelStyle);
|
|
153
148
|
}
|
|
154
|
-
|
|
149
|
+
_setStyle(labelStyle) {
|
|
155
150
|
this.style = this.globe.ObjectArray.GetDefaultStyle();
|
|
156
151
|
if (labelStyle) {
|
|
157
152
|
this.style.labels[0] = labelStyle;
|
|
@@ -169,54 +164,53 @@ var ObjectArrayLabels = /** @class */ (function () {
|
|
|
169
164
|
}
|
|
170
165
|
this.style.labels[0].text = "${value}";
|
|
171
166
|
this.style.fidKey = this.primaryKey;
|
|
172
|
-
this.style.iconType =
|
|
173
|
-
}
|
|
167
|
+
this.style.iconType = CSIconTypes.NOICON; // milIcon ekleyebilmek için icon tipi MAP olmalı
|
|
168
|
+
}
|
|
174
169
|
/**
|
|
175
170
|
* @param {CSGlobe} [globe]
|
|
176
171
|
*/
|
|
177
|
-
|
|
172
|
+
setGlobe(globe) {
|
|
178
173
|
if (!globe)
|
|
179
174
|
return;
|
|
180
175
|
this.globe = globe;
|
|
181
|
-
}
|
|
182
|
-
|
|
176
|
+
}
|
|
177
|
+
addToMap() {
|
|
183
178
|
this.globe.ObjectArray.Add(this);
|
|
184
|
-
}
|
|
185
|
-
|
|
179
|
+
}
|
|
180
|
+
removeFromMap() {
|
|
186
181
|
this.flush();
|
|
187
182
|
this.globe.ObjectArray.Delete(this.id);
|
|
188
|
-
}
|
|
183
|
+
}
|
|
189
184
|
/**
|
|
190
185
|
* Haritaya kullanılacak veriyi verir. Her çağrıldığında tüm hesaplamalar yeniden yapılır
|
|
191
186
|
* @param {PointObjectArray} data
|
|
192
187
|
*/
|
|
193
|
-
|
|
188
|
+
setData(data) {
|
|
194
189
|
this.globe.ObjectArray.SetData(this, [data]);
|
|
195
|
-
}
|
|
190
|
+
}
|
|
196
191
|
/**
|
|
197
192
|
* @param {PointObjectArray} data
|
|
198
193
|
* @param {CSObjectArrayUpdateTypes} operation
|
|
199
194
|
* @param {CanChangeOptions} [canChange]
|
|
200
195
|
*/
|
|
201
|
-
|
|
196
|
+
updateData(data, operation, canChange) {
|
|
202
197
|
this.globe.ObjectArray.UpdateData(this, operation, [data], canChange);
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
|
|
198
|
+
}
|
|
199
|
+
flush() {
|
|
200
|
+
const deleteBucket = {
|
|
206
201
|
coords: [],
|
|
207
202
|
coordsZ: [],
|
|
208
203
|
attribs: [],
|
|
209
204
|
};
|
|
210
205
|
this.setData(deleteBucket);
|
|
211
206
|
this._idCollector = new Set();
|
|
212
|
-
}
|
|
207
|
+
}
|
|
213
208
|
/**
|
|
214
209
|
* Haritaya kullanılacak veriyi verir. Her çağrıldığında tüm hesaplamalar yeniden yapılmaz, ancak ön hesaplama maliyeti vardır
|
|
215
210
|
* @param {PointObjectArray} data
|
|
216
211
|
*/
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
var paritalData = {
|
|
212
|
+
setControlledData(data) {
|
|
213
|
+
const paritalData = {
|
|
220
214
|
add: {
|
|
221
215
|
coords: [],
|
|
222
216
|
coordsZ: [],
|
|
@@ -244,19 +238,19 @@ var ObjectArrayLabels = /** @class */ (function () {
|
|
|
244
238
|
if (this._idCollector.size === 0) {
|
|
245
239
|
this.setData(data);
|
|
246
240
|
// Eklenen id'ler set edildi
|
|
247
|
-
for (
|
|
248
|
-
|
|
249
|
-
|
|
241
|
+
for (let i = 0; i < data.attribs.length; i++) {
|
|
242
|
+
const currentPayload = data.attribs[i];
|
|
243
|
+
const id = currentPayload[this.primaryKey];
|
|
250
244
|
this._idCollector.add(id);
|
|
251
245
|
}
|
|
252
246
|
return;
|
|
253
247
|
}
|
|
254
248
|
/** @type {Set<string>} */
|
|
255
|
-
|
|
256
|
-
for (
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
249
|
+
const dataIds = new Set();
|
|
250
|
+
for (let i = 0; i < data.attribs.length; i++) {
|
|
251
|
+
const currentPayload = data.attribs[i];
|
|
252
|
+
const id = currentPayload[this.primaryKey];
|
|
253
|
+
let bucket = paritalData.add;
|
|
260
254
|
dataIds.add(id);
|
|
261
255
|
if (this._idCollector.has(id)) {
|
|
262
256
|
bucket = paritalData.update;
|
|
@@ -269,40 +263,38 @@ var ObjectArrayLabels = /** @class */ (function () {
|
|
|
269
263
|
bucket.attribs.push(currentPayload);
|
|
270
264
|
}
|
|
271
265
|
// Artık varolmayan elemenları sil
|
|
272
|
-
|
|
273
|
-
this._idCollector.forEach(
|
|
274
|
-
var _a;
|
|
266
|
+
const deleteBucket = paritalData.delete;
|
|
267
|
+
this._idCollector.forEach((id) => {
|
|
275
268
|
if (!dataIds.has(id)) {
|
|
276
|
-
|
|
269
|
+
this._idCollector.delete(id);
|
|
277
270
|
deleteBucket.coords.push(0, 0);
|
|
278
271
|
deleteBucket.coordsZ.push(0);
|
|
279
|
-
deleteBucket.attribs.push(
|
|
280
|
-
|
|
281
|
-
|
|
272
|
+
deleteBucket.attribs.push({
|
|
273
|
+
[this.primaryKey]: id,
|
|
274
|
+
});
|
|
282
275
|
}
|
|
283
276
|
});
|
|
284
277
|
if (paritalData.add.coords.length > 0) {
|
|
285
|
-
this.updateData(paritalData.add,
|
|
278
|
+
this.updateData(paritalData.add, CSObjectArrayUpdateTypes.ADD);
|
|
286
279
|
}
|
|
287
280
|
if (paritalData.update.coords.length > 0) {
|
|
288
|
-
this.updateData(paritalData.update,
|
|
281
|
+
this.updateData(paritalData.update, CSObjectArrayUpdateTypes.UPDATE, paritalData.canChange);
|
|
289
282
|
}
|
|
290
283
|
if (paritalData.delete.coords.length > 0) {
|
|
291
|
-
this.updateData(paritalData.delete,
|
|
284
|
+
this.updateData(paritalData.delete, CSObjectArrayUpdateTypes.DELETE);
|
|
292
285
|
}
|
|
293
|
-
}
|
|
294
|
-
|
|
286
|
+
}
|
|
287
|
+
setPrimarykey(key) {
|
|
295
288
|
this.primaryKey = key;
|
|
296
|
-
}
|
|
297
|
-
|
|
289
|
+
}
|
|
290
|
+
setSymbolSet(symbolSet) {
|
|
298
291
|
this.symbolSet = symbolSet;
|
|
299
|
-
}
|
|
300
|
-
|
|
292
|
+
}
|
|
293
|
+
getLabelStyle() {
|
|
301
294
|
return this.style.labels[0];
|
|
302
|
-
}
|
|
303
|
-
|
|
295
|
+
}
|
|
296
|
+
setLabelStyle(style) {
|
|
304
297
|
this.style.labels[0] = style;
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
exports.default = ObjectArrayLabels;
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
export default ObjectArrayLabels;
|