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
`,
`
`,
@@ -555,7 +555,7 @@ let BottomBar = {
$(
'#mainSettingsModalSection3DGlobe #globeSetRadiusOfTiles'
).on('input', function () {
- if (L_.Globe_) {
+ if (L_.Globe_ && L_.hasGlobe) {
L_.Globe_.litho.options.radiusOfTiles = parseInt(
$(this).val()
)
diff --git a/src/essence/Tools/Identifier/IdentifierTool.js b/src/essence/Tools/Identifier/IdentifierTool.js
index a67ea752..27a86c33 100644
--- a/src/essence/Tools/Identifier/IdentifierTool.js
+++ b/src/essence/Tools/Identifier/IdentifierTool.js
@@ -113,11 +113,12 @@ var IdentifierTool = {
}, 5)
},
idPixelGlobe: function (e) {
- IdentifierTool.idPixel(e, [
- Globe_.litho.mouse.lng,
- Globe_.litho.mouse.lat,
- Globe_.litho.zoom,
- ])
+ if (Globe_.litho.mouse)
+ IdentifierTool.idPixel(e, [
+ Globe_.litho.mouse.lng,
+ Globe_.litho.mouse.lat,
+ Globe_.litho.zoom,
+ ])
},
idValueMap: function (e) {
IdentifierTool.idPixel(
@@ -127,11 +128,16 @@ var IdentifierTool = {
)
},
idValueGlobe: function (e) {
- IdentifierTool.idPixel(
- e,
- [Globe_.litho.mouse.lng, Globe_.litho.mouse.lat, Globe_.litho.zoom],
- true
- )
+ if (Globe_.litho.mouse)
+ IdentifierTool.idPixel(
+ e,
+ [
+ Globe_.litho.mouse.lng,
+ Globe_.litho.mouse.lat,
+ Globe_.litho.zoom,
+ ],
+ true
+ )
},
//lnglatzoom is [lng,lat,zoom]
//if trueValue is true, query the data layer for the value, else us the legend if possible
@@ -418,12 +424,15 @@ function interfaceWithMMWebGIS() {
d3.select('#map').style('cursor', 'crosshair')
Map_.map.on('mousemove', IdentifierTool.idPixelMap)
- Globe_.litho
- .getContainer()
- .addEventListener('mousemove', IdentifierTool.idPixelGlobe, false)
- //Globe_.shouldRaycastSprites = false
+ if (L_.hasGlobe) {
+ Globe_.litho
+ .getContainer()
+ .addEventListener('mousemove', IdentifierTool.idPixelGlobe, false)
+ //Globe_.shouldRaycastSprites = false
+
+ Globe_.litho.getContainer().style.cursor = 'crosshair'
+ }
- Globe_.litho.getContainer().style.cursor = 'crosshair'
//Share everything. Don't take things that aren't yours.
// Put things back where you found them.
function separateFromMMWebGIS() {
@@ -431,13 +440,14 @@ function interfaceWithMMWebGIS() {
d3.select('#map').style('cursor', previousCursor)
- //Globe_.shouldRaycastSprites = true
- Globe_.litho.getContainer().style.cursor = 'default'
-
Map_.map.off('mousemove', IdentifierTool.idPixelMap)
- Globe_.litho
- .getContainer()
- .removeEventListener('mousemove', IdentifierTool.idPixelGlobe)
+ //Globe_.shouldRaycastSprites = true
+ if (L_.hasGlobe) {
+ Globe_.litho.getContainer().style.cursor = 'default'
+ Globe_.litho
+ .getContainer()
+ .removeEventListener('mousemove', IdentifierTool.idPixelGlobe)
+ }
}
}
diff --git a/src/essence/Tools/Measure/MeasureTool.js b/src/essence/Tools/Measure/MeasureTool.js
index 3cf08557..36627330 100644
--- a/src/essence/Tools/Measure/MeasureTool.js
+++ b/src/essence/Tools/Measure/MeasureTool.js
@@ -10,7 +10,7 @@ import calls from '../../../pre/calls'
import metricsGraphics from '../../../external/MetricsGraphics/metricsgraphics.min'
-import {render, unmountComponentAtNode } from 'react-dom'
+import { render, unmountComponentAtNode } from 'react-dom'
import React, { useState, useEffect, useRef } from 'react'
import { Chart } from 'chart.js'
@@ -64,15 +64,25 @@ const Measure = () => {
.on('mousemove', MeasureTool.moveMap)
.on('mouseout', MeasureTool.mouseOutMap)
- const globeCont = Globe_.litho.getContainer()
- globeCont.addEventListener(
- 'mousedown',
- MeasureTool.mouseDownGlobe,
- false
- )
- globeCont.addEventListener('mouseup', MeasureTool.clickGlobe, false)
- globeCont.addEventListener('mousemove', MeasureTool.moveGlobe, false)
- globeCont.addEventListener('mouseout', MeasureTool.mouseOutMap, false)
+ if (L_.hasGlobe) {
+ const globeCont = Globe_.litho.getContainer()
+ globeCont.addEventListener(
+ 'mousedown',
+ MeasureTool.mouseDownGlobe,
+ false
+ )
+ globeCont.addEventListener('mouseup', MeasureTool.clickGlobe, false)
+ globeCont.addEventListener(
+ 'mousemove',
+ MeasureTool.moveGlobe,
+ false
+ )
+ globeCont.addEventListener(
+ 'mouseout',
+ MeasureTool.mouseOutMap,
+ false
+ )
+ }
Viewer_.imageViewerMap.addHandler(
'canvas-click',
@@ -632,19 +642,29 @@ let MeasureTool = {
.off('mousemove', MeasureTool.moveMap)
.off('mouseout', MeasureTool.mouseOutMap)
- const globeCont = Globe_.litho.getContainer()
- globeCont.removeEventListener(
- 'mousedown',
- MeasureTool.mouseDownGlobe,
- false
- )
- globeCont.removeEventListener('mouseup', MeasureTool.clickGlobe, false)
- globeCont.removeEventListener('mousemove', MeasureTool.moveGlobe, false)
- globeCont.removeEventListener(
- 'mouseout',
- MeasureTool.mouseOutMap,
- false
- )
+ if (L_.hasGlobe) {
+ const globeCont = Globe_.litho.getContainer()
+ globeCont.removeEventListener(
+ 'mousedown',
+ MeasureTool.mouseDownGlobe,
+ false
+ )
+ globeCont.removeEventListener(
+ 'mouseup',
+ MeasureTool.clickGlobe,
+ false
+ )
+ globeCont.removeEventListener(
+ 'mousemove',
+ MeasureTool.moveGlobe,
+ false
+ )
+ globeCont.removeEventListener(
+ 'mouseout',
+ MeasureTool.mouseOutMap,
+ false
+ )
+ }
Viewer_.imageViewerMap.removeHandler(
'canvas-click',
@@ -1539,28 +1559,30 @@ function makeGlobePolyline(polylinePoints) {
},
})
}
-
- const globeBCR = Globe_.litho.getContainer()?.getBoundingClientRect() || {}
- if (globeBCR.width > 0)
- Globe_.litho.addLayer('clamped', {
- name: '_measurePolyline',
- id: '_measurePolyline',
- on: true,
- order: 10,
- opacity: 1,
- minZoom: 0,
- maxZoom: 30,
- style: {
- default: {
- weight: 3,
- color: 'prop=color',
+ if (L_.hasGlobe) {
+ const globeBCR =
+ Globe_.litho.getContainer()?.getBoundingClientRect() || {}
+ if (globeBCR.width > 0)
+ Globe_.litho.addLayer('clamped', {
+ name: '_measurePolyline',
+ id: '_measurePolyline',
+ on: true,
+ order: 10,
+ opacity: 1,
+ minZoom: 0,
+ maxZoom: 30,
+ style: {
+ default: {
+ weight: 3,
+ color: 'prop=color',
+ },
},
- },
- geojson: {
- type: 'FeatureCollection',
- features: features,
- },
- })
+ geojson: {
+ type: 'FeatureCollection',
+ features: features,
+ },
+ })
+ }
}
MeasureTool.init()