@abi-software/scaffoldvuer 1.8.1-isan.0 → 1.9.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/scaffoldvuer.js +8052 -7985
- package/dist/scaffoldvuer.umd.cjs +162 -165
- package/dist/style.css +1 -1
- package/package.json +3 -3
- package/src/App.vue +37 -0
- package/src/components/ScaffoldTooltip.vue +15 -4
- package/src/components/ScaffoldVuer.vue +66 -18
- package/src/scripts/Utilities.js +16 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abi-software/scaffoldvuer",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.9.0-beta.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"*.js"
|
|
42
42
|
],
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@abi-software/map-utilities": "^1.
|
|
44
|
+
"@abi-software/map-utilities": "^1.5.0-beta.0",
|
|
45
45
|
"@abi-software/sparc-annotation": "^0.3.2",
|
|
46
46
|
"@abi-software/svg-sprite": "^1.0.1",
|
|
47
47
|
"@element-plus/icons-vue": "^2.3.1",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"vue": "^3.4.21",
|
|
55
55
|
"vue-router": "^4.2.5",
|
|
56
56
|
"vue3-component-svg-sprite": "^0.0.1",
|
|
57
|
-
"zincjs": "^1.
|
|
57
|
+
"zincjs": "^1.13.0"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
60
|
"@vitejs/plugin-vue": "^4.6.2",
|
package/src/App.vue
CHANGED
|
@@ -156,6 +156,36 @@
|
|
|
156
156
|
</el-col>
|
|
157
157
|
</el-row>
|
|
158
158
|
|
|
159
|
+
<el-row :gutter="20" justify="center" align="middle">
|
|
160
|
+
<el-col :span="auto">
|
|
161
|
+
<el-button size="small" @click="() => fitBoundingBox=!fitBoundingBox">
|
|
162
|
+
{{ fitBoundingBox ? 'Unfit' : 'Fit' }} BoundingBox
|
|
163
|
+
</el-button>
|
|
164
|
+
</el-col>
|
|
165
|
+
<el-col :span="auto">
|
|
166
|
+
<el-button-group>
|
|
167
|
+
<el-button size="small" @click="createAxisDisplay('axes', fitBoundingBox)">
|
|
168
|
+
Create Axes CoordSystem
|
|
169
|
+
</el-button>
|
|
170
|
+
</el-button-group>
|
|
171
|
+
</el-col>
|
|
172
|
+
<el-col :span="auto">
|
|
173
|
+
<el-button-group>
|
|
174
|
+
<el-button size="small" @click="enableAxisDisplay(true, false)">
|
|
175
|
+
Enable CoordSystem
|
|
176
|
+
</el-button>
|
|
177
|
+
<el-button size="small" @click="enableAxisDisplay(true, true )">
|
|
178
|
+
Enable MiniAxes CoordSystem
|
|
179
|
+
</el-button>
|
|
180
|
+
</el-button-group>
|
|
181
|
+
</el-col>
|
|
182
|
+
<el-col :span="auto">
|
|
183
|
+
<el-button size="small" @click="enableAxisDisplay(false, false)">
|
|
184
|
+
Disable CoordSystem
|
|
185
|
+
</el-button>
|
|
186
|
+
</el-col>
|
|
187
|
+
</el-row>
|
|
188
|
+
|
|
159
189
|
<el-row justify="center" align="middle">
|
|
160
190
|
<el-col>
|
|
161
191
|
<el-row :gutter="20" justify="center" align="middle">
|
|
@@ -417,6 +447,7 @@ export default {
|
|
|
417
447
|
ElIconFolderOpened: shallowRef(ElIconFolderOpened),
|
|
418
448
|
auto: NaN,
|
|
419
449
|
annotator: markRaw(new AnnotationService(`https://mapcore-demo.org/devel/flatmap/v4/annotator`)),
|
|
450
|
+
fitBoundingBox: false
|
|
420
451
|
};
|
|
421
452
|
},
|
|
422
453
|
watch: {
|
|
@@ -472,6 +503,12 @@ export default {
|
|
|
472
503
|
this.$refs.dropzone.revokeURLs();
|
|
473
504
|
},
|
|
474
505
|
methods: {
|
|
506
|
+
enableAxisDisplay: function (enable, miniaxes) {
|
|
507
|
+
this.$refs.scaffold.enableAxisDisplay(enable, miniaxes);
|
|
508
|
+
},
|
|
509
|
+
createAxisDisplay: function (type, fitBoundingBox) {
|
|
510
|
+
this.$refs.scaffold.createAxisDisplay(fitBoundingBox);
|
|
511
|
+
},
|
|
475
512
|
exportGLTF: function () {
|
|
476
513
|
this.$refs.scaffold.exportGLTF(false).then((data) => {
|
|
477
514
|
const filename = 'export' + JSON.stringify(new Date()) + '.gltf';
|
|
@@ -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: "",
|
|
@@ -130,7 +139,7 @@ export default {
|
|
|
130
139
|
data: function () {
|
|
131
140
|
return {
|
|
132
141
|
display: false,
|
|
133
|
-
annotationEntry:
|
|
142
|
+
annotationEntry: { },
|
|
134
143
|
ElIconDelete: shallowRef(ElIconDelete),
|
|
135
144
|
};
|
|
136
145
|
},
|
|
@@ -151,16 +160,18 @@ export default {
|
|
|
151
160
|
this.display = true;
|
|
152
161
|
if (this.annotationDisplay) {
|
|
153
162
|
const region = this.region ? this.region +"/" : "";
|
|
154
|
-
this.annotationEntry
|
|
163
|
+
this.annotationEntry = {
|
|
155
164
|
"featureId": region + this.label,
|
|
156
165
|
"resourceId": this.scaffoldUrl,
|
|
157
166
|
"resource": this.scaffoldUrl,
|
|
158
|
-
|
|
167
|
+
"feature": this.annotationFeature,
|
|
168
|
+
"offline": this.offlineAnnotationEnabled,
|
|
169
|
+
};
|
|
159
170
|
}
|
|
160
171
|
}
|
|
161
172
|
else {
|
|
162
173
|
this.display = false;
|
|
163
|
-
this.annotationEntry =
|
|
174
|
+
this.annotationEntry = { };
|
|
164
175
|
}
|
|
165
176
|
},
|
|
166
177
|
hideTriggered: function() {
|
|
@@ -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
|
/>
|
|
@@ -311,7 +314,7 @@
|
|
|
311
314
|
{{ modeDescription }}
|
|
312
315
|
</el-row>
|
|
313
316
|
<el-row v-if="viewingMode === 'Annotation' && offlineAnnotationEnabled" class="viewing-mode-description">
|
|
314
|
-
(
|
|
317
|
+
(Anonymous annotate)
|
|
315
318
|
</el-row>
|
|
316
319
|
</el-row>
|
|
317
320
|
<el-row class="backgroundSpacer"></el-row>
|
|
@@ -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,
|
|
@@ -970,6 +976,16 @@ export default {
|
|
|
970
976
|
},
|
|
971
977
|
},
|
|
972
978
|
methods: {
|
|
979
|
+
enableAxisDisplay: function (enable, miniaxes) {
|
|
980
|
+
if (this.$module.scene) {
|
|
981
|
+
this.$module.scene.enableAxisDisplay(enable, miniaxes);
|
|
982
|
+
}
|
|
983
|
+
},
|
|
984
|
+
createAxisDisplay: function (fit) {
|
|
985
|
+
if (this.$module.scene) {
|
|
986
|
+
this.$module.scene.createAxisDisplay(fit);
|
|
987
|
+
}
|
|
988
|
+
},
|
|
973
989
|
/**
|
|
974
990
|
* @public
|
|
975
991
|
* Call this to manually add a zinc object into the current scene.
|
|
@@ -1020,15 +1036,11 @@ export default {
|
|
|
1020
1036
|
zincObjectRemoved: function (zincObject) {
|
|
1021
1037
|
if (this.$module.scene) {
|
|
1022
1038
|
// zincObjectAdded will be alled in sequential callback
|
|
1023
|
-
const regionPath = zincObject.region.getFullPath();
|
|
1024
1039
|
const groupName = zincObject.groupName;
|
|
1025
1040
|
const objects = zincObject.region.findObjectsWithGroupName(groupName, false);
|
|
1026
1041
|
//Remove relevant objects from the rest of the app.
|
|
1027
1042
|
if (objects.length === 0) {
|
|
1028
1043
|
this.$_searchIndex.removeZincObject(zincObject, zincObject.uuid);
|
|
1029
|
-
if (this.offlineAnnotationEnabled) {
|
|
1030
|
-
this.removeFromOfflineAnnotation(regionPath, groupName);
|
|
1031
|
-
}
|
|
1032
1044
|
}
|
|
1033
1045
|
}
|
|
1034
1046
|
},
|
|
@@ -1118,11 +1130,9 @@ export default {
|
|
|
1118
1130
|
regionPath = regionPath.slice(0, -1);
|
|
1119
1131
|
}
|
|
1120
1132
|
annotation.region = regionPath;
|
|
1121
|
-
this.offlineAnnotations = JSON.parse(sessionStorage.getItem('
|
|
1122
|
-
//Remove previous entry if there is matching region and group
|
|
1123
|
-
this.removeFromOfflineAnnotation(regionPath, group);
|
|
1133
|
+
this.offlineAnnotations = JSON.parse(sessionStorage.getItem('anonymous-annotation')) || [];
|
|
1124
1134
|
this.offlineAnnotations.push(annotation);
|
|
1125
|
-
sessionStorage.setItem('
|
|
1135
|
+
sessionStorage.setItem('anonymous-annotation', JSON.stringify(this.offlineAnnotations));
|
|
1126
1136
|
}
|
|
1127
1137
|
this.$emit('userPrimitivesUpdated', {region, group, zincObject});
|
|
1128
1138
|
},
|
|
@@ -1205,6 +1215,27 @@ export default {
|
|
|
1205
1215
|
this.$emit("annotation-close");
|
|
1206
1216
|
}
|
|
1207
1217
|
},
|
|
1218
|
+
/**
|
|
1219
|
+
* Internal only.
|
|
1220
|
+
* Confirm delete of user created primitive.
|
|
1221
|
+
* This is only called from callback.
|
|
1222
|
+
*/
|
|
1223
|
+
confirmComment: function (payload) {
|
|
1224
|
+
if (this._editingZincObject) {
|
|
1225
|
+
let annotation = payload
|
|
1226
|
+
if (this._editingZincObject.isEditable) {
|
|
1227
|
+
this.existDrawnFeatures = markRaw(this.existDrawnFeatures.filter(feature => feature.id !== annotation.item.id));
|
|
1228
|
+
this.existDrawnFeatures.push(payload.feature);
|
|
1229
|
+
}
|
|
1230
|
+
if (this.offlineAnnotationEnabled) {
|
|
1231
|
+
annotation.group = this._editingZincObject.groupName;;
|
|
1232
|
+
annotation.region = this._editingZincObject.region.getFullPath();
|
|
1233
|
+
this.offlineAnnotations = JSON.parse(sessionStorage.getItem('anonymous-annotation')) || [];
|
|
1234
|
+
this.offlineAnnotations.push(annotation);
|
|
1235
|
+
sessionStorage.setItem('anonymous-annotation', JSON.stringify(this.offlineAnnotations));
|
|
1236
|
+
}
|
|
1237
|
+
}
|
|
1238
|
+
},
|
|
1208
1239
|
/**
|
|
1209
1240
|
* Internal only.
|
|
1210
1241
|
* Confirm delete of user created primitive.
|
|
@@ -1221,7 +1252,9 @@ export default {
|
|
|
1221
1252
|
const childRegion = this.$module.scene.getRootRegion().findChildFromPath(regionPath);
|
|
1222
1253
|
childRegion.removeZincObject(this._editingZincObject);
|
|
1223
1254
|
if (this.offlineAnnotationEnabled) {
|
|
1224
|
-
sessionStorage.
|
|
1255
|
+
this.offlineAnnotations = JSON.parse(sessionStorage.getItem('anonymous-annotation')) || [];
|
|
1256
|
+
this.offlineAnnotations = this.offlineAnnotations.filter(offline => offline.item.id !== annotation.item.id);
|
|
1257
|
+
sessionStorage.setItem('anonymous-annotation', JSON.stringify(this.offlineAnnotations));
|
|
1225
1258
|
}
|
|
1226
1259
|
}
|
|
1227
1260
|
}
|
|
@@ -1562,6 +1595,14 @@ export default {
|
|
|
1562
1595
|
if (this.viewingMode === 'Annotation') {
|
|
1563
1596
|
this.tData.label = id;
|
|
1564
1597
|
this.tData.region = regionPath;
|
|
1598
|
+
const zincObject = getClickedObjects(event);
|
|
1599
|
+
this._editingZincObject = zincObject;
|
|
1600
|
+
if (zincObject) {
|
|
1601
|
+
const regionPath = this._editingZincObject.region.getFullPath() + "/";
|
|
1602
|
+
const group = this._editingZincObject.groupName;
|
|
1603
|
+
this.annotationFeature = createNewAnnotationsWithFeatures(this._editingZincObject,
|
|
1604
|
+
regionPath, group, this.url, '').feature;
|
|
1605
|
+
}
|
|
1565
1606
|
this.activateAnnotationMode(names, event);
|
|
1566
1607
|
} else {
|
|
1567
1608
|
if (this.$refs.scaffoldTreeControls) {
|
|
@@ -1951,17 +1992,20 @@ export default {
|
|
|
1951
1992
|
);
|
|
1952
1993
|
} else {
|
|
1953
1994
|
const region = this.tData.region ? this.tData.region +"/" : "";
|
|
1954
|
-
const annotationEntry =
|
|
1995
|
+
const annotationEntry = {
|
|
1955
1996
|
"featureId": region + this.tData.label,
|
|
1956
1997
|
"resourceId": this.url,
|
|
1957
1998
|
"resource": this.url,
|
|
1958
|
-
|
|
1999
|
+
"feature": this.annotationFeature,
|
|
2000
|
+
"offline": this.offlineAnnotationEnabled,
|
|
2001
|
+
};
|
|
1959
2002
|
this.$emit('annotation-open', {
|
|
1960
2003
|
annotationEntry: annotationEntry,
|
|
1961
2004
|
createData: this.createData,
|
|
1962
2005
|
confirmCreate: this.confirmCreate,
|
|
1963
2006
|
cancelCreate: this.cancelCreate,
|
|
1964
2007
|
confirmDelete: this.confirmDelete,
|
|
2008
|
+
confirmComment: this.confirmComment
|
|
1965
2009
|
});
|
|
1966
2010
|
return;
|
|
1967
2011
|
}
|
|
@@ -1989,8 +2033,10 @@ export default {
|
|
|
1989
2033
|
addAnnotationFeature: async function () {
|
|
1990
2034
|
let drawnFeatures;
|
|
1991
2035
|
if (this.offlineAnnotationEnabled) {
|
|
1992
|
-
this.offlineAnnotations = JSON.parse(sessionStorage.getItem('
|
|
1993
|
-
drawnFeatures = this.offlineAnnotations.filter((offline) =>
|
|
2036
|
+
this.offlineAnnotations = JSON.parse(sessionStorage.getItem('anonymous-annotation')) || [];
|
|
2037
|
+
drawnFeatures = this.offlineAnnotations.filter((offline) => {
|
|
2038
|
+
return offline.resource === this.url && offline.feature.properties.drawn;
|
|
2039
|
+
}).map(offline => offline.feature);
|
|
1994
2040
|
} else {
|
|
1995
2041
|
drawnFeatures = [];
|
|
1996
2042
|
const drawn = await getDrawnAnnotations(this.annotator, this.userToken, this.url);
|
|
@@ -2222,7 +2268,7 @@ export default {
|
|
|
2222
2268
|
this.backgroundChangeCallback(options.background);
|
|
2223
2269
|
}
|
|
2224
2270
|
if (options.offlineAnnotations) {
|
|
2225
|
-
sessionStorage.setItem('
|
|
2271
|
+
sessionStorage.setItem('anonymous-annotation', options.offlineAnnotations);
|
|
2226
2272
|
}
|
|
2227
2273
|
if (options.viewingMode) {
|
|
2228
2274
|
this.changeViewingMode(options.viewingMode);
|
|
@@ -2266,6 +2312,8 @@ export default {
|
|
|
2266
2312
|
this.boundingDims.centre = centre;
|
|
2267
2313
|
this.boundingDims.size = size;
|
|
2268
2314
|
this.$nextTick(() => this.restoreSettings(options) );
|
|
2315
|
+
//this.$module.scene.createAxisDisplay(false);
|
|
2316
|
+
//this.$module.scene.enableAxisDisplay(true, true);
|
|
2269
2317
|
this.isReady = true;
|
|
2270
2318
|
};
|
|
2271
2319
|
},
|
|
@@ -2294,7 +2342,7 @@ export default {
|
|
|
2294
2342
|
state.search = {...this.lastSelected};
|
|
2295
2343
|
}
|
|
2296
2344
|
if (this.offlineAnnotationEnabled) {
|
|
2297
|
-
state.offlineAnnotations = sessionStorage.getItem('
|
|
2345
|
+
state.offlineAnnotations = sessionStorage.getItem('anonymous-annotation');
|
|
2298
2346
|
}
|
|
2299
2347
|
return state;
|
|
2300
2348
|
},
|
|
@@ -2313,7 +2361,7 @@ export default {
|
|
|
2313
2361
|
viewport: state.viewport,
|
|
2314
2362
|
visibility: state.visibility,
|
|
2315
2363
|
background: state.background,
|
|
2316
|
-
viewingMode:
|
|
2364
|
+
viewingMode: state.viewingMode,
|
|
2317
2365
|
search: state.search,
|
|
2318
2366
|
offlineAnnotations: state.offlineAnnotations,
|
|
2319
2367
|
});
|
|
@@ -2384,7 +2432,7 @@ export default {
|
|
|
2384
2432
|
annotationsList.forEach((annotation) => {
|
|
2385
2433
|
this.offlineAnnotations.push({...annotation});
|
|
2386
2434
|
});
|
|
2387
|
-
sessionStorage.setItem('
|
|
2435
|
+
sessionStorage.setItem('anonymous-annotation', JSON.stringify(this.offlineAnnotations));
|
|
2388
2436
|
}
|
|
2389
2437
|
},
|
|
2390
2438
|
|
package/src/scripts/Utilities.js
CHANGED
|
@@ -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":
|
|
318
|
-
"label":
|
|
330
|
+
"drawn": drawn,
|
|
331
|
+
"label": label
|
|
319
332
|
},
|
|
320
333
|
"geometry": {
|
|
321
334
|
"coordinates": coords,
|