Skip to content

Commit

Permalink
wip: Provide a selection manager component - reset style action (#1098)
Browse files Browse the repository at this point in the history
  • Loading branch information
claustres committed Feb 21, 2025
1 parent 6ae067b commit f1b4271
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 10 deletions.
18 changes: 18 additions & 0 deletions map/client/components/selection/KSelectedLayerFeatures.vue
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,12 @@ const layerActions = computed(() => {
icon: 'las la-edit',
handler: editSelectedFeatures,
visible: isLayerDataEditable(props.item.layer)
}, {
id: 'reset-style-selected-features',
label: 'KSelectedLayerFeatures.RESET_FEATURES_STYLE_LABEL',
icon: 'las la-paint-brush',
handler: resetSelectedFeaturesStyle,
visible: isLayerDataEditable(props.item.layer)
}, {
id: 'remove-selected-features',
label: 'KSelectedLayerFeatures.REMOVE_FEATURES_LABEL',
Expand Down Expand Up @@ -128,6 +134,12 @@ const featureActions = computed(() => {
icon: 'las la-address-card',
handler: editSelectedFeatureProperties,
visible: isLayerDataEditable(props.item.layer) && _.get(props.item.layer, 'schema.content')
}, {
id: 'reset-style-selected-feature',
label: 'KSelectedLayerFeatures.RESET_FEATURE_STYLE_LABEL',
icon: 'las la-paint-brush',
handler: resetSelectedFeatureStyle,
visible: isLayerDataEditable(props.item.layer)
}, {
id: 'remove-selected-feature',
label: 'KSelectedLayerFeatures.REMOVE_FEATURE_LABEL',
Expand Down Expand Up @@ -247,6 +259,12 @@ function editSelectedFeatureProperties (feature) {
})
})
}
function resetSelectedFeaturesStyle () {
CurrentActivity.value.editFeaturesStyle({ type: 'FeatureCollection', features: props.item.features.map(feature => Object.assign(feature, { style: {} })) }, props.item.layer)
}
function resetSelectedFeatureStyle (feature) {
CurrentActivity.value.editFeaturesStyle(Object.assign(feature, { style: {} }), props.item.layer)
}
function removeSelectedFeatures () {
Dialog.create({
title: i18n.t('KSelectedLayerFeatures.REMOVE_FEATURES_DIALOG_TITLE'),
Expand Down
12 changes: 7 additions & 5 deletions map/client/i18n/map_en.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
"DISPLAY_POSITION": "Display the coordinates",
"DISPLAY_LEGEND": "Display legend",
"DISPLAY_SELECTION": "Display selection",
"DISPLAY_STYLE_MANAGER": "Display style manager",
"DISPLAY_STYLES": "Display styles",
"HIDE_LEGEND": "Hide legend",
"SEARCH_LOCATION": "Search a location",
"ADD_VIEW": "Add view",
Expand Down Expand Up @@ -524,12 +524,14 @@
},
"KSelectedLayerFeatures": {
"FEATURE_PROPERTIES_LABEL": "Feature properties",
"ZOOM_TO_FEATURES_LABEL": "Zoom to layer features",
"EDIT_FEATURES_LABEL": "Edit layer elements",
"REMOVE_FEATURES_LABEL": "Remove layer features",
"ZOOM_TO_FEATURES_LABEL": "Zoom to features",
"EDIT_FEATURES_LABEL": "Edit features",
"RESET_FEATURES_STYLE_LABEL": "Reset features style",
"REMOVE_FEATURES_LABEL": "Remove features",
"ZOOM_TO_FEATURE_LABEL": "Zoom to feature",
"EDIT_FEATURE_LABEL": "Edit feature",
"EDIT_FEATURE_PROPERTIES_LABEL": "Edit feature properties",
"RESET_FEATURE_STYLE_LABEL": "Reset feature style",
"REMOVE_FEATURE_LABEL": "Remove feature",
"REMOVE_FEATURE_DIALOG_TITLE": "Remove this feature ?",
"REMOVE_FEATURE_DIALOG_MESSAGE": "Are you sure you want to remove this feature from your workspace ?",
Expand Down Expand Up @@ -748,7 +750,7 @@
"COMPASS": "Compass"
},
"KStyleManager": {
"TITLE": "Style manager",
"TITLE": "Styles",
"APPLY_TO_SELECTION": "Apply style to selection",
"EDIT": "Edit style",
"DELETE": "Delete style",
Expand Down
12 changes: 7 additions & 5 deletions map/client/i18n/map_fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
"DISPLAY_POSITION": "Afficher les coordonnées",
"DISPLAY_LEGEND": "Afficher la légende",
"DISPLAY_SELECTION": "Afficher la sélection",
"DISPLAY_STYLE_MANAGER": "Afficher le gestionnaire de style",
"DISPLAY_STYLES": "Afficher les styles",
"HIDE_LEGEND": "Masquer la légende",
"SEARCH_LOCATION": "Rechercher un lieu",
"ADD_VIEW": "Ajouter une vue",
Expand Down Expand Up @@ -523,12 +523,14 @@
},
"KSelectedLayerFeatures": {
"FEATURE_PROPERTIES_LABEL": "Propriétés de l'élément",
"ZOOM_TO_FEATURES_LABEL": "Zoomer sur les éléments de la couche",
"EDIT_FEATURES_LABEL": "Editer les éléments de la couche",
"REMOVE_FEATURES_LABEL": "Supprimer les éléments de la couche",
"ZOOM_TO_FEATURES_LABEL": "Zoomer sur les éléments",
"EDIT_FEATURES_LABEL": "Editer les éléments",
"RESET_FEATURES_STYLE_LABEL": "Réinitialiser le style",
"REMOVE_FEATURES_LABEL": "Supprimer les éléments",
"ZOOM_TO_FEATURE_LABEL": "Zoomer sur l'élément",
"EDIT_FEATURE_LABEL": "Editer l'élément",
"EDIT_FEATURE_PROPERTIES_LABEL": "Editer les propriétés de l'élément",
"RESET_FEATURE_STYLE_LABEL": "Réinitialiser le style",
"REMOVE_FEATURE_LABEL": "Supprimer l'élément",
"REMOVE_FEATURE_DIALOG_TITLE": "Supprimer l'élément ?",
"REMOVE_FEATURE_DIALOG_MESSAGE": "Etes vous sûr de vouloir supprimer l'élément de votre espace de travail ?",
Expand Down Expand Up @@ -752,7 +754,7 @@
"COMPASS": "Boussole"
},
"KStyleManager": {
"TITLE": "Gestionnaire de styles",
"TITLE": "Styles",
"APPLY_TO_SELECTION": "Appliquer le style à la sélection",
"EDIT": "Modifier le style",
"DELETE": "Supprimer le style",
Expand Down
1 change: 1 addition & 0 deletions map/client/mixins/mixin.feature-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ export const featureService = {
createFeatures: features.createFeatures,
editFeaturesGeometry: features.editFeaturesGeometry,
editFeaturesProperties: features.editFeaturesProperties,
editFeaturesStyle: features.editFeaturesStyle,
removeFeatures: features.removeFeatures,
onFeatureUpdated (feature, layer) {
// Find related layer, either directly given in feature if coming from user-defined features service
Expand Down

0 comments on commit f1b4271

Please sign in to comment.