From 8b5ad6352f2ee88bf55ab95fc3ef2088c248ac00 Mon Sep 17 00:00:00 2001 From: Oliver Fritz Date: Wed, 9 Oct 2024 17:11:29 +0200 Subject: [PATCH 01/10] feat(street): add mapillary api entry to env templates --- .env.development.local.sample | 2 ++ .env.production.local.sample | 2 ++ 2 files changed, 4 insertions(+) diff --git a/.env.development.local.sample b/.env.development.local.sample index f4dd354..721a563 100644 --- a/.env.development.local.sample +++ b/.env.development.local.sample @@ -8,3 +8,5 @@ VITE_FIREBASE_STORAGE_BUCKET= VITE_FIREBASE_MESSAGING_SENDER_ID= VITE_FIREBASE_APP_ID= VITE_FIREBASE_MEASUREMENT_ID= + +VITE_MAPILLARY_API_KEY= diff --git a/.env.production.local.sample b/.env.production.local.sample index b4d18fe..7886077 100644 --- a/.env.production.local.sample +++ b/.env.production.local.sample @@ -8,3 +8,5 @@ VITE_FIREBASE_STORAGE_BUCKET= VITE_FIREBASE_MESSAGING_SENDER_ID= VITE_FIREBASE_APP_ID= VITE_FIREBASE_MEASUREMENT_ID= + +VITE_MAPILLARY_API_KEY= From ff40cef2dbf82f953997d07277802be9cc8b443c Mon Sep 17 00:00:00 2001 From: Oliver Fritz Date: Thu, 10 Oct 2024 11:27:00 +0200 Subject: [PATCH 02/10] feat(street-level): add street level to project types config --- src/config/projectTypes.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/config/projectTypes.ts b/src/config/projectTypes.ts index c408426..f15c9ec 100644 --- a/src/config/projectTypes.ts +++ b/src/config/projectTypes.ts @@ -23,6 +23,10 @@ const projectTypes = { name: 'Digitize', component: 'digitizeProject', }, + '7': { + name: 'Street', + component: 'streetProject', + }, } export default projectTypes From 9fed0a7820e9d9d8628998d2268339379dc0aab8 Mon Sep 17 00:00:00 2001 From: Oliver Fritz Date: Thu, 10 Oct 2024 16:33:14 +0200 Subject: [PATCH 03/10] feat(street-project): add basic street project component --- src/components/StreetProject.vue | 198 +++++++++++++++++++++++++++++++ src/views/ProjectView.vue | 2 + 2 files changed, 200 insertions(+) create mode 100644 src/components/StreetProject.vue diff --git a/src/components/StreetProject.vue b/src/components/StreetProject.vue new file mode 100644 index 0000000..3cc5d1a --- /dev/null +++ b/src/components/StreetProject.vue @@ -0,0 +1,198 @@ + + + + + diff --git a/src/views/ProjectView.vue b/src/views/ProjectView.vue index 8938156..ecdf40e 100644 --- a/src/views/ProjectView.vue +++ b/src/views/ProjectView.vue @@ -23,6 +23,7 @@ import FindProject from '@/components/FindProject.vue' import MediaProject from '@/components/MediaProject.vue' import ValidateProject from '@/components/ValidateProject.vue' import DigitizeProject from '@/components/DigitizeProject.vue' +import StreetProject from '@/components/StreetProject.vue' import projectTypes from '@/config/projectTypes' export default defineComponent({ @@ -33,6 +34,7 @@ export default defineComponent({ mediaProject: MediaProject, validateProject: ValidateProject, digitizeProject: DigitizeProject, + streetProject: StreetProject, }, data() { return { From 588673ac2f49838789b62a94575f11ba3e8601ac Mon Sep 17 00:00:00 2001 From: Oliver Fritz Date: Thu, 10 Oct 2024 17:38:33 +0200 Subject: [PATCH 04/10] feat(street-project): add mapillary viewer --- package.json | 1 + src/components/StreetProject.vue | 30 +++- yarn.lock | 232 +++++++++++++++++++++++++++++++ 3 files changed, 257 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index ff6e8e9..77a43f3 100644 --- a/package.json +++ b/package.json @@ -19,6 +19,7 @@ "@intlify/unplugin-vue-i18n": "^3.0.1", "base-64": "^1.0.0", "firebase": "^10.9.0", + "mapillary-js": "^4.1.2", "ol": "^9.1.0", "ol-contextmenu": "^5.4.0", "ol-ext": "^4.0.17", diff --git a/src/components/StreetProject.vue b/src/components/StreetProject.vue index 3cc5d1a..6b2994b 100644 --- a/src/components/StreetProject.vue +++ b/src/components/StreetProject.vue @@ -1,4 +1,6 @@ @@ -148,12 +167,11 @@ export default defineComponent({ - {{ taskId }} - + style="position: relative; height: calc(100vh - 375px)" + /> Date: Wed, 16 Oct 2024 17:39:12 +0200 Subject: [PATCH 05/10] feat(street, media): disable option buttons and forward while loading image --- src/components/MediaProject.vue | 5 +++-- src/components/OptionButtons.vue | 5 +++++ src/components/StreetProject.vue | 7 +++++-- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/components/MediaProject.vue b/src/components/MediaProject.vue index 571f05e..0c54cd2 100644 --- a/src/components/MediaProject.vue +++ b/src/components/MediaProject.vue @@ -93,7 +93,7 @@ export default defineComponent({ }, back() { if (!this.taskIndex <= 0) { - this.imageLoaded = false + this.isImageLoaded = false this.taskIndex-- this.taskId = this.tasks[this.taskIndex].taskId } @@ -105,7 +105,7 @@ export default defineComponent({ }, forward() { if (this.isImageLoaded && this.isAnswered() && this.taskIndex + 1 < this.tasks.length) { - this.imageLoaded = false + this.isImageLoaded = false this.taskIndex++ this.taskId = this.tasks[this.taskIndex].taskId } @@ -170,6 +170,7 @@ export default defineComponent({ , required: true, @@ -86,6 +90,7 @@ export default defineComponent({ @click="handleOptionButtonClicked(option)" v-shortkey="[option.shortkey]" @shortkey="handleOptionButtonClicked(option)" + :disabled="disabled" :title="[option.title, option.description].filter(Boolean).join(': ')" :text="'(' + option.shortkey + ') ' + option.title" :key="optionIndex" diff --git a/src/components/StreetProject.vue b/src/components/StreetProject.vue index 6b2994b..bd0f8ff 100644 --- a/src/components/StreetProject.vue +++ b/src/components/StreetProject.vue @@ -77,6 +77,7 @@ export default defineComponent({ data() { return { arrowKeys: true, + isLoading: true, results: {}, startTime: null, taskId: undefined, @@ -114,7 +115,7 @@ export default defineComponent({ }, */ forward() { - if (this.isAnswered() && this.taskIndex + 1 < this.tasks.length) { + if (!this.isLoading && this.isAnswered() && this.taskIndex + 1 < this.tasks.length) { this.taskIndex++ this.taskId = this.tasks[this.taskIndex].taskId this.viewer.moveTo(this.taskId) @@ -131,6 +132,7 @@ export default defineComponent({ this.viewer.deactivateComponent('direction') this.viewer.deactivateComponent('sequence') this.viewer.deactivateComponent('keyboard') + this.viewer.on('dataloading', (e) => (this.isLoading = e.loading)) }, isAnswered() { const result = this.results[this.taskId] @@ -174,6 +176,7 @@ export default defineComponent({ /> Date: Thu, 24 Oct 2024 15:24:12 +0200 Subject: [PATCH 06/10] refactor(street): move viewer into street-project-task component --- src/components/StreetProject.vue | 40 +++------------------ src/components/StreetProjectTask.vue | 52 ++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+), 36 deletions(-) create mode 100644 src/components/StreetProjectTask.vue diff --git a/src/components/StreetProject.vue b/src/components/StreetProject.vue index bd0f8ff..c67edb7 100644 --- a/src/components/StreetProject.vue +++ b/src/components/StreetProject.vue @@ -1,17 +1,17 @@ @@ -168,12 +141,7 @@ export default defineComponent({ - + +import { Viewer } from 'mapillary-js' +import 'mapillary-js/dist/mapillary.css' +import { defineComponent } from 'vue' + +export default defineComponent({ + props: { + taskId: { + type: String, + required: true, + }, + }, + data() { + return { + viewer: null, + } + }, + watch: { + taskId(newTaskId) { + this.viewer.moveTo(newTaskId) + }, + }, + methods: { + initialiseViewer(imageId) { + this.viewer = new Viewer({ + accessToken: import.meta.env.VITE_MAPILLARY_API_KEY, + component: { cover: false }, + container: 'mapillary', + imageId: imageId, + }) + + this.viewer.deactivateComponent('direction') + this.viewer.deactivateComponent('sequence') + this.viewer.deactivateComponent('keyboard') + this.viewer.on('dataloading', (e) => this.$emit('dataloading', e)) + }, + }, + mounted() { + this.initialiseViewer(this.taskId) + }, +}) + + + + + From ee2526d655bc0a92ebb6126b9a9f1defa811fcb8 Mon Sep 17 00:00:00 2001 From: Oliver Fritz Date: Mon, 28 Oct 2024 18:34:21 +0100 Subject: [PATCH 07/10] feat(street): add instructions and project-info --- src/components/DigitizeProject.vue | 2 +- src/components/MediaProject.vue | 2 +- src/components/StreetProject.vue | 34 +++++----- src/components/StreetProjectInstructions.vue | 67 ++++++++++++++++++++ src/i18n/locales/de.json | 4 ++ src/i18n/locales/en.json | 4 ++ 6 files changed, 93 insertions(+), 20 deletions(-) create mode 100644 src/components/StreetProjectInstructions.vue diff --git a/src/components/DigitizeProject.vue b/src/components/DigitizeProject.vue index 67d3bb0..f66626d 100644 --- a/src/components/DigitizeProject.vue +++ b/src/components/DigitizeProject.vue @@ -38,7 +38,7 @@ export default defineComponent({ }, tutorial: { type: Object, - require: false, + required: false, }, }, data() { diff --git a/src/components/MediaProject.vue b/src/components/MediaProject.vue index 0c54cd2..cb01990 100644 --- a/src/components/MediaProject.vue +++ b/src/components/MediaProject.vue @@ -44,7 +44,7 @@ export default defineComponent({ }, tutorial: { type: Object, - require: false, + required: false, }, }, data() { diff --git a/src/components/StreetProject.vue b/src/components/StreetProject.vue index c67edb7..e78da17 100644 --- a/src/components/StreetProject.vue +++ b/src/components/StreetProject.vue @@ -1,20 +1,20 @@ + + + + diff --git a/src/i18n/locales/de.json b/src/i18n/locales/de.json index 015903a..24c00c5 100644 --- a/src/i18n/locales/de.json +++ b/src/i18n/locales/de.json @@ -200,6 +200,10 @@ "moveLeft": "Zurück", "moveRight": "Weiter" }, + "streetProject": { + "moveLeft": "Zurück", + "moveRight": "Weiter" + }, "digitizeProjectInstructions": { "switchMode": "Editiermodus umschalten", "drawNewFeature": "Neue Objekte einzeichnen", diff --git a/src/i18n/locales/en.json b/src/i18n/locales/en.json index 469eac2..7222394 100644 --- a/src/i18n/locales/en.json +++ b/src/i18n/locales/en.json @@ -200,6 +200,10 @@ "moveLeft": "Back", "moveRight": "Forward" }, + "streetProject": { + "moveLeft": "Back", + "moveRight": "Forward" + }, "digitizeProjectInstructions": { "switchMode": "Switch editing mode", "drawNewFeature": "Draw new features", From fce015a033769e32cfd91b52814c7d29bd935250 Mon Sep 17 00:00:00 2001 From: Oliver Fritz Date: Wed, 4 Dec 2024 11:59:35 +0100 Subject: [PATCH 08/10] fix(street-project): correctly define default options prop --- src/components/StreetProject.vue | 51 +++++++++++++++----------------- 1 file changed, 24 insertions(+), 27 deletions(-) diff --git a/src/components/StreetProject.vue b/src/components/StreetProject.vue index e78da17..7ab2163 100644 --- a/src/components/StreetProject.vue +++ b/src/components/StreetProject.vue @@ -28,33 +28,30 @@ export default defineComponent({ }, options: { type: Array, - options: { - type: Array, - default() { - return [ - { - mdiIcon: 'mdi-check-bold', - iconColor: '#bbcb7d', - shortkey: 1, - title: 'Yes', - value: 1, - }, - { - mdiIcon: 'mdi-close-thick', - iconColor: '#fd5054', - shortkey: 2, - title: 'No', - value: 0, - }, - { - mdiIcon: 'mdi-minus-thick', - iconColor: '#adadad', - title: 'Not sure', - shortkey: 3, - value: 2, - }, - ] - }, + default() { + return [ + { + mdiIcon: 'mdi-check-bold', + iconColor: '#bbcb7d', + shortkey: 1, + title: 'Yes', + value: 1, + }, + { + mdiIcon: 'mdi-close-thick', + iconColor: '#fd5054', + shortkey: 2, + title: 'No', + value: 0, + }, + { + mdiIcon: 'mdi-minus-thick', + iconColor: '#adadad', + title: 'Not sure', + shortkey: 3, + value: 2, + }, + ] }, }, project: { From d44896678c9f48e1ab1ed93159694bb7f9840d3e Mon Sep 17 00:00:00 2001 From: Oliver Fritz Date: Thu, 5 Dec 2024 11:10:14 +0100 Subject: [PATCH 09/10] feat(street-project-task): reset view on move --- src/components/StreetProjectTask.vue | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/components/StreetProjectTask.vue b/src/components/StreetProjectTask.vue index be3ffeb..9e86104 100644 --- a/src/components/StreetProjectTask.vue +++ b/src/components/StreetProjectTask.vue @@ -17,7 +17,7 @@ export default defineComponent({ }, watch: { taskId(newTaskId) { - this.viewer.moveTo(newTaskId) + this.viewer.moveTo(newTaskId).then(() => this.resetView()) }, }, methods: { @@ -34,6 +34,10 @@ export default defineComponent({ this.viewer.deactivateComponent('keyboard') this.viewer.on('dataloading', (e) => this.$emit('dataloading', e)) }, + resetView() { + this.viewer.setCenter([0.5, 0.5]) + this.viewer.setZoom(0) + }, }, mounted() { this.initialiseViewer(this.taskId) From 3e3c6d9c665be26abac2d82b14d60e534b9722db Mon Sep 17 00:00:00 2001 From: Oliver Fritz Date: Thu, 5 Dec 2024 11:19:56 +0100 Subject: [PATCH 10/10] feat(street-project-task): use letterbox render mode --- src/components/StreetProjectTask.vue | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/StreetProjectTask.vue b/src/components/StreetProjectTask.vue index 9e86104..e2d534a 100644 --- a/src/components/StreetProjectTask.vue +++ b/src/components/StreetProjectTask.vue @@ -27,6 +27,7 @@ export default defineComponent({ component: { cover: false }, container: 'mapillary', imageId: imageId, + renderMode: 0, // Letterbox }) this.viewer.deactivateComponent('direction')