@abi-software/flatmapvuer 1.6.2-beta.2 → 1.6.2-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/flatmapvuer.js +2884 -2839
- package/dist/flatmapvuer.umd.cjs +20 -20
- package/dist/style.css +1 -1
- package/package.json +2 -2
- package/src/components/FlatmapVuer.vue +96 -68
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abi-software/flatmapvuer",
|
|
3
|
-
"version": "1.6.2-beta.
|
|
3
|
+
"version": "1.6.2-beta.3",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist/*",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"@abi-software/flatmap-viewer": "^3.2.8",
|
|
47
|
-
"@abi-software/map-utilities": "^1.2.
|
|
47
|
+
"@abi-software/map-utilities": "^1.2.1",
|
|
48
48
|
"@abi-software/sparc-annotation": "0.3.2",
|
|
49
49
|
"@abi-software/svg-sprite": "^1.0.1",
|
|
50
50
|
"@element-plus/icons-vue": "^2.3.1",
|
|
@@ -152,6 +152,7 @@ Please use `const` to assign meaningful names to them...
|
|
|
152
152
|
class: '.maplibregl-canvas',
|
|
153
153
|
}"
|
|
154
154
|
:toolbarOptions="toolbarOptions"
|
|
155
|
+
:drawnType="drawnType"
|
|
155
156
|
:activeDrawTool="activeDrawTool"
|
|
156
157
|
:activeDrawMode="activeDrawMode"
|
|
157
158
|
:newlyDrawnEntry="drawnCreatedEvent"
|
|
@@ -453,22 +454,44 @@ Please use `const` to assign meaningful names to them...
|
|
|
453
454
|
</template>
|
|
454
455
|
</div>
|
|
455
456
|
<el-row class="viewing-mode-description">
|
|
456
|
-
{{
|
|
457
|
+
{{ viewingModes[viewingMode] }}
|
|
457
458
|
</el-row>
|
|
458
459
|
</el-row>
|
|
459
460
|
<template v-if="viewingMode === 'Annotation' && userInformation">
|
|
460
|
-
<el-row class="backgroundText">
|
|
461
|
+
<el-row class="backgroundText">Drawn By*</el-row>
|
|
461
462
|
<el-row class="backgroundControl">
|
|
462
463
|
<el-select
|
|
463
464
|
:teleported="false"
|
|
464
|
-
v-model="
|
|
465
|
+
v-model="drawnType"
|
|
465
466
|
placeholder="Select"
|
|
466
467
|
class="select-box"
|
|
467
468
|
popper-class="flatmap_dropdown"
|
|
468
|
-
@change="
|
|
469
|
+
@change="setDrawnType"
|
|
469
470
|
>
|
|
470
471
|
<el-option
|
|
471
|
-
v-for="item in
|
|
472
|
+
v-for="item in drawnTypes"
|
|
473
|
+
:key="item"
|
|
474
|
+
:label="item"
|
|
475
|
+
:value="item"
|
|
476
|
+
>
|
|
477
|
+
<el-row>
|
|
478
|
+
<el-col :span="12">{{ item }}</el-col>
|
|
479
|
+
</el-row>
|
|
480
|
+
</el-option>
|
|
481
|
+
</el-select>
|
|
482
|
+
</el-row>
|
|
483
|
+
<el-row class="backgroundText">Annotated By*</el-row>
|
|
484
|
+
<el-row class="backgroundControl">
|
|
485
|
+
<el-select
|
|
486
|
+
:teleported="false"
|
|
487
|
+
v-model="annotatedType"
|
|
488
|
+
placeholder="Select"
|
|
489
|
+
class="select-box"
|
|
490
|
+
popper-class="flatmap_dropdown"
|
|
491
|
+
@change="setAnnotatedType"
|
|
492
|
+
>
|
|
493
|
+
<el-option
|
|
494
|
+
v-for="item in annotatedTypes"
|
|
472
495
|
:key="item"
|
|
473
496
|
:label="item"
|
|
474
497
|
:value="item"
|
|
@@ -645,24 +668,20 @@ const centroid = (geometry) => {
|
|
|
645
668
|
let featureGeometry = { lng: 0, lat: 0, }
|
|
646
669
|
let coordinates
|
|
647
670
|
if (geometry.type === "Polygon") {
|
|
648
|
-
|
|
649
|
-
coordinates = geometry.coordinates[0]
|
|
650
|
-
}
|
|
671
|
+
coordinates = geometry.coordinates[0]
|
|
651
672
|
} else {
|
|
652
673
|
coordinates = geometry.coordinates
|
|
653
674
|
}
|
|
654
|
-
if (
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
featureGeometry.lat += parseFloat(coordinates[1])
|
|
665
|
-
}
|
|
675
|
+
if (!(geometry.type === 'Point')) {
|
|
676
|
+
coordinates.map((coor) => {
|
|
677
|
+
featureGeometry.lng += parseFloat(coor[0])
|
|
678
|
+
featureGeometry.lat += parseFloat(coor[1])
|
|
679
|
+
})
|
|
680
|
+
featureGeometry.lng = featureGeometry.lng / coordinates.length
|
|
681
|
+
featureGeometry.lat = featureGeometry.lat / coordinates.length
|
|
682
|
+
} else {
|
|
683
|
+
featureGeometry.lng += parseFloat(coordinates[0])
|
|
684
|
+
featureGeometry.lat += parseFloat(coordinates[1])
|
|
666
685
|
}
|
|
667
686
|
return featureGeometry
|
|
668
687
|
}
|
|
@@ -754,7 +773,6 @@ export default {
|
|
|
754
773
|
if (this.annotationSidebar) this.$emit("annotation-close")
|
|
755
774
|
this.closeTooltip()
|
|
756
775
|
this.annotationEventCallback({}, { type: 'aborted' })
|
|
757
|
-
this.initialiseDrawing()
|
|
758
776
|
},
|
|
759
777
|
/**
|
|
760
778
|
* @public
|
|
@@ -832,6 +850,7 @@ export default {
|
|
|
832
850
|
toolbarEvent: function (type, name) {
|
|
833
851
|
this.manualAbortedOnClose()
|
|
834
852
|
this.doubleClickedFeature = false
|
|
853
|
+
this.connectionEntry = {}
|
|
835
854
|
if (type === 'mode') {
|
|
836
855
|
// Deselect any feature when draw mode is changed
|
|
837
856
|
this.changeAnnotationDrawMode({ mode: 'simple_select' })
|
|
@@ -840,6 +859,7 @@ export default {
|
|
|
840
859
|
if (name) {
|
|
841
860
|
const tool = name.replace(/[A-Z]/g, letter => `_${letter.toLowerCase()}`)
|
|
842
861
|
this.changeAnnotationDrawMode({ mode: `draw${tool}` })
|
|
862
|
+
this.initialiseDrawing()
|
|
843
863
|
} else {
|
|
844
864
|
this.changeAnnotationDrawMode({ mode: 'simple_select' })
|
|
845
865
|
this.cancelDrawnFeature()
|
|
@@ -865,7 +885,8 @@ export default {
|
|
|
865
885
|
}
|
|
866
886
|
this.doubleClickedFeature = false
|
|
867
887
|
}
|
|
868
|
-
}
|
|
888
|
+
}
|
|
889
|
+
if (this.activeDrawMode === 'Delete') {
|
|
869
890
|
this.changeAnnotationDrawMode({
|
|
870
891
|
mode: 'simple_select',
|
|
871
892
|
options: { featureIds: [data.feature.feature.id] }
|
|
@@ -954,7 +975,6 @@ export default {
|
|
|
954
975
|
if (this.annotationEntry.type === 'deleted') {
|
|
955
976
|
if (this.annotationSidebar) this.$emit("annotation-close")
|
|
956
977
|
this.closeTooltip()
|
|
957
|
-
// Only delete need, keep the annotation tooltip/sidebar open if created/updated
|
|
958
978
|
this.annotationEntry = {}
|
|
959
979
|
}
|
|
960
980
|
this.addAnnotationFeature()
|
|
@@ -995,6 +1015,12 @@ export default {
|
|
|
995
1015
|
let drawnFeatures = await this.annotator.drawnFeatures(this.userToken, this.serverURL, annotatedItemIds)
|
|
996
1016
|
// The annotator has `resource` and `features` fields
|
|
997
1017
|
if ('resource' in drawnFeatures) drawnFeatures = drawnFeatures.features
|
|
1018
|
+
// Use to switch the displayed feature type
|
|
1019
|
+
if (this.drawnType !== 'All tools') {
|
|
1020
|
+
drawnFeatures = drawnFeatures.filter((feature) => {
|
|
1021
|
+
return feature.geometry.type === this.drawnType
|
|
1022
|
+
})
|
|
1023
|
+
}
|
|
998
1024
|
return drawnFeatures
|
|
999
1025
|
},
|
|
1000
1026
|
/**
|
|
@@ -1004,19 +1030,21 @@ export default {
|
|
|
1004
1030
|
addAnnotationFeature: async function () {
|
|
1005
1031
|
if (this.mapImp) {
|
|
1006
1032
|
if (!this.featureAnnotationSubmitted) this.clearAnnotationFeature()
|
|
1007
|
-
if (
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
this.userInformation.orcid
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1033
|
+
if (this.drawnType !== 'None') {
|
|
1034
|
+
if (!this.featureAnnotationSubmitted) this.loading = true
|
|
1035
|
+
const userId = this.annotatedType === 'Anyone' ?
|
|
1036
|
+
undefined : this.userInformation.orcid ?
|
|
1037
|
+
this.userInformation.orcid : '0000-0000-0000-0000'
|
|
1038
|
+
const participated = this.annotatedType === 'Anyone' ?
|
|
1039
|
+
undefined : this.annotatedType === 'Me' ?
|
|
1040
|
+
true : false
|
|
1041
|
+
const drawnFeatures = await this.fetchDrawnFeatures(userId, participated)
|
|
1042
|
+
this.existDrawnFeatures = drawnFeatures
|
|
1043
|
+
this.loading = false
|
|
1044
|
+
if (!this.featureAnnotationSubmitted) {
|
|
1045
|
+
for (const feature of drawnFeatures) {
|
|
1046
|
+
this.mapImp.addAnnotationFeature(feature)
|
|
1047
|
+
}
|
|
1020
1048
|
}
|
|
1021
1049
|
}
|
|
1022
1050
|
}
|
|
@@ -1034,13 +1062,26 @@ export default {
|
|
|
1034
1062
|
this.$el.querySelector('.maplibregl-ctrl-group').style.display = 'none'
|
|
1035
1063
|
}
|
|
1036
1064
|
},
|
|
1065
|
+
/**
|
|
1066
|
+
* @public
|
|
1067
|
+
* Function to switch the type of annotation.
|
|
1068
|
+
* @arg {Boolean} `flag`
|
|
1069
|
+
*/
|
|
1070
|
+
setDrawnType: function (flag) {
|
|
1071
|
+
this.drawnType = flag
|
|
1072
|
+
if (this.mapImp) {
|
|
1073
|
+
this.manualAbortedOnClose()
|
|
1074
|
+
this.addAnnotationFeature()
|
|
1075
|
+
this.initialiseDrawing()
|
|
1076
|
+
}
|
|
1077
|
+
},
|
|
1037
1078
|
/**
|
|
1038
1079
|
* @public
|
|
1039
1080
|
* Function to switch the type of person who annotated.
|
|
1040
1081
|
* @arg {Boolean} `flag`
|
|
1041
1082
|
*/
|
|
1042
|
-
|
|
1043
|
-
this.
|
|
1083
|
+
setAnnotatedType: function (flag) {
|
|
1084
|
+
this.annotatedType = flag
|
|
1044
1085
|
if (this.mapImp) {
|
|
1045
1086
|
this.manualAbortedOnClose()
|
|
1046
1087
|
this.addAnnotationFeature()
|
|
@@ -1548,7 +1589,7 @@ export default {
|
|
|
1548
1589
|
this.annotationEntry = {}
|
|
1549
1590
|
} else if (data.type === 'modeChanged') {
|
|
1550
1591
|
if (data.feature.mode === 'direct_select') this.doubleClickedFeature = true
|
|
1551
|
-
if (this.annotationSidebar && data.feature.mode === 'simple_select'
|
|
1592
|
+
if (this.annotationSidebar && data.feature.mode === 'simple_select') {
|
|
1552
1593
|
this.annotationEventCallback({}, { type: 'aborted' })
|
|
1553
1594
|
}
|
|
1554
1595
|
} else if (data.type === 'selectionChanged') {
|
|
@@ -1566,15 +1607,6 @@ export default {
|
|
|
1566
1607
|
this.connectionEntry = drawnFeature.connection
|
|
1567
1608
|
}
|
|
1568
1609
|
this.annotationDrawModeEvent(payload)
|
|
1569
|
-
} else {
|
|
1570
|
-
if (this.annotationSidebar && this.previousEditEvent.type === 'updated') {
|
|
1571
|
-
this.annotationEntry = {
|
|
1572
|
-
...this.previousEditEvent,
|
|
1573
|
-
resourceId: this.serverURL
|
|
1574
|
-
}
|
|
1575
|
-
this.annotationEventCallback({}, { type: 'aborted' })
|
|
1576
|
-
}
|
|
1577
|
-
this.previousEditEvent = {}
|
|
1578
1610
|
}
|
|
1579
1611
|
}
|
|
1580
1612
|
} else {
|
|
@@ -1592,7 +1624,6 @@ export default {
|
|
|
1592
1624
|
if (data.type === 'created') this.drawnCreatedEvent = payload
|
|
1593
1625
|
else this.checkAndCreatePopups(payload)
|
|
1594
1626
|
}
|
|
1595
|
-
if (data.type === 'updated') this.previousEditEvent = data
|
|
1596
1627
|
if (data.type === 'deleted') this.previousDeletedEvent = data
|
|
1597
1628
|
else this.previousDeletedEvent = {}
|
|
1598
1629
|
},
|
|
@@ -1804,7 +1835,7 @@ export default {
|
|
|
1804
1835
|
}
|
|
1805
1836
|
|
|
1806
1837
|
// highlight all available features
|
|
1807
|
-
this.mapImp.
|
|
1838
|
+
this.mapImp.selectFeatures(featuresToHighlight);
|
|
1808
1839
|
}
|
|
1809
1840
|
},
|
|
1810
1841
|
emitConnectivityGraphError: function (errorData) {
|
|
@@ -1839,8 +1870,12 @@ export default {
|
|
|
1839
1870
|
if (data.feature.featureId && data.feature.models) {
|
|
1840
1871
|
this.displayTooltip(data.feature.models)
|
|
1841
1872
|
} else if (data.feature.feature) {
|
|
1842
|
-
// in drawing or edit/delete mode is on or
|
|
1843
|
-
if (
|
|
1873
|
+
// in drawing or edit/delete mode is on or has connectivity
|
|
1874
|
+
if (
|
|
1875
|
+
this.activeDrawTool ||
|
|
1876
|
+
this.activeDrawMode ||
|
|
1877
|
+
Object.keys(this.connectionEntry).length > 0
|
|
1878
|
+
) {
|
|
1844
1879
|
this.featureAnnotationSubmitted = false
|
|
1845
1880
|
this.annotationEntry.featureId = data.feature.feature.id
|
|
1846
1881
|
if (this.activeDrawTool) {
|
|
@@ -2143,7 +2178,8 @@ export default {
|
|
|
2143
2178
|
!this.disableUI && (
|
|
2144
2179
|
(
|
|
2145
2180
|
this.viewingMode === 'Annotation' &&
|
|
2146
|
-
!this.annotationSidebar
|
|
2181
|
+
!this.annotationSidebar &&
|
|
2182
|
+
this.userInformation
|
|
2147
2183
|
) ||
|
|
2148
2184
|
(
|
|
2149
2185
|
this.viewingMode === 'Exploration' &&
|
|
@@ -2157,6 +2193,7 @@ export default {
|
|
|
2157
2193
|
this.mapImp.showPopup(featureId, this.$refs.tooltip.$el, options);
|
|
2158
2194
|
this.popUpCssHacks();
|
|
2159
2195
|
});
|
|
2196
|
+
|
|
2160
2197
|
}
|
|
2161
2198
|
},
|
|
2162
2199
|
hasTooltipEntry: function () {
|
|
@@ -2916,10 +2953,12 @@ export default {
|
|
|
2916
2953
|
viewingModes: {
|
|
2917
2954
|
'Exploration': 'Find relevant research and view detail of neural pathways by selecting a pathway to view its connections and data sources',
|
|
2918
2955
|
'Neuron Connection': 'Discover Neuron connections by selecting a neuron and viewing its associated network connections',
|
|
2919
|
-
'Annotation':
|
|
2956
|
+
'Annotation': 'View internal identifiers of features'
|
|
2920
2957
|
},
|
|
2921
|
-
|
|
2922
|
-
|
|
2958
|
+
drawnType: 'All tools',
|
|
2959
|
+
drawnTypes: ['All tools', 'Point', 'LineString', 'Polygon', 'None'],
|
|
2960
|
+
annotatedType: 'Anyone',
|
|
2961
|
+
annotatedTypes: ['Anyone', 'Me', 'Others'],
|
|
2923
2962
|
openMapRef: undefined,
|
|
2924
2963
|
backgroundIconRef: undefined,
|
|
2925
2964
|
toolbarOptions: [
|
|
@@ -2936,7 +2975,6 @@ export default {
|
|
|
2936
2975
|
activeDrawTool: undefined,
|
|
2937
2976
|
featureAnnotationSubmitted: false,
|
|
2938
2977
|
drawnCreatedEvent: {},
|
|
2939
|
-
previousEditEvent: {},
|
|
2940
2978
|
previousDeletedEvent: {},
|
|
2941
2979
|
connectionEntry: {},
|
|
2942
2980
|
existDrawnFeatures: [], // Store all exist drawn features
|
|
@@ -2991,17 +3029,7 @@ export default {
|
|
|
2991
3029
|
}
|
|
2992
3030
|
this.drawerOpen = false
|
|
2993
3031
|
return true
|
|
2994
|
-
}
|
|
2995
|
-
modeDescription: function () {
|
|
2996
|
-
let description = this.viewingModes[this.viewingMode]
|
|
2997
|
-
if (this.viewingMode === 'Annotation') {
|
|
2998
|
-
if (this.userInformation) {
|
|
2999
|
-
return description[1]
|
|
3000
|
-
}
|
|
3001
|
-
return description[0]
|
|
3002
|
-
}
|
|
3003
|
-
return description
|
|
3004
|
-
},
|
|
3032
|
+
}
|
|
3005
3033
|
},
|
|
3006
3034
|
watch: {
|
|
3007
3035
|
entry: function () {
|