diff --git a/src/essence/Ancillary/QueryURL.js b/src/essence/Ancillary/QueryURL.js index a702d2cb..db885507 100644 --- a/src/essence/Ancillary/QueryURL.js +++ b/src/essence/Ancillary/QueryURL.js @@ -284,9 +284,11 @@ var QueryURL = { if (mapZoom == undefined) mapZoom = L_.Map_.map.getZoom() var globeCenter = L_.Globe_.litho.getCenter() - if (globeLon == undefined) globeLon = globeCenter.lng - if (globeLat == undefined) globeLat = globeCenter.lat - if (globeZoom == undefined) globeZoom = L_.Globe_.litho.zoom + if (globeCenter) { + if (globeLon == undefined) globeLon = globeCenter.lng + if (globeLat == undefined) globeLat = globeCenter.lat + if (globeZoom == undefined) globeZoom = L_.Globe_.litho.zoom + } var viewerImg = L_.Viewer_.getLastImageId() var viewerLoc = L_.Viewer_.getLocation() diff --git a/src/essence/Basics/Globe_/Globe_.js b/src/essence/Basics/Globe_/Globe_.js index 5d17f7e9..82175229 100644 --- a/src/essence/Basics/Globe_/Globe_.js +++ b/src/essence/Basics/Globe_/Globe_.js @@ -107,6 +107,11 @@ let Globe_ = { // CONSTRUCTOR this.litho = new LithoSphere(containerId, lithoConfig) + if (!L_.hasGlobe) { + this.litho = this.getMockLitho(this.litho) + return + } + this.litho.addControl('mmgisLithoHome', this.litho.controls.home) this.litho.addControl( 'mmgisLithoExaggerate', @@ -199,6 +204,28 @@ let Globe_ = { coordinates.hideElevation() }) }, + getMockLitho: function () { + return { + removeLayer: function () {}, + addLayer: function () {}, + toggleLayer: function () {}, + hasLayer: function () {}, + getCenter: function () {}, + setCenter: function () {}, + getCameras: function () {}, + setLayerOpacity: function () {}, + setLayerFilterEffect: function () {}, + orderLayers: function () {}, + invalidateSize: function () {}, + setLayerSpecificOptions: function () {}, + getElevationAtLngLat: function () { + return 0 + }, + projection: this.litho.projection, + _: {}, + options: {}, + } + }, reset: function () {}, setLink: function () {}, highlight: function () {}, diff --git a/src/essence/Basics/Map_/Map_.js b/src/essence/Basics/Map_/Map_.js index b663e6e8..3dfc79cb 100644 --- a/src/essence/Basics/Map_/Map_.js +++ b/src/essence/Basics/Map_/Map_.js @@ -206,16 +206,18 @@ let Map_ = { $('.map-autoset-zoom').text(Map_.map.getZoom()) }) - this.map.on('move', (e) => { - const c = this.map.getCenter() - Globe_.controls.link.linkMove(c.lng, c.lat) - }) - this.map.on('mousemove', (e) => { - Globe_.controls.link.linkMouseMove(e.latlng.lng, e.latlng.lat) - }) - this.map.on('mouseout', (e) => { - Globe_.controls.link.linkMouseOut() - }) + if (Globe_.controls.link) { + this.map.on('move', (e) => { + const c = this.map.getCenter() + Globe_.controls.link.linkMove(c.lng, c.lat) + }) + this.map.on('mousemove', (e) => { + Globe_.controls.link.linkMouseMove(e.latlng.lng, e.latlng.lat) + }) + this.map.on('mouseout', (e) => { + Globe_.controls.link.linkMouseOut() + }) + } // Clear the selected feature if clicking on the map where there are no features Map_.map.addEventListener('click', clearOnMapClick) diff --git a/src/essence/Basics/UserInterface_/BottomBar.js b/src/essence/Basics/UserInterface_/BottomBar.js index 2b7b0ab2..28d8bed3 100644 --- a/src/essence/Basics/UserInterface_/BottomBar.js +++ b/src/essence/Basics/UserInterface_/BottomBar.js @@ -515,7 +515,7 @@ let BottomBar = { ``, ``, ``, - (L_.Globe_ ? + (L_.Globe_ && L_.hasGlobe ? [`
`, `
3D Globe
`, `