Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update the globe when vector layers are modified #158

Merged
merged 3 commits into from
Mar 15, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions src/essence/Basics/Layers_/Layers_.js
Original file line number Diff line number Diff line change
Expand Up @@ -1416,6 +1416,7 @@ var L_ = {
L_.layersGroup[layerName].clearLayers()
L_.clearVectorLayerInfo()
L_.syncSublayerData(layerName, 'clear')
L_.globeLithoLayerHelper(L_.layersNamed[layerName])
} catch (e) {
console.log(e)
console.warn('Warning: Unable to clear vector layer: ' + layerName)
Expand Down Expand Up @@ -1526,6 +1527,7 @@ var L_ = {
}
}
L_.syncSublayerData(layerName)
L_.globeLithoLayerHelper(L_.layersNamed[layerName])
}
} else {
console.warn(
Expand Down Expand Up @@ -1576,6 +1578,7 @@ var L_ = {
}
}
L_.syncSublayerData(layerName)
L_.globeLithoLayerHelper(L_.layersNamed[layerName])
}
} else {
console.warn(
Expand Down Expand Up @@ -1765,6 +1768,8 @@ var L_ = {
L_.clearVectorLayerInfo()
updateLayer.clearLayers()
updateLayer.addData(layersGeoJSON)
L_.syncSublayerData(layerName)
L_.globeLithoLayerHelper(L_.layersNamed[layerName])
} else {
console.warn(
'Warning: Unable to trim the vector layer `' +
Expand Down Expand Up @@ -1865,6 +1870,8 @@ var L_ = {
L_.clearVectorLayerInfo()
updateLayer.clearLayers()
updateLayer.addData(layersGeoJSON)
L_.syncSublayerData(layerName)
L_.globeLithoLayerHelper(L_.layersNamed[layerName])
} else {
console.warn(
'Warning: Unable to append to the vector layer `' +
Expand Down Expand Up @@ -1896,6 +1903,7 @@ var L_ = {
return
}
L_.syncSublayerData(layerName)
L_.globeLithoLayerHelper(L_.layersNamed[layerName])
} else {
console.warn(
'Warning: Unable to update vector layer as it does not exist: ' +
Expand Down Expand Up @@ -1937,6 +1945,26 @@ var L_ = {
// Clear the description
Description.clearDescription()
},
//Takes in a config layer object
globeLithoLayerHelper: async function(s) {
if (L_.Globe_) {
// Hold the previous layer state
const prevState = L_.toggledArray[s.name]

// Only toggle the layer to reset if the layer is toggled on,
// because if the layer is toggled off, it is not on the globe
if (prevState) {
// Temporarily set layer to on
L_.toggledArray[s.name] = false

// Toggle the layer so its drawn in the globe
await L_.toggleLayer(s)

// Reset the previous layer state
L_.toggledArray[s.name] === prevState
ac-61 marked this conversation as resolved.
Show resolved Hide resolved
}
}
},
}

//Takes in a configData object and does a depth-first search through its
Expand Down