@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,132 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TextureToGlobeProgram = void 0;
4
+ var webglobjectbuilders_1 = require("../webglobjectbuilders");
5
+ var __1 = require("..");
6
+ var __2 = require("..");
7
+ /** TODO:
8
+ * 3d icin calistir
9
+ */
10
+ //TODO: DELETE THIS FILE.
11
+ var TextureToGlobeProgram = /** @class */ (function () {
12
+ function TextureToGlobeProgram(gl, globe) {
13
+ this.globe = globe;
14
+ this.gl = gl;
15
+ this._is3D = true;
16
+ this._programWrapper = this._createProgramWrapper();
17
+ this._resizeHandler = this._resizeEventHandler.bind(this);
18
+ window.addEventListener('resize', this._resizeHandler, true);
19
+ }
20
+ TextureToGlobeProgram.prototype._initUniforms = function () {
21
+ var _a = this, gl = _a.gl, _programWrapper = _a._programWrapper;
22
+ var currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
23
+ gl.useProgram(_programWrapper.program);
24
+ // set u_alpha
25
+ gl.uniformMatrix3fv(_programWrapper.u_bbox_matrix, false, new Float32Array([
26
+ 1, 0, 0,
27
+ 0, 1, 0,
28
+ 0, 0, 1
29
+ ]));
30
+ gl.uniform1f(_programWrapper.u_alpha, 1.0);
31
+ gl.uniform1f(_programWrapper.u_is3D, 1.0);
32
+ gl.uniform1f(_programWrapper.height, 0.0);
33
+ gl.useProgram(currentProgram);
34
+ };
35
+ TextureToGlobeProgram.prototype._createProgramWrapper = function () {
36
+ var gl = this.gl;
37
+ var vertexSource = "#version 300 es\n precision highp float;\n\n in vec2 a_position;\n\n uniform mat3 u_bbox_matrix;\n\n uniform mat4 u_model_view_matrix;\n uniform mat4 u_proj_matrix;\n uniform vec3 u_transpos;\n\n uniform vec2 u_mapWH;\n uniform vec2 u_scrWH;\n\n uniform bool u_is3D;\n uniform float height; \n\n out vec2 v_texcoord;\n\n\n " + __1.shaderfunctions.pixelXYToCartesian3DPoint + "\n " + __1.shaderfunctions.pixelXYToCartesian2DPoint + "\n\n\n void main() {\n vec3 pos = u_bbox_matrix * vec3(a_position, height);\n if(u_is3D){\n pos = pixelXYToCartesian3DPoint(pos);\n gl_Position = u_proj_matrix * u_model_view_matrix * vec4(pos - u_transpos, 1.0);\n } else {\n vec2 xy = pixelXYToCartesian2DPoint(pos.xy, u_transpos.xy, u_mapWH, u_scrWH);\n gl_Position = u_proj_matrix * vec4(xy.x, xy.y, 0.0, 1.0);\n }\n gl_PointSize = 100.0;\n v_texcoord = a_position * 0.5 + 0.5; // need a check\n }\n ";
38
+ var fragmentSource = "#version 300 es\n precision highp float;\n\n in vec2 v_texcoord;\n\n uniform float u_alpha;\n uniform sampler2D u_texture;\n\n out vec4 outColor;\n\n void main() {\n // outColor = texture(u_texture, v_texcoord);\n // outColor.a *= u_alpha;\n outColor = vec4(1.0, 0.0, 0.0, 0.5);\n } \n ";
39
+ var program = (0, webglobjectbuilders_1.createProgram)(gl, vertexSource, fragmentSource);
40
+ var vao = gl.createVertexArray();
41
+ var buffer = gl.createBuffer();
42
+ gl.bindVertexArray(vao);
43
+ gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
44
+ gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([
45
+ 0, 0,
46
+ 1, 0,
47
+ 1, 1,
48
+ 0, 1
49
+ ]), gl.STATIC_DRAW);
50
+ var a_position = -gl.getAttribLocation(program, 'a_position');
51
+ gl.enableVertexAttribArray(a_position);
52
+ gl.vertexAttribPointer(a_position, 2, gl.FLOAT, false, 0, 0);
53
+ gl.bindVertexArray(null);
54
+ return {
55
+ program: program,
56
+ vao: vao,
57
+ u_model_view_matrix: gl.getUniformLocation(program, 'u_model_view_matrix'),
58
+ u_proj_matrix: gl.getUniformLocation(program, 'u_proj_matrix'),
59
+ u_transpos: gl.getUniformLocation(program, 'u_transpos'),
60
+ u_mapWH: gl.getUniformLocation(program, 'u_mapWH'),
61
+ u_scrWH: gl.getUniformLocation(program, 'u_scrWH'),
62
+ u_texture: gl.getUniformLocation(program, 'u_texture'),
63
+ u_bbox_matrix: gl.getUniformLocation(program, 'u_bbox_matrix'),
64
+ u_is3D: gl.getUniformLocation(program, 'u_is3D'),
65
+ };
66
+ };
67
+ TextureToGlobeProgram.prototype.draw = function (modelViewMatrix, projectionMatrix, transPos, texture) {
68
+ // console.log('draw')
69
+ var _a = this, gl = _a.gl, _programWrapper = _a._programWrapper, _is3D = _a._is3D;
70
+ gl.useProgram(_programWrapper.program);
71
+ gl.bindVertexArray(_programWrapper.vao);
72
+ gl.uniformMatrix4fv(_programWrapper.u_model_view_matrix, false, modelViewMatrix);
73
+ gl.uniformMatrix4fv(_programWrapper.u_proj_matrix, false, projectionMatrix);
74
+ gl.uniform3f(_programWrapper.u_transpos, transPos.x, transPos.y, transPos.z);
75
+ gl.activeTexture(gl.TEXTURE0);
76
+ gl.bindTexture(gl.TEXTURE_2D, texture);
77
+ gl.uniform1i(_programWrapper.u_texture, 0);
78
+ if (!_is3D) {
79
+ var mapWH = this.globe.api_GetCurrentWorldWH();
80
+ gl.uniform2f(_programWrapper.u_mapWH, mapWH.width, mapWH.height);
81
+ }
82
+ gl.drawArrays(gl.TRIANGLE_FAN, 0, 4);
83
+ gl.drawArrays(gl.POINTS, 0, 4);
84
+ };
85
+ TextureToGlobeProgram.prototype.setBBox = function (minx, maxx, miny, maxy) {
86
+ var _a = this, gl = _a.gl, _programWrapper = _a._programWrapper;
87
+ var currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
88
+ gl.useProgram(_programWrapper.program);
89
+ gl.uniformMatrix3fv(_programWrapper.u_bbox_matrix, false, new Float32Array([
90
+ maxx - minx, 0, minx,
91
+ 0, maxy - miny, miny,
92
+ 0, 0, 1
93
+ ]));
94
+ gl.useProgram(currentProgram);
95
+ };
96
+ TextureToGlobeProgram.prototype.setLatLongBBox = function (minx, maxx, miny, maxy) {
97
+ var bboxMatrix = (0, __2.latLongBboxtoPixelXYBbox)(minx, miny, maxx, maxy);
98
+ var _a = this, gl = _a.gl, _programWrapper = _a._programWrapper;
99
+ var currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
100
+ gl.useProgram(_programWrapper.program);
101
+ gl.uniformMatrix3fv(_programWrapper.u_bbox_matrix, false, bboxMatrix);
102
+ gl.useProgram(currentProgram);
103
+ };
104
+ TextureToGlobeProgram.prototype.setScreenWH = function () {
105
+ var _a = this, gl = _a.gl, _programWrapper = _a._programWrapper, globe = _a.globe;
106
+ var currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
107
+ gl.useProgram(_programWrapper.program);
108
+ gl.uniform2f(_programWrapper.u_scrWH, globe.api_ScrW(), globe.api_ScrH());
109
+ gl.useProgram(currentProgram);
110
+ };
111
+ TextureToGlobeProgram.prototype.resize = function () {
112
+ var globe = this.globe;
113
+ this.setScreenWH();
114
+ };
115
+ TextureToGlobeProgram.prototype.setGeometry = function () {
116
+ var _a = this, gl = _a.gl, globe = _a.globe, _programWrapper = _a._programWrapper;
117
+ this._is3D = globe.api_GetCurrentGeometry() === 0;
118
+ var currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
119
+ gl.useProgram(_programWrapper.program);
120
+ gl.uniform1f(_programWrapper.u_is3D, this._is3D ? 1.0 : 0.0);
121
+ gl.useProgram(currentProgram);
122
+ this.resize();
123
+ };
124
+ TextureToGlobeProgram.prototype.free = function () {
125
+ window.removeEventListener('resize', this._resizeHandler, true);
126
+ };
127
+ TextureToGlobeProgram.prototype._resizeEventHandler = function () {
128
+ this.resize();
129
+ };
130
+ return TextureToGlobeProgram;
131
+ }());
132
+ exports.TextureToGlobeProgram = TextureToGlobeProgram;
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ // Z in kolometers
3
+ //
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.circleOnSphere = exports.circleLimpFromLongLatRadCenterMercatorRealDistanceNew_accurate = exports.circleLimpFromLongLatRadCenterMercatorCompass_accurate = exports.circleLimpFromLongLatRadCenterCartesian3D_accurate = exports.slerp = exports.realDistanceOnSphereR1 = exports.circleCircumferenceInterPolationOf2PointsRadian = exports.angleBetweenTwoPointsRadian = exports.cartesianToSpherical = exports.circleLimpFromLongLatRadCenterMercatorCompass = exports.circleLimpFromLongLatRadCenterMercatorRealDistancePadding = exports.circleLimpFromLongLatRadCenterMercatorRealDistance = exports.circleLimpFromLongLatRadCenterMercatorRealDistanceNew = exports.circleLimpFromLongLatRadCenterCartesian3D = exports.longLatRadToCartesian3DWithR = exports.longLatRadToCartesian3D = exports.longLatRadToMercator = exports.cartesian3DToGLPosition = exports.mercatorXYToGLPosition = exports.pixelXYToCartesian2DPoint = exports.pixelXYToCartesian3DPoint = exports.R_3D = exports.POLE_BY_PI = exports.PI = exports.R = exports.POLE = void 0;
6
+ exports.POLE = "\n#ifndef POLE\n#define POLE 20037508.34\n#endif\n";
7
+ exports.R = "\n#ifndef R\n#define R 6378137.0\n#endif\n";
8
+ exports.PI = "\n#ifndef PI\n#define PI 3.141592653589793\n\n#endif\n";
9
+ exports.POLE_BY_PI = " \n#ifndef POLE_BY_PI\n#define POLE_BY_PI 6378137.0\n#endif\n";
10
+ exports.R_3D = "\n#ifndef R_3D\n#define R_3D 6378.137\n#endif\n";
11
+ exports.pixelXYToCartesian3DPoint = exports.R_3D + exports.PI + "\nvec3 pixelXYToCartesian3DPoint( vec3 position) {\n float longRad = PI * (2.0 * position.x - 1.0);\n float latRad = PI * position.y;\n float radius = R_3D + position.z;\n float x = radius * sin(latRad) * cos(longRad);\n float y = radius * sin(latRad) * sin(longRad);\n float z = radius * cos(latRad);\n return vec3(x, y, z);\n}\n";
12
+ exports.pixelXYToCartesian2DPoint = exports.PI + exports.POLE + exports.POLE_BY_PI + "\nvec2 pixelXYToCartesian2DPoint( vec2 position, vec2 translate, vec2 mapWH, vec2 screenWH) {\n float x = (2.0 * position.x - 1.0) * POLE;\n x = ((x - translate.x) / mapWH.x) * screenWH.x; \n float y = log( tan( ( 1.0 - position.y ) * PI / 2.0 ) ) * POLE_BY_PI;\n y = (1.0 - (y - translate.y) / mapWH.y) * screenWH.y;\n return vec2(x, y);\n}\n";
13
+ // TODO: rename it to mercatorXYToGLPosition
14
+ exports.mercatorXYToGLPosition = "\nvec4 mercatorXYToGLPosition( vec2 position) { // projection, translate, mapWH, screenWH comes from camera uniform block\n float x = (( position.x - translate.x ) / mapWH.x) * screenWH.x;\n float y = (1.0 - (position.y - translate.y) / mapWH.y) * screenWH.y;\n return projection * vec4(x, y, 0.0, 1.0);\n} \n";
15
+ exports.cartesian3DToGLPosition = "\nvec4 cartesian3DToGLPosition( vec3 position) {\n return projection * view * vec4(position - translate, 1.0);\n}\n";
16
+ // pi / pole = 2 / R
17
+ exports.longLatRadToMercator = exports.R + exports.PI + "\nvec2 longLatRadToMercator( vec2 longLatRad) {\n float x = R * longLatRad.x;\n float y = R * log( tan( PI / 4.0 + longLatRad.y / 2.0 ) );\n y -= mix(-60.0, 60.0, abs(longLatRad.y + PI / 8.0) / (PI / 4.0));\n return vec2(x, y);\n}\n";
18
+ exports.longLatRadToCartesian3D = exports.R_3D + "\nvec3 longLatRadToCartesian3D( vec2 longLat) {\n float x = R_3D * cos(longLat.y) * cos(longLat.x);\n float y = R_3D * cos(longLat.y) * sin(longLat.x);\n float z = R_3D * sin(longLat.y);\n return vec3(x, y, z);\n}\n";
19
+ exports.longLatRadToCartesian3DWithR = "\nvec3 longLatRadToCartesian3DWithR( vec2 longLat, float radius) {\n float x = radius * cos(longLat.y) * cos(longLat.x);\n float y = radius * cos(longLat.y) * sin(longLat.x);\n float z = radius * sin(longLat.y);\n return vec3(x, y, z);\n}\n";
20
+ // TODO: Make it precise. It doesnt use haversine formula. If this changes, change the formmula which calculates text position.
21
+ exports.circleLimpFromLongLatRadCenterCartesian3D = exports.R + "\nvec3 circleLimpFromLongLatRadCenterCartesian3D( vec2 center, float radius, float angle) {\n vec3 geoW = longLatRadToCartesian3D(center);\n vec3 normal = normalize(geoW);\n vec3 tangent1 = cross(normal, vec3(0.0, 0.0, -1.0));\n if ( length(tangent1) < 0.1 ){ tangent1 = cross(normal, vec3(0.0, -1.0, 0.0)); }\n tangent1 = normalize(tangent1);\n // rotate tangent with given angle\n tangent1 = cos(angle) * tangent1 - sin(angle) * cross(normal, tangent1);\n float radius_in_angle = radius/R;\n float projected_radius = sin(radius_in_angle) * R / 1000.0;\n return (geoW * cos(radius_in_angle))+ tangent1 * projected_radius;\n }\n";
22
+ // TODO: Make it precise. Y axis is not correct.
23
+ exports.circleLimpFromLongLatRadCenterMercatorRealDistanceNew = exports.PI + "\nvec2 circleLimpFromLongLatRadCenterMercatorRealDistance(vec2 center, float radius, float angle) {\n float ang = angle + PI / 2.0; // Shift angle to align with +x axis\n float r = radius / R;\n float cos_r = cos(r);\n float sin_r = sin(r);\n\n float sin_lat = sin(center.y) * cos_r + cos(center.y) * sin_r * cos(ang);\n float lat = asin(sin_lat);\n\n float delta_long = atan(sin(ang) * sin_r * cos(center.y), cos_r - sin(center.y) * sin_lat);\n float longi = center.x + delta_long;\n \n\n return vec2(\n R * longi,\n R * log(tan(PI / 4.0 + lat / 2.0)) \n );\n}";
24
+ exports.circleLimpFromLongLatRadCenterMercatorRealDistance = exports.PI + "\nvec2 circleLimpFromLongLatRadCenterMercatorRealDistance(vec2 center, float radius, float angle){\n float ang = angle + PI / 2.0; // this is there because the other methods are implemented in, angle 0 is +x axis orientatation\n float r = radius / R;\n float sin_lat = sin(center.y) * cos(r) + cos(center.y) * sin(r) * cos(ang);\n float lat = asin(sin_lat);\n float longi = center.x + atan(sin(ang) * sin(r) * cos(center.y), cos(r) - sin(center.y) * sin_lat);\n return longLatRadToMercator(vec2(longi, lat));\n}\n";
25
+ // TODO: reconstruct this function
26
+ exports.circleLimpFromLongLatRadCenterMercatorRealDistancePadding = "\nvec2 circleLimpFromLongLatRadCenterMercatorRealDistancePadding(vec2 center, float radius, float angle){\n float radius_radian = radius / R;\n float new_angle;\n if (angle != - 1.5707963267948966192313216916398) {\n float section = floor(angle / (PI / 2.0)) + 1.0;\n float lat = center.y - radius_radian * sin(angle);\n float scale = 1.0 / abs(cos(lat));\n new_angle = atan(tan(angle) * scale);\n if (section == 2.0) {\n new_angle = mod(new_angle, PI);\n } else if (section == 3.0) {\n new_angle = new_angle + PI;\n }\n } else {\n new_angle = angle;\n }\n float new_lat = center.y - radius_radian * sin(new_angle);\n float new_scale = 1.0 / abs(cos(new_lat));\n\n vec2 center_ = longLatRadToMercator(center);\n float x = center_.x + new_scale * radius * cos(new_angle);\n float y = center_.y - new_scale * radius * sin(new_angle);\n return vec2(x, y);\n}\n";
27
+ exports.circleLimpFromLongLatRadCenterMercatorCompass = "\nvec2 circleLimpFromLongLatRadCenterMercatorCompass(vec2 center, float radius, float angle){\n vec2 center_ = longLatRadToMercator(center);\n float y = -sin(angle) * radius + center_.y;\n float x = cos(angle) * radius + center_.x;\n return vec2(x, y);\n} ";
28
+ // Function to convert Cartesian coordinates back to spherical (latitude, longitude)
29
+ exports.cartesianToSpherical = "\nvec2 cartesianToSpherical(vec3 point) {\n float lat = degrees(asin(point.z)); // Latitude\n float lon = degrees(atan(point.y, point.x)); // Longitude\n\n return vec2(lat, lon);\n} ";
30
+ // Main function to calculate an intermediate point
31
+ exports.angleBetweenTwoPointsRadian = "\nfloat angleBetweenTwoPointsRadian(vec2 start_, vec2 end_) {\n float start_lat = log(tan((1.0 - start_.y) * PI / 2.0));\n float end_lat = log(tan((1.0 - end_.y) * PI / 2.0));\n float angle = atan((end_lat - start_lat) / (end_.x - start_.x));\n return angle;\n}\n";
32
+ exports.circleCircumferenceInterPolationOf2PointsRadian = "\nfloat circleCircumferenceInterPolationOf2PointsRadian(vec2 center, vec2 target, float bearing_angle, float ratio) {\n vec2 t = target - center;\n float mainAngle = atan(t.x, t.y);\n float angle = mainAngle - * ratio;\n return angle;\n}\n";
33
+ exports.realDistanceOnSphereR1 = "\nfloat realDistanceOnSphereR1(vec2 longLat1, vec2 longLat2) {\n float dLat = longLat2.y - longLat1.y;\n float dLong = longLat2.x - longLat1.x;\n float a = sin(dLat / 2.0) * sin(dLat / 2.0) + cos(longLat1.y) * cos(longLat2.y) * sin(dLong / 2.0) * sin(dLong / 2.0);\n float c = 2.0 * atan(sqrt(a), sqrt(1.0 - a));\n return c;\n}\n";
34
+ var pointsOnSphereBetween = "\nvec3 pointsOnSphereBetween(vec3 a, vec3 b, float ratio) {\n // Normalize the input points to ensure they are on the unit sphere\n a = normalize(a);\n b = normalize(b);\n\n // Compute the dot product and clamp it to avoid numerical issues\n // float dotProduct = clamp(dot(a, b), -1.0, 1.0);\n\n // Compute the angle between the points\n float theta = acos(dot(a, b));\n\n // Handle the edge case where the points are nearly identical\n if (theta < 0.0001) {\n return normalize(mix(a, b, ratio)); // Linear interpolation as fallback\n }\n\n // Compute the interpolated point using spherical linear interpolation (slerp)\n float sinTheta = sin(theta);\n float factorA = sin((1.0 - ratio) * theta) / sinTheta;\n float factorB = sin(ratio * theta) / sinTheta;\n\n vec3 result = factorA * a + factorB * b;\n\n // Return the normalized result to ensure it lies on the sphere\n return normalize(result);\n}";
35
+ var slerp = "\n".concat(pointsOnSphereBetween, "\nvec3 slerp(vec3 A, vec3 B, float t) {\n return pointsOnSphereBetween(A, B, t) * mix(length(A), length(B), t);\n}\n");
36
+ exports.slerp = slerp;
37
+ var circleLimpFromLongLatRadCenterCartesian3D_accurate = exports.R + "\nvec3 circleLimpFromLongLatRadCenterCartesian3D_accurate( vec3 geoW, float radius, float angle) {\n vec3 normal = normalize(geoW);\n vec3 tangent1 = cross(normal, vec3(0.0, 0.0, -1.0));\n if ( length(tangent1) < 0.1 ){ tangent1 = cross(normal, vec3(0.0, -1.0, 0.0)); }\n tangent1 = normalize(tangent1);\n // rotate tangent with given angle\n tangent1 = cos(angle) * tangent1 - sin(angle) * cross(normal, tangent1);\n float radius_in_angle = radius/R;\n float projected_radius = sin(radius_in_angle) * R / 1000.0;\n return (geoW * cos(radius_in_angle)) + tangent1 * projected_radius;\n}";
38
+ exports.circleLimpFromLongLatRadCenterCartesian3D_accurate = circleLimpFromLongLatRadCenterCartesian3D_accurate;
39
+ var circleOnSphere = "\nvec3 rotateVectorAroundAxis(vec3 v, vec3 axis, float angle) {\n float c = cos(angle);\n float s = sin(angle);\n float t = 1.0 - c;\n vec3 normalizedAxis = normalize(axis); // Ensure axis is unit length\n\n return vec3(\n (t * normalizedAxis.x * normalizedAxis.x + c) * v.x +\n (t * normalizedAxis.x * normalizedAxis.y - s * normalizedAxis.z) * v.y +\n (t * normalizedAxis.x * normalizedAxis.z + s * normalizedAxis.y) * v.z,\n\n (t * normalizedAxis.x * normalizedAxis.y + s * normalizedAxis.z) * v.x +\n (t * normalizedAxis.y * normalizedAxis.y + c) * v.y +\n (t * normalizedAxis.y * normalizedAxis.z - s * normalizedAxis.x) * v.z,\n\n (t * normalizedAxis.x * normalizedAxis.z - s * normalizedAxis.y) * v.x +\n (t * normalizedAxis.y * normalizedAxis.z + s * normalizedAxis.x) * v.y +\n (t * normalizedAxis.z * normalizedAxis.z + c) * v.z\n );\n\n // Alternative, more compact way using cross and dot products:\n // vec3 crossProd = cross(normalizedAxis, v);\n // float dotProd = dot(normalizedAxis, v);\n // return v * c + crossProd * s + normalizedAxis * dotProd * t;\n}\n\n/**\n * @brief Calculates a point on a circle drawn on the surface of a sphere.\n * The sphere is assumed to be centered at the origin (0,0,0).\n * The circle's center on the sphere surface is M, and H is a starting point on the circle.\n * The function returns the point obtained by rotating H around the axis defined by M by angle A.\n *\n * @param M The center point of the circle on the sphere's surface. The vector from the origin to M defines the rotation axis.\n * @param H A starting point on the circle (also on the sphere's surface).\n * @param A The angle of rotation in radians. Use radians(degrees) if your input is in degrees.\n * @return A vec3 representing the calculated point on the sphere's surface.\n */\nvec3 circleOnSphere(vec3 M, vec3 H, float A) {\n // The rotation axis is the vector from the origin to the circle's center point M on the sphere.\n // This axis vector needs to be normalized for the rotation formula.\n vec3 rotationAxis = normalize(M);\n\n // Rotate the starting point H around the rotation axis by angle A.\n vec3 rotatedPoint = rotateVectorAroundAxis(H, rotationAxis, A);\n\n // Optional but recommended: Re-normalize the result to ensure it stays exactly on the sphere's surface,\n // counteracting potential floating-point inaccuracies, especially if the original sphere radius was 1.\n // If the sphere has a different radius R, you might want to normalize and multiply by R:\n // float radius = length(M); // Assuming M is exactly on the surface\n // return normalize(rotatedPoint) * radius;\n // If it's a unit sphere:\n // return normalize(rotatedPoint);\n\n // For simplicity, returning the direct result of rotation. Assume M and H were perfectly on the sphere.\n return rotatedPoint;\n}";
40
+ exports.circleOnSphere = circleOnSphere;
41
+ var circleLimpFromLongLatRadCenterMercatorCompass_accurate = "\nvec2 circleLimpFromLongLatRadCenterMercatorCompass_accurate(vec2 center, float radius, float angle){\n float y = -sin(angle) * radius + center.y;\n float x = cos(angle) * radius + center.x;\n return vec2(x, y);\n} ";
42
+ exports.circleLimpFromLongLatRadCenterMercatorCompass_accurate = circleLimpFromLongLatRadCenterMercatorCompass_accurate;
43
+ //TODO make it work...
44
+ var circleLimpFromLongLatRadCenterMercatorRealDistanceNew_accurate = exports.PI + "\nvec2 circleLimpFromLongLatRadCenterMercatorRealDistanceNew_accurate(vec2 mercator_center, float radius, float angle) {\n vec2 center = vec2(mercator_center.x /6378137.0 , asin(tanh(mercator_center.y / 6378137.0 )));\n float ang = angle + PI / 2.0; // Shift angle to align with +x axis\n float r = radius / R;\n float cos_r = cos(r);\n float sin_r = sin(r);\n\n float sin_lat = sin(center.y) * cos_r + cos(center.y) * sin_r * cos(ang);\n float lat = asin(sin_lat);\n\n float delta_long = atan(sin(ang) * sin_r * cos(center.y), cos_r - sin(center.y) * sin_lat);\n float longi = center.x + delta_long;\n // float y = mix(-80.5, 80.5, abs(center.y + PI / 2.0));\n vec2 limp = vec2(\n R * longi,\n R * log(tan(PI / 4.0 + lat / 2.0))\n );\n vec2 center_mercator = vec2(\n R * center.x,\n R * log(tan(PI/4.0+ center.y / 2.0))\n );\n return mercator_center - center_mercator + limp;\n}";
45
+ exports.circleLimpFromLongLatRadCenterMercatorRealDistanceNew_accurate = circleLimpFromLongLatRadCenterMercatorRealDistanceNew_accurate;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./geometrytransformations"), exports);
18
+ __exportStar(require("./nodata"), exports);
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.vertexIDtoTextureCoordinate = void 0;
4
+ var vertexIDtoTextureCoordinate = "\nvec2 vertexIDtoTextureCoordinate(float id, vec2 textureDimentions) {\n float x = mod(id, textureDimentions.x);\n float y = floor(id / textureDimentions.x);\n return vec2( x / textureDimentions.x, y / textureDimentions.y);\n}\n";
5
+ exports.vertexIDtoTextureCoordinate = vertexIDtoTextureCoordinate;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
3
+ if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
4
+ return cooked;
5
+ };
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ var permute34 = ""(templateObject_1 || (templateObject_1 = __makeTemplateObject(["vec3 permute34(vec3 x) {\n x = ((x * 34.0) + 1.0) * x;\n return x - floor(x * (1.0 / 289.0)) * 289.0;\n}"], ["vec3 permute34(vec3 x) {\n x = ((x * 34.0) + 1.0) * x;\n return x - floor(x * (1.0 / 289.0)) * 289.0;\n}"])))(templateObject_2 || (templateObject_2 = __makeTemplateObject([""], [""])));
8
+ var waveNoice = ""(templateObject_3 || (templateObject_3 = __makeTemplateObject(["float waveNoice(vec2 v)\n{\n const vec4 C = vec4(0.211324865405187, 0.366025403784439, -0.577350269189626, 0.024390243902439); \n\n\t vec2 i = floor(v + dot(v, C.yy));\n\t vec2 x0 = v - i + dot(i, C.xx);\n\n\t vec2 i1;\n i1 = (x0.x > x0.y) ? vec2(1.0, 0.0) : vec2(0.0, 1.0);\n\n\t vec4 x12 = x0.xyxy + C.xxzz;\n x12.xy -= i1;\n\n i = i - floor(i * (1.0 / 289.0)) * 289.0;\n\n\t vec3 p = permute(permute(i.y + vec3(0.0, i1.y, 1.0))\n + i.x + vec3(0.0, i1.x, 1.0));\n\n\t vec3 m = max(0.5 - vec3(dot(x0, x0), dot(x12.xy, x12.xy), dot(x12.zw, x12.zw)), 0.0);\n m = m * m;\n m = m * m;\n\n\t vec3 x = 2.0 * fract(p * C.www) - 1.0;\n\t vec3 h = abs(x) - 0.5;\n\t vec3 ox = floor(x + 0.5);\n\t vec3 a0 = x - ox;\n\n m *= inversesqrt(a0 * a0 + h * h);\n\n\t vec3 g;\n g.x = a0.x * x0.x + h.x * x0.y;\n g.yz = a0.yz * x12.xz + h.yz * x12.yw;\n return 130.0 * dot(m, g);\n}"], ["float waveNoice(vec2 v)\n{\n const vec4 C = vec4(0.211324865405187, 0.366025403784439, -0.577350269189626, 0.024390243902439); \n\n\t vec2 i = floor(v + dot(v, C.yy));\n\t vec2 x0 = v - i + dot(i, C.xx);\n\n\t vec2 i1;\n i1 = (x0.x > x0.y) ? vec2(1.0, 0.0) : vec2(0.0, 1.0);\n\n\t vec4 x12 = x0.xyxy + C.xxzz;\n x12.xy -= i1;\n\n i = i - floor(i * (1.0 / 289.0)) * 289.0;\n\n\t vec3 p = permute(permute(i.y + vec3(0.0, i1.y, 1.0))\n + i.x + vec3(0.0, i1.x, 1.0));\n\n\t vec3 m = max(0.5 - vec3(dot(x0, x0), dot(x12.xy, x12.xy), dot(x12.zw, x12.zw)), 0.0);\n m = m * m;\n m = m * m;\n\n\t vec3 x = 2.0 * fract(p * C.www) - 1.0;\n\t vec3 h = abs(x) - 0.5;\n\t vec3 ox = floor(x + 0.5);\n\t vec3 a0 = x - ox;\n\n m *= inversesqrt(a0 * a0 + h * h);\n\n\t vec3 g;\n g.x = a0.x * x0.x + h.x * x0.y;\n g.yz = a0.yz * x12.xz + h.yz * x12.yw;\n return 130.0 * dot(m, g);\n}"])))(templateObject_4 || (templateObject_4 = __makeTemplateObject([""], [""])));
9
+ exports.default = {
10
+ permute34: permute34,
11
+ waveNoice: waveNoice
12
+ };
13
+ var templateObject_1, templateObject_2, templateObject_3, templateObject_4;
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ // function naiveBBox(a: number[], b: number[]): BBox {
3
+ // return {
4
+ // minX: Math.min(a[0], b[0]),
5
+ // minY: Math.min(a[1], b[1]),
6
+ // maxX: Math.max(a[0], b[0]),
7
+ // maxY: Math.max(a[1], b[1])
8
+ // };
9
+ // }
10
+ // function slerp(a: Vector, b: Vector, t: number, theta: number, sinTheta: number): Vector {
11
+ // }
12
+ // function getArcBBoxes(arc: Arc, dotStep: number = 0.025): BBox[] {
13
+ // const start = arc.start;
14
+ // const end = arc.end;
15
+ // const a = [start[0], start[1], start[2]];
16
+ // const b = [end[0], end[1], end[2]];
17
+ // const theta = Math.acos(a[0] * b[0] + a[1] * b[1] + a[2] * b[2]);
18
+ // const step = dotStep / theta;
19
+ // if (step >= 1) {
20
+ // return [naiveBBox(start, end)];
21
+ // }
22
+ // let points = [start] as Vector[];
23
+ // let currentStep =
24
+ // return bbox;
25
+ // }
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ var ArcsToCutsManager = /** @class */ (function () {
3
+ function ArcsToCutsManager(rbush, _a) {
4
+ var _b = _a.dotDistanceOfArcCuts, dotDistanceOfArcCuts = _b === void 0 ? 0.01 : _b;
5
+ this._map = new Map();
6
+ this._dotDistanceOfArcCuts = dotDistanceOfArcCuts;
7
+ this._rbush = rbush;
8
+ }
9
+ ArcsToCutsManager.prototype.insertArcs = function (arc) {
10
+ if (this._map.has(arc.id)) {
11
+ this._deleteCuts(arc.id);
12
+ }
13
+ };
14
+ ArcsToCutsManager.prototype._deleteCuts = function (id) {
15
+ var cuts = this._map.get(id);
16
+ if (cuts) {
17
+ cuts.forEach(function (cut) { return cut.remove(); });
18
+ }
19
+ };
20
+ ArcsToCutsManager.prototype._cutArcAndAddToRBush = function (arc) {
21
+ var _this = this;
22
+ var cuts = this._cutArcToBBoxs(arc);
23
+ cuts.forEach(function (cut) {
24
+ _this._rbush.insert(cut);
25
+ });
26
+ this._map.set(arc.id, cuts);
27
+ };
28
+ ArcsToCutsManager.prototype._cutArcToBBoxs = function (arc) {
29
+ var cuts = [];
30
+ // Calculate the bounding box of the arc
31
+ // Create a cut object and add it to the cuts array
32
+ var cut = {
33
+ minX: bbox.minX,
34
+ minY: bbox.minY,
35
+ maxX: bbox.maxX,
36
+ maxY: bbox.maxY,
37
+ arcId: arc.id,
38
+ };
39
+ cuts.push(cut);
40
+ return cuts;
41
+ };
42
+ return ArcsToCutsManager;
43
+ }());
44
+ function sphericalLinearInterpolation(phi1, lambda1, phi2, lambda2, t) {
45
+ // Spherical linear interpolation between two points on a sphere
46
+ // Args: phi1, lambda1: starting point (in radians)
47
+ // phi2, lambda2: ending point (in radians)
48
+ // t: interpolation parameter (0 <= t <= 1)
49
+ // Returns: [phi, lambda] in radians
50
+ var phi = phi1 + t * (phi2 - phi1);
51
+ var lambda = lambda1 + t * (lambda2 - lambda1);
52
+ return [phi, lambda];
53
+ }
@@ -0,0 +1 @@
1
+ "use strict";
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ // class FlowManager {
3
+ // _populateCount: number;
4
+ // _rbush: RBush<any>;
5
+ // _arcToCutsManager: ArcToCutsManager;
6
+ // consturctor({ populateCount = 36, dotDistanceOfArcCuts = 1 / Math.pow(2, 10 - 1) }) {
7
+ // this._populateCount = populateCount;
8
+ // // does the cutting and id mapping(one to many)
9
+ // // cuts have their bbox ready for rbush
10
+ // this._rbush = new RBush(1000);
11
+ // this._arcToCutsManager = new ArcToCutsManager({ dotDistanceOfArcCuts, rbush: this._rbush }); // 10km
12
+ // }
13
+ // /**
14
+ // * adds or updates an arc in the rbush and the cuts manager
15
+ // */
16
+ // insertArc(arc: Arc) {
17
+ // this._arcToCutsManager.insertArc(arc);
18
+ // }
19
+ // deleteArc(id: Arc['id']) {
20
+ // this._arcToCutsManager.deleteArc(id);
21
+ // }
22
+ // queryBBox(bbox: BBox) {
23
+ // const arcIDSet = new Set(this._rbush.query(bbox).map(x => x.id)); // sets Of ids of arcs
24
+ // // arcs U bbox => arcs
25
+ // // populate points
26
+ // // return typed array of points belonging to all the arcs of cuts
27
+ // }
28
+ // }
@@ -0,0 +1 @@
1
+ "use strict";
@@ -0,0 +1 @@
1
+ "use strict";
@@ -0,0 +1 @@
1
+ "use strict";
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.defaultblendfunction = defaultblendfunction;
4
+ function defaultblendfunction(gl) {
5
+ gl.blendEquation(gl.FUNC_ADD); // TODO: TESTING THIS
6
+ gl.blendFuncSeparate(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA);
7
+ }
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./rasteroverlay"), exports);
18
+ __exportStar(require("./gldefaultstates"), exports);
@@ -0,0 +1,80 @@
1
+ "use strict";
2
+ /**
3
+ * Iceride bir canvas uretir ve degisiklikler bu kanvasta yapilir
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.RasterOverlayLoader = void 0;
7
+ // this class loads texture to raster overlay
8
+ var RasterOverlayLoader = /** @class */ (function () {
9
+ function RasterOverlayLoader(id, globe, _a) {
10
+ var _b = _a === void 0 ? {} : _a, _c = _b.opacity, opacity = _c === void 0 ? 1.0 : _c, _d = _b.minLon, minLon = _d === void 0 ? -180 : _d, _e = _b.minLat, minLat = _e === void 0 ? -90 : _e, _f = _b.maxLon, maxLon = _f === void 0 ? 180 : _f, _g = _b.maxLat, maxLat = _g === void 0 ? 90 : _g, _h = _b.beforeObject, beforeObject = _h === void 0 ? null : _h, _j = _b.canvas, canvas = _j === void 0 ? null : _j, _k = _b.callBack, callBack = _k === void 0 ? null : _k;
11
+ this.canvas = canvas || document.createElement('canvas');
12
+ this.gl = this.canvas.getContext('webgl2');
13
+ this.globe = globe;
14
+ this.id = id;
15
+ this._opacity = opacity;
16
+ this.bbox = { ll: { x: minLon, y: minLat }, ur: { x: maxLon, y: maxLat } };
17
+ this._beforeObject = beforeObject;
18
+ this._isProcessing = false;
19
+ this._callBack = callBack;
20
+ }
21
+ RasterOverlayLoader.prototype.getGL = function () {
22
+ return this.gl;
23
+ };
24
+ RasterOverlayLoader.prototype.getCanvasURL = function () {
25
+ return this.canvas.toDataURL();
26
+ };
27
+ RasterOverlayLoader.prototype.setBBox = function (minLon, minLat, maxLon, maxLat) {
28
+ this.bbox = { ll: { x: minLon, y: minLat }, ur: { x: maxLon, y: maxLat } };
29
+ this.draw();
30
+ };
31
+ RasterOverlayLoader.prototype.setCanvasWidthHeight = function (width, height) {
32
+ this.canvas.width = width;
33
+ this.canvas.height = height;
34
+ this.gl.viewport(0, 0, width, height);
35
+ };
36
+ RasterOverlayLoader.prototype.draw = function () {
37
+ if (!this._isProcessing) {
38
+ requestAnimationFrame(this._draw.bind(this));
39
+ this._isProcessing = true;
40
+ }
41
+ };
42
+ RasterOverlayLoader.prototype._draw = function () {
43
+ this.globe.api_DeleteImageOverlay(this.id);
44
+ var id = this.id;
45
+ var imgUrl = this.getCanvasURL();
46
+ var bbox = this.bbox;
47
+ var opacity = this._opacity;
48
+ var rotDeg = 0;
49
+ var color = null;
50
+ var beforeObject = this._beforeObject;
51
+ var callback = this._callBack || function () { };
52
+ this.globe.api_AddImageOverlay(id, imgUrl, bbox, color, opacity, rotDeg, beforeObject, callback);
53
+ this._isProcessing = false;
54
+ };
55
+ RasterOverlayLoader.prototype.setBeforeObject = function (beforeObject) {
56
+ this._beforeObject = beforeObject;
57
+ this.draw();
58
+ };
59
+ RasterOverlayLoader.prototype.setCallback = function (callback) {
60
+ this._callBack = callback;
61
+ };
62
+ RasterOverlayLoader.prototype.setOpacity = function (opacity) {
63
+ if (opacity < 0 || opacity > 1) {
64
+ return;
65
+ }
66
+ this._opacity = opacity;
67
+ this.globe.api_SetImageOverlayColor(this.id, null, opacity);
68
+ };
69
+ RasterOverlayLoader.prototype.free = function () {
70
+ this.globe.api_DeleteImageOverlay(this.id);
71
+ };
72
+ RasterOverlayLoader.prototype.on = function () {
73
+ this.draw();
74
+ };
75
+ RasterOverlayLoader.prototype.off = function () {
76
+ this.globe.api_DeleteImageOverlay(this.id);
77
+ };
78
+ return RasterOverlayLoader;
79
+ }());
80
+ exports.RasterOverlayLoader = RasterOverlayLoader;