@pirireis/webglobeplugins 0.9.7 → 0.9.8

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