From a43e9076b2d933fa1236752c5ae2684bc4b3ed12 Mon Sep 17 00:00:00 2001 From: Daven Quinn Date: Mon, 2 Oct 2023 12:36:05 -0500 Subject: [PATCH 1/2] Updated screen space errors --- deps/cesium-viewer | 2 +- packages/globe-dev/src/cesium-view.ts | 19 ++++++++++++------- packages/globe-dev/src/main.ts | 2 +- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/deps/cesium-viewer b/deps/cesium-viewer index a911c879..cdca09dc 160000 --- a/deps/cesium-viewer +++ b/deps/cesium-viewer @@ -1 +1 @@ -Subproject commit a911c8798e355ed741d3f8f69c99248643b08218 +Subproject commit cdca09dc9a01ba35987582d57b5627bc7bb7b4a6 diff --git a/packages/globe-dev/src/cesium-view.ts b/packages/globe-dev/src/cesium-view.ts index 27fe99d3..f8bd7efd 100644 --- a/packages/globe-dev/src/cesium-view.ts +++ b/packages/globe-dev/src/cesium-view.ts @@ -24,15 +24,18 @@ import { MapboxImageryProvider } from "cesium"; // return h(ImageryLayer, { imageryProvider: provider.current, ...rest }); // } +function buildSatelliteLayer({ accessToken }) { + const provider = new MapboxImageryProvider({ + mapId: "mapbox.satellite", + maximumLevel: 19, + accessToken, + }); + return provider; +} + const SatelliteLayer = (props) => { const { accessToken, ...rest } = props; - let satellite = useRef( - new MapboxImageryProvider({ - mapId: "mapbox.satellite", - maximumLevel: 19, - accessToken, - }) - ); + let satellite = useRef(buildSatelliteLayer({ accessToken })); return h(ImageryLayer, { imageryProvider: satellite.current, ...rest }); }; @@ -54,6 +57,8 @@ function CesiumView({ style, accessToken, ...rest }) { { terrainProvider: terrainProvider.current, displayQuality: DisplayQuality.High, + fogDensity: 0.0002, + //skyBox: true, showInspector: true, showIonLogo: false, ...rest, diff --git a/packages/globe-dev/src/main.ts b/packages/globe-dev/src/main.ts index 8b7521fb..21a3df2e 100644 --- a/packages/globe-dev/src/main.ts +++ b/packages/globe-dev/src/main.ts @@ -35,7 +35,7 @@ var opts = { // Makes cesium not render high fps all the time requestRenderMode: true, // Use full scene buffer (respecting pixel ratio) if this is false - useBrowserRecommendedResolution: false, + //useBrowserRecommendedResolution: false, // We have a bug in the tile bounding box calculation somewhere. terrainExaggeration: 1.0, baseLayer: new Cesium.ImageryLayer(satellite), From 86796f2fb45cb16409ad03a9a8d197561271f033 Mon Sep 17 00:00:00 2001 From: Daven Quinn Date: Mon, 2 Oct 2023 12:54:35 -0500 Subject: [PATCH 2/2] Basic link to google earth --- packages/globe-dev/src/index.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/packages/globe-dev/src/index.ts b/packages/globe-dev/src/index.ts index 90819631..b1bc25e5 100644 --- a/packages/globe-dev/src/index.ts +++ b/packages/globe-dev/src/index.ts @@ -51,6 +51,23 @@ function getStartingPosition(): MapPosition { const _CesiumView = memo(CesiumView); +function GoogleEarthLink({ position }) { + const base = "https://earth.google.com/web/"; + const { camera, target } = position; + const { altitude, pitch, bearing, azimuth } = camera; + let url = base; + if (target == null) { + url += `@${camera.lat},${camera.lng},${ + altitude * 100 + }d,${bearing}h,${pitch}t`; + } else { + const { lat, lng, distance } = target; + url += `@${lat},${lng},${distance}d,${bearing}h,${pitch}t`; + } + + return h("a", { href: url, target: "_blank" }, "Open in Google Earth"); +} + function App({ accessToken }) { const initialPosition = useRef(getStartingPosition()); @@ -118,6 +135,7 @@ function App({ accessToken }) { setShown: setShowMapbox, }), h(Link, { href: mapURL }, "Switch to map"), + h(GoogleEarthLink, { position }, "Open in Google Earth"), ]), ]), h("div.map-container", [