@pirireis/webglobeplugins 0.9.6 → 0.9.7

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 (226) hide show
  1. package/package.json +5 -2
  2. package/Math/angle-calculation.js +0 -14
  3. package/Math/arc.ts +0 -76
  4. package/Math/bounds/line-bbox.js +0 -225
  5. package/Math/constants.ts +0 -11
  6. package/Math/frustum/camera.ts +0 -32
  7. package/Math/frustum/from-globeinfo.ts +0 -63
  8. package/Math/frustum/types.ts +0 -11
  9. package/Math/globe-util/horizon-plane.ts +0 -137
  10. package/Math/index.js +0 -0
  11. package/Math/juction/arc-plane.ts +0 -114
  12. package/Math/juction/line-sphere.ts +0 -30
  13. package/Math/juction/plane-plane.ts +0 -66
  14. package/Math/line.ts +0 -70
  15. package/Math/matrix4.ts +0 -0
  16. package/Math/methods.js +0 -237
  17. package/Math/plane.ts +0 -86
  18. package/Math/quaternion.ts +0 -120
  19. package/Math/roadmap.md +0 -10
  20. package/Math/types.ts +0 -45
  21. package/Math/utils.js +0 -3
  22. package/Math/vec3.ts +0 -155
  23. package/algorithms/search-binary.js +0 -14
  24. package/altitude-locator/adaptors.js +0 -0
  25. package/altitude-locator/draw-subset-obj.js +0 -27
  26. package/altitude-locator/keymethod.js +0 -0
  27. package/altitude-locator/plugin.js +0 -439
  28. package/altitude-locator/types.js +0 -26
  29. package/arrowfield/adaptor.js +0 -11
  30. package/arrowfield/index.js +0 -3
  31. package/arrowfield/plugin.js +0 -128
  32. package/bearing-line/index.js +0 -2
  33. package/bearing-line/plugin.js +0 -512
  34. package/circle-line-chain/chain-list-map.js +0 -221
  35. package/circle-line-chain/init.js +0 -0
  36. package/circle-line-chain/plugin.js +0 -469
  37. package/circle-line-chain/readme.md +0 -57
  38. package/circle-line-chain/util.js +0 -1
  39. package/compass-rose/compass-rose-padding-flat.js +0 -266
  40. package/compass-rose/compass-text-writer.js +0 -173
  41. package/compass-rose/index.js +0 -3
  42. package/compassrose/compassrose.js +0 -341
  43. package/compassrose/index.js +0 -2
  44. package/depth-locator/readme.md +0 -26
  45. package/globe-types.ts +0 -13
  46. package/heatwave/index.js +0 -4
  47. package/heatwave/isobar/objectarraylabels.js +0 -247
  48. package/heatwave/isobar/plugin.js +0 -340
  49. package/heatwave/isobar/quadtreecontours.js +0 -336
  50. package/heatwave/plugins/heatwaveglobeshell.js +0 -258
  51. package/jest.config.js +0 -6
  52. package/partialrings/buffer-manager.js +0 -89
  53. package/partialrings/goals.md +0 -17
  54. package/partialrings/index.js +0 -3
  55. package/partialrings/plugin.js +0 -160
  56. package/partialrings/program.js +0 -324
  57. package/pin/pin-object-array.js +0 -381
  58. package/pin/pin-point-totem.js +0 -77
  59. package/point-heat-map/adaptors/timetracksplugin-format-to-this.js +0 -78
  60. package/point-heat-map/index.js +0 -0
  61. package/point-heat-map/plugin-webworker.js +0 -151
  62. package/point-heat-map/point-to-heat-map-flow.js +0 -150
  63. package/point-heat-map/readme.md +0 -15
  64. package/point-tracks/key-methods.js +0 -3
  65. package/point-tracks/plugin.js +0 -394
  66. package/programs/arrowfield/index.js +0 -2
  67. package/programs/arrowfield/logic.js +0 -286
  68. package/programs/arrowfield/object.js +0 -89
  69. package/programs/data2legend/density-to-legend.js +0 -115
  70. package/programs/data2legend/point-to-density-texture.js +0 -114
  71. package/programs/float2legendwithratio/index.js +0 -3
  72. package/programs/float2legendwithratio/logic.js +0 -194
  73. package/programs/float2legendwithratio/object.js +0 -141
  74. package/programs/globe-util/is-globe-moved.js +0 -27
  75. package/programs/globeshell/index.js +0 -2
  76. package/programs/globeshell/noise/noises.js +0 -0
  77. package/programs/globeshell/wiggle/index.js +0 -6
  78. package/programs/globeshell/wiggle/logic.js +0 -371
  79. package/programs/globeshell/wiggle/object.js +0 -93
  80. package/programs/helpers/blender/index.js +0 -0
  81. package/programs/helpers/blender/program.js +0 -91
  82. package/programs/helpers/fadeaway/index.js +0 -3
  83. package/programs/helpers/fadeaway/logic.js +0 -76
  84. package/programs/helpers/fadeaway/object.js +0 -20
  85. package/programs/helpers/index.js +0 -2
  86. package/programs/index.js +0 -21
  87. package/programs/interface.ts +0 -7
  88. package/programs/line-on-globe/angled-line.js +0 -206
  89. package/programs/line-on-globe/circle-accurate-3d.js +0 -167
  90. package/programs/line-on-globe/circle-accurate-flat.js +0 -262
  91. package/programs/line-on-globe/circle-accurate.js +0 -202
  92. package/programs/line-on-globe/circle.js +0 -191
  93. package/programs/line-on-globe/degree-padding-around-circle-3d.js +0 -188
  94. package/programs/line-on-globe/index.js +0 -0
  95. package/programs/line-on-globe/lines-color-instanced-flat.js +0 -151
  96. package/programs/line-on-globe/linestrip.ts +0 -228
  97. package/programs/line-on-globe/naive-accurate-flexible.js +0 -239
  98. package/programs/line-on-globe/to-the-surface.js +0 -129
  99. package/programs/line-on-globe/util.js +0 -8
  100. package/programs/picking/pickable-renderer.js +0 -216
  101. package/programs/point-on-globe/element-globe-surface-glow.js +0 -168
  102. package/programs/point-on-globe/element-point-glow.js +0 -184
  103. package/programs/point-on-globe/square-pixel-point.js +0 -189
  104. package/programs/programcache.ts +0 -131
  105. package/programs/rings/distancering/circleflatprogram.js +0 -136
  106. package/programs/rings/distancering/circlepaddingfreeangleprogram.js +0 -378
  107. package/programs/rings/distancering/circlepaddysharedbuffer.js +0 -420
  108. package/programs/rings/distancering/index.js +0 -5
  109. package/programs/rings/distancering/paddyflatprogram.js +0 -146
  110. package/programs/rings/distancering/paddyflatprogram2d.js +0 -150
  111. package/programs/rings/distancering/paddyflatprogram3d.js +0 -146
  112. package/programs/rings/distancering/shader.js +0 -0
  113. package/programs/rings/index.js +0 -1
  114. package/programs/rings/partial-ring/piece-of-pie.js +0 -315
  115. package/programs/totems/camerauniformblock.d.ts +0 -48
  116. package/programs/totems/camerauniformblock.js +0 -197
  117. package/programs/totems/canvas-webglobe-info.js +0 -136
  118. package/programs/totems/gpu-selection-uniform-block.js +0 -132
  119. package/programs/totems/index.ts +0 -2
  120. package/programs/two-d/pixel-circle.js +0 -0
  121. package/programs/two-d/pixel-padding-for-compass.js +0 -174
  122. package/programs/util.js +0 -20
  123. package/programs/vectorfields/index.js +0 -3
  124. package/programs/vectorfields/logics/drawrectangleparticles.js +0 -125
  125. package/programs/vectorfields/logics/index.js +0 -5
  126. package/programs/vectorfields/logics/pixelbased.js +0 -161
  127. package/programs/vectorfields/logics/ubo.js +0 -64
  128. package/programs/vectorfields/pingpongbuffermanager.js +0 -80
  129. package/publish.bat +0 -60
  130. package/rangerings/enum.js +0 -3
  131. package/rangerings/index.js +0 -5
  132. package/rangerings/plugin.js +0 -649
  133. package/rangerings/rangeringangletext.js +0 -368
  134. package/rangerings/ring-account.js +0 -129
  135. package/shaders/fragment-toy/firework.js +0 -55
  136. package/shaders/fragment-toy/singularity.js +0 -59
  137. package/shape-on-terrain/arc/naive/plugin.ts +0 -304
  138. package/shape-on-terrain/goal.md +0 -12
  139. package/tests/Math/junction/arc-plane.test.ts +0 -133
  140. package/tests/Math/junction/plane-plane.test.ts +0 -82
  141. package/tests/Math/plane.test.ts +0 -43
  142. package/tests/Math/vec3.test.ts +0 -14
  143. package/timetracks/adaptors-line-strip.js +0 -80
  144. package/timetracks/adaptors.js +0 -133
  145. package/timetracks/index.js +0 -6
  146. package/timetracks/plugin-line-strip.js +0 -295
  147. package/timetracks/plugin.js +0 -304
  148. package/timetracks/program-line-strip.js +0 -688
  149. package/timetracks/program.js +0 -850
  150. package/timetracks/programpoint-line-strip.js +0 -175
  151. package/timetracks/programpoint.js +0 -168
  152. package/timetracks/readme.md +0 -1
  153. package/tsconfig.json +0 -22
  154. package/types.ts +0 -17
  155. package/util/account/bufferoffsetmanager.js +0 -209
  156. package/util/account/index.js +0 -6
  157. package/util/account/single-attribute-buffer-management/buffer-manager.ts +0 -119
  158. package/util/account/single-attribute-buffer-management/buffer-orchestrator.ts +0 -173
  159. package/util/account/single-attribute-buffer-management/index.ts +0 -13
  160. package/util/account/single-attribute-buffer-management/object-store.ts +0 -65
  161. package/util/account/single-attribute-buffer-management/types.ts +0 -39
  162. package/util/account/util.js +0 -22
  163. package/util/algorithms/index.js +0 -0
  164. package/util/algorithms/search-binary.js +0 -26
  165. package/util/check/get.js +0 -13
  166. package/util/check/index.js +0 -0
  167. package/util/check/typecheck.js +0 -39
  168. package/util/geometry/index.js +0 -53
  169. package/util/gl-util/buffer/attribute-loader.ts +0 -85
  170. package/util/gl-util/buffer/index.ts +0 -6
  171. package/util/gl-util/buffer/types.ts +0 -13
  172. package/util/gl-util/draw-options/methods.ts +0 -66
  173. package/util/gl-util/draw-options/types.ts +0 -28
  174. package/util/gl-util/uniform-block/manager.ts +0 -187
  175. package/util/gl-util/uniform-block/roadmap.md +0 -70
  176. package/util/gl-util/uniform-block/shader.js +0 -0
  177. package/util/gl-util/uniform-block/types.ts +0 -27
  178. package/util/heatwavedatamanager/datamanager.js +0 -168
  179. package/util/heatwavedatamanager/index.js +0 -3
  180. package/util/heatwavedatamanager/pointcoordinatesdatacalculator.js +0 -133
  181. package/util/heatwavedatamanager/pointcoordsmeta.js +0 -22
  182. package/util/index.js +0 -13
  183. package/util/interpolation/index.js +0 -0
  184. package/util/interpolation/timetrack/index.js +0 -9
  185. package/util/interpolation/timetrack/timetrack-interpolator.js +0 -88
  186. package/util/interpolation/timetrack/web-worker-str.js +0 -180
  187. package/util/interpolation/timetrack/web-worker.js +0 -51
  188. package/util/jshelpers/data-filler.js +0 -19
  189. package/util/jshelpers/equality.js +0 -17
  190. package/util/jshelpers/index.js +0 -1
  191. package/util/jshelpers/timefilters.js +0 -32
  192. package/util/picking/fence.js +0 -46
  193. package/util/picking/picker-displayer.js +0 -177
  194. package/util/programs/draw-texture-on-canvas.js +0 -102
  195. package/util/programs/index.js +0 -1
  196. package/util/programs/shapesonglobe.js +0 -246
  197. package/util/programs/supersampletotextures.js +0 -142
  198. package/util/programs/texturetoglobe.js +0 -203
  199. package/util/shaderfunctions/geometrytransformations.ts +0 -388
  200. package/util/shaderfunctions/index.js +0 -2
  201. package/util/shaderfunctions/nodata.js +0 -10
  202. package/util/shaderfunctions/noisefunctions.js +0 -44
  203. package/util/surface-line-data/arc-bboxes.ts +0 -42
  204. package/util/surface-line-data/arcs-to-cuts.js +0 -74
  205. package/util/surface-line-data/cut-arc.js +0 -0
  206. package/util/surface-line-data/flow.ts +0 -52
  207. package/util/surface-line-data/rbush-manager.js +0 -0
  208. package/util/surface-line-data/types.ts +0 -27
  209. package/util/surface-line-data/web-worker.js +0 -0
  210. package/util/webglobe/gldefaultstates.js +0 -5
  211. package/util/webglobe/index.js +0 -2
  212. package/util/webglobe/rasteroverlay.js +0 -96
  213. package/util/webglobjectbuilders.ts +0 -456
  214. package/util/webglobjectbuilders1.js +0 -271
  215. package/waveparticles/adaptor.js +0 -16
  216. package/waveparticles/index.js +0 -3
  217. package/waveparticles/plugin.js +0 -313
  218. package/wind/imagetovectorfieldandmagnitude.js +0 -39
  219. package/wind/index.js +0 -5
  220. package/wind/plugin.js +0 -1057
  221. package/wind/vectorfieldimage.js +0 -27
  222. package/write-text/attached-text-writer.js +0 -105
  223. package/write-text/context-text.js +0 -125
  224. package/write-text/context-text3.js +0 -178
  225. package/write-text/index.js +0 -1
  226. package/write-text/writer-plugin.js +0 -7
@@ -1,27 +0,0 @@
1
- function getVectorField(u, v, width, height, vMin, vMax, uMin, uMax, flip) {
2
-
3
- const data = new Uint8ClampedArray(width * height * 4);
4
-
5
- for (let row = 0; row < height; row++) {
6
- for (let col = 0; col < width; col++) {
7
- let k = flip ? ((height - row - 1) * width + col) : row * width + col;
8
- let idx = (width * row + col) << 2; // Multiply by 4 for RGBA
9
-
10
- if (u[k] === null || v[k] === null || isNaN(u[k]) || !isFinite(u[k]) || isNaN(v[k]) || !isFinite(v[k])) {
11
- data[idx] = 0; // R
12
- data[idx + 1] = 0; // G
13
- data[idx + 2] = 0; // B
14
- data[idx + 3] = 0; // A
15
- } else {
16
- data[idx] = Math.floor(255 * (u[k] - uMin) / (uMax - uMin)); // R
17
- data[idx + 1] = Math.floor(255 * (v[k] - vMin) / (vMax - vMin)); // G
18
- data[idx + 2] = 0; // B
19
- data[idx + 3] = 255; // A
20
- }
21
- }
22
- }
23
-
24
- return data;
25
- }
26
-
27
- export default getVectorField;
@@ -1,105 +0,0 @@
1
-
2
- import { CSZMode } from "@pirireis/webglobe";
3
- import { isTextFont, opacityCheck } from "../util/check/typecheck";
4
-
5
- /**
6
- * Light wight version of context text writer.
7
- * The parameters by text are calculated on user side and inserted as items. (ContextTextWriter3 constructs text data from items)
8
- *
9
- * Good side of ContextTextWriters pattern is that there is only one way to create text.
10
- * The glue is inside the plugin.
11
- * This makes the code more readable and maintainable.
12
- *
13
- * With AttachedTextWriter the glue is created by user.
14
- * I observed that the users generally uses a wrapper around the plugin logic anyway. This wrapper can be used as the glue for plugin and attacked writer.
15
- */
16
-
17
- export class AttachedTextWriter {
18
- constructor(globe, {
19
- style = {
20
- textFont: {
21
- name: 'Arial',
22
- textColor: '#FFFFFF', // beyaz
23
- hollowColor: '#000000', // siyah
24
- size: 12, // piksel
25
- hollow: true,
26
- bold: true,
27
- italic: false,
28
- },
29
- opacity: 1.0,
30
- zMode: CSZMode.Z_GROUND_PERVERTEX,
31
- },
32
- doDraw = true,
33
- angleOnSphere = false,
34
- zoomLevelAdaptor = (zoomLevel) => (item) => {
35
- return {
36
- opacityMultiplier: 1,
37
- sizeMultiplier: 1
38
- }
39
- },
40
- } = {}) {
41
- this.globe = globe;
42
- this._itemMap = new Map();
43
- this.doDraw = doDraw;
44
- this.angleOnSphere = angleOnSphere;
45
- this.zoomLevelAdaptor = zoomLevelAdaptor;
46
- this.setStyle(style);
47
-
48
- }
49
-
50
-
51
- setOpacity(opacity) {
52
- opacityCheck(opacity);
53
- this._style.opacity = opacity;
54
- this.globe.DrawRender();
55
- }
56
-
57
- setStyle(style) {
58
- isTextFont(style.textFont);
59
- this._style = style;
60
- this.globe.DrawRender();
61
- }
62
-
63
- /**
64
- *
65
- * @param {{text, long, lat, z = 0, xOffset = 0, yOffset = 0, isAngleOn = false, Angle = 0 }} item
66
- * @returns
67
- */
68
-
69
- insertItem(item) {
70
- const key = this.keyAdaptor ? this.keyAdaptor(item) : item;
71
- this._itemMap.set(key, item);
72
- this.globe.DrawRender();
73
- }
74
-
75
- // TODO: use item style
76
- draw() {
77
- if (!this.doDraw) {
78
- return;
79
- }
80
- const { globe, _itemMap, _style } = this;
81
- const { zMode, textFont, opacity } = _style;
82
- const is3D = globe.api_GetCurrentGeometry() === 0;
83
- const angleIsOn = is3D ? true : this.angleOnSphere;
84
- const zoomLevel = globe.api_GetCurrentLODWithDecimal();
85
- const zoomAdaptor = this.zoomLevelAdaptor(zoomLevel);
86
- const theSize = textFont.size;
87
- _itemMap.forEach((item, key) => {
88
- const { text, long, lat, z = 0, xOffset = 0, yOffset = 0, isAngleOn = false, angle = 0 } = item;
89
- const { x, y } = globe.api_GetScreenPointFromGeo(
90
- {
91
- long,
92
- lat,
93
- z
94
- },
95
- zMode
96
- );
97
- const { opacityMultiplier, sizeMultiplier } = zoomAdaptor(item);
98
- textFont.size = sizeMultiplier * theSize;
99
- if (x !== null && y !== null) {
100
- globe.api_DrawContextText(text, textFont, opacityMultiplier * opacity, { x: x + xOffset, y: y - yOffset }, (isAngleOn && angleIsOn), angle);
101
- }
102
- });
103
- textFont.size = theSize;
104
- }
105
- }
@@ -1,125 +0,0 @@
1
- import { CSZMode } from "@pirireis/webglobe";
2
-
3
- const defaultStyle = {
4
- textFont: {
5
- name: 'Arial',
6
- textColor: '#FFFFFF', // beyaz
7
- hollowColor: '#000000', // siyah
8
- size: 12, // piksel
9
- hollow: true,
10
- bold: true,
11
- italic: false,
12
- },
13
- opacity: 1.0,
14
- zMode: CSZMode.Z_GROUND_PERVERTEX,
15
- }
16
-
17
- export class ContextTextWriter {
18
- constructor(globe, { style = null, doDraw = true } = {}) {
19
- this.globe = globe;
20
- this.itemMap = new Map();
21
- this.style = style || defaultStyle;
22
- this.doDraw = doDraw;
23
-
24
-
25
-
26
- }
27
-
28
-
29
- setDoDraw(bool) {
30
- this.doDraw = bool;
31
- }
32
-
33
- setStyle(style) {
34
- this.style = style;
35
- }
36
-
37
- setOpacity(opacity) {
38
- this.style.opacity = opacity;
39
- }
40
-
41
- // Clean this ask Front dev
42
- doDraw(boolean) {
43
- this.doDraw = boolean;
44
- }
45
-
46
-
47
- draw() {
48
- if (!this.doDraw) return;
49
- const { globe, style, itemMap } = this;
50
- const { textFont, opacity: opacity_ } = style;
51
-
52
- for (const [key, { lat, long, text, opacity = null }] of itemMap) {
53
- const { x, y } = globe.api_GetScreenPointFromGeo(
54
- {
55
- long: long,
56
- lat: lat,
57
- z: 0,
58
- },
59
- style.zMode === CSZMode.Z_MSL,
60
- );
61
- const o = opacity === null ? opacity_ : opacity * opacity_;
62
- if (x !== null && y !== null) globe.api_DrawContextTextMultiLine(text, textFont, o, { x, y });
63
- }
64
- }
65
-
66
-
67
-
68
-
69
- insertText(key, lat, long, text,) {
70
- this.itemMap.set(key, { lat, long, text });
71
- }
72
-
73
-
74
- updateOpacityOfItem(key, opacity) {
75
- this.itemMap.get(key).opacity = opacity;
76
- }
77
-
78
- updateOpacityBulk(items, keyAdaptor, valueAdaptor) {
79
- for (const item of items) {
80
- const key = keyAdaptor(item);
81
- const opacity = valueAdaptor(item);
82
- const data = this.itemMap.get(key)
83
- data.opacity = opacity;
84
- }
85
- }
86
-
87
- updateText(key, text) {
88
- const item = this.itemMap.get(key);
89
- item.text = text;
90
- }
91
-
92
- updateCoords(key, lat, long) {
93
- const item = this.itemMap.get(key);
94
- item.lat = lat; item.long = long;
95
- }
96
-
97
-
98
- insertTextBulk(items) {
99
- for (const item of items) {
100
- this.itemMap.set(item.key, item);
101
- }
102
- }
103
-
104
- updateTextCoordsBulk(items) {
105
- for (const { key, lat, long } of items) {
106
- const item = this.itemMap.get(key);
107
- item.lat = lat; item.long = long;
108
- }
109
- }
110
-
111
-
112
- deleteTextBulk(keys) {
113
- for (const key of keys) {
114
- this.itemMap.delete(key);
115
- }
116
- }
117
-
118
-
119
-
120
- clear() {
121
- this.itemMap.clear();
122
- }
123
- }
124
-
125
-
@@ -1,178 +0,0 @@
1
- import { CSZMode } from "@pirireis/webglobe";
2
- import { isTextFont, opacityCheck } from "../util/check/typecheck";
3
-
4
- /**
5
- * TODOs:
6
- * 1) update all if initials change (propably need a context and a callback to iterate over zPayload)
7
- * 2) expose a mechanic to update text on zoom change
8
- * 3) extend the mechanic on 2 to other events
9
- *
10
- * TODO: key check and raise error if doesnt exist
11
- */
12
- export class ContextTextWriter3 {
13
- constructor(globe, {
14
- style = {
15
- textFont: {
16
- name: 'Arial',
17
- textColor: '#FFFFFF', // beyaz
18
- hollowColor: '#000000', // siyah
19
- size: 12, // piksel
20
- hollow: true,
21
- bold: true,
22
- italic: false,
23
- },
24
- opacity: 1.0,
25
- zMode: CSZMode.Z_GROUND_PERVERTEX,
26
- },
27
- xOffset = 0,
28
- yOffset = 0,
29
- doDraw = true,
30
- textAdaptor = null,
31
- coordinatesAdaptor = null,
32
- keyAdaptor = null,
33
- opacityAdaptor = null,
34
- angleAdaptor = null,
35
- angleOnSphere = false,
36
- positionAdaptor = (item, i, container, properties) => "left",
37
- zoomLevelAdaptor = (zoomLevel) => (item) => {
38
- return {
39
- opacityMultiplier: 1,
40
- sizeMultiplier: 1
41
- }
42
- }
43
- } = {}) {
44
- this.globe = globe;
45
- this.itemMap = new Map();
46
- this.setStyle(style);
47
- this.doDraw = doDraw;
48
- this._checkParameterTypes(textAdaptor, coordinatesAdaptor, keyAdaptor, opacityAdaptor, angleAdaptor, xOffset, yOffset);
49
-
50
- this.textAdaptor = textAdaptor;
51
- this.coordinatesAdaptor = coordinatesAdaptor;
52
- this.keyAdaptor = keyAdaptor;
53
-
54
- this.zoomLevelAdaptor = zoomLevelAdaptor;
55
- this.positionAdaptor = positionAdaptor;
56
- this.opacityAdaptor = opacityAdaptor ? opacityAdaptor : () => 1;
57
- this.angleOnSphere = angleOnSphere;
58
- if (angleAdaptor) {
59
- this.angleAdaptor = angleAdaptor
60
- this.angleAdaptorIsOn = true;
61
- } else {
62
- this.angleAdaptor = () => null
63
- this.angleAdaptorIsOn = false
64
- }
65
-
66
- this.xOffset = xOffset;
67
- this.yOffset = yOffset;
68
- }
69
-
70
- _checkParameterTypes(textAdaptor, coordinatesAdaptor, keyAdaptor, opacityAdaptor, angleAdaptor, xOffset, yOffset) {
71
- if (textAdaptor !== null) if (!(textAdaptor instanceof Function)) throw new Error("textAdaptor is not an instance of a Function");
72
- if (coordinatesAdaptor !== null) if (!(coordinatesAdaptor instanceof Function)) throw new Error("coordinatesAdaptor is not an instance of a Function");
73
- if (keyAdaptor !== null) if (!(keyAdaptor instanceof Function)) throw new Error("keyAdaptor is not an instance of a Function");
74
- if (opacityAdaptor !== null) if (!(opacityAdaptor instanceof Function)) throw new Error("opacityAdaptor is not an instance of a Function");
75
- if (angleAdaptor !== null) if (!(angleAdaptor instanceof Function)) throw new Error("angleAdaptor is not an instance of a Function");
76
- if (typeof xOffset !== "number") throw new Error("xOffset type is not a number");
77
- if (typeof yOffset !== "number") throw new Error("yOffset type is not a number");
78
- }
79
-
80
- setKeyAdaptor(adaptor) {
81
- this.keyAdaptor = adaptor;
82
- }
83
-
84
- setDoDraw(bool) {
85
- this.doDraw = bool;
86
- this.globe.DrawRender();
87
- }
88
-
89
- setStyle(style) {
90
- isTextFont(style.textFont);
91
- opacityCheck(style.opacity); //TODO: use shallow copy
92
- this.style = style;
93
- this.globe.DrawRender();
94
- }
95
-
96
- setOpacity(opacity) {
97
- this.style.opacity = opacity;
98
- this.globe.DrawRender();
99
- }
100
-
101
-
102
-
103
- draw() {
104
- if (!this.doDraw) return;
105
- const { globe, style, itemMap, xOffset, yOffset } = this;
106
- const { textFont, opacity: opacity_ } = style;
107
- const textSize = textFont.size;
108
- const is3D = globe.api_GetCurrentGeometry() === 0;
109
- const angleIsOn = is3D ? (this.angleAdaptorIsOn && this.angleOnSphere) : (this.angleAdaptorIsOn)
110
- const zoomLevel = globe.api_GetCurrentLODWithDecimal();
111
- const zoomAdaptor = this.zoomLevelAdaptor(zoomLevel);
112
- for (const item of itemMap.values()) {
113
- const { lat, long, text, opacity = null, angle = null, zPayload, position } = item;
114
- const { x, y } = globe.api_GetScreenPointFromGeo(
115
- {
116
- long: long,
117
- lat: lat,
118
- z: 0,
119
- },
120
- style.zMode === CSZMode.Z_MSL,
121
- );
122
- const { opacityMultiplier, sizeMultiplier } = zoomAdaptor(zPayload);
123
- const o = (opacity === null ? opacity_ : opacity * opacity_) * opacityMultiplier;
124
- textFont.size = sizeMultiplier * textSize;
125
- textFont.position = position;
126
- if (x !== null && y !== null) globe.api_DrawContextTextMultiLine(text, textFont, o, { x: x + xOffset, y: y - yOffset }, angleIsOn, angle);
127
- }
128
- textFont.size = textSize;
129
- }
130
-
131
-
132
-
133
-
134
- insertTextBulk(container, properties) {
135
- container.forEach((v, i, c) => {
136
- this.insertText(v, i, c, properties);
137
- });
138
- }
139
-
140
-
141
-
142
- deleteTextBulk(keys) {
143
- for (const key of keys) {
144
- this.itemMap.delete(key);
145
- }
146
- }
147
-
148
-
149
- insertText(item, id, container, properties) {
150
- const key = this.keyAdaptor(item, id, container, properties)
151
- const coords = this.coordinatesAdaptor(item, id, container, properties)
152
- if (coords == null) {
153
- this.itemMap.delete(key);
154
- return;
155
- }
156
- const text = this.textAdaptor(item, id, container, properties)
157
- if (text == null) {
158
- this.itemMap.delete(key);
159
- return
160
- };
161
- const opacity = this.opacityAdaptor(item, id, container, properties);
162
- const angle = this.angleAdaptor(item, id, container, properties);
163
- const position = this.positionAdaptor(item, id, container, properties);
164
- this.itemMap.set(key, { long: coords.long, lat: coords.lat, text, opacity, angle, zPayload: item, position });
165
- }
166
-
167
-
168
- clear() {
169
- this.itemMap.clear();
170
- }
171
-
172
-
173
- free() {
174
- this.itemMap = null;
175
- }
176
- }
177
-
178
-
@@ -1 +0,0 @@
1
- export { ContextTextWriter } from "./context-text";
@@ -1,7 +0,0 @@
1
- /**
2
- * registerMap(id, aMap, textFont)
3
- * aMap key, object map.
4
- * aMap is a specifical tem for a use case.
5
- * The object has { text, long, lat, opacity, angle, zPayload, achor, xOffset, yOffset, ...extraPropertiesForZoomLevelAdaptor } properties.
6
- * the plugin runs over items in aMap and draw text on the globe.
7
- */