Skip to content
Merged
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,7 @@ sessions
docker-compose.yml
docker-compose.env.yml

.mcp.json
.serena
.claude
#tools
2 changes: 1 addition & 1 deletion src/css/mmgisUI.css
Original file line number Diff line number Diff line change
Expand Up @@ -1619,7 +1619,7 @@ input::-webkit-inner-spin-button {
}
#toast-container {
position: fixed !important;
bottom: 40px !important;
bottom: 80px !important;
right: 5px !important;
z-index: 1001 !important;
}
Expand Down
12 changes: 12 additions & 0 deletions src/essence/Ancillary/QueryURL.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import L_ from '../Basics/Layers_/Layers_'
import T_ from '../Basics/ToolController_/ToolController_'
import calls from '../../pre/calls'
import TimeControl from './TimeControl'
import TimeUI from './TimeUI'

var QueryURL = {
checkIfMission: function () {
Expand Down Expand Up @@ -38,6 +39,7 @@ var QueryURL = {
var startTime = this.getSingleQueryVariable('startTime')
var endTime = this.getSingleQueryVariable('endTime')
var live = this.getSingleQueryVariable('live')
var follow = this.getSingleQueryVariable('follow')

if (urlSite !== false) {
L_.FUTURES.site = urlSite
Expand Down Expand Up @@ -182,6 +184,11 @@ var QueryURL = {
L_.FUTURES.live = liveStr === 'true' || liveStr === '1'
}

if (follow !== false) {
const followStr = (follow + '').toLowerCase()
L_.FUTURES.follow = followStr === 'true' || followStr === '1'
}

if (layersOn !== false || selected !== false) {
L_.FUTURES.customOn = true
// lists all the on layers
Expand Down Expand Up @@ -408,6 +415,11 @@ var QueryURL = {
urlAppendage += '&endTime=' + TimeControl.endTime
if (TimeControl.timeUI && typeof TimeControl.timeUI.now === 'boolean')
urlAppendage += '&live=' + (TimeControl.timeUI.now ? '1' : '0')

// Follow state
if (typeof TimeUI !== 'undefined' && TimeUI.followEnabled && TimeUI.followedFeature) {
urlAppendage += '&follow=1'
}
}

var url = encodeURI(urlAppendage)
Expand Down
73 changes: 73 additions & 0 deletions src/essence/Ancillary/TimeControl.js
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,34 @@ var TimeControl = {
reloadTimeLayers: function () {
// refresh time enabled layers
let reloadedLayers = []
let savedActiveFeature = null

// Save active feature if it belongs to a time-enabled layer
if (L_.activeFeature) {
const activeLayerName = L_.activeFeature.layerName
const activeLayer = L_.layers.data[activeLayerName]

if (activeLayer && activeLayer.time && activeLayer.time.enabled === true) {
// Save the active feature details for restoration
savedActiveFeature = {
layerName: activeLayerName,
feature: JSON.parse(JSON.stringify(L_.activeFeature.feature))
}

// If the layer has useKeyAsId or useKeyAsName, save the key/value
const keyProp = activeLayer.variables?.useKeyAsId || activeLayer.variables?.useKeyAsName
if (keyProp && L_.activeFeature.feature.properties) {
// keyProp might be a path like "properties.id" or just "id"
const keyPath = keyProp.includes('.') ? keyProp.split('.') : [keyProp]
const keyValue = F_.getIn(L_.activeFeature.feature.properties, keyPath)
if (keyValue != null) {
savedActiveFeature.key = keyProp
savedActiveFeature.value = keyValue
}
}
}
}

for (let layerName in L_.layers.data) {
const layer = L_.layers.data[layerName]
if (
Expand All @@ -396,6 +424,51 @@ var TimeControl = {
reloadedLayers.push(layer.name)
}
}

// Restore active feature after layers reload
if (savedActiveFeature && reloadedLayers.includes(savedActiveFeature.layerName)) {
setTimeout(() => {
// Try to restore using key/value if available
if (savedActiveFeature.key && savedActiveFeature.value) {
L_.selectPoint({
layerUUID: savedActiveFeature.layerName,
key: savedActiveFeature.key,
value: savedActiveFeature.value
})
} else if (savedActiveFeature.feature.geometry && savedActiveFeature.feature.geometry.coordinates) {
// Fallback to selecting by coordinates
const coords = savedActiveFeature.feature.geometry.coordinates
let lat, lon
if (savedActiveFeature.feature.geometry.type === 'Point') {
lon = coords[0]
lat = coords[1]
} else if (savedActiveFeature.feature.geometry.type === 'LineString' ||
savedActiveFeature.feature.geometry.type === 'Polygon') {
// Get first coordinate or centroid
const firstCoord = savedActiveFeature.feature.geometry.type === 'Polygon' ? coords[0][0] : coords[0]
lon = firstCoord[0]
lat = firstCoord[1]
}

if (lat != null && lon != null) {
L_.selectPoint({
layerUUID: savedActiveFeature.layerName,
lat: lat,
lon: lon
})
}
}
}, 500)
}

// Pan to followed feature after layers reload
if (TimeUI.followEnabled && TimeUI.followedFeature) {
// Add a small delay to ensure layers have finished loading
setTimeout(() => {
TimeUI.panToFollowedFeature()
}, 500)
}

return reloadedLayers
},
updateLayersTime: function () {
Expand Down
Loading