-
Notifications
You must be signed in to change notification settings - Fork 1
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
Implement context fusion #60
Draft
mtiessen1175
wants to merge
42
commits into
geo_upload
Choose a base branch
from
context_fusion
base: geo_upload
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 15 commits
Commits
Show all changes
42 commits
Select commit
Hold shift + click to select a range
b8a3f1e
added annotationsSettingsTab mixin for geo context-layer
mtiessen1175 e4cd4df
Rename files as allocation already clear from directory-structure
mtiessen1175 6df3a4f
Added annotations script (also included to publisher) in order to loa…
mtiessen1175 d02335e
remove console statements
mtiessen1175 d15366d
added production file (public annotations script)
mtiessen1175 f89eb86
Fixed missing <script> tag and added overlays to settingsTab.
mtiessen1175 ff117b0
Merge branch 'geo_upload' into context_fusion
mtiessen1175 c8f9335
Merge branch 'geo_upload' into context_fusion
mtiessen1175 8e6ce33
Merge branch 'geo_upload' into context_fusion
mtiessen1175 4834c0c
Include list of geo overlays to select from in annotation-settings.
mtiessen1175 9736999
added production ready files
mtiessen1175 72c8c5b
removed console statement
mtiessen1175 7d3b9e6
added production files
mtiessen1175 ed4c84e
Added annotationCanvasMixin for context layer to geo-module
mtiessen1175 ab5f76e
added production files
mtiessen1175 cd28d28
Merge branch 'geo_upload' into context_fusion
mtiessen1175 c243315
Updated OpenLayers imports to new biigle path
mtiessen1175 3107886
Added basic layer structure for WMS source to settingsTab.
mtiessen1175 b3c1913
Small linter fix and production files.
mtiessen1175 33d8bc0
Merge branch 'geo_upload' into context_fusion (working geoTIFF vis)
mtiessen1175 e146bd7
Save the context-layer settings (active overlay, opacity) in annotati…
mtiessen1175 dca8dcd
removed annotationCanvasMixin.
mtiessen1175 780f9e0
added geoTIFF TIlelayer to annotation map.
mtiessen1175 21b31bb
Changed watcher to properly add/update layer upon changes.
mtiessen1175 0676eed
minor changes (comment)
mtiessen1175 5d1315a
Fixed "map undefined" error on sidebar.toggle event.
mtiessen1175 d99482b
Added API route for receiving image metadata.
mtiessen1175 471c5c8
Fetch entire Image object (with metadata). Calculated correct context…
mtiessen1175 868a79a
changed calculateExtent function dependencies.
mtiessen1175 bb4e24b
Attempt to rotate context-layer (not working)
mtiessen1175 e2f9103
rotation and scale of overlay in experimental state.
mtiessen1175 8e4758e
Added OL prerender function for rotation of contextLayer
mtiessen1175 533326b
Fixed if-statement to account for undefined as well.
mtiessen1175 43716a2
experimental prerender rotate-function (not working yet)
mtiessen1175 771b888
Implemented mosaic rotation (adapted for cases that use the lower lef…
mtiessen1175 c2f9cd5
Merge branch 'geo_upload' into context_fusion
mtiessen1175 42a9c9f
Add scale method to adjust context-layer size
mtiessen1175 baf6cce
small fixes
mtiessen1175 617469b
Adapt the scale method (reset scale to 1 after each change).
mtiessen1175 6679db2
Added comment to code.
mtiessen1175 025bfc7
Add more detailed comments for further development.
mtiessen1175 b558179
Merge branch 'geo_upload' into context_fusion
mtiessen1175 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Large diffs are not rendered by default.
Oops, something went wrong.
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,5 @@ | ||
/*! | ||
* Vue.js v2.6.14 | ||
* (c) 2014-2021 Evan You | ||
* Released under the MIT License. | ||
*/ |
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 |
---|---|---|
@@ -1,5 +1,6 @@ | ||
{ | ||
"/assets/scripts/main.js": "/assets/scripts/main.js?id=2841cb161cd2f12e8413f919d09168b3", | ||
"/assets/scripts/volumes.js": "/assets/scripts/volumes.js?id=68b2595cd29676ad8496e5f5a04a32f5", | ||
"/assets/scripts/annotations.js": "/assets/scripts/annotations.js?id=c8439caed612fb0ded80425c64937956", | ||
"/assets/styles/main.css": "/assets/styles/main.css?id=bf09d95dc04208c3ee738dafbf8e123c" | ||
} |
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,5 @@ | ||
import './settingsTabPlugins'; | ||
import ContextLayerMixin from './mixins/ContextLayerMixin'; | ||
import {annotationCanvasMixins} from './import'; | ||
|
||
annotationCanvasMixins.push(ContextLayerMixin); |
123 changes: 123 additions & 0 deletions
123
src/resources/assets/js/annotations/components/settingsTabPlugin.vue
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,123 @@ | ||
<script> | ||
import { Collapse } from 'uiv'; | ||
/** | ||
* The plugin component to edit the context-layer appearance. | ||
* | ||
* @type {Object} | ||
*/ | ||
export default { | ||
components: { | ||
collapse: Collapse | ||
}, | ||
props: { | ||
settings: { | ||
type: Object, | ||
required: true, | ||
}, | ||
}, | ||
data() { | ||
return { | ||
opacityValue: '1', | ||
volumeId: null, | ||
overlays: null, | ||
showLayers: false, | ||
activeId: null, | ||
} | ||
}, | ||
computed: { | ||
opacity() { | ||
return parseFloat(this.opacityValue); | ||
}, | ||
shown() { | ||
return this.opacity > 0; | ||
}, | ||
}, | ||
methods: { | ||
toggleActive(id) { | ||
if(this.activeId === id) { | ||
// do nothing | ||
} else { | ||
this.activeId = id; | ||
} | ||
} | ||
}, | ||
watch: { | ||
opacity(opacity) { | ||
if (opacity < 1) { | ||
this.settings.set('contextLayerOpacity', opacity); | ||
} else { | ||
this.settings.delete('contextLayerOpacity'); | ||
} | ||
// TODO: Implement OL-layer that shows mosaic | ||
// this.layer.setOpacity(opacity); | ||
}, | ||
// save the ID of the currently selected overlay in settings | ||
activeId(activeId) { | ||
this.settings.set('contextLayerId', activeId); | ||
} | ||
}, | ||
created() { | ||
this.volumeId = biigle.$require('annotations.volumeId'); | ||
this.overlays = biigle.$require('annotations.overlays'); | ||
|
||
// check if there are context-overlays | ||
if(this.overlays.length !== 0) { | ||
// initially set activeId to first overlay | ||
this.activeId = this.overlays[0].id; | ||
// check if an opacity preference is available in settings and change it in case | ||
if (this.settings.has('contextLayerOpacity')) { | ||
this.opacityValue = this.settings.get('contextLayerOpacity'); | ||
} | ||
} | ||
}, | ||
}; | ||
</script> | ||
<style scoped> | ||
p { | ||
margin: 0; | ||
} | ||
|
||
/* layer-items settings */ | ||
.list-group-item.active { | ||
background-color: #353535; | ||
color: #ffffff; | ||
} | ||
|
||
.custom { | ||
display: flex; | ||
flex-direction: row; | ||
justify-content: space-between; | ||
gap: 10px; | ||
} | ||
|
||
.custom > .ellipsis { | ||
order: 1; | ||
flex: 1; | ||
min-width: 0; | ||
overflow: hidden; | ||
white-space: nowrap; | ||
text-overflow: ellipsis; | ||
} | ||
|
||
.layer-button { | ||
display: flex; | ||
flex-flow: row nowrap; | ||
justify-content: space-between; | ||
align-items: center; | ||
background-color: var(--body-bg); | ||
width: 100%; | ||
text-decoration: none; | ||
border: none; | ||
color: inherit; | ||
padding-bottom: 15px; | ||
} | ||
|
||
/* animate the chevron icon when list expands */ | ||
.icon { | ||
transition: ease-in-out .2s; | ||
} | ||
|
||
.icon.active { | ||
transform: rotateZ(180deg); | ||
} | ||
</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,2 @@ | ||
export let SettingsTabPlugins = biigle.$require('annotations.components.settingsTabPlugins'); | ||
export let annotationCanvasMixins = biigle.$require('annotations.stores.canvasMixins'); |
42 changes: 42 additions & 0 deletions
42
src/resources/assets/js/annotations/mixins/ContextLayerMixin.vue
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,42 @@ | ||
<script> | ||
import TileLayer from 'ol/layer/Tile'; | ||
import TileWMS from 'ol/source/TileWMS'; | ||
|
||
|
||
|
||
/** | ||
* Mixin for the annotationCanvas component that contains logic for the Context-Layer (Geo-Overlay) interaction. | ||
* | ||
* @type {Object} | ||
*/ | ||
export default { | ||
data() { | ||
return { | ||
overlays: [], | ||
}; | ||
}, | ||
methods: { | ||
|
||
}, | ||
mounted() { | ||
this.overlays = biigle.$require('annotations.overlays'); | ||
// console.log('geoOverlays: ', this.overlays); | ||
// console.log('activeId: ', this.settings); | ||
|
||
for(let i = this.overlays.length - 1; i >= 0; i--) { | ||
if(this.overlays[i].type == 'webmap') { | ||
let wmsTileLayer = new TileLayer({ | ||
source: new TileWMS({ | ||
url: this.overlays[i].attrs.url, | ||
params: {'LAYERS': this.overlays[i].attrs.layers, 'TILED': true}, | ||
serverType: 'geoserver', | ||
transition: 0, | ||
}), | ||
}); | ||
wmsTileLayer.set('id', this.overlays[i].id); | ||
// this.map.push(wmsTileLayer); | ||
} | ||
} | ||
} | ||
}; | ||
</script> |
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,11 @@ | ||
import Plugin from './components/settingsTabPlugin'; | ||
import {SettingsTabPlugins} from './import'; | ||
|
||
/** | ||
* The plugin component to modify the context layer in the annotation tool. | ||
* | ||
* @type {Object} | ||
*/ | ||
if (SettingsTabPlugins) { | ||
SettingsTabPlugins.contextLayer = Plugin; | ||
} |
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,4 @@ | ||
<script type="text/javascript"> | ||
biigle.$declare('annotations.overlays', {!! \Biigle\Modules\Geo\GeoOverlay::where('volume_id', $volume->id)->where('context_layer', true)->orderBy('layer_index')->get() !!}); | ||
</script> | ||
<script src="{{ cachebust_asset('vendor/geo/scripts/annotations.js') }}"></script> |
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,20 @@ | ||
<component :is="plugins.contextLayer" :settings="settings" inline-template> | ||
<div v-if="overlays.length !== 0" class="sidebar-tab__section"> | ||
<h5 title="Opacity of the context layer">Geo Overlay Opacity (<span v-if="shown" v-text="opacity"></span><span v-else>hidden</span>)</h5> | ||
<div class="form-group"> | ||
<input type="range" min="0" max="1" step="0.1" v-model="opacityValue"> | ||
</div> | ||
<button class="layer-button" @click="showLayers = !showLayers" title="Show available geo-overlays"> | ||
<p>Geo Overlays</p> <i class="icon fa fa-chevron-down" :class="{active: showLayers}" style="font-size: 1.5em;"></i> | ||
</button> | ||
<collapse v-model="showLayers"> | ||
<div v-if="overlays.length !== 0"> | ||
<div v-for="overlay in overlays" :key="overlay.id"> | ||
<button :id="overlay.id" :class="{active: overlay.id === activeId}" class="list-group-item custom" v-on:click="toggleActive(overlay.id)"> | ||
<span class="ellipsis" :title="overlay.name" v-text="overlay.name"></span> | ||
</button> | ||
</div> | ||
</div> | ||
</collapse> | ||
</div> | ||
</component> |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mzur,
I am a bit confused by all the imports between the biigle modules, which is why I pose this question:
In the geo-module I created a
ContextLayerMixin
for theannotationCanvas.vue
of biigle/core.In this mixin, I want to access a couple of variables from the annotation settings tab (i.e. the activeId or opacity of the geo-overlay settings, which are part of yet another plugin that is published from the geo-module to the
settingsTab.vue
in core).In order to access these variables, do I have to make them available as properties in the
annotationCanvas
component (here) in biigle/core, or can I directly import them, for example the whole settings-variable from the settings-store?The first option should work because the variables would be made accessible within the
ContextLayerMixin
, but it would require changes to the code in biigle/core, which doesn't seem right. Regarding the second option, I'm not sure how to make the settings-store variable available.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see your point, there is no direct way to access the settings in an annotation canvas mixin. Maybe you can do it like the reports module. It does everything in the settings tab plugin by using the
annotations.map.init
andimages.change
events to hook up OpenLayers objects and update image data.