@abi-software/flatmapvuer 1.13.4-simulation.1 → 1.13.4-simulation.2
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 +2271 -2621
- package/dist/flatmapvuer.umd.cjs +13 -13
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/components/FlatmapVuer.vue +645 -1167
|
@@ -11,11 +11,7 @@
|
|
|
11
11
|
style="height: 100%; width: 100%; position: relative; overflow-y: none"
|
|
12
12
|
>
|
|
13
13
|
<!-- flatmap-display -->
|
|
14
|
-
<div
|
|
15
|
-
style="height: 100%; width: 100%"
|
|
16
|
-
ref="display"
|
|
17
|
-
class="flatmap-display"
|
|
18
|
-
></div>
|
|
14
|
+
<div style="height: 100%; width: 100%" ref="display" class="flatmap-display"></div>
|
|
19
15
|
<!-- flatmap-error -->
|
|
20
16
|
<FlatmapError v-if="flatmapError" :flatmapError="flatmapError" />
|
|
21
17
|
|
|
@@ -29,7 +25,7 @@
|
|
|
29
25
|
:visible="hoverVisibilities[7].value"
|
|
30
26
|
ref="warningPopover"
|
|
31
27
|
>
|
|
32
|
-
|
|
28
|
+
<!--
|
|
33
29
|
What magic meaning do the numbers 6, 7, etc have?
|
|
34
30
|
|
|
35
31
|
Please use `const` to assign meaningful names to them...
|
|
@@ -63,7 +59,10 @@ Please use `const` to assign meaningful names to them...
|
|
|
63
59
|
SCKAN </a
|
|
64
60
|
>.
|
|
65
61
|
</p>
|
|
66
|
-
<p v-else
|
|
62
|
+
<p v-else
|
|
63
|
+
@mouseover="showTooltip(7)"
|
|
64
|
+
@mouseout="hideTooltip(7)"
|
|
65
|
+
>
|
|
67
66
|
This map displays the connectivity of neuron populations.
|
|
68
67
|
Specifically, those from the primarily rat-based
|
|
69
68
|
<a
|
|
@@ -87,9 +86,7 @@ Please use `const` to assign meaningful names to them...
|
|
|
87
86
|
@mouseover="showTooltip(7)"
|
|
88
87
|
@mouseout="hideTooltip(7)"
|
|
89
88
|
>
|
|
90
|
-
<el-icon v-if="displayWarning || isLegacy"
|
|
91
|
-
><el-icon-warning-filled
|
|
92
|
-
/></el-icon>
|
|
89
|
+
<el-icon v-if="displayWarning || isLegacy"><el-icon-warning-filled /></el-icon>
|
|
93
90
|
<template v-if="isLegacy">
|
|
94
91
|
<span class="warning-text">Legacy Map</span>
|
|
95
92
|
<div class="latest-map-text" @click="viewLatestMap">
|
|
@@ -126,13 +123,13 @@ Please use `const` to assign meaningful names to them...
|
|
|
126
123
|
<template #default>
|
|
127
124
|
<b>Connectivity References</b>
|
|
128
125
|
<p>
|
|
129
|
-
Connectivity references have been improved and available
|
|
130
|
-
various formats.
|
|
126
|
+
Connectivity references have been improved and available
|
|
127
|
+
in various formats.
|
|
131
128
|
</p>
|
|
132
129
|
<b>Improved state storing</b>
|
|
133
130
|
<p>
|
|
134
|
-
Current selection and visibility filters are now stored
|
|
135
|
-
creating a permalink.
|
|
131
|
+
Current selection and visibility filters are now stored
|
|
132
|
+
when creating a permalink.
|
|
136
133
|
</p>
|
|
137
134
|
</template>
|
|
138
135
|
</el-popover>
|
|
@@ -150,11 +147,7 @@ Please use `const` to assign meaningful names to them...
|
|
|
150
147
|
</el-icon>
|
|
151
148
|
|
|
152
149
|
<DrawToolbar
|
|
153
|
-
v-if="
|
|
154
|
-
viewingMode === 'Annotation' &&
|
|
155
|
-
(authorisedUser || offlineAnnotationEnabled) &&
|
|
156
|
-
!disableUI
|
|
157
|
-
"
|
|
150
|
+
v-if="viewingMode === 'Annotation' && (authorisedUser || offlineAnnotationEnabled) && !disableUI"
|
|
158
151
|
:mapCanvas="{
|
|
159
152
|
containerHTML: this.$el,
|
|
160
153
|
class: '.maplibregl-canvas',
|
|
@@ -173,80 +166,7 @@ Please use `const` to assign meaningful names to them...
|
|
|
173
166
|
@hideTooltip="hideTooltip"
|
|
174
167
|
ref="toolbarPopover"
|
|
175
168
|
/>
|
|
176
|
-
|
|
177
|
-
<el-popover
|
|
178
|
-
content="Open simulation protocols"
|
|
179
|
-
v-if="simulationInfo.length > 0"
|
|
180
|
-
placement="right"
|
|
181
|
-
:teleported="false"
|
|
182
|
-
trigger="manual"
|
|
183
|
-
:offset="-18"
|
|
184
|
-
popper-class="flatmap-popper"
|
|
185
|
-
:visible="hoverVisibilities[16].value"
|
|
186
|
-
ref="simulationPopover"
|
|
187
|
-
>
|
|
188
|
-
<template #reference>
|
|
189
|
-
<div
|
|
190
|
-
class="popover-location simulation top"
|
|
191
|
-
:class="{
|
|
192
|
-
open: simulationDrawerOpen,
|
|
193
|
-
close: !simulationDrawerOpen,
|
|
194
|
-
}"
|
|
195
|
-
v-show="!disableUI"
|
|
196
|
-
>
|
|
197
|
-
<div
|
|
198
|
-
class="pathway-container"
|
|
199
|
-
:class="{
|
|
200
|
-
open: simulationDrawerOpen,
|
|
201
|
-
close: !simulationDrawerOpen,
|
|
202
|
-
}"
|
|
203
|
-
v-popover:simulationPopover
|
|
204
|
-
>
|
|
205
|
-
<h4 style="margin-top: 0; margin-bottom: 10px">
|
|
206
|
-
Available Protocols
|
|
207
|
-
</h4>
|
|
208
|
-
<el-select
|
|
209
|
-
popper-class="flatmap-dropdown"
|
|
210
|
-
v-model="selectedSimulation"
|
|
211
|
-
placeholder="Select a simulation"
|
|
212
|
-
size="default"
|
|
213
|
-
style="width: 100%; margin-bottom: 10px"
|
|
214
|
-
value-key="path"
|
|
215
|
-
>
|
|
216
|
-
<el-option
|
|
217
|
-
v-for="info in simulationInfo"
|
|
218
|
-
:key="info.path"
|
|
219
|
-
:label="getSimulationLabel(info)"
|
|
220
|
-
:value="info"
|
|
221
|
-
/>
|
|
222
|
-
</el-select>
|
|
223
|
-
<el-button
|
|
224
|
-
type="primary"
|
|
225
|
-
@click="openSimulation"
|
|
226
|
-
:disabled="!selectedSimulation"
|
|
227
|
-
style="width: 100%"
|
|
228
|
-
>
|
|
229
|
-
Open Simulation
|
|
230
|
-
</el-button>
|
|
231
|
-
</div>
|
|
232
|
-
<div
|
|
233
|
-
@click="simulationDrawerOpen = !simulationDrawerOpen"
|
|
234
|
-
class="drawer-button"
|
|
235
|
-
:class="{
|
|
236
|
-
open: simulationDrawerOpen,
|
|
237
|
-
close: !simulationDrawerOpen,
|
|
238
|
-
}"
|
|
239
|
-
title="Toggle Simulation Panel"
|
|
240
|
-
>
|
|
241
|
-
<!-- Arrow icons for open/close state -->
|
|
242
|
-
<el-icon>
|
|
243
|
-
<el-icon-arrow-left />
|
|
244
|
-
</el-icon>
|
|
245
|
-
</div>
|
|
246
|
-
</div>
|
|
247
|
-
</template>
|
|
248
|
-
</el-popover>
|
|
249
|
-
<!-- </div> -->
|
|
169
|
+
|
|
250
170
|
<div class="bottom-right-control" v-show="!disableUI">
|
|
251
171
|
<el-popover
|
|
252
172
|
content="Zoom in"
|
|
@@ -265,7 +185,10 @@ Please use `const` to assign meaningful names to them...
|
|
|
265
185
|
@mouseover="showTooltip(1)"
|
|
266
186
|
@mouseout="hideTooltip(1)"
|
|
267
187
|
>
|
|
268
|
-
<map-svg-icon
|
|
188
|
+
<map-svg-icon
|
|
189
|
+
class="icon-button zoomIn"
|
|
190
|
+
icon="zoomIn"
|
|
191
|
+
/>
|
|
269
192
|
</div>
|
|
270
193
|
</template>
|
|
271
194
|
</el-popover>
|
|
@@ -273,14 +196,23 @@ Please use `const` to assign meaningful names to them...
|
|
|
273
196
|
content="Zoom out"
|
|
274
197
|
placement="top-end"
|
|
275
198
|
:teleported="false"
|
|
276
|
-
|
|
199
|
+
trigger="manual"
|
|
277
200
|
width="70"
|
|
278
201
|
popper-class="flatmap-popper"
|
|
202
|
+
:visible="hoverVisibilities[2].value"
|
|
279
203
|
ref="zoomOutPopover"
|
|
280
204
|
>
|
|
281
205
|
<template #reference>
|
|
282
|
-
<div
|
|
283
|
-
|
|
206
|
+
<div
|
|
207
|
+
class="icon-button-container"
|
|
208
|
+
@click="zoomOut()"
|
|
209
|
+
@mouseover="showTooltip(2)"
|
|
210
|
+
@mouseout="hideTooltip(2)"
|
|
211
|
+
>
|
|
212
|
+
<map-svg-icon
|
|
213
|
+
class="icon-button zoomOut"
|
|
214
|
+
icon="zoomOut"
|
|
215
|
+
/>
|
|
284
216
|
</div>
|
|
285
217
|
</template>
|
|
286
218
|
</el-popover>
|
|
@@ -306,14 +238,16 @@ Please use `const` to assign meaningful names to them...
|
|
|
306
238
|
@mouseover="showTooltip(3)"
|
|
307
239
|
@mouseout="hideTooltip(3)"
|
|
308
240
|
>
|
|
309
|
-
<map-svg-icon
|
|
241
|
+
<map-svg-icon
|
|
242
|
+
class="icon-button fitWindow"
|
|
243
|
+
icon="fitWindow"
|
|
244
|
+
/>
|
|
310
245
|
</div>
|
|
311
246
|
</template>
|
|
312
247
|
</el-popover>
|
|
313
248
|
</div>
|
|
314
249
|
<el-popover
|
|
315
250
|
content="Change pathway visibility"
|
|
316
|
-
class="somerandomclass"
|
|
317
251
|
placement="right"
|
|
318
252
|
:teleported="false"
|
|
319
253
|
trigger="manual"
|
|
@@ -324,7 +258,7 @@ Please use `const` to assign meaningful names to them...
|
|
|
324
258
|
>
|
|
325
259
|
<template #reference>
|
|
326
260
|
<div
|
|
327
|
-
class="
|
|
261
|
+
class="pathway-location"
|
|
328
262
|
:class="{ open: drawerOpen, close: !drawerOpen }"
|
|
329
263
|
v-show="!disableUI && requiresDrawer"
|
|
330
264
|
>
|
|
@@ -334,7 +268,7 @@ Please use `const` to assign meaningful names to them...
|
|
|
334
268
|
:style="{ 'max-height': pathwaysMaxHeight + 'px' }"
|
|
335
269
|
v-popover:checkBoxPopover
|
|
336
270
|
>
|
|
337
|
-
<
|
|
271
|
+
<dynamic-legends
|
|
338
272
|
v-if="legendEntry.length"
|
|
339
273
|
identifierKey="prompt"
|
|
340
274
|
colourKey="colour"
|
|
@@ -432,11 +366,7 @@ Please use `const` to assign meaningful names to them...
|
|
|
432
366
|
key="pathwaysSelection"
|
|
433
367
|
/>
|
|
434
368
|
<selections-group
|
|
435
|
-
v-if="
|
|
436
|
-
taxonConnectivity &&
|
|
437
|
-
taxonConnectivity.length > 0 &&
|
|
438
|
-
showPathwayFilter
|
|
439
|
-
"
|
|
369
|
+
v-if="taxonConnectivity && taxonConnectivity.length > 0 && showPathwayFilter"
|
|
440
370
|
title="Studied in"
|
|
441
371
|
labelKey="label"
|
|
442
372
|
identifierKey="taxon"
|
|
@@ -478,7 +408,9 @@ Please use `const` to assign meaningful names to them...
|
|
|
478
408
|
@event open-map
|
|
479
409
|
@arg {String} `mapOption.key`
|
|
480
410
|
-->
|
|
481
|
-
<el-button type="primary" plain
|
|
411
|
+
<el-button type="primary" plain
|
|
412
|
+
@click="$emit('open-map', item.key)"
|
|
413
|
+
>
|
|
482
414
|
{{ item.display }}
|
|
483
415
|
</el-button>
|
|
484
416
|
</el-row>
|
|
@@ -496,29 +428,23 @@ Please use `const` to assign meaningful names to them...
|
|
|
496
428
|
<div>
|
|
497
429
|
<el-row class="backgroundText">Viewing Mode</el-row>
|
|
498
430
|
<el-row class="backgroundControl">
|
|
499
|
-
<div style="margin-bottom: 2px">
|
|
500
|
-
<template
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
>
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
<
|
|
508
|
-
class="viewing-mode-unselected"
|
|
509
|
-
|
|
510
|
-
>{{ key }}</span
|
|
511
|
-
>
|
|
512
|
-
</template>
|
|
431
|
+
<div style="margin-bottom: 2px;">
|
|
432
|
+
<template
|
|
433
|
+
v-for="(value, key, index) in viewingModes"
|
|
434
|
+
:key="key"
|
|
435
|
+
>
|
|
436
|
+
<template v-if="key === viewingMode">
|
|
437
|
+
<span class="viewing-mode-title"><b >{{ key }}</b></span>
|
|
438
|
+
</template>
|
|
439
|
+
<template v-else>
|
|
440
|
+
<span class="viewing-mode-unselected" @click="changeViewingMode(key)">{{ key }}</span>
|
|
441
|
+
</template>
|
|
513
442
|
</template>
|
|
514
443
|
</div>
|
|
515
444
|
<el-row class="viewing-mode-description">
|
|
516
445
|
{{ modeDescription }}
|
|
517
446
|
</el-row>
|
|
518
|
-
<el-row
|
|
519
|
-
v-if="viewingMode === 'Annotation' && offlineAnnotationEnabled"
|
|
520
|
-
class="viewing-mode-description"
|
|
521
|
-
>
|
|
447
|
+
<el-row v-if="viewingMode === 'Annotation' && offlineAnnotationEnabled" class="viewing-mode-description">
|
|
522
448
|
(Anonymous annotate)
|
|
523
449
|
</el-row>
|
|
524
450
|
</el-row>
|
|
@@ -546,21 +472,16 @@ Please use `const` to assign meaningful names to them...
|
|
|
546
472
|
</el-select>
|
|
547
473
|
</el-row>
|
|
548
474
|
</template>
|
|
549
|
-
<el-row
|
|
550
|
-
|
|
551
|
-
v-if="displayFlightPathOption"
|
|
552
|
-
></el-row>
|
|
553
|
-
<el-row class="backgroundText" v-if="displayFlightPathOption"
|
|
554
|
-
>Flight path display</el-row
|
|
555
|
-
>
|
|
475
|
+
<el-row class="backgroundSpacer" v-if="displayFlightPathOption"></el-row>
|
|
476
|
+
<el-row class="backgroundText" v-if="displayFlightPathOption">Flight path display</el-row>
|
|
556
477
|
<el-row class="backgroundControl" v-if="displayFlightPathOption">
|
|
557
478
|
<el-radio-group
|
|
558
479
|
v-model="flightPath3DRadio"
|
|
559
480
|
class="flatmap-radio"
|
|
560
481
|
@change="setFlightPath3D"
|
|
561
482
|
>
|
|
562
|
-
|
|
563
|
-
|
|
483
|
+
<el-radio :value="false">2D</el-radio>
|
|
484
|
+
<el-radio :value="true">3D</el-radio>
|
|
564
485
|
</el-radio-group>
|
|
565
486
|
</el-row>
|
|
566
487
|
<el-row class="backgroundSpacer"></el-row>
|
|
@@ -650,7 +571,10 @@ Please use `const` to assign meaningful names to them...
|
|
|
650
571
|
@mouseover="showTooltip(5)"
|
|
651
572
|
@mouseout="hideTooltip(5)"
|
|
652
573
|
>
|
|
653
|
-
<map-svg-icon
|
|
574
|
+
<map-svg-icon
|
|
575
|
+
icon="changeBckgd"
|
|
576
|
+
class="icon-button"
|
|
577
|
+
/>
|
|
654
578
|
</div>
|
|
655
579
|
</template>
|
|
656
580
|
</el-popover>
|
|
@@ -706,33 +630,30 @@ import {
|
|
|
706
630
|
getKnowledgeSource,
|
|
707
631
|
getReferenceConnectivitiesByAPI,
|
|
708
632
|
} from '../services/flatmapKnowledge.js'
|
|
709
|
-
import {
|
|
710
|
-
retrieveOmexData,
|
|
711
|
-
} from '../services/apsTestData.js'
|
|
712
633
|
import { capitalise, normaliseAlertToStringArray } from './utilities.js'
|
|
713
634
|
import yellowstar from '../icons/yellowstar'
|
|
714
635
|
import ResizeSensor from 'css-element-queries/src/ResizeSensor'
|
|
715
636
|
import flatmap from '../services/flatmapLoader.js'
|
|
716
637
|
import { AnnotationService } from '@abi-software/sparc-annotation'
|
|
717
638
|
import { mapState } from 'pinia'
|
|
718
|
-
import { useMainStore } from '
|
|
639
|
+
import { useMainStore } from '@/store/index'
|
|
719
640
|
import {
|
|
720
641
|
fetchLabels,
|
|
721
642
|
DrawToolbar,
|
|
722
643
|
Tooltip,
|
|
723
644
|
TreeControls,
|
|
724
|
-
getFlatmapFilterOptions
|
|
645
|
+
getFlatmapFilterOptions
|
|
725
646
|
} from '@abi-software/map-utilities'
|
|
726
647
|
import '@abi-software/map-utilities/dist/style.css'
|
|
727
648
|
import EventBus from './EventBus.js'
|
|
728
649
|
import FlatmapError from './FlatmapError.vue'
|
|
729
650
|
|
|
730
|
-
const ERROR_MESSAGE = 'cannot be found on the map.'
|
|
651
|
+
const ERROR_MESSAGE = 'cannot be found on the map.';
|
|
731
652
|
|
|
732
653
|
const centroid = (geometry) => {
|
|
733
|
-
let featureGeometry = { lng: 0, lat: 0 }
|
|
654
|
+
let featureGeometry = { lng: 0, lat: 0, }
|
|
734
655
|
let coordinates
|
|
735
|
-
if (geometry.type ===
|
|
656
|
+
if (geometry.type === "Polygon") {
|
|
736
657
|
if (geometry.coordinates.length) {
|
|
737
658
|
coordinates = geometry.coordinates[0]
|
|
738
659
|
}
|
|
@@ -806,7 +727,6 @@ export default {
|
|
|
806
727
|
ElIconArrowDown,
|
|
807
728
|
ElIconArrowLeft,
|
|
808
729
|
DrawToolbar,
|
|
809
|
-
DynamicLegends,
|
|
810
730
|
FlatmapError,
|
|
811
731
|
},
|
|
812
732
|
beforeCreate: function () {
|
|
@@ -818,7 +738,7 @@ export default {
|
|
|
818
738
|
setup(props) {
|
|
819
739
|
let annotator = inject('$annotator')
|
|
820
740
|
if (!annotator) {
|
|
821
|
-
annotator = markRaw(new AnnotationService(`${props.flatmapAPI}annotator`))
|
|
741
|
+
annotator = markRaw(new AnnotationService(`${props.flatmapAPI}annotator`));
|
|
822
742
|
provide('$annotator', annotator)
|
|
823
743
|
}
|
|
824
744
|
return { annotator }
|
|
@@ -843,17 +763,17 @@ export default {
|
|
|
843
763
|
if (this.mapImp) {
|
|
844
764
|
if (this.mapImp.contextLost) {
|
|
845
765
|
if (filter) {
|
|
846
|
-
this.filterToRestore = markRaw(JSON.parse(JSON.stringify(filter)))
|
|
766
|
+
this.filterToRestore = markRaw(JSON.parse(JSON.stringify(filter)));
|
|
847
767
|
} else {
|
|
848
|
-
this.filterToRestore = undefined
|
|
768
|
+
this.filterToRestore = undefined;
|
|
849
769
|
}
|
|
850
770
|
} else {
|
|
851
771
|
if (filter) {
|
|
852
|
-
this.mapImp.setVisibilityFilter(filter)
|
|
772
|
+
this.mapImp.setVisibilityFilter(filter);
|
|
853
773
|
} else {
|
|
854
|
-
this.mapImp.clearVisibilityFilter()
|
|
774
|
+
this.mapImp.clearVisibilityFilter();
|
|
855
775
|
}
|
|
856
|
-
this.filterToRestore = undefined
|
|
776
|
+
this.filterToRestore = undefined;
|
|
857
777
|
}
|
|
858
778
|
}
|
|
859
779
|
},
|
|
@@ -862,7 +782,7 @@ export default {
|
|
|
862
782
|
* Function to manually send aborted signal when annotation tooltip popup or sidebar tab closed.
|
|
863
783
|
*/
|
|
864
784
|
manualAbortedOnClose: function () {
|
|
865
|
-
if (this.annotationSidebar) this.$emit(
|
|
785
|
+
if (this.annotationSidebar) this.$emit("annotation-close")
|
|
866
786
|
this.closeTooltip()
|
|
867
787
|
this.annotationEventCallback({}, { type: 'aborted' })
|
|
868
788
|
this.initialiseDrawing()
|
|
@@ -883,14 +803,12 @@ export default {
|
|
|
883
803
|
*/
|
|
884
804
|
cancelDrawnFeature: function () {
|
|
885
805
|
if (this.isValidDrawnCreated) {
|
|
886
|
-
if (this.annotationSidebar) this.$emit(
|
|
806
|
+
if (this.annotationSidebar) this.$emit("annotation-close")
|
|
887
807
|
this.closeTooltip()
|
|
888
|
-
this.annotationEntry = [
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
},
|
|
893
|
-
]
|
|
808
|
+
this.annotationEntry = [{
|
|
809
|
+
...this.drawnCreatedEvent.feature,
|
|
810
|
+
resourceId: this.serverURL,
|
|
811
|
+
}]
|
|
894
812
|
this.rollbackAnnotationEvent()
|
|
895
813
|
this.initialiseDrawing()
|
|
896
814
|
}
|
|
@@ -906,11 +824,7 @@ export default {
|
|
|
906
824
|
const numericId = Number(value)
|
|
907
825
|
const featureObject = numericId
|
|
908
826
|
? this.mapImp.featureProperties(numericId)
|
|
909
|
-
: {
|
|
910
|
-
feature: this.existDrawnFeatures.find(
|
|
911
|
-
(feature) => feature.id === value.trim()
|
|
912
|
-
),
|
|
913
|
-
}
|
|
827
|
+
: { feature: this.existDrawnFeatures.find(feature => feature.id === value.trim()) };
|
|
914
828
|
let payload = { feature: featureObject }
|
|
915
829
|
this.checkAndCreatePopups([payload], false)
|
|
916
830
|
} else {
|
|
@@ -941,7 +855,7 @@ export default {
|
|
|
941
855
|
* @arg {String} `name`
|
|
942
856
|
*/
|
|
943
857
|
toolbarEvent: function (type, name) {
|
|
944
|
-
if (this.isValidDrawnCreated) return
|
|
858
|
+
if (this.isValidDrawnCreated) return;
|
|
945
859
|
this.manualAbortedOnClose()
|
|
946
860
|
this.doubleClickedFeature = false
|
|
947
861
|
// Deselect any feature when draw mode/tool is changed
|
|
@@ -952,10 +866,7 @@ export default {
|
|
|
952
866
|
// Remove any unsubmitted drawn
|
|
953
867
|
this.cancelDrawnFeature()
|
|
954
868
|
if (name) {
|
|
955
|
-
const tool = name.replace(
|
|
956
|
-
/[A-Z]/g,
|
|
957
|
-
(letter) => `_${letter.toLowerCase()}`
|
|
958
|
-
)
|
|
869
|
+
const tool = name.replace(/[A-Z]/g, letter => `_${letter.toLowerCase()}`)
|
|
959
870
|
this.changeAnnotationDrawMode({ mode: `draw${tool}` })
|
|
960
871
|
}
|
|
961
872
|
this.activeDrawTool = name
|
|
@@ -973,7 +884,7 @@ export default {
|
|
|
973
884
|
if (data.feature.feature.geometry.type !== 'Point') {
|
|
974
885
|
this.changeAnnotationDrawMode({
|
|
975
886
|
mode: 'direct_select',
|
|
976
|
-
options: { featureId: data.feature.feature.id }
|
|
887
|
+
options: { featureId: data.feature.feature.id }
|
|
977
888
|
})
|
|
978
889
|
this.modifyAnnotationFeature()
|
|
979
890
|
}
|
|
@@ -982,7 +893,7 @@ export default {
|
|
|
982
893
|
} else if (this.activeDrawMode === 'Delete') {
|
|
983
894
|
this.changeAnnotationDrawMode({
|
|
984
895
|
mode: 'simple_select',
|
|
985
|
-
options: { featureIds: [data.feature.feature.id] }
|
|
896
|
+
options: { featureIds: [data.feature.feature.id] }
|
|
986
897
|
})
|
|
987
898
|
this.modifyAnnotationFeature()
|
|
988
899
|
}
|
|
@@ -997,9 +908,7 @@ export default {
|
|
|
997
908
|
type: 'connectivity',
|
|
998
909
|
source: features[0],
|
|
999
910
|
target: features[features.length - 1],
|
|
1000
|
-
intermediates: features.filter(
|
|
1001
|
-
(f, index) => index !== 0 && index !== features.length - 1
|
|
1002
|
-
),
|
|
911
|
+
intermediates: features.filter((f, index) => index !== 0 && index !== features.length - 1),
|
|
1003
912
|
}
|
|
1004
913
|
this.annotationEntry[0].body = body
|
|
1005
914
|
}
|
|
@@ -1023,12 +932,12 @@ export default {
|
|
|
1023
932
|
this.mapImp.clearAnnotationFeature()
|
|
1024
933
|
}
|
|
1025
934
|
},
|
|
1026
|
-
forceContextLoss: function
|
|
935
|
+
forceContextLoss: function() {
|
|
1027
936
|
if (this.mapImp && !this.mapImp.contextLost && !this.loading) {
|
|
1028
937
|
this.mapImp.forceContextLoss()
|
|
1029
938
|
}
|
|
1030
939
|
},
|
|
1031
|
-
forceContextRestore: function
|
|
940
|
+
forceContextRestore: function() {
|
|
1032
941
|
if (this.mapImp) {
|
|
1033
942
|
this.flatmapError = null
|
|
1034
943
|
this.mapImp.forceContextRestore()
|
|
@@ -1070,35 +979,22 @@ export default {
|
|
|
1070
979
|
commitAnnotationEvent: function (annotation) {
|
|
1071
980
|
if (this.mapImp) {
|
|
1072
981
|
if (this.offlineAnnotationEnabled) {
|
|
1073
|
-
this.offlineAnnotations =
|
|
1074
|
-
JSON.parse(sessionStorage.getItem('anonymous-annotation')) || []
|
|
982
|
+
this.offlineAnnotations = JSON.parse(sessionStorage.getItem('anonymous-annotation')) || []
|
|
1075
983
|
this.offlineAnnotations.push(annotation)
|
|
1076
984
|
if (this.annotationEntry[0].type === 'deleted') {
|
|
1077
|
-
this.offlineAnnotations = this.offlineAnnotations.filter(
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
offline.resource !== this.serverURL ||
|
|
1081
|
-
offline.item.id !== annotation.item.id
|
|
1082
|
-
)
|
|
1083
|
-
}
|
|
1084
|
-
)
|
|
985
|
+
this.offlineAnnotations = this.offlineAnnotations.filter((offline) => {
|
|
986
|
+
return offline.resource !== this.serverURL || offline.item.id !== annotation.item.id
|
|
987
|
+
})
|
|
1085
988
|
}
|
|
1086
|
-
sessionStorage.setItem(
|
|
1087
|
-
'anonymous-annotation',
|
|
1088
|
-
JSON.stringify(this.offlineAnnotations)
|
|
1089
|
-
)
|
|
989
|
+
sessionStorage.setItem('anonymous-annotation', JSON.stringify(this.offlineAnnotations))
|
|
1090
990
|
}
|
|
1091
|
-
if (
|
|
1092
|
-
['created', 'updated', 'deleted'].includes(
|
|
1093
|
-
this.annotationEntry[0].type
|
|
1094
|
-
)
|
|
1095
|
-
) {
|
|
991
|
+
if (['created', 'updated', 'deleted'].includes(this.annotationEntry[0].type)) {
|
|
1096
992
|
this.featureAnnotationSubmitted = true
|
|
1097
993
|
this.mapImp.commitAnnotationEvent(this.annotationEntry[0])
|
|
1098
|
-
if (annotation.body.comment ===
|
|
994
|
+
if (annotation.body.comment === "Position Updated") {
|
|
1099
995
|
this.annotationEntry[0].positionUpdated = false
|
|
1100
996
|
} else if (this.annotationEntry[0].type === 'deleted') {
|
|
1101
|
-
if (this.annotationSidebar) this.$emit(
|
|
997
|
+
if (this.annotationSidebar) this.$emit("annotation-close")
|
|
1102
998
|
this.closeTooltip()
|
|
1103
999
|
// Only delete need, keep the annotation tooltip/sidebar open if created/updated
|
|
1104
1000
|
this.annotationEntry = []
|
|
@@ -1113,29 +1009,17 @@ export default {
|
|
|
1113
1009
|
* @arg {String} `userId`,
|
|
1114
1010
|
* @arg {String} `participated`
|
|
1115
1011
|
*/
|
|
1116
|
-
fetchAnnotatedItemIds: async function (
|
|
1117
|
-
userId = undefined,
|
|
1118
|
-
participated = undefined
|
|
1119
|
-
) {
|
|
1012
|
+
fetchAnnotatedItemIds: async function (userId = undefined, participated = undefined) {
|
|
1120
1013
|
let annotatedItemIds
|
|
1121
1014
|
if (this.offlineAnnotationEnabled) {
|
|
1122
|
-
this.offlineAnnotations =
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
return offline.resource === this.serverURL
|
|
1127
|
-
})
|
|
1128
|
-
.map((offline) => offline.item.id)
|
|
1015
|
+
this.offlineAnnotations = JSON.parse(sessionStorage.getItem('anonymous-annotation')) || []
|
|
1016
|
+
annotatedItemIds = this.offlineAnnotations.filter((offline) => {
|
|
1017
|
+
return offline.resource === this.serverURL
|
|
1018
|
+
}).map(offline => offline.item.id)
|
|
1129
1019
|
} else {
|
|
1130
|
-
annotatedItemIds = await this.annotator.annotatedItemIds(
|
|
1131
|
-
this.userToken,
|
|
1132
|
-
this.serverURL,
|
|
1133
|
-
userId,
|
|
1134
|
-
participated
|
|
1135
|
-
)
|
|
1020
|
+
annotatedItemIds = await this.annotator.annotatedItemIds(this.userToken, this.serverURL, userId, participated)
|
|
1136
1021
|
// The annotator has `resource` and `items` fields
|
|
1137
|
-
if ('resource' in annotatedItemIds)
|
|
1138
|
-
annotatedItemIds = annotatedItemIds.itemIds
|
|
1022
|
+
if ('resource' in annotatedItemIds) annotatedItemIds = annotatedItemIds.itemIds
|
|
1139
1023
|
}
|
|
1140
1024
|
return annotatedItemIds
|
|
1141
1025
|
},
|
|
@@ -1160,23 +1044,13 @@ export default {
|
|
|
1160
1044
|
fetchDrawnFeatures: async function (userId, participated) {
|
|
1161
1045
|
let drawnFeatures
|
|
1162
1046
|
if (this.offlineAnnotationEnabled) {
|
|
1163
|
-
this.offlineAnnotations =
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
return offline.feature && offline.resource === this.serverURL
|
|
1168
|
-
})
|
|
1169
|
-
.map((offline) => offline.feature)
|
|
1047
|
+
this.offlineAnnotations = JSON.parse(sessionStorage.getItem('anonymous-annotation')) || []
|
|
1048
|
+
drawnFeatures = this.offlineAnnotations.filter((offline) => {
|
|
1049
|
+
return offline.feature && offline.resource === this.serverURL
|
|
1050
|
+
}).map(offline => offline.feature)
|
|
1170
1051
|
} else {
|
|
1171
|
-
const annotatedItemIds = await this.fetchAnnotatedItemIds(
|
|
1172
|
-
|
|
1173
|
-
participated
|
|
1174
|
-
)
|
|
1175
|
-
drawnFeatures = await this.annotator.drawnFeatures(
|
|
1176
|
-
this.userToken,
|
|
1177
|
-
this.serverURL,
|
|
1178
|
-
annotatedItemIds
|
|
1179
|
-
)
|
|
1052
|
+
const annotatedItemIds = await this.fetchAnnotatedItemIds(userId, participated)
|
|
1053
|
+
drawnFeatures = await this.annotator.drawnFeatures(this.userToken, this.serverURL, annotatedItemIds)
|
|
1180
1054
|
// The annotator has `resource` and `features` fields
|
|
1181
1055
|
if ('resource' in drawnFeatures) drawnFeatures = drawnFeatures.features
|
|
1182
1056
|
}
|
|
@@ -1192,22 +1066,13 @@ export default {
|
|
|
1192
1066
|
this.clearAnnotationFeature()
|
|
1193
1067
|
this.loading = true
|
|
1194
1068
|
}
|
|
1195
|
-
const userId =
|
|
1196
|
-
this.
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
:
|
|
1201
|
-
const
|
|
1202
|
-
this.annotationFrom === 'Anyone'
|
|
1203
|
-
? undefined
|
|
1204
|
-
: this.annotationFrom === 'Me'
|
|
1205
|
-
? true
|
|
1206
|
-
: false
|
|
1207
|
-
const drawnFeatures = await this.fetchDrawnFeatures(
|
|
1208
|
-
userId,
|
|
1209
|
-
participated
|
|
1210
|
-
)
|
|
1069
|
+
const userId = this.annotationFrom === 'Anyone' ?
|
|
1070
|
+
undefined : this.authorisedUser.orcid ?
|
|
1071
|
+
this.authorisedUser.orcid : '0000-0000-0000-0000'
|
|
1072
|
+
const participated = this.annotationFrom === 'Anyone' ?
|
|
1073
|
+
undefined : this.annotationFrom === 'Me' ?
|
|
1074
|
+
true : false
|
|
1075
|
+
const drawnFeatures = await this.fetchDrawnFeatures(userId, participated)
|
|
1211
1076
|
this.existDrawnFeatures = drawnFeatures
|
|
1212
1077
|
this.loading = false
|
|
1213
1078
|
if (!this.featureAnnotationSubmitted) {
|
|
@@ -1246,10 +1111,7 @@ export default {
|
|
|
1246
1111
|
* Function to emit offline annotation enabled status
|
|
1247
1112
|
*/
|
|
1248
1113
|
emitOfflineAnnotationUpdate: function () {
|
|
1249
|
-
this.$emit(
|
|
1250
|
-
'update-offline-annotation-enabled',
|
|
1251
|
-
this.offlineAnnotationEnabled
|
|
1252
|
-
)
|
|
1114
|
+
this.$emit('update-offline-annotation-enabled', this.offlineAnnotationEnabled);
|
|
1253
1115
|
},
|
|
1254
1116
|
/**
|
|
1255
1117
|
* @public
|
|
@@ -1331,20 +1193,15 @@ export default {
|
|
|
1331
1193
|
entityLabels.forEach((entityLabel) => {
|
|
1332
1194
|
let enabled = true
|
|
1333
1195
|
if (state) {
|
|
1334
|
-
enabled = state.checkAll
|
|
1335
|
-
? true
|
|
1336
|
-
: state.checked.includes(entityLabel.taxon)
|
|
1196
|
+
enabled = state.checkAll ? true : state.checked.includes(entityLabel.taxon)
|
|
1337
1197
|
}
|
|
1338
|
-
this.taxonConnectivity.push({
|
|
1198
|
+
this.taxonConnectivity.push({...entityLabel, enabled});
|
|
1339
1199
|
if (this.mapImp) {
|
|
1340
|
-
this.mapImp.enableConnectivityByTaxonIds(
|
|
1341
|
-
entityLabel.taxon,
|
|
1342
|
-
enabled
|
|
1343
|
-
)
|
|
1200
|
+
this.mapImp.enableConnectivityByTaxonIds(entityLabel.taxon, enabled)
|
|
1344
1201
|
}
|
|
1345
|
-
})
|
|
1202
|
+
});
|
|
1346
1203
|
}
|
|
1347
|
-
})
|
|
1204
|
+
});
|
|
1348
1205
|
},
|
|
1349
1206
|
/**
|
|
1350
1207
|
* @public
|
|
@@ -1379,19 +1236,19 @@ export default {
|
|
|
1379
1236
|
},
|
|
1380
1237
|
setInitMapState: function () {
|
|
1381
1238
|
if (this.mapImp) {
|
|
1382
|
-
const map = this.mapImp.map
|
|
1383
|
-
const bounds = this.mapImp.options.bounds
|
|
1239
|
+
const map = this.mapImp.map;
|
|
1240
|
+
const bounds = this.mapImp.options.bounds;
|
|
1384
1241
|
const initBounds = [
|
|
1385
1242
|
[bounds[0], bounds[1]],
|
|
1386
|
-
[bounds[2], bounds[3]]
|
|
1387
|
-
]
|
|
1243
|
+
[bounds[2], bounds[3]]
|
|
1244
|
+
];
|
|
1388
1245
|
|
|
1389
|
-
map.setMaxBounds(null) // override default
|
|
1390
|
-
map.setRenderWorldCopies(false)
|
|
1246
|
+
map.setMaxBounds(null); // override default
|
|
1247
|
+
map.setRenderWorldCopies(false);
|
|
1391
1248
|
|
|
1392
1249
|
this.initMapState = markRaw({
|
|
1393
1250
|
initBounds,
|
|
1394
|
-
})
|
|
1251
|
+
});
|
|
1395
1252
|
}
|
|
1396
1253
|
},
|
|
1397
1254
|
/**
|
|
@@ -1402,17 +1259,17 @@ export default {
|
|
|
1402
1259
|
resetView: function () {
|
|
1403
1260
|
if (this.mapImp) {
|
|
1404
1261
|
// fit to window
|
|
1405
|
-
const map = this.mapImp.map
|
|
1406
|
-
const { initBounds } = this.initMapState
|
|
1262
|
+
const map = this.mapImp.map;
|
|
1263
|
+
const { initBounds } = this.initMapState;
|
|
1407
1264
|
// reset rotation
|
|
1408
1265
|
map.resetNorthPitch({
|
|
1409
1266
|
animate: false,
|
|
1410
|
-
})
|
|
1267
|
+
});
|
|
1411
1268
|
if (initBounds) {
|
|
1412
1269
|
// reset zoom and position
|
|
1413
1270
|
map.fitBounds(initBounds, {
|
|
1414
|
-
animate: false
|
|
1415
|
-
})
|
|
1271
|
+
animate: false
|
|
1272
|
+
});
|
|
1416
1273
|
}
|
|
1417
1274
|
if (this.$refs.skcanSelection) {
|
|
1418
1275
|
this.$refs.skcanSelection.reset()
|
|
@@ -1449,7 +1306,7 @@ export default {
|
|
|
1449
1306
|
}
|
|
1450
1307
|
},
|
|
1451
1308
|
onSelectionsDataChanged: function (data) {
|
|
1452
|
-
this.$emit('pathway-selection-changed', data)
|
|
1309
|
+
this.$emit('pathway-selection-changed', data);
|
|
1453
1310
|
},
|
|
1454
1311
|
/**
|
|
1455
1312
|
* // Currently not in use
|
|
@@ -1492,94 +1349,76 @@ export default {
|
|
|
1492
1349
|
retrieveConnectedPaths: async function (payload, options = {}) {
|
|
1493
1350
|
// query all connected paths from flatmap
|
|
1494
1351
|
if (this.mapImp) {
|
|
1495
|
-
let connectedPaths = []
|
|
1496
|
-
let connectedTarget = options.target?.length ? options.target : []
|
|
1352
|
+
let connectedPaths = [];
|
|
1353
|
+
let connectedTarget = options.target?.length ? options.target : [];
|
|
1497
1354
|
// The line below is to get the path features from the geojson ids
|
|
1498
|
-
const nodeFeatureIds = [...this.mapImp.pathModelNodes(payload)]
|
|
1499
|
-
const pathsOfEntities = await this.mapImp.queryPathsForFeatures(payload)
|
|
1355
|
+
const nodeFeatureIds = [...this.mapImp.pathModelNodes(payload)];
|
|
1356
|
+
const pathsOfEntities = await this.mapImp.queryPathsForFeatures(payload);
|
|
1500
1357
|
if (nodeFeatureIds.length) {
|
|
1501
1358
|
if (!connectedTarget.length) {
|
|
1502
|
-
const connectedType = options.type?.length ? options.type : [
|
|
1503
|
-
const connectivity =
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
connected.push(...originsFlat)
|
|
1514
|
-
if (connectedType.includes('components'))
|
|
1515
|
-
connected.push(...componentsFlat)
|
|
1516
|
-
if (connectedType.includes('destinations'))
|
|
1517
|
-
connected.push(...destinationsFlat)
|
|
1518
|
-
if (connectedType.includes('all'))
|
|
1519
|
-
connected.push(
|
|
1520
|
-
...originsFlat,
|
|
1521
|
-
...componentsFlat,
|
|
1522
|
-
...destinationsFlat
|
|
1523
|
-
)
|
|
1524
|
-
connectedTarget = [...new Set(connected)]
|
|
1359
|
+
const connectedType = options.type?.length ? options.type : ["all"];
|
|
1360
|
+
const connectivity = await this.flatmapQueries.queryForConnectivityNew(this.mapImp, payload[0]);
|
|
1361
|
+
const originsFlat = connectivity?.ids?.dendrites.flat(Infinity);
|
|
1362
|
+
const componentsFlat = connectivity?.ids?.components.flat(Infinity);
|
|
1363
|
+
const destinationsFlat = connectivity?.ids?.axons.flat(Infinity);
|
|
1364
|
+
let connected = [];
|
|
1365
|
+
if (connectedType.includes("origins")) connected.push(...originsFlat);
|
|
1366
|
+
if (connectedType.includes("components")) connected.push(...componentsFlat);
|
|
1367
|
+
if (connectedType.includes("destinations")) connected.push(...destinationsFlat);
|
|
1368
|
+
if (connectedType.includes("all")) connected.push(...originsFlat, ...componentsFlat, ...destinationsFlat);
|
|
1369
|
+
connectedTarget = [...new Set(connected)];
|
|
1525
1370
|
}
|
|
1526
1371
|
// Loop through the node features and check if we have certain nodes
|
|
1527
1372
|
nodeFeatureIds.forEach((featureId) => {
|
|
1528
1373
|
// Get the paths from each node feature
|
|
1529
|
-
const pathsL2 = this.mapImp.nodePathModels(featureId)
|
|
1374
|
+
const pathsL2 = this.mapImp.nodePathModels(featureId);
|
|
1530
1375
|
pathsL2.forEach((path) => {
|
|
1531
1376
|
// nodes of the second level path
|
|
1532
|
-
const nodeFeatureIdsL2 = this.mapImp.pathModelNodes(path)
|
|
1377
|
+
const nodeFeatureIdsL2 = this.mapImp.pathModelNodes(path);
|
|
1533
1378
|
const nodeModelsL2 = nodeFeatureIdsL2.map((featureIdL2) => {
|
|
1534
|
-
return this.mapImp.featureProperties(featureIdL2).models
|
|
1535
|
-
})
|
|
1536
|
-
const intersection = connectedTarget.filter((element)
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
connectedPaths.push(path)
|
|
1541
|
-
})
|
|
1542
|
-
})
|
|
1379
|
+
return this.mapImp.featureProperties(featureIdL2).models;
|
|
1380
|
+
});
|
|
1381
|
+
const intersection = connectedTarget.filter(element => nodeModelsL2.includes(element));
|
|
1382
|
+
if (intersection.length && !connectedPaths.includes(path)) connectedPaths.push(path);
|
|
1383
|
+
});
|
|
1384
|
+
});
|
|
1543
1385
|
} else if (pathsOfEntities.length) {
|
|
1544
1386
|
if (connectedTarget.length) {
|
|
1545
1387
|
pathsOfEntities.forEach((path) => {
|
|
1546
|
-
const nodeFeatureIds = this.mapImp.pathModelNodes(path)
|
|
1388
|
+
const nodeFeatureIds = this.mapImp.pathModelNodes(path);
|
|
1547
1389
|
const nodeModels = nodeFeatureIds.map((featureId) => {
|
|
1548
|
-
return this.mapImp.featureProperties(featureId).models
|
|
1549
|
-
})
|
|
1550
|
-
const intersection = connectedTarget.filter((element)
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
if (intersection.length && !connectedPaths.includes(path))
|
|
1554
|
-
connectedPaths.push(path)
|
|
1555
|
-
})
|
|
1390
|
+
return this.mapImp.featureProperties(featureId).models;
|
|
1391
|
+
});
|
|
1392
|
+
const intersection = connectedTarget.filter(element => nodeModels.includes(element));
|
|
1393
|
+
if (intersection.length && !connectedPaths.includes(path)) connectedPaths.push(path);
|
|
1394
|
+
});
|
|
1556
1395
|
} else {
|
|
1557
|
-
connectedPaths = pathsOfEntities
|
|
1396
|
+
connectedPaths = pathsOfEntities;
|
|
1558
1397
|
}
|
|
1559
1398
|
}
|
|
1560
|
-
connectedPaths = [...new Set([...connectedPaths, ...payload])]
|
|
1561
|
-
return connectedPaths
|
|
1399
|
+
connectedPaths = [...new Set([...connectedPaths, ...payload])];
|
|
1400
|
+
return connectedPaths;
|
|
1562
1401
|
}
|
|
1563
1402
|
},
|
|
1564
|
-
resetMapFilter: function
|
|
1565
|
-
const alert = this.mapFilters.alert
|
|
1566
|
-
let filter
|
|
1567
|
-
const isPathways = { 'tile-layer': 'pathways' }
|
|
1568
|
-
const notPathways = { NOT: isPathways }
|
|
1403
|
+
resetMapFilter: function() {
|
|
1404
|
+
const alert = this.mapFilters.alert;
|
|
1405
|
+
let filter;
|
|
1406
|
+
const isPathways = { 'tile-layer': 'pathways' };
|
|
1407
|
+
const notPathways = { NOT: isPathways };
|
|
1569
1408
|
|
|
1570
1409
|
if (alert.with && !alert.without) {
|
|
1571
1410
|
// Show pathways with alert
|
|
1572
1411
|
filter = {
|
|
1573
|
-
OR: [notPathways, { AND: [isPathways, { HAS: 'alert' }] }]
|
|
1574
|
-
}
|
|
1412
|
+
OR: [notPathways, { AND: [isPathways, { HAS: 'alert' }] }]
|
|
1413
|
+
};
|
|
1575
1414
|
} else if (!alert.with && alert.without) {
|
|
1576
1415
|
// Show pathways without alert
|
|
1577
1416
|
filter = {
|
|
1578
|
-
OR: [notPathways, { AND: [isPathways, { NOT: { HAS: 'alert' } }] }]
|
|
1579
|
-
}
|
|
1417
|
+
OR: [notPathways, { AND: [isPathways, { NOT: { HAS: 'alert' } }] }]
|
|
1418
|
+
};
|
|
1580
1419
|
} else if (!alert.with && !alert.without) {
|
|
1581
1420
|
// Hide all pathways
|
|
1582
|
-
filter = notPathways
|
|
1421
|
+
filter = notPathways;
|
|
1583
1422
|
}
|
|
1584
1423
|
this.setVisibilityFilter(filter)
|
|
1585
1424
|
},
|
|
@@ -1592,17 +1431,16 @@ export default {
|
|
|
1592
1431
|
alertMouseEnterEmitted: function (payload) {
|
|
1593
1432
|
if (this.mapImp) {
|
|
1594
1433
|
if (payload.value) {
|
|
1595
|
-
let filter
|
|
1596
|
-
const isPathways = { 'tile-layer': 'pathways' }
|
|
1597
|
-
const notPathways = { NOT: isPathways }
|
|
1434
|
+
let filter;
|
|
1435
|
+
const isPathways = { 'tile-layer': 'pathways' };
|
|
1436
|
+
const notPathways = { NOT: isPathways };
|
|
1598
1437
|
|
|
1599
|
-
if (payload.key ===
|
|
1600
|
-
const hasAlert =
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
: { NOT: { HAS: 'alert' } }
|
|
1438
|
+
if (payload.key === "alert" || payload.key === "withoutAlert") {
|
|
1439
|
+
const hasAlert = payload.key === "alert" ?
|
|
1440
|
+
{ HAS: 'alert' } :
|
|
1441
|
+
{ NOT: { HAS: 'alert' } };
|
|
1604
1442
|
|
|
1605
|
-
filter = { OR: [notPathways, { AND: [isPathways, hasAlert] }] }
|
|
1443
|
+
filter = { OR: [notPathways, { AND: [isPathways, hasAlert] }] };
|
|
1606
1444
|
}
|
|
1607
1445
|
this.setVisibilityFilter(filter)
|
|
1608
1446
|
} else {
|
|
@@ -1618,13 +1456,13 @@ export default {
|
|
|
1618
1456
|
*/
|
|
1619
1457
|
alertSelected: function (payload) {
|
|
1620
1458
|
if (this.mapImp) {
|
|
1621
|
-
if (payload.key ===
|
|
1459
|
+
if (payload.key === "alert") {
|
|
1622
1460
|
if (payload.value) {
|
|
1623
1461
|
this.mapFilters.alert.with = true
|
|
1624
1462
|
} else {
|
|
1625
1463
|
this.mapFilters.alert.with = false
|
|
1626
1464
|
}
|
|
1627
|
-
} else if (payload.key ===
|
|
1465
|
+
} else if (payload.key === "withoutAlert") {
|
|
1628
1466
|
if (payload.value) {
|
|
1629
1467
|
this.mapFilters.alert.without = true
|
|
1630
1468
|
} else {
|
|
@@ -1725,7 +1563,7 @@ export default {
|
|
|
1725
1563
|
clearTimeout(this.taxonLeaveDelay)
|
|
1726
1564
|
let gid = this.mapImp.taxonFeatureIds(payload.key)
|
|
1727
1565
|
this.mapImp.enableConnectivityByTaxonIds(payload.key, payload.value) // make sure path is visible
|
|
1728
|
-
this.mapImp.zoomToGeoJSONFeatures(gid, {
|
|
1566
|
+
this.mapImp.zoomToGeoJSONFeatures(gid, {noZoomIn: true})
|
|
1729
1567
|
} else {
|
|
1730
1568
|
this.taxonLeaveDelay = setTimeout(() => {
|
|
1731
1569
|
// reset visibility of paths
|
|
@@ -1734,7 +1572,7 @@ export default {
|
|
|
1734
1572
|
let show = payload.checked.includes(item.taxon)
|
|
1735
1573
|
this.mapImp.enableConnectivityByTaxonIds(item.taxon, show)
|
|
1736
1574
|
})
|
|
1737
|
-
}, 1000)
|
|
1575
|
+
}, 1000);
|
|
1738
1576
|
}
|
|
1739
1577
|
}
|
|
1740
1578
|
},
|
|
@@ -1796,23 +1634,15 @@ export default {
|
|
|
1796
1634
|
else this.featureAnnotationSubmitted = false
|
|
1797
1635
|
this.annotationEntry = []
|
|
1798
1636
|
} else if (data.type === 'modeChanged') {
|
|
1799
|
-
if (data.feature.mode === 'direct_select')
|
|
1800
|
-
|
|
1801
|
-
if (
|
|
1802
|
-
this.annotationSidebar &&
|
|
1803
|
-
data.feature.mode === 'simple_select' &&
|
|
1804
|
-
this.activeDrawMode === 'Deleted'
|
|
1805
|
-
) {
|
|
1637
|
+
if (data.feature.mode === 'direct_select') this.doubleClickedFeature = true
|
|
1638
|
+
if (this.annotationSidebar && data.feature.mode === 'simple_select' && this.activeDrawMode === 'Deleted') {
|
|
1806
1639
|
this.annotationEventCallback({}, { type: 'aborted' })
|
|
1807
1640
|
}
|
|
1808
1641
|
} else if (data.type === 'selectionChanged') {
|
|
1809
|
-
this.selectedDrawnFeature =
|
|
1810
|
-
data.feature.features
|
|
1811
|
-
? undefined
|
|
1812
|
-
: data.feature.features[0]
|
|
1642
|
+
this.selectedDrawnFeature = data.feature.features.length === 0 ?
|
|
1643
|
+
undefined : data.feature.features[0]
|
|
1813
1644
|
payload.feature.feature = this.selectedDrawnFeature
|
|
1814
|
-
if (!this.activeDrawTool) {
|
|
1815
|
-
// Make sure dialog content doesn't change
|
|
1645
|
+
if (!this.activeDrawTool) { // Make sure dialog content doesn't change
|
|
1816
1646
|
this.connectionEntry = {}
|
|
1817
1647
|
// For exist drawn annotation features
|
|
1818
1648
|
if (this.selectedDrawnFeature) {
|
|
@@ -1826,16 +1656,11 @@ export default {
|
|
|
1826
1656
|
}
|
|
1827
1657
|
this.annotationDrawModeEvent(payload)
|
|
1828
1658
|
} else {
|
|
1829
|
-
if (
|
|
1830
|
-
this.
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
{
|
|
1835
|
-
...this.previousEditEvent,
|
|
1836
|
-
resourceId: this.serverURL,
|
|
1837
|
-
},
|
|
1838
|
-
]
|
|
1659
|
+
if (this.annotationSidebar && this.previousEditEvent.type === 'updated') {
|
|
1660
|
+
this.annotationEntry = [{
|
|
1661
|
+
...this.previousEditEvent,
|
|
1662
|
+
resourceId: this.serverURL
|
|
1663
|
+
}]
|
|
1839
1664
|
this.annotationEventCallback({}, { type: 'aborted' })
|
|
1840
1665
|
}
|
|
1841
1666
|
this.previousEditEvent = {}
|
|
@@ -1846,9 +1671,7 @@ export default {
|
|
|
1846
1671
|
if (data.type === 'updated' && data.feature.action) {
|
|
1847
1672
|
data.positionUpdated = data.feature.action === 'move'
|
|
1848
1673
|
}
|
|
1849
|
-
const feature = this.mapImp.refreshAnnotationFeatureGeometry(
|
|
1850
|
-
data.feature
|
|
1851
|
-
)
|
|
1674
|
+
const feature = this.mapImp.refreshAnnotationFeatureGeometry(data.feature)
|
|
1852
1675
|
payload.feature.feature = feature
|
|
1853
1676
|
// NB. this might now be `null` if user has deleted it (before OK/Submit)
|
|
1854
1677
|
// so maybe then no `service.addAnnotation` ??
|
|
@@ -1902,39 +1725,36 @@ export default {
|
|
|
1902
1725
|
const biologicalSex = this.biologicalSex
|
|
1903
1726
|
const featuresAlert = normaliseAlertToStringArray(data.alert)
|
|
1904
1727
|
const taxons = this.getTaxons(data)
|
|
1905
|
-
let payload = [
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
alert: featuresAlert,
|
|
1918
|
-
},
|
|
1919
|
-
]
|
|
1728
|
+
let payload = [{
|
|
1729
|
+
dataset: data.dataset,
|
|
1730
|
+
biologicalSex: biologicalSex,
|
|
1731
|
+
taxonomy: taxonomy,
|
|
1732
|
+
resource: resource,
|
|
1733
|
+
label: label,
|
|
1734
|
+
feature: data,
|
|
1735
|
+
userData: args,
|
|
1736
|
+
eventType: eventType,
|
|
1737
|
+
provenanceTaxonomy: taxons,
|
|
1738
|
+
alert: featuresAlert
|
|
1739
|
+
}]
|
|
1920
1740
|
if (eventType === 'click') {
|
|
1921
1741
|
// If multiple paths overlap at the click location,
|
|
1922
1742
|
// `data` is an object with numeric keys for each feature (e.g., {0: {...}, 1: {...}, ..., mapUUID: '...'}).
|
|
1923
1743
|
// If only one feature or path is clicked,
|
|
1924
1744
|
// `data` is a single object (e.g., {featureId: '...', mapUUID: '...'}).
|
|
1925
|
-
const singleSelection = !data[0]
|
|
1745
|
+
const singleSelection = !data[0];
|
|
1926
1746
|
if (!singleSelection) {
|
|
1927
1747
|
payload = []
|
|
1928
1748
|
const mapuuid = data.mapUUID
|
|
1929
|
-
const seenIds = new Set()
|
|
1749
|
+
const seenIds = new Set();
|
|
1930
1750
|
for (let [key, value] of Object.entries(data)) {
|
|
1931
1751
|
if (key !== 'mapUUID') {
|
|
1932
1752
|
const id = value.featureId
|
|
1933
1753
|
const label = value.label
|
|
1934
1754
|
const resource = [value.models]
|
|
1935
1755
|
const taxons = this.getTaxons(value)
|
|
1936
|
-
if (seenIds.has(id)) continue
|
|
1937
|
-
seenIds.add(id)
|
|
1756
|
+
if (seenIds.has(id)) continue;
|
|
1757
|
+
seenIds.add(id);
|
|
1938
1758
|
payload.push({
|
|
1939
1759
|
dataset: value.dataset,
|
|
1940
1760
|
biologicalSex: biologicalSex,
|
|
@@ -1952,7 +1772,7 @@ export default {
|
|
|
1952
1772
|
}
|
|
1953
1773
|
}
|
|
1954
1774
|
const clickedItem = singleSelection ? data : data[0]
|
|
1955
|
-
this.setConnectivityDataSource(this.viewingMode, clickedItem)
|
|
1775
|
+
this.setConnectivityDataSource(this.viewingMode, clickedItem);
|
|
1956
1776
|
if (this.viewingMode === 'Neuron Connection') {
|
|
1957
1777
|
// do nothing here
|
|
1958
1778
|
// the method to highlight paths is moved to checkAndCreatePopups function
|
|
@@ -1961,33 +1781,20 @@ export default {
|
|
|
1961
1781
|
// This is for annotation mode - draw connectivity between features/paths
|
|
1962
1782
|
if (this.activeDrawTool && !this.isValidDrawnCreated) {
|
|
1963
1783
|
// Check if flatmap features or existing drawn features
|
|
1964
|
-
const validDrawnFeature =
|
|
1965
|
-
clickedItem.
|
|
1966
|
-
|
|
1967
|
-
(feature) => feature.id === clickedItem.id
|
|
1968
|
-
)
|
|
1784
|
+
const validDrawnFeature = clickedItem.featureId || this.existDrawnFeatures.find(
|
|
1785
|
+
(feature) => feature.id === clickedItem.id
|
|
1786
|
+
)
|
|
1969
1787
|
// Only the linestring will have connection
|
|
1970
1788
|
if (this.activeDrawTool === 'LineString' && validDrawnFeature) {
|
|
1971
|
-
const key = clickedItem.featureId
|
|
1972
|
-
|
|
1973
|
-
: clickedItem.id
|
|
1974
|
-
const nodeLabel = clickedItem.label
|
|
1975
|
-
? clickedItem.label
|
|
1976
|
-
: `Feature ${clickedItem.id}`
|
|
1789
|
+
const key = clickedItem.featureId ? clickedItem.featureId : clickedItem.id
|
|
1790
|
+
const nodeLabel = clickedItem.label ? clickedItem.label : `Feature ${clickedItem.id}`
|
|
1977
1791
|
// Add space before key to make sure properties follows adding order
|
|
1978
1792
|
this.connectionEntry[` ${key}`] = Object.assign(
|
|
1979
1793
|
{ label: nodeLabel },
|
|
1980
1794
|
Object.fromEntries(
|
|
1981
1795
|
Object.entries(clickedItem)
|
|
1982
|
-
.filter(([key]) =>
|
|
1983
|
-
|
|
1984
|
-
)
|
|
1985
|
-
.map(([key, value]) => [
|
|
1986
|
-
key === 'featureId' ? 'id' : key,
|
|
1987
|
-
value,
|
|
1988
|
-
])
|
|
1989
|
-
)
|
|
1990
|
-
)
|
|
1796
|
+
.filter(([key]) => ['featureId', 'models'].includes(key))
|
|
1797
|
+
.map(([key, value]) => [(key === 'featureId') ? 'id' : key, value])))
|
|
1991
1798
|
}
|
|
1992
1799
|
}
|
|
1993
1800
|
}
|
|
@@ -1996,10 +1803,7 @@ export default {
|
|
|
1996
1803
|
if (data && data.type !== 'marker' && !this.activeDrawTool) {
|
|
1997
1804
|
this.checkAndCreatePopups(payload)
|
|
1998
1805
|
}
|
|
1999
|
-
} else if (
|
|
2000
|
-
eventType === 'mouseenter' &&
|
|
2001
|
-
this.viewingMode !== 'Neuron Connection'
|
|
2002
|
-
) {
|
|
1806
|
+
} else if (eventType === 'mouseenter' && this.viewingMode !== 'Neuron Connection') {
|
|
2003
1807
|
this.currentHover = data.models ? data.models : ''
|
|
2004
1808
|
}
|
|
2005
1809
|
|
|
@@ -2019,13 +1823,11 @@ export default {
|
|
|
2019
1823
|
setConnectivityDataSource: function (viewingMode, data) {
|
|
2020
1824
|
// Exploration mode, only path click will be used as data source
|
|
2021
1825
|
if (viewingMode === 'Exploration') {
|
|
2022
|
-
this.connectivityDataSource = data.models?.startsWith('ilxtr:')
|
|
2023
|
-
? data.models
|
|
2024
|
-
: ''
|
|
1826
|
+
this.connectivityDataSource = data.models?.startsWith('ilxtr:') ? data.models : '';
|
|
2025
1827
|
} else {
|
|
2026
1828
|
// Other modes, it can be anything
|
|
2027
1829
|
// (annotation drawing doesn't have featureId or models)
|
|
2028
|
-
this.connectivityDataSource = data.featureId || data.id
|
|
1830
|
+
this.connectivityDataSource = data.featureId || data.id;
|
|
2029
1831
|
}
|
|
2030
1832
|
},
|
|
2031
1833
|
/**
|
|
@@ -2048,12 +1850,12 @@ export default {
|
|
|
2048
1850
|
removeActiveTooltips: function () {
|
|
2049
1851
|
// Remove active tooltip/popup on map
|
|
2050
1852
|
if (this.mapImp) {
|
|
2051
|
-
this.mapImp.removePopup()
|
|
1853
|
+
this.mapImp.removePopup();
|
|
2052
1854
|
}
|
|
2053
1855
|
|
|
2054
1856
|
// Fallback: remove any existing toolitp on DOM
|
|
2055
|
-
const tooltips = this.$el.querySelectorAll('.flatmap-tooltip-popup')
|
|
2056
|
-
tooltips.forEach((tooltip) => tooltip.remove())
|
|
1857
|
+
const tooltips = this.$el.querySelectorAll('.flatmap-tooltip-popup');
|
|
1858
|
+
tooltips.forEach((tooltip) => tooltip.remove());
|
|
2057
1859
|
},
|
|
2058
1860
|
/**
|
|
2059
1861
|
* Function to create tooltip for the provided connectivity data.
|
|
@@ -2062,24 +1864,28 @@ export default {
|
|
|
2062
1864
|
createTooltipForConnectivity: function (connectivityData, geojsonId) {
|
|
2063
1865
|
// combine all labels to show together
|
|
2064
1866
|
// content type must be DOM object to use HTML
|
|
2065
|
-
const labelsContainer = document.createElement('div')
|
|
2066
|
-
labelsContainer.classList.add('flatmap-feature-label')
|
|
1867
|
+
const labelsContainer = document.createElement('div');
|
|
1868
|
+
labelsContainer.classList.add('flatmap-feature-label');
|
|
2067
1869
|
|
|
2068
1870
|
connectivityData.forEach((connectivity, i) => {
|
|
2069
|
-
const { label } = connectivity
|
|
2070
|
-
labelsContainer.append(capitalise(label))
|
|
1871
|
+
const { label } = connectivity;
|
|
1872
|
+
labelsContainer.append(capitalise(label));
|
|
2071
1873
|
|
|
2072
|
-
if (i + 1 < connectivityData.length) {
|
|
2073
|
-
const hr = document.createElement('hr')
|
|
2074
|
-
labelsContainer.appendChild(hr)
|
|
1874
|
+
if ((i + 1) < connectivityData.length) {
|
|
1875
|
+
const hr = document.createElement('hr');
|
|
1876
|
+
labelsContainer.appendChild(hr);
|
|
2075
1877
|
}
|
|
2076
|
-
})
|
|
1878
|
+
});
|
|
2077
1879
|
|
|
2078
|
-
this.mapImp.showPopup(
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
1880
|
+
this.mapImp.showPopup(
|
|
1881
|
+
geojsonId,
|
|
1882
|
+
labelsContainer,
|
|
1883
|
+
{
|
|
1884
|
+
className: 'custom-popup flatmap-tooltip-popup',
|
|
1885
|
+
positionAtLastClick: false,
|
|
1886
|
+
preserveSelection: true,
|
|
1887
|
+
}
|
|
1888
|
+
);
|
|
2083
1889
|
},
|
|
2084
1890
|
/**
|
|
2085
1891
|
* Function to show connectivity tooltips on the map
|
|
@@ -2087,53 +1893,53 @@ export default {
|
|
|
2087
1893
|
* @arg {Object} `payload`
|
|
2088
1894
|
*/
|
|
2089
1895
|
showConnectivityTooltips: function (payload) {
|
|
2090
|
-
const { connectivityInfo, data } = payload
|
|
2091
|
-
const featuresToHighlight = []
|
|
2092
|
-
const geojsonHighlights = []
|
|
2093
|
-
const connectivityData = []
|
|
2094
|
-
const errorData = []
|
|
1896
|
+
const { connectivityInfo, data } = payload;
|
|
1897
|
+
const featuresToHighlight = [];
|
|
1898
|
+
const geojsonHighlights = [];
|
|
1899
|
+
const connectivityData = [];
|
|
1900
|
+
const errorData = [];
|
|
2095
1901
|
|
|
2096
1902
|
// to keep the highlighted path on map
|
|
2097
1903
|
if (connectivityInfo && connectivityInfo.featureId) {
|
|
2098
|
-
featuresToHighlight.push(...connectivityInfo.featureId)
|
|
1904
|
+
featuresToHighlight.push(...connectivityInfo.featureId);
|
|
2099
1905
|
}
|
|
2100
1906
|
|
|
2101
1907
|
if (this.mapImp) {
|
|
2102
1908
|
// search the features on the map first
|
|
2103
1909
|
data.forEach((connectivity) => {
|
|
2104
|
-
const response = this.mapImp.search(connectivity.id)
|
|
1910
|
+
const response = this.mapImp.search(connectivity.id);
|
|
2105
1911
|
|
|
2106
1912
|
if (response?.results.length) {
|
|
2107
|
-
const featureId = response?.results[0].featureId
|
|
2108
|
-
connectivityData.push({ featureId, ...connectivity })
|
|
1913
|
+
const featureId = response?.results[0].featureId;
|
|
1914
|
+
connectivityData.push({ featureId, ...connectivity });
|
|
2109
1915
|
} else {
|
|
2110
|
-
errorData.push(connectivity)
|
|
1916
|
+
errorData.push(connectivity);
|
|
2111
1917
|
}
|
|
2112
|
-
})
|
|
1918
|
+
});
|
|
2113
1919
|
|
|
2114
1920
|
if (connectivityData.length) {
|
|
2115
|
-
let geojsonId = connectivityData[0].featureId
|
|
1921
|
+
let geojsonId = connectivityData[0].featureId;
|
|
2116
1922
|
|
|
2117
1923
|
this.mapImp.annotations.forEach((annotation) => {
|
|
2118
|
-
const anatomicalNodes = annotation['anatomical-nodes']
|
|
1924
|
+
const anatomicalNodes = annotation['anatomical-nodes'];
|
|
2119
1925
|
|
|
2120
1926
|
if (anatomicalNodes) {
|
|
2121
|
-
const anatomicalNodesString = anatomicalNodes.join('')
|
|
2122
|
-
const foundItem = connectivityData.every(
|
|
2123
|
-
|
|
2124
|
-
)
|
|
1927
|
+
const anatomicalNodesString = anatomicalNodes.join('');
|
|
1928
|
+
const foundItem = connectivityData.every((item) =>
|
|
1929
|
+
anatomicalNodesString.indexOf(item.id) !== -1
|
|
1930
|
+
);
|
|
2125
1931
|
|
|
2126
1932
|
if (foundItem) {
|
|
2127
|
-
geojsonId = annotation.featureId
|
|
2128
|
-
geojsonHighlights.push(geojsonId)
|
|
1933
|
+
geojsonId = annotation.featureId;
|
|
1934
|
+
geojsonHighlights.push(geojsonId);
|
|
2129
1935
|
}
|
|
2130
1936
|
}
|
|
2131
|
-
})
|
|
1937
|
+
});
|
|
2132
1938
|
|
|
2133
|
-
this.createTooltipForConnectivity(connectivityData, geojsonId)
|
|
1939
|
+
this.createTooltipForConnectivity(connectivityData, geojsonId);
|
|
2134
1940
|
} else {
|
|
2135
1941
|
// Close all tooltips on the current flatmap element
|
|
2136
|
-
this.removeActiveTooltips()
|
|
1942
|
+
this.removeActiveTooltips();
|
|
2137
1943
|
}
|
|
2138
1944
|
|
|
2139
1945
|
// Emit error message for connectivity
|
|
@@ -2143,86 +1949,75 @@ export default {
|
|
|
2143
1949
|
|
|
2144
1950
|
// highlight all available features
|
|
2145
1951
|
const connectivityFeatures = featuresToHighlight.reduce((arr, path) => {
|
|
2146
|
-
const connectivityObj = this.mapImp.pathways.paths[path]
|
|
2147
|
-
const connectivities = connectivityObj
|
|
2148
|
-
? connectivityObj.connectivity
|
|
2149
|
-
: null
|
|
1952
|
+
const connectivityObj = this.mapImp.pathways.paths[path];
|
|
1953
|
+
const connectivities = connectivityObj ? connectivityObj.connectivity : null;
|
|
2150
1954
|
if (connectivities) {
|
|
2151
|
-
const flatFeatures = connectivities.flat(Infinity)
|
|
2152
|
-
arr.push(...flatFeatures)
|
|
1955
|
+
const flatFeatures = connectivities.flat(Infinity);
|
|
1956
|
+
arr.push(...flatFeatures);
|
|
2153
1957
|
}
|
|
2154
|
-
return arr
|
|
2155
|
-
}, [])
|
|
2156
|
-
const uniqueConnectivityFeatures = [...new Set(connectivityFeatures)]
|
|
2157
|
-
const combinedFeatures = [
|
|
2158
|
-
|
|
2159
|
-
...uniqueConnectivityFeatures,
|
|
2160
|
-
]
|
|
2161
|
-
const featureIdsToHighlight =
|
|
2162
|
-
this.mapImp.modelFeatureIdList(combinedFeatures)
|
|
1958
|
+
return arr;
|
|
1959
|
+
}, []);
|
|
1960
|
+
const uniqueConnectivityFeatures = [...new Set(connectivityFeatures)];
|
|
1961
|
+
const combinedFeatures = [...featuresToHighlight, ...uniqueConnectivityFeatures];
|
|
1962
|
+
const featureIdsToHighlight = this.mapImp.modelFeatureIdList(combinedFeatures);
|
|
2163
1963
|
const allFeaturesToHighlight = [
|
|
2164
1964
|
...featureIdsToHighlight,
|
|
2165
|
-
...geojsonHighlights
|
|
2166
|
-
]
|
|
1965
|
+
...geojsonHighlights
|
|
1966
|
+
];
|
|
2167
1967
|
|
|
2168
|
-
this.mapImp.selectGeoJSONFeatures(allFeaturesToHighlight)
|
|
1968
|
+
this.mapImp.selectGeoJSONFeatures(allFeaturesToHighlight);
|
|
2169
1969
|
}
|
|
2170
1970
|
},
|
|
2171
1971
|
showConnectivitiesByReference: function (resource) {
|
|
2172
1972
|
this.searchConnectivitiesByReference(resource).then((featureIds) => {
|
|
2173
|
-
this.mapImp.selectFeatures(featureIds)
|
|
2174
|
-
})
|
|
1973
|
+
this.mapImp.selectFeatures(featureIds);
|
|
1974
|
+
});
|
|
2175
1975
|
},
|
|
2176
1976
|
searchConnectivitiesByReference: async function (resource) {
|
|
2177
|
-
const flatmapKnowledge = sessionStorage.getItem('flatmap-knowledge')
|
|
2178
|
-
let featureIds = []
|
|
1977
|
+
const flatmapKnowledge = sessionStorage.getItem('flatmap-knowledge');
|
|
1978
|
+
let featureIds = [];
|
|
2179
1979
|
|
|
2180
1980
|
if (flatmapKnowledge) {
|
|
2181
|
-
featureIds = await getReferenceConnectivitiesFromStorage(resource)
|
|
1981
|
+
featureIds = await getReferenceConnectivitiesFromStorage(resource);
|
|
2182
1982
|
} else {
|
|
2183
|
-
featureIds = await getReferenceConnectivitiesByAPI(
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
1983
|
+
featureIds = await getReferenceConnectivitiesByAPI(this.mapImp, resource, this.flatmapQueries);
|
|
1984
|
+
}
|
|
1985
|
+
return featureIds;
|
|
1986
|
+
},
|
|
1987
|
+
getFlatmapKnowledge: function () {
|
|
1988
|
+
let flatmapKnowledge = [];
|
|
1989
|
+
const flatmapKnowledgeRaw = sessionStorage.getItem('flatmap-knowledge');
|
|
1990
|
+
if (flatmapKnowledgeRaw) {
|
|
1991
|
+
flatmapKnowledge = JSON.parse(flatmapKnowledgeRaw);
|
|
2188
1992
|
}
|
|
2189
|
-
return
|
|
1993
|
+
return flatmapKnowledge;
|
|
2190
1994
|
},
|
|
2191
1995
|
emitConnectivityError: function (errorData) {
|
|
2192
1996
|
this.$emit('connectivity-error', {
|
|
2193
1997
|
data: {
|
|
2194
1998
|
errorData: errorData,
|
|
2195
1999
|
errorMessage: ERROR_MESSAGE,
|
|
2196
|
-
}
|
|
2197
|
-
})
|
|
2000
|
+
}
|
|
2001
|
+
});
|
|
2198
2002
|
},
|
|
2199
|
-
checkConnectivityTooltipEntry: function
|
|
2003
|
+
checkConnectivityTooltipEntry: function(tooltipEntry) {
|
|
2200
2004
|
if (tooltipEntry?.length) {
|
|
2201
|
-
return (
|
|
2202
|
-
undefined !==
|
|
2203
|
-
tooltipEntry.find(
|
|
2204
|
-
(entry) => entry?.destinations?.length || entry?.components?.length
|
|
2205
|
-
)
|
|
2206
|
-
)
|
|
2005
|
+
return undefined !== (tooltipEntry.find(entry => entry?.destinations?.length || entry?.components?.length))
|
|
2207
2006
|
}
|
|
2208
2007
|
return false
|
|
2209
2008
|
},
|
|
2210
2009
|
changeConnectivitySource: async function (payload) {
|
|
2211
|
-
const { entry, connectivitySource } = payload
|
|
2010
|
+
const { entry, connectivitySource } = payload;
|
|
2212
2011
|
if (entry.mapId === this.mapImp.id) {
|
|
2213
|
-
await this.flatmapQueries.queryForConnectivityNew(
|
|
2214
|
-
this.mapImp,
|
|
2215
|
-
entry.featureId[0],
|
|
2216
|
-
connectivitySource
|
|
2217
|
-
)
|
|
2012
|
+
await this.flatmapQueries.queryForConnectivityNew(this.mapImp, entry.featureId[0], connectivitySource);
|
|
2218
2013
|
this.tooltipEntry = this.tooltipEntry.map((tooltip) => {
|
|
2219
2014
|
if (tooltip.featureId[0] === entry.featureId[0]) {
|
|
2220
|
-
return this.flatmapQueries.updateTooltipData(tooltip)
|
|
2015
|
+
return this.flatmapQueries.updateTooltipData(tooltip);
|
|
2221
2016
|
}
|
|
2222
|
-
return tooltip
|
|
2017
|
+
return tooltip;
|
|
2223
2018
|
})
|
|
2224
2019
|
if (this.checkConnectivityTooltipEntry(this.tooltipEntry)) {
|
|
2225
|
-
this.$emit('connectivity-info-open', this.tooltipEntry)
|
|
2020
|
+
this.$emit('connectivity-info-open', this.tooltipEntry);
|
|
2226
2021
|
}
|
|
2227
2022
|
}
|
|
2228
2023
|
},
|
|
@@ -2235,39 +2030,28 @@ export default {
|
|
|
2235
2030
|
checkAndCreatePopups: async function (data, mapclick = true) {
|
|
2236
2031
|
// Call flatmap database to get the connection data
|
|
2237
2032
|
if (this.viewingMode === 'Annotation') {
|
|
2238
|
-
const features = data.filter(
|
|
2033
|
+
const features = data.filter(d => d.feature).map(d => d.feature)
|
|
2239
2034
|
if (features.length > 0) {
|
|
2240
|
-
if (
|
|
2241
|
-
this.
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
{
|
|
2246
|
-
...this.previousDeletedEvent,
|
|
2247
|
-
resourceId: this.serverURL,
|
|
2248
|
-
},
|
|
2249
|
-
]
|
|
2035
|
+
if (this.annotationSidebar && this.previousDeletedEvent.type === 'deleted') {
|
|
2036
|
+
this.annotationEntry = [{
|
|
2037
|
+
...this.previousDeletedEvent,
|
|
2038
|
+
resourceId: this.serverURL
|
|
2039
|
+
}]
|
|
2250
2040
|
this.annotationEventCallback({}, { type: 'aborted' })
|
|
2251
2041
|
}
|
|
2252
2042
|
this.annotationEntry = []
|
|
2253
|
-
features.forEach(
|
|
2043
|
+
features.forEach(feature => {
|
|
2254
2044
|
this.annotationEntry.push({
|
|
2255
2045
|
...feature,
|
|
2256
2046
|
resourceId: this.serverURL,
|
|
2257
|
-
featureId: feature.featureId
|
|
2258
|
-
|
|
2259
|
-
: feature.feature?.id,
|
|
2260
|
-
offline: this.offlineAnnotationEnabled,
|
|
2047
|
+
featureId: feature.featureId ? feature.featureId : feature.feature?.id,
|
|
2048
|
+
offline: this.offlineAnnotationEnabled
|
|
2261
2049
|
})
|
|
2262
|
-
})
|
|
2050
|
+
});
|
|
2263
2051
|
// Drawn feature annotationEntry will always have length of 1
|
|
2264
2052
|
if (features[0].feature) {
|
|
2265
2053
|
// in drawing or edit/delete mode is on or valid drawn
|
|
2266
|
-
if (
|
|
2267
|
-
this.activeDrawTool ||
|
|
2268
|
-
this.activeDrawMode ||
|
|
2269
|
-
this.isValidDrawnCreated
|
|
2270
|
-
) {
|
|
2054
|
+
if (this.activeDrawTool || this.activeDrawMode || this.isValidDrawnCreated) {
|
|
2271
2055
|
this.featureAnnotationSubmitted = false
|
|
2272
2056
|
if (this.activeDrawTool) {
|
|
2273
2057
|
this.createConnectivityBody()
|
|
@@ -2281,8 +2065,8 @@ export default {
|
|
|
2281
2065
|
}
|
|
2282
2066
|
} else {
|
|
2283
2067
|
const featureIds = this.annotationEntry
|
|
2284
|
-
.filter(
|
|
2285
|
-
.map(
|
|
2068
|
+
.filter(annotation => annotation.featureId && annotation.models)
|
|
2069
|
+
.map(annotation => annotation.models)
|
|
2286
2070
|
if (featureIds.length > 0) {
|
|
2287
2071
|
this.displayTooltip(featureIds)
|
|
2288
2072
|
}
|
|
@@ -2294,131 +2078,115 @@ export default {
|
|
|
2294
2078
|
// clicking on a connectivity explorer card will be the same as exploration mode
|
|
2295
2079
|
// the card should be opened without doing other functions
|
|
2296
2080
|
else if (this.viewingMode === 'Neuron Connection' && mapclick) {
|
|
2297
|
-
const resources = data.map(
|
|
2081
|
+
const resources = data.map(tooltip => tooltip.resource[0]);
|
|
2298
2082
|
|
|
2299
2083
|
// filter out paths
|
|
2300
|
-
const featureId = resources.find(
|
|
2301
|
-
(resource) => !resource.startsWith('ilxtr:')
|
|
2302
|
-
)
|
|
2084
|
+
const featureId = resources.find(resource => !resource.startsWith('ilxtr:'));
|
|
2303
2085
|
if (featureId) {
|
|
2304
2086
|
// fallback if it cannot find in anatomical nodes
|
|
2305
|
-
const transformResources = Array.isArray(resources)
|
|
2306
|
-
? [...resources]
|
|
2307
|
-
: [resources]
|
|
2087
|
+
const transformResources = Array.isArray(resources) ? [...resources] : [resources];
|
|
2308
2088
|
if (transformResources.length === 1) {
|
|
2309
|
-
transformResources.push([])
|
|
2089
|
+
transformResources.push([]);
|
|
2310
2090
|
}
|
|
2311
2091
|
|
|
2312
|
-
const featureId = data[0].feature?.featureId
|
|
2313
|
-
const annotation = this.mapImp.annotations.get(featureId)
|
|
2314
|
-
const anatomicalNodes = annotation?.['anatomical-nodes']
|
|
2315
|
-
const annotationModels = annotation?.['models']
|
|
2316
|
-
let anatomicalNode
|
|
2317
|
-
let uniqueResource = transformResources
|
|
2318
|
-
const models = annotation?.['models']
|
|
2092
|
+
const featureId = data[0].feature?.featureId;
|
|
2093
|
+
const annotation = this.mapImp.annotations.get(featureId);
|
|
2094
|
+
const anatomicalNodes = annotation?.['anatomical-nodes'];
|
|
2095
|
+
const annotationModels = annotation?.['models'];
|
|
2096
|
+
let anatomicalNode;
|
|
2097
|
+
let uniqueResource = transformResources;
|
|
2098
|
+
const models = annotation?.['models'];
|
|
2319
2099
|
if (anatomicalNodes?.length) {
|
|
2320
2100
|
// get the node which match the feature in a location
|
|
2321
2101
|
// [feature, location]
|
|
2322
|
-
anatomicalNode = anatomicalNodes.find(
|
|
2323
|
-
|
|
2324
|
-
)
|
|
2102
|
+
anatomicalNode = anatomicalNodes.find((node) =>
|
|
2103
|
+
JSON.parse(node)[0] === annotationModels
|
|
2104
|
+
);
|
|
2325
2105
|
}
|
|
2326
2106
|
if (anatomicalNode) {
|
|
2327
|
-
uniqueResource = JSON.parse(anatomicalNode)
|
|
2107
|
+
uniqueResource = JSON.parse(anatomicalNode);
|
|
2328
2108
|
} else if (models) {
|
|
2329
|
-
uniqueResource = [models, []]
|
|
2109
|
+
uniqueResource = [models, []];
|
|
2330
2110
|
}
|
|
2331
2111
|
|
|
2332
|
-
const knowledgeSource = this.mapImp.knowledgeSource
|
|
2333
|
-
const terms = uniqueResource.flat(Infinity)
|
|
2334
|
-
const uniqueTerms = [...new Set(terms)]
|
|
2335
|
-
const fetchResults = await fetchLabels(this.flatmapAPI, uniqueTerms)
|
|
2112
|
+
const knowledgeSource = this.mapImp.knowledgeSource;
|
|
2113
|
+
const terms = uniqueResource.flat(Infinity);
|
|
2114
|
+
const uniqueTerms = [...new Set(terms)];
|
|
2115
|
+
const fetchResults = await fetchLabels(this.flatmapAPI, uniqueTerms);
|
|
2336
2116
|
const objectResults = fetchResults.reduce((arr, item) => {
|
|
2337
|
-
const id = item[0]
|
|
2338
|
-
const valObj = JSON.parse(item[1])
|
|
2339
|
-
arr.push({ id, label: valObj.label, source: valObj.source })
|
|
2340
|
-
return arr
|
|
2341
|
-
}, [])
|
|
2117
|
+
const id = item[0];
|
|
2118
|
+
const valObj = JSON.parse(item[1]);
|
|
2119
|
+
arr.push({ id, label: valObj.label, source: valObj.source });
|
|
2120
|
+
return arr;
|
|
2121
|
+
}, []);
|
|
2342
2122
|
|
|
2343
2123
|
// sort matched knowledgeSource items for same id
|
|
2344
2124
|
objectResults.sort((a, b) => {
|
|
2345
2125
|
if (a.id === b.id) {
|
|
2346
|
-
if (a.source === knowledgeSource && b.source !== knowledgeSource)
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
return 1
|
|
2350
|
-
return 0
|
|
2126
|
+
if (a.source === knowledgeSource && b.source !== knowledgeSource) return -1;
|
|
2127
|
+
if (a.source !== knowledgeSource && b.source === knowledgeSource) return 1;
|
|
2128
|
+
return 0;
|
|
2351
2129
|
}
|
|
2352
|
-
return a.id.localeCompare(b.id)
|
|
2353
|
-
})
|
|
2130
|
+
return a.id.localeCompare(b.id);
|
|
2131
|
+
});
|
|
2354
2132
|
|
|
2355
|
-
const labels = []
|
|
2133
|
+
const labels = [];
|
|
2356
2134
|
for (let i = 0; i < uniqueTerms.length; i++) {
|
|
2357
|
-
const foundObj = objectResults.find(
|
|
2358
|
-
(obj) => obj.id === uniqueTerms[i]
|
|
2359
|
-
)
|
|
2135
|
+
const foundObj = objectResults.find((obj) => obj.id === uniqueTerms[i])
|
|
2360
2136
|
if (foundObj) {
|
|
2361
|
-
labels.push(foundObj.label)
|
|
2137
|
+
labels.push(foundObj.label);
|
|
2362
2138
|
}
|
|
2363
2139
|
}
|
|
2364
|
-
const filterItemLabel = capitalise(labels.join(', '))
|
|
2140
|
+
const filterItemLabel = capitalise(labels.join(', '));
|
|
2365
2141
|
const newConnectivityfilter = {
|
|
2366
2142
|
facet: JSON.stringify(uniqueResource),
|
|
2367
2143
|
facetPropPath: `flatmap.connectivity.source.${this.connectionType.toLowerCase()}`,
|
|
2368
2144
|
tagLabel: filterItemLabel, // used tagLabel here instead of label since the label and value are different
|
|
2369
|
-
term: this.connectionType
|
|
2370
|
-
}
|
|
2145
|
+
term: this.connectionType
|
|
2146
|
+
};
|
|
2371
2147
|
// check for existing item
|
|
2372
|
-
const isNewFilterItemExist = this.connectivityFilters.some(
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
newConnectivityfilter.facetPropPath
|
|
2377
|
-
)
|
|
2148
|
+
const isNewFilterItemExist = this.connectivityFilters.some((connectivityfilter) => (
|
|
2149
|
+
connectivityfilter.facet === newConnectivityfilter.facet &&
|
|
2150
|
+
connectivityfilter.facetPropPath === newConnectivityfilter.facetPropPath
|
|
2151
|
+
));
|
|
2378
2152
|
|
|
2379
2153
|
if (!isNewFilterItemExist) {
|
|
2380
|
-
this.connectivityFilters.push(newConnectivityfilter)
|
|
2154
|
+
this.connectivityFilters.push(newConnectivityfilter);
|
|
2381
2155
|
}
|
|
2382
2156
|
|
|
2383
2157
|
this.$emit('neuron-connection-feature-click', {
|
|
2384
2158
|
filters: this.connectivityFilters,
|
|
2385
2159
|
search: '',
|
|
2386
|
-
})
|
|
2160
|
+
});
|
|
2387
2161
|
} else {
|
|
2388
2162
|
// clicking on paths
|
|
2389
2163
|
await this.openConnectivityInfo(data);
|
|
2390
2164
|
}
|
|
2391
2165
|
} else {
|
|
2392
|
-
await this.openConnectivityInfo(data)
|
|
2166
|
+
await this.openConnectivityInfo(data);
|
|
2393
2167
|
}
|
|
2394
2168
|
},
|
|
2395
2169
|
openConnectivityInfo: async function (data) {
|
|
2396
2170
|
// load and store knowledge
|
|
2397
|
-
loadAndStoreKnowledge(this.mapImp, this.flatmapQueries)
|
|
2171
|
+
loadAndStoreKnowledge(this.mapImp, this.flatmapQueries);
|
|
2398
2172
|
let prom1 = []
|
|
2399
2173
|
// Emit placeholders first.
|
|
2400
2174
|
// This may contain invalid connectivity.
|
|
2401
2175
|
this.tooltipEntry = data
|
|
2402
|
-
.filter(
|
|
2176
|
+
.filter(tooltip => tooltip.resource[0] in this.mapImp.pathways.paths)
|
|
2403
2177
|
.map((tooltip) => {
|
|
2404
|
-
return {
|
|
2405
|
-
title: tooltip.label,
|
|
2406
|
-
featureId: tooltip.resource,
|
|
2407
|
-
ready: false,
|
|
2408
|
-
}
|
|
2178
|
+
return { title: tooltip.label, featureId: tooltip.resource, ready: false }
|
|
2409
2179
|
})
|
|
2410
2180
|
// this should only for flatmap paths not all features
|
|
2411
2181
|
if (this.tooltipEntry.length) {
|
|
2412
|
-
this.$emit('connectivity-info-open', this.tooltipEntry)
|
|
2182
|
+
this.$emit('connectivity-info-open', this.tooltipEntry);
|
|
2413
2183
|
|
|
2414
2184
|
// While having placeholders displayed, get details for all paths and then replace.
|
|
2415
2185
|
for (let index = 0; index < data.length; index++) {
|
|
2416
2186
|
prom1.push(await this.getKnowledgeTooltip(data[index]))
|
|
2417
2187
|
}
|
|
2418
2188
|
this.tooltipEntry = await Promise.all(prom1)
|
|
2419
|
-
const featureIds = this.tooltipEntry.map(
|
|
2420
|
-
(tooltip) => tooltip.featureId[0]
|
|
2421
|
-
)
|
|
2189
|
+
const featureIds = this.tooltipEntry.map(tooltip => tooltip.featureId[0])
|
|
2422
2190
|
if (featureIds.length > 0) {
|
|
2423
2191
|
this.displayTooltip(featureIds)
|
|
2424
2192
|
}
|
|
@@ -2430,90 +2198,79 @@ export default {
|
|
|
2430
2198
|
* @param {Array} payload - The array of filter items to update.
|
|
2431
2199
|
*/
|
|
2432
2200
|
updateConnectivityFilters: function (payload) {
|
|
2433
|
-
if (!payload.length) return
|
|
2434
|
-
this.connectivityFilters = payload.filter(
|
|
2435
|
-
|
|
2436
|
-
)
|
|
2201
|
+
if (!payload.length) return;
|
|
2202
|
+
this.connectivityFilters = payload.filter((filterItem) => (
|
|
2203
|
+
filterItem.facet.toLowerCase() !== 'show all'
|
|
2204
|
+
));
|
|
2437
2205
|
},
|
|
2438
2206
|
resetConnectivityfilters: function (payload) {
|
|
2439
2207
|
if (payload.length) {
|
|
2440
2208
|
// remove not found items
|
|
2441
|
-
this.connectivityFilters = this.connectivityFilters.filter(
|
|
2442
|
-
(
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
connectivityfilter.facetPropPath &&
|
|
2447
|
-
notFoundItem.facet !== connectivityfilter.facet
|
|
2448
|
-
)
|
|
2209
|
+
this.connectivityFilters = this.connectivityFilters.filter((connectivityfilter) =>
|
|
2210
|
+
payload.some((notFoundItem) => (
|
|
2211
|
+
notFoundItem.facetPropPath === connectivityfilter.facetPropPath &&
|
|
2212
|
+
notFoundItem.facet !== connectivityfilter.facet
|
|
2213
|
+
))
|
|
2449
2214
|
)
|
|
2450
2215
|
} else {
|
|
2451
2216
|
// full reset
|
|
2452
|
-
this.connectivityFilters = []
|
|
2217
|
+
this.connectivityFilters = [];
|
|
2453
2218
|
}
|
|
2454
2219
|
},
|
|
2455
2220
|
getKnowledgeTooltip: async function (data) {
|
|
2456
2221
|
//require data.resource && data.feature.source
|
|
2457
|
-
const results =
|
|
2458
|
-
|
|
2459
|
-
this.mapImp,
|
|
2460
|
-
data
|
|
2461
|
-
)
|
|
2462
|
-
let tooltip = await this.flatmapQueries.createTooltipData(
|
|
2463
|
-
this.mapImp,
|
|
2464
|
-
data
|
|
2465
|
-
)
|
|
2466
|
-
|
|
2222
|
+
const results = await this.flatmapQueries.retrieveFlatmapKnowledgeForEvent(this.mapImp, data)
|
|
2223
|
+
let tooltip = await this.flatmapQueries.createTooltipData(this.mapImp, data)
|
|
2467
2224
|
// The line below only creates the tooltip if some data was found on the path
|
|
2468
2225
|
// the pubmed URLs are in knowledge response.references
|
|
2469
2226
|
if ((results && results[0]) || (data.feature.hyperlinks && data.feature.hyperlinks.length > 0)) {
|
|
2470
2227
|
tooltip['featuresAlert'] = normaliseAlertToStringArray(data.alert);
|
|
2471
2228
|
tooltip['knowledgeSource'] = getKnowledgeSource(this.mapImp);
|
|
2472
2229
|
// Map id and uuid to load connectivity information from the map
|
|
2473
|
-
tooltip['mapId'] = this.mapImp.mapMetadata.id
|
|
2474
|
-
tooltip['mapuuid'] = this.mapImp.mapMetadata.uuid
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
}
|
|
2515
|
-
tooltip['ready'] = true
|
|
2516
|
-
return tooltip
|
|
2230
|
+
tooltip['mapId'] = this.mapImp.mapMetadata.id;
|
|
2231
|
+
tooltip['mapuuid'] = this.mapImp.mapMetadata.uuid;
|
|
2232
|
+
// } else {
|
|
2233
|
+
// tooltip = {
|
|
2234
|
+
// ...tooltip,
|
|
2235
|
+
// origins: [data.label],
|
|
2236
|
+
// originsWithDatasets: [{ id: data.resource[0], name: data.label }],
|
|
2237
|
+
// components: [],
|
|
2238
|
+
// componentsWithDatasets: [],
|
|
2239
|
+
// destinations: [],
|
|
2240
|
+
// destinationsWithDatasets: [],
|
|
2241
|
+
// }
|
|
2242
|
+
// let featureIds = []
|
|
2243
|
+
// const pathsOfEntities = await this.mapImp.queryPathsForFeatures(data.resource)
|
|
2244
|
+
// if (pathsOfEntities.length) {
|
|
2245
|
+
// pathsOfEntities.forEach((path) => {
|
|
2246
|
+
// featureIds.push(...this.mapImp.pathModelNodes(path))
|
|
2247
|
+
// const searchResults = this.mapImp.search(path)
|
|
2248
|
+
// let featureId = undefined;
|
|
2249
|
+
// for (let i = 0; i < searchResults.results.length; i++) {
|
|
2250
|
+
// featureId = searchResults.results[i].featureId
|
|
2251
|
+
// const annotation = this.mapImp.annotation(featureId)
|
|
2252
|
+
// if (featureId && annotation?.label) break;
|
|
2253
|
+
// }
|
|
2254
|
+
// if (featureId) {
|
|
2255
|
+
// const feature = this.mapImp.featureProperties(featureId)
|
|
2256
|
+
// if (feature.label && !tooltip.components.includes(feature.label)) {
|
|
2257
|
+
// tooltip.components.push(feature.label)
|
|
2258
|
+
// tooltip.componentsWithDatasets.push({ id: feature.models, name: feature.label })
|
|
2259
|
+
// }
|
|
2260
|
+
// }
|
|
2261
|
+
// })
|
|
2262
|
+
// featureIds = [...new Set(featureIds)].filter(id => id !== data.feature.featureId)
|
|
2263
|
+
// featureIds.forEach((id) => {
|
|
2264
|
+
// const feature = this.mapImp.featureProperties(id)
|
|
2265
|
+
// if (feature.label && !tooltip.destinations.includes(feature.label)) {
|
|
2266
|
+
// tooltip.destinations.push(feature.label)
|
|
2267
|
+
// tooltip.destinationsWithDatasets.push({ id: feature.models, name: feature.label })
|
|
2268
|
+
// }
|
|
2269
|
+
// })
|
|
2270
|
+
// }
|
|
2271
|
+
}
|
|
2272
|
+
tooltip['ready'] = true;
|
|
2273
|
+
return tooltip;
|
|
2517
2274
|
},
|
|
2518
2275
|
/**
|
|
2519
2276
|
* A hack to remove flatmap tooltips while popup is open
|
|
@@ -2521,9 +2278,7 @@ export default {
|
|
|
2521
2278
|
popUpCssHacks: function () {
|
|
2522
2279
|
// Below is a hack to remove flatmap tooltips while popup is open
|
|
2523
2280
|
const ftooltip = document.querySelector('.flatmap-tooltip-popup')
|
|
2524
|
-
const popupCloseButton = document.querySelector(
|
|
2525
|
-
'.maplibregl-popup-close-button'
|
|
2526
|
-
)
|
|
2281
|
+
const popupCloseButton = document.querySelector('.maplibregl-popup-close-button')
|
|
2527
2282
|
if (ftooltip) ftooltip.style.display = 'none'
|
|
2528
2283
|
popupCloseButton.style.display = 'block'
|
|
2529
2284
|
this.$refs.tooltip.$el.style.display = 'flex'
|
|
@@ -2532,7 +2287,7 @@ export default {
|
|
|
2532
2287
|
* This event is emitted
|
|
2533
2288
|
* when a connectivity info (provenance popup) is closed.
|
|
2534
2289
|
*/
|
|
2535
|
-
this.$emit('connectivity-info-close')
|
|
2290
|
+
this.$emit('connectivity-info-close');
|
|
2536
2291
|
if (ftooltip) ftooltip.style.display = 'block'
|
|
2537
2292
|
}
|
|
2538
2293
|
},
|
|
@@ -2605,13 +2360,10 @@ export default {
|
|
|
2605
2360
|
'.maplibregl-ctrl-minimap'
|
|
2606
2361
|
)
|
|
2607
2362
|
if (minimapEl) {
|
|
2608
|
-
if (
|
|
2609
|
-
|
|
2610
|
-
this.$refs.minimapResize.$el.parentNode
|
|
2611
|
-
) {
|
|
2363
|
+
if (this.$refs.minimapResize &&
|
|
2364
|
+
this.$refs.minimapResize.$el.parentNode) {
|
|
2612
2365
|
this.$refs.minimapResize.$el.parentNode.removeChild(
|
|
2613
|
-
this.$refs.minimapResize.$el
|
|
2614
|
-
)
|
|
2366
|
+
this.$refs.minimapResize.$el)
|
|
2615
2367
|
}
|
|
2616
2368
|
minimapEl.appendChild(this.$refs.minimapResize.$el)
|
|
2617
2369
|
this.minimapResizeShow = true
|
|
@@ -2624,58 +2376,52 @@ export default {
|
|
|
2624
2376
|
* @arg {Boolean} `helpMode`
|
|
2625
2377
|
*/
|
|
2626
2378
|
setHelpMode: function (helpMode) {
|
|
2627
|
-
const toolTipsLength = this.hoverVisibilities.length
|
|
2628
|
-
const lastIndex = toolTipsLength - 1
|
|
2629
|
-
const activePopoverObj = this.hoverVisibilities[this.helpModeActiveIndex]
|
|
2379
|
+
const toolTipsLength = this.hoverVisibilities.length;
|
|
2380
|
+
const lastIndex = toolTipsLength - 1;
|
|
2381
|
+
const activePopoverObj = this.hoverVisibilities[this.helpModeActiveIndex];
|
|
2630
2382
|
|
|
2631
2383
|
if (activePopoverObj) {
|
|
2632
|
-
const popoverRefsId = activePopoverObj?.refs
|
|
2633
|
-
const popoverRefId = activePopoverObj?.ref
|
|
2634
|
-
const popoverRef =
|
|
2635
|
-
this.$refs[popoverRefsId ? popoverRefsId : popoverRefId]
|
|
2384
|
+
const popoverRefsId = activePopoverObj?.refs;
|
|
2385
|
+
const popoverRefId = activePopoverObj?.ref;
|
|
2386
|
+
const popoverRef = this.$refs[popoverRefsId ? popoverRefsId : popoverRefId];
|
|
2636
2387
|
|
|
2637
2388
|
if (popoverRef) {
|
|
2638
2389
|
// Open pathway drawer if the tooltip is inside or beside
|
|
2639
|
-
const { parentElement, nextElementSibling } = popoverRef.$el
|
|
2390
|
+
const { parentElement, nextElementSibling } = popoverRef.$el;
|
|
2640
2391
|
const isPathwayContainer = (element) => {
|
|
2641
|
-
return (
|
|
2642
|
-
element
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
}
|
|
2392
|
+
return element && (
|
|
2393
|
+
element.classList.contains('pathway-container') ||
|
|
2394
|
+
element.classList.contains('pathway-location')
|
|
2395
|
+
);
|
|
2396
|
+
};
|
|
2647
2397
|
|
|
2648
2398
|
if (
|
|
2649
2399
|
isPathwayContainer(parentElement) ||
|
|
2650
2400
|
isPathwayContainer(nextElementSibling)
|
|
2651
2401
|
) {
|
|
2652
2402
|
if (this.requiresDrawer) {
|
|
2653
|
-
this.drawerOpen = true
|
|
2403
|
+
this.drawerOpen = true;
|
|
2654
2404
|
} else {
|
|
2655
|
-
this.helpModeActiveIndex += 1
|
|
2405
|
+
this.helpModeActiveIndex += 1;
|
|
2656
2406
|
}
|
|
2657
2407
|
}
|
|
2658
2408
|
} else {
|
|
2659
2409
|
// skip the unavailable tooltips
|
|
2660
|
-
this.helpModeActiveIndex += 1
|
|
2661
|
-
this.setHelpMode(helpMode)
|
|
2410
|
+
this.helpModeActiveIndex += 1;
|
|
2411
|
+
this.setHelpMode(helpMode);
|
|
2662
2412
|
}
|
|
2663
2413
|
}
|
|
2664
2414
|
|
|
2665
2415
|
// Skip checkbox tooltip if pathway filter is not shown
|
|
2666
|
-
const activePopoverObjAfter =
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
!this.showPathwayFilter
|
|
2671
|
-
) {
|
|
2672
|
-
this.helpModeActiveIndex += 1
|
|
2673
|
-
this.setHelpMode(helpMode)
|
|
2416
|
+
const activePopoverObjAfter = this.hoverVisibilities[this.helpModeActiveIndex];
|
|
2417
|
+
if (activePopoverObjAfter?.ref === 'checkBoxPopover' && !this.showPathwayFilter) {
|
|
2418
|
+
this.helpModeActiveIndex += 1;
|
|
2419
|
+
this.setHelpMode(helpMode);
|
|
2674
2420
|
}
|
|
2675
2421
|
|
|
2676
2422
|
if (!helpMode) {
|
|
2677
2423
|
// reset to iniital state
|
|
2678
|
-
this.helpModeActiveIndex = this.helpModeInitialIndex
|
|
2424
|
+
this.helpModeActiveIndex = this.helpModeInitialIndex;
|
|
2679
2425
|
}
|
|
2680
2426
|
|
|
2681
2427
|
if (this.viewingMode !== 'Annotation' && this.helpModeActiveIndex > 9) {
|
|
@@ -2686,34 +2432,31 @@ export default {
|
|
|
2686
2432
|
/**
|
|
2687
2433
|
* This event is emitted when the tooltips in help mode reach the last item.
|
|
2688
2434
|
*/
|
|
2689
|
-
this.$emit('help-mode-last-item', true)
|
|
2435
|
+
this.$emit('help-mode-last-item', true);
|
|
2690
2436
|
}
|
|
2691
2437
|
|
|
2692
2438
|
if (helpMode && !this.helpModeDialog) {
|
|
2693
|
-
this.inHelp = true
|
|
2439
|
+
this.inHelp = true;
|
|
2694
2440
|
this.hoverVisibilities.forEach((item) => {
|
|
2695
|
-
item.value = true
|
|
2696
|
-
})
|
|
2697
|
-
} else if (
|
|
2698
|
-
|
|
2699
|
-
this.helpModeDialog &&
|
|
2700
|
-
toolTipsLength > this.helpModeActiveIndex
|
|
2701
|
-
) {
|
|
2441
|
+
item.value = true;
|
|
2442
|
+
});
|
|
2443
|
+
} else if (helpMode && this.helpModeDialog && toolTipsLength > this.helpModeActiveIndex) {
|
|
2444
|
+
|
|
2702
2445
|
// Show the map tooltip as first item
|
|
2703
2446
|
if (this.helpModeActiveIndex > -1) {
|
|
2704
|
-
this.closeFlatmapHelpPopup()
|
|
2447
|
+
this.closeFlatmapHelpPopup();
|
|
2705
2448
|
|
|
2706
2449
|
// wait for CSS transition
|
|
2707
2450
|
setTimeout(() => {
|
|
2708
|
-
this.inHelp = false
|
|
2451
|
+
this.inHelp = false;
|
|
2709
2452
|
this.hoverVisibilities.forEach((item) => {
|
|
2710
|
-
item.value = false
|
|
2711
|
-
})
|
|
2453
|
+
item.value = false;
|
|
2454
|
+
});
|
|
2712
2455
|
|
|
2713
|
-
this.showTooltip(this.helpModeActiveIndex, 200)
|
|
2714
|
-
}, 300)
|
|
2456
|
+
this.showTooltip(this.helpModeActiveIndex, 200);
|
|
2457
|
+
}, 300);
|
|
2715
2458
|
} else if (this.helpModeActiveIndex === -1) {
|
|
2716
|
-
this.openFlatmapHelpPopup()
|
|
2459
|
+
this.openFlatmapHelpPopup();
|
|
2717
2460
|
}
|
|
2718
2461
|
} else {
|
|
2719
2462
|
this.inHelp = false
|
|
@@ -2738,7 +2481,7 @@ export default {
|
|
|
2738
2481
|
/**
|
|
2739
2482
|
* This event is emitted after a tooltip in Flatmap is shown.
|
|
2740
2483
|
*/
|
|
2741
|
-
this.$emit('shown-tooltip')
|
|
2484
|
+
this.$emit('shown-tooltip');
|
|
2742
2485
|
}, timeout)
|
|
2743
2486
|
}
|
|
2744
2487
|
},
|
|
@@ -2767,7 +2510,6 @@ export default {
|
|
|
2767
2510
|
*/
|
|
2768
2511
|
displayTooltip: function (feature, geometry = undefined) {
|
|
2769
2512
|
let featureId = undefined
|
|
2770
|
-
console.log('Displaying tooltip for feature:', feature)
|
|
2771
2513
|
let options = { className: 'flatmapvuer-popover' }
|
|
2772
2514
|
if (geometry) {
|
|
2773
2515
|
featureId = feature
|
|
@@ -2775,7 +2517,7 @@ export default {
|
|
|
2775
2517
|
if (this.annotationEntry.length) {
|
|
2776
2518
|
options['annotationEvent'] = {
|
|
2777
2519
|
type: this.annotationEntry[0].type,
|
|
2778
|
-
feature: this.annotationEntry[0].feature
|
|
2520
|
+
feature: this.annotationEntry[0].feature
|
|
2779
2521
|
}
|
|
2780
2522
|
}
|
|
2781
2523
|
} else {
|
|
@@ -2790,19 +2532,15 @@ export default {
|
|
|
2790
2532
|
// If connectivityInfoSidebar is set to `true`
|
|
2791
2533
|
// Connectivity info will show in sidebar
|
|
2792
2534
|
if (
|
|
2793
|
-
this.connectivityInfoSidebar &&
|
|
2794
|
-
this.tooltipEntry.length &&
|
|
2535
|
+
(this.connectivityInfoSidebar && this.tooltipEntry.length) &&
|
|
2795
2536
|
this.viewingMode !== 'Annotation'
|
|
2796
2537
|
) {
|
|
2797
2538
|
if (this.checkConnectivityTooltipEntry(this.tooltipEntry)) {
|
|
2798
|
-
this.$emit('connectivity-info-open', this.tooltipEntry)
|
|
2539
|
+
this.$emit('connectivity-info-open', this.tooltipEntry);
|
|
2799
2540
|
}
|
|
2800
2541
|
}
|
|
2801
2542
|
if (this.annotationSidebar && this.viewingMode === 'Annotation') {
|
|
2802
|
-
this.$emit('annotation-open', {
|
|
2803
|
-
annotationEntry: this.annotationEntry,
|
|
2804
|
-
commitCallback: this.commitAnnotationEvent,
|
|
2805
|
-
})
|
|
2543
|
+
this.$emit('annotation-open', {annotationEntry: this.annotationEntry, commitCallback: this.commitAnnotationEvent});
|
|
2806
2544
|
}
|
|
2807
2545
|
// If UI is not disabled,
|
|
2808
2546
|
// And connectivityInfoSidebar is not set (default) or set to `false`
|
|
@@ -2811,14 +2549,16 @@ export default {
|
|
|
2811
2549
|
if (
|
|
2812
2550
|
featureId &&
|
|
2813
2551
|
!this.disableUI &&
|
|
2814
|
-
(
|
|
2815
|
-
(this.viewingMode === '
|
|
2552
|
+
(
|
|
2553
|
+
(this.viewingMode === 'Annotation' && !this.annotationSidebar) ||
|
|
2554
|
+
(this.viewingMode === 'Exploration' && !this.connectivityInfoSidebar)
|
|
2555
|
+
)
|
|
2816
2556
|
) {
|
|
2817
|
-
this.tooltipDisplay = true
|
|
2557
|
+
this.tooltipDisplay = true;
|
|
2818
2558
|
this.$nextTick(() => {
|
|
2819
|
-
this.mapImp.showPopup(featureId, this.$refs.tooltip.$el, options)
|
|
2820
|
-
this.popUpCssHacks()
|
|
2821
|
-
})
|
|
2559
|
+
this.mapImp.showPopup(featureId, this.$refs.tooltip.$el, options);
|
|
2560
|
+
this.popUpCssHacks();
|
|
2561
|
+
});
|
|
2822
2562
|
}
|
|
2823
2563
|
},
|
|
2824
2564
|
/**
|
|
@@ -2827,18 +2567,18 @@ export default {
|
|
|
2827
2567
|
* because the sidebar is opened
|
|
2828
2568
|
* @arg featureIds
|
|
2829
2569
|
*/
|
|
2830
|
-
|
|
2570
|
+
moveMap: function (featureIds, options = {}) {
|
|
2831
2571
|
if (this.mapImp) {
|
|
2832
|
-
const { offsetX = 0, offsetY = 0, zoom = 4 } = options
|
|
2833
|
-
const Map = this.mapImp.map
|
|
2834
|
-
const bbox = this.mapImp.bounds.toArray()
|
|
2572
|
+
const { offsetX = 0, offsetY = 0, zoom = 4 } = options;
|
|
2573
|
+
const Map = this.mapImp.map;
|
|
2574
|
+
const bbox = this.mapImp.bounds.toArray();
|
|
2835
2575
|
|
|
2836
2576
|
// Zoom the map to features first
|
|
2837
|
-
this.mapImp.zoomToFeatures(featureIds, { noZoomIn: true })
|
|
2577
|
+
this.mapImp.zoomToFeatures(featureIds, { noZoomIn: true });
|
|
2838
2578
|
|
|
2839
2579
|
// Hide the left pathway drawer
|
|
2840
2580
|
// to get more space for the map
|
|
2841
|
-
this.showPathwaysDrawer(false)
|
|
2581
|
+
this.showPathwaysDrawer(false);
|
|
2842
2582
|
|
|
2843
2583
|
// Move the map to left side
|
|
2844
2584
|
// since the sidebar is taking space on the right
|
|
@@ -2847,9 +2587,9 @@ export default {
|
|
|
2847
2587
|
Map.fitBounds(bbox, {
|
|
2848
2588
|
offset: [offsetX, offsetY],
|
|
2849
2589
|
zoom: zoom,
|
|
2850
|
-
animate: true
|
|
2851
|
-
})
|
|
2852
|
-
})
|
|
2590
|
+
animate: true
|
|
2591
|
+
});
|
|
2592
|
+
});
|
|
2853
2593
|
}
|
|
2854
2594
|
}
|
|
2855
2595
|
},
|
|
@@ -2869,7 +2609,7 @@ export default {
|
|
|
2869
2609
|
/**
|
|
2870
2610
|
* This event is emitted after a tooltip on Flatmap's map is shown.
|
|
2871
2611
|
*/
|
|
2872
|
-
this.$emit('shown-map-tooltip')
|
|
2612
|
+
this.$emit('shown-map-tooltip');
|
|
2873
2613
|
}
|
|
2874
2614
|
}
|
|
2875
2615
|
},
|
|
@@ -2904,19 +2644,16 @@ export default {
|
|
|
2904
2644
|
*/
|
|
2905
2645
|
getVisibilityState: function (state) {
|
|
2906
2646
|
const refs = ['alertSelection', 'pathwaysSelection', 'taxonSelection']
|
|
2907
|
-
refs.forEach(
|
|
2647
|
+
refs.forEach(ref => {
|
|
2908
2648
|
let comp = this.$refs[ref]
|
|
2909
2649
|
if (comp) {
|
|
2910
2650
|
state[ref] = comp.getState()
|
|
2911
2651
|
}
|
|
2912
2652
|
})
|
|
2913
2653
|
if (this.$refs.treeControls) {
|
|
2914
|
-
const checkedKeys =
|
|
2915
|
-
this.$refs.treeControls.$refs.regionTree.getCheckedKeys()
|
|
2654
|
+
const checkedKeys = this.$refs.treeControls.$refs.regionTree.getCheckedKeys();
|
|
2916
2655
|
//Only store first level systems (terms without .)
|
|
2917
|
-
state['systemsSelection'] = checkedKeys.filter(
|
|
2918
|
-
(term) => !term.includes('.')
|
|
2919
|
-
)
|
|
2656
|
+
state['systemsSelection'] = checkedKeys.filter(term => !term.includes('.'))
|
|
2920
2657
|
}
|
|
2921
2658
|
},
|
|
2922
2659
|
/**
|
|
@@ -2925,7 +2662,7 @@ export default {
|
|
|
2925
2662
|
*/
|
|
2926
2663
|
setVisibilityState: function (state) {
|
|
2927
2664
|
const refs = ['alertSelection', 'pathwaysSelection', 'taxonSelection']
|
|
2928
|
-
refs.forEach(
|
|
2665
|
+
refs.forEach(ref => {
|
|
2929
2666
|
const settings = state[ref]
|
|
2930
2667
|
if (settings) {
|
|
2931
2668
|
const comp = this.$refs[ref]
|
|
@@ -2936,14 +2673,9 @@ export default {
|
|
|
2936
2673
|
})
|
|
2937
2674
|
if ('systemsSelection' in state) {
|
|
2938
2675
|
if (this.$refs.treeControls) {
|
|
2939
|
-
this.$refs.treeControls.$refs.regionTree.setCheckedKeys(
|
|
2940
|
-
state['systemsSelection']
|
|
2941
|
-
)
|
|
2676
|
+
this.$refs.treeControls.$refs.regionTree.setCheckedKeys(state['systemsSelection']);
|
|
2942
2677
|
this.systems[0].children.forEach((item) => {
|
|
2943
|
-
this.mapImp.enableSystem(
|
|
2944
|
-
item.key,
|
|
2945
|
-
state['systemsSelection'].includes(item.key)
|
|
2946
|
-
)
|
|
2678
|
+
this.mapImp.enableSystem(item.key, state['systemsSelection'].includes(item.key))
|
|
2947
2679
|
})
|
|
2948
2680
|
}
|
|
2949
2681
|
}
|
|
@@ -2970,9 +2702,7 @@ export default {
|
|
|
2970
2702
|
state['outlines'] = this.outlinesRadio
|
|
2971
2703
|
state['background'] = this.currentBackground
|
|
2972
2704
|
if (this.offlineAnnotationEnabled) {
|
|
2973
|
-
state['offlineAnnotations'] = sessionStorage.getItem(
|
|
2974
|
-
'anonymous-annotation'
|
|
2975
|
-
)
|
|
2705
|
+
state['offlineAnnotations'] = sessionStorage.getItem('anonymous-annotation')
|
|
2976
2706
|
}
|
|
2977
2707
|
this.getVisibilityState(state)
|
|
2978
2708
|
return state
|
|
@@ -3009,10 +2739,7 @@ export default {
|
|
|
3009
2739
|
if (state) {
|
|
3010
2740
|
if (state.viewport) this.mapImp.setState(state.viewport)
|
|
3011
2741
|
if (state.offlineAnnotations) {
|
|
3012
|
-
sessionStorage.setItem(
|
|
3013
|
-
'anonymous-annotation',
|
|
3014
|
-
state.offlineAnnotations
|
|
3015
|
-
)
|
|
2742
|
+
sessionStorage.setItem('anonymous-annotation', state.offlineAnnotations)
|
|
3016
2743
|
}
|
|
3017
2744
|
if (state.viewingMode) this.changeViewingMode(state.viewingMode)
|
|
3018
2745
|
//The following three are boolean
|
|
@@ -3036,10 +2763,7 @@ export default {
|
|
|
3036
2763
|
*/
|
|
3037
2764
|
setFlightPathInfo: function (mapVersion) {
|
|
3038
2765
|
const mapVersionForFlightPath = 1.6
|
|
3039
|
-
if (
|
|
3040
|
-
mapVersion === mapVersionForFlightPath ||
|
|
3041
|
-
mapVersion > mapVersionForFlightPath
|
|
3042
|
-
) {
|
|
2766
|
+
if (mapVersion === mapVersionForFlightPath || mapVersion > mapVersionForFlightPath) {
|
|
3043
2767
|
// Show flight path option UI
|
|
3044
2768
|
this.displayFlightPathOption = true
|
|
3045
2769
|
// Show 2D as default on FC type
|
|
@@ -3085,10 +2809,10 @@ export default {
|
|
|
3085
2809
|
identifier.taxon = state.entry
|
|
3086
2810
|
}
|
|
3087
2811
|
if (state.biologicalSex) {
|
|
3088
|
-
|
|
2812
|
+
identifier['biologicalSex'] = state.biologicalSex;
|
|
3089
2813
|
} else if (identifier.taxon === 'NCBITaxon:9606') {
|
|
3090
2814
|
//For backward compatibility
|
|
3091
|
-
identifier['biologicalSex'] = 'PATO:0000384'
|
|
2815
|
+
identifier['biologicalSex'] = 'PATO:0000384';
|
|
3092
2816
|
}
|
|
3093
2817
|
} else {
|
|
3094
2818
|
// Set the bioloicalSex now if map is not resumed from
|
|
@@ -3112,52 +2836,48 @@ export default {
|
|
|
3112
2836
|
tooltipDelay: 15, // new feature to delay tooltips showing
|
|
3113
2837
|
}
|
|
3114
2838
|
)
|
|
3115
|
-
promise1
|
|
3116
|
-
.
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
this.flatmapError =
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
|
|
3136
|
-
)
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
|
|
3141
|
-
|
|
3142
|
-
|
|
3143
|
-
|
|
3144
|
-
|
|
3145
|
-
|
|
3146
|
-
|
|
3147
|
-
|
|
3148
|
-
|
|
3149
|
-
text: 'Load Default Map',
|
|
3150
|
-
callback: () => {
|
|
3151
|
-
const defaultSpecies = multiFlatmapVuer.initial
|
|
3152
|
-
multiFlatmapVuer.setSpecies(defaultSpecies, undefined, 3)
|
|
3153
|
-
},
|
|
2839
|
+
promise1.then((returnedObject) => {
|
|
2840
|
+
this.mapImp = returnedObject
|
|
2841
|
+
this.serverURL = this.mapImp.makeServerUrl('').slice(0, -1)
|
|
2842
|
+
let mapVersion = this.mapImp.details.version
|
|
2843
|
+
this.setFlightPathInfo(mapVersion)
|
|
2844
|
+
const stateToSet = this._stateToBeSet ? this._stateToBeSet : state
|
|
2845
|
+
this.onFlatmapReady(stateToSet)
|
|
2846
|
+
this.$nextTick(() => this.restoreMapState(stateToSet))
|
|
2847
|
+
}).catch((error) => {
|
|
2848
|
+
console.error('Flatmap loading error:', error)
|
|
2849
|
+
// prepare error object
|
|
2850
|
+
this.flatmapError = {};
|
|
2851
|
+
if (error.message && error.message.indexOf('Unknown map') !== -1) {
|
|
2852
|
+
this.flatmapError['title'] = 'Unknown Map!';
|
|
2853
|
+
this.flatmapError['messages'] = Object.keys(identifier).map(key => {
|
|
2854
|
+
const keyName = key === 'uuid' ? 'UUID' : capitalise(key);
|
|
2855
|
+
return `${keyName}: ${identifier[key]}`
|
|
2856
|
+
});
|
|
2857
|
+
} else {
|
|
2858
|
+
this.flatmapError['title'] = 'Error Loading Map!';
|
|
2859
|
+
this.flatmapError['messages'] = [
|
|
2860
|
+
error.message ? error.message : error.toString(),
|
|
2861
|
+
'Please try again later or contact support if the problem persists.'
|
|
2862
|
+
];
|
|
2863
|
+
}
|
|
2864
|
+
if (this.$parent?.$refs?.multiContainer) {
|
|
2865
|
+
// if the flatmap is in a multiflatmapvuer
|
|
2866
|
+
// show a button to load default map
|
|
2867
|
+
const multiFlatmapVuer = this.$parent;
|
|
2868
|
+
this.flatmapError['button'] = {
|
|
2869
|
+
text: 'Load Default Map',
|
|
2870
|
+
callback: () => {
|
|
2871
|
+
const defaultSpecies = multiFlatmapVuer.initial;
|
|
2872
|
+
multiFlatmapVuer.setSpecies(defaultSpecies, undefined, 3);
|
|
3154
2873
|
}
|
|
3155
|
-
}
|
|
3156
|
-
|
|
3157
|
-
|
|
2874
|
+
};
|
|
2875
|
+
}
|
|
2876
|
+
this.loading = false;
|
|
2877
|
+
})
|
|
3158
2878
|
} else if (state) {
|
|
3159
2879
|
this._stateToBeSet = {
|
|
3160
|
-
...state
|
|
2880
|
+
...state
|
|
3161
2881
|
}
|
|
3162
2882
|
if (this.mapImp && !this.loading) {
|
|
3163
2883
|
this.restoreMapState(this._stateToBeSet)
|
|
@@ -3199,7 +2919,7 @@ export default {
|
|
|
3199
2919
|
let filterSourcesMap = new Map()
|
|
3200
2920
|
for (const annotation of this.mapImp.annotations.values()) {
|
|
3201
2921
|
if (annotation.source) {
|
|
3202
|
-
if (
|
|
2922
|
+
if ("alert" in annotation) {
|
|
3203
2923
|
withAlert.add(annotation.source)
|
|
3204
2924
|
} else {
|
|
3205
2925
|
withoutAlert.add(annotation.source)
|
|
@@ -3216,7 +2936,7 @@ export default {
|
|
|
3216
2936
|
sourceMap.set(setKey, new Set())
|
|
3217
2937
|
}
|
|
3218
2938
|
sourceMap.get(setKey).add(`${annotation.source}`)
|
|
3219
|
-
}
|
|
2939
|
+
};
|
|
3220
2940
|
if (Array.isArray(value)) {
|
|
3221
2941
|
value.forEach(addToSourceMap)
|
|
3222
2942
|
} else {
|
|
@@ -3227,10 +2947,10 @@ export default {
|
|
|
3227
2947
|
}
|
|
3228
2948
|
}
|
|
3229
2949
|
let filterSources = {
|
|
3230
|
-
alert: {
|
|
3231
|
-
with: [...withAlert],
|
|
3232
|
-
without: [...withoutAlert]
|
|
3233
|
-
}
|
|
2950
|
+
'alert': {
|
|
2951
|
+
'with': [...withAlert],
|
|
2952
|
+
'without': [...withoutAlert]
|
|
2953
|
+
}
|
|
3234
2954
|
}
|
|
3235
2955
|
for (const [key, value] of filterSourcesMap.entries()) {
|
|
3236
2956
|
filterSources[key] = {}
|
|
@@ -3241,15 +2961,10 @@ export default {
|
|
|
3241
2961
|
return filterSources
|
|
3242
2962
|
},
|
|
3243
2963
|
getFilterOptions: async function (mapImp, _providedKnowledge) {
|
|
3244
|
-
const providedKnowledge = _providedKnowledge || this.getFlatmapKnowledge()
|
|
3245
|
-
const providedPathways = this.pathways
|
|
3246
|
-
const flatmapFilterOptions = await getFlatmapFilterOptions(
|
|
3247
|
-
|
|
3248
|
-
mapImp,
|
|
3249
|
-
providedKnowledge,
|
|
3250
|
-
providedPathways
|
|
3251
|
-
)
|
|
3252
|
-
return flatmapFilterOptions
|
|
2964
|
+
const providedKnowledge = _providedKnowledge || this.getFlatmapKnowledge();
|
|
2965
|
+
const providedPathways = this.pathways;
|
|
2966
|
+
const flatmapFilterOptions = await getFlatmapFilterOptions(this.flatmapAPI, mapImp, providedKnowledge, providedPathways);
|
|
2967
|
+
return flatmapFilterOptions;
|
|
3253
2968
|
},
|
|
3254
2969
|
/**
|
|
3255
2970
|
* @public
|
|
@@ -3257,40 +2972,33 @@ export default {
|
|
|
3257
2972
|
*/
|
|
3258
2973
|
onFlatmapReady: function (state) {
|
|
3259
2974
|
// onFlatmapReady is used for functions that need to run immediately after the flatmap is loaded
|
|
3260
|
-
this.sensor = markRaw(
|
|
3261
|
-
new ResizeSensor(this.$refs.display, this.mapResize)
|
|
3262
|
-
)
|
|
2975
|
+
this.sensor = markRaw(new ResizeSensor(this.$refs.display, this.mapResize))
|
|
3263
2976
|
if (this.mapImp.options?.style === 'functional') {
|
|
3264
2977
|
this.isFC = true
|
|
3265
2978
|
}
|
|
3266
2979
|
this.mapImp.setBackgroundOpacity(1)
|
|
3267
2980
|
this.backgroundChangeCallback(this.currentBackground)
|
|
3268
2981
|
this.pathways = this.mapImp.pathTypes()
|
|
3269
|
-
this.pathways = this.pathways.filter(
|
|
2982
|
+
this.pathways = this.pathways.filter(path => {
|
|
3270
2983
|
return path.enabled && path.type !== 'other'
|
|
3271
2984
|
})
|
|
3272
2985
|
//Disable layers for now
|
|
3273
2986
|
//this.layers = this.mapImp.getLayers();
|
|
3274
2987
|
this.processSystems(this.mapImp.getSystems())
|
|
3275
2988
|
//Async, pass the state for checking
|
|
3276
|
-
this.processTaxon(
|
|
3277
|
-
|
|
3278
|
-
state ? state['taxonSelection'] : undefined
|
|
3279
|
-
)
|
|
3280
|
-
|
|
3281
|
-
this.containsAlert = 'alert' in this.mapImp.featureFilterRanges()
|
|
2989
|
+
this.processTaxon(this.mapImp.taxonIdentifiers, state ? state['taxonSelection'] : undefined)
|
|
2990
|
+
this.containsAlert = "alert" in this.mapImp.featureFilterRanges()
|
|
3282
2991
|
this.flatmapLegends = this.mapImp.flatmapLegend
|
|
3283
2992
|
this.loading = false
|
|
3284
2993
|
this.computePathControlsMaximumHeight()
|
|
3285
2994
|
this.mapResize()
|
|
3286
|
-
this.handleMapClick()
|
|
3287
|
-
this.setInitMapState()
|
|
2995
|
+
this.handleMapClick();
|
|
2996
|
+
this.setInitMapState();
|
|
3288
2997
|
if (this.displayMinimap) {
|
|
3289
|
-
const minimapOptions = { position: 'top-right' }
|
|
3290
|
-
this.mapImp.createMinimap(minimapOptions)
|
|
2998
|
+
const minimapOptions = { position: 'top-right' };
|
|
2999
|
+
this.mapImp.createMinimap(minimapOptions);
|
|
3291
3000
|
this.addResizeButtonToMinimap()
|
|
3292
3001
|
}
|
|
3293
|
-
this.currentFlatmapUuid = this.mapImp?.mapMetadata?.uuid
|
|
3294
3002
|
/**
|
|
3295
3003
|
* This is ``onFlatmapReady`` event.
|
|
3296
3004
|
* @arg ``this`` (Component Vue Instance)
|
|
@@ -3303,35 +3011,33 @@ export default {
|
|
|
3303
3011
|
* after the map is loaded.
|
|
3304
3012
|
*/
|
|
3305
3013
|
handleMapClick: function () {
|
|
3306
|
-
const _map = this.mapImp.map
|
|
3014
|
+
const _map = this.mapImp.map;
|
|
3307
3015
|
if (_map) {
|
|
3308
3016
|
_map.on('click', (e) => {
|
|
3309
3017
|
if (!this.connectivityDataSource) {
|
|
3310
|
-
this.$emit('connectivity-info-close')
|
|
3018
|
+
this.$emit('connectivity-info-close');
|
|
3311
3019
|
}
|
|
3312
|
-
this.connectivityDataSource = '' // reset
|
|
3313
|
-
})
|
|
3020
|
+
this.connectivityDataSource = ''; // reset
|
|
3021
|
+
});
|
|
3314
3022
|
}
|
|
3315
3023
|
},
|
|
3316
|
-
onContextLost: function
|
|
3024
|
+
onContextLost: function() {
|
|
3317
3025
|
this.lastViewport = markRaw(this.mapImp.getState())
|
|
3318
|
-
this.flatmapError = {}
|
|
3026
|
+
this.flatmapError = {};
|
|
3319
3027
|
this.flatmapError['title'] = 'GL context lost!'
|
|
3320
|
-
this.flatmapError['messages'] = [
|
|
3321
|
-
`A display issue has occurred due
|
|
3028
|
+
this.flatmapError['messages'] = [`A display issue has occurred due
|
|
3322
3029
|
to a limit on available WebGL contexts. You can restore the display
|
|
3323
3030
|
using the Restore Context button. Please see the
|
|
3324
3031
|
<a href="https://docs.sparc.science/docs/integrated-maps-viewer-overview#limit-on-available-webgl-contexts" target='_blank'>documentation</a>
|
|
3325
|
-
for more details
|
|
3326
|
-
]
|
|
3032
|
+
for more details.`]
|
|
3327
3033
|
this.flatmapError['button'] = {
|
|
3328
3034
|
text: 'Restore Context',
|
|
3329
3035
|
callback: () => {
|
|
3330
3036
|
this.forceContextRestore()
|
|
3331
|
-
}
|
|
3332
|
-
}
|
|
3037
|
+
}
|
|
3038
|
+
};
|
|
3333
3039
|
},
|
|
3334
|
-
onContextRestored: function
|
|
3040
|
+
onContextRestored: function() {
|
|
3335
3041
|
if (this.mapImp) {
|
|
3336
3042
|
this.handleMapClick()
|
|
3337
3043
|
this.setInitMapState()
|
|
@@ -3341,8 +3047,8 @@ export default {
|
|
|
3341
3047
|
}
|
|
3342
3048
|
this.restoreMapState(lostState)
|
|
3343
3049
|
if (this.displayMinimap) {
|
|
3344
|
-
const minimapOptions = { position: 'top-right' }
|
|
3345
|
-
this.mapImp.createMinimap(minimapOptions)
|
|
3050
|
+
const minimapOptions = { position: 'top-right' };
|
|
3051
|
+
this.mapImp.createMinimap(minimapOptions);
|
|
3346
3052
|
this.addResizeButtonToMinimap()
|
|
3347
3053
|
}
|
|
3348
3054
|
if (this.filterToRestore) {
|
|
@@ -3373,23 +3079,23 @@ export default {
|
|
|
3373
3079
|
if (this.mapImp) {
|
|
3374
3080
|
if (term === undefined || term === '') {
|
|
3375
3081
|
this.mapImp.clearSearchResults()
|
|
3376
|
-
if (this.viewingMode ===
|
|
3377
|
-
this.$emit('connectivity-info-close')
|
|
3378
|
-
} else if (this.viewingMode ===
|
|
3082
|
+
if (this.viewingMode === "Exploration") {
|
|
3083
|
+
this.$emit('connectivity-info-close');
|
|
3084
|
+
} else if (this.viewingMode === "Annotation") {
|
|
3379
3085
|
this.manualAbortedOnClose()
|
|
3380
3086
|
}
|
|
3381
|
-
this.searchTerm =
|
|
3087
|
+
this.searchTerm = ""
|
|
3382
3088
|
return true
|
|
3383
3089
|
} else {
|
|
3384
3090
|
const searchResults = this.mapImp.search(term)
|
|
3385
3091
|
if (searchResults?.results?.length) {
|
|
3386
3092
|
this.mapImp.showSearchResults(searchResults)
|
|
3387
3093
|
if (displayInfo) {
|
|
3388
|
-
let featureId = undefined
|
|
3094
|
+
let featureId = undefined;
|
|
3389
3095
|
for (let i = 0; i < searchResults.results.length; i++) {
|
|
3390
3096
|
featureId = searchResults.results[i].featureId
|
|
3391
3097
|
const annotation = this.mapImp.annotation(featureId)
|
|
3392
|
-
if (featureId && annotation?.label) break
|
|
3098
|
+
if (featureId && annotation?.label) break;
|
|
3393
3099
|
}
|
|
3394
3100
|
if (featureId) {
|
|
3395
3101
|
const feature = this.mapImp.featureProperties(featureId)
|
|
@@ -3425,13 +3131,10 @@ export default {
|
|
|
3425
3131
|
highlightConnectedPaths: function (paths) {
|
|
3426
3132
|
if (paths.length) {
|
|
3427
3133
|
// filter paths for this map
|
|
3428
|
-
const filteredPaths = paths.filter(
|
|
3429
|
-
(path) => path in this.mapImp.pathways.paths
|
|
3430
|
-
)
|
|
3134
|
+
const filteredPaths = paths.filter(path => (path in this.mapImp.pathways.paths))
|
|
3431
3135
|
// this.zoomToFeatures is replaced with selectGeoJSONFeatures to highlight paths
|
|
3432
|
-
const featureIdsToHighlight =
|
|
3433
|
-
|
|
3434
|
-
this.mapImp.selectGeoJSONFeatures(featureIdsToHighlight)
|
|
3136
|
+
const featureIdsToHighlight = this.mapImp.modelFeatureIdList(filteredPaths);
|
|
3137
|
+
this.mapImp.selectGeoJSONFeatures(featureIdsToHighlight);
|
|
3435
3138
|
}
|
|
3436
3139
|
},
|
|
3437
3140
|
/**
|
|
@@ -3448,167 +3151,7 @@ export default {
|
|
|
3448
3151
|
EventBus.emit('onActionClick', data)
|
|
3449
3152
|
},
|
|
3450
3153
|
setConnectionType: function (type) {
|
|
3451
|
-
this.connectionType = type
|
|
3452
|
-
},
|
|
3453
|
-
/**
|
|
3454
|
-
* Main function to coordinate fetching dataset info and processing files.
|
|
3455
|
-
*/
|
|
3456
|
-
async fetchFlatmapProtocols(uuid) {
|
|
3457
|
-
const cacheKey = `flatmap_dataset_${uuid}`
|
|
3458
|
-
|
|
3459
|
-
// Try to get from cache first
|
|
3460
|
-
// console.log('------- caching temporary disabled for debugging -------')
|
|
3461
|
-
// const cachedData = null
|
|
3462
|
-
const cachedData = this.getSessionCache(cacheKey)
|
|
3463
|
-
if (cachedData) {
|
|
3464
|
-
this.datasetInfo = cachedData
|
|
3465
|
-
this.processDatasetFiles(cachedData)
|
|
3466
|
-
return
|
|
3467
|
-
}
|
|
3468
|
-
|
|
3469
|
-
// If not in cache, call the API
|
|
3470
|
-
const apiLocation = this.sparcAPI
|
|
3471
|
-
if (!apiLocation) {
|
|
3472
|
-
console.warn('VITE_API_LOCATION is not defined.')
|
|
3473
|
-
return
|
|
3474
|
-
}
|
|
3475
|
-
|
|
3476
|
-
try {
|
|
3477
|
-
console.log('Fetching dataset info from API...')
|
|
3478
|
-
// Ensure the URL matches your backend route structure
|
|
3479
|
-
const response = await fetch(`${apiLocation}flatmap/uuid?uuid=${uuid}`)
|
|
3480
|
-
|
|
3481
|
-
let data = undefined;
|
|
3482
|
-
|
|
3483
|
-
if (!response.ok) {
|
|
3484
|
-
if (this.testDataLocation) {
|
|
3485
|
-
data = await retrieveOmexData(this.testDataLocation, uuid)
|
|
3486
|
-
}
|
|
3487
|
-
} else {
|
|
3488
|
-
data = await response.json()
|
|
3489
|
-
}
|
|
3490
|
-
|
|
3491
|
-
if (!data) {
|
|
3492
|
-
throw new Error(`No protocol data available for map`)
|
|
3493
|
-
}
|
|
3494
|
-
|
|
3495
|
-
// Save to cache and process
|
|
3496
|
-
|
|
3497
|
-
this.setSessionCache(cacheKey, data)
|
|
3498
|
-
this.datasetInfo = data
|
|
3499
|
-
this.processDatasetFiles(data)
|
|
3500
|
-
} catch (error) {
|
|
3501
|
-
console.error('Error fetching flatmap protocols:', error)
|
|
3502
|
-
}
|
|
3503
|
-
},
|
|
3504
|
-
|
|
3505
|
-
/**
|
|
3506
|
-
* Extract the bucket name from an S3 URI.
|
|
3507
|
-
*
|
|
3508
|
-
* @param s3Uri
|
|
3509
|
-
*/
|
|
3510
|
-
extractBucketNameFromS3Uri(s3Uri) {
|
|
3511
|
-
try {
|
|
3512
|
-
// Use the native URL API to parse the s3:// URI
|
|
3513
|
-
// s3://bucket-name/path/to/key -> hostname is bucket-name
|
|
3514
|
-
const url = new URL(s3Uri)
|
|
3515
|
-
return url.hostname
|
|
3516
|
-
} catch (e) {
|
|
3517
|
-
console.error('Error converting S3 URI:', e)
|
|
3518
|
-
return null
|
|
3519
|
-
}
|
|
3520
|
-
},
|
|
3521
|
-
/**
|
|
3522
|
-
* Iterates through the file list, constructs full URLs, and checks for simulation content.
|
|
3523
|
-
*/
|
|
3524
|
-
async processDatasetFiles(data) {
|
|
3525
|
-
if (!data) return
|
|
3526
|
-
|
|
3527
|
-
if (data.testData) {
|
|
3528
|
-
this.simulationInfo = [] // Reset list
|
|
3529
|
-
data.simulation.forEach((item) => {
|
|
3530
|
-
this.simulationInfo.push({
|
|
3531
|
-
label: item.name,
|
|
3532
|
-
path: item.dataset.path,
|
|
3533
|
-
dataset_id: item.datasetId,
|
|
3534
|
-
type: 'Simulation',
|
|
3535
|
-
resource: item.resource.url,
|
|
3536
|
-
})
|
|
3537
|
-
})
|
|
3538
|
-
} else {
|
|
3539
|
-
if (data.length !== 0) {
|
|
3540
|
-
this.simulationInfo = [] // Reset list
|
|
3541
|
-
//FIXME: Currently only process the first dataset entry
|
|
3542
|
-
const firstData = data[0]
|
|
3543
|
-
const apiLocation = this.sparcAPI
|
|
3544
|
-
// Base URL for Pennsieve public assets
|
|
3545
|
-
const baseUrl = `${apiLocation}/s3-resource/${firstData.dataset_id}/files`
|
|
3546
|
-
const bucketName = this.extractBucketNameFromS3Uri(firstData.s3uri)
|
|
3547
|
-
|
|
3548
|
-
firstData.urls.map(async (filePath) => {
|
|
3549
|
-
const fullUrl = `${baseUrl}/${filePath}?s3BucketName=${bucketName}`
|
|
3550
|
-
// Add to our list of valid files
|
|
3551
|
-
this.simulationInfo.push({
|
|
3552
|
-
label: firstData.title,
|
|
3553
|
-
s3uri: firstData.s3uri,
|
|
3554
|
-
dataset_id: firstData.dataset_id,
|
|
3555
|
-
version: firstData.version,
|
|
3556
|
-
path: filePath,
|
|
3557
|
-
type: 'Simulation',
|
|
3558
|
-
resource: fullUrl,
|
|
3559
|
-
})
|
|
3560
|
-
})
|
|
3561
|
-
}
|
|
3562
|
-
}
|
|
3563
|
-
},
|
|
3564
|
-
/**
|
|
3565
|
-
* Retrieve data from session storage if it hasn't expired.
|
|
3566
|
-
*/
|
|
3567
|
-
getSessionCache(key) {
|
|
3568
|
-
const itemStr = sessionStorage.getItem(key)
|
|
3569
|
-
if (!itemStr) return null
|
|
3570
|
-
|
|
3571
|
-
try {
|
|
3572
|
-
const item = JSON.parse(itemStr)
|
|
3573
|
-
const now = new Date()
|
|
3574
|
-
|
|
3575
|
-
// Check if expired (compare current time to expiry time)
|
|
3576
|
-
if (now.getTime() > item.expiry) {
|
|
3577
|
-
sessionStorage.removeItem(key)
|
|
3578
|
-
return null
|
|
3579
|
-
}
|
|
3580
|
-
return item.value
|
|
3581
|
-
} catch (e) {
|
|
3582
|
-
return null
|
|
3583
|
-
}
|
|
3584
|
-
},
|
|
3585
|
-
|
|
3586
|
-
/**
|
|
3587
|
-
* Save data to session storage with a 24-hour expiry.
|
|
3588
|
-
*/
|
|
3589
|
-
setSessionCache(key, value) {
|
|
3590
|
-
const now = new Date()
|
|
3591
|
-
// 24 hours in milliseconds: 24 * 60 * 60 * 1000 = 86400000
|
|
3592
|
-
const ttl = 86400000
|
|
3593
|
-
|
|
3594
|
-
const item = {
|
|
3595
|
-
value: value,
|
|
3596
|
-
expiry: now.getTime() + ttl,
|
|
3597
|
-
}
|
|
3598
|
-
|
|
3599
|
-
try {
|
|
3600
|
-
sessionStorage.setItem(key, JSON.stringify(item))
|
|
3601
|
-
} catch (e) {
|
|
3602
|
-
console.warn('Session storage full or disabled', e)
|
|
3603
|
-
}
|
|
3604
|
-
},
|
|
3605
|
-
getSimulationLabel(info) {
|
|
3606
|
-
return info.path.split('/').pop()
|
|
3607
|
-
},
|
|
3608
|
-
openSimulation() {
|
|
3609
|
-
if (this.selectedSimulation) {
|
|
3610
|
-
this.$emit('open-simulation', this.selectedSimulation)
|
|
3611
|
-
}
|
|
3154
|
+
this.connectionType = type;
|
|
3612
3155
|
},
|
|
3613
3156
|
},
|
|
3614
3157
|
props: {
|
|
@@ -3667,7 +3210,7 @@ export default {
|
|
|
3667
3210
|
* On default, `false`, clicking help will show all tooltips.
|
|
3668
3211
|
* If `true`, clicking help will show the help-mode-dialog.
|
|
3669
3212
|
*/
|
|
3670
|
-
|
|
3213
|
+
helpModeDialog: {
|
|
3671
3214
|
type: Boolean,
|
|
3672
3215
|
default: false,
|
|
3673
3216
|
},
|
|
@@ -3798,17 +3341,10 @@ export default {
|
|
|
3798
3341
|
type: String,
|
|
3799
3342
|
default: 'https://api.sparc.science/',
|
|
3800
3343
|
},
|
|
3801
|
-
/**
|
|
3802
|
-
* Specify the endpoint of the SPARC API.
|
|
3803
|
-
*/
|
|
3804
|
-
testDataLocation: {
|
|
3805
|
-
type: String,
|
|
3806
|
-
default: '',
|
|
3807
|
-
},
|
|
3808
3344
|
/**
|
|
3809
3345
|
* Flag to disable UIs on Map
|
|
3810
3346
|
*/
|
|
3811
|
-
|
|
3347
|
+
disableUI: {
|
|
3812
3348
|
type: Boolean,
|
|
3813
3349
|
default: false,
|
|
3814
3350
|
},
|
|
@@ -3871,14 +3407,12 @@ export default {
|
|
|
3871
3407
|
flatmapError: null,
|
|
3872
3408
|
sensor: null,
|
|
3873
3409
|
mapManagerRef: undefined,
|
|
3874
|
-
currentFlatmapUuid: undefined,
|
|
3875
3410
|
flatmapQueries: undefined,
|
|
3876
3411
|
annotationEntry: [],
|
|
3877
3412
|
//tooltip display has to be set to false until it is rendered
|
|
3878
|
-
//for the first time, otherwise it may display an arrow at
|
|
3413
|
+
//for the first time, otherwise it may display an arrow at a
|
|
3879
3414
|
//undesired location.
|
|
3880
3415
|
tooltipDisplay: false,
|
|
3881
|
-
tooltipTimer: null,
|
|
3882
3416
|
serverURL: undefined,
|
|
3883
3417
|
layers: [],
|
|
3884
3418
|
pathways: [],
|
|
@@ -3904,13 +3438,12 @@ export default {
|
|
|
3904
3438
|
{ value: false, ref: 'warningPopover' }, // 7
|
|
3905
3439
|
{ value: false, ref: 'whatsNewPopover' }, // 8
|
|
3906
3440
|
{ value: false, ref: 'featuredMarkerPopover' }, // 9
|
|
3907
|
-
{ value: false, refs:
|
|
3908
|
-
{ value: false, refs:
|
|
3909
|
-
{ value: false, refs:
|
|
3910
|
-
{ value: false, refs:
|
|
3911
|
-
{ value: false, refs:
|
|
3912
|
-
{ value: false, refs:
|
|
3913
|
-
{ value: false, ref: 'simulationPopover' }, // 16
|
|
3441
|
+
{ value: false, refs: "toolbarPopover", ref: "editPopover" }, // 10
|
|
3442
|
+
{ value: false, refs: "toolbarPopover", ref: "deletePopover" }, // 11
|
|
3443
|
+
{ value: false, refs: "toolbarPopover", ref: "pointPopover" }, // 12
|
|
3444
|
+
{ value: false, refs: "toolbarPopover", ref: "lineStringPopover" }, // 13
|
|
3445
|
+
{ value: false, refs: "toolbarPopover", ref: "polygonPopover" }, // 14
|
|
3446
|
+
{ value: false, refs: "toolbarPopover", ref: "connectionPopover" }, // 15
|
|
3914
3447
|
],
|
|
3915
3448
|
helpModeActiveIndex: this.helpModeInitialIndex,
|
|
3916
3449
|
yellowstar: yellowstar,
|
|
@@ -3935,14 +3468,9 @@ export default {
|
|
|
3935
3468
|
currentHover: '',
|
|
3936
3469
|
viewingMode: 'Exploration',
|
|
3937
3470
|
viewingModes: {
|
|
3938
|
-
Exploration:
|
|
3939
|
-
|
|
3940
|
-
'
|
|
3941
|
-
'Discover Neuron connections by selecting a neuron and viewing its associated network connections',
|
|
3942
|
-
Annotation: [
|
|
3943
|
-
'View feature annotations',
|
|
3944
|
-
'Add, comment on and view feature annotations',
|
|
3945
|
-
],
|
|
3471
|
+
'Exploration': 'Find relevant research and view detail of neural pathways by selecting a pathway to view its connections and data sources',
|
|
3472
|
+
'Neuron Connection': 'Discover Neuron connections by selecting a neuron and viewing its associated network connections',
|
|
3473
|
+
'Annotation': ['View feature annotations', 'Add, comment on and view feature annotations']
|
|
3946
3474
|
},
|
|
3947
3475
|
connectionType: 'All',
|
|
3948
3476
|
offlineAnnotationEnabled: false,
|
|
@@ -3952,12 +3480,12 @@ export default {
|
|
|
3952
3480
|
openMapRef: undefined,
|
|
3953
3481
|
backgroundIconRef: undefined,
|
|
3954
3482
|
toolbarOptions: [
|
|
3955
|
-
|
|
3956
|
-
|
|
3957
|
-
|
|
3958
|
-
|
|
3959
|
-
|
|
3960
|
-
|
|
3483
|
+
"Edit",
|
|
3484
|
+
"Delete",
|
|
3485
|
+
"Point",
|
|
3486
|
+
"LineString",
|
|
3487
|
+
"Polygon",
|
|
3488
|
+
"Connection",
|
|
3961
3489
|
],
|
|
3962
3490
|
annotator: undefined,
|
|
3963
3491
|
authorisedUser: undefined,
|
|
@@ -3987,17 +3515,13 @@ export default {
|
|
|
3987
3515
|
alert: {
|
|
3988
3516
|
with: true,
|
|
3989
3517
|
without: true,
|
|
3990
|
-
}
|
|
3518
|
+
}
|
|
3991
3519
|
}),
|
|
3992
|
-
searchTerm:
|
|
3520
|
+
searchTerm: "",
|
|
3993
3521
|
taxonLeaveDelay: undefined,
|
|
3994
3522
|
connectivityFilters: [],
|
|
3995
3523
|
flatmapLegends: [],
|
|
3996
3524
|
lastViewport: undefined,
|
|
3997
|
-
simulationInfo: [],
|
|
3998
|
-
datasetInfo: null,
|
|
3999
|
-
simulationDrawerOpen: false,
|
|
4000
|
-
selectedSimulation: null,
|
|
4001
3525
|
}
|
|
4002
3526
|
},
|
|
4003
3527
|
computed: {
|
|
@@ -4005,17 +3529,16 @@ export default {
|
|
|
4005
3529
|
isValidDrawnCreated: function () {
|
|
4006
3530
|
return Object.keys(this.drawnCreatedEvent).length > 0
|
|
4007
3531
|
},
|
|
4008
|
-
requiresDrawer: function
|
|
3532
|
+
requiresDrawer: function() {
|
|
4009
3533
|
if (this.loading) {
|
|
4010
3534
|
this.drawerOpen = false
|
|
4011
3535
|
return false
|
|
4012
3536
|
}
|
|
4013
|
-
if (
|
|
4014
|
-
this.systems?.length > 0 ||
|
|
3537
|
+
if ((this.systems?.length > 0) ||
|
|
4015
3538
|
(this.containsAlert && this.alertOptions) ||
|
|
4016
|
-
this.pathways?.length > 0 ||
|
|
4017
|
-
this.taxonConnectivity?.length > 0 ||
|
|
4018
|
-
this.legendEntry?.length > 0
|
|
3539
|
+
(this.pathways?.length > 0) ||
|
|
3540
|
+
(this.taxonConnectivity?.length > 0) ||
|
|
3541
|
+
(this.legendEntry?.length > 0)
|
|
4019
3542
|
) {
|
|
4020
3543
|
this.drawerOpen = true
|
|
4021
3544
|
return true
|
|
@@ -4037,7 +3560,7 @@ export default {
|
|
|
4037
3560
|
return [...this.flatmapLegends, ...this.externalLegends]
|
|
4038
3561
|
},
|
|
4039
3562
|
showDatasetMarkerTooltip: function () {
|
|
4040
|
-
return this.hoverVisibilities[9].value
|
|
3563
|
+
return this.hoverVisibilities[9].value;
|
|
4041
3564
|
},
|
|
4042
3565
|
},
|
|
4043
3566
|
watch: {
|
|
@@ -4053,11 +3576,11 @@ export default {
|
|
|
4053
3576
|
// just take the action from helpModeActiveItem
|
|
4054
3577
|
// work with local value since the indexing is different
|
|
4055
3578
|
if (this.helpMode) {
|
|
4056
|
-
this.helpModeActiveIndex += 1
|
|
4057
|
-
this.setHelpMode(this.helpMode)
|
|
3579
|
+
this.helpModeActiveIndex += 1;
|
|
3580
|
+
this.setHelpMode(this.helpMode);
|
|
4058
3581
|
}
|
|
4059
3582
|
},
|
|
4060
|
-
render: function
|
|
3583
|
+
render: function(val) {
|
|
4061
3584
|
if (val) {
|
|
4062
3585
|
if (this.mapImp && this.mapImp.contextLost && !this.loading) {
|
|
4063
3586
|
this.$nextTick(() => {
|
|
@@ -4092,7 +3615,7 @@ export default {
|
|
|
4092
3615
|
this.authorisedUser = undefined
|
|
4093
3616
|
this.offlineAnnotationEnabled = true
|
|
4094
3617
|
}
|
|
4095
|
-
this.emitOfflineAnnotationUpdate()
|
|
3618
|
+
this.emitOfflineAnnotationUpdate();
|
|
4096
3619
|
this.setFeatureAnnotated()
|
|
4097
3620
|
this.addAnnotationFeature()
|
|
4098
3621
|
this.loading = false
|
|
@@ -4105,67 +3628,54 @@ export default {
|
|
|
4105
3628
|
}
|
|
4106
3629
|
},
|
|
4107
3630
|
activeDrawTool: function (tool) {
|
|
4108
|
-
let coordinates = []
|
|
4109
|
-
let lastClick = { x: null, y: null }
|
|
4110
|
-
const canvas = this.$el.querySelector('.maplibregl-canvas')
|
|
3631
|
+
let coordinates = [];
|
|
3632
|
+
let lastClick = { x: null, y: null };
|
|
3633
|
+
const canvas = this.$el.querySelector('.maplibregl-canvas');
|
|
4111
3634
|
const removeListeners = () => {
|
|
4112
|
-
canvas.removeEventListener('keydown', handleKeyboardEvent)
|
|
4113
|
-
canvas.removeEventListener('click', handleMouseEvent)
|
|
4114
|
-
}
|
|
3635
|
+
canvas.removeEventListener('keydown', handleKeyboardEvent);
|
|
3636
|
+
canvas.removeEventListener('click', handleMouseEvent);
|
|
3637
|
+
};
|
|
4115
3638
|
const handleKeyboardEvent = (event) => {
|
|
4116
|
-
if (!['Escape', 'Enter'].includes(event.key)) return
|
|
3639
|
+
if (!['Escape', 'Enter'].includes(event.key)) return;
|
|
4117
3640
|
const isValidDraw =
|
|
4118
3641
|
(tool === 'Point' && coordinates.length === 1) ||
|
|
4119
3642
|
(tool === 'LineString' && coordinates.length >= 2) ||
|
|
4120
|
-
(tool === 'Polygon' && coordinates.length >= 3)
|
|
3643
|
+
(tool === 'Polygon' && coordinates.length >= 3);
|
|
4121
3644
|
if (event.key === 'Escape' || (event.key === 'Enter' && !isValidDraw)) {
|
|
4122
|
-
this.activeDrawTool = undefined
|
|
3645
|
+
this.activeDrawTool = undefined;
|
|
4123
3646
|
}
|
|
4124
|
-
removeListeners()
|
|
4125
|
-
}
|
|
3647
|
+
removeListeners();
|
|
3648
|
+
};
|
|
4126
3649
|
const handleMouseEvent = (event) => {
|
|
4127
|
-
const rect = canvas.getBoundingClientRect()
|
|
4128
|
-
const x = event.clientX - rect.left
|
|
4129
|
-
const y = event.clientY - rect.top
|
|
4130
|
-
const distance = Math.sqrt(
|
|
4131
|
-
(x - lastClick.x) ** 2 + (y - lastClick.y) ** 2
|
|
4132
|
-
)
|
|
3650
|
+
const rect = canvas.getBoundingClientRect();
|
|
3651
|
+
const x = event.clientX - rect.left;
|
|
3652
|
+
const y = event.clientY - rect.top;
|
|
3653
|
+
const distance = Math.sqrt((x - lastClick.x) ** 2 + (y - lastClick.y) ** 2);
|
|
4133
3654
|
if (distance < 8) {
|
|
4134
|
-
if (!this.isValidDrawnCreated) this.activeDrawTool = undefined
|
|
4135
|
-
removeListeners()
|
|
4136
|
-
return
|
|
3655
|
+
if (!this.isValidDrawnCreated) this.activeDrawTool = undefined;
|
|
3656
|
+
removeListeners();
|
|
3657
|
+
return;
|
|
4137
3658
|
}
|
|
4138
|
-
lastClick = { x, y }
|
|
4139
|
-
coordinates.push(lastClick)
|
|
4140
|
-
}
|
|
3659
|
+
lastClick = { x, y };
|
|
3660
|
+
coordinates.push(lastClick);
|
|
3661
|
+
};
|
|
4141
3662
|
if (tool) {
|
|
4142
|
-
removeListeners()
|
|
4143
|
-
canvas.addEventListener('keydown', handleKeyboardEvent)
|
|
4144
|
-
canvas.addEventListener('click', handleMouseEvent)
|
|
3663
|
+
removeListeners();
|
|
3664
|
+
canvas.addEventListener('keydown', handleKeyboardEvent);
|
|
3665
|
+
canvas.addEventListener('click', handleMouseEvent);
|
|
4145
3666
|
}
|
|
4146
|
-
}
|
|
4147
|
-
currentFlatmapUuid: {
|
|
4148
|
-
handler(newUuid) {
|
|
4149
|
-
if (newUuid) {
|
|
4150
|
-
// console.log('New map loaded with uuid:', newUuid)
|
|
4151
|
-
this.fetchFlatmapProtocols(newUuid)
|
|
4152
|
-
}
|
|
4153
|
-
},
|
|
4154
|
-
// immediate: true,
|
|
4155
|
-
},
|
|
3667
|
+
}
|
|
4156
3668
|
},
|
|
4157
3669
|
created: function () {
|
|
4158
3670
|
if (this.mapManager) {
|
|
4159
|
-
this.mapManagerRef = this.mapManager
|
|
3671
|
+
this.mapManagerRef = this.mapManager;
|
|
4160
3672
|
} else {
|
|
4161
|
-
this.mapManagerRef = markRaw(
|
|
4162
|
-
new flatmap.MapViewer(this.flatmapAPI, { container: undefined })
|
|
4163
|
-
)
|
|
3673
|
+
this.mapManagerRef = markRaw(new flatmap.MapViewer(this.flatmapAPI, { container: undefined }));
|
|
4164
3674
|
/**
|
|
4165
3675
|
* The event emitted after a new mapManager is loaded.
|
|
4166
3676
|
* This mapManager can be used to create new flatmaps.
|
|
4167
3677
|
*/
|
|
4168
|
-
this.$emit('mapmanager-loaded', this.mapManagerRef)
|
|
3678
|
+
this.$emit('mapmanager-loaded', this.mapManagerRef);
|
|
4169
3679
|
}
|
|
4170
3680
|
},
|
|
4171
3681
|
mounted: function () {
|
|
@@ -4182,16 +3692,17 @@ export default {
|
|
|
4182
3692
|
} else if (this.renderAtMounted) {
|
|
4183
3693
|
this.createFlatmap()
|
|
4184
3694
|
}
|
|
4185
|
-
refreshFlatmapKnowledgeCache()
|
|
3695
|
+
refreshFlatmapKnowledgeCache();
|
|
4186
3696
|
},
|
|
4187
3697
|
}
|
|
4188
3698
|
</script>
|
|
4189
3699
|
|
|
4190
3700
|
<style lang="scss" scoped>
|
|
3701
|
+
|
|
4191
3702
|
.beta-popovers {
|
|
4192
3703
|
position: absolute;
|
|
4193
|
-
top:
|
|
4194
|
-
left:
|
|
3704
|
+
top: 90px;
|
|
3705
|
+
left: 16px;
|
|
4195
3706
|
text-align: left;
|
|
4196
3707
|
font-size: 25px;
|
|
4197
3708
|
}
|
|
@@ -4247,40 +3758,6 @@ export default {
|
|
|
4247
3758
|
width: 100%;
|
|
4248
3759
|
}
|
|
4249
3760
|
|
|
4250
|
-
.popover-location {
|
|
4251
|
-
position: absolute;
|
|
4252
|
-
left: 0px;
|
|
4253
|
-
transform: translateX(0);
|
|
4254
|
-
transition: all var(--el-transition-duration);
|
|
4255
|
-
z-index: 99;
|
|
4256
|
-
display: flex;
|
|
4257
|
-
flex-direction: row;
|
|
4258
|
-
align-items: center;
|
|
4259
|
-
|
|
4260
|
-
&.simulation {
|
|
4261
|
-
.el-button {
|
|
4262
|
-
background: $app-primary-color;
|
|
4263
|
-
}
|
|
4264
|
-
}
|
|
4265
|
-
|
|
4266
|
-
|
|
4267
|
-
|
|
4268
|
-
&.open {
|
|
4269
|
-
transform: translateX(0);
|
|
4270
|
-
}
|
|
4271
|
-
&.close {
|
|
4272
|
-
transform: translateX(-100%);
|
|
4273
|
-
}
|
|
4274
|
-
}
|
|
4275
|
-
|
|
4276
|
-
.popover-location.top {
|
|
4277
|
-
top: 5px;
|
|
4278
|
-
}
|
|
4279
|
-
|
|
4280
|
-
.popover-location.bottom {
|
|
4281
|
-
bottom: 0px;
|
|
4282
|
-
}
|
|
4283
|
-
|
|
4284
3761
|
.pathway-location {
|
|
4285
3762
|
position: absolute;
|
|
4286
3763
|
bottom: 0px;
|
|
@@ -4527,7 +4004,7 @@ export default {
|
|
|
4527
4004
|
}
|
|
4528
4005
|
}
|
|
4529
4006
|
|
|
4530
|
-
:deep(.flatmap-marker-popup)
|
|
4007
|
+
:deep(.flatmap-marker-popup){
|
|
4531
4008
|
.maplibregl-popup-content {
|
|
4532
4009
|
padding: 0px;
|
|
4533
4010
|
}
|
|
@@ -4552,9 +4029,7 @@ export default {
|
|
|
4552
4029
|
}
|
|
4553
4030
|
}
|
|
4554
4031
|
|
|
4555
|
-
.zoomIn,
|
|
4556
|
-
.zoomOut,
|
|
4557
|
-
.fitWindow {
|
|
4032
|
+
.zoomIn, .zoomOut, .fitWindow {
|
|
4558
4033
|
padding: 4px;
|
|
4559
4034
|
}
|
|
4560
4035
|
|
|
@@ -4617,6 +4092,7 @@ export default {
|
|
|
4617
4092
|
border-color: $app-primary-color;
|
|
4618
4093
|
color: $app-primary-color;
|
|
4619
4094
|
}
|
|
4095
|
+
|
|
4620
4096
|
.el-popper__arrow {
|
|
4621
4097
|
&:before {
|
|
4622
4098
|
border-color: $app-primary-color;
|
|
@@ -4668,7 +4144,7 @@ export default {
|
|
|
4668
4144
|
color: $app-primary-color;
|
|
4669
4145
|
|
|
4670
4146
|
&.open-map-button {
|
|
4671
|
-
margin-bottom:
|
|
4147
|
+
margin-bottom:4px;
|
|
4672
4148
|
}
|
|
4673
4149
|
|
|
4674
4150
|
&:hover {
|
|
@@ -4792,7 +4268,7 @@ export default {
|
|
|
4792
4268
|
position: relative;
|
|
4793
4269
|
|
|
4794
4270
|
&::before {
|
|
4795
|
-
content:
|
|
4271
|
+
content: "";
|
|
4796
4272
|
display: block;
|
|
4797
4273
|
width: 0;
|
|
4798
4274
|
height: 0;
|
|
@@ -4921,7 +4397,7 @@ export default {
|
|
|
4921
4397
|
background-color: var(--white);
|
|
4922
4398
|
font-weight: 500;
|
|
4923
4399
|
color: rgb(48, 49, 51);
|
|
4924
|
-
width: 150px
|
|
4400
|
+
width: 150px!important;
|
|
4925
4401
|
}
|
|
4926
4402
|
|
|
4927
4403
|
:deep(.flatmap_dropdown) {
|
|
@@ -4945,10 +4421,11 @@ export default {
|
|
|
4945
4421
|
</style>
|
|
4946
4422
|
|
|
4947
4423
|
<style lang="scss">
|
|
4424
|
+
|
|
4948
4425
|
.flatmap-container {
|
|
4949
|
-
--el-color-primary: #
|
|
4950
|
-
--el-color-primary-light-5: #
|
|
4951
|
-
--el-color-primary-light-9: #
|
|
4426
|
+
--el-color-primary: #8300BF;
|
|
4427
|
+
--el-color-primary-light-5: #CD99E5;
|
|
4428
|
+
--el-color-primary-light-9: #F3E6F9;
|
|
4952
4429
|
--el-color-primary-dark-2: var(--el-color-primary);
|
|
4953
4430
|
}
|
|
4954
4431
|
|
|
@@ -4971,4 +4448,5 @@ export default {
|
|
|
4971
4448
|
}
|
|
4972
4449
|
}
|
|
4973
4450
|
}
|
|
4974
|
-
|
|
4451
|
+
|
|
4452
|
+
</style>
|