@abi-software/flatmapvuer 1.8.1-beta.2 → 1.8.1-beta.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abi-software/flatmapvuer",
3
- "version": "1.8.1-beta.2",
3
+ "version": "1.8.1-beta.4",
4
4
  "license": "Apache-2.0",
5
5
  "files": [
6
6
  "dist/*",
@@ -43,7 +43,7 @@
43
43
  "./src/*": "./src/*"
44
44
  },
45
45
  "dependencies": {
46
- "@abi-software/flatmap-viewer": "3.2.13",
46
+ "@abi-software/flatmap-viewer": "^4.0.4",
47
47
  "@abi-software/map-utilities": "^1.4.0",
48
48
  "@abi-software/sparc-annotation": "0.3.2",
49
49
  "@abi-software/svg-sprite": "^1.0.1",
@@ -693,18 +693,6 @@ const processFTUs = (parent, key) => {
693
693
  return ftus
694
694
  }
695
695
 
696
- const createUnfilledTooltipData = function () {
697
- return {
698
- destinations: [],
699
- origins: [],
700
- components: [],
701
- destinationsWithDatasets: [],
702
- originsWithDatasets: [],
703
- componentsWithDatasets: [],
704
- resource: undefined,
705
- }
706
- }
707
-
708
696
  /**
709
697
  * A vue component of the flatmap viewer.
710
698
  */
@@ -1173,7 +1161,7 @@ export default {
1173
1161
  },
1174
1162
  setInitMapState: function () {
1175
1163
  if (this.mapImp) {
1176
- const map = this.mapImp._map;
1164
+ const map = this.mapImp.map;
1177
1165
  const bounds = this.mapImp.options.bounds;
1178
1166
  const initBounds = [
1179
1167
  [bounds[0], bounds[1]],
@@ -1195,7 +1183,7 @@ export default {
1195
1183
  resetView: function () {
1196
1184
  if (this.mapImp) {
1197
1185
  // fit to window
1198
- const map = this.mapImp._map;
1186
+ const map = this.mapImp.map;
1199
1187
  const { initBounds } = this.initMapState;
1200
1188
  // reset rotation
1201
1189
  map.resetNorthPitch({
@@ -1267,72 +1255,52 @@ export default {
1267
1255
  )
1268
1256
  }
1269
1257
  },
1270
- /**
1271
- * Function to highlight paths and features
1272
- * @param data
1273
- */
1274
- zoomToFeatures: function (data) {
1275
- if (this.mapImp) {
1276
- this.mapImp.zoomToFeatures(data)
1277
- }
1278
- },
1279
1258
  /**
1280
1259
  * @public
1281
1260
  * Function to highlight the connected paths
1282
- * by providing path model identifier, ``pathId`` or ``anatomicalId``.
1283
- * @arg {string} `pathId` or `anatomicalId`
1261
+ * by providing path model identifier, ``pathId``.
1262
+ * @arg {String} `pathId`
1284
1263
  */
1285
- retrieveConnectedPaths: async function (payload, options = {}) {
1264
+ highlightConnectedPaths: async function (payload) {
1286
1265
  if (this.mapImp) {
1287
- let connectedPaths = [];
1288
- let connectedTarget = options.target?.length ? options.target : [];
1266
+ let paths = [...this.mapImp.pathModelNodes(payload)]
1267
+
1289
1268
  // The line below is to get the path features from the geojson ids
1290
- const nodeFeatureIds = [...this.mapImp.pathModelNodes(payload)];
1291
- const pathsOfEntities = await this.mapImp.queryPathsForFeatures(payload);
1292
- if (nodeFeatureIds.length) {
1293
- if (!connectedTarget.length) {
1294
- const connectedType = options.type?.length ? options.type : ["all"];
1295
- const connectivity = await this.flatmapQueries.queryForConnectivityNew(this.mapImp, payload);
1296
- const originsFlat = connectivity?.ids?.dendrites.flat(Infinity);
1297
- const componentsFlat = connectivity?.ids?.components.flat(Infinity);
1298
- const destinationsFlat = connectivity?.ids?.axons.flat(Infinity);
1299
- let connected = [];
1300
- if (connectedType.includes("origins")) connected.push(...originsFlat);
1301
- if (connectedType.includes("components")) connected.push(...componentsFlat);
1302
- if (connectedType.includes("destinations")) connected.push(...destinationsFlat);
1303
- if (connectedType.includes("all")) connected.push(...originsFlat, ...componentsFlat, ...destinationsFlat);
1304
- connectedTarget = [...new Set(connected)];
1305
- }
1306
- // Loop through the node features and check if we have certain nodes
1307
- nodeFeatureIds.forEach((featureId) => {
1308
- // Get the paths from each node feature
1309
- const pathsL2 = this.mapImp.nodePathModels(featureId);
1310
- pathsL2.forEach((path) => {
1311
- // nodes of the second level path
1312
- const nodeFeatureIdsL2 = this.mapImp.pathModelNodes(path);
1313
- const nodeModelsL2 = nodeFeatureIdsL2.map((featureIdL2) => {
1314
- return this.mapImp.featureProperties(featureIdL2).models;
1315
- });
1316
- const intersection = connectedTarget.filter(element => nodeModelsL2.includes(element));
1317
- if (intersection.length && !connectedPaths.includes(path)) connectedPaths.push(path);
1318
- });
1319
- });
1320
- } else if (pathsOfEntities.length) {
1321
- if (connectedTarget.length) {
1322
- pathsOfEntities.forEach((path) => {
1323
- const nodeFeatureIds = this.mapImp.pathModelNodes(path);
1324
- const nodeModels = nodeFeatureIds.map((featureId) => {
1325
- return this.mapImp.featureProperties(featureId).models;
1326
- });
1327
- const intersection = connectedTarget.filter(element => nodeModels.includes(element));
1328
- if (intersection.length && !connectedPaths.includes(path)) connectedPaths.push(path);
1329
- });
1330
- } else {
1331
- connectedPaths = pathsOfEntities;
1332
- }
1333
- }
1334
- connectedPaths = [...new Set([...connectedPaths, ...payload])];
1335
- return connectedPaths;
1269
+ let pathFeatures = paths.map((p) => this.mapImp.featureProperties(p))
1270
+
1271
+ // Query the flatmap knowledge graph for connectivity, we use this to grab the origins
1272
+ let connectivity = await this.flatmapQueries.queryForConnectivityNew(this.mapImp, payload)
1273
+
1274
+ // Check and flatten the origins node graph
1275
+ let originsFlat = connectivity?.ids?.dendrites?.flat().flat()
1276
+
1277
+ let toHighlight = []
1278
+ let highlight = false
1279
+
1280
+ // Loop through the path features and check if we have origin nodes
1281
+ pathFeatures.forEach((p) => {
1282
+
1283
+ // Get the nodes from each path feature
1284
+ this.mapImp.nodePathModels(p.featureId).forEach((f) => {
1285
+ highlight = true
1286
+ // s2 here is the second level paths
1287
+ let s2 = this.mapImp.pathModelNodes(f)
1288
+ s2.forEach((s) => {
1289
+ let s2Feature = this.mapImp.featureProperties([s]) // get the feature properties for s2
1290
+ if (originsFlat.includes(s2Feature.models)) {
1291
+ highlight = false // if we have an origin node, we don't want to highlight the path
1292
+ return
1293
+ }
1294
+ })
1295
+
1296
+ if (highlight) {
1297
+ toHighlight.push(f)
1298
+ }
1299
+ })
1300
+ })
1301
+
1302
+ // display connected paths
1303
+ this.mapImp.zoomToFeatures(toHighlight, { noZoomIn: true })
1336
1304
  }
1337
1305
  },
1338
1306
  resetMapFilter: function() {
@@ -1642,6 +1610,7 @@ export default {
1642
1610
  const resource = [data.models]
1643
1611
  const taxonomy = this.entry
1644
1612
  const biologicalSex = this.biologicalSex
1613
+ const featuresAlert = data.alert
1645
1614
  let taxons = undefined
1646
1615
  if (data.taxons) {
1647
1616
  // check if data.taxons is string or array
@@ -1651,7 +1620,7 @@ export default {
1651
1620
  taxons = data.taxons
1652
1621
  }
1653
1622
  }
1654
- const payload = {
1623
+ let payload = [{
1655
1624
  dataset: data.dataset,
1656
1625
  biologicalSex: biologicalSex,
1657
1626
  taxonomy: taxonomy,
@@ -1661,13 +1630,41 @@ export default {
1661
1630
  userData: args,
1662
1631
  eventType: eventType,
1663
1632
  provenanceTaxonomy: taxons,
1664
- }
1665
- if (eventType === 'click') {
1666
- this.featuresAlert = data.alert
1667
- if (this.viewingMode === 'Neuron Connection') {
1668
- this.retrieveConnectedPaths([data.models]).then((paths) => {
1669
- this.zoomToFeatures(paths)
1633
+ alert: featuresAlert
1634
+ }]
1635
+ if (Array.isArray(data)) {
1636
+ payload = []
1637
+ data.forEach((d) => {
1638
+ const label = d.label
1639
+ const resource = [d.models]
1640
+ let taxons = undefined
1641
+ if (d.taxons) {
1642
+ // check if data.taxons is string or array
1643
+ if (typeof d.taxons !== 'object') {
1644
+ taxons = JSON.parse(d.taxons)
1645
+ } else {
1646
+ taxons = d.taxons
1647
+ }
1648
+ }
1649
+ payload.push({
1650
+ dataset: d.dataset,
1651
+ biologicalSex: biologicalSex,
1652
+ taxonomy: taxonomy,
1653
+ resource: resource,
1654
+ label: label,
1655
+ feature: d,
1656
+ userData: args,
1657
+ eventType: eventType,
1658
+ provenanceTaxonomy: taxons,
1659
+ alert: d.alert
1670
1660
  })
1661
+ })
1662
+ this.setConnectivityDataSource(this.viewingMode, data);
1663
+ //The following will be used to track either a feature is selected
1664
+ this.statesTracking.activeClick = true
1665
+ this.statesTracking.activeTerm = data?.models
1666
+ if (this.viewingMode === 'Neuron Connection') {
1667
+ this.highlightConnectedPaths([data.models])
1671
1668
  } else {
1672
1669
  this.currentActive = data.models ? data.models : ''
1673
1670
  // Drawing connectivity between features
@@ -1712,6 +1709,23 @@ export default {
1712
1709
  }
1713
1710
  }
1714
1711
  },
1712
+ /**
1713
+ * The data for connectivity data source is just a placeholder data
1714
+ * to check which part of the map is clicked, e.g., path or feture or empty area,
1715
+ * based on the viewing mode.
1716
+ * The "connectivity-info-close" event will be emitted based on this data
1717
+ * when there has a click event on map.
1718
+ * @param viewingMode
1719
+ * @param data
1720
+ */
1721
+ setConnectivityDataSource: function (viewingMode, data) {
1722
+ // for Exploration mode, only path click will be used as data source
1723
+ this.connectivityDataSource = data.source;
1724
+ // for other modes, it can be feature or path
1725
+ if (viewingMode === 'Neuron Connection' || viewingMode === 'Annotation') {
1726
+ this.connectivityDataSource = data.featureId;
1727
+ }
1728
+ },
1715
1729
  /**
1716
1730
  * @public
1717
1731
  * Function triggered by viewing mode change.
@@ -1926,24 +1940,32 @@ export default {
1926
1940
  this.annotation = {}
1927
1941
  }
1928
1942
  } else {
1929
- //require data.resource && data.feature.source
1930
- let results = await this.flatmapQueries.retrieveFlatmapKnowledgeForEvent(this.mapImp, data)
1931
1943
  // load and store knowledge
1932
1944
  loadAndStoreKnowledge(this.mapImp, this.flatmapQueries);
1933
- // The line below only creates the tooltip if some data was found on the path
1934
- // the pubmed URLs are in knowledge response.references
1935
- if (
1936
- (results && results[0]) ||
1937
- (data.feature.hyperlinks && data.feature.hyperlinks.length > 0)
1938
- ) {
1939
- this.resourceForTooltip = data.resource[0]
1940
- data.resourceForTooltip = this.resourceForTooltip
1941
- this.createTooltipFromNeuronCuration(data)
1942
- } else {
1943
- this.createTooltipFromEntityCuration(data)
1945
+ let prom1 = []
1946
+ for (let index = 0; index < data.length; index++) {
1947
+ const entry = data[index]
1948
+ prom1.push(await this.getKnowledgeTooltip(entry))
1949
+ }
1950
+ this.tooltipEntry = await Promise.all(prom1)
1951
+ const featureIds = this.tooltipEntry.filter(tooltip => tooltip).map(tooltip => tooltip.featureId[0])
1952
+ if (featureIds.length > 0) {
1953
+ this.displayTooltip(featureIds)
1944
1954
  }
1945
1955
  }
1946
1956
  },
1957
+ getKnowledgeTooltip: async function (data) {
1958
+ //require data.resource && data.feature.source
1959
+ let results = await this.flatmapQueries.retrieveFlatmapKnowledgeForEvent(this.mapImp, data)
1960
+ // The line below only creates the tooltip if some data was found on the path
1961
+ // the pubmed URLs are in knowledge response.references
1962
+ if ((results && results[0]) || (data.feature.hyperlinks && data.feature.hyperlinks.length > 0)) {
1963
+ let tooltip = await this.flatmapQueries.createTooltipData(this.mapImp, data)
1964
+ tooltip['featuresAlert'] = data.alert;
1965
+ tooltip['knowledgeSource'] = getKnowledgeSource(this.mapImp);
1966
+ return tooltip;
1967
+ }
1968
+ },
1947
1969
  /**
1948
1970
  * A hack to remove flatmap tooltips while popup is open
1949
1971
  */
@@ -1984,41 +2006,6 @@ export default {
1984
2006
  this.tooltipEntry = await this.flatmapQueries.createTooltipData(this.mapImp, data)
1985
2007
  this.displayTooltip(data.resource[0])
1986
2008
  },
1987
- /**
1988
- * @public
1989
- * Function to create tooltip from Entity Curation ``data``.
1990
- * @arg {Object} `data`
1991
- */
1992
- createTooltipFromEntityCuration: async function (data) {
1993
- this.tooltipEntry = await this.flatmapQueries.createTooltipData(this.mapImp, data)
1994
- let featureIds = []
1995
- let destinations = []
1996
- let destinationsWithDatasets = []
1997
- const pathsOfEntities = await this.mapImp.queryPathsForFeatures(data.resource)
1998
- if (pathsOfEntities.length) {
1999
- pathsOfEntities.forEach((path) => {
2000
- featureIds.push(...this.mapImp.pathModelNodes(path))
2001
- })
2002
- featureIds = [...new Set(featureIds)].filter(id => id !== data.feature.featureId)
2003
- featureIds.forEach((id) => {
2004
- const feature = this.mapImp.featureProperties(id)
2005
- if (!destinations.includes(feature.label)) {
2006
- destinations.push(feature.label)
2007
- destinationsWithDatasets.push({ id: feature.models, name: feature.label })
2008
- }
2009
- })
2010
- this.tooltipEntry = {
2011
- ...this.tooltipEntry,
2012
- origins: [data.label],
2013
- originsWithDatasets: [{ id: data.resource[0], name: data.label }],
2014
- components: [],
2015
- componentsWithDatasets: [],
2016
- destinations: destinations,
2017
- destinationsWithDatasets: destinationsWithDatasets,
2018
- }
2019
- this.displayTooltip(data.resource[0])
2020
- }
2021
- },
2022
2009
  /**
2023
2010
  * @public
2024
2011
  * Function to show popup on map.
@@ -2223,25 +2210,18 @@ export default {
2223
2210
  featureId = feature
2224
2211
  options.annotationFeatureGeometry = geometry
2225
2212
  } else {
2226
- featureId = this.mapImp.modelFeatureIds(feature)[0]
2213
+ const entry = Array.isArray(feature) ? feature[0] : feature
2214
+ featureId = this.mapImp.modelFeatureIds(entry)[0]
2227
2215
  if (!this.activeDrawTool) {
2228
2216
  options.positionAtLastClick = true
2229
2217
  }
2230
2218
  }
2231
2219
  // If connectivityInfoSidebar is set to `true`
2232
2220
  // Connectivity info will show in sidebar
2233
- if ((this.connectivityInfoSidebar && this.hasTooltipEntry()) && this.viewingMode !== 'Annotation') {
2234
- // move the map center to highlighted area
2235
- // this method is moved to sidebar connectivity info
2236
- // const featureIds = [feature];
2237
- // this.moveMap(featureIds);
2238
- if (this.featuresAlert) {
2239
- this.tooltipEntry['featuresAlert'] = this.featuresAlert;
2240
- }
2241
- // Get connectivity knowledge source | SCKAN release
2242
- if (this.mapImp.provenance?.connectivity) {
2243
- this.tooltipEntry['knowledge-source'] = getKnowledgeSource(this.mapImp);
2244
- }
2221
+ if (
2222
+ (this.connectivityInfoSidebar && this.tooltipEntry.length) &&
2223
+ this.viewingMode !== 'Annotation'
2224
+ ) {
2245
2225
  this.$emit('connectivity-info-open', this.tooltipEntry);
2246
2226
  }
2247
2227
  if (this.annotationSidebar && this.viewingMode === 'Annotation') {
@@ -2252,16 +2232,10 @@ export default {
2252
2232
  // Provenance popup will be shown on map
2253
2233
  // Tooltip will be shown for Annotation view
2254
2234
  if (
2255
- !this.disableUI && (
2256
- (
2257
- this.viewingMode === 'Annotation' &&
2258
- !this.annotationSidebar
2259
- ) ||
2260
- (
2261
- this.viewingMode === 'Exploration' &&
2262
- !this.connectivityInfoSidebar &&
2263
- this.hasTooltipEntry()
2264
- )
2235
+ !this.disableUI &&
2236
+ (
2237
+ (this.viewingMode === 'Annotation' && !this.annotationSidebar) ||
2238
+ (this.viewingMode === 'Exploration' && !this.connectivityInfoSidebar)
2265
2239
  )
2266
2240
  ) {
2267
2241
  this.tooltipDisplay = true;
@@ -2271,23 +2245,6 @@ export default {
2271
2245
  });
2272
2246
  }
2273
2247
  },
2274
- hasTooltipEntry: function () {
2275
- const {
2276
- components,
2277
- destinations,
2278
- origins,
2279
- provenanceTaxonomy,
2280
- provenanceTaxonomyLabel
2281
- } = this.tooltipEntry;
2282
-
2283
- return Boolean(
2284
- components?.length ||
2285
- destinations?.length ||
2286
- origins?.length ||
2287
- provenanceTaxonomy?.length ||
2288
- provenanceTaxonomyLabel?.length
2289
- );
2290
- },
2291
2248
  /**
2292
2249
  * Move the map to the left side
2293
2250
  * to the visible area of the feature IDs
@@ -2297,8 +2254,8 @@ export default {
2297
2254
  moveMap: function (featureIds, options = {}) {
2298
2255
  if (this.mapImp) {
2299
2256
  const { offsetX = 0, offsetY = 0, zoom = 4 } = options;
2300
- const Map = this.mapImp._map;
2301
- const bbox = this.mapImp._bounds.toArray();
2257
+ const Map = this.mapImp.map;
2258
+ const bbox = this.mapImp.bounds.toArray();
2302
2259
 
2303
2260
  // Zoom the map to features first
2304
2261
  this.mapImp.zoomToFeatures(featureIds, { noZoomIn: true });
@@ -2423,10 +2380,10 @@ export default {
2423
2380
  state['biologicalSex'] = identifier.biologicalSex
2424
2381
  if (identifier && identifier.uuid) state['uuid'] = identifier.uuid
2425
2382
  state['viewingMode'] = this.viewingMode
2426
- state['searchTerm'] = this.searchTerm
2383
+ state['searchTerm'] = this.statesTracking.activeTerm
2427
2384
  state['flightPath3D'] = this.flightPath3DRadio
2428
2385
  state['colour'] = this.colourRadio
2429
- state['outlines'] = this.outlinesRadio
2386
+ state['outlinesRadio'] = this.outlinesRadio
2430
2387
  state['background'] = this.currentBackground
2431
2388
  this.getVisibilityState(state)
2432
2389
  return state
@@ -2471,9 +2428,7 @@ export default {
2471
2428
  if (state.searchTerm) {
2472
2429
  const searchTerm = state.searchTerm
2473
2430
  if (state.viewingMode === "Neuron Connection") {
2474
- this.retrieveConnectedPaths([searchTerm]).then((paths) => {
2475
- this.zoomToFeatures(paths)
2476
- })
2431
+ this.highlightConnectedPaths([searchTerm])
2477
2432
  } else {
2478
2433
  this.searchAndShowResult(searchTerm, true)
2479
2434
  }
@@ -2554,7 +2509,6 @@ export default {
2554
2509
 
2555
2510
  let promise1 = this.mapManagerRef.loadMap(
2556
2511
  identifier,
2557
- this.$refs.display,
2558
2512
  this.eventCallback(),
2559
2513
  {
2560
2514
  //fullscreenControl: false,
@@ -2563,6 +2517,7 @@ export default {
2563
2517
  minZoom: this.minZoom,
2564
2518
  tooltips: this.tooltips,
2565
2519
  minimap: minimap,
2520
+ container: this.$refs.display,
2566
2521
  // tooltipDelay: 15, // new feature to delay tooltips showing
2567
2522
  }
2568
2523
  )
@@ -2608,9 +2563,6 @@ export default {
2608
2563
  if (this.mapImp) {
2609
2564
  this.mapImp.resize()
2610
2565
  this.showMinimap(this.displayMinimap)
2611
- if (this.mapImp._minimap) {
2612
- this.mapImp._minimap._miniMap.resize()
2613
- }
2614
2566
  }
2615
2567
  } catch {
2616
2568
  console.error('Map resize error')
@@ -2639,6 +2591,7 @@ export default {
2639
2591
  this.loading = false
2640
2592
  this.computePathControlsMaximumHeight()
2641
2593
  this.mapResize()
2594
+ this.handleMapClick();
2642
2595
  this.setInitMapState();
2643
2596
  /**
2644
2597
  * This is ``onFlatmapReady`` event.
@@ -2646,6 +2599,29 @@ export default {
2646
2599
  */
2647
2600
  this.$emit('ready', this)
2648
2601
  },
2602
+ /**
2603
+ * @public
2604
+ * Function to handle mouse click on map area
2605
+ * after the map is loaded.
2606
+ */
2607
+ handleMapClick: function () {
2608
+ const _map = this.mapImp.map;
2609
+ if (_map) {
2610
+ _map.on('click', (e) => {
2611
+ //A little logic to make sure we are keeping track
2612
+ //of selected term
2613
+ if (this.statesTracking.activeClick) {
2614
+ this.statesTracking.activeClick = false
2615
+ } else {
2616
+ this.statesTracking.activeTerm = ""
2617
+ }
2618
+ if (!this.connectivityDataSource) {
2619
+ this.$emit('connectivity-info-close');
2620
+ }
2621
+ this.connectivityDataSource = ''; // reset
2622
+ });
2623
+ }
2624
+ },
2649
2625
  /**
2650
2626
  * @public
2651
2627
  * Function to show or hide the minimap
@@ -2680,11 +2656,12 @@ export default {
2680
2656
  } else if (this.viewingMode === "Annotation") {
2681
2657
  this.manualAbortedOnClose()
2682
2658
  }
2683
- this.searchTerm = ""
2659
+ this.statesTracking.activeTerm = ""
2684
2660
  return true
2685
2661
  } else {
2686
2662
  const searchResults = this.mapImp.search(term)
2687
2663
  if (searchResults?.results?.length) {
2664
+ this.statesTracking.activeTerm = term
2688
2665
  this.mapImp.showSearchResults(searchResults)
2689
2666
  if (displayInfo) {
2690
2667
  let featureId = undefined;
@@ -2704,9 +2681,9 @@ export default {
2704
2681
  if (this.viewingMode === "Exploration" || this.viewingMode === "Annotation") {
2705
2682
  this.checkAndCreatePopups(data)
2706
2683
  } else if (this.viewingMode === 'Neuron Connection') {
2707
- this.retrieveConnectedPaths(data.resource).then((paths) => {
2708
- this.zoomToFeatures(paths)
2709
- })
2684
+ setTimeout(() => {
2685
+ this.highlightConnectedPaths(data.resource)
2686
+ }, 1000)
2710
2687
  }
2711
2688
  this.mapImp.showPopup(featureId, capitalise(feature.label), {
2712
2689
  className: 'custom-popup',
@@ -2715,7 +2692,6 @@ export default {
2715
2692
  })
2716
2693
  }
2717
2694
  }
2718
- this.searchTerm = term
2719
2695
  return true
2720
2696
  } else this.mapImp.clearSearchResults()
2721
2697
  }
@@ -2937,7 +2913,6 @@ export default {
2937
2913
  return {
2938
2914
  flatmapAPI: this.flatmapAPI,
2939
2915
  sparcAPI: this.sparcAPI,
2940
- getFeaturesAlert: () => this.featuresAlert,
2941
2916
  userApiKey: this.userToken,
2942
2917
  }
2943
2918
  },
@@ -2991,11 +2966,10 @@ export default {
2991
2966
  availableBackground: ['white', 'lightskyblue', 'black'],
2992
2967
  loading: false,
2993
2968
  flatmapMarker: flatmapMarker,
2994
- tooltipEntry: createUnfilledTooltipData(),
2969
+ tooltipEntry: [],
2995
2970
  connectivityDataSource: '',
2996
2971
  connectivityTooltipVisible: false,
2997
2972
  drawerOpen: false,
2998
- featuresAlert: undefined,
2999
2973
  flightPath3DRadio: false,
3000
2974
  displayFlightPathOption: false,
3001
2975
  colourRadio: true,
@@ -3053,7 +3027,10 @@ export default {
3053
3027
  without: true,
3054
3028
  }
3055
3029
  }),
3056
- searchTerm: "",
3030
+ statesTracking: markRaw({
3031
+ activeClick: false,
3032
+ activeTerm: "",
3033
+ }),
3057
3034
  taxonLeaveDelay: undefined,
3058
3035
  }
3059
3036
  },
@@ -3187,7 +3164,7 @@ export default {
3187
3164
  if (this.mapManager) {
3188
3165
  this.mapManagerRef = this.mapManager;
3189
3166
  } else {
3190
- this.mapManagerRef = markRaw(new flatmap.MapManager(this.flatmapAPI));
3167
+ this.mapManagerRef = markRaw(new flatmap.MapViewer(this.flatmapAPI, { container: undefined }));
3191
3168
  /**
3192
3169
  * The event emitted after a new mapManager is loaded.
3193
3170
  * This mapManager can be used to create new flatmaps.
@@ -231,7 +231,7 @@ export default {
231
231
  if (this.mapManager) {
232
232
  this.mapManagerRef = this.mapManager;
233
233
  } else {
234
- this.mapManagerRef = markRaw(new flatmap.MapManager(this.flatmapAPI));
234
+ this.mapManagerRef = markRaw(new flatmap.MapViewer(this.flatmapAPI, { container: undefined }));
235
235
  /**
236
236
  * The event emitted after a new mapManager is loaded.
237
237
  * This mapManager can be used to create new flatmaps.
@@ -36,29 +36,25 @@ function getKnowledgeSource(mapImp) {
36
36
  mapKnowledgeSource = `${sckanProvenance.npo.release}-npo`;
37
37
  }
38
38
  }
39
+
39
40
  return mapKnowledgeSource;
40
41
  }
41
42
 
42
- async function loadAndStoreKnowledge(mapImp, flatmapQueries) {
43
+ function loadAndStoreKnowledge(mapImp, flatmapQueries) {
43
44
  const knowledgeSource = getKnowledgeSource(mapImp);
44
45
  const sql = `select knowledge from knowledge
45
- where source="${knowledgeSource}"
46
- order by source desc`;
47
-
48
- refreshFlatmapKnowledgeCache()
46
+ where source="${knowledgeSource}"
47
+ order by source desc`;
49
48
  const flatmapKnowledge = sessionStorage.getItem('flatmap-knowledge');
50
49
 
51
50
  if (!flatmapKnowledge) {
52
- const response = await flatmapQueries.flatmapQuery(sql);
53
- const mappedData = response.values.map(x => x[0]);
54
- const parsedData = mappedData.map(x => JSON.parse(x));
55
-
56
- sessionStorage.setItem('flatmap-knowledge', JSON.stringify(parsedData));
57
- updateFlatmapKnowledgeCache();
58
-
59
- return parsedData;
51
+ flatmapQueries.flatmapQuery(sql).then((response) => {
52
+ const mappedData = response.values.map(x => x[0]);
53
+ const parsedData = mappedData.map(x => JSON.parse(x));
54
+ sessionStorage.setItem('flatmap-knowledge', JSON.stringify(parsedData));
55
+ updateFlatmapKnowledgeCache();
56
+ });
60
57
  }
61
- return JSON.parse(flatmapKnowledge);
62
58
  }
63
59
 
64
60
  function updateFlatmapKnowledgeCache() {
@@ -74,7 +70,6 @@ function removeFlatmapKnowledgeCache() {
74
70
  'flatmap-knowledge',
75
71
  'flatmap-knowledge-expiry',
76
72
  ];
77
-
78
73
  keys.forEach((key) => {
79
74
  sessionStorage.removeItem(key);
80
75
  });