@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,221 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* set and get node data
|
|
3
|
-
* node indexes;
|
|
4
|
-
*/
|
|
5
|
-
export class ChainListMap {
|
|
6
|
-
|
|
7
|
-
constructor(keyMethod) {
|
|
8
|
-
this._chainMap = new Map();
|
|
9
|
-
this._chainSideProperties = new Map();
|
|
10
|
-
this._indexMap = new Map(); // hold list index of lastly updated nodes. on add delete goes empty
|
|
11
|
-
this.keyMethod = keyMethod;
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
getChain(chainKey) {
|
|
16
|
-
return this._chainMap.get(chainKey);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
*
|
|
21
|
-
* @param {*} node
|
|
22
|
-
* @param {*} chainKey
|
|
23
|
-
* @param {string|null} theNodeKeyFront
|
|
24
|
-
*/
|
|
25
|
-
addNode(node, chainKey, theNodeKeyFront = null) {
|
|
26
|
-
const chain = this.getChain(chainKey);
|
|
27
|
-
let frontIndex = null;
|
|
28
|
-
for (let i = 0; i < chain.length; i++) {
|
|
29
|
-
const n_ode = chain[i];
|
|
30
|
-
if (n_ode.key === node.key) {
|
|
31
|
-
throw new Error("Chain node already exists");
|
|
32
|
-
}
|
|
33
|
-
if (n_ode.key === theNodeKeyFront) {
|
|
34
|
-
frontIndex = i;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
if (theNodeKeyFront !== null) {
|
|
38
|
-
if (frontIndex !== null) {
|
|
39
|
-
chain.splice(frontIndex, 0, node);
|
|
40
|
-
} else {
|
|
41
|
-
throw new Error("Could not find theNodeKeyFront");
|
|
42
|
-
}
|
|
43
|
-
} else {
|
|
44
|
-
chain.push(node);
|
|
45
|
-
}
|
|
46
|
-
node.__identity__ = this.keyMethod(chainKey, node.key);
|
|
47
|
-
this._resetIndexChain(chainKey);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
deleteNodesBelongToAChain(chainKey, nodeKeys) {
|
|
52
|
-
const chain = this._chainMap.get(chainKey);
|
|
53
|
-
const deleteKeys = [];
|
|
54
|
-
const removeSet = new Set(nodeKeys);
|
|
55
|
-
const newChain = []
|
|
56
|
-
for (let i = 0; i < chain.length - 1; i++) {
|
|
57
|
-
const node = chain[i];
|
|
58
|
-
const dKey = node.__identity__;
|
|
59
|
-
this._indexMap.delete(dKey);
|
|
60
|
-
if (removeSet.has(node.key)) {
|
|
61
|
-
deleteKeys.push(dKey);
|
|
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
|
-
} else {
|
|
75
|
-
newChain.push(lastItem);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
this._chainMap.set(chainKey, newChain);
|
|
79
|
-
return deleteKeys;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
deleteChainAndReturnChainKeys(chainKey) {
|
|
83
|
-
const keys = this.getNodeKeysOfChain(chainKey);
|
|
84
|
-
this._chainMap.delete(chainKey);
|
|
85
|
-
for (const key of keys) this._indexMap.delete(key);
|
|
86
|
-
return keys;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
updateNode(node, chainKey) {
|
|
90
|
-
const index = this.getIndexOfNode(chainKey, node.key)
|
|
91
|
-
const chain = this._chainMap.get(chainKey);
|
|
92
|
-
node.__identity__ = this.keyMethod(chainKey, node.key);
|
|
93
|
-
chain[index] = node;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
updateNodesProperties(chainKey, nodes) {
|
|
98
|
-
nodes.forEach((node) => {
|
|
99
|
-
|
|
100
|
-
const index = this.getIndexOfNode(chainKey, node.key)
|
|
101
|
-
const chainNode = this._chainMap.get(chainKey)[index];
|
|
102
|
-
if (node.circleProperties) {
|
|
103
|
-
if (typeof chainNode.circleProperties !== 'object') chainNode.circleProperties = {}
|
|
104
|
-
node.circleProperties.forEach((value, key, container) => chainNode.circleProperties[key] = value);
|
|
105
|
-
}
|
|
106
|
-
if (node.lineProperties) {
|
|
107
|
-
if (typeof chainNode.lineProperties !== 'object') chainNode.lineProperties = {}
|
|
108
|
-
node.lineProperties.forEach((value, key, container) => chainNode.lineProperties[key] = value);
|
|
109
|
-
}
|
|
110
|
-
});
|
|
111
|
-
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
updateCoordsinatesOfNode(node, chainKey) {
|
|
115
|
-
const index = this.getIndexOfNode(chainKey, node.key)
|
|
116
|
-
const chain = this._chainMap.get(chainKey);
|
|
117
|
-
chain[index].long = node.long;
|
|
118
|
-
chain[index].lat = node.lat;
|
|
119
|
-
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
setChain(chainKey, nodeList) {
|
|
123
|
-
if (this._chainMap.has(chainKey)) this._flushIndexMap();
|
|
124
|
-
this._chainMap.set(chainKey, nodeList);
|
|
125
|
-
nodeList.forEach((v) => v.__identity__ = this.keyMethod(chainKey, v.key))
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
setChainProperties(chainKey, properties) {
|
|
130
|
-
this._chainSideProperties.set(chainKey, properties);
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
/**
|
|
135
|
-
*
|
|
136
|
-
* @param {string} chainKey
|
|
137
|
-
* @param {Map} properties
|
|
138
|
-
* // after this method update text and buffer data of the chain
|
|
139
|
-
*/
|
|
140
|
-
updateChainProperties(chainKey, properties) {
|
|
141
|
-
|
|
142
|
-
const memoryProperties = this._chainSideProperties.get(chainKey);
|
|
143
|
-
properties.forEach((value, key, m) => {
|
|
144
|
-
memoryProperties[key] = value;
|
|
145
|
-
})
|
|
146
|
-
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
getChainProperties(chainKey) {
|
|
150
|
-
this._chainSideProperties.get(chainKey);
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
/**
|
|
154
|
-
*
|
|
155
|
-
* @param {*} chainKey
|
|
156
|
-
* @param {*} callback | (value, index, array) => expexted output
|
|
157
|
-
*/
|
|
158
|
-
calculateBufferPropertiesChain(chainKey, callback, result,) {
|
|
159
|
-
const chain = this._chainMap.get(chainKey);
|
|
160
|
-
const props = this._chainSideProperties.get(chainKey);
|
|
161
|
-
for (let i = 0; i < chain.length - 1; i++) {
|
|
162
|
-
const node = callback(chain[i], i, chain, props);
|
|
163
|
-
if (node !== null) result.push(node);
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
/**
|
|
169
|
-
* @param {*} chainKey
|
|
170
|
-
* @param {*} textWriterObjs
|
|
171
|
-
* @param {*} nodeKeys use nodeKeys on updateCoordinatesOnly
|
|
172
|
-
*/
|
|
173
|
-
textUpdate(chainKey, textWriterObjs, dataPreAdaptor) {
|
|
174
|
-
const chain = this._chainMap.get(chainKey);
|
|
175
|
-
if (!chain) return;
|
|
176
|
-
const data = (dataPreAdaptor) ? chain.map(dataPreAdaptor) : chain;
|
|
177
|
-
const properties = this._chainSideProperties.get(chainKey);
|
|
178
|
-
textWriterObjs.forEach((writer) => {
|
|
179
|
-
writer.insertTextBulk(data, properties);
|
|
180
|
-
});
|
|
181
|
-
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
getAllChainKeysIterator() {
|
|
185
|
-
return this._chainMap.keys();
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
getIndexOfNode(chainKey, nodeKey) {
|
|
189
|
-
const key = this.keyMethod(chainKey, nodeKey);
|
|
190
|
-
if (this._indexMap.has(key)) return this._indexMap.get(key);
|
|
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(key, i);
|
|
195
|
-
if (node.key === nodeKey) {
|
|
196
|
-
return i;
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
_flushIndexMap() {
|
|
202
|
-
this._indexMap.clear();
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
_resetIndexChain(chainKey) {
|
|
206
|
-
const chain = this._chainMap.get(chainKey);
|
|
207
|
-
for (let i = 0; i < chain.length; i++) {
|
|
208
|
-
const node = chain[i]
|
|
209
|
-
this._indexMap.set(this.keyMethod(chainKey, node.key), i);
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
getNodeKeysOfChain(chainKey) {
|
|
214
|
-
const chain = this._chainMap.get(chainKey);
|
|
215
|
-
if (!chain) return [];
|
|
216
|
-
const result = chain.map((v) => v.__identity__);
|
|
217
|
-
return result
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
}
|
|
File without changes
|
|
@@ -1,469 +0,0 @@
|
|
|
1
|
-
import { LineOnGlobeCache } from '../programs/line-on-globe/naive-accurate-flexible';
|
|
2
|
-
import { CircleCache, EDGE_COUNT as flatCircleEdgeCount, centerCoords2dflatDataCreator } from '../programs/line-on-globe/circle-accurate-flat';
|
|
3
|
-
import { CircleCache as Circle3DCache } from '../programs/line-on-globe/circle-accurate-3d';
|
|
4
|
-
import { BufferOrchestrator, BufferManager } from "../util/account";
|
|
5
|
-
import { ChainListMap } from "./chain-list-map";
|
|
6
|
-
import { mapGetOrThrow } from "../util/check/get";
|
|
7
|
-
import { keyMethod } from "./util";
|
|
8
|
-
import { populateFloat32Array } from "../util/jshelpers/data-filler";
|
|
9
|
-
import { ContextTextWriter3 } from '../write-text/context-text3';
|
|
10
|
-
import { isBoolean, constraintFloat, opacityCheck } from '../util/check/typecheck';
|
|
11
|
-
import { createBufferAndReadInfo } from '../util/gl-util/buffer/attribute-loader';
|
|
12
|
-
import { sphereCoord } from '../util/geometry/index';
|
|
13
|
-
/**
|
|
14
|
-
* Insert info to chain list map (nodes and properties)
|
|
15
|
-
*
|
|
16
|
-
* ask chain list map for text data
|
|
17
|
-
* ask chain list map for buffer data
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
* addNode
|
|
21
|
-
* insertBulk
|
|
22
|
-
* deleteChain
|
|
23
|
-
* deleteNodes
|
|
24
|
-
* updateCoordinates()
|
|
25
|
-
* updateChainProperties
|
|
26
|
-
*/
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
* @typedef chain
|
|
33
|
-
* @property {string} chainKey
|
|
34
|
-
* @property {StyleProperties} chainProperties
|
|
35
|
-
*
|
|
36
|
-
* @typedef {Object} Node
|
|
37
|
-
* @property {string} key
|
|
38
|
-
* @property {number} long
|
|
39
|
-
* @property {number} lat
|
|
40
|
-
* @property {number} altitude
|
|
41
|
-
* @property {StyleProperties} circleProperties
|
|
42
|
-
*
|
|
43
|
-
* @typedef {Object} Node
|
|
44
|
-
* @property {string} key
|
|
45
|
-
* @property {number} long
|
|
46
|
-
* @property {number} lat
|
|
47
|
-
*
|
|
48
|
-
* @typedef StyleProperties
|
|
49
|
-
* @property {Array<number>} rgba 0-1
|
|
50
|
-
* @property { number} dashOpacity 0-1
|
|
51
|
-
* @property { number} dashRatio 0-1
|
|
52
|
-
* @property { number } circleDashAngle 0-360
|
|
53
|
-
* @property { number} altitude
|
|
54
|
-
*
|
|
55
|
-
* //property {Array<Node>} nodes
|
|
56
|
-
*/
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
const textWriterGetOrThrow = mapGetOrThrow("textWriterIDs is invalid");
|
|
60
|
-
|
|
61
|
-
export class CircleLineChainPlugin {
|
|
62
|
-
/**
|
|
63
|
-
*
|
|
64
|
-
* @param {*} id
|
|
65
|
-
* @param {Map<[key, ContextTextWriter3]} textWritersMap //import { ContextTextWriter3 } from "@pirireis/webglobeplugins/write-text/context-text3";
|
|
66
|
-
*/
|
|
67
|
-
constructor(id, {
|
|
68
|
-
drawCircleOn = true,
|
|
69
|
-
textWritersMap = new Map(),
|
|
70
|
-
textDataPreAdaptor = null,
|
|
71
|
-
circleFlatEdgeCount = flatCircleEdgeCount - 2
|
|
72
|
-
} = {}) {
|
|
73
|
-
this.id = id;
|
|
74
|
-
this._checktextWritersMap(textWritersMap);
|
|
75
|
-
this._textWritersMap = textWritersMap;
|
|
76
|
-
this._textWritersMap.forEach((writer) => writer.setKeyAdaptor((v, i, c, properties) => v.__identity__));
|
|
77
|
-
this._opacity = 1;
|
|
78
|
-
this._chainListMap = new ChainListMap(keyMethod);
|
|
79
|
-
this.bufferOrchestrator = new BufferOrchestrator({ capacity: 10 });
|
|
80
|
-
this._drawCircleOn = drawCircleOn;
|
|
81
|
-
this._textDataPreAdaptor = textDataPreAdaptor;
|
|
82
|
-
this._circleFlatEdgeCount = circleFlatEdgeCount + 2;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
// init
|
|
86
|
-
|
|
87
|
-
// API
|
|
88
|
-
setDrawCircleOn(bool) {
|
|
89
|
-
if (typeof bool !== 'boolean') throw new Error("setDrawCircleOn parameter must be a boolean");
|
|
90
|
-
this._drawCircleOn = bool;
|
|
91
|
-
this.globe.DrawRender();
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
// ---- updateBulk
|
|
95
|
-
/**
|
|
96
|
-
* @param {Array<chain>} data
|
|
97
|
-
* @typedef chain
|
|
98
|
-
* @property {string} chainKey
|
|
99
|
-
* @property {Array<Node>} nodes
|
|
100
|
-
|
|
101
|
-
*/
|
|
102
|
-
updateCoordinatesBulk(data, { textWriterIDs = [] } = {}) {
|
|
103
|
-
// update implicit data structure
|
|
104
|
-
// find keys to update.. (inserted data and the radius of "from")
|
|
105
|
-
// updateBuffers
|
|
106
|
-
// update text
|
|
107
|
-
const chainKeys = [];
|
|
108
|
-
for (const chain of data) {
|
|
109
|
-
chainKeys.push(chain.chainKey);
|
|
110
|
-
chain.nodes.forEach((node) => {
|
|
111
|
-
this._chainListMap.updateCoordsinatesOfNode(node, chain.chainKey);
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
this._reconstructChains(chainKeys);
|
|
115
|
-
this._updateTexts(chainKeys, textWriterIDs);
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
/**
|
|
120
|
-
* @param {*} chainKey
|
|
121
|
-
* @param {Array<{nodeKey, circleProperties:Map[propertyName ,value], lineProperties:Map[propertyName ,value] }} propertyMap
|
|
122
|
-
*/
|
|
123
|
-
updateNodesProperties(chainKey, nodesAndPropertyMap, { textWriterIDs = [] } = {}) {
|
|
124
|
-
this._chainListMap.updateNodesProperties(chainKey, nodesAndPropertyMap)
|
|
125
|
-
this._reconstructChains([chainKey]);
|
|
126
|
-
this._updateTexts([chainKey], textWriterIDs);
|
|
127
|
-
this.globe.DrawRender();
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
/**
|
|
131
|
-
* @param {*} chainKey
|
|
132
|
-
* @param {Map<propertyName ,value} propertyMap
|
|
133
|
-
*/
|
|
134
|
-
updateChainProperties(chainKey, propertyMap, { textWriterIDs = [] } = {}) {
|
|
135
|
-
this._chainListMap.updateChainProperties(chainKey, propertyMap);
|
|
136
|
-
this._reconstructChains([chainKey]);
|
|
137
|
-
if (textWriterIDs) this._updateTexts([chainKey], textWriterIDs);
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
updateNodeCoordinates(node, chainKey, { textWriterIDs = [] } = {}) {
|
|
142
|
-
this._chainListMap.updateCoordsinatesOfNode(node, chainKey);
|
|
143
|
-
if (textWriterIDs) this._updateTexts([chainKey], textWriterIDs);
|
|
144
|
-
this._reconstructChains([chainKey]);
|
|
145
|
-
this.globe.DrawRender();
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
/**
|
|
150
|
-
*
|
|
151
|
-
|
|
152
|
-
/**
|
|
153
|
-
* @param {Array<string>} textWriterIDs | textWritersMap keys to be used for writing text.
|
|
154
|
-
* @param {Array<string>} chainKeys | if empty, all texts will be updated
|
|
155
|
-
*/
|
|
156
|
-
updateText(textWriterIDs = [], chainKeys = null) {
|
|
157
|
-
if (chainKeys === null) chainKeys = this._chainListMap.getAllChainKeysIterator();
|
|
158
|
-
this._updateTexts(chainKeys, textWriterIDs);
|
|
159
|
-
this.globe.DrawRender();
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
// ---- insertBulk
|
|
164
|
-
/**
|
|
165
|
-
*
|
|
166
|
-
* @param {Array<chain>} data
|
|
167
|
-
*/
|
|
168
|
-
insertBulk(data, { textWriterIDs = [] } = {}) {
|
|
169
|
-
// first insert everything to implicit structure,
|
|
170
|
-
// then iterate over data again to update text
|
|
171
|
-
// let _reconstractChainBufferData method interact with data and bufferOrchestrator.
|
|
172
|
-
const chainKeysToConstruct = [];
|
|
173
|
-
|
|
174
|
-
for (const { chainKey, chainProperties, nodes } of data) {
|
|
175
|
-
this._chainListMap.setChain(chainKey, nodes);
|
|
176
|
-
this._chainListMap.setChainProperties(chainKey, chainProperties);
|
|
177
|
-
chainKeysToConstruct.push(chainKey);
|
|
178
|
-
}
|
|
179
|
-
this._reconstructChains(chainKeysToConstruct);
|
|
180
|
-
if (textWriterIDs) this._updateTexts(chainKeysToConstruct, textWriterIDs);
|
|
181
|
-
this.globe.DrawRender();
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
/**
|
|
185
|
-
* @param {Node} node
|
|
186
|
-
* @param {*} chainKey
|
|
187
|
-
* @param {*} theNodeKeyFront | node key of the next node, null places to the last
|
|
188
|
-
*/
|
|
189
|
-
addNode(node, chainKey, { theNodeKeyFront = null, textWriterIDs = [] } = {}) {
|
|
190
|
-
this._chainListMap.addNode(node, chainKey, theNodeKeyFront);
|
|
191
|
-
if (textWriterIDs) this._updateTexts([chainKey], textWriterIDs);
|
|
192
|
-
this._reconstructChains([chainKey]);
|
|
193
|
-
this.globe.DrawRender();
|
|
194
|
-
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
setOpacity(opacity) {
|
|
199
|
-
opacityCheck(opacity);
|
|
200
|
-
this._textWritersMap.forEach((writer) => writer.setOpacity(opacity));
|
|
201
|
-
this._opacity = opacity;
|
|
202
|
-
this.globe.DrawRender();
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
getChain(chainKey) {
|
|
208
|
-
this._chainListMap.getChain(chainKey);
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
/**
|
|
212
|
-
*
|
|
213
|
-
* @param {*} chainKeys
|
|
214
|
-
*/
|
|
215
|
-
deleteChains(chainKeys) {
|
|
216
|
-
const bufferKeys = [];
|
|
217
|
-
for (const chainKey of chainKeys) {
|
|
218
|
-
bufferKeys.push(...this._chainListMap.deleteChainAndReturnChainKeys(chainKey));
|
|
219
|
-
}
|
|
220
|
-
this._textWritersMap.forEach((writer) => writer.deleteTextBulk(bufferKeys));
|
|
221
|
-
this._updateTexts(chainKeys, this._textWritersMap.keys());
|
|
222
|
-
this.bufferOrchestrator.deleteBulk(bufferKeys, this.bufferManagersCompMap);
|
|
223
|
-
this.globe.DrawRender();
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
/**
|
|
228
|
-
*
|
|
229
|
-
* @param {Array<{chainKey, nodeKeys:[]} keysAndNodes
|
|
230
|
-
*/
|
|
231
|
-
deleteNodes(keysAndNodes, { textWriterIDs = [] } = {}) {
|
|
232
|
-
const bufferKeys = [];
|
|
233
|
-
const chainKeysToReconstuct = [];
|
|
234
|
-
keysAndNodes.forEach(({ chainKey, nodeKeys }) => {
|
|
235
|
-
bufferKeys.push(...this._chainListMap.deleteNodesBelongToAChain(chainKey, nodeKeys));
|
|
236
|
-
chainKeysToReconstuct.push(chainKey);
|
|
237
|
-
});
|
|
238
|
-
this._textWritersMap.forEach((writer) => writer.deleteTextBulk(bufferKeys));
|
|
239
|
-
this.bufferOrchestrator.deleteBulk(bufferKeys, this.bufferManagersCompMap);
|
|
240
|
-
this._reconstructChains(chainKeysToReconstuct);
|
|
241
|
-
this._updateTexts(chainKeysToReconstuct, textWriterIDs);
|
|
242
|
-
this.globe.DrawRender();
|
|
243
|
-
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
init(globe, gl) {
|
|
248
|
-
this.gl = gl;
|
|
249
|
-
this.globe = globe
|
|
250
|
-
this._initOrchestrations()
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
// implicit
|
|
254
|
-
|
|
255
|
-
_checktextWritersMap(textWritersMap) {
|
|
256
|
-
if (!(textWritersMap instanceof Map)) throw new Error("textWritersMap is not an instance of Map");
|
|
257
|
-
textWritersMap.forEach((v) => {
|
|
258
|
-
if (!(v instanceof ContextTextWriter3)) throw new Error("textWritersMap element is not an instance of ContextTextWriter3");
|
|
259
|
-
});
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
_initOrchestrations() {
|
|
263
|
-
const { gl, globe } = this;
|
|
264
|
-
this.lineProgram = LineOnGlobeCache.get(globe);
|
|
265
|
-
this.circleProgram2d = CircleCache.get(globe);
|
|
266
|
-
this.circle3DProgram = Circle3DCache.get(globe);
|
|
267
|
-
|
|
268
|
-
const _circleFlatEdgeCount = this._circleFlatEdgeCount;
|
|
269
|
-
{
|
|
270
|
-
|
|
271
|
-
// createBuffers
|
|
272
|
-
const bufferType = "DYNAMIC_DRAW";
|
|
273
|
-
const initialCapacity = this.bufferOrchestrator.capacity;
|
|
274
|
-
this.bufferManagersCompMap = new Map(
|
|
275
|
-
[
|
|
276
|
-
["centerCoords2d", {
|
|
277
|
-
'bufferManager': new BufferManager(gl, 2, { bufferType, initialCapacity }),
|
|
278
|
-
'adaptor': (item) => new Float32Array(globe.api_GetMercator2DPoint(item.long, item.lat)),
|
|
279
|
-
}],
|
|
280
|
-
["centerCoords3d", {
|
|
281
|
-
'bufferManager': new BufferManager(gl, 3, { bufferType, initialCapacity }),
|
|
282
|
-
'adaptor': (item) => sphereCoord(item.long, item.lat, globe, item.altitude),
|
|
283
|
-
}],
|
|
284
|
-
["targetCoords2d", {
|
|
285
|
-
'bufferManager': new BufferManager(gl, 2, { bufferType, initialCapacity }),
|
|
286
|
-
'adaptor': (item) => new Float32Array(globe.api_GetMercator2DPoint(item.targetLong, item.targetLat)),
|
|
287
|
-
}],
|
|
288
|
-
["targetCoords3d", {
|
|
289
|
-
'bufferManager': new BufferManager(gl, 3, { bufferType, initialCapacity }),
|
|
290
|
-
'adaptor': (item) => sphereCoord(item.targetLong, item.targetLat, globe, item.altitude),
|
|
291
|
-
}],
|
|
292
|
-
["rgba", {
|
|
293
|
-
'bufferManager': new BufferManager(gl, 4, { bufferType, initialCapacity }),
|
|
294
|
-
'adaptor': (item) => {
|
|
295
|
-
if (item.lineProperties?.rgba) return new Float32Array(item.lineProperties.rgba);
|
|
296
|
-
return new Float32Array(item.chainProperties.rgba);
|
|
297
|
-
}
|
|
298
|
-
}],
|
|
299
|
-
// ["bigRadius", {
|
|
300
|
-
// 'bufferManager': new BufferManager(gl, 1, { bufferType, initialCapacity }),
|
|
301
|
-
// 'adaptor': (item) => new Float32Array([item.bigRadius])
|
|
302
|
-
// }],
|
|
303
|
-
["dashRatio", {
|
|
304
|
-
'bufferManager': new BufferManager(gl, 1, { bufferType, initialCapacity }),
|
|
305
|
-
'adaptor': (item) => new Float32Array([item.chainProperties.dashRatio])
|
|
306
|
-
}],
|
|
307
|
-
["dashOpacity", {
|
|
308
|
-
'bufferManager': new BufferManager(gl, 1, { bufferType, initialCapacity }),
|
|
309
|
-
'adaptor': (item) => new Float32Array([item.chainProperties.dashOpacity])
|
|
310
|
-
}],
|
|
311
|
-
["circleDashAngle", {
|
|
312
|
-
'bufferManager': new BufferManager(gl, 1, { bufferType, initialCapacity }),
|
|
313
|
-
'adaptor': (item) => {
|
|
314
|
-
if (item.circleProperties?.circleDashAngle) return new Float32Array([item.circleProperties.circleDashAngle / 360]);
|
|
315
|
-
return new Float32Array([item.chainProperties.circleDashAngle / 360]);
|
|
316
|
-
}
|
|
317
|
-
}],
|
|
318
|
-
["rgbaCircle", {
|
|
319
|
-
"bufferManager": new BufferManager(gl, 4, { bufferType, initialCapacity }),
|
|
320
|
-
"adaptor": (item) => {
|
|
321
|
-
if (item.circleProperties?.rgba) return new Float32Array(item.circleProperties.rgba);
|
|
322
|
-
return new Float32Array(item.chainProperties.rgba);
|
|
323
|
-
}
|
|
324
|
-
}],
|
|
325
|
-
// Mercator buffers
|
|
326
|
-
["circleDashAngleMercator", {
|
|
327
|
-
'bufferManager': new BufferManager(gl, 1 * _circleFlatEdgeCount, { bufferType, initialCapacity }),
|
|
328
|
-
'adaptor': (item) => {
|
|
329
|
-
if (item.circleProperties?.circleDashAngle) return new Float32Array([item.circleProperties.circleDashAngle / 360]);
|
|
330
|
-
return populateFloat32Array.fillFloat32Array(_circleFlatEdgeCount, item.chainProperties.circleDashAngle / 360);
|
|
331
|
-
}
|
|
332
|
-
}],
|
|
333
|
-
["rgbaCircleMercator", { // 62
|
|
334
|
-
"bufferManager": new BufferManager(gl, 4 * _circleFlatEdgeCount, { bufferType, initialCapacity }),
|
|
335
|
-
"adaptor": (item) => {
|
|
336
|
-
if (item.circleProperties?.rgba) return populateFloat32Array.fillWithListData(_circleFlatEdgeCount, item.circleProperties.rgba);
|
|
337
|
-
return populateFloat32Array.fillWithListData(_circleFlatEdgeCount, item.chainProperties.rgba);
|
|
338
|
-
}
|
|
339
|
-
}],
|
|
340
|
-
["dashOpacityMercator", {
|
|
341
|
-
'bufferManager': new BufferManager(gl, 1 * _circleFlatEdgeCount, { bufferType, initialCapacity }),
|
|
342
|
-
'adaptor': (item) => populateFloat32Array.fillFloat32Array(_circleFlatEdgeCount, item.chainProperties.dashOpacity)
|
|
343
|
-
}],
|
|
344
|
-
["centerCoords2dMercator", {
|
|
345
|
-
'bufferManager': new BufferManager(gl, 2 * _circleFlatEdgeCount, { bufferType, initialCapacity }),
|
|
346
|
-
'adaptor': (item) => item.centerCoords2dflat,
|
|
347
|
-
}],
|
|
348
|
-
]
|
|
349
|
-
);
|
|
350
|
-
const obj = (key) => createBufferAndReadInfo(this.bufferManagersCompMap.get(key).bufferManager.buffer);
|
|
351
|
-
|
|
352
|
-
this.lineVao = this.lineProgram.createVAO(
|
|
353
|
-
...['centerCoords2d', 'centerCoords3d', 'targetCoords2d', 'targetCoords3d', 'dashRatio', 'dashOpacity', 'rgba'
|
|
354
|
-
].map(key => obj(key)));
|
|
355
|
-
|
|
356
|
-
this.circleVao2d = this.circleProgram2d.createVAO(
|
|
357
|
-
...["centerCoords2dMercator", "rgbaCircleMercator", "circleDashAngleMercator", "dashOpacityMercator"
|
|
358
|
-
].map(key => obj(key)));
|
|
359
|
-
|
|
360
|
-
this.circle3DVao = this.circle3DProgram.createVAO(
|
|
361
|
-
...["centerCoords3d", "targetCoords3d", "rgbaCircle", "circleDashAngle", "dashOpacity"
|
|
362
|
-
].map(key => obj(key))
|
|
363
|
-
);
|
|
364
|
-
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
_updateTexts(chainKeys, textWriterIDs) {
|
|
372
|
-
if (textWriterIDs.length === 0) return;
|
|
373
|
-
const textWriters = textWriterGetOrThrow(this._textWritersMap, textWriterIDs)
|
|
374
|
-
chainKeys.forEach((chainKey) => {
|
|
375
|
-
this._chainListMap.textUpdate(chainKey, textWriters, this._textDataPreAdaptor);
|
|
376
|
-
});
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
_reconstructChains(chainKeys) {
|
|
381
|
-
const { globe } = this;
|
|
382
|
-
|
|
383
|
-
// const radiusM = radiusMethod(globe);
|
|
384
|
-
const callback = (v, i, array, chainProperties) => {
|
|
385
|
-
if (i === array.length - 1) return null;
|
|
386
|
-
|
|
387
|
-
const centerCoords2dflat = centerCoords2dflatDataCreator(globe, v.long, v.lat, array[i + 1].long, array[i + 1].lat, { edgeCount: this._circleFlatEdgeCount });
|
|
388
|
-
const altitude = (v.altitude ?? chainProperties.altitude ?? 0) / 1000;
|
|
389
|
-
return {
|
|
390
|
-
chainProperties: chainProperties,
|
|
391
|
-
// bigRadius: radiusM(v, i, array),
|
|
392
|
-
targetLong: array[i + 1].long,
|
|
393
|
-
targetLat: array[i + 1].lat,
|
|
394
|
-
altitude: altitude,
|
|
395
|
-
long: v.long,
|
|
396
|
-
lat: v.lat,
|
|
397
|
-
lineProperties: v.lineProperties,
|
|
398
|
-
circleProperties: v.circleProperties,
|
|
399
|
-
centerCoords2dflat,
|
|
400
|
-
key: v.__identity__
|
|
401
|
-
|
|
402
|
-
}
|
|
403
|
-
}
|
|
404
|
-
const bulkData = [];
|
|
405
|
-
chainKeys.forEach((k) => {
|
|
406
|
-
this._chainListMap.calculateBufferPropertiesChain(k, callback, bulkData);
|
|
407
|
-
})
|
|
408
|
-
|
|
409
|
-
this._insertBulk(bulkData);
|
|
410
|
-
}
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
_insertBulk(bulkData) {
|
|
414
|
-
this.bufferOrchestrator.insertBulk(bulkData, this.bufferManagersCompMap);
|
|
415
|
-
this.globe.DrawRender();
|
|
416
|
-
}
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
// GLOBE API
|
|
420
|
-
free() {
|
|
421
|
-
if (this.isFreed) return;
|
|
422
|
-
this.bufferManagersCompMap.forEach(({ bufferManager }) => {
|
|
423
|
-
bufferManager.free();
|
|
424
|
-
})
|
|
425
|
-
LineOnGlobeCache.release(this.globe);
|
|
426
|
-
CircleCache.release(this.globe);
|
|
427
|
-
Circle3DCache.release(this.globe);
|
|
428
|
-
// LineToTheOriginCache.release(this.globe);
|
|
429
|
-
this._textWritersMap.forEach((writer) => writer.free());
|
|
430
|
-
const { gl } = this;
|
|
431
|
-
gl.deleteVertexArray(this.lineVao);
|
|
432
|
-
gl.deleteVertexArray(this.circleVao2d);
|
|
433
|
-
gl.deleteVertexArray(this.circle3DVao);
|
|
434
|
-
this.lineProgram = null;
|
|
435
|
-
this.circleProgram2d = null;
|
|
436
|
-
this.isFreed = true;
|
|
437
|
-
}
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
draw3D() {
|
|
441
|
-
const { gl, globe } = this;
|
|
442
|
-
gl.disable(gl.DEPTH_TEST);
|
|
443
|
-
|
|
444
|
-
const drawOptions = {
|
|
445
|
-
drawRange: {
|
|
446
|
-
first: 0,
|
|
447
|
-
count: this.bufferOrchestrator.length
|
|
448
|
-
}
|
|
449
|
-
}
|
|
450
|
-
this.lineProgram.draw(this.lineVao, drawOptions, this._opacity);
|
|
451
|
-
this._textWritersMap.forEach((writer) => writer.draw());
|
|
452
|
-
const is3D = globe.api_GetCurrentGeometry() === 0;
|
|
453
|
-
if (this._drawCircleOn) {
|
|
454
|
-
if (is3D) {
|
|
455
|
-
this.circle3DProgram.draw(this.circle3DVao, this.bufferOrchestrator.length, this._opacity);
|
|
456
|
-
} else {
|
|
457
|
-
this.circleProgram2d.draw(this.circleVao2d, this.bufferOrchestrator.length, this._circleFlatEdgeCount, this._opacity);
|
|
458
|
-
}
|
|
459
|
-
}
|
|
460
|
-
gl.enable(gl.DEPTH_TEST);
|
|
461
|
-
}
|
|
462
|
-
}
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
// const radiusMethod = (globe) => (v, i, array) => {
|
|
467
|
-
// return globe.Math.GetDist3D(v.long, v.lat, array[i + 1].long, array[i + 1].lat)
|
|
468
|
-
// }
|
|
469
|
-
|