diff --git a/src/assets/js/map-util.js b/src/assets/js/map-util.js index 30345ad853097db80e45c575f45dc9844ab865bf..4c2434bff8808af4071d7c522c5fc2ff601962a0 100644 --- a/src/assets/js/map-util.js +++ b/src/assets/js/map-util.js @@ -300,88 +300,30 @@ const mapUtil = { vectorTileLayerStyles: { default: (properties) => { const featureType = featureTypes.find((x) => x.slug.split('-')[0] === '' + properties.feature_type_id); - // Look for a custom field - let customField; - let customFieldOption; - if ( - featureType.customfield_set && - Object.keys(properties).some(el => featureType.customfield_set.map(e => e.name).includes(el)) - ) { - customField = Object.keys(properties) - .filter(el => featureType.customfield_set.map(e => e.name).includes(el)); - customFieldOption = properties[customField[0]]; - } const color = this.retrieveFeatureColor(featureType, properties); - const colorValue = - color.value && color.value.length ? - color.value : typeof color === 'string' && color.length ? - color : '#000000'; + color.value && color.value.length ? + color.value : typeof color === 'string' && color.length ? + color : '#000000'; const hiddenStyle = ({ - iconHTML: null, - iconSize: [20, 20], - className: 'myDivIcon' + radius: 0, + fillOpacity: 0.5, + weight: 0, + fill: false, + color: featureType.color, }); - let defaultStyle; + const defaultStyle = { + radius: 4, + fillOpacity: 0.5, + weight: 3, + fill: true, + color: colorValue, + }; + - if ( - customFieldOption && - featureType.colors_style && - featureType.colors_style.value && - featureType.colors_style.value.icons && - !!Object.keys(featureType.colors_style.value.icons).length - ) { - if ( - featureType.colors_style.value.icons[customFieldOption] && - featureType.colors_style.value.icons[customFieldOption] !== 'circle' - ) { - const iconHTML = ` - <i - class="fas fa-${featureType.colors_style.value.icons[customFieldOption]} fa-lg" - style="color: ${colorValue}" - ></i> - `; - defaultStyle = { - iconHTML: iconHTML, - iconSize: [20, 20], - className: 'myDivIcon' - }; - } else { - defaultStyle = { - radius: 4, - fillOpacity: 0.5, - weight: 3, - fill: true, - color: colorValue, - }; - } - } else { - if (featureType.icon && featureType.icon !== 'circle') { - const iconHTML = ` - <i - class="fas fa-${featureType.icon} fa-lg" - style="color: ${colorValue}" - ></i> - `; - defaultStyle = { - iconHTML: iconHTML, - iconSize: [20, 20], - className: 'myDivIcon' - }; - } else { - defaultStyle = { - radius: 4, - fillOpacity: 0.5, - weight: 3, - fill: true, - color: colorValue, - }; - } - } - // Filtre sur le feature type if (form_filters && form_filters.type.selected) { if (featureType.title !== form_filters.type.selected) { @@ -401,7 +343,7 @@ const mapUtil = { } } return defaultStyle; - } + }, }, // subdomains: "0123", // key: 'abcdefghi01234567890',