-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #53 from mapswipe/feature/street
Street level image classification project type
- Loading branch information
Showing
14 changed files
with
577 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,182 @@ | ||
<script lang="ts"> | ||
import createInformationPages from '@/utils/createInformationPages' | ||
import StreetProjectTask from './StreetProjectTask.vue' | ||
import OptionButtons from './OptionButtons.vue' | ||
import ProjectHeader from './ProjectHeader.vue' | ||
import ProjectInfo from './ProjectInfo.vue' | ||
import TaskProgress from '@/components/TaskProgress.vue' | ||
import StreetProjectInstructions from './StreetProjectInstructions.vue' | ||
import { defineComponent } from 'vue' | ||
export default defineComponent({ | ||
components: { | ||
streetProjectInstructions: StreetProjectInstructions, | ||
streetProjectTask: StreetProjectTask, | ||
optionButtons: OptionButtons, | ||
projectHeader: ProjectHeader, | ||
projectInfo: ProjectInfo, | ||
taskProgress: TaskProgress, | ||
}, | ||
props: { | ||
group: { | ||
type: Object, | ||
required: true, | ||
}, | ||
first: { | ||
type: Boolean, | ||
default: false, | ||
}, | ||
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, | ||
}, | ||
] | ||
}, | ||
}, | ||
project: { | ||
type: Object, | ||
required: true, | ||
}, | ||
tasks: { | ||
type: Array, | ||
required: true, | ||
}, | ||
tutorial: { | ||
type: Object, | ||
required: false, | ||
}, | ||
}, | ||
data() { | ||
return { | ||
arrowKeys: true, | ||
isLoading: true, | ||
results: {}, | ||
startTime: null, | ||
taskId: undefined, | ||
taskIndex: 0, | ||
} | ||
}, | ||
inject: { | ||
logMappingStarted: 'logMappingStarted', | ||
saveResults: 'saveResults', | ||
}, | ||
computed: { | ||
instructionMessage() { | ||
const message = this.project?.lookFor | ||
return message | ||
}, | ||
}, | ||
methods: { | ||
addResult(value) { | ||
this.results[this.taskId] = value | ||
}, | ||
back() { | ||
if (!this.taskIndex <= 0) { | ||
this.taskIndex-- | ||
this.taskId = this.tasks[this.taskIndex].taskId | ||
} | ||
}, | ||
createInformationPages, | ||
// fallback information pages for street projects tbd | ||
createFallbackInformationPages() { | ||
return undefined | ||
}, | ||
forward() { | ||
if (!this.isLoading && this.isAnswered() && this.taskIndex + 1 < this.tasks.length) { | ||
this.taskIndex++ | ||
this.taskId = this.tasks[this.taskIndex].taskId | ||
} | ||
}, | ||
isAnswered() { | ||
const result = this.results[this.taskId] | ||
const defined = result !== undefined | ||
return defined | ||
}, | ||
}, | ||
created() { | ||
this.startTime = new Date().toISOString() | ||
this.taskId = this.tasks[this.taskIndex].taskId | ||
this.$emit('created') | ||
this.logMappingStarted(this.project.projectType) | ||
}, | ||
}) | ||
</script> | ||
|
||
<template> | ||
<project-header :instructionMessage="instructionMessage" :title="project?.projectTopic"> | ||
<project-info | ||
:first="first" | ||
:informationPages="createInformationPages(tutorial, project, createFallbackInformationPages)" | ||
:manualUrl="project?.manualUrl" | ||
@toggle-dialog="arrowKeys = !arrowKeys" | ||
> | ||
<template #instructions> | ||
<street-project-instructions :instructionMessage="instructionMessage" :options="options" /> | ||
</template> | ||
</project-info> | ||
</project-header> | ||
<street-project-task :taskId="taskId" @dataloading="(e) => (isLoading = e.loading)" /> | ||
<option-buttons | ||
v-if="taskId" | ||
:disabled="isLoading" | ||
:options="options" | ||
:result="results[taskId]" | ||
:taskId="taskId" | ||
@addResult="addResult" | ||
/> | ||
<v-toolbar color="white" extension-height="20" density="compact" extended> | ||
<v-spacer /> | ||
<v-btn | ||
:title="$t('streetProject.moveLeft')" | ||
icon="mdi-chevron-left" | ||
color="secondary" | ||
:disabled="taskIndex <= 0" | ||
@click="back" | ||
v-shortkey.once="[arrowKeys ? 'arrowleft' : '']" | ||
@shortkey="back" | ||
/> | ||
<v-btn | ||
:title="$t('projectView.saveResults')" | ||
icon="mdi-content-save" | ||
color="primary" | ||
:disabled="Object.keys(results).length < tasks.length" | ||
@click="saveResults(results, startTime)" | ||
/> | ||
<v-btn | ||
:title="$t('streetProject.moveRight')" | ||
icon="mdi-chevron-right" | ||
color="secondary" | ||
:disabled="isLoading || !isAnswered() || taskIndex + 1 === tasks.length" | ||
@click="forward" | ||
v-shortkey.once="[arrowKeys ? 'arrowright' : '']" | ||
@shortkey="forward" | ||
/> | ||
<v-spacer /> | ||
<template #extension> | ||
<task-progress :progress="taskIndex + isAnswered()" :total="tasks.length" /> | ||
</template> | ||
</v-toolbar> | ||
</template> | ||
|
||
<style scoped></style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
<script lang="ts"> | ||
import { defineComponent } from 'vue' | ||
export default defineComponent({ | ||
props: { | ||
instructionMessage: { | ||
type: String, | ||
required: true, | ||
}, | ||
attribution: { | ||
type: String, | ||
require: false, | ||
}, | ||
options: { | ||
type: Array, | ||
required: true, | ||
}, | ||
}, | ||
}) | ||
</script> | ||
|
||
<template> | ||
<v-card-text> | ||
<div class="text-h6">{{ $t('projectInstructions.classifyTitle') }}</div> | ||
<div class="text-p"> | ||
{{ instructionMessage }} {{ $t('projectInstructions.classifyInstruction') }}. | ||
</div> | ||
|
||
<v-row v-for="(option, optionIndex) in options" :key="optionIndex" align="center" dense> | ||
<v-col cols="auto" class="mr-4"> | ||
<v-btn | ||
class="mx-2 text-caption" | ||
width="6rem" | ||
:text="'(' + option.shortkey + ') ' + option.title" | ||
:color="option.iconColor" | ||
:prepend-icon="option.mdiIcon" | ||
variant="plain" | ||
stacked | ||
/> | ||
</v-col> | ||
<v-col>{{ [option.title, option.description].filter(Boolean).join(': ') }}</v-col> | ||
</v-row> | ||
|
||
<div class="text-h6 mt-10">{{ $t('projectInstructions.useButtonsToNavigate') }}</div> | ||
<div class="text-p mt-2"> | ||
<v-row class="align-center" dense> | ||
<v-col cols="auto" class="mr-4"> | ||
<v-btn icon="mdi-chevron-left" color="secondary" class="mr-2" variant="text" /> | ||
<v-btn icon="mdi-chevron-right" color="secondary" variant="text" /> | ||
</v-col> | ||
<v-col>{{ $t('projectInstructions.move') }}</v-col> | ||
</v-row> | ||
</div> | ||
|
||
<div class="text-h6 mt-10">{{ $t('projectInstructions.saveYourAnswers') }}</div> | ||
<div class="text-p mt-2"> | ||
<v-row class="align-center" dense> | ||
<v-col cols="auto" class="mr-4"> | ||
<v-btn icon="mdi-content-save" color="primary" variant="text" /> | ||
</v-col> | ||
<v-col>{{ $t('projectInstructions.seenAll') }}</v-col> | ||
</v-row> | ||
</div> | ||
</v-card-text> | ||
</template> | ||
|
||
<style scoped></style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<script lang="ts"> | ||
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).then(() => this.resetView()) | ||
}, | ||
}, | ||
methods: { | ||
initialiseViewer(imageId) { | ||
this.viewer = new Viewer({ | ||
accessToken: import.meta.env.VITE_MAPILLARY_API_KEY, | ||
component: { cover: false }, | ||
container: 'mapillary', | ||
imageId: imageId, | ||
renderMode: 0, // Letterbox | ||
}) | ||
this.viewer.deactivateComponent('direction') | ||
this.viewer.deactivateComponent('sequence') | ||
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) | ||
}, | ||
}) | ||
</script> | ||
|
||
<template> | ||
<v-container | ||
id="mapillary" | ||
class="ma-0 pa-0" | ||
style="position: relative; height: calc(100vh - 375px)" | ||
/> | ||
</template> | ||
|
||
<style scoped></style> |
Oops, something went wrong.