diff --git a/API/Backend/Geodatasets/models/geodatasets.js b/API/Backend/Geodatasets/models/geodatasets.js index fbfd4616..a2d3934d 100644 --- a/API/Backend/Geodatasets/models/geodatasets.js +++ b/API/Backend/Geodatasets/models/geodatasets.js @@ -62,6 +62,14 @@ function makeNewGeodatasetTable( allowNull: true, defaultValue: {}, }, + start_time: { + type: Sequelize.BIGINT, + allowNull: true, + }, + end_time: { + type: Sequelize.BIGINT, + allowNull: true, + }, geometry_type: { type: Sequelize.STRING, unique: false, @@ -115,6 +123,7 @@ function makeNewGeodatasetTable( `CREATE INDEX IF NOT EXISTS ${result.dataValues.table}_geom_idx on ${result.dataValues.table} USING gist (geom);` ) .then(() => { + if (startProp != null || endProp != null) { sequelize .query( @@ -157,6 +166,7 @@ function makeNewGeodatasetTable( return null; } + }) .catch((err) => { logger( @@ -189,8 +199,7 @@ function makeNewGeodatasetTable( sequelize .query("SELECT MAX(id) FROM geodatasets") .then(([results]) => { - let newTable = - "g" + (parseInt(results[0].max) + 1) + "_geodatasets"; + let newTable = "g" + (parseInt(results[0].max) + 1) + "_geodatasets"; Geodatasets.create({ name: name, diff --git a/API/Backend/Geodatasets/routes/geodatasets.js b/API/Backend/Geodatasets/routes/geodatasets.js index 360b640c..a44c1e63 100644 --- a/API/Backend/Geodatasets/routes/geodatasets.js +++ b/API/Backend/Geodatasets/routes/geodatasets.js @@ -633,6 +633,7 @@ router.delete("/remove/:name", function (req, res, next) { sequelize .query(`DROP TABLE IF EXISTS ${result.dataValues.table};`) .then(() => { + Geodatasets.destroy({ where: { name: req.params.name } }) .then(() => { logger( diff --git a/src/essence/Ancillary/TimeUI.js b/src/essence/Ancillary/TimeUI.js index 6c92210a..014a8284 100644 --- a/src/essence/Ancillary/TimeUI.js +++ b/src/essence/Ancillary/TimeUI.js @@ -1067,9 +1067,12 @@ const TimeUI = { dontRemoveOffset, ignoreDontChange ) { - const timestamp = - typeof ISOString === 'string' ? Date.parse(ISOString) : ISOString - TimeUI._timeSliderTimestamp = timestamp + if (typeof ISOString === 'string') { + TimeUI._timeSliderTimestamp = TimeUI.addOffset(ISOString) + } else { + TimeUI._timeSliderTimestamp = ISOString + } + if (TimeUI.play) { const date = new Date(TimeUI._timeSliderTimestamp) const offsetNowDate = new Date( diff --git a/src/essence/Basics/Layers_/LayerConstructors.js b/src/essence/Basics/Layers_/LayerConstructors.js index 5ee5a8b1..ff89c291 100644 --- a/src/essence/Basics/Layers_/LayerConstructors.js +++ b/src/essence/Basics/Layers_/LayerConstructors.js @@ -1006,6 +1006,7 @@ const uncertaintyEllipses = (geojson, layerObj, leafletLayerObject) => { let clampedUncertaintyOptions let leafletLayerObjectUncertaintyEllipse + if ( uncertaintyVar && (uncertaintyVar.enabled === true || uncertaintyVar.enabled == null) diff --git a/src/essence/Basics/Layers_/Layers_.js b/src/essence/Basics/Layers_/Layers_.js index 4ee999db..87b97a01 100644 --- a/src/essence/Basics/Layers_/Layers_.js +++ b/src/essence/Basics/Layers_/Layers_.js @@ -3400,6 +3400,11 @@ function parseConfig(configData, urlOnLayers) { })(d[i].name) ) } + + // Set disabled time object if missing + if (d[i].time == null) { + d[i].time = { enabled: false } + } } //Create parsed layers data diff --git a/src/essence/Tools/Identifier/IdentifierTool.js b/src/essence/Tools/Identifier/IdentifierTool.js index a67ea752..d1e3a732 100644 --- a/src/essence/Tools/Identifier/IdentifierTool.js +++ b/src/essence/Tools/Identifier/IdentifierTool.js @@ -26,17 +26,68 @@ var IdentifierTool = { MMWebGISInterface: null, mousemoveTimeout: null, mousemoveTimeoutMap: null, + targetId: null, + made: false, + justification: 'left', vars: {}, - make: function () { + initialize: function () { + //Get tool variables and UI adjustments + this.justification = L_.getToolVars('identifier')['justification'] + var toolContent = d3.select('#toolSeparated_Identifier') + toolContent.style('bottom', '2px') + if (this.justification == 'right') { + var toolController = d3.select('#toolcontroller_sepdiv') + toolController.style('top', '110px') + toolController.style('left', null) + toolController.style('right', '5px') + toolContent.style('left', null) + toolContent.style('right', '0px') + } else if (this.justification != L_.getToolVars('legend')['justification']) { + var toolController = d3.select('#toolcontroller_sepdiv').clone(false).attr('id', 'toolcontroller_sepdiv_left') + $('#toolSeparated_Identifier').appendTo('#toolcontroller_sepdiv_left') + toolController.style('top', '40px') + toolController.style('left', '5px') + toolController.style('right', null) + } + }, + make: function (targetId) { this.MMWebGISInterface = new interfaceWithMMWebGIS() + this.targetId = targetId + this.activeLayerNames = [] + + L_.subscribeOnLayerToggle('IdentifierTool', () => { + this.MMWebGISInterface = new interfaceWithMMWebGIS() + }) + + this.made = true + + L_.subscribeOnLayerToggle('IdentifierTool', () => { + this.MMWebGISInterface = new interfaceWithMMWebGIS() + }) + + this.made = true //Get tool variables - this.varsRaw = L_.getToolVars('identifier') - this.vars = {} + this.varsRaw = L_.getToolVars('identifier', true) + this.vars = { + data: {}, + } Object.keys(this.varsRaw).forEach((layerName) => { - this.vars[L_.asLayerUUID(layerName)] = this.varsRaw[layerName] + if (layerName != '__layers') + this.vars.data[L_.asLayerUUID(layerName)] = { + data: [this.varsRaw[layerName]], + } }) + if (this.varsRaw.__layers) { + Object.keys(this.varsRaw.__layers).forEach((layerName) => { + const layer = this.varsRaw.__layers[layerName] + if (layer.data) { + this.vars.data[layerName] = layer + } + }) + } + //Probably always 256 this.tileImageWidth = 256 //x y and zoom of mousedover tile @@ -55,11 +106,14 @@ var IdentifierTool = { }, destroy: function () { this.MMWebGISInterface.separateFromMMWebGIS() + this.targetId = null + L_.unsubscribeOnLayerToggle('IdentifierTool') + this.made = false }, fillURLParameters: function (url, layerUUID) { - if (IdentifierTool.vars[layerUUID]) { + if (IdentifierTool.vars.data?.[layerUUID]?.data?.[0]) { const layerTimeFormat = d3.utcFormat( - IdentifierTool.vars[layerUUID].timeFormat + IdentifierTool.vars.data[layerUUID].data[0].timeFormat ) let filledURL = url @@ -113,29 +167,16 @@ var IdentifierTool = { }, 5) }, idPixelGlobe: function (e) { - IdentifierTool.idPixel(e, [ - Globe_.litho.mouse.lng, - Globe_.litho.mouse.lat, - Globe_.litho.zoom, - ]) - }, - idValueMap: function (e) { - IdentifierTool.idPixel( - e, - [e.latlng.lng, e.latlng.lat, Map_.map.getZoom()], - true - ) - }, - 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, + ]) }, //lnglatzoom is [lng,lat,zoom] //if trueValue is true, query the data layer for the value, else us the legend if possible - idPixel: function (e, lnglatzoom, trueValue) { + idPixel: function (e, lnglatzoom, trueValue, selfish) { trueValue = trueValue || false clearTimeout(IdentifierTool.mousemoveTimeout) @@ -252,105 +293,128 @@ var IdentifierTool = { ) } //Oh IdentifierTool is the same as X != undefined - if (pxRGBA) { - if ( - trueValue && - IdentifierTool.vars[IdentifierTool.activeLayerNames[i]] - ) { - queryDataValue( - IdentifierTool.vars[IdentifierTool.activeLayerNames[i]] - .url, - lnglatzoom[0], - lnglatzoom[1], - IdentifierTool.vars[IdentifierTool.activeLayerNames[i]] - .bands, - IdentifierTool.activeLayerNames[i], - (function (pxRGBA, i) { - return function (value) { - var htmlValues = '' - var cnt = 0 - for (var v in value) { - var unit = - IdentifierTool.vars[ - IdentifierTool.activeLayerNames[i] - ].unit || '' - if ( - IdentifierTool.vars[ - IdentifierTool.activeLayerNames[i] - ].units && - IdentifierTool.vars[ - IdentifierTool.activeLayerNames[i] - ].units.constructor === Array && - IdentifierTool.vars[ - IdentifierTool.activeLayerNames[i] - ].units[cnt] - ) { - unit = - IdentifierTool.vars[ + if ( + IdentifierTool.vars.data[IdentifierTool.activeLayerNames[i]] + ?.data + ) { + const data = + IdentifierTool.vars.data[IdentifierTool.activeLayerNames[i]] + for (let j = 0; j < data.data.length; j++) { + const d = data.data[j] + + if (pxRGBA) { + if (trueValue) { + queryDataValue( + d.url, + lnglatzoom[0], + lnglatzoom[1], + d.bands, + IdentifierTool.activeLayerNames[i], + (function (pxRGBA, i, j) { + return function (value) { + const d2 = + IdentifierTool.vars.data[ IdentifierTool.activeLayerNames[ i ] - ].units[cnt] + ].data[j] + var htmlValues = '' + // first empty it + $( + `#identifierToolIdPixelCursorInfo_${i}_${j}` + ).html( + [ + '