@abi-software/scaffoldvuer 1.8.1-beta.2 → 1.8.1-beta.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abi-software/scaffoldvuer",
3
- "version": "1.8.1-beta.2",
3
+ "version": "1.8.1-beta.4",
4
4
  "license": "Apache-2.0",
5
5
  "repository": {
6
6
  "type": "git",
@@ -26,6 +26,7 @@
26
26
  ref="annotationTooltip"
27
27
  :annotationDisplay="true"
28
28
  :annotationEntry="annotationEntry"
29
+ @annotation="$emit('confirm-comment', $event)"
29
30
  />
30
31
  <div v-if="createData.toBeDeleted" class="delete-container">
31
32
  <el-row>
@@ -104,6 +105,14 @@ export default {
104
105
  type: Boolean,
105
106
  default: false,
106
107
  },
108
+ annotationFeature: {
109
+ type: Object,
110
+ default: {},
111
+ },
112
+ offlineAnnotationEnabled: {
113
+ type: Boolean,
114
+ default: false,
115
+ },
107
116
  region: {
108
117
  type: String,
109
118
  default: "",
@@ -155,6 +164,8 @@ export default {
155
164
  "featureId": region + this.label,
156
165
  "resourceId": this.scaffoldUrl,
157
166
  "resource": this.scaffoldUrl,
167
+ "feature": this.annotationFeature,
168
+ "offline": this.offlineAnnotationEnabled,
158
169
  };
159
170
  }
160
171
  }
@@ -15,8 +15,11 @@
15
15
  :x="tData.x"
16
16
  :y="tData.y"
17
17
  :annotationDisplay="annotationDisplay"
18
+ :annotationFeature="annotationFeature"
19
+ :offlineAnnotationEnabled="offlineAnnotationEnabled"
18
20
  @confirm-create="confirmCreate($event)"
19
21
  @cancel-create="cancelCreate()"
22
+ @confirm-comment="confirmComment($event)"
20
23
  @confirm-delete="confirmDelete()"
21
24
  @tooltip-hide="onTooltipHide()"
22
25
  />
@@ -399,8 +402,10 @@ import { MapSvgIcon, MapSvgSpriteColor } from "@abi-software/svg-sprite";
399
402
  import { DrawToolbar } from '@abi-software/map-utilities'
400
403
  import '@abi-software/map-utilities/dist/style.css'
401
404
  import {
405
+ createNewAnnotationsWithFeatures,
402
406
  addUserAnnotationWithFeature,
403
407
  annotationFeaturesToPrimitives,
408
+ getClickedObjects,
404
409
  getDeletableObjects,
405
410
  getDrawnAnnotations,
406
411
  getEditableLines,
@@ -805,6 +810,7 @@ export default {
805
810
  },
806
811
  openMapRef: undefined,
807
812
  backgroundIconRef: undefined,
813
+ annotationFeature: {},
808
814
  offlineAnnotationEnabled: false,
809
815
  offlineAnnotations: markRaw([]),
810
816
  authorisedUser: undefined,
@@ -1020,15 +1026,11 @@ export default {
1020
1026
  zincObjectRemoved: function (zincObject) {
1021
1027
  if (this.$module.scene) {
1022
1028
  // zincObjectAdded will be alled in sequential callback
1023
- const regionPath = zincObject.region.getFullPath();
1024
1029
  const groupName = zincObject.groupName;
1025
1030
  const objects = zincObject.region.findObjectsWithGroupName(groupName, false);
1026
1031
  //Remove relevant objects from the rest of the app.
1027
1032
  if (objects.length === 0) {
1028
1033
  this.$_searchIndex.removeZincObject(zincObject, zincObject.uuid);
1029
- if (this.offlineAnnotationEnabled) {
1030
- this.removeFromOfflineAnnotation(regionPath, groupName);
1031
- }
1032
1034
  }
1033
1035
  }
1034
1036
  },
@@ -1119,8 +1121,6 @@ export default {
1119
1121
  }
1120
1122
  annotation.region = regionPath;
1121
1123
  this.offlineAnnotations = JSON.parse(sessionStorage.getItem('offline-annotation')) || [];
1122
- //Remove previous entry if there is matching region and group
1123
- this.removeFromOfflineAnnotation(regionPath, group);
1124
1124
  this.offlineAnnotations.push(annotation);
1125
1125
  sessionStorage.setItem('offline-annotation', JSON.stringify(this.offlineAnnotations));
1126
1126
  }
@@ -1205,6 +1205,27 @@ export default {
1205
1205
  this.$emit("annotation-close");
1206
1206
  }
1207
1207
  },
1208
+ /**
1209
+ * Internal only.
1210
+ * Confirm delete of user created primitive.
1211
+ * This is only called from callback.
1212
+ */
1213
+ confirmComment: function (payload) {
1214
+ if (this._editingZincObject) {
1215
+ let annotation = payload
1216
+ if (this._editingZincObject.isEditable) {
1217
+ this.existDrawnFeatures = markRaw(this.existDrawnFeatures.filter(feature => feature.id !== annotation.item.id));
1218
+ this.existDrawnFeatures.push(payload.feature);
1219
+ }
1220
+ if (this.offlineAnnotationEnabled) {
1221
+ annotation.group = this._editingZincObject.groupName;;
1222
+ annotation.region = this._editingZincObject.region.getFullPath();
1223
+ this.offlineAnnotations = JSON.parse(sessionStorage.getItem('offline-annotation')) || [];
1224
+ this.offlineAnnotations.push(annotation);
1225
+ sessionStorage.setItem('offline-annotation', JSON.stringify(this.offlineAnnotations));
1226
+ }
1227
+ }
1228
+ },
1208
1229
  /**
1209
1230
  * Internal only.
1210
1231
  * Confirm delete of user created primitive.
@@ -1221,6 +1242,8 @@ export default {
1221
1242
  const childRegion = this.$module.scene.getRootRegion().findChildFromPath(regionPath);
1222
1243
  childRegion.removeZincObject(this._editingZincObject);
1223
1244
  if (this.offlineAnnotationEnabled) {
1245
+ this.offlineAnnotations = JSON.parse(sessionStorage.getItem('offline-annotation')) || [];
1246
+ this.offlineAnnotations = this.offlineAnnotations.filter(offline => offline.item.id !== annotation.item.id);
1224
1247
  sessionStorage.setItem('offline-annotation', JSON.stringify(this.offlineAnnotations));
1225
1248
  }
1226
1249
  }
@@ -1562,6 +1585,14 @@ export default {
1562
1585
  if (this.viewingMode === 'Annotation') {
1563
1586
  this.tData.label = id;
1564
1587
  this.tData.region = regionPath;
1588
+ const zincObject = getClickedObjects(event);
1589
+ this._editingZincObject = zincObject;
1590
+ if (zincObject) {
1591
+ const regionPath = this._editingZincObject.region.getFullPath() + "/";
1592
+ const group = this._editingZincObject.groupName;
1593
+ this.annotationFeature = createNewAnnotationsWithFeatures(this._editingZincObject,
1594
+ regionPath, group, this.url, '').feature;
1595
+ }
1565
1596
  this.activateAnnotationMode(names, event);
1566
1597
  } else {
1567
1598
  if (this.$refs.scaffoldTreeControls) {
@@ -1955,6 +1986,8 @@ export default {
1955
1986
  "featureId": region + this.tData.label,
1956
1987
  "resourceId": this.url,
1957
1988
  "resource": this.url,
1989
+ "feature": this.annotationFeature,
1990
+ "offline": this.offlineAnnotationEnabled,
1958
1991
  };
1959
1992
  this.$emit('annotation-open', {
1960
1993
  annotationEntry: annotationEntry,
@@ -1962,6 +1995,7 @@ export default {
1962
1995
  confirmCreate: this.confirmCreate,
1963
1996
  cancelCreate: this.cancelCreate,
1964
1997
  confirmDelete: this.confirmDelete,
1998
+ confirmComment: this.confirmComment
1965
1999
  });
1966
2000
  return;
1967
2001
  }
@@ -1990,7 +2024,9 @@ export default {
1990
2024
  let drawnFeatures;
1991
2025
  if (this.offlineAnnotationEnabled) {
1992
2026
  this.offlineAnnotations = JSON.parse(sessionStorage.getItem('offline-annotation')) || [];
1993
- drawnFeatures = this.offlineAnnotations.filter((offline) => offline.resource === this.url).map(offline => offline.feature);
2027
+ drawnFeatures = this.offlineAnnotations.filter((offline) => {
2028
+ return offline.resource === this.url && offline.feature.properties.drawn;
2029
+ }).map(offline => offline.feature);
1994
2030
  } else {
1995
2031
  drawnFeatures = [];
1996
2032
  const drawn = await getDrawnAnnotations(this.annotator, this.userToken, this.url);
@@ -7,7 +7,6 @@ export {}
7
7
 
8
8
  declare module 'vue' {
9
9
  export interface GlobalComponents {
10
- ElAutocomplete: typeof import('element-plus/es')['ElAutocomplete']
11
10
  ElButton: typeof import('element-plus/es')['ElButton']
12
11
  ElCol: typeof import('element-plus/es')['ElCol']
13
12
  ElCollapse: typeof import('element-plus/es')['ElCollapse']
@@ -20,7 +19,6 @@ declare module 'vue' {
20
19
  ElIconDelete: typeof import('@element-plus/icons-vue')['Delete']
21
20
  ElIconPlus: typeof import('@element-plus/icons-vue')['Plus']
22
21
  ElIconWarningFilled: typeof import('@element-plus/icons-vue')['WarningFilled']
23
- ElInput: typeof import('element-plus/es')['ElInput']
24
22
  ElInputNumber: typeof import('element-plus/es')['ElInputNumber']
25
23
  ElMain: typeof import('element-plus/es')['ElMain']
26
24
  ElOption: typeof import('element-plus/es')['ElOption']
@@ -28,9 +26,6 @@ declare module 'vue' {
28
26
  ElRow: typeof import('element-plus/es')['ElRow']
29
27
  ElSelect: typeof import('element-plus/es')['ElSelect']
30
28
  ElSlider: typeof import('element-plus/es')['ElSlider']
31
- ElSwitch: typeof import('element-plus/es')['ElSwitch']
32
- ElTable: typeof import('element-plus/es')['ElTable']
33
- ElTableColumn: typeof import('element-plus/es')['ElTableColumn']
34
29
  ElTabPane: typeof import('element-plus/es')['ElTabPane']
35
30
  ElTabs: typeof import('element-plus/es')['ElTabs']
36
31
  LinesControls: typeof import('./components/LinesControls.vue')['default']
@@ -47,6 +47,15 @@ export const getEditableLines = (event) => {
47
47
  return undefined;
48
48
  }
49
49
 
50
+ export const getClickedObjects = (event) => {
51
+ const zincObjects = event.zincObjects;
52
+ if (zincObjects.length > 0 && zincObjects[0]) {
53
+ const zincObject = zincObjects[0];
54
+ return zincObject;
55
+ }
56
+ return undefined;
57
+ }
58
+
50
59
  export const getDeletableObjects = (event) => {
51
60
  const zincObjects = event.zincObjects;
52
61
  if (zincObjects.length > 0 && zincObjects[0]) {
@@ -289,13 +298,17 @@ const getCoordinatesForAnnotationFeature = (zincObject) => {
289
298
  return coords;
290
299
  }
291
300
 
292
- const createNewAnnotationsWithFeatures = (zincObject, region, group, scaffoldUrl, comment) => {
301
+ export const createNewAnnotationsWithFeatures = (zincObject, region, group, scaffoldUrl, comment) => {
293
302
  let type = undefined;
294
303
  if (zincObject.isPointset) {
295
304
  type = "MultiPoint";
296
305
  } else if (zincObject.isLines2) {
297
306
  type = "MultiLineString";
307
+ } else {
308
+ type = "Feature";
298
309
  }
310
+ const drawn = type === "Feature" ? false : true;
311
+ const label = type === "Feature" ? "Feature annotation" : "Drawn annotation";
299
312
  if (type) {
300
313
  const coords = getCoordinatesForAnnotationFeature(zincObject);
301
314
  //Check if region ends with a slash
@@ -314,8 +327,8 @@ const createNewAnnotationsWithFeatures = (zincObject, region, group, scaffoldUrl
314
327
  feature: {
315
328
  "id": featureID,
316
329
  "properties": {
317
- "drawn": true,
318
- "label": "Drawn annotation"
330
+ "drawn": drawn,
331
+ "label": label
319
332
  },
320
333
  "geometry": {
321
334
  "coordinates": coords,