mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +00:00
Build the selected vessel's trail without Cesium
Trail vertices are geo/ellipsoid positions and the minimum move is measured with geo/vector, both giving what the Cesium calls gave. Re-anchoring rows when the geoid loads asks the rendering part for the anchor, now one function prepareRecordVisual shares, so icon positions stay Cesium values. The shared trail renderer takes plain ECEF positions as well, turning them into Cartesian3s for its polyline; the Cartesian3s other layers hand it pass through untouched. tracking leaves the Cesium allow-list.
This commit is contained in:
1 parent
1c840cb66f
commit
e327760074
6 files changed
+224
-26
No files matched your search
@@ -49,7 +49,7 @@ const MIN_SEGMENT_DISTANCE_SQ = 0.01;
|
||||
* @param {object} options - Trail options.
|
||||
* @param {string} options.color - CSS color string for the trail hue.
|
||||
* @param {number} [options.width=2.5] - Polyline width in pixels.
|
||||
* @returns {{setPositions: function(Cesium.Cartesian3[]): void, setVisible: function(boolean): void, clear: function(): void, destroy: function(): void}}
|
||||
* @returns {{setPositions: function(Array<Cesium.Cartesian3|{x: number, y: number, z: number}>): void, setVisible: function(boolean): void, clear: function(): void, destroy: function(): void}}
|
||||
* Trail handle: setPositions replaces the geometry, setVisible temporarily
|
||||
* hides it without discarding history, clear empties it, and destroy removes
|
||||
* the entity permanently.
|
||||
@@ -92,7 +92,8 @@ export function createTrail(viewer, { color, width = 2.5 }) {
|
||||
/**
|
||||
* Replace the trail geometry with a chronological position list
|
||||
* (oldest first). Fewer than 2 distinct positions clears the trail.
|
||||
* @param {Cesium.Cartesian3[]} cartesians - Positions, oldest -> newest.
|
||||
* @param {Array<Cesium.Cartesian3|{x: number, y: number, z: number}>} cartesians
|
||||
* ECEF positions, oldest -> newest.
|
||||
*/
|
||||
setPositions(cartesians) {
|
||||
if (destroyed || !viewer || viewer.isDestroyed()) return;
|
||||
@@ -107,7 +108,12 @@ export function createTrail(viewer, { color, width = 2.5 }) {
|
||||
MIN_SEGMENT_DISTANCE_SQ
|
||||
)
|
||||
continue;
|
||||
positions.push(position);
|
||||
// Callers may hand plain ECEF {x, y, z}: the polyline gets Cartesian3s.
|
||||
positions.push(
|
||||
position instanceof Cesium.Cartesian3
|
||||
? position
|
||||
: new Cesium.Cartesian3(position.x, position.y, position.z),
|
||||
);
|
||||
}
|
||||
current = positions.length >= 2 ? positions : [];
|
||||
ensureEntity();
|
||||
|
||||
Reference in new issue
Block a user