@pirireis/webglobeplugins 0.9.9 → 0.9.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (212) hide show
  1. package/Math/angle-calculation.js +15 -0
  2. package/Math/arc.js +65 -0
  3. package/Math/bounds/line-bbox.js +190 -0
  4. package/Math/constants.js +9 -0
  5. package/Math/frustum/camera.js +24 -0
  6. package/Math/frustum/from-globeinfo.js +48 -0
  7. package/Math/frustum/types.js +2 -0
  8. package/Math/globe-util/horizon-plane.js +112 -0
  9. package/Math/index.js +1 -0
  10. package/Math/juction/arc-plane.js +83 -0
  11. package/Math/juction/line-sphere.js +25 -0
  12. package/Math/juction/plane-plane.js +58 -0
  13. package/Math/line.js +58 -0
  14. package/Math/matrix4.js +1 -0
  15. package/Math/methods.js +206 -0
  16. package/Math/plane.js +62 -0
  17. package/Math/quaternion.js +108 -0
  18. package/Math/types.js +2 -0
  19. package/Math/utils.js +4 -0
  20. package/Math/vec3.js +129 -0
  21. package/algorithms/search-binary.js +19 -0
  22. package/altitude-locator/adaptors.js +1 -0
  23. package/altitude-locator/draw-subset-obj.js +19 -0
  24. package/altitude-locator/keymethod.js +1 -0
  25. package/altitude-locator/plugin.js +357 -0
  26. package/altitude-locator/types.js +23 -0
  27. package/arrowfield/adaptor.js +15 -0
  28. package/arrowfield/index.js +10 -0
  29. package/arrowfield/plugin.js +89 -0
  30. package/bearing-line/index.js +8 -0
  31. package/bearing-line/plugin.js +474 -0
  32. package/circle-line-chain/chain-list-map.js +211 -0
  33. package/circle-line-chain/init.js +1 -0
  34. package/circle-line-chain/plugin.js +449 -0
  35. package/circle-line-chain/util.js +5 -0
  36. package/compass-rose/compass-rose-padding-flat.js +247 -0
  37. package/compass-rose/compass-text-writer.js +161 -0
  38. package/compass-rose/index.js +7 -0
  39. package/compassrose/compassrose.js +300 -0
  40. package/compassrose/index.js +8 -0
  41. package/globe-types.js +1 -0
  42. package/heatwave/index.js +10 -0
  43. package/heatwave/isobar/objectarraylabels.js +206 -0
  44. package/heatwave/isobar/plugin.js +362 -0
  45. package/heatwave/isobar/quadtreecontours.js +316 -0
  46. package/heatwave/plugins/heatwaveglobeshell.js +224 -0
  47. package/index.js +11 -11
  48. package/jest.config.js +7 -0
  49. package/package.json +4 -4
  50. package/partialrings/buffer-manager.js +113 -0
  51. package/partialrings/index.js +41 -0
  52. package/partialrings/plugin.js +171 -0
  53. package/partialrings/program.js +197 -0
  54. package/pin/pin-object-array.js +308 -0
  55. package/pin/pin-point-totem.js +61 -0
  56. package/point-heat-map/adaptors/timetracksplugin-format-to-this.js +66 -0
  57. package/point-heat-map/index.js +1 -0
  58. package/point-heat-map/plugin-webworker.js +131 -0
  59. package/point-heat-map/point-to-heat-map-flow.js +129 -0
  60. package/point-tracks/key-methods.js +5 -0
  61. package/point-tracks/plugin.js +353 -0
  62. package/programs/arrowfield/index.js +7 -0
  63. package/programs/arrowfield/logic.js +149 -0
  64. package/programs/arrowfield/object.js +68 -0
  65. package/programs/data2legend/density-to-legend.js +77 -0
  66. package/programs/data2legend/point-to-density-texture.js +75 -0
  67. package/programs/float2legendwithratio/index.js +8 -0
  68. package/programs/float2legendwithratio/logic.js +125 -0
  69. package/programs/float2legendwithratio/object.js +113 -0
  70. package/programs/globe-util/is-globe-moved.js +22 -0
  71. package/programs/globeshell/index.js +8 -0
  72. package/programs/globeshell/noise/noises.js +1 -0
  73. package/programs/globeshell/wiggle/index.js +8 -0
  74. package/programs/globeshell/wiggle/logic.js +252 -0
  75. package/programs/globeshell/wiggle/object.js +74 -0
  76. package/programs/helpers/blender/index.js +1 -0
  77. package/programs/helpers/blender/program.js +62 -0
  78. package/programs/helpers/fadeaway/index.js +7 -0
  79. package/programs/helpers/fadeaway/logic.js +50 -0
  80. package/programs/helpers/fadeaway/object.js +21 -0
  81. package/programs/helpers/index.js +8 -0
  82. package/programs/index.js +58 -0
  83. package/programs/interface.js +1 -0
  84. package/programs/line-on-globe/angled-line.js +117 -0
  85. package/programs/line-on-globe/circle-accurate-3d.js +91 -0
  86. package/programs/line-on-globe/circle-accurate-flat.js +158 -0
  87. package/programs/line-on-globe/circle-accurate.js +108 -0
  88. package/programs/line-on-globe/circle.js +102 -0
  89. package/programs/line-on-globe/degree-padding-around-circle-3d.js +109 -0
  90. package/programs/line-on-globe/index.js +1 -0
  91. package/programs/line-on-globe/lines-color-instanced-flat.js +91 -0
  92. package/programs/line-on-globe/linestrip.js +110 -0
  93. package/programs/line-on-globe/naive-accurate-flexible.js +125 -0
  94. package/programs/line-on-globe/to-the-surface.js +82 -0
  95. package/programs/line-on-globe/util.js +8 -0
  96. package/programs/picking/pickable-renderer.js +104 -0
  97. package/programs/point-on-globe/element-globe-surface-glow.js +102 -0
  98. package/programs/point-on-globe/element-point-glow.js +85 -0
  99. package/programs/point-on-globe/square-pixel-point.js +125 -0
  100. package/programs/programcache.js +131 -0
  101. package/programs/rings/distancering/circleflatprogram.js +114 -0
  102. package/programs/rings/distancering/circlepaddingfreeangleprogram.js +358 -0
  103. package/programs/rings/distancering/circlepaddysharedbuffer.js +433 -0
  104. package/programs/rings/distancering/index.js +14 -0
  105. package/programs/rings/distancering/paddyflatprogram.js +119 -0
  106. package/programs/rings/distancering/paddyflatprogram2d.js +121 -0
  107. package/programs/rings/distancering/paddyflatprogram3d.js +119 -0
  108. package/programs/rings/distancering/shader.js +1 -0
  109. package/programs/rings/index.js +17 -0
  110. package/programs/rings/partial-ring/piece-of-pie.js +173 -0
  111. package/programs/totems/camerauniformblock.js +147 -0
  112. package/programs/totems/canvas-webglobe-info.js +102 -0
  113. package/programs/totems/gpu-selection-uniform-block.js +104 -0
  114. package/programs/totems/index.js +40 -0
  115. package/programs/two-d/pixel-circle.js +1 -0
  116. package/programs/two-d/pixel-padding-for-compass.js +101 -0
  117. package/programs/util.js +18 -0
  118. package/programs/vectorfields/index.js +23 -0
  119. package/programs/vectorfields/logics/drawrectangleparticles.js +66 -0
  120. package/programs/vectorfields/logics/index.js +12 -0
  121. package/programs/vectorfields/logics/pixelbased.js +86 -0
  122. package/programs/vectorfields/logics/ubo.js +57 -0
  123. package/programs/vectorfields/pingpongbuffermanager.js +80 -0
  124. package/rangerings/enum.js +5 -0
  125. package/rangerings/index.js +15 -0
  126. package/rangerings/plugin.js +610 -0
  127. package/rangerings/rangeringangletext.js +341 -0
  128. package/rangerings/ring-account.js +134 -0
  129. package/shaders/fragment-toy/firework.js +4 -0
  130. package/shaders/fragment-toy/singularity.js +5 -0
  131. package/shape-on-terrain/arc/naive/plugin.js +252 -0
  132. package/timetracks/adaptors-line-strip.js +82 -0
  133. package/timetracks/adaptors.js +136 -0
  134. package/timetracks/index.js +19 -0
  135. package/timetracks/plugin-line-strip.js +254 -0
  136. package/timetracks/plugin.js +262 -0
  137. package/timetracks/program-line-strip.js +418 -0
  138. package/timetracks/program.js +466 -0
  139. package/timetracks/programpoint-line-strip.js +101 -0
  140. package/timetracks/programpoint.js +101 -0
  141. package/types.js +15 -0
  142. package/util/account/bufferoffsetmanager.js +202 -0
  143. package/util/account/index.js +23 -0
  144. package/util/account/single-attribute-buffer-management/buffer-manager.js +112 -0
  145. package/util/account/single-attribute-buffer-management/buffer-orchestrator.js +180 -0
  146. package/util/account/single-attribute-buffer-management/index.js +9 -0
  147. package/util/account/single-attribute-buffer-management/object-store.js +53 -0
  148. package/util/account/single-attribute-buffer-management/types.js +2 -0
  149. package/util/account/util.js +24 -0
  150. package/util/algorithms/index.js +1 -0
  151. package/util/algorithms/search-binary.js +28 -0
  152. package/util/check/get.js +18 -0
  153. package/util/check/index.js +1 -0
  154. package/util/check/typecheck.js +51 -0
  155. package/util/geometry/index.js +53 -0
  156. package/util/gl-util/buffer/attribute-loader.js +81 -0
  157. package/util/gl-util/buffer/index.js +6 -0
  158. package/util/gl-util/buffer/types.js +1 -0
  159. package/util/gl-util/draw-options/methods.js +38 -0
  160. package/util/gl-util/draw-options/types.js +15 -0
  161. package/util/gl-util/uniform-block/manager.js +168 -0
  162. package/util/gl-util/uniform-block/shader.js +1 -0
  163. package/util/gl-util/uniform-block/types.js +8 -0
  164. package/util/heatwavedatamanager/datamanager.js +212 -0
  165. package/util/heatwavedatamanager/index.js +10 -0
  166. package/util/heatwavedatamanager/pointcoordinatesdatacalculator.js +125 -0
  167. package/util/heatwavedatamanager/pointcoordsmeta.js +21 -0
  168. package/util/index.js +57 -0
  169. package/util/interpolation/index.js +1 -0
  170. package/util/interpolation/timetrack/index.js +5 -0
  171. package/util/interpolation/timetrack/timetrack-interpolator.js +81 -0
  172. package/util/interpolation/timetrack/web-worker-str.js +5 -0
  173. package/util/interpolation/timetrack/web-worker.js +48 -0
  174. package/util/jshelpers/data-filler.js +20 -0
  175. package/util/jshelpers/equality.js +20 -0
  176. package/util/jshelpers/index.js +37 -0
  177. package/util/jshelpers/timefilters.js +32 -0
  178. package/util/picking/fence.js +46 -0
  179. package/util/picking/picker-displayer.js +145 -0
  180. package/util/programs/draw-texture-on-canvas.js +71 -0
  181. package/util/programs/index.js +17 -0
  182. package/util/programs/shapesonglobe.js +174 -0
  183. package/util/programs/supersampletotextures.js +107 -0
  184. package/util/programs/texturetoglobe.js +132 -0
  185. package/util/shaderfunctions/geometrytransformations.js +45 -0
  186. package/util/shaderfunctions/index.js +18 -0
  187. package/util/shaderfunctions/nodata.js +5 -0
  188. package/util/shaderfunctions/noisefunctions.js +13 -0
  189. package/util/surface-line-data/arc-bboxes.js +25 -0
  190. package/util/surface-line-data/arcs-to-cuts.js +53 -0
  191. package/util/surface-line-data/cut-arc.js +1 -0
  192. package/util/surface-line-data/flow.js +28 -0
  193. package/util/surface-line-data/rbush-manager.js +1 -0
  194. package/util/surface-line-data/types.js +1 -0
  195. package/util/surface-line-data/web-worker.js +1 -0
  196. package/util/webglobe/gldefaultstates.js +7 -0
  197. package/util/webglobe/index.js +18 -0
  198. package/util/webglobe/rasteroverlay.js +80 -0
  199. package/util/webglobjectbuilders.js +393 -0
  200. package/util/webglobjectbuilders1.js +238 -0
  201. package/waveparticles/adaptor.js +18 -0
  202. package/waveparticles/index.js +10 -0
  203. package/waveparticles/plugin.js +271 -0
  204. package/wind/imagetovectorfieldandmagnitude.js +35 -0
  205. package/wind/index.js +14 -0
  206. package/wind/plugin.js +724 -0
  207. package/wind/vectorfieldimage.js +25 -0
  208. package/write-text/attached-text-writer.js +93 -0
  209. package/write-text/context-text.js +105 -0
  210. package/write-text/context-text3.js +160 -0
  211. package/write-text/index.js +5 -0
  212. package/write-text/writer-plugin.js +8 -0
@@ -0,0 +1,197 @@
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
+ 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");
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
+ var drawModeMap = Object.freeze({
17
+ LINE_STRIP: 0,
18
+ TRIANGLE_FAN: 1,
19
+ });
20
+ var vertexShaderSource = "#version 300 es\n\n".concat(programs_1.CameraUniformBlockString, " \n").concat(geometrytransformations_1.PI, " \n").concat(geometrytransformations_1.longLatRadToMercator, "\n").concat(geometrytransformations_1.mercatorXYToGLPosition, "\n").concat(geometrytransformations_1.longLatRadToCartesian3D, "\n").concat(geometrytransformations_1.circleLimpFromLongLatRadCenterCartesian3D, "\n").concat(geometrytransformations_1.circleLimpFromLongLatRadCenterMercatorRealDistance, "\n").concat(geometrytransformations_1.cartesian3DToGLPosition, "\n\nuniform float edge_count;\nuniform int draw_mode; // %2 => 0: LINE_STRIP, 1: TRIANGLE_FAN \nuniform float plugin_alpha_multiplier;\n//, lat, startAngle, tailAngle, ...rgba, radius, rgbaMode\nin vec2 center; // long, lat in radian\nin float start_angle; // the start of partial circle from bearing point\nin float tail_angle; // the rotation of the partial circle\nin vec4 color;\nin float radius; // in meter\nin float color_mode; // 0.0: constant, 1.0: fading, 2.0: hide\n// flat out int vid;\n// flat out float v_phase;\nout vec2 v_pos;\nout vec4 v_color;\n// flat out float v_angle;\n\nvoid main() {\n // vid = gl_VertexID;\n if (color_mode == 2.0 || radius == 0.0) { return; }\n float color_mode_ = color_mode;\n if ( draw_mode == 0 && color_mode == 1.0) {color_mode_ = 0.0;}\n float vertexID = float(gl_VertexID);\n float radius_ = radius;\n float alpha = plugin_alpha_multiplier;\n if (draw_mode == 1) { // TRIANGLE_FAN\n if (gl_VertexID == 0) { \n radius_ = 0.0; \n if ( color_mode == 1.0 ) { alpha = 0.0; }\n }\n vertexID -= 1.0;\n }\n float phase = ( vertexID / (edge_count - 1.0) );\n // v_angle = tail_angle;\n \n if ( color_mode_ == 1.0 ) {\n if ( tail_angle < 0.0 ) {\n v_color = vec4( color.rgb , color.a * ( 1.0 - phase ) * alpha );\n } else {\n v_color = vec4( color.rgb , color.a * phase * alpha );\n }\n } else {\n v_color = vec4( color.rgb , color.a * alpha );\n }\n if ( color_mode == 0.0 && draw_mode == 1 ) {\n v_color.a /= 2.0;\n }\n float angle;\n if ( tail_angle > 0.0 ) { \n angle = tail_angle * (-phase + 1.0) + start_angle;\n } else {\n angle = tail_angle * phase + start_angle;\n }\n if (is3D) {\n\n vec3 pos = circleLimpFromLongLatRadCenterCartesian3D(center, radius_, angle);\n v_pos = vec2(0.0, 0.0);\n gl_Position = cartesian3DToGLPosition(pos);\n }\n else {\n \n vec2 pos = circleLimpFromLongLatRadCenterMercatorRealDistance(center, radius_, angle);\n v_pos = pos;\n gl_Position = mercatorXYToGLPosition(pos);\n }\n\n gl_PointSize = 10.0;\n}");
21
+ var fragmentShaderSource = "#version 300 es" + geometrytransformations_1.POLE + geometrytransformations_1.PI + "\nprecision highp float;\n// flat in int vid;\nin vec4 v_color;\nin vec2 v_pos;\n// flat in float v_phase;\n// in float v_angle;\nout vec4 outColor;\nvoid main() {\n // if( vid % 2 == 0 ) { discard; }\n // if ( mod(v_angle, PI / 36.0 ) < (PI / 72.0)) { discard; }\n // if ( mod(v_angle * v_phase, PI / 90.0 ) < (PI / 180.0)) { discard; }\n if ( v_pos.x < -POLE || v_pos.x > POLE || v_pos.y < -POLE || v_pos.y > POLE ) { discard; }\n outColor = v_color;\n}";
22
+ exports.ITEM_SIZE = 10;
23
+ var Logic = /** @class */ (function () {
24
+ function Logic(globe) {
25
+ this.globe = globe;
26
+ this.gl = globe.gl;
27
+ this._lastMode = 0;
28
+ this._lastEdgeCount = 64;
29
+ this._lastAlphaMultiplier = 1.0;
30
+ this.program = (0, util_1.createProgram)(this.gl, vertexShaderSource, fragmentShaderSource);
31
+ var _a = this, gl = _a.gl, program = _a.program;
32
+ { // set attributes locations
33
+ gl.bindAttribLocation(program, 0, 'center');
34
+ gl.bindAttribLocation(program, 1, 'start_angle');
35
+ gl.bindAttribLocation(program, 2, 'tail_angle');
36
+ gl.bindAttribLocation(program, 3, 'color');
37
+ gl.bindAttribLocation(program, 4, 'radius');
38
+ gl.bindAttribLocation(program, 5, 'color_mode');
39
+ // vao
40
+ // instanced draw read 1
41
+ }
42
+ { // Uniforms
43
+ this._edgeCountLocation = gl.getUniformLocation(program, 'edge_count');
44
+ this._draw_modeLocation = gl.getUniformLocation(program, 'draw_mode');
45
+ this._plugin_alpha_multiplierLocation = gl.getUniformLocation(program, 'plugin_alpha_multiplier');
46
+ var currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
47
+ gl.useProgram(program);
48
+ gl.uniform1i(this._draw_modeLocation, this._lastMode);
49
+ gl.uniform1f(this._edgeCountLocation, this._lastEdgeCount);
50
+ gl.uniform1f(this._plugin_alpha_multiplierLocation, 1.0);
51
+ this.cameraBlockBindingPoint = 0;
52
+ this.cameraBlockTotem = programs_1.globeProgramCache.getProgram(globe, programs_1.CameraUniformBlockTotem);
53
+ var cameraBlockIndex = gl.getUniformBlockIndex(program, "CameraUniformBlock");
54
+ gl.uniformBlockBinding(program, cameraBlockIndex, this.cameraBlockBindingPoint);
55
+ gl.useProgram(currentProgram);
56
+ }
57
+ }
58
+ Logic.prototype.draw = function (length, vao, edgeCount, alphaMultiplier, drawMode) {
59
+ var _a = this, gl = _a.gl, program = _a.program, cameraBlockTotem = _a.cameraBlockTotem, cameraBlockBindingPoint = _a.cameraBlockBindingPoint;
60
+ // gl.disable(gl.DEPTH_TEST);
61
+ gl.useProgram(program);
62
+ if (drawMode !== this._lastMode) {
63
+ gl.uniform1i(this._draw_modeLocation, drawModeMap[drawMode]);
64
+ this._lastMode = drawMode;
65
+ }
66
+ if (edgeCount !== this._lastEdgeCount) {
67
+ gl.uniform1f(this._edgeCountLocation, edgeCount);
68
+ this._lastEdgeCount = edgeCount;
69
+ }
70
+ if (alphaMultiplier !== this._lastAlphaMultiplier) {
71
+ gl.uniform1f(this._plugin_alpha_multiplierLocation, alphaMultiplier);
72
+ this._lastAlphaMultiplier = alphaMultiplier;
73
+ }
74
+ var overdraw = drawModeMap[drawMode];
75
+ cameraBlockTotem.bind(cameraBlockBindingPoint);
76
+ gl.bindVertexArray(vao);
77
+ gl.drawArraysInstanced(gl[drawMode], 0, edgeCount + overdraw, length);
78
+ cameraBlockTotem.unbind(cameraBlockBindingPoint);
79
+ gl.bindVertexArray(null);
80
+ // gl.enable(gl.DEPTH_TEST);
81
+ };
82
+ Logic.prototype.free = function () {
83
+ programs_1.noRegisterGlobeProgramCache.releaseProgram(this.globe, programs_1.CameraUniformBlockTotem);
84
+ this.gl.deleteProgram(this.program);
85
+ this.program = null;
86
+ };
87
+ Logic.prototype.getVaoBuffer = function () {
88
+ var gl = this.gl;
89
+ var vao = gl.createVertexArray();
90
+ var buffer = gl.createBuffer();
91
+ gl.bindVertexArray(vao);
92
+ gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
93
+ var stride = exports.ITEM_SIZE * 4;
94
+ var offset = 0;
95
+ gl.enableVertexAttribArray(0);
96
+ gl.vertexAttribPointer(0, 2, gl.FLOAT, false, stride, offset);
97
+ offset += 2 * 4;
98
+ gl.enableVertexAttribArray(1);
99
+ gl.vertexAttribPointer(1, 1, gl.FLOAT, false, stride, offset);
100
+ offset += 1 * 4;
101
+ gl.enableVertexAttribArray(2);
102
+ gl.vertexAttribPointer(2, 1, gl.FLOAT, false, stride, offset);
103
+ offset += 1 * 4;
104
+ gl.enableVertexAttribArray(3);
105
+ gl.vertexAttribPointer(3, 4, gl.FLOAT, false, stride, offset);
106
+ offset += 4 * 4;
107
+ gl.enableVertexAttribArray(4);
108
+ gl.vertexAttribPointer(4, 1, gl.FLOAT, false, stride, offset);
109
+ offset += 1 * 4;
110
+ gl.enableVertexAttribArray(5);
111
+ gl.vertexAttribPointer(5, 1, gl.FLOAT, false, stride, offset);
112
+ gl.vertexAttribDivisor(0, 1);
113
+ gl.vertexAttribDivisor(1, 1);
114
+ gl.vertexAttribDivisor(2, 1);
115
+ gl.vertexAttribDivisor(3, 1);
116
+ gl.vertexAttribDivisor(4, 1);
117
+ gl.vertexAttribDivisor(5, 1);
118
+ gl.bindVertexArray(null);
119
+ gl.bindBuffer(gl.ARRAY_BUFFER, null);
120
+ return {
121
+ vao: vao,
122
+ buffer: buffer,
123
+ };
124
+ };
125
+ /**
126
+ * in vec2 center; // long, lat in radian
127
+ in float start_angle; // the start of partial circle from bearing point
128
+ in float tail_angle; // the rotation of the partial circle
129
+ in vec4 color;
130
+ in float radius; // in meter
131
+ in float color_mode; // 0.0: constant, 1.0: fading, 2.0: hide
132
+ */
133
+ Logic.prototype.createVAO = function (centerObj, startAngleObj, tailAngleObj, colorObj, radiusObj, colorModeObj) {
134
+ var gl = this.gl;
135
+ var vao = gl.createVertexArray();
136
+ gl.bindVertexArray(vao);
137
+ {
138
+ var buffer = centerObj.buffer, stride = centerObj.stride, offset = centerObj.offset;
139
+ gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
140
+ gl.enableVertexAttribArray(0);
141
+ gl.vertexAttribPointer(0, 2, gl.FLOAT, false, stride, offset);
142
+ gl.vertexAttribDivisor(0, 1);
143
+ }
144
+ {
145
+ var buffer = startAngleObj.buffer, stride = startAngleObj.stride, offset = startAngleObj.offset;
146
+ gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
147
+ gl.enableVertexAttribArray(1);
148
+ gl.vertexAttribPointer(1, 1, gl.FLOAT, false, stride, offset);
149
+ gl.vertexAttribDivisor(1, 1);
150
+ }
151
+ {
152
+ var buffer = tailAngleObj.buffer, stride = tailAngleObj.stride, offset = tailAngleObj.offset;
153
+ gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
154
+ gl.enableVertexAttribArray(2);
155
+ gl.vertexAttribPointer(2, 1, gl.FLOAT, false, stride, offset);
156
+ gl.vertexAttribDivisor(2, 1);
157
+ }
158
+ {
159
+ var buffer = colorObj.buffer, stride = colorObj.stride, offset = colorObj.offset;
160
+ gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
161
+ gl.enableVertexAttribArray(3);
162
+ gl.vertexAttribPointer(3, 4, gl.FLOAT, false, stride, offset);
163
+ gl.vertexAttribDivisor(3, 1);
164
+ }
165
+ {
166
+ var buffer = radiusObj.buffer, stride = radiusObj.stride, offset = radiusObj.offset;
167
+ gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
168
+ gl.enableVertexAttribArray(4);
169
+ gl.vertexAttribPointer(4, 1, gl.FLOAT, false, stride, offset);
170
+ gl.vertexAttribDivisor(4, 1);
171
+ }
172
+ {
173
+ var buffer = colorModeObj.buffer, stride = colorModeObj.stride, offset = colorModeObj.offset;
174
+ gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
175
+ gl.enableVertexAttribArray(5);
176
+ gl.vertexAttribPointer(5, 1, gl.FLOAT, false, stride, offset);
177
+ gl.vertexAttribDivisor(5, 1);
178
+ }
179
+ gl.bindVertexArray(null);
180
+ gl.bindBuffer(gl.ARRAY_BUFFER, null);
181
+ return vao;
182
+ };
183
+ Logic.prototype.getBufferManagerAndVao = function (_a) {
184
+ var _b = _a === void 0 ? {} : _a, _c = _b.capacity, capacity = _c === void 0 ? 10 : _c, _d = _b.bufferType, bufferType = _d === void 0 ? "DYNAMIC_DRAW" : _d;
185
+ var _e = this.getVaoBuffer(), vao = _e.vao, buffer = _e.buffer;
186
+ return {
187
+ bufferManager: new buffer_manager_1.default(this.globe, this.gl, buffer, { capacity: capacity, bufferType: bufferType }),
188
+ vao: vao
189
+ };
190
+ };
191
+ return Logic;
192
+ }());
193
+ exports.Logic = Logic;
194
+ exports.programCache = Object.freeze({
195
+ get: function (globe) { return programs_1.noRegisterGlobeProgramCache.getProgram(globe, Logic); },
196
+ release: function (globe) { return programs_1.noRegisterGlobeProgramCache.releaseProgram(globe, Logic); }
197
+ });
@@ -0,0 +1,308 @@
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
+ var webglobe_1 = require("@pirireis/webglobe");
25
+ var 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, ICON_MAP_URL, ICON_MAP_JSON_URL) {
48
+ if (mapName === void 0) { mapName = "IconMapName"; }
49
+ globe.api_AddIconMap('IconMapName', ICON_MAP_URL, ICON_MAP_JSON_URL);
50
+ }
51
+ var ObjectArray = /** @class */ (function () {
52
+ function ObjectArray(symbolSet, style) {
53
+ this.symbolSet = symbolSet;
54
+ this.style = style;
55
+ }
56
+ ObjectArray.prototype.setSymbolSet = function (symbolSet) {
57
+ this.symbolSet = symbolSet;
58
+ };
59
+ return ObjectArray;
60
+ }());
61
+ var PinPointObjectArray = /** @class */ (function () {
62
+ function PinPointObjectArray(id, globe, symbolSet, // iconMapName
63
+ style, callBacks) {
64
+ var _a;
65
+ if (callBacks === void 0) { callBacks = (_a = {}, function (pinItem, event) { } = _a.mouseDown, function (pinItem, event) { } = _a.mouseMove, function (pinItem, event) { } = _a.mouseUp, function (pinItem, event) { } = _a.mouseClick, function (pinItem, event) { } = _a.mouseDblClick, _a); }
66
+ this.id = id;
67
+ this.globe = globe;
68
+ this.symbolSet = symbolSet;
69
+ this.style = style;
70
+ this.iconMapName = iconMapName;
71
+ this.callBacks = callBacks;
72
+ // this item will be used
73
+ this.currentItem = null;
74
+ }
75
+ PinPointObjectArray.prototype.insertPins = function (pins) {
76
+ };
77
+ PinPointObjectArray.prototype.deletePins = function (pinsIDs) {
78
+ var deleteBucket = {
79
+ coords: [],
80
+ coordsZ: [],
81
+ attribs: []
82
+ };
83
+ };
84
+ PinPointObjectArray.prototype._queryByScreenFindFirst = function () {
85
+ var _a = this.globe.api_GetMousePos(), clientX = _a.clientX, clientY = _a.clientY;
86
+ var allObjects = this.globe.queryByScreen(clientX, clientY);
87
+ for (var i = 0; i < allObjects.length; i++) {
88
+ var _b = allObjects[i], obj = _b.obj, owner = _b.owner;
89
+ if (owner === this.objectArray) {
90
+ return obj;
91
+ }
92
+ }
93
+ };
94
+ // mouseDown(x, y, event) {
95
+ // return false
96
+ // }
97
+ // // mouse'a basılıp hareket ettirildiğinde, mouseDown'dan true dönmüşse çağrılır
98
+ // mouseMove(x, y, event) {
99
+ // }
100
+ // // mouse bırakıldığında çağrılır
101
+ // mouseUp(x, y, event) {
102
+ // }
103
+ // // harita üzerinde tıklandığında çağrılır
104
+ // mouseClick() {
105
+ // return false
106
+ // }
107
+ // // harita üzerinde çift tıklandığında çağrılır
108
+ // mouseDblClick() {
109
+ // return false
110
+ // }
111
+ PinPointObjectArray.prototype.free = function () {
112
+ this.globe.api_ClearMouseEvents(); // TODO
113
+ };
114
+ PinPointObjectArray.prototype._setMouseEvent = function () {
115
+ var globe = this.globe;
116
+ globe.api_SetMouseEvents();
117
+ };
118
+ PinPointObjectArray.prototype._getIdForGlobe = function () {
119
+ var _a = this, globe = _a.globe, objectArray = _a.objectArray;
120
+ var callback = function () {
121
+ var allObjects = globe.api_queryByScreen();
122
+ };
123
+ return "".concat(this.id, "_pinObjectArrayMouseEvent");
124
+ };
125
+ return PinPointObjectArray;
126
+ }());
127
+ var ObjectArrayLabels = /** @class */ (function () {
128
+ /**
129
+ * @param {number | string} id
130
+ * @param {CSGlobe} globe
131
+ */
132
+ function ObjectArrayLabels(id, globe, labelStyle) {
133
+ if (labelStyle === void 0) { 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
+ ObjectArrayLabels.prototype._setStyle = function (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
+ ObjectArrayLabels.prototype.setGlobe = function (globe) {
178
+ if (!globe)
179
+ return;
180
+ this.globe = globe;
181
+ };
182
+ ObjectArrayLabels.prototype.addToMap = function () {
183
+ this.globe.ObjectArray.Add(this);
184
+ };
185
+ ObjectArrayLabels.prototype.removeFromMap = function () {
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
+ ObjectArrayLabels.prototype.setData = function (data) {
194
+ this.globe.ObjectArray.SetData(this, [data]);
195
+ };
196
+ /**
197
+ * @param {PointObjectArray} data
198
+ * @param {CSObjectArrayUpdateTypes} operation
199
+ * @param {CanChangeOptions} [canChange]
200
+ */
201
+ ObjectArrayLabels.prototype.updateData = function (data, operation, canChange) {
202
+ this.globe.ObjectArray.UpdateData(this, operation, [data], canChange);
203
+ };
204
+ ObjectArrayLabels.prototype.flush = function () {
205
+ var 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
+ ObjectArrayLabels.prototype.setControlledData = function (data) {
218
+ var _this = this;
219
+ var paritalData = {
220
+ add: {
221
+ coords: [],
222
+ coordsZ: [],
223
+ attribs: [],
224
+ },
225
+ update: {
226
+ coords: [],
227
+ coordsZ: [],
228
+ attribs: [],
229
+ },
230
+ delete: {
231
+ coords: [],
232
+ coordsZ: [],
233
+ attribs: [],
234
+ },
235
+ canChange: {
236
+ // Tüm değişimler gözardı edilecek
237
+ attribs: false,
238
+ icon: false,
239
+ label: false,
240
+ heading: false,
241
+ },
242
+ };
243
+ // İlk toplu ekleme adımı
244
+ if (this._idCollector.size === 0) {
245
+ this.setData(data);
246
+ // Eklenen id'ler set edildi
247
+ for (var i = 0; i < data.attribs.length; i++) {
248
+ var currentPayload = data.attribs[i];
249
+ var id = currentPayload[this.primaryKey];
250
+ this._idCollector.add(id);
251
+ }
252
+ return;
253
+ }
254
+ /** @type {Set<string>} */
255
+ var dataIds = new Set();
256
+ for (var i = 0; i < data.attribs.length; i++) {
257
+ var currentPayload = data.attribs[i];
258
+ var id = currentPayload[this.primaryKey];
259
+ var bucket = paritalData.add;
260
+ dataIds.add(id);
261
+ if (this._idCollector.has(id)) {
262
+ bucket = paritalData.update;
263
+ }
264
+ else {
265
+ this._idCollector.add(id);
266
+ }
267
+ bucket.coords.push(data.coords[2 * i], data.coords[2 * i + 1]);
268
+ bucket.coordsZ.push(data.coordsZ[i]);
269
+ bucket.attribs.push(currentPayload);
270
+ }
271
+ // Artık varolmayan elemenları sil
272
+ var deleteBucket = paritalData.delete;
273
+ this._idCollector.forEach(function (id) {
274
+ var _a;
275
+ if (!dataIds.has(id)) {
276
+ _this._idCollector.delete(id);
277
+ deleteBucket.coords.push(0, 0);
278
+ deleteBucket.coordsZ.push(0);
279
+ deleteBucket.attribs.push((_a = {},
280
+ _a[_this.primaryKey] = id,
281
+ _a));
282
+ }
283
+ });
284
+ if (paritalData.add.coords.length > 0) {
285
+ this.updateData(paritalData.add, webglobe_1.CSObjectArrayUpdateTypes.ADD);
286
+ }
287
+ if (paritalData.update.coords.length > 0) {
288
+ this.updateData(paritalData.update, webglobe_1.CSObjectArrayUpdateTypes.UPDATE, paritalData.canChange);
289
+ }
290
+ if (paritalData.delete.coords.length > 0) {
291
+ this.updateData(paritalData.delete, webglobe_1.CSObjectArrayUpdateTypes.DELETE);
292
+ }
293
+ };
294
+ ObjectArrayLabels.prototype.setPrimarykey = function (key) {
295
+ this.primaryKey = key;
296
+ };
297
+ ObjectArrayLabels.prototype.setSymbolSet = function (symbolSet) {
298
+ this.symbolSet = symbolSet;
299
+ };
300
+ ObjectArrayLabels.prototype.getLabelStyle = function () {
301
+ return this.style.labels[0];
302
+ };
303
+ ObjectArrayLabels.prototype.setLabelStyle = function (style) {
304
+ this.style.labels[0] = style;
305
+ };
306
+ return ObjectArrayLabels;
307
+ }());
308
+ exports.default = ObjectArrayLabels;
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ /**
3
+ * This class registered as globe plugin one for each globe. to the head of plugin call stack.
4
+ */
5
+ var PinPointTotem = /** @class */ (function () {
6
+ function PinPointTotem(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
+ PinPointTotem.prototype.registerPinMap = function (objectArray, callbacks) {
22
+ this.objectArrayMap.set(objectArray, callbacks);
23
+ };
24
+ PinPointTotem.prototype.unregisterPinMap = function (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
+ PinPointTotem.prototype.mouseDown = function (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
+ PinPointTotem.prototype.mouseMove = function (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
+ PinPointTotem.prototype.mouseUp = function (x, y, event) {
43
+ };
44
+ // harita üzerinde tıklandığında çağrılır
45
+ PinPointTotem.prototype.mouseClick = function (x, y, event) {
46
+ return false;
47
+ };
48
+ // harita üzerinde çift tıklandığında çağrılır
49
+ PinPointTotem.prototype.mouseDblClick = function (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
+ PinPointTotem.prototype.keyDown = function (event) {
54
+ return false;
55
+ };
56
+ // klavyedeki bir tuştan parmak çekildiği anda çalışır
57
+ PinPointTotem.prototype.keyUp = function (event) {
58
+ return false;
59
+ };
60
+ return PinPointTotem;
61
+ }());
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ /**
3
+ * @typedef {Float32Array} TimeTrackMultiColorData | A linestring is representation, let A{a1, a2, a3}, B{b1, b2} be the points of the line.
4
+ * TimeTrackMultiColorData is [
5
+ * a1x, a1y, a1z, a1time, a1r, a1g, a1b, a1time, a3time,
6
+ * a2x, a2y, a2z, a2time, a2r, a2g, a2b, a1time, a3time,
7
+ * a3x, a3y, a3z, a3time, a3r, a3g, a3b, a1time, a3time,
8
+ * 0, 0, 0, 0, -1, -1, -1, 0, 0,
9
+ * b1x, b1y, b1z, b1time, b1r, b1g, b1b, b1time, b2time,
10
+ * b2x, b2y, b2z, b2time, b2r, b2g, b2b, BstartTime, BendTime
11
+ * ]
12
+ * there is a cutting point between A and B
13
+ *
14
+ */
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.timeTrackPluginDataToPointHeatInterpolatorAdapter = void 0;
17
+ /**
18
+ * ABOVE
19
+ * TO
20
+ * BELOW
21
+
22
+ /**
23
+ * @typedef {Array<number>} vec3 [x, y, z]
24
+ * @typedef {Array<number>} vec2 [x, y]
25
+ * @typedef {Array<number>} vec4 [x, y, z, w]
26
+ * @typedef {number} fraction a number between 0 and 1
27
+ * @typedef {Array<number>} wgs84 [long, lat]
28
+ */
29
+ /**
30
+ * @typedef Timetrack
31
+ * @property {Array<vec4>}} coordinates [x,y,z, length]
32
+ * @property {Array<Number>} times
33
+ * @param {Array<Timetrack>} timeTracks
34
+ */
35
+ var methods_1 = require("../../Math/methods");
36
+ var processACut = function (array, offset) {
37
+ // first 3 values of array
38
+ var v3 = array.slice(offset, offset + 3);
39
+ var v4 = (0, methods_1.pixelXYLenghtToUnitVectorWithHeight)(v3);
40
+ var time = array[offset + 3];
41
+ return [v4, time];
42
+ };
43
+ var timeTrackPluginDataToPointHeatInterpolatorAdapter = function (timeTrackPluginData) {
44
+ var timeTracks = [];
45
+ var offset = 0;
46
+ var timeTrack = {
47
+ coordinates: [],
48
+ times: []
49
+ };
50
+ while (offset < timeTrackPluginData.length) {
51
+ if (!timeTrackPluginData[offset]) {
52
+ timeTracks.push(timeTrack);
53
+ timeTrack = {
54
+ coordinates: [],
55
+ times: []
56
+ };
57
+ offset += 9;
58
+ }
59
+ var point = processACut(timeTrackPluginData, offset);
60
+ offset += 9;
61
+ timeTrack.coordinates.push(point[0]);
62
+ timeTrack.times.push(point[1]);
63
+ }
64
+ return timeTracks;
65
+ };
66
+ exports.timeTrackPluginDataToPointHeatInterpolatorAdapter = timeTrackPluginDataToPointHeatInterpolatorAdapter;
@@ -0,0 +1 @@
1
+ "use strict";