From 95846ef248fd5618bafdf5a10db28f682a0140dd Mon Sep 17 00:00:00 2001 From: Damon Ulmi <63123585+DamonU2@users.noreply.github.com> Date: Fri, 13 Dec 2024 15:14:27 -0800 Subject: [PATCH] fix(style): ESRI Dynamic handles multiple styles with same label Closes #2597 --- .../configs/navigator/16-esri-dynamic.json | 282 +++++++++++++----- .../configs/navigator/17-esri-feature.json | 161 ++++++---- .../legend-event-processor.ts | 20 +- .../layer/gv-layers/raster/gv-esri-dynamic.ts | 63 ++-- packages/geoview-core/src/geo/layer/layer.ts | 8 +- .../src/geo/utils/renderer/esri-renderer.ts | 20 +- 6 files changed, 403 insertions(+), 151 deletions(-) diff --git a/packages/geoview-core/public/configs/navigator/16-esri-dynamic.json b/packages/geoview-core/public/configs/navigator/16-esri-dynamic.json index a16aa387b6e..d640d0c6658 100644 --- a/packages/geoview-core/public/configs/navigator/16-esri-dynamic.json +++ b/packages/geoview-core/public/configs/navigator/16-esri-dynamic.json @@ -43,15 +43,26 @@ "Point": { "type": "uniqueValue", "hasDefault": true, - "fields": ["E_Regulated", "E_SampleType", "E_Overall_Condition"], + "fields": [ + "E_Regulated", + "E_SampleType", + "E_Overall_Condition" + ], "info": [ { "visible": true, "label": "Natural, Seasonal, High", - "values": ["Natural", "Seasonal", "High"], + "values": [ + "Natural", + "Seasonal", + "High" + ], "settings": { "mimeType": "image/png", - "offset": [0, 0], + "offset": [ + 0, + 0 + ], "opacity": 1, "rotation": 0, "src": "iVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAYAAAAfSC3RAAAAAXNSR0IB2cksfwAAAAlwSFlzAAAOxAAADsQBlSsOGwAAAcNJREFUKJFjYSATsCBz/v//z/Tp8+fwO/cf273/+FmckZHxn6iQwBMVJbldXJyc27Bq/P//v8jVm3cmtUxf7rX+3nN+ZEVJ+srhd+8/3KikIFfMyMj4Fa7x////zBeu3JjuXDM55Ou//xjOmnfxrsS+8t7Uze1FLAwMDClwjU+fv0irmLzYH5smGHjw/TdTz7yVIe/ef9wiJMi/gYWBgYHhxp2HXgeev2dFVtjhb8Pw7dtPhqbdp+FiCy894E+4cz+IgYEBovHDp88qyJpmxngwxIf5wfnImt+9f68Ed+rff3/ZkTVycnDA2dxcHMhSDH/+/WeHa+Tm5HzJwMCgCJMsW7SZgYmZkeHHj18M5RsPo2jk4eJ+DdcoKSZyQoeX0+LK5+8MDAwMDC9+/WWImbkeI4D85MUZJMWED8A1qirKVjUlBvgETVqugqEa5mQmRoacKO9zWurKPXCNfHx8389evha5Njd8bfPCLXIXPn1F0eQgLshQGut7XUREOJCRkfEfXCMDAwODsa7WmQOnT+t150VMevn6ne33bz+kGBgZ/3FzcTyUEBXZxcb4p0RbTek3TD1KWnUwNf3IwMAQj8u5yAAAupehfivnXOEAAAAASUVORK5CYII=", @@ -61,10 +72,17 @@ { "visible": false, "label": "Natural, Seasonal, Low", - "values": ["Natural", "Seasonal", "Low"], + "values": [ + "Natural", + "Seasonal", + "Low" + ], "settings": { "mimeType": "image/png", - "offset": [0, 0], + "offset": [ + 0, + 0 + ], "opacity": 1, "rotation": 0, "src": "iVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAYAAAAfSC3RAAAAAXNSR0IB2cksfwAAAAlwSFlzAAAOxAAADsQBlSsOGwAAAcdJREFUKJFjYSATsCBz/v//z/Tt++fwZ6/v2X359lGckZHxHx+34BNJMZVdnOyc27Bq/P//v8iDZzcm7Tg+yev915v8yIokhMzCn768v1FKTKGYkZHxK1zj////me8+vjx99YHikP///2I468W7UxJLd11NjXTtZ2FgYEiBa3zz4WnaluO9/tg0wcCff1+Zdp+aFfLpy/stfDyCG1gYGBgYnry46/Xtx2NWZIW6CmEMP39/Y7j1dAvC5vdn+J+8uh3EwMAA0fjl+0cVZE1mGqkMzmYRDAwMDAxr9zKgaP785Z0Skh//siNrZGPhgLPZWblRnPz3/z92uEZ2Ns6XDAwMijDJo9dmMTAyMjH8/vOD4fKDlSgaOdm5X8M1CvJKnGBl4bf4/ecjAwMDA8P/fz8ZDl+eiBFAAtyqDIK84gfgGiWElKrs9TJ99pzrUMFQDQWMjMwMNnpx5+Sl1HvgGvn4+L7ffnA50tmwbO3hK7Plfv1+j6KJi0OawV4v+bogr2ggIyPjP7hGBgYGBlUF3TNX7x3QczMtnvTh82vb37+/STEwMv7jYOV+KMArtusbN1OJrKTab5h6lLSqreTwkYGBIR6Xc5EBAG+8pa3DWR79AAAAAElFTkSuQmCC", @@ -74,10 +92,17 @@ { "visible": false, "label": "Natural, Seasonal, Normal", - "values": ["Natural", "Seasonal", "Normal"], + "values": [ + "Natural", + "Seasonal", + "Normal" + ], "settings": { "mimeType": "image/png", - "offset": [0, 0], + "offset": [ + 0, + 0 + ], "opacity": 1, "rotation": 0, "src": "iVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAYAAAAfSC3RAAAAAXNSR0IB2cksfwAAAAlwSFlzAAAOxAAADsQBlSsOGwAAAcdJREFUKJFjYSATsCBz/v//z/Tt++fwZ6/v2X359lGckZHxHx+34BNJMZVdnOyc27Bq/P//v8iDZzcm7Tg+yev915v8yIokhMzCn768v1FKTKGYkZHxK1zj////me8+vjx99YHikP///2I468W7UxJLd11NjXTtZ2FgYEiBa3zz4WnaluO9/tg0wcCff1+Zdp+aFfLpy/stfDyCG1gYGBgYnry46/Xtx2NWZIW6CmEMP39/Y7j1dAvC5vdn+J+8uh3EwMAA0fjl+0cVZE1mGqkMzmYRDAwMDAxr9zKgaP785Z0Skh//siNrZGPhgLPZWblRnPz3/z92uEZ2Ns6XDAwMijDJo9dmMTAyMjH8/vOD4fKDlSgaOdm5X8M1CvJKnGBl4bf4/ecjAwMDA8P/fz8ZDl+eiBFAAtyqDIK84gfgGiWElKrs9TJ99pzrUMFQDQWMjMwMNnpx5+Sl1HvgGvn4+L7ffnA50tmwbO3hK7Plfv1+j6KJi0OawV4v+bogr2ggIyPjP7hGBgYGBlUF3TNX7x3QczMtnvTh82vb37+/STEwMv7jYOV+KMArtusbN1OJrKTab5h6lLSqreTwkYGBIR6Xc5EBAG+8pa3DWR79AAAAAElFTkSuQmCC", @@ -87,10 +112,17 @@ { "visible": true, "label": "Natural, Yearly, High", - "values": ["Natural", "Yearly", "High"], + "values": [ + "Natural", + "Yearly", + "High" + ], "settings": { "mimeType": "image/png", - "offset": [0, 0], + "offset": [ + 0, + 0 + ], "opacity": 1, "rotation": 0, "src": "iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAYAAABWdVznAAAAAXNSR0IB2cksfwAAAAlwSFlzAAAOxAAADsQBlSsOGwAAARhJREFUKJGNjzFLQlEYhp8OR45xaUgiIqcgEhpqb2toaFAbpTEuQTch15qD5ooEwR/QrnDr+gPammsMg7hgDsHBjtm5DXrFwbo948fzvnyvJKZUms305g/1gCKCLNABGxhHXXN71Y01CbBaPFppa3wNOcS4Yg3EltJfZfJewTSqD8OA66p2ONOEKMd0FiBqsuNu0qq/ykyYOtBE67/IMRnSqTPAkxoKCTIACvYMeBLI/icALAFCYulMDP2LLmAl2ADEdpLtwJ0BpOl/V1ValBNe+1R9ew4gadU/nN3jgpbWBxanyD2D3X+7rz0NA0DXv3kkf7KhbP/UCIoKloF3BxvMDcTFi197jtNy3NO4DA1UgIoZncxo6SQ//xRZVbXMk6kAAAAASUVORK5CYII=", @@ -100,10 +132,17 @@ { "visible": false, "label": "Natural, Yearly, Low", - "values": ["Natural", "Yearly", "Low"], + "values": [ + "Natural", + "Yearly", + "Low" + ], "settings": { "mimeType": "image/png", - "offset": [0, 0], + "offset": [ + 0, + 0 + ], "opacity": 1, "rotation": 0, "src": "iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAYAAABWdVznAAAAAXNSR0IB2cksfwAAAAlwSFlzAAAOxAAADsQBlSsOGwAAASFJREFUKJGNkb1KA0EURs8Mw0YRLUREDLgIYsBCezsLSxMbgwSUJYiFpLDVWvABBAsLiVaSYGUgIXkAO7E0vbAIyUaMouyQGQt3u/x44MKF73zc4ioirnYZd7R7KCQZDEkIW9ZQdxL+Re6OIPYUwE1maRGtq0AKE0fOspCsa+0WbrNj6f1S8xFA3R+Q+OzoCpCiPzO216sUs6k1r9R8Vd22mxeSlQFyhJ6WVp8CR0pI0sPlPyxsx4WkNSN9MMw1QCoLrf9cgDDYBKMEYd3ibIwuTNQAlHn3L8WUWwCSQ+wfKb/OAJTX4KO4000LM1kFZvvI31aGub2y/wLR47xy8HS9tbCqnM6JhQwwj6RtCevgnHtlvxm3VbzkH57fgONoBvILJileSF2zp2AAAAAASUVORK5CYII=", @@ -113,10 +152,17 @@ { "visible": false, "label": "Natural, Yearly, Normal", - "values": ["Natural", "Yearly", "Normal"], + "values": [ + "Natural", + "Yearly", + "Normal" + ], "settings": { "mimeType": "image/png", - "offset": [0, 0], + "offset": [ + 0, + 0 + ], "opacity": 1, "rotation": 0, "src": "iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAYAAABWdVznAAAAAXNSR0IB2cksfwAAAAlwSFlzAAAOxAAADsQBlSsOGwAAARxJREFUKJGNkS1IQ2EUQM/99u2vioj4ksWBQbuwoLDoZpSB8lgwyIJN3hBEnA6TQTAYZNpNDqZ7UdBm1m5QmQsqvjF57zNsr21uBy5cLuekq+mxe7aajMVeN0RUDgILVNOYoNGJdU728vet0NMABxfpaeG9DirVPSuAGRG1EP9NFA8vM9nSuvsAoI+viHvf0RqQoj/jGL9WqWbmHdt90d7XUgFhdoAcMmaUXwI2NUJ2iNzFsBIGFmakZBIXpTE0R9KhRYZAi9AwhsVhtsANgP4JIqdJ8YuA9Y/fRkXLAHrfdj/L1XRWSaIO/kQf2RMT5J212yfoPW7Hvns8Ol+eC3TbMcbPAVPAh5hIA3TFsevPYa3DZbtw/QZs9WYgf/xmWAwLz4rrAAAAAElFTkSuQmCC", @@ -126,10 +172,17 @@ { "visible": false, "label": "Regulated, Seasonal, High", - "values": ["Regulated", "Seasonal", "High"], + "values": [ + "Regulated", + "Seasonal", + "High" + ], "settings": { "mimeType": "image/png", - "offset": [0, 0], + "offset": [ + 0, + 0 + ], "opacity": 1, "rotation": 0, "src": "iVBORw0KGgoAAAANSUhEUgAAABMAAAAQCAYAAAD0xERiAAAAAXNSR0IB2cksfwAAAAlwSFlzAAAOxAAADsQBlSsOGwAAAf5JREFUOI2t01tI02EYBvDnrT+EmC6KYCRBglFRmJ02VlgRSqAUHUCQZY68GQ2vJGdIkHiRdNE06DAG9u8gxoJpRxJ3EQqaMYpS2VAqaqsVxGyWOmXu6WoyXbFmPXffw8vve/ngU/Afo6QaICnR6Ox1RVlqFhH+EzY9M1P1qLunuKSosBKAumiMpGbIN1putLtyX67PrSDpFJHJRWE/Jybr6mw3DQDQcKVN33rhTA2AxrQxkhvdPf2F7mAoAwDuv/+S+XrYV0zyhogE0sJCY+Hak81tuxM7y6Xbhmf2PCuA6r/GSB5qaW0vCEVjkth7JyKKu3dgB0m9iAykxEgu838KGq2dvdu2ZGXgak0l1uZo0ed5A6PdBaPdZdhn2HkaQGpsNhYzn2tR9QBw3nQYuu35AIDjpUXwDI7A1jcER3tnPskyEXH+ESOZ82rQu/euz78OALKXZ867aPUqDQCgoetFwYmjB4+QfCgiU7/FpiLT1aeaHAfi51sP3Ni6eQM02VkYffcBl7uez83WN6u71CarGYAtCSO5597j7k3eH5EV8e7O8Ec8MZ2FTrsSTwPf5m3p9Pnzakfe6kiuEZHPcxjJJd/D4+UV9o6ShW8YisaSoHhMjdf296sXLQDqEzerCgS/ljotZSn/6oJox8Ljx0h2iIhHAQARcQBwpAkl5ReILNJbf8Z/egAAAABJRU5ErkJggg==", @@ -139,10 +192,17 @@ { "visible": false, "label": "Regulated, Seasonal, Low", - "values": ["Regulated", "Seasonal", "Low"], + "values": [ + "Regulated", + "Seasonal", + "Low" + ], "settings": { "mimeType": "image/png", - "offset": [0, 0], + "offset": [ + 0, + 0 + ], "opacity": 1, "rotation": 0, "src": "iVBORw0KGgoAAAANSUhEUgAAABMAAAAQCAYAAAD0xERiAAAAAXNSR0IB2cksfwAAAAlwSFlzAAAOxAAADsQBlSsOGwAAAf1JREFUOI2t009Ik2EcB/Dvr15o/dOikNKIJA+KJZOwtaKQwkNWJB4KsfAg1SglcJFBhAeRCIqoJhivTA8eQpAOZhCMkQ4Ra2nN0mrQPzdrHZyTNt9qr99OjumKNet7e378+DxfHngU/McoyRZIih6NtixVFIuI8J8w/cf36hFHT0n+gYNVANoXjZFM9795VeGx12Vn5OSeJNkpIpFFYVokfKn/1hUzAAzcbTIdblStABpTxkjmjvU59mpfh5YDQPhj/0rf6IsSkm0i4ksJ+xacvOhurtkdPxu8fcG8sflhPYDav8ZIHnG124zUNYmfRyN+5a3LsYOkSUQGk2Ikl036xyvfP7heqKzaDPP5G1ibuQkfng3AY6+Dx241b91VfBZAcmx2Vrf02RpMALD9RD2yC4sAAMbScgReDiHwpANP76kFJI+JSOcfMZJZn0aG9017nVsAwLA6bd5FhnXrAQA+Z4sxWFZZRrJbRGZ+i/3UtFrXtZr9c+fR7g5k5RVgRVo6Au+8GHe0xnZ77zQUHW1qtQC4mYCR3PO8pytP1/xr5mah14/QdaoXhoxtmPnsntdy2uvMmfCO7SSZKSITMYzkknBoqsLTZi1d+IbUtQQo1u7q6eLj6uNzAC7HN6ue+uI7ZDxjS/pXF2RDOBQsJ3lfRNwKAIiICkBNEUrIL56h1pnX6ksDAAAAAElFTkSuQmCC", @@ -152,10 +212,17 @@ { "visible": false, "label": "Regulated, Seasonal, Normal", - "values": ["Regulated", "Seasonal", "Normal"], + "values": [ + "Regulated", + "Seasonal", + "Normal" + ], "settings": { "mimeType": "image/png", - "offset": [0, 0], + "offset": [ + 0, + 0 + ], "opacity": 1, "rotation": 0, "src": "iVBORw0KGgoAAAANSUhEUgAAABMAAAAQCAYAAAD0xERiAAAAAXNSR0IB2cksfwAAAAlwSFlzAAAOxAAADsQBlSsOGwAAAftJREFUOI2t011I01EYBvDnzX80a2UFRbWKRgVGGQvJsUZSgV2UUkQYEhFh0Ci8iOgDBt10YxG5ootgFwndlCGlq6CCaFsRfiA6RdMoXa7Bhtk+29iHT1eT6Yo167k7Dy+/83LgKPiPUfINkJR0OnWvqEgxiQj/CUukE/Wd/S+rKrbuPwmgec4YyZKxb0N1TpdFu27l5hMkW0Tk55ywWDx6xfb+ugEAXny4oz9VffMCgGsFYyRLe4be7o7Ex4sBIBAdXvTFM1BF8r6IeArCQpHJS6+6G3dld887Gg3rVzdfBtDw1xjJmmdOq45MSnafSgWVvhF7OUm9iHTkxUgu8E96jvePPtwxXylBtcGMFcs0+DjWBYfLAofLYijbaDwLID82NZU2tTlu6QGgsuwMSrXlAACjrgZunwtu3xu87nqwnWStiLT8ESOp+fTVVTkR6tsAAMWqxTMuUquWAwBGPO06/4+jh0naRCT2WyyRjDc8dV7dlzl3DrZCq9kG9cIl8Pg+Y3DcNj3bZr+x8/ShJhOAphyMpPFdb/uWVDq8NNP5g72421oLtWotwrHRGVtOhAY2ub3DFSTXiIh3GiM5LxwN1jldtw/MfkMymQNl8thu3nP+2KNzAMzZm9V/D3gP7tVdzPtXZ2VVJBo4QvKJiHQrACAiVgDWAqGc/ALxctoeg0TwJAAAAABJRU5ErkJggg==", @@ -165,10 +232,17 @@ { "visible": false, "label": "Regulated, Yearly, High", - "values": ["Regulated", "Yearly", "High"], + "values": [ + "Regulated", + "Yearly", + "High" + ], "settings": { "mimeType": "image/png", - "offset": [0, 0], + "offset": [ + 0, + 0 + ], "opacity": 1, "rotation": 0, "src": "iVBORw0KGgoAAAANSUhEUgAAABIAAAAPCAYAAADphp8SAAAAAXNSR0IB2cksfwAAAAlwSFlzAAAOxAAADsQBlSsOGwAAATxJREFUOI2d079LAnEYx/F3p9yFOMS1JK0NztHQUNQmYXHQr61JyPLIwTAIgqShHxQSghZBY3/AF3Ju7X9okLZoOAr6Uhf5vYYTyUo9/WzPl+f7ep7lCRMkyWyUaumtU0u4K7KyGzE+X+5cKzeLKMq+IePjdQeYMJDbLhz0ByXSo+Dl/ULLY6UuEdfPPUOmHjqUeJFGGUXp+4DdE2TO2eMStfbzzYD1kaR9/lgtPwSGpK6KKAZ+9z9p6ghYDgYtZBZR3kybGUumZU86onzfGcpmdWruCWjtlkUqdQpMd4SM2tcWaGNtFT9TWJsW4kL8D61mhnn39rog/kA4duEWqP+F3HoBtKEgEIq4aWVSjqhctUCxRDruKG0jENKIVF4BK3eDKMom5AyGzlBe99trTcxQ/uk0P7qiMt8j0pJvr8JggMSSoswAAAAASUVORK5CYII=", @@ -181,7 +255,10 @@ "values": [], "settings": { "mimeType": "image/png", - "offset": [0, 0], + "offset": [ + 0, + 0 + ], "opacity": 1, "rotation": 0, "src": "iVBORw0KGgoAAAANSUhEUgAAABIAAAAPCAYAAADphp8SAAAAAXNSR0IB2cksfwAAAAlwSFlzAAAOxAAADsQBlSsOGwAAAUhJREFUOI2d0z1Lw1AUBuD3hppCLSo4iLg6dFZBEYtZQgeFgB+jrSIEQXSxFUIFg1jTYhBHyWITEVwDOhXUSVz8Bf4DcahgBxtvrkNrIbamSd/tXM557llOBAGiGQtxRb779OuJdEOUm9UY+6o+6KYkZDN2rWdooF7dZ6BTdXzsATjqCSpaqTGXOblGxeVUc/JCzby8hYZc5pwAiDXLOM8GDwFsh4KOy8kJAGueRwK5cDl7nt94eg0MEdJ3BoC09XO8BmAlEFQwhSUCzHf8ANyyVhZnlPXKsy+0a4An4Er/bQoAjNBTAElfaCQq7gB03A8CMKdZgqSkH+2OUMmaHqaMHnRBGlsxrmgYuJVl0DboG/0qAYaCQAAS71FxE6gYHki7SiWY62wFRJqhqm5K19mMXWtBLnN0EuBk/mT093Rag/n0/WJIxJMfY79g/IvbH/IAAAAASUVORK5CYII=", @@ -214,37 +291,29 @@ { "layerId": "8", "layerFilter": "Total_CSO_Volume > 5000000", - "style": { + "layerStyle": { "Point": { - "styleId": "classBreaksId", - "styleType": "classBreaks", - "defaultLabel": "Pas de données de volume / No volume data", - "defaultSettings": { - "symbol": "square", - "type": "simpleSymbol", - "color": "rgba(255,127,127,1)", - "offset": [0, 0], - "rotation": 0, - "size": 2.0010000000000003, - "stroke": { - "color": "rgba(0,0,0,1)", - "lineStyle": "solid", - "width": 0.5 - } - }, - "defaultVisible": true, - "field": "Total_CSO_Volume", - "classBreakStyleInfo": [ + "type": "classBreaks", + "hasDefault": true, + "fields": [ + "Total_CSO_Volume" + ], + "info": [ { "label": "0 m3", - "minValue": 0, - "maxValue": 0, + "values": [ + 0, + 0.0001 + ], "visible": true, "settings": { "symbol": "circle", "type": "simpleSymbol", "color": "rgba(76,230,0,1)", - "offset": [0, 0], + "offset": [ + 0, + 0 + ], "rotation": 0, "size": 2.6679999999999997, "stroke": { @@ -256,14 +325,19 @@ }, { "label": "0.0001 - ≤ 5,000,000 m3", - "minValue": 0, - "maxValue": 5000000, + "values": [ + 0.0001, + 5000000 + ], "visible": true, "settings": { "symbol": "circle", "type": "simpleSymbol", "color": "rgba(196,97,255,1)", - "offset": [0, 0], + "offset": [ + 0, + 0 + ], "rotation": 0, "size": 5.114407777777778, "stroke": { @@ -275,14 +349,19 @@ }, { "label": "> 5,000,000 - ≤ 10,000,000 m3", - "minValue": 5000000, - "maxValue": 10000000, + "values": [ + 5000000, + 10000000 + ], "visible": true, "settings": { "symbol": "circle", "type": "simpleSymbol", "color": "rgba(196,97,255,1)", - "offset": [0, 0], + "offset": [ + 0, + 0 + ], "rotation": 0, "size": 7.560815555555555, "stroke": { @@ -294,14 +373,19 @@ }, { "label": "> 10,000,000 - ≤ 15,000,000 m3", - "minValue": 10000000, - "maxValue": 15000000, + "values": [ + 10000000, + 15000000 + ], "visible": true, "settings": { "symbol": "circle", "type": "simpleSymbol", "color": "rgba(196,97,255,1)", - "offset": [0, 0], + "offset": [ + 0, + 0 + ], "rotation": 0, "size": 10.007223333333332, "stroke": { @@ -313,14 +397,19 @@ }, { "label": "> 15,000,000 - ≤ 20,000,000 m3", - "minValue": 15000000, - "maxValue": 20000000, + "values": [ + 15000000, + 20000000 + ], "visible": true, "settings": { "symbol": "circle", "type": "simpleSymbol", "color": "rgba(196,97,255,1)", - "offset": [0, 0], + "offset": [ + 0, + 0 + ], "rotation": 0, "size": 12.453631111111111, "stroke": { @@ -332,14 +421,19 @@ }, { "label": "> 20,000,000 - ≤ 25,000,000 m3", - "minValue": 20000000, - "maxValue": 25000000, + "values": [ + 20000000, + 25000000 + ], "visible": true, "settings": { "symbol": "circle", "type": "simpleSymbol", "color": "rgba(196,97,255,1)", - "offset": [0, 0], + "offset": [ + 0, + 0 + ], "rotation": 0, "size": 14.90003888888889, "stroke": { @@ -351,14 +445,19 @@ }, { "label": "> 25,000,000 - ≤ 30,000,000 m3", - "minValue": 25000000, - "maxValue": 30000000, + "values": [ + 25000000, + 30000000 + ], "visible": true, "settings": { "symbol": "circle", "type": "simpleSymbol", "color": "rgba(196,97,255,1)", - "offset": [0, 0], + "offset": [ + 0, + 0 + ], "rotation": 0, "size": 17.346446666666665, "stroke": { @@ -370,14 +469,19 @@ }, { "label": "> 30,000,000 - ≤ 35,000,000 m3", - "minValue": 30000000, - "maxValue": 35000000, + "values": [ + 30000000, + 35000000 + ], "visible": true, "settings": { "symbol": "circle", "type": "simpleSymbol", "color": "rgba(196,97,255,1)", - "offset": [0, 0], + "offset": [ + 0, + 0 + ], "rotation": 0, "size": 19.792854444444444, "stroke": { @@ -389,14 +493,19 @@ }, { "label": "> 35,000,000 m3", - "minValue": 35000000, - "maxValue": 999000000, + "values": [ + 35000000, + 999000000 + ], "visible": true, "settings": { "symbol": "circle", "type": "simpleSymbol", "color": "rgba(196,97,255,1)", - "offset": [0, 0], + "offset": [ + 0, + 0 + ], "rotation": 0, "size": 22.239262222222223, "stroke": { @@ -405,6 +514,27 @@ "width": 0.5 } } + }, + { + "label": "Pas de données de volume / No volume data", + "values": [], + "visible": true, + "settings": { + "symbol": "circle", + "type": "simpleSymbol", + "color": "rgba(255,127,127,1)", + "offset": [ + 0, + 0 + ], + "rotation": 0, + "size": 2.0010000000000003, + "stroke": { + "color": "rgba(0,0,0,1)", + "lineStyle": "solid", + "width": 0.5 + } + } } ] } @@ -414,12 +544,20 @@ } ] }, - "components": ["overview-map", "north-arrow"], + "components": [ + "overview-map", + "north-arrow" + ], "footerBar": { "tabs": { - "core": ["legend", "layers", "details", "data-table"] + "core": [ + "legend", + "layers", + "details", + "data-table" + ] } }, "corePackages": [], "theme": "geo.ca" -} +} \ No newline at end of file diff --git a/packages/geoview-core/public/configs/navigator/17-esri-feature.json b/packages/geoview-core/public/configs/navigator/17-esri-feature.json index 80155137948..d5885858d52 100644 --- a/packages/geoview-core/public/configs/navigator/17-esri-feature.json +++ b/packages/geoview-core/public/configs/navigator/17-esri-feature.json @@ -53,37 +53,29 @@ { "layerId": "8", "layerFilter": "Total_CSO_Volume > 5000000", - "style": { + "layerStyle": { "Point": { - "styleId": "classBreaksId", - "styleType": "classBreaks", - "defaultLabel": "Pas de données de volume / No volume data", - "defaultSettings": { - "symbol": "square", - "type": "simpleSymbol", - "color": "rgba(255,127,127,1)", - "offset": [0, 0], - "rotation": 0, - "size": 2.0010000000000003, - "stroke": { - "color": "rgba(0,0,0,1)", - "lineStyle": "solid", - "width": 0.5 - } - }, - "defaultVisible": true, - "field": "Total_CSO_Volume", - "classBreakStyleInfo": [ + "type": "classBreaks", + "hasDefault": true, + "fields": [ + "Total_CSO_Volume" + ], + "info": [ { "label": "0 m3", - "minValue": 0, - "maxValue": 0, + "values": [ + 0, + 0 + ], "visible": true, "settings": { "symbol": "circle", "type": "simpleSymbol", "color": "rgba(76,230,0,1)", - "offset": [0, 0], + "offset": [ + 0, + 0 + ], "rotation": 0, "size": 2.6679999999999997, "stroke": { @@ -95,14 +87,19 @@ }, { "label": "0.0001 - ≤ 5,000,000 m3", - "minValue": 0, - "maxValue": 5000000, + "values": [ + 0.0001, + 5000000 + ], "visible": true, "settings": { "symbol": "circle", "type": "simpleSymbol", "color": "rgba(196,97,255,1)", - "offset": [0, 0], + "offset": [ + 0, + 0 + ], "rotation": 0, "size": 5.114407777777778, "stroke": { @@ -114,14 +111,19 @@ }, { "label": "> 5,000,000 - ≤ 10,000,000 m3", - "minValue": 5000000, - "maxValue": 10000000, + "values": [ + 5000000, + 10000000 + ], "visible": true, "settings": { "symbol": "circle", "type": "simpleSymbol", "color": "rgba(196,97,255,1)", - "offset": [0, 0], + "offset": [ + 0, + 0 + ], "rotation": 0, "size": 7.560815555555555, "stroke": { @@ -133,14 +135,19 @@ }, { "label": "> 10,000,000 - ≤ 15,000,000 m3", - "minValue": 10000000, - "maxValue": 15000000, + "values": [ + 10000000, + 15000000 + ], "visible": true, "settings": { "symbol": "circle", "type": "simpleSymbol", "color": "rgba(196,97,255,1)", - "offset": [0, 0], + "offset": [ + 0, + 0 + ], "rotation": 0, "size": 10.007223333333332, "stroke": { @@ -152,14 +159,19 @@ }, { "label": "> 15,000,000 - ≤ 20,000,000 m3", - "minValue": 15000000, - "maxValue": 20000000, + "values": [ + 15000000, + 20000000 + ], "visible": true, "settings": { "symbol": "circle", "type": "simpleSymbol", "color": "rgba(196,97,255,1)", - "offset": [0, 0], + "offset": [ + 0, + 0 + ], "rotation": 0, "size": 12.453631111111111, "stroke": { @@ -171,14 +183,19 @@ }, { "label": "> 20,000,000 - ≤ 25,000,000 m3", - "minValue": 20000000, - "maxValue": 25000000, + "values": [ + 20000000, + 25000000 + ], "visible": true, "settings": { "symbol": "circle", "type": "simpleSymbol", "color": "rgba(196,97,255,1)", - "offset": [0, 0], + "offset": [ + 0, + 0 + ], "rotation": 0, "size": 14.90003888888889, "stroke": { @@ -190,14 +207,19 @@ }, { "label": "> 25,000,000 - ≤ 30,000,000 m3", - "minValue": 25000000, - "maxValue": 30000000, + "values": [ + 25000000, + 30000000 + ], "visible": true, "settings": { "symbol": "circle", "type": "simpleSymbol", "color": "rgba(196,97,255,1)", - "offset": [0, 0], + "offset": [ + 0, + 0 + ], "rotation": 0, "size": 17.346446666666665, "stroke": { @@ -209,14 +231,19 @@ }, { "label": "> 30,000,000 - ≤ 35,000,000 m3", - "minValue": 30000000, - "maxValue": 35000000, + "values": [ + 30000000, + 35000000 + ], "visible": true, "settings": { "symbol": "circle", "type": "simpleSymbol", "color": "rgba(196,97,255,1)", - "offset": [0, 0], + "offset": [ + 0, + 0 + ], "rotation": 0, "size": 19.792854444444444, "stroke": { @@ -228,14 +255,19 @@ }, { "label": "> 35,000,000 m3", - "minValue": 35000000, - "maxValue": 999000000, + "values": [ + 35000000, + 999000000 + ], "visible": true, "settings": { "symbol": "circle", "type": "simpleSymbol", "color": "rgba(196,97,255,1)", - "offset": [0, 0], + "offset": [ + 0, + 0 + ], "rotation": 0, "size": 22.239262222222223, "stroke": { @@ -244,6 +276,27 @@ "width": 0.5 } } + }, + { + "label": "Pas de données de volume / No volume data", + "values": [], + "visible": true, + "settings": { + "symbol": "circle", + "type": "simpleSymbol", + "color": "rgba(255,127,127,1)", + "offset": [ + 0, + 0 + ], + "rotation": 0, + "size": 2.0010000000000003, + "stroke": { + "color": "rgba(0,0,0,1)", + "lineStyle": "solid", + "width": 0.5 + } + } } ] } @@ -253,12 +306,20 @@ } ] }, - "components": ["overview-map", "north-arrow"], + "components": [ + "overview-map", + "north-arrow" + ], "footerBar": { "tabs": { - "core": ["legend", "layers", "details", "data-table"] + "core": [ + "legend", + "layers", + "details", + "data-table" + ] } }, "corePackages": [], "theme": "geo.ca" -} +} \ No newline at end of file diff --git a/packages/geoview-core/src/api/event-processors/event-processor-children/legend-event-processor.ts b/packages/geoview-core/src/api/event-processors/event-processor-children/legend-event-processor.ts index 2bce99e9fd1..37bc8f8ed07 100644 --- a/packages/geoview-core/src/api/event-processors/event-processor-children/legend-event-processor.ts +++ b/packages/geoview-core/src/api/event-processors/event-processor-children/legend-event-processor.ts @@ -176,14 +176,18 @@ export class LegendEventProcessor extends AbstractEventProcessor { iconDetails.push(iconDetailsEntry); } else { iconDetailsEntry.iconType = 'list'; - iconDetailsEntry.iconList = styleRepresentation.arrayOfCanvas!.map((canvas, i) => { - const legendLayerListItem: TypeLegendItem = { - geometryType, - icon: canvas ? canvas.toDataURL() : null, - name: styleSettings.info[i].label, - isVisible: styleSettings.info[i].visible !== false, - }; - return legendLayerListItem; + iconDetailsEntry.iconList = []; + styleRepresentation.arrayOfCanvas!.forEach((canvas, i) => { + // Check if there is already an entry for this label before adding it. + if (!iconDetailsEntry.iconList?.find((listItem) => listItem.name === styleSettings.info[i].label)) { + const legendLayerListItem: TypeLegendItem = { + geometryType, + icon: canvas ? canvas.toDataURL() : null, + name: styleSettings.info[i].label, + isVisible: styleSettings.info[i].visible !== false, + }; + iconDetailsEntry.iconList?.push(legendLayerListItem); + } }); if (styleRepresentation.defaultCanvas) { const legendLayerListItem: TypeLegendItem = { diff --git a/packages/geoview-core/src/geo/layer/gv-layers/raster/gv-esri-dynamic.ts b/packages/geoview-core/src/geo/layer/gv-layers/raster/gv-esri-dynamic.ts index 9f7b343a399..a3cb646d83c 100644 --- a/packages/geoview-core/src/geo/layer/gv-layers/raster/gv-esri-dynamic.ts +++ b/packages/geoview-core/src/geo/layer/gv-layers/raster/gv-esri-dynamic.ts @@ -301,7 +301,7 @@ export class GVEsriDynamic extends AbstractGVRaster { * Counts the number of times the value of a field is used by the unique value style information object. Depending on the * visibility of the default, we count visible or invisible settings. * @param {TypeLayerStyleSettings} styleSettings - The unique value style settings to evaluate. - * @returns {TypeFieldOfTheSameValue[][]} The result of the evaluation. The first index of the array correspond to the field's + * @returns {TypeFieldOfTheSameValue[][]} The result of the evaluation. The first index of the array corresponds to the field's * index in the style settings and the second one to the number of different values the field may have based on visibility of * the feature. * @private @@ -309,16 +309,16 @@ export class GVEsriDynamic extends AbstractGVRaster { static #countFieldOfTheSameValue(styleSettings: TypeLayerStyleSettings): TypeFieldOfTheSameValue[][] { return styleSettings.info.reduce( (counter, styleEntry): TypeFieldOfTheSameValue[][] => { - if ( - (styleEntry.visible === false && styleSettings.info[styleSettings.info.length - 1].visible !== false) || - (styleEntry.visible !== false && styleSettings.info[styleSettings.info.length - 1].visible === false) - ) { + if (styleEntry.visible !== false) { styleEntry.values.forEach((styleValue, i) => { - const valueExist = counter[i].find((counterEntry) => counterEntry.value === styleValue); + const valueExist = counter[i]?.find((counterEntry) => counterEntry.value === styleValue); if (valueExist) valueExist.nbOccurence++; - else counter[i].push({ value: styleValue, nbOccurence: 1 }); + else if (counter[i]) counter[i].push({ value: styleValue, nbOccurence: 1 }); + // eslint-disable-next-line no-param-reassign + else counter[i] = [{ value: styleValue, nbOccurence: 1 }]; }); } + return counter; }, styleSettings.fields.map(() => []) @@ -378,7 +378,12 @@ export class GVEsriDynamic extends AbstractGVRaster { for (let i = 0; i < styleSettings.info.length; i++) { if (filterArray.length % 2 === 0) { if (i === 0) { - if (styleSettings.info[0].visible !== false && styleSettings.info[styleSettings.info.length - 1].visible === false) + // First set, visible, default not visible + if ( + styleSettings.info[0].visible !== false && + (!styleSettings.hasDefault || + (styleSettings.hasDefault && styleSettings.info[styleSettings.info.length - 1].visible === false)) + ) filterArray.push( `${styleSettings.fields[0]} >= ${GVEsriDynamic.#formatFieldValue( styleSettings.fields[0], @@ -386,7 +391,12 @@ export class GVEsriDynamic extends AbstractGVRaster { layerConfig.source.featureInfo! )}` ); - else if (styleSettings.info[0].visible === false && styleSettings.info[styleSettings.info.length - 1].visible !== false) { + else if ( + // First set, not visible, default visible + styleSettings.info[0].visible === false && + styleSettings.hasDefault && + styleSettings.info[styleSettings.info.length - 1].visible !== false + ) { filterArray.push( `${styleSettings.fields[0]} < ${GVEsriDynamic.#formatFieldValue( styleSettings.fields[0], @@ -396,7 +406,12 @@ export class GVEsriDynamic extends AbstractGVRaster { ); visibleWhenGreatherThisIndex = i; } - } else if (styleSettings.info[i].visible !== false && styleSettings.info[styleSettings.info.length - 1].visible === false) { + } else if ( + // Visible, default not visible + styleSettings.info[i].visible !== false && + (!styleSettings.hasDefault || + (styleSettings.hasDefault && styleSettings.info[styleSettings.info.length - 1].visible === false)) + ) { filterArray.push( `${styleSettings.fields[0]} > ${GVEsriDynamic.#formatFieldValue( styleSettings.fields[0], @@ -412,7 +427,12 @@ export class GVEsriDynamic extends AbstractGVRaster { layerConfig.source.featureInfo! )}` ); - } else if (styleSettings.info[i].visible === false && styleSettings.info[styleSettings.info.length - 1].visible !== false) { + } else if ( + // Not visible, default visible + styleSettings.info[i].visible === false && + styleSettings.hasDefault && + styleSettings.info[styleSettings.info.length - 1].visible !== false + ) { filterArray.push( `${styleSettings.fields[0]} <= ${GVEsriDynamic.#formatFieldValue( styleSettings.fields[0], @@ -422,7 +442,11 @@ export class GVEsriDynamic extends AbstractGVRaster { ); visibleWhenGreatherThisIndex = i; } - } else if (styleSettings.info[styleSettings.info.length - 1].visible === false) { + } else if ( + !styleSettings.hasDefault || + (styleSettings.hasDefault && styleSettings.info[styleSettings.info.length - 1].visible === false) + ) { + // Default is not visible/does not exist if (styleSettings.info[i].visible === false) { filterArray.push( `${styleSettings.fields[0]} <= ${GVEsriDynamic.#formatFieldValue( @@ -440,7 +464,8 @@ export class GVEsriDynamic extends AbstractGVRaster { )}` ); } - } else if (styleSettings.info[i].visible !== false) { + } else if (styleSettings.hasDefault && styleSettings.info[i].visible !== false) { + // Has default and default is visible filterArray.push( `${styleSettings.fields[0]} > ${GVEsriDynamic.#formatFieldValue( styleSettings.fields[0], @@ -453,6 +478,7 @@ export class GVEsriDynamic extends AbstractGVRaster { visibleWhenGreatherThisIndex = i; } } + if (visibleWhenGreatherThisIndex !== -1) filterArray.push( `${styleSettings.fields[0]} > ${GVEsriDynamic.#formatFieldValue( @@ -462,7 +488,7 @@ export class GVEsriDynamic extends AbstractGVRaster { )}` ); - if (styleSettings.info[styleSettings.info.length - 1].visible !== false) { + if (styleSettings.hasDefault && styleSettings.info[styleSettings.info.length - 1].visible !== false) { const filterValue = `${filterArray.slice(0, -1).reduce((previousFilterValue, filterNode, i) => { if (i === 0) return `(${filterNode} or `; if (i % 2 === 0) return `${previousFilterValue} and ${filterNode}) or `; @@ -479,6 +505,7 @@ export class GVEsriDynamic extends AbstractGVRaster { }, '')})` : // We use '(1=0)' as false to select nothing '(1=0)'; + return `${filterValue}${layerFilter ? ` and (${layerFilter})` : ''}`; } } @@ -520,6 +547,7 @@ export class GVEsriDynamic extends AbstractGVRaster { fieldNotUsed[entrySelected] = false; fieldOrder.push(entrySelected); } + return fieldOrder; } @@ -547,10 +575,7 @@ export class GVEsriDynamic extends AbstractGVRaster { ): TypeQueryTree { const queryTree: TypeQueryTree = []; styleSettings.info.forEach((styleEntry) => { - if ( - (styleEntry.visible === false && styleSettings.info[styleSettings.info.length - 1].visible !== false) || - (styleEntry.visible !== false && styleSettings.info[styleSettings.info.length - 1].visible === false) - ) { + if (styleEntry.visible !== false) { let levelToSearch = queryTree; for (let i = 0; i < fieldOrder.length; i++) { if (fieldOfTheSameValue[fieldOrder[i]].find((field) => field.value === styleEntry.values[fieldOrder[i]])) { @@ -563,6 +588,7 @@ export class GVEsriDynamic extends AbstractGVRaster { } } }); + return queryTree; } @@ -605,6 +631,7 @@ export class GVEsriDynamic extends AbstractGVRaster { // If i points to the last element of the queryTree, close the parenthesis. if (i === queryTree.length - 1) queryString = `${queryString})`; } + return queryString === '(' ? '(1=0)' : queryString; } diff --git a/packages/geoview-core/src/geo/layer/layer.ts b/packages/geoview-core/src/geo/layer/layer.ts index 4f139e8deb4..928236675c4 100644 --- a/packages/geoview-core/src/geo/layer/layer.ts +++ b/packages/geoview-core/src/geo/layer/layer.ts @@ -1510,8 +1510,12 @@ export class LayerApi { // Assign value to registered layer. This is use by applyFilter function to set visibility // TODO: check if we need to refactor to centralize attribute setting.... const geometryStyleConfig = layer.getStyle(layerPath)![item.geometryType]; - const toggledStyleInfo = geometryStyleConfig?.info.find((styleInfo) => styleInfo.label === item.name); - if (toggledStyleInfo) toggledStyleInfo.visible = visibility; + // Get all styles with the label matching the name of the clicked item and update their visibility + const toggledStyleInfos = geometryStyleConfig?.info.filter((styleInfo) => styleInfo.label === item.name); + toggledStyleInfos?.forEach((toggledStyleInfo) => { + // eslint-disable-next-line no-param-reassign + if (toggledStyleInfo) toggledStyleInfo.visible = visibility; + }); } // Update the legend layers if necessary diff --git a/packages/geoview-core/src/geo/utils/renderer/esri-renderer.ts b/packages/geoview-core/src/geo/utils/renderer/esri-renderer.ts index 37f7395b578..9afd8a5c097 100644 --- a/packages/geoview-core/src/geo/utils/renderer/esri-renderer.ts +++ b/packages/geoview-core/src/geo/utils/renderer/esri-renderer.ts @@ -327,6 +327,7 @@ function processUniqueValueRenderer(renderer: EsriUniqueValueRenderer): TypeLaye const fields = [renderer.field1]; if (renderer.field2) fields.push(renderer.field2); if (renderer.field3) fields.push(renderer.field3); + const uniqueValueStyleInfo: TypeLayerStyleConfigInfo[] = []; renderer.uniqueValueInfos.forEach((symbolInfo) => { const settings = convertSymbol(symbolInfo.symbol); @@ -342,12 +343,29 @@ function processUniqueValueRenderer(renderer: EsriUniqueValueRenderer): TypeLaye } }); + // Add default setting to the end of the array + const defaultSettings = convertSymbol(renderer.defaultSymbol); + const hasDefault = !!defaultSettings; + if (hasDefault) { + if ( + renderer.rotationType === 'geographic' && + (isIconSymbolVectorConfig(defaultSettings) || isSimpleSymbolVectorConfig(defaultSettings)) + ) + defaultSettings.rotation = Math.PI / 2 - defaultSettings.rotation!; + uniqueValueStyleInfo.push({ + label: renderer.defaultLabel, + visible: true, + values: [''], + settings: defaultSettings, + }); + } + // If any found if (uniqueValueStyleInfo.length > 0) { const styleGeometry = getStyleGeometry(uniqueValueStyleInfo[0].settings); const styleSettings: TypeLayerStyleSettings = { type: 'uniqueValue', - hasDefault: false, + hasDefault: !!renderer.defaultLabel, fields, info: uniqueValueStyleInfo, };