-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merging of new vector filter capabilities (#2663)
* feat: added possibility to pass flat style style * chore: added initial vector layer for sawmill data * feat: implemented initial idea for vector tile feature filtering * chore: cleanup of component, added category info to filter definition * fix: made sure colormap is loaded in correct layer for forest disturbance * chore: added truck supported roads network as layer to fcm2, added sawmill capabilities also to fcm3 * chore: removed adress from tooltip
- Loading branch information
1 parent
11cb463
commit 653b043
Showing
4 changed files
with
303 additions
and
57 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,71 @@ | ||
<template> | ||
<v-col v-if="filters" | ||
:cols="$vuetify.breakpoint.mdAndDown" | ||
:style="`height: auto`" | ||
> | ||
<v-card class="pa-2"> | ||
<v-card-title class="pa-2">Filters</v-card-title> | ||
<template> | ||
<v-select | ||
v-model="selectedFilters" | ||
:items="filters" | ||
item-text="description" | ||
item-value="id" | ||
label="Select" | ||
multiple | ||
return-object | ||
:hint="featureFilters.hint ? featureFilters.hint: 'Select filter'" | ||
persistent-hint | ||
@change="updateMap" | ||
></v-select> | ||
</template> | ||
</v-card> | ||
</v-col> | ||
</template> | ||
|
||
<script> | ||
import { getMapInstance } from '@/components/map/map'; | ||
export default { | ||
name: 'FilterControls', | ||
props: { | ||
featureFilters: Object, | ||
}, | ||
data() { | ||
return { | ||
selectedFilters: [], | ||
filters: this.featureFilters.filters, | ||
}; | ||
}, | ||
methods: { | ||
updateMap() { | ||
let resultFilters = []; | ||
let style; | ||
if (this.selectedFilters.length > 1) { | ||
resultFilters.push('all'); | ||
this.selectedFilters.forEach((f) => { | ||
resultFilters.push(['==', ['get', f.id], 1]); | ||
}); | ||
} else if (this.selectedFilters.length === 1) { | ||
resultFilters = ['==', ['get', this.selectedFilters[0].id], 1]; | ||
} | ||
if (this.selectedFilters.length === 0) { | ||
style = this.featureFilters.baseStyle; | ||
} else { | ||
style = [{ | ||
filter: resultFilters, | ||
style: this.featureFilters.baseStyle, | ||
}]; | ||
} | ||
const { map } = getMapInstance('centerMap'); | ||
const vectorLayer = map.getAllLayers().find( | ||
(l) => l.get('id') === this.featureFilters.sourceLayer, | ||
); | ||
vectorLayer.setStyle(style); | ||
}, | ||
}, | ||
}; | ||
</script> | ||
|
||
<style lang="scss" 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
Oops, something went wrong.