@pirireis/webglobeplugins 0.9.7 → 0.9.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (212) hide show
  1. package/dist/Math/angle-calculation.js +15 -0
  2. package/dist/Math/arc.js +65 -0
  3. package/dist/Math/bounds/line-bbox.js +188 -0
  4. package/dist/Math/constants.js +9 -0
  5. package/dist/Math/frustum/camera.js +24 -0
  6. package/dist/Math/frustum/from-globeinfo.js +48 -0
  7. package/dist/Math/frustum/types.js +2 -0
  8. package/dist/Math/globe-util/horizon-plane.js +112 -0
  9. package/dist/Math/index.js +1 -0
  10. package/dist/Math/juction/arc-plane.js +83 -0
  11. package/dist/Math/juction/line-sphere.js +25 -0
  12. package/dist/Math/juction/plane-plane.js +58 -0
  13. package/dist/Math/line.js +56 -0
  14. package/dist/Math/matrix4.js +1 -0
  15. package/dist/Math/methods.js +201 -0
  16. package/dist/Math/plane.js +60 -0
  17. package/dist/Math/quaternion.js +104 -0
  18. package/dist/Math/types.js +2 -0
  19. package/dist/Math/utils.js +4 -0
  20. package/dist/Math/vec3.js +126 -0
  21. package/dist/algorithms/search-binary.js +19 -0
  22. package/dist/altitude-locator/adaptors.js +1 -0
  23. package/dist/altitude-locator/draw-subset-obj.js +18 -0
  24. package/dist/altitude-locator/keymethod.js +1 -0
  25. package/dist/altitude-locator/plugin.js +341 -0
  26. package/dist/altitude-locator/types.js +23 -0
  27. package/dist/arrowfield/adaptor.js +14 -0
  28. package/dist/arrowfield/index.js +10 -0
  29. package/dist/arrowfield/plugin.js +86 -0
  30. package/dist/bearing-line/index.js +8 -0
  31. package/dist/bearing-line/plugin.js +449 -0
  32. package/dist/circle-line-chain/chain-list-map.js +205 -0
  33. package/dist/circle-line-chain/init.js +1 -0
  34. package/dist/circle-line-chain/plugin.js +424 -0
  35. package/dist/circle-line-chain/util.js +5 -0
  36. package/dist/compass-rose/compass-rose-padding-flat.js +225 -0
  37. package/dist/compass-rose/compass-text-writer.js +153 -0
  38. package/dist/compass-rose/index.js +7 -0
  39. package/dist/compassrose/compassrose.js +296 -0
  40. package/dist/compassrose/index.js +8 -0
  41. package/dist/globe-types.js +1 -0
  42. package/dist/heatwave/index.js +10 -0
  43. package/dist/heatwave/isobar/objectarraylabels.js +202 -0
  44. package/dist/heatwave/isobar/plugin.js +343 -0
  45. package/dist/heatwave/isobar/quadtreecontours.js +300 -0
  46. package/dist/heatwave/plugins/heatwaveglobeshell.js +206 -0
  47. package/dist/index.js +58 -0
  48. package/dist/jest.config.js +7 -0
  49. package/dist/partialrings/buffer-manager.js +81 -0
  50. package/dist/partialrings/index.js +41 -0
  51. package/dist/partialrings/plugin.js +135 -0
  52. package/dist/partialrings/program.js +286 -0
  53. package/dist/pin/pin-object-array.js +305 -0
  54. package/dist/pin/pin-point-totem.js +60 -0
  55. package/dist/point-heat-map/adaptors/timetracksplugin-format-to-this.js +66 -0
  56. package/dist/point-heat-map/index.js +1 -0
  57. package/dist/point-heat-map/plugin-webworker.js +126 -0
  58. package/dist/point-heat-map/point-to-heat-map-flow.js +127 -0
  59. package/dist/point-tracks/key-methods.js +5 -0
  60. package/dist/point-tracks/plugin.js +338 -0
  61. package/dist/programs/arrowfield/index.js +7 -0
  62. package/dist/programs/arrowfield/logic.js +257 -0
  63. package/dist/programs/arrowfield/object.js +66 -0
  64. package/dist/programs/data2legend/density-to-legend.js +101 -0
  65. package/dist/programs/data2legend/point-to-density-texture.js +100 -0
  66. package/dist/programs/float2legendwithratio/index.js +8 -0
  67. package/dist/programs/float2legendwithratio/logic.js +171 -0
  68. package/dist/programs/float2legendwithratio/object.js +110 -0
  69. package/dist/programs/globe-util/is-globe-moved.js +21 -0
  70. package/dist/programs/globeshell/index.js +8 -0
  71. package/dist/programs/globeshell/noise/noises.js +1 -0
  72. package/dist/programs/globeshell/wiggle/index.js +8 -0
  73. package/dist/programs/globeshell/wiggle/logic.js +345 -0
  74. package/dist/programs/globeshell/wiggle/object.js +72 -0
  75. package/dist/programs/helpers/blender/index.js +1 -0
  76. package/dist/programs/helpers/blender/program.js +79 -0
  77. package/dist/programs/helpers/fadeaway/index.js +7 -0
  78. package/dist/programs/helpers/fadeaway/logic.js +72 -0
  79. package/dist/programs/helpers/fadeaway/object.js +20 -0
  80. package/dist/programs/helpers/index.js +8 -0
  81. package/dist/programs/index.js +58 -0
  82. package/dist/programs/interface.js +1 -0
  83. package/dist/programs/line-on-globe/angled-line.js +176 -0
  84. package/dist/programs/line-on-globe/circle-accurate-3d.js +141 -0
  85. package/dist/programs/line-on-globe/circle-accurate-flat.js +216 -0
  86. package/dist/programs/line-on-globe/circle-accurate.js +178 -0
  87. package/dist/programs/line-on-globe/circle.js +167 -0
  88. package/dist/programs/line-on-globe/degree-padding-around-circle-3d.js +159 -0
  89. package/dist/programs/line-on-globe/index.js +1 -0
  90. package/dist/programs/line-on-globe/lines-color-instanced-flat.js +136 -0
  91. package/dist/programs/line-on-globe/linestrip.js +171 -0
  92. package/dist/programs/line-on-globe/naive-accurate-flexible.js +195 -0
  93. package/dist/programs/line-on-globe/to-the-surface.js +111 -0
  94. package/dist/programs/line-on-globe/util.js +8 -0
  95. package/dist/programs/picking/pickable-renderer.js +188 -0
  96. package/dist/programs/point-on-globe/element-globe-surface-glow.js +142 -0
  97. package/dist/programs/point-on-globe/element-point-glow.js +153 -0
  98. package/dist/programs/point-on-globe/square-pixel-point.js +174 -0
  99. package/dist/programs/programcache.js +131 -0
  100. package/dist/programs/rings/distancering/circleflatprogram.js +156 -0
  101. package/dist/programs/rings/distancering/circlepaddingfreeangleprogram.js +369 -0
  102. package/dist/programs/rings/distancering/circlepaddysharedbuffer.js +357 -0
  103. package/dist/programs/rings/distancering/index.js +14 -0
  104. package/dist/programs/rings/distancering/paddyflatprogram.js +172 -0
  105. package/dist/programs/rings/distancering/paddyflatprogram2d.js +174 -0
  106. package/dist/programs/rings/distancering/paddyflatprogram3d.js +172 -0
  107. package/dist/programs/rings/distancering/shader.js +1 -0
  108. package/dist/programs/rings/index.js +17 -0
  109. package/dist/programs/rings/partial-ring/piece-of-pie.js +275 -0
  110. package/dist/programs/totems/camerauniformblock.js +160 -0
  111. package/dist/programs/totems/canvas-webglobe-info.js +110 -0
  112. package/dist/programs/totems/gpu-selection-uniform-block.js +108 -0
  113. package/dist/programs/totems/index.js +40 -0
  114. package/dist/programs/two-d/pixel-circle.js +1 -0
  115. package/dist/programs/two-d/pixel-padding-for-compass.js +162 -0
  116. package/dist/programs/util.js +17 -0
  117. package/dist/programs/vectorfields/index.js +23 -0
  118. package/dist/programs/vectorfields/logics/drawrectangleparticles.js +107 -0
  119. package/dist/programs/vectorfields/logics/index.js +12 -0
  120. package/dist/programs/vectorfields/logics/pixelbased.js +142 -0
  121. package/dist/programs/vectorfields/logics/ubo.js +63 -0
  122. package/dist/programs/vectorfields/pingpongbuffermanager.js +76 -0
  123. package/dist/rangerings/enum.js +5 -0
  124. package/dist/rangerings/index.js +15 -0
  125. package/dist/rangerings/plugin.js +560 -0
  126. package/dist/rangerings/rangeringangletext.js +329 -0
  127. package/dist/rangerings/ring-account.js +117 -0
  128. package/dist/shaders/fragment-toy/firework.js +58 -0
  129. package/dist/shaders/fragment-toy/singularity.js +59 -0
  130. package/dist/shape-on-terrain/arc/naive/plugin.js +252 -0
  131. package/dist/timetracks/adaptors-line-strip.js +71 -0
  132. package/dist/timetracks/adaptors.js +122 -0
  133. package/dist/timetracks/index.js +19 -0
  134. package/dist/timetracks/plugin-line-strip.js +250 -0
  135. package/dist/timetracks/plugin.js +258 -0
  136. package/dist/timetracks/program-line-strip.js +611 -0
  137. package/dist/timetracks/program.js +772 -0
  138. package/dist/timetracks/programpoint-line-strip.js +154 -0
  139. package/dist/timetracks/programpoint.js +147 -0
  140. package/dist/types.js +15 -0
  141. package/dist/util/account/bufferoffsetmanager.js +179 -0
  142. package/dist/util/account/index.js +23 -0
  143. package/dist/util/account/single-attribute-buffer-management/buffer-manager.js +108 -0
  144. package/dist/util/account/single-attribute-buffer-management/buffer-orchestrator.js +150 -0
  145. package/dist/util/account/single-attribute-buffer-management/index.js +9 -0
  146. package/dist/util/account/single-attribute-buffer-management/object-store.js +51 -0
  147. package/dist/util/account/single-attribute-buffer-management/types.js +2 -0
  148. package/dist/util/account/util.js +22 -0
  149. package/dist/util/algorithms/index.js +1 -0
  150. package/dist/util/algorithms/search-binary.js +28 -0
  151. package/dist/util/check/get.js +18 -0
  152. package/dist/util/check/index.js +1 -0
  153. package/dist/util/check/typecheck.js +49 -0
  154. package/dist/util/geometry/index.js +51 -0
  155. package/dist/util/gl-util/buffer/attribute-loader.js +69 -0
  156. package/dist/util/gl-util/buffer/index.js +6 -0
  157. package/dist/util/gl-util/buffer/types.js +1 -0
  158. package/dist/util/gl-util/draw-options/methods.js +38 -0
  159. package/dist/util/gl-util/draw-options/types.js +15 -0
  160. package/dist/util/gl-util/uniform-block/manager.js +156 -0
  161. package/dist/util/gl-util/uniform-block/shader.js +1 -0
  162. package/dist/util/gl-util/uniform-block/types.js +8 -0
  163. package/dist/util/heatwavedatamanager/datamanager.js +152 -0
  164. package/dist/util/heatwavedatamanager/index.js +10 -0
  165. package/dist/util/heatwavedatamanager/pointcoordinatesdatacalculator.js +122 -0
  166. package/dist/util/heatwavedatamanager/pointcoordsmeta.js +20 -0
  167. package/dist/util/index.js +57 -0
  168. package/dist/util/interpolation/index.js +1 -0
  169. package/dist/util/interpolation/timetrack/index.js +5 -0
  170. package/dist/util/interpolation/timetrack/timetrack-interpolator.js +79 -0
  171. package/dist/util/interpolation/timetrack/web-worker-str.js +183 -0
  172. package/dist/util/interpolation/timetrack/web-worker.js +48 -0
  173. package/dist/util/jshelpers/data-filler.js +20 -0
  174. package/dist/util/jshelpers/equality.js +20 -0
  175. package/dist/util/jshelpers/index.js +37 -0
  176. package/dist/util/jshelpers/timefilters.js +32 -0
  177. package/dist/util/picking/fence.js +46 -0
  178. package/dist/util/picking/picker-displayer.js +139 -0
  179. package/dist/util/programs/draw-texture-on-canvas.js +89 -0
  180. package/dist/util/programs/index.js +17 -0
  181. package/dist/util/programs/shapesonglobe.js +214 -0
  182. package/dist/util/programs/supersampletotextures.js +113 -0
  183. package/dist/util/programs/texturetoglobe.js +182 -0
  184. package/dist/util/shaderfunctions/geometrytransformations.js +340 -0
  185. package/dist/util/shaderfunctions/index.js +18 -0
  186. package/dist/util/shaderfunctions/nodata.js +11 -0
  187. package/dist/util/shaderfunctions/noisefunctions.js +43 -0
  188. package/dist/util/surface-line-data/arc-bboxes.js +25 -0
  189. package/dist/util/surface-line-data/arcs-to-cuts.js +50 -0
  190. package/dist/util/surface-line-data/cut-arc.js +1 -0
  191. package/dist/util/surface-line-data/flow.js +28 -0
  192. package/dist/util/surface-line-data/rbush-manager.js +1 -0
  193. package/dist/util/surface-line-data/types.js +1 -0
  194. package/dist/util/surface-line-data/web-worker.js +1 -0
  195. package/dist/util/webglobe/gldefaultstates.js +7 -0
  196. package/dist/util/webglobe/index.js +18 -0
  197. package/dist/util/webglobe/rasteroverlay.js +78 -0
  198. package/dist/util/webglobjectbuilders.js +388 -0
  199. package/dist/util/webglobjectbuilders1.js +237 -0
  200. package/dist/waveparticles/adaptor.js +17 -0
  201. package/dist/waveparticles/index.js +10 -0
  202. package/dist/waveparticles/plugin.js +266 -0
  203. package/dist/wind/imagetovectorfieldandmagnitude.js +35 -0
  204. package/dist/wind/index.js +14 -0
  205. package/dist/wind/plugin.js +926 -0
  206. package/dist/wind/vectorfieldimage.js +25 -0
  207. package/dist/write-text/attached-text-writer.js +91 -0
  208. package/dist/write-text/context-text.js +98 -0
  209. package/dist/write-text/context-text3.js +155 -0
  210. package/dist/write-text/index.js +5 -0
  211. package/dist/write-text/writer-plugin.js +8 -0
  212. package/package.json +1 -1
@@ -0,0 +1,329 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const webglobe_1 = require("@pirireis/webglobe");
4
+ const enum_1 = require("./enum");
5
+ const fidKey = "__fid__";
6
+ const object = {
7
+ "displayName": "RangeRingAngleText",
8
+ "layerType": 3,
9
+ "wkbGeom": null,
10
+ "wfsLayerName": null,
11
+ "objectType": "point",
12
+ "bbox": null,
13
+ "startLod": 2,
14
+ "endLod": 30,
15
+ "continuousLOD": true,
16
+ "MVTXYZName": "hd_seyp",
17
+ "rasterize": false,
18
+ };
19
+ class RangeRingAngleText {
20
+ constructor(globe, id, { style = null, hideAll = false, opacity = 1 } = {}) {
21
+ this.globe = globe;
22
+ this.ObjectArray = globe.ObjectArray;
23
+ this.id = id;
24
+ this._hideAll = hideAll;
25
+ this._opacity = opacity;
26
+ const style_ = style !== null ? style : this.getDefaultStyle();
27
+ this.object = Object.assign({}, object, { style: style_, id: this.id });
28
+ this._centerCollection = new Map();
29
+ // new inner MAP params
30
+ // hide
31
+ // textHide
32
+ this.ObjectArray.Add(this.object);
33
+ }
34
+ getDefaultStyle() {
35
+ const style = this.ObjectArray.GetDefaultStyle();
36
+ style.fidKey = fidKey;
37
+ const { labels } = style;
38
+ const label = labels[0];
39
+ label.offset = { x: 0, y: 0 };
40
+ label.fontFamily.hollowWidth = 1;
41
+ label.vAlignment = 2;
42
+ label.hAlignment = 2;
43
+ label.size = 17;
44
+ // eslint-disable-next-line
45
+ label.text = "`${aci}`";
46
+ return style;
47
+ }
48
+ setStyle(style) {
49
+ if (style === null)
50
+ return;
51
+ style.opacity = this._opacity;
52
+ this.object.style = style;
53
+ this.ObjectArray.StyleChanged(this.object);
54
+ }
55
+ setOpacity(opacity) {
56
+ this._opacity = opacity;
57
+ const { style } = this.object;
58
+ style.opacity = opacity;
59
+ this.ObjectArray.StyleChanged(this.object);
60
+ }
61
+ free() {
62
+ this.flush();
63
+ this.ObjectArray.Delete(this.id);
64
+ }
65
+ /**
66
+ * @param {Array<{centerID,stepAngle, long,lat, rings>} ringDatas
67
+ * centerID: string | ObjectArray fidKey de kullanilir
68
+ * stepAngle: number | 0-360 arasinda
69
+ * long,lat: number | merkez koordinatlari lat long radian. Globe icin dereceye iceride cevrilir
70
+ * rings: Array<{radius: number}> | En buyuk halkaya centik acilari yazilir, Sonraki adim yaricaplarin uzunlugunu yazdirmak
71
+ *
72
+ * eger bir centerID zaten var ise: Onceki noktalar dusurulur ve yeniden eklenir
73
+ *
74
+ * */
75
+ insertBulk(ringDatas) {
76
+ const { _hideAll } = this;
77
+ const addBucket = {
78
+ coords: [],
79
+ coordsZ: [],
80
+ attribs: []
81
+ };
82
+ const deleteBucket = {
83
+ coords: [],
84
+ coordsZ: [],
85
+ attribs: []
86
+ };
87
+ for (const { centerID, long, lat, rings, stepAngle, hide = enum_1.ENUM_HIDE.SHOW, textHide = enum_1.ENUM_TEXT_HIDE.SHOW } of ringDatas) {
88
+ if (this._centerCollection.has(centerID)) {
89
+ this._fillDeleteBucket(centerID, deleteBucket);
90
+ }
91
+ const maxRadius = rings.reduce((acc, { radius }) => Math.max(acc, radius), 0);
92
+ const textHide_ = _hideAll ? enum_1.ENUM_TEXT_HIDE.HIDE : textHide;
93
+ const show = hide !== enum_1.ENUM_HIDE.HIDE && textHide_ === enum_1.ENUM_TEXT_HIDE.SHOW;
94
+ if (show)
95
+ this._appendCircle(long, lat, maxRadius, stepAngle, centerID, addBucket);
96
+ this._centerCollection.set(centerID, new Map([
97
+ ["stepAngle", stepAngle],
98
+ ["maxRadius", maxRadius],
99
+ ["long", long],
100
+ ["lat", lat],
101
+ ["hide", hide],
102
+ ["textHide", textHide_]
103
+ ]));
104
+ }
105
+ if (this._hideAll)
106
+ return;
107
+ if (deleteBucket.coords.length > 0)
108
+ this._updateData(deleteBucket, webglobe_1.CSObjectArrayUpdateTypes.DELETE);
109
+ if (addBucket.coords.length > 0)
110
+ this._updateData(addBucket, webglobe_1.CSObjectArrayUpdateTypes.ADD);
111
+ }
112
+ /**
113
+ * @param {Array<{centerID, x,y}>} centerDatas
114
+ * aci ve radiuslarin tutulmasi gereklidir.
115
+ * */
116
+ updateCentersXY(centerDatas) {
117
+ const updateBucket = {
118
+ coords: [],
119
+ coordsZ: [],
120
+ attribs: []
121
+ };
122
+ for (const { centerID, long, lat } of centerDatas) {
123
+ if (this._centerCollection.has(centerID)) {
124
+ const centerMap = this._centerCollection.get(centerID);
125
+ centerMap.set("long", long);
126
+ centerMap.set("lat", lat);
127
+ const hide = centerMap.get("hide");
128
+ const textHide = centerMap.get("textHide");
129
+ const isHidden = hide === enum_1.ENUM_HIDE.HIDE || textHide === enum_1.ENUM_TEXT_HIDE.HIDE;
130
+ if (isHidden)
131
+ continue;
132
+ const maxRadius = centerMap.get("maxRadius");
133
+ const stepAngle = centerMap.get("stepAngle");
134
+ // long, lat, radius, step, centerID, outBucket
135
+ this._appendCircle(long, lat, maxRadius, stepAngle, centerID, updateBucket);
136
+ }
137
+ }
138
+ // for (const attribs of updateBucket.attribs) {
139
+ // delete attribs["aci"];
140
+ // }
141
+ if (updateBucket.coords.length > 0) {
142
+ this._updateData(updateBucket, webglobe_1.CSObjectArrayUpdateTypes.UPDATE);
143
+ }
144
+ }
145
+ /**
146
+ *
147
+ * @param {Array<{centerID:string, hide: bool}>} centerHides
148
+ */
149
+ updateCentersHide(centerHides) {
150
+ if (this._hideAll) {
151
+ console.warn("Tum mesafe halkasi yazilari gizli durum. Islem yapilamaz");
152
+ return;
153
+ }
154
+ ;
155
+ const addBucket = {
156
+ coords: [],
157
+ coordsZ: [],
158
+ attribs: []
159
+ };
160
+ const deleteBucket = {
161
+ coords: [],
162
+ coordsZ: [],
163
+ attribs: []
164
+ };
165
+ for (const { centerID, textHide = null, hide = null } of centerHides) {
166
+ if (!this._centerCollection.has(centerID))
167
+ continue;
168
+ const centerMap = this._centerCollection.get(centerID);
169
+ const isHidden = centerMap.get("hide") === enum_1.ENUM_HIDE.HIDE || centerMap.get("textHide") === enum_1.ENUM_TEXT_HIDE.HIDE;
170
+ const _hide = hide !== null ? hide : centerMap.get("hide");
171
+ const _textHide = textHide !== null ? textHide : centerMap.get("textHide");
172
+ const show = (_hide !== enum_1.ENUM_HIDE.HIDE) && (_textHide === enum_1.ENUM_TEXT_HIDE.SHOW);
173
+ if (!isHidden && !show) {
174
+ this._fillDeleteBucket(centerID, deleteBucket);
175
+ }
176
+ else if (isHidden && show) {
177
+ this._appendCircle(centerMap.get("long"), centerMap.get("lat"), centerMap.get("maxRadius"), centerMap.get("stepAngle"), centerID, addBucket);
178
+ }
179
+ if (hide !== null)
180
+ centerMap.set("hide", hide);
181
+ if (textHide !== null)
182
+ centerMap.set("textHide", textHide);
183
+ }
184
+ if (deleteBucket.coords.length > 0)
185
+ this._updateData(deleteBucket, webglobe_1.CSObjectArrayUpdateTypes.DELETE);
186
+ if (addBucket.coords.length > 0)
187
+ this._updateData(addBucket, webglobe_1.CSObjectArrayUpdateTypes.ADD);
188
+ }
189
+ // TODO : Implement this
190
+ removeCenters(centerIDs) {
191
+ const deleteBucket = {
192
+ coords: [],
193
+ coordsZ: [],
194
+ attribs: []
195
+ };
196
+ for (const centerID of centerIDs) {
197
+ if (this._centerCollection.has(centerID)) {
198
+ this._fillDeleteBucket(centerID, deleteBucket);
199
+ this._centerCollection.delete(centerID);
200
+ }
201
+ }
202
+ this._updateData(deleteBucket, webglobe_1.CSObjectArrayUpdateTypes.DELETE);
203
+ }
204
+ hideAll() {
205
+ this._hideAll = true;
206
+ const deleteBucket = {
207
+ coords: [],
208
+ coordsZ: [],
209
+ attribs: []
210
+ };
211
+ for (const [centerID, centerMap] of this._centerCollection) {
212
+ const hide = centerMap.get("hide");
213
+ const hideText = centerMap.get("textHide");
214
+ centerMap.set("textHide", enum_1.ENUM_TEXT_HIDE.HIDE);
215
+ if (hide === enum_1.ENUM_HIDE.HIDE)
216
+ continue;
217
+ const isHidden = hideText === enum_1.ENUM_TEXT_HIDE.HIDE;
218
+ if (!isHidden)
219
+ this._fillDeleteBucket(centerID, deleteBucket);
220
+ }
221
+ this._updateData(deleteBucket, webglobe_1.CSObjectArrayUpdateTypes.DELETE);
222
+ }
223
+ showAll() {
224
+ this._hideAll = false;
225
+ const addBucket = {
226
+ coords: [],
227
+ coordsZ: [],
228
+ attribs: []
229
+ };
230
+ for (const [centerID, centerMap] of this._centerCollection) {
231
+ const hide = centerMap.get("hide");
232
+ if (hide === enum_1.ENUM_HIDE.HIDE)
233
+ continue;
234
+ const hideText = centerMap.get("textHide");
235
+ const isHidden = hideText === enum_1.ENUM_TEXT_HIDE.HIDE;
236
+ if (isHidden) {
237
+ const long = centerMap.get("long");
238
+ const lat = centerMap.get("lat");
239
+ const maxRadius = centerMap.get("maxRadius");
240
+ const stepAngle = centerMap.get("stepAngle");
241
+ this._appendCircle(long, lat, maxRadius, stepAngle, centerID, addBucket);
242
+ centerMap.set("hide", enum_1.ENUM_HIDE.SHOW);
243
+ centerMap.set("textHide", enum_1.ENUM_TEXT_HIDE.SHOW);
244
+ }
245
+ }
246
+ if (addBucket.coords.length)
247
+ this._updateData(addBucket, webglobe_1.CSObjectArrayUpdateTypes.ADD);
248
+ }
249
+ flush() {
250
+ const data = {
251
+ coords: [],
252
+ coordsZ: [],
253
+ attribs: []
254
+ };
255
+ this._idCollector = new Set();
256
+ this.ObjectArray.SetData(this.object, data);
257
+ }
258
+ //------------------PRIVATE METHODS------------------//
259
+ _appendCircle(long, lat, radius, step, centerID, outBucket) {
260
+ this.__realCoords(long, lat, radius, step, centerID, outBucket);
261
+ }
262
+ __realCoords(longCenter, latCenter, radius, stepAngle, centerID, outBucket) {
263
+ const { globe } = this;
264
+ const { coords, coordsZ, attribs } = outBucket;
265
+ let i = 1;
266
+ for (let aci = stepAngle; aci < 360; aci += stepAngle) {
267
+ const { long, lat } = globe.Math.FindPointByPolar(longCenter, latCenter, radius, aci);
268
+ coords.push(long, lat);
269
+ coordsZ.push(0);
270
+ const key = this._key(centerID, i);
271
+ i++;
272
+ // fidkey is the key
273
+ attribs.push({
274
+ "__fid__": key,
275
+ "aci": (aci).toFixed(0).toString().padStart(3, '0')
276
+ });
277
+ }
278
+ { // add 0
279
+ const { long, lat } = globe.Math.FindPointByPolar(longCenter, latCenter, radius, 0);
280
+ coords.push(long, lat);
281
+ coordsZ.push(0);
282
+ const key = this._key(centerID, 0);
283
+ // fidkey is the key
284
+ attribs.push({
285
+ "__fid__": key,
286
+ "aci": "K"
287
+ });
288
+ }
289
+ }
290
+ _updateData(bucket, mode) {
291
+ this.ObjectArray.UpdateData(this.object, mode, [bucket], { attribs: false, icon: false, text: false });
292
+ }
293
+ _key(centerRingKey, limpIndex) {
294
+ return `${centerRingKey}_${limpIndex}`;
295
+ }
296
+ _fillDeleteBucket(centerID, outDeleteBucket) {
297
+ const centerMap = this._centerCollection.get(centerID);
298
+ const stepAngle = centerMap.get("stepAngle");
299
+ const { coords, coordsZ, attribs } = outDeleteBucket;
300
+ let i = 0;
301
+ for (let aci = 0; aci < 360; aci += stepAngle) {
302
+ const key = this._key(centerID, i++);
303
+ coords.push(0, 0);
304
+ coordsZ.push(0);
305
+ attribs.push({
306
+ "__fid__": key,
307
+ });
308
+ }
309
+ }
310
+ _updateAll() {
311
+ const updateBucket = {
312
+ coords: [],
313
+ coordsZ: [],
314
+ attribs: []
315
+ };
316
+ for (const [centerID, centerMap] of this._centerCollection) {
317
+ const isHidden = centerMap.get("hide") === enum_1.ENUM_HIDE.HIDE || centerMap.get("textHide") === enum_1.ENUM_TEXT_HIDE.HIDE;
318
+ if (isHidden)
319
+ continue;
320
+ const long = centerMap.get("long");
321
+ const lat = centerMap.get("lat");
322
+ const maxRadius = centerMap.get("maxRadius");
323
+ const stepAngle = centerMap.get("stepAngle");
324
+ this._appendCircle(long, lat, maxRadius, stepAngle, centerID, updateBucket);
325
+ }
326
+ this._updateData(updateBucket, webglobe_1.CSObjectArrayUpdateTypes.UPDATE);
327
+ }
328
+ }
329
+ exports.default = RangeRingAngleText;
@@ -0,0 +1,117 @@
1
+ "use strict";
2
+ /**
3
+ * This account interacts with buffer orchestrations and buffers.
4
+ * For rings, coordinates and paddings
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.ringBigPaddingKeyMethod = exports.ringKeyMethod = exports.RingAccount = void 0;
8
+ const ringKeyMethod = (centerID, ringID) => `${centerID}_${ringID}`;
9
+ exports.ringKeyMethod = ringKeyMethod;
10
+ const ringBigPaddingKeyMethod = (centerID, ringID, angle) => `${centerID}_${ringID}_${angle}`;
11
+ exports.ringBigPaddingKeyMethod = ringBigPaddingKeyMethod;
12
+ /**
13
+ * @typedef { Array < { ringID, radius, paddingRange } >} rings
14
+ * @param { Array < centerID: string, x: number, y: number, stepAngle: number, rgba: [4 numbers], rings: rings } items
15
+ */
16
+ class RingAccount {
17
+ constructor() {
18
+ this._centralMap = new Map(); // key, new MAP(x,y, rings:[])
19
+ }
20
+ /**
21
+ * @typedef {centerID, long,lat, rings} centralItem
22
+ *
23
+ */
24
+ insertCenter(centralItem) {
25
+ centralItem.rings.forEach((ring) => {
26
+ ring.__identity__ = ringKeyMethod(centralItem.centerID, ring.ringID);
27
+ });
28
+ this._centralMap.set(centralItem.centerID, {
29
+ ...centralItem,
30
+ rgba: new Float32Array(centralItem.rgba),
31
+ });
32
+ }
33
+ getCenter(centerID) {
34
+ return this._centralMap.get(centerID);
35
+ }
36
+ updateCentersCoordinate(items) {
37
+ for (const { centerID, long, lat } of items) {
38
+ const center = this.getCenter(centerID);
39
+ if (center) {
40
+ center.long = long;
41
+ center.lat = lat;
42
+ }
43
+ }
44
+ }
45
+ updateCentersHide(items) {
46
+ for (const { centerID, hide = null, textHide = null } of items) {
47
+ const center = this.getCenter(centerID);
48
+ if (center) {
49
+ if (hide !== null)
50
+ center.hide = hide;
51
+ if (textHide !== null)
52
+ center.textHide = textHide;
53
+ }
54
+ }
55
+ }
56
+ /**
57
+ *
58
+ * @param {Array<{centerID, rgba}>} centersColor
59
+ */
60
+ updateCentersColor(centersColor) {
61
+ for (const { centerID, rgba } of centersColor) {
62
+ const center = this.getCenter(centerID);
63
+ if (center) {
64
+ center.rgba = new Float32Array(rgba);
65
+ }
66
+ }
67
+ }
68
+ // to delete rings and one degree paddings from buffer
69
+ ringKeys(centerID) {
70
+ const result = [];
71
+ const center = this.getCenter(centerID);
72
+ if (center) {
73
+ const rings = center.rings;
74
+ for (const { __identity__ } of rings) {
75
+ result.push(__identity__);
76
+ }
77
+ }
78
+ return result;
79
+ }
80
+ // To delete big paddings from buffer
81
+ ringBigPaddingKeys(centerID) {
82
+ const result = [];
83
+ const center = this.getCenter(centerID);
84
+ if (!center)
85
+ return [];
86
+ const { rings, stepAngle } = center;
87
+ for (const { ringID } of rings) {
88
+ let angle = 0;
89
+ while (angle < 360) {
90
+ result.push(ringBigPaddingKeyMethod(centerID, ringID, angle));
91
+ angle += stepAngle;
92
+ }
93
+ }
94
+ return result;
95
+ }
96
+ removeCenters(centerIDs) {
97
+ const centralMap = this._centralMap;
98
+ centerIDs.forEach((centerID) => {
99
+ centralMap.delete(centerID);
100
+ });
101
+ }
102
+ textUpdate(centerID, textWriterObjs, dataPreAdaptor = null) {
103
+ const center = this.getCenter(centerID);
104
+ if (!center)
105
+ return;
106
+ const data = (dataPreAdaptor) ? dataPreAdaptor(center) : center;
107
+ textWriterObjs.forEach((writer) => {
108
+ writer.insertTextBulk(data.rings, data);
109
+ });
110
+ }
111
+ updateAllText(textWriterObjs, dataPreAdaptor = null) {
112
+ this._centralMap.forEach((center) => {
113
+ this.textUpdate(center.centerID, textWriterObjs, dataPreAdaptor);
114
+ });
115
+ }
116
+ }
117
+ exports.RingAccount = RingAccount;
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.firework = void 0;
4
+ exports.firework = `
5
+ float firework(vec2 point_coord, float phase) {
6
+ float t = phase + 5.0;
7
+ float z = 6.0;
8
+ const int n = 53; // particle count
9
+
10
+ vec3 startColor = vec3(0.0, 0.64, 0.2);
11
+ vec3 endColor = vec3(0.06, 0.35, 0.85);
12
+
13
+ float startRadius = 0.84;
14
+ float endRadius = 1.6;
15
+
16
+ float power = 0.51;
17
+ float duration = 4.0;
18
+
19
+ vec2 v = z * (2.0 * point_coord - vec2(1.0) );
20
+
21
+ vec3 col = vec3(0.0);
22
+ vec2 pm = v.yx * 2.8;
23
+
24
+ float dMax = duration;
25
+ float evo = (sin(phase * 0.01 + 400.0) * 0.5 + 0.5) * 99.0 + 1.0;
26
+
27
+ float mb = 0.0;
28
+ float mbRadius = 0.0;
29
+ float sum = 0.0;
30
+
31
+ for(int i = 0; i < n; i++) {
32
+ float d = fract(t * power + 48934.4238 * sin(float(i / int(evo)) * 692.7398));
33
+
34
+ float a = 6.28 * float(i) / float(n);
35
+ float x = d * cos(a) * duration;
36
+ float y = d * sin(a) * duration;
37
+
38
+ float distRatio = d / dMax;
39
+ mbRadius = mix(startRadius, endRadius, distRatio);
40
+
41
+ vec2 p = v - vec2(x, y);
42
+ mb = mbRadius / dot(p, p);
43
+
44
+ sum += mb;
45
+ col = mix(col, mix(startColor, endColor, distRatio), mb / sum);
46
+ }
47
+
48
+ sum /= float(n);
49
+ col = normalize(col) * sum;
50
+ sum = clamp(sum, 0.0, 0.4);
51
+
52
+ vec3 tex = vec3(1.0);
53
+ col *= smoothstep(tex, vec3(0.0), vec3(sum));
54
+
55
+ float alpha = sum * 2.5;
56
+ return clamp(alpha, 0.0, 1.0);
57
+ }
58
+ `;
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.singularity = void 0;
4
+ const singularity = `
5
+
6
+ vec3 palette(float d){
7
+ return mix(vec3(0.2, 0.7, 0.9), vec3(1.0, 0.0, 1.0), d);
8
+ }
9
+
10
+ vec2 rotate(vec2 p, float a){
11
+ float c = cos(a);
12
+ float s = sin(a);
13
+ return p * mat2(c, s, -s, c);
14
+ }
15
+
16
+ float map(vec3 p){
17
+ for (int i = 0; i < 4; ++i){
18
+ float t = u_phase * 0.2;
19
+ p.xz = rotate(p.xz, t);
20
+ p.xy = rotate(p.xy, t * 1.89);
21
+ p.xz = abs(p.xz);
22
+ p.xz -= 0.85;
23
+ }
24
+ return dot(sign(p), p) / 5.0;
25
+ }
26
+
27
+ vec4 rm(vec3 ro, vec3 rd){
28
+ float t = 0.0;
29
+ vec3 col = vec3(0.0);
30
+ float d;
31
+ for (float i = 0.0; i < 56.0; i++){
32
+ vec3 p = ro + rd * t;
33
+ d = map(p) * 0.5;
34
+ if (d < 0.02){
35
+ break;
36
+ }
37
+ if (d > 100.0){
38
+ break;
39
+ }
40
+ col += palette(length(p) * 0.1) / (400.0 * d);
41
+ t += d;
42
+ }
43
+ return vec4(col, 1.0 / d * 2.0 );
44
+ }
45
+
46
+ vec4 singularity(vec2 pointCoord, float u_phase) {
47
+ vec2 uv = (pointCoord - 0.5); // Normalized coordinates from gl_PointCoord
48
+ vec3 ro = vec3(0.0, 0.0, -50.0);
49
+ ro.xz = rotate(ro.xz, u_phase);
50
+ vec3 cf = normalize(-ro);
51
+ vec3 cs = normalize(cross(cf, vec3(0.0, 1.0, 0.0)));
52
+ vec3 cu = normalize(cross(cf, cs));
53
+
54
+ vec3 uuv = ro + cf * 3.0 + uv.x * cs + uv.y * cu;
55
+ vec3 rd = normalize(uuv - ro);
56
+
57
+ return rm(ro, rd);
58
+ }`;
59
+ exports.singularity = singularity;