Skip to content

Commit

Permalink
Merge pull request #835 from geoadmin/feat-PB-491-3d-menu-2
Browse files Browse the repository at this point in the history
PB-491: 3D menu only when active
  • Loading branch information
ltshb authored May 16, 2024
2 parents cf84e12 + cc2299c commit a2f8937
Show file tree
Hide file tree
Showing 16 changed files with 339 additions and 119 deletions.
12 changes: 10 additions & 2 deletions src/modules/i18n/locales/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,10 @@
"time_hide": "Deaktivieren der Anzeige von Daten-Zeitständen.",
"time_select_year": "Wählen Sie ein Jahr aus",
"time_show": "Aktivieren der Anzeige von Daten-Zeitständen.",
"time_slider_legend_tippy_intro": "Der Zeitschieber zeigt verschiedene Farben an, je nachdem, ob die Zeitschichten Daten für das ausgewählte Jahr haben oder nicht.",
"time_slider_legend_tippy_full_data": "Vollständige Daten",
"time_slider_legend_tippy_no_data": "Teildaten",
"time_slider_legend_tippy_partial_data": "Keine Daten",
"title": "Titel",
"tooltip": "Tooltip",
"topic_are_tooltip": "Bundesamt für Raumentwicklung",
Expand Down Expand Up @@ -638,7 +642,7 @@
"loading_error_network_failure": "Laden fehlgeschlagen, auf die Datei kann nicht zugegriffen werden",
"loading_file": "Laden...",
"invalid_kml_gpx_file_error": "Ungültige Datei, nur KML- oder GPX-Dateien werden unterstützt",
"import_maps": "Karten Importieren",
"import_maps": "Karten importieren",
"import_maps_tooltip": "Importieren Sie externe WMTS- oder WMS-Datenquellen",
"unsupported_content_type": "Nicht unterstützter Antwortinhaltstyp",
"invalid_wms_capabilities": "Ungültige WMS-Capabilities-Daten",
Expand Down Expand Up @@ -672,5 +676,9 @@
"no_email": "Das E-Mail-Feld ist erforderlich",
"file_unsupported_format": "Dieses Dateiformat wird nicht unterstützt. Nur die folgenden Formate sind erlaubt: ALLOWED_FORMATS",
"form_invalid": "Das Formular ist ungültig",
"file_imported_success": "Datei erfolgreich importiert"
"file_imported_success": "Datei erfolgreich importiert",
"3d_labels": "Geografische Namen",
"3d_vegetation": "Vegetationen",
"3d_constructions": "Gebäude und Konstruktionen",
"webmapviewer_live_disclaimer": "Grosse Veränderungen stehen bevor, <a target='_blank' href='https://www.swisstopo.admin.ch/de'>erfahren Sie mehr</a>"
}
10 changes: 9 additions & 1 deletion src/modules/i18n/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,10 @@
"time_hide": "Disable representation of data time stamps.",
"time_select_year": "Select a year",
"time_show": "Enable representation of data time stamps.",
"time_slider_legend_tippy_intro": "The time slider displays different colours depending on whether the time layers have data for the selected year or not.",
"time_slider_legend_tippy_full_data": "Full Data.",
"time_slider_legend_tippy_no_data": "No data.",
"time_slider_legend_tippy_partial_data": "Partial data.",
"title": "Title",
"tooltip": "Tooltip",
"topic_are_tooltip": "Federal Office for Spatial Development ",
Expand Down Expand Up @@ -672,5 +676,9 @@
"no_email": "Email field is required",
"file_unsupported_format": "This file format is not supported. Only the following formats are allowed: ALLOWED_FORMATS",
"form_invalid": "Form is invalid",
"file_imported_success": "File successfully imported"
"file_imported_success": "File successfully imported",
"3d_labels": "Geographic names",
"3d_vegetation": "Vegetations",
"3d_constructions": "Buildings and constructions",
"webmapviewer_live_disclaimer": "Big changes are coming soon, <a target='_blank' href='https://www.swisstopo.admin.ch/en'>learn more</a>"
}
10 changes: 9 additions & 1 deletion src/modules/i18n/locales/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,10 @@
"time_hide": "Désactiver l'outil de représentation historique des données.",
"time_select_year": "Choisissez une année",
"time_show": "Activer l'outil de représentation historique des données.",
"time_slider_legend_tippy_intro": "Le time slider affiche des couleurs différentes selon que les couches temporelles aient des données ou non pour l'année sélectionnée.",
"time_slider_legend_tippy_full_data": "Données complètes",
"time_slider_legend_tippy_no_data": "Aucune donnée",
"time_slider_legend_tippy_partial_data": "Données partielles",
"title": "Titre",
"tooltip": "Tooltip",
"topic_are_tooltip": "Office fédéral du développement territorial ",
Expand Down Expand Up @@ -672,5 +676,9 @@
"no_email": "Le champ email est requis",
"file_unsupported_format": "Ce format de fichier n'est pas pris en charge. Seuls les formats suivants sont autorisés : ALLOWED_FORMATS",
"form_invalid": "Le formulaire est invalide",
"file_imported_success": "Fichier importé avec succès"
"file_imported_success": "Fichier importé avec succès",
"3d_labels": "Noms géographiques",
"3d_vegetation": "Végétations",
"3d_constructions": "Bâtiments et constructions",
"webmapviewer_live_disclaimer": "De grands changements sont à venir, <a target='_blank' href='https://www.swisstopo.admin.ch/fr'>en savoir plus</a>"
}
10 changes: 9 additions & 1 deletion src/modules/i18n/locales/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,10 @@
"time_hide": "Disattivare la visualizzazione storica dei dati",
"time_select_year": "Scegliete un anno",
"time_show": "Attivare la visualizzazione storica dei dati",
"time_slider_legend_tippy_intro": "Il cursore del tempo mostra colori diversi a seconda che gli strati temporali abbiano o meno dati per l'anno selezionato.",
"time_slider_legend_tippy_full_data": "Vollständige Daten",
"time_slider_legend_tippy_no_data": "Nessun dato",
"time_slider_legend_tippy_partial_data": "Dati parziali",
"title": "Titolo",
"tooltip": "Tooltip",
"topic_are_tooltip": "Ufficio federale dello sviluppo territoriale ",
Expand Down Expand Up @@ -672,5 +676,9 @@
"no_email": "Il campo email è obbligatorio",
"file_unsupported_format": "Questo formato file non è supportato. Sono ammessi solo i seguenti formati: ALLOWED_FORMATS",
"form_invalid": "Il modulo non è valido",
"file_imported_success": "File importato con successo"
"file_imported_success": "File importato con successo",
"3d_labels": "Nomi geografici",
"3d_vegetation": "Vegetazione",
"3d_constructions": "Edifici e costruzioni",
"webmapviewer_live_disclaimer": "Grandi cambiamenti in arrivo, <a target='_blank' href='https://www.swisstopo.admin.ch/it'>per saperne di più</a>"
}
10 changes: 9 additions & 1 deletion src/modules/i18n/locales/rm.json
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,10 @@
"time_hide": "Deactivar la visualisaziun istorica da las datas.",
"time_select_year": "Selecziunais in onn",
"time_show": "Activar la visualisaziun istorica da las datas.",
"time_slider_legend_tippy_intro": "Il temp slider mussa differentas colurs, tut tenor sche las stresas dal temp han datas per l'onn tschernì u betg.",
"time_slider_legend_tippy_full_data": "Datas entiras",
"time_slider_legend_tippy_no_data": "Naginas datas",
"time_slider_legend_tippy_partial_data": "Datas parzialas",
"title": "Titel",
"tooltip": "Tooltip",
"topic_are_tooltip": "Uffizi federal da planisaziun dal territori",
Expand Down Expand Up @@ -670,5 +674,9 @@
"no_email": "Il champ da posta eletronicala è necessari",
"file_unsupported_format": "Quest format da datoteca na vegn betg sustegnì. Sun ils seguents formats èn permess: ALLOWED_FORMATS",
"form_invalid": "Il formular è invalid",
"file_imported_success": "Datoteca importada cun success"
"file_imported_success": "Datoteca importada cun success",
"3d_labels": "Numns geografics",
"3d_vegetation": "Vegietaziun",
"3d_constructions": "Edifizis ed installaziuns",
"webmapviewer_live_disclaimer": "Grondas midadas vegnan prest, <a target='_blank' href='https://www.swisstopo.admin.ch/de'>emprender dapli</a>"
}
54 changes: 54 additions & 0 deletions src/modules/menu/components/3d/MenuThreeD.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<script setup>
import { computed, toRefs } from 'vue'
import { useStore } from 'vuex'
import MenuItemCheckBox from '@/modules/menu/components/common/MenuItemCheckBox.vue'
import { useTippyTooltip } from '@/utils/composables/useTippyTooltip'
const dispatcher = { dispatcher: 'MenuThreeD.vue' }
useTippyTooltip('.menu-three-d [data-tippy-content]')
const props = defineProps({
compact: {
type: Boolean,
default: false,
},
})
const { compact } = toRefs(props)
const store = useStore()
const labels = computed({
get: () => store.state.cesium.showLabels,
set: (value) => store.dispatch('setShowLabels', { showLabels: !!value, ...dispatcher }),
})
const vegetation = computed({
get: () => store.state.cesium.showVegetation,
set: (value) => store.dispatch('setShowVegetation', { showVegetation: !!value, ...dispatcher }),
})
const constructions = computed({
get: () => store.state.cesium.showBuildings && store.state.cesium.showConstructions,
set: (value) =>
store.dispatch('setShowConstructionsBuildings', {
showConstructionsBuildings: !!value,
...dispatcher,
}),
})
</script>

<template>
<div class="menu-three-d" data-cy="menu-three-d">
<MenuItemCheckBox v-model="labels" label="3d_labels" :compact="compact" />
<MenuItemCheckBox v-model="vegetation" label="3d_vegetation" :compact="compact" />
<MenuItemCheckBox v-model="constructions" label="3d_constructions" :compact="compact" />
</div>
</template>

<style lang="scss" scoped>
@import '@/modules/menu/scss/menu-items';
.menu-three-d {
@extend .menu-list;
overflow-y: auto;
}
</style>
15 changes: 10 additions & 5 deletions src/modules/menu/components/LayerCatalogueItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,12 @@ function containsLayer(layers, searchText) {
</script>
<template>
<div v-show="showItem" class="menu-catalogue-item" :data-cy="`catalogue-tree-item-${item.id}`">
<div
v-show="showItem"
class="menu-catalogue-item"
:class="{ compact: compact }"
:data-cy="`catalogue-tree-item-${item.id}`"
>
<div
class="menu-catalogue-item-title ps-2"
:class="{ group: hasChildren }"
Expand All @@ -244,7 +249,7 @@ function containsLayer(layers, searchText) {
>
<button
v-if="canBeAddedToTheMap"
class="btn border-0"
class="btn border-0 d-flex align-items-center"
:class="{
'text-primary': isPresentInActiveLayers,
'btn-lg': !compact,
Expand All @@ -258,7 +263,7 @@ function containsLayer(layers, searchText) {
</button>
<button
v-if="hasChildren"
class="btn border-0"
class="btn border-0 d-flex align-items-center"
:class="{
'text-primary': isPresentInActiveLayers,
'btn-lg': !compact,
Expand All @@ -280,7 +285,7 @@ function containsLayer(layers, searchText) {
</TextTruncate>
<button
v-if="item.extent?.length"
class="btn"
class="btn d-flex align-items-center"
:class="{ 'btn-lg': !compact }"
:data-cy="`catalogue-zoom-extent-button-${item.id}`"
@click.stop="zoomToLayer"
Expand All @@ -289,7 +294,7 @@ function containsLayer(layers, searchText) {
</button>
<button
v-if="hasDescription"
class="btn"
class="btn d-flex align-items-center"
:class="{ 'btn-lg': !compact }"
:data-cy="`catalogue-tree-item-info-${item.id}`"
@click.stop="showLayerDescription = true"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ function duplicateLayer() {
>
<button
v-if="showSpinner"
class="loading-button btn border-0"
class="loading-button btn border-0 d-flex align-items-center"
:class="{
'btn-lg': !compact,
}"
Expand Down Expand Up @@ -178,7 +178,7 @@ function duplicateLayer() {
/>
</ThirdPartyDisclaimer>
<button
class="btn border-0"
class="btn border-0 d-flex align-items-center"
:class="{
'btn-lg': !compact,
'flip text-primary': showLayerDetail,
Expand Down
68 changes: 68 additions & 0 deletions src/modules/menu/components/common/MenuItemCheckBox.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<script setup>
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome'
import { toRefs } from 'vue'
import { useI18n } from 'vue-i18n'
const model = defineModel({ type: Boolean })
const emits = defineEmits(['click'])
const i18n = useI18n()
const props = defineProps({
label: {
type: String,
default: '',
},
compact: {
type: Boolean,
default: false,
},
dataCy: {
type: String,
default: '',
},
})
const { compact } = toRefs(props)
function onClick(ev) {
model.value = !model.value
emits('click', ev)
}
</script>

<template>
<div class="menu-check-box-item" :class="{ compact: compact }" @click="onClick">
<div class="menu-check-box-item-title">
<button
class="btn border-0 d-flex align-items-center"
:class="{ 'btn-lg': !compact }"
:data-cy="dataCy"
>
<FontAwesomeIcon :icon="`far fa-${model ? 'check-' : ''}square`" />
</button>
<label v-if="label" class="ms-2 menu-check-box-item-name">{{ i18n.t(label) }}</label>
</div>
</div>
</template>

<style lang="scss" scoped>
@import '@/modules/menu/scss/menu-items';
.menu-check-box-item {
@extend .menu-item;
border-bottom: none;
&-title {
@extend .menu-title;
cursor: pointer;
border-bottom-width: 1px;
border-bottom-color: $gray-400;
border-bottom-style: solid;
}
&-name {
@extend .menu-name;
cursor: pointer;
}
}
</style>
2 changes: 1 addition & 1 deletion src/modules/menu/components/menu/MenuSection.vue
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export default {
default: false,
},
},
expose: ['close', 'open'],
expose: ['close', 'open', 'id'],
emits: ['openMenuSection', 'closeMenuSection', 'click:header'],
data() {
return {
Expand Down
Loading

0 comments on commit a2f8937

Please sign in to comment.