@pirireis/webglobeplugins 1.0.2 → 1.0.3
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.
- package/Math/{angle-calculation.ts → angle-calculation.js} +14 -18
- package/Math/{arc-cdf-points.ts → arc-cdf-points.js} +272 -329
- package/Math/{arc-generate-points-exponantial.ts → arc-generate-points-exponantial.js} +254 -299
- package/Math/{arc.ts → arc.js} +292 -421
- package/Math/bounds/line-bbox.js +186 -225
- package/Math/{circle-cdf-points.ts → circle-cdf-points.js} +78 -143
- package/Math/{circle.ts → circle.js} +33 -49
- package/Math/{constants.ts → constants.js} +4 -12
- package/Math/contour/{quadtreecontours.ts → quadtreecontours.js} +300 -371
- package/Math/contour/quadtreecontours1.js +298 -336
- package/Math/{finite-line-2d.ts → finite-line-2d.js} +58 -68
- package/Math/{haversine.ts → haversine.js} +22 -33
- package/Math/index.js +1 -0
- package/Math/juction/{arc-plane.ts → arc-plane.js} +143 -203
- package/Math/juction/{line-sphere.ts → line-sphere.js} +22 -32
- package/Math/juction/{plane-plane.ts → plane-plane.js} +53 -62
- package/Math/{line.ts → line.js} +52 -84
- package/Math/matrix4.js +1 -0
- package/Math/{methods.ts → methods.js} +126 -182
- package/Math/{plane.ts → plane.js} +56 -92
- package/Math/{quaternion.ts → quaternion.js} +106 -128
- package/Math/templete-shapes/{grid-visually-equal.ts → grid-visually-equal.js} +65 -118
- package/Math/tessellation/constants.js +1 -0
- package/Math/tessellation/{methods.ts → methods.js} +49 -79
- package/Math/tessellation/{nearest-value-padding.ts → nearest-value-padding.js} +112 -147
- package/Math/tessellation/{spherical-triangle-area.ts → spherical-triangle-area.js} +99 -127
- package/Math/tessellation/{tile-merger.ts → tile-merger.js} +429 -578
- package/Math/tessellation/{triangle-tessellation.ts → triangle-tessellation.js} +386 -533
- package/Math/tessellation/types.js +1 -0
- package/Math/types.js +1 -0
- package/Math/utils.js +2 -3
- package/Math/{vec3.ts → vec3.js} +155 -227
- package/Math/{xyz-tile.ts → xyz-tile.js} +18 -26
- package/algorithms/search-binary.js +16 -14
- package/altitude-locator/adaptors.js +1 -0
- package/altitude-locator/keymethod.js +1 -0
- package/altitude-locator/plugin.js +344 -445
- package/altitude-locator/types.js +21 -26
- package/compass-rose/compass-rose-padding-flat.js +230 -274
- package/compass-rose/{compass-text-writer.ts → compass-text-writer.js} +155 -210
- package/compass-rose/index.js +3 -3
- package/{constants.ts → constants.js} +6 -8
- package/heatwave/datamanager.js +149 -168
- package/heatwave/heatwave.js +206 -261
- package/heatwave/index.js +5 -5
- package/heatwave/isobar.js +303 -340
- package/heatwave/{texture-point-sampler.ts → texture-point-sampler.js} +187 -220
- package/investigation-tools/draw/tiles/adapters.js +67 -0
- package/investigation-tools/draw/tiles/{tiles.ts → tiles.js} +128 -162
- package/jest.config.js +7 -6
- package/package.json +1 -1
- package/pin/pin-object-array1.js +300 -381
- package/pin/pin-point-totem1.js +60 -77
- package/programs/arrowfield/arrow-field.js +60 -89
- package/programs/arrowfield/logic.js +141 -173
- package/programs/data2legend/density-to-legend.js +68 -86
- package/programs/data2legend/point-to-density-texture.js +67 -84
- package/programs/float2legendwithratio/index.js +2 -3
- package/programs/float2legendwithratio/logic.js +118 -144
- package/programs/float2legendwithratio/object.js +104 -141
- package/programs/helpers/blender.js +58 -73
- package/programs/helpers/{fadeaway.ts → fadeaway.js} +60 -73
- package/programs/index.js +20 -19
- package/programs/line-on-globe/circle-accurate-3d.js +85 -112
- package/programs/line-on-globe/circle-accurate-flat.js +148 -200
- package/programs/line-on-globe/degree-padding-around-circle-3d.js +102 -134
- package/programs/line-on-globe/index.js +1 -0
- package/programs/line-on-globe/lines-color-instanced-flat.js +80 -99
- package/programs/line-on-globe/linestrip/data.js +4 -0
- package/programs/line-on-globe/linestrip/{linestrip.ts → linestrip.js} +93 -152
- package/programs/line-on-globe/{naive-accurate-flexible.ts → naive-accurate-flexible.js} +126 -175
- package/programs/line-on-globe/util.js +5 -8
- package/programs/picking/pickable-polygon-renderer.js +98 -129
- package/programs/picking/pickable-renderer.js +98 -130
- package/programs/point-on-globe/element-globe-surface-glow.js +93 -122
- package/programs/point-on-globe/element-point-glow.js +80 -114
- package/programs/point-on-globe/square-pixel-point.js +121 -139
- package/programs/polygon-on-globe/{texture-dem-triangles.ts → texture-dem-triangles.js} +163 -207
- package/programs/{programcache.ts → programcache.js} +126 -134
- package/programs/rings/index.js +1 -1
- package/programs/rings/partial-ring/{piece-of-pie.ts → piece-of-pie.js} +152 -222
- package/programs/totems/camera-totem-attactment-interface.js +1 -0
- package/programs/totems/{camerauniformblock.ts → camerauniformblock.js} +225 -310
- package/programs/totems/{canvas-webglobe-info.ts → canvas-webglobe-info.js} +132 -147
- package/programs/totems/{dem-textures-manager.ts → dem-textures-manager.js} +257 -360
- package/programs/totems/{globe-changes.ts → globe-changes.js} +59 -79
- package/programs/totems/gpu-selection-uniform-block.js +99 -127
- package/programs/totems/{index.ts → index.js} +2 -2
- package/programs/two-d/pixel-padding-for-compass.js +87 -101
- package/programs/util.js +14 -19
- package/programs/vectorfields/logics/{constants.ts → constants.js} +4 -5
- package/programs/vectorfields/logics/{drawrectangleparticles.ts → drawrectangleparticles.js} +80 -115
- package/programs/vectorfields/logics/index.js +2 -4
- package/programs/vectorfields/logics/particle-ubo.js +16 -0
- package/programs/vectorfields/logics/{pixelbased.ts → pixelbased.js} +86 -115
- package/programs/vectorfields/logics/ubo.js +51 -57
- package/programs/vectorfields/{pingpongbuffermanager.ts → pingpongbuffermanager.js} +99 -113
- package/range-tools-on-terrain/bearing-line/{adapters.ts → adapters.js} +114 -154
- package/range-tools-on-terrain/bearing-line/{plugin.ts → plugin.js} +457 -569
- package/range-tools-on-terrain/bearing-line/types.js +1 -0
- package/range-tools-on-terrain/circle-line-chain/{adapters.ts → adapters.js} +85 -104
- package/range-tools-on-terrain/circle-line-chain/{chain-list-map.ts → chain-list-map.js} +382 -446
- package/range-tools-on-terrain/circle-line-chain/{plugin.ts → plugin.js} +464 -607
- package/range-tools-on-terrain/circle-line-chain/types.js +1 -0
- package/range-tools-on-terrain/range-ring/{adapters.ts → adapters.js} +93 -114
- package/range-tools-on-terrain/range-ring/{enum.ts → enum.js} +2 -2
- package/range-tools-on-terrain/range-ring/{plugin.ts → plugin.js} +377 -444
- package/range-tools-on-terrain/range-ring/rangeringangletext.js +331 -0
- package/range-tools-on-terrain/range-ring/types.js +9 -0
- package/semiplugins/interface.js +1 -0
- package/semiplugins/lightweight/{line-plugin.ts → line-plugin.js} +221 -342
- package/semiplugins/lightweight/{piece-of-pie-plugin.ts → piece-of-pie-plugin.js} +200 -275
- package/semiplugins/shape-on-terrain/{arc-plugin.ts → arc-plugin.js} +481 -616
- package/semiplugins/shape-on-terrain/{circle-plugin.ts → circle-plugin.js} +444 -588
- package/semiplugins/shape-on-terrain/{padding-1-degree.ts → padding-1-degree.js} +539 -713
- package/semiplugins/shape-on-terrain/terrain-polygon/{adapters.ts → adapters.js} +55 -69
- package/semiplugins/shape-on-terrain/terrain-polygon/data/{cache.ts → cache.js} +102 -149
- package/semiplugins/shape-on-terrain/terrain-polygon/data/{index-polygon-map.ts → index-polygon-map.js} +45 -58
- package/semiplugins/shape-on-terrain/terrain-polygon/data/{manager.ts → manager.js} +4 -4
- package/semiplugins/shape-on-terrain/terrain-polygon/data/master-worker.js +177 -196
- package/semiplugins/shape-on-terrain/terrain-polygon/data/{polygon-to-triangles.ts → polygon-to-triangles.js} +100 -144
- package/semiplugins/shape-on-terrain/terrain-polygon/data/{random.ts → random.js} +121 -165
- package/semiplugins/shape-on-terrain/terrain-polygon/data/types.js +1 -0
- package/semiplugins/shape-on-terrain/terrain-polygon/data/{worker-contact.ts → worker-contact.js} +63 -81
- package/semiplugins/shape-on-terrain/terrain-polygon/data/worker.js +125 -146
- package/semiplugins/shape-on-terrain/terrain-polygon/{terrain-polygon.ts → terrain-polygon.js} +219 -265
- package/semiplugins/shape-on-terrain/terrain-polygon/types.js +8 -0
- package/semiplugins/shell/bbox-renderer/index.js +2 -0
- package/semiplugins/shell/bbox-renderer/{logic.ts → logic.js} +209 -273
- package/semiplugins/shell/bbox-renderer/object.js +75 -0
- package/semiplugins/type.js +1 -0
- package/semiplugins/utility/{container-plugin.ts → container-plugin.js} +94 -126
- package/semiplugins/utility/{object-pass-container-plugin.ts → object-pass-container-plugin.js} +80 -101
- package/shaders/fragment-toy/firework.js +1 -1
- package/shaders/fragment-toy/singularity.js +2 -5
- package/tracks/point-heat-map/adaptors/timetracksplugin-format-to-this.js +63 -78
- package/tracks/point-heat-map/index.js +1 -0
- package/tracks/point-heat-map/plugin-webworker.js +121 -148
- package/tracks/point-heat-map/point-to-heat-map-flow.js +121 -150
- package/tracks/point-tracks/key-methods.js +2 -3
- package/tracks/point-tracks/plugin.js +401 -487
- package/tracks/timetracks/adaptors-line-strip.js +65 -79
- package/tracks/timetracks/plugin-line-strip.js +240 -295
- package/tracks/timetracks/program-line-strip.js +411 -495
- package/tracks/timetracks/programpoint-line-strip.js +109 -137
- package/types.js +19 -0
- package/util/account/bufferoffsetmanager.js +176 -209
- package/util/account/create-buffermap-orchastration.js +39 -0
- package/util/account/index.js +3 -6
- package/util/account/single-attribute-buffer-management/{buffer-manager.ts → buffer-manager.js} +119 -151
- package/util/account/single-attribute-buffer-management/{buffer-orchestrator.ts → buffer-orchestrator.js} +212 -238
- package/util/account/single-attribute-buffer-management/{buffer-orchestrator1.ts → buffer-orchestrator1.js} +159 -184
- package/util/account/single-attribute-buffer-management/{index.ts → index.js} +4 -11
- package/util/account/single-attribute-buffer-management/{object-store.ts → object-store.js} +55 -76
- package/util/account/single-attribute-buffer-management/types.js +1 -0
- package/util/account/util.js +18 -22
- package/util/algorithms/index.js +1 -0
- package/util/algorithms/search-binary.js +25 -26
- package/util/build-strategy/{static-dynamic.ts → static-dynamic.js} +41 -50
- package/util/check/index.js +1 -0
- package/util/check/typecheck.js +66 -0
- package/util/{frame-counter-trigger.ts → frame-counter-trigger.js} +84 -99
- package/util/geometry/{index.ts → index.js} +121 -155
- package/util/gl-util/buffer/{attribute-loader.ts → attribute-loader.js} +62 -84
- package/util/gl-util/buffer/{index.ts → index.js} +3 -6
- package/util/gl-util/draw-options/{methods.ts → methods.js} +32 -47
- package/util/gl-util/uniform-block/{manager.ts → manager.js} +200 -232
- package/util/{globe-default-gl-states.ts → globe-default-gl-states.js} +4 -5
- package/util/{helper-methods.ts → helper-methods.js} +8 -9
- package/util/index.js +10 -9
- package/util/interpolation/index.js +1 -0
- package/util/interpolation/timetrack/index.js +2 -9
- package/util/interpolation/timetrack/timetrack-interpolator.js +79 -94
- package/util/interpolation/timetrack/web-worker.js +46 -51
- package/util/picking/{fence.ts → fence.js} +43 -47
- package/util/picking/{picker-displayer.ts → picker-displayer.js} +176 -226
- package/util/programs/draw-from-pixel-coords.js +164 -201
- package/util/programs/{draw-texture-on-canvas.ts → draw-texture-on-canvas.js} +69 -91
- package/util/programs/supersampletotextures.js +97 -130
- package/util/programs/texturetoglobe.js +128 -153
- package/util/shaderfunctions/{geometrytransformations.ts → geometrytransformations.js} +44 -106
- package/util/shaderfunctions/index.js +2 -2
- package/util/shaderfunctions/nodata.js +2 -4
- package/util/shaderfunctions/noisefunctions.js +7 -10
- package/util/{webglobjectbuilders.ts → webglobjectbuilders.js} +358 -446
- package/vectorfield/arrowfield/adaptor.js +11 -11
- package/vectorfield/arrowfield/index.js +3 -3
- package/vectorfield/arrowfield/plugin.js +83 -128
- package/vectorfield/waveparticles/adaptor.js +15 -16
- package/vectorfield/waveparticles/index.js +3 -3
- package/vectorfield/waveparticles/{plugin.ts → plugin.js} +415 -506
- package/vectorfield/wind/adapters/{image-to-fields.ts → image-to-fields.js} +61 -74
- package/vectorfield/wind/adapters/types.js +1 -0
- package/vectorfield/wind/{imagetovectorfieldandmagnitude.ts → imagetovectorfieldandmagnitude.js} +53 -78
- package/vectorfield/wind/index.js +5 -5
- package/vectorfield/wind/{plugin-persistant copy.ts → plugin-persistant copy.js } +364 -461
- package/vectorfield/wind/{plugin-persistant.ts → plugin-persistant.js} +375 -483
- package/vectorfield/wind/plugin.js +685 -883
- package/vectorfield/wind/vectorfieldimage.js +23 -27
- package/write-text/{context-text-bulk.ts → context-text-bulk.js} +200 -285
- package/write-text/context-text3.js +167 -0
- package/write-text/{context-text4.ts → context-text4.js} +146 -231
- package/write-text/context-textDELETE.js +94 -125
- package/write-text/objectarraylabels/{index.ts → index.js} +2 -2
- package/write-text/objectarraylabels/objectarraylabels.js +200 -247
- package/Math/matrix4.ts +0 -0
- package/Math/mesh/mapbox-delaunay.d.ts +0 -74
- package/Math/roadmap.md +0 -10
- package/Math/tessellation/constants.ts +0 -1
- package/Math/tessellation/roadmap.md +0 -48
- package/Math/tessellation/types.ts +0 -1
- package/Math/types.ts +0 -68
- package/investigation-tools/draw/tiles/adapters.ts +0 -133
- package/programs/line-on-globe/linestrip/data.ts +0 -29
- package/programs/polygon-on-globe/roadmap.md +0 -8
- package/programs/totems/camera-totem-attactment-interface.ts +0 -4
- package/programs/vectorfields/logics/particle-ubo.ts +0 -23
- package/publish.bat +0 -62
- package/range-tools-on-terrain/bearing-line/types.ts +0 -65
- package/range-tools-on-terrain/circle-line-chain/types.ts +0 -43
- package/range-tools-on-terrain/range-ring/rangeringangletext.ts +0 -396
- package/range-tools-on-terrain/range-ring/types.ts +0 -30
- package/semiplugins/interface.ts +0 -14
- package/semiplugins/shape-on-terrain/goal.md +0 -12
- package/semiplugins/shape-on-terrain/terrain-polygon/data/cache-shortcuts.md +0 -20
- package/semiplugins/shape-on-terrain/terrain-polygon/data/master-worker.ts +0 -209
- package/semiplugins/shape-on-terrain/terrain-polygon/data/readme.md +0 -5
- package/semiplugins/shape-on-terrain/terrain-polygon/data/types.ts +0 -37
- package/semiplugins/shape-on-terrain/terrain-polygon/notes.md +0 -90
- package/semiplugins/shape-on-terrain/terrain-polygon/types.ts +0 -69
- package/semiplugins/shell/bbox-renderer/index.ts +0 -2
- package/semiplugins/shell/bbox-renderer/object.ts +0 -129
- package/semiplugins/type.ts +0 -8
- package/terrain-plugin.mmd +0 -83
- package/tests/Math/arc-sampling-test.js +0 -367
- package/tests/Math/arc-sampling-test.ts +0 -429
- package/tests/Math/arc.test.ts +0 -77
- package/tests/Math/junction/arc-limit.test.ts +0 -7
- package/tests/Math/junction/arc-plane-points.test.ts +0 -196
- package/tests/Math/junction/arc-plane.test.ts +0 -172
- package/tests/Math/junction/line-sphere.test.ts +0 -127
- package/tests/Math/junction/plane-plane.test.ts +0 -91
- package/tests/Math/plane-test.ts +0 -17
- package/tests/Math/plane.test.ts +0 -43
- package/tests/Math/vec3.test.ts +0 -33
- package/tracks/point-heat-map/readme.md +0 -15
- package/tracks/timetracks/readme.md +0 -1
- package/tsconfig.json +0 -22
- package/types/@pirireis/webglobe.d.ts +0 -102
- package/types/delaunator.d.ts +0 -40
- package/types/earcut.d.ts +0 -11
- package/types/rbush.d.ts +0 -57
- package/types.ts +0 -319
- package/util/account/create-buffermap-orchastration.ts +0 -85
- package/util/account/single-attribute-buffer-management/types.ts +0 -43
- package/util/check/typecheck.ts +0 -74
- package/vectorfield/wind/adapters/types.ts +0 -12
- package/write-text/context-text3.ts +0 -252
- 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
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
this.
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
this.
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
this.
|
|
197
|
-
this.
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
if (
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
)
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
}
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
this.
|
|
459
|
-
this.
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
}
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
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
|
+
}
|