@abi-software/flatmapvuer 0.3.9 → 0.3.10-beta
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/LICENSE +201 -201
- package/README.md +105 -105
- package/babel.config.js +14 -14
- package/dist/flatmapvuer.common.js +2096 -4085
- package/dist/flatmapvuer.common.js.map +1 -1
- package/dist/flatmapvuer.css +1 -1
- package/dist/flatmapvuer.umd.js +2096 -4085
- package/dist/flatmapvuer.umd.js.map +1 -1
- package/dist/flatmapvuer.umd.min.js +1 -1
- package/dist/flatmapvuer.umd.min.js.map +1 -1
- package/package-lock.json +14121 -14210
- package/package.json +71 -71
- package/public/index.html +17 -17
- package/src/App.vue +162 -164
- package/src/assets/_variables.scss +43 -43
- package/src/assets/styles.scss +7 -7
- package/src/components/EventBus.js +2 -2
- package/src/components/FlatmapVuer.vue +1442 -1413
- package/src/components/MultiFlatmapVuer.vue +361 -361
- package/src/components/PubmedViewer.vue +149 -198
- package/src/components/Tooltip.vue +594 -591
- package/src/components/index.js +9 -9
- package/src/components/legends/Legends.vue +66 -66
- 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/legends/legend.svg +25 -25
- package/src/main.js +8 -8
- package/src/nerve-map.js +99 -0
- package/vue.config.js +31 -31
|
@@ -1,361 +1,361 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="multi-container">
|
|
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="flatmapChanged"
|
|
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
|
-
:biologicalSex="item.biologicalSex"
|
|
35
|
-
:displayWarning="item.displayWarning"
|
|
36
|
-
:warningMessage="warningMessage"
|
|
37
|
-
:displayLatestChanges="item.displayLatestChanges"
|
|
38
|
-
:latestChangesMessage="item.latestChangesMessage"
|
|
39
|
-
:ref="key"
|
|
40
|
-
@resource-selected="FlatmapSelected"
|
|
41
|
-
@ready="FlatmapReady"
|
|
42
|
-
@pan-zoom-callback="panZoomCallback"
|
|
43
|
-
:featureInfo="featureInfo"
|
|
44
|
-
:minZoom="minZoom"
|
|
45
|
-
:pathControls="pathControls"
|
|
46
|
-
:searchable="searchable"
|
|
47
|
-
:helpMode="helpMode"
|
|
48
|
-
:renderAtMounted="renderAtMounted"
|
|
49
|
-
:displayMinimap="displayMinimap"
|
|
50
|
-
style="height:100%"
|
|
51
|
-
:flatmapAPI="flatmapAPI"
|
|
52
|
-
:sparcAPI="sparcAPI"
|
|
53
|
-
/>
|
|
54
|
-
</div>
|
|
55
|
-
</template>
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
<script>
|
|
59
|
-
/* eslint-disable no-alert, no-console */
|
|
60
|
-
import EventBus from './EventBus'
|
|
61
|
-
import Vue from "vue";
|
|
62
|
-
import FlatmapVuer from "./FlatmapVuer.vue";
|
|
63
|
-
import { Col, Option, Select, Row, Popover } from "element-ui";
|
|
64
|
-
import lang from "element-ui/lib/locale/lang/en";
|
|
65
|
-
import locale from "element-ui/lib/locale";
|
|
66
|
-
locale.use(lang);
|
|
67
|
-
Vue.use(Col);
|
|
68
|
-
Vue.use(Row);
|
|
69
|
-
Vue.use(Option);
|
|
70
|
-
Vue.use(Select);
|
|
71
|
-
Vue.use(Popover)
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
export default {
|
|
75
|
-
name: "MultiFlatmapVuer",
|
|
76
|
-
components: {
|
|
77
|
-
FlatmapVuer
|
|
78
|
-
},
|
|
79
|
-
mounted: function() {
|
|
80
|
-
this.initialise();
|
|
81
|
-
EventBus.$on('onActionClick', (action) =>{
|
|
82
|
-
this.FlatmapSelected(action)
|
|
83
|
-
})
|
|
84
|
-
},
|
|
85
|
-
methods: {
|
|
86
|
-
initialise: function() {
|
|
87
|
-
return new Promise(resolve => {
|
|
88
|
-
fetch(this.flatmapAPI)
|
|
89
|
-
.then(response => response.json())
|
|
90
|
-
.then(data => {
|
|
91
|
-
this.speciesList= {};
|
|
92
|
-
Object.keys(this.availableSpecies).forEach(key => {
|
|
93
|
-
for (let i = 0; i < data.length; i++) {
|
|
94
|
-
if (this.availableSpecies[key].taxo === data[i].taxon) {
|
|
95
|
-
if (this.availableSpecies[key].biologicalSex) {
|
|
96
|
-
if (data[i].biologicalSex &&
|
|
97
|
-
data[i].biologicalSex === this.availableSpecies[key].biologicalSex) {
|
|
98
|
-
this.speciesList[key] = this.availableSpecies[key];
|
|
99
|
-
break;
|
|
100
|
-
}
|
|
101
|
-
} else {
|
|
102
|
-
this.speciesList[key] = this.availableSpecies[key];
|
|
103
|
-
break;
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
});
|
|
108
|
-
if (!this.state) {
|
|
109
|
-
if (this.initial && this.speciesList[this.initial] !== undefined) {
|
|
110
|
-
this.activeSpecies = this.initial;
|
|
111
|
-
} else {
|
|
112
|
-
this.activeSpecies = Object.keys(this.speciesList)[0];
|
|
113
|
-
}
|
|
114
|
-
Vue.nextTick(() => {
|
|
115
|
-
if (this.$refs[this.activeSpecies])
|
|
116
|
-
this.$refs[this.activeSpecies][0].createFlatmap();
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
resolve();
|
|
120
|
-
});
|
|
121
|
-
})
|
|
122
|
-
},
|
|
123
|
-
FlatmapSelected: function(resource) {
|
|
124
|
-
this.$emit("resource-selected", resource);
|
|
125
|
-
},
|
|
126
|
-
FlatmapReady: function(component) {
|
|
127
|
-
this.$emit("ready", component);
|
|
128
|
-
},
|
|
129
|
-
getCoordinatesOfLastClick: function() {
|
|
130
|
-
const flatmap = this.$refs[this.activeSpecies];
|
|
131
|
-
if (flatmap && flatmap[0]) {
|
|
132
|
-
return flatmap[0].getCoordinatesOfLastClick();
|
|
133
|
-
}
|
|
134
|
-
return undefined;
|
|
135
|
-
},
|
|
136
|
-
getCurrentFlatmap: function() {
|
|
137
|
-
return this.$refs[this.activeSpecies][0];
|
|
138
|
-
},
|
|
139
|
-
panZoomCallback: function(payload) {
|
|
140
|
-
this.$emit("pan-zoom-callback", payload);
|
|
141
|
-
},
|
|
142
|
-
showPopup: function(featureId, node, options) {
|
|
143
|
-
let map = this.getCurrentFlatmap();
|
|
144
|
-
map.showPopup(featureId, node, options);
|
|
145
|
-
},
|
|
146
|
-
showMarkerPopup: function(featureId, node, options) {
|
|
147
|
-
let map = this.getCurrentFlatmap();
|
|
148
|
-
map.showMarkerPopup(featureId, node, options);
|
|
149
|
-
},
|
|
150
|
-
flatmapChanged: function(species){
|
|
151
|
-
if (this.activeSpecies != species)
|
|
152
|
-
this.activeSpecies = species;
|
|
153
|
-
this.$refs[this.activeSpecies][0].createFlatmap();
|
|
154
|
-
this.$emit('flatmapChanged', this.activeSpecies);
|
|
155
|
-
},
|
|
156
|
-
/**
|
|
157
|
-
* Function used for getting the current states of the scene. This exported states
|
|
158
|
-
* can be imported using the importStates method.
|
|
159
|
-
*
|
|
160
|
-
* @public
|
|
161
|
-
*/
|
|
162
|
-
getState: function() {
|
|
163
|
-
let state = {
|
|
164
|
-
species: this.activeSpecies,
|
|
165
|
-
state: undefined,
|
|
166
|
-
};
|
|
167
|
-
let map = this.getCurrentFlatmap();
|
|
168
|
-
state.state = map.getState();
|
|
169
|
-
return state;
|
|
170
|
-
},
|
|
171
|
-
/**
|
|
172
|
-
* Function used for importing the states of the scene. This exported states
|
|
173
|
-
* can be imported using the read states method.
|
|
174
|
-
*
|
|
175
|
-
* @public
|
|
176
|
-
*/
|
|
177
|
-
setState: function(state) {
|
|
178
|
-
if (state) {
|
|
179
|
-
this.initialise().then(() => {
|
|
180
|
-
if (state.species && state.species !== this.activeSpecies) {
|
|
181
|
-
this.activeSpecies = state.species;
|
|
182
|
-
if (state.state) {
|
|
183
|
-
//Wait for next tick when the refs are ready for rendering
|
|
184
|
-
this.$nextTick(() => {
|
|
185
|
-
this.$refs[this.activeSpecies][0].createFlatmap(state.state);
|
|
186
|
-
this.$emit('flatmapChanged', this.activeSpecies);
|
|
187
|
-
})
|
|
188
|
-
}
|
|
189
|
-
} else if (state.state) {
|
|
190
|
-
let map = this.getCurrentFlatmap();
|
|
191
|
-
map.setState(state.state);
|
|
192
|
-
}
|
|
193
|
-
})
|
|
194
|
-
}
|
|
195
|
-
},
|
|
196
|
-
resourceSelected: function(action) {
|
|
197
|
-
this.$emit("resource-selected", action);
|
|
198
|
-
},
|
|
199
|
-
},
|
|
200
|
-
props: {
|
|
201
|
-
showLayer: {
|
|
202
|
-
type: Boolean,
|
|
203
|
-
default: false
|
|
204
|
-
},
|
|
205
|
-
featureInfo: {
|
|
206
|
-
type: Boolean,
|
|
207
|
-
default: false
|
|
208
|
-
},
|
|
209
|
-
pathControls: {
|
|
210
|
-
type: Boolean,
|
|
211
|
-
default: true
|
|
212
|
-
},
|
|
213
|
-
searchable: {
|
|
214
|
-
type: Boolean,
|
|
215
|
-
default: false
|
|
216
|
-
},
|
|
217
|
-
/**
|
|
218
|
-
* Initial species for the flatmap.
|
|
219
|
-
* This value will be ignored if a valid state object is provided.
|
|
220
|
-
*/
|
|
221
|
-
initial: {
|
|
222
|
-
type: String,
|
|
223
|
-
default: ""
|
|
224
|
-
},
|
|
225
|
-
minZoom: {
|
|
226
|
-
type: Number,
|
|
227
|
-
default: 4
|
|
228
|
-
},
|
|
229
|
-
renderAtMounted: {
|
|
230
|
-
type: Boolean,
|
|
231
|
-
default: false
|
|
232
|
-
},
|
|
233
|
-
helpMode: {
|
|
234
|
-
type: Boolean,
|
|
235
|
-
default: false
|
|
236
|
-
},
|
|
237
|
-
displayMinimap: {
|
|
238
|
-
type: Boolean,
|
|
239
|
-
default: false
|
|
240
|
-
},
|
|
241
|
-
warningMessage: {
|
|
242
|
-
type: String,
|
|
243
|
-
default: "Beta feature - This map is based on the connectivity of a rat. New connectivity and species specificity will be added as the SPARC program progress."
|
|
244
|
-
},
|
|
245
|
-
availableSpecies: {},
|
|
246
|
-
/**
|
|
247
|
-
* State containing state of the flatmap.
|
|
248
|
-
*/
|
|
249
|
-
state: {
|
|
250
|
-
type: Object,
|
|
251
|
-
default: undefined,
|
|
252
|
-
},
|
|
253
|
-
/**
|
|
254
|
-
* Specify the endpoint of the flatmap server.
|
|
255
|
-
*/
|
|
256
|
-
flatmapAPI: {
|
|
257
|
-
type: String,
|
|
258
|
-
default: "https://mapcore-demo.org/current/flatmap/v3/"
|
|
259
|
-
},
|
|
260
|
-
sparcAPI: {
|
|
261
|
-
type: String,
|
|
262
|
-
default: "https://api.sparc.science/"
|
|
263
|
-
}
|
|
264
|
-
},
|
|
265
|
-
data: function() {
|
|
266
|
-
return {
|
|
267
|
-
activeSpecies: undefined,
|
|
268
|
-
appendToBody: false,
|
|
269
|
-
speciesList: {}
|
|
270
|
-
};
|
|
271
|
-
},
|
|
272
|
-
watch: {
|
|
273
|
-
state: {
|
|
274
|
-
handler: function(state) {
|
|
275
|
-
this.setState(state);
|
|
276
|
-
},
|
|
277
|
-
immediate: true,
|
|
278
|
-
deep: true,
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
};
|
|
282
|
-
</script>
|
|
283
|
-
|
|
284
|
-
<style scoped lang="scss">
|
|
285
|
-
@import "~element-ui/packages/theme-chalk/src/select";
|
|
286
|
-
@import "~element-ui/packages/theme-chalk/src/option";
|
|
287
|
-
|
|
288
|
-
.multi-container {
|
|
289
|
-
height: 100%;
|
|
290
|
-
width: 100%;
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
.species-display-text {
|
|
294
|
-
width: 47px;
|
|
295
|
-
height: 20px;
|
|
296
|
-
color: rgb(48, 49, 51);
|
|
297
|
-
font-size: 14px;
|
|
298
|
-
font-weight: normal;
|
|
299
|
-
line-height: 20px;
|
|
300
|
-
left:24px;
|
|
301
|
-
top:16px;
|
|
302
|
-
position: absolute;
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
.select-box {
|
|
306
|
-
width: 120px;
|
|
307
|
-
border-radius: 4px;
|
|
308
|
-
border: 1px solid rgb(144, 147, 153);
|
|
309
|
-
background-color: var(--white);
|
|
310
|
-
font-weight: 500;
|
|
311
|
-
color:rgb(48, 49, 51);;
|
|
312
|
-
left: 16px;
|
|
313
|
-
top: 44px;
|
|
314
|
-
position: absolute;
|
|
315
|
-
::v-deep .el-input__inner {
|
|
316
|
-
color: rgb(48, 49, 51);
|
|
317
|
-
padding-top: 0.25em;
|
|
318
|
-
.is-focus {
|
|
319
|
-
border: 1px solid $app-primary-color;
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
::v-deep .flatmap_dropdown {
|
|
325
|
-
min-width: 160px!important;
|
|
326
|
-
.el-select-dropdown__item {
|
|
327
|
-
white-space: nowrap;
|
|
328
|
-
text-align: left;
|
|
329
|
-
&.selected {
|
|
330
|
-
color: $app-primary-color;
|
|
331
|
-
font-weight: normal;
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
::v-deep .flatmap-popper {
|
|
337
|
-
padding: 6px 4px;
|
|
338
|
-
font-size:12px;
|
|
339
|
-
color: rgb(48, 49, 51);
|
|
340
|
-
background-color: #f3ecf6;
|
|
341
|
-
border: 1px solid $app-primary-color;
|
|
342
|
-
white-space: nowrap;
|
|
343
|
-
min-width: unset;
|
|
344
|
-
&.right-popper {
|
|
345
|
-
.popper__arrow {
|
|
346
|
-
border-right-color: $app-primary-color !important;
|
|
347
|
-
&:after {
|
|
348
|
-
border-right-color: #f3ecf6 !important;
|
|
349
|
-
}
|
|
350
|
-
}
|
|
351
|
-
}
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
::v-deep .flatmap-marker-popup{
|
|
355
|
-
background-color: #f0f0f000 !important;
|
|
356
|
-
box-shadow: none !important;
|
|
357
|
-
}
|
|
358
|
-
|
|
359
|
-
</style>
|
|
360
|
-
|
|
361
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<div class="multi-container">
|
|
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="flatmapChanged"
|
|
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
|
+
:biologicalSex="item.biologicalSex"
|
|
35
|
+
:displayWarning="item.displayWarning"
|
|
36
|
+
:warningMessage="warningMessage"
|
|
37
|
+
:displayLatestChanges="item.displayLatestChanges"
|
|
38
|
+
:latestChangesMessage="item.latestChangesMessage"
|
|
39
|
+
:ref="key"
|
|
40
|
+
@resource-selected="FlatmapSelected"
|
|
41
|
+
@ready="FlatmapReady"
|
|
42
|
+
@pan-zoom-callback="panZoomCallback"
|
|
43
|
+
:featureInfo="featureInfo"
|
|
44
|
+
:minZoom="minZoom"
|
|
45
|
+
:pathControls="pathControls"
|
|
46
|
+
:searchable="searchable"
|
|
47
|
+
:helpMode="helpMode"
|
|
48
|
+
:renderAtMounted="renderAtMounted"
|
|
49
|
+
:displayMinimap="displayMinimap"
|
|
50
|
+
style="height:100%"
|
|
51
|
+
:flatmapAPI="flatmapAPI"
|
|
52
|
+
:sparcAPI="sparcAPI"
|
|
53
|
+
/>
|
|
54
|
+
</div>
|
|
55
|
+
</template>
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
<script>
|
|
59
|
+
/* eslint-disable no-alert, no-console */
|
|
60
|
+
import EventBus from './EventBus'
|
|
61
|
+
import Vue from "vue";
|
|
62
|
+
import FlatmapVuer from "./FlatmapVuer.vue";
|
|
63
|
+
import { Col, Option, Select, Row, Popover } from "element-ui";
|
|
64
|
+
import lang from "element-ui/lib/locale/lang/en";
|
|
65
|
+
import locale from "element-ui/lib/locale";
|
|
66
|
+
locale.use(lang);
|
|
67
|
+
Vue.use(Col);
|
|
68
|
+
Vue.use(Row);
|
|
69
|
+
Vue.use(Option);
|
|
70
|
+
Vue.use(Select);
|
|
71
|
+
Vue.use(Popover)
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
export default {
|
|
75
|
+
name: "MultiFlatmapVuer",
|
|
76
|
+
components: {
|
|
77
|
+
FlatmapVuer
|
|
78
|
+
},
|
|
79
|
+
mounted: function() {
|
|
80
|
+
this.initialise();
|
|
81
|
+
EventBus.$on('onActionClick', (action) =>{
|
|
82
|
+
this.FlatmapSelected(action)
|
|
83
|
+
})
|
|
84
|
+
},
|
|
85
|
+
methods: {
|
|
86
|
+
initialise: function() {
|
|
87
|
+
return new Promise(resolve => {
|
|
88
|
+
fetch(this.flatmapAPI)
|
|
89
|
+
.then(response => response.json())
|
|
90
|
+
.then(data => {
|
|
91
|
+
this.speciesList= {};
|
|
92
|
+
Object.keys(this.availableSpecies).forEach(key => {
|
|
93
|
+
for (let i = 0; i < data.length; i++) {
|
|
94
|
+
if (this.availableSpecies[key].taxo === data[i].taxon) {
|
|
95
|
+
if (this.availableSpecies[key].biologicalSex) {
|
|
96
|
+
if (data[i].biologicalSex &&
|
|
97
|
+
data[i].biologicalSex === this.availableSpecies[key].biologicalSex) {
|
|
98
|
+
this.speciesList[key] = this.availableSpecies[key];
|
|
99
|
+
break;
|
|
100
|
+
}
|
|
101
|
+
} else {
|
|
102
|
+
this.speciesList[key] = this.availableSpecies[key];
|
|
103
|
+
break;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
if (!this.state) {
|
|
109
|
+
if (this.initial && this.speciesList[this.initial] !== undefined) {
|
|
110
|
+
this.activeSpecies = this.initial;
|
|
111
|
+
} else {
|
|
112
|
+
this.activeSpecies = Object.keys(this.speciesList)[0];
|
|
113
|
+
}
|
|
114
|
+
Vue.nextTick(() => {
|
|
115
|
+
if (this.$refs[this.activeSpecies])
|
|
116
|
+
this.$refs[this.activeSpecies][0].createFlatmap();
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
resolve();
|
|
120
|
+
});
|
|
121
|
+
})
|
|
122
|
+
},
|
|
123
|
+
FlatmapSelected: function(resource) {
|
|
124
|
+
this.$emit("resource-selected", resource);
|
|
125
|
+
},
|
|
126
|
+
FlatmapReady: function(component) {
|
|
127
|
+
this.$emit("ready", component);
|
|
128
|
+
},
|
|
129
|
+
getCoordinatesOfLastClick: function() {
|
|
130
|
+
const flatmap = this.$refs[this.activeSpecies];
|
|
131
|
+
if (flatmap && flatmap[0]) {
|
|
132
|
+
return flatmap[0].getCoordinatesOfLastClick();
|
|
133
|
+
}
|
|
134
|
+
return undefined;
|
|
135
|
+
},
|
|
136
|
+
getCurrentFlatmap: function() {
|
|
137
|
+
return this.$refs[this.activeSpecies][0];
|
|
138
|
+
},
|
|
139
|
+
panZoomCallback: function(payload) {
|
|
140
|
+
this.$emit("pan-zoom-callback", payload);
|
|
141
|
+
},
|
|
142
|
+
showPopup: function(featureId, node, options) {
|
|
143
|
+
let map = this.getCurrentFlatmap();
|
|
144
|
+
map.showPopup(featureId, node, options);
|
|
145
|
+
},
|
|
146
|
+
showMarkerPopup: function(featureId, node, options) {
|
|
147
|
+
let map = this.getCurrentFlatmap();
|
|
148
|
+
map.showMarkerPopup(featureId, node, options);
|
|
149
|
+
},
|
|
150
|
+
flatmapChanged: function(species){
|
|
151
|
+
if (this.activeSpecies != species)
|
|
152
|
+
this.activeSpecies = species;
|
|
153
|
+
this.$refs[this.activeSpecies][0].createFlatmap();
|
|
154
|
+
this.$emit('flatmapChanged', this.activeSpecies);
|
|
155
|
+
},
|
|
156
|
+
/**
|
|
157
|
+
* Function used for getting the current states of the scene. This exported states
|
|
158
|
+
* can be imported using the importStates method.
|
|
159
|
+
*
|
|
160
|
+
* @public
|
|
161
|
+
*/
|
|
162
|
+
getState: function() {
|
|
163
|
+
let state = {
|
|
164
|
+
species: this.activeSpecies,
|
|
165
|
+
state: undefined,
|
|
166
|
+
};
|
|
167
|
+
let map = this.getCurrentFlatmap();
|
|
168
|
+
state.state = map.getState();
|
|
169
|
+
return state;
|
|
170
|
+
},
|
|
171
|
+
/**
|
|
172
|
+
* Function used for importing the states of the scene. This exported states
|
|
173
|
+
* can be imported using the read states method.
|
|
174
|
+
*
|
|
175
|
+
* @public
|
|
176
|
+
*/
|
|
177
|
+
setState: function(state) {
|
|
178
|
+
if (state) {
|
|
179
|
+
this.initialise().then(() => {
|
|
180
|
+
if (state.species && state.species !== this.activeSpecies) {
|
|
181
|
+
this.activeSpecies = state.species;
|
|
182
|
+
if (state.state) {
|
|
183
|
+
//Wait for next tick when the refs are ready for rendering
|
|
184
|
+
this.$nextTick(() => {
|
|
185
|
+
this.$refs[this.activeSpecies][0].createFlatmap(state.state);
|
|
186
|
+
this.$emit('flatmapChanged', this.activeSpecies);
|
|
187
|
+
})
|
|
188
|
+
}
|
|
189
|
+
} else if (state.state) {
|
|
190
|
+
let map = this.getCurrentFlatmap();
|
|
191
|
+
map.setState(state.state);
|
|
192
|
+
}
|
|
193
|
+
})
|
|
194
|
+
}
|
|
195
|
+
},
|
|
196
|
+
resourceSelected: function(action) {
|
|
197
|
+
this.$emit("resource-selected", action);
|
|
198
|
+
},
|
|
199
|
+
},
|
|
200
|
+
props: {
|
|
201
|
+
showLayer: {
|
|
202
|
+
type: Boolean,
|
|
203
|
+
default: false
|
|
204
|
+
},
|
|
205
|
+
featureInfo: {
|
|
206
|
+
type: Boolean,
|
|
207
|
+
default: false
|
|
208
|
+
},
|
|
209
|
+
pathControls: {
|
|
210
|
+
type: Boolean,
|
|
211
|
+
default: true
|
|
212
|
+
},
|
|
213
|
+
searchable: {
|
|
214
|
+
type: Boolean,
|
|
215
|
+
default: false
|
|
216
|
+
},
|
|
217
|
+
/**
|
|
218
|
+
* Initial species for the flatmap.
|
|
219
|
+
* This value will be ignored if a valid state object is provided.
|
|
220
|
+
*/
|
|
221
|
+
initial: {
|
|
222
|
+
type: String,
|
|
223
|
+
default: ""
|
|
224
|
+
},
|
|
225
|
+
minZoom: {
|
|
226
|
+
type: Number,
|
|
227
|
+
default: 4
|
|
228
|
+
},
|
|
229
|
+
renderAtMounted: {
|
|
230
|
+
type: Boolean,
|
|
231
|
+
default: false
|
|
232
|
+
},
|
|
233
|
+
helpMode: {
|
|
234
|
+
type: Boolean,
|
|
235
|
+
default: false
|
|
236
|
+
},
|
|
237
|
+
displayMinimap: {
|
|
238
|
+
type: Boolean,
|
|
239
|
+
default: false
|
|
240
|
+
},
|
|
241
|
+
warningMessage: {
|
|
242
|
+
type: String,
|
|
243
|
+
default: "Beta feature - This map is based on the connectivity of a rat. New connectivity and species specificity will be added as the SPARC program progress."
|
|
244
|
+
},
|
|
245
|
+
availableSpecies: {},
|
|
246
|
+
/**
|
|
247
|
+
* State containing state of the flatmap.
|
|
248
|
+
*/
|
|
249
|
+
state: {
|
|
250
|
+
type: Object,
|
|
251
|
+
default: undefined,
|
|
252
|
+
},
|
|
253
|
+
/**
|
|
254
|
+
* Specify the endpoint of the flatmap server.
|
|
255
|
+
*/
|
|
256
|
+
flatmapAPI: {
|
|
257
|
+
type: String,
|
|
258
|
+
default: "https://mapcore-demo.org/current/flatmap/v3/"
|
|
259
|
+
},
|
|
260
|
+
sparcAPI: {
|
|
261
|
+
type: String,
|
|
262
|
+
default: "https://api.sparc.science/"
|
|
263
|
+
}
|
|
264
|
+
},
|
|
265
|
+
data: function() {
|
|
266
|
+
return {
|
|
267
|
+
activeSpecies: undefined,
|
|
268
|
+
appendToBody: false,
|
|
269
|
+
speciesList: {}
|
|
270
|
+
};
|
|
271
|
+
},
|
|
272
|
+
watch: {
|
|
273
|
+
state: {
|
|
274
|
+
handler: function(state) {
|
|
275
|
+
this.setState(state);
|
|
276
|
+
},
|
|
277
|
+
immediate: true,
|
|
278
|
+
deep: true,
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
};
|
|
282
|
+
</script>
|
|
283
|
+
|
|
284
|
+
<style scoped lang="scss">
|
|
285
|
+
@import "~element-ui/packages/theme-chalk/src/select";
|
|
286
|
+
@import "~element-ui/packages/theme-chalk/src/option";
|
|
287
|
+
|
|
288
|
+
.multi-container {
|
|
289
|
+
height: 100%;
|
|
290
|
+
width: 100%;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
.species-display-text {
|
|
294
|
+
width: 47px;
|
|
295
|
+
height: 20px;
|
|
296
|
+
color: rgb(48, 49, 51);
|
|
297
|
+
font-size: 14px;
|
|
298
|
+
font-weight: normal;
|
|
299
|
+
line-height: 20px;
|
|
300
|
+
left:24px;
|
|
301
|
+
top:16px;
|
|
302
|
+
position: absolute;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
.select-box {
|
|
306
|
+
width: 120px;
|
|
307
|
+
border-radius: 4px;
|
|
308
|
+
border: 1px solid rgb(144, 147, 153);
|
|
309
|
+
background-color: var(--white);
|
|
310
|
+
font-weight: 500;
|
|
311
|
+
color:rgb(48, 49, 51);;
|
|
312
|
+
left: 16px;
|
|
313
|
+
top: 44px;
|
|
314
|
+
position: absolute;
|
|
315
|
+
::v-deep .el-input__inner {
|
|
316
|
+
color: rgb(48, 49, 51);
|
|
317
|
+
padding-top: 0.25em;
|
|
318
|
+
.is-focus {
|
|
319
|
+
border: 1px solid $app-primary-color;
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
::v-deep .flatmap_dropdown {
|
|
325
|
+
min-width: 160px!important;
|
|
326
|
+
.el-select-dropdown__item {
|
|
327
|
+
white-space: nowrap;
|
|
328
|
+
text-align: left;
|
|
329
|
+
&.selected {
|
|
330
|
+
color: $app-primary-color;
|
|
331
|
+
font-weight: normal;
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
::v-deep .flatmap-popper {
|
|
337
|
+
padding: 6px 4px;
|
|
338
|
+
font-size:12px;
|
|
339
|
+
color: rgb(48, 49, 51);
|
|
340
|
+
background-color: #f3ecf6;
|
|
341
|
+
border: 1px solid $app-primary-color;
|
|
342
|
+
white-space: nowrap;
|
|
343
|
+
min-width: unset;
|
|
344
|
+
&.right-popper {
|
|
345
|
+
.popper__arrow {
|
|
346
|
+
border-right-color: $app-primary-color !important;
|
|
347
|
+
&:after {
|
|
348
|
+
border-right-color: #f3ecf6 !important;
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
::v-deep .flatmap-marker-popup{
|
|
355
|
+
background-color: #f0f0f000 !important;
|
|
356
|
+
box-shadow: none !important;
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
</style>
|
|
360
|
+
|
|
361
|
+
|