@abi-software/flatmapvuer 0.6.1-auth.1 → 0.6.1-auth.2
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 +41536 -43025
- package/dist/flatmapvuer.umd.cjs +178 -184
- package/dist/style.css +1 -1
- package/package.json +3 -3
- package/src/App.vue +1 -1
- package/src/components/AnnotationTool.vue +49 -100
- package/src/components/FlatmapVuer.vue +91 -867
- package/src/components/Tooltip.vue +1 -1
- package/src/components.d.ts +0 -5
- package/src/components/RelevanceDialog.vue +0 -102
|
@@ -136,128 +136,6 @@
|
|
|
136
136
|
<el-icon-arrow-down />
|
|
137
137
|
</el-icon>
|
|
138
138
|
|
|
139
|
-
<div class="bottom-draw-control"
|
|
140
|
-
v-if="viewingMode === 'Annotation' && userInformation"
|
|
141
|
-
v-show="!disableUI">
|
|
142
|
-
<el-popover
|
|
143
|
-
content="Relevance"
|
|
144
|
-
placement="top"
|
|
145
|
-
:teleported="false"
|
|
146
|
-
trigger="manual"
|
|
147
|
-
width="80"
|
|
148
|
-
popper-class="flatmap-popper"
|
|
149
|
-
:visible="hoverVisibilities[10].value"
|
|
150
|
-
>
|
|
151
|
-
<template #reference>
|
|
152
|
-
<map-svg-icon
|
|
153
|
-
icon="connection"
|
|
154
|
-
class="icon-button drawRelevance inactive"
|
|
155
|
-
@click="relevanceDialogPopup"
|
|
156
|
-
@mouseover="showToolitip(10)"
|
|
157
|
-
@mouseout="hideToolitip(10)"
|
|
158
|
-
/>
|
|
159
|
-
</template>
|
|
160
|
-
</el-popover>
|
|
161
|
-
<el-popover
|
|
162
|
-
content="Draw Point"
|
|
163
|
-
placement="top"
|
|
164
|
-
:teleported="false"
|
|
165
|
-
trigger="manual"
|
|
166
|
-
width="80"
|
|
167
|
-
popper-class="flatmap-popper"
|
|
168
|
-
:visible="hoverVisibilities[11].value"
|
|
169
|
-
v-if="drawnType !== 'LineString' && drawnType !== 'Polygon'"
|
|
170
|
-
>
|
|
171
|
-
<template #reference>
|
|
172
|
-
<map-svg-icon
|
|
173
|
-
icon="drawPoint"
|
|
174
|
-
class="icon-button drawPoint"
|
|
175
|
-
@click="drawingEvent('Point')"
|
|
176
|
-
@mouseover="showToolitip(11)"
|
|
177
|
-
@mouseout="hideToolitip(11)"
|
|
178
|
-
/>
|
|
179
|
-
</template>
|
|
180
|
-
</el-popover>
|
|
181
|
-
<el-popover
|
|
182
|
-
content="Draw Line"
|
|
183
|
-
placement="top"
|
|
184
|
-
:teleported="false"
|
|
185
|
-
trigger="manual"
|
|
186
|
-
width="80"
|
|
187
|
-
popper-class="flatmap-popper"
|
|
188
|
-
:visible="hoverVisibilities[12].value"
|
|
189
|
-
v-if="drawnType !== 'Point' && drawnType !== 'Polygon'"
|
|
190
|
-
>
|
|
191
|
-
<template #reference>
|
|
192
|
-
<map-svg-icon
|
|
193
|
-
icon="drawLine"
|
|
194
|
-
class="icon-button drawLineString"
|
|
195
|
-
@click="drawingEvent('LineString')"
|
|
196
|
-
@mouseover="showToolitip(12)"
|
|
197
|
-
@mouseout="hideToolitip(12)"
|
|
198
|
-
/>
|
|
199
|
-
</template>
|
|
200
|
-
</el-popover>
|
|
201
|
-
<el-popover
|
|
202
|
-
content="Draw Polygon"
|
|
203
|
-
placement="top"
|
|
204
|
-
:teleported="false"
|
|
205
|
-
trigger="manual"
|
|
206
|
-
width="80"
|
|
207
|
-
popper-class="flatmap-popper"
|
|
208
|
-
:visible="hoverVisibilities[13].value"
|
|
209
|
-
v-if="drawnType !== 'Point' && drawnType !== 'LineString'"
|
|
210
|
-
>
|
|
211
|
-
<template #reference>
|
|
212
|
-
<map-svg-icon
|
|
213
|
-
icon="drawPolygon"
|
|
214
|
-
class="icon-button drawPolygon"
|
|
215
|
-
@click="drawingEvent('Polygon')"
|
|
216
|
-
@mouseover="showToolitip(13)"
|
|
217
|
-
@mouseout="hideToolitip(13)"
|
|
218
|
-
/>
|
|
219
|
-
</template>
|
|
220
|
-
</el-popover>
|
|
221
|
-
<el-popover
|
|
222
|
-
content="Delete"
|
|
223
|
-
placement="top"
|
|
224
|
-
:teleported="false"
|
|
225
|
-
trigger="manual"
|
|
226
|
-
width="80"
|
|
227
|
-
popper-class="flatmap-popper"
|
|
228
|
-
:visible="hoverVisibilities[14].value"
|
|
229
|
-
>
|
|
230
|
-
<template #reference>
|
|
231
|
-
<map-svg-icon
|
|
232
|
-
icon="drawTrash"
|
|
233
|
-
class="icon-button drawDelete"
|
|
234
|
-
@click="drawingEvent('Delete')"
|
|
235
|
-
@mouseover="showToolitip(14)"
|
|
236
|
-
@mouseout="hideToolitip(14)"
|
|
237
|
-
/>
|
|
238
|
-
</template>
|
|
239
|
-
</el-popover>
|
|
240
|
-
<el-popover
|
|
241
|
-
content="Edit"
|
|
242
|
-
placement="top"
|
|
243
|
-
:teleported="false"
|
|
244
|
-
trigger="manual"
|
|
245
|
-
width="80"
|
|
246
|
-
popper-class="flatmap-popper"
|
|
247
|
-
:visible="hoverVisibilities[15].value"
|
|
248
|
-
>
|
|
249
|
-
<template #reference>
|
|
250
|
-
<map-svg-icon
|
|
251
|
-
icon="comment"
|
|
252
|
-
class="icon-button drawEdit"
|
|
253
|
-
@click="drawingEvent('Edit')"
|
|
254
|
-
@mouseover="showToolitip(15)"
|
|
255
|
-
@mouseout="hideToolitip(15)"
|
|
256
|
-
/>
|
|
257
|
-
</template>
|
|
258
|
-
</el-popover>
|
|
259
|
-
</div>
|
|
260
|
-
|
|
261
139
|
<div class="bottom-right-control" v-show="!disableUI">
|
|
262
140
|
<el-popover
|
|
263
141
|
content="Zoom in"
|
|
@@ -284,7 +162,7 @@
|
|
|
284
162
|
:teleported="false"
|
|
285
163
|
trigger="manual"
|
|
286
164
|
width="70"
|
|
287
|
-
popper-class="flatmap-popper"
|
|
165
|
+
popper-class="flatmap-popper popper-zoomout"
|
|
288
166
|
:visible="hoverVisibilities[1].value"
|
|
289
167
|
>
|
|
290
168
|
<template #reference>
|
|
@@ -516,52 +394,6 @@
|
|
|
516
394
|
</el-option>
|
|
517
395
|
</el-select>
|
|
518
396
|
</el-row>
|
|
519
|
-
<template v-if="viewingMode === 'Annotation' && userInformation">
|
|
520
|
-
<el-row class="backgroundText">Drawn By*</el-row>
|
|
521
|
-
<el-row class="backgroundControl">
|
|
522
|
-
<el-select
|
|
523
|
-
:teleported="false"
|
|
524
|
-
v-model="drawnType"
|
|
525
|
-
placeholder="Select"
|
|
526
|
-
class="select-box"
|
|
527
|
-
popper-class="flatmap_dropdown"
|
|
528
|
-
@change="setDrawnType"
|
|
529
|
-
>
|
|
530
|
-
<el-option
|
|
531
|
-
v-for="item in drawnTypes"
|
|
532
|
-
:key="item"
|
|
533
|
-
:label="item"
|
|
534
|
-
:value="item"
|
|
535
|
-
>
|
|
536
|
-
<el-row>
|
|
537
|
-
<el-col :span="12">{{ item }}</el-col>
|
|
538
|
-
</el-row>
|
|
539
|
-
</el-option>
|
|
540
|
-
</el-select>
|
|
541
|
-
</el-row>
|
|
542
|
-
<el-row class="backgroundText">Annotated By*</el-row>
|
|
543
|
-
<el-row class="backgroundControl">
|
|
544
|
-
<el-select
|
|
545
|
-
:teleported="false"
|
|
546
|
-
v-model="annotatedType"
|
|
547
|
-
placeholder="Select"
|
|
548
|
-
class="select-box"
|
|
549
|
-
popper-class="flatmap_dropdown"
|
|
550
|
-
@change="setAnnotatedType"
|
|
551
|
-
>
|
|
552
|
-
<el-option
|
|
553
|
-
v-for="item in annotatedTypes"
|
|
554
|
-
:key="item"
|
|
555
|
-
:label="item"
|
|
556
|
-
:value="item"
|
|
557
|
-
>
|
|
558
|
-
<el-row>
|
|
559
|
-
<el-col :span="12">{{ item }}</el-col>
|
|
560
|
-
</el-row>
|
|
561
|
-
</el-option>
|
|
562
|
-
</el-select>
|
|
563
|
-
</el-row>
|
|
564
|
-
</template>
|
|
565
397
|
<el-row class="backgroundSpacer" v-if="displayFlightPathOption"></el-row>
|
|
566
398
|
<el-row class="backgroundText" v-if="displayFlightPathOption">Flight path display</el-row>
|
|
567
399
|
<el-row class="backgroundControl" v-if="displayFlightPathOption">
|
|
@@ -667,37 +499,23 @@
|
|
|
667
499
|
:annotationEntry="annotationEntry"
|
|
668
500
|
:entry="tooltipEntry"
|
|
669
501
|
:annotationDisplay="viewingMode === 'Annotation'"
|
|
670
|
-
@annotation="commitAnnotationEvent"
|
|
671
|
-
/>
|
|
672
|
-
<RelevanceDialog
|
|
673
|
-
class="relevance-dialog"
|
|
674
|
-
v-show="relevanceDisplay"
|
|
675
|
-
:entry="relevanceEntry"
|
|
676
|
-
:drawing="inDrawing"
|
|
677
|
-
:relevance="relevance"
|
|
678
|
-
@display="relevanceDialogPopup"
|
|
679
|
-
@confirm="confirmDrawnFeature"
|
|
680
|
-
@cancel="cancelDrawnFeature"
|
|
681
|
-
@popup="closePopup"
|
|
682
|
-
@tooltip="checkAndCreatePopups"
|
|
683
502
|
/>
|
|
684
503
|
</div>
|
|
685
504
|
</div>
|
|
686
505
|
</template>
|
|
687
506
|
|
|
688
507
|
<script>
|
|
689
|
-
|
|
690
|
-
import { shallowRef, markRaw } from 'vue'
|
|
508
|
+
import { shallowRef } from 'vue'
|
|
691
509
|
import {
|
|
692
510
|
WarningFilled as ElIconWarningFilled,
|
|
693
511
|
ArrowDown as ElIconArrowDown,
|
|
694
512
|
ArrowLeft as ElIconArrowLeft,
|
|
695
513
|
} from '@element-plus/icons-vue'
|
|
514
|
+
/* eslint-disable no-alert, no-console */
|
|
696
515
|
import Tooltip from './Tooltip.vue'
|
|
697
516
|
import SelectionsGroup from './SelectionsGroup.vue'
|
|
698
517
|
import TreeControls from './TreeControls.vue'
|
|
699
518
|
import { MapSvgIcon, MapSvgSpriteColor } from '@abi-software/svg-sprite'
|
|
700
|
-
import '@abi-software/svg-sprite/dist/style.css'
|
|
701
519
|
import SvgLegends from './legends/SvgLegends.vue'
|
|
702
520
|
import {
|
|
703
521
|
ElButton as Button,
|
|
@@ -707,7 +525,6 @@ import {
|
|
|
707
525
|
ElRadioGroup as RadioGroup,
|
|
708
526
|
ElRow as Row,
|
|
709
527
|
ElSelect as Select,
|
|
710
|
-
ElDialog as Dialog,
|
|
711
528
|
} from 'element-plus'
|
|
712
529
|
import flatmapMarker from '../icons/flatmap-marker'
|
|
713
530
|
import {
|
|
@@ -717,80 +534,7 @@ import {
|
|
|
717
534
|
import yellowstar from '../icons/yellowstar'
|
|
718
535
|
import ResizeSensor from 'css-element-queries/src/ResizeSensor'
|
|
719
536
|
import * as flatmap from '@abi-software/flatmap-viewer'
|
|
720
|
-
import { AnnotationService } from '@abi-software/sparc-annotation'
|
|
721
|
-
import RelevanceDialog from './RelevanceDialog.vue'
|
|
722
537
|
|
|
723
|
-
/**
|
|
724
|
-
* @param scopeElement Draggable scope area (Optional)
|
|
725
|
-
* @param dragElement Draggable element
|
|
726
|
-
*/
|
|
727
|
-
const draggable = (scopeElement, dragElement) => {
|
|
728
|
-
let startX, startY, clickX, clickY, posX, posY
|
|
729
|
-
// reset position in case previous pupped up dialog is dragged
|
|
730
|
-
dragElement.style.left = ''
|
|
731
|
-
dragElement.style.top = ''
|
|
732
|
-
// const scopeRect = scopeElement.getBoundingClientRect()
|
|
733
|
-
// const dragRect = dragElement.getBoundingClientRect()
|
|
734
|
-
|
|
735
|
-
dragElement.addEventListener('mousedown', (e) => {
|
|
736
|
-
e.preventDefault();
|
|
737
|
-
startX = dragElement.offsetLeft
|
|
738
|
-
startY = dragElement.offsetTop
|
|
739
|
-
clickX = e.clientX
|
|
740
|
-
clickY = e.clientY
|
|
741
|
-
|
|
742
|
-
dragElement.addEventListener('mousemove', drag, false);
|
|
743
|
-
document.addEventListener('mouseup', () => {
|
|
744
|
-
dragElement.removeEventListener('mousemove', drag, false);
|
|
745
|
-
}, false);
|
|
746
|
-
}, false);
|
|
747
|
-
|
|
748
|
-
function drag(e) {
|
|
749
|
-
e.preventDefault();
|
|
750
|
-
posX = startX - (clickX - e.clientX)
|
|
751
|
-
posY = startY - (clickY - e.clientY)
|
|
752
|
-
// if (
|
|
753
|
-
// (posX > scopeRect.left && ((posX + dragRect.width) < scopeRect.right)) &&
|
|
754
|
-
// (posY > scopeRect.top && ((posY + dragRect.height) < scopeRect.bottom))
|
|
755
|
-
// ) {
|
|
756
|
-
dragElement.style.left = `${posX}px`;
|
|
757
|
-
dragElement.style.top = `${posY}px`;
|
|
758
|
-
// } else {
|
|
759
|
-
// if (posX <= scopeRect.left) {
|
|
760
|
-
// dragElement.style.left = '0px';
|
|
761
|
-
// } else if (posX + dragRect.width >= scopeRect.right) {
|
|
762
|
-
// dragElement.style.left = `${scopeRect.right - dragRect.width}px`;
|
|
763
|
-
// }
|
|
764
|
-
// if (posY <= scopeRect.top) {
|
|
765
|
-
// dragElement.style.top = '0px';
|
|
766
|
-
// } else if (posY + dragRect.height >= scopeRect.bottom) {
|
|
767
|
-
// dragElement.style.top = `${scopeRect.bottom - dragRect.height}px`;
|
|
768
|
-
// }
|
|
769
|
-
// }
|
|
770
|
-
}
|
|
771
|
-
}
|
|
772
|
-
|
|
773
|
-
const centroid = (geometry) => {
|
|
774
|
-
let featureGeometry = { lng: 0, lat: 0, }
|
|
775
|
-
let coordinates
|
|
776
|
-
if (geometry.type === "Polygon") {
|
|
777
|
-
coordinates = geometry.coordinates[0]
|
|
778
|
-
} else {
|
|
779
|
-
coordinates = geometry.coordinates
|
|
780
|
-
}
|
|
781
|
-
if (!(geometry.type === 'Point')) {
|
|
782
|
-
coordinates.map((coor) => {
|
|
783
|
-
featureGeometry.lng += parseFloat(coor[0])
|
|
784
|
-
featureGeometry.lat += parseFloat(coor[1])
|
|
785
|
-
})
|
|
786
|
-
featureGeometry.lng = featureGeometry.lng / coordinates.length
|
|
787
|
-
featureGeometry.lat = featureGeometry.lat / coordinates.length
|
|
788
|
-
} else {
|
|
789
|
-
featureGeometry.lng += parseFloat(coordinates[0])
|
|
790
|
-
featureGeometry.lat += parseFloat(coordinates[1])
|
|
791
|
-
}
|
|
792
|
-
return featureGeometry
|
|
793
|
-
}
|
|
794
538
|
|
|
795
539
|
const processFTUs = (parent, key) => {
|
|
796
540
|
const ftus = []
|
|
@@ -865,7 +609,6 @@ export default {
|
|
|
865
609
|
RadioGroup,
|
|
866
610
|
Row,
|
|
867
611
|
Select,
|
|
868
|
-
Dialog,
|
|
869
612
|
MapSvgIcon,
|
|
870
613
|
MapSvgSpriteColor,
|
|
871
614
|
Tooltip,
|
|
@@ -884,221 +627,7 @@ export default {
|
|
|
884
627
|
//resolve this issue.
|
|
885
628
|
this.setStateRequired = false
|
|
886
629
|
},
|
|
887
|
-
setup(props) {
|
|
888
|
-
const annotator = markRaw(new AnnotationService(`${props.flatmapAPI}annotator`));
|
|
889
|
-
return { annotator }
|
|
890
|
-
},
|
|
891
630
|
methods: {
|
|
892
|
-
// This should be called when create is confirmed or cancelled
|
|
893
|
-
initialiseDrawing: function () {
|
|
894
|
-
this.inDrawing = false
|
|
895
|
-
this.initialiseDialog()
|
|
896
|
-
this.activeDrawTool = undefined
|
|
897
|
-
this.createdEvent = undefined
|
|
898
|
-
},
|
|
899
|
-
cancelDrawnFeature: function () {
|
|
900
|
-
if (this.createdEvent) {
|
|
901
|
-
this.closePopup()
|
|
902
|
-
this.annotationEntry = {
|
|
903
|
-
...this.createdEvent.feature,
|
|
904
|
-
resourceId: this.serverUUID,
|
|
905
|
-
}
|
|
906
|
-
this.rollbackAnnotationEvent()
|
|
907
|
-
this.initialiseDrawing()
|
|
908
|
-
}
|
|
909
|
-
},
|
|
910
|
-
confirmDrawnFeature: function () {
|
|
911
|
-
if (this.createdEvent) {
|
|
912
|
-
this.checkAndCreatePopups(this.createdEvent)
|
|
913
|
-
// Add relevance if exist to annotationEntry
|
|
914
|
-
// Relevance will only be added in creating new drawn feature annotation
|
|
915
|
-
// And will not be updated if move drawn features
|
|
916
|
-
if (Object.keys(this.relevanceEntry).length > 0) {
|
|
917
|
-
this.annotationEntry.feature.relevance = this.relevanceEntry
|
|
918
|
-
}
|
|
919
|
-
this.initialiseDrawing()
|
|
920
|
-
}
|
|
921
|
-
},
|
|
922
|
-
initialiseDialog: function () {
|
|
923
|
-
this.relevanceDisplay = false
|
|
924
|
-
this.relevanceEntry = {}
|
|
925
|
-
},
|
|
926
|
-
relevanceDialogPopup: function () {
|
|
927
|
-
const inactive = this.$el.querySelector('.drawRelevance').classList.contains('inactive')
|
|
928
|
-
// disable click popup if icon inactive or in drawing
|
|
929
|
-
if (!inactive && !this.inDrawing) {
|
|
930
|
-
this.closePopup()
|
|
931
|
-
this.relevanceDisplay = !this.relevanceDisplay
|
|
932
|
-
}
|
|
933
|
-
},
|
|
934
|
-
drawingEvent: function (type) {
|
|
935
|
-
this.closePopup()
|
|
936
|
-
// disable mode icon click if any tool is active
|
|
937
|
-
if (this.drawnTypes.includes(type) && !this.activeDrawMode && !this.relevanceDisplay) {
|
|
938
|
-
if (type === 'Point') {
|
|
939
|
-
const point = this.$el.querySelector('.mapbox-gl-draw_point')
|
|
940
|
-
this.$el.querySelector('.mapbox-gl-draw_point').click()
|
|
941
|
-
this.activeDrawTool = point.classList.contains('active') ? 'Point' : undefined
|
|
942
|
-
} else if (type === 'LineString') {
|
|
943
|
-
const line = this.$el.querySelector('.mapbox-gl-draw_line')
|
|
944
|
-
this.$el.querySelector('.mapbox-gl-draw_line').click()
|
|
945
|
-
this.activeDrawTool = line.classList.contains('active') ? 'LineString' : undefined
|
|
946
|
-
} else if (type === 'Polygon') {
|
|
947
|
-
const polygon = this.$el.querySelector('.mapbox-gl-draw_polygon')
|
|
948
|
-
this.$el.querySelector('.mapbox-gl-draw_polygon').click()
|
|
949
|
-
this.activeDrawTool = polygon.classList.contains('active') ? 'Polygon' : undefined
|
|
950
|
-
}
|
|
951
|
-
// disable tool icon click if any mode is on
|
|
952
|
-
} else if (this.drawModes.includes(type) && !this.activeDrawTool) {
|
|
953
|
-
if (type === 'Delete') {
|
|
954
|
-
if (
|
|
955
|
-
this.currentDrawnFeature &&
|
|
956
|
-
// For either no mode is on or edit is on
|
|
957
|
-
(!this.activeDrawMode || this.activeDrawMode === 'Edit')
|
|
958
|
-
) {
|
|
959
|
-
// Force simple_select a feature for delete event
|
|
960
|
-
this.doubleClickedFeature = false
|
|
961
|
-
this.changeAnnotationDrawMode({
|
|
962
|
-
mode: 'simple_select',
|
|
963
|
-
options: { featureIds: [this.currentDrawnFeature.id] }
|
|
964
|
-
})
|
|
965
|
-
this.trashAnnotationFeature()
|
|
966
|
-
}
|
|
967
|
-
this.activeDrawMode = this.activeDrawMode === 'Delete' ? undefined : 'Delete'
|
|
968
|
-
// clear currentDrawnFeature when quit delete mode
|
|
969
|
-
if (!this.activeDrawMode) {
|
|
970
|
-
this.currentDrawnFeature = undefined
|
|
971
|
-
}
|
|
972
|
-
} else if (type === 'Edit') {
|
|
973
|
-
this.activeDrawMode = this.activeDrawMode === 'Edit' ? undefined : 'Edit'
|
|
974
|
-
}
|
|
975
|
-
}
|
|
976
|
-
},
|
|
977
|
-
changeAnnotationDrawMode: function (mode) {
|
|
978
|
-
if (this.mapImp) {
|
|
979
|
-
this.mapImp.changeAnnotationDrawMode(mode)
|
|
980
|
-
}
|
|
981
|
-
},
|
|
982
|
-
// Remove all drawn annotations from annotation layer
|
|
983
|
-
clearAnnotationFeature: function () {
|
|
984
|
-
if (
|
|
985
|
-
this.mapImp &&
|
|
986
|
-
this.drawnAnnotationFeatures &&
|
|
987
|
-
this.drawnAnnotationFeatures.length > 0
|
|
988
|
-
) {
|
|
989
|
-
this.mapImp.clearAnnotationFeature()
|
|
990
|
-
}
|
|
991
|
-
},
|
|
992
|
-
trashAnnotationFeature: function () {
|
|
993
|
-
if (this.mapImp) {
|
|
994
|
-
this.mapImp.trashAnnotationFeature()
|
|
995
|
-
}
|
|
996
|
-
},
|
|
997
|
-
rollbackAnnotationEvent: function () {
|
|
998
|
-
// For 'updated' and 'deleted' callback
|
|
999
|
-
if (
|
|
1000
|
-
this.mapImp &&
|
|
1001
|
-
this.drawnAnnotationEvent.includes(this.annotationEntry.type)
|
|
1002
|
-
) {
|
|
1003
|
-
this.mapImp.rollbackAnnotationEvent(this.annotationEntry)
|
|
1004
|
-
}
|
|
1005
|
-
},
|
|
1006
|
-
commitAnnotationEvent: function (annotation) {
|
|
1007
|
-
if (
|
|
1008
|
-
this.mapImp &&
|
|
1009
|
-
this.drawnAnnotationEvent.includes(this.annotationEntry.type) &&
|
|
1010
|
-
// Only when annotation comments stored successfully
|
|
1011
|
-
annotation
|
|
1012
|
-
) {
|
|
1013
|
-
this.annotationSubmitted = true
|
|
1014
|
-
this.mapImp.commitAnnotationEvent(this.annotationEntry)
|
|
1015
|
-
if (this.annotationEntry.type === 'deleted') {
|
|
1016
|
-
this.closePopup()
|
|
1017
|
-
} else {
|
|
1018
|
-
// Use to update 'this.drawnAnnotationFeatures' when created or updated
|
|
1019
|
-
this.addAnnotationFeature()
|
|
1020
|
-
}
|
|
1021
|
-
}
|
|
1022
|
-
},
|
|
1023
|
-
setFeatureAnnotated: function () {
|
|
1024
|
-
if (this.mapImp) {
|
|
1025
|
-
this.annotator.annotatedItemIds(this.userApiKey, this.serverUUID)
|
|
1026
|
-
.then((annotatedItemIds) => {
|
|
1027
|
-
for (const id of annotatedItemIds) {
|
|
1028
|
-
this.mapImp.setFeatureAnnotated(id)
|
|
1029
|
-
}
|
|
1030
|
-
})
|
|
1031
|
-
.catch((reason) => {
|
|
1032
|
-
console.log(reason) // Error!
|
|
1033
|
-
})
|
|
1034
|
-
}
|
|
1035
|
-
},
|
|
1036
|
-
addAnnotationFeature: function () {
|
|
1037
|
-
if (this.mapImp) {
|
|
1038
|
-
if (!this.annotationSubmitted) this.clearAnnotationFeature()
|
|
1039
|
-
if (this.drawnType !== 'None') {
|
|
1040
|
-
this.annotator.drawnFeatures(this.userApiKey, this.serverUUID)
|
|
1041
|
-
.then((drawnFeatures) => {
|
|
1042
|
-
// Use to switch the displayed feature type
|
|
1043
|
-
if (this.drawnType !== 'All tools') {
|
|
1044
|
-
drawnFeatures = drawnFeatures.filter((feature) => {
|
|
1045
|
-
return feature.geometry.type === this.drawnType
|
|
1046
|
-
})
|
|
1047
|
-
}
|
|
1048
|
-
this.drawnAnnotationFeatures = drawnFeatures
|
|
1049
|
-
// No need to call 'addAnnotationFeature' when a new feature created
|
|
1050
|
-
if (!this.annotationSubmitted) {
|
|
1051
|
-
for (const feature of drawnFeatures) {
|
|
1052
|
-
if (this.annotatedType !== 'Everyone') {
|
|
1053
|
-
this.annotator
|
|
1054
|
-
.itemAnnotations(this.userApiKey, this.serverUUID, feature.id)
|
|
1055
|
-
.then((value) => {
|
|
1056
|
-
let participated = value.filter((v) => {
|
|
1057
|
-
return (
|
|
1058
|
-
v.creator.name === this.userInformation.name &&
|
|
1059
|
-
v.creator.email === this.userInformation.email
|
|
1060
|
-
)
|
|
1061
|
-
}).length > 0
|
|
1062
|
-
if (
|
|
1063
|
-
(this.annotatedType === 'Me' && participated) ||
|
|
1064
|
-
(this.annotatedType === 'Others' && !participated)
|
|
1065
|
-
) {
|
|
1066
|
-
this.mapImp.addAnnotationFeature(feature)
|
|
1067
|
-
}
|
|
1068
|
-
})
|
|
1069
|
-
.catch((reason) => {
|
|
1070
|
-
console.log(reason) // Error!
|
|
1071
|
-
})
|
|
1072
|
-
} else this.mapImp.addAnnotationFeature(feature)
|
|
1073
|
-
}
|
|
1074
|
-
}
|
|
1075
|
-
})
|
|
1076
|
-
.catch((reason) => {
|
|
1077
|
-
console.log(reason) // Error!
|
|
1078
|
-
})
|
|
1079
|
-
}
|
|
1080
|
-
}
|
|
1081
|
-
},
|
|
1082
|
-
showAnnotator: function (flag) {
|
|
1083
|
-
if (this.mapImp) {
|
|
1084
|
-
// Control the show/hide of the drawn annotations
|
|
1085
|
-
this.mapImp.showAnnotator(flag)
|
|
1086
|
-
// Hide default toolbar, we will use customised SVG icons instead
|
|
1087
|
-
this.$el.querySelector('.maplibregl-ctrl-group').style.display = 'none'
|
|
1088
|
-
}
|
|
1089
|
-
},
|
|
1090
|
-
setDrawnType: function (flag) {
|
|
1091
|
-
this.drawnType = flag
|
|
1092
|
-
if (this.mapImp) {
|
|
1093
|
-
this.addAnnotationFeature()
|
|
1094
|
-
}
|
|
1095
|
-
},
|
|
1096
|
-
setAnnotatedType: function (flag) {
|
|
1097
|
-
this.annotatedType = flag
|
|
1098
|
-
if (this.mapImp) {
|
|
1099
|
-
this.addAnnotationFeature()
|
|
1100
|
-
}
|
|
1101
|
-
},
|
|
1102
631
|
/**
|
|
1103
632
|
* @vuese
|
|
1104
633
|
* Function to switch from 2D to 3D
|
|
@@ -1436,229 +965,67 @@ export default {
|
|
|
1436
965
|
*/
|
|
1437
966
|
eventCallback: function () {
|
|
1438
967
|
return (eventType, data, ...args) => {
|
|
1439
|
-
if (eventType
|
|
968
|
+
if (eventType !== 'pan-zoom') {
|
|
969
|
+
const label = data.label
|
|
970
|
+
const resource = [data.models]
|
|
971
|
+
const taxonomy = this.entry
|
|
972
|
+
const biologicalSex = this.biologicalSex
|
|
973
|
+
let taxons = undefined
|
|
974
|
+
if (data.taxons) {
|
|
975
|
+
// check if data.taxons is string or array
|
|
976
|
+
if (typeof data.taxons !== 'object') {
|
|
977
|
+
taxons = JSON.parse(data.taxons)
|
|
978
|
+
} else {
|
|
979
|
+
taxons = data.taxons
|
|
980
|
+
}
|
|
981
|
+
}
|
|
1440
982
|
const payload = {
|
|
983
|
+
dataset: data.dataset,
|
|
984
|
+
biologicalSex: biologicalSex,
|
|
985
|
+
taxonomy: taxonomy,
|
|
986
|
+
resource: resource,
|
|
987
|
+
label: label,
|
|
1441
988
|
feature: data,
|
|
1442
989
|
userData: args,
|
|
1443
990
|
eventType: eventType,
|
|
991
|
+
provenanceTaxonomy: taxons,
|
|
1444
992
|
}
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
if (!this.annotationSubmitted) this.rollbackAnnotationEvent()
|
|
1449
|
-
else this.annotationSubmitted = false
|
|
1450
|
-
} else if (data.type === 'modeChanged') {
|
|
1451
|
-
// 'modeChanged' event is before 'created' event
|
|
1452
|
-
if (data.feature.mode.startsWith('draw_')) {
|
|
1453
|
-
// Reset data entry for every draw
|
|
1454
|
-
this.initialiseDialog()
|
|
1455
|
-
this.inDrawing = true
|
|
1456
|
-
} else if (data.feature.mode === 'simple_select' && this.inDrawing) {
|
|
1457
|
-
if (this.createdEvent) {
|
|
1458
|
-
this.relevanceDisplay = true
|
|
1459
|
-
} else {
|
|
1460
|
-
// Reset if a invalid draw
|
|
1461
|
-
this.initialiseDrawing()
|
|
1462
|
-
}
|
|
1463
|
-
} else if (data.feature.mode === 'direct_select') {
|
|
1464
|
-
this.doubleClickedFeature = true
|
|
1465
|
-
}
|
|
1466
|
-
} else if (data.type === 'selectionChanged') {
|
|
1467
|
-
this.currentDrawnFeature =
|
|
1468
|
-
data.feature.features.length === 0 ?
|
|
1469
|
-
undefined :
|
|
1470
|
-
data.feature.features[0]
|
|
1471
|
-
payload.feature.feature = this.currentDrawnFeature
|
|
1472
|
-
if (!this.inDrawing) {
|
|
1473
|
-
this.initialiseDialog()
|
|
1474
|
-
// For exist drawn annotation features
|
|
1475
|
-
if (this.currentDrawnFeature) {
|
|
1476
|
-
this.processRelevance()
|
|
1477
|
-
this.checkAndCreateDrawnFeaturePopups(payload)
|
|
1478
|
-
}
|
|
1479
|
-
}
|
|
1480
|
-
} else {
|
|
1481
|
-
if (data.type === 'created' || data.type === 'updated') {
|
|
1482
|
-
if (data.type === 'updated' && data.feature.action) {
|
|
1483
|
-
data.positionUpdated = data.feature.action === 'move'
|
|
1484
|
-
}
|
|
1485
|
-
const feature = this.mapImp.refreshAnnotationFeatureGeometry(data.feature)
|
|
1486
|
-
payload.feature.feature = feature
|
|
1487
|
-
// NB. this might now be `null` if user has deleted it (before OK/Submit)
|
|
1488
|
-
// so maybe then no `service.addAnnotation` ??
|
|
1489
|
-
}
|
|
1490
|
-
// Once double click mouse to confirm drawing, 'aborted' event will be triggered.
|
|
1491
|
-
// Hence disable direct popup when 'created' event, dialog will be used instead.
|
|
1492
|
-
if (data.type === 'created') {
|
|
1493
|
-
this.createdEvent = payload
|
|
993
|
+
if (eventType === 'click') {
|
|
994
|
+
if (this.viewingMode === 'Network Discovery') {
|
|
995
|
+
this.highlightConnectedPaths([data.models])
|
|
1494
996
|
} else {
|
|
1495
|
-
this.
|
|
997
|
+
this.currentActive = data.models ? data.models : ''
|
|
1496
998
|
}
|
|
999
|
+
} else if (
|
|
1000
|
+
eventType === 'mouseenter' &&
|
|
1001
|
+
!(this.viewingMode === 'Network Discovery')
|
|
1002
|
+
) {
|
|
1003
|
+
this.currentHover = data.models ? data.models : ''
|
|
1497
1004
|
}
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
if (data.taxons) {
|
|
1506
|
-
// check if data.taxons is string or array
|
|
1507
|
-
if (typeof data.taxons !== 'object') {
|
|
1508
|
-
taxons = JSON.parse(data.taxons)
|
|
1509
|
-
} else {
|
|
1510
|
-
taxons = data.taxons
|
|
1511
|
-
}
|
|
1512
|
-
}
|
|
1513
|
-
const payload = {
|
|
1514
|
-
dataset: data.dataset,
|
|
1515
|
-
biologicalSex: biologicalSex,
|
|
1516
|
-
taxonomy: taxonomy,
|
|
1517
|
-
resource: resource,
|
|
1518
|
-
label: label,
|
|
1519
|
-
feature: data,
|
|
1520
|
-
userData: args,
|
|
1521
|
-
eventType: eventType,
|
|
1522
|
-
provenanceTaxonomy: taxons,
|
|
1523
|
-
}
|
|
1524
|
-
if (eventType === 'click') {
|
|
1525
|
-
if (this.viewingMode === 'Network Discovery') {
|
|
1526
|
-
this.highlightConnectedPaths([data.models])
|
|
1527
|
-
} else {
|
|
1528
|
-
this.currentActive = data.models ? data.models : ''
|
|
1529
|
-
// Stop adding features if dialog displayed
|
|
1530
|
-
if (this.inDrawing && !this.relevanceDisplay ) {
|
|
1531
|
-
this.processRelevance(payload)
|
|
1532
|
-
}
|
|
1533
|
-
}
|
|
1534
|
-
} else if (
|
|
1535
|
-
eventType === 'mouseenter' &&
|
|
1536
|
-
!(this.viewingMode === 'Network Discovery')
|
|
1537
|
-
) {
|
|
1538
|
-
this.currentHover = data.models ? data.models : ''
|
|
1539
|
-
}
|
|
1540
|
-
if (
|
|
1541
|
-
data &&
|
|
1542
|
-
data.type !== 'marker' &&
|
|
1543
|
-
eventType === 'click' &&
|
|
1544
|
-
!(this.viewingMode === 'Network Discovery') &&
|
|
1545
|
-
// Disable popup when drawing
|
|
1546
|
-
!this.inDrawing
|
|
1547
|
-
) {
|
|
1548
|
-
this.checkAndCreatePopups(payload)
|
|
1549
|
-
}
|
|
1550
|
-
this.$emit('resource-selected', payload)
|
|
1551
|
-
} else {
|
|
1552
|
-
this.$emit('pan-zoom-callback', data)
|
|
1553
|
-
}
|
|
1554
|
-
}
|
|
1555
|
-
}
|
|
1556
|
-
},
|
|
1557
|
-
// for dialog popup
|
|
1558
|
-
dialogCssHacks: function () {
|
|
1559
|
-
this.$nextTick(() => {
|
|
1560
|
-
const dialog = this.$el.querySelector('.relevance-dialog')
|
|
1561
|
-
if (this.$el && dialog) {
|
|
1562
|
-
draggable(this.$el, dialog)
|
|
1563
|
-
// dialog popup at the click position
|
|
1564
|
-
// slightly change x or y if close to boundary
|
|
1565
|
-
let posX, posY
|
|
1566
|
-
const containerRect = this.$el.getBoundingClientRect()
|
|
1567
|
-
const dialogRect = dialog.getBoundingClientRect()
|
|
1568
|
-
if (this.dialogPosition.x > containerRect.width / 2) {
|
|
1569
|
-
posX = this.dialogPosition.x - dialogRect.width
|
|
1570
|
-
} else {
|
|
1571
|
-
posX = this.dialogPosition.x
|
|
1572
|
-
}
|
|
1573
|
-
if (this.dialogPosition.y > containerRect.height / 2) {
|
|
1574
|
-
posY = this.dialogPosition.y - dialogRect.height
|
|
1575
|
-
} else {
|
|
1576
|
-
posY = this.dialogPosition.y
|
|
1577
|
-
}
|
|
1578
|
-
dialog.style.transform =
|
|
1579
|
-
`translate(${posX - this.dialogPosition.offsetX}px, ${posY - this.dialogPosition.offsetY}px)`
|
|
1580
|
-
}
|
|
1581
|
-
})
|
|
1582
|
-
},
|
|
1583
|
-
drawIconCssHacks: function () {
|
|
1584
|
-
// set tool/mode icon status
|
|
1585
|
-
if (this.$el.querySelector('.iconSelected') || !this.relevanceDisplay) {
|
|
1586
|
-
this.drawnTypes.map((t) => {
|
|
1587
|
-
const dtype = this.$el.querySelector(`.draw${t}`)
|
|
1588
|
-
if (dtype) {
|
|
1589
|
-
dtype.classList.remove('iconSelected');
|
|
1590
|
-
dtype.classList.remove('inactive');
|
|
1591
|
-
}
|
|
1592
|
-
})
|
|
1593
|
-
this.drawModes.map((m) => {
|
|
1594
|
-
this.$el.querySelector(`.draw${m}`).classList.remove('iconSelected');
|
|
1595
|
-
this.$el.querySelector(`.draw${m}`).classList.remove('inactive');
|
|
1596
|
-
})
|
|
1597
|
-
}
|
|
1598
|
-
if (this.activeDrawTool) {
|
|
1599
|
-
this.$el.querySelector(`.draw${this.activeDrawTool}`).classList.add('iconSelected');
|
|
1600
|
-
this.drawModes.map((m) => {
|
|
1601
|
-
this.$el.querySelector(`.draw${m}`).classList.add('inactive');
|
|
1602
|
-
})
|
|
1603
|
-
} else if (this.activeDrawMode || this.relevanceDisplay) {
|
|
1604
|
-
if (this.activeDrawMode) {
|
|
1605
|
-
this.$el.querySelector(`.draw${this.activeDrawMode}`).classList.add('iconSelected');
|
|
1606
|
-
}
|
|
1607
|
-
this.drawnTypes.map((t) => {
|
|
1608
|
-
const dtype = this.$el.querySelector(`.draw${t}`)
|
|
1609
|
-
if (dtype) dtype.classList.add('inactive');
|
|
1610
|
-
})
|
|
1611
|
-
}
|
|
1612
|
-
},
|
|
1613
|
-
processRelevance: function (data = undefined) {
|
|
1614
|
-
// process while drawing new features
|
|
1615
|
-
if (data && data.feature) {
|
|
1616
|
-
// Only clicked relevance data will be added
|
|
1617
|
-
let relevant = data.feature.models ? data.feature.models : data.feature.featureId
|
|
1618
|
-
// only the linestring will have relevance at the current stage
|
|
1619
|
-
if (relevant && this.activeDrawTool === 'LineString') {
|
|
1620
|
-
this.relevanceEntry[relevant] = data
|
|
1621
|
-
}
|
|
1622
|
-
} else {
|
|
1623
|
-
// process while checking exist features
|
|
1624
|
-
if (this.currentDrawnFeature && this.drawnAnnotationFeatures) {
|
|
1625
|
-
let feature = this.drawnAnnotationFeatures
|
|
1626
|
-
.filter((feature) => {
|
|
1627
|
-
return feature.id === this.currentDrawnFeature.id
|
|
1628
|
-
})[0]
|
|
1629
|
-
if (feature && feature.relevance) {
|
|
1630
|
-
this.relevanceEntry = feature.relevance
|
|
1631
|
-
}
|
|
1632
|
-
}
|
|
1633
|
-
}
|
|
1634
|
-
},
|
|
1635
|
-
// This is used only when either edit or delete mode is on
|
|
1636
|
-
checkAndCreateDrawnFeaturePopups: function (data) {
|
|
1637
|
-
if (this.activeDrawMode) {
|
|
1638
|
-
// double click fires 'updated' callback
|
|
1639
|
-
if (this.doubleClickedFeature) {
|
|
1640
|
-
if (data.feature.feature.geometry.type !== 'Point') {
|
|
1641
|
-
// show tooltip and enter edit mode
|
|
1642
|
-
this.changeAnnotationDrawMode({
|
|
1643
|
-
mode: 'direct_select',
|
|
1644
|
-
options: { featureId: data.feature.feature.id }
|
|
1645
|
-
})
|
|
1646
|
-
this.trashAnnotationFeature()
|
|
1005
|
+
if (
|
|
1006
|
+
data &&
|
|
1007
|
+
data.type !== 'marker' &&
|
|
1008
|
+
eventType === 'click' &&
|
|
1009
|
+
!(this.viewingMode === 'Network Discovery')
|
|
1010
|
+
) {
|
|
1011
|
+
this.checkAndCreatePopups(payload)
|
|
1647
1012
|
}
|
|
1648
|
-
|
|
1013
|
+
/**
|
|
1014
|
+
* The event emitted from the mouse event callbacks that come from flatmap-viewer. The payload
|
|
1015
|
+
* argument provides an object with information on the feature where the mouse event takes place.
|
|
1016
|
+
* @arg payload
|
|
1017
|
+
*/
|
|
1018
|
+
this.$emit('resource-selected', payload)
|
|
1649
1019
|
} else {
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
this.trashAnnotationFeature()
|
|
1657
|
-
}
|
|
1020
|
+
/**
|
|
1021
|
+
* The event emitted in ``callback`` function from ``MapManager.loadMap()``
|
|
1022
|
+
* if ``eventType`` is ``pan-zoom``.
|
|
1023
|
+
* @arg data
|
|
1024
|
+
*/
|
|
1025
|
+
this.$emit('pan-zoom-callback', data)
|
|
1658
1026
|
}
|
|
1659
1027
|
}
|
|
1660
1028
|
},
|
|
1661
|
-
// checkNeuronClicked shows a neuron path pop up if a path was recently clicked
|
|
1662
1029
|
/**
|
|
1663
1030
|
* @vuese
|
|
1664
1031
|
* Function to create/display tooltips from the provided ``data``.
|
|
@@ -1668,32 +1035,12 @@ export default {
|
|
|
1668
1035
|
checkAndCreatePopups: async function (data) {
|
|
1669
1036
|
// Call flatmap database to get the connection data
|
|
1670
1037
|
if (this.viewingMode === 'Annotation') {
|
|
1671
|
-
if (data.feature) {
|
|
1038
|
+
if (data.feature && data.feature.featureId && data.feature.models) {
|
|
1672
1039
|
this.annotationEntry = {
|
|
1673
1040
|
...data.feature,
|
|
1674
1041
|
resourceId: this.serverUUID,
|
|
1675
1042
|
}
|
|
1676
|
-
|
|
1677
|
-
this.displayTooltip(data.feature.models)
|
|
1678
|
-
} else if (data.feature.feature) {
|
|
1679
|
-
if (this.inDrawing || this.activeDrawMode) {
|
|
1680
|
-
this.annotationSubmitted = false
|
|
1681
|
-
this.annotationEntry.featureId = data.feature.feature.id
|
|
1682
|
-
this.displayTooltip(
|
|
1683
|
-
data.feature.feature.id,
|
|
1684
|
-
centroid(data.feature.feature.geometry)
|
|
1685
|
-
)
|
|
1686
|
-
} else {
|
|
1687
|
-
// Not allowed to update feature if not on edit mode
|
|
1688
|
-
if (data.feature.type === 'updated') {
|
|
1689
|
-
this.rollbackAnnotationEvent()
|
|
1690
|
-
}
|
|
1691
|
-
}
|
|
1692
|
-
// Hide dialog when updated or deleted event is fired and tooltip is displayed
|
|
1693
|
-
if (data.feature.type === 'updated' || data.feature.type === 'deleted') {
|
|
1694
|
-
this.initialiseDialog()
|
|
1695
|
-
}
|
|
1696
|
-
}
|
|
1043
|
+
this.displayTooltip(data.feature.models)
|
|
1697
1044
|
} else {
|
|
1698
1045
|
this.annotation = {}
|
|
1699
1046
|
}
|
|
@@ -1724,13 +1071,9 @@ export default {
|
|
|
1724
1071
|
'block'
|
|
1725
1072
|
this.$refs.tooltip.$el.style.display = 'flex'
|
|
1726
1073
|
document.querySelector('.maplibregl-popup-close-button').onclick = () => {
|
|
1727
|
-
|
|
1074
|
+
document.querySelector('.flatmap-tooltip-popup').style.display = 'block'
|
|
1728
1075
|
}
|
|
1729
1076
|
},
|
|
1730
|
-
closePopup: function () {
|
|
1731
|
-
let cbutton = document.querySelector('.maplibregl-popup-close-button')
|
|
1732
|
-
if (cbutton) cbutton.click()
|
|
1733
|
-
},
|
|
1734
1077
|
/**
|
|
1735
1078
|
* @vuese
|
|
1736
1079
|
* Function to close tooltip.
|
|
@@ -1871,26 +1214,28 @@ export default {
|
|
|
1871
1214
|
* by providing featureId (``feature``).
|
|
1872
1215
|
* @arg feature
|
|
1873
1216
|
*/
|
|
1874
|
-
displayTooltip: function (feature
|
|
1217
|
+
displayTooltip: function (feature) {
|
|
1875
1218
|
this.tooltipDisplay = true
|
|
1876
|
-
let featureId = undefined
|
|
1877
|
-
let options = { className: 'flatmapvuer-popover' }
|
|
1878
|
-
if (geometry) {
|
|
1879
|
-
featureId = feature
|
|
1880
|
-
options.annotationFeatureGeometry = geometry
|
|
1881
|
-
} else {
|
|
1882
|
-
featureId = this.mapImp.modelFeatureIds(feature)[0]
|
|
1883
|
-
if (!this.inDrawing) {
|
|
1884
|
-
options.positionAtLastClick = true
|
|
1885
|
-
}
|
|
1886
|
-
}
|
|
1887
1219
|
if (!this.disableUI) {
|
|
1888
1220
|
this.$nextTick(() => {
|
|
1889
|
-
this.
|
|
1890
|
-
|
|
1891
|
-
})
|
|
1221
|
+
this.displayPopup(feature)
|
|
1222
|
+
});
|
|
1892
1223
|
}
|
|
1893
1224
|
},
|
|
1225
|
+
/**
|
|
1226
|
+
* @vuese
|
|
1227
|
+
* Function to display popup
|
|
1228
|
+
* by providing featureId (``feature``).
|
|
1229
|
+
* @arg feature
|
|
1230
|
+
*/
|
|
1231
|
+
displayPopup: function (feature) {
|
|
1232
|
+
this.mapImp.showPopup(
|
|
1233
|
+
this.mapImp.modelFeatureIds(feature)[0],
|
|
1234
|
+
this.$refs.tooltip.$el,
|
|
1235
|
+
{ className: 'flatmapvuer-popover', positionAtLastClick: true }
|
|
1236
|
+
)
|
|
1237
|
+
this.popUpCssHacks()
|
|
1238
|
+
},
|
|
1894
1239
|
/**
|
|
1895
1240
|
* @vuese
|
|
1896
1241
|
* Function to open Flatmap Help Popup.
|
|
@@ -2394,8 +1739,7 @@ export default {
|
|
|
2394
1739
|
return {
|
|
2395
1740
|
flatmapAPI: this.flatmapAPI,
|
|
2396
1741
|
sparcAPI: this.sparcAPI,
|
|
2397
|
-
userApiKey: this.userApiKey
|
|
2398
|
-
$annotator: this.annotator
|
|
1742
|
+
userApiKey: this.userApiKey
|
|
2399
1743
|
}
|
|
2400
1744
|
},
|
|
2401
1745
|
data: function () {
|
|
@@ -2404,7 +1748,7 @@ export default {
|
|
|
2404
1748
|
//tooltip display has to be set to false until it is rendered
|
|
2405
1749
|
//for the first time, otherwise it may display an arrow at a
|
|
2406
1750
|
//undesired location.
|
|
2407
|
-
tooltipDisplay:
|
|
1751
|
+
tooltipDisplay: false,
|
|
2408
1752
|
serverUUID: undefined,
|
|
2409
1753
|
layers: [],
|
|
2410
1754
|
pathways: [],
|
|
@@ -2435,12 +1779,6 @@ export default {
|
|
|
2435
1779
|
{ value: false },
|
|
2436
1780
|
{ value: false },
|
|
2437
1781
|
{ value: false },
|
|
2438
|
-
{ value: false },
|
|
2439
|
-
{ value: false },
|
|
2440
|
-
{ value: false },
|
|
2441
|
-
{ value: false },
|
|
2442
|
-
{ value: false },
|
|
2443
|
-
{ value: false },
|
|
2444
1782
|
],
|
|
2445
1783
|
yellowstar: yellowstar,
|
|
2446
1784
|
isFC: false,
|
|
@@ -2452,6 +1790,7 @@ export default {
|
|
|
2452
1790
|
tooltipEntry: createUnfilledTooltipData(),
|
|
2453
1791
|
connectivityTooltipVisible: false,
|
|
2454
1792
|
drawerOpen: false,
|
|
1793
|
+
annotationRadio: false,
|
|
2455
1794
|
flightPath3DRadio: false,
|
|
2456
1795
|
displayFlightPathOption: false,
|
|
2457
1796
|
colourRadio: true,
|
|
@@ -2459,40 +1798,11 @@ export default {
|
|
|
2459
1798
|
minimapResizeShow: false,
|
|
2460
1799
|
minimapSmall: false,
|
|
2461
1800
|
currentActive: '',
|
|
2462
|
-
currentDrawnFeature: undefined, // Clicked drawn annotation
|
|
2463
1801
|
currentHover: '',
|
|
2464
1802
|
viewingMode: 'Exploration',
|
|
2465
1803
|
viewingModes: ['Annotation', 'Exploration', 'Network Discovery'],
|
|
2466
|
-
drawnType: 'All tools',
|
|
2467
|
-
drawnTypes: ['All tools', 'Point', 'LineString', 'Polygon', 'None'],
|
|
2468
|
-
annotatedType: 'Everyone',
|
|
2469
|
-
annotatedTypes: ['Everyone', 'Me', 'Others'],
|
|
2470
1804
|
openMapRef: undefined,
|
|
2471
1805
|
backgroundIconRef: undefined,
|
|
2472
|
-
annotator: undefined,
|
|
2473
|
-
userInformation: undefined,
|
|
2474
|
-
activeDrawTool: undefined,
|
|
2475
|
-
drawnAnnotationEvent: ['created', 'updated', 'deleted'],
|
|
2476
|
-
createdEvent: undefined,
|
|
2477
|
-
annotationSubmitted: false,
|
|
2478
|
-
inDrawing: false,
|
|
2479
|
-
relevanceDisplay: false,
|
|
2480
|
-
relevanceEntry: {},
|
|
2481
|
-
drawnAnnotationFeatures: undefined, // Store all exist drawn features
|
|
2482
|
-
doubleClickedFeature: false,
|
|
2483
|
-
activeDrawMode: undefined,
|
|
2484
|
-
drawModes: ['Delete', 'Edit'],
|
|
2485
|
-
dialogPosition: {
|
|
2486
|
-
offsetX: 0,
|
|
2487
|
-
offsetY: 0,
|
|
2488
|
-
x: undefined,
|
|
2489
|
-
y: undefined
|
|
2490
|
-
}
|
|
2491
|
-
}
|
|
2492
|
-
},
|
|
2493
|
-
computed: {
|
|
2494
|
-
relevance: function () {
|
|
2495
|
-
return Object.keys(this.relevanceEntry).length > 0
|
|
2496
1806
|
}
|
|
2497
1807
|
},
|
|
2498
1808
|
watch: {
|
|
@@ -2518,80 +1828,11 @@ export default {
|
|
|
2518
1828
|
immediate: true,
|
|
2519
1829
|
deep: true,
|
|
2520
1830
|
},
|
|
2521
|
-
activeDrawTool: function () {
|
|
2522
|
-
this.drawIconCssHacks()
|
|
2523
|
-
},
|
|
2524
|
-
activeDrawMode: function () {
|
|
2525
|
-
this.drawIconCssHacks()
|
|
2526
|
-
},
|
|
2527
|
-
/**
|
|
2528
|
-
* hide dialog when relevanceEntry is empty
|
|
2529
|
-
*/
|
|
2530
|
-
relevance: function (value) {
|
|
2531
|
-
const relevanceIcon = this.$el.querySelector('.drawRelevance')
|
|
2532
|
-
if (!value) {
|
|
2533
|
-
this.relevanceDisplay = false
|
|
2534
|
-
relevanceIcon.classList.add('inactive')
|
|
2535
|
-
} else {
|
|
2536
|
-
relevanceIcon.classList.remove('inactive')
|
|
2537
|
-
}
|
|
2538
|
-
},
|
|
2539
|
-
/**
|
|
2540
|
-
* popup dialog via click icon
|
|
2541
|
-
*/
|
|
2542
|
-
relevanceDisplay: function (display) {
|
|
2543
|
-
const relevanceIcon = this.$el.querySelector('.drawRelevance')
|
|
2544
|
-
if (display) {
|
|
2545
|
-
relevanceIcon.classList.add('iconSelected')
|
|
2546
|
-
this.dialogCssHacks()
|
|
2547
|
-
} else {
|
|
2548
|
-
relevanceIcon.classList.remove('iconSelected')
|
|
2549
|
-
}
|
|
2550
|
-
this.drawIconCssHacks()
|
|
2551
|
-
},
|
|
2552
|
-
/**
|
|
2553
|
-
* Set dialog offset when flatmap annotator used
|
|
2554
|
-
*/
|
|
2555
|
-
dialogPosition: {
|
|
2556
|
-
handler: function () {
|
|
2557
|
-
if (this.$el) {
|
|
2558
|
-
const containerRect = this.$el.getBoundingClientRect()
|
|
2559
|
-
this.dialogPosition.offsetX = containerRect.x
|
|
2560
|
-
this.dialogPosition.offsetY = containerRect.y
|
|
2561
|
-
}
|
|
2562
|
-
},
|
|
2563
|
-
deep: true,
|
|
2564
|
-
once: true,
|
|
2565
|
-
},
|
|
2566
|
-
viewingMode: function (mode) {
|
|
2567
|
-
if (mode === 'Annotation') {
|
|
2568
|
-
console.log(this.userApiKey)
|
|
2569
|
-
this.$el.querySelector('.maplibregl-canvas').addEventListener('click', (e) => {
|
|
2570
|
-
e.preventDefault();
|
|
2571
|
-
this.dialogPosition.x = e.clientX
|
|
2572
|
-
this.dialogPosition.y = e.clientY
|
|
2573
|
-
// use to fix the draw point pop up position issue
|
|
2574
|
-
if (this.activeDrawTool === 'Point') {
|
|
2575
|
-
this.dialogCssHacks()
|
|
2576
|
-
}
|
|
2577
|
-
}, false)
|
|
2578
|
-
this.showAnnotator(true)
|
|
2579
|
-
this.annotator.authenticate(this.userApiKey).then((userData) => {
|
|
2580
|
-
if (userData.name && userData.email) {
|
|
2581
|
-
this.userInformation = userData
|
|
2582
|
-
this.setFeatureAnnotated()
|
|
2583
|
-
if (!this.drawnAnnotationFeatures) {
|
|
2584
|
-
this.addAnnotationFeature()
|
|
2585
|
-
}
|
|
2586
|
-
}
|
|
2587
|
-
})
|
|
2588
|
-
} else this.showAnnotator(false)
|
|
2589
|
-
},
|
|
2590
1831
|
disableUI: function (isUIDisabled) {
|
|
2591
1832
|
if (isUIDisabled) {
|
|
2592
1833
|
this.closeTooltip()
|
|
2593
1834
|
}
|
|
2594
|
-
}
|
|
1835
|
+
}
|
|
2595
1836
|
},
|
|
2596
1837
|
created: function () {
|
|
2597
1838
|
|
|
@@ -2747,7 +1988,6 @@ export default {
|
|
|
2747
1988
|
}
|
|
2748
1989
|
|
|
2749
1990
|
:deep(.maplibregl-popup) {
|
|
2750
|
-
z-index: 10;
|
|
2751
1991
|
max-width: 300px !important;
|
|
2752
1992
|
}
|
|
2753
1993
|
|
|
@@ -2862,19 +2102,12 @@ export default {
|
|
|
2862
2102
|
}
|
|
2863
2103
|
}
|
|
2864
2104
|
|
|
2865
|
-
.
|
|
2866
|
-
|
|
2867
|
-
.zoomIn, .zoomOut, .fitWindow {
|
|
2868
|
-
padding: 4px;
|
|
2105
|
+
.zoomOut {
|
|
2106
|
+
padding-left: 8px;
|
|
2869
2107
|
}
|
|
2870
2108
|
|
|
2871
|
-
.
|
|
2872
|
-
|
|
2873
|
-
}
|
|
2874
|
-
|
|
2875
|
-
.inactive {
|
|
2876
|
-
color: #DDDDDD !important;
|
|
2877
|
-
cursor: not-allowed !important;
|
|
2109
|
+
.fitWindow {
|
|
2110
|
+
padding-left: 8px;
|
|
2878
2111
|
}
|
|
2879
2112
|
|
|
2880
2113
|
.yellow-star-legend {
|
|
@@ -2899,7 +2132,7 @@ export default {
|
|
|
2899
2132
|
background-color: #ffffff;
|
|
2900
2133
|
border: 1px solid $app-primary-color;
|
|
2901
2134
|
box-shadow: 0px 2px 12px 0px rgba(0, 0, 0, 0.06);
|
|
2902
|
-
height:
|
|
2135
|
+
height: 290px;
|
|
2903
2136
|
min-width: 200px;
|
|
2904
2137
|
.el-popper__arrow {
|
|
2905
2138
|
&:before {
|
|
@@ -3082,19 +2315,19 @@ export default {
|
|
|
3082
2315
|
}
|
|
3083
2316
|
}
|
|
3084
2317
|
|
|
3085
|
-
:deep(.
|
|
3086
|
-
padding:
|
|
2318
|
+
:deep(.popper-zoomout) {
|
|
2319
|
+
padding-right: 13px !important;
|
|
2320
|
+
left: -21px !important;
|
|
3087
2321
|
}
|
|
3088
2322
|
|
|
3089
|
-
.
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
bottom: 16px;
|
|
2323
|
+
:deep(.popper-zoomout) {
|
|
2324
|
+
.popper__arrow {
|
|
2325
|
+
left: 53px !important;
|
|
2326
|
+
}
|
|
2327
|
+
}
|
|
2328
|
+
|
|
2329
|
+
:deep(.maplibregl-popup-content) {
|
|
2330
|
+
padding: 0px;
|
|
3098
2331
|
}
|
|
3099
2332
|
|
|
3100
2333
|
.bottom-right-control {
|
|
@@ -3286,21 +2519,12 @@ export default {
|
|
|
3286
2519
|
}
|
|
3287
2520
|
}
|
|
3288
2521
|
}
|
|
3289
|
-
|
|
3290
|
-
.relevance-dialog {
|
|
3291
|
-
position: absolute;
|
|
3292
|
-
z-index: 10;
|
|
3293
|
-
cursor: move;
|
|
3294
|
-
}
|
|
3295
2522
|
</style>
|
|
3296
2523
|
|
|
3297
2524
|
<style lang="scss">
|
|
3298
2525
|
|
|
3299
2526
|
.flatmap-container {
|
|
3300
2527
|
--el-color-primary: #8300BF;
|
|
3301
|
-
--el-color-primary-light-5: #CD99E5;
|
|
3302
|
-
--el-color-primary-light-9: #F3E6F9;
|
|
3303
|
-
--el-color-primary-dark-2: var(--el-color-primary);
|
|
3304
2528
|
}
|
|
3305
2529
|
|
|
3306
2530
|
</style>
|