@pirireis/webglobeplugins 1.0.2 → 1.0.4

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 (277) hide show
  1. package/package.json +2 -2
  2. package/plugins/alarms/alarmFadeInFadeOutPlugin/AlarmTimeLineFadeInFadeOutPlugin.js +399 -0
  3. package/{Math/angle-calculation.ts → webglobeplugins/Math/angle-calculation.js} +14 -18
  4. package/{Math/arc-cdf-points.ts → webglobeplugins/Math/arc-cdf-points.js} +272 -329
  5. package/{Math/arc-generate-points-exponantial.ts → webglobeplugins/Math/arc-generate-points-exponantial.js} +254 -299
  6. package/{Math/arc.ts → webglobeplugins/Math/arc.js} +292 -421
  7. package/{Math → webglobeplugins/Math}/bounds/line-bbox.js +186 -225
  8. package/{Math/circle-cdf-points.ts → webglobeplugins/Math/circle-cdf-points.js} +78 -143
  9. package/{Math/circle.ts → webglobeplugins/Math/circle.js} +33 -49
  10. package/{Math/constants.ts → webglobeplugins/Math/constants.js} +4 -12
  11. package/{Math/contour/quadtreecontours.ts → webglobeplugins/Math/contour/quadtreecontours.js} +300 -371
  12. package/{Math → webglobeplugins/Math}/contour/quadtreecontours1.js +298 -336
  13. package/{Math/finite-line-2d.ts → webglobeplugins/Math/finite-line-2d.js} +58 -68
  14. package/{Math/haversine.ts → webglobeplugins/Math/haversine.js} +22 -33
  15. package/webglobeplugins/Math/index.js +1 -0
  16. package/{Math/juction/arc-plane.ts → webglobeplugins/Math/juction/arc-plane.js} +143 -203
  17. package/{Math/juction/line-sphere.ts → webglobeplugins/Math/juction/line-sphere.js} +22 -32
  18. package/{Math/juction/plane-plane.ts → webglobeplugins/Math/juction/plane-plane.js} +53 -62
  19. package/{Math/line.ts → webglobeplugins/Math/line.js} +52 -84
  20. package/webglobeplugins/Math/matrix4.js +1 -0
  21. package/{Math/methods.ts → webglobeplugins/Math/methods.js} +126 -182
  22. package/{Math/plane.ts → webglobeplugins/Math/plane.js} +56 -92
  23. package/{Math/quaternion.ts → webglobeplugins/Math/quaternion.js} +106 -128
  24. package/{Math/templete-shapes/grid-visually-equal.ts → webglobeplugins/Math/templete-shapes/grid-visually-equal.js} +65 -118
  25. package/webglobeplugins/Math/tessellation/constants.js +1 -0
  26. package/{Math/tessellation/methods.ts → webglobeplugins/Math/tessellation/methods.js} +49 -79
  27. package/{Math/tessellation/nearest-value-padding.ts → webglobeplugins/Math/tessellation/nearest-value-padding.js} +112 -147
  28. package/{Math/tessellation/spherical-triangle-area.ts → webglobeplugins/Math/tessellation/spherical-triangle-area.js} +99 -127
  29. package/{Math/tessellation/tile-merger.ts → webglobeplugins/Math/tessellation/tile-merger.js} +429 -578
  30. package/{Math/tessellation/triangle-tessellation.ts → webglobeplugins/Math/tessellation/triangle-tessellation.js} +464 -533
  31. package/webglobeplugins/Math/tessellation/types.js +1 -0
  32. package/webglobeplugins/Math/types.js +1 -0
  33. package/{Math → webglobeplugins/Math}/utils.js +2 -3
  34. package/{Math/vec3.ts → webglobeplugins/Math/vec3.js} +155 -227
  35. package/{Math/xyz-tile.ts → webglobeplugins/Math/xyz-tile.js} +18 -26
  36. package/{algorithms → webglobeplugins/algorithms}/search-binary.js +16 -14
  37. package/webglobeplugins/altitude-locator/adaptors.js +1 -0
  38. package/webglobeplugins/altitude-locator/keymethod.js +1 -0
  39. package/{altitude-locator → webglobeplugins/altitude-locator}/plugin.js +344 -445
  40. package/{altitude-locator → webglobeplugins/altitude-locator}/types.js +21 -26
  41. package/{compass-rose → webglobeplugins/compass-rose}/compass-rose-padding-flat.js +230 -274
  42. package/{compass-rose/compass-text-writer.ts → webglobeplugins/compass-rose/compass-text-writer.js} +155 -210
  43. package/{compass-rose → webglobeplugins/compass-rose}/index.js +3 -3
  44. package/{constants.ts → webglobeplugins/constants.js} +6 -8
  45. package/{heatwave → webglobeplugins/heatwave}/datamanager.js +149 -168
  46. package/{heatwave → webglobeplugins/heatwave}/heatwave.js +206 -261
  47. package/{heatwave → webglobeplugins/heatwave}/index.js +5 -5
  48. package/{heatwave → webglobeplugins/heatwave}/isobar.js +306 -340
  49. package/{heatwave/texture-point-sampler.ts → webglobeplugins/heatwave/texture-point-sampler.js} +187 -220
  50. package/webglobeplugins/investigation-tools/draw/tiles/adapters.js +67 -0
  51. package/{investigation-tools/draw/tiles/tiles.ts → webglobeplugins/investigation-tools/draw/tiles/tiles.js} +128 -162
  52. package/{jest.config.js → webglobeplugins/jest.config.js} +7 -6
  53. package/{pin → webglobeplugins/pin}/pin-object-array1.js +300 -381
  54. package/{pin → webglobeplugins/pin}/pin-point-totem1.js +60 -77
  55. package/{programs → webglobeplugins/programs}/arrowfield/arrow-field.js +60 -89
  56. package/{programs → webglobeplugins/programs}/arrowfield/logic.js +141 -173
  57. package/{programs → webglobeplugins/programs}/data2legend/density-to-legend.js +68 -86
  58. package/{programs → webglobeplugins/programs}/data2legend/point-to-density-texture.js +67 -84
  59. package/{programs → webglobeplugins/programs}/float2legendwithratio/index.js +2 -3
  60. package/{programs → webglobeplugins/programs}/float2legendwithratio/logic.js +118 -144
  61. package/{programs → webglobeplugins/programs}/float2legendwithratio/object.js +104 -141
  62. package/{programs → webglobeplugins/programs}/helpers/blender.js +58 -73
  63. package/{programs/helpers/fadeaway.ts → webglobeplugins/programs/helpers/fadeaway.js} +60 -73
  64. package/{programs → webglobeplugins/programs}/index.js +20 -19
  65. package/{programs → webglobeplugins/programs}/line-on-globe/circle-accurate-3d.js +85 -112
  66. package/{programs → webglobeplugins/programs}/line-on-globe/circle-accurate-flat.js +148 -200
  67. package/{programs → webglobeplugins/programs}/line-on-globe/degree-padding-around-circle-3d.js +102 -134
  68. package/webglobeplugins/programs/line-on-globe/index.js +1 -0
  69. package/{programs → webglobeplugins/programs}/line-on-globe/lines-color-instanced-flat.js +80 -99
  70. package/webglobeplugins/programs/line-on-globe/linestrip/data.js +4 -0
  71. package/{programs/line-on-globe/linestrip/linestrip.ts → webglobeplugins/programs/line-on-globe/linestrip/linestrip.js} +93 -152
  72. package/{programs/line-on-globe/naive-accurate-flexible.ts → webglobeplugins/programs/line-on-globe/naive-accurate-flexible.js} +126 -175
  73. package/{programs → webglobeplugins/programs}/line-on-globe/util.js +5 -8
  74. package/{programs → webglobeplugins/programs}/picking/pickable-polygon-renderer.js +98 -129
  75. package/{programs → webglobeplugins/programs}/picking/pickable-renderer.js +98 -130
  76. package/{programs → webglobeplugins/programs}/point-on-globe/element-globe-surface-glow.js +93 -122
  77. package/{programs → webglobeplugins/programs}/point-on-globe/element-point-glow.js +80 -114
  78. package/{programs → webglobeplugins/programs}/point-on-globe/square-pixel-point.js +121 -139
  79. package/{programs/polygon-on-globe/texture-dem-triangles.ts → webglobeplugins/programs/polygon-on-globe/texture-dem-triangles.js} +178 -209
  80. package/{programs/programcache.ts → webglobeplugins/programs/programcache.js} +126 -134
  81. package/webglobeplugins/programs/rings/index.js +1 -0
  82. package/{programs/rings/partial-ring/piece-of-pie.ts → webglobeplugins/programs/rings/partial-ring/piece-of-pie.js} +152 -222
  83. package/webglobeplugins/programs/totems/attachments/adaptive-opacity.js +131 -0
  84. package/{programs/totems/dem-textures-manager.ts → webglobeplugins/programs/totems/attachments/dem-textures-manager.js} +263 -360
  85. package/webglobeplugins/programs/totems/camera-totem-attactment-interface.js +1 -0
  86. package/{programs/totems/camerauniformblock.ts → webglobeplugins/programs/totems/camerauniformblock.js} +225 -310
  87. package/{programs/totems/canvas-webglobe-info.ts → webglobeplugins/programs/totems/canvas-webglobe-info.js} +132 -147
  88. package/{programs/totems/globe-changes.ts → webglobeplugins/programs/totems/globe-changes.js} +59 -79
  89. package/{programs → webglobeplugins/programs}/totems/gpu-selection-uniform-block.js +99 -127
  90. package/{programs/totems/index.ts → webglobeplugins/programs/totems/index.js} +2 -2
  91. package/{programs → webglobeplugins/programs}/two-d/pixel-padding-for-compass.js +87 -101
  92. package/{programs → webglobeplugins/programs}/util.js +14 -19
  93. package/{programs/vectorfields/logics/constants.ts → webglobeplugins/programs/vectorfields/logics/constants.js} +4 -5
  94. package/{programs/vectorfields/logics/drawrectangleparticles.ts → webglobeplugins/programs/vectorfields/logics/drawrectangleparticles.js} +107 -136
  95. package/{programs → webglobeplugins/programs}/vectorfields/logics/index.js +2 -4
  96. package/webglobeplugins/programs/vectorfields/logics/particle-ubo.js +19 -0
  97. package/{programs/vectorfields/logics/pixelbased.ts → webglobeplugins/programs/vectorfields/logics/pixelbased.js} +89 -122
  98. package/{programs → webglobeplugins/programs}/vectorfields/logics/ubo.js +51 -57
  99. package/{programs/vectorfields/pingpongbuffermanager.ts → webglobeplugins/programs/vectorfields/pingpongbuffermanager.js} +99 -113
  100. package/{range-tools-on-terrain/bearing-line/adapters.ts → webglobeplugins/range-tools-on-terrain/bearing-line/adapters.js} +114 -154
  101. package/{range-tools-on-terrain/bearing-line/plugin.ts → webglobeplugins/range-tools-on-terrain/bearing-line/plugin.js} +457 -569
  102. package/webglobeplugins/range-tools-on-terrain/bearing-line/types.js +1 -0
  103. package/{range-tools-on-terrain/circle-line-chain/adapters.ts → webglobeplugins/range-tools-on-terrain/circle-line-chain/adapters.js} +85 -104
  104. package/{range-tools-on-terrain/circle-line-chain/chain-list-map.ts → webglobeplugins/range-tools-on-terrain/circle-line-chain/chain-list-map.js} +382 -446
  105. package/{range-tools-on-terrain/circle-line-chain/plugin.ts → webglobeplugins/range-tools-on-terrain/circle-line-chain/plugin.js} +464 -607
  106. package/webglobeplugins/range-tools-on-terrain/circle-line-chain/types.js +1 -0
  107. package/{range-tools-on-terrain/range-ring/adapters.ts → webglobeplugins/range-tools-on-terrain/range-ring/adapters.js} +93 -114
  108. package/{range-tools-on-terrain/range-ring/enum.ts → webglobeplugins/range-tools-on-terrain/range-ring/enum.js} +2 -2
  109. package/{range-tools-on-terrain/range-ring/plugin.ts → webglobeplugins/range-tools-on-terrain/range-ring/plugin.js} +377 -444
  110. package/webglobeplugins/range-tools-on-terrain/range-ring/rangeringangletext.js +331 -0
  111. package/webglobeplugins/range-tools-on-terrain/range-ring/types.js +9 -0
  112. package/webglobeplugins/semiplugins/interface.js +1 -0
  113. package/{semiplugins/lightweight/line-plugin.ts → webglobeplugins/semiplugins/lightweight/line-plugin.js} +221 -342
  114. package/{semiplugins/lightweight/piece-of-pie-plugin.ts → webglobeplugins/semiplugins/lightweight/piece-of-pie-plugin.js} +200 -275
  115. package/{semiplugins/shape-on-terrain/arc-plugin.ts → webglobeplugins/semiplugins/shape-on-terrain/arc-plugin.js} +481 -616
  116. package/{semiplugins/shape-on-terrain/circle-plugin.ts → webglobeplugins/semiplugins/shape-on-terrain/circle-plugin.js} +444 -588
  117. package/{semiplugins/shape-on-terrain/padding-1-degree.ts → webglobeplugins/semiplugins/shape-on-terrain/padding-1-degree.js} +539 -713
  118. package/{semiplugins/shape-on-terrain/terrain-polygon/adapters.ts → webglobeplugins/semiplugins/shape-on-terrain/terrain-polygon/adapters.js} +55 -69
  119. package/{semiplugins/shape-on-terrain/terrain-polygon/data/cache.ts → webglobeplugins/semiplugins/shape-on-terrain/terrain-polygon/data/cache.js} +104 -149
  120. package/{semiplugins/shape-on-terrain/terrain-polygon/data/index-polygon-map.ts → webglobeplugins/semiplugins/shape-on-terrain/terrain-polygon/data/index-polygon-map.js} +45 -58
  121. package/{semiplugins/shape-on-terrain/terrain-polygon/data/manager.ts → webglobeplugins/semiplugins/shape-on-terrain/terrain-polygon/data/manager.js} +4 -4
  122. package/webglobeplugins/semiplugins/shape-on-terrain/terrain-polygon/data/master-worker.js +241 -0
  123. package/webglobeplugins/semiplugins/shape-on-terrain/terrain-polygon/data/polygon-to-triangles.js +76 -0
  124. package/{semiplugins/shape-on-terrain/terrain-polygon/data/random.ts → webglobeplugins/semiplugins/shape-on-terrain/terrain-polygon/data/random.js} +121 -165
  125. package/webglobeplugins/semiplugins/shape-on-terrain/terrain-polygon/data/types.js +1 -0
  126. package/{semiplugins/shape-on-terrain/terrain-polygon/data/worker-contact.ts → webglobeplugins/semiplugins/shape-on-terrain/terrain-polygon/data/worker-contact.js} +64 -81
  127. package/webglobeplugins/semiplugins/shape-on-terrain/terrain-polygon/data/worker.js +162 -0
  128. package/{semiplugins/shape-on-terrain/terrain-polygon/terrain-polygon.ts → webglobeplugins/semiplugins/shape-on-terrain/terrain-polygon/terrain-polygon.js} +282 -265
  129. package/webglobeplugins/semiplugins/shape-on-terrain/terrain-polygon/test-records.js +14 -0
  130. package/webglobeplugins/semiplugins/shape-on-terrain/terrain-polygon/types.js +8 -0
  131. package/webglobeplugins/semiplugins/shell/bbox-renderer/index.js +2 -0
  132. package/{semiplugins/shell/bbox-renderer/logic.ts → webglobeplugins/semiplugins/shell/bbox-renderer/logic.js} +209 -273
  133. package/webglobeplugins/semiplugins/shell/bbox-renderer/object.js +78 -0
  134. package/webglobeplugins/semiplugins/type.js +1 -0
  135. package/{semiplugins/utility/container-plugin.ts → webglobeplugins/semiplugins/utility/container-plugin.js} +94 -126
  136. package/{semiplugins/utility/object-pass-container-plugin.ts → webglobeplugins/semiplugins/utility/object-pass-container-plugin.js} +80 -101
  137. package/{shaders → webglobeplugins/shaders}/fragment-toy/firework.js +1 -1
  138. package/{shaders → webglobeplugins/shaders}/fragment-toy/singularity.js +2 -5
  139. package/{tracks → webglobeplugins/tracks}/point-heat-map/adaptors/timetracksplugin-format-to-this.js +63 -78
  140. package/webglobeplugins/tracks/point-heat-map/index.js +1 -0
  141. package/{tracks → webglobeplugins/tracks}/point-heat-map/plugin-webworker.js +121 -148
  142. package/{tracks → webglobeplugins/tracks}/point-heat-map/point-to-heat-map-flow.js +121 -150
  143. package/{tracks → webglobeplugins/tracks}/point-tracks/key-methods.js +2 -3
  144. package/{tracks → webglobeplugins/tracks}/point-tracks/plugin.js +401 -487
  145. package/{tracks → webglobeplugins/tracks}/timetracks/adaptors-line-strip.js +65 -79
  146. package/{tracks → webglobeplugins/tracks}/timetracks/plugin-line-strip.js +240 -295
  147. package/{tracks → webglobeplugins/tracks}/timetracks/program-line-strip.js +413 -495
  148. package/{tracks → webglobeplugins/tracks}/timetracks/programpoint-line-strip.js +109 -137
  149. package/webglobeplugins/types.js +19 -0
  150. package/{util → webglobeplugins/util}/account/bufferoffsetmanager.js +176 -209
  151. package/webglobeplugins/util/account/create-buffermap-orchastration.js +39 -0
  152. package/{util → webglobeplugins/util}/account/index.js +3 -6
  153. package/{util/account/single-attribute-buffer-management/buffer-manager.ts → webglobeplugins/util/account/single-attribute-buffer-management/buffer-manager.js} +119 -151
  154. package/{util/account/single-attribute-buffer-management/buffer-orchestrator.ts → webglobeplugins/util/account/single-attribute-buffer-management/buffer-orchestrator.js} +212 -238
  155. package/{util/account/single-attribute-buffer-management/buffer-orchestrator1.ts → webglobeplugins/util/account/single-attribute-buffer-management/buffer-orchestrator1.js} +159 -184
  156. package/{util/account/single-attribute-buffer-management/index.ts → webglobeplugins/util/account/single-attribute-buffer-management/index.js} +4 -11
  157. package/{util/account/single-attribute-buffer-management/object-store.ts → webglobeplugins/util/account/single-attribute-buffer-management/object-store.js} +55 -76
  158. package/webglobeplugins/util/account/single-attribute-buffer-management/types.js +1 -0
  159. package/{util → webglobeplugins/util}/account/util.js +18 -22
  160. package/webglobeplugins/util/algorithms/index.js +1 -0
  161. package/{util → webglobeplugins/util}/algorithms/search-binary.js +25 -26
  162. package/{util/build-strategy/static-dynamic.ts → webglobeplugins/util/build-strategy/static-dynamic.js} +41 -50
  163. package/webglobeplugins/util/check/index.js +1 -0
  164. package/webglobeplugins/util/check/typecheck.js +66 -0
  165. package/{util/frame-counter-trigger.ts → webglobeplugins/util/frame-counter-trigger.js} +84 -99
  166. package/{util/geometry/index.ts → webglobeplugins/util/geometry/index.js} +121 -155
  167. package/webglobeplugins/util/gl-util/buffer/attribute-loader.js +74 -0
  168. package/{util/gl-util/buffer/index.ts → webglobeplugins/util/gl-util/buffer/index.js} +3 -6
  169. package/{util/gl-util/draw-options/methods.ts → webglobeplugins/util/gl-util/draw-options/methods.js} +32 -47
  170. package/{util/gl-util/uniform-block/manager.ts → webglobeplugins/util/gl-util/uniform-block/manager.js} +209 -232
  171. package/{util/globe-default-gl-states.ts → webglobeplugins/util/globe-default-gl-states.js} +4 -5
  172. package/{util/helper-methods.ts → webglobeplugins/util/helper-methods.js} +8 -9
  173. package/{util → webglobeplugins/util}/index.js +10 -9
  174. package/webglobeplugins/util/interpolation/index.js +1 -0
  175. package/webglobeplugins/util/interpolation/timetrack/index.js +2 -0
  176. package/{util → webglobeplugins/util}/interpolation/timetrack/timetrack-interpolator.js +79 -94
  177. package/{util → webglobeplugins/util}/interpolation/timetrack/web-worker.js +46 -51
  178. package/{util/picking/fence.ts → webglobeplugins/util/picking/fence.js} +43 -47
  179. package/{util/picking/picker-displayer.ts → webglobeplugins/util/picking/picker-displayer.js} +176 -226
  180. package/{util → webglobeplugins/util}/programs/draw-from-pixel-coords.js +164 -201
  181. package/{util/programs/draw-texture-on-canvas.ts → webglobeplugins/util/programs/draw-texture-on-canvas.js} +69 -91
  182. package/{util → webglobeplugins/util}/programs/supersampletotextures.js +97 -130
  183. package/{util/programs/texturetoglobe.js → webglobeplugins/util/programs/texturetoglobe_delete.js} +128 -153
  184. package/{util/shaderfunctions/geometrytransformations.ts → webglobeplugins/util/shaderfunctions/geometrytransformations.js} +44 -106
  185. package/{util → webglobeplugins/util}/shaderfunctions/index.js +2 -2
  186. package/{util → webglobeplugins/util}/shaderfunctions/nodata.js +2 -4
  187. package/{util → webglobeplugins/util}/shaderfunctions/noisefunctions.js +7 -10
  188. package/{util/webglobjectbuilders.ts → webglobeplugins/util/webglobjectbuilders.js} +358 -446
  189. package/{vectorfield → webglobeplugins/vectorfield}/arrowfield/adaptor.js +11 -11
  190. package/{vectorfield → webglobeplugins/vectorfield}/arrowfield/index.js +3 -3
  191. package/{vectorfield → webglobeplugins/vectorfield}/arrowfield/plugin.js +83 -128
  192. package/{vectorfield → webglobeplugins/vectorfield}/waveparticles/adaptor.js +15 -16
  193. package/{vectorfield → webglobeplugins/vectorfield}/waveparticles/index.js +3 -3
  194. package/{vectorfield/waveparticles/plugin.ts → webglobeplugins/vectorfield/waveparticles/plugin.js} +455 -506
  195. package/webglobeplugins/vectorfield/wind/adapters/image-to-fields.js +92 -0
  196. package/webglobeplugins/vectorfield/wind/adapters/types.js +1 -0
  197. package/{vectorfield/wind/imagetovectorfieldandmagnitude.ts → webglobeplugins/vectorfield/wind/imagetovectorfieldandmagnitude.js} +53 -78
  198. package/{vectorfield → webglobeplugins/vectorfield}/wind/index.js +5 -5
  199. package/{vectorfield/wind/plugin-persistant.ts → webglobeplugins/vectorfield/wind/plugin-persistant.js} +390 -483
  200. package/{vectorfield → webglobeplugins/vectorfield}/wind/plugin.js +685 -883
  201. package/{vectorfield → webglobeplugins/vectorfield}/wind/vectorfieldimage.js +23 -27
  202. package/{write-text/context-text-bulk.ts → webglobeplugins/write-text/context-text-bulk.js} +200 -285
  203. package/webglobeplugins/write-text/context-text3.js +167 -0
  204. package/{write-text/context-text4.ts → webglobeplugins/write-text/context-text4.js} +146 -231
  205. package/{write-text → webglobeplugins/write-text}/context-textDELETE.js +94 -125
  206. package/{write-text/objectarraylabels/index.ts → webglobeplugins/write-text/objectarraylabels/index.js} +2 -2
  207. package/{write-text → webglobeplugins/write-text}/objectarraylabels/objectarraylabels.js +200 -247
  208. package/Math/index.js +0 -0
  209. package/Math/matrix4.ts +0 -0
  210. package/Math/mesh/mapbox-delaunay.d.ts +0 -74
  211. package/Math/roadmap.md +0 -10
  212. package/Math/tessellation/constants.ts +0 -1
  213. package/Math/tessellation/roadmap.md +0 -48
  214. package/Math/tessellation/types.ts +0 -1
  215. package/Math/types.ts +0 -68
  216. package/altitude-locator/adaptors.js +0 -0
  217. package/altitude-locator/keymethod.js +0 -0
  218. package/investigation-tools/draw/tiles/adapters.ts +0 -133
  219. package/programs/line-on-globe/index.js +0 -0
  220. package/programs/line-on-globe/linestrip/data.ts +0 -29
  221. package/programs/polygon-on-globe/roadmap.md +0 -8
  222. package/programs/rings/index.js +0 -1
  223. package/programs/totems/camera-totem-attactment-interface.ts +0 -4
  224. package/programs/vectorfields/logics/particle-ubo.ts +0 -23
  225. package/publish.bat +0 -62
  226. package/range-tools-on-terrain/bearing-line/types.ts +0 -65
  227. package/range-tools-on-terrain/circle-line-chain/types.ts +0 -43
  228. package/range-tools-on-terrain/range-ring/rangeringangletext.ts +0 -396
  229. package/range-tools-on-terrain/range-ring/types.ts +0 -30
  230. package/semiplugins/interface.ts +0 -14
  231. package/semiplugins/shape-on-terrain/goal.md +0 -12
  232. package/semiplugins/shape-on-terrain/terrain-polygon/data/cache-shortcuts.md +0 -20
  233. package/semiplugins/shape-on-terrain/terrain-polygon/data/master-worker.js +0 -196
  234. package/semiplugins/shape-on-terrain/terrain-polygon/data/master-worker.ts +0 -209
  235. package/semiplugins/shape-on-terrain/terrain-polygon/data/polygon-to-triangles.ts +0 -144
  236. package/semiplugins/shape-on-terrain/terrain-polygon/data/readme.md +0 -5
  237. package/semiplugins/shape-on-terrain/terrain-polygon/data/types.ts +0 -37
  238. package/semiplugins/shape-on-terrain/terrain-polygon/data/worker.js +0 -146
  239. package/semiplugins/shape-on-terrain/terrain-polygon/notes.md +0 -90
  240. package/semiplugins/shape-on-terrain/terrain-polygon/types.ts +0 -69
  241. package/semiplugins/shell/bbox-renderer/index.ts +0 -2
  242. package/semiplugins/shell/bbox-renderer/object.ts +0 -129
  243. package/semiplugins/type.ts +0 -8
  244. package/terrain-plugin.mmd +0 -83
  245. package/tests/Math/arc-sampling-test.js +0 -367
  246. package/tests/Math/arc-sampling-test.ts +0 -429
  247. package/tests/Math/arc.test.ts +0 -77
  248. package/tests/Math/junction/arc-limit.test.ts +0 -7
  249. package/tests/Math/junction/arc-plane-points.test.ts +0 -196
  250. package/tests/Math/junction/arc-plane.test.ts +0 -172
  251. package/tests/Math/junction/line-sphere.test.ts +0 -127
  252. package/tests/Math/junction/plane-plane.test.ts +0 -91
  253. package/tests/Math/plane-test.ts +0 -17
  254. package/tests/Math/plane.test.ts +0 -43
  255. package/tests/Math/vec3.test.ts +0 -33
  256. package/tracks/point-heat-map/index.js +0 -0
  257. package/tracks/point-heat-map/readme.md +0 -15
  258. package/tracks/timetracks/readme.md +0 -1
  259. package/tsconfig.json +0 -22
  260. package/types/@pirireis/webglobe.d.ts +0 -102
  261. package/types/delaunator.d.ts +0 -40
  262. package/types/earcut.d.ts +0 -11
  263. package/types/rbush.d.ts +0 -57
  264. package/types.ts +0 -319
  265. package/util/account/create-buffermap-orchastration.ts +0 -85
  266. package/util/account/single-attribute-buffer-management/types.ts +0 -43
  267. package/util/algorithms/index.js +0 -0
  268. package/util/check/index.js +0 -0
  269. package/util/check/typecheck.ts +0 -74
  270. package/util/gl-util/buffer/attribute-loader.ts +0 -84
  271. package/util/interpolation/index.js +0 -0
  272. package/util/interpolation/timetrack/index.js +0 -9
  273. package/vectorfield/wind/adapters/image-to-fields.ts +0 -74
  274. package/vectorfield/wind/adapters/types.ts +0 -12
  275. package/vectorfield/wind/plugin-persistant copy.ts +0 -461
  276. package/write-text/context-text3.ts +0 -252
  277. package/write-text/objectarraylabels/objectarraylabels.d.ts +0 -72
@@ -1,396 +0,0 @@
1
- // @ts-ignore
2
- import {CSObjectArrayUpdateTypes} from "@pirireis/webglobe";
3
- import { ENUM_HIDE, ENUM_TEXT_HIDE } from "./enum";
4
- import {Globe,
5
- ObjectArray,
6
- DataBucketObjectArray as DataBucket,
7
- StyleObjectArray as Style,
8
- LabelObjectArray as Label,
9
- LayerObjectObjectArray as LayerObject
10
- } from "../../types";
11
-
12
-
13
- // Type definitions for enum values
14
- type EnumHideType = typeof ENUM_HIDE[keyof typeof ENUM_HIDE];
15
- type EnumTextHideType = typeof ENUM_TEXT_HIDE[keyof typeof ENUM_TEXT_HIDE];
16
-
17
- const fidKey = "__fid__";
18
-
19
- // Type definitions
20
-
21
- interface RingData {
22
- centerID: string;
23
- stepAngle: number;
24
- long: number;
25
- lat: number;
26
- rings: { radius: number }[];
27
- hide?: EnumHideType;
28
- textHide?: EnumTextHideType;
29
- }
30
-
31
- interface CenterData {
32
- centerID: string;
33
- long: number;
34
- lat: number;
35
- }
36
-
37
- interface CenterHide {
38
- centerID: string;
39
- hide?: EnumHideType | null;
40
- textHide?: EnumTextHideType | null;
41
- }
42
-
43
- interface ConstructorOptions {
44
- style?: Style | null;
45
- hideAll?: boolean;
46
- opacity?: number;
47
- }
48
-
49
- interface CenterMapData {
50
- stepAngle: number;
51
- maxRadius: number;
52
- long: number;
53
- lat: number;
54
- hide: EnumHideType;
55
- textHide: EnumTextHideType;
56
- }
57
-
58
- const object: Omit<LayerObject, 'style' | 'id'> = {
59
- "displayName": "RangeRingAngleText",
60
- "layerType": 3,
61
- "wkbGeom": null,
62
- "wfsLayerName": null,
63
- "objectType": "point",
64
- "bbox": null,
65
- "startLod": 2,
66
- "endLod": 30,
67
- "continuousLOD": true,
68
- "MVTXYZName": "hd_seyp",
69
- "rasterize": false,
70
- }
71
-
72
- export default class RangeRingAngleText {
73
- private globe: Globe;
74
- private ObjectArray: ObjectArray;
75
- private id: string;
76
- private _hideAll: boolean;
77
- private _opacity: number;
78
- private object: LayerObject;
79
- private _centerCollection: Map<string, Map<keyof CenterMapData, any>>;
80
-
81
- constructor(globe: Globe, id: string, { style = null, hideAll = false, opacity = 1 }: ConstructorOptions = {}) {
82
- this.globe = globe;
83
- this.ObjectArray = globe.ObjectArray;
84
- this.id = id;
85
-
86
- this._hideAll = hideAll;
87
- this._opacity = opacity;
88
- const style_: Style = style !== null ? style : this.getDefaultStyle();
89
- this.object = Object.assign({}, object, { style: style_, id: this.id }) as LayerObject;
90
-
91
- this._centerCollection = new Map();
92
- // new inner MAP params
93
- // hide
94
- // textHide
95
- this.ObjectArray.Add(this.object);
96
- }
97
-
98
- getDefaultStyle(): Style {
99
- const style: Style = this.ObjectArray.GetDefaultStyle();
100
- style.fidKey = fidKey;
101
- const { labels } = style;
102
- const label: Label = labels[0];
103
- label.offset = { x: 0, y: 0 };
104
- label.fontFamily.hollowWidth = 1;
105
- label.vAlignment = 2;
106
- label.hAlignment = 2;
107
- label.size = 17;
108
- // eslint-disable-next-line
109
- label.text = "`${aci}`"
110
-
111
- return style;
112
- }
113
-
114
- setStyle(style: Style | null): void {
115
- if (style === null) return;
116
- style.opacity = this._opacity;
117
- this.object.style = style;
118
- this.ObjectArray.StyleChanged(this.object);
119
- }
120
-
121
- setOpacity(opacity: number): void {
122
- this._opacity = opacity;
123
- const { style } = this.object;
124
- style.opacity = opacity;
125
- this.ObjectArray.StyleChanged(this.object);
126
- }
127
-
128
- free(): void {
129
- this.flush();
130
- this.ObjectArray.Delete(this.id);
131
- }
132
-
133
- /**
134
- * @param ringDatas Array of ring data objects
135
- * centerID: string | ObjectArray fidKey de kullanilir
136
- * stepAngle: number | 0-360 arasinda
137
- * long,lat: number | merkez koordinatlari lat long radian. Globe icin dereceye iceride cevrilir
138
- * rings: Array<{radius: number}> | En buyuk halkaya centik acilari yazilir, Sonraki adim yaricaplarin uzunlugunu yazdirmak
139
- *
140
- * eger bir centerID zaten var ise: Onceki noktalar dusurulur ve yeniden eklenir
141
- */
142
- insertBulk(ringDatas: RingData[]): void {
143
- const { _hideAll } = this;
144
- const addBucket: DataBucket = {
145
- coords: [],
146
- coordsZ: [],
147
- attribs: []
148
- }
149
-
150
- const deleteBucket: DataBucket = {
151
- coords: [],
152
- coordsZ: [],
153
- attribs: []
154
- }
155
-
156
- for (const { centerID, long, lat, rings, stepAngle, hide = ENUM_HIDE.SHOW, textHide = ENUM_TEXT_HIDE.SHOW } of ringDatas) {
157
- if (this._centerCollection.has(centerID)) {
158
- this._fillDeleteBucket(centerID, deleteBucket);
159
- }
160
-
161
- const maxRadius: number = rings.reduce((acc, { radius }) => Math.max(acc, radius), 0);
162
- const textHide_: EnumTextHideType = _hideAll ? ENUM_TEXT_HIDE.HIDE : textHide;
163
- const show: boolean = hide !== ENUM_HIDE.HIDE && textHide_ === ENUM_TEXT_HIDE.SHOW;
164
- if (show) this._appendCircle(long, lat, maxRadius, stepAngle, centerID, addBucket);
165
- this._centerCollection.set(centerID,
166
- new Map([
167
- ["stepAngle", stepAngle],
168
- ["maxRadius", maxRadius],
169
- ["long", long],
170
- ["lat", lat],
171
- ["hide", hide],
172
- ["textHide", textHide_]
173
- ]));
174
- }
175
- if (this._hideAll) return;
176
- if (deleteBucket.coords.length > 0) this._updateData(deleteBucket, CSObjectArrayUpdateTypes.DELETE);
177
- if (addBucket.coords.length > 0) this._updateData(addBucket, CSObjectArrayUpdateTypes.ADD);
178
- }
179
-
180
- /**
181
- * @param centerDatas Array of center data objects
182
- * aci ve radiuslarin tutulmasi gereklidir.
183
- */
184
- updateCentersXY(centerDatas: CenterData[]): void {
185
- const updateBucket: DataBucket = {
186
- coords: [],
187
- coordsZ: [],
188
- attribs: []
189
- }
190
- for (const { centerID, long, lat } of centerDatas) {
191
- if (this._centerCollection.has(centerID)) {
192
- const centerMap = this._centerCollection.get(centerID)!;
193
- centerMap.set("long", long);
194
- centerMap.set("lat", lat);
195
- const hide: EnumHideType = centerMap.get("hide");
196
- const textHide: EnumTextHideType = centerMap.get("textHide");
197
- const isHidden: boolean = hide === ENUM_HIDE.HIDE || textHide === ENUM_TEXT_HIDE.HIDE;
198
- if (isHidden) continue;
199
- const maxRadius: number = centerMap.get("maxRadius");
200
- const stepAngle: number = centerMap.get("stepAngle");
201
- // long, lat, radius, step, centerID, outBucket
202
- this._appendCircle(long, lat, maxRadius, stepAngle, centerID, updateBucket);
203
- }
204
- }
205
- // for (const attribs of updateBucket.attribs) {
206
- // delete attribs["aci"];
207
- // }
208
- if (updateBucket.coords.length > 0) {
209
- this._updateData(updateBucket, CSObjectArrayUpdateTypes.UPDATE);
210
- }
211
- }
212
-
213
- /**
214
- * @param centerHides Array of center hide data
215
- */
216
- updateCentersHide(centerHides: CenterHide[]): void {
217
- if (this._hideAll) {
218
- console.warn("Tum mesafe halkasi yazilari gizli durum. Islem yapilamaz");
219
- return;
220
- };
221
- const addBucket: DataBucket = {
222
- coords: [],
223
- coordsZ: [],
224
- attribs: []
225
- };
226
- const deleteBucket: DataBucket = {
227
- coords: [],
228
- coordsZ: [],
229
- attribs: []
230
- };
231
- for (const { centerID, textHide = null, hide = null } of centerHides) {
232
- if (!this._centerCollection.has(centerID)) continue;
233
- const centerMap = this._centerCollection.get(centerID)!;
234
-
235
- const isHidden: boolean = centerMap.get("hide") === ENUM_HIDE.HIDE || centerMap.get("textHide") === ENUM_TEXT_HIDE.HIDE;
236
-
237
- const _hide: EnumHideType = hide !== null ? hide : centerMap.get("hide");
238
- const _textHide: EnumTextHideType = textHide !== null ? textHide : centerMap.get("textHide");
239
-
240
- const show: boolean = (_hide !== ENUM_HIDE.HIDE) && (_textHide === ENUM_TEXT_HIDE.SHOW);
241
- if (!isHidden && !show) {
242
- this._fillDeleteBucket(centerID, deleteBucket);
243
- } else if (isHidden && show) {
244
- this._appendCircle(centerMap.get("long"), centerMap.get("lat"), centerMap.get("maxRadius"), centerMap.get("stepAngle"), centerID, addBucket);
245
- }
246
- if (hide !== null) centerMap.set("hide", hide);
247
- if (textHide !== null) centerMap.set("textHide", textHide);
248
- }
249
- if (deleteBucket.coords.length > 0) this._updateData(deleteBucket, CSObjectArrayUpdateTypes.DELETE);
250
- if (addBucket.coords.length > 0) this._updateData(addBucket, CSObjectArrayUpdateTypes.ADD);
251
- }
252
-
253
- // TODO : Implement this
254
- removeCenters(centerIDs: string[]): void {
255
- const deleteBucket: DataBucket = {
256
- coords: [],
257
- coordsZ: [],
258
- attribs: []
259
- }
260
- for (const centerID of centerIDs) {
261
- if (this._centerCollection.has(centerID)) {
262
- this._fillDeleteBucket(centerID, deleteBucket);
263
- this._centerCollection.delete(centerID);
264
- }
265
- }
266
- this._updateData(deleteBucket, CSObjectArrayUpdateTypes.DELETE);
267
- }
268
-
269
- hideAll(): void {
270
- this._hideAll = true;
271
- const deleteBucket: DataBucket = {
272
- coords: [],
273
- coordsZ: [],
274
- attribs: []
275
- }
276
- for (const [centerID, centerMap] of this._centerCollection) {
277
- const hide: EnumHideType = centerMap.get("hide");
278
- const hideText: EnumTextHideType = centerMap.get("textHide");
279
- centerMap.set("textHide", ENUM_TEXT_HIDE.HIDE);
280
- if (hide === ENUM_HIDE.HIDE) continue;
281
- const isHidden: boolean = hideText === ENUM_TEXT_HIDE.HIDE;
282
- if (!isHidden) this._fillDeleteBucket(centerID, deleteBucket);
283
- }
284
- this._updateData(deleteBucket, CSObjectArrayUpdateTypes.DELETE);
285
- }
286
-
287
- showAll(): void {
288
- this._hideAll = false;
289
- const addBucket: DataBucket = {
290
- coords: [],
291
- coordsZ: [],
292
- attribs: []
293
- }
294
- for (const [centerID, centerMap] of this._centerCollection) {
295
- const hide: EnumHideType = centerMap.get("hide");
296
- if (hide === ENUM_HIDE.HIDE) continue;
297
- const hideText: EnumTextHideType = centerMap.get("textHide");
298
- const isHidden: boolean = hideText === ENUM_TEXT_HIDE.HIDE;
299
- if (isHidden) {
300
- const long: number = centerMap.get("long");
301
- const lat: number = centerMap.get("lat");
302
- const maxRadius: number = centerMap.get("maxRadius");
303
- const stepAngle: number = centerMap.get("stepAngle");
304
- this._appendCircle(long, lat, maxRadius, stepAngle, centerID, addBucket);
305
- centerMap.set("hide", ENUM_HIDE.SHOW);
306
- centerMap.set("textHide", ENUM_TEXT_HIDE.SHOW);
307
- }
308
- }
309
- if (addBucket.coords.length) this._updateData(addBucket, CSObjectArrayUpdateTypes.ADD);
310
- }
311
-
312
- flush(): void {
313
- const data: DataBucket = {
314
- coords: [],
315
- coordsZ: [],
316
- attribs: []
317
- };
318
- this.ObjectArray.SetData(this.object, data);
319
- }
320
-
321
- //------------------PRIVATE METHODS------------------//
322
-
323
- private _appendCircle(long: number, lat: number, radius: number, step: number, centerID: string, outBucket: DataBucket): void {
324
- this.__realCoords(long, lat, radius, step, centerID, outBucket);
325
- }
326
-
327
- private __realCoords(longCenter: number, latCenter: number, radius: number, stepAngle: number, centerID: string, outBucket: DataBucket): void {
328
- const { globe } = this;
329
- const { coords, coordsZ, attribs } = outBucket;
330
- let i = 1;
331
- for (let aci = stepAngle; aci < 360; aci += stepAngle) {
332
- const { long, lat } = globe.Math.FindPointByPolar(longCenter, latCenter, radius, aci);
333
- coords.push(long, lat);
334
- coordsZ.push(0);
335
- const key: string = this._key(centerID, i); i++;
336
- // fidkey is the key
337
- attribs.push({
338
- "__fid__": key,
339
- "aci": (aci).toFixed(0).toString().padStart(3, '0')
340
- })
341
- }
342
-
343
- { // add 0
344
- const { long, lat } = globe.Math.FindPointByPolar(longCenter, latCenter, radius, 0);
345
- coords.push(long, lat);
346
- coordsZ.push(0);
347
- const key: string = this._key(centerID, 0);
348
- // fidkey is the key
349
- attribs.push({
350
- "__fid__": key,
351
- "aci": "K"
352
- });
353
- }
354
- }
355
-
356
- private _updateData(bucket: DataBucket, mode: any): void {
357
- this.ObjectArray.UpdateData(this.object, mode, [bucket], { attribs: false, icon: false, text: false });
358
- }
359
-
360
- private _key(centerRingKey: string, limpIndex: number): string {
361
- return `${centerRingKey}_${limpIndex}`;
362
- }
363
-
364
- private _fillDeleteBucket(centerID: string, outDeleteBucket: DataBucket): void {
365
- const centerMap = this._centerCollection.get(centerID)!;
366
- const stepAngle: number = centerMap.get("stepAngle");
367
- const { coords, coordsZ, attribs } = outDeleteBucket;
368
- let i = 0;
369
- for (let aci = 0; aci < 360; aci += stepAngle) {
370
- const key: string = this._key(centerID, i++);
371
- coords.push(0, 0);
372
- coordsZ.push(0);
373
- attribs.push({
374
- "__fid__": key,
375
- });
376
- }
377
- }
378
-
379
- private _updateAll(): void {
380
- const updateBucket: DataBucket = {
381
- coords: [],
382
- coordsZ: [],
383
- attribs: []
384
- }
385
- for (const [centerID, centerMap] of this._centerCollection) {
386
- const isHidden: boolean = centerMap.get("hide") === ENUM_HIDE.HIDE || centerMap.get("textHide") === ENUM_TEXT_HIDE.HIDE;
387
- if (isHidden) continue;
388
- const long: number = centerMap.get("long");
389
- const lat: number = centerMap.get("lat");
390
- const maxRadius: number = centerMap.get("maxRadius");
391
- const stepAngle: number = centerMap.get("stepAngle");
392
- this._appendCircle(long, lat, maxRadius, stepAngle, centerID, updateBucket);
393
- }
394
- this._updateData(updateBucket, CSObjectArrayUpdateTypes.UPDATE);
395
- }
396
- }
@@ -1,30 +0,0 @@
1
- import { Color, Meter } from "../../types";
2
-
3
- export type RangeRing = {
4
- ringID: string;
5
- radius: Meter;
6
- padding: number;
7
- }
8
-
9
- export const ENUM_HIDE = Object.freeze({
10
- SHOW: 0,
11
- HIDE: 1,
12
- HIDE_1_DEGREE_PADDINGS: 2
13
- });
14
-
15
- export const ENUM_TEXT_HIDE = Object.freeze({
16
- SHOW: 0,
17
- HIDE: 1
18
- });
19
-
20
- export type RangeRingInput = {
21
- centerID: string;
22
- long: number;
23
- lat: number;
24
- stepAngle: number;
25
- altitude: number; // TODO: probably not needed anymore
26
- hide: 0 | 1 | 2; // 0 - show, 1 - hide // TODO: create a type or enum for this
27
- rgba: Color; // [r, g, b, a] 0-1
28
- textHide: 0 | 1; // 0 - show, 1 - hide // TODO: create a type or enum for this
29
- rings: RangeRing[];
30
- }
@@ -1,14 +0,0 @@
1
- import { Globe, Color } from "../types";
2
-
3
- export interface SemiPluginInterface {
4
- id: string;
5
- init(globe: Globe, gl: WebGL2RenderingContext): void;
6
- setPluginOpacity(opacity: number, drawRender: boolean): void;
7
- insertBulk(data: any[]): void;
8
- deleteBulk(keys: string[]): void;
9
- setDefaultColor(color: Color, drawRender: boolean): void;
10
- increaseSpace(amount: number): void;
11
- updateCoordinates(items: any[]): void;
12
- }
13
-
14
-
@@ -1,12 +0,0 @@
1
- The fact that a straight line have two points, lacks the ability to cover elevation data on higher zoom levels.
2
-
3
- The purpose of this subplugin is to adapt the straight line to the terrain.
4
-
5
-
6
- ### Steps
7
-
8
- - filter by bbox with tree -> indexes
9
- - find intersaction. Also filters in a more precise way then bbox. -> index and 2 points. 3d carteasian so it can be used on slerp.
10
- - Populate the line points -> Array<lat long>
11
- - 3d cartesian coords with globe api
12
-
@@ -1,20 +0,0 @@
1
- 1) Tüm üçgenlerin özetini bufferlarda tutmak zoom 0 göre partition
2
- 1 problem 1) eğer üçgen çok büyükse, 3d de küre oturmaz, 2d de gerekli alanı kaplamaz
3
- 1 problem 2) Cachelenmiş hızlı yüklenen çıktılar main threaddemi, tüm işlemleri yapan webworkerda mı yoksa yeni bir workerdamı tutulacak?
4
-
5
- Webworker problemi: Şu an webworkera bir aracı ile veri gönderilip alınıyor. Aracı webworker işlemdeyken gelen yazma silme işlemlerini istifliyor, tile işlemlerinin ise üzerine yazıyor. Webworker cevap gönderdiğinde onun boşaldığını anlıyor. Biriktirdiği tüm işlemleri tek seferde yolluyor.
6
-
7
- MessageChannel API (Doğrudan İletişim): Araştıracağım!!!!
8
-
9
-
10
-
11
- 2) Görünmüyorsa, hesaplarken O an ekrandaki en derin zoom seviyesindeki parkenin bile kenarından 100 kat küçükse üçgen atlanabilir.
12
-
13
- Bu hesaplamada üçgenin uzun kenarı ile parkenin kenarı kıyaslanır. polygonlar çok ince ama uzun üçgenler içerebiliyor.
14
- Alan hesaplandığında bu kenarlar eleniyor. Ancak kenar uzunluğu kullanıldığında polygon biraz küçültülerek basitleştirilmiş gibi gözüküyor
15
-
16
- 2 problemi) Küçücük üçgenelere bölünmüş büyük polygonlar düşük zoom seviyelerinde çok fazla budanıyor.
17
-
18
- 2 avantajı) gözükmeyen üçgenler gpu bufferda yer tutmuyor ve işlemci zamanı harcamıyor
19
-
20
-
@@ -1,196 +0,0 @@
1
- /// <reference lib="webworker" />
2
-
3
- const _workers = [];
4
- const _workerMap = new Map();
5
- let _maxWorkers = 4; // Default, updated in init
6
- let _nextWorkerIndex = 0;
7
-
8
- // Configuration state to pass to new workers or re-broadcast
9
- let _pickableState;
10
- let _variativeColorsOn;
11
-
12
- // Initialize workers
13
- function initWorkers() {
14
- _maxWorkers = Math.max(1, (navigator.hardwareConcurrency / 2 || 3) - 1);
15
- for (let i = 0; i < _maxWorkers; i++) {
16
- addWorker();
17
- }
18
- }
19
-
20
- function addWorker() {
21
- const worker = new Worker(new URL("./worker.js", import.meta.url), { type: 'module' });
22
-
23
- const wrapper = {
24
- worker,
25
- inProgress: false,
26
- insertDeleteQueue: [],
27
- lastBBOXData: null,
28
- itemCount: 0,
29
- lastOutput: null
30
- };
31
-
32
- worker.onmessage = (event) => {
33
- wrapper.inProgress = false;
34
- wrapper.lastOutput = event.data;
35
- mergeAndSendResults();
36
- sendToSubWorker(wrapper);
37
- };
38
-
39
- // Initialize sub-worker with current global state
40
- worker.postMessage({
41
- pickableState: _pickableState,
42
- variativeColorsOn: _variativeColorsOn,
43
- insertDeleteQueue: [],
44
- bboxes: null,
45
- });
46
-
47
- _workers.push(wrapper);
48
- }
49
-
50
- function mergeAndSendResults() {
51
- let totalVec3s = 0;
52
- let totalIndices = 0;
53
- let totalLongLats = 0;
54
- let totalPickIndices = 0;
55
- let totalVariativeColors = 0;
56
-
57
- const validOutputs = [];
58
-
59
- for (const w of _workers) {
60
- if (w.lastOutput) {
61
- validOutputs.push(w.lastOutput);
62
- totalVec3s += w.lastOutput.vec3s.length;
63
- totalIndices += w.lastOutput.indices.length;
64
- totalLongLats += w.lastOutput.longLats.length;
65
- if (w.lastOutput.pickIndices) totalPickIndices += w.lastOutput.pickIndices.length;
66
- if (w.lastOutput.variativeColors) totalVariativeColors += w.lastOutput.variativeColors.length;
67
- }
68
- }
69
-
70
- if (validOutputs.length === 0) return;
71
-
72
- const merged = {
73
- vec3s: new Float32Array(totalVec3s),
74
- indices: new Uint32Array(totalIndices),
75
- longLats: new Float32Array(totalLongLats),
76
- pickIndices: totalPickIndices > 0 ? new Float32Array(totalPickIndices) : null,
77
- variativeColors: totalVariativeColors > 0 ? new Float32Array(totalVariativeColors) : null
78
- };
79
-
80
- let offsetVec3s = 0;
81
- let offsetIndices = 0;
82
- let offsetLongLats = 0;
83
- let offsetPickIndices = 0;
84
- let offsetVariativeColors = 0;
85
- let vertexOffset = 0;
86
-
87
- for (const out of validOutputs) {
88
- merged.vec3s.set(out.vec3s, offsetVec3s);
89
- offsetVec3s += out.vec3s.length;
90
-
91
- for (let i = 0; i < out.indices.length; i++) {
92
- merged.indices[offsetIndices + i] = out.indices[i] + vertexOffset;
93
- }
94
- offsetIndices += out.indices.length;
95
- vertexOffset += out.vec3s.length / 3;
96
-
97
- merged.longLats.set(out.longLats, offsetLongLats);
98
- offsetLongLats += out.longLats.length;
99
-
100
- if (merged.pickIndices && out.pickIndices) {
101
- merged.pickIndices.set(out.pickIndices, offsetPickIndices);
102
- offsetPickIndices += out.pickIndices.length;
103
- }
104
-
105
- if (merged.variativeColors && out.variativeColors) {
106
- merged.variativeColors.set(out.variativeColors, offsetVariativeColors);
107
- offsetVariativeColors += out.variativeColors.length;
108
- }
109
- }
110
-
111
- // Send merged result to Main Thread
112
- // eslint-disable-next-line no-restricted-globals
113
- self.postMessage(merged, [
114
- merged.vec3s.buffer,
115
- merged.indices.buffer,
116
- merged.longLats.buffer,
117
- ...(merged.pickIndices ? [merged.pickIndices.buffer] : []),
118
- ...(merged.variativeColors ? [merged.variativeColors.buffer] : [])
119
- ]);
120
- }
121
-
122
- function sendToSubWorker(wrapper) {
123
- if (wrapper.inProgress) return;
124
- if (wrapper.insertDeleteQueue.length === 0 && wrapper.lastBBOXData === null) return;
125
-
126
- wrapper.inProgress = true;
127
- wrapper.worker.postMessage({
128
- pickableState: undefined, // State is set on init, only send updates if needed
129
- variativeColorsOn: undefined,
130
- bboxes: wrapper.lastBBOXData,
131
- insertDeleteQueue: wrapper.insertDeleteQueue,
132
- });
133
-
134
- wrapper.lastBBOXData = null;
135
- wrapper.insertDeleteQueue = [];
136
- }
137
-
138
- function triggerAllWorkers() {
139
- for (const w of _workers) {
140
- sendToSubWorker(w);
141
- }
142
- }
143
-
144
- // Handle messages from Main Thread
145
- // eslint-disable-next-line no-restricted-globals
146
- self.onmessage = (event) => {
147
- const { bboxes, insertDeleteQueue, pickableState, variativeColorsOn } = event.data;
148
-
149
- // Initialize if not already done
150
- if (_workers.length === 0) {
151
- _pickableState = pickableState;
152
- _variativeColorsOn = variativeColorsOn;
153
- initWorkers();
154
- }
155
-
156
- // Handle BBOX updates
157
- if (bboxes) {
158
- for (const w of _workers) {
159
- w.lastBBOXData = bboxes;
160
- }
161
- }
162
-
163
- // Handle Insert/Delete
164
- if (insertDeleteQueue && insertDeleteQueue.length > 0) {
165
- if (insertDeleteQueue[0] === "__CLEAR_ALL_ITEMS__") {
166
- _workerMap.clear();
167
- for (const w of _workers) {
168
- w.insertDeleteQueue = ["__CLEAR_ALL_ITEMS__"];
169
- w.itemCount = 0;
170
- w.lastOutput = null;
171
- }
172
- } else {
173
- for (const item of insertDeleteQueue) {
174
- if (typeof item === 'string') {
175
- // Delete
176
- const workerIdx = _workerMap.get(item);
177
- if (workerIdx !== undefined) {
178
- _workers[workerIdx].insertDeleteQueue.push(item);
179
- _workers[workerIdx].itemCount--;
180
- _workerMap.delete(item);
181
- }
182
- } else {
183
- // Insert
184
- let workerIdx = _workerMap.get(item.key);
185
- if (workerIdx === undefined) {
186
- workerIdx = _nextWorkerIndex;
187
- _workerMap.set(item.key, workerIdx);
188
- _workers[workerIdx].itemCount++;
189
- _nextWorkerIndex = (_nextWorkerIndex + 1) % _workers.length;
190
- }
191
- _workers[workerIdx].insertDeleteQueue.push(item);
192
- }
193
- }
194
- }
195
- } triggerAllWorkers();
196
- };