@pirireis/webglobeplugins 0.15.1-alpha → 0.15.2-3.alpha
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/arc.js +1 -2
- package/Math/circle-cdf-points.js +1 -170
- package/Math/circle.js +0 -25
- package/Math/methods.js +2 -2
- package/Math/vec3.js +6 -2
- package/altitude-locator/plugin.js +1 -1
- package/bearing-line/plugin.js +3 -2
- package/package.json +1 -1
- package/point-tracks/plugin.js +82 -22
- package/programs/line-on-globe/lines-color-instanced-flat.js +0 -1
- package/programs/line-on-globe/linestrip/linestrip.js +2 -30
- package/programs/point-on-globe/element-globe-surface-glow.js +0 -1
- package/programs/rings/partial-ring/piece-of-pie.js +55 -89
- package/programs/totems/camerauniformblock.js +7 -0
- package/programs/totems/canvas-webglobe-info.js +9 -9
- package/programs/totems/globe-changes.js +59 -0
- package/range-tools-on-terrain/bearing-line/adapters.js +8 -5
- package/range-tools-on-terrain/bearing-line/plugin.js +115 -18
- package/range-tools-on-terrain/circle-line-chain/adapters.js +15 -8
- package/range-tools-on-terrain/circle-line-chain/chain-list-map.js +35 -13
- package/range-tools-on-terrain/circle-line-chain/plugin.js +76 -16
- package/range-tools-on-terrain/range-ring/adapters.js +74 -6
- package/range-tools-on-terrain/range-ring/plugin.js +222 -7
- package/range-tools-on-terrain/range-ring/types.js +9 -1
- package/semiplugins/interface.js +1 -0
- package/semiplugins/lightweight/line-plugin.js +65 -47
- package/semiplugins/lightweight/piece-of-pie-plugin.js +50 -25
- package/semiplugins/shape-on-terrain/arc-plugin.js +197 -100
- package/semiplugins/shape-on-terrain/circle-plugin.js +209 -90
- package/semiplugins/shape-on-terrain/padding-1-degree.js +538 -0
- package/util/account/single-attribute-buffer-management/buffer-manager.js +10 -0
- package/util/account/single-attribute-buffer-management/buffer-orchestrator.js +145 -8
- package/util/account/single-attribute-buffer-management/buffer-orchestrator1.js +159 -0
- package/util/account/single-attribute-buffer-management/object-store.js +7 -0
- package/util/build-strategy/static-dynamic.js +11 -1
- package/util/check/typecheck.js +12 -0
- package/util/frame-counter-trigger.js +84 -0
- package/util/geometry/index.js +2 -1
- package/write-text/context-text4.js +140 -0
- package/Math/arc-generate-points copy.js +0 -366
- package/Math/globe-util/horizon-plane.js +0 -112
- package/altitude-locator/draw-subset-obj.js +0 -16
- package/programs/line-on-globe/paddings/paddings.js +0 -1
- package/programs/rings/partial-ring/piece-of-pie copy.js +0 -286
- package/semiplugins/shape-on-terrain/derived/padding-plugin.js +0 -101
- package/semiplugins/shape-on-terrain/one-degree-padding.js +0 -85
|
@@ -9,12 +9,11 @@ export const circleDataAdaptor = (globe, chain) => {
|
|
|
9
9
|
const { chainKey, chainProperties, nodes } = chain;
|
|
10
10
|
for (let i = 0; i < nodes.length - 1; i++) {
|
|
11
11
|
const node = nodes[i];
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
if (
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
12
|
+
// const circleOn = nodes[i + 1]?.circleOn ?? true; // Default to true if not specified
|
|
13
|
+
const { key, long, lat, circleProperties, circleOn = true } = node;
|
|
14
|
+
if (!circleOn)
|
|
15
|
+
continue; // Skip if circle is not enabled for this node
|
|
16
|
+
const color = circleProperties?.rgba ?? chainProperties.rgba ?? [1, 1, 1, 1]; // Default color if not specifie
|
|
18
17
|
const radius = globe.Math.GetDist2D(long, lat, nodes[i + 1].long, nodes[i + 1].lat);
|
|
19
18
|
const nodeKey = keyMethod(chainKey, key);
|
|
20
19
|
circleInputs.push({
|
|
@@ -23,6 +22,7 @@ export const circleDataAdaptor = (globe, chain) => {
|
|
|
23
22
|
radius,
|
|
24
23
|
height: chainProperties.altitude ?? 0,
|
|
25
24
|
color: color,
|
|
25
|
+
msl: chainProperties.msl ?? null
|
|
26
26
|
});
|
|
27
27
|
}
|
|
28
28
|
return circleInputs;
|
|
@@ -32,8 +32,11 @@ export function arcDataAdaptor(chain) {
|
|
|
32
32
|
const { chainKey, chainProperties, nodes } = chain;
|
|
33
33
|
for (let i = 0; i < nodes.length - 1; i++) {
|
|
34
34
|
const node = nodes[i];
|
|
35
|
+
// const arcOn = nodes[i + 1]?.arcOn ?? true; // Default to true if not specified
|
|
35
36
|
const nextNode = nodes[i + 1];
|
|
36
|
-
const { key, long, lat, lineProperties } = node;
|
|
37
|
+
const { key, long, lat, lineProperties, arcOn = true } = node;
|
|
38
|
+
if (!arcOn)
|
|
39
|
+
continue; // Skip if arc is not enabled for this node
|
|
37
40
|
const nodeKey = keyMethod(chainKey, key);
|
|
38
41
|
const { long: nextLong, lat: nextLat } = nextNode;
|
|
39
42
|
const color = lineProperties?.rgba ?? chainProperties.rgba ?? [1, 1, 1, 1]; // Default color if not specified
|
|
@@ -43,6 +46,7 @@ export function arcDataAdaptor(chain) {
|
|
|
43
46
|
end: [nextLong, nextLat],
|
|
44
47
|
height: chainProperties.altitude ?? 0,
|
|
45
48
|
color: color,
|
|
49
|
+
msl: chainProperties.msl ?? null
|
|
46
50
|
});
|
|
47
51
|
}
|
|
48
52
|
return arcInputs;
|
|
@@ -53,7 +57,10 @@ export function lineDataAdaptor(chain) {
|
|
|
53
57
|
for (let i = 0; i < nodes.length - 1; i++) {
|
|
54
58
|
const node = nodes[i];
|
|
55
59
|
const nextNode = nodes[i + 1];
|
|
56
|
-
const
|
|
60
|
+
// const lineOn = nextNode?.lineOn ?? true; // Default to true if not specified
|
|
61
|
+
const { key, long, lat, lineProperties, lineOn = true } = node;
|
|
62
|
+
if (!lineOn)
|
|
63
|
+
continue; // Skip if line is not enabled for this node
|
|
57
64
|
const nodeKey = keyMethod(chainKey, key);
|
|
58
65
|
const { long: nextLong, lat: nextLat } = nextNode;
|
|
59
66
|
const color = lineProperties?.rgba ?? chainProperties.rgba ?? [1, 1, 1, 1]; // Default color if not specified
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* set and get node data
|
|
3
|
-
* node indexes;
|
|
4
|
-
*/
|
|
5
1
|
export class ChainListMap {
|
|
6
2
|
_chainMap;
|
|
7
3
|
_chainSideProperties;
|
|
@@ -79,6 +75,9 @@ export class ChainListMap {
|
|
|
79
75
|
deleteKeys.push(chain[chain.length - 2].__identity__);
|
|
80
76
|
deleteKeys.push(chain[chain.length - 1].__identity__);
|
|
81
77
|
}
|
|
78
|
+
else if (chain.length === 1) {
|
|
79
|
+
deleteKeys.push(lastItem.__identity__);
|
|
80
|
+
}
|
|
82
81
|
}
|
|
83
82
|
else {
|
|
84
83
|
newChain.push(lastItem);
|
|
@@ -87,10 +86,15 @@ export class ChainListMap {
|
|
|
87
86
|
this._chainMap.set(chainKey, newChain);
|
|
88
87
|
return deleteKeys;
|
|
89
88
|
}
|
|
90
|
-
deleteChainAndReturnChainKeys(chainKey) {
|
|
89
|
+
deleteChainAndReturnChainKeys(chainKey, textWritersMap = null) {
|
|
91
90
|
const keys = this.getNodeKeysOfChain(chainKey);
|
|
91
|
+
if (textWritersMap && textWritersMap.size > 0) {
|
|
92
|
+
textWritersMap.forEach((writer) => {
|
|
93
|
+
writer.deleteTextBulk(keys);
|
|
94
|
+
});
|
|
95
|
+
}
|
|
92
96
|
this._chainMap.delete(chainKey);
|
|
93
|
-
this._chainSideProperties.delete(chainKey);
|
|
97
|
+
this._chainSideProperties.delete(chainKey);
|
|
94
98
|
for (const key of keys)
|
|
95
99
|
this._indexMap.delete(key);
|
|
96
100
|
return keys;
|
|
@@ -106,13 +110,13 @@ export class ChainListMap {
|
|
|
106
110
|
chain[index] = node;
|
|
107
111
|
}
|
|
108
112
|
updateNodesProperties(chainKey, nodes) {
|
|
113
|
+
const chain = this._chainMap.get(chainKey);
|
|
114
|
+
if (!chain)
|
|
115
|
+
return;
|
|
109
116
|
nodes.forEach((node) => {
|
|
110
117
|
const index = this.getIndexOfNode(chainKey, node.key);
|
|
111
118
|
if (index === undefined)
|
|
112
119
|
return;
|
|
113
|
-
const chain = this._chainMap.get(chainKey);
|
|
114
|
-
if (!chain)
|
|
115
|
-
return;
|
|
116
120
|
const chainNode = chain[index];
|
|
117
121
|
if (node.circleProperties) {
|
|
118
122
|
if (typeof chainNode.circleProperties !== 'object')
|
|
@@ -128,6 +132,12 @@ export class ChainListMap {
|
|
|
128
132
|
chainNode.lineProperties[key] = value;
|
|
129
133
|
});
|
|
130
134
|
}
|
|
135
|
+
if (node.circleOn !== undefined)
|
|
136
|
+
chainNode.circleOn = node.circleOn;
|
|
137
|
+
if (node.arcOn !== undefined)
|
|
138
|
+
chainNode.arcOn = node.arcOn;
|
|
139
|
+
if (node.lineOn !== undefined)
|
|
140
|
+
chainNode.lineOn = node.lineOn;
|
|
131
141
|
});
|
|
132
142
|
}
|
|
133
143
|
updateCoordsinatesOfNode(node, chainKey) {
|
|
@@ -163,13 +173,25 @@ export class ChainListMap {
|
|
|
163
173
|
memoryProperties[key] = value;
|
|
164
174
|
});
|
|
165
175
|
}
|
|
166
|
-
//
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
}
|
|
176
|
+
// getNodeProperties(chainKey: string): ChainProperties | undefined {
|
|
177
|
+
// return this._chainSideProperties.get(chainKey);
|
|
178
|
+
// }
|
|
170
179
|
getChainProperties(chainKey) {
|
|
171
180
|
return this._chainSideProperties.get(chainKey);
|
|
172
181
|
}
|
|
182
|
+
deleteTexts(chainKeys, textWriters) {
|
|
183
|
+
if (!textWriters || textWriters.size === 0)
|
|
184
|
+
return;
|
|
185
|
+
textWriters.forEach((writer) => {
|
|
186
|
+
chainKeys.forEach((chainKey) => {
|
|
187
|
+
const chain = this._chainMap.get(chainKey);
|
|
188
|
+
if (!chain)
|
|
189
|
+
return;
|
|
190
|
+
const keys = chain.map((node) => node.__identity__);
|
|
191
|
+
writer.deleteTextBulk(keys);
|
|
192
|
+
});
|
|
193
|
+
});
|
|
194
|
+
}
|
|
173
195
|
/**
|
|
174
196
|
*
|
|
175
197
|
* @param chainKey
|
|
@@ -27,6 +27,7 @@ export class CircleLineChainPlugin {
|
|
|
27
27
|
variativeColorsOn: false,
|
|
28
28
|
defaultColor: [1, 1, 1, 1],
|
|
29
29
|
defaultHeightFromGroundIn3D: 30,
|
|
30
|
+
isMSL: false
|
|
30
31
|
},
|
|
31
32
|
arcOnTerrainOptions: {
|
|
32
33
|
flatViewOn: true,
|
|
@@ -35,7 +36,8 @@ export class CircleLineChainPlugin {
|
|
|
35
36
|
defaultColor: [1, 1, 1, 1],
|
|
36
37
|
defaultHeightFromGroundIn3D: 0,
|
|
37
38
|
vertexCount: 32,
|
|
38
|
-
cameraAttractionIsOn: true // If true, camera attraction is enabled else evenly distributed arc points are used
|
|
39
|
+
cameraAttractionIsOn: true, // If true, camera attraction is enabled else evenly distributed arc points are used
|
|
40
|
+
isMSL: false, // If true, no elevation of terrain
|
|
39
41
|
},
|
|
40
42
|
lineOptions: {
|
|
41
43
|
flatViewOn: true,
|
|
@@ -45,7 +47,7 @@ export class CircleLineChainPlugin {
|
|
|
45
47
|
dashedLineOpacityVariativeOn: false,
|
|
46
48
|
dashedLineRatioVariativeOn: false,
|
|
47
49
|
bufferType: "DYNAMIC_DRAW",
|
|
48
|
-
opacity: 1.0
|
|
50
|
+
opacity: 1.0,
|
|
49
51
|
}
|
|
50
52
|
};
|
|
51
53
|
constructor(id, { drawCircleOn, textWritersMap, textDataPreAdaptor, opacities, lineAdaptor, arcAdaptor, circleAdaptor, arcOnTerrainOptions, circleOnTerrainOptions, lineOptions } = {}) {
|
|
@@ -116,11 +118,17 @@ export class CircleLineChainPlugin {
|
|
|
116
118
|
if (this._chainListMap.hasChain(chainKey)) {
|
|
117
119
|
chainsToClean.push(chainKey);
|
|
118
120
|
}
|
|
121
|
+
}
|
|
122
|
+
this._cleanChainsFromSemiPlugins(chainsToClean);
|
|
123
|
+
for (const { chainKey, chainProperties, nodes } of chains) {
|
|
124
|
+
if (!chainKey || !chainProperties || !nodes || nodes.length === 0) {
|
|
125
|
+
console.warn("Invalid chain data, skipping insertion.");
|
|
126
|
+
continue;
|
|
127
|
+
}
|
|
119
128
|
this._chainListMap.setChain(chainKey, nodes);
|
|
120
129
|
this._chainListMap.setChainProperties(chainKey, chainProperties);
|
|
121
130
|
chainKeys.push(chainKey);
|
|
122
131
|
}
|
|
123
|
-
this._cleanChainsFromSemiPlugins(chainsToClean);
|
|
124
132
|
// Reconstruct chains
|
|
125
133
|
this._reconstructChains(chainKeys);
|
|
126
134
|
// Update texts
|
|
@@ -150,12 +158,23 @@ export class CircleLineChainPlugin {
|
|
|
150
158
|
this.globe?.DrawRender();
|
|
151
159
|
}
|
|
152
160
|
setOpacities(opacities) {
|
|
153
|
-
|
|
161
|
+
if (this._freed) {
|
|
162
|
+
console.warn("CircleLineChainPlugin is freed, cannot set opacities.");
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
154
165
|
this._opacities = {
|
|
155
166
|
...this._opacities,
|
|
156
167
|
...opacities
|
|
157
168
|
};
|
|
158
|
-
|
|
169
|
+
this.globe?.DrawRender();
|
|
170
|
+
}
|
|
171
|
+
setElevationMode(mode) {
|
|
172
|
+
if (this._freed) {
|
|
173
|
+
console.warn("CircleLineChainPlugin is freed, cannot set elevation mode.");
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
this.arcPlugin?.setElevationMode(mode);
|
|
177
|
+
this.circlePlugin?.setElevationMode(mode);
|
|
159
178
|
this.globe?.DrawRender();
|
|
160
179
|
}
|
|
161
180
|
deleteChains(chainKeys) {
|
|
@@ -164,7 +183,7 @@ export class CircleLineChainPlugin {
|
|
|
164
183
|
return;
|
|
165
184
|
}
|
|
166
185
|
for (const chainKey of chainKeys) {
|
|
167
|
-
const keys = this._chainListMap.deleteChainAndReturnChainKeys(chainKey);
|
|
186
|
+
const keys = this._chainListMap.deleteChainAndReturnChainKeys(chainKey, this._textWritersMap);
|
|
168
187
|
if (keys.length <= 1) {
|
|
169
188
|
console.warn("No chains were deleted, chainKeys might be invalid.");
|
|
170
189
|
return;
|
|
@@ -175,33 +194,61 @@ export class CircleLineChainPlugin {
|
|
|
175
194
|
this.circlePlugin?.deleteBulk(keys);
|
|
176
195
|
this._updateTexts(chainKeys, Array.from(this._textWritersMap.keys()));
|
|
177
196
|
}
|
|
197
|
+
this.globe?.DrawRender();
|
|
178
198
|
}
|
|
179
|
-
deleteNodes(keysAndNodes
|
|
199
|
+
deleteNodes(keysAndNodes) {
|
|
180
200
|
if (this._freed) {
|
|
181
201
|
console.warn("CircleLineChainPlugin is freed, cannot delete nodes.");
|
|
182
202
|
return;
|
|
183
203
|
}
|
|
184
|
-
const chainKeysToReconstruct =
|
|
204
|
+
const chainKeysToReconstruct = keysAndNodes.map(({ chainKey }) => chainKey);
|
|
205
|
+
// this._chainListMap.deleteTexts(chainKeysToReconstruct, this._textWritersMap); // TODO: delete this method from chain-list-map
|
|
206
|
+
this._cleanChainsFromSemiPlugins(chainKeysToReconstruct);
|
|
185
207
|
keysAndNodes.forEach(({ chainKey, nodeKeys }) => {
|
|
186
208
|
this._chainListMap.deleteNodesBelongToAChain(chainKey, nodeKeys);
|
|
187
|
-
chainKeysToReconstruct.push(chainKey);
|
|
188
209
|
});
|
|
189
|
-
this._cleanChainsFromSemiPlugins(chainKeysToReconstruct);
|
|
190
210
|
this._reconstructChains(chainKeysToReconstruct);
|
|
191
|
-
this._updateTexts(chainKeysToReconstruct,
|
|
211
|
+
this._updateTexts(chainKeysToReconstruct, Array.from(this._textWritersMap.keys()));
|
|
192
212
|
this.globe?.DrawRender();
|
|
193
213
|
}
|
|
194
|
-
updateNodesProperties(chainKey,
|
|
214
|
+
updateNodesProperties(chainKey, nodesAndPropertyList, { textWriterIDs = [] } = {}) {
|
|
195
215
|
if (this._freed) {
|
|
196
216
|
console.warn("CircleLineChainPlugin is freed, cannot update nodes properties.");
|
|
197
217
|
return;
|
|
198
218
|
}
|
|
199
|
-
this._chainListMap.updateNodesProperties(chainKey,
|
|
219
|
+
this._chainListMap.updateNodesProperties(chainKey, nodesAndPropertyList);
|
|
200
220
|
this._cleanChainsFromSemiPlugins([chainKey]);
|
|
201
221
|
this._reconstructChains([chainKey]);
|
|
202
222
|
this._updateTexts([chainKey], textWriterIDs);
|
|
203
223
|
this.globe?.DrawRender();
|
|
204
224
|
}
|
|
225
|
+
updateChainDrawOptionsProperties(chainKey, drawOptions) {
|
|
226
|
+
if (this._freed) {
|
|
227
|
+
console.warn("CircleLineChainPlugin is freed, cannot update chain draw options properties.");
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
230
|
+
const chain = this._chainListMap.getChain(chainKey);
|
|
231
|
+
if (!chain) {
|
|
232
|
+
console.warn(`Chain with key ${chainKey} not found.`);
|
|
233
|
+
return;
|
|
234
|
+
}
|
|
235
|
+
const { nodes } = chain;
|
|
236
|
+
nodes.forEach((node) => {
|
|
237
|
+
if (drawOptions.circleOn !== undefined) {
|
|
238
|
+
node.circleOn = drawOptions.circleOn;
|
|
239
|
+
}
|
|
240
|
+
if (drawOptions.arcOn !== undefined) {
|
|
241
|
+
node.arcOn = drawOptions.arcOn;
|
|
242
|
+
}
|
|
243
|
+
if (drawOptions.line !== undefined) {
|
|
244
|
+
node.lineOn = drawOptions.line;
|
|
245
|
+
}
|
|
246
|
+
});
|
|
247
|
+
this._cleanChainsFromSemiPlugins([chainKey]);
|
|
248
|
+
this._reconstructChains([chainKey]);
|
|
249
|
+
this._updateTexts([chainKey], Array.from(this._textWritersMap.keys()));
|
|
250
|
+
this.globe?.DrawRender();
|
|
251
|
+
}
|
|
205
252
|
updateCoordinatesBulk(chains, { textWriterIDs = [] } = {}) {
|
|
206
253
|
if (this._freed) {
|
|
207
254
|
console.warn("CircleLineChainPlugin is freed, cannot update coordinates.");
|
|
@@ -253,6 +300,15 @@ export class CircleLineChainPlugin {
|
|
|
253
300
|
this.globe?.DrawRender();
|
|
254
301
|
}
|
|
255
302
|
setDefaultSemiPluginColor(semiPluginName, color) {
|
|
303
|
+
if (semiPluginName === "ALL") {
|
|
304
|
+
this._semiPluginOptions.circleOnTerrainOptions.defaultColor = color;
|
|
305
|
+
this._semiPluginOptions.arcOnTerrainOptions.defaultColor = color;
|
|
306
|
+
this._semiPluginOptions.lineOptions.defaultColor = color;
|
|
307
|
+
this.circlePlugin?.setDefaultColor(color);
|
|
308
|
+
this.arcPlugin?.setDefaultColor(color);
|
|
309
|
+
this.linePlugin?.setDefaultColor(color);
|
|
310
|
+
return;
|
|
311
|
+
}
|
|
256
312
|
switch (semiPluginName) {
|
|
257
313
|
case "circleOnTerrain":
|
|
258
314
|
this._semiPluginOptions.circleOnTerrainOptions.defaultColor = color;
|
|
@@ -294,7 +350,11 @@ export class CircleLineChainPlugin {
|
|
|
294
350
|
for (const chainKey of chainKeys) {
|
|
295
351
|
// Clean chains from text writers
|
|
296
352
|
const nodeKeys = this._chainListMap.getNodeKeysOfChain(chainKey);
|
|
353
|
+
this._textWritersMap.forEach((writer) => {
|
|
354
|
+
writer.deleteTextBulk(nodeKeys);
|
|
355
|
+
});
|
|
297
356
|
nodeKeys.pop(); // Remove the last key which is destination of the last circle
|
|
357
|
+
// Clean chains from semi-plugins
|
|
298
358
|
this.circlePlugin?.deleteBulk(nodeKeys);
|
|
299
359
|
this.linePlugin?.deleteBulk(nodeKeys);
|
|
300
360
|
this.arcPlugin?.deleteBulk(nodeKeys);
|
|
@@ -345,7 +405,7 @@ export class CircleLineChainPlugin {
|
|
|
345
405
|
}
|
|
346
406
|
const circleOpacity = getOpacity(this._opacities, "circle");
|
|
347
407
|
if (this._drawCircleOn && circleOpacity !== 0) {
|
|
348
|
-
this.circlePlugin?.setPluginOpacity(circleOpacity);
|
|
408
|
+
this.circlePlugin?.setPluginOpacity(circleOpacity, false);
|
|
349
409
|
this.circlePlugin?.draw3D();
|
|
350
410
|
}
|
|
351
411
|
const currentGeometry = globe.api_GetCurrentGeometry();
|
|
@@ -354,12 +414,12 @@ export class CircleLineChainPlugin {
|
|
|
354
414
|
// globe view
|
|
355
415
|
const lineOpacity = getOpacity(this._opacities, "globeArc");
|
|
356
416
|
if (lineOpacity !== 0) {
|
|
357
|
-
this.linePlugin?.setPluginOpacity(lineOpacity);
|
|
417
|
+
this.linePlugin?.setPluginOpacity(lineOpacity, false);
|
|
358
418
|
this.linePlugin?.draw3D();
|
|
359
419
|
}
|
|
360
420
|
const arcOpacity = getOpacity(this._opacities, "globeArcFitsTerrain");
|
|
361
421
|
if (arcOpacity !== 0) {
|
|
362
|
-
this.arcPlugin?.setPluginOpacity(arcOpacity);
|
|
422
|
+
this.arcPlugin?.setPluginOpacity(arcOpacity, false);
|
|
363
423
|
this.arcPlugin?.draw3D();
|
|
364
424
|
}
|
|
365
425
|
break;
|
|
@@ -7,19 +7,87 @@
|
|
|
7
7
|
// altitude: rangeRing.altitude,
|
|
8
8
|
// };
|
|
9
9
|
// }
|
|
10
|
+
export const keyAdapter = (centerID, rangeID) => {
|
|
11
|
+
return `${centerID}-${rangeID}`;
|
|
12
|
+
};
|
|
13
|
+
export const allCircleKeysAdapter = (rangeRing) => {
|
|
14
|
+
const result = new Array(rangeRing.rings.length);
|
|
15
|
+
for (let i = 0; i < rangeRing.rings.length; i++) {
|
|
16
|
+
result[i] = keyAdapter(rangeRing.centerID, rangeRing.rings[i].ringID);
|
|
17
|
+
}
|
|
18
|
+
return result;
|
|
19
|
+
};
|
|
10
20
|
export const rangeRingToCircleInputAdapter = (rangeRing) => {
|
|
21
|
+
const centerID = rangeRing.centerID;
|
|
11
22
|
return rangeRing.rings.map(ring => ({
|
|
12
|
-
key: ring.
|
|
23
|
+
key: keyAdapter(centerID, ring.ringID),
|
|
13
24
|
center: [rangeRing.long, rangeRing.lat],
|
|
14
25
|
radius: ring.radius,
|
|
15
26
|
color: rangeRing.rgba,
|
|
16
27
|
altitude: rangeRing.altitude,
|
|
17
28
|
}));
|
|
18
29
|
};
|
|
19
|
-
|
|
20
|
-
|
|
30
|
+
export const allArcKeysAdapter = (rangeRing) => {
|
|
31
|
+
const arcEachRing = Math.ceil(360 / rangeRing.stepAngle);
|
|
32
|
+
const result = new Array(arcEachRing * rangeRing.rings.length);
|
|
33
|
+
for (let i = 0; i < rangeRing.rings.length; i++)
|
|
34
|
+
for (let j = 0; j < arcEachRing; j++)
|
|
35
|
+
result[i * arcEachRing + j] = keyAdapter(rangeRing.centerID, rangeRing.rings[i].ringID) + `-${j}`;
|
|
36
|
+
return result;
|
|
37
|
+
};
|
|
38
|
+
export const rangeRingToArcInputAdapter = (globe, rangeRingInput) => {
|
|
39
|
+
const { long, lat, stepAngle, altitude = 0, rgba, rings } = rangeRingInput;
|
|
40
|
+
const arcEachRing = Math.ceil(360 / stepAngle);
|
|
41
|
+
const result = new Array(rings.length * arcEachRing);
|
|
42
|
+
for (let i = 0; i < rings.length; i++) {
|
|
43
|
+
const ring = rings[i];
|
|
44
|
+
for (let j = 0; j < arcEachRing; j++) {
|
|
45
|
+
const angle = Math.min(stepAngle * j, 360);
|
|
46
|
+
const startLongLat = globe.Math.FindPointByPolar(long, lat, ring.radius, angle);
|
|
47
|
+
const endLongLat = globe.Math.FindPointByPolar(long, lat, ring.radius - ring.padding, angle);
|
|
48
|
+
result[i * arcEachRing + j] = {
|
|
49
|
+
key: keyAdapter(rangeRingInput.centerID, ring.ringID) + `-${j}`,
|
|
50
|
+
start: [startLongLat.long, startLongLat.lat],
|
|
51
|
+
end: [endLongLat.long, endLongLat.lat],
|
|
52
|
+
color: rgba,
|
|
53
|
+
height: altitude,
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return result;
|
|
58
|
+
};
|
|
59
|
+
export function createColorRatios(color, stepAngle, colorFade = 0.4) {
|
|
60
|
+
const angleCount = Math.ceil(360 / stepAngle) * 2;
|
|
61
|
+
let angleLeft = 360;
|
|
62
|
+
const result = new Array(angleCount);
|
|
63
|
+
for (let i = 0; i < angleCount; i++) {
|
|
64
|
+
const currentAngle = Math.min(stepAngle, angleLeft);
|
|
65
|
+
angleLeft -= currentAngle;
|
|
66
|
+
result[i * 2] = {
|
|
67
|
+
color: [0, 0, 0, 0],
|
|
68
|
+
ratio: 1,
|
|
69
|
+
};
|
|
70
|
+
const colorRatio = {
|
|
71
|
+
// color: i % 2 === 0 ? color : [color[0] * colorFade, color[1] * colorFade, color[2] * colorFade, color[3]] as Color,
|
|
72
|
+
color: i % 2 === 0 ? color : [1 - color[0] * colorFade, 1 - color[1] * colorFade, 1 - color[2] * colorFade, color[3]],
|
|
73
|
+
ratio: currentAngle - 1
|
|
74
|
+
};
|
|
75
|
+
result[i * 2 + 1] = colorRatio;
|
|
76
|
+
}
|
|
77
|
+
return result;
|
|
21
78
|
}
|
|
22
|
-
export const
|
|
23
|
-
|
|
24
|
-
|
|
79
|
+
export const padding1DegreeInputAdapter = (bearingLine) => {
|
|
80
|
+
const { long, lat, rgba, altitude = 0, rings, stepAngle } = bearingLine;
|
|
81
|
+
const result = new Array(rings.length);
|
|
82
|
+
for (let i = 0; i < rings.length; i++) {
|
|
83
|
+
const ring = rings[i];
|
|
84
|
+
result[i] = {
|
|
85
|
+
key: keyAdapter(bearingLine.centerID, ring.ringID),
|
|
86
|
+
center: [long, lat],
|
|
87
|
+
radius: ring.radius,
|
|
88
|
+
colorsRatios: createColorRatios(rgba, stepAngle, 0.5),
|
|
89
|
+
heightFromGroundIn3D: altitude,
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
return result;
|
|
25
93
|
};
|