@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,252 @@
1
+ "use strict";
2
+ // import { LineStripProgramCache } from "../../../programs/line-on-globe/linestrip"
3
+ // import "../../../programs/interface";
4
+ // import { createBufferAndReadInfo } from '../../../util/gl-util/buffer/attribute-loader';
5
+ // import { populateFloat32Array } from "../../../util/jshelpers/data-filler";
6
+ // import { BufferManagement, BufferManager, BufferOrchestrator } from "../../../util/account/single-attribute-buffer-management/index";
7
+ // import { globe3Dcoordinates, globe2Dcoordinates, RADIANS } from "../../../Math/methods";
8
+ // import { Vector3D } from "../../../Math/vector3d";
9
+ // import { Arc } from "../../../Math/arc";
10
+ // import { Plane } from "../../../Math/plane";
11
+ // import { arcFrustumPlanesIntersection } from "../../../Math/intersections/arc-frustum-planes";
12
+ // import { CameraUniformBlockTotemCache, CameraUniformBlockTotem } from "../../../programs/totems/camerauniformblock";
13
+ // import { FrustumPlanes } from "../../../Math/frustum/types";
14
+ // const VERTEX_COUNT = 360;
15
+ // const INITAL_CAPACITY = 10;
16
+ // const _0vector = new Vector3D();
17
+ // const _0arc = new Arc();
18
+ // // window add properties
19
+ // declare global {
20
+ // interface Window {
21
+ // startPoint: Vector3D;
22
+ // endPoint: Vector3D;
23
+ // }
24
+ // }
25
+ // let interval = 1;
26
+ // const testVec = new Vector3D(0, 0, 1);
27
+ // testVec.setFromLongLat(30 * RADIANS, 30 * RADIANS);
28
+ // console.log("testVec", testVec.x, testVec.y, testVec.z);
29
+ // testVec.setFromLongLat(50 * RADIANS, 50 * RADIANS);
30
+ // console.log("testVec", testVec.x, testVec.y, testVec.z);
31
+ // export class NaiveLineOnTerrainPlugin {
32
+ // public id: string;
33
+ // private program: ProgramInterface;
34
+ // private _bufferManagersCompMap: BufferManagement;
35
+ // private _bufferManagersCompMapTest: BufferManagement;
36
+ // private _bufferOrchestrator: BufferOrchestrator = new BufferOrchestrator({ capacity: INITAL_CAPACITY });
37
+ // private _testOrchestrator: BufferOrchestrator = new BufferOrchestrator({ capacity: INITAL_CAPACITY });
38
+ // private _opacity: number = 1;
39
+ // private _arcUBOHandler: UBOHandler;
40
+ // private _vao: WebGLVertexArrayObject;
41
+ // private _vaoAllTest: WebGLVertexArrayObject;
42
+ // private _ubohandlerAllTest: UBOHandler;
43
+ // private globe: any;
44
+ // private gl: WebGL2RenderingContext;
45
+ // private _arcMap: Map<string, Arc>;
46
+ // private _arcMapTest: Map<string, Arc>;
47
+ // private _screenPlane: Plane = new Plane();
48
+ // private _doBuild: boolean = false
49
+ // private _cameraUniformBlock: CameraUniformBlockTotem;
50
+ // public fieldOfView = 50 * RADIANS; // 50 degrees in radians
51
+ // constructor(id: string) {
52
+ // this.id = id;
53
+ // this._arcMap = new Map();
54
+ // this._arcMapTest = new Map();
55
+ // }
56
+ // insertArcFromLongLat(key: string, startPoint: { long: number, lat: number }, endPoint: { long: number, lat: number }) {
57
+ // if (this._arcMap.has(key)) {
58
+ // this._arcMap.delete(key);
59
+ // }
60
+ // const start = _0vector.setFromLongLat(startPoint.long * RADIANS, startPoint.lat * RADIANS).clone();
61
+ // const end = _0vector.setFromLongLat(endPoint.long * RADIANS, endPoint.lat * RADIANS).clone();
62
+ // window.startPoint = start;
63
+ // window.endPoint = end;
64
+ // const arc = new Arc(start, end);
65
+ // this._arcMap.set(key, arc);
66
+ // this._arcMapTest.set(key, arc.clone());
67
+ // const longLatArr = new Float32Array(2 * VERTEX_COUNT);
68
+ // const _3Dpoints = arc.populatePoints3D(VERTEX_COUNT);
69
+ // const longLat = {
70
+ // long: 1,
71
+ // lat: 1
72
+ // };
73
+ // for (let i = 0; i < _3Dpoints.length / 3; i++) {
74
+ // _0vector.set(_3Dpoints[i * 3], _3Dpoints[i * 3 + 1], _3Dpoints[i * 3 + 2]).toLongLat(longLat);
75
+ // longLatArr.set([longLat.long / RADIANS, longLat.lat / RADIANS], i * 2);
76
+ // }
77
+ // const result = [{
78
+ // key: key,
79
+ // longLatArr: longLatArr,
80
+ // }
81
+ // ]
82
+ // this._testOrchestrator.insertBulk(result, this._bufferManagersCompMapTest);
83
+ // this._doBuild = true;
84
+ // }
85
+ // init(globe: any, gl: WebGL2RenderingContext) {
86
+ // this.globe = globe;
87
+ // this.gl = gl;
88
+ // this.program = LineStripProgramCache.get(globe);
89
+ // const g3D = globe3Dcoordinates(globe, 30);
90
+ // const g2D = globe2Dcoordinates(globe);
91
+ // this._cameraUniformBlock = CameraUniformBlockTotemCache.get(globe);
92
+ // this._bufferManagersCompMap = new Map(
93
+ // [
94
+ // ["position3d", {
95
+ // bufferManager: new BufferManager(gl, 3 * (VERTEX_COUNT + 1), { bufferType: "DYNAMIC_DRAW", initialCapacity: INITAL_CAPACITY }),
96
+ // adaptor: (item: any) => {
97
+ // const { longLatArr } = item;
98
+ // const result = g3D(longLatArr, { paddingCount: 1 });
99
+ // // console.log("result", result);
100
+ // return result;
101
+ // }
102
+ // }],
103
+ // ["position2d", {
104
+ // bufferManager: new BufferManager(gl, 2 * (VERTEX_COUNT + 1), { bufferType: "DYNAMIC_DRAW", initialCapacity: INITAL_CAPACITY }),
105
+ // adaptor: (item: any) => {
106
+ // const { longLatArr } = item;
107
+ // return g2D(longLatArr, { paddingCount: 1 });
108
+ // }
109
+ // }
110
+ // ],
111
+ // ]
112
+ // );
113
+ // this._bufferManagersCompMapTest = new Map([
114
+ // ["positionTest3d", {
115
+ // bufferManager: new BufferManager(gl, 3 * (VERTEX_COUNT + 1), { bufferType: "DYNAMIC_DRAW", initialCapacity: INITAL_CAPACITY }),
116
+ // adaptor: (item: any) => {
117
+ // const { longLatArr } = item;
118
+ // const result = g3D(longLatArr, { paddingCount: 1 });
119
+ // return result;
120
+ // }
121
+ // }],
122
+ // ["positionTest2d", {
123
+ // bufferManager: new BufferManager(gl, 2 * (VERTEX_COUNT + 1), { bufferType: "DYNAMIC_DRAW", initialCapacity: INITAL_CAPACITY }),
124
+ // adaptor: (item: any) => {
125
+ // const { longLatArr } = item;
126
+ // return g2D(longLatArr, { paddingCount: 1 });
127
+ // }
128
+ // }
129
+ // ]
130
+ // ]
131
+ // );
132
+ // this._bufferOrchestrator = new BufferOrchestrator(gl, this._bufferManagersCompMap);
133
+ // this._arcUBOHandler = this.program.createUBO();
134
+ // this._arcUBOHandler.update(new Map([
135
+ // ["u_color", new Float32Array([1, 0, 0, 1])],
136
+ // ]));
137
+ // this._ubohandlerAllTest = this.program.createUBO();
138
+ // this._ubohandlerAllTest.update(new Map([
139
+ // ["u_color", new Float32Array([0, 0, 1, 1])],
140
+ // ]));
141
+ // this._vao = this.program.createVAO(
142
+ // createBufferAndReadInfo(this._bufferManagersCompMap.get("position3d").bufferManager.buffer),
143
+ // createBufferAndReadInfo(this._bufferManagersCompMap.get("position2d").bufferManager.buffer),
144
+ // null,
145
+ // null,
146
+ // null,
147
+ // );
148
+ // this._vaoAllTest = this.program.createVAO(
149
+ // createBufferAndReadInfo(this._bufferManagersCompMapTest.get("positionTest3d").bufferManager.buffer),
150
+ // createBufferAndReadInfo(this._bufferManagersCompMapTest.get("positionTest2d").bufferManager.buffer),
151
+ // null,
152
+ // null,
153
+ // null,
154
+ // );
155
+ // }
156
+ // setFieldOfView(fieldOfView: number) {
157
+ // this.fieldOfView = fieldOfView * RADIANS; // convert degrees to radians
158
+ // this.globe.DrawRender();
159
+ // }
160
+ // _buildArcs() {
161
+ // // updatePlane
162
+ // const { globe, _arcMap } = this;
163
+ // const planes = this._cameraUniformBlock.getFrustumPlanes() as FrustumPlanes;
164
+ // //
165
+ // const cameraPostition = new Vector3D();
166
+ // cameraPostition.copy(globe.Fp as Vector3D).normalize();
167
+ // // calculateHorizonPlane(globe, _screenPlane, this.fieldOfView);
168
+ // const result = [];
169
+ // const longLat = {
170
+ // long: 1,
171
+ // lat: 1
172
+ // }
173
+ // let counter = 0;
174
+ // for (const [key, arc] of _arcMap) {
175
+ // // const isArc = arc.intersectionMedium(_screenPlane, _0arc) as Arc;
176
+ // _0arc.copy(arc);
177
+ // const isArc = arcFrustumPlanesIntersection(_0arc, planes, _0arc);
178
+ // if (!isArc) {
179
+ // continue;
180
+ // }
181
+ // counter++;
182
+ // const longLatArr = new Float32Array(2 * VERTEX_COUNT);
183
+ // // const _3Dpoints = _0arc.populatePoints3DInRespectToCamera(cameraPostition, VERTEX_COUNT);
184
+ // const _3Dpoints = _0arc.populatePoints3D(VERTEX_COUNT);
185
+ // for (let i = 0; i < _3Dpoints.length / 3; i++) {
186
+ // _0vector.set(_3Dpoints[i * 3], _3Dpoints[i * 3 + 1], _3Dpoints[i * 3 + 2]).toLongLat(longLat);
187
+ // longLatArr.set([longLat.long / RADIANS, longLat.lat / RADIANS], i * 2);
188
+ // }
189
+ // result.push({
190
+ // key: key,
191
+ // longLatArr: longLatArr,
192
+ // });
193
+ // // if (!arc.imaginaryPlane.equals(_0arc.imaginaryPlane) || !arc.imaginaryPlane.equalsReverseOriantation(_0arc.imaginaryPlane)) {
194
+ // // // console.log("Arc with key", key, "has imaginary plane equal to the original arc's imaginary plane.");
195
+ // // throw new Error("The arc segment is not on the parent arc")
196
+ // // }
197
+ // }
198
+ // interval += 1;
199
+ // if (interval === 100) {
200
+ // interval = 1;
201
+ // console.log("Arc count on screen:", counter);
202
+ // }
203
+ // // update buffer
204
+ // this._bufferOrchestrator.resetWithCapacity(this._bufferManagersCompMap, result.length);
205
+ // this._bufferOrchestrator.insertBulk(result, this._bufferManagersCompMap);
206
+ // this._doBuild = false;
207
+ // this._checkIfCorrupted(); // check if any arc is corrupted
208
+ // }
209
+ // draw3D() {
210
+ // // Drawing logic here
211
+ // this._buildArcs() // can be async
212
+ // const { gl, program, _bufferOrchestrator } = this;
213
+ // gl.disable(gl.DEPTH_TEST);
214
+ // const drawOptionTest = {
215
+ // drawRange: {
216
+ // first: 0,
217
+ // count: this._testOrchestrator.length * (VERTEX_COUNT + 1)
218
+ // },
219
+ // indexes: null
220
+ // }
221
+ // program.draw(
222
+ // this._vaoAllTest,
223
+ // drawOptionTest,
224
+ // this._opacity,
225
+ // this._ubohandlerAllTest
226
+ // );
227
+ // const drawOptions = {
228
+ // drawRange: {
229
+ // first: 0,
230
+ // count: _bufferOrchestrator.length * (VERTEX_COUNT + 1)
231
+ // },
232
+ // indexes: null
233
+ // }
234
+ // program.draw(
235
+ // this._vao,
236
+ // drawOptions,
237
+ // this._opacity,
238
+ // this._arcUBOHandler
239
+ // );
240
+ // gl.enable(gl.DEPTH_TEST);
241
+ // }
242
+ // _checkIfCorrupted() {
243
+ // for (const [key, arc] of this._arcMap) {
244
+ // if (!arc.p0.equals(arc.p1)) {
245
+ // continue; // valid arc
246
+ // }
247
+ // console.warn(`Arc with key ${key} is corrupted: p0 and p1 are the same point.`);
248
+ // // this._arcMap.delete(key);
249
+ // // this._arcMapTest.delete(key);
250
+ // }
251
+ // }
252
+ // }
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.latLongToPixelXY = void 0;
4
+ exports.addCuttingPointLineStrip = addCuttingPointLineStrip;
5
+ exports.featuresToLineStringData = featuresToLineStringData;
6
+ exports.fillSliceOfFloat32ArrayLineStrip = fillSliceOfFloat32ArrayLineStrip;
7
+ const util_1 = require("../util");
8
+ Object.defineProperty(exports, "latLongToPixelXY", { enumerable: true, get: function () { return util_1.latLongToPixelXY; } });
9
+ /**
10
+ * @param {Array.<Array.<number>>} coordinates
11
+ * @param {Array.<number>} timestamps
12
+ * @param {Array.<String>} styleGroupNameArray
13
+ * @param {Object.<string, TrackStyleGroup>} _groupColorMap
14
+ * @param {Float32Array} floatArray
15
+ * @param {number} offset
16
+ *
17
+ * create floatArray with createFloat32Array before calling this function.
18
+ * start offset from 0.
19
+ * feed the floatArray with a track data and offset that is returned from the previous call.
20
+ */
21
+ function featuresToLineStringData(data) {
22
+ /**
23
+ * features are the tracks
24
+ * feature[i].geometry.coordinates are the points of the track
25
+ * feature[i].properties.messageTime are the timestamps of the points
26
+ *
27
+ */
28
+ const features = data.features;
29
+ let size = data.features.length - 1;
30
+ let startTime = features[0].properties.messageTime[0];
31
+ let endTime = features[0].properties.messageTime[features[0].properties.messageTime.length - 1];
32
+ for (let feature of features) {
33
+ size += feature.properties.messageTime.length;
34
+ startTime = Math.min(startTime, feature.properties.messageTime[0]);
35
+ endTime = Math.max(endTime, feature.properties.messageTime[feature.properties.messageTime.length - 1]);
36
+ }
37
+ const array = new Float32Array(size * 9);
38
+ let offset = 0;
39
+ {
40
+ const feature = features[0];
41
+ const coordinates = feature.geometry.coordinates;
42
+ const timestamps = feature.properties.messageTime.map((time) => (time - startTime) / 1000);
43
+ offset = fillSliceOfFloat32ArrayLineStrip(array, offset, coordinates, timestamps);
44
+ }
45
+ for (let i = 1; i < features.length; i++) {
46
+ const feature = features[i];
47
+ const coordinates = feature.geometry.coordinates;
48
+ const timestamps = feature.properties.messageTime.map((time) => (time - startTime) / 1000);
49
+ offset = addCuttingPointLineStrip(array, offset);
50
+ offset = fillSliceOfFloat32ArrayLineStrip(array, offset, coordinates, timestamps);
51
+ }
52
+ return { data: array, startTime, endTime };
53
+ }
54
+ function fillSliceOfFloat32ArrayLineStrip(floatArray, offset, coordinates, timestamps, { styleGroupNameArray = null, groupColorFunction = () => [Math.random(), Math.random(), Math.random()] } = {}) {
55
+ const startTime = timestamps[0];
56
+ const endTime = timestamps[timestamps.length - 1];
57
+ for (let i = 0; i < coordinates.length; i++) {
58
+ const time = timestamps[i];
59
+ const coord = coordinates[i];
60
+ const styleGroupName = styleGroupNameArray ? styleGroupNameArray[i] : "default";
61
+ const { x, y } = (0, util_1.latLongToPixelXY)(coord[1], coord[0]);
62
+ const z = coord[2] ? coord[2] / 1000.0 : 0;
63
+ floatArray.set([x, y, z, time, ...groupColorFunction(styleGroupName), startTime, endTime], offset);
64
+ offset += 9;
65
+ }
66
+ return offset;
67
+ }
68
+ function addCuttingPointLineStrip(floatArray, offset) {
69
+ floatArray.set(new Float32Array(9).fill(NaN), offset);
70
+ return offset + 9;
71
+ }
@@ -0,0 +1,122 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Adaptor = void 0;
4
+ exports.fillSliceOfFloat32Array = fillSliceOfFloat32Array;
5
+ exports.createFloat32Array = createFloat32Array;
6
+ const util_1 = require("../util");
7
+ const _latLongToPixelXY = util_1.latLongToPixelXY;
8
+ class Adaptor {
9
+ /**
10
+ * @param {Object.<string, Color>} groupColorMap
11
+ * @typedef {Array} Color | [r, g, b] | between 0-1
12
+ */
13
+ constructor(groupColorMap) {
14
+ this._groupColorMap = groupColorMap;
15
+ }
16
+ /**
17
+ * @param {Object} geojsonObject
18
+ * @param {number} startTime
19
+ * @param {string} timePropertyName
20
+ * @param {string} styleGroupPropertyName
21
+ * @returns {lineData} lineData for Plugin
22
+ */
23
+ fromGeoJson(geojsonObject, startTime, timePropertyName = "messageTime", styleGroupPropertyName = "styleGroup") {
24
+ const features = geojsonObject.features.filter(feature => feature.geometry.coordinates.length > 1);
25
+ const buffer = createFloat32Array(features.map(feature => feature.geometry.coordinates));
26
+ let offset = 0;
27
+ for (let feature of features) {
28
+ const coordinates = feature.geometry.coordinates;
29
+ const timestamps = feature.properties[timePropertyName].map((time) => (time - startTime) / 1000);
30
+ const styleGroupNameArray = feature.properties[styleGroupPropertyName];
31
+ offset = fillSliceOfFloat32Array(coordinates, timestamps, styleGroupNameArray, this._groupColorMap, buffer, offset);
32
+ }
33
+ return buffer;
34
+ }
35
+ /**
36
+ * Inputs are lists of tracks. Each track is a list of coordinates, timestamps and styleGroupNames.
37
+ * @param {Array.<Array.<Array.<number>>>} coordinatesList | [ [ [lon, lat, z], [lon, lat, z], ...], ...
38
+ * @param {Array.<Array.<number>>} timestampsList | [ [time, time, ...], ...
39
+ * @param {Array.<Array.<String>>} colorGroupList | [ [styleGroupName, styleGroupName, ...], ...
40
+ * @param {number} startTime | epoch time
41
+ * @returns {lineData} lineData for Plugin
42
+ */
43
+ fromLists(coordinatesList, timestampsList, colorGroupList, startTime) {
44
+ const buffer = createFloat32Array(coordinatesList);
45
+ let offset = 0;
46
+ for (let i = 0; i < coordinatesList.length; i++) {
47
+ const coordinates = coordinatesList[i];
48
+ const timestamps = timestampsList[i].map((time) => (time - startTime) / 1000);
49
+ const styleGroupNameArray = colorGroupList[i];
50
+ offset = fillSliceOfFloat32Array(coordinates, timestamps, styleGroupNameArray, this._groupColorMap, buffer, offset);
51
+ }
52
+ return buffer;
53
+ }
54
+ }
55
+ exports.Adaptor = Adaptor;
56
+ /**
57
+ * @param {Array.<Array.<number>>} coordinates
58
+ * @param {Array.<number>} timestamps
59
+ * @param {Array.<String>} styleGroupNameArray
60
+ * @param {Object.<string, TrackStyleGroup>} _groupColorMap
61
+ * @param {Float32Array} floatArray
62
+ * @param {number} offset
63
+ *
64
+ * create floatArray with createFloat32Array before calling this function.
65
+ * start offset from 0.
66
+ * feed the floatArray with a track data and offset that is returned from the previous call.
67
+ */
68
+ function fillSliceOfFloat32Array(coordinates, timestamps, styleGroupNameArray, _groupColorMap, floatArray, offset) {
69
+ if (coordinates[0].length === 2) {
70
+ const startTime = timestamps[0];
71
+ const endTime = timestamps[timestamps.length - 1];
72
+ let prevPointData = null;
73
+ { // first point
74
+ const { x, y } = _latLongToPixelXY(coordinates[0][1], coordinates[0][0]);
75
+ prevPointData = [x, y, 0, timestamps[0], ..._groupColorMap[styleGroupNameArray[0]]];
76
+ }
77
+ { // middle points until end
78
+ for (let i = 1; i < coordinates.length; i++) {
79
+ const time = timestamps[i];
80
+ const coord = coordinates[i];
81
+ const { x, y } = _latLongToPixelXY(coord[1], coord[0]);
82
+ floatArray.set([...prevPointData, startTime, endTime, x, y, 0, time, ..._groupColorMap[styleGroupNameArray[i]], startTime, endTime], offset);
83
+ prevPointData = [x, y, 0, time, ..._groupColorMap[styleGroupNameArray[i]]];
84
+ offset += 18;
85
+ }
86
+ }
87
+ }
88
+ else {
89
+ const startTime = timestamps[0];
90
+ const endTime = timestamps[timestamps.length - 1];
91
+ let prevPointData = null;
92
+ { // first point
93
+ const { x, y } = _latLongToPixelXY(coordinates[0][1], coordinates[0][0]);
94
+ prevPointData = [x, y, coordinates[0][2] / 1000.0, timestamps[0], ..._groupColorMap[styleGroupNameArray[0]]];
95
+ }
96
+ { // middle points until end
97
+ for (let i = 1; i < coordinates.length; i++) {
98
+ const time = timestamps[i];
99
+ const coord = coordinates[i];
100
+ const { x, y } = _latLongToPixelXY(coord[1], coord[0]);
101
+ floatArray.set([...prevPointData, startTime, endTime, x, y, coord[2] / 1000.0, time, ..._groupColorMap[styleGroupNameArray[i]], startTime, endTime], offset);
102
+ prevPointData = [x, y, coord[2] / 1000.0, time, ..._groupColorMap[styleGroupNameArray[i]]];
103
+ offset += 18;
104
+ }
105
+ }
106
+ }
107
+ return offset;
108
+ }
109
+ /**
110
+ *
111
+ * @param {*} coordinatesArray
112
+ * @returns Float32Array
113
+ * Coordinates array is needed to calculate the size of the buffer.
114
+ */
115
+ function createFloat32Array(coordinatesArray) {
116
+ let filteredSize = 0;
117
+ for (let coordinates of coordinatesArray) {
118
+ filteredSize += coordinates.length * 2 - 2;
119
+ }
120
+ const array = new Float32Array(filteredSize * 9);
121
+ return array;
122
+ }
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.latLongToPixelXY = exports.fillSliceOfFloat32ArrayLineStrip = exports.featuresToLineStringData = exports.addCuttingPointLineStrip = exports.TimeTracksLineStrip = exports.TimeTracks = exports.createFloat32Array = exports.fillSliceOfFloat32Array = exports.Adaptor = void 0;
7
+ const plugin_1 = __importDefault(require("./plugin"));
8
+ exports.TimeTracks = plugin_1.default;
9
+ const adaptors_1 = require("./adaptors");
10
+ Object.defineProperty(exports, "Adaptor", { enumerable: true, get: function () { return adaptors_1.Adaptor; } });
11
+ Object.defineProperty(exports, "fillSliceOfFloat32Array", { enumerable: true, get: function () { return adaptors_1.fillSliceOfFloat32Array; } });
12
+ Object.defineProperty(exports, "createFloat32Array", { enumerable: true, get: function () { return adaptors_1.createFloat32Array; } });
13
+ const plugin_line_strip_1 = __importDefault(require("./plugin-line-strip"));
14
+ exports.TimeTracksLineStrip = plugin_line_strip_1.default;
15
+ const adaptors_line_strip_1 = require("./adaptors-line-strip");
16
+ Object.defineProperty(exports, "addCuttingPointLineStrip", { enumerable: true, get: function () { return adaptors_line_strip_1.addCuttingPointLineStrip; } });
17
+ Object.defineProperty(exports, "featuresToLineStringData", { enumerable: true, get: function () { return adaptors_line_strip_1.featuresToLineStringData; } });
18
+ Object.defineProperty(exports, "fillSliceOfFloat32ArrayLineStrip", { enumerable: true, get: function () { return adaptors_line_strip_1.fillSliceOfFloat32ArrayLineStrip; } });
19
+ Object.defineProperty(exports, "latLongToPixelXY", { enumerable: true, get: function () { return adaptors_line_strip_1.latLongToPixelXY; } });