@pirireis/webglobeplugins 0.15.2-3.alpha → 0.15.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-generate-points copy.js +366 -0
- package/Math/arc.js +2 -1
- package/Math/circle-cdf-points.js +170 -1
- package/Math/circle.js +25 -0
- package/Math/globe-util/horizon-plane.js +112 -0
- package/Math/methods.js +2 -2
- package/Math/vec3.js +2 -6
- package/altitude-locator/draw-subset-obj.js +16 -0
- package/altitude-locator/plugin.js +1 -1
- package/bearing-line/plugin.js +2 -3
- package/package.json +1 -1
- package/point-tracks/plugin.js +22 -82
- package/programs/line-on-globe/lines-color-instanced-flat.js +1 -0
- package/programs/line-on-globe/linestrip/linestrip.js +28 -2
- package/programs/line-on-globe/paddings/paddings.js +1 -0
- package/programs/point-on-globe/element-globe-surface-glow.js +1 -0
- package/programs/rings/partial-ring/piece-of-pie copy.js +286 -0
- package/programs/totems/camerauniformblock.js +0 -7
- package/programs/totems/canvas-webglobe-info.js +9 -9
- package/range-tools-on-terrain/bearing-line/adapters.js +5 -8
- package/range-tools-on-terrain/bearing-line/plugin.js +20 -95
- package/range-tools-on-terrain/circle-line-chain/adapters.js +8 -15
- package/range-tools-on-terrain/circle-line-chain/chain-list-map.js +12 -16
- package/range-tools-on-terrain/circle-line-chain/plugin.js +11 -67
- package/range-tools-on-terrain/range-ring/adapters.js +6 -74
- package/range-tools-on-terrain/range-ring/plugin.js +7 -222
- package/range-tools-on-terrain/range-ring/types.js +1 -9
- package/semiplugins/lightweight/line-plugin.js +47 -65
- package/semiplugins/lightweight/piece-of-pie-plugin.js +18 -44
- package/semiplugins/shape-on-terrain/arc-plugin.js +100 -197
- package/semiplugins/shape-on-terrain/circle-plugin.js +90 -209
- package/semiplugins/shape-on-terrain/derived/padding-plugin.js +101 -0
- package/semiplugins/shape-on-terrain/one-degree-padding.js +85 -0
- package/util/account/single-attribute-buffer-management/buffer-manager.js +0 -10
- package/util/account/single-attribute-buffer-management/buffer-orchestrator.js +8 -145
- package/util/account/single-attribute-buffer-management/object-store.js +0 -7
- package/util/build-strategy/static-dynamic.js +1 -11
- package/util/check/typecheck.js +0 -12
- package/util/geometry/index.js +1 -2
- package/programs/totems/globe-changes.js +0 -59
- package/semiplugins/interface.js +0 -1
- package/semiplugins/shape-on-terrain/padding-1-degree.js +0 -538
- package/util/account/single-attribute-buffer-management/buffer-orchestrator1.js +0 -159
- package/util/frame-counter-trigger.js +0 -84
- package/write-text/context-text4.js +0 -140
|
@@ -19,149 +19,15 @@ export class BufferOrchestrator {
|
|
|
19
19
|
this.tombstoneOffsets = [];
|
|
20
20
|
this._length = 0;
|
|
21
21
|
}
|
|
22
|
-
// ...existing code...
|
|
23
|
-
// TODO: CLEAN THIS
|
|
24
|
-
// insertBulk2(items: any[], bufferManagersMap: BufferManagersMap, bufferKeys: string[] | null = null) {
|
|
25
|
-
// this.ensureSpace(items.length, bufferManagersMap);
|
|
26
|
-
// const { offsetMap } = this;
|
|
27
|
-
// // For block insert (truly new, consecutive offsets)
|
|
28
|
-
// const blockItems: any[] = [];
|
|
29
|
-
// let blockStart: number | null = null;
|
|
30
|
-
// let lastBlockOffset: number | null = null;
|
|
31
|
-
// // For single insert (existing or tombstone-assigned)
|
|
32
|
-
// const singleItems: any[] = [];
|
|
33
|
-
// const singleOffsets: number[] = [];
|
|
34
|
-
// for (const item of items) {
|
|
35
|
-
// let offset = offsetMap.get(item.key);
|
|
36
|
-
// if (offset !== undefined) {
|
|
37
|
-
// // Already present, update in place
|
|
38
|
-
// singleItems.push(item);
|
|
39
|
-
// singleOffsets.push(offset);
|
|
40
|
-
// } else {
|
|
41
|
-
// // Assign offset (tombstone or new)
|
|
42
|
-
// if (this.tombstoneOffsets.length > 0) {
|
|
43
|
-
// offset = this.tombstoneOffsets.pop() as number;
|
|
44
|
-
// offsetMap.set(item.key, offset);
|
|
45
|
-
// singleItems.push(item);
|
|
46
|
-
// singleOffsets.push(offset);
|
|
47
|
-
// } else {
|
|
48
|
-
// offset = this._length++;
|
|
49
|
-
// if (offset >= this._capacity) throw new Error("The Size Should Be Increased!!");
|
|
50
|
-
// offsetMap.set(item.key, offset);
|
|
51
|
-
// // Check for consecutive block
|
|
52
|
-
// if (blockStart === null) {
|
|
53
|
-
// blockStart = offset;
|
|
54
|
-
// lastBlockOffset = offset;
|
|
55
|
-
// blockItems.push(item);
|
|
56
|
-
// } else if (lastBlockOffset !== null && offset === lastBlockOffset + 1) {
|
|
57
|
-
// lastBlockOffset = offset;
|
|
58
|
-
// blockItems.push(item);
|
|
59
|
-
// } else {
|
|
60
|
-
// // Not consecutive, flush current block
|
|
61
|
-
// if (blockItems.length > 0) {
|
|
62
|
-
// this._insertBlock(blockItems, blockStart, bufferManagersMap, bufferKeys);
|
|
63
|
-
// blockItems.length = 0;
|
|
64
|
-
// }
|
|
65
|
-
// blockStart = offset;
|
|
66
|
-
// lastBlockOffset = offset;
|
|
67
|
-
// blockItems.push(item);
|
|
68
|
-
// }
|
|
69
|
-
// }
|
|
70
|
-
// }
|
|
71
|
-
// }
|
|
72
|
-
// // Flush any remaining block
|
|
73
|
-
// if (blockItems.length > 0 && blockStart !== null) {
|
|
74
|
-
// this._insertBlock(blockItems, blockStart, bufferManagersMap, bufferKeys);
|
|
75
|
-
// }
|
|
76
|
-
// // Insert singles
|
|
77
|
-
// if (singleItems.length > 0) {
|
|
78
|
-
// if (bufferKeys) {
|
|
79
|
-
// for (const key of bufferKeys) {
|
|
80
|
-
// const bufferManagerComp = bufferManagersMap.get(key);
|
|
81
|
-
// if (!bufferManagerComp) throw new Error("insertBulk bufferKey does not exist");
|
|
82
|
-
// const { bufferManager, adaptor } = bufferManagerComp;
|
|
83
|
-
// bufferManager.insertBulk(singleItems.map(adaptor), singleOffsets);
|
|
84
|
-
// }
|
|
85
|
-
// } else {
|
|
86
|
-
// for (const [key, { bufferManager, adaptor }] of bufferManagersMap) {
|
|
87
|
-
// bufferManager.insertBulk(singleItems.map(adaptor), singleOffsets);
|
|
88
|
-
// }
|
|
89
|
-
// }
|
|
90
|
-
// }
|
|
91
|
-
// }
|
|
92
|
-
// // Helper for block insert
|
|
93
|
-
// private _insertBlock(blockItems: any[], blockStart: number, bufferManagersMap: BufferManagersMap, bufferKeys: string[] | null) {
|
|
94
|
-
// if (bufferKeys) {
|
|
95
|
-
// for (const key of bufferKeys) {
|
|
96
|
-
// const bufferManagerComp = bufferManagersMap.get(key);
|
|
97
|
-
// if (!bufferManagerComp) throw new Error("insertBulk bufferKey does not exist");
|
|
98
|
-
// const { bufferManager, adaptor } = bufferManagerComp;
|
|
99
|
-
// bufferManager.insertBlock(blockItems, blockStart, adaptor, Float32Array);
|
|
100
|
-
// }
|
|
101
|
-
// } else {
|
|
102
|
-
// for (const [key, { bufferManager, adaptor }] of bufferManagersMap) {
|
|
103
|
-
// bufferManager.insertBlock(blockItems, blockStart, adaptor, Float32Array);
|
|
104
|
-
// }
|
|
105
|
-
// }
|
|
106
|
-
// }
|
|
107
|
-
// ...existing code...
|
|
108
|
-
// want to add stack load to this method
|
|
109
|
-
// if offsetMap.has(item.key) === false get next offset, add the item to stack
|
|
110
|
-
// create a single big float32array and fill it with the items
|
|
111
|
-
// bufferManager.insertBulk([bigFloat32Array], [offsets[0]])
|
|
112
22
|
insertBulk(items, bufferManagersMap, bufferKeys = null) {
|
|
113
23
|
this.ensureSpace(items.length, bufferManagersMap);
|
|
114
24
|
const { offsetMap } = this;
|
|
115
|
-
let offsetStart = null;
|
|
116
25
|
const offsets = [];
|
|
117
|
-
const blockLoad = [];
|
|
118
26
|
for (const item of items) {
|
|
119
27
|
let o = offsetMap.get(item.key);
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
offsetMap.set(item.key, o);
|
|
124
|
-
}
|
|
125
|
-
if (o !== undefined) {
|
|
126
|
-
// Already exist or there is a random empty space in earlear part of memory.
|
|
127
|
-
// insert for single slots
|
|
128
|
-
if (bufferKeys) {
|
|
129
|
-
for (const key of bufferKeys) {
|
|
130
|
-
const bufferManagerComp = bufferManagersMap.get(key);
|
|
131
|
-
if (bufferManagerComp === undefined)
|
|
132
|
-
throw new Error("insertBulk bufferKey does not exist");
|
|
133
|
-
const { bufferManager, adaptor } = bufferManagerComp;
|
|
134
|
-
bufferManager.insertBulk([adaptor(item)], [o]);
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
else {
|
|
138
|
-
for (const [key, { bufferManager, adaptor }] of bufferManagersMap) {
|
|
139
|
-
bufferManager.insertBulk([adaptor(item)], [o]);
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
else {
|
|
144
|
-
// offset comes from increment function
|
|
145
|
-
// this part stacks data to be load a a single big block.
|
|
146
|
-
const offset = this.nextOffset();
|
|
147
|
-
if (offset === undefined) {
|
|
148
|
-
throw new Error("The Size Should Be Increased!!");
|
|
149
|
-
}
|
|
150
|
-
offsets.push(offset);
|
|
151
|
-
offsetMap.set(item.key, offset);
|
|
152
|
-
blockLoad.push(item);
|
|
153
|
-
if (offsetStart === null) {
|
|
154
|
-
offsetStart = offset;
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
if (offsetStart === null)
|
|
159
|
-
return;
|
|
160
|
-
for (let i = 0; i < offsets.length - 1; i++) {
|
|
161
|
-
if (offsets[i] - offsets[i + 1] !== -1) {
|
|
162
|
-
// TODO: DELETE THIS
|
|
163
|
-
throw new Error("consecutive is not consecutive");
|
|
164
|
-
}
|
|
28
|
+
const offset = o !== undefined ? o : this.nextOffset();
|
|
29
|
+
offsetMap.set(item.key, offset);
|
|
30
|
+
offsets.push(offset);
|
|
165
31
|
}
|
|
166
32
|
if (bufferKeys) {
|
|
167
33
|
for (const key of bufferKeys) {
|
|
@@ -169,12 +35,12 @@ export class BufferOrchestrator {
|
|
|
169
35
|
if (bufferManagerComp === undefined)
|
|
170
36
|
throw new Error("insertBulk bufferKey does not exist");
|
|
171
37
|
const { bufferManager, adaptor } = bufferManagerComp;
|
|
172
|
-
bufferManager.
|
|
38
|
+
bufferManager.insertBulk(items.map(adaptor), offsets);
|
|
173
39
|
}
|
|
174
40
|
}
|
|
175
41
|
else {
|
|
176
42
|
for (const [key, { bufferManager, adaptor }] of bufferManagersMap) {
|
|
177
|
-
bufferManager.
|
|
43
|
+
bufferManager.insertBulk(items.map(adaptor), offsets);
|
|
178
44
|
}
|
|
179
45
|
}
|
|
180
46
|
}
|
|
@@ -188,7 +54,7 @@ export class BufferOrchestrator {
|
|
|
188
54
|
offsets.push(offset);
|
|
189
55
|
}
|
|
190
56
|
else {
|
|
191
|
-
throw new Error(
|
|
57
|
+
throw new Error("updateBulk item Key does not exist");
|
|
192
58
|
}
|
|
193
59
|
}
|
|
194
60
|
if (bufferKeys) {
|
|
@@ -223,18 +89,15 @@ export class BufferOrchestrator {
|
|
|
223
89
|
getOffset(key) {
|
|
224
90
|
return this.offsetMap.get(key);
|
|
225
91
|
}
|
|
226
|
-
|
|
92
|
+
nextOffset() {
|
|
227
93
|
if (this.tombstoneOffsets.length > 0) {
|
|
228
94
|
const offset = this.tombstoneOffsets.pop();
|
|
229
95
|
return offset;
|
|
230
96
|
}
|
|
231
|
-
return undefined;
|
|
232
|
-
}
|
|
233
|
-
nextOffset() {
|
|
234
97
|
if (this._length < this._capacity) {
|
|
235
98
|
return this._length++;
|
|
236
99
|
}
|
|
237
|
-
return
|
|
100
|
+
return false;
|
|
238
101
|
}
|
|
239
102
|
ensureSpace(itemsLength, bufferManagersMap) {
|
|
240
103
|
if (itemsLength <= this.emptySpace)
|
|
@@ -23,13 +23,6 @@ export class ObjectStore {
|
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
-
insertBlock(objects, startOffset) {
|
|
27
|
-
for (let i = 0; i < objects.length; i++) {
|
|
28
|
-
const object = objects[i];
|
|
29
|
-
const offset = startOffset + i;
|
|
30
|
-
this._container[offset] = object;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
26
|
defrag(offsetValues, occupiedCapacity, newCapacity) {
|
|
34
27
|
const hold = this._createEmptyList(newCapacity);
|
|
35
28
|
for (let i = 0; i < offsetValues.length; i++) {
|
|
@@ -9,31 +9,21 @@ export class StaticDynamicStrategy {
|
|
|
9
9
|
_staticDynamicState = StaticDynamicState.DYNAMIC;
|
|
10
10
|
_transitionLevel = 8; // Default transition level
|
|
11
11
|
_lastStaticDynamicState = StaticDynamicState.STATIC;
|
|
12
|
-
|
|
13
|
-
_toStatic;
|
|
14
|
-
constructor(globe, transitionLevel = 8, toStatic) {
|
|
12
|
+
constructor(globe, transitionLevel = 8) {
|
|
15
13
|
this.globe = globe;
|
|
16
14
|
this._transitionLevel = transitionLevel;
|
|
17
|
-
this._toStatic = toStatic;
|
|
18
15
|
this.updateState();
|
|
19
16
|
}
|
|
20
17
|
updateState() {
|
|
21
18
|
const currentLOD = this.globe.api_GetCurrentLODWithDecimal();
|
|
22
19
|
const state = currentLOD < this._transitionLevel ? StaticDynamicState.STATIC : StaticDynamicState.DYNAMIC;
|
|
23
|
-
const currentGeometry = this.globe.api_GetCurrentGeometry();
|
|
24
20
|
if (this._lastStaticDynamicState === StaticDynamicState.DYNAMIC && state === StaticDynamicState.STATIC) {
|
|
25
21
|
this._staticDynamicState = StaticDynamicState.TO_STATIC;
|
|
26
|
-
this._toStatic();
|
|
27
|
-
}
|
|
28
|
-
else if ((currentGeometry !== this._lastGeometry) && state === StaticDynamicState.STATIC) {
|
|
29
|
-
this._staticDynamicState = StaticDynamicState.TO_STATIC;
|
|
30
|
-
this._toStatic();
|
|
31
22
|
}
|
|
32
23
|
else {
|
|
33
24
|
this._staticDynamicState = state;
|
|
34
25
|
}
|
|
35
26
|
this._lastStaticDynamicState = this._staticDynamicState;
|
|
36
|
-
this._lastGeometry = currentGeometry;
|
|
37
27
|
}
|
|
38
28
|
getState() {
|
|
39
29
|
return this._staticDynamicState;
|
package/util/check/typecheck.js
CHANGED
|
@@ -9,18 +9,6 @@ const doesOwnProperties = (properties, errorMessage) => {
|
|
|
9
9
|
};
|
|
10
10
|
export const isHexColor = (hexColor) => /^#[0-9A-F]{6}$/i.test(hexColor);
|
|
11
11
|
export const isHexColorWithOpacity = (hexColor) => /^#[0-9A-F]{6}[0-9a-f]{0,2}$/i.test(hexColor);
|
|
12
|
-
export const colorCheck = (color) => {
|
|
13
|
-
if (Array.isArray(color)) {
|
|
14
|
-
if (color.length !== 4)
|
|
15
|
-
throw new TypeError("Color must be an array 4 numbers RGBA");
|
|
16
|
-
color.forEach(c => {
|
|
17
|
-
if (typeof c !== "number")
|
|
18
|
-
throw new TypeError("Color array must contain only numbers");
|
|
19
|
-
if (c < 0 || c > 1)
|
|
20
|
-
throw new RangeError("Color values must be between 0 and 1");
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
};
|
|
24
12
|
export const opacityCheck = (opacity) => {
|
|
25
13
|
if (typeof opacity !== "number")
|
|
26
14
|
throw new TypeError("style.opacity must a number");
|
package/util/geometry/index.js
CHANGED
|
@@ -40,8 +40,7 @@ function normalize(array, newLength = 1) {
|
|
|
40
40
|
}
|
|
41
41
|
return result;
|
|
42
42
|
}
|
|
43
|
-
// TODO carry the usefull content to math module.
|
|
44
43
|
function sphereCoord(long, lat, globe, height = 0) {
|
|
45
|
-
return normalize(globe.api_GetCartesian3DPoint(long, lat, 0,
|
|
44
|
+
return normalize(globe.api_GetCartesian3DPoint(long, lat, 0, 0), 6378.137 + height);
|
|
46
45
|
}
|
|
47
46
|
export { createBBoxMatrix, latLongToPixelXY, latLongBboxtoPixelXYBbox, sphereCoord, normalize };
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
export class GlobeChangeObserver {
|
|
2
|
-
globe;
|
|
3
|
-
lastLOD = -1;
|
|
4
|
-
lastGeometry;
|
|
5
|
-
lastWorldWH = { width: 0, height: 0 };
|
|
6
|
-
lastLook = {
|
|
7
|
-
CenterLong: 0,
|
|
8
|
-
CenterLat: 0,
|
|
9
|
-
Distance: 0,
|
|
10
|
-
Tilt: 0,
|
|
11
|
-
NorthAng: 0
|
|
12
|
-
};
|
|
13
|
-
lastElevationCoefficient = NaN;
|
|
14
|
-
changes = {
|
|
15
|
-
geometry: false,
|
|
16
|
-
look: false,
|
|
17
|
-
lod: false,
|
|
18
|
-
lod2DWheel: false,
|
|
19
|
-
elevationScale: false,
|
|
20
|
-
screenMoved: false
|
|
21
|
-
};
|
|
22
|
-
constructor(globe) {
|
|
23
|
-
this.globe = globe;
|
|
24
|
-
this.lastGeometry = globe.api_GetCurrentGeometry();
|
|
25
|
-
this.lastLook = globe.api_GetCurrentLookInfo();
|
|
26
|
-
this.lastLOD = globe.api_GetCurrentLODWithDecimal();
|
|
27
|
-
this.lastWorldWH = globe.api_GetCurrentWorldWH();
|
|
28
|
-
this.lastElevationCoefficient = globe.api_GetZScale();
|
|
29
|
-
}
|
|
30
|
-
checkChanges() {
|
|
31
|
-
const globe = this.globe;
|
|
32
|
-
const currentGeometry = globe.api_GetCurrentGeometry();
|
|
33
|
-
const currentLook = globe.api_GetCurrentLookInfo();
|
|
34
|
-
const currentLOD = globe.api_GetCurrentLODWithDecimal();
|
|
35
|
-
const currentWorldWH = globe.api_GetCurrentWorldWH();
|
|
36
|
-
this.changes.geometry = (this.lastGeometry !== currentGeometry);
|
|
37
|
-
this.changes.look = (this.lastLook.CenterLong !== currentLook.CenterLong ||
|
|
38
|
-
this.lastLook.CenterLat !== currentLook.CenterLat ||
|
|
39
|
-
this.lastLook.Distance !== currentLook.Distance ||
|
|
40
|
-
this.lastLook.Tilt !== currentLook.Tilt ||
|
|
41
|
-
this.lastLook.NorthAng !== currentLook.NorthAng ||
|
|
42
|
-
this.lastWorldWH.width !== currentWorldWH.width ||
|
|
43
|
-
this.lastWorldWH.height !== currentWorldWH.height);
|
|
44
|
-
this.changes.lod = (this.lastLOD !== currentLOD);
|
|
45
|
-
this.changes.lod2DWheel = (!globe.api_IsScreenMoving() && this.changes.lod);
|
|
46
|
-
// Update last known states
|
|
47
|
-
this.lastGeometry = currentGeometry;
|
|
48
|
-
this.lastLook = currentLook;
|
|
49
|
-
this.lastLOD = currentLOD;
|
|
50
|
-
this.lastWorldWH = currentWorldWH;
|
|
51
|
-
this.changes.screenMoved = (this.changes.geometry ||
|
|
52
|
-
this.changes.look ||
|
|
53
|
-
this.changes.lod ||
|
|
54
|
-
this.changes.lod2DWheel);
|
|
55
|
-
}
|
|
56
|
-
getChanges() {
|
|
57
|
-
return this.changes;
|
|
58
|
-
}
|
|
59
|
-
}
|
package/semiplugins/interface.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|