diff --git a/components.d.ts b/components.d.ts index 481364a..199b4f7 100644 --- a/components.d.ts +++ b/components.d.ts @@ -15,8 +15,10 @@ declare module 'vue' { AreaMenu: typeof import('./src/components/AreaMenu.vue')['default'] LayerLegend: typeof import('./src/components/LayerLegend.vue')['default'] LayerList: typeof import('./src/components/LayerList.vue')['default'] + MapboxHighlight: typeof import('./src/components/MapboxHighlight.vue')['default'] MapComponent: typeof import('./src/components/MapComponent.vue')['default'] MapLayer: typeof import('./src/components/MapLayer.vue')['default'] + MapZoomControl: typeof import('./src/components/MapZoomControl.vue')['default'] NavigationDrawer: typeof import('./src/components/NavigationDrawer.vue')['default'] NumberInput: typeof import('./src/components/NumberInput.vue')['default'] RouterLink: typeof import('vue-router')['RouterLink'] diff --git a/package-lock.json b/package-lock.json index 2084c7e..1296a39 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,6 +11,7 @@ "@fontsource/roboto": "5.2.7", "@mdi/font": "7.4.47", "@studiometa/vue-mapbox-gl": "^2.7.2", + "@turf/bbox": "^7.3.4", "axios": "^1.13.5", "pinia": "^3.0.3", "query-string": "^9.3.1", @@ -1710,6 +1711,48 @@ "node": ">=10" } }, + "node_modules/@turf/bbox": { + "version": "7.3.4", + "resolved": "https://registry.npmjs.org/@turf/bbox/-/bbox-7.3.4.tgz", + "integrity": "sha512-D5ErVWtfQbEPh11yzI69uxqrcJmbPU/9Y59f1uTapgwAwQHQztDWgsYpnL3ns8r1GmPWLP8sGJLVTIk2TZSiYA==", + "license": "MIT", + "dependencies": { + "@turf/helpers": "7.3.4", + "@turf/meta": "7.3.4", + "@types/geojson": "^7946.0.10", + "tslib": "^2.8.1" + }, + "funding": { + "url": "https://opencollective.com/turf" + } + }, + "node_modules/@turf/helpers": { + "version": "7.3.4", + "resolved": "https://registry.npmjs.org/@turf/helpers/-/helpers-7.3.4.tgz", + "integrity": "sha512-U/S5qyqgx3WTvg4twaH0WxF3EixoTCfDsmk98g1E3/5e2YKp7JKYZdz0vivsS5/UZLJeZDEElOSFH4pUgp+l7g==", + "license": "MIT", + "dependencies": { + "@types/geojson": "^7946.0.10", + "tslib": "^2.8.1" + }, + "funding": { + "url": "https://opencollective.com/turf" + } + }, + "node_modules/@turf/meta": { + "version": "7.3.4", + "resolved": "https://registry.npmjs.org/@turf/meta/-/meta-7.3.4.tgz", + "integrity": "sha512-tlmw9/Hs1p2n0uoHVm1w3ugw1I6L8jv9YZrcdQa4SH5FX5UY0ATrKeIvfA55FlL//PGuYppJp+eyg/0eb4goqw==", + "license": "MIT", + "dependencies": { + "@turf/helpers": "7.3.4", + "@types/geojson": "^7946.0.10", + "tslib": "^2.8.1" + }, + "funding": { + "url": "https://opencollective.com/turf" + } + }, "node_modules/@types/cacheable-request": { "version": "6.0.3", "resolved": "https://registry.npmjs.org/@types/cacheable-request/-/cacheable-request-6.0.3.tgz", @@ -6662,7 +6705,6 @@ "version": "2.8.1", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", - "devOptional": true, "license": "0BSD" }, "node_modules/type-check": { diff --git a/package.json b/package.json index 6219673..4b4b523 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,7 @@ "@fontsource/roboto": "5.2.7", "@mdi/font": "7.4.47", "@studiometa/vue-mapbox-gl": "^2.7.2", + "@turf/bbox": "^7.3.4", "axios": "^1.13.5", "pinia": "^3.0.3", "query-string": "^9.3.1", diff --git a/src/components/MapComponent.vue b/src/components/MapComponent.vue index 8fbaaf2..16166cc 100644 --- a/src/components/MapComponent.vue +++ b/src/components/MapComponent.vue @@ -14,6 +14,7 @@ :layer="layer" @click="onFeatureClick" /> + @@ -23,6 +24,8 @@ import { MapboxMap, MapboxNavigationControl } from '@studiometa/vue-mapbox-gl' import { MAP_CENTER, MAP_ZOOM, MAP_BASELAYERS, MAP_BASELAYER_DEFAULT } from '@/lib/constant' import { useMapStore } from '@/stores/map' + import MapLayer from '@/components/MapLayer.vue' + import MapZoomControl from '@/components/MapZoomControl.vue' import { computed, ref } from 'vue' const mapStore = useMapStore() const accessToken = import.meta.env.VITE_MAPBOX_TOKEN @@ -36,6 +39,10 @@ } function onFeatureClick (feature) { + if (feature == null) { + mapStore.clearActiveRegion() + return + } if (feature?.layer?.id) { mapStore.setActiveRegion(feature.layer.id, feature) } diff --git a/src/components/MapLayer.vue b/src/components/MapLayer.vue index 96e8653..c71d4cd 100644 --- a/src/components/MapLayer.vue +++ b/src/components/MapLayer.vue @@ -11,7 +11,7 @@ diff --git a/src/components/MapZoomControl.vue b/src/components/MapZoomControl.vue new file mode 100644 index 0000000..bbd30b4 --- /dev/null +++ b/src/components/MapZoomControl.vue @@ -0,0 +1,43 @@ + + + diff --git a/src/components/SubMenu.vue b/src/components/SubMenu.vue index 43e5ed0..db61b71 100644 --- a/src/components/SubMenu.vue +++ b/src/components/SubMenu.vue @@ -124,9 +124,6 @@ const context = { payload, stores } const inputs = resolveInputs(props.wps.inputs, context) - console.log("inputs", inputs) - console.log("baseUrl", baseUrl) - console.log("identifier", identifier) const result = await sendWpsRequest({ baseUrl, identifier, diff --git a/src/data/base-layers-config.json b/src/data/base-layers-config.json index ba9a390..08b1337 100644 --- a/src/data/base-layers-config.json +++ b/src/data/base-layers-config.json @@ -12,9 +12,30 @@ "layer": "region:nuts_2021_level_3", "url": "https://desirmed.openearth.eu/geoserver/gwc/service/wmts?", "format": "application/vnd.mapbox-vector-tile", + "promoteId": "nuts_id", "paint": { - "fill-color": "transparent", - "fill-opacity": 1 + "fill-color": [ + "case", + ["boolean", ["feature-state", "selected"], false], + "#ffcc00", + [ + "case", + ["boolean", ["feature-state", "hover"], false], + "#ffeb3b", + "transparent" + ] + ], + "fill-opacity": [ + "case", + ["boolean", ["feature-state", "selected"], false], + 1, + [ + "case", + ["boolean", ["feature-state", "hover"], false], + 0.9, + 0.7 + ] + ] }, "vectorType": "fill", "minZoom": 0 diff --git a/src/lib/build-wmts-layer.js b/src/lib/build-wmts-layer.js index 169fd2a..403bebe 100644 --- a/src/lib/build-wmts-layer.js +++ b/src/lib/build-wmts-layer.js @@ -11,6 +11,7 @@ function buildWmtsLayer ({ bbox = [], format, vectorType, + promoteId, minZoom, maxZoom, }) { @@ -40,6 +41,7 @@ function buildWmtsLayer ({ type: 'vector', tiles: [ tile ], ...(bbox && Array.isArray(bbox) && bbox.length > 0 && { bounds: bbox }), + ...(promoteId && { promoteId: { [layer.split(':')[1]]: promoteId } }), }, 'source-layer': layer.split(':')[1], paint,