Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
9 changes: 9 additions & 0 deletions src/essence/Basics/Layers_/LayerCapturer.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,11 @@ export const captureVector = (layerObj, options, cb, dynamicCb) => {
layerData?.variables
?.dynamicExtentMoveThreshold ==
null ||
layerData?.variables
?.dynamicExtentMoveThreshold ===
'' ||
layerData._ignoreDynamicExtentMoveThreshold ===
true ||
F_.lngLatDistBetween(
lastLoc.lng,
lastLoc.lat,
Expand All @@ -166,6 +171,7 @@ export const captureVector = (layerObj, options, cb, dynamicCb) => {
)
: 1))
) {
layerData._ignoreDynamicExtentMoveThreshold = false
L_.clearVectorLayer(layerObj.name)
L_.updateVectorLayer(layerObj.name, data)
_geodatasetRequestLastLoc[layerObj.name] =
Expand Down Expand Up @@ -288,6 +294,8 @@ export const captureVector = (layerObj, options, cb, dynamicCb) => {
(lastLoc == null ||
layerData?.variables
?.dynamicExtentMoveThreshold == null ||
layerData._ignoreDynamicExtentMoveThreshold ===
true ||
F_.lngLatDistBetween(
lastLoc.lng,
lastLoc.lat,
Expand All @@ -309,6 +317,7 @@ export const captureVector = (layerObj, options, cb, dynamicCb) => {
)
: 1))
) {
layerData._ignoreDynamicExtentMoveThreshold = false
L_.clearVectorLayer(layerObj.name)
L_.updateVectorLayer(layerObj.name, data)
_layerRequestLastLoc[layerObj.name] = nowLoc
Expand Down
36 changes: 18 additions & 18 deletions src/essence/Basics/Layers_/LayerConstructors.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,34 +82,34 @@ export const constructVectorLayer = (
? F_.parseColor(feature.properties[col.substring(5)]) ||
'#FFF'
: feature.style && feature.style.stroke != null
? feature.style.stroke
: col
? feature.style.stroke
: col
var finalOpa =
opa.toLowerCase().substring(0, 4) === 'prop'
? feature.properties[opa.substring(5)] || '1'
: feature.style && feature.style.opacity != null
? feature.style.opacity
: opa
? feature.style.opacity
: opa
var finalWei =
wei.toLowerCase().substring(0, 4) === 'prop'
? feature.properties[wei.substring(5)] || '1'
: feature.style && feature.style.weight != null
? feature.style.weight
: wei
? feature.style.weight
: wei
if (!isNaN(parseInt(finalWei))) finalWei = parseInt(finalWei)
var finalFiC =
fiC.toLowerCase().substring(0, 4) === 'prop'
? F_.parseColor(feature.properties[fiC.substring(5)]) ||
'#000'
: feature.style && feature.style.fill != null
? feature.style.fill
: fiC
? feature.style.fill
: fiC
var finalFiO =
fiO.toLowerCase().substring(0, 4) === 'prop'
? feature.properties[fiO.substring(5)] || '1'
: feature.style && feature.style.fillopacity != null
? feature.style.fillopacity
: fiO
? feature.style.fillopacity
: fiO

// Check for radius property if radius=1 (default/prop:radius)
layerObj.style.radius =
Expand Down Expand Up @@ -765,8 +765,8 @@ const labels = (geojson, layerObj, leafletLayerObject, layer, sublayers) => {
on: L_.layers.attachments[layerObj.name]?.labels
? L_.layers.attachments[layerObj.name]?.labels.on
: labelsVar.initialVisibility != null
? labelsVar.initialVisibility
: true,
? labelsVar.initialVisibility
: true,
type: 'labels',
geojson: geojson,
layer: layer,
Expand Down Expand Up @@ -936,8 +936,8 @@ const pairings = (geojson, layerObj, leafletLayerObject) => {
on: L_.layers.attachments[layerObj.name]?.pairings
? L_.layers.attachments[layerObj.name]?.pairings.on
: pairingsVar.initialVisibility != null
? pairingsVar.initialVisibility
: true,
? pairingsVar.initialVisibility
: true,
pairedLayers: layers,
pairProp: pairProp,
layersAzProp: layersAzProp,
Expand Down Expand Up @@ -983,8 +983,8 @@ const uncertaintyEllipses = (geojson, layerObj, leafletLayerObject) => {
existingOn != null
? existingOn
: uncertaintyVar.initialVisibility != null
? uncertaintyVar.initialVisibility
: true
? uncertaintyVar.initialVisibility
: true

uncertaintyStyle = {
fillOpacity: uncertaintyVar.fillOpacity || 0.25,
Expand Down Expand Up @@ -1157,8 +1157,8 @@ const imageOverlays = (geojson, layerObj, leafletLayerObject) => {
existingOn != null
? existingOn
: imageVar.initialVisibility != null
? imageVar.initialVisibility
: true
? imageVar.initialVisibility
: true

if (imageVar && imageShow === 'always')
leafletLayerObjectImageOverlay = {
Expand Down
4 changes: 2 additions & 2 deletions src/essence/Basics/Layers_/Layers_.js
Original file line number Diff line number Diff line change
Expand Up @@ -931,8 +931,8 @@ const L_ = {
geojson.features
? geojson.features
: geojson.length > 0 && geojson[0].type === 'Feature'
? geojson
: null
? geojson
: null
)
if (keepLastN && keepLastN > 0) {
layer._sourceGeoJSON.features =
Expand Down
35 changes: 23 additions & 12 deletions src/essence/Basics/Map_/Map_.js
Original file line number Diff line number Diff line change
Expand Up @@ -395,15 +395,27 @@ let Map_ = {
},
refreshLayer: async function (layerObj, cb) {
// If it's a dynamic extent layer, just re-call its function
if (
L_._onSpecificLayerToggleSubscriptions[
`dynamicextent_${layerObj.name}`
] != null
) {
if (L_.layers.on[layerObj.name])
L_._onSpecificLayerToggleSubscriptions[
`dynamicextent_${layerObj.name}`
].func(layerObj.name)
const dynamicExtentKey = `dynamicextent_${layerObj.name}`
const dynamicGeodatasetKey = `dynamicgeodataset_${layerObj.name}` // For velocity layers

const subscription =
L_._onSpecificLayerToggleSubscriptions[dynamicExtentKey] ||
L_._onSpecificLayerToggleSubscriptions[dynamicGeodatasetKey]

if (subscription != null) {
if (L_.layers.on[layerObj.name]) {
const layerData = L_.layers.data[layerObj.name]

// Always bypass threshold for explicit refreshLayer() calls
// (refresh intervals, time changes, manual API calls)
// Pan/zoom events call the callback directly, not via refreshLayer
if (layerData) {
layerData._ignoreDynamicExtentMoveThreshold = true
}

subscription.func(layerObj.name)
}

if (typeof cb === 'function') cb()
return true
}
Expand Down Expand Up @@ -842,9 +854,8 @@ async function makeVectorLayer(
`ERROR: ${layerObj.display_name} has invalid GeoJSON!`
)
}
L_._layersLoaded[
L_._layersOrdered.indexOf(layerObj.name)
] = true
L_._layersLoaded[L_._layersOrdered.indexOf(layerObj.name)] =
true
L_.layers.layer[layerObj.name] = data == null ? null : false
allLayersLoaded()
resolve()
Expand Down