@pirireis/webglobeplugins 0.15.7-alpha → 0.15.8-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/package.json
CHANGED
|
@@ -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 circleOn = nodes[i + 1]?.circleOn ?? true; // Default to true if not specified
|
|
13
|
+
if (!circleOn)
|
|
14
|
+
continue; // Skip if circle is not enabled for this node
|
|
12
15
|
const { key, long, lat, circleProperties } = node;
|
|
13
|
-
const color = circleProperties?.rgba ?? chainProperties.rgba ?? [1, 1, 1, 1]; // Default color if not
|
|
14
|
-
if (key === "Sakarya") {
|
|
15
|
-
console.log("circleProperties", circleProperties, "chainProperties", chainProperties);
|
|
16
|
-
console.log("Sakarya color", color);
|
|
17
|
-
}
|
|
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({
|
|
@@ -32,8 +31,13 @@ export function arcDataAdaptor(chain) {
|
|
|
32
31
|
const { chainKey, chainProperties, nodes } = chain;
|
|
33
32
|
for (let i = 0; i < nodes.length - 1; i++) {
|
|
34
33
|
const node = nodes[i];
|
|
34
|
+
const arcOn = nodes[i + 1]?.arcOn ?? true; // Default to true if not specified
|
|
35
|
+
if (!arcOn)
|
|
36
|
+
continue; // Skip if arc is not enabled for this node
|
|
35
37
|
const nextNode = nodes[i + 1];
|
|
36
38
|
const { key, long, lat, lineProperties } = node;
|
|
39
|
+
if (!arcOn)
|
|
40
|
+
continue; // Skip if arc is not enabled for this node
|
|
37
41
|
const nodeKey = keyMethod(chainKey, key);
|
|
38
42
|
const { long: nextLong, lat: nextLat } = nextNode;
|
|
39
43
|
const color = lineProperties?.rgba ?? chainProperties.rgba ?? [1, 1, 1, 1]; // Default color if not specified
|
|
@@ -53,6 +57,9 @@ 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];
|
|
60
|
+
const lineOn = nextNode?.lineOn ?? true; // Default to true if not specified
|
|
61
|
+
if (!lineOn)
|
|
62
|
+
continue; // Skip if line is not enabled for this node
|
|
56
63
|
const { key, long, lat, lineProperties } = node;
|
|
57
64
|
const nodeKey = keyMethod(chainKey, key);
|
|
58
65
|
const { long: nextLong, lat: nextLat } = nextNode;
|
|
@@ -136,6 +136,12 @@ export class ChainListMap {
|
|
|
136
136
|
chainNode.lineProperties[key] = value;
|
|
137
137
|
});
|
|
138
138
|
}
|
|
139
|
+
if (node.circleOn !== undefined)
|
|
140
|
+
chainNode.circleOn = node.circleOn;
|
|
141
|
+
if (node.arcOn !== undefined)
|
|
142
|
+
chainNode.arcOn = node.arcOn;
|
|
143
|
+
if (node.lineOn !== undefined)
|
|
144
|
+
chainNode.lineOn = node.lineOn;
|
|
139
145
|
});
|
|
140
146
|
}
|
|
141
147
|
updateCoordsinatesOfNode(node, chainKey) {
|
|
@@ -116,11 +116,17 @@ export class CircleLineChainPlugin {
|
|
|
116
116
|
if (this._chainListMap.hasChain(chainKey)) {
|
|
117
117
|
chainsToClean.push(chainKey);
|
|
118
118
|
}
|
|
119
|
+
}
|
|
120
|
+
this._cleanChainsFromSemiPlugins(chainsToClean);
|
|
121
|
+
for (const { chainKey, chainProperties, nodes } of chains) {
|
|
122
|
+
if (!chainKey || !chainProperties || !nodes || nodes.length === 0) {
|
|
123
|
+
console.warn("Invalid chain data, skipping insertion.");
|
|
124
|
+
continue;
|
|
125
|
+
}
|
|
119
126
|
this._chainListMap.setChain(chainKey, nodes);
|
|
120
127
|
this._chainListMap.setChainProperties(chainKey, chainProperties);
|
|
121
128
|
chainKeys.push(chainKey);
|
|
122
129
|
}
|
|
123
|
-
this._cleanChainsFromSemiPlugins(chainsToClean);
|
|
124
130
|
// Reconstruct chains
|
|
125
131
|
this._reconstructChains(chainKeys);
|
|
126
132
|
// Update texts
|
|
@@ -202,6 +208,33 @@ export class CircleLineChainPlugin {
|
|
|
202
208
|
this._updateTexts([chainKey], textWriterIDs);
|
|
203
209
|
this.globe?.DrawRender();
|
|
204
210
|
}
|
|
211
|
+
updateChainDrawOptionsProperties(chainKey, drawOptions, { textWriterIDs = [] } = {}) {
|
|
212
|
+
if (this._freed) {
|
|
213
|
+
console.warn("CircleLineChainPlugin is freed, cannot update chain draw options properties.");
|
|
214
|
+
return;
|
|
215
|
+
}
|
|
216
|
+
const chain = this._chainListMap.getChain(chainKey);
|
|
217
|
+
if (!chain) {
|
|
218
|
+
console.warn(`Chain with key ${chainKey} not found.`);
|
|
219
|
+
return;
|
|
220
|
+
}
|
|
221
|
+
const { nodes } = chain;
|
|
222
|
+
nodes.forEach((node) => {
|
|
223
|
+
if (drawOptions.circleOn !== undefined) {
|
|
224
|
+
node.circleOn = drawOptions.circleOn;
|
|
225
|
+
}
|
|
226
|
+
if (drawOptions.arcOn !== undefined) {
|
|
227
|
+
node.arcOn = drawOptions.arcOn;
|
|
228
|
+
}
|
|
229
|
+
if (drawOptions.line !== undefined) {
|
|
230
|
+
node.lineOn = drawOptions.line;
|
|
231
|
+
}
|
|
232
|
+
});
|
|
233
|
+
this._cleanChainsFromSemiPlugins([chainKey]);
|
|
234
|
+
this._reconstructChains([chainKey]);
|
|
235
|
+
this._updateTexts([chainKey], textWriterIDs);
|
|
236
|
+
this.globe?.DrawRender();
|
|
237
|
+
}
|
|
205
238
|
updateCoordinatesBulk(chains, { textWriterIDs = [] } = {}) {
|
|
206
239
|
if (this._freed) {
|
|
207
240
|
console.warn("CircleLineChainPlugin is freed, cannot update coordinates.");
|