@abi-software/flatmapvuer 1.10.1-beta.2 → 1.10.1

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.10.1-beta.2",
3
+ "version": "1.10.1",
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/map-utilities": "^1.6.1-beta.0",
46
+ "@abi-software/map-utilities": "^1.6.0",
47
47
  "@abi-software/sparc-annotation": "0.3.2",
48
48
  "@abi-software/svg-sprite": "^1.0.1",
49
49
  "@element-plus/icons-vue": "^2.3.1",
@@ -633,29 +633,15 @@ import {
633
633
  refreshFlatmapKnowledgeCache,
634
634
  getKnowledgeSource,
635
635
  getReferenceConnectivitiesByAPI,
636
- filterPathsByOriginFromKnowledge,
637
- filterPathsByDestinationFromKnowledge,
638
- filterPathsByViaFromKnowledge,
639
636
  } from '../services/flatmapKnowledge.js'
640
637
  import { capitalise } from './utilities.js'
641
638
  import yellowstar from '../icons/yellowstar'
642
639
  import ResizeSensor from 'css-element-queries/src/ResizeSensor'
643
- import * as flatmap from 'https://cdn.jsdelivr.net/npm/@abi-software/flatmap-viewer@4.2.5/+esm'
640
+ import * as flatmap from 'https://cdn.jsdelivr.net/npm/@abi-software/flatmap-viewer@4.2.4/+esm'
644
641
  import { AnnotationService } from '@abi-software/sparc-annotation'
645
642
  import { mapState } from 'pinia'
646
643
  import { useMainStore } from '@/store/index'
647
- import {
648
- queryPathsByOrigin,
649
- queryPathsByViaLocation,
650
- queryPathsByDestination,
651
- extractOriginItems,
652
- extractDestinationItems,
653
- extractViaItems,
654
- queryAllConnectedPaths,
655
- DrawToolbar,
656
- Tooltip,
657
- TreeControls
658
- } from '@abi-software/map-utilities'
644
+ import { DrawToolbar, Tooltip, TreeControls } from '@abi-software/map-utilities'
659
645
  import '@abi-software/map-utilities/dist/style.css'
660
646
  import EventBus from './EventBus.js'
661
647
 
@@ -754,13 +740,8 @@ export default {
754
740
  return { annotator }
755
741
  },
756
742
  methods: {
757
- enableFeatureResetOnClick: function (enable) {
758
- if (this.mapImp) {
759
- this.mapImp.enableFeatureResetOnClick(enable)
760
- }
761
- },
762
743
  /**
763
- *
744
+ *
764
745
  * @param filter format should follow #makeStyleFilter (flatmap-viewer)
765
746
  */
766
747
  setVisibilityFilter: function (filter) {
@@ -1754,8 +1735,9 @@ export default {
1754
1735
  const clickedItem = singleSelection ? data : data[0]
1755
1736
  this.setConnectivityDataSource(this.viewingMode, clickedItem);
1756
1737
  if (this.viewingMode === 'Neuron Connection') {
1757
- // do nothing here
1758
- // the method to highlight paths is moved to checkAndCreatePopups function
1738
+ this.retrieveConnectedPaths([clickedItem.models]).then((paths) => {
1739
+ this.zoomToFeatures(paths)
1740
+ })
1759
1741
  } else {
1760
1742
  this.currentActive = clickedItem.models ? clickedItem.models : '' // This is for FC map
1761
1743
  // This is for annotation mode - draw connectivity between features/paths
@@ -1788,6 +1770,7 @@ export default {
1788
1770
  data &&
1789
1771
  data.type !== 'marker' &&
1790
1772
  eventType === 'click' &&
1773
+ !(this.viewingMode === 'Neuron Connection') &&
1791
1774
  // Disable popup when drawing
1792
1775
  !this.activeDrawTool
1793
1776
  ) {
@@ -1958,14 +1941,6 @@ export default {
1958
1941
  }
1959
1942
  return featureIds;
1960
1943
  },
1961
- getFlatmapKnowledge: function () {
1962
- let flatmapKnowledge = [];
1963
- const flatmapKnowledgeRaw = sessionStorage.getItem('flatmap-knowledge');
1964
- if (flatmapKnowledgeRaw) {
1965
- flatmapKnowledge = JSON.parse(flatmapKnowledgeRaw);
1966
- }
1967
- return flatmapKnowledge;
1968
- },
1969
1944
  emitConnectivityError: function (errorData) {
1970
1945
  this.$emit('connectivity-error', {
1971
1946
  data: {
@@ -2001,7 +1976,7 @@ export default {
2001
1976
  * _checkNeuronClicked shows a neuron path pop up if a path was recently clicked._
2002
1977
  * @arg {Object} `data`
2003
1978
  */
2004
- checkAndCreatePopups: async function (data, connectivityExplorerClicked) {
1979
+ checkAndCreatePopups: async function (data) {
2005
1980
  // Call flatmap database to get the connection data
2006
1981
  if (this.viewingMode === 'Annotation') {
2007
1982
  const features = data.filter(d => d.feature).map(d => d.feature)
@@ -2048,104 +2023,6 @@ export default {
2048
2023
  } else {
2049
2024
  this.annotation = {}
2050
2025
  }
2051
- }
2052
- // clicking on a connectivity explorer card will be same as exploration mode
2053
- // since the card should be opened
2054
- else if (this.viewingMode === 'Neuron Connection' && !connectivityExplorerClicked) {
2055
- const resources = data.map(tooltip => tooltip.resource[0]);
2056
- let pathsQueryAPI = this.retrieveConnectedPaths(resources); // TODO: to replace with queryAllConnectedPaths
2057
-
2058
- // filter out paths
2059
- const featureId = resources.find(resource => !resource.startsWith('ilxtr:'));
2060
- if (featureId) {
2061
- // fallback if it cannot find in anatomical nodes
2062
- const transformResources = Array.isArray(resources) ? [...resources] : [resources];
2063
- if (transformResources.length === 1) {
2064
- transformResources.push([]);
2065
- }
2066
-
2067
- const featureId = data[0].feature?.featureId;
2068
- const annotation = this.mapImp.annotations.get(featureId);
2069
- const anatomicalNodes = annotation?.['anatomical-nodes'];
2070
- const uniqueResource = anatomicalNodes ? JSON.parse(anatomicalNodes[0]) : transformResources;
2071
-
2072
- if (this.connectionType === 'Origin') {
2073
- // Competency Query API
2074
- // pathsQueryAPI = queryPathsByOrigin(this.flatmapAPI, this.mapImp.knowledgeSource, resources);
2075
-
2076
- // search by unique placement before competency API is ready for this
2077
- pathsQueryAPI = filterPathsByOriginFromKnowledge(uniqueResource);
2078
- } else if (this.connectionType === 'Via') {
2079
- // Competency Query API
2080
- // pathsQueryAPI = queryPathsByViaLocation(this.flatmapAPI, this.mapImp.knowledgeSource, resources);
2081
-
2082
- // search by unique placement before competency API is ready for this
2083
- pathsQueryAPI = filterPathsByViaFromKnowledge(uniqueResource);
2084
- } else if (this.connectionType === 'Destination') {
2085
- // Competency Query API
2086
- // pathsQueryAPI = queryPathsByDestination(this.flatmapAPI, this.mapImp.knowledgeSource, resources);
2087
-
2088
- // search by unique placement before competency API is ready for this
2089
- pathsQueryAPI = filterPathsByDestinationFromKnowledge(uniqueResource);
2090
- } else {
2091
- pathsQueryAPI = queryAllConnectedPaths(this.flatmapAPI, this.mapImp.knowledgeSource, resources);
2092
- }
2093
- this.connectivityfilters.push({
2094
- facet: JSON.stringify(uniqueResource),
2095
- facetPropPath: `flatmap.connectivity.source.${this.connectionType.toLowerCase()}`,
2096
- label: JSON.stringify(uniqueResource),
2097
- term: this.connectionType
2098
- })
2099
- // TODO: to remove "neuron-connection-click"
2100
- this.$emit('neuron-connection-feature-click', this.connectivityfilters);
2101
- }
2102
-
2103
- // TODO: to clean up after verification
2104
- // pathsQueryAPI.then(async (paths) => {
2105
- // if (paths.length) {
2106
- // const filteredPaths = paths.filter(path => (path in this.mapImp.pathways.paths))
2107
- // const filteredPathsWithData = [];
2108
- // let prom1 = [];
2109
- // let prom2 = [];
2110
-
2111
- // for (let i = 0; i < filteredPaths.length; i++) {
2112
- // const path = filteredPaths[i];
2113
- // const modelFeatureIds = this.mapImp.modelFeatureIds(path);
2114
- // const feature = this.mapImp.featureProperties(modelFeatureIds[0]);
2115
- // if (feature) {
2116
- // const pathData = {
2117
- // resource: [feature.models],
2118
- // feature: feature,
2119
- // label: feature.label,
2120
- // provenanceTaxonomy: feature.taxons,
2121
- // alert: feature.alert,
2122
- // };
2123
- // filteredPathsWithData.push(pathData);
2124
- // prom1.push({
2125
- // title: pathData.label,
2126
- // featureId: [path]
2127
- // })
2128
- // }
2129
- // }
2130
- // this.tooltipEntry = await Promise.all(prom1)
2131
- // // Emit placeholders first.
2132
- // this.$emit('connectivity-info-open', this.tooltipEntry);
2133
-
2134
- // /**
2135
- // * This event is emitted to highlight the same paths on other display maps.
2136
- // */
2137
- // this.$emit('neuron-connection-click', paths);
2138
-
2139
- // // loading data
2140
- // for (let i = 0; i < filteredPathsWithData.length; i++) {
2141
- // const pathData = filteredPathsWithData[i];
2142
- // const tooltipEntryData = await this.getKnowledgeTooltip(pathData);
2143
- // prom2.push(tooltipEntryData)
2144
- // }
2145
- // this.tooltipEntry = await Promise.all(prom2)
2146
- // this.displayTooltip(filteredPaths)
2147
- // }
2148
- // })
2149
2026
  } else {
2150
2027
  // load and store knowledge
2151
2028
  loadAndStoreKnowledge(this.mapImp, this.flatmapQueries);
@@ -2160,7 +2037,6 @@ export default {
2160
2037
  // this should only for flatmap paths not all features
2161
2038
  if (this.tooltipEntry.length) {
2162
2039
  this.$emit('connectivity-info-open', this.tooltipEntry);
2163
-
2164
2040
  // While having placeholders displayed, get details for all paths and then replace.
2165
2041
  for (let index = 0; index < data.length; index++) {
2166
2042
  prom1.push(await this.getKnowledgeTooltip(data[index]))
@@ -2173,9 +2049,6 @@ export default {
2173
2049
  }
2174
2050
  }
2175
2051
  },
2176
- resetConnectivityfilters: function () {
2177
- this.connectivityfilters = [];
2178
- },
2179
2052
  getKnowledgeTooltip: async function (data) {
2180
2053
  //require data.resource && data.feature.source
2181
2054
  const results = await this.flatmapQueries.retrieveFlatmapKnowledgeForEvent(this.mapImp, data)
@@ -2892,9 +2765,7 @@ export default {
2892
2765
  if (key === "kind") {
2893
2766
  main.label = "Pathways"
2894
2767
  for (const facet of value) {
2895
- const pathway = this.pathways.find(path => {
2896
- return !['other', 'centreline'].includes(path.type) && path.type === facet
2897
- })
2768
+ const pathway = this.pathways.find(path => path.type === facet)
2898
2769
  if (pathway) {
2899
2770
  main.children.push({
2900
2771
  key: `${main.key}.${facet}`,
@@ -2932,38 +2803,18 @@ export default {
2932
2803
  filterOptions.push(main)
2933
2804
  }
2934
2805
  }
2935
- const connectionFilters = [];
2936
- const flatmapKnowledge = this.getFlatmapKnowledge();
2937
- const originItems = extractOriginItems(flatmapKnowledge);
2938
- const viaItems = extractViaItems(flatmapKnowledge);
2939
- const destinationItems = extractDestinationItems(flatmapKnowledge);
2940
-
2941
- const transformItem = (facet, item) => {
2942
- const label = JSON.stringify(item);
2943
- return {
2944
- key: `flatmap.connectivity.source.${facet}.${label}`,
2945
- label: label
2946
- };
2947
- }
2948
-
2949
- for (const facet of ["origin", "via", "destination"]) {
2950
- let childrenList = []
2951
- if (facet === 'origin') {
2952
- childrenList = originItems.map((item) => transformItem(facet, item));
2953
- } else if (facet === 'via') {
2954
- childrenList = viaItems.map((item) => transformItem(facet, item));
2955
- } else if (facet === 'destination') {
2956
- childrenList = destinationItems.map((item) => transformItem(facet, item));
2957
- }
2958
-
2959
- connectionFilters.push({
2960
- key: `flatmap.connectivity.source.${facet}`,
2961
- label: facet,
2962
- children: childrenList,
2963
- })
2964
- }
2965
-
2966
- filterOptions.push(...connectionFilters)
2806
+ // let hardcode = {
2807
+ // key: "flatmap.connectivity.source",
2808
+ // label: "Connectivity",
2809
+ // children: []
2810
+ // }
2811
+ // for (const facet of ["Origins", "Components", "Destinations"]) {
2812
+ // hardcode.children.push({
2813
+ // key: `flatmap.connectivity.source.${facet}`,
2814
+ // label: facet
2815
+ // })
2816
+ // }
2817
+ // filterOptions.push(hardcode)
2967
2818
  return filterOptions
2968
2819
  }
2969
2820
  },
@@ -2980,7 +2831,9 @@ export default {
2980
2831
  this.mapImp.setBackgroundOpacity(1)
2981
2832
  this.backgroundChangeCallback(this.currentBackground)
2982
2833
  this.pathways = this.mapImp.pathTypes()
2983
- this.pathways = this.pathways.filter(path => !['other', 'centreline'].includes(path.type))
2834
+ this.pathways = this.pathways.filter(path => {
2835
+ return path.enabled && path.type !== 'other'
2836
+ })
2984
2837
  //Disable layers for now
2985
2838
  //this.layers = this.mapImp.getLayers();
2986
2839
  this.processSystems(this.mapImp.getSystems())
@@ -3040,7 +2893,7 @@ export default {
3040
2893
  * @arg {String} `term`,
3041
2894
  * @arg {String} `displayInfo`
3042
2895
  */
3043
- searchAndShowResult: function (term, displayInfo, connectivityExplorerClicked) {
2896
+ searchAndShowResult: function (term, displayInfo) {
3044
2897
  if (this.mapImp) {
3045
2898
  if (term === undefined || term === '') {
3046
2899
  this.mapImp.clearSearchResults()
@@ -3071,8 +2924,13 @@ export default {
3071
2924
  provenanceTaxonomy: feature.taxons,
3072
2925
  alert: feature.alert,
3073
2926
  }
3074
- // Show popup for all modes
3075
- this.checkAndCreatePopups([data], connectivityExplorerClicked)
2927
+ if (this.viewingMode === "Exploration" || this.viewingMode === "Annotation") {
2928
+ this.checkAndCreatePopups([data])
2929
+ } else if (this.viewingMode === 'Neuron Connection') {
2930
+ this.retrieveConnectedPaths(data.resource).then((paths) => {
2931
+ this.zoomToFeatures(paths)
2932
+ })
2933
+ }
3076
2934
  this.mapImp.showPopup(featureId, capitalise(feature.label), {
3077
2935
  className: 'custom-popup',
3078
2936
  positionAtLastClick: false,
@@ -3087,21 +2945,6 @@ export default {
3087
2945
  }
3088
2946
  return false
3089
2947
  },
3090
- /**
3091
- * @public
3092
- * Public method to highlight connected paths for neuron connection mode,
3093
- * to highlight paths for other display maps on spit screen.
3094
- * @arg {Array} `paths`
3095
- */
3096
- highlightConnectedPaths: function (paths) {
3097
- if (paths.length) {
3098
- // filter paths for this map
3099
- const filteredPaths = paths.filter(path => (path in this.mapImp.pathways.paths))
3100
- // this.zoomToFeatures is replaced with selectGeoJSONFeatures to highlight paths
3101
- const featureIdsToHighlight = this.mapImp.modelFeatureIdList(filteredPaths);
3102
- this.mapImp.selectGeoJSONFeatures(featureIdsToHighlight);
3103
- }
3104
- },
3105
2948
  /**
3106
2949
  * @public
3107
2950
  * Function to show search suggestions
@@ -3115,9 +2958,6 @@ export default {
3115
2958
  onActionClick: function (data) {
3116
2959
  EventBus.emit('onActionClick', data)
3117
2960
  },
3118
- setConnectionType: function (type) {
3119
- this.connectionType = type;
3120
- },
3121
2961
  },
3122
2962
  props: {
3123
2963
  /**
@@ -3417,7 +3257,6 @@ export default {
3417
3257
  'Neuron Connection': 'Discover Neuron connections by selecting a neuron and viewing its associated network connections',
3418
3258
  'Annotation': ['View feature annotations', 'Add, comment on and view feature annotations']
3419
3259
  },
3420
- connectionType: 'All',
3421
3260
  offlineAnnotationEnabled: false,
3422
3261
  offlineAnnotations: [],
3423
3262
  annotationFrom: 'Anyone',
@@ -3464,7 +3303,6 @@ export default {
3464
3303
  }),
3465
3304
  searchTerm: "",
3466
3305
  taxonLeaveDelay: undefined,
3467
- connectivityfilters: [],
3468
3306
  }
3469
3307
  },
3470
3308
  computed: {
@@ -70,8 +70,6 @@
70
70
  @connectivity-info-open="onConnectivityInfoOpen"
71
71
  @connectivity-info-close="onConnectivityInfoClose"
72
72
  @connectivity-error="onConnectivityError"
73
- @neuron-connection-click="onNeuronConnectionClick"
74
- @neuron-connection-feature-click="onNeuronConnectionFeatureClick"
75
73
  @open-map="$emit('open-map', $event)"
76
74
  @pathway-selection-changed="onSelectionsDataChanged"
77
75
  :minZoom="minZoom"
@@ -101,7 +99,7 @@
101
99
  import { markRaw } from 'vue'
102
100
  import EventBus from './EventBus'
103
101
  import FlatmapVuer from './FlatmapVuer.vue'
104
- import * as flatmap from 'https://cdn.jsdelivr.net/npm/@abi-software/flatmap-viewer@4.2.5/+esm'
102
+ import * as flatmap from 'https://cdn.jsdelivr.net/npm/@abi-software/flatmap-viewer@4.2.4/+esm'
105
103
  import {
106
104
  ElCol as Col,
107
105
  ElOption as Option,
@@ -307,12 +305,6 @@ export default {
307
305
  onConnectivityError: function (errorInfo) {
308
306
  this.$emit('connectivity-error', errorInfo);
309
307
  },
310
- onNeuronConnectionClick: function (payload) {
311
- this.$emit('neuron-connection-click', payload);
312
- },
313
- onNeuronConnectionFeatureClick: function (payload) {
314
- this.$emit('neuron-connection-feature-click', payload);
315
- },
316
308
  onSelectionsDataChanged: function (data) {
317
309
  this.$emit('pathway-selection-changed', data);
318
310
  },
@@ -565,10 +557,6 @@ export default {
565
557
  let map = this.getCurrentFlatmap()
566
558
  map.changeViewingMode(modeName)
567
559
  },
568
- setConnectionType: function (type) {
569
- let map = this.getCurrentFlatmap();
570
- map.setConnectionType(type);
571
- },
572
560
  },
573
561
  props: {
574
562
  /**
@@ -1,9 +1,3 @@
1
- import {
2
- findPathsByOriginItem,
3
- findPathsByDestinationItem,
4
- findPathsByViaItem,
5
- } from '@abi-software/map-utilities';
6
-
7
1
  async function getReferenceConnectivitiesFromStorage(resource) {
8
2
  const flatmapKnowledgeRaw = sessionStorage.getItem('flatmap-knowledge');
9
3
 
@@ -32,43 +26,6 @@ async function getReferenceConnectivitiesByAPI(mapImp, resource, flatmapQueries)
32
26
  return featureIds;
33
27
  }
34
28
 
35
- function getFlatmapKnowledge() {
36
- const flatmapKnowledgeRaw = sessionStorage.getItem('flatmap-knowledge');
37
-
38
- if (flatmapKnowledgeRaw) {
39
- const flatmapKnowledge = JSON.parse(flatmapKnowledgeRaw);
40
- return flatmapKnowledge;
41
- }
42
- return [];
43
- }
44
-
45
- async function filterPathsByOriginFromKnowledge(resource) {
46
- const flatmapKnowledge = getFlatmapKnowledge();
47
- const results = findPathsByOriginItem(flatmapKnowledge, resource);
48
- if (Array.isArray(results)) {
49
- return results.map(x => x.id);
50
- }
51
- return [];
52
- }
53
-
54
- async function filterPathsByDestinationFromKnowledge(resource) {
55
- const flatmapKnowledge = getFlatmapKnowledge();
56
- const results = findPathsByDestinationItem(flatmapKnowledge, resource);
57
- if (Array.isArray(results)) {
58
- return results.map(x => x.id);
59
- }
60
- return [];
61
- }
62
-
63
- async function filterPathsByViaFromKnowledge(resource) {
64
- const flatmapKnowledge = getFlatmapKnowledge();
65
- const results = findPathsByViaItem(flatmapKnowledge, resource);
66
- if (Array.isArray(results)) {
67
- return results.map(x => x.id);
68
- }
69
- return [];
70
- }
71
-
72
29
  function getKnowledgeSource(mapImp) {
73
30
  return getKnowledgeSourceFromProvenance(mapImp.provenance);
74
31
  }
@@ -146,7 +103,4 @@ export {
146
103
  getKnowledgeSource,
147
104
  getKnowledgeSourceFromProvenance,
148
105
  refreshFlatmapKnowledgeCache,
149
- filterPathsByOriginFromKnowledge,
150
- filterPathsByDestinationFromKnowledge,
151
- filterPathsByViaFromKnowledge,
152
106
  }