@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.
- package/package.json +5 -2
- package/Math/angle-calculation.js +0 -14
- package/Math/arc.ts +0 -76
- package/Math/bounds/line-bbox.js +0 -225
- package/Math/constants.ts +0 -11
- package/Math/frustum/camera.ts +0 -32
- package/Math/frustum/from-globeinfo.ts +0 -63
- package/Math/frustum/types.ts +0 -11
- package/Math/globe-util/horizon-plane.ts +0 -137
- package/Math/index.js +0 -0
- package/Math/juction/arc-plane.ts +0 -114
- package/Math/juction/line-sphere.ts +0 -30
- package/Math/juction/plane-plane.ts +0 -66
- package/Math/line.ts +0 -70
- package/Math/matrix4.ts +0 -0
- package/Math/methods.js +0 -237
- package/Math/plane.ts +0 -86
- package/Math/quaternion.ts +0 -120
- package/Math/roadmap.md +0 -10
- package/Math/types.ts +0 -45
- package/Math/utils.js +0 -3
- package/Math/vec3.ts +0 -155
- package/algorithms/search-binary.js +0 -14
- package/altitude-locator/adaptors.js +0 -0
- package/altitude-locator/draw-subset-obj.js +0 -27
- package/altitude-locator/keymethod.js +0 -0
- package/altitude-locator/plugin.js +0 -439
- package/altitude-locator/types.js +0 -26
- package/arrowfield/adaptor.js +0 -11
- package/arrowfield/index.js +0 -3
- package/arrowfield/plugin.js +0 -128
- package/bearing-line/index.js +0 -2
- package/bearing-line/plugin.js +0 -512
- package/circle-line-chain/chain-list-map.js +0 -221
- package/circle-line-chain/init.js +0 -0
- package/circle-line-chain/plugin.js +0 -469
- package/circle-line-chain/readme.md +0 -57
- package/circle-line-chain/util.js +0 -1
- package/compass-rose/compass-rose-padding-flat.js +0 -266
- package/compass-rose/compass-text-writer.js +0 -173
- package/compass-rose/index.js +0 -3
- package/compassrose/compassrose.js +0 -341
- package/compassrose/index.js +0 -2
- package/depth-locator/readme.md +0 -26
- package/globe-types.ts +0 -13
- package/heatwave/index.js +0 -4
- package/heatwave/isobar/objectarraylabels.js +0 -247
- package/heatwave/isobar/plugin.js +0 -340
- package/heatwave/isobar/quadtreecontours.js +0 -336
- package/heatwave/plugins/heatwaveglobeshell.js +0 -258
- package/jest.config.js +0 -6
- package/partialrings/buffer-manager.js +0 -89
- package/partialrings/goals.md +0 -17
- package/partialrings/index.js +0 -3
- package/partialrings/plugin.js +0 -160
- package/partialrings/program.js +0 -324
- package/pin/pin-object-array.js +0 -381
- package/pin/pin-point-totem.js +0 -77
- package/point-heat-map/adaptors/timetracksplugin-format-to-this.js +0 -78
- package/point-heat-map/index.js +0 -0
- package/point-heat-map/plugin-webworker.js +0 -151
- package/point-heat-map/point-to-heat-map-flow.js +0 -150
- package/point-heat-map/readme.md +0 -15
- package/point-tracks/key-methods.js +0 -3
- package/point-tracks/plugin.js +0 -394
- package/programs/arrowfield/index.js +0 -2
- package/programs/arrowfield/logic.js +0 -286
- package/programs/arrowfield/object.js +0 -89
- package/programs/data2legend/density-to-legend.js +0 -115
- package/programs/data2legend/point-to-density-texture.js +0 -114
- package/programs/float2legendwithratio/index.js +0 -3
- package/programs/float2legendwithratio/logic.js +0 -194
- package/programs/float2legendwithratio/object.js +0 -141
- package/programs/globe-util/is-globe-moved.js +0 -27
- package/programs/globeshell/index.js +0 -2
- package/programs/globeshell/noise/noises.js +0 -0
- package/programs/globeshell/wiggle/index.js +0 -6
- package/programs/globeshell/wiggle/logic.js +0 -371
- package/programs/globeshell/wiggle/object.js +0 -93
- package/programs/helpers/blender/index.js +0 -0
- package/programs/helpers/blender/program.js +0 -91
- package/programs/helpers/fadeaway/index.js +0 -3
- package/programs/helpers/fadeaway/logic.js +0 -76
- package/programs/helpers/fadeaway/object.js +0 -20
- package/programs/helpers/index.js +0 -2
- package/programs/index.js +0 -21
- package/programs/interface.ts +0 -7
- package/programs/line-on-globe/angled-line.js +0 -206
- package/programs/line-on-globe/circle-accurate-3d.js +0 -167
- package/programs/line-on-globe/circle-accurate-flat.js +0 -262
- package/programs/line-on-globe/circle-accurate.js +0 -202
- package/programs/line-on-globe/circle.js +0 -191
- package/programs/line-on-globe/degree-padding-around-circle-3d.js +0 -188
- package/programs/line-on-globe/index.js +0 -0
- package/programs/line-on-globe/lines-color-instanced-flat.js +0 -151
- package/programs/line-on-globe/linestrip.ts +0 -228
- package/programs/line-on-globe/naive-accurate-flexible.js +0 -239
- package/programs/line-on-globe/to-the-surface.js +0 -129
- package/programs/line-on-globe/util.js +0 -8
- package/programs/picking/pickable-renderer.js +0 -216
- package/programs/point-on-globe/element-globe-surface-glow.js +0 -168
- package/programs/point-on-globe/element-point-glow.js +0 -184
- package/programs/point-on-globe/square-pixel-point.js +0 -189
- package/programs/programcache.ts +0 -131
- package/programs/rings/distancering/circleflatprogram.js +0 -136
- package/programs/rings/distancering/circlepaddingfreeangleprogram.js +0 -378
- package/programs/rings/distancering/circlepaddysharedbuffer.js +0 -420
- package/programs/rings/distancering/index.js +0 -5
- package/programs/rings/distancering/paddyflatprogram.js +0 -146
- package/programs/rings/distancering/paddyflatprogram2d.js +0 -150
- package/programs/rings/distancering/paddyflatprogram3d.js +0 -146
- package/programs/rings/distancering/shader.js +0 -0
- package/programs/rings/index.js +0 -1
- package/programs/rings/partial-ring/piece-of-pie.js +0 -315
- package/programs/totems/camerauniformblock.d.ts +0 -48
- package/programs/totems/camerauniformblock.js +0 -197
- package/programs/totems/canvas-webglobe-info.js +0 -136
- package/programs/totems/gpu-selection-uniform-block.js +0 -132
- package/programs/totems/index.ts +0 -2
- package/programs/two-d/pixel-circle.js +0 -0
- package/programs/two-d/pixel-padding-for-compass.js +0 -174
- package/programs/util.js +0 -20
- package/programs/vectorfields/index.js +0 -3
- package/programs/vectorfields/logics/drawrectangleparticles.js +0 -125
- package/programs/vectorfields/logics/index.js +0 -5
- package/programs/vectorfields/logics/pixelbased.js +0 -161
- package/programs/vectorfields/logics/ubo.js +0 -64
- package/programs/vectorfields/pingpongbuffermanager.js +0 -80
- package/publish.bat +0 -60
- package/rangerings/enum.js +0 -3
- package/rangerings/index.js +0 -5
- package/rangerings/plugin.js +0 -649
- package/rangerings/rangeringangletext.js +0 -368
- package/rangerings/ring-account.js +0 -129
- package/shaders/fragment-toy/firework.js +0 -55
- package/shaders/fragment-toy/singularity.js +0 -59
- package/shape-on-terrain/arc/naive/plugin.ts +0 -304
- package/shape-on-terrain/goal.md +0 -12
- package/tests/Math/junction/arc-plane.test.ts +0 -133
- package/tests/Math/junction/plane-plane.test.ts +0 -82
- package/tests/Math/plane.test.ts +0 -43
- package/tests/Math/vec3.test.ts +0 -14
- package/timetracks/adaptors-line-strip.js +0 -80
- package/timetracks/adaptors.js +0 -133
- package/timetracks/index.js +0 -6
- package/timetracks/plugin-line-strip.js +0 -295
- package/timetracks/plugin.js +0 -304
- package/timetracks/program-line-strip.js +0 -688
- package/timetracks/program.js +0 -850
- package/timetracks/programpoint-line-strip.js +0 -175
- package/timetracks/programpoint.js +0 -168
- package/timetracks/readme.md +0 -1
- package/tsconfig.json +0 -22
- package/types.ts +0 -17
- package/util/account/bufferoffsetmanager.js +0 -209
- package/util/account/index.js +0 -6
- package/util/account/single-attribute-buffer-management/buffer-manager.ts +0 -119
- package/util/account/single-attribute-buffer-management/buffer-orchestrator.ts +0 -173
- package/util/account/single-attribute-buffer-management/index.ts +0 -13
- package/util/account/single-attribute-buffer-management/object-store.ts +0 -65
- package/util/account/single-attribute-buffer-management/types.ts +0 -39
- package/util/account/util.js +0 -22
- package/util/algorithms/index.js +0 -0
- package/util/algorithms/search-binary.js +0 -26
- package/util/check/get.js +0 -13
- package/util/check/index.js +0 -0
- package/util/check/typecheck.js +0 -39
- package/util/geometry/index.js +0 -53
- package/util/gl-util/buffer/attribute-loader.ts +0 -85
- package/util/gl-util/buffer/index.ts +0 -6
- package/util/gl-util/buffer/types.ts +0 -13
- package/util/gl-util/draw-options/methods.ts +0 -66
- package/util/gl-util/draw-options/types.ts +0 -28
- package/util/gl-util/uniform-block/manager.ts +0 -187
- package/util/gl-util/uniform-block/roadmap.md +0 -70
- package/util/gl-util/uniform-block/shader.js +0 -0
- package/util/gl-util/uniform-block/types.ts +0 -27
- package/util/heatwavedatamanager/datamanager.js +0 -168
- package/util/heatwavedatamanager/index.js +0 -3
- package/util/heatwavedatamanager/pointcoordinatesdatacalculator.js +0 -133
- package/util/heatwavedatamanager/pointcoordsmeta.js +0 -22
- package/util/index.js +0 -13
- package/util/interpolation/index.js +0 -0
- package/util/interpolation/timetrack/index.js +0 -9
- package/util/interpolation/timetrack/timetrack-interpolator.js +0 -88
- package/util/interpolation/timetrack/web-worker-str.js +0 -180
- package/util/interpolation/timetrack/web-worker.js +0 -51
- package/util/jshelpers/data-filler.js +0 -19
- package/util/jshelpers/equality.js +0 -17
- package/util/jshelpers/index.js +0 -1
- package/util/jshelpers/timefilters.js +0 -32
- package/util/picking/fence.js +0 -46
- package/util/picking/picker-displayer.js +0 -177
- package/util/programs/draw-texture-on-canvas.js +0 -102
- package/util/programs/index.js +0 -1
- package/util/programs/shapesonglobe.js +0 -246
- package/util/programs/supersampletotextures.js +0 -142
- package/util/programs/texturetoglobe.js +0 -203
- package/util/shaderfunctions/geometrytransformations.ts +0 -388
- package/util/shaderfunctions/index.js +0 -2
- package/util/shaderfunctions/nodata.js +0 -10
- package/util/shaderfunctions/noisefunctions.js +0 -44
- package/util/surface-line-data/arc-bboxes.ts +0 -42
- package/util/surface-line-data/arcs-to-cuts.js +0 -74
- package/util/surface-line-data/cut-arc.js +0 -0
- package/util/surface-line-data/flow.ts +0 -52
- package/util/surface-line-data/rbush-manager.js +0 -0
- package/util/surface-line-data/types.ts +0 -27
- package/util/surface-line-data/web-worker.js +0 -0
- package/util/webglobe/gldefaultstates.js +0 -5
- package/util/webglobe/index.js +0 -2
- package/util/webglobe/rasteroverlay.js +0 -96
- package/util/webglobjectbuilders.ts +0 -456
- package/util/webglobjectbuilders1.js +0 -271
- package/waveparticles/adaptor.js +0 -16
- package/waveparticles/index.js +0 -3
- package/waveparticles/plugin.js +0 -313
- package/wind/imagetovectorfieldandmagnitude.js +0 -39
- package/wind/index.js +0 -5
- package/wind/plugin.js +0 -1057
- package/wind/vectorfieldimage.js +0 -27
- package/write-text/attached-text-writer.js +0 -105
- package/write-text/context-text.js +0 -125
- package/write-text/context-text3.js +0 -178
- package/write-text/index.js +0 -1
- package/write-text/writer-plugin.js +0 -7
|
@@ -1,304 +0,0 @@
|
|
|
1
|
-
// import { LineStripProgramCache } from "../../../programs/line-on-globe/linestrip"
|
|
2
|
-
// import "../../../programs/interface";
|
|
3
|
-
|
|
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
|
-
|
|
13
|
-
// import { CameraUniformBlockTotemCache, CameraUniformBlockTotem } from "../../../programs/totems/camerauniformblock";
|
|
14
|
-
// import { FrustumPlanes } from "../../../Math/frustum/types";
|
|
15
|
-
// const VERTEX_COUNT = 360;
|
|
16
|
-
// const INITAL_CAPACITY = 10;
|
|
17
|
-
// const _0vector = new Vector3D();
|
|
18
|
-
// const _0arc = new Arc();
|
|
19
|
-
|
|
20
|
-
// // window add properties
|
|
21
|
-
// declare global {
|
|
22
|
-
// interface Window {
|
|
23
|
-
// startPoint: Vector3D;
|
|
24
|
-
// endPoint: Vector3D;
|
|
25
|
-
// }
|
|
26
|
-
// }
|
|
27
|
-
|
|
28
|
-
// let interval = 1;
|
|
29
|
-
|
|
30
|
-
// const testVec = new Vector3D(0, 0, 1);
|
|
31
|
-
// testVec.setFromLongLat(30 * RADIANS, 30 * RADIANS);
|
|
32
|
-
// console.log("testVec", testVec.x, testVec.y, testVec.z);
|
|
33
|
-
|
|
34
|
-
// testVec.setFromLongLat(50 * RADIANS, 50 * RADIANS);
|
|
35
|
-
// console.log("testVec", testVec.x, testVec.y, testVec.z);
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
// export class NaiveLineOnTerrainPlugin {
|
|
39
|
-
// public id: string;
|
|
40
|
-
// private program: ProgramInterface;
|
|
41
|
-
// private _bufferManagersCompMap: BufferManagement;
|
|
42
|
-
// private _bufferManagersCompMapTest: BufferManagement;
|
|
43
|
-
// private _bufferOrchestrator: BufferOrchestrator = new BufferOrchestrator({ capacity: INITAL_CAPACITY });
|
|
44
|
-
// private _testOrchestrator: BufferOrchestrator = new BufferOrchestrator({ capacity: INITAL_CAPACITY });
|
|
45
|
-
// private _opacity: number = 1;
|
|
46
|
-
// private _arcUBOHandler: UBOHandler;
|
|
47
|
-
// private _vao: WebGLVertexArrayObject;
|
|
48
|
-
// private _vaoAllTest: WebGLVertexArrayObject;
|
|
49
|
-
// private _ubohandlerAllTest: UBOHandler;
|
|
50
|
-
// private globe: any;
|
|
51
|
-
// private gl: WebGL2RenderingContext;
|
|
52
|
-
// private _arcMap: Map<string, Arc>;
|
|
53
|
-
// private _arcMapTest: Map<string, Arc>;
|
|
54
|
-
// private _screenPlane: Plane = new Plane();
|
|
55
|
-
// private _doBuild: boolean = false
|
|
56
|
-
// private _cameraUniformBlock: CameraUniformBlockTotem;
|
|
57
|
-
// public fieldOfView = 50 * RADIANS; // 50 degrees in radians
|
|
58
|
-
|
|
59
|
-
// constructor(id: string) {
|
|
60
|
-
// this.id = id;
|
|
61
|
-
// this._arcMap = new Map();
|
|
62
|
-
// this._arcMapTest = new Map();
|
|
63
|
-
// }
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
// insertArcFromLongLat(key: string, startPoint: { long: number, lat: number }, endPoint: { long: number, lat: number }) {
|
|
68
|
-
// if (this._arcMap.has(key)) {
|
|
69
|
-
// this._arcMap.delete(key);
|
|
70
|
-
// }
|
|
71
|
-
// const start = _0vector.setFromLongLat(startPoint.long * RADIANS, startPoint.lat * RADIANS).clone();
|
|
72
|
-
// const end = _0vector.setFromLongLat(endPoint.long * RADIANS, endPoint.lat * RADIANS).clone();
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
// window.startPoint = start;
|
|
77
|
-
// window.endPoint = end;
|
|
78
|
-
// const arc = new Arc(start, end);
|
|
79
|
-
// this._arcMap.set(key, arc);
|
|
80
|
-
// this._arcMapTest.set(key, arc.clone());
|
|
81
|
-
// const longLatArr = new Float32Array(2 * VERTEX_COUNT);
|
|
82
|
-
// const _3Dpoints = arc.populatePoints3D(VERTEX_COUNT);
|
|
83
|
-
// const longLat = {
|
|
84
|
-
// long: 1,
|
|
85
|
-
// lat: 1
|
|
86
|
-
// };
|
|
87
|
-
// for (let i = 0; i < _3Dpoints.length / 3; i++) {
|
|
88
|
-
// _0vector.set(_3Dpoints[i * 3], _3Dpoints[i * 3 + 1], _3Dpoints[i * 3 + 2]).toLongLat(longLat);
|
|
89
|
-
// longLatArr.set([longLat.long / RADIANS, longLat.lat / RADIANS], i * 2);
|
|
90
|
-
// }
|
|
91
|
-
// const result = [{
|
|
92
|
-
// key: key,
|
|
93
|
-
// longLatArr: longLatArr,
|
|
94
|
-
// }
|
|
95
|
-
// ]
|
|
96
|
-
// this._testOrchestrator.insertBulk(result, this._bufferManagersCompMapTest);
|
|
97
|
-
|
|
98
|
-
// this._doBuild = true;
|
|
99
|
-
// }
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
// init(globe: any, gl: WebGL2RenderingContext) {
|
|
104
|
-
// this.globe = globe;
|
|
105
|
-
// this.gl = gl;
|
|
106
|
-
// this.program = LineStripProgramCache.get(globe);
|
|
107
|
-
|
|
108
|
-
// const g3D = globe3Dcoordinates(globe, 30);
|
|
109
|
-
// const g2D = globe2Dcoordinates(globe);
|
|
110
|
-
// this._cameraUniformBlock = CameraUniformBlockTotemCache.get(globe);
|
|
111
|
-
// this._bufferManagersCompMap = new Map(
|
|
112
|
-
// [
|
|
113
|
-
// ["position3d", {
|
|
114
|
-
// bufferManager: new BufferManager(gl, 3 * (VERTEX_COUNT + 1), { bufferType: "DYNAMIC_DRAW", initialCapacity: INITAL_CAPACITY }),
|
|
115
|
-
// adaptor: (item: any) => {
|
|
116
|
-
// const { longLatArr } = item;
|
|
117
|
-
// const result = g3D(longLatArr, { paddingCount: 1 });
|
|
118
|
-
// // console.log("result", result);
|
|
119
|
-
// return result;
|
|
120
|
-
// }
|
|
121
|
-
// }],
|
|
122
|
-
// ["position2d", {
|
|
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
|
-
|
|
133
|
-
// this._bufferManagersCompMapTest = new Map([
|
|
134
|
-
// ["positionTest3d", {
|
|
135
|
-
// bufferManager: new BufferManager(gl, 3 * (VERTEX_COUNT + 1), { bufferType: "DYNAMIC_DRAW", initialCapacity: INITAL_CAPACITY }),
|
|
136
|
-
// adaptor: (item: any) => {
|
|
137
|
-
// const { longLatArr } = item;
|
|
138
|
-
// const result = g3D(longLatArr, { paddingCount: 1 });
|
|
139
|
-
// return result;
|
|
140
|
-
// }
|
|
141
|
-
// }],
|
|
142
|
-
// ["positionTest2d", {
|
|
143
|
-
// bufferManager: new BufferManager(gl, 2 * (VERTEX_COUNT + 1), { bufferType: "DYNAMIC_DRAW", initialCapacity: INITAL_CAPACITY }),
|
|
144
|
-
// adaptor: (item: any) => {
|
|
145
|
-
// const { longLatArr } = item;
|
|
146
|
-
// return g2D(longLatArr, { paddingCount: 1 });
|
|
147
|
-
// }
|
|
148
|
-
// }
|
|
149
|
-
// ]
|
|
150
|
-
// ]
|
|
151
|
-
// );
|
|
152
|
-
|
|
153
|
-
// this._bufferOrchestrator = new BufferOrchestrator(gl, this._bufferManagersCompMap);
|
|
154
|
-
|
|
155
|
-
// this._arcUBOHandler = this.program.createUBO();
|
|
156
|
-
// this._arcUBOHandler.update(new Map([
|
|
157
|
-
// ["u_color", new Float32Array([1, 0, 0, 1])],
|
|
158
|
-
// ]));
|
|
159
|
-
// this._ubohandlerAllTest = this.program.createUBO();
|
|
160
|
-
// this._ubohandlerAllTest.update(new Map([
|
|
161
|
-
// ["u_color", new Float32Array([0, 0, 1, 1])],
|
|
162
|
-
// ]));
|
|
163
|
-
|
|
164
|
-
// this._vao = this.program.createVAO(
|
|
165
|
-
// createBufferAndReadInfo(this._bufferManagersCompMap.get("position3d").bufferManager.buffer),
|
|
166
|
-
// createBufferAndReadInfo(this._bufferManagersCompMap.get("position2d").bufferManager.buffer),
|
|
167
|
-
// null,
|
|
168
|
-
// null,
|
|
169
|
-
// null,
|
|
170
|
-
// );
|
|
171
|
-
// this._vaoAllTest = this.program.createVAO(
|
|
172
|
-
// createBufferAndReadInfo(this._bufferManagersCompMapTest.get("positionTest3d").bufferManager.buffer),
|
|
173
|
-
// createBufferAndReadInfo(this._bufferManagersCompMapTest.get("positionTest2d").bufferManager.buffer),
|
|
174
|
-
// null,
|
|
175
|
-
// null,
|
|
176
|
-
// null,
|
|
177
|
-
// );
|
|
178
|
-
// }
|
|
179
|
-
|
|
180
|
-
// setFieldOfView(fieldOfView: number) {
|
|
181
|
-
// this.fieldOfView = fieldOfView * RADIANS; // convert degrees to radians
|
|
182
|
-
// this.globe.DrawRender();
|
|
183
|
-
// }
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
// _buildArcs() {
|
|
188
|
-
// // updatePlane
|
|
189
|
-
// const { globe, _arcMap } = this;
|
|
190
|
-
|
|
191
|
-
// const planes = this._cameraUniformBlock.getFrustumPlanes() as FrustumPlanes;
|
|
192
|
-
// //
|
|
193
|
-
|
|
194
|
-
// const cameraPostition = new Vector3D();
|
|
195
|
-
// cameraPostition.copy(globe.Fp as Vector3D).normalize();
|
|
196
|
-
// // calculateHorizonPlane(globe, _screenPlane, this.fieldOfView);
|
|
197
|
-
|
|
198
|
-
// const result = [];
|
|
199
|
-
// const longLat = {
|
|
200
|
-
// long: 1,
|
|
201
|
-
// lat: 1
|
|
202
|
-
// }
|
|
203
|
-
|
|
204
|
-
// let counter = 0;
|
|
205
|
-
// for (const [key, arc] of _arcMap) {
|
|
206
|
-
// // const isArc = arc.intersectionMedium(_screenPlane, _0arc) as Arc;
|
|
207
|
-
// _0arc.copy(arc);
|
|
208
|
-
|
|
209
|
-
// const isArc = arcFrustumPlanesIntersection(_0arc, planes, _0arc);
|
|
210
|
-
|
|
211
|
-
// if (!isArc) {
|
|
212
|
-
// continue;
|
|
213
|
-
// }
|
|
214
|
-
// counter++;
|
|
215
|
-
// const longLatArr = new Float32Array(2 * VERTEX_COUNT);
|
|
216
|
-
// // const _3Dpoints = _0arc.populatePoints3DInRespectToCamera(cameraPostition, VERTEX_COUNT);
|
|
217
|
-
// const _3Dpoints = _0arc.populatePoints3D(VERTEX_COUNT);
|
|
218
|
-
|
|
219
|
-
// for (let i = 0; i < _3Dpoints.length / 3; i++) {
|
|
220
|
-
// _0vector.set(_3Dpoints[i * 3], _3Dpoints[i * 3 + 1], _3Dpoints[i * 3 + 2]).toLongLat(longLat);
|
|
221
|
-
// longLatArr.set([longLat.long / RADIANS, longLat.lat / RADIANS], i * 2);
|
|
222
|
-
// }
|
|
223
|
-
|
|
224
|
-
// result.push({
|
|
225
|
-
// key: key,
|
|
226
|
-
// longLatArr: longLatArr,
|
|
227
|
-
// });
|
|
228
|
-
|
|
229
|
-
// // if (!arc.imaginaryPlane.equals(_0arc.imaginaryPlane) || !arc.imaginaryPlane.equalsReverseOriantation(_0arc.imaginaryPlane)) {
|
|
230
|
-
// // // console.log("Arc with key", key, "has imaginary plane equal to the original arc's imaginary plane.");
|
|
231
|
-
// // throw new Error("The arc segment is not on the parent arc")
|
|
232
|
-
// // }
|
|
233
|
-
// }
|
|
234
|
-
// interval += 1;
|
|
235
|
-
// if (interval === 100) {
|
|
236
|
-
// interval = 1;
|
|
237
|
-
// console.log("Arc count on screen:", counter);
|
|
238
|
-
// }
|
|
239
|
-
// // update buffer
|
|
240
|
-
// this._bufferOrchestrator.resetWithCapacity(this._bufferManagersCompMap, result.length);
|
|
241
|
-
|
|
242
|
-
// this._bufferOrchestrator.insertBulk(result, this._bufferManagersCompMap);
|
|
243
|
-
|
|
244
|
-
// this._doBuild = false;
|
|
245
|
-
// this._checkIfCorrupted(); // check if any arc is corrupted
|
|
246
|
-
|
|
247
|
-
// }
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
// draw3D() {
|
|
251
|
-
// // Drawing logic here
|
|
252
|
-
// this._buildArcs() // can be async
|
|
253
|
-
// const { gl, program, _bufferOrchestrator } = this;
|
|
254
|
-
|
|
255
|
-
// gl.disable(gl.DEPTH_TEST);
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
// const drawOptionTest = {
|
|
260
|
-
// drawRange: {
|
|
261
|
-
// first: 0,
|
|
262
|
-
// count: this._testOrchestrator.length * (VERTEX_COUNT + 1)
|
|
263
|
-
// },
|
|
264
|
-
// indexes: null
|
|
265
|
-
// }
|
|
266
|
-
|
|
267
|
-
// program.draw(
|
|
268
|
-
// this._vaoAllTest,
|
|
269
|
-
// drawOptionTest,
|
|
270
|
-
// this._opacity,
|
|
271
|
-
// this._ubohandlerAllTest
|
|
272
|
-
// );
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
// const drawOptions = {
|
|
276
|
-
// drawRange: {
|
|
277
|
-
// first: 0,
|
|
278
|
-
// count: _bufferOrchestrator.length * (VERTEX_COUNT + 1)
|
|
279
|
-
// },
|
|
280
|
-
// indexes: null
|
|
281
|
-
// }
|
|
282
|
-
|
|
283
|
-
// program.draw(
|
|
284
|
-
// this._vao,
|
|
285
|
-
// drawOptions,
|
|
286
|
-
// this._opacity,
|
|
287
|
-
// this._arcUBOHandler
|
|
288
|
-
// );
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
// gl.enable(gl.DEPTH_TEST);
|
|
292
|
-
// }
|
|
293
|
-
|
|
294
|
-
// _checkIfCorrupted() {
|
|
295
|
-
// for (const [key, arc] of this._arcMap) {
|
|
296
|
-
// if (!arc.p0.equals(arc.p1)) {
|
|
297
|
-
// continue; // valid arc
|
|
298
|
-
// }
|
|
299
|
-
// console.warn(`Arc with key ${key} is corrupted: p0 and p1 are the same point.`);
|
|
300
|
-
// // this._arcMap.delete(key);
|
|
301
|
-
// // this._arcMapTest.delete(key);
|
|
302
|
-
// }
|
|
303
|
-
// }
|
|
304
|
-
// }
|
package/shape-on-terrain/goal.md
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
The fact that a straight line have two points, lacks the ability to cover elevation data on higher zoom levels.
|
|
2
|
-
|
|
3
|
-
The purpose of this subplugin is to adapt the straight line to the terrain.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
### Steps
|
|
7
|
-
|
|
8
|
-
- filter by bbox with tree -> indexes
|
|
9
|
-
- find intersaction. Also filters in a more precise way then bbox. -> index and 2 points. 3d carteasian so it can be used on slerp.
|
|
10
|
-
- Populate the line points -> Array<lat long>
|
|
11
|
-
- 3d cartesian coords with globe api
|
|
12
|
-
|
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
import { Plane, Line, Vec3, Quaternion, Arc } from '../../../Math/types';
|
|
2
|
-
import { plane } from '../../../Math/plane';
|
|
3
|
-
import { line } from '../../../Math/line';
|
|
4
|
-
import { arc } from '../../../Math/arc';
|
|
5
|
-
import { vec3 } from '../../../Math/vec3';
|
|
6
|
-
import { quaternion } from '../../../Math/quaternion';
|
|
7
|
-
import { planePlaneJuction } from '../../../Math/juction/plane-plane';
|
|
8
|
-
import { arcSlice } from '../../../Math/juction/arc-plane';
|
|
9
|
-
import { EPSILON } from '../../../Math/constants';
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const arcIn = arc.create(vec3.create(0, 0, 1), vec3.create(1, 0, 0));
|
|
13
|
-
const arcOut: [Arc, Arc] = [
|
|
14
|
-
arc.create(vec3.create(0, 0, 1), vec3.create(1, 0, 0)),
|
|
15
|
-
arc.create(vec3.create(0, 0, 1), vec3.create(1, 0, 0))
|
|
16
|
-
];
|
|
17
|
-
const arcExpected = arc.create(vec3.create(0, 0, 1), vec3.create(1, 0, 0));
|
|
18
|
-
const junctionPlane = plane.create(vec3.create(0, 0, 1), 0);
|
|
19
|
-
|
|
20
|
-
const r2 = Math.sqrt(2) / 2;
|
|
21
|
-
const r3 = Math.sqrt(3) / 3;
|
|
22
|
-
|
|
23
|
-
beforeAll(() => {
|
|
24
|
-
// Initialize any necessary data or state before running the tests
|
|
25
|
-
arc.set(arcIn, vec3.create(0, 0, 1), vec3.create(1, 0, 0));
|
|
26
|
-
arc.set(arcOut[0], vec3.create(0, 0, 1), vec3.create(1, 0, 0));
|
|
27
|
-
arc.set(arcOut[1], vec3.create(0, 0, 1), vec3.create(1, 0, 0));
|
|
28
|
-
|
|
29
|
-
plane.set(junctionPlane, vec3.create(0, 0, 1), 0);
|
|
30
|
-
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
test('arcSlice - No intersection 1', () => {
|
|
38
|
-
junctionPlane.distance = 2; // Set distance to ensure no intersection
|
|
39
|
-
const result = arcSlice(arcOut, arcIn, junctionPlane);
|
|
40
|
-
expect(result).toBe(false);
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
test('arcSlice - Full intersection 1', () => {
|
|
46
|
-
junctionPlane.distance = 0; // Set distance to ensure full intersection
|
|
47
|
-
const result = arcSlice(arcOut, arcIn, junctionPlane);
|
|
48
|
-
expect(result).toBe(true);
|
|
49
|
-
const isEqual = arc.equals(arcOut[0], arcExpected);
|
|
50
|
-
expect(isEqual).toBe(true);
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
test('arcSlice-1', () => {
|
|
55
|
-
// Set up a case where the arc intersects with the plane
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
const r3 = Math.sqrt(3);
|
|
59
|
-
const juctionNormal = vec3.create(r3, r3, r3);
|
|
60
|
-
|
|
61
|
-
plane.set(junctionPlane, juctionNormal, 0);
|
|
62
|
-
|
|
63
|
-
const result = arcSlice(arcOut, arcIn, junctionPlane);
|
|
64
|
-
expect(result).toBe(true);
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
test('arcSlice - Plane intersection line is out of sphere', () => {
|
|
69
|
-
// Set up a case where the arc intersects with the plane
|
|
70
|
-
|
|
71
|
-
const point1 = vec3.create(0, 1, 0);
|
|
72
|
-
const point2 = vec3.create(0, 0, 1);
|
|
73
|
-
arc.set(arcIn, point1, point2);
|
|
74
|
-
|
|
75
|
-
const juctionNormal = vec3.create(r3, r3, r3);
|
|
76
|
-
|
|
77
|
-
const closestPoint = vec3.create(r2, r2, 0);
|
|
78
|
-
const distance = vec3.dot(juctionNormal, closestPoint) + EPSILON;
|
|
79
|
-
plane.set(junctionPlane, juctionNormal, distance);
|
|
80
|
-
|
|
81
|
-
const result = arcSlice(arcOut, arcIn, junctionPlane);
|
|
82
|
-
expect(result).toBe(false);
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
test("arcSlice - Planes are parallel", () => {
|
|
87
|
-
|
|
88
|
-
const point1 = vec3.create(0, 1, 0);
|
|
89
|
-
const point2 = vec3.create(0, 0, 1);
|
|
90
|
-
arc.set(arcIn, point1, point2);
|
|
91
|
-
|
|
92
|
-
plane.fromValues(junctionPlane, 1, 0, 0, 0.3); // Set a plane parallel to the arc's normal
|
|
93
|
-
const result = arcSlice(arcOut, arcIn, junctionPlane);
|
|
94
|
-
expect(result).toBe(false); // Expect no intersection
|
|
95
|
-
|
|
96
|
-
junctionPlane.distance = -0.3;
|
|
97
|
-
|
|
98
|
-
const result2 = arcSlice(arcOut, arcIn, junctionPlane);
|
|
99
|
-
expect(result2).toBe(true); // Expect no intersection
|
|
100
|
-
const isEqual = arc.equals(arcOut[0], arcIn);
|
|
101
|
-
expect(isEqual).toBe(true); // Expect the output arc to be equal to the input arc
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
test("arcSlice - Arc sliced in half", () => {
|
|
106
|
-
|
|
107
|
-
const point1 = vec3.create(0, 1, 0);
|
|
108
|
-
const point2 = vec3.create(0, 0, 1);
|
|
109
|
-
arc.set(arcIn, point1, point2);
|
|
110
|
-
|
|
111
|
-
expect(vec3.equals(arcIn.normal, vec3.create(1, 0, 0))).toBe(true); // Arc normal should be (1, 0, 0)
|
|
112
|
-
|
|
113
|
-
plane.fromValues(junctionPlane, 0, -r2, r2, 0); // Set a plane parallel to the arc's normal
|
|
114
|
-
|
|
115
|
-
const result = arcSlice(arcOut, arcIn, junctionPlane);
|
|
116
|
-
expect(result).toBe(true); // Expect an intersection
|
|
117
|
-
const expectedPoint1 = vec3.create(0, r2, r2);
|
|
118
|
-
const expectedPoint2 = vec3.create(0, 0, 1);
|
|
119
|
-
arc.set(arcExpected, expectedPoint1, expectedPoint2);
|
|
120
|
-
const isEqual = arc.equals(arcOut[0], arcExpected);
|
|
121
|
-
expect(isEqual).toBe(true); // Expect the output arc to be equal to the expected arc
|
|
122
|
-
});
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
// test("arcSlice - Arc sliced in middle", () => {
|
|
126
|
-
// const point1 = vec3.create(0, 1, 0);
|
|
127
|
-
// const point2 = vec3.create(0, 0, 1);
|
|
128
|
-
// arc.set(arcIn, point1, point2);
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
// plane.fromValues(junctionPlane, 0, r2, r2, )
|
|
132
|
-
|
|
133
|
-
// });
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import { Plane, Line, Vec3, Quaternion } from '../../../Math/types';
|
|
2
|
-
import { plane } from '../../../Math/plane';
|
|
3
|
-
import { line } from '../../../Math/line';
|
|
4
|
-
import { vec3 } from '../../../Math/vec3';
|
|
5
|
-
import { quaternion } from '../../../Math/quaternion';
|
|
6
|
-
import { planePlaneJuction } from '../../../Math/juction/plane-plane';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
let plane1: Plane;
|
|
10
|
-
let plane2: Plane;
|
|
11
|
-
let intersectionLine: Line;
|
|
12
|
-
let quaternion1: Quaternion;
|
|
13
|
-
|
|
14
|
-
beforeAll(() => {
|
|
15
|
-
plane1 = plane.create();
|
|
16
|
-
plane2 = plane.create();
|
|
17
|
-
intersectionLine = line.create();
|
|
18
|
-
quaternion1 = quaternion.create();
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
test('plane-plane intersection - parallel planes', () => {
|
|
23
|
-
plane.fromValues(plane1, 0, 0, 1, 5); // Plane: z = 5
|
|
24
|
-
plane.fromValues(plane2, 0, 0, 1, 10); // Plane: z = 10
|
|
25
|
-
const result = planePlaneJuction(intersectionLine, plane1, plane2);
|
|
26
|
-
expect(result).toBe(false);
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
test('plane-plane intersection - intersecting planes', () => {
|
|
30
|
-
plane.fromValues(plane1, 0, 0, 1, 5); // Plane: z = 5
|
|
31
|
-
plane.fromValues(plane2, 1, 0, 0, 3); // Plane: x = 3
|
|
32
|
-
|
|
33
|
-
const result = planePlaneJuction(intersectionLine, plane1, plane2);
|
|
34
|
-
expect(result).toBe(true);
|
|
35
|
-
expect(vec3.equals(intersectionLine.direction, vec3.create(0, 1, 0))).toBe(true);
|
|
36
|
-
expect(vec3.equals(intersectionLine.origin, vec3.create(3, 0, 5))).toBe(true);
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
test('plane-plane intersection - rotating a plane', () => {
|
|
41
|
-
// plane1 z = 5
|
|
42
|
-
plane.fromValues(plane1, 0, 0, 1, 5);
|
|
43
|
-
|
|
44
|
-
// plane2 x = 3, for the start
|
|
45
|
-
vec3.randomUnit(plane2.normal);
|
|
46
|
-
plane2.distance = 3;
|
|
47
|
-
|
|
48
|
-
const result = planePlaneJuction(intersectionLine, plane1, plane2);
|
|
49
|
-
expect(result).toBe(true);
|
|
50
|
-
const quaRotateLine = line.clone(intersectionLine);
|
|
51
|
-
|
|
52
|
-
const step = 90;
|
|
53
|
-
quaternion.fromAxisAngle(quaternion1, plane1.normal, Math.PI / step); // Rotate 90 degrees around Y-axis
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
for (let i = 0; i < step; i++) {
|
|
57
|
-
|
|
58
|
-
vec3.applyQuaternion(plane2.normal, plane2.normal, quaternion1);
|
|
59
|
-
|
|
60
|
-
const result = planePlaneJuction(intersectionLine, plane1, plane2);
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
line.applyQuaternion(quaRotateLine, quaRotateLine, quaternion1);
|
|
64
|
-
|
|
65
|
-
expect(result).toBe(true);
|
|
66
|
-
expect(vec3.equals(intersectionLine.direction, quaRotateLine.direction)).toBe(true);
|
|
67
|
-
expect(line.contains(intersectionLine, quaRotateLine.origin)).toBe(true);
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
test("plane-plane intersection 1", () => {
|
|
72
|
-
const r2 = Math.sqrt(2) / 2;
|
|
73
|
-
plane.fromValues(plane1, 1, 0, 0, 0);
|
|
74
|
-
plane.fromValues(plane2, 0, -r2, r2, 0);
|
|
75
|
-
const result = planePlaneJuction(intersectionLine, plane1, plane2);
|
|
76
|
-
|
|
77
|
-
expect(result).toBe(true);
|
|
78
|
-
console.log(intersectionLine);
|
|
79
|
-
expect(vec3.equals(intersectionLine.direction, vec3.create(0, r2, r2)) || vec3.equals(intersectionLine.direction, vec3.create(0, -r2, -r2))
|
|
80
|
-
).toBe(true);
|
|
81
|
-
expect(line.contains(intersectionLine, vec3.create(0, 0, 0))).toBe(true);
|
|
82
|
-
});
|
package/tests/Math/plane.test.ts
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { Plane, Vec3 } from "../../Math/types";
|
|
2
|
-
import { vec3 } from "../../Math/vec3";
|
|
3
|
-
import { plane } from "../../Math/plane";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const _planeA = /*@__PURE__*/ plane.create(vec3.create(1, 0, 0), 0);
|
|
7
|
-
const _planeB = /*@__PURE__*/ plane.create(vec3.create(0, 1, 0), 0);
|
|
8
|
-
const _vecA = /*@__PURE__*/ vec3.create(1, 0, 0);
|
|
9
|
-
|
|
10
|
-
beforeAll(() => {
|
|
11
|
-
vec3.set(_vecA, 1, 0, 0);
|
|
12
|
-
plane.set(_planeA, vec3.create(1, 0, 0), 0);
|
|
13
|
-
plane.set(_planeB, vec3.create(0, 1, 0), 0);
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
test("Plane: getUnitSphereRadiusAngle", () => {
|
|
17
|
-
const angleA = plane.getUnitSphereRadiusAngle(_planeA);
|
|
18
|
-
const angleB = plane.getUnitSphereRadiusAngle(_planeB);
|
|
19
|
-
|
|
20
|
-
expect(angleA).toBeCloseTo(Math.PI / 2, 5); // 90 degrees
|
|
21
|
-
expect(angleB).toBeCloseTo(Math.PI / 2, 5); // 90 degrees
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
test("Plane: getUnitSphereRadiusAngle 1", () => {
|
|
26
|
-
|
|
27
|
-
vec3.set(_vecA, 1, 1, 0);
|
|
28
|
-
vec3.normalize(_vecA, _vecA);
|
|
29
|
-
const distance = Math.sqrt(2) / 2; // Distance from origin to the plane
|
|
30
|
-
plane.set(_planeA, _vecA, distance);
|
|
31
|
-
const angleA = plane.getUnitSphereRadiusAngle(_planeA);
|
|
32
|
-
expect(angleA).toBeCloseTo(Math.PI / 4, 5); // 45 degrees
|
|
33
|
-
|
|
34
|
-
for (let i = 0; i < 100; i++) {
|
|
35
|
-
const distance = Math.random();
|
|
36
|
-
|
|
37
|
-
const angle = Math.acos(distance);
|
|
38
|
-
vec3.randomUnit(_vecA)
|
|
39
|
-
plane.set(_planeA, _vecA, distance);
|
|
40
|
-
const angleA = plane.getUnitSphereRadiusAngle(_planeA);
|
|
41
|
-
expect(angleA).toBeCloseTo(angle, 5); // Check if the angle is close to the expected value
|
|
42
|
-
}
|
|
43
|
-
});
|
package/tests/Math/vec3.test.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { Vec3 } from "../../Math/types";
|
|
2
|
-
import { vec3 } from "../../Math/vec3";
|
|
3
|
-
|
|
4
|
-
test("vec3.create", () => {
|
|
5
|
-
const v = vec3.create(1, 2, 3);
|
|
6
|
-
expect(v).toEqual([1, 2, 3]);
|
|
7
|
-
});
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
test("vec3.length", () => {
|
|
11
|
-
const v = vec3.create(3, 4, 0);
|
|
12
|
-
const length = vec3.length(v);
|
|
13
|
-
expect(length).toBe(5);
|
|
14
|
-
});
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import { latLongToPixelXY } from "../util";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* @param {Array.<Array.<number>>} coordinates
|
|
7
|
-
* @param {Array.<number>} timestamps
|
|
8
|
-
* @param {Array.<String>} styleGroupNameArray
|
|
9
|
-
* @param {Object.<string, TrackStyleGroup>} _groupColorMap
|
|
10
|
-
* @param {Float32Array} floatArray
|
|
11
|
-
* @param {number} offset
|
|
12
|
-
*
|
|
13
|
-
* create floatArray with createFloat32Array before calling this function.
|
|
14
|
-
* start offset from 0.
|
|
15
|
-
* feed the floatArray with a track data and offset that is returned from the previous call.
|
|
16
|
-
*/
|
|
17
|
-
function featuresToLineStringData(data) {
|
|
18
|
-
/**
|
|
19
|
-
* features are the tracks
|
|
20
|
-
* feature[i].geometry.coordinates are the points of the track
|
|
21
|
-
* feature[i].properties.messageTime are the timestamps of the points
|
|
22
|
-
*
|
|
23
|
-
*/
|
|
24
|
-
const features = data.features;
|
|
25
|
-
let size = data.features.length - 1;
|
|
26
|
-
|
|
27
|
-
let startTime = features[0].properties.messageTime[0];
|
|
28
|
-
let endTime = features[0].properties.messageTime[features[0].properties.messageTime.length - 1];
|
|
29
|
-
|
|
30
|
-
for (let feature of features) {
|
|
31
|
-
size += feature.properties.messageTime.length;
|
|
32
|
-
startTime = Math.min(startTime, feature.properties.messageTime[0]);
|
|
33
|
-
endTime = Math.max(endTime, feature.properties.messageTime[feature.properties.messageTime.length - 1]);
|
|
34
|
-
}
|
|
35
|
-
const array = new Float32Array(size * 9);
|
|
36
|
-
let offset = 0;
|
|
37
|
-
|
|
38
|
-
{
|
|
39
|
-
const feature = features[0];
|
|
40
|
-
const coordinates = feature.geometry.coordinates;
|
|
41
|
-
const timestamps = feature.properties.messageTime.map((time) => (time - startTime) / 1000);
|
|
42
|
-
offset = fillSliceOfFloat32ArrayLineStrip(array, offset, coordinates, timestamps);
|
|
43
|
-
}
|
|
44
|
-
for (let i = 1; i < features.length; i++) {
|
|
45
|
-
const feature = features[i];
|
|
46
|
-
const coordinates = feature.geometry.coordinates;
|
|
47
|
-
const timestamps = feature.properties.messageTime.map((time) => (time - startTime) / 1000);
|
|
48
|
-
offset = addCuttingPointLineStrip(array, offset);
|
|
49
|
-
offset = fillSliceOfFloat32ArrayLineStrip(array, offset, coordinates, timestamps);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
return { data: array, startTime, endTime };
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
function fillSliceOfFloat32ArrayLineStrip(floatArray, offset, coordinates, timestamps, { styleGroupNameArray = null, groupColorFunction = () => [Math.random(), Math.random(), Math.random()] } = {}) {
|
|
57
|
-
const startTime = timestamps[0];
|
|
58
|
-
const endTime = timestamps[timestamps.length - 1];
|
|
59
|
-
for (let i = 0; i < coordinates.length; i++) {
|
|
60
|
-
const time = timestamps[i];
|
|
61
|
-
const coord = coordinates[i];
|
|
62
|
-
const styleGroupName = styleGroupNameArray ? styleGroupNameArray[i] : "default";
|
|
63
|
-
const { x, y } = latLongToPixelXY(coord[1], coord[0]);
|
|
64
|
-
const z = coord[2] ? coord[2] / 1000.0 : 0;
|
|
65
|
-
floatArray.set([x, y, z, time, ...groupColorFunction(styleGroupName), startTime, endTime], offset);
|
|
66
|
-
offset += 9;
|
|
67
|
-
}
|
|
68
|
-
return offset;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
function addCuttingPointLineStrip(floatArray, offset) {
|
|
72
|
-
floatArray.set(new Float32Array(9).fill(NaN), offset);
|
|
73
|
-
return offset + 9;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
export { addCuttingPointLineStrip, featuresToLineStringData, fillSliceOfFloat32ArrayLineStrip, latLongToPixelXY };
|