From 89e2fab5edb33d5e5a26a0b4061248823d3d16cf Mon Sep 17 00:00:00 2001 From: Vincent De Oliveira Date: Tue, 18 Apr 2023 17:07:56 +0200 Subject: [PATCH 01/31] Fix counter's style to match other icons --- src/components/yeti/Counter.vue | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/components/yeti/Counter.vue b/src/components/yeti/Counter.vue index ef09dff4d8..9078b88be8 100644 --- a/src/components/yeti/Counter.vue +++ b/src/components/yeti/Counter.vue @@ -1,6 +1,6 @@ @@ -20,17 +20,22 @@ export default { .yeti-counter { display: inline-block; - width: 1.1rem; - height: 1.1rem; - vertical-align: 0.1rem; + min-width: 1em; + height: 1em; + line-height: 1em; margin-left: 0.25rem; + padding: 0 0.25rem; background: $grey-lighter; color: $grey-darker; - border-radius: 50%; - font-size: 0.72em; + border-radius: 1em; font-weight: normal; text-align: center; + span { + font-size: 0.72em; + vertical-align: 0.125em; + } + &.has-background-primary { color: $white; } From 7c43872c1084731c17548beb55406f2c93bc6a80 Mon Sep 17 00:00:00 2001 From: Vincent De Oliveira Date: Tue, 18 Apr 2023 17:17:06 +0200 Subject: [PATCH 02/31] Better style for IconLayer's icons --- src/components/yeti/map-layers/IconLayer.vue | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/components/yeti/map-layers/IconLayer.vue b/src/components/yeti/map-layers/IconLayer.vue index eaecf2f81f..d3460d7f97 100644 --- a/src/components/yeti/map-layers/IconLayer.vue +++ b/src/components/yeti/map-layers/IconLayer.vue @@ -64,9 +64,9 @@ export default { }, created() { this.icon = (color) => { - let svg = ` - - ${this.letter} + let svg = ` + + ${this.letter} `; return 'data:image/svg+xml;charset=utf-8,' + encodeURIComponent(svg); }; @@ -74,7 +74,7 @@ export default { this.style = new ol.style.Style({ image: new ol.style.Icon({ src: this.icon(this.color), - size: [20, 20], + size: [26, 26], }), }); @@ -196,8 +196,8 @@ export default { .overlay-icon { position: absolute; transform: scale(1.3); - top: -4px; - left: -6px; /* iconSize / 2 */ + top: -7px; + left: -10px; /* iconSize / 2 */ margin: auto; z-index: 2; pointer-events: none; From 5648ba2314d038132a62c8d8ec101c6f369da86a Mon Sep 17 00:00:00 2001 From: Vincent De Oliveira Date: Tue, 18 Apr 2023 17:37:06 +0200 Subject: [PATCH 03/31] New layout --- src/components/yeti/SubPanelTitle.vue | 5 ++-- src/components/yeti/YetiMap.vue | 1 + src/views/portals/YetiView.vue | 39 +++++++++++++-------------- 3 files changed, 22 insertions(+), 23 deletions(-) diff --git a/src/components/yeti/SubPanelTitle.vue b/src/components/yeti/SubPanelTitle.vue index 2d2886a33b..0035e08b5f 100644 --- a/src/components/yeti/SubPanelTitle.vue +++ b/src/components/yeti/SubPanelTitle.vue @@ -1,7 +1,7 @@
-

+

@@ -14,7 +14,8 @@ h2 { display: inline-block; margin-left: -1.25rem; - padding: 0.25em 1.25rem; + padding: 0.25em 0.5rem; background: $grey-lighter; + text-transform: uppercase; } diff --git a/src/components/yeti/YetiMap.vue b/src/components/yeti/YetiMap.vue index 1f292d7841..7628fddb89 100644 --- a/src/components/yeti/YetiMap.vue +++ b/src/components/yeti/YetiMap.vue @@ -527,6 +527,7 @@ $yeti-height: calc( .map-container { position: relative; + padding-left: 0; } @media screen and (max-width: $tablet) { .map-container { diff --git a/src/views/portals/YetiView.vue b/src/views/portals/YetiView.vue index 2e1472aab7..88c0d3e93b 100644 --- a/src/views/portals/YetiView.vue +++ b/src/views/portals/YetiView.vue @@ -1,17 +1,8 @@ @@ -63,6 +70,7 @@ import RommaLayer from './map-layers/RommaLayer.vue'; import RouteLayer from './map-layers/RouteLayer.vue'; import YetiLayer from './map-layers/YetiLayer.vue'; +import Toast from '@/components/yeti/Toast'; import Yetix from '@/components/yeti/Yetix'; import photon from '@/js/apis/photon'; import ol from '@/js/libs/ol'; @@ -80,6 +88,7 @@ export default { NivosesLayer, RommaLayer, RouteLayer, + Toast, YetiLayer, }, props: { @@ -219,6 +228,10 @@ export default { onDrawingMode() { Yetix.setDrawingMode(!this.drawingMode); }, + activeLayersTab() { + this.$refs['toast-layer'].toast(); + Yetix.setActiveTab(0); + }, }, }; From 5e81f969a88d3d2e837120fb5dcb6b0f4f4cadd5 Mon Sep 17 00:00:00 2001 From: Vincent De Oliveira Date: Wed, 19 Apr 2023 15:53:50 +0200 Subject: [PATCH 13/31] Set maxZoom to 16 for IGN maps --- src/components/yeti/map-layers/BaseLayers.vue | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/components/yeti/map-layers/BaseLayers.vue b/src/components/yeti/map-layers/BaseLayers.vue index eba379bc1e..415ae8526f 100644 --- a/src/components/yeti/map-layers/BaseLayers.vue +++ b/src/components/yeti/map-layers/BaseLayers.vue @@ -24,6 +24,14 @@ export default { return layer.get('country') !== 'gb'; }); + this.baseLayers = this.baseLayers.map((layer) => { + // set maxzoom to 16 for IGN maps + if (layer.get('title') === 'IGN maps') { + layer.getSource().tileGrid.maxZoom = 16; + } + return layer; + }); + // create layers selector let baseLayersSelector = this.baseLayers.map((layer) => { return { From 6f48ada8ebfc403c02829b9a51b95a0d0bfb5996 Mon Sep 17 00:00:00 2001 From: Vincent De Oliveira Date: Mon, 13 Nov 2023 09:37:41 +0100 Subject: [PATCH 14/31] Fix: strokes should always be on top --- .../yeti/map-layers/AvalancheBulletinsLayer.vue | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/components/yeti/map-layers/AvalancheBulletinsLayer.vue b/src/components/yeti/map-layers/AvalancheBulletinsLayer.vue index 1e977940dd..90e1b33ded 100644 --- a/src/components/yeti/map-layers/AvalancheBulletinsLayer.vue +++ b/src/components/yeti/map-layers/AvalancheBulletinsLayer.vue @@ -95,10 +95,6 @@ let mountainsStyle = (feature, mapZoom, danger) => { let styles = [ new ol.style.Style({ - stroke: new ol.style.Stroke({ - color: 'rgba(0, 0, 0, 0.85)', - width: strokeWidth, - }), fill: new ol.style.Fill({ color: `rgba(${dangerFill[danger]}, ${opacity})`, }), @@ -116,6 +112,16 @@ let mountainsStyle = (feature, mapZoom, danger) => { ); } + // add stroke on top + styles.push( + new ol.style.Style({ + stroke: new ol.style.Stroke({ + color: 'rgba(0, 0, 0, 0.85)', + width: strokeWidth, + }), + }) + ); + return styles; }; From 080358c493ab714d047448712ffe127052139d9b Mon Sep 17 00:00:00 2001 From: Vincent De Oliveira Date: Mon, 13 Nov 2023 12:07:01 +0100 Subject: [PATCH 15/31] Remove "Force elevations" option --- src/components/yeti/ElevationProfile.vue | 67 ++++++++---------------- 1 file changed, 22 insertions(+), 45 deletions(-) diff --git a/src/components/yeti/ElevationProfile.vue b/src/components/yeti/ElevationProfile.vue index fb1329d49c..5126e8c9dc 100644 --- a/src/components/yeti/ElevationProfile.vue +++ b/src/components/yeti/ElevationProfile.vue @@ -9,35 +9,29 @@ Add more points -
- - - - Too much points - - - Invalid value +
+
+ + + + Too much points + + + Invalid value + +
+ +

Will generate new points along route, at regular interval, defined by distance in meters

- -

Will generate new points along route, at regular interval, defined by distance in meters

-
-
-
- - Force elevations -
- -

If checked, all elevations will be recomputed and current values will be lost

-
@@ -81,7 +75,6 @@ export default { loading: false, interpolate: false, interpolateValue: 50, - override: false, i18n_: { elevation_legend: this.$gettext('Elevation (m)'), distance_legend: this.$gettext('Distance (km)'), @@ -90,9 +83,6 @@ export default { actionDisabled: this.$gettext('Action is disabled. You must confirm simplified geometry first.'), fromApi: this.$gettext('One or more route could not be processed:'), interpolateValue: this.$gettext('Interpolate value should be a number > 0'), - overrideElevation: this.$gettext( - 'Features already have elevations. Enable "Force elevations" if you want to override them.' - ), tooMuchPoints: this.$gettext( 'One or more line chunks will generate more than 3000 points. Adjust distance to generate less points.' ), @@ -109,13 +99,6 @@ export default { validSimplifyTolerance() { return Yetix.validSimplifyTolerance; }, - atLeastOneFeatureHas3D() { - let features = this.features.filter((feature) => { - let coords = feature.getGeometry().getCoordinates(); - return !coords.some((coord) => coord.length >= 3 && coord[2] !== 0); - }); - return features.length === 0; - }, atLeastOneLineChunkHasTooMuchPoints() { if (this.interpolateValueInvalid) { return false; @@ -185,18 +168,12 @@ export default { if (this.interpolateValueInvalid) { return window.alert(this.errors.interpolateValue); } - if (!this.override && this.atLeastOneFeatureHas3D) { - return window.alert(this.errors.overrideElevation); - } // start loading this.loading = true; // and defer (next cycle) setTimeout(() => { - if (this.override) { - // when elevation is forced, start by removing all elevations - this.removeAllElevations(); - } - + // start by removing all elevations + this.removeAllElevations(); // interpolateValue is 5 meters min, or 0 if not checked let interpolateValue = this.interpolate ? Math.max(MIN_INTERPOLATE_VALUE, this.interpolateValue) : 0; From bb3f3a33f26f69d5aaeb6881cde028693a62d62f Mon Sep 17 00:00:00 2001 From: Vincent De Oliveira Date: Tue, 14 Nov 2023 16:30:19 +0100 Subject: [PATCH 16/31] Move yetiData/yetiExtent to Yetix --- src/components/yeti/YetiMap.vue | 12 +-------- src/components/yeti/Yetix.vue | 15 +++++++++++ src/components/yeti/map-layers/YetiLayer.vue | 26 +++++++++----------- src/views/portals/YetiView.vue | 10 +++----- 4 files changed, 31 insertions(+), 32 deletions(-) diff --git a/src/components/yeti/YetiMap.vue b/src/components/yeti/YetiMap.vue index f19cf187ee..6dc217f2bb 100644 --- a/src/components/yeti/YetiMap.vue +++ b/src/components/yeti/YetiMap.vue @@ -4,7 +4,7 @@
- + @@ -91,16 +91,6 @@ export default { Toast, YetiLayer, }, - props: { - yetiExtent: { - type: Array, - required: true, - }, - yetiData: { - type: String, - default: null, - }, - }, data() { return { recenterPropositions: null, diff --git a/src/components/yeti/Yetix.vue b/src/components/yeti/Yetix.vue index ea2bdeda79..c0b4482792 100644 --- a/src/components/yeti/Yetix.vue +++ b/src/components/yeti/Yetix.vue @@ -46,6 +46,9 @@ let defaultState = { showYeti: false, yetiOk: false, + yetiData: null, + yetiExtent: [], + areas: [], areaOk: true, showAreas: false, @@ -133,6 +136,12 @@ export default new Vue({ yetiOk() { return state.yetiOk; }, + yetiData() { + return state.yetiData; + }, + yetiExtent() { + return state.yetiExtent; + }, areas() { return state.areas; }, @@ -220,6 +229,12 @@ export default new Vue({ this.setShowYeti(true); } }, + setYetiData(yetiData) { + state.yetiData = yetiData; + }, + setYetiExtent(yetiExtent) { + state.yetiExtent = yetiExtent; + }, setAreas(areas) { state.areas = areas; }, diff --git a/src/components/yeti/map-layers/YetiLayer.vue b/src/components/yeti/map-layers/YetiLayer.vue index d34c4b62df..631105c233 100644 --- a/src/components/yeti/map-layers/YetiLayer.vue +++ b/src/components/yeti/map-layers/YetiLayer.vue @@ -37,16 +37,6 @@ import ol from '@/js/libs/ol'; export default { mixins: [layerMixin], - props: { - data: { - type: String, - default: null, - }, - extent: { - type: Array, - required: true, - }, - }, data() { return { showLegend: undefined, @@ -54,6 +44,12 @@ export default { }; }, computed: { + yetiData() { + return Yetix.yetiData; + }, + yetiExtent() { + return Yetix.yetiExtent; + }, showAreas() { return Yetix.showAreas; }, @@ -65,15 +61,15 @@ export default { }, }, watch: { - data() { - if (!this.data) { + yetiData() { + if (!this.yetiData) { this.clearLayers(); return; } this.drawImage(); }, - extent() { - this.drawExtent(this.extent); + yetiExtent() { + this.drawExtent(this.yetiExtent); }, showAreas() { // switch classname when showareas updates @@ -147,7 +143,7 @@ export default { this.extentLayer.getSource().addFeature(feature); }, drawImage() { - let xml = new DOMParser().parseFromString(this.data, 'application/xml'); + let xml = new DOMParser().parseFromString(this.yetiData, 'application/xml'); let imageBase64 = xml.getElementsByTagName('wps:ComplexData')[0].textContent; let imageBbox = xml.getElementsByTagName('wps:ComplexData')[1].textContent; let imageExtent = ol.proj.transformExtent(imageBbox.split(',').map(Number), 'EPSG:4326', 'EPSG:3857'); diff --git a/src/views/portals/YetiView.vue b/src/views/portals/YetiView.vue index b90291654e..e7f7231606 100644 --- a/src/views/portals/YetiView.vue +++ b/src/views/portals/YetiView.vue @@ -94,7 +94,7 @@
- + @@ -153,8 +153,6 @@ export default { currentError: undefined, promise: null, - yetiData: null, - yetiExtent: [], }; }, @@ -359,7 +357,7 @@ export default { const yetiUrl = this.getYetiUrl(extendedExtent); // first, set data to null (will remove last one) - this.yetiData = null; + Yetix.setYetiData(null); // fetch img this.promise = axios @@ -375,8 +373,8 @@ export default { }, onYetiResult(result, extendedExtent) { - this.yetiData = result.data; - this.yetiExtent = extendedExtent; + Yetix.setYetiData(result.data); + Yetix.setYetiExtent(extendedExtent); this.promise = null; }, From ecc17c7edea3c6e2e76f0c2fb235ac67a359011a Mon Sep 17 00:00:00 2001 From: Vincent De Oliveira Date: Tue, 14 Nov 2023 16:39:30 +0100 Subject: [PATCH 17/31] Move all layer selectors on their own component --- src/components/yeti/SubPanelLayers.vue | 116 ++---------------- src/components/yeti/YetiMap.vue | 24 +--- src/components/yeti/Yetix.vue | 35 +++++- src/components/yeti/map-layers/AreaLayer.vue | 25 +++- .../map-layers/AvalancheBulletinsLayer.vue | 16 ++- .../yeti/map-layers/FlowcaptLayer.vue | 11 +- src/components/yeti/map-layers/IconLayer.vue | 18 ++- .../yeti/map-layers/NivosesLayer.vue | 11 +- .../yeti/map-layers/OverlaysLayers.vue | 33 +++++ src/components/yeti/map-layers/RommaLayer.vue | 11 +- src/components/yeti/map-layers/YetiLayer.vue | 38 ++++-- src/components/yeti/map-layers/YetiLayers.vue | 27 ++++ .../yeti/map-layers/layer-selector-watcher.js | 10 ++ 13 files changed, 231 insertions(+), 144 deletions(-) create mode 100644 src/components/yeti/map-layers/OverlaysLayers.vue create mode 100644 src/components/yeti/map-layers/YetiLayers.vue create mode 100644 src/components/yeti/map-layers/layer-selector-watcher.js diff --git a/src/components/yeti/SubPanelLayers.vue b/src/components/yeti/SubPanelLayers.vue index d9e42c8bf6..82b63ac86f 100644 --- a/src/components/yeti/SubPanelLayers.vue +++ b/src/components/yeti/SubPanelLayers.vue @@ -4,7 +4,7 @@ Overlays
- + - {{ yetiLayerSelector.title }} + {{ layer.title }}