@abi-software/flatmapvuer 1.6.0-beta.0 → 1.6.0-beta.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/dist/flatmapvuer.js +21914 -21526
- package/dist/flatmapvuer.umd.cjs +134 -128
- package/dist/style.css +1 -1
- package/package.json +3 -3
- package/src/App.vue +8 -3
- package/src/components/FlatmapVuer.vue +309 -123
- package/src/components/MultiFlatmapVuer.vue +27 -5
- package/src/components/SelectionsGroup.vue +30 -8
- package/src/components/utilities.js +9 -0
- package/src/services/flatmapQueries.js +118 -46
|
@@ -257,7 +257,7 @@ Please use `const` to assign meaningful names to them...
|
|
|
257
257
|
<div
|
|
258
258
|
class="pathway-location"
|
|
259
259
|
:class="{ open: drawerOpen, close: !drawerOpen }"
|
|
260
|
-
v-show="!
|
|
260
|
+
v-show="!disableUI"
|
|
261
261
|
>
|
|
262
262
|
<div
|
|
263
263
|
class="pathway-container"
|
|
@@ -388,17 +388,6 @@ Please use `const` to assign meaningful names to them...
|
|
|
388
388
|
ref="taxonSelection"
|
|
389
389
|
key="taxonSelection"
|
|
390
390
|
/>
|
|
391
|
-
<selections-group
|
|
392
|
-
v-if="!(isCentreLine || isFC) && centreLines && centreLines.length > 0"
|
|
393
|
-
title="Nerves"
|
|
394
|
-
labelKey="label"
|
|
395
|
-
identifierKey="key"
|
|
396
|
-
:selections="centreLines"
|
|
397
|
-
@changed="centreLinesSelected"
|
|
398
|
-
@selections-data-changed="onSelectionsDataChanged"
|
|
399
|
-
ref="centrelinesSelection"
|
|
400
|
-
key="centrelinesSelection"
|
|
401
|
-
/>
|
|
402
391
|
</div>
|
|
403
392
|
<div
|
|
404
393
|
@click="toggleDrawer"
|
|
@@ -658,8 +647,9 @@ import {
|
|
|
658
647
|
import flatmapMarker from '../icons/flatmap-marker'
|
|
659
648
|
import {
|
|
660
649
|
FlatmapQueries,
|
|
661
|
-
|
|
650
|
+
findTaxonomyLabels,
|
|
662
651
|
} from '../services/flatmapQueries.js'
|
|
652
|
+
import { capitalise } from './utilities.js'
|
|
663
653
|
import yellowstar from '../icons/yellowstar'
|
|
664
654
|
import ResizeSensor from 'css-element-queries/src/ResizeSensor'
|
|
665
655
|
import * as flatmap from '@abi-software/flatmap-viewer'
|
|
@@ -717,28 +707,6 @@ const processFTUs = (parent, key) => {
|
|
|
717
707
|
return ftus
|
|
718
708
|
}
|
|
719
709
|
|
|
720
|
-
const processSystems = (systems) => {
|
|
721
|
-
const allSystems = []
|
|
722
|
-
if (systems && systems.length > 0) {
|
|
723
|
-
const data = { label: 'All', key: 'All', children: [] }
|
|
724
|
-
systems.forEach((system) => {
|
|
725
|
-
const child = {
|
|
726
|
-
colour: system.colour,
|
|
727
|
-
enabled: system.enabled,
|
|
728
|
-
label: system.id,
|
|
729
|
-
key: system.id,
|
|
730
|
-
}
|
|
731
|
-
const children = processFTUs(system, child.key)
|
|
732
|
-
if (children.length > 0) child.children = children
|
|
733
|
-
data.children.push(child)
|
|
734
|
-
})
|
|
735
|
-
|
|
736
|
-
allSystems.push(data)
|
|
737
|
-
}
|
|
738
|
-
|
|
739
|
-
return allSystems
|
|
740
|
-
}
|
|
741
|
-
|
|
742
710
|
const createUnfilledTooltipData = function () {
|
|
743
711
|
return {
|
|
744
712
|
destinations: [],
|
|
@@ -792,6 +760,15 @@ export default {
|
|
|
792
760
|
return { annotator }
|
|
793
761
|
},
|
|
794
762
|
methods: {
|
|
763
|
+
/**
|
|
764
|
+
* @public
|
|
765
|
+
* Function to manually send aborted signal when annotation tooltip popup or sidebar tab closed.
|
|
766
|
+
*/
|
|
767
|
+
manualAbortedOnClose: function () {
|
|
768
|
+
if (this.annotationSidebar) this.$emit("annotation-close")
|
|
769
|
+
this.closeTooltip()
|
|
770
|
+
this.annotationEventCallback({}, { type: 'aborted' })
|
|
771
|
+
},
|
|
795
772
|
/**
|
|
796
773
|
* @public
|
|
797
774
|
* Function to initialise drawing.
|
|
@@ -802,7 +779,7 @@ export default {
|
|
|
802
779
|
this.activeDrawMode = undefined
|
|
803
780
|
this.drawnCreatedEvent = {}
|
|
804
781
|
},
|
|
805
|
-
/**
|
|
782
|
+
/**
|
|
806
783
|
* @public
|
|
807
784
|
* Function to cancel a newly drawn feature.
|
|
808
785
|
*/
|
|
@@ -866,18 +843,13 @@ export default {
|
|
|
866
843
|
* @arg {String} `name`
|
|
867
844
|
*/
|
|
868
845
|
toolbarEvent: function (type, name) {
|
|
869
|
-
this.
|
|
870
|
-
if (this.annotationSidebar) this.$emit("annotation-close")
|
|
846
|
+
this.manualAbortedOnClose()
|
|
871
847
|
this.doubleClickedFeature = false
|
|
872
848
|
this.connectionEntry = {}
|
|
873
849
|
if (type === 'mode') {
|
|
874
850
|
// Deselect any feature when draw mode is changed
|
|
875
851
|
this.changeAnnotationDrawMode({ mode: 'simple_select' })
|
|
876
852
|
this.activeDrawMode = name
|
|
877
|
-
// rollback modified feature when exit edit/delete mode
|
|
878
|
-
if (Object.keys(this.annotationEntry).length > 0 && !this.featureAnnotationSubmitted) {
|
|
879
|
-
this.rollbackAnnotationEvent()
|
|
880
|
-
}
|
|
881
853
|
} else if (type === 'tool') {
|
|
882
854
|
if (name) {
|
|
883
855
|
const tool = name.replace(/[A-Z]/g, letter => `_${letter.toLowerCase()}`)
|
|
@@ -999,10 +971,8 @@ export default {
|
|
|
999
971
|
if (this.annotationSidebar) this.$emit("annotation-close")
|
|
1000
972
|
this.closeTooltip()
|
|
1001
973
|
this.annotationEntry = {}
|
|
1002
|
-
} else {
|
|
1003
|
-
// Update 'existDrawnFeatures' when created or updated event
|
|
1004
|
-
this.addAnnotationFeature()
|
|
1005
974
|
}
|
|
975
|
+
this.addAnnotationFeature()
|
|
1006
976
|
}
|
|
1007
977
|
},
|
|
1008
978
|
/**
|
|
@@ -1095,6 +1065,7 @@ export default {
|
|
|
1095
1065
|
setDrawnType: function (flag) {
|
|
1096
1066
|
this.drawnType = flag
|
|
1097
1067
|
if (this.mapImp) {
|
|
1068
|
+
this.manualAbortedOnClose()
|
|
1098
1069
|
this.addAnnotationFeature()
|
|
1099
1070
|
this.initialiseDrawing()
|
|
1100
1071
|
}
|
|
@@ -1107,6 +1078,7 @@ export default {
|
|
|
1107
1078
|
setAnnotatedType: function (flag) {
|
|
1108
1079
|
this.annotatedType = flag
|
|
1109
1080
|
if (this.mapImp) {
|
|
1081
|
+
this.manualAbortedOnClose()
|
|
1110
1082
|
this.addAnnotationFeature()
|
|
1111
1083
|
}
|
|
1112
1084
|
},
|
|
@@ -1173,7 +1145,6 @@ export default {
|
|
|
1173
1145
|
if (children.length > 0) child.children = children
|
|
1174
1146
|
data.children.push(child)
|
|
1175
1147
|
})
|
|
1176
|
-
|
|
1177
1148
|
this.systems.push(data)
|
|
1178
1149
|
}
|
|
1179
1150
|
},
|
|
@@ -1184,14 +1155,22 @@ export default {
|
|
|
1184
1155
|
* @arg {String} `flatmapAPI`,
|
|
1185
1156
|
* @arg {Array} `taxonIdentifiers`
|
|
1186
1157
|
*/
|
|
1187
|
-
processTaxon: function (
|
|
1158
|
+
processTaxon: function (taxonIdentifiers, state) {
|
|
1188
1159
|
this.taxonConnectivity.length = 0
|
|
1189
|
-
taxonIdentifiers.
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1160
|
+
findTaxonomyLabels(this.mapImp, taxonIdentifiers).then((entityLabels) => {
|
|
1161
|
+
if (entityLabels.length) {
|
|
1162
|
+
entityLabels.forEach((entityLabel) => {
|
|
1163
|
+
let enabled = true
|
|
1164
|
+
if (state) {
|
|
1165
|
+
enabled = state.checkAll ? true : state.checked.includes(entityLabel.taxon)
|
|
1166
|
+
}
|
|
1167
|
+
this.taxonConnectivity.push({...entityLabel, enabled});
|
|
1168
|
+
if (this.mapImp) {
|
|
1169
|
+
this.mapImp.enableConnectivityByTaxonIds(entityLabel.taxon, enabled)
|
|
1170
|
+
}
|
|
1171
|
+
});
|
|
1172
|
+
}
|
|
1173
|
+
});
|
|
1195
1174
|
},
|
|
1196
1175
|
/**
|
|
1197
1176
|
* @public
|
|
@@ -1219,11 +1198,27 @@ export default {
|
|
|
1219
1198
|
* @arg {Boolean} `flag`
|
|
1220
1199
|
*/
|
|
1221
1200
|
setOutlines: function (flag) {
|
|
1222
|
-
this.
|
|
1201
|
+
this.outlinesRadio = flag
|
|
1223
1202
|
if (this.mapImp) {
|
|
1224
1203
|
this.mapImp.setPaint({ colour: this.colourRadio, outline: flag })
|
|
1225
1204
|
}
|
|
1226
1205
|
},
|
|
1206
|
+
setInitMapState: function () {
|
|
1207
|
+
if (this.mapImp) {
|
|
1208
|
+
const map = this.mapImp._map;
|
|
1209
|
+
const bounds = this.mapImp.options.bounds;
|
|
1210
|
+
const initBounds = [
|
|
1211
|
+
[bounds[0], bounds[1]],
|
|
1212
|
+
[bounds[2], bounds[3]]
|
|
1213
|
+
];
|
|
1214
|
+
|
|
1215
|
+
map.setMaxBounds(null); // override default
|
|
1216
|
+
|
|
1217
|
+
this.initMapState = {
|
|
1218
|
+
initBounds,
|
|
1219
|
+
};
|
|
1220
|
+
}
|
|
1221
|
+
},
|
|
1227
1222
|
/**
|
|
1228
1223
|
* @public
|
|
1229
1224
|
* Function to toggle paths to default.
|
|
@@ -1231,9 +1226,18 @@ export default {
|
|
|
1231
1226
|
*/
|
|
1232
1227
|
resetView: function () {
|
|
1233
1228
|
if (this.mapImp) {
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1229
|
+
// fit to window
|
|
1230
|
+
const map = this.mapImp._map;
|
|
1231
|
+
const { initBounds } = this.initMapState;
|
|
1232
|
+
// reset rotation
|
|
1233
|
+
map.resetNorthPitch({
|
|
1234
|
+
animate: false,
|
|
1235
|
+
});
|
|
1236
|
+
if (initBounds) {
|
|
1237
|
+
// reset zoom and position
|
|
1238
|
+
map.fitBounds(initBounds, {
|
|
1239
|
+
animate: false
|
|
1240
|
+
});
|
|
1237
1241
|
}
|
|
1238
1242
|
if (this.$refs.skcanSelection) {
|
|
1239
1243
|
this.$refs.skcanSelection.reset()
|
|
@@ -1269,18 +1273,6 @@ export default {
|
|
|
1269
1273
|
this.mapImp.zoomOut()
|
|
1270
1274
|
}
|
|
1271
1275
|
},
|
|
1272
|
-
/**
|
|
1273
|
-
* @public
|
|
1274
|
-
* Function to show or hide centrelines and nodes.
|
|
1275
|
-
* The parameter ``payload`` is an object with a boolean property, ``value``,
|
|
1276
|
-
* ``payload.value = true/false``.
|
|
1277
|
-
* @arg {Object} `payload`
|
|
1278
|
-
*/
|
|
1279
|
-
centreLinesSelected: function (payload) {
|
|
1280
|
-
if (this.mapImp) {
|
|
1281
|
-
this.mapImp.enableCentrelines(payload.value)
|
|
1282
|
-
}
|
|
1283
|
-
},
|
|
1284
1276
|
onSelectionsDataChanged: function (data) {
|
|
1285
1277
|
this.$emit('pathway-selection-changed', data);
|
|
1286
1278
|
},
|
|
@@ -1321,7 +1313,7 @@ export default {
|
|
|
1321
1313
|
let pathFeatures = paths.map((p) => this.mapImp.featureProperties(p))
|
|
1322
1314
|
|
|
1323
1315
|
// Query the flatmap knowledge graph for connectivity, we use this to grab the origins
|
|
1324
|
-
let connectivity = await this.flatmapQueries.
|
|
1316
|
+
let connectivity = await this.flatmapQueries.queryForConnectivityNew(this.mapImp, payload)
|
|
1325
1317
|
|
|
1326
1318
|
// Check and flatten the origins node graph
|
|
1327
1319
|
let originsFlat = connectivity?.ids?.dendrites?.flat().flat()
|
|
@@ -1589,8 +1581,12 @@ export default {
|
|
|
1589
1581
|
// Rollback drawing when no new annotation submitted
|
|
1590
1582
|
if (!this.featureAnnotationSubmitted) this.rollbackAnnotationEvent()
|
|
1591
1583
|
else this.featureAnnotationSubmitted = false
|
|
1584
|
+
this.annotationEntry = {}
|
|
1592
1585
|
} else if (data.type === 'modeChanged') {
|
|
1593
1586
|
if (data.feature.mode === 'direct_select') this.doubleClickedFeature = true
|
|
1587
|
+
if (this.annotationSidebar && data.feature.mode === 'simple_select') {
|
|
1588
|
+
this.annotationEventCallback({}, { type: 'aborted' })
|
|
1589
|
+
}
|
|
1594
1590
|
} else if (data.type === 'selectionChanged') {
|
|
1595
1591
|
this.selectedDrawnFeature = data.feature.features.length === 0 ?
|
|
1596
1592
|
undefined : data.feature.features[0]
|
|
@@ -1623,6 +1619,8 @@ export default {
|
|
|
1623
1619
|
if (data.type === 'created') this.drawnCreatedEvent = payload
|
|
1624
1620
|
else this.checkAndCreatePopups(payload)
|
|
1625
1621
|
}
|
|
1622
|
+
if (data.type === 'deleted') this.previousDeletedEvent = data
|
|
1623
|
+
else this.previousDeletedEvent = {}
|
|
1626
1624
|
},
|
|
1627
1625
|
/**
|
|
1628
1626
|
* @public
|
|
@@ -1667,6 +1665,9 @@ export default {
|
|
|
1667
1665
|
}
|
|
1668
1666
|
if (eventType === 'click') {
|
|
1669
1667
|
this.featuresAlert = data.alert
|
|
1668
|
+
//The following will be used to track either a feature is selected
|
|
1669
|
+
this.statesTracking.activeClick = true
|
|
1670
|
+
this.statesTracking.activeTerm = data?.models
|
|
1670
1671
|
if (this.viewingMode === 'Neuron Connection') {
|
|
1671
1672
|
this.highlightConnectedPaths([data.models])
|
|
1672
1673
|
} else {
|
|
@@ -1724,8 +1725,123 @@ export default {
|
|
|
1724
1725
|
if (modeName) {
|
|
1725
1726
|
this.viewingMode = modeName
|
|
1726
1727
|
}
|
|
1727
|
-
|
|
1728
|
-
|
|
1728
|
+
this.manualAbortedOnClose()
|
|
1729
|
+
},
|
|
1730
|
+
/**
|
|
1731
|
+
* @public
|
|
1732
|
+
* Function to remove active tooltips on map.
|
|
1733
|
+
*/
|
|
1734
|
+
removeActiveTooltips: function () {
|
|
1735
|
+
const tooltips = this.$el.querySelectorAll('.flatmap-tooltip-popup');
|
|
1736
|
+
tooltips.forEach((tooltip) => tooltip.remove());
|
|
1737
|
+
},
|
|
1738
|
+
/**
|
|
1739
|
+
* Function to create tooltip for the provided connectivity data.
|
|
1740
|
+
* @arg {Array} `connectivityData`
|
|
1741
|
+
*/
|
|
1742
|
+
createTooltipForConnectivity: function (connectivityData) {
|
|
1743
|
+
// combine all labels to show together
|
|
1744
|
+
// content type must be DOM object to use HTML
|
|
1745
|
+
const labelsContainer = document.createElement('div');
|
|
1746
|
+
labelsContainer.classList.add('flatmap-feature-label');
|
|
1747
|
+
|
|
1748
|
+
connectivityData.forEach((connectivity, i) => {
|
|
1749
|
+
const { label } = connectivity;
|
|
1750
|
+
labelsContainer.append(capitalise(label));
|
|
1751
|
+
|
|
1752
|
+
if ((i + 1) < connectivityData.length) {
|
|
1753
|
+
const hr = document.createElement('hr');
|
|
1754
|
+
labelsContainer.appendChild(hr);
|
|
1755
|
+
}
|
|
1756
|
+
});
|
|
1757
|
+
|
|
1758
|
+
this.mapImp.showPopup(
|
|
1759
|
+
connectivityData[0].featureId,
|
|
1760
|
+
labelsContainer,
|
|
1761
|
+
{
|
|
1762
|
+
className: 'custom-popup flatmap-tooltip-popup',
|
|
1763
|
+
positionAtLastClick: false,
|
|
1764
|
+
preserveSelection: true,
|
|
1765
|
+
}
|
|
1766
|
+
);
|
|
1767
|
+
},
|
|
1768
|
+
/**
|
|
1769
|
+
* Function to show connectivity tooltips on the map
|
|
1770
|
+
* and highlight the nerve.
|
|
1771
|
+
* @arg {Object} `payload`
|
|
1772
|
+
*/
|
|
1773
|
+
showConnectivityTooltips: function (payload) {
|
|
1774
|
+
const { connectivityInfo, data } = payload;
|
|
1775
|
+
const featuresToHighlight = [];
|
|
1776
|
+
const connectivityData = [];
|
|
1777
|
+
const filteredConnectivityData = [];
|
|
1778
|
+
const errorData = [];
|
|
1779
|
+
|
|
1780
|
+
if (!data.length) {
|
|
1781
|
+
// Close all tooltips on the current flatmap element
|
|
1782
|
+
this.removeActiveTooltips();
|
|
1783
|
+
} else {
|
|
1784
|
+
data.forEach((item) => {
|
|
1785
|
+
connectivityData.push({
|
|
1786
|
+
id: item.id,
|
|
1787
|
+
label: item.label,
|
|
1788
|
+
});
|
|
1789
|
+
});
|
|
1790
|
+
}
|
|
1791
|
+
|
|
1792
|
+
// to keep the highlighted path on map
|
|
1793
|
+
if (connectivityInfo && connectivityInfo.featureId) {
|
|
1794
|
+
featuresToHighlight.push(...connectivityInfo.featureId);
|
|
1795
|
+
}
|
|
1796
|
+
|
|
1797
|
+
// search the features on the map first
|
|
1798
|
+
if (this.mapImp) {
|
|
1799
|
+
connectivityData.forEach((connectivity, i) => {
|
|
1800
|
+
const {id, label} = connectivity;
|
|
1801
|
+
const response = this.mapImp.search(id);
|
|
1802
|
+
|
|
1803
|
+
if (response?.results.length) {
|
|
1804
|
+
const featureId = response?.results[0].featureId;
|
|
1805
|
+
|
|
1806
|
+
filteredConnectivityData.push({
|
|
1807
|
+
featureId,
|
|
1808
|
+
id,
|
|
1809
|
+
label,
|
|
1810
|
+
});
|
|
1811
|
+
featuresToHighlight.push(id);
|
|
1812
|
+
} else {
|
|
1813
|
+
errorData.push(connectivity);
|
|
1814
|
+
}
|
|
1815
|
+
});
|
|
1816
|
+
|
|
1817
|
+
if (filteredConnectivityData.length) {
|
|
1818
|
+
// show tooltip of the first item
|
|
1819
|
+
// with all labels
|
|
1820
|
+
this.createTooltipForConnectivity(filteredConnectivityData);
|
|
1821
|
+
} else {
|
|
1822
|
+
errorData.push(...connectivityData);
|
|
1823
|
+
// Close all tooltips on the current flatmap element
|
|
1824
|
+
this.removeActiveTooltips();
|
|
1825
|
+
}
|
|
1826
|
+
|
|
1827
|
+
// Emit error message for connectivity graph
|
|
1828
|
+
if (errorData.length) {
|
|
1829
|
+
this.emitConnectivityGraphError(errorData);
|
|
1830
|
+
}
|
|
1831
|
+
|
|
1832
|
+
// highlight all available features
|
|
1833
|
+
this.mapImp.zoomToFeatures(featuresToHighlight, { noZoomIn: true });
|
|
1834
|
+
}
|
|
1835
|
+
},
|
|
1836
|
+
emitConnectivityGraphError: function (errorData) {
|
|
1837
|
+
const errorMessage = 'cannot be found on the map!';
|
|
1838
|
+
|
|
1839
|
+
this.$emit('connectivity-graph-error', {
|
|
1840
|
+
data: {
|
|
1841
|
+
errorData: errorData,
|
|
1842
|
+
errorMessage: errorMessage,
|
|
1843
|
+
}
|
|
1844
|
+
});
|
|
1729
1845
|
},
|
|
1730
1846
|
/**
|
|
1731
1847
|
* @public
|
|
@@ -1737,6 +1853,13 @@ export default {
|
|
|
1737
1853
|
// Call flatmap database to get the connection data
|
|
1738
1854
|
if (this.viewingMode === 'Annotation') {
|
|
1739
1855
|
if (data.feature) {
|
|
1856
|
+
if (this.annotationSidebar && this.previousDeletedEvent.type === 'deleted') {
|
|
1857
|
+
this.annotationEntry = {
|
|
1858
|
+
...this.previousDeletedEvent,
|
|
1859
|
+
resourceId: this.serverURL
|
|
1860
|
+
}
|
|
1861
|
+
this.annotationEventCallback({}, { type: 'aborted' })
|
|
1862
|
+
}
|
|
1740
1863
|
this.annotationEntry = {
|
|
1741
1864
|
...data.feature,
|
|
1742
1865
|
resourceId: this.serverURL,
|
|
@@ -1767,13 +1890,13 @@ export default {
|
|
|
1767
1890
|
this.annotation = {}
|
|
1768
1891
|
}
|
|
1769
1892
|
} else {
|
|
1893
|
+
//require data.resource && data.feature.source
|
|
1770
1894
|
let results =
|
|
1771
|
-
await this.flatmapQueries.retrieveFlatmapKnowledgeForEvent(data)
|
|
1895
|
+
await this.flatmapQueries.retrieveFlatmapKnowledgeForEvent(this.mapImp, data)
|
|
1772
1896
|
// The line below only creates the tooltip if some data was found on the path
|
|
1773
|
-
//
|
|
1897
|
+
// the pubmed URLs are in knowledge response.references
|
|
1774
1898
|
if (
|
|
1775
|
-
results[0] ||
|
|
1776
|
-
results[1] ||
|
|
1899
|
+
(results && results[0]) ||
|
|
1777
1900
|
(data.feature.hyperlinks && data.feature.hyperlinks.length > 0)
|
|
1778
1901
|
) {
|
|
1779
1902
|
this.resourceForTooltip = data.resource[0]
|
|
@@ -1817,7 +1940,7 @@ export default {
|
|
|
1817
1940
|
* @arg {Object} `data`
|
|
1818
1941
|
*/
|
|
1819
1942
|
createTooltipFromNeuronCuration: async function (data) {
|
|
1820
|
-
this.tooltipEntry = await this.flatmapQueries.createTooltipData(data)
|
|
1943
|
+
this.tooltipEntry = await this.flatmapQueries.createTooltipData(this.mapImp, data)
|
|
1821
1944
|
this.displayTooltip(data.resource[0])
|
|
1822
1945
|
},
|
|
1823
1946
|
/**
|
|
@@ -2160,6 +2283,48 @@ export default {
|
|
|
2160
2283
|
return Array.from(new Set(labels))
|
|
2161
2284
|
}
|
|
2162
2285
|
},
|
|
2286
|
+
/**
|
|
2287
|
+
* Function to get and store the state (object) of the map in
|
|
2288
|
+
* the provided argument
|
|
2289
|
+
*/
|
|
2290
|
+
getVisibilityState: function (state) {
|
|
2291
|
+
const refs = ['alertSelection', 'pathwaysSelection', 'taxonSelection']
|
|
2292
|
+
refs.forEach(ref => {
|
|
2293
|
+
let comp = this.$refs[ref]
|
|
2294
|
+
if (comp) {
|
|
2295
|
+
state[ref] = comp.getState()
|
|
2296
|
+
}
|
|
2297
|
+
})
|
|
2298
|
+
if (this.$refs.treeControls) {
|
|
2299
|
+
const checkedKeys = this.$refs.treeControls.$refs.regionTree.getCheckedKeys();
|
|
2300
|
+
//Only store first level systems (terms without .)
|
|
2301
|
+
state['systemsSelection'] = checkedKeys.filter(term => !term.includes('.'))
|
|
2302
|
+
}
|
|
2303
|
+
},
|
|
2304
|
+
/**
|
|
2305
|
+
* Function to set and restore the visibility state (object) of
|
|
2306
|
+
* the map with the provided argument
|
|
2307
|
+
*/
|
|
2308
|
+
setVisibilityState: function (state) {
|
|
2309
|
+
const refs = ['alertSelection', 'pathwaysSelection', 'taxonSelection']
|
|
2310
|
+
refs.forEach(ref => {
|
|
2311
|
+
const settings = state[ref]
|
|
2312
|
+
if (settings) {
|
|
2313
|
+
const comp = this.$refs[ref]
|
|
2314
|
+
if (comp) {
|
|
2315
|
+
comp.setState(settings)
|
|
2316
|
+
}
|
|
2317
|
+
}
|
|
2318
|
+
})
|
|
2319
|
+
if ('systemsSelection' in state) {
|
|
2320
|
+
if (this.$refs.treeControls) {
|
|
2321
|
+
this.$refs.treeControls.$refs.regionTree.setCheckedKeys(state['systemsSelection']);
|
|
2322
|
+
this.systems[0].children.forEach((item) => {
|
|
2323
|
+
this.mapImp.enableSystem(item.key, state['systemsSelection'].includes(item.key))
|
|
2324
|
+
})
|
|
2325
|
+
}
|
|
2326
|
+
}
|
|
2327
|
+
},
|
|
2163
2328
|
/**
|
|
2164
2329
|
* @public
|
|
2165
2330
|
* Function to get the state (object) of the map.
|
|
@@ -2175,6 +2340,13 @@ export default {
|
|
|
2175
2340
|
else if (identifier && identifier.biologicalSex)
|
|
2176
2341
|
state['biologicalSex'] = identifier.biologicalSex
|
|
2177
2342
|
if (identifier && identifier.uuid) state['uuid'] = identifier.uuid
|
|
2343
|
+
state['viewingMode'] = this.viewingMode
|
|
2344
|
+
state['searchTerm'] = this.statesTracking.activeTerm
|
|
2345
|
+
state['flightPath3D'] = this.flightPath3DRadio
|
|
2346
|
+
state['colour'] = this.colourRadio
|
|
2347
|
+
state['outlinesRadio'] = this.outlinesRadio
|
|
2348
|
+
state['background'] = this.currentBackground
|
|
2349
|
+
this.getVisibilityState(state)
|
|
2178
2350
|
return state
|
|
2179
2351
|
}
|
|
2180
2352
|
return undefined
|
|
@@ -2192,9 +2364,7 @@ export default {
|
|
|
2192
2364
|
this.entry == state.entry &&
|
|
2193
2365
|
(!state.biologicalSex || state.biologicalSex === this.biologicalSex)
|
|
2194
2366
|
) {
|
|
2195
|
-
|
|
2196
|
-
this.mapImp.setState(state.viewport)
|
|
2197
|
-
}
|
|
2367
|
+
this.restoreMapState(state)
|
|
2198
2368
|
} else {
|
|
2199
2369
|
this.createFlatmap(state)
|
|
2200
2370
|
}
|
|
@@ -2210,7 +2380,33 @@ export default {
|
|
|
2210
2380
|
restoreMapState: function (state) {
|
|
2211
2381
|
if (state) {
|
|
2212
2382
|
if (state.viewport) this.mapImp.setState(state.viewport)
|
|
2213
|
-
if (state.
|
|
2383
|
+
if (state.viewingMode) this.changeViewingMode(state.viewingMode)
|
|
2384
|
+
//The following three are boolean
|
|
2385
|
+
if ('flightPath3D' in state) this.setFlightPath3D(state.flightPath3D)
|
|
2386
|
+
if ('colour' in state) this.setColour(state.colour)
|
|
2387
|
+
if ('outlines' in state) this.setOutlines(state.outlines)
|
|
2388
|
+
if (state.background) this.backgroundChangeCallback(state.background)
|
|
2389
|
+
if (state.searchTerm) {
|
|
2390
|
+
const searchTerm = state.searchTerm
|
|
2391
|
+
this.searchAndShowResult(searchTerm, true)
|
|
2392
|
+
if (state.viewingMode === "Neuron Connection") {
|
|
2393
|
+
this.highlightConnectedPaths([searchTerm])
|
|
2394
|
+
} else {
|
|
2395
|
+
const geoID = this.mapImp.modelFeatureIds(searchTerm)
|
|
2396
|
+
if (geoID.length > 0) {
|
|
2397
|
+
const feature = this.mapImp.featureProperties(geoID[0])
|
|
2398
|
+
this.searchAndShowResult(searchTerm, true)
|
|
2399
|
+
const data = {
|
|
2400
|
+
resource: [feature.source],
|
|
2401
|
+
feature,
|
|
2402
|
+
label: feature.label,
|
|
2403
|
+
provenanceTaxonomy: feature.taxons
|
|
2404
|
+
}
|
|
2405
|
+
this.checkAndCreatePopups(data)
|
|
2406
|
+
}
|
|
2407
|
+
}
|
|
2408
|
+
}
|
|
2409
|
+
this.setVisibilityState(state)
|
|
2214
2410
|
}
|
|
2215
2411
|
},
|
|
2216
2412
|
/**
|
|
@@ -2303,16 +2499,13 @@ export default {
|
|
|
2303
2499
|
this.serverURL = this.mapImp.makeServerUrl('').slice(0, -1)
|
|
2304
2500
|
let mapVersion = this.mapImp.details.version
|
|
2305
2501
|
this.setFlightPathInfo(mapVersion)
|
|
2306
|
-
this.
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
this.restoreMapState(state)
|
|
2310
|
-
}
|
|
2502
|
+
const stateToSet = this._stateToBeSet ? this._stateToBeSet : state
|
|
2503
|
+
this.onFlatmapReady(stateToSet)
|
|
2504
|
+
this.$nextTick(() => this.restoreMapState(stateToSet))
|
|
2311
2505
|
})
|
|
2312
2506
|
} else if (state) {
|
|
2313
2507
|
this._stateToBeSet = {
|
|
2314
|
-
|
|
2315
|
-
searchTerm: state.searchTerm,
|
|
2508
|
+
...state
|
|
2316
2509
|
}
|
|
2317
2510
|
if (this.mapImp && !this.loading)
|
|
2318
2511
|
this.restoreMapState(this._stateToBeSet)
|
|
@@ -2354,31 +2547,28 @@ export default {
|
|
|
2354
2547
|
* @public
|
|
2355
2548
|
* This function is used for functions that need to run immediately after the flatmap is loaded.
|
|
2356
2549
|
*/
|
|
2357
|
-
onFlatmapReady: function () {
|
|
2550
|
+
onFlatmapReady: function (state) {
|
|
2358
2551
|
// onFlatmapReady is used for functions that need to run immediately after the flatmap is loaded
|
|
2359
2552
|
this.sensor = markRaw(new ResizeSensor(this.$refs.display, this.mapResize))
|
|
2360
2553
|
if (this.mapImp.options?.style === 'functional') {
|
|
2361
2554
|
this.isFC = true
|
|
2362
|
-
} else if (this.mapImp.options?.style === 'centreline') {
|
|
2363
|
-
this.isCentreLine = true
|
|
2364
2555
|
}
|
|
2365
2556
|
this.mapImp.setBackgroundOpacity(1)
|
|
2366
2557
|
this.backgroundChangeCallback(this.currentBackground)
|
|
2367
2558
|
this.pathways = this.mapImp.pathTypes()
|
|
2368
|
-
if (!this.isCentreLine) {
|
|
2369
|
-
this.mapImp.enableCentrelines(false)
|
|
2370
|
-
}
|
|
2371
2559
|
//Disable layers for now
|
|
2372
2560
|
//this.layers = this.mapImp.getLayers();
|
|
2373
2561
|
this.processSystems(this.mapImp.getSystems())
|
|
2374
|
-
|
|
2562
|
+
//Async, pass the state for checking
|
|
2563
|
+
this.processTaxon(this.mapImp.taxonIdentifiers, state ? state['taxonSelection'] : undefined)
|
|
2375
2564
|
this.containsAlert = "alert" in this.mapImp.featureFilterRanges()
|
|
2376
2565
|
this.addResizeButtonToMinimap()
|
|
2377
2566
|
this.loading = false
|
|
2378
2567
|
this.computePathControlsMaximumHeight()
|
|
2379
|
-
this.drawerOpen =
|
|
2568
|
+
this.drawerOpen = true;
|
|
2380
2569
|
this.mapResize()
|
|
2381
2570
|
this.handleMapClick();
|
|
2571
|
+
this.setInitMapState();
|
|
2382
2572
|
/**
|
|
2383
2573
|
* This is ``onFlatmapReady`` event.
|
|
2384
2574
|
* @arg ``this`` (Component Vue Instance)
|
|
@@ -2392,9 +2582,15 @@ export default {
|
|
|
2392
2582
|
*/
|
|
2393
2583
|
handleMapClick: function () {
|
|
2394
2584
|
const _map = this.mapImp._map;
|
|
2395
|
-
|
|
2396
2585
|
if (_map) {
|
|
2397
2586
|
_map.on('click', (e) => {
|
|
2587
|
+
//A little logic to make sure we are keeping track
|
|
2588
|
+
//of selected term
|
|
2589
|
+
if (this.statesTracking.activeClick) {
|
|
2590
|
+
this.statesTracking.activeClick = false
|
|
2591
|
+
} else {
|
|
2592
|
+
this.statesTracking.activeTerm = ""
|
|
2593
|
+
}
|
|
2398
2594
|
if (this.tooltipEntry.featureId) {
|
|
2399
2595
|
this.$emit('connectivity-info-close');
|
|
2400
2596
|
}
|
|
@@ -2430,6 +2626,7 @@ export default {
|
|
|
2430
2626
|
if (this.mapImp) {
|
|
2431
2627
|
if (term === undefined || term === '') {
|
|
2432
2628
|
this.mapImp.clearSearchResults()
|
|
2629
|
+
this.statesTracking.activeTerm = ""
|
|
2433
2630
|
return true
|
|
2434
2631
|
} else {
|
|
2435
2632
|
const searchResults = this.mapImp.search(term)
|
|
@@ -2438,6 +2635,7 @@ export default {
|
|
|
2438
2635
|
searchResults.results &&
|
|
2439
2636
|
searchResults.results.length > 0
|
|
2440
2637
|
) {
|
|
2638
|
+
this.statesTracking.activeTerm = term
|
|
2441
2639
|
this.mapImp.showSearchResults(searchResults)
|
|
2442
2640
|
if (
|
|
2443
2641
|
displayLabel &&
|
|
@@ -2501,7 +2699,7 @@ export default {
|
|
|
2501
2699
|
*/
|
|
2502
2700
|
minZoom: {
|
|
2503
2701
|
type: Number,
|
|
2504
|
-
default:
|
|
2702
|
+
default: 1,
|
|
2505
2703
|
},
|
|
2506
2704
|
/**
|
|
2507
2705
|
* The option to add another feature label _(`FeatureSmallSymbolLayer`)_
|
|
@@ -2687,19 +2885,13 @@ export default {
|
|
|
2687
2885
|
serverURL: undefined,
|
|
2688
2886
|
layers: [],
|
|
2689
2887
|
pathways: [],
|
|
2888
|
+
initMapState: {},
|
|
2690
2889
|
sckanDisplay: [
|
|
2691
2890
|
{
|
|
2692
2891
|
label: 'Display Path with SCKAN',
|
|
2693
2892
|
key: 'VALID',
|
|
2694
2893
|
},
|
|
2695
2894
|
],
|
|
2696
|
-
centreLines: [
|
|
2697
|
-
{
|
|
2698
|
-
label: 'Display Nerves',
|
|
2699
|
-
key: 'centrelines',
|
|
2700
|
-
enabled: false,
|
|
2701
|
-
},
|
|
2702
|
-
],
|
|
2703
2895
|
systems: [],
|
|
2704
2896
|
taxonConnectivity: [],
|
|
2705
2897
|
pathwaysMaxHeight: 1000,
|
|
@@ -2725,7 +2917,6 @@ export default {
|
|
|
2725
2917
|
helpModeActiveIndex: this.helpModeInitialIndex,
|
|
2726
2918
|
yellowstar: yellowstar,
|
|
2727
2919
|
isFC: false,
|
|
2728
|
-
isCentreLine: false,
|
|
2729
2920
|
inHelp: false,
|
|
2730
2921
|
currentBackground: 'white',
|
|
2731
2922
|
availableBackground: ['white', 'lightskyblue', 'black'],
|
|
@@ -2770,6 +2961,7 @@ export default {
|
|
|
2770
2961
|
activeDrawTool: undefined,
|
|
2771
2962
|
featureAnnotationSubmitted: false,
|
|
2772
2963
|
drawnCreatedEvent: {},
|
|
2964
|
+
previousDeletedEvent: {},
|
|
2773
2965
|
connectionEntry: {},
|
|
2774
2966
|
existDrawnFeatures: [], // Store all exist drawn features
|
|
2775
2967
|
doubleClickedFeature: false,
|
|
@@ -2791,7 +2983,11 @@ export default {
|
|
|
2791
2983
|
with: true,
|
|
2792
2984
|
without: true,
|
|
2793
2985
|
}
|
|
2794
|
-
})
|
|
2986
|
+
}),
|
|
2987
|
+
statesTracking: markRaw({
|
|
2988
|
+
activeClick: false,
|
|
2989
|
+
activeTerm: "",
|
|
2990
|
+
}),
|
|
2795
2991
|
}
|
|
2796
2992
|
},
|
|
2797
2993
|
computed: {
|
|
@@ -2839,9 +3035,7 @@ export default {
|
|
|
2839
3035
|
this.showAnnotator(true)
|
|
2840
3036
|
this.userInformation = userData
|
|
2841
3037
|
this.setFeatureAnnotated()
|
|
2842
|
-
|
|
2843
|
-
this.addAnnotationFeature()
|
|
2844
|
-
}
|
|
3038
|
+
this.addAnnotationFeature()
|
|
2845
3039
|
}
|
|
2846
3040
|
this.loading = false
|
|
2847
3041
|
})
|
|
@@ -2939,6 +3133,11 @@ export default {
|
|
|
2939
3133
|
left: 0px;
|
|
2940
3134
|
transform: translateX(0);
|
|
2941
3135
|
transition: all var(--el-transition-duration);
|
|
3136
|
+
z-index: 99;
|
|
3137
|
+
display: flex;
|
|
3138
|
+
flex-direction: row;
|
|
3139
|
+
align-items: center;
|
|
3140
|
+
|
|
2942
3141
|
&.open {
|
|
2943
3142
|
transform: translateX(0);
|
|
2944
3143
|
}
|
|
@@ -3484,7 +3683,6 @@ export default {
|
|
|
3484
3683
|
}
|
|
3485
3684
|
}
|
|
3486
3685
|
|
|
3487
|
-
.open-drawer,
|
|
3488
3686
|
.drawer-button {
|
|
3489
3687
|
z-index: 8;
|
|
3490
3688
|
width: 20px;
|
|
@@ -3494,18 +3692,6 @@ export default {
|
|
|
3494
3692
|
vertical-align: middle;
|
|
3495
3693
|
cursor: pointer;
|
|
3496
3694
|
pointer-events: auto;
|
|
3497
|
-
}
|
|
3498
|
-
|
|
3499
|
-
.open-drawer {
|
|
3500
|
-
position: absolute;
|
|
3501
|
-
left: 0px;
|
|
3502
|
-
background-color: #f7faff;
|
|
3503
|
-
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.06);
|
|
3504
|
-
}
|
|
3505
|
-
|
|
3506
|
-
.drawer-button {
|
|
3507
|
-
float: left;
|
|
3508
|
-
margin-top: calc(50% - 36px);
|
|
3509
3695
|
background-color: #f9f2fc;
|
|
3510
3696
|
|
|
3511
3697
|
i {
|