@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,713 +1,539 @@
1
- // One Degree Padding
2
- /**
3
- * 2d coordinates are loaded ones
4
- * 3d coordinates are calculated on the fly.
5
- *
6
- * 2d paddings are fixed size
7
- * 3d paddings gets shortened as lod increases
8
- *
9
- * color buffer is shared and does not change on unless insert or delete
10
- * changing color can be done by re inserting
11
- *
12
- *
13
- *
14
- */
15
-
16
- import {
17
- Globe,
18
- GlobeChanges,
19
- Meter,
20
- Color,
21
- BUFFER_TYPE,
22
- UBOHandler,
23
- ColorRatio,
24
- PluginInterface,
25
- DrawRangeIndexParams,
26
- LongLatDegree
27
- } from '../../types';
28
- import { SemiPluginInterface } from '../interface';
29
- import { BufferManagersMap } from '../../util/account/single-attribute-buffer-management/types';
30
-
31
- import { BufferManager } from '../../util/account/single-attribute-buffer-management/buffer-manager';
32
-
33
- import { BufferOrchestrator } from '../../util/account/single-attribute-buffer-management/buffer-orchestrator';
34
-
35
- import {
36
- LineStripProgramCache,
37
- LineProgram
38
- } from '../../programs/line-on-globe/linestrip/linestrip';
39
- import {
40
- opacityCheck,
41
- colorCheck
42
- } from '../../util/check/typecheck';
43
- import { FrameCounterTrigger } from '../../util/frame-counter-trigger';
44
-
45
-
46
-
47
- export type Padding1DegreeInput = {
48
- key: string;
49
- center: LongLatDegree;
50
- radius: Meter;
51
- heightFromGroundIn3D?: Meter; // optional, if not provided, defaultHeightFromGroundIn3D will be used
52
- colorsRatios: ColorRatio[];
53
- };
54
-
55
-
56
- export type Padding1DegreePluginOptions = {
57
- bufferType: BUFFER_TYPE;
58
- variativeColorsOn: boolean;
59
- defaultColor: Color;
60
- defaultHeightFromGroundIn3D: Meter;
61
- adativePaddingSize: boolean; // TODO : implement this
62
- adaptiveOpacity: boolean; // TODO : implement this
63
- isMSL: boolean;
64
- }
65
-
66
- const initialCapacity = 2; // initial capacity for the buffer managers
67
-
68
- // You'll need to define this type based on your requirements
69
- type InnerPadding1DegreeInput = {
70
- key: string;
71
- center: [number, number];
72
- radius: number;
73
- outerCoords: (LongLatDegree | null)[];
74
- innerCoords: (LongLatDegree | null)[];
75
- colorsRatios: ColorRatio[]; // optional, if not provided, defaultColor will be used
76
- heightFromGroundIn3D: Meter;
77
- };
78
-
79
-
80
- // const _float32Array = new Float32Array(360 * 3 * 2).fill(NaN);
81
-
82
- export class Padding1DegreePlugin implements SemiPluginInterface, PluginInterface {
83
- id: string;
84
- globe: Globe | null = null;
85
- private bufferOrchestrator: BufferOrchestrator;
86
- private bufferManagerMap: BufferManagersMap;
87
- private lineProgram: LineProgram | null = null;
88
- private _innerPaddingRatio = 0.95; //
89
- private _float32Array: Float32Array | null = null; // this is used to forward the data to the buffer manager
90
- private _uboHandler: UBOHandler | null = null; // this is used to forward the data to the shader program
91
- private _bufferNames: string[] = ["position2d", "position3d"];
92
- private _vao: WebGLVertexArrayObject | null = null; // this is used to store the VAO for the plugin
93
- private _freed: boolean = false; // this is used to check if the plugin is freed or not
94
- private _userOpacity: number = 1;
95
- private _adaptiveOpacityMultiplier: number = 1;
96
- private _dataMap = new Map<string, InnerPadding1DegreeInput>();
97
- private _options: Padding1DegreePluginOptions = {
98
- bufferType: "STATIC_DRAW",
99
- variativeColorsOn: false,
100
- defaultColor: [1, 1, 1, 1], // white color
101
- defaultHeightFromGroundIn3D: 0.1, // 10 cm from ground
102
- adativePaddingSize: true, // if true, the padding size will be adaptive to the LOD
103
- adaptiveOpacity: true, // if true, the opacity will be adaptive to the LOD
104
- isMSL: false // if true, no elevation of terrain
105
-
106
- };
107
- private _frameCounterTrigger: FrameCounterTrigger | null = null;
108
-
109
- constructor(id: string, options: Partial<Padding1DegreePluginOptions> | null = null) {
110
- this.id = id;
111
- this.bufferManagerMap = new Map();
112
- this.lineProgram = null;
113
- this._options = options ? { ...this._options, ...options } : this._options;
114
- this.bufferOrchestrator = new BufferOrchestrator()
115
-
116
- if (this._options.variativeColorsOn) {
117
- this._bufferNames.push("color");
118
- }
119
- }
120
-
121
-
122
-
123
- increaseSpace(amount: number): void {
124
- if (this._freed) {
125
- console.warn("Plugin is freed, cannot increase space");
126
- return;
127
- }
128
- if (this.globe === null) {
129
- console.warn("Globe is not initialized.");
130
- return;
131
- }
132
- if (typeof amount !== "number" || amount <= 0) {
133
- console.warn("Invalid amount, must be a positive number");
134
- return;
135
- }
136
- this.bufferOrchestrator.ensureSpace(amount, this.bufferManagerMap!);
137
- }
138
-
139
-
140
- insertBulk(inputs: Padding1DegreeInput[]): void {
141
- if (this.globe === null) {
142
- console.warn("Globe is not initialized, cannot insert input");
143
- return;
144
- }
145
- if (this._freed) {
146
- console.warn("Plugin is freed, cannot insert input");
147
- return;
148
- }
149
-
150
- const wrapper: [InnerPadding1DegreeInput | null] = [null]
151
- this._float32Array = new Float32Array(360 * 4 * 4); // largest float32Array
152
- let newItemCount = 0;
153
- for (let i = 0; i < inputs.length; i++) {
154
- if (!this._dataMap.has(inputs[i].key)) {
155
- newItemCount++;
156
- }
157
- }
158
- this.bufferOrchestrator.ensureSpace(newItemCount, this.bufferManagerMap!);
159
- for (let i = 0; i < inputs.length; i++) {
160
- const coords = preAdapter(this.globe, inputs[i], this._innerPaddingRatio, null);
161
- const paddingInput = { ...inputs[i], ...coords } as InnerPadding1DegreeInput;
162
- this._dataMap.set(paddingInput.key, paddingInput);
163
- wrapper[0] = paddingInput;
164
- this.bufferOrchestrator.insertBulk(wrapper, this.bufferManagerMap, this._bufferNames);
165
- }
166
- this._float32Array = null;
167
- this.globe?.DrawRender();
168
- }
169
-
170
-
171
- updateColorRatios(key: string, colorRatios: ColorRatio[], drawRender: boolean = true): void {
172
- if (this._freed) {
173
- console.warn("Plugin is freed, cannot update color");
174
- return;
175
- }
176
- if (this.globe === null) {
177
- console.warn("Globe is not initialized, cannot update color");
178
- return;
179
- }
180
- if (!this._options.variativeColorsOn) {
181
- console.warn("VariativeColors are not enabled");
182
- return;
183
- }
184
- if (!this._dataMap.has(key)) {
185
- console.warn(`Key ${key} does not exist in the data map`);
186
- return;
187
- }
188
- const paddingInput = this._dataMap.get(key);
189
- if (!paddingInput) {
190
- console.warn(`Padding input for key ${key} is not found`);
191
- return;
192
- }
193
- this._float32Array = new Float32Array(360 * 4 * 4); // largest float32Array
194
-
195
- paddingInput.colorsRatios = colorRatios;
196
- this.bufferOrchestrator.updateBulk([paddingInput], this.bufferManagerMap, ["color"]);
197
- this._float32Array = null;
198
- if (drawRender) {
199
- this.globe.DrawRender();
200
- }
201
- }
202
-
203
- updateCoordinates(items: Pick<Padding1DegreeInput, "key" | "center" | "radius">[]): void {
204
- if (this._freed) {
205
- console.warn("Plugin is freed, cannot update coordinates");
206
- return;
207
- }
208
- if (this.globe === null) {
209
- console.warn("Globe is not initialized, cannot update coordinates");
210
- return;
211
- }
212
- this._float32Array = new Float32Array(360 * 4 * 4); // largest float32Array
213
-
214
- const updateKeys: string[] = [];
215
- for (const item of items) {
216
- const paddingInput = this._dataMap.get(item.key);
217
- if (!paddingInput) {
218
- console.warn(`Padding input for key ${item.key} is not found`);
219
- continue;
220
- }
221
- paddingInput.center = item.center;
222
- paddingInput.radius = item.radius;
223
- updateKeys.push(item.key);
224
- }
225
-
226
- this._buildPaddings("input", updateKeys);
227
- this._float32Array = null;
228
- this.globe.DrawRender();
229
- }
230
-
231
- deleteBulk(keys: string[]): void {
232
- if (this.globe === null) {
233
- console.warn("Globe is not initialized, cannot delete data");
234
- return;
235
- }
236
- if (this._freed) {
237
- console.warn("Plugin is freed, cannot delete data");
238
- return;
239
- }
240
- this.bufferOrchestrator.deleteBulk(keys, this.bufferManagerMap);
241
- for (const key of keys) {
242
- this._dataMap.delete(key);
243
- }
244
- this.globe?.DrawRender();
245
- }
246
-
247
- setPluginOpacity(opacity: number, drawRender: boolean = false): void {
248
- if (this._freed) {
249
- console.warn("Plugin is freed, cannot set opacity");
250
- return;
251
- }
252
- if (this.globe === null) {
253
- console.warn("Globe is not initialized, cannot set opacity");
254
- return;
255
- }
256
- opacityCheck(opacity);
257
- this._userOpacity = opacity;
258
- if (drawRender) {
259
- this.globe.DrawRender();
260
- }
261
- }
262
-
263
- setDefaultColor(color: Color): void {
264
- if (this._freed) {
265
- console.warn("Plugin is freed, cannot set default color");
266
- return;
267
- }
268
- if (this.globe === null) {
269
- console.warn("Globe is not initialized, cannot set default color");
270
- return;
271
- }
272
- colorCheck(color);
273
- this._options.defaultColor = color;
274
- this._uboHandler?.updateSingle("u_color", new Float32Array(color));
275
- this.globe.DrawRender();
276
- }
277
-
278
-
279
- setElevationMode(mode: "msl" | "agl"): void {
280
- switch (mode) {
281
- case "msl":
282
- this._options.isMSL = true;
283
- break;
284
- case "agl":
285
- this._options.isMSL = false;
286
- break;
287
- default:
288
- throw new Error(`Unknown elevation mode: ${mode}`);
289
- }
290
- this._buildPaddings("elevation");
291
- this.globe?.DrawRender();
292
- }
293
-
294
- init(globe: Globe, gl: WebGL2RenderingContext): void {
295
- this.globe = globe;
296
- this.lineProgram = LineStripProgramCache.get(globe);
297
-
298
- this._frameCounterTrigger = new FrameCounterTrigger(globe, 10, 1000, (globeChanges: GlobeChanges) => {
299
- if (this._freed) return;
300
- this.__build(globeChanges);
301
- globe.DrawRender();
302
- });
303
-
304
-
305
- this.__updateLODRelatedParameters()
306
- this.__updateAdaptiveOpacityMultiplier();
307
-
308
- const bufferManagerMap = new Map(
309
- [
310
- ["position2d", {
311
- bufferManager: new BufferManager(globe.gl as WebGL2RenderingContext,
312
- 360 * 2 * 3, // plus 1 to cut
313
- { bufferType: this._options.bufferType, initialCapacity: initialCapacity }),
314
- adaptor: (paddingInput: InnerPadding1DegreeInput) => {
315
- if (this._float32Array === null) {
316
- throw new Error("Float32Array is not initialized");
317
- } else {
318
- this._float32Array.fill(NaN); // reset the float32Array
319
- }
320
- for (let i = 0; i < 360; i++) {
321
-
322
- const outerCoords = paddingInput.outerCoords[i] as LongLatDegree;
323
- const innerCoords = paddingInput.innerCoords[i] as LongLatDegree;
324
- if (outerCoords === null || innerCoords === null) {
325
- continue;
326
- }
327
- let coordsOuter = globe.api_GetMercator2DPoint(outerCoords[0], outerCoords[1]);
328
- // fill the second coordinate with 0
329
- this._float32Array[i * 6] = coordsOuter[0];
330
- this._float32Array[i * 6 + 1] = coordsOuter[1];
331
-
332
- let coordsInner = globe.api_GetMercator2DPoint(innerCoords[0], innerCoords[1]);
333
- // fill the second coordinate with 0
334
- this._float32Array[i * 6 + 2] = coordsInner[0];
335
- this._float32Array[i * 6 + 3] = coordsInner[1];
336
- }
337
- return this._float32Array.subarray(0, 360 * 2 * 3);
338
- }
339
- }
340
- ],
341
- [
342
- "position3d", {
343
- bufferManager: new BufferManager(globe.gl as WebGL2RenderingContext,
344
- 360 * 3 * 3, // plus 1 to cut
345
- { bufferType: this._options.bufferType, initialCapacity: initialCapacity }),
346
- adaptor: (paddingInput: InnerPadding1DegreeInput) => {
347
- if (this._float32Array === null) {
348
- throw new Error("Float32Array is not initialized");
349
- } else {
350
- this._float32Array.fill(NaN); // reset the float32Array
351
- }
352
- const _float32Array = this._float32Array;
353
- for (let i = 0; i < 360; i++) {
354
-
355
-
356
- const outerCoords = paddingInput.outerCoords[i] as LongLatDegree;
357
- const innerCoords = paddingInput.innerCoords[i] as LongLatDegree;
358
- if (outerCoords === null || innerCoords === null) {
359
- continue;
360
- }
361
- const height = paddingInput.heightFromGroundIn3D ?? this._options.defaultHeightFromGroundIn3D;
362
-
363
- let coords = globe.api_GetCartesian3DPoint(outerCoords[0], outerCoords[1], height, this._options.isMSL);
364
- // fill the second coordinate with 0
365
- _float32Array[i * 9] = coords[0];
366
- _float32Array[i * 9 + 1] = coords[1];
367
- _float32Array[i * 9 + 2] = coords[2];
368
-
369
-
370
- let coordsInner = globe.api_GetCartesian3DPoint(innerCoords[0], innerCoords[1], height, this._options.isMSL);
371
- // fill the second coordinate with 0
372
-
373
- _float32Array[i * 9 + 3] = coordsInner[0];
374
- _float32Array[i * 9 + 4] = coordsInner[1];
375
- _float32Array[i * 9 + 5] = coordsInner[2];
376
-
377
- }
378
- return _float32Array.subarray(0, 360 * 3 * 3);
379
- }
380
- }
381
- ],
382
- ]
383
- );
384
-
385
-
386
- if (this._options.variativeColorsOn) {
387
- bufferManagerMap.set(
388
- "color", {
389
- bufferManager: new BufferManager(globe.gl as WebGL2RenderingContext,
390
- 360 * 4 * 3, // 4 for RGBA
391
- { bufferType: this._options.bufferType, initialCapacity: initialCapacity }),
392
- adaptor: (paddingInput: Padding1DegreeInput) => {
393
- if (this._float32Array === null) {
394
- throw new Error("Float32Array is not initialized");
395
- } else {
396
- this._float32Array.fill(NaN); // reset the float32Array
397
- }
398
- if (!paddingInput.colorsRatios) {
399
- const color = this._options.defaultColor;
400
- const colorArray = new Float32Array(360 * 4 * 3);
401
- this._float32Array = colorArray; // store for forwarding
402
- for (let i = 0; i < 360; i++) {
403
- this._float32Array[i * 12] = color[0];
404
- this._float32Array[i * 12 + 1] = color[1];
405
- this._float32Array[i * 12 + 2] = color[2];
406
- this._float32Array[i * 12 + 3] = color[3];
407
- this._float32Array[i * 12 + 4] = color[0];
408
- this._float32Array[i * 12 + 5] = color[1];
409
- this._float32Array[i * 12 + 6] = color[2];
410
- this._float32Array[i * 12 + 7] = 0; //color[3] ;
411
- }
412
- return this._float32Array.subarray(0, 360 * 4 * 3);
413
- } else {
414
- const colorsRatios = paddingInput.colorsRatios;
415
- let i = 0;
416
- for (const colorRatio of colorsRatios) {
417
- const color = colorRatio.color;
418
- const ratio = colorRatio.ratio;
419
- for (let j = 0; j < ratio; j++) {
420
- this._float32Array[i * 12] = color[0];
421
- this._float32Array[i * 12 + 1] = color[1];
422
- this._float32Array[i * 12 + 2] = color[2];
423
- this._float32Array[i * 12 + 3] = color[3];
424
- this._float32Array[i * 12 + 4] = color[0];
425
- this._float32Array[i * 12 + 5] = color[1];
426
- this._float32Array[i * 12 + 6] = color[2];
427
- this._float32Array[i * 12 + 7] = 0.1;// color[3];
428
- i++;
429
- }
430
- }
431
- return this._float32Array.subarray(0, 360 * 4 * 3);
432
- }
433
- }
434
- }
435
- );
436
- }
437
-
438
-
439
- const vaoInput = ["position3d", "position2d", "color"].map((name) => {
440
- const bufferManager = bufferManagerMap.get(name);
441
- if (!bufferManager) {
442
- return null;
443
- }
444
- return {
445
- buffer: bufferManager.bufferManager.buffer,
446
- stride: 0,
447
- offset: 0
448
- }
449
- })
450
-
451
- this._vao = this.lineProgram.createVAO(
452
- vaoInput[0],
453
- vaoInput[1],
454
- vaoInput[2],
455
- );
456
- this.bufferManagerMap = bufferManagerMap;
457
- this.bufferOrchestrator.resetWithCapacity(bufferManagerMap, initialCapacity);
458
- this._uboHandler = this.lineProgram.createUBO("STATIC_DRAW");
459
- this._uboHandler.updateSingle("u_color", new Float32Array(this._options.defaultColor));
460
- }
461
-
462
-
463
- draw3D(): void {
464
-
465
- if (this._freed) {
466
- console.warn("Plugin is freed, cannot draw");
467
- return;
468
- }
469
- if (this.globe === null || this.lineProgram === null || this._vao === null) {
470
- console.warn("Globe or LineProgram or VAO is not initialized, cannot draw");
471
- return;
472
- }
473
-
474
- this._frameCounterTrigger?.trigger();
475
- // this.__build();
476
-
477
- const gl = this.globe.gl as WebGL2RenderingContext;
478
- const drawOptions: DrawRangeIndexParams = {
479
- drawRange: {
480
- first: 0,
481
- count: this.bufferOrchestrator.length * (360 * 3), // plus 1 is for cutting linestrips
482
- },
483
- }
484
- gl.disable(gl.DEPTH_TEST);
485
-
486
- this.lineProgram.draw(
487
- this._vao,
488
- drawOptions,
489
- this._userOpacity * this._adaptiveOpacityMultiplier,
490
- this._uboHandler
491
- );
492
- gl.enable(gl.DEPTH_TEST);
493
-
494
- }
495
-
496
-
497
- free(): void {
498
- if (this._freed) {
499
- console.warn("Plugin is already freed");
500
- return;
501
- }
502
- if (!this.globe || !this.lineProgram) {
503
- console.warn("Globe or LineProgram is not initialized, cannot free the plugin");
504
- return;
505
- }
506
- this._freed = true;
507
- this._frameCounterTrigger?.free();
508
- LineStripProgramCache.release(this.lineProgram);
509
- this.lineProgram = null;
510
- this._uboHandler?.free();
511
- this._uboHandler = null;
512
- this.globe.gl.deleteVertexArray(this._vao);
513
- this.globe = null;
514
- this._vao = null;
515
- this.bufferManagerMap.forEach((bufferManager) => {
516
- bufferManager.bufferManager.free();
517
- });
518
- this._float32Array = null;
519
- }
520
-
521
-
522
-
523
-
524
-
525
-
526
- _buildPaddings(level: "input" | "innerCircle" | "elevation" | "geometry", subSetIDs: string[] | null = null) {
527
-
528
- if (level === "input") {
529
- this.__inner(subSetIDs);
530
- this.__elevation(subSetIDs);
531
- } else if (level === "innerCircle") {
532
- // Build inner circle paddings
533
- if (this._options.adativePaddingSize) {
534
- this.__innerCircle(subSetIDs);
535
- }
536
- this.__elevation(subSetIDs);
537
- } else if (level === "elevation") {
538
- // Build elevation paddings
539
- this.__elevation(subSetIDs);
540
- }
541
- }
542
-
543
- __inner(subSetIDs: string[] | null = null) {
544
- // Implement inner circle padding logic
545
-
546
- const datas = this._dataMap;
547
-
548
- let keys;
549
- if (subSetIDs) {
550
- keys = subSetIDs;
551
- } else {
552
- keys = Array.from(datas.keys());
553
- }
554
- for (const key of keys) {
555
- const value = datas.get(key);
556
- if (!value) continue;
557
-
558
- // Implement inner circle padding logic using key and value
559
- const { innerCoords, outerCoords } = preAdapter(
560
- this.globe!,
561
- value,
562
- this._innerPaddingRatio,
563
- null
564
- )
565
- value.outerCoords = outerCoords;
566
- value.innerCoords = innerCoords;
567
- }
568
- }
569
-
570
- __innerCircle(subSetIDs: string[] | null = null) {
571
- // Implement inner circle padding logic
572
-
573
- const datas = this._dataMap;
574
-
575
- let keys;
576
- if (subSetIDs) {
577
- keys = subSetIDs;
578
- } else {
579
- keys = Array.from(datas.keys());
580
- }
581
- for (const key of keys) {
582
- const value = datas.get(key);
583
- if (!value) continue;
584
-
585
- // Implement inner circle padding logic using key and value
586
- const { innerCoords } = preAdapter(
587
- this.globe!,
588
- value,
589
- this._innerPaddingRatio,
590
- value.outerCoords
591
- )
592
- value.innerCoords = innerCoords;
593
- }
594
- }
595
-
596
-
597
- __elevation(subSetIDs: string[] | null = null) {
598
- this.__updateAdaptiveOpacityMultiplier();
599
- const bufferToUpdate = [this.globe?.api_GetCurrentGeometry() === 1 ? "position2d" : "position3d"];
600
- const datas = this._dataMap;
601
- const wrapper: [InnerPadding1DegreeInput] = [null!];
602
- this._float32Array = new Float32Array(360 * 4 * 4); // largest float32Array
603
-
604
- let keys;
605
- if (subSetIDs) {
606
- keys = subSetIDs;
607
- } else {
608
- keys = Array.from(datas.keys());
609
- }
610
-
611
- for (const key of keys) {
612
- const value = datas.get(key);
613
- if (!value) continue;
614
- wrapper[0] = value
615
- this.bufferOrchestrator.updateBulk(
616
- wrapper,
617
- this.bufferManagerMap,
618
- bufferToUpdate
619
- );
620
- }
621
- this._float32Array = null; // reset the float32Array
622
- }
623
-
624
-
625
-
626
- __build(globeChanges: GlobeChanges) {
627
- if (globeChanges.lod) {
628
- this.__updateLODRelatedParameters();
629
- this._buildPaddings("innerCircle");
630
- } else if (globeChanges.look || globeChanges.geometry) {
631
- this._buildPaddings("elevation");
632
- }
633
-
634
- }
635
- __updateLODRelatedParameters(): void {
636
- const lod = this.globe?.api_GetCurrentLODWithDecimal() as number;
637
- this._innerPaddingRatio = 1 - Math.pow(0.7, lod);
638
- }
639
-
640
- __updateAdaptiveOpacityMultiplier() {
641
- if (this._options.adaptiveOpacity === true) {
642
- const currentLod = this.globe?.api_GetCurrentLODWithDecimal() as number;
643
- this._adaptiveOpacityMultiplier = Math.max(1 - (2.9 / currentLod), 0.1)
644
- } else {
645
- this._adaptiveOpacityMultiplier = 1; // TODO: set this once on adaptiveOpacity is Set to false
646
- }
647
- }
648
-
649
- }
650
-
651
-
652
-
653
- function preAdapter<T extends LongLatDegree | null>(
654
- globe: Globe,
655
- paddingInput: Padding1DegreeInput,
656
- paddingRatio: number,
657
- outerCoords: T[] | null,
658
- ): { outerCoords: T[], innerCoords: T[] } {
659
-
660
- const innerCoords: T[] = new Array<T>(360);
661
-
662
- if (outerCoords === null) {
663
- outerCoords = new Array<T>(360);
664
-
665
- for (let i = 0; i < 360; i++) {
666
- const { long, lat } = globe.Math.FindPointByPolar(
667
- paddingInput.center[0], // center long
668
- paddingInput.center[1], // center lat
669
- paddingInput.radius, // outer radius
670
- i, // angle
671
- );
672
-
673
- const { long: endLong, lat: endLat } = globe.Math.FindPointByPolar(
674
- paddingInput.center[0], // center long
675
- paddingInput.center[1], // center lat
676
- paddingInput.radius * paddingRatio, // inner radius
677
- i, // angle
678
- );
679
-
680
- const longDifference = Math.abs(long - endLong);
681
- // const latDifference = Math.abs(lat - endLat);
682
-
683
- if (longDifference > 45) {
684
- outerCoords[i] = null as T;
685
- innerCoords[i] = null as T;
686
- continue;
687
- }
688
-
689
- // Assign the calculated coordinates
690
- outerCoords[i] = [long, lat] as T;
691
- innerCoords[i] = [endLong, endLat] as T;
692
- }
693
- } else {
694
- // Handle case when outerCoords is provided
695
- for (let i = 0; i < 360; i++) {
696
- if (outerCoords[i] === null) {
697
- innerCoords[i] = null as T;
698
- continue;
699
- }
700
-
701
- const { long: endLong, lat: endLat } = globe.Math.FindPointByPolar(
702
- paddingInput.center[0],
703
- paddingInput.center[1],
704
- paddingInput.radius * paddingRatio,
705
- i
706
- );
707
-
708
- innerCoords[i] = [endLong, endLat] as T;
709
- }
710
- }
711
-
712
- return { outerCoords, innerCoords };
713
- }
1
+ // One Degree Padding
2
+ /**
3
+ * 2d coordinates are loaded ones
4
+ * 3d coordinates are calculated on the fly.
5
+ *
6
+ * 2d paddings are fixed size
7
+ * 3d paddings gets shortened as lod increases
8
+ *
9
+ * color buffer is shared and does not change on unless insert or delete
10
+ * changing color can be done by re inserting
11
+ *
12
+ *
13
+ *
14
+ */
15
+ import { BufferManager } from '../../util/account/single-attribute-buffer-management/buffer-manager';
16
+ import { BufferOrchestrator } from '../../util/account/single-attribute-buffer-management/buffer-orchestrator';
17
+ import { LineStripProgramCache } from '../../programs/line-on-globe/linestrip/linestrip';
18
+ import { opacityCheck, colorCheck } from '../../util/check/typecheck';
19
+ import { FrameCounterTrigger } from '../../util/frame-counter-trigger';
20
+ const initialCapacity = 2; // initial capacity for the buffer managers
21
+ // const _float32Array = new Float32Array(360 * 3 * 2).fill(NaN);
22
+ export class Padding1DegreePlugin {
23
+ id;
24
+ globe = null;
25
+ bufferOrchestrator;
26
+ bufferManagerMap;
27
+ lineProgram = null;
28
+ _innerPaddingRatio = 0.95; //
29
+ _float32Array = null; // this is used to forward the data to the buffer manager
30
+ _uboHandler = null; // this is used to forward the data to the shader program
31
+ _bufferNames = ["position2d", "position3d"];
32
+ _vao = null; // this is used to store the VAO for the plugin
33
+ _freed = false; // this is used to check if the plugin is freed or not
34
+ _userOpacity = 1;
35
+ _adaptiveOpacityMultiplier = 1;
36
+ _dataMap = new Map();
37
+ _options = {
38
+ bufferType: "STATIC_DRAW",
39
+ variativeColorsOn: false,
40
+ defaultColor: [1, 1, 1, 1], // white color
41
+ defaultHeightFromGroundIn3D: 0.1, // 10 cm from ground
42
+ adativePaddingSize: true, // if true, the padding size will be adaptive to the LOD
43
+ adaptiveOpacity: true, // if true, the opacity will be adaptive to the LOD
44
+ isMSL: false // if true, no elevation of terrain
45
+ };
46
+ _frameCounterTrigger = null;
47
+ constructor(id, options = null) {
48
+ this.id = id;
49
+ this.bufferManagerMap = new Map();
50
+ this.lineProgram = null;
51
+ this._options = options ? { ...this._options, ...options } : this._options;
52
+ this.bufferOrchestrator = new BufferOrchestrator();
53
+ if (this._options.variativeColorsOn) {
54
+ this._bufferNames.push("color");
55
+ }
56
+ }
57
+ increaseSpace(amount) {
58
+ if (this._freed) {
59
+ console.warn("Plugin is freed, cannot increase space");
60
+ return;
61
+ }
62
+ if (this.globe === null) {
63
+ console.warn("Globe is not initialized.");
64
+ return;
65
+ }
66
+ if (typeof amount !== "number" || amount <= 0) {
67
+ console.warn("Invalid amount, must be a positive number");
68
+ return;
69
+ }
70
+ this.bufferOrchestrator.ensureSpace(amount, this.bufferManagerMap);
71
+ }
72
+ insertBulk(inputs) {
73
+ if (this.globe === null) {
74
+ console.warn("Globe is not initialized, cannot insert input");
75
+ return;
76
+ }
77
+ if (this._freed) {
78
+ console.warn("Plugin is freed, cannot insert input");
79
+ return;
80
+ }
81
+ const wrapper = [null];
82
+ this._float32Array = new Float32Array(360 * 4 * 4); // largest float32Array
83
+ let newItemCount = 0;
84
+ for (let i = 0; i < inputs.length; i++) {
85
+ if (!this._dataMap.has(inputs[i].key)) {
86
+ newItemCount++;
87
+ }
88
+ }
89
+ this.bufferOrchestrator.ensureSpace(newItemCount, this.bufferManagerMap);
90
+ for (let i = 0; i < inputs.length; i++) {
91
+ const coords = preAdapter(this.globe, inputs[i], this._innerPaddingRatio, null);
92
+ const paddingInput = { ...inputs[i], ...coords };
93
+ this._dataMap.set(paddingInput.key, paddingInput);
94
+ wrapper[0] = paddingInput;
95
+ this.bufferOrchestrator.insertBulk(wrapper, this.bufferManagerMap, this._bufferNames);
96
+ }
97
+ this._float32Array = null;
98
+ this.globe?.DrawRender();
99
+ }
100
+ updateColorRatios(key, colorRatios, drawRender = true) {
101
+ if (this._freed) {
102
+ console.warn("Plugin is freed, cannot update color");
103
+ return;
104
+ }
105
+ if (this.globe === null) {
106
+ console.warn("Globe is not initialized, cannot update color");
107
+ return;
108
+ }
109
+ if (!this._options.variativeColorsOn) {
110
+ console.warn("VariativeColors are not enabled");
111
+ return;
112
+ }
113
+ if (!this._dataMap.has(key)) {
114
+ console.warn(`Key ${key} does not exist in the data map`);
115
+ return;
116
+ }
117
+ const paddingInput = this._dataMap.get(key);
118
+ if (!paddingInput) {
119
+ console.warn(`Padding input for key ${key} is not found`);
120
+ return;
121
+ }
122
+ this._float32Array = new Float32Array(360 * 4 * 4); // largest float32Array
123
+ paddingInput.colorsRatios = colorRatios;
124
+ this.bufferOrchestrator.updateBulk([paddingInput], this.bufferManagerMap, ["color"]);
125
+ this._float32Array = null;
126
+ if (drawRender) {
127
+ this.globe.DrawRender();
128
+ }
129
+ }
130
+ updateCoordinates(items) {
131
+ if (this._freed) {
132
+ console.warn("Plugin is freed, cannot update coordinates");
133
+ return;
134
+ }
135
+ if (this.globe === null) {
136
+ console.warn("Globe is not initialized, cannot update coordinates");
137
+ return;
138
+ }
139
+ this._float32Array = new Float32Array(360 * 4 * 4); // largest float32Array
140
+ const updateKeys = [];
141
+ for (const item of items) {
142
+ const paddingInput = this._dataMap.get(item.key);
143
+ if (!paddingInput) {
144
+ console.warn(`Padding input for key ${item.key} is not found`);
145
+ continue;
146
+ }
147
+ paddingInput.center = item.center;
148
+ paddingInput.radius = item.radius;
149
+ updateKeys.push(item.key);
150
+ }
151
+ this._buildPaddings("input", updateKeys);
152
+ this._float32Array = null;
153
+ this.globe.DrawRender();
154
+ }
155
+ deleteBulk(keys) {
156
+ if (this.globe === null) {
157
+ console.warn("Globe is not initialized, cannot delete data");
158
+ return;
159
+ }
160
+ if (this._freed) {
161
+ console.warn("Plugin is freed, cannot delete data");
162
+ return;
163
+ }
164
+ this.bufferOrchestrator.deleteBulk(keys, this.bufferManagerMap);
165
+ for (const key of keys) {
166
+ this._dataMap.delete(key);
167
+ }
168
+ this.globe?.DrawRender();
169
+ }
170
+ setPluginOpacity(opacity, drawRender = false) {
171
+ if (this._freed) {
172
+ console.warn("Plugin is freed, cannot set opacity");
173
+ return;
174
+ }
175
+ if (this.globe === null) {
176
+ console.warn("Globe is not initialized, cannot set opacity");
177
+ return;
178
+ }
179
+ opacityCheck(opacity);
180
+ this._userOpacity = opacity;
181
+ if (drawRender) {
182
+ this.globe.DrawRender();
183
+ }
184
+ }
185
+ setDefaultColor(color) {
186
+ if (this._freed) {
187
+ console.warn("Plugin is freed, cannot set default color");
188
+ return;
189
+ }
190
+ if (this.globe === null) {
191
+ console.warn("Globe is not initialized, cannot set default color");
192
+ return;
193
+ }
194
+ colorCheck(color);
195
+ this._options.defaultColor = color;
196
+ this._uboHandler?.updateSingle("u_color", new Float32Array(color));
197
+ this.globe.DrawRender();
198
+ }
199
+ setElevationMode(mode) {
200
+ switch (mode) {
201
+ case "msl":
202
+ this._options.isMSL = true;
203
+ break;
204
+ case "agl":
205
+ this._options.isMSL = false;
206
+ break;
207
+ default:
208
+ throw new Error(`Unknown elevation mode: ${mode}`);
209
+ }
210
+ this._buildPaddings("elevation");
211
+ this.globe?.DrawRender();
212
+ }
213
+ init(globe, gl) {
214
+ this.globe = globe;
215
+ this.lineProgram = LineStripProgramCache.get(globe);
216
+ this._frameCounterTrigger = new FrameCounterTrigger(globe, 10, 1000, (globeChanges) => {
217
+ if (this._freed)
218
+ return;
219
+ this.__build(globeChanges);
220
+ globe.DrawRender();
221
+ });
222
+ this.__updateLODRelatedParameters();
223
+ this.__updateAdaptiveOpacityMultiplier();
224
+ const bufferManagerMap = new Map([
225
+ ["position2d", {
226
+ bufferManager: new BufferManager(globe.gl, 360 * 2 * 3, // plus 1 to cut
227
+ { bufferType: this._options.bufferType, initialCapacity: initialCapacity }),
228
+ adaptor: (paddingInput) => {
229
+ if (this._float32Array === null) {
230
+ throw new Error("Float32Array is not initialized");
231
+ }
232
+ else {
233
+ this._float32Array.fill(NaN); // reset the float32Array
234
+ }
235
+ for (let i = 0; i < 360; i++) {
236
+ const outerCoords = paddingInput.outerCoords[i];
237
+ const innerCoords = paddingInput.innerCoords[i];
238
+ if (outerCoords === null || innerCoords === null) {
239
+ continue;
240
+ }
241
+ let coordsOuter = globe.api_GetMercator2DPoint(outerCoords[0], outerCoords[1]);
242
+ // fill the second coordinate with 0
243
+ this._float32Array[i * 6] = coordsOuter[0];
244
+ this._float32Array[i * 6 + 1] = coordsOuter[1];
245
+ let coordsInner = globe.api_GetMercator2DPoint(innerCoords[0], innerCoords[1]);
246
+ // fill the second coordinate with 0
247
+ this._float32Array[i * 6 + 2] = coordsInner[0];
248
+ this._float32Array[i * 6 + 3] = coordsInner[1];
249
+ }
250
+ return this._float32Array.subarray(0, 360 * 2 * 3);
251
+ }
252
+ }
253
+ ],
254
+ [
255
+ "position3d", {
256
+ bufferManager: new BufferManager(globe.gl, 360 * 3 * 3, // plus 1 to cut
257
+ { bufferType: this._options.bufferType, initialCapacity: initialCapacity }),
258
+ adaptor: (paddingInput) => {
259
+ if (this._float32Array === null) {
260
+ throw new Error("Float32Array is not initialized");
261
+ }
262
+ else {
263
+ this._float32Array.fill(NaN); // reset the float32Array
264
+ }
265
+ const _float32Array = this._float32Array;
266
+ for (let i = 0; i < 360; i++) {
267
+ const outerCoords = paddingInput.outerCoords[i];
268
+ const innerCoords = paddingInput.innerCoords[i];
269
+ if (outerCoords === null || innerCoords === null) {
270
+ continue;
271
+ }
272
+ const height = paddingInput.heightFromGroundIn3D ?? this._options.defaultHeightFromGroundIn3D;
273
+ let coords = globe.api_GetCartesian3DPoint(outerCoords[0], outerCoords[1], height, this._options.isMSL);
274
+ // fill the second coordinate with 0
275
+ _float32Array[i * 9] = coords[0];
276
+ _float32Array[i * 9 + 1] = coords[1];
277
+ _float32Array[i * 9 + 2] = coords[2];
278
+ let coordsInner = globe.api_GetCartesian3DPoint(innerCoords[0], innerCoords[1], height, this._options.isMSL);
279
+ // fill the second coordinate with 0
280
+ _float32Array[i * 9 + 3] = coordsInner[0];
281
+ _float32Array[i * 9 + 4] = coordsInner[1];
282
+ _float32Array[i * 9 + 5] = coordsInner[2];
283
+ }
284
+ return _float32Array.subarray(0, 360 * 3 * 3);
285
+ }
286
+ }
287
+ ],
288
+ ]);
289
+ if (this._options.variativeColorsOn) {
290
+ bufferManagerMap.set("color", {
291
+ bufferManager: new BufferManager(globe.gl, 360 * 4 * 3, // 4 for RGBA
292
+ { bufferType: this._options.bufferType, initialCapacity: initialCapacity }),
293
+ adaptor: (paddingInput) => {
294
+ if (this._float32Array === null) {
295
+ throw new Error("Float32Array is not initialized");
296
+ }
297
+ else {
298
+ this._float32Array.fill(NaN); // reset the float32Array
299
+ }
300
+ if (!paddingInput.colorsRatios) {
301
+ const color = this._options.defaultColor;
302
+ const colorArray = new Float32Array(360 * 4 * 3);
303
+ this._float32Array = colorArray; // store for forwarding
304
+ for (let i = 0; i < 360; i++) {
305
+ this._float32Array[i * 12] = color[0];
306
+ this._float32Array[i * 12 + 1] = color[1];
307
+ this._float32Array[i * 12 + 2] = color[2];
308
+ this._float32Array[i * 12 + 3] = color[3];
309
+ this._float32Array[i * 12 + 4] = color[0];
310
+ this._float32Array[i * 12 + 5] = color[1];
311
+ this._float32Array[i * 12 + 6] = color[2];
312
+ this._float32Array[i * 12 + 7] = 0; //color[3] ;
313
+ }
314
+ return this._float32Array.subarray(0, 360 * 4 * 3);
315
+ }
316
+ else {
317
+ const colorsRatios = paddingInput.colorsRatios;
318
+ let i = 0;
319
+ for (const colorRatio of colorsRatios) {
320
+ const color = colorRatio.color;
321
+ const ratio = colorRatio.ratio;
322
+ for (let j = 0; j < ratio; j++) {
323
+ this._float32Array[i * 12] = color[0];
324
+ this._float32Array[i * 12 + 1] = color[1];
325
+ this._float32Array[i * 12 + 2] = color[2];
326
+ this._float32Array[i * 12 + 3] = color[3];
327
+ this._float32Array[i * 12 + 4] = color[0];
328
+ this._float32Array[i * 12 + 5] = color[1];
329
+ this._float32Array[i * 12 + 6] = color[2];
330
+ this._float32Array[i * 12 + 7] = 0.1; // color[3];
331
+ i++;
332
+ }
333
+ }
334
+ return this._float32Array.subarray(0, 360 * 4 * 3);
335
+ }
336
+ }
337
+ });
338
+ }
339
+ const vaoInput = ["position3d", "position2d", "color"].map((name) => {
340
+ const bufferManager = bufferManagerMap.get(name);
341
+ if (!bufferManager) {
342
+ return null;
343
+ }
344
+ return {
345
+ buffer: bufferManager.bufferManager.buffer,
346
+ stride: 0,
347
+ offset: 0
348
+ };
349
+ });
350
+ this._vao = this.lineProgram.createVAO(vaoInput[0], vaoInput[1], vaoInput[2]);
351
+ this.bufferManagerMap = bufferManagerMap;
352
+ this.bufferOrchestrator.resetWithCapacity(bufferManagerMap, initialCapacity);
353
+ this._uboHandler = this.lineProgram.createUBO("STATIC_DRAW");
354
+ this._uboHandler.updateSingle("u_color", new Float32Array(this._options.defaultColor));
355
+ }
356
+ draw3D() {
357
+ if (this._freed) {
358
+ console.warn("Plugin is freed, cannot draw");
359
+ return;
360
+ }
361
+ if (this.globe === null || this.lineProgram === null || this._vao === null) {
362
+ console.warn("Globe or LineProgram or VAO is not initialized, cannot draw");
363
+ return;
364
+ }
365
+ this._frameCounterTrigger?.trigger();
366
+ // this.__build();
367
+ const gl = this.globe.gl;
368
+ const drawOptions = {
369
+ drawRange: {
370
+ first: 0,
371
+ count: this.bufferOrchestrator.length * (360 * 3), // plus 1 is for cutting linestrips
372
+ },
373
+ };
374
+ gl.disable(gl.DEPTH_TEST);
375
+ this.lineProgram.draw(this._vao, drawOptions, this._userOpacity * this._adaptiveOpacityMultiplier, this._uboHandler);
376
+ gl.enable(gl.DEPTH_TEST);
377
+ }
378
+ free() {
379
+ if (this._freed) {
380
+ console.warn("Plugin is already freed");
381
+ return;
382
+ }
383
+ if (!this.globe || !this.lineProgram) {
384
+ console.warn("Globe or LineProgram is not initialized, cannot free the plugin");
385
+ return;
386
+ }
387
+ this._freed = true;
388
+ this._frameCounterTrigger?.free();
389
+ LineStripProgramCache.release(this.lineProgram);
390
+ this.lineProgram = null;
391
+ this._uboHandler?.free();
392
+ this._uboHandler = null;
393
+ this.globe.gl.deleteVertexArray(this._vao);
394
+ this.globe = null;
395
+ this._vao = null;
396
+ this.bufferManagerMap.forEach((bufferManager) => {
397
+ bufferManager.bufferManager.free();
398
+ });
399
+ this._float32Array = null;
400
+ }
401
+ _buildPaddings(level, subSetIDs = null) {
402
+ if (level === "input") {
403
+ this.__inner(subSetIDs);
404
+ this.__elevation(subSetIDs);
405
+ }
406
+ else if (level === "innerCircle") {
407
+ // Build inner circle paddings
408
+ if (this._options.adativePaddingSize) {
409
+ this.__innerCircle(subSetIDs);
410
+ }
411
+ this.__elevation(subSetIDs);
412
+ }
413
+ else if (level === "elevation") {
414
+ // Build elevation paddings
415
+ this.__elevation(subSetIDs);
416
+ }
417
+ }
418
+ __inner(subSetIDs = null) {
419
+ // Implement inner circle padding logic
420
+ const datas = this._dataMap;
421
+ let keys;
422
+ if (subSetIDs) {
423
+ keys = subSetIDs;
424
+ }
425
+ else {
426
+ keys = Array.from(datas.keys());
427
+ }
428
+ for (const key of keys) {
429
+ const value = datas.get(key);
430
+ if (!value)
431
+ continue;
432
+ // Implement inner circle padding logic using key and value
433
+ const { innerCoords, outerCoords } = preAdapter(this.globe, value, this._innerPaddingRatio, null);
434
+ value.outerCoords = outerCoords;
435
+ value.innerCoords = innerCoords;
436
+ }
437
+ }
438
+ __innerCircle(subSetIDs = null) {
439
+ // Implement inner circle padding logic
440
+ const datas = this._dataMap;
441
+ let keys;
442
+ if (subSetIDs) {
443
+ keys = subSetIDs;
444
+ }
445
+ else {
446
+ keys = Array.from(datas.keys());
447
+ }
448
+ for (const key of keys) {
449
+ const value = datas.get(key);
450
+ if (!value)
451
+ continue;
452
+ // Implement inner circle padding logic using key and value
453
+ const { innerCoords } = preAdapter(this.globe, value, this._innerPaddingRatio, value.outerCoords);
454
+ value.innerCoords = innerCoords;
455
+ }
456
+ }
457
+ __elevation(subSetIDs = null) {
458
+ this.__updateAdaptiveOpacityMultiplier();
459
+ const bufferToUpdate = [this.globe?.api_GetCurrentGeometry() === 1 ? "position2d" : "position3d"];
460
+ const datas = this._dataMap;
461
+ const wrapper = [null];
462
+ this._float32Array = new Float32Array(360 * 4 * 4); // largest float32Array
463
+ let keys;
464
+ if (subSetIDs) {
465
+ keys = subSetIDs;
466
+ }
467
+ else {
468
+ keys = Array.from(datas.keys());
469
+ }
470
+ for (const key of keys) {
471
+ const value = datas.get(key);
472
+ if (!value)
473
+ continue;
474
+ wrapper[0] = value;
475
+ this.bufferOrchestrator.updateBulk(wrapper, this.bufferManagerMap, bufferToUpdate);
476
+ }
477
+ this._float32Array = null; // reset the float32Array
478
+ }
479
+ __build(globeChanges) {
480
+ if (globeChanges.lod) {
481
+ this.__updateLODRelatedParameters();
482
+ this._buildPaddings("innerCircle");
483
+ }
484
+ else if (globeChanges.look || globeChanges.geometry) {
485
+ this._buildPaddings("elevation");
486
+ }
487
+ }
488
+ __updateLODRelatedParameters() {
489
+ const lod = this.globe?.api_GetCurrentLODWithDecimal();
490
+ this._innerPaddingRatio = 1 - Math.pow(0.7, lod);
491
+ }
492
+ __updateAdaptiveOpacityMultiplier() {
493
+ if (this._options.adaptiveOpacity === true) {
494
+ const currentLod = this.globe?.api_GetCurrentLODWithDecimal();
495
+ this._adaptiveOpacityMultiplier = Math.max(1 - (2.9 / currentLod), 0.1);
496
+ }
497
+ else {
498
+ this._adaptiveOpacityMultiplier = 1; // TODO: set this once on adaptiveOpacity is Set to false
499
+ }
500
+ }
501
+ }
502
+ function preAdapter(globe, paddingInput, paddingRatio, outerCoords) {
503
+ const innerCoords = new Array(360);
504
+ if (outerCoords === null) {
505
+ outerCoords = new Array(360);
506
+ for (let i = 0; i < 360; i++) {
507
+ const { long, lat } = globe.Math.FindPointByPolar(paddingInput.center[0], // center long
508
+ paddingInput.center[1], // center lat
509
+ paddingInput.radius, // outer radius
510
+ i);
511
+ const { long: endLong, lat: endLat } = globe.Math.FindPointByPolar(paddingInput.center[0], // center long
512
+ paddingInput.center[1], // center lat
513
+ paddingInput.radius * paddingRatio, // inner radius
514
+ i);
515
+ const longDifference = Math.abs(long - endLong);
516
+ // const latDifference = Math.abs(lat - endLat);
517
+ if (longDifference > 45) {
518
+ outerCoords[i] = null;
519
+ innerCoords[i] = null;
520
+ continue;
521
+ }
522
+ // Assign the calculated coordinates
523
+ outerCoords[i] = [long, lat];
524
+ innerCoords[i] = [endLong, endLat];
525
+ }
526
+ }
527
+ else {
528
+ // Handle case when outerCoords is provided
529
+ for (let i = 0; i < 360; i++) {
530
+ if (outerCoords[i] === null) {
531
+ innerCoords[i] = null;
532
+ continue;
533
+ }
534
+ const { long: endLong, lat: endLat } = globe.Math.FindPointByPolar(paddingInput.center[0], paddingInput.center[1], paddingInput.radius * paddingRatio, i);
535
+ innerCoords[i] = [endLong, endLat];
536
+ }
537
+ }
538
+ return { outerCoords, innerCoords };
539
+ }