@abi-software/mapintegratedvuer 0.7.2-vue3.0-alpha.0 → 1.0.0
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 +150 -150
- package/assets/styleguide.css +19 -19
- package/cypress.config.js +23 -23
- package/dist/index.html +17 -17
- package/dist/mapintegratedvuer.js +74203 -73758
- package/dist/mapintegratedvuer.umd.cjs +878 -515
- package/dist/style.css +1 -1
- package/package.json +134 -135
- package/public/index.html +17 -17
- package/reporter-config.json +9 -9
- package/src/App.vue +245 -245
- package/src/assets/_variables.scss +43 -43
- package/src/assets/fonts/mapicon-species.eot +0 -0
- package/src/assets/fonts/mapicon-species.ttf +0 -0
- package/src/assets/fonts/mapicon-species.woff +0 -0
- package/src/assets/header-icon.scss +67 -67
- package/src/assets/mapicon-species-style.css +41 -41
- package/src/assets/styles.scss +9 -9
- package/src/components/ContentBar.vue +376 -376
- package/src/components/ContentVuer.vue +217 -217
- package/src/components/ContextCard.vue +385 -385
- package/src/components/ContextHelp.vue +73 -73
- package/src/components/CustomSplitter.vue +151 -151
- package/src/components/DatasetHeader.vue +97 -97
- package/src/components/DialogToolbarContent.vue +464 -464
- package/src/components/EventBus.js +3 -3
- package/src/components/FlatmapContextCard.vue +134 -134
- package/src/components/MapContent.vue +328 -333
- package/src/components/ResizeSensor.vue +47 -47
- package/src/components/SearchControls.vue +115 -115
- package/src/components/SimulatedData.js +721 -721
- package/src/components/SplitDialog.vue +287 -287
- package/src/components/SplitFlow.vue +414 -414
- package/src/components/index.js +7 -7
- package/src/components/markerZoomLevelsHardCoded.js +255 -255
- package/src/components/scripts/utilities.js +173 -173
- package/src/components/viewers/Flatmap.vue +145 -145
- package/src/components/viewers/Iframe.vue +31 -31
- package/src/components/viewers/MultiFlatmap.vue +384 -384
- package/src/components/viewers/Plot.vue +23 -23
- package/src/components/viewers/Scaffold.vue +198 -198
- package/src/components/viewers/Simulation.vue +21 -21
- package/src/icons/yellowstar.js +1 -1
- package/src/main.js +31 -31
- package/src/mixins/ContentMixin.js +438 -438
- package/src/mixins/DynamicMarkerMixin.js +88 -88
- package/src/mixins/S3Bucket.vue +37 -37
- package/src/stores/entries.js +40 -40
- package/src/stores/index.js +23 -23
- package/src/stores/settings.js +144 -144
- package/src/stores/splitFlow.js +523 -523
- package/static.json +7 -7
- package/vite.config.js +70 -70
- package/vite.static-build.js +12 -12
- package/vitest.workspace.js +3 -3
- package/vuese-generator.js +65 -65
- package/assets/gazelle-icons-no-background.css +0 -32
- package/dist/matterport.pdf +0 -0
- package/dist/test.txt +0 -0
- package/public/matterport.pdf +0 -0
- package/public/test.txt +0 -0
- package/q.json +0 -690
- package/src/mixins/RetrieveContextCardMixin.js +0 -82
- package/tsconfig.json +0 -19
@@ -1,173 +1,173 @@
|
|
1
|
-
const initialDefaultState = () => {
|
2
|
-
return {
|
3
|
-
entries: [
|
4
|
-
{
|
5
|
-
resource: "Rat",
|
6
|
-
type: "MultiFlatmap",
|
7
|
-
mode: "main",
|
8
|
-
id: 1,
|
9
|
-
state: undefined,
|
10
|
-
label: "",
|
11
|
-
discoverId: undefined
|
12
|
-
}
|
13
|
-
],
|
14
|
-
};
|
15
|
-
}
|
16
|
-
|
17
|
-
const getNewMapEntry = async (type, sparcApi) => {
|
18
|
-
let entry = { };
|
19
|
-
if (type === "AC") {
|
20
|
-
entry = {
|
21
|
-
resource: "Rat",
|
22
|
-
type: "MultiFlatmap",
|
23
|
-
mode: "main",
|
24
|
-
state: undefined,
|
25
|
-
label: "",
|
26
|
-
discoverId: undefined
|
27
|
-
};
|
28
|
-
} else if (type === "FC") {
|
29
|
-
entry = {
|
30
|
-
resource: "FunctionalConnectivity",
|
31
|
-
type: "Flatmap",
|
32
|
-
mode: "main",
|
33
|
-
state: undefined,
|
34
|
-
label: "Functional",
|
35
|
-
discoverId: undefined
|
36
|
-
}
|
37
|
-
} else if (type === "3D") {
|
38
|
-
const data = await getBodyScaffoldInfo(sparcApi, "human");
|
39
|
-
entry = {
|
40
|
-
resource: data.url,
|
41
|
-
type: "Scaffold",
|
42
|
-
mode: "main",
|
43
|
-
state: undefined,
|
44
|
-
label: "Human",
|
45
|
-
discoverId: data.datasetInfo.discoverId,
|
46
|
-
contextCardUrl: data.datasetInfo.contextCardUrl,
|
47
|
-
s3uri: data.datasetInfo.s3uri,
|
48
|
-
version: data.datasetInfo.version,
|
49
|
-
isBodyScaffold: true,
|
50
|
-
};
|
51
|
-
}
|
52
|
-
|
53
|
-
return entry;
|
54
|
-
}
|
55
|
-
|
56
|
-
/*
|
57
|
-
* Initial state for the split flow
|
58
|
-
*/
|
59
|
-
const initialState = async (type, sparcApi) => {
|
60
|
-
const state = initialDefaultState();
|
61
|
-
if (type === "FC") {
|
62
|
-
state.entries[0].resource = "FunctionalConnectivity";
|
63
|
-
state.entries[0].type = "Flatmap";
|
64
|
-
state.entries[0].label = "Functional";
|
65
|
-
} else if (type === "WholeBody") {
|
66
|
-
const data = await getBodyScaffoldInfo(sparcApi, "human");
|
67
|
-
state.entries[0].resource = data.url;
|
68
|
-
state.entries[0].contextCardUrl = data.datasetInfo.contextCardUrl;
|
69
|
-
state.entries[0].discoverId = data.datasetInfo.discoverId,
|
70
|
-
state.entries[0].s3uri = data.datasetInfo.s3uri;
|
71
|
-
state.entries[0].version = data.datasetInfo.version;
|
72
|
-
state.entries[0].type = "Scaffold";
|
73
|
-
state.entries[0].label = "Human";
|
74
|
-
state.entries[0].isBodyScaffold = true;
|
75
|
-
}
|
76
|
-
|
77
|
-
return state;
|
78
|
-
}
|
79
|
-
|
80
|
-
const capitalise = term => {
|
81
|
-
if (term)
|
82
|
-
return term.charAt(0).toUpperCase() + term.slice(1);
|
83
|
-
return term;
|
84
|
-
};
|
85
|
-
|
86
|
-
/*
|
87
|
-
* Provide a list of available species for the flatmap
|
88
|
-
*/
|
89
|
-
const availableSpecies = () => {
|
90
|
-
return {
|
91
|
-
"Human Female": { taxo: "NCBITaxon:9606", biologicalSex: "PATO:0000383", iconClass: "mapicon-icon_human", displayLatestChanges: true, displayWarning: true },
|
92
|
-
"Human Male": { taxo: "NCBITaxon:9606", biologicalSex: "PATO:0000384", iconClass: "mapicon-icon_human", displayLatestChanges: true, displayWarning: true },
|
93
|
-
"Rat": { taxo: "NCBITaxon:10114", iconClass: "mapicon-icon_rat", displayLatestChanges: true, displayWarning: true },
|
94
|
-
"Mouse": { taxo: "NCBITaxon:10090", iconClass: "mapicon-icon_mouse", displayLatestChanges: true, displayWarning: true },
|
95
|
-
"Pig": { taxo: "NCBITaxon:9823", iconClass: "mapicon-icon_pig", displayLatestChanges: true, displayWarning: true },
|
96
|
-
"Cat": { taxo: "NCBITaxon:9685", iconClass: "mapicon-icon_cat", displayLatestChanges: true, displayWarning: true },
|
97
|
-
}
|
98
|
-
}
|
99
|
-
|
100
|
-
/*
|
101
|
-
* Look for the key in availableSpecies with the provided condition
|
102
|
-
*/
|
103
|
-
const findSpeciesKey = condition => {
|
104
|
-
if (condition) {
|
105
|
-
const list = availableSpecies();
|
106
|
-
for (let key in list) {
|
107
|
-
if (condition.taxo === list[key].taxo) {
|
108
|
-
if (condition.biologicalSex && list[key].biologicalSex) {
|
109
|
-
if (condition.biologicalSex === list[key].biologicalSex)
|
110
|
-
return key;
|
111
|
-
} else {
|
112
|
-
return key;
|
113
|
-
}
|
114
|
-
}
|
115
|
-
}
|
116
|
-
}
|
117
|
-
return "";
|
118
|
-
}
|
119
|
-
|
120
|
-
const extractS3BucketNameAndPrefix = uri => {
|
121
|
-
if (uri) {
|
122
|
-
const substring = uri.split("//")[1];
|
123
|
-
if (substring) {
|
124
|
-
const s3Bucket = substring.split("/")[0];
|
125
|
-
const n = substring.indexOf('/');
|
126
|
-
const s3Prefix = substring.substring(n + 1);
|
127
|
-
return {
|
128
|
-
s3Bucket,
|
129
|
-
s3Prefix
|
130
|
-
};
|
131
|
-
}
|
132
|
-
}
|
133
|
-
return undefined
|
134
|
-
}
|
135
|
-
|
136
|
-
const getBodyScaffoldInfo = async (sparcApi, species) => {
|
137
|
-
//Get body scaffold information
|
138
|
-
let url = "";
|
139
|
-
let datasetInfo = undefined;
|
140
|
-
const response = await fetch(`${sparcApi}get_body_scaffold_info/${species}`);
|
141
|
-
if (response.ok) {
|
142
|
-
const data = await response.json();
|
143
|
-
//Construct the url endpoint for downloading the scaffold
|
144
|
-
const bucketInfo = extractS3BucketNameAndPrefix(data.s3uri);
|
145
|
-
url = `${sparcApi}s3-resource/${bucketInfo.s3Prefix}files/${data.path}?s3BucketName=${bucketInfo.s3Bucket}`;
|
146
|
-
const contextCardUrl = `${sparcApi}s3-resource/${bucketInfo.s3Prefix}files/${data.contextinfo}?s3BucketName=${bucketInfo.s3Bucket}`;
|
147
|
-
datasetInfo = {
|
148
|
-
s3uri: data.s3uri,
|
149
|
-
contextCardUrl,
|
150
|
-
discoverId: data.id,
|
151
|
-
version: data.version,
|
152
|
-
};
|
153
|
-
} else {
|
154
|
-
//Use default url if data is not found for any reason
|
155
|
-
if (species === "rat") {
|
156
|
-
url = "https://mapcore-bucket1.s3.us-west-2.amazonaws.com/WholeBody/31-May-2021/ratBody/ratBody_syncmap_metadata.json";
|
157
|
-
} else if (species === "human") {
|
158
|
-
url = "https://mapcore-bucket1.s3.us-west-2.amazonaws.com/WholeBody/27-4-23-human/human_body_metadata.json";
|
159
|
-
}
|
160
|
-
}
|
161
|
-
|
162
|
-
return {url, datasetInfo};
|
163
|
-
}
|
164
|
-
|
165
|
-
export {
|
166
|
-
availableSpecies,
|
167
|
-
capitalise,
|
168
|
-
findSpeciesKey,
|
169
|
-
initialState,
|
170
|
-
initialDefaultState,
|
171
|
-
getBodyScaffoldInfo,
|
172
|
-
getNewMapEntry
|
173
|
-
}
|
1
|
+
const initialDefaultState = () => {
|
2
|
+
return {
|
3
|
+
entries: [
|
4
|
+
{
|
5
|
+
resource: "Rat",
|
6
|
+
type: "MultiFlatmap",
|
7
|
+
mode: "main",
|
8
|
+
id: 1,
|
9
|
+
state: undefined,
|
10
|
+
label: "",
|
11
|
+
discoverId: undefined
|
12
|
+
}
|
13
|
+
],
|
14
|
+
};
|
15
|
+
}
|
16
|
+
|
17
|
+
const getNewMapEntry = async (type, sparcApi) => {
|
18
|
+
let entry = { };
|
19
|
+
if (type === "AC") {
|
20
|
+
entry = {
|
21
|
+
resource: "Rat",
|
22
|
+
type: "MultiFlatmap",
|
23
|
+
mode: "main",
|
24
|
+
state: undefined,
|
25
|
+
label: "",
|
26
|
+
discoverId: undefined
|
27
|
+
};
|
28
|
+
} else if (type === "FC") {
|
29
|
+
entry = {
|
30
|
+
resource: "FunctionalConnectivity",
|
31
|
+
type: "Flatmap",
|
32
|
+
mode: "main",
|
33
|
+
state: undefined,
|
34
|
+
label: "Functional",
|
35
|
+
discoverId: undefined
|
36
|
+
}
|
37
|
+
} else if (type === "3D") {
|
38
|
+
const data = await getBodyScaffoldInfo(sparcApi, "human");
|
39
|
+
entry = {
|
40
|
+
resource: data.url,
|
41
|
+
type: "Scaffold",
|
42
|
+
mode: "main",
|
43
|
+
state: undefined,
|
44
|
+
label: "Human",
|
45
|
+
discoverId: data.datasetInfo.discoverId,
|
46
|
+
contextCardUrl: data.datasetInfo.contextCardUrl,
|
47
|
+
s3uri: data.datasetInfo.s3uri,
|
48
|
+
version: data.datasetInfo.version,
|
49
|
+
isBodyScaffold: true,
|
50
|
+
};
|
51
|
+
}
|
52
|
+
|
53
|
+
return entry;
|
54
|
+
}
|
55
|
+
|
56
|
+
/*
|
57
|
+
* Initial state for the split flow
|
58
|
+
*/
|
59
|
+
const initialState = async (type, sparcApi) => {
|
60
|
+
const state = initialDefaultState();
|
61
|
+
if (type === "FC") {
|
62
|
+
state.entries[0].resource = "FunctionalConnectivity";
|
63
|
+
state.entries[0].type = "Flatmap";
|
64
|
+
state.entries[0].label = "Functional";
|
65
|
+
} else if (type === "WholeBody") {
|
66
|
+
const data = await getBodyScaffoldInfo(sparcApi, "human");
|
67
|
+
state.entries[0].resource = data.url;
|
68
|
+
state.entries[0].contextCardUrl = data.datasetInfo.contextCardUrl;
|
69
|
+
state.entries[0].discoverId = data.datasetInfo.discoverId,
|
70
|
+
state.entries[0].s3uri = data.datasetInfo.s3uri;
|
71
|
+
state.entries[0].version = data.datasetInfo.version;
|
72
|
+
state.entries[0].type = "Scaffold";
|
73
|
+
state.entries[0].label = "Human";
|
74
|
+
state.entries[0].isBodyScaffold = true;
|
75
|
+
}
|
76
|
+
|
77
|
+
return state;
|
78
|
+
}
|
79
|
+
|
80
|
+
const capitalise = term => {
|
81
|
+
if (term)
|
82
|
+
return term.charAt(0).toUpperCase() + term.slice(1);
|
83
|
+
return term;
|
84
|
+
};
|
85
|
+
|
86
|
+
/*
|
87
|
+
* Provide a list of available species for the flatmap
|
88
|
+
*/
|
89
|
+
const availableSpecies = () => {
|
90
|
+
return {
|
91
|
+
"Human Female": { taxo: "NCBITaxon:9606", biologicalSex: "PATO:0000383", iconClass: "mapicon-icon_human", displayLatestChanges: true, displayWarning: true },
|
92
|
+
"Human Male": { taxo: "NCBITaxon:9606", biologicalSex: "PATO:0000384", iconClass: "mapicon-icon_human", displayLatestChanges: true, displayWarning: true },
|
93
|
+
"Rat": { taxo: "NCBITaxon:10114", iconClass: "mapicon-icon_rat", displayLatestChanges: true, displayWarning: true },
|
94
|
+
"Mouse": { taxo: "NCBITaxon:10090", iconClass: "mapicon-icon_mouse", displayLatestChanges: true, displayWarning: true },
|
95
|
+
"Pig": { taxo: "NCBITaxon:9823", iconClass: "mapicon-icon_pig", displayLatestChanges: true, displayWarning: true },
|
96
|
+
"Cat": { taxo: "NCBITaxon:9685", iconClass: "mapicon-icon_cat", displayLatestChanges: true, displayWarning: true },
|
97
|
+
}
|
98
|
+
}
|
99
|
+
|
100
|
+
/*
|
101
|
+
* Look for the key in availableSpecies with the provided condition
|
102
|
+
*/
|
103
|
+
const findSpeciesKey = condition => {
|
104
|
+
if (condition) {
|
105
|
+
const list = availableSpecies();
|
106
|
+
for (let key in list) {
|
107
|
+
if (condition.taxo === list[key].taxo) {
|
108
|
+
if (condition.biologicalSex && list[key].biologicalSex) {
|
109
|
+
if (condition.biologicalSex === list[key].biologicalSex)
|
110
|
+
return key;
|
111
|
+
} else {
|
112
|
+
return key;
|
113
|
+
}
|
114
|
+
}
|
115
|
+
}
|
116
|
+
}
|
117
|
+
return "";
|
118
|
+
}
|
119
|
+
|
120
|
+
const extractS3BucketNameAndPrefix = uri => {
|
121
|
+
if (uri) {
|
122
|
+
const substring = uri.split("//")[1];
|
123
|
+
if (substring) {
|
124
|
+
const s3Bucket = substring.split("/")[0];
|
125
|
+
const n = substring.indexOf('/');
|
126
|
+
const s3Prefix = substring.substring(n + 1);
|
127
|
+
return {
|
128
|
+
s3Bucket,
|
129
|
+
s3Prefix
|
130
|
+
};
|
131
|
+
}
|
132
|
+
}
|
133
|
+
return undefined
|
134
|
+
}
|
135
|
+
|
136
|
+
const getBodyScaffoldInfo = async (sparcApi, species) => {
|
137
|
+
//Get body scaffold information
|
138
|
+
let url = "";
|
139
|
+
let datasetInfo = undefined;
|
140
|
+
const response = await fetch(`${sparcApi}get_body_scaffold_info/${species}`);
|
141
|
+
if (response.ok) {
|
142
|
+
const data = await response.json();
|
143
|
+
//Construct the url endpoint for downloading the scaffold
|
144
|
+
const bucketInfo = extractS3BucketNameAndPrefix(data.s3uri);
|
145
|
+
url = `${sparcApi}s3-resource/${bucketInfo.s3Prefix}files/${data.path}?s3BucketName=${bucketInfo.s3Bucket}`;
|
146
|
+
const contextCardUrl = `${sparcApi}s3-resource/${bucketInfo.s3Prefix}files/${data.contextinfo}?s3BucketName=${bucketInfo.s3Bucket}`;
|
147
|
+
datasetInfo = {
|
148
|
+
s3uri: data.s3uri,
|
149
|
+
contextCardUrl,
|
150
|
+
discoverId: data.id,
|
151
|
+
version: data.version,
|
152
|
+
};
|
153
|
+
} else {
|
154
|
+
//Use default url if data is not found for any reason
|
155
|
+
if (species === "rat") {
|
156
|
+
url = "https://mapcore-bucket1.s3.us-west-2.amazonaws.com/WholeBody/31-May-2021/ratBody/ratBody_syncmap_metadata.json";
|
157
|
+
} else if (species === "human") {
|
158
|
+
url = "https://mapcore-bucket1.s3.us-west-2.amazonaws.com/WholeBody/27-4-23-human/human_body_metadata.json";
|
159
|
+
}
|
160
|
+
}
|
161
|
+
|
162
|
+
return {url, datasetInfo};
|
163
|
+
}
|
164
|
+
|
165
|
+
export {
|
166
|
+
availableSpecies,
|
167
|
+
capitalise,
|
168
|
+
findSpeciesKey,
|
169
|
+
initialState,
|
170
|
+
initialDefaultState,
|
171
|
+
getBodyScaffoldInfo,
|
172
|
+
getNewMapEntry
|
173
|
+
}
|
@@ -1,145 +1,145 @@
|
|
1
|
-
<template>
|
2
|
-
<FlatmapVuer
|
3
|
-
:state="entry.state"
|
4
|
-
:entry="entry.resource"
|
5
|
-
@resource-selected="flatmaprResourceSelected(entry.type, $event)"
|
6
|
-
@pan-zoom-callback="flatmapPanZoomCallback"
|
7
|
-
:name="entry.resource"
|
8
|
-
style="height: 100%; width: 100%"
|
9
|
-
:minZoom="entry.minZoom"
|
10
|
-
:helpMode="helpMode"
|
11
|
-
:pathControls="true"
|
12
|
-
ref="flatmap"
|
13
|
-
@ready="flatmapReadyCall"
|
14
|
-
:displayMinimap="false"
|
15
|
-
:displayWarning="true"
|
16
|
-
:enableOpenMapUI="true"
|
17
|
-
:flatmapAPI="flatmapAPI"
|
18
|
-
:sparcAPI="apiLocation"
|
19
|
-
@open-map="openMap"
|
20
|
-
/>
|
21
|
-
</template>
|
22
|
-
|
23
|
-
<script>
|
24
|
-
/* eslint-disable no-alert, no-console */
|
25
|
-
import { FlatmapVuer } from "@abi-software/flatmapvuer";
|
26
|
-
import EventBus from "../EventBus";
|
27
|
-
import ContentMixin from "../../mixins/ContentMixin";
|
28
|
-
import DynamicMarkerMixin from "../../mixins/DynamicMarkerMixin";
|
29
|
-
import "@abi-software/flatmapvuer/dist/style.css";
|
30
|
-
|
31
|
-
export default {
|
32
|
-
name: "Flatmap",
|
33
|
-
mixins: [ ContentMixin, DynamicMarkerMixin ],
|
34
|
-
components: {
|
35
|
-
FlatmapVuer,
|
36
|
-
},
|
37
|
-
methods: {
|
38
|
-
getState: function () {
|
39
|
-
return this.$refs.flatmap.getState();
|
40
|
-
},
|
41
|
-
/**
|
42
|
-
* Perform a local search on this contentvuer
|
43
|
-
*/
|
44
|
-
search: function (term) {
|
45
|
-
return this.$refs.flatmap.searchAndShowResult(term);
|
46
|
-
},
|
47
|
-
getFlatmapImp() {
|
48
|
-
return this.$refs.flatmap.mapImp;
|
49
|
-
},
|
50
|
-
flatmaprResourceSelected: function (type, resource) {
|
51
|
-
this.$refs.flatmap.resourceSelected(
|
52
|
-
type, resource, (this.$refs.map.viewingMode === "Exploration"));
|
53
|
-
},
|
54
|
-
flatmapReadyCall: function (flatmap) {
|
55
|
-
let provClone = {id: this.entry.id, prov: this.getFlatmapImp().provenance}; //create clone of provenance and add id
|
56
|
-
EventBus.emit("mapImpProv", provClone); // send clone to context card
|
57
|
-
this.$emit("flatmap-provenance-ready", provClone);
|
58
|
-
this.getAvailableTerms();
|
59
|
-
if (this.entry.resource === "FunctionalConnectivity"){
|
60
|
-
this.flatmapReadyForMarkerUpdates(flatmap);
|
61
|
-
}
|
62
|
-
},
|
63
|
-
highlightFeatures: function(info) {
|
64
|
-
let name = info.name;
|
65
|
-
const flatmap = this.$refs.flatmap.mapImp;
|
66
|
-
if (name) {
|
67
|
-
const results = flatmap.search(name);
|
68
|
-
if (results.featureIds[0]) {
|
69
|
-
flatmap.highlightFeatures([
|
70
|
-
flatmap.modelForFeature(results.featureIds[0]),
|
71
|
-
]);
|
72
|
-
}
|
73
|
-
}
|
74
|
-
},
|
75
|
-
/**
|
76
|
-
* Append the list of suggested terms to suggestions
|
77
|
-
*/
|
78
|
-
searchSuggestions: function (term, suggestions) {
|
79
|
-
if (term && this.$refs.flatmap.mapImp) {
|
80
|
-
const results = this.$refs.flatmap.mapImp.search(term);
|
81
|
-
results.__featureIds.forEach(id => {
|
82
|
-
const annotation = this.$refs.flatmap.mapImp.annotation(id);
|
83
|
-
if (annotation && annotation.label)
|
84
|
-
suggestions.push(annotation.label);
|
85
|
-
});
|
86
|
-
}
|
87
|
-
},
|
88
|
-
zoomToFeatures: function(info, forceSelect) {
|
89
|
-
let name = info.name;
|
90
|
-
const flatmap = this.$refs.flatmap.mapImp;
|
91
|
-
if (name) {
|
92
|
-
const results = flatmap.search(name);
|
93
|
-
if (results.featureIds.length) {
|
94
|
-
let externalId = flatmap.modelForFeature(results.featureIds[0]);
|
95
|
-
if (externalId) {
|
96
|
-
if (forceSelect) {
|
97
|
-
flatmap.selectFeatures(externalId);
|
98
|
-
}
|
99
|
-
flatmap.zoomToFeatures(externalId);
|
100
|
-
} else flatmap.clearSearchResults();
|
101
|
-
}
|
102
|
-
} else {
|
103
|
-
flatmap.clearSearchResults();
|
104
|
-
}
|
105
|
-
},
|
106
|
-
},
|
107
|
-
computed: {
|
108
|
-
facetSpecies() {
|
109
|
-
return this.settingsStore.facets.species;
|
110
|
-
},
|
111
|
-
},
|
112
|
-
mounted: function() {
|
113
|
-
this.getAvailableTerms();
|
114
|
-
EventBus.on("markerUpdate", () => {
|
115
|
-
this.flatmapMarkerZoomUpdate(true, undefined);
|
116
|
-
});
|
117
|
-
},
|
118
|
-
};
|
119
|
-
</script>
|
120
|
-
|
121
|
-
<!-- Add "scoped" attribute to limit CSS to this component only -->
|
122
|
-
<style scoped lang="scss">
|
123
|
-
:deep(.maplibregl-popup) {
|
124
|
-
z-index: 3;
|
125
|
-
}
|
126
|
-
|
127
|
-
:deep(.flatmapvuer-popover) {
|
128
|
-
.maplibregl-popup-content {
|
129
|
-
border-radius: 4px;
|
130
|
-
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
|
131
|
-
pointer-events: auto;
|
132
|
-
width: 25em;
|
133
|
-
background: #fff;
|
134
|
-
}
|
135
|
-
}
|
136
|
-
|
137
|
-
:deep(.maplibregl-marker) {
|
138
|
-
&.standard-marker {
|
139
|
-
z-index: 2;
|
140
|
-
}
|
141
|
-
&.highlight-marker {
|
142
|
-
z-index: 1;
|
143
|
-
}
|
144
|
-
}
|
145
|
-
</style>
|
1
|
+
<template>
|
2
|
+
<FlatmapVuer
|
3
|
+
:state="entry.state"
|
4
|
+
:entry="entry.resource"
|
5
|
+
@resource-selected="flatmaprResourceSelected(entry.type, $event)"
|
6
|
+
@pan-zoom-callback="flatmapPanZoomCallback"
|
7
|
+
:name="entry.resource"
|
8
|
+
style="height: 100%; width: 100%"
|
9
|
+
:minZoom="entry.minZoom"
|
10
|
+
:helpMode="helpMode"
|
11
|
+
:pathControls="true"
|
12
|
+
ref="flatmap"
|
13
|
+
@ready="flatmapReadyCall"
|
14
|
+
:displayMinimap="false"
|
15
|
+
:displayWarning="true"
|
16
|
+
:enableOpenMapUI="true"
|
17
|
+
:flatmapAPI="flatmapAPI"
|
18
|
+
:sparcAPI="apiLocation"
|
19
|
+
@open-map="openMap"
|
20
|
+
/>
|
21
|
+
</template>
|
22
|
+
|
23
|
+
<script>
|
24
|
+
/* eslint-disable no-alert, no-console */
|
25
|
+
import { FlatmapVuer } from "@abi-software/flatmapvuer";
|
26
|
+
import EventBus from "../EventBus";
|
27
|
+
import ContentMixin from "../../mixins/ContentMixin";
|
28
|
+
import DynamicMarkerMixin from "../../mixins/DynamicMarkerMixin";
|
29
|
+
import "@abi-software/flatmapvuer/dist/style.css";
|
30
|
+
|
31
|
+
export default {
|
32
|
+
name: "Flatmap",
|
33
|
+
mixins: [ ContentMixin, DynamicMarkerMixin ],
|
34
|
+
components: {
|
35
|
+
FlatmapVuer,
|
36
|
+
},
|
37
|
+
methods: {
|
38
|
+
getState: function () {
|
39
|
+
return this.$refs.flatmap.getState();
|
40
|
+
},
|
41
|
+
/**
|
42
|
+
* Perform a local search on this contentvuer
|
43
|
+
*/
|
44
|
+
search: function (term) {
|
45
|
+
return this.$refs.flatmap.searchAndShowResult(term);
|
46
|
+
},
|
47
|
+
getFlatmapImp() {
|
48
|
+
return this.$refs.flatmap.mapImp;
|
49
|
+
},
|
50
|
+
flatmaprResourceSelected: function (type, resource) {
|
51
|
+
this.$refs.flatmap.resourceSelected(
|
52
|
+
type, resource, (this.$refs.map.viewingMode === "Exploration"));
|
53
|
+
},
|
54
|
+
flatmapReadyCall: function (flatmap) {
|
55
|
+
let provClone = {id: this.entry.id, prov: this.getFlatmapImp().provenance}; //create clone of provenance and add id
|
56
|
+
EventBus.emit("mapImpProv", provClone); // send clone to context card
|
57
|
+
this.$emit("flatmap-provenance-ready", provClone);
|
58
|
+
this.getAvailableTerms();
|
59
|
+
if (this.entry.resource === "FunctionalConnectivity"){
|
60
|
+
this.flatmapReadyForMarkerUpdates(flatmap);
|
61
|
+
}
|
62
|
+
},
|
63
|
+
highlightFeatures: function(info) {
|
64
|
+
let name = info.name;
|
65
|
+
const flatmap = this.$refs.flatmap.mapImp;
|
66
|
+
if (name) {
|
67
|
+
const results = flatmap.search(name);
|
68
|
+
if (results.featureIds[0]) {
|
69
|
+
flatmap.highlightFeatures([
|
70
|
+
flatmap.modelForFeature(results.featureIds[0]),
|
71
|
+
]);
|
72
|
+
}
|
73
|
+
}
|
74
|
+
},
|
75
|
+
/**
|
76
|
+
* Append the list of suggested terms to suggestions
|
77
|
+
*/
|
78
|
+
searchSuggestions: function (term, suggestions) {
|
79
|
+
if (term && this.$refs.flatmap.mapImp) {
|
80
|
+
const results = this.$refs.flatmap.mapImp.search(term);
|
81
|
+
results.__featureIds.forEach(id => {
|
82
|
+
const annotation = this.$refs.flatmap.mapImp.annotation(id);
|
83
|
+
if (annotation && annotation.label)
|
84
|
+
suggestions.push(annotation.label);
|
85
|
+
});
|
86
|
+
}
|
87
|
+
},
|
88
|
+
zoomToFeatures: function(info, forceSelect) {
|
89
|
+
let name = info.name;
|
90
|
+
const flatmap = this.$refs.flatmap.mapImp;
|
91
|
+
if (name) {
|
92
|
+
const results = flatmap.search(name);
|
93
|
+
if (results.featureIds.length) {
|
94
|
+
let externalId = flatmap.modelForFeature(results.featureIds[0]);
|
95
|
+
if (externalId) {
|
96
|
+
if (forceSelect) {
|
97
|
+
flatmap.selectFeatures(externalId);
|
98
|
+
}
|
99
|
+
flatmap.zoomToFeatures(externalId);
|
100
|
+
} else flatmap.clearSearchResults();
|
101
|
+
}
|
102
|
+
} else {
|
103
|
+
flatmap.clearSearchResults();
|
104
|
+
}
|
105
|
+
},
|
106
|
+
},
|
107
|
+
computed: {
|
108
|
+
facetSpecies() {
|
109
|
+
return this.settingsStore.facets.species;
|
110
|
+
},
|
111
|
+
},
|
112
|
+
mounted: function() {
|
113
|
+
this.getAvailableTerms();
|
114
|
+
EventBus.on("markerUpdate", () => {
|
115
|
+
this.flatmapMarkerZoomUpdate(true, undefined);
|
116
|
+
});
|
117
|
+
},
|
118
|
+
};
|
119
|
+
</script>
|
120
|
+
|
121
|
+
<!-- Add "scoped" attribute to limit CSS to this component only -->
|
122
|
+
<style scoped lang="scss">
|
123
|
+
:deep(.maplibregl-popup) {
|
124
|
+
z-index: 3;
|
125
|
+
}
|
126
|
+
|
127
|
+
:deep(.flatmapvuer-popover) {
|
128
|
+
.maplibregl-popup-content {
|
129
|
+
border-radius: 4px;
|
130
|
+
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
|
131
|
+
pointer-events: auto;
|
132
|
+
width: 25em;
|
133
|
+
background: #fff;
|
134
|
+
}
|
135
|
+
}
|
136
|
+
|
137
|
+
:deep(.maplibregl-marker) {
|
138
|
+
&.standard-marker {
|
139
|
+
z-index: 2;
|
140
|
+
}
|
141
|
+
&.highlight-marker {
|
142
|
+
z-index: 1;
|
143
|
+
}
|
144
|
+
}
|
145
|
+
</style>
|