Skip to content

Commit f1b4271

Browse files
committed
wip: Provide a selection manager component - reset style action (#1098)
1 parent 6ae067b commit f1b4271

File tree

4 files changed

+33
-10
lines changed

4 files changed

+33
-10
lines changed

map/client/components/selection/KSelectedLayerFeatures.vue

+18
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,12 @@ const layerActions = computed(() => {
9494
icon: 'las la-edit',
9595
handler: editSelectedFeatures,
9696
visible: isLayerDataEditable(props.item.layer)
97+
}, {
98+
id: 'reset-style-selected-features',
99+
label: 'KSelectedLayerFeatures.RESET_FEATURES_STYLE_LABEL',
100+
icon: 'las la-paint-brush',
101+
handler: resetSelectedFeaturesStyle,
102+
visible: isLayerDataEditable(props.item.layer)
97103
}, {
98104
id: 'remove-selected-features',
99105
label: 'KSelectedLayerFeatures.REMOVE_FEATURES_LABEL',
@@ -128,6 +134,12 @@ const featureActions = computed(() => {
128134
icon: 'las la-address-card',
129135
handler: editSelectedFeatureProperties,
130136
visible: isLayerDataEditable(props.item.layer) && _.get(props.item.layer, 'schema.content')
137+
}, {
138+
id: 'reset-style-selected-feature',
139+
label: 'KSelectedLayerFeatures.RESET_FEATURE_STYLE_LABEL',
140+
icon: 'las la-paint-brush',
141+
handler: resetSelectedFeatureStyle,
142+
visible: isLayerDataEditable(props.item.layer)
131143
}, {
132144
id: 'remove-selected-feature',
133145
label: 'KSelectedLayerFeatures.REMOVE_FEATURE_LABEL',
@@ -247,6 +259,12 @@ function editSelectedFeatureProperties (feature) {
247259
})
248260
})
249261
}
262+
function resetSelectedFeaturesStyle () {
263+
CurrentActivity.value.editFeaturesStyle({ type: 'FeatureCollection', features: props.item.features.map(feature => Object.assign(feature, { style: {} })) }, props.item.layer)
264+
}
265+
function resetSelectedFeatureStyle (feature) {
266+
CurrentActivity.value.editFeaturesStyle(Object.assign(feature, { style: {} }), props.item.layer)
267+
}
250268
function removeSelectedFeatures () {
251269
Dialog.create({
252270
title: i18n.t('KSelectedLayerFeatures.REMOVE_FEATURES_DIALOG_TITLE'),

map/client/i18n/map_en.json

+7-5
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
"DISPLAY_POSITION": "Display the coordinates",
8181
"DISPLAY_LEGEND": "Display legend",
8282
"DISPLAY_SELECTION": "Display selection",
83-
"DISPLAY_STYLE_MANAGER": "Display style manager",
83+
"DISPLAY_STYLES": "Display styles",
8484
"HIDE_LEGEND": "Hide legend",
8585
"SEARCH_LOCATION": "Search a location",
8686
"ADD_VIEW": "Add view",
@@ -524,12 +524,14 @@
524524
},
525525
"KSelectedLayerFeatures": {
526526
"FEATURE_PROPERTIES_LABEL": "Feature properties",
527-
"ZOOM_TO_FEATURES_LABEL": "Zoom to layer features",
528-
"EDIT_FEATURES_LABEL": "Edit layer elements",
529-
"REMOVE_FEATURES_LABEL": "Remove layer features",
527+
"ZOOM_TO_FEATURES_LABEL": "Zoom to features",
528+
"EDIT_FEATURES_LABEL": "Edit features",
529+
"RESET_FEATURES_STYLE_LABEL": "Reset features style",
530+
"REMOVE_FEATURES_LABEL": "Remove features",
530531
"ZOOM_TO_FEATURE_LABEL": "Zoom to feature",
531532
"EDIT_FEATURE_LABEL": "Edit feature",
532533
"EDIT_FEATURE_PROPERTIES_LABEL": "Edit feature properties",
534+
"RESET_FEATURE_STYLE_LABEL": "Reset feature style",
533535
"REMOVE_FEATURE_LABEL": "Remove feature",
534536
"REMOVE_FEATURE_DIALOG_TITLE": "Remove this feature ?",
535537
"REMOVE_FEATURE_DIALOG_MESSAGE": "Are you sure you want to remove this feature from your workspace ?",
@@ -748,7 +750,7 @@
748750
"COMPASS": "Compass"
749751
},
750752
"KStyleManager": {
751-
"TITLE": "Style manager",
753+
"TITLE": "Styles",
752754
"APPLY_TO_SELECTION": "Apply style to selection",
753755
"EDIT": "Edit style",
754756
"DELETE": "Delete style",

map/client/i18n/map_fr.json

+7-5
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
"DISPLAY_POSITION": "Afficher les coordonnées",
8181
"DISPLAY_LEGEND": "Afficher la légende",
8282
"DISPLAY_SELECTION": "Afficher la sélection",
83-
"DISPLAY_STYLE_MANAGER": "Afficher le gestionnaire de style",
83+
"DISPLAY_STYLES": "Afficher les styles",
8484
"HIDE_LEGEND": "Masquer la légende",
8585
"SEARCH_LOCATION": "Rechercher un lieu",
8686
"ADD_VIEW": "Ajouter une vue",
@@ -523,12 +523,14 @@
523523
},
524524
"KSelectedLayerFeatures": {
525525
"FEATURE_PROPERTIES_LABEL": "Propriétés de l'élément",
526-
"ZOOM_TO_FEATURES_LABEL": "Zoomer sur les éléments de la couche",
527-
"EDIT_FEATURES_LABEL": "Editer les éléments de la couche",
528-
"REMOVE_FEATURES_LABEL": "Supprimer les éléments de la couche",
526+
"ZOOM_TO_FEATURES_LABEL": "Zoomer sur les éléments",
527+
"EDIT_FEATURES_LABEL": "Editer les éléments",
528+
"RESET_FEATURES_STYLE_LABEL": "Réinitialiser le style",
529+
"REMOVE_FEATURES_LABEL": "Supprimer les éléments",
529530
"ZOOM_TO_FEATURE_LABEL": "Zoomer sur l'élément",
530531
"EDIT_FEATURE_LABEL": "Editer l'élément",
531532
"EDIT_FEATURE_PROPERTIES_LABEL": "Editer les propriétés de l'élément",
533+
"RESET_FEATURE_STYLE_LABEL": "Réinitialiser le style",
532534
"REMOVE_FEATURE_LABEL": "Supprimer l'élément",
533535
"REMOVE_FEATURE_DIALOG_TITLE": "Supprimer l'élément ?",
534536
"REMOVE_FEATURE_DIALOG_MESSAGE": "Etes vous sûr de vouloir supprimer l'élément de votre espace de travail ?",
@@ -752,7 +754,7 @@
752754
"COMPASS": "Boussole"
753755
},
754756
"KStyleManager": {
755-
"TITLE": "Gestionnaire de styles",
757+
"TITLE": "Styles",
756758
"APPLY_TO_SELECTION": "Appliquer le style à la sélection",
757759
"EDIT": "Modifier le style",
758760
"DELETE": "Supprimer le style",

map/client/mixins/mixin.feature-service.js

+1
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ export const featureService = {
6969
createFeatures: features.createFeatures,
7070
editFeaturesGeometry: features.editFeaturesGeometry,
7171
editFeaturesProperties: features.editFeaturesProperties,
72+
editFeaturesStyle: features.editFeaturesStyle,
7273
removeFeatures: features.removeFeatures,
7374
onFeatureUpdated (feature, layer) {
7475
// Find related layer, either directly given in feature if coming from user-defined features service

0 commit comments

Comments
 (0)