@pirireis/webglobeplugins 0.9.8 → 0.9.9

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 (213) hide show
  1. package/index.js +58 -15
  2. package/package.json +1 -1
  3. package/dist/Math/angle-calculation.js +0 -15
  4. package/dist/Math/arc.js +0 -65
  5. package/dist/Math/bounds/line-bbox.js +0 -188
  6. package/dist/Math/constants.js +0 -9
  7. package/dist/Math/frustum/camera.js +0 -24
  8. package/dist/Math/frustum/from-globeinfo.js +0 -48
  9. package/dist/Math/frustum/types.js +0 -2
  10. package/dist/Math/globe-util/horizon-plane.js +0 -112
  11. package/dist/Math/index.js +0 -1
  12. package/dist/Math/juction/arc-plane.js +0 -83
  13. package/dist/Math/juction/line-sphere.js +0 -25
  14. package/dist/Math/juction/plane-plane.js +0 -58
  15. package/dist/Math/line.js +0 -56
  16. package/dist/Math/matrix4.js +0 -1
  17. package/dist/Math/methods.js +0 -201
  18. package/dist/Math/plane.js +0 -60
  19. package/dist/Math/quaternion.js +0 -104
  20. package/dist/Math/types.js +0 -2
  21. package/dist/Math/utils.js +0 -4
  22. package/dist/Math/vec3.js +0 -126
  23. package/dist/algorithms/search-binary.js +0 -19
  24. package/dist/altitude-locator/adaptors.js +0 -1
  25. package/dist/altitude-locator/draw-subset-obj.js +0 -18
  26. package/dist/altitude-locator/keymethod.js +0 -1
  27. package/dist/altitude-locator/plugin.js +0 -341
  28. package/dist/altitude-locator/types.js +0 -23
  29. package/dist/arrowfield/adaptor.js +0 -14
  30. package/dist/arrowfield/index.js +0 -10
  31. package/dist/arrowfield/plugin.js +0 -86
  32. package/dist/bearing-line/index.js +0 -8
  33. package/dist/bearing-line/plugin.js +0 -449
  34. package/dist/circle-line-chain/chain-list-map.js +0 -205
  35. package/dist/circle-line-chain/init.js +0 -1
  36. package/dist/circle-line-chain/plugin.js +0 -424
  37. package/dist/circle-line-chain/util.js +0 -5
  38. package/dist/compass-rose/compass-rose-padding-flat.js +0 -225
  39. package/dist/compass-rose/compass-text-writer.js +0 -153
  40. package/dist/compass-rose/index.js +0 -7
  41. package/dist/compassrose/compassrose.js +0 -296
  42. package/dist/compassrose/index.js +0 -8
  43. package/dist/globe-types.js +0 -1
  44. package/dist/heatwave/index.js +0 -10
  45. package/dist/heatwave/isobar/objectarraylabels.js +0 -202
  46. package/dist/heatwave/isobar/plugin.js +0 -343
  47. package/dist/heatwave/isobar/quadtreecontours.js +0 -300
  48. package/dist/heatwave/plugins/heatwaveglobeshell.js +0 -206
  49. package/dist/index.js +0 -58
  50. package/dist/jest.config.js +0 -7
  51. package/dist/partialrings/buffer-manager.js +0 -81
  52. package/dist/partialrings/index.js +0 -41
  53. package/dist/partialrings/plugin.js +0 -135
  54. package/dist/partialrings/program.js +0 -286
  55. package/dist/pin/pin-object-array.js +0 -305
  56. package/dist/pin/pin-point-totem.js +0 -60
  57. package/dist/point-heat-map/adaptors/timetracksplugin-format-to-this.js +0 -66
  58. package/dist/point-heat-map/index.js +0 -1
  59. package/dist/point-heat-map/plugin-webworker.js +0 -126
  60. package/dist/point-heat-map/point-to-heat-map-flow.js +0 -127
  61. package/dist/point-tracks/key-methods.js +0 -5
  62. package/dist/point-tracks/plugin.js +0 -338
  63. package/dist/programs/arrowfield/index.js +0 -7
  64. package/dist/programs/arrowfield/logic.js +0 -257
  65. package/dist/programs/arrowfield/object.js +0 -66
  66. package/dist/programs/data2legend/density-to-legend.js +0 -101
  67. package/dist/programs/data2legend/point-to-density-texture.js +0 -100
  68. package/dist/programs/float2legendwithratio/index.js +0 -8
  69. package/dist/programs/float2legendwithratio/logic.js +0 -171
  70. package/dist/programs/float2legendwithratio/object.js +0 -110
  71. package/dist/programs/globe-util/is-globe-moved.js +0 -21
  72. package/dist/programs/globeshell/index.js +0 -8
  73. package/dist/programs/globeshell/noise/noises.js +0 -1
  74. package/dist/programs/globeshell/wiggle/index.js +0 -8
  75. package/dist/programs/globeshell/wiggle/logic.js +0 -345
  76. package/dist/programs/globeshell/wiggle/object.js +0 -72
  77. package/dist/programs/helpers/blender/index.js +0 -1
  78. package/dist/programs/helpers/blender/program.js +0 -79
  79. package/dist/programs/helpers/fadeaway/index.js +0 -7
  80. package/dist/programs/helpers/fadeaway/logic.js +0 -72
  81. package/dist/programs/helpers/fadeaway/object.js +0 -20
  82. package/dist/programs/helpers/index.js +0 -8
  83. package/dist/programs/index.js +0 -58
  84. package/dist/programs/interface.js +0 -1
  85. package/dist/programs/line-on-globe/angled-line.js +0 -176
  86. package/dist/programs/line-on-globe/circle-accurate-3d.js +0 -141
  87. package/dist/programs/line-on-globe/circle-accurate-flat.js +0 -216
  88. package/dist/programs/line-on-globe/circle-accurate.js +0 -178
  89. package/dist/programs/line-on-globe/circle.js +0 -167
  90. package/dist/programs/line-on-globe/degree-padding-around-circle-3d.js +0 -159
  91. package/dist/programs/line-on-globe/index.js +0 -1
  92. package/dist/programs/line-on-globe/lines-color-instanced-flat.js +0 -136
  93. package/dist/programs/line-on-globe/linestrip.js +0 -171
  94. package/dist/programs/line-on-globe/naive-accurate-flexible.js +0 -195
  95. package/dist/programs/line-on-globe/to-the-surface.js +0 -111
  96. package/dist/programs/line-on-globe/util.js +0 -8
  97. package/dist/programs/picking/pickable-renderer.js +0 -188
  98. package/dist/programs/point-on-globe/element-globe-surface-glow.js +0 -142
  99. package/dist/programs/point-on-globe/element-point-glow.js +0 -153
  100. package/dist/programs/point-on-globe/square-pixel-point.js +0 -174
  101. package/dist/programs/programcache.js +0 -131
  102. package/dist/programs/rings/distancering/circleflatprogram.js +0 -156
  103. package/dist/programs/rings/distancering/circlepaddingfreeangleprogram.js +0 -369
  104. package/dist/programs/rings/distancering/circlepaddysharedbuffer.js +0 -357
  105. package/dist/programs/rings/distancering/index.js +0 -14
  106. package/dist/programs/rings/distancering/paddyflatprogram.js +0 -172
  107. package/dist/programs/rings/distancering/paddyflatprogram2d.js +0 -174
  108. package/dist/programs/rings/distancering/paddyflatprogram3d.js +0 -172
  109. package/dist/programs/rings/distancering/shader.js +0 -1
  110. package/dist/programs/rings/index.js +0 -17
  111. package/dist/programs/rings/partial-ring/piece-of-pie.js +0 -275
  112. package/dist/programs/totems/camerauniformblock.js +0 -160
  113. package/dist/programs/totems/canvas-webglobe-info.js +0 -110
  114. package/dist/programs/totems/gpu-selection-uniform-block.js +0 -108
  115. package/dist/programs/totems/index.js +0 -40
  116. package/dist/programs/two-d/pixel-circle.js +0 -1
  117. package/dist/programs/two-d/pixel-padding-for-compass.js +0 -162
  118. package/dist/programs/util.js +0 -17
  119. package/dist/programs/vectorfields/index.js +0 -23
  120. package/dist/programs/vectorfields/logics/drawrectangleparticles.js +0 -107
  121. package/dist/programs/vectorfields/logics/index.js +0 -12
  122. package/dist/programs/vectorfields/logics/pixelbased.js +0 -142
  123. package/dist/programs/vectorfields/logics/ubo.js +0 -63
  124. package/dist/programs/vectorfields/pingpongbuffermanager.js +0 -76
  125. package/dist/rangerings/enum.js +0 -5
  126. package/dist/rangerings/index.js +0 -15
  127. package/dist/rangerings/plugin.js +0 -560
  128. package/dist/rangerings/rangeringangletext.js +0 -329
  129. package/dist/rangerings/ring-account.js +0 -117
  130. package/dist/shaders/fragment-toy/firework.js +0 -58
  131. package/dist/shaders/fragment-toy/singularity.js +0 -59
  132. package/dist/shape-on-terrain/arc/naive/plugin.js +0 -252
  133. package/dist/timetracks/adaptors-line-strip.js +0 -71
  134. package/dist/timetracks/adaptors.js +0 -122
  135. package/dist/timetracks/index.js +0 -19
  136. package/dist/timetracks/plugin-line-strip.js +0 -250
  137. package/dist/timetracks/plugin.js +0 -258
  138. package/dist/timetracks/program-line-strip.js +0 -611
  139. package/dist/timetracks/program.js +0 -772
  140. package/dist/timetracks/programpoint-line-strip.js +0 -154
  141. package/dist/timetracks/programpoint.js +0 -147
  142. package/dist/types.js +0 -15
  143. package/dist/util/account/bufferoffsetmanager.js +0 -179
  144. package/dist/util/account/index.js +0 -23
  145. package/dist/util/account/single-attribute-buffer-management/buffer-manager.js +0 -108
  146. package/dist/util/account/single-attribute-buffer-management/buffer-orchestrator.js +0 -150
  147. package/dist/util/account/single-attribute-buffer-management/index.js +0 -9
  148. package/dist/util/account/single-attribute-buffer-management/object-store.js +0 -51
  149. package/dist/util/account/single-attribute-buffer-management/types.js +0 -2
  150. package/dist/util/account/util.js +0 -22
  151. package/dist/util/algorithms/index.js +0 -1
  152. package/dist/util/algorithms/search-binary.js +0 -28
  153. package/dist/util/check/get.js +0 -18
  154. package/dist/util/check/index.js +0 -1
  155. package/dist/util/check/typecheck.js +0 -49
  156. package/dist/util/geometry/index.js +0 -51
  157. package/dist/util/gl-util/buffer/attribute-loader.js +0 -69
  158. package/dist/util/gl-util/buffer/index.js +0 -6
  159. package/dist/util/gl-util/buffer/types.js +0 -1
  160. package/dist/util/gl-util/draw-options/methods.js +0 -38
  161. package/dist/util/gl-util/draw-options/types.js +0 -15
  162. package/dist/util/gl-util/uniform-block/manager.js +0 -156
  163. package/dist/util/gl-util/uniform-block/shader.js +0 -1
  164. package/dist/util/gl-util/uniform-block/types.js +0 -8
  165. package/dist/util/heatwavedatamanager/datamanager.js +0 -152
  166. package/dist/util/heatwavedatamanager/index.js +0 -10
  167. package/dist/util/heatwavedatamanager/pointcoordinatesdatacalculator.js +0 -122
  168. package/dist/util/heatwavedatamanager/pointcoordsmeta.js +0 -20
  169. package/dist/util/index.js +0 -57
  170. package/dist/util/interpolation/index.js +0 -1
  171. package/dist/util/interpolation/timetrack/index.js +0 -5
  172. package/dist/util/interpolation/timetrack/timetrack-interpolator.js +0 -79
  173. package/dist/util/interpolation/timetrack/web-worker-str.js +0 -183
  174. package/dist/util/interpolation/timetrack/web-worker.js +0 -48
  175. package/dist/util/jshelpers/data-filler.js +0 -20
  176. package/dist/util/jshelpers/equality.js +0 -20
  177. package/dist/util/jshelpers/index.js +0 -37
  178. package/dist/util/jshelpers/timefilters.js +0 -32
  179. package/dist/util/picking/fence.js +0 -46
  180. package/dist/util/picking/picker-displayer.js +0 -139
  181. package/dist/util/programs/draw-texture-on-canvas.js +0 -89
  182. package/dist/util/programs/index.js +0 -17
  183. package/dist/util/programs/shapesonglobe.js +0 -214
  184. package/dist/util/programs/supersampletotextures.js +0 -113
  185. package/dist/util/programs/texturetoglobe.js +0 -182
  186. package/dist/util/shaderfunctions/geometrytransformations.js +0 -340
  187. package/dist/util/shaderfunctions/index.js +0 -18
  188. package/dist/util/shaderfunctions/nodata.js +0 -11
  189. package/dist/util/shaderfunctions/noisefunctions.js +0 -43
  190. package/dist/util/surface-line-data/arc-bboxes.js +0 -25
  191. package/dist/util/surface-line-data/arcs-to-cuts.js +0 -50
  192. package/dist/util/surface-line-data/cut-arc.js +0 -1
  193. package/dist/util/surface-line-data/flow.js +0 -28
  194. package/dist/util/surface-line-data/rbush-manager.js +0 -1
  195. package/dist/util/surface-line-data/types.js +0 -1
  196. package/dist/util/surface-line-data/web-worker.js +0 -1
  197. package/dist/util/webglobe/gldefaultstates.js +0 -7
  198. package/dist/util/webglobe/index.js +0 -18
  199. package/dist/util/webglobe/rasteroverlay.js +0 -78
  200. package/dist/util/webglobjectbuilders.js +0 -388
  201. package/dist/util/webglobjectbuilders1.js +0 -237
  202. package/dist/waveparticles/adaptor.js +0 -17
  203. package/dist/waveparticles/index.js +0 -10
  204. package/dist/waveparticles/plugin.js +0 -266
  205. package/dist/wind/imagetovectorfieldandmagnitude.js +0 -35
  206. package/dist/wind/index.js +0 -14
  207. package/dist/wind/plugin.js +0 -926
  208. package/dist/wind/vectorfieldimage.js +0 -25
  209. package/dist/write-text/attached-text-writer.js +0 -91
  210. package/dist/write-text/context-text.js +0 -98
  211. package/dist/write-text/context-text3.js +0 -155
  212. package/dist/write-text/index.js +0 -5
  213. package/dist/write-text/writer-plugin.js +0 -8
@@ -1,449 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RINGPARTIAL_DRAW_MODE = void 0;
4
- const piece_of_pie_1 = require("../programs/rings/partial-ring/piece-of-pie");
5
- const naive_accurate_flexible_1 = require("../programs/line-on-globe/naive-accurate-flexible");
6
- const circle_accurate_3d_1 = require("../programs/line-on-globe/circle-accurate-3d");
7
- const circle_accurate_flat_1 = require("../programs/line-on-globe/circle-accurate-flat");
8
- const account_1 = require("../util/account");
9
- const get_1 = require("../util/check/get");
10
- const data_filler_1 = require("../util/jshelpers/data-filler");
11
- const context_text3_1 = require("../write-text/context-text3");
12
- const typecheck_1 = require("../util/check/typecheck");
13
- const geometry_1 = require("../util/geometry");
14
- const attribute_loader_1 = require("../util/gl-util/buffer/attribute-loader");
15
- exports.RINGPARTIAL_DRAW_MODE = Object.freeze({
16
- LINE_STRIP: "LINE_STRIP",
17
- TRIANGLE_FAN: "TRIANGLE_FAN",
18
- });
19
- /**
20
- * @typedef {{key, long, lat, endLong, endLat, bearingAngle, radius, rgba:[4numbers], rgbaMode, bigRadius, dashRatio, dashOpacity, circleDashAngle}} BearingLineItem
21
- * @property {string} key
22
- * @property {number} long
23
- * @property {number} lat
24
- * @property {number} endLong
25
- * @property {number} endLat
26
- * @property {number} bearingAngle 0-360
27
- * @property {number} radius angle ring radius
28
- * @property {number} altitude in meters effects all parts of the item
29
- * @property {Array<numbers>} rgba [r,g,b,a] 0-1
30
- * @property {number} rgbaMode 0 constant, 1 fading, 2 hides angle ring
31
- * @property {number} bigRadius undefined means it will be calculated from long, lat, endLong, endLat
32
- * @property {number} dashRatio 0-1
33
- * @property {number} dashOpacity 0-1
34
- * @property {number} circleDashAngle 0-360
35
- */
36
- const textWriterGetOrThrow = (0, get_1.mapGetOrThrow)("BearingLine textContextInjection id does not exist in map");
37
- const radian = (degree) => degree * Math.PI / 180;
38
- const integralSec = (angle) => {
39
- return Math.log(Math.tan(angle / 2 + Math.PI / 4));
40
- };
41
- const calculateStartAngle = (long, lat, endLong, endLat) => {
42
- const dLat = (integralSec(endLat) - integralSec(lat)); // Because lines are strectes toward poles.
43
- const dLong = endLong - long;
44
- let angle = -Math.atan2(dLat, dLong);
45
- return angle;
46
- };
47
- class BearingLinePlugin {
48
- /**
49
- * @param {*} id
50
- * @param {Map<[key, ContextTextWriter3]>} textWritersMap
51
- */
52
- constructor(id, { opacity = 1, textWritersMap = new Map(), textDataPreAdaptor = (x) => x, drawVRM = true, drawBearingLine = true, drawAngleRing = true, drawText = true, circleFlatEdgeCount = circle_accurate_flat_1.EDGE_COUNT - 2 } = {}) {
53
- this.id = id;
54
- this._opacity = opacity;
55
- this.bufferOrchestrator = new account_1.BufferOrchestrator({ capacity: 10 });
56
- this._checkTextContextWriterInjectionMap(textWritersMap);
57
- this._textWritersMap = textWritersMap;
58
- this._textWritersMap.forEach((writer) => writer.keyAdaptor = (item) => item.key);
59
- this.drawVRM = drawVRM;
60
- this.drawBearingLine = drawBearingLine;
61
- this.drawAngleRing = drawAngleRing;
62
- this._textDataPreAdaptor = textDataPreAdaptor;
63
- this.drawText = drawText;
64
- this._memoryForText = new Map();
65
- this.circleFlatEdgeCount = circleFlatEdgeCount + 2;
66
- }
67
- setDoDrawVRM(bool) {
68
- (0, typecheck_1.isBoolean)(bool);
69
- if (bool === this.drawVRM)
70
- return;
71
- this.drawVRM = bool;
72
- this.globe.DrawRender();
73
- }
74
- setDoDrawText(bool) {
75
- (0, typecheck_1.isBoolean)(bool);
76
- if (bool === this.drawText)
77
- return;
78
- this.drawText = bool;
79
- this.globe.DrawRender();
80
- }
81
- setDoDrawText(bool) {
82
- (0, typecheck_1.isBoolean)(bool);
83
- if (bool === this.drawText)
84
- return;
85
- this.drawText = bool;
86
- this.globe.DrawRender();
87
- }
88
- setDoDrawAngleRing(bool) {
89
- (0, typecheck_1.isBoolean)(bool);
90
- if (bool === this.drawAngleRing)
91
- return;
92
- this.drawAngleRing = bool;
93
- this.globe.DrawRender();
94
- }
95
- setOpacity(opacity) {
96
- (0, typecheck_1.constraintFloat)(opacity, 0, 1);
97
- this._opacity = opacity;
98
- this._textWritersMap.forEach((writer) => writer.setOpacity(opacity));
99
- this.globe.DrawRender();
100
- }
101
- /**
102
-
103
- * @param {Array<BearingLineItem>} items
104
- * @param {Array<string>} textWriterIDs | textWritersMap keys to be used for writing text.
105
- */
106
- insertBulk(items, { textWriterIDs = [] } = {}) {
107
- const { globe, bufferOrchestrator, bufferManagersCompMap } = this; // angleTextContext, distanceTextContext,
108
- const data = [];
109
- for (let item of items) {
110
- data.push(this.__insertAdaptor(item));
111
- }
112
- bufferOrchestrator.insertBulk(data, bufferManagersCompMap);
113
- this.__insertTexts(items, textWriterIDs);
114
- globe.DrawRender();
115
- }
116
- /**
117
- * @param {Array<string>} textWriterIDs | textWritersMap keys to be used for writing text.
118
- * @param {Array<string>} itemKeys | if empty, all texts will be updated.
119
- */
120
- updateText(textWriterIDs = [], itemKeys = null) {
121
- const textWritersMap = textWriterGetOrThrow(this._textWritersMap, textWriterIDs);
122
- if (itemKeys === null) {
123
- this._memoryForText.forEach((item) => {
124
- let _item = this._textDataPreAdaptor(item);
125
- textWritersMap.forEach((writer) => writer.insertText(_item));
126
- });
127
- }
128
- else {
129
- itemKeys.forEach((key) => {
130
- let item = this._memoryForText.get(key);
131
- if (item === undefined)
132
- return;
133
- let _item = this._textDataPreAdaptor(item);
134
- textWritersMap.forEach((writer) => writer.insertText(_item));
135
- });
136
- }
137
- this.globe.DrawRender();
138
- }
139
- deleteBulk(keys) {
140
- this.bufferOrchestrator.deleteBulk(keys, this.bufferManagersCompMap);
141
- for (const key of keys) {
142
- this._memoryForText.delete(key);
143
- }
144
- this._deleteTexts(keys);
145
- this.globe.DrawRender();
146
- }
147
- defrag() {
148
- this.bufferOrchestrator.defrag(this.bufferManagersCompMap);
149
- }
150
- /**
151
- * @param {Array<{key, long, lat, endLong, endLat, bearingAngle}>} items
152
- * @param {Array<string>} textWriterIDs | textWritersMap keys to be used for writing text.
153
- */
154
- updateCoordinatesBulk(items, { textWriterIDs = [] } = {}) {
155
- const { globe, bufferOrchestrator, bufferManagersCompMap, } = this;
156
- const data = [];
157
- for (let item of items) {
158
- data.push(this.__updateCoordsAdaptor(item));
159
- }
160
- this.__insertTexts(items, textWriterIDs);
161
- bufferOrchestrator.updateBulk(data, bufferManagersCompMap, ["centerCoords2d", "centerCoords3d", "targetCoords2d", "targetCoords3d",
162
- "startAngle2d", "tailAngle2d", "startAngle3d", "tailAngle3d", "bearingTargetCoords2d", "bearingTargetCoords3d", "centerCoords2dflat",
163
- "bigRadius", "radius"]);
164
- globe.DrawRender();
165
- }
166
- /**
167
- *
168
- * @param {Array<BearingLineItem>} items some colums EXCEPT positional ones
169
- * @param {string} propertyIDs
170
- * @param {string} textWriterIDs
171
- * Do NOT send empty data if property ID of this data is entered or NaN is loaded to the buffer, resulting in an unwanted behaviour.
172
- *{ textWriterIDs = []}
173
- */
174
- updatePartial(items, propertyIDs = [], { textWriterIDs = [] } = {}) {
175
- if (propertyIDs.length === 0)
176
- console.warn("updatePartial is called with no target propertyIDs");
177
- const fixedPropertyIDs = this.__fixPartialProperties(propertyIDs);
178
- const { bufferOrchestrator, bufferManagersCompMap } = this;
179
- bufferOrchestrator.updateBulk(items, bufferManagersCompMap, fixedPropertyIDs);
180
- // patch to update text opacity
181
- this.__insertTexts(items, textWriterIDs);
182
- this.globe.DrawRender();
183
- }
184
- // Private methods
185
- _checkTextContextWriterInjectionMap(textContextWriterInjectionMap) {
186
- if (!(textContextWriterInjectionMap instanceof Map))
187
- throw new Error("textContextWriterInjectionMap is not an instance of Map");
188
- textContextWriterInjectionMap.forEach((v) => {
189
- if (!(v instanceof context_text3_1.ContextTextWriter3))
190
- throw new Error("textContextWriterInjectionMap element is not an instance of ContextTextWriter3");
191
- });
192
- }
193
- __insertTexts(items, textWriterIDs) {
194
- const textWritersMap = textWriterGetOrThrow(this._textWritersMap, textWriterIDs);
195
- for (const item of items) {
196
- const oldItem = this._memoryForText.get(item.key);
197
- let _item = oldItem !== undefined ? { ...oldItem, ...item } : item;
198
- this._memoryForText.set(item.key, _item);
199
- if (this._textDataPreAdaptor !== null)
200
- _item = this._textDataPreAdaptor(_item);
201
- textWritersMap.forEach((writer) => writer.insertText(_item));
202
- }
203
- }
204
- __insertAdaptor(item) {
205
- const rgba = item.rgba !== undefined ? item.rgba : [0, 0, 0, 0];
206
- const rgbaMode = item.rgbaMode !== undefined ? item.rgbaMode : 0;
207
- const dashRatio = item.dashRatio !== undefined ? item.dashRatio : 1.0;
208
- const dashOpacity = item.dashOpacity !== undefined ? item.dashOpacity : 0.9;
209
- const circleDashAngle = item.circleDashAngle !== undefined ? item.circleDashAngle : 360;
210
- const coordsData = this.__updateCoordsAdaptor(item);
211
- return {
212
- ...coordsData,
213
- rgba,
214
- dashRatio,
215
- dashOpacity,
216
- circleDashAngle,
217
- rgbaMode
218
- };
219
- }
220
- __updateCoordsAdaptor(item) {
221
- var _a, _b;
222
- const { globe } = this;
223
- const lat = radian(item.lat);
224
- const long = radian(item.long);
225
- const endLat = radian(item.endLat);
226
- const endLong = radian(item.endLong);
227
- const altitude = ((_a = item.altitude) !== null && _a !== void 0 ? _a : 0) / 1000;
228
- const bigRadius = (_b = item.bigRadius) !== null && _b !== void 0 ? _b : globe.Math.GetDist2D(item.long, item.lat, item.endLong, item.endLat);
229
- const radius = item.radius !== undefined ? item.radius : bigRadius * 0.2;
230
- const { long: bearingLong, lat: bearingLat } = globe.Math.FindPointByPolar(item.long, item.lat, bigRadius, item.bearingAngle);
231
- const startAngle2d = calculateStartAngle(long, lat, endLong, endLat);
232
- const bearingAngle2d = calculateStartAngle(long, lat, radian(bearingLong), radian(bearingLat));
233
- let tailAngle2d = bearingAngle2d - startAngle2d;
234
- if (tailAngle2d > 0) {
235
- tailAngle2d -= Math.PI * 2;
236
- }
237
- const bearingAngle = radian(item.bearingAngle - 90);
238
- const startAngleOfCircle = globe.Math.GetAzimuthAngle(item.long, item.lat, item.endLong, item.endLat); //startAngle2d * 180 / Math.PI;
239
- const startAngle3d = radian(startAngleOfCircle) - radian(90);
240
- let tailAngle3d = bearingAngle - startAngle3d;
241
- if (tailAngle3d > 0) {
242
- tailAngle3d -= Math.PI * 2;
243
- }
244
- const centerCoords2dflat = (0, circle_accurate_flat_1.centerCoords2dflatDataCreator)(globe, item.long, item.lat, item.endLong, item.endLat, { startAngleOfCircle, edgeCount: this.circleFlatEdgeCount });
245
- return {
246
- key: item.key,
247
- lat: item.lat,
248
- long: item.long,
249
- endLat: item.endLat,
250
- endLong: item.endLong,
251
- altitude,
252
- bearingAngle,
253
- radius,
254
- bigRadius,
255
- startAngle2d,
256
- tailAngle2d,
257
- startAngle3d,
258
- tailAngle3d,
259
- bearingLong,
260
- bearingLat,
261
- centerCoords2dflat
262
- };
263
- }
264
- __fixPartialProperties(propertyIDs) {
265
- const s = new Set(["rgba", "dashOpacity", "circleDashAngle"]);
266
- const result = [];
267
- for (const item of propertyIDs) {
268
- result.push(item);
269
- if (s.has(item)) {
270
- result.push(item + "Mercator");
271
- }
272
- }
273
- return result;
274
- }
275
- // Globe API
276
- init(globe, gl) {
277
- this.gl = gl;
278
- this.globe = globe;
279
- this.lineProgram = naive_accurate_flexible_1.LineOnGlobeCache.get(globe);
280
- this.pieceOfPieProgram = piece_of_pie_1.PieceOfPieProgramCache.get(globe);
281
- this.circleProgram = circle_accurate_flat_1.CircleCache.get(globe);
282
- this.circle3DProgram = circle_accurate_3d_1.CircleCache.get(globe);
283
- const circleFlatEdgeCount = this.circleFlatEdgeCount;
284
- {
285
- // createBuffers
286
- const bufferType = "DYNAMIC_DRAW";
287
- const initialCapacity = this.bufferOrchestrator.capacity;
288
- this.bufferManagersCompMap = new Map([
289
- ["centerCoords2d", {
290
- 'bufferManager': new account_1.BufferManager(gl, 2, { bufferType, initialCapacity }),
291
- 'adaptor': (item) => new Float32Array(globe.api_GetMercator2DPoint(item.long, item.lat)),
292
- }],
293
- ["centerCoords2dflat", {
294
- 'bufferManager': new account_1.BufferManager(gl, circleFlatEdgeCount * 2, { bufferType, initialCapacity }),
295
- 'adaptor': (item) => item.centerCoords2dflat,
296
- }],
297
- ["centerCoords3d", {
298
- 'bufferManager': new account_1.BufferManager(gl, 3, { bufferType, initialCapacity }),
299
- 'adaptor': (item) => (0, geometry_1.sphereCoord)(item.long, item.lat, globe, item.altitude),
300
- }],
301
- ["targetCoords2d", {
302
- 'bufferManager': new account_1.BufferManager(gl, 2, { bufferType, initialCapacity }),
303
- 'adaptor': (item) => new Float32Array(globe.api_GetMercator2DPoint(item.endLong, item.endLat))
304
- }],
305
- ["targetCoords3d", {
306
- 'bufferManager': new account_1.BufferManager(gl, 3, { bufferType, initialCapacity }),
307
- 'adaptor': (item) => (0, geometry_1.sphereCoord)(item.endLong, item.endLat, globe, item.altitude)
308
- }],
309
- ["bearingTargetCoords2d", {
310
- 'bufferManager': new account_1.BufferManager(gl, 2, { bufferType, initialCapacity }),
311
- 'adaptor': (item) => new Float32Array(globe.api_GetMercator2DPoint(item.bearingLong, item.bearingLat))
312
- }],
313
- ["bearingTargetCoords3d", {
314
- 'bufferManager': new account_1.BufferManager(gl, 3, { bufferType, initialCapacity }),
315
- 'adaptor': (item) => (0, geometry_1.sphereCoord)(item.bearingLong, item.bearingLat, globe, item.altitude)
316
- }],
317
- ["startAngle2d", {
318
- 'bufferManager': new account_1.BufferManager(gl, 1, { bufferType, initialCapacity }),
319
- 'adaptor': (item) => new Float32Array([item.startAngle2d])
320
- }],
321
- ["tailAngle2d", {
322
- 'bufferManager': new account_1.BufferManager(gl, 1, { bufferType, initialCapacity }),
323
- 'adaptor': (item) => new Float32Array([item.tailAngle2d])
324
- }],
325
- ["startAngle3d", {
326
- 'bufferManager': new account_1.BufferManager(gl, 1, { bufferType, initialCapacity }),
327
- 'adaptor': (item) => new Float32Array([item.startAngle3d])
328
- }],
329
- ["tailAngle3d", {
330
- 'bufferManager': new account_1.BufferManager(gl, 1, { bufferType, initialCapacity }),
331
- 'adaptor': (item) => new Float32Array([item.tailAngle3d])
332
- }],
333
- ["bearingDashRatio", {
334
- 'bufferManager': new account_1.BufferManager(gl, 1, { bufferType, initialCapacity }),
335
- 'adaptor': (item) => new Float32Array([0])
336
- }],
337
- ["rgba", {
338
- 'bufferManager': new account_1.BufferManager(gl, 4, { bufferType, initialCapacity }),
339
- 'adaptor': (item) => new Float32Array(item.rgba)
340
- }],
341
- ["radius", {
342
- 'bufferManager': new account_1.BufferManager(gl, 1, { bufferType, initialCapacity }),
343
- 'adaptor': (item) => new Float32Array([item.radius])
344
- }],
345
- ["rgbaMode", {
346
- 'bufferManager': new account_1.BufferManager(gl, 1, { bufferType, initialCapacity }),
347
- 'adaptor': (item) => new Float32Array([item.rgbaMode])
348
- }],
349
- ["dashRatio", {
350
- 'bufferManager': new account_1.BufferManager(gl, 1, { bufferType, initialCapacity }),
351
- 'adaptor': (item) => new Float32Array([item.dashRatio])
352
- }],
353
- ["bigRadius", {
354
- 'bufferManager': new account_1.BufferManager(gl, 1, { bufferType, initialCapacity }),
355
- 'adaptor': (item) => new Float32Array([item.bigRadius])
356
- }],
357
- ["dashOpacity", {
358
- 'bufferManager': new account_1.BufferManager(gl, 1, { bufferType, initialCapacity }),
359
- 'adaptor': (item) => new Float32Array([item.dashOpacity]),
360
- }],
361
- ["circleDashAngle", {
362
- 'bufferManager': new account_1.BufferManager(gl, 1, { bufferType, initialCapacity }),
363
- 'adaptor': (item) => new Float32Array([item.circleDashAngle / 360]),
364
- }],
365
- // Mercator circle properties are duplicated for the sake of performance.
366
- ["rgbaMercator", {
367
- 'bufferManager': new account_1.BufferManager(gl, 4 * circleFlatEdgeCount, { bufferType, initialCapacity }),
368
- 'adaptor': (item) => data_filler_1.populateFloat32Array.fillWithListData(circleFlatEdgeCount, item.rgba),
369
- }],
370
- ["circleDashAngleMercator", {
371
- 'bufferManager': new account_1.BufferManager(gl, circleFlatEdgeCount, { bufferType, initialCapacity }),
372
- 'adaptor': (item) => data_filler_1.populateFloat32Array.fillFloat32Array(circleFlatEdgeCount, item.circleDashAngle / 360),
373
- }],
374
- ["dashOpacityMercator", {
375
- 'bufferManager': new account_1.BufferManager(gl, circleFlatEdgeCount, { bufferType, initialCapacity }),
376
- 'adaptor': (item) => data_filler_1.populateFloat32Array.fillFloat32Array(circleFlatEdgeCount, item.dashOpacity),
377
- }],
378
- ]);
379
- }
380
- const vaoOBJ = (key) => (0, attribute_loader_1.createBufferAndReadInfo)(this.bufferManagersCompMap.get(key).bufferManager.buffer);
381
- this.lineVao = this.lineProgram.createVAO(...['centerCoords2d', 'centerCoords3d', 'targetCoords2d', 'targetCoords3d', 'dashOpacity', 'dashOpacity', 'rgba'].map(key => vaoOBJ(key)));
382
- this.ringVao = this.pieceOfPieProgram.createVAO(...['centerCoords2d',
383
- 'centerCoords3d',
384
- 'startAngle2d',
385
- 'tailAngle2d',
386
- 'startAngle3d',
387
- 'tailAngle3d',
388
- 'rgba',
389
- 'radius',
390
- 'rgbaMode'].map(key => vaoOBJ(key)));
391
- this.bearingLineVAO = this.lineProgram.createVAO(...['centerCoords2d', 'centerCoords3d', 'bearingTargetCoords2d', 'bearingTargetCoords3d', 'bearingDashRatio', 'dashOpacity', 'rgba'
392
- ].map(key => vaoOBJ(key)));
393
- this.circleVao = this.circleProgram.createVAO(...["centerCoords2dflat", "rgbaMercator", "circleDashAngleMercator", "dashOpacityMercator"
394
- ].map(key => vaoOBJ(key)));
395
- this.circle3DVao = this.circle3DProgram.createVAO(...["centerCoords3d", "targetCoords3d", "rgba", "circleDashAngle", "dashOpacity"
396
- ].map(key => vaoOBJ(key)));
397
- }
398
- draw3D() {
399
- const { gl } = this;
400
- gl.disable(gl.DEPTH_TEST);
401
- const is3D = this.globe.api_GetCurrentGeometry() === 0;
402
- const drawRange = { first: 0, count: this.bufferOrchestrator.length };
403
- this.lineProgram.draw(this.lineVao, { drawRange }, this._opacity);
404
- if (this.drawAngleRing) {
405
- this.pieceOfPieProgram.draw(this.bufferOrchestrator.length, this.ringVao, 360, this._opacity * 0.8, exports.RINGPARTIAL_DRAW_MODE.TRIANGLE_FAN);
406
- this.pieceOfPieProgram.draw(this.bufferOrchestrator.length, this.ringVao, 360, this._opacity * 0.8, exports.RINGPARTIAL_DRAW_MODE.LINE_STRIP);
407
- }
408
- if (this.drawBearingLine) {
409
- // this.lineProgram.draw(this.bearingLineVAO, this.bufferOrchestrator.length, this._opacity );
410
- this.lineProgram.draw(this.bearingLineVAO, { drawRange }, this._opacity);
411
- }
412
- if (this.drawVRM) {
413
- if (is3D) {
414
- this.circle3DProgram.draw(this.circle3DVao, this.bufferOrchestrator.length, this._opacity);
415
- }
416
- else {
417
- this.circleProgram.draw(this.circleVao, this.bufferOrchestrator.length, this.circleFlatEdgeCount, this._opacity);
418
- }
419
- }
420
- if (this.drawText) {
421
- this._textWritersMap.forEach((writer) => writer.draw());
422
- }
423
- gl.enable(gl.DEPTH_TEST);
424
- }
425
- free() {
426
- if (this.isFreed)
427
- return;
428
- this.bufferManagersCompMap.forEach(({ bufferManager, adaptor }) => {
429
- bufferManager.free();
430
- });
431
- const { gl, globe } = this;
432
- gl.deleteVertexArray(this.lineVao);
433
- gl.deleteVertexArray(this.ringVao);
434
- gl.deleteVertexArray(this.bearingLineVAO);
435
- gl.deleteVertexArray(this.circleVao);
436
- gl.deleteVertexArray(this.circle3DVao);
437
- naive_accurate_flexible_1.LineOnGlobeCache.release(globe);
438
- piece_of_pie_1.PieceOfPieProgramCache.release(globe);
439
- circle_accurate_flat_1.CircleCache.release(globe);
440
- circle_accurate_3d_1.CircleCache.release(globe);
441
- this.isFreed = true;
442
- }
443
- _deleteTexts(keys) {
444
- this._textWritersMap.forEach((writer) => {
445
- writer.deleteTextBulk(keys);
446
- });
447
- }
448
- }
449
- exports.default = BearingLinePlugin;
@@ -1,205 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ChainListMap = void 0;
4
- /**
5
- * set and get node data
6
- * node indexes;
7
- */
8
- class ChainListMap {
9
- constructor(keyMethod) {
10
- this._chainMap = new Map();
11
- this._chainSideProperties = new Map();
12
- this._indexMap = new Map(); // hold list index of lastly updated nodes. on add delete goes empty
13
- this.keyMethod = keyMethod;
14
- }
15
- getChain(chainKey) {
16
- return this._chainMap.get(chainKey);
17
- }
18
- /**
19
- *
20
- * @param {*} node
21
- * @param {*} chainKey
22
- * @param {string|null} theNodeKeyFront
23
- */
24
- addNode(node, chainKey, theNodeKeyFront = null) {
25
- const chain = this.getChain(chainKey);
26
- let frontIndex = null;
27
- for (let i = 0; i < chain.length; i++) {
28
- const n_ode = chain[i];
29
- if (n_ode.key === node.key) {
30
- throw new Error("Chain node already exists");
31
- }
32
- if (n_ode.key === theNodeKeyFront) {
33
- frontIndex = i;
34
- }
35
- }
36
- if (theNodeKeyFront !== null) {
37
- if (frontIndex !== null) {
38
- chain.splice(frontIndex, 0, node);
39
- }
40
- else {
41
- throw new Error("Could not find theNodeKeyFront");
42
- }
43
- }
44
- else {
45
- chain.push(node);
46
- }
47
- node.__identity__ = this.keyMethod(chainKey, node.key);
48
- this._resetIndexChain(chainKey);
49
- }
50
- deleteNodesBelongToAChain(chainKey, nodeKeys) {
51
- const chain = this._chainMap.get(chainKey);
52
- const deleteKeys = [];
53
- const removeSet = new Set(nodeKeys);
54
- const newChain = [];
55
- for (let i = 0; i < chain.length - 1; i++) {
56
- const node = chain[i];
57
- const dKey = node.__identity__;
58
- this._indexMap.delete(dKey);
59
- if (removeSet.has(node.key)) {
60
- deleteKeys.push(dKey);
61
- }
62
- else {
63
- newChain.push(node);
64
- }
65
- }
66
- { // last item case
67
- const lastItem = chain[chain.length - 1];
68
- this._indexMap.delete(lastItem.__identity__);
69
- if (removeSet.has(lastItem.key)) {
70
- if (chain.length > 1) {
71
- deleteKeys.push(chain[chain.length - 2].__identity__);
72
- deleteKeys.push(chain[chain.length - 1].__identity__);
73
- }
74
- ;
75
- }
76
- else {
77
- newChain.push(lastItem);
78
- }
79
- }
80
- this._chainMap.set(chainKey, newChain);
81
- return deleteKeys;
82
- }
83
- deleteChainAndReturnChainKeys(chainKey) {
84
- const keys = this.getNodeKeysOfChain(chainKey);
85
- this._chainMap.delete(chainKey);
86
- for (const key of keys)
87
- this._indexMap.delete(key);
88
- return keys;
89
- }
90
- updateNode(node, chainKey) {
91
- const index = this.getIndexOfNode(chainKey, node.key);
92
- const chain = this._chainMap.get(chainKey);
93
- node.__identity__ = this.keyMethod(chainKey, node.key);
94
- chain[index] = node;
95
- }
96
- updateNodesProperties(chainKey, nodes) {
97
- nodes.forEach((node) => {
98
- const index = this.getIndexOfNode(chainKey, node.key);
99
- const chainNode = this._chainMap.get(chainKey)[index];
100
- if (node.circleProperties) {
101
- if (typeof chainNode.circleProperties !== 'object')
102
- chainNode.circleProperties = {};
103
- node.circleProperties.forEach((value, key, container) => chainNode.circleProperties[key] = value);
104
- }
105
- if (node.lineProperties) {
106
- if (typeof chainNode.lineProperties !== 'object')
107
- chainNode.lineProperties = {};
108
- node.lineProperties.forEach((value, key, container) => chainNode.lineProperties[key] = value);
109
- }
110
- });
111
- }
112
- updateCoordsinatesOfNode(node, chainKey) {
113
- const index = this.getIndexOfNode(chainKey, node.key);
114
- const chain = this._chainMap.get(chainKey);
115
- chain[index].long = node.long;
116
- chain[index].lat = node.lat;
117
- }
118
- setChain(chainKey, nodeList) {
119
- if (this._chainMap.has(chainKey))
120
- this._flushIndexMap();
121
- this._chainMap.set(chainKey, nodeList);
122
- nodeList.forEach((v) => v.__identity__ = this.keyMethod(chainKey, v.key));
123
- }
124
- setChainProperties(chainKey, properties) {
125
- this._chainSideProperties.set(chainKey, properties);
126
- }
127
- /**
128
- *
129
- * @param {string} chainKey
130
- * @param {Map} properties
131
- * // after this method update text and buffer data of the chain
132
- */
133
- updateChainProperties(chainKey, properties) {
134
- const memoryProperties = this._chainSideProperties.get(chainKey);
135
- properties.forEach((value, key, m) => {
136
- memoryProperties[key] = value;
137
- });
138
- }
139
- getChainProperties(chainKey) {
140
- this._chainSideProperties.get(chainKey);
141
- }
142
- /**
143
- *
144
- * @param {*} chainKey
145
- * @param {*} callback | (value, index, array) => expexted output
146
- */
147
- calculateBufferPropertiesChain(chainKey, callback, result) {
148
- const chain = this._chainMap.get(chainKey);
149
- const props = this._chainSideProperties.get(chainKey);
150
- for (let i = 0; i < chain.length - 1; i++) {
151
- const node = callback(chain[i], i, chain, props);
152
- if (node !== null)
153
- result.push(node);
154
- }
155
- }
156
- /**
157
- * @param {*} chainKey
158
- * @param {*} textWriterObjs
159
- * @param {*} nodeKeys use nodeKeys on updateCoordinatesOnly
160
- */
161
- textUpdate(chainKey, textWriterObjs, dataPreAdaptor) {
162
- const chain = this._chainMap.get(chainKey);
163
- if (!chain)
164
- return;
165
- const data = (dataPreAdaptor) ? chain.map(dataPreAdaptor) : chain;
166
- const properties = this._chainSideProperties.get(chainKey);
167
- textWriterObjs.forEach((writer) => {
168
- writer.insertTextBulk(data, properties);
169
- });
170
- }
171
- getAllChainKeysIterator() {
172
- return this._chainMap.keys();
173
- }
174
- getIndexOfNode(chainKey, nodeKey) {
175
- const key = this.keyMethod(chainKey, nodeKey);
176
- if (this._indexMap.has(key))
177
- return this._indexMap.get(key);
178
- const chain = this._chainMap.get(chainKey);
179
- for (let i = 0; i < chain.length; i++) {
180
- const node = chain[i];
181
- this._indexMap.set(key, i);
182
- if (node.key === nodeKey) {
183
- return i;
184
- }
185
- }
186
- }
187
- _flushIndexMap() {
188
- this._indexMap.clear();
189
- }
190
- _resetIndexChain(chainKey) {
191
- const chain = this._chainMap.get(chainKey);
192
- for (let i = 0; i < chain.length; i++) {
193
- const node = chain[i];
194
- this._indexMap.set(this.keyMethod(chainKey, node.key), i);
195
- }
196
- }
197
- getNodeKeysOfChain(chainKey) {
198
- const chain = this._chainMap.get(chainKey);
199
- if (!chain)
200
- return [];
201
- const result = chain.map((v) => v.__identity__);
202
- return result;
203
- }
204
- }
205
- exports.ChainListMap = ChainListMap;
@@ -1 +0,0 @@
1
- "use strict";