@pirireis/webglobeplugins 0.15.27 → 0.15.29
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/vec3.js
CHANGED
|
@@ -60,7 +60,7 @@ function length(a) {
|
|
|
60
60
|
function normalize(outVec, inVec) {
|
|
61
61
|
const len = length(inVec);
|
|
62
62
|
if (len === 0) {
|
|
63
|
-
console.warn('Cannot normalize a zero vector');
|
|
63
|
+
// console.warn('Cannot normalize a zero vector');
|
|
64
64
|
outVec[0] = 0;
|
|
65
65
|
outVec[1] = 0;
|
|
66
66
|
outVec[2] = 0;
|
package/package.json
CHANGED
|
@@ -19,9 +19,6 @@ export class CircleLineChainPlugin {
|
|
|
19
19
|
_textWritersMap;
|
|
20
20
|
_textDataPreAdaptor = undefined;
|
|
21
21
|
_chainListMap;
|
|
22
|
-
_arcAdaptor = arcDataAdaptor;
|
|
23
|
-
_lineAdaptor = lineDataAdaptor;
|
|
24
|
-
_circleAdaptor = circleDataAdaptor;
|
|
25
22
|
_semiPluginOptions = {
|
|
26
23
|
circleOnTerrainOptions: {
|
|
27
24
|
variativeColorsOn: false,
|
|
@@ -50,14 +47,11 @@ export class CircleLineChainPlugin {
|
|
|
50
47
|
opacity: 1.0,
|
|
51
48
|
}
|
|
52
49
|
};
|
|
53
|
-
constructor(id, { drawCircleOn, textWritersMap, textDataPreAdaptor, opacities,
|
|
50
|
+
constructor(id, { drawCircleOn, textWritersMap, textDataPreAdaptor, opacities, arcOnTerrainOptions, circleOnTerrainOptions, lineOptions } = {}) {
|
|
54
51
|
const defaults = {
|
|
55
52
|
drawCircleOn: true,
|
|
56
53
|
textWritersMap: new Map(),
|
|
57
54
|
textDataPreAdaptor: undefined,
|
|
58
|
-
lineAdaptor: lineDataAdaptor,
|
|
59
|
-
arcAdaptor: arcDataAdaptor,
|
|
60
|
-
circleAdaptor: circleDataAdaptor,
|
|
61
55
|
opacities: {
|
|
62
56
|
general: 1,
|
|
63
57
|
circle: null,
|
|
@@ -73,9 +67,6 @@ export class CircleLineChainPlugin {
|
|
|
73
67
|
drawCircleOn: drawCircleOn ?? defaults.drawCircleOn,
|
|
74
68
|
textWritersMap: textWritersMap ?? defaults.textWritersMap,
|
|
75
69
|
textDataPreAdaptor: textDataPreAdaptor ?? defaults.textDataPreAdaptor,
|
|
76
|
-
lineAdaptor: lineAdaptor ?? defaults.lineAdaptor,
|
|
77
|
-
arcAdaptor: arcAdaptor ?? defaults.arcAdaptor,
|
|
78
|
-
circleAdaptor: circleAdaptor ?? defaults.circleAdaptor,
|
|
79
70
|
opacities: finalOpacities
|
|
80
71
|
};
|
|
81
72
|
this._semiPluginOptions.circleOnTerrainOptions = {
|
|
@@ -95,9 +86,6 @@ export class CircleLineChainPlugin {
|
|
|
95
86
|
this._textWritersMap = config.textWritersMap;
|
|
96
87
|
this._textDataPreAdaptor = config.textDataPreAdaptor;
|
|
97
88
|
this._chainListMap = new ChainListMap(keyMethod);
|
|
98
|
-
this._arcAdaptor = config.arcAdaptor;
|
|
99
|
-
this._lineAdaptor = config.lineAdaptor;
|
|
100
|
-
this._circleAdaptor = config.circleAdaptor;
|
|
101
89
|
this._opacities = config.opacities;
|
|
102
90
|
this._checktextWritersMap(this._textWritersMap);
|
|
103
91
|
this._textWritersMap.forEach((writer) => {
|
|
@@ -182,11 +170,16 @@ export class CircleLineChainPlugin {
|
|
|
182
170
|
console.warn("CircleLineChainPlugin is freed, cannot delete chains.");
|
|
183
171
|
return;
|
|
184
172
|
}
|
|
173
|
+
// type check chainKeys
|
|
174
|
+
if (!Array.isArray(chainKeys) || chainKeys.some(key => typeof key !== "string")) {
|
|
175
|
+
console.warn("Invalid chainKeys array.");
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
185
178
|
for (const chainKey of chainKeys) {
|
|
186
179
|
const keys = this._chainListMap.deleteChainAndReturnChainKeys(chainKey, this._textWritersMap);
|
|
187
180
|
if (keys.length <= 1) {
|
|
188
|
-
console.warn(
|
|
189
|
-
|
|
181
|
+
console.warn(`Deleted chain ${chainKey}, was too small to be displayed.`);
|
|
182
|
+
continue;
|
|
190
183
|
}
|
|
191
184
|
keys.pop(); // Remove the last key which which is destination of the last circle
|
|
192
185
|
this.linePlugin?.deleteBulk(keys);
|
|
@@ -216,6 +209,11 @@ export class CircleLineChainPlugin {
|
|
|
216
209
|
console.warn("CircleLineChainPlugin is freed, cannot update nodes properties.");
|
|
217
210
|
return;
|
|
218
211
|
}
|
|
212
|
+
const hasChain = this._chainListMap.hasChain(chainKey);
|
|
213
|
+
if (!hasChain) {
|
|
214
|
+
console.warn(`Chain with key ${chainKey} not found.`);
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
219
217
|
this._chainListMap.updateNodesProperties(chainKey, nodesAndPropertyList);
|
|
220
218
|
this._cleanChainsFromSemiPlugins([chainKey]);
|
|
221
219
|
this._reconstructChains([chainKey]);
|
|
@@ -373,9 +371,9 @@ export class CircleLineChainPlugin {
|
|
|
373
371
|
console.warn(`Chain with key ${chainKey} not found.`);
|
|
374
372
|
continue;
|
|
375
373
|
}
|
|
376
|
-
const lineInput =
|
|
377
|
-
const arcInput =
|
|
378
|
-
const circleInput =
|
|
374
|
+
const lineInput = lineDataAdaptor(chain);
|
|
375
|
+
const arcInput = arcDataAdaptor(chain);
|
|
376
|
+
const circleInput = circleDataAdaptor(globe, chain);
|
|
379
377
|
this.linePlugin?.insertBulk(lineInput);
|
|
380
378
|
this.arcPlugin?.insertBulk(arcInput);
|
|
381
379
|
this.circlePlugin?.insertBulk(circleInput);
|
|
@@ -164,12 +164,12 @@ export class CircleOnTerrainPlugin {
|
|
|
164
164
|
const keys = [];
|
|
165
165
|
let newItemCount = 0;
|
|
166
166
|
for (const circleInput of circles) {
|
|
167
|
-
if (
|
|
167
|
+
if (circleInput.key == null || circleInput.center == null || circleInput.radius == null) {
|
|
168
168
|
console.warn(`CircleOnTerrainPlugin: Circle input is missing required properties: ${circleInput.radius} or ${circleInput.center} or ${circleInput.key}`);
|
|
169
169
|
continue;
|
|
170
170
|
}
|
|
171
171
|
if (circleInput.radius <= 0) {
|
|
172
|
-
console.warn(`CircleOnTerrainPlugin: Circle ${circleInput.key} has non-positive radius ${circleInput.radius}. Skipping.`);
|
|
172
|
+
// console.warn(`CircleOnTerrainPlugin: Circle ${circleInput.key} has non-positive radius ${circleInput.radius}. Skipping.`);
|
|
173
173
|
continue;
|
|
174
174
|
}
|
|
175
175
|
keys.push(circleInput.key);
|
|
@@ -348,6 +348,10 @@ export class CircleOnTerrainPlugin {
|
|
|
348
348
|
const [{ radius, center, height = null, msl = null }, circleForAzimuthCalc] = this.circleMap.get(key);
|
|
349
349
|
const closestAzimuthAngle = CircleMethods.closestAzimuthAngle(circleForAzimuthCalc, cameraPosition);
|
|
350
350
|
const stregthLevel = defineStregthLevel(currentLOD, radius);
|
|
351
|
+
if (typeof stregthLevel !== "number") {
|
|
352
|
+
console.warn(`CircleOnTerrainPlugin: Circle ${key} has invalid strength level for current LOD ${currentLOD}. Skipping., radius: ${radius}, stregthLevel: ${stregthLevel}`);
|
|
353
|
+
continue;
|
|
354
|
+
}
|
|
351
355
|
if (stregthLevel < 0) {
|
|
352
356
|
console.warn(`CircleOnTerrainPlugin: Circle ${key} has too small radius for current LOD ${currentLOD}. Skipping., radius: ${radius}, stregthLevel: ${stregthLevel}`);
|
|
353
357
|
continue;
|