-
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.
* initialize geoJS annotation viewer * basic annotation rendering, beginning annotation editing
- Loading branch information
1 parent
505001f
commit 166b35e
Showing
14 changed files
with
985 additions
and
25 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import logging | ||
|
||
from django.http import HttpRequest | ||
from ninja import Schema | ||
from ninja.errors import HttpError | ||
from ninja.pagination import RouterPaginated | ||
from oauth2_provider.models import AccessToken | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
||
router = RouterPaginated() | ||
|
||
|
||
class AnnotationSchema(Schema): | ||
recording: int # Foreign Key to index | ||
owner_username: str | ||
start_time: int | ||
end_time: int | ||
low_freq: int | ||
high_freq: int | ||
species: list[int] | ||
comments: str | ||
|
||
|
||
def get_owner_id(request: HttpRequest): | ||
token = request.headers.get('Authorization').replace('Bearer ', '') | ||
token_found = AccessToken.objects.get(token=token) | ||
if not token_found: | ||
raise HttpError(401, 'Authentication credentials were not provided.') | ||
|
||
return token_found.user.pk |
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,46 @@ | ||
<script lang="ts"> | ||
import { defineComponent, onMounted, PropType } from 'vue'; | ||
import { SpectrogramAnnotation } from '../../api/api'; | ||
import { SpectroInfo } from './geoJSUtils'; | ||
import RectangleLayer from './layers/rectangleLayer'; | ||
export default defineComponent({ | ||
name:'LayerManager', | ||
props: { | ||
geoViewerRef: { | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
type: Object as PropType<any>, | ||
required: true, | ||
}, | ||
spectroInfo: { | ||
type: Object as PropType<SpectroInfo | undefined>, | ||
default: () => undefined | ||
}, | ||
annotations: { | ||
type: Array as PropType<SpectrogramAnnotation[]>, | ||
default: () => [], | ||
} | ||
}, | ||
setup(props) { | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any | ||
const event = (type: string, data: any) => { | ||
// Will handle clicking, selecting and editing here | ||
}; | ||
onMounted(() => { | ||
if (props.spectroInfo) { | ||
const rectAnnotationLayer = new RectangleLayer(props.geoViewerRef, event, props.spectroInfo); | ||
rectAnnotationLayer.formatData(props.annotations); | ||
rectAnnotationLayer.redraw(); | ||
} | ||
}); | ||
return { | ||
}; | ||
} | ||
}); | ||
</script> | ||
|
||
<template> | ||
<div /> | ||
</template> |
Oops, something went wrong.