@abi-software/mapintegratedvuer 0.7.2-vue3.0-alpha.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/LICENSE +201 -201
  2. package/README.md +150 -150
  3. package/assets/styleguide.css +19 -19
  4. package/cypress.config.js +23 -23
  5. package/dist/index.html +17 -17
  6. package/dist/mapintegratedvuer.js +74289 -73840
  7. package/dist/mapintegratedvuer.umd.cjs +878 -515
  8. package/dist/style.css +1 -1
  9. package/package.json +134 -135
  10. package/public/index.html +17 -17
  11. package/reporter-config.json +9 -9
  12. package/src/App.vue +245 -245
  13. package/src/assets/_variables.scss +43 -43
  14. package/src/assets/fonts/mapicon-species.eot +0 -0
  15. package/src/assets/fonts/mapicon-species.ttf +0 -0
  16. package/src/assets/fonts/mapicon-species.woff +0 -0
  17. package/src/assets/header-icon.scss +67 -67
  18. package/src/assets/mapicon-species-style.css +41 -41
  19. package/src/assets/styles.scss +9 -9
  20. package/src/components/ContentBar.vue +376 -376
  21. package/src/components/ContentVuer.vue +217 -217
  22. package/src/components/ContextCard.vue +385 -385
  23. package/src/components/ContextHelp.vue +73 -73
  24. package/src/components/CustomSplitter.vue +151 -151
  25. package/src/components/DatasetHeader.vue +97 -97
  26. package/src/components/DialogToolbarContent.vue +464 -464
  27. package/src/components/EventBus.js +3 -3
  28. package/src/components/FlatmapContextCard.vue +134 -134
  29. package/src/components/MapContent.vue +328 -333
  30. package/src/components/ResizeSensor.vue +47 -47
  31. package/src/components/SearchControls.vue +115 -115
  32. package/src/components/SimulatedData.js +721 -721
  33. package/src/components/SplitDialog.vue +287 -287
  34. package/src/components/SplitFlow.vue +414 -414
  35. package/src/components/index.js +7 -7
  36. package/src/components/markerZoomLevelsHardCoded.js +255 -255
  37. package/src/components/scripts/utilities.js +173 -173
  38. package/src/components/viewers/Flatmap.vue +145 -145
  39. package/src/components/viewers/Iframe.vue +31 -31
  40. package/src/components/viewers/MultiFlatmap.vue +384 -384
  41. package/src/components/viewers/Plot.vue +23 -23
  42. package/src/components/viewers/Scaffold.vue +198 -198
  43. package/src/components/viewers/Simulation.vue +21 -21
  44. package/src/icons/yellowstar.js +1 -1
  45. package/src/main.js +31 -31
  46. package/src/mixins/ContentMixin.js +438 -438
  47. package/src/mixins/DynamicMarkerMixin.js +88 -88
  48. package/src/mixins/S3Bucket.vue +37 -37
  49. package/src/stores/entries.js +40 -40
  50. package/src/stores/index.js +23 -23
  51. package/src/stores/settings.js +144 -144
  52. package/src/stores/splitFlow.js +523 -523
  53. package/static.json +7 -7
  54. package/vite.config.js +70 -70
  55. package/vite.static-build.js +12 -12
  56. package/vitest.workspace.js +3 -3
  57. package/vuese-generator.js +65 -65
  58. package/assets/gazelle-icons-no-background.css +0 -32
  59. package/dist/matterport.pdf +0 -0
  60. package/dist/test.txt +0 -0
  61. package/public/matterport.pdf +0 -0
  62. package/public/test.txt +0 -0
  63. package/q.json +0 -690
  64. package/src/mixins/RetrieveContextCardMixin.js +0 -82
  65. package/tsconfig.json +0 -19
@@ -1,385 +1,385 @@
1
- <template>
2
- <MultiFlatmapVuer
3
- :availableSpecies="availableSpecies"
4
- @flatmapChanged="flatmapChanged"
5
- @ready="multiFlatmapReady"
6
- :state="entry.state"
7
- @resource-selected="flatmaprResourceSelected(entry.type, $event)"
8
- style="height: 100%; width: 100%"
9
- :initial="entry.resource"
10
- :helpMode="helpMode"
11
- ref="multiflatmap"
12
- :displayMinimap="true"
13
- :showStarInLegend="showStarInLegend"
14
- :enableOpenMapUI="true"
15
- :openMapOptions="openMapOptions"
16
- :flatmapAPI="flatmapAPI"
17
- :sparcAPI="apiLocation"
18
- @pan-zoom-callback="flatmapPanZoomCallback"
19
- @open-map="openMap"
20
- />
21
- </template>
22
-
23
- <script>
24
- /* eslint-disable no-alert, no-console */
25
- import { availableSpecies } from "../scripts/utilities.js";
26
- import { MultiFlatmapVuer } from "@abi-software/flatmapvuer";
27
- import ContentMixin from "../../mixins/ContentMixin";
28
- import EventBus from "../EventBus";
29
- import { getBodyScaffoldInfo } from "../scripts/utilities";
30
- import DyncamicMarkerMixin from "../../mixins/DynamicMarkerMixin";
31
-
32
- import "@abi-software/flatmapvuer/dist/style.css";
33
- import YellowStar from "../../icons/yellowstar";
34
-
35
- const getOpenMapOptions = (species) => {
36
- const options = [
37
- {
38
- display: "Open AC Map",
39
- key: "AC"
40
- },
41
- {
42
- display: "Open FC Map",
43
- key: "FC"
44
- },
45
- {
46
- display: "Open 3D Human Map",
47
- key: "3D"
48
- },
49
- ]
50
- switch (species) {
51
- case "Human Male":
52
- case "Human Female":
53
- case "Rat":
54
- options.push({
55
- display: "Open Sync Map",
56
- key: "SYNC"
57
- });
58
- break;
59
- default:
60
- break;
61
- }
62
- return options;
63
- }
64
-
65
- export default {
66
- name: "MultiFlatmap",
67
- mixins: [ContentMixin, DyncamicMarkerMixin],
68
- components: {
69
- MultiFlatmapVuer,
70
- },
71
- data: function () {
72
- return {
73
- zoomLevel: 6,
74
- flatmapReady: false,
75
- availableSpecies: availableSpecies(),
76
- scaffoldResource: { },
77
- showStarInLegend: false,
78
- openMapOptions: getOpenMapOptions("Rat"),
79
- }
80
- },
81
- methods: {
82
- /**
83
- * Toggle sync mode on/off depending on species and current state
84
- */
85
- toggleSyncMode: async function () {
86
- if (this.syncMode == false) {
87
- let action = undefined;
88
- if (this.activeSpecies === "Rat") {
89
- action = {
90
- contextCard: undefined,
91
- discoverId: undefined,
92
- label: "Rat Body",
93
- resource: "https://mapcore-bucket1.s3.us-west-2.amazonaws.com/WholeBody/31-May-2021/ratBody/ratBody_syncmap_metadata.json",
94
- title: "View 3D scaffold",
95
- layout: "2horpanel",
96
- type: "SyncMap",
97
- };
98
- } else if ((this.activeSpecies === "Human Male") || (this.activeSpecies === "Human Female")) {
99
- //Dynamically construct the whole body scaffold for human and store it
100
- if (!("human" in this.scaffoldResource)) {
101
- this.scaffoldResource["human"] = await getBodyScaffoldInfo(storeeSettings.sparcApi, "human");
102
- }
103
- action = {
104
- contextCardUrl: this.scaffoldResource["human"].datasetInfo.contextCardUrl,
105
- discoverId: this.scaffoldResource["human"].datasetInfo.discoverId,
106
- s3uri: this.scaffoldResource["human"].datasetInfo.s3uri,
107
- version: this.scaffoldResource["human"].datasetInfo.version,
108
- label: "Human Body",
109
- resource: this.scaffoldResource["human"].url,
110
- title: "View 3D scaffold",
111
- layout: "2vertpanel",
112
- type: "SyncMap",
113
- isBodyScaffold: true,
114
- };
115
- }
116
- if (action)
117
- EventBus.emit("SyncModeRequest", { flag: true, action: action });
118
- } else {
119
- EventBus.emit("SyncModeRequest", { flag: false });
120
- }
121
- },
122
- getState: function () {
123
- if (this.flatmapReady) return this.$refs.multiflatmap.getState();
124
- else return undefined;
125
- },
126
- flatmapPanZoomCallback: function (payload) {
127
- if (this.mouseHovered) {
128
- const result = {
129
- paneIndex: this.entry.id,
130
- eventType: "panZoom",
131
- payload: payload,
132
- type: this.entry.type,
133
- };
134
- this.flatmapMarkerZoomUpdate(false, undefined);
135
- this.$emit("resource-selected", result);
136
- }
137
- },
138
- /**
139
- * Perform a local search on this contentvuer
140
- */
141
- search: function (term) {
142
- const flatmap = this.$refs.multiflatmap.getCurrentFlatmap();
143
- //First search and show the result
144
- return flatmap.searchAndShowResult(term, true);
145
- },
146
- /**
147
- * Append the list of suggested terms to suggestions
148
- */
149
- searchSuggestions: function (term, suggestions) {
150
- const flatmap = this.$refs.multiflatmap.getCurrentFlatmap();
151
- if (term && flatmap.mapImp) {
152
- const results = flatmap.mapImp.search(term);
153
- results.__featureIds.forEach(id => {
154
- const annotation = flatmap.mapImp.annotation(id);
155
- if (annotation && annotation.label)
156
- suggestions.push(annotation.label);
157
- });
158
- }
159
- },
160
- flatmaprResourceSelected: function (type, resource) {
161
- const map = this.$refs.multiflatmap.getCurrentFlatmap();
162
- this.resourceSelected(type, resource, (map.viewingMode === "Exploration"));
163
- },
164
- /**
165
- * Handle sync pan zoom event
166
- */
167
- handleSyncPanZoomEvent: function (data) {
168
- //Prevent recursive callback
169
- if (!this.mouseHovered) {
170
- if (data.type !== this.entry.type) {
171
- const zoom = data.payload.zoom;
172
- const center = data.payload.target;
173
- const height = this.$el.clientHeight;
174
- const width = this.$el.clientWidth;
175
- const max = Math.max(width, height);
176
- let sW = width / max / zoom;
177
- const sH = height / max / zoom;
178
- const origin = [
179
- center[0] / 2 + 0.5 - sW / 2,
180
- 0.5 - center[1] / 2 - sH / 2,
181
- ];
182
- this.$refs.multiflatmap
183
- .getCurrentFlatmap()
184
- .mapImp.panZoomTo(origin, [sW, sH]);
185
- this.flatmapMarkerZoomUpdate(false, undefined);
186
- }
187
- }
188
- },
189
- displayTooltip: function (info) {
190
- if (info) {
191
- let name = info.name;
192
- if (name) {
193
- this.search(name);
194
- } else {
195
- const flatmap = this.$refs.multiflatmap.getCurrentFlatmap();
196
- flatmap.mapImp.clearSearchResults();
197
- }
198
- }
199
- },
200
- zoomToFeatures: function (info, forceSelect) {
201
- let name = info.name;
202
- const flatmap = this.$refs.multiflatmap.getCurrentFlatmap().mapImp;
203
- if (name) {
204
- const results = flatmap.search(name);
205
- if (results.featureIds.length > 0) {
206
- if (forceSelect) {
207
- flatmap.selectFeatures(results.featureIds);
208
- }
209
- flatmap.zoomToFeatures(results.featureIds);
210
- } else {
211
- flatmap.clearSearchResults();
212
- }
213
- } else {
214
- flatmap.clearSearchResults();
215
- }
216
- },
217
- highlightFeatures: function (info) {
218
- let name = info.name;
219
- const flatmap = this.$refs.multiflatmap.getCurrentFlatmap().mapImp;
220
- if (name) {
221
- const results = flatmap.search(name);
222
- if (results.featureIds.length > 0) {
223
- flatmap.zoomToFeatures(results.featureIds, { noZoomIn: true });
224
- /*
225
- flatmap.highlightFeatures([
226
- flatmap.modelForFeature(results.featureIds[0]),
227
- ]);
228
- */
229
- }
230
- }
231
- },
232
- updateProvCard: function() {
233
- const imp = this.getFlatmapImp();
234
- if (imp) {
235
- let provClone = {id: this.entry.id, prov: imp.provenance};
236
- this.$emit("flatmap-provenance-ready", provClone);
237
- }
238
- },
239
- flatmapChanged: async function (activeSpecies) {
240
- this.activeSpecies = activeSpecies;
241
- this.openMapOptions = getOpenMapOptions(activeSpecies);
242
- this.$emit("species-changed", activeSpecies);
243
- if (!(this.entry.state && (this.entry.state.species === this.activeSpecies))) {
244
- if (this.syncMode == true)
245
- await this.toggleSyncMode();
246
- }
247
- this.updateProvCard();
248
- },
249
- multiFlatmapReady: function (flatmap) {
250
- if (flatmap) {
251
- flatmap.enablePanZoomEvents(true); // Use zoom events for dynamic markers
252
- this.flatmapReady = true;
253
- const flatmapImp = flatmap.mapImp;
254
- this.flatmapMarkerZoomUpdate(true, flatmapImp);
255
- this.updateProvCard();
256
- }
257
- },
258
- getFlatmapImp: function () {
259
- if (this.entry.type === "MultiFlatmap" && this.flatmapReady) {
260
- return this.$refs.multiflatmap.getCurrentFlatmap()["mapImp"];
261
- } else {
262
- return undefined;
263
- }
264
- },
265
- flatmapAreaSearch() {
266
- const flatmapImp = this.getFlatmapImp();
267
- let shownMarkers = flatmapImp.visibleMarkerAnatomicalIds();
268
- let returnedAction = {
269
- type: "Facets",
270
- label: "Unused",
271
- val: shownMarkers.map(marker => this.idNamePair[marker]),
272
- };
273
- EventBus.emit("PopoverActionClick", returnedAction);
274
- },
275
- restoreFeaturedMarkers: function (flatmap) {
276
- this.settingsStore.resetFeaturedMarkerIdentifier();
277
- const markers = this.settingsStore.featuredMarkers;
278
- this.updateFeatureMarkers(markers, flatmap);
279
- },
280
- updateFeatureMarkers: function (markers, flatmap) {
281
- this.showStarInLegend = false; // will show if we have a featured marker
282
- for (let index = 0; index < markers.length; ++index) {
283
- if (markers[index]) {
284
- const markerIdentifier =
285
- this.settingsStore.featuredMarkerIdentifiers[index];
286
- if (!markerIdentifier) {
287
- // Add the featured marker to the legend if we have a featured marker
288
- const markerExists = this.addFeaturedMarker(markers[index], index, flatmap);
289
- if (markerExists) {
290
- this.showStarInLegend = true;
291
- }
292
- }
293
- }
294
- }
295
- },
296
- addFeaturedMarker: function (marker, index, flatmap) {
297
- const markerSpecies =
298
- this.settingsStore.featuredMarkerSpecies[index];
299
- if (markerSpecies && !this.activeSpecies.startsWith(markerSpecies)) {
300
- return false;
301
- }
302
- let flatmapImp = flatmap;
303
- if (!flatmapImp) {
304
- flatmapImp = this.getFlatmapImp();
305
- }
306
-
307
- if (flatmapImp) {
308
- // create the star marker
309
- let wrapperElement = document.createElement("div");
310
- wrapperElement.innerHTML = YellowStar;
311
-
312
- // add it to the flatmap
313
- const markerIdentifier = flatmapImp.addMarker(marker, {
314
- element: wrapperElement,
315
- className: "highlight-marker"
316
- });
317
-
318
- // update the store with the marker identifier
319
- this.settingsStore.updateFeaturedMarkerIdentifier({
320
- index,
321
- markerIdentifier,
322
- });
323
- return true;
324
- }
325
- return false;
326
- },
327
- },
328
- computed: {
329
- facetSpecies() {
330
- return this.settingsStore.facets.species;
331
- },
332
- featuredMarkers() {
333
- return this.settingsStore.featuredMarkers;
334
- },
335
- },
336
- watch: {
337
- syncMode: function (val) {
338
- if (this.$refs.multiflatmap.getCurrentFlatmap())
339
- this.$refs.multiflatmap.getCurrentFlatmap().enablePanZoomEvents(val);
340
- },
341
- featuredMarkers: function (markers) {
342
- if (!this.flatmapReady) {
343
- return;
344
- }
345
-
346
- this.updateFeatureMarkers(markers, undefined);
347
- },
348
- },
349
- mounted: function () {
350
- this.getAvailableTerms();
351
- this.getFeaturedDatasets();
352
-
353
- EventBus.on("markerUpdate", () => {
354
- this.flatmapMarkerZoomUpdate(true, undefined);
355
- });
356
- },
357
- };
358
- </script>
359
-
360
- <!-- Add "scoped" attribute to limit CSS to this component only -->
361
- <style scoped lang="scss">
362
-
363
- :deep(.maplibregl-popup) {
364
- z-index: 3;
365
- }
366
-
367
- :deep(.maplibregl-marker) {
368
- &.standard-marker {
369
- cursor: pointer !important;
370
- z-index: 2;
371
- }
372
- &.highlight-marker {
373
- visibility: visible !important;
374
- cursor: pointer !important;
375
- z-index: 1;
376
- div {
377
- scale: 0.5;
378
- transform: translate(45px, -7px);
379
- }
380
- }
381
- }
382
-
383
- </style>
384
-
1
+ <template>
2
+ <MultiFlatmapVuer
3
+ :availableSpecies="availableSpecies"
4
+ @flatmapChanged="flatmapChanged"
5
+ @ready="multiFlatmapReady"
6
+ :state="entry.state"
7
+ @resource-selected="flatmaprResourceSelected(entry.type, $event)"
8
+ style="height: 100%; width: 100%"
9
+ :initial="entry.resource"
10
+ :helpMode="helpMode"
11
+ ref="multiflatmap"
12
+ :displayMinimap="true"
13
+ :showStarInLegend="showStarInLegend"
14
+ :enableOpenMapUI="true"
15
+ :openMapOptions="openMapOptions"
16
+ :flatmapAPI="flatmapAPI"
17
+ :sparcAPI="apiLocation"
18
+ @pan-zoom-callback="flatmapPanZoomCallback"
19
+ @open-map="openMap"
20
+ />
21
+ </template>
22
+
23
+ <script>
24
+ /* eslint-disable no-alert, no-console */
25
+ import { availableSpecies } from "../scripts/utilities.js";
26
+ import { MultiFlatmapVuer } from "@abi-software/flatmapvuer";
27
+ import ContentMixin from "../../mixins/ContentMixin";
28
+ import EventBus from "../EventBus";
29
+ import { getBodyScaffoldInfo } from "../scripts/utilities";
30
+ import DyncamicMarkerMixin from "../../mixins/DynamicMarkerMixin";
31
+
32
+ import "@abi-software/flatmapvuer/dist/style.css";
33
+ import YellowStar from "../../icons/yellowstar";
34
+
35
+ const getOpenMapOptions = (species) => {
36
+ const options = [
37
+ {
38
+ display: "Open AC Map",
39
+ key: "AC"
40
+ },
41
+ {
42
+ display: "Open FC Map",
43
+ key: "FC"
44
+ },
45
+ {
46
+ display: "Open 3D Human Map",
47
+ key: "3D"
48
+ },
49
+ ]
50
+ switch (species) {
51
+ case "Human Male":
52
+ case "Human Female":
53
+ case "Rat":
54
+ options.push({
55
+ display: "Open Sync Map",
56
+ key: "SYNC"
57
+ });
58
+ break;
59
+ default:
60
+ break;
61
+ }
62
+ return options;
63
+ }
64
+
65
+ export default {
66
+ name: "MultiFlatmap",
67
+ mixins: [ContentMixin, DyncamicMarkerMixin],
68
+ components: {
69
+ MultiFlatmapVuer,
70
+ },
71
+ data: function () {
72
+ return {
73
+ zoomLevel: 6,
74
+ flatmapReady: false,
75
+ availableSpecies: availableSpecies(),
76
+ scaffoldResource: { },
77
+ showStarInLegend: false,
78
+ openMapOptions: getOpenMapOptions("Rat"),
79
+ }
80
+ },
81
+ methods: {
82
+ /**
83
+ * Toggle sync mode on/off depending on species and current state
84
+ */
85
+ toggleSyncMode: async function () {
86
+ if (this.syncMode == false) {
87
+ let action = undefined;
88
+ if (this.activeSpecies === "Rat") {
89
+ action = {
90
+ contextCard: undefined,
91
+ discoverId: undefined,
92
+ label: "Rat Body",
93
+ resource: "https://mapcore-bucket1.s3.us-west-2.amazonaws.com/WholeBody/31-May-2021/ratBody/ratBody_syncmap_metadata.json",
94
+ title: "View 3D scaffold",
95
+ layout: "2horpanel",
96
+ type: "SyncMap",
97
+ };
98
+ } else if ((this.activeSpecies === "Human Male") || (this.activeSpecies === "Human Female")) {
99
+ //Dynamically construct the whole body scaffold for human and store it
100
+ if (!("human" in this.scaffoldResource)) {
101
+ this.scaffoldResource["human"] = await getBodyScaffoldInfo(this.apiLocation, "human");
102
+ }
103
+ action = {
104
+ contextCardUrl: this.scaffoldResource["human"].datasetInfo.contextCardUrl,
105
+ discoverId: this.scaffoldResource["human"].datasetInfo.discoverId,
106
+ s3uri: this.scaffoldResource["human"].datasetInfo.s3uri,
107
+ version: this.scaffoldResource["human"].datasetInfo.version,
108
+ label: "Human Body",
109
+ resource: this.scaffoldResource["human"].url,
110
+ title: "View 3D scaffold",
111
+ layout: "2vertpanel",
112
+ type: "SyncMap",
113
+ isBodyScaffold: true,
114
+ };
115
+ }
116
+ if (action)
117
+ EventBus.emit("SyncModeRequest", { flag: true, action: action });
118
+ } else {
119
+ EventBus.emit("SyncModeRequest", { flag: false });
120
+ }
121
+ },
122
+ getState: function () {
123
+ if (this.flatmapReady) return this.$refs.multiflatmap.getState();
124
+ else return undefined;
125
+ },
126
+ flatmapPanZoomCallback: function (payload) {
127
+ if (this.mouseHovered) {
128
+ const result = {
129
+ paneIndex: this.entry.id,
130
+ eventType: "panZoom",
131
+ payload: payload,
132
+ type: this.entry.type,
133
+ };
134
+ this.flatmapMarkerZoomUpdate(false, undefined);
135
+ this.$emit("resource-selected", result);
136
+ }
137
+ },
138
+ /**
139
+ * Perform a local search on this contentvuer
140
+ */
141
+ search: function (term) {
142
+ const flatmap = this.$refs.multiflatmap.getCurrentFlatmap();
143
+ //First search and show the result
144
+ return flatmap.searchAndShowResult(term, true);
145
+ },
146
+ /**
147
+ * Append the list of suggested terms to suggestions
148
+ */
149
+ searchSuggestions: function (term, suggestions) {
150
+ const flatmap = this.$refs.multiflatmap.getCurrentFlatmap();
151
+ if (term && flatmap.mapImp) {
152
+ const results = flatmap.mapImp.search(term);
153
+ results.__featureIds.forEach(id => {
154
+ const annotation = flatmap.mapImp.annotation(id);
155
+ if (annotation && annotation.label)
156
+ suggestions.push(annotation.label);
157
+ });
158
+ }
159
+ },
160
+ flatmaprResourceSelected: function (type, resource) {
161
+ const map = this.$refs.multiflatmap.getCurrentFlatmap();
162
+ this.resourceSelected(type, resource, (map.viewingMode === "Exploration"));
163
+ },
164
+ /**
165
+ * Handle sync pan zoom event
166
+ */
167
+ handleSyncPanZoomEvent: function (data) {
168
+ //Prevent recursive callback
169
+ if (!this.mouseHovered) {
170
+ if (data.type !== this.entry.type) {
171
+ const zoom = data.payload.zoom;
172
+ const center = data.payload.target;
173
+ const height = this.$el.clientHeight;
174
+ const width = this.$el.clientWidth;
175
+ const max = Math.max(width, height);
176
+ let sW = width / max / zoom;
177
+ const sH = height / max / zoom;
178
+ const origin = [
179
+ center[0] / 2 + 0.5 - sW / 2,
180
+ 0.5 - center[1] / 2 - sH / 2,
181
+ ];
182
+ this.$refs.multiflatmap
183
+ .getCurrentFlatmap()
184
+ .mapImp.panZoomTo(origin, [sW, sH]);
185
+ this.flatmapMarkerZoomUpdate(false, undefined);
186
+ }
187
+ }
188
+ },
189
+ displayTooltip: function (info) {
190
+ if (info) {
191
+ let name = info.name;
192
+ if (name) {
193
+ this.search(name);
194
+ } else {
195
+ const flatmap = this.$refs.multiflatmap.getCurrentFlatmap();
196
+ flatmap.mapImp.clearSearchResults();
197
+ }
198
+ }
199
+ },
200
+ zoomToFeatures: function (info, forceSelect) {
201
+ let name = info.name;
202
+ const flatmap = this.$refs.multiflatmap.getCurrentFlatmap().mapImp;
203
+ if (name) {
204
+ const results = flatmap.search(name);
205
+ if (results.featureIds.length > 0) {
206
+ if (forceSelect) {
207
+ flatmap.selectFeatures(results.featureIds);
208
+ }
209
+ flatmap.zoomToFeatures(results.featureIds);
210
+ } else {
211
+ flatmap.clearSearchResults();
212
+ }
213
+ } else {
214
+ flatmap.clearSearchResults();
215
+ }
216
+ },
217
+ highlightFeatures: function (info) {
218
+ let name = info.name;
219
+ const flatmap = this.$refs.multiflatmap.getCurrentFlatmap().mapImp;
220
+ if (name) {
221
+ const results = flatmap.search(name);
222
+ if (results.featureIds.length > 0) {
223
+ flatmap.zoomToFeatures(results.featureIds, { noZoomIn: true });
224
+ /*
225
+ flatmap.highlightFeatures([
226
+ flatmap.modelForFeature(results.featureIds[0]),
227
+ ]);
228
+ */
229
+ }
230
+ }
231
+ },
232
+ updateProvCard: function() {
233
+ const imp = this.getFlatmapImp();
234
+ if (imp) {
235
+ let provClone = {id: this.entry.id, prov: imp.provenance};
236
+ this.$emit("flatmap-provenance-ready", provClone);
237
+ }
238
+ },
239
+ flatmapChanged: async function (activeSpecies) {
240
+ this.activeSpecies = activeSpecies;
241
+ this.openMapOptions = getOpenMapOptions(activeSpecies);
242
+ this.$emit("species-changed", activeSpecies);
243
+ if (!(this.entry.state && (this.entry.state.species === this.activeSpecies))) {
244
+ if (this.syncMode == true)
245
+ await this.toggleSyncMode();
246
+ }
247
+ this.updateProvCard();
248
+ },
249
+ multiFlatmapReady: function (flatmap) {
250
+ if (flatmap) {
251
+ flatmap.enablePanZoomEvents(true); // Use zoom events for dynamic markers
252
+ this.flatmapReady = true;
253
+ const flatmapImp = flatmap.mapImp;
254
+ this.flatmapMarkerZoomUpdate(true, flatmapImp);
255
+ this.updateProvCard();
256
+ }
257
+ },
258
+ getFlatmapImp: function () {
259
+ if (this.entry.type === "MultiFlatmap" && this.flatmapReady) {
260
+ return this.$refs.multiflatmap.getCurrentFlatmap()["mapImp"];
261
+ } else {
262
+ return undefined;
263
+ }
264
+ },
265
+ flatmapAreaSearch() {
266
+ const flatmapImp = this.getFlatmapImp();
267
+ let shownMarkers = flatmapImp.visibleMarkerAnatomicalIds();
268
+ let returnedAction = {
269
+ type: "Facets",
270
+ label: "Unused",
271
+ val: shownMarkers.map(marker => this.idNamePair[marker]),
272
+ };
273
+ EventBus.emit("PopoverActionClick", returnedAction);
274
+ },
275
+ restoreFeaturedMarkers: function (flatmap) {
276
+ this.settingsStore.resetFeaturedMarkerIdentifier();
277
+ const markers = this.settingsStore.featuredMarkers;
278
+ this.updateFeatureMarkers(markers, flatmap);
279
+ },
280
+ updateFeatureMarkers: function (markers, flatmap) {
281
+ this.showStarInLegend = false; // will show if we have a featured marker
282
+ for (let index = 0; index < markers.length; ++index) {
283
+ if (markers[index]) {
284
+ const markerIdentifier =
285
+ this.settingsStore.featuredMarkerIdentifiers[index];
286
+ if (!markerIdentifier) {
287
+ // Add the featured marker to the legend if we have a featured marker
288
+ const markerExists = this.addFeaturedMarker(markers[index], index, flatmap);
289
+ if (markerExists) {
290
+ this.showStarInLegend = true;
291
+ }
292
+ }
293
+ }
294
+ }
295
+ },
296
+ addFeaturedMarker: function (marker, index, flatmap) {
297
+ const markerSpecies =
298
+ this.settingsStore.featuredMarkerSpecies[index];
299
+ if (markerSpecies && !this.activeSpecies.startsWith(markerSpecies)) {
300
+ return false;
301
+ }
302
+ let flatmapImp = flatmap;
303
+ if (!flatmapImp) {
304
+ flatmapImp = this.getFlatmapImp();
305
+ }
306
+
307
+ if (flatmapImp) {
308
+ // create the star marker
309
+ let wrapperElement = document.createElement("div");
310
+ wrapperElement.innerHTML = YellowStar;
311
+
312
+ // add it to the flatmap
313
+ const markerIdentifier = flatmapImp.addMarker(marker, {
314
+ element: wrapperElement,
315
+ className: "highlight-marker"
316
+ });
317
+
318
+ // update the store with the marker identifier
319
+ this.settingsStore.updateFeaturedMarkerIdentifier({
320
+ index,
321
+ markerIdentifier,
322
+ });
323
+ return true;
324
+ }
325
+ return false;
326
+ },
327
+ },
328
+ computed: {
329
+ facetSpecies() {
330
+ return this.settingsStore.facets.species;
331
+ },
332
+ featuredMarkers() {
333
+ return this.settingsStore.featuredMarkers;
334
+ },
335
+ },
336
+ watch: {
337
+ syncMode: function (val) {
338
+ if (this.$refs.multiflatmap.getCurrentFlatmap())
339
+ this.$refs.multiflatmap.getCurrentFlatmap().enablePanZoomEvents(val);
340
+ },
341
+ featuredMarkers: function (markers) {
342
+ if (!this.flatmapReady) {
343
+ return;
344
+ }
345
+
346
+ this.updateFeatureMarkers(markers, undefined);
347
+ },
348
+ },
349
+ mounted: function () {
350
+ this.getAvailableTerms();
351
+ this.getFeaturedDatasets();
352
+
353
+ EventBus.on("markerUpdate", () => {
354
+ this.flatmapMarkerZoomUpdate(true, undefined);
355
+ });
356
+ },
357
+ };
358
+ </script>
359
+
360
+ <!-- Add "scoped" attribute to limit CSS to this component only -->
361
+ <style scoped lang="scss">
362
+
363
+ :deep(.maplibregl-popup) {
364
+ z-index: 3;
365
+ }
366
+
367
+ :deep(.maplibregl-marker) {
368
+ &.standard-marker {
369
+ cursor: pointer !important;
370
+ z-index: 2;
371
+ }
372
+ &.highlight-marker {
373
+ visibility: visible !important;
374
+ cursor: pointer !important;
375
+ z-index: 1;
376
+ div {
377
+ scale: 0.5;
378
+ transform: translate(45px, -7px);
379
+ }
380
+ }
381
+ }
382
+
383
+ </style>
384
+
385
385
  <style src="../../assets/mapicon-species-style.css"></style>