@abi-software/flatmapvuer 0.5.9 → 0.5.10
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/CHANGELOG.md +402 -402
- package/LICENSE +201 -201
- package/README.md +105 -105
- package/babel.config.js +14 -14
- package/package-lock.json +18473 -18473
- package/package.json +79 -79
- package/public/index.html +17 -17
- package/src/App.vue +228 -228
- package/src/assets/_variables.scss +43 -43
- package/src/assets/styles.scss +7 -7
- package/src/components/AnnotationTool.vue +403 -403
- package/src/components/EventBus.js +2 -2
- package/src/components/ExternalResourceCard.vue +98 -98
- package/src/components/FlatmapVuer.vue +2070 -2059
- package/src/components/MultiFlatmapVuer.vue +535 -536
- package/src/components/ProvenancePopup.vue +422 -422
- package/src/components/SelectionsGroup.vue +249 -249
- package/src/components/Tooltip.vue +52 -52
- package/src/components/TreeControls.vue +231 -231
- package/src/components/index.js +9 -9
- package/src/components/legends/DynamicLegends.vue +112 -112
- package/src/components/legends/SvgLegends.vue +67 -67
- package/src/icons/fonts/mapicon-species.eot +0 -0
- package/src/icons/fonts/mapicon-species.svg +14 -14
- package/src/icons/fonts/mapicon-species.ttf +0 -0
- package/src/icons/fonts/mapicon-species.woff +0 -0
- package/src/icons/mapicon-species-style.css +42 -42
- package/src/icons/yellowstar.js +5 -5
- package/src/legends/legend.svg +25 -25
- package/src/main.js +8 -8
- package/src/nerve-map.js +99 -0
- package/src/services/flatmapQueries.js +415 -415
- package/vue.config.js +31 -31
- package/dist/demo.html +0 -10
- package/dist/flatmapvuer.common.js +0 -22741
- package/dist/flatmapvuer.common.js.map +0 -1
- package/dist/flatmapvuer.css +0 -1
- package/dist/flatmapvuer.umd.js +0 -22751
- package/dist/flatmapvuer.umd.js.map +0 -1
- package/dist/flatmapvuer.umd.min.js +0 -4
- package/dist/flatmapvuer.umd.min.js.map +0 -1
|
@@ -1,536 +1,535 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="multi-container" ref="multiContainer">
|
|
3
|
-
<div style="position:absolute;z-index:10;">
|
|
4
|
-
<div class="species-display-text">
|
|
5
|
-
Species
|
|
6
|
-
</div>
|
|
7
|
-
<el-popover content="Select a species" placement="right"
|
|
8
|
-
:appendToBody=false trigger="manual" popper-class="flatmap-popper right-popper" v-model="helpMode" ref="selectPopover">
|
|
9
|
-
</el-popover>
|
|
10
|
-
<el-select
|
|
11
|
-
id="flatmap-select"
|
|
12
|
-
:popper-append-to-body="appendToBody"
|
|
13
|
-
v-model="activeSpecies"
|
|
14
|
-
placeholder="Select"
|
|
15
|
-
class="select-box"
|
|
16
|
-
popper-class="flatmap_dropdown"
|
|
17
|
-
@change="setSpecies"
|
|
18
|
-
v-popover:selectPopover
|
|
19
|
-
>
|
|
20
|
-
<el-option v-for="(item, key) in speciesList" :key="key" :label="key" :value="key">
|
|
21
|
-
<el-row>
|
|
22
|
-
<el-col :span="8"><i :class="item.iconClass"></i></el-col>
|
|
23
|
-
<el-col :span="12">{{ key }}</el-col>
|
|
24
|
-
</el-row>
|
|
25
|
-
</el-option>
|
|
26
|
-
</el-select>
|
|
27
|
-
</div>
|
|
28
|
-
<FlatmapVuer
|
|
29
|
-
v-for="(item, key) in speciesList"
|
|
30
|
-
:key="key"
|
|
31
|
-
:showLayer="showLayer"
|
|
32
|
-
v-show="activeSpecies==key"
|
|
33
|
-
:entry="item.taxo"
|
|
34
|
-
:uuid="item.uuid"
|
|
35
|
-
:biologicalSex="item.biologicalSex"
|
|
36
|
-
:displayWarning="item.displayWarning"
|
|
37
|
-
:displayLatestChanges="item.displayLatestChanges"
|
|
38
|
-
:
|
|
39
|
-
:
|
|
40
|
-
:
|
|
41
|
-
:
|
|
42
|
-
|
|
43
|
-
@
|
|
44
|
-
@
|
|
45
|
-
@
|
|
46
|
-
@
|
|
47
|
-
|
|
48
|
-
:
|
|
49
|
-
:
|
|
50
|
-
:
|
|
51
|
-
:
|
|
52
|
-
:
|
|
53
|
-
:
|
|
54
|
-
:
|
|
55
|
-
:
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
:
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
import
|
|
68
|
-
import
|
|
69
|
-
import
|
|
70
|
-
import
|
|
71
|
-
import
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
Vue.use(
|
|
75
|
-
Vue.use(
|
|
76
|
-
Vue.use(
|
|
77
|
-
Vue.use(
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
"NCBITaxon:
|
|
82
|
-
"NCBITaxon:
|
|
83
|
-
"NCBITaxon:
|
|
84
|
-
"NCBITaxon:
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
//
|
|
95
|
-
|
|
96
|
-
this.
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
this.
|
|
111
|
-
|
|
112
|
-
.then(
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
resolve
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
this.activeSpecies
|
|
199
|
-
this.$
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
*
|
|
212
|
-
*
|
|
213
|
-
*
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
*
|
|
230
|
-
*
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
*
|
|
264
|
-
*
|
|
265
|
-
*
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
const
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
//
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
*
|
|
307
|
-
*
|
|
308
|
-
*
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
state
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
*
|
|
322
|
-
*
|
|
323
|
-
*
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
*
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
*
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
"Human
|
|
410
|
-
"
|
|
411
|
-
"
|
|
412
|
-
"
|
|
413
|
-
"
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
@import "~element-ui/packages/theme-chalk/src/
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
font-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
border
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
color:
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<div class="multi-container" ref="multiContainer">
|
|
3
|
+
<div style="position:absolute;z-index:10;">
|
|
4
|
+
<div class="species-display-text">
|
|
5
|
+
Species
|
|
6
|
+
</div>
|
|
7
|
+
<el-popover content="Select a species" placement="right"
|
|
8
|
+
:appendToBody=false trigger="manual" popper-class="flatmap-popper right-popper" v-model="helpMode" ref="selectPopover">
|
|
9
|
+
</el-popover>
|
|
10
|
+
<el-select
|
|
11
|
+
id="flatmap-select"
|
|
12
|
+
:popper-append-to-body="appendToBody"
|
|
13
|
+
v-model="activeSpecies"
|
|
14
|
+
placeholder="Select"
|
|
15
|
+
class="select-box"
|
|
16
|
+
popper-class="flatmap_dropdown"
|
|
17
|
+
@change="setSpecies"
|
|
18
|
+
v-popover:selectPopover
|
|
19
|
+
>
|
|
20
|
+
<el-option v-for="(item, key) in speciesList" :key="key" :label="key" :value="key">
|
|
21
|
+
<el-row>
|
|
22
|
+
<el-col :span="8"><i :class="item.iconClass"></i></el-col>
|
|
23
|
+
<el-col :span="12">{{ key }}</el-col>
|
|
24
|
+
</el-row>
|
|
25
|
+
</el-option>
|
|
26
|
+
</el-select>
|
|
27
|
+
</div>
|
|
28
|
+
<FlatmapVuer
|
|
29
|
+
v-for="(item, key) in speciesList"
|
|
30
|
+
:key="key"
|
|
31
|
+
:showLayer="showLayer"
|
|
32
|
+
v-show="activeSpecies==key"
|
|
33
|
+
:entry="item.taxo"
|
|
34
|
+
:uuid="item.uuid"
|
|
35
|
+
:biologicalSex="item.biologicalSex"
|
|
36
|
+
:displayWarning="item.displayWarning"
|
|
37
|
+
:displayLatestChanges="item.displayLatestChanges"
|
|
38
|
+
:isLegacy="item.isLegacy"
|
|
39
|
+
:ref="key"
|
|
40
|
+
:enableOpenMapUI="enableOpenMapUI"
|
|
41
|
+
:openMapOptions="openMapOptions"
|
|
42
|
+
@view-latest-map="viewLatestMap"
|
|
43
|
+
@resource-selected="FlatmapSelected"
|
|
44
|
+
@ready="FlatmapReady"
|
|
45
|
+
@pan-zoom-callback="panZoomCallback"
|
|
46
|
+
@open-map="$emit('open-map', $event)"
|
|
47
|
+
:featureInfo="featureInfo"
|
|
48
|
+
:minZoom="minZoom"
|
|
49
|
+
:pathControls="pathControls"
|
|
50
|
+
:searchable="searchable"
|
|
51
|
+
:layerControl="layerControl"
|
|
52
|
+
:helpMode="helpMode"
|
|
53
|
+
:renderAtMounted="renderAtMounted"
|
|
54
|
+
:displayMinimap="displayMinimap"
|
|
55
|
+
:showStarInLegend="showStarInLegend"
|
|
56
|
+
style="height:100%"
|
|
57
|
+
:flatmapAPI="flatmapAPI"
|
|
58
|
+
:sparcAPI="sparcAPI"
|
|
59
|
+
/>
|
|
60
|
+
</div>
|
|
61
|
+
</template>
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
<script>
|
|
65
|
+
/* eslint-disable no-alert, no-console */
|
|
66
|
+
import EventBus from './EventBus'
|
|
67
|
+
import Vue from "vue";
|
|
68
|
+
import FlatmapVuer from "./FlatmapVuer.vue";
|
|
69
|
+
import { Col, Option, Select, Row, Popover } from "element-ui";
|
|
70
|
+
import lang from "element-ui/lib/locale/lang/en";
|
|
71
|
+
import locale from "element-ui/lib/locale";
|
|
72
|
+
locale.use(lang);
|
|
73
|
+
Vue.use(Col);
|
|
74
|
+
Vue.use(Row);
|
|
75
|
+
Vue.use(Option);
|
|
76
|
+
Vue.use(Select);
|
|
77
|
+
Vue.use(Popover)
|
|
78
|
+
|
|
79
|
+
const TAXON_UUID = {
|
|
80
|
+
"NCBITaxon:10114": "01fedbf9-d783-509c-a10c-827941ab13da",
|
|
81
|
+
"NCBITaxon:9823": "a336ac04-24db-561f-a25f-1c994fe17410",
|
|
82
|
+
"NCBITaxon:9606": "42ed6323-f645-5fbe-bada-9581819cf689",
|
|
83
|
+
"NCBITaxon:10090": "25285fab-48a0-5620-a6a0-f9a0374837d5",
|
|
84
|
+
"NCBITaxon:9685": "73060497-46a6-52bf-b975-cac511c127cb"
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export default {
|
|
88
|
+
name: "MultiFlatmapVuer",
|
|
89
|
+
components: {
|
|
90
|
+
FlatmapVuer
|
|
91
|
+
},
|
|
92
|
+
beforeMount() {
|
|
93
|
+
//List for resolving the promise in initialise
|
|
94
|
+
//if initialise is called multiple times
|
|
95
|
+
this._resolveList = [];
|
|
96
|
+
this._initialised = false;
|
|
97
|
+
},
|
|
98
|
+
mounted: function() {
|
|
99
|
+
this.initialise();
|
|
100
|
+
EventBus.$on('onActionClick', (action) =>{
|
|
101
|
+
this.FlatmapSelected(action)
|
|
102
|
+
})
|
|
103
|
+
},
|
|
104
|
+
methods: {
|
|
105
|
+
initialise: function() {
|
|
106
|
+
return new Promise(resolve => {
|
|
107
|
+
if (this.requireInitialisation) {
|
|
108
|
+
//It has not been initialised yet
|
|
109
|
+
this.requireInitialisation = false;
|
|
110
|
+
fetch(this.flatmapAPI)
|
|
111
|
+
.then(response => response.json())
|
|
112
|
+
.then(data => {
|
|
113
|
+
//Check each key in the provided availableSpecies against the one
|
|
114
|
+
Object.keys(this.availableSpecies).forEach(key => {
|
|
115
|
+
// FIrst look through the uuid
|
|
116
|
+
const uuid = this.availableSpecies[key].uuid;
|
|
117
|
+
if (uuid && data.map(e => e.uuid).indexOf(uuid) > 0) {
|
|
118
|
+
this.$set(this.speciesList, key, this.availableSpecies[key]);
|
|
119
|
+
} else {
|
|
120
|
+
for (let i = 0; i < data.length; i++) {
|
|
121
|
+
if (this.availableSpecies[key].taxo === data[i].taxon) {
|
|
122
|
+
if (this.availableSpecies[key].biologicalSex) {
|
|
123
|
+
if (data[i].biologicalSex &&
|
|
124
|
+
data[i].biologicalSex === this.availableSpecies[key].biologicalSex) {
|
|
125
|
+
this.$set(this.speciesList, key, this.availableSpecies[key]);
|
|
126
|
+
break;
|
|
127
|
+
}
|
|
128
|
+
} else {
|
|
129
|
+
this.$set(this.speciesList, key, this.availableSpecies[key]);
|
|
130
|
+
break;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
//Use the state species if it does not have any other species information
|
|
137
|
+
let species = this.initial;
|
|
138
|
+
if (this.state) {
|
|
139
|
+
const mapState = this.state.state;
|
|
140
|
+
if ((!mapState || ( !mapState.uuid && !mapState.entry )) && this.state.species)
|
|
141
|
+
species = this.state.species;
|
|
142
|
+
else
|
|
143
|
+
species = undefined;
|
|
144
|
+
}
|
|
145
|
+
if (species) {
|
|
146
|
+
//No state resuming, set the current flatmap to {this.initial}
|
|
147
|
+
if (species && this.speciesList[species] !== undefined) {
|
|
148
|
+
this.activeSpecies = species;
|
|
149
|
+
} else {
|
|
150
|
+
this.activeSpecies = Object.keys(this.speciesList)[0];
|
|
151
|
+
}
|
|
152
|
+
this.setSpecies(this.activeSpecies, this.state ? this.state.state : undefined, 5);
|
|
153
|
+
}
|
|
154
|
+
this._initialised = true;
|
|
155
|
+
resolve();
|
|
156
|
+
//Resolve all other promises resolve in the list
|
|
157
|
+
this._resolveList.forEach(other => { other(); });
|
|
158
|
+
});
|
|
159
|
+
} else if (this._initialised) {
|
|
160
|
+
//resolve as it has been initialised
|
|
161
|
+
resolve();
|
|
162
|
+
} else {
|
|
163
|
+
//resolve when the async initialisation is finished
|
|
164
|
+
this._resolveList.push(resolve);
|
|
165
|
+
}
|
|
166
|
+
})
|
|
167
|
+
},
|
|
168
|
+
FlatmapSelected: function(resource) {
|
|
169
|
+
this.$emit("resource-selected", resource);
|
|
170
|
+
},
|
|
171
|
+
FlatmapReady: function(component) {
|
|
172
|
+
this.$emit("ready", component);
|
|
173
|
+
},
|
|
174
|
+
getCoordinatesOfLastClick: function() {
|
|
175
|
+
const flatmap = this.$refs[this.activeSpecies];
|
|
176
|
+
if (flatmap && flatmap[0]) {
|
|
177
|
+
return flatmap[0].getCoordinatesOfLastClick();
|
|
178
|
+
}
|
|
179
|
+
return undefined;
|
|
180
|
+
},
|
|
181
|
+
getCurrentFlatmap: function() {
|
|
182
|
+
return this.$refs[this.activeSpecies][0];
|
|
183
|
+
},
|
|
184
|
+
panZoomCallback: function(payload) {
|
|
185
|
+
this.$emit("pan-zoom-callback", payload);
|
|
186
|
+
},
|
|
187
|
+
showPopup: function(featureId, node, options) {
|
|
188
|
+
let map = this.getCurrentFlatmap();
|
|
189
|
+
map.showPopup(featureId, node, options);
|
|
190
|
+
},
|
|
191
|
+
showMarkerPopup: function(featureId, node, options) {
|
|
192
|
+
let map = this.getCurrentFlatmap();
|
|
193
|
+
map.showMarkerPopup(featureId, node, options);
|
|
194
|
+
},
|
|
195
|
+
setSpecies: function(species, state, numberOfRetry) {
|
|
196
|
+
if (this.$refs && species in this.$refs) {
|
|
197
|
+
this.activeSpecies = species;
|
|
198
|
+
this.$refs[this.activeSpecies][0].createFlatmap(state);
|
|
199
|
+
this.$emit('flatmapChanged', this.activeSpecies);
|
|
200
|
+
} else if (numberOfRetry) {
|
|
201
|
+
const retry = numberOfRetry - 1;
|
|
202
|
+
if (retry >= 0) {
|
|
203
|
+
Vue.nextTick(() => {
|
|
204
|
+
this.setSpecies(species, state, retry);
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
},
|
|
209
|
+
/**
|
|
210
|
+
* Function to switch to the latest existing map from
|
|
211
|
+
* a legacy map of the same species.
|
|
212
|
+
*
|
|
213
|
+
* @private
|
|
214
|
+
*/
|
|
215
|
+
viewLatestMap: function(state) {
|
|
216
|
+
const keys = Object.keys(this.speciesList);
|
|
217
|
+
for (let i = 0; i < keys.length; i++) {
|
|
218
|
+
const species = this.speciesList[keys[i]];
|
|
219
|
+
if (!species.isLegacy &&
|
|
220
|
+
(species.taxo === state.entry) &&
|
|
221
|
+
(species.biologicalSex === state.biologicalSex)) {
|
|
222
|
+
this.setSpecies(keys[i], state, 0);
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
},
|
|
227
|
+
/**
|
|
228
|
+
* Create a legacy entry with the provided information
|
|
229
|
+
*
|
|
230
|
+
* @private
|
|
231
|
+
*/
|
|
232
|
+
createLegacyEntry: function(state, taxo, uuid) {
|
|
233
|
+
if (uuid && taxo) {
|
|
234
|
+
let name = "Legacy";
|
|
235
|
+
if (state.species) {
|
|
236
|
+
if (state.species.slice(0, 6) === "Legacy")
|
|
237
|
+
name = state.species;
|
|
238
|
+
else
|
|
239
|
+
name = name + ` ${state.species}`;
|
|
240
|
+
}
|
|
241
|
+
this.$set(
|
|
242
|
+
this.speciesList,
|
|
243
|
+
name,
|
|
244
|
+
{
|
|
245
|
+
taxo: taxo,
|
|
246
|
+
isLegacy: true,
|
|
247
|
+
displayWarning: true
|
|
248
|
+
}
|
|
249
|
+
);
|
|
250
|
+
return {
|
|
251
|
+
species: name,
|
|
252
|
+
state: {
|
|
253
|
+
entry: taxo,
|
|
254
|
+
uuid: uuid,
|
|
255
|
+
viewport: state.state.viewport,
|
|
256
|
+
searchTerm: state.state.searchTerm
|
|
257
|
+
},
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
},
|
|
261
|
+
/**
|
|
262
|
+
* Function used to translate the legacy map state to one that can be used in current
|
|
263
|
+
* flatmap if required. If it is a legacy, an Select entry will be added
|
|
264
|
+
*
|
|
265
|
+
* @private
|
|
266
|
+
*/
|
|
267
|
+
updateState: function(state) {
|
|
268
|
+
return new Promise((resolve) => {
|
|
269
|
+
if (state && state.state) {
|
|
270
|
+
const mapState = state.state;
|
|
271
|
+
//uuid is not in the state, this is a legacy map
|
|
272
|
+
if (!mapState.uuid) {
|
|
273
|
+
if (mapState.entry) {
|
|
274
|
+
const uuid = mapState.entry in TAXON_UUID ? TAXON_UUID[mapState.entry] : undefined;
|
|
275
|
+
const newState = this.createLegacyEntry(state, mapState.entry, uuid);
|
|
276
|
+
resolve(newState ? newState : state);
|
|
277
|
+
}
|
|
278
|
+
} else if (mapState.entry) {
|
|
279
|
+
//uuid is in the state but should be checked if it is the latest map
|
|
280
|
+
//for that taxon
|
|
281
|
+
return new Promise(() => {
|
|
282
|
+
const mapManager = new (require("@abi-software/flatmap-viewer")).MapManager(this.flatmapAPI);
|
|
283
|
+
//mapManager.findMap_ is an async function so we need to wrap this with a promise
|
|
284
|
+
const identifier = { taxon: mapState.entry };
|
|
285
|
+
if (mapState.biologicalSex)
|
|
286
|
+
identifier['biologicalSex'] = mapState.biologicalSex;
|
|
287
|
+
mapManager.findMap_(identifier).then(map => {
|
|
288
|
+
if (map.uuid !== mapState.uuid) {
|
|
289
|
+
return this.createLegacyEntry(state, mapState.entry, mapState.uuid);
|
|
290
|
+
}
|
|
291
|
+
}).then(newState => {
|
|
292
|
+
resolve(newState ? newState : state);
|
|
293
|
+
})
|
|
294
|
+
.catch(() => {
|
|
295
|
+
resolve(state);
|
|
296
|
+
});
|
|
297
|
+
});
|
|
298
|
+
}
|
|
299
|
+
//Create a new state and add the legacy map to the select
|
|
300
|
+
}
|
|
301
|
+
resolve(state);
|
|
302
|
+
});
|
|
303
|
+
},
|
|
304
|
+
/**
|
|
305
|
+
* Function used for getting the current states of the scene. This exported states
|
|
306
|
+
* can be imported using the importStates method.
|
|
307
|
+
*
|
|
308
|
+
* @public
|
|
309
|
+
*/
|
|
310
|
+
getState: function() {
|
|
311
|
+
let state = {
|
|
312
|
+
species: this.activeSpecies,
|
|
313
|
+
state: undefined,
|
|
314
|
+
};
|
|
315
|
+
let map = this.getCurrentFlatmap();
|
|
316
|
+
state.state = map.getState();
|
|
317
|
+
return state;
|
|
318
|
+
},
|
|
319
|
+
/**
|
|
320
|
+
* Function used for importing the states of the scene. This exported states
|
|
321
|
+
* can be imported using the read states method.
|
|
322
|
+
*
|
|
323
|
+
* @public
|
|
324
|
+
*/
|
|
325
|
+
setState: function(state) {
|
|
326
|
+
if (state) {
|
|
327
|
+
//Update state if required
|
|
328
|
+
this.updateState(state).then(currentState => {
|
|
329
|
+
this.initialise().then(() => {
|
|
330
|
+
if (currentState.species && (currentState.species !== this.activeSpecies)) {
|
|
331
|
+
this.setSpecies(currentState.species, currentState.state, 5);
|
|
332
|
+
} else if (currentState.state) {
|
|
333
|
+
let map = this.getCurrentFlatmap();
|
|
334
|
+
map.setState(currentState.state);
|
|
335
|
+
}
|
|
336
|
+
});
|
|
337
|
+
});
|
|
338
|
+
}
|
|
339
|
+
},
|
|
340
|
+
resourceSelected: function(action) {
|
|
341
|
+
this.$emit("resource-selected", action);
|
|
342
|
+
},
|
|
343
|
+
},
|
|
344
|
+
props: {
|
|
345
|
+
showLayer: {
|
|
346
|
+
type: Boolean,
|
|
347
|
+
default: false
|
|
348
|
+
},
|
|
349
|
+
featureInfo: {
|
|
350
|
+
type: Boolean,
|
|
351
|
+
default: false
|
|
352
|
+
},
|
|
353
|
+
pathControls: {
|
|
354
|
+
type: Boolean,
|
|
355
|
+
default: true
|
|
356
|
+
},
|
|
357
|
+
searchable: {
|
|
358
|
+
type: Boolean,
|
|
359
|
+
default: false
|
|
360
|
+
},
|
|
361
|
+
layerControl: {
|
|
362
|
+
type: Boolean,
|
|
363
|
+
default: false
|
|
364
|
+
},
|
|
365
|
+
/**
|
|
366
|
+
* Initial species for the flatmap.
|
|
367
|
+
* This value will be ignored if a valid state object is provided.
|
|
368
|
+
*/
|
|
369
|
+
initial: {
|
|
370
|
+
type: String,
|
|
371
|
+
default: ""
|
|
372
|
+
},
|
|
373
|
+
minZoom: {
|
|
374
|
+
type: Number,
|
|
375
|
+
default: 4
|
|
376
|
+
},
|
|
377
|
+
renderAtMounted: {
|
|
378
|
+
type: Boolean,
|
|
379
|
+
default: false
|
|
380
|
+
},
|
|
381
|
+
helpMode: {
|
|
382
|
+
type: Boolean,
|
|
383
|
+
default: false
|
|
384
|
+
},
|
|
385
|
+
displayMinimap: {
|
|
386
|
+
type: Boolean,
|
|
387
|
+
default: false
|
|
388
|
+
},
|
|
389
|
+
showStarInLegend: {
|
|
390
|
+
type: Boolean,
|
|
391
|
+
default: false
|
|
392
|
+
},
|
|
393
|
+
/**
|
|
394
|
+
* Flag to determine rather open map UI should be
|
|
395
|
+
* presented or not.
|
|
396
|
+
*/
|
|
397
|
+
enableOpenMapUI: {
|
|
398
|
+
type: Boolean,
|
|
399
|
+
default: false,
|
|
400
|
+
},
|
|
401
|
+
openMapOptions: {
|
|
402
|
+
type: Array
|
|
403
|
+
},
|
|
404
|
+
availableSpecies: {
|
|
405
|
+
type: Object,
|
|
406
|
+
default: function() {
|
|
407
|
+
return {
|
|
408
|
+
"Human Female":{taxo: "NCBITaxon:9606", biologicalSex: "PATO:0000383", iconClass:"mapicon-icon_human", displayWarning:true},
|
|
409
|
+
"Human Male":{taxo: "NCBITaxon:9606", biologicalSex: "PATO:0000384", iconClass:"mapicon-icon_human", displayWarning:true},
|
|
410
|
+
"Rat":{taxo: "NCBITaxon:10114", iconClass:"mapicon-icon_rat", displayLatestChanges: true},
|
|
411
|
+
"Mouse":{taxo: "NCBITaxon:10090", iconClass:"mapicon-icon_mouse", displayWarning: true},
|
|
412
|
+
"Pig":{taxo: "NCBITaxon:9823", iconClass:"mapicon-icon_pig", displayWarning: true},
|
|
413
|
+
"Cat":{taxo: "NCBITaxon:9685", iconClass:"mapicon-icon_cat", displayWarning: true},
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
},
|
|
417
|
+
/**
|
|
418
|
+
* State containing state of the flatmap.
|
|
419
|
+
*/
|
|
420
|
+
state: {
|
|
421
|
+
type: Object,
|
|
422
|
+
default: undefined,
|
|
423
|
+
},
|
|
424
|
+
/**
|
|
425
|
+
* Specify the endpoint of the flatmap server.
|
|
426
|
+
*/
|
|
427
|
+
flatmapAPI: {
|
|
428
|
+
type: String,
|
|
429
|
+
default: "https://mapcore-demo.org/current/flatmap/v3/"
|
|
430
|
+
},
|
|
431
|
+
sparcAPI: {
|
|
432
|
+
type: String,
|
|
433
|
+
default: "https://api.sparc.science/"
|
|
434
|
+
}
|
|
435
|
+
},
|
|
436
|
+
data: function() {
|
|
437
|
+
return {
|
|
438
|
+
activeSpecies: undefined,
|
|
439
|
+
appendToBody: false,
|
|
440
|
+
speciesList: {},
|
|
441
|
+
requireInitialisation: true
|
|
442
|
+
};
|
|
443
|
+
},
|
|
444
|
+
watch: {
|
|
445
|
+
state: {
|
|
446
|
+
handler: function(state) {
|
|
447
|
+
this.setState(state);
|
|
448
|
+
},
|
|
449
|
+
immediate: true,
|
|
450
|
+
deep: true,
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
};
|
|
454
|
+
</script>
|
|
455
|
+
|
|
456
|
+
<style scoped lang="scss">
|
|
457
|
+
@import "~element-ui/packages/theme-chalk/src/select";
|
|
458
|
+
@import "~element-ui/packages/theme-chalk/src/option";
|
|
459
|
+
|
|
460
|
+
.multi-container {
|
|
461
|
+
height: 100%;
|
|
462
|
+
width: 100%;
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
.species-display-text {
|
|
466
|
+
width: 47px;
|
|
467
|
+
height: 20px;
|
|
468
|
+
color: rgb(48, 49, 51);
|
|
469
|
+
font-size: 14px;
|
|
470
|
+
font-weight: normal;
|
|
471
|
+
line-height: 20px;
|
|
472
|
+
left:24px;
|
|
473
|
+
top:16px;
|
|
474
|
+
position: absolute;
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
.select-box {
|
|
478
|
+
width: 120px;
|
|
479
|
+
border-radius: 4px;
|
|
480
|
+
border: 1px solid rgb(144, 147, 153);
|
|
481
|
+
background-color: var(--white);
|
|
482
|
+
font-weight: 500;
|
|
483
|
+
color:rgb(48, 49, 51);
|
|
484
|
+
left: 16px;
|
|
485
|
+
top: 44px;
|
|
486
|
+
position: absolute;
|
|
487
|
+
::v-deep .el-input__inner {
|
|
488
|
+
color: rgb(48, 49, 51);
|
|
489
|
+
padding-top: 0.25em;
|
|
490
|
+
}
|
|
491
|
+
::v-deep .el-input__inner {
|
|
492
|
+
&is-focus, &:focus {
|
|
493
|
+
border: 1px solid $app-primary-color;
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
|
|
499
|
+
::v-deep .flatmap_dropdown {
|
|
500
|
+
min-width: 160px!important;
|
|
501
|
+
.el-select-dropdown__item {
|
|
502
|
+
white-space: nowrap;
|
|
503
|
+
text-align: left;
|
|
504
|
+
&.selected {
|
|
505
|
+
color: $app-primary-color;
|
|
506
|
+
font-weight: normal;
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
::v-deep .flatmap-popper {
|
|
512
|
+
padding: 6px 4px;
|
|
513
|
+
font-size:12px;
|
|
514
|
+
color: rgb(48, 49, 51);
|
|
515
|
+
background-color: #f3ecf6;
|
|
516
|
+
border: 1px solid $app-primary-color;
|
|
517
|
+
white-space: nowrap;
|
|
518
|
+
min-width: unset;
|
|
519
|
+
&.right-popper {
|
|
520
|
+
.popper__arrow {
|
|
521
|
+
border-right-color: $app-primary-color !important;
|
|
522
|
+
&:after {
|
|
523
|
+
border-right-color: #f3ecf6 !important;
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
::v-deep .flatmap-marker-popup{
|
|
530
|
+
background-color: #f0f0f000 !important;
|
|
531
|
+
box-shadow: none !important;
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
</style>
|
|
535
|
+
|