Skip to content

Commit

Permalink
Update the globe when vector layers are modified (#158)
Browse files Browse the repository at this point in the history
* Update the globe when vector layers are modified

* Remove extraneous code

* Remove extra variable
  • Loading branch information
ac-61 committed Mar 15, 2022
1 parent b8ce73d commit 4efe578
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 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,20 @@ var L_ = {
// Clear the description
Description.clearDescription()
},
//Takes in a config layer object
globeLithoLayerHelper: async function(s) {
if (L_.Globe_) {
// 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 (L_.toggledArray[s.name]) {
// Temporarily set layer to "off" so the layer will be redrawn
L_.toggledArray[s.name] = false

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

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

0 comments on commit 4efe578

Please sign in to comment.