-
Notifications
You must be signed in to change notification settings - Fork 0
Integration of VISIAN into DV #575
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop-annotation-service
Are you sure you want to change the base?
Changes from 32 commits
144845c
8f3744d
39337de
e8b5973
3931466
0673144
a3475cf
db51c09
21bc212
73bb97b
64822e8
ee2fffe
27f8b99
fcd5e6d
704c5ac
b3b83d1
579edee
1812a61
9c0fb5f
8878f94
85db549
11ac43d
e330497
774cb1d
b5b7fbd
7647230
0f8b8cd
8cfd6bf
d30a731
aa3fee0
87cd0b1
ff3d38e
ab56144
c437417
22fa3b8
4b36b01
dfacfbd
c50a269
fa3df48
244dc20
f1bec14
f4b3d51
1e6f908
08b491b
ddf8736
698b4de
9ff649d
10c33d0
f675ab7
0f38e03
fa71c29
9ae3820
dcf65dd
7b8a451
344747c
1f94891
4e88ad5
3848f55
7ff9661
ca52344
1c4aea0
6521914
b571d94
fb683b7
9d309aa
fe9d4f9
2618609
0aab42f
d23cf33
65249b8
e9343c5
a6907b8
5d59873
2be2a09
cbd5f81
e68de9c
df8914a
26f59bf
95b77fc
d39d335
6e5e4a3
772f00e
6e219fd
1df633e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| import { getDVTask } from "@visian/utils"; | ||
|
|
||
| import { RootStore } from "../root"; | ||
| import { DVReviewTask } from "./dv-review-task"; | ||
| import { ReviewStrategy } from "./review-strategy"; | ||
| import { ReviewStrategySnapshot } from "./review-strategy-snapshot"; | ||
|
|
||
| export class DVReviewStrategy extends ReviewStrategy { | ||
| public static fromSnapshot( | ||
| store: RootStore, | ||
| snapshot?: ReviewStrategySnapshot, | ||
| ) { | ||
| if (!snapshot) return undefined; | ||
| if (snapshot.backend === "dv") { | ||
| return new DVReviewStrategy({ | ||
| store, | ||
| currentReviewTask: snapshot.currentReviewTask | ||
| ? DVReviewTask.fromSnapshot(snapshot.currentReviewTask) | ||
| : undefined, | ||
| }); | ||
| } | ||
| return undefined; | ||
| } | ||
|
|
||
| constructor({ | ||
| store, | ||
| currentReviewTask, | ||
| }: { | ||
| store: RootStore; | ||
| currentReviewTask?: DVReviewTask; | ||
| }) { | ||
| super({ store }); | ||
| if (currentReviewTask) this.setCurrentTask(currentReviewTask); | ||
| } | ||
|
|
||
| public async nextTask(): Promise<void> { | ||
| throw new Error("Next task is not implemented in the DV strategy!"); | ||
| } | ||
|
|
||
| public async previousTask() { | ||
| throw new Error("Previous task is not implemented in the DV strategy!"); | ||
| } | ||
|
|
||
| public async saveTask(): Promise<void> { | ||
| this.currentTask?.save(this.getDocument()); | ||
| } | ||
|
|
||
| protected async buildTask() { | ||
| // TODO: receiving the task id from the url is not implemented yet | ||
| const dvTask = await getDVTask("dv-task-id"); | ||
|
||
|
|
||
| if (!dvTask) throw new Error("DV Task not found."); | ||
| this.setCurrentTask(new DVReviewTask(dvTask)); | ||
| } | ||
|
|
||
| // eslint-disable-next-line @typescript-eslint/no-empty-function | ||
| protected async importAnnotations(): Promise<void> {} | ||
|
|
||
| public loadTaskPostProcessing(): void { | ||
| const document = this.getDocument(); | ||
| const reviewTask = this.currentTask as DVReviewTask; | ||
| reviewTask.addGroupsAndLayers(document); | ||
|
|
||
| document.requestSave(); | ||
| } | ||
Alorcus marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| public toJSON(): ReviewStrategySnapshot { | ||
| return { | ||
| backend: "dv", | ||
| currentReviewTask: this.currentTask | ||
| ? (this.currentTask as DVReviewTask).toJSON() | ||
| : undefined, | ||
| }; | ||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.