mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-15 15:52:21 +00:00
Convert share link angles and positions through src/geo
Share links convert degrees, radians and the flight destination with src/geo. The hash and the destination are bit for bit the same as before; the flight itself still goes through the Cesium camera.
This commit is contained in:
1 parent
e32988ae5e
commit
bf758a0abb
1 file changed
+11
-21
+11
-21
@@ -1,4 +1,5 @@
|
|||||||
import * as Cesium from 'cesium';
|
import * as Cesium from 'cesium';
|
||||||
|
import { fromDegrees, toDegrees, toRadians } from './geo/index.js';
|
||||||
import { BLOOM_INTENSITY_DEFAULT, BLOOM_SCALE_VERSION } from './bloom.js';
|
import { BLOOM_INTENSITY_DEFAULT, BLOOM_SCALE_VERSION } from './bloom.js';
|
||||||
import {
|
import {
|
||||||
migrateDetectionState,
|
migrateDetectionState,
|
||||||
@@ -327,15 +328,13 @@ export class ShareLinkManager {
|
|||||||
if (this._destroyed || !state)
|
if (this._destroyed || !state)
|
||||||
return { succeeded: false, reason: 'unavailable' };
|
return { succeeded: false, reason: 'unavailable' };
|
||||||
const view = {
|
const view = {
|
||||||
destination: Cesium.Cartesian3.fromDegrees(
|
destination: Cesium.Cartesian3.clone(
|
||||||
state.lon,
|
fromDegrees(state.lon, state.lat, state.alt),
|
||||||
state.lat,
|
|
||||||
state.alt,
|
|
||||||
),
|
),
|
||||||
orientation: {
|
orientation: {
|
||||||
heading: Cesium.Math.toRadians(state.heading),
|
heading: toRadians(state.heading),
|
||||||
pitch: Cesium.Math.toRadians(state.pitch),
|
pitch: toRadians(state.pitch),
|
||||||
roll: Cesium.Math.toRadians(state.roll),
|
roll: toRadians(state.roll),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
let cameraPromise = Promise.resolve({
|
let cameraPromise = Promise.resolve({
|
||||||
@@ -652,21 +651,12 @@ export class ShareLinkManager {
|
|||||||
|
|
||||||
const params = new URLSearchParams();
|
const params = new URLSearchParams();
|
||||||
params.set('v', '2');
|
params.set('v', '2');
|
||||||
params.set('lat', Cesium.Math.toDegrees(carto.latitude).toFixed(4));
|
params.set('lat', toDegrees(carto.latitude).toFixed(4));
|
||||||
params.set('lon', Cesium.Math.toDegrees(carto.longitude).toFixed(4));
|
params.set('lon', toDegrees(carto.longitude).toFixed(4));
|
||||||
params.set('alt', Math.round(carto.height).toString());
|
params.set('alt', Math.round(carto.height).toString());
|
||||||
params.set(
|
params.set('heading', Math.round(toDegrees(camera.heading)).toString());
|
||||||
'heading',
|
params.set('pitch', Math.round(toDegrees(camera.pitch)).toString());
|
||||||
Math.round(Cesium.Math.toDegrees(camera.heading)).toString(),
|
params.set('roll', Math.round(toDegrees(camera.roll)).toString());
|
||||||
);
|
|
||||||
params.set(
|
|
||||||
'pitch',
|
|
||||||
Math.round(Cesium.Math.toDegrees(camera.pitch)).toString(),
|
|
||||||
);
|
|
||||||
params.set(
|
|
||||||
'roll',
|
|
||||||
Math.round(Cesium.Math.toDegrees(camera.roll)).toString(),
|
|
||||||
);
|
|
||||||
params.set('style', STYLE_TO_URL[this._currentStyle] || 'normal');
|
params.set('style', STYLE_TO_URL[this._currentStyle] || 'normal');
|
||||||
params.set('bloom', this._bloomEnabled ? '1' : '0');
|
params.set('bloom', this._bloomEnabled ? '1' : '0');
|
||||||
params.set('sharpen', this._sharpenEnabled ? '1' : '0');
|
params.set('sharpen', this._sharpenEnabled ? '1' : '0');
|
||||||
|
|||||||
Reference in new issue
Block a user