@pirireis/webglobeplugins 0.16.4 → 0.17.0
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/Math/angle-calculation.js +1 -0
- package/Math/arc.js +92 -2
- package/Math/circle-cdf-points.js +2 -2
- package/Math/circle.js +2 -2
- package/Math/contour/quadtreecontours.js +300 -0
- package/Math/finite-line-2d.js +58 -0
- package/Math/juction/arc-plane.js +67 -12
- package/Math/juction/line-sphere.js +6 -6
- package/Math/juction/plane-plane.js +4 -6
- package/Math/methods.js +5 -5
- package/Math/templete-shapes/grid-visually-equal.js +0 -1
- package/Math/tessellation/earcut/adapters.js +37 -0
- package/Math/tessellation/hybrid-triangle-tessellation-meta.js +123 -0
- package/Math/tessellation/methods.js +46 -0
- package/Math/tessellation/shred-input.js +18 -0
- package/Math/tessellation/tile-merger.js +56 -0
- package/Math/tessellation/tiler.js +50 -0
- package/Math/tessellation/triangle-tessellation-meta.js +516 -0
- package/Math/tessellation/triangle-tessellation.js +14 -0
- package/Math/tessellation/zoom-catch.js +1 -0
- package/Math/vec3.js +26 -1
- package/compass-rose/compass-text-writer.js +39 -33
- package/constants.js +3 -0
- package/{util/heatwavedatamanager → heatwave}/datamanager.js +1 -1
- package/heatwave/{plugins/heatwaveglobeshell.js → heatwave.js} +8 -6
- package/heatwave/index.js +5 -3
- package/heatwave/{isobar/plugin.js → isobar.js} +6 -5
- package/{util/heatwavedatamanager → heatwave}/texture-point-sampler.js +24 -3
- package/package.json +7 -3
- package/programs/arrowfield/{object.js → arrow-field.js} +1 -1
- package/programs/arrowfield/logic.js +1 -1
- package/programs/data2legend/density-to-legend.js +24 -29
- package/programs/data2legend/point-to-density-texture.js +14 -17
- package/programs/float2legendwithratio/logic.js +2 -2
- package/programs/float2legendwithratio/object.js +1 -1
- package/programs/helpers/{blender/program.js → blender.js} +1 -1
- package/programs/helpers/{fadeaway/logic.js → fadeaway.js} +11 -2
- package/programs/index.js +20 -9
- package/programs/line-on-globe/circle-accurate-3d.js +12 -14
- package/programs/line-on-globe/circle-accurate-flat.js +0 -1
- package/programs/line-on-globe/degree-padding-around-circle-3d.js +13 -15
- package/programs/line-on-globe/lines-color-instanced-flat.js +15 -18
- package/programs/line-on-globe/naive-accurate-flexible.js +0 -1
- package/programs/picking/pickable-polygon-renderer.js +1 -1
- package/programs/picking/pickable-renderer.js +2 -2
- package/programs/point-on-globe/element-globe-surface-glow.js +2 -2
- package/programs/point-on-globe/element-point-glow.js +1 -1
- package/programs/point-on-globe/square-pixel-point.js +1 -1
- package/programs/polygon-on-globe/texture-dem-triangle-test-plugin-triangle.js +204 -0
- package/programs/polygon-on-globe/texture-dem-triangle-test-plugin.js +31 -10
- package/programs/polygon-on-globe/texture-dem-triangles.js +81 -12
- package/programs/rings/partial-ring/piece-of-pie.js +26 -29
- package/programs/totems/camerauniformblock.js +34 -45
- package/programs/two-d/pixel-padding-for-compass.js +14 -24
- package/programs/vectorfields/logics/drawrectangleparticles.js +1 -2
- package/programs/vectorfields/logics/pixelbased.js +1 -2
- package/programs/vectorfields/pingpongbuffermanager.js +1 -1
- package/range-tools-on-terrain/bearing-line/adapters.js +1 -1
- package/range-tools-on-terrain/circle-line-chain/adapters.js +0 -5
- package/range-tools-on-terrain/circle-line-chain/plugin.js +1 -1
- package/range-tools-on-terrain/range-ring/plugin.js +4 -6
- package/semiplugins/lightweight/line-plugin.js +0 -1
- package/semiplugins/shape-on-terrain/arc-plugin.js +5 -7
- package/semiplugins/shape-on-terrain/circle-plugin.js +2 -2
- package/semiplugins/shape-on-terrain/padding-1-degree.js +1 -2
- package/semiplugins/shell/bbox-renderer/index.js +2 -0
- package/{programs/globeshell/wiggle → semiplugins/shell/bbox-renderer}/logic.js +101 -102
- package/{programs/globeshell/wiggle → semiplugins/shell/bbox-renderer}/object.js +6 -7
- package/semiplugins/utility/container-plugin.js +94 -0
- package/semiplugins/utility/object-pass-container-plugin.js +80 -0
- package/{point-heat-map → tracks/point-heat-map}/adaptors/timetracksplugin-format-to-this.js +1 -1
- package/{point-heat-map → tracks/point-heat-map}/plugin-webworker.js +3 -3
- package/{point-heat-map → tracks/point-heat-map}/point-to-heat-map-flow.js +11 -14
- package/{point-tracks → tracks/point-tracks}/plugin.js +5 -5
- package/{timetracks → tracks/timetracks}/adaptors-line-strip.js +1 -1
- package/{timetracks → tracks/timetracks}/program-line-strip.js +49 -49
- package/{timetracks → tracks/timetracks}/programpoint-line-strip.js +16 -13
- package/types.js +6 -0
- package/util/account/bufferoffsetmanager.js +1 -1
- package/util/account/single-attribute-buffer-management/buffer-orchestrator.js +9 -95
- package/util/gl-util/uniform-block/manager.js +4 -5
- package/util/gl-util/uniform-block/types.js +0 -7
- package/util/index.js +10 -13
- package/util/picking/fence.js +16 -18
- package/util/picking/picker-displayer.js +4 -6
- package/util/programs/{shapesonglobe.js → draw-from-pixel-coords.js} +4 -7
- package/util/programs/draw-texture-on-canvas.js +1 -1
- package/util/programs/texturetoglobe.js +3 -3
- package/util/shaderfunctions/geometrytransformations.js +6 -0
- package/util/webglobe/rasteroverlay.js +1 -0
- package/vectorfield/arrowfield/index.js +3 -0
- package/{arrowfield → vectorfield/arrowfield}/plugin.js +2 -2
- package/{waveparticles → vectorfield/waveparticles}/plugin.js +12 -12
- package/{wind → vectorfield/wind}/index.js +1 -1
- package/{wind → vectorfield/wind}/plugin.js +32 -32
- package/write-text/attached-text-writer.js +9 -1
- package/write-text/context-text3.js +0 -1
- package/write-text/objectarraylabels/index.js +2 -0
- package/Math/mesh/mapbox-delaunay.js +0 -544
- package/arrowfield/index.js +0 -3
- package/bearing-line/index.js +0 -2
- package/bearing-line/plugin.js +0 -444
- package/circle-line-chain/chain-list-map.js +0 -201
- package/circle-line-chain/plugin.js +0 -411
- package/circle-line-chain/util.js +0 -1
- package/compassrose/compassrose.js +0 -293
- package/compassrose/index.js +0 -2
- package/index.js +0 -12
- package/partialrings/buffer-manager.js +0 -75
- package/partialrings/index.js +0 -2
- package/partialrings/plugin.js +0 -128
- package/partialrings/program.js +0 -279
- package/programs/arrowfield/index.js +0 -2
- package/programs/globe-util/is-globe-moved.js +0 -19
- package/programs/globeshell/index.js +0 -2
- package/programs/globeshell/wiggle/index.js +0 -2
- package/programs/helpers/blender/index.js +0 -1
- package/programs/helpers/fadeaway/index.js +0 -2
- package/programs/helpers/fadeaway/object.js +0 -14
- package/programs/helpers/index.js +0 -2
- package/programs/rings/distancering/circleflatprogram.js +0 -116
- package/programs/rings/distancering/circlepaddingfreeangleprogram.js +0 -326
- package/programs/rings/distancering/circlepaddysharedbuffer.js +0 -368
- package/programs/rings/distancering/index.js +0 -6
- package/programs/rings/distancering/paddyflatprogram.js +0 -127
- package/programs/rings/distancering/paddyflatprogram2d.js +0 -129
- package/programs/rings/distancering/paddyflatprogram3d.js +0 -128
- package/programs/two-d/pixel-circle.js +0 -1
- package/programs/vectorfields/index.js +0 -3
- package/rangerings/enum.js +0 -2
- package/rangerings/index.js +0 -5
- package/rangerings/plugin.js +0 -543
- package/rangerings/rangeringangletext.js +0 -326
- package/rangerings/ring-account.js +0 -112
- package/timetracks/index.js +0 -1
- package/util/build-strategy/general-strategy.js +0 -62
- package/util/gl-util/uniform-block/shader.js +0 -1
- package/util/heatwavedatamanager/index.js +0 -2
- package/util/heatwavedatamanager/pointcoordsmeta.js +0 -22
- package/util/jshelpers/data-filler.js +0 -17
- package/util/jshelpers/equality.js +0 -18
- package/util/jshelpers/index.js +0 -2
- package/util/jshelpers/timefilters.js +0 -30
- package/util/programs/index.js +0 -1
- package/util/surface-line-data/arc-bboxes.js +0 -25
- package/util/surface-line-data/arcs-to-cuts.js +0 -50
- package/util/surface-line-data/cut-arc.js +0 -1
- package/util/surface-line-data/flow.js +0 -28
- package/util/surface-line-data/rbush-manager.js +0 -1
- package/util/surface-line-data/web-worker.js +0 -1
- package/write-text/context-text3old.js +0 -152
- package/write-text/index.js +0 -1
- package/write-text/writer-plugin.js +0 -8
- /package/{heatwave/isobar/quadtreecontours.js → Math/contour/quadtreecontours1.js} +0 -0
- /package/{util/surface-line-data → Math/tessellation}/types.js +0 -0
- /package/pin/{pin-object-array.js → pin-object-array1.js} +0 -0
- /package/pin/{pin-point-totem.js → pin-point-totem1.js} +0 -0
- /package/{circle-line-chain/init.js → programs/polygon-on-globe/partial-tesselation.js} +0 -0
- /package/{point-heat-map → tracks/point-heat-map}/index.js +0 -0
- /package/{point-tracks → tracks/point-tracks}/key-methods.js +0 -0
- /package/{timetracks → tracks/timetracks}/plugin-line-strip.js +0 -0
- /package/{arrowfield → vectorfield/arrowfield}/adaptor.js +0 -0
- /package/{waveparticles → vectorfield/waveparticles}/adaptor.js +0 -0
- /package/{waveparticles → vectorfield/waveparticles}/index.js +0 -0
- /package/{wind → vectorfield/wind}/imagetovectorfieldandmagnitude.js +0 -0
- /package/{wind → vectorfield/wind}/vectorfieldimage.js +0 -0
- /package/write-text/{context-text.js → context-textDELETE.js} +0 -0
- /package/{heatwave/isobar → write-text/objectarraylabels}/objectarraylabels.js +0 -0
|
@@ -1,411 +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 "../range-tools-on-terrain/circle-line-chain/chain-list-map";
|
|
6
|
-
import { keyMethod } from "./util";
|
|
7
|
-
import { populateFloat32Array } from "../util/jshelpers/data-filler";
|
|
8
|
-
import { ContextTextWriter3 } from '../write-text/context-text3';
|
|
9
|
-
import { opacityCheck, mapGetOrThrow } from '../util/check/typecheck';
|
|
10
|
-
import { createBufferAndReadInfo } from '../util/gl-util/buffer/attribute-loader';
|
|
11
|
-
import { sphereCoord } from '../util/geometry/index';
|
|
12
|
-
/**
|
|
13
|
-
* Insert info to chain list map (nodes and properties)
|
|
14
|
-
*
|
|
15
|
-
* ask chain list map for text data
|
|
16
|
-
* ask chain list map for buffer data
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* addNode
|
|
20
|
-
* insertBulk
|
|
21
|
-
* deleteChain
|
|
22
|
-
* deleteNodes
|
|
23
|
-
* updateCoordinates()
|
|
24
|
-
* updateChainProperties
|
|
25
|
-
*/
|
|
26
|
-
/**
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
* @typedef chain
|
|
30
|
-
* @property {string} chainKey
|
|
31
|
-
* @property {StyleProperties} chainProperties
|
|
32
|
-
*
|
|
33
|
-
* @typedef {Object} Node
|
|
34
|
-
* @property {string} key
|
|
35
|
-
* @property {number} long
|
|
36
|
-
* @property {number} lat
|
|
37
|
-
* @property {number} altitude
|
|
38
|
-
* @property {StyleProperties} circleProperties
|
|
39
|
-
*
|
|
40
|
-
* @typedef {Object} Node
|
|
41
|
-
* @property {string} key
|
|
42
|
-
* @property {number} long
|
|
43
|
-
* @property {number} lat
|
|
44
|
-
*
|
|
45
|
-
* @typedef StyleProperties
|
|
46
|
-
* @property {Array<number>} rgba 0-1
|
|
47
|
-
* @property { number} dashOpacity 0-1
|
|
48
|
-
* @property { number} dashRatio 0-1
|
|
49
|
-
* @property { number } circleDashAngle 0-360
|
|
50
|
-
* @property { number} altitude
|
|
51
|
-
*
|
|
52
|
-
* //property {Array<Node>} nodes
|
|
53
|
-
*/
|
|
54
|
-
const textWriterGetOrThrow = mapGetOrThrow("textWriterIDs is invalid");
|
|
55
|
-
export class CircleLineChainPlugin {
|
|
56
|
-
/**
|
|
57
|
-
*
|
|
58
|
-
* @param {*} id
|
|
59
|
-
* @param {Map<key, ContextTextWriter3>} textWritersMap //import { ContextTextWriter3 } from "@pirireis/webglobeplugins/write-text/context-text3";
|
|
60
|
-
*/
|
|
61
|
-
constructor(id, { drawCircleOn = true, textWritersMap = new Map(), textDataPreAdaptor = null, circleFlatEdgeCount = flatCircleEdgeCount - 2 } = {}) {
|
|
62
|
-
this.id = id;
|
|
63
|
-
this._checktextWritersMap(textWritersMap);
|
|
64
|
-
this._textWritersMap = textWritersMap;
|
|
65
|
-
this._textWritersMap.forEach((writer) => writer.setKeyAdaptor((v, i, c, properties) => v.__identity__));
|
|
66
|
-
this._opacity = 1;
|
|
67
|
-
this._chainListMap = new ChainListMap(keyMethod);
|
|
68
|
-
this.bufferOrchestrator = new BufferOrchestrator({ capacity: 10 });
|
|
69
|
-
this._drawCircleOn = drawCircleOn;
|
|
70
|
-
this._textDataPreAdaptor = textDataPreAdaptor;
|
|
71
|
-
this._circleFlatEdgeCount = circleFlatEdgeCount + 2;
|
|
72
|
-
}
|
|
73
|
-
// init
|
|
74
|
-
// API
|
|
75
|
-
setDrawCircleOn(bool) {
|
|
76
|
-
if (typeof bool !== 'boolean')
|
|
77
|
-
throw new Error("setDrawCircleOn parameter must be a boolean");
|
|
78
|
-
this._drawCircleOn = bool;
|
|
79
|
-
this.globe.DrawRender();
|
|
80
|
-
}
|
|
81
|
-
// ---- updateBulk
|
|
82
|
-
/**
|
|
83
|
-
* @param {Array<chain>} data
|
|
84
|
-
* @typedef chain
|
|
85
|
-
* @property {string} chainKey
|
|
86
|
-
* @property {Array<Node>} nodes
|
|
87
|
-
|
|
88
|
-
*/
|
|
89
|
-
updateCoordinatesBulk(data, { textWriterIDs = [] } = {}) {
|
|
90
|
-
// update implicit data structure
|
|
91
|
-
// find keys to update.. (inserted data and the radius of "from")
|
|
92
|
-
// updateBuffers
|
|
93
|
-
// update text
|
|
94
|
-
const chainKeys = [];
|
|
95
|
-
for (const chain of data) {
|
|
96
|
-
chainKeys.push(chain.chainKey);
|
|
97
|
-
chain.nodes.forEach((node) => {
|
|
98
|
-
this._chainListMap.updateCoordsinatesOfNode(node, chain.chainKey);
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
this._reconstructChains(chainKeys);
|
|
102
|
-
this._updateTexts(chainKeys, textWriterIDs);
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* @param {*} chainKey
|
|
106
|
-
* @param {Array<{nodeKey, circleProperties:Map[propertyName ,value], lineProperties:Map[propertyName ,value] }} propertyMap
|
|
107
|
-
*/
|
|
108
|
-
updateNodesProperties(chainKey, nodesAndPropertyMap, { textWriterIDs = [] } = {}) {
|
|
109
|
-
this._chainListMap.updateNodesProperties(chainKey, nodesAndPropertyMap);
|
|
110
|
-
this._reconstructChains([chainKey]);
|
|
111
|
-
this._updateTexts([chainKey], textWriterIDs);
|
|
112
|
-
this.globe.DrawRender();
|
|
113
|
-
}
|
|
114
|
-
/**
|
|
115
|
-
* @param {*} chainKey
|
|
116
|
-
* @param {Map<propertyName ,value} propertyMap
|
|
117
|
-
*/
|
|
118
|
-
updateChainProperties(chainKey, propertyMap, { textWriterIDs = [] } = {}) {
|
|
119
|
-
this._chainListMap.updateChainProperties(chainKey, propertyMap);
|
|
120
|
-
this._reconstructChains([chainKey]);
|
|
121
|
-
if (textWriterIDs)
|
|
122
|
-
this._updateTexts([chainKey], textWriterIDs);
|
|
123
|
-
}
|
|
124
|
-
updateNodeCoordinates(node, chainKey, { textWriterIDs = [] } = {}) {
|
|
125
|
-
this._chainListMap.updateCoordsinatesOfNode(node, chainKey);
|
|
126
|
-
if (textWriterIDs)
|
|
127
|
-
this._updateTexts([chainKey], textWriterIDs);
|
|
128
|
-
this._reconstructChains([chainKey]);
|
|
129
|
-
this.globe.DrawRender();
|
|
130
|
-
}
|
|
131
|
-
/**
|
|
132
|
-
*
|
|
133
|
-
* @param {Array<string>} textWriterIDs | textWritersMap keys to be used for writing text.
|
|
134
|
-
* @param {Array<string>} chainKeys | if empty, all texts will be updated
|
|
135
|
-
*/
|
|
136
|
-
updateText(textWriterIDs = [], chainKeys = null) {
|
|
137
|
-
if (chainKeys === null)
|
|
138
|
-
chainKeys = this._chainListMap.getAllChainKeysIterator();
|
|
139
|
-
this._updateTexts(chainKeys, textWriterIDs);
|
|
140
|
-
this.globe.DrawRender();
|
|
141
|
-
}
|
|
142
|
-
// ---- insertBulk
|
|
143
|
-
/**
|
|
144
|
-
*
|
|
145
|
-
* @param {Array<chain>} data
|
|
146
|
-
*/
|
|
147
|
-
insertBulk(data, { textWriterIDs = [] } = {}) {
|
|
148
|
-
// first insert everything to implicit structure,
|
|
149
|
-
// then iterate over data again to update text
|
|
150
|
-
// let _reconstractChainBufferData method interact with data and bufferOrchestrator.
|
|
151
|
-
const chainKeysToConstruct = [];
|
|
152
|
-
for (const { chainKey, chainProperties, nodes } of data) {
|
|
153
|
-
this._chainListMap.setChain(chainKey, nodes);
|
|
154
|
-
this._chainListMap.setChainProperties(chainKey, chainProperties);
|
|
155
|
-
chainKeysToConstruct.push(chainKey);
|
|
156
|
-
}
|
|
157
|
-
this._reconstructChains(chainKeysToConstruct);
|
|
158
|
-
if (textWriterIDs)
|
|
159
|
-
this._updateTexts(chainKeysToConstruct, textWriterIDs);
|
|
160
|
-
this.globe.DrawRender();
|
|
161
|
-
}
|
|
162
|
-
/**
|
|
163
|
-
* @param {Node} node
|
|
164
|
-
* @param {*} chainKey
|
|
165
|
-
* @param {*} theNodeKeyFront | node key of the next node, null places to the last
|
|
166
|
-
*/
|
|
167
|
-
addNode(node, chainKey, { theNodeKeyFront = null, textWriterIDs = [] } = {}) {
|
|
168
|
-
this._chainListMap.addNode(node, chainKey, theNodeKeyFront);
|
|
169
|
-
if (textWriterIDs)
|
|
170
|
-
this._updateTexts([chainKey], textWriterIDs);
|
|
171
|
-
this._reconstructChains([chainKey]);
|
|
172
|
-
this.globe.DrawRender();
|
|
173
|
-
}
|
|
174
|
-
setOpacity(opacity) {
|
|
175
|
-
opacityCheck(opacity);
|
|
176
|
-
this._textWritersMap.forEach((writer) => writer.setOpacity(opacity));
|
|
177
|
-
this._opacity = opacity;
|
|
178
|
-
this.globe.DrawRender();
|
|
179
|
-
}
|
|
180
|
-
getChain(chainKey) {
|
|
181
|
-
this._chainListMap.getNodes(chainKey);
|
|
182
|
-
}
|
|
183
|
-
/**
|
|
184
|
-
*
|
|
185
|
-
* @param {*} chainKeys
|
|
186
|
-
*/
|
|
187
|
-
deleteChains(chainKeys) {
|
|
188
|
-
const bufferKeys = [];
|
|
189
|
-
for (const chainKey of chainKeys) {
|
|
190
|
-
bufferKeys.push(...this._chainListMap.deleteChainAndReturnChainKeys(chainKey));
|
|
191
|
-
}
|
|
192
|
-
this._textWritersMap.forEach((writer) => writer.deleteTextBulk(bufferKeys));
|
|
193
|
-
this._updateTexts(chainKeys, this._textWritersMap.keys());
|
|
194
|
-
this.bufferOrchestrator.deleteBulk(bufferKeys, this.bufferManagersCompMap);
|
|
195
|
-
this.globe.DrawRender();
|
|
196
|
-
}
|
|
197
|
-
/**
|
|
198
|
-
*
|
|
199
|
-
* @param {Array<{chainKey, nodeKeys:[]} keysAndNodes
|
|
200
|
-
*/
|
|
201
|
-
deleteNodes(keysAndNodes, { textWriterIDs = [] } = {}) {
|
|
202
|
-
const bufferKeys = [];
|
|
203
|
-
const chainKeysToReconstuct = [];
|
|
204
|
-
keysAndNodes.forEach(({ chainKey, nodeKeys }) => {
|
|
205
|
-
bufferKeys.push(...this._chainListMap.deleteNodesBelongToAChain(chainKey, nodeKeys));
|
|
206
|
-
chainKeysToReconstuct.push(chainKey);
|
|
207
|
-
});
|
|
208
|
-
this._textWritersMap.forEach((writer) => writer.deleteTextBulk(bufferKeys));
|
|
209
|
-
this.bufferOrchestrator.deleteBulk(bufferKeys, this.bufferManagersCompMap);
|
|
210
|
-
this._reconstructChains(chainKeysToReconstuct);
|
|
211
|
-
this._updateTexts(chainKeysToReconstuct, textWriterIDs);
|
|
212
|
-
this.globe.DrawRender();
|
|
213
|
-
}
|
|
214
|
-
init(globe, gl) {
|
|
215
|
-
this.gl = gl;
|
|
216
|
-
this.globe = globe;
|
|
217
|
-
this._initOrchestrations();
|
|
218
|
-
}
|
|
219
|
-
// implicit
|
|
220
|
-
_checktextWritersMap(textWritersMap) {
|
|
221
|
-
if (!(textWritersMap instanceof Map))
|
|
222
|
-
throw new Error("textWritersMap is not an instance of Map");
|
|
223
|
-
textWritersMap.forEach((v) => {
|
|
224
|
-
if (!(v instanceof ContextTextWriter3))
|
|
225
|
-
throw new Error("textWritersMap element is not an instance of ContextTextWriter3");
|
|
226
|
-
});
|
|
227
|
-
}
|
|
228
|
-
_initOrchestrations() {
|
|
229
|
-
const { gl, globe } = this;
|
|
230
|
-
this.lineProgram = LineOnGlobeCache.get(globe);
|
|
231
|
-
this.circleProgram2d = CircleCache.get(globe);
|
|
232
|
-
this.circle3DProgram = Circle3DCache.get(globe);
|
|
233
|
-
const _circleFlatEdgeCount = this._circleFlatEdgeCount;
|
|
234
|
-
{
|
|
235
|
-
// createBuffers
|
|
236
|
-
const bufferType = "DYNAMIC_DRAW";
|
|
237
|
-
const initialCapacity = this.bufferOrchestrator.capacity;
|
|
238
|
-
this.bufferManagersCompMap = new Map([
|
|
239
|
-
["centerCoords2d", {
|
|
240
|
-
'bufferManager': new BufferManager(gl, 2, { bufferType, initialCapacity }),
|
|
241
|
-
'adaptor': (item) => new Float32Array(globe.api_GetMercator2DPoint(item.long, item.lat)),
|
|
242
|
-
}],
|
|
243
|
-
["centerCoords3d", {
|
|
244
|
-
'bufferManager': new BufferManager(gl, 3, { bufferType, initialCapacity }),
|
|
245
|
-
'adaptor': (item) => sphereCoord(item.long, item.lat, globe, item.altitude),
|
|
246
|
-
}],
|
|
247
|
-
["targetCoords2d", {
|
|
248
|
-
'bufferManager': new BufferManager(gl, 2, { bufferType, initialCapacity }),
|
|
249
|
-
'adaptor': (item) => new Float32Array(globe.api_GetMercator2DPoint(item.targetLong, item.targetLat)),
|
|
250
|
-
}],
|
|
251
|
-
["targetCoords3d", {
|
|
252
|
-
'bufferManager': new BufferManager(gl, 3, { bufferType, initialCapacity }),
|
|
253
|
-
'adaptor': (item) => sphereCoord(item.targetLong, item.targetLat, globe, item.altitude),
|
|
254
|
-
}],
|
|
255
|
-
["rgba", {
|
|
256
|
-
'bufferManager': new BufferManager(gl, 4, { bufferType, initialCapacity }),
|
|
257
|
-
'adaptor': (item) => {
|
|
258
|
-
if (item.lineProperties?.rgba)
|
|
259
|
-
return new Float32Array(item.lineProperties.rgba);
|
|
260
|
-
return new Float32Array(item.chainProperties.rgba);
|
|
261
|
-
}
|
|
262
|
-
}],
|
|
263
|
-
// ["bigRadius", {
|
|
264
|
-
// 'bufferManager': new BufferManager(gl, 1, { bufferType, initialCapacity }),
|
|
265
|
-
// 'adaptor': (item) => new Float32Array([item.bigRadius])
|
|
266
|
-
// }],
|
|
267
|
-
["dashRatio", {
|
|
268
|
-
'bufferManager': new BufferManager(gl, 1, { bufferType, initialCapacity }),
|
|
269
|
-
'adaptor': (item) => new Float32Array([item.chainProperties.dashRatio])
|
|
270
|
-
}],
|
|
271
|
-
["dashOpacity", {
|
|
272
|
-
'bufferManager': new BufferManager(gl, 1, { bufferType, initialCapacity }),
|
|
273
|
-
'adaptor': (item) => new Float32Array([item.chainProperties.dashOpacity])
|
|
274
|
-
}],
|
|
275
|
-
["circleDashAngle", {
|
|
276
|
-
'bufferManager': new BufferManager(gl, 1, { bufferType, initialCapacity }),
|
|
277
|
-
'adaptor': (item) => {
|
|
278
|
-
if (item.circleProperties?.circleDashAngle)
|
|
279
|
-
return new Float32Array([item.circleProperties.circleDashAngle / 360]);
|
|
280
|
-
return new Float32Array([item.chainProperties.circleDashAngle / 360]);
|
|
281
|
-
}
|
|
282
|
-
}],
|
|
283
|
-
["rgbaCircle", {
|
|
284
|
-
"bufferManager": new BufferManager(gl, 4, { bufferType, initialCapacity }),
|
|
285
|
-
"adaptor": (item) => {
|
|
286
|
-
if (item.circleProperties?.rgba)
|
|
287
|
-
return new Float32Array(item.circleProperties.rgba);
|
|
288
|
-
return new Float32Array(item.chainProperties.rgba);
|
|
289
|
-
}
|
|
290
|
-
}],
|
|
291
|
-
// Mercator buffers
|
|
292
|
-
["circleDashAngleMercator", {
|
|
293
|
-
'bufferManager': new BufferManager(gl, 1 * _circleFlatEdgeCount, { bufferType, initialCapacity }),
|
|
294
|
-
'adaptor': (item) => {
|
|
295
|
-
if (item.circleProperties?.circleDashAngle)
|
|
296
|
-
return new Float32Array([item.circleProperties.circleDashAngle / 360]);
|
|
297
|
-
return populateFloat32Array.fillFloat32Array(_circleFlatEdgeCount, item.chainProperties.circleDashAngle / 360);
|
|
298
|
-
}
|
|
299
|
-
}],
|
|
300
|
-
["rgbaCircleMercator", {
|
|
301
|
-
"bufferManager": new BufferManager(gl, 4 * _circleFlatEdgeCount, { bufferType, initialCapacity }),
|
|
302
|
-
"adaptor": (item) => {
|
|
303
|
-
if (item.circleProperties?.rgba)
|
|
304
|
-
return populateFloat32Array.fillWithListData(_circleFlatEdgeCount, item.circleProperties.rgba);
|
|
305
|
-
return populateFloat32Array.fillWithListData(_circleFlatEdgeCount, item.chainProperties.rgba);
|
|
306
|
-
}
|
|
307
|
-
}],
|
|
308
|
-
["dashOpacityMercator", {
|
|
309
|
-
'bufferManager': new BufferManager(gl, 1 * _circleFlatEdgeCount, { bufferType, initialCapacity }),
|
|
310
|
-
'adaptor': (item) => populateFloat32Array.fillFloat32Array(_circleFlatEdgeCount, item.chainProperties.dashOpacity)
|
|
311
|
-
}],
|
|
312
|
-
["centerCoords2dMercator", {
|
|
313
|
-
'bufferManager': new BufferManager(gl, 2 * _circleFlatEdgeCount, { bufferType, initialCapacity }),
|
|
314
|
-
'adaptor': (item) => item.centerCoords2dflat,
|
|
315
|
-
}],
|
|
316
|
-
]);
|
|
317
|
-
const obj = (key) => createBufferAndReadInfo(this.bufferManagersCompMap.get(key).bufferManager.buffer);
|
|
318
|
-
this.lineVao = this.lineProgram.createVAO(...['centerCoords2d', 'centerCoords3d', 'targetCoords2d', 'targetCoords3d', 'dashRatio', 'dashOpacity', 'rgba'
|
|
319
|
-
].map(key => obj(key)));
|
|
320
|
-
this.circleVao2d = this.circleProgram2d.createVAO(...["centerCoords2dMercator", "rgbaCircleMercator", "circleDashAngleMercator", "dashOpacityMercator"
|
|
321
|
-
].map(key => obj(key)));
|
|
322
|
-
this.circle3DVao = this.circle3DProgram.createVAO(...["centerCoords3d", "targetCoords3d", "rgbaCircle", "circleDashAngle", "dashOpacity"
|
|
323
|
-
].map(key => obj(key)));
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
_updateTexts(chainKeys, textWriterIDs) {
|
|
327
|
-
if (textWriterIDs.length === 0)
|
|
328
|
-
return;
|
|
329
|
-
const textWriters = textWriterGetOrThrow(this._textWritersMap, textWriterIDs);
|
|
330
|
-
chainKeys.forEach((chainKey) => {
|
|
331
|
-
this._chainListMap.textUpdate(chainKey, textWriters, this._textDataPreAdaptor);
|
|
332
|
-
});
|
|
333
|
-
}
|
|
334
|
-
_reconstructChains(chainKeys) {
|
|
335
|
-
const { globe } = this;
|
|
336
|
-
// const radiusM = radiusMethod(globe);
|
|
337
|
-
const callback = (v, i, array, chainProperties) => {
|
|
338
|
-
if (i === array.length - 1)
|
|
339
|
-
return null;
|
|
340
|
-
const centerCoords2dflat = centerCoords2dflatDataCreator(globe, v.long, v.lat, array[i + 1].long, array[i + 1].lat, { edgeCount: this._circleFlatEdgeCount });
|
|
341
|
-
const altitude = (v.altitude ?? chainProperties.altitude ?? 0) / 1000;
|
|
342
|
-
return {
|
|
343
|
-
chainProperties: chainProperties,
|
|
344
|
-
// bigRadius: radiusM(v, i, array),
|
|
345
|
-
targetLong: array[i + 1].long,
|
|
346
|
-
targetLat: array[i + 1].lat,
|
|
347
|
-
altitude: altitude,
|
|
348
|
-
long: v.long,
|
|
349
|
-
lat: v.lat,
|
|
350
|
-
lineProperties: v.lineProperties,
|
|
351
|
-
circleProperties: v.circleProperties,
|
|
352
|
-
centerCoords2dflat,
|
|
353
|
-
key: v.__identity__
|
|
354
|
-
};
|
|
355
|
-
};
|
|
356
|
-
const bulkData = [];
|
|
357
|
-
chainKeys.forEach((k) => {
|
|
358
|
-
this._chainListMap.calculateBufferPropertiesChain(k, callback, bulkData);
|
|
359
|
-
});
|
|
360
|
-
this._insertBulk(bulkData);
|
|
361
|
-
}
|
|
362
|
-
_insertBulk(bulkData) {
|
|
363
|
-
this.bufferOrchestrator.insertBulk(bulkData, this.bufferManagersCompMap);
|
|
364
|
-
this.globe.DrawRender();
|
|
365
|
-
}
|
|
366
|
-
// GLOBE API
|
|
367
|
-
free() {
|
|
368
|
-
if (this.isFreed)
|
|
369
|
-
return;
|
|
370
|
-
this.bufferManagersCompMap.forEach(({ bufferManager }) => {
|
|
371
|
-
bufferManager.free();
|
|
372
|
-
});
|
|
373
|
-
LineOnGlobeCache.release(this.globe);
|
|
374
|
-
CircleCache.release(this.globe);
|
|
375
|
-
Circle3DCache.release(this.globe);
|
|
376
|
-
// LineToTheOriginCache.release(this.globe);
|
|
377
|
-
this._textWritersMap.forEach((writer) => writer.free());
|
|
378
|
-
const { gl } = this;
|
|
379
|
-
gl.deleteVertexArray(this.lineVao);
|
|
380
|
-
gl.deleteVertexArray(this.circleVao2d);
|
|
381
|
-
gl.deleteVertexArray(this.circle3DVao);
|
|
382
|
-
this.lineProgram = null;
|
|
383
|
-
this.circleProgram2d = null;
|
|
384
|
-
this.isFreed = true;
|
|
385
|
-
}
|
|
386
|
-
draw3D() {
|
|
387
|
-
const { gl, globe } = this;
|
|
388
|
-
gl.disable(gl.DEPTH_TEST);
|
|
389
|
-
const drawOptions = {
|
|
390
|
-
drawRange: {
|
|
391
|
-
first: 0,
|
|
392
|
-
count: this.bufferOrchestrator.length
|
|
393
|
-
}
|
|
394
|
-
};
|
|
395
|
-
this.lineProgram.draw(this.lineVao, drawOptions, this._opacity);
|
|
396
|
-
this._textWritersMap.forEach((writer) => writer.draw());
|
|
397
|
-
const is3D = globe.api_GetCurrentGeometry() === 0;
|
|
398
|
-
if (this._drawCircleOn) {
|
|
399
|
-
if (is3D) {
|
|
400
|
-
this.circle3DProgram.draw(this.circle3DVao, this.bufferOrchestrator.length, this._opacity);
|
|
401
|
-
}
|
|
402
|
-
else {
|
|
403
|
-
this.circleProgram2d.draw(this.circleVao2d, this.bufferOrchestrator.length, this._circleFlatEdgeCount, this._opacity);
|
|
404
|
-
}
|
|
405
|
-
}
|
|
406
|
-
gl.enable(gl.DEPTH_TEST);
|
|
407
|
-
}
|
|
408
|
-
}
|
|
409
|
-
// const radiusMethod = (globe) => (v, i, array) => {
|
|
410
|
-
// return globe.Math.GetDist3D(v.long, v.lat, array[i + 1].long, array[i + 1].lat)
|
|
411
|
-
// }
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export const keyMethod = (chainKey, nodeKey) => `${chainKey}_${nodeKey}`;
|