From 9007ef1e16ed58a8147a73882e25aafeef41c026 Mon Sep 17 00:00:00 2001 From: Damon Ulmi <63123585+DamonU2@users.noreply.github.com> Date: Tue, 26 Nov 2024 11:33:12 -0800 Subject: [PATCH] refactor(style): update style to match new config (#2614) Closes #2540 --- .../configs/OSDP/datasets/OSDP-metadata.json | 34 +- .../navigator/10-package-time-slider.json | 2 +- .../configs/navigator/13-all-layers.json | 2 +- .../configs/navigator/14-wms-layer.json | 6 +- .../configs/navigator/16-esri-dynamic.json | 90 +-- .../validator/01-simple-esri-feature.json | 48 +- .../public/configs/validator/04-geocore.json | 1 - .../05-esri-feature-and-dynamic.json | 31 +- .../datasets/geojson/hydro-metadata.meta | 28 +- .../public/datasets/geojson/lines.json | 104 +-- .../datasets/geojson/metadata-blank.meta | 22 +- .../public/datasets/geojson/metadata.json | 225 +++--- .../public/datasets/geojson/metadata.meta | 698 +++++++++++++----- .../public/datasets/geojson/metadata1.meta | 60 +- .../datasets/geojson/processes-metadata.meta | 30 +- .../public/templates/layers/esri-dynamic.html | 185 +++-- .../public/templates/layers/layerlib.js | 65 +- .../geoview-core/public/templates/test.html | 185 +++-- packages/geoview-core/schema.json | 530 ++++++------- .../src/api/config/esri-renderer-parser.ts | 66 +- .../abstract-geoview-esri-layer-config.ts | 7 +- .../vector-config/geojson-config.ts | 28 +- .../raster/esri-dynamic-layer-entry-config.ts | 6 +- .../leaf/raster/wms-layer-entry-config.ts | 10 +- .../vector/esri-feature-layer-entry-config.ts | 6 +- .../leaf/vector/geojson-layer-entry-config.ts | 6 +- .../leaf/vector/wfs-layer-entry-config.ts | 4 +- .../types/config-validation-schema.json | 63 +- .../src/api/config/types/map-schema-types.ts | 20 +- .../legend-event-processor.ts | 107 +-- .../map-event-processor.ts | 2 +- .../src/core/components/common/layer-list.tsx | 2 +- .../src/core/components/common/layout.tsx | 2 +- .../common/responsive-grid-layout.tsx | 8 +- .../components/common/responsive-grid.tsx | 8 +- .../layers/right-panel/layer-details.tsx | 9 +- .../src/core/components/layers/types.ts | 4 +- .../layer-state.ts | 4 +- .../abstract-base-layer-entry-config.ts | 16 +- .../src/geo/layer/geometry/geometry.ts | 1 + .../geoview-layers/abstract-geoview-layers.ts | 30 +- .../layer/geoview-layers/esri-layer-common.ts | 4 +- .../geoview-layers/raster/esri-dynamic.ts | 138 ++-- .../layer/geoview-layers/raster/esri-image.ts | 20 +- .../geo/layer/geoview-layers/raster/wms.ts | 15 +- .../layer/geoview-layers/vector/geojson.ts | 2 +- .../layer/geoview-layers/vector/geopackage.ts | 29 +- .../geo/layer/gv-layers/abstract-gv-layer.ts | 26 +- .../layer/gv-layers/raster/gv-esri-dynamic.ts | 136 ++-- .../layer/gv-layers/raster/gv-esri-image.ts | 20 +- .../src/geo/layer/gv-layers/raster/gv-wms.ts | 3 +- .../gv-layers/vector/abstract-gv-vector.ts | 5 +- .../src/geo/layer/layer-mockup.ts | 135 ++-- packages/geoview-core/src/geo/layer/layer.ts | 16 +- .../src/geo/map/map-schema-types.ts | 308 +++----- .../src/geo/utils/renderer/esri-renderer.ts | 101 +-- .../geo/utils/renderer/geoview-renderer.ts | 273 +++---- .../geoview-core/src/geo/utils/utilities.ts | 6 +- .../geoview-core/src/schemaESRIFeature.txt | 180 ++--- 59 files changed, 2200 insertions(+), 1972 deletions(-) diff --git a/packages/geoview-core/public/configs/OSDP/datasets/OSDP-metadata.json b/packages/geoview-core/public/configs/OSDP/datasets/OSDP-metadata.json index fb9ec06f3f2..27854c4d4da 100644 --- a/packages/geoview-core/public/configs/OSDP/datasets/OSDP-metadata.json +++ b/packages/geoview-core/public/configs/OSDP/datasets/OSDP-metadata.json @@ -19,21 +19,29 @@ ] } }, - "style": { + "layerStyle": { "Polygon": { - "styleType": "simple", - "label": "LineString label", - "settings": { - "type": "filledPolygon", - "color": "rgba(0,0,255,0.5)", - "paternSize": 10, - "paternWidth": 2, - "fillStyle": "diagonalCross", - "stroke": { - "color": "rgba(128,0,0,1)", - "lineStyle": "dot" + "type": "simple", + "fields": [], + "hasDefault": false, + "info": [ + { + "visible": true, + "label": "Polygon label", + "values": [], + "settings": { + "type": "filledPolygon", + "color": "rgba(0,0,255,0.5)", + "paternSize": 10, + "paternWidth": 2, + "fillStyle": "diagonalCross", + "stroke": { + "color": "rgba(128,0,0,1)", + "lineStyle": "dot" + } + } } - } + ] } } } diff --git a/packages/geoview-core/public/configs/navigator/10-package-time-slider.json b/packages/geoview-core/public/configs/navigator/10-package-time-slider.json index b8e78ebc12f..57c2f792b23 100644 --- a/packages/geoview-core/public/configs/navigator/10-package-time-slider.json +++ b/packages/geoview-core/public/configs/navigator/10-package-time-slider.json @@ -59,7 +59,7 @@ { "layerId": "msi-94-or-more", "source": { - "style": "msi-binary" + "wmsStyle": "msi-binary" } } ] diff --git a/packages/geoview-core/public/configs/navigator/13-all-layers.json b/packages/geoview-core/public/configs/navigator/13-all-layers.json index 3c4c7893ff3..2db31839fda 100644 --- a/packages/geoview-core/public/configs/navigator/13-all-layers.json +++ b/packages/geoview-core/public/configs/navigator/13-all-layers.json @@ -145,7 +145,7 @@ "layerId": "msi-94-or-more", "layerName": "Permanent Snow", "source": { - "style": "msi-binary", + "wmsStyle": "msi-binary", "featureInfo": { "queryable": true, "nameField": "band-0-pixel-value", diff --git a/packages/geoview-core/public/configs/navigator/14-wms-layer.json b/packages/geoview-core/public/configs/navigator/14-wms-layer.json index 98af18fd3cc..6feabe6c7b8 100644 --- a/packages/geoview-core/public/configs/navigator/14-wms-layer.json +++ b/packages/geoview-core/public/configs/navigator/14-wms-layer.json @@ -43,7 +43,7 @@ "layerFilter": "time = date'2023-04-18T07:00:00-04:00'", "layerName": "Ice Cover", "source": { - "style": "SEA_ICECONC" + "wmsStyle": "SEA_ICECONC" } } ] @@ -60,7 +60,7 @@ "layerId": "msi-94-or-more", "layerName": "Permanent Snow", "source": { - "style": "msi-binary", + "wmsStyle": "msi-binary", "featureInfo": { "queryable": true, "nameField": "band-0-pixel-value", @@ -87,7 +87,7 @@ "layerId": "RADAR_1KM_RSNO", "layerName": "Test Spatiotemporel", "source": { - "style": "Radar-Snow_14colors" + "wmsStyle": "Radar-Snow_14colors" } } ] 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 f80d9f4698a..cd018b01f23 100644 --- a/packages/geoview-core/public/configs/navigator/16-esri-dynamic.json +++ b/packages/geoview-core/public/configs/navigator/16-esri-dynamic.json @@ -39,24 +39,16 @@ { "layerId": "1", "layerFilter": "E_Province = 'Alberta' or E_Province = 'Manitoba'", - "style": { + "layerStyle": { "Point": { - "styleId": "uniqueValueId", - "defaultLabel": "Regulated, Yearly, Normal", - "styleType": "uniqueValue", - "defaultSettings": { - "mimeType": "image/png", - "offset": [0, 0], - "opacity": 1, - "rotation": 0, - "src": "iVBORw0KGgoAAAANSUhEUgAAABIAAAAPCAYAAADphp8SAAAAAXNSR0IB2cksfwAAAAlwSFlzAAAOxAAADsQBlSsOGwAAAUhJREFUOI2d0z1Lw1AUBuD3hppCLSo4iLg6dFZBEYtZQgeFgB+jrSIEQXSxFUIFg1jTYhBHyWITEVwDOhXUSVz8Bf4DcahgBxtvrkNrIbamSd/tXM557llOBAGiGQtxRb779OuJdEOUm9UY+6o+6KYkZDN2rWdooF7dZ6BTdXzsATjqCSpaqTGXOblGxeVUc/JCzby8hYZc5pwAiDXLOM8GDwFsh4KOy8kJAGueRwK5cDl7nt94eg0MEdJ3BoC09XO8BmAlEFQwhSUCzHf8ANyyVhZnlPXKsy+0a4An4Er/bQoAjNBTAElfaCQq7gB03A8CMKdZgqSkH+2OUMmaHqaMHnRBGlsxrmgYuJVl0DboG/0qAYaCQAAS71FxE6gYHki7SiWY62wFRJqhqm5K19mMXWtBLnN0EuBk/mT093Rag/n0/WJIxJMfY79g/IvbH/IAAAAASUVORK5CYII=", - "type": "iconSymbol" - }, - "defaultVisible": true, + "type": "uniqueValue", + "hasDefault": true, "fields": ["E_Regulated", "E_SampleType", "E_Overall_Condition"], - "uniqueValueStyleInfo": [ + "info": [ { + "visible": true, "label": "Natural, Seasonal, High", + "values": ["Natural", "Seasonal", "High"], "settings": { "mimeType": "image/png", "offset": [0, 0], @@ -64,25 +56,25 @@ "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=", "type": "iconSymbol" - }, - "values": ["Natural", "Seasonal", "High"], - "visible": true + } }, { + "visible": false, "label": "Natural, Seasonal, Low", + "values": ["Natural", "Seasonal", "Low"], "settings": { "mimeType": "image/png", "offset": [0, 0], "opacity": 1, "rotation": 0, - "src": "iVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAYAAAAfSC3RAAAAAXNSR0IB2cksfwAAAAlwSFlzAAAOxAAADsQBlSsOGwAAAcNJREFUKJFjYSATsCBz/v//z/T986fw1w/u2n379EGckZHxH7eg8BMxRZVd7Jxc27Bq/P//v8izW9cmHZ/Z5vX14RF+ZEVC2j7hLx/c3Sgmr1TMyMj4Fa7x////zI+vXpp+oDE45P+/3xjOend1i8Su6hOprs3LWRgYGFLgGj88f5p2fFqNPzZNMPDvxxumU/MnhHx5/24Lj6DQBhYGBgaGF3dvev14eYkVWaGCVxHD7+/fGJ7unwEXe39tK/+re3FBDAwMEI3fP71XQdakEd7MYBYay8DAwMCwl4EBRfOXd2+UEH78958dJcQ4OeBsVi5uFCf///uXHa6RjYPrJQMDgyJM8trSRgZGJiaGPz9+MDzY2ouikZ2H9zVcI6+YxAkWHjmLP18eQQLi9xeGy/OKMQKIW86SgVdU/ABco5CiapVebKXPuemZKhiqoYCRiZVBLyzrnJSaVg9cIx8f3/cHly9EGmZMW3tlabfc78/3UTRxiOkx6EUWXOcVFg5kZGT8B9fIwMDAoKBrcObe6QN6ppnNkz6/fmn7+8d3KUYGhn+sXNwPeUUldnEzsJZIqmnDIxolrSqZOnxkYGCIx+VcZAAA8GKiZ9d12dAAAAAASUVORK5CYII=", + "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", "type": "iconSymbol" - }, - "values": ["Natural", "Seasonal", "Low"], - "visible": false + } }, { + "visible": false, "label": "Natural, Seasonal, Normal", + "values": ["Natural", "Seasonal", "Normal"], "settings": { "mimeType": "image/png", "offset": [0, 0], @@ -90,12 +82,12 @@ "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", "type": "iconSymbol" - }, - "values": ["Natural", "Seasonal", "Normal"], - "visible": false + } }, { + "visible": true, "label": "Natural, Yearly, High", + "values": ["Natural", "Yearly", "High"], "settings": { "mimeType": "image/png", "offset": [0, 0], @@ -103,12 +95,12 @@ "rotation": 0, "src": "iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAYAAABWdVznAAAAAXNSR0IB2cksfwAAAAlwSFlzAAAOxAAADsQBlSsOGwAAARhJREFUKJGNjzFLQlEYhp8OR45xaUgiIqcgEhpqb2toaFAbpTEuQTch15qD5ooEwR/QrnDr+gPammsMg7hgDsHBjtm5DXrFwbo948fzvnyvJKZUms305g/1gCKCLNABGxhHXXN71Y01CbBaPFppa3wNOcS4Yg3EltJfZfJewTSqD8OA66p2ONOEKMd0FiBqsuNu0qq/ykyYOtBE67/IMRnSqTPAkxoKCTIACvYMeBLI/icALAFCYulMDP2LLmAl2ADEdpLtwJ0BpOl/V1ValBNe+1R9ew4gadU/nN3jgpbWBxanyD2D3X+7rz0NA0DXv3kkf7KhbP/UCIoKloF3BxvMDcTFi197jtNy3NO4DA1UgIoZncxo6SQ//xRZVbXMk6kAAAAASUVORK5CYII=", "type": "iconSymbol" - }, - "values": ["Natural", "Yearly", "High"], - "visible": true + } }, { + "visible": false, "label": "Natural, Yearly, Low", + "values": ["Natural", "Yearly", "Low"], "settings": { "mimeType": "image/png", "offset": [0, 0], @@ -116,12 +108,12 @@ "rotation": 0, "src": "iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAYAAABWdVznAAAAAXNSR0IB2cksfwAAAAlwSFlzAAAOxAAADsQBlSsOGwAAASFJREFUKJGNkb1KA0EURs8Mw0YRLUREDLgIYsBCezsLSxMbgwSUJYiFpLDVWvABBAsLiVaSYGUgIXkAO7E0vbAIyUaMouyQGQt3u/x44MKF73zc4ioirnYZd7R7KCQZDEkIW9ZQdxL+Re6OIPYUwE1maRGtq0AKE0fOspCsa+0WbrNj6f1S8xFA3R+Q+OzoCpCiPzO216sUs6k1r9R8Vd22mxeSlQFyhJ6WVp8CR0pI0sPlPyxsx4WkNSN9MMw1QCoLrf9cgDDYBKMEYd3ibIwuTNQAlHn3L8WUWwCSQ+wfKb/OAJTX4KO4000LM1kFZvvI31aGub2y/wLR47xy8HS9tbCqnM6JhQwwj6RtCevgnHtlvxm3VbzkH57fgONoBvILJileSF2zp2AAAAAASUVORK5CYII=", "type": "iconSymbol" - }, - "values": ["Natural", "Yearly", "Low"], - "visible": false + } }, { + "visible": false, "label": "Natural, Yearly, Normal", + "values": ["Natural", "Yearly", "Normal"], "settings": { "mimeType": "image/png", "offset": [0, 0], @@ -129,12 +121,12 @@ "rotation": 0, "src": "iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAYAAABWdVznAAAAAXNSR0IB2cksfwAAAAlwSFlzAAAOxAAADsQBlSsOGwAAARxJREFUKJGNkS1IQ2EUQM/99u2vioj4ksWBQbuwoLDoZpSB8lgwyIJN3hBEnA6TQTAYZNpNDqZ7UdBm1m5QmQsqvjF57zNsr21uBy5cLuekq+mxe7aajMVeN0RUDgILVNOYoNGJdU728vet0NMABxfpaeG9DirVPSuAGRG1EP9NFA8vM9nSuvsAoI+viHvf0RqQoj/jGL9WqWbmHdt90d7XUgFhdoAcMmaUXwI2NUJ2iNzFsBIGFmakZBIXpTE0R9KhRYZAi9AwhsVhtsANgP4JIqdJ8YuA9Y/fRkXLAHrfdj/L1XRWSaIO/kQf2RMT5J212yfoPW7Hvns8Ol+eC3TbMcbPAVPAh5hIA3TFsevPYa3DZbtw/QZs9WYgf/xmWAwLz4rrAAAAAElFTkSuQmCC", "type": "iconSymbol" - }, - "values": ["Natural", "Yearly", "Normal"], - "visible": false + } }, { + "visible": false, "label": "Regulated, Seasonal, High", + "values": ["Regulated", "Seasonal", "High"], "settings": { "mimeType": "image/png", "offset": [0, 0], @@ -142,12 +134,12 @@ "rotation": 0, "src": "iVBORw0KGgoAAAANSUhEUgAAABMAAAAQCAYAAAD0xERiAAAAAXNSR0IB2cksfwAAAAlwSFlzAAAOxAAADsQBlSsOGwAAAf5JREFUOI2t01tI02EYBvDnrT+EmC6KYCRBglFRmJ02VlgRSqAUHUCQZY68GQ2vJGdIkHiRdNE06DAG9u8gxoJpRxJ3EQqaMYpS2VAqaqsVxGyWOmXu6WoyXbFmPXffw8vve/ngU/Afo6QaICnR6Ox1RVlqFhH+EzY9M1P1qLunuKSosBKAumiMpGbIN1putLtyX67PrSDpFJHJRWE/Jybr6mw3DQDQcKVN33rhTA2AxrQxkhvdPf2F7mAoAwDuv/+S+XrYV0zyhogE0sJCY+Hak81tuxM7y6Xbhmf2PCuA6r/GSB5qaW0vCEVjkth7JyKKu3dgB0m9iAykxEgu838KGq2dvdu2ZGXgak0l1uZo0ed5A6PdBaPdZdhn2HkaQGpsNhYzn2tR9QBw3nQYuu35AIDjpUXwDI7A1jcER3tnPskyEXH+ESOZ82rQu/euz78OALKXZ867aPUqDQCgoetFwYmjB4+QfCgiU7/FpiLT1aeaHAfi51sP3Ni6eQM02VkYffcBl7uez83WN6u71CarGYAtCSO5597j7k3eH5EV8e7O8Ec8MZ2FTrsSTwPf5m3p9Pnzakfe6kiuEZHPcxjJJd/D4+UV9o6ShW8YisaSoHhMjdf296sXLQDqEzerCgS/ljotZSn/6oJox8Ljx0h2iIhHAQARcQBwpAkl5ReILNJbf8Z/egAAAABJRU5ErkJggg==", "type": "iconSymbol" - }, - "values": ["Regulated", "Seasonal", "High"], - "visible": false + } }, { + "visible": false, "label": "Regulated, Seasonal, Low", + "values": ["Regulated", "Seasonal", "Low"], "settings": { "mimeType": "image/png", "offset": [0, 0], @@ -155,12 +147,12 @@ "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", "type": "iconSymbol" - }, - "values": ["Regulated", "Seasonal", "Low"], - "visible": false + } }, { + "visible": false, "label": "Regulated, Seasonal, Normal", + "values": ["Regulated", "Seasonal", "Normal"], "settings": { "mimeType": "image/png", "offset": [0, 0], @@ -168,12 +160,12 @@ "rotation": 0, "src": "iVBORw0KGgoAAAANSUhEUgAAABMAAAAQCAYAAAD0xERiAAAAAXNSR0IB2cksfwAAAAlwSFlzAAAOxAAADsQBlSsOGwAAAftJREFUOI2t011I01EYBvDnzX80a2UFRbWKRgVGGQvJsUZSgV2UUkQYEhFh0Ci8iOgDBt10YxG5ootgFwndlCGlq6CCaFsRfiA6RdMoXa7Bhtk+29iHT1eT6Yo167k7Dy+/83LgKPiPUfINkJR0OnWvqEgxiQj/CUukE/Wd/S+rKrbuPwmgec4YyZKxb0N1TpdFu27l5hMkW0Tk55ywWDx6xfb+ugEAXny4oz9VffMCgGsFYyRLe4be7o7Ex4sBIBAdXvTFM1BF8r6IeArCQpHJS6+6G3dld887Gg3rVzdfBtDw1xjJmmdOq45MSnafSgWVvhF7OUm9iHTkxUgu8E96jvePPtwxXylBtcGMFcs0+DjWBYfLAofLYijbaDwLID82NZU2tTlu6QGgsuwMSrXlAACjrgZunwtu3xu87nqwnWStiLT8ESOp+fTVVTkR6tsAAMWqxTMuUquWAwBGPO06/4+jh0naRCT2WyyRjDc8dV7dlzl3DrZCq9kG9cIl8Pg+Y3DcNj3bZr+x8/ShJhOAphyMpPFdb/uWVDq8NNP5g72421oLtWotwrHRGVtOhAY2ub3DFSTXiIh3GiM5LxwN1jldtw/MfkMymQNl8thu3nP+2KNzAMzZm9V/D3gP7tVdzPtXZ2VVJBo4QvKJiHQrACAiVgDWAqGc/ALxctoeg0TwJAAAAABJRU5ErkJggg==", "type": "iconSymbol" - }, - "values": ["Regulated", "Seasonal", "Normal"], - "visible": false + } }, { + "visible": false, "label": "Regulated, Yearly, High", + "values": ["Regulated", "Yearly", "High"], "settings": { "mimeType": "image/png", "offset": [0, 0], @@ -181,22 +173,20 @@ "rotation": 0, "src": "iVBORw0KGgoAAAANSUhEUgAAABIAAAAPCAYAAADphp8SAAAAAXNSR0IB2cksfwAAAAlwSFlzAAAOxAAADsQBlSsOGwAAATxJREFUOI2d079LAnEYx/F3p9yFOMS1JK0NztHQUNQmYXHQr61JyPLIwTAIgqShHxQSghZBY3/AF3Ju7X9okLZoOAr6Uhf5vYYTyUo9/WzPl+f7ep7lCRMkyWyUaumtU0u4K7KyGzE+X+5cKzeLKMq+IePjdQeYMJDbLhz0ByXSo+Dl/ULLY6UuEdfPPUOmHjqUeJFGGUXp+4DdE2TO2eMStfbzzYD1kaR9/lgtPwSGpK6KKAZ+9z9p6ghYDgYtZBZR3kybGUumZU86onzfGcpmdWruCWjtlkUqdQpMd4SM2tcWaGNtFT9TWJsW4kL8D61mhnn39rog/kA4duEWqP+F3HoBtKEgEIq4aWVSjqhctUCxRDruKG0jENKIVF4BK3eDKMom5AyGzlBe99trTcxQ/uk0P7qiMt8j0pJvr8JggMSSoswAAAAASUVORK5CYII=", "type": "iconSymbol" - }, - "values": ["Regulated", "Yearly", "High"], - "visible": false + } }, { - "label": "Regulated, Yearly, Low", + "visible": true, + "label": "Regulated, Yearly, Normal", + "values": [], "settings": { "mimeType": "image/png", "offset": [0, 0], "opacity": 1, "rotation": 0, - "src": "iVBORw0KGgoAAAANSUhEUgAAABIAAAAPCAYAAADphp8SAAAAAXNSR0IB2cksfwAAAAlwSFlzAAAOxAAADsQBlSsOGwAAAURJREFUOI2d079LAmEcx/H3HfIIYhA1HQ0tBzpXUENRe8FBduGSFoEEUUvYFCQN/aCIxrglzwgEaTioubWlPyByEQclmiLBOrxrqKQ09fSzPQ/f5/V8lq8PDzFmCSZueWs34+uEZHUC7456Z2r5mbhFpWfoA3Ub7DFkZQtKez1BmWhoyLWrSQBkkTS10fO49fDcNeTar/sgAt/HoCtedoH1rqC0PjCCI5Z+30kOiYvo8NlKtvDkGZKcvlNAapyXbQ6ABU+QGVHmgekWf0TSWmhi2Xq8bwsZmwiK4gi5VVeQfNVjYKot5C8ObyCjtmYAmMzoihbLlax/oczi+KBbK+90QABwHXFowE0Cas2N7HIKmX4vEBD2R9RVrvPGH+hSV8KOw5pH5CuynTI1ruIWlTrkIk6aGnaKg/KzOvWHsVxhriukIZ8czlrxD/361gAAAABJRU5ErkJggg==", + "src": "iVBORw0KGgoAAAANSUhEUgAAABIAAAAPCAYAAADphp8SAAAAAXNSR0IB2cksfwAAAAlwSFlzAAAOxAAADsQBlSsOGwAAAUhJREFUOI2d0z1Lw1AUBuD3hppCLSo4iLg6dFZBEYtZQgeFgB+jrSIEQXSxFUIFg1jTYhBHyWITEVwDOhXUSVz8Bf4DcahgBxtvrkNrIbamSd/tXM557llOBAGiGQtxRb779OuJdEOUm9UY+6o+6KYkZDN2rWdooF7dZ6BTdXzsATjqCSpaqTGXOblGxeVUc/JCzby8hYZc5pwAiDXLOM8GDwFsh4KOy8kJAGueRwK5cDl7nt94eg0MEdJ3BoC09XO8BmAlEFQwhSUCzHf8ANyyVhZnlPXKsy+0a4An4Er/bQoAjNBTAElfaCQq7gB03A8CMKdZgqSkH+2OUMmaHqaMHnRBGlsxrmgYuJVl0DboG/0qAYaCQAAS71FxE6gYHki7SiWY62wFRJqhqm5K19mMXWtBLnN0EuBk/mT093Rag/n0/WJIxJMfY79g/IvbH/IAAAAASUVORK5CYII=", "type": "iconSymbol" - }, - "values": ["Regulated", "Yearly", "Low"], - "visible": false + } } ] } diff --git a/packages/geoview-core/public/configs/validator/01-simple-esri-feature.json b/packages/geoview-core/public/configs/validator/01-simple-esri-feature.json index e7498be6880..3d2e1d3589a 100644 --- a/packages/geoview-core/public/configs/validator/01-simple-esri-feature.json +++ b/packages/geoview-core/public/configs/validator/01-simple-esri-feature.json @@ -19,7 +19,6 @@ "listOfLayerEntryConfig": [ { "layerId": "0", - "geometryType": "point", "layerName": "stations-Temporal", "initialSettings": { "controls": { @@ -50,29 +49,32 @@ "source": { "layerFilter": "Province = \\'Alberta\\' or Province = \\'Manitoba\\'" }, - "style": { - "type": "simple", - "hasDefault": false, - "info": [ - { - "visible": true, - "label": "", - "values": [], - "settings": { - "type": "simpleSymbol", - "rotation": 0, - "color": "rgba(156,0,130,1)", - "stroke": { - "color": "rgba(0,0,0,1)", - "lineStyle": "solid", - "width": 1 - }, - "size": 2.668, - "symbol": "square", - "offset": [0, 0] + "layerStyle": { + "Point": { + "type": "simple", + "hasDefault": false, + "fields": [], + "info": [ + { + "visible": true, + "label": "", + "values": [], + "settings": { + "type": "simpleSymbol", + "rotation": 0, + "color": "rgba(156,0,130,1)", + "stroke": { + "color": "rgba(0,0,0,1)", + "lineStyle": "solid", + "width": 1 + }, + "size": 2.668, + "symbol": "square", + "offset": [0, 0] + } } - } - ] + ] + } } } ] diff --git a/packages/geoview-core/public/configs/validator/04-geocore.json b/packages/geoview-core/public/configs/validator/04-geocore.json index ac2a3a51302..a2d995f8aac 100644 --- a/packages/geoview-core/public/configs/validator/04-geocore.json +++ b/packages/geoview-core/public/configs/validator/04-geocore.json @@ -23,7 +23,6 @@ "listOfLayerEntryConfig": [ { "layerId": "0", - "geometryType": "point", "layerName": "stations-Temporal", "initialSettings": { "controls": { diff --git a/packages/geoview-core/public/configs/validator/05-esri-feature-and-dynamic.json b/packages/geoview-core/public/configs/validator/05-esri-feature-and-dynamic.json index f53d7470336..e99542fb2bb 100644 --- a/packages/geoview-core/public/configs/validator/05-esri-feature-and-dynamic.json +++ b/packages/geoview-core/public/configs/validator/05-esri-feature-and-dynamic.json @@ -19,7 +19,6 @@ "listOfLayerEntryConfig": [ { "layerId": "0", - "geometryType": "point", "layerName": "stations-Temporal", "initialSettings": { "controls": { @@ -50,21 +49,25 @@ "source": { "layerFilter": "Province = \\'Alberta\\' or Province = \\'Manitoba\\'" }, - "style": { - "type": "simple", - "hasDefault": false, - "info": [ - { - "label": "", - "visible": false, - "settings": { - "symbol": "square", - "stroke": { - "color": "rgba(128,128,128,1)" + "layerStyle": { + "Point": { + "type": "simple", + "hasDefault": false, + "fields": [], + "info": [ + { + "label": "", + "visible": false, + "values": [], + "settings": { + "symbol": "square", + "stroke": { + "color": "rgba(128,128,128,1)" + } } } - } - ] + ] + } } } ] diff --git a/packages/geoview-core/public/datasets/geojson/hydro-metadata.meta b/packages/geoview-core/public/datasets/geojson/hydro-metadata.meta index 04b899b54aa..3ed343a924b 100644 --- a/packages/geoview-core/public/datasets/geojson/hydro-metadata.meta +++ b/packages/geoview-core/public/datasets/geojson/hydro-metadata.meta @@ -263,18 +263,26 @@ "initialSettings": { "extent": [-177.29275972275843, 34.301384132573055, -9.977229778239453, 84.400481529465] }, - "style": { + "layerStyle": { "LineString": { - "styleType": "simple", - "label": "Downstream Analysis", - "settings": { - "type": "lineString", - "stroke": { - "color": "rgba(230,123,38,1)", - "lineStyle": "shortDash-dot-dot", - "width": 2 + "type": "simple", + "hasDefault": false, + "fields": [], + "info": [ + { + "label": "Downstream Analysis", + "visible": true, + "values": [], + "settings": { + "type": "lineString", + "stroke": { + "color": "rgba(230,123,38,1)", + "lineStyle": "shortDash-dot-dot", + "width": 2 + } + } } - } + ] } } } diff --git a/packages/geoview-core/public/datasets/geojson/lines.json b/packages/geoview-core/public/datasets/geojson/lines.json index f1549049745..bcb2f88b3ab 100644 --- a/packages/geoview-core/public/datasets/geojson/lines.json +++ b/packages/geoview-core/public/datasets/geojson/lines.json @@ -1,52 +1,52 @@ -{ - "type": "FeatureCollection", - "features": [ - { - "type": "Feature", - "properties": { - "Road_Number": 55, - "Province": "Quebec", - "creationDate": "28/05/2020T12:00:00-05:00" - }, - "geometry": { - "type": "LineString", - "coordinates": [ - [-79, 49], - [-78, 46] - ] - } - }, - { - "type": "Feature", - "properties": { - "Road_Number": 55, - "Province": "Quebec", - "creationDate": "14/09/2021T13:00:00-05:00" - }, - "geometry": { - "type": "LineString", - "coordinates": [ - [-78, 49], - [-76, 46], - [-77, 49] - ] - } - }, - { - "type": "Feature", - "properties": { - "Road_Number": 20, - "Province": "Ontario", - "creationDate": "25/12/2020T12:00:00-05:00" - }, - "geometry": { - "type": "LineString", - "coordinates": [ - [-81, 51], - [-80.5, 46], - [-80, 49] - ] - } - } - ] -} +{ + "type": "FeatureCollection", + "features": [ + { + "type": "Feature", + "properties": { + "Road_Number": 55, + "Province": "Quebec", + "creationDate": "28/05/2020T12:00:00-05:00" + }, + "geometry": { + "type": "LineString", + "coordinates": [ + [-79, 49], + [-78, 46] + ] + } + }, + { + "type": "Feature", + "properties": { + "Road_Number": 55, + "Province": "Quebec", + "creationDate": "14/09/2021T13:00:00-05:00" + }, + "geometry": { + "type": "LineString", + "coordinates": [ + [-78, 49], + [-76, 46], + [-77, 49] + ] + } + }, + { + "type": "Feature", + "properties": { + "Road_Number": 20, + "Province": "Ontario", + "creationDate": "25/12/2020T12:00:00-05:00" + }, + "geometry": { + "type": "LineString", + "coordinates": [ + [-81, 51], + [-80.5, 46], + [-80, 49] + ] + } + } + ] +} diff --git a/packages/geoview-core/public/datasets/geojson/metadata-blank.meta b/packages/geoview-core/public/datasets/geojson/metadata-blank.meta index a1f46da7890..0e92f102cfe 100644 --- a/packages/geoview-core/public/datasets/geojson/metadata-blank.meta +++ b/packages/geoview-core/public/datasets/geojson/metadata-blank.meta @@ -19,14 +19,22 @@ ] } }, - "style": { + "layerStyle": { "Point": { - "styleType": "simple", - "label": "Point label", - "settings": { - "type": "simpleSymbol", - "symbol": "star" - } + "type": "simple", + "hasDefault": false, + "fields": [], + "info": [ + { + "label": "Point label", + "visible": true, + "values": [], + "settings": { + "type": "simpleSymbol", + "symbol": "star" + } + } + ] } } } diff --git a/packages/geoview-core/public/datasets/geojson/metadata.json b/packages/geoview-core/public/datasets/geojson/metadata.json index fdb16b398d9..4c35ac8bb9c 100644 --- a/packages/geoview-core/public/datasets/geojson/metadata.json +++ b/packages/geoview-core/public/datasets/geojson/metadata.json @@ -16,27 +16,16 @@ ] } }, - "style": { + "layerStyle": { "Polygon": { - "styleId": "uniqueValueId", - "defaultLabel": "Other provinces", - "styleType": "uniqueValue", - "defaultSettings": { - "type": "filledPolygon", - "color": "rgba(0,0,255,0.5)", - "paternSize": 10, - "paternWidth": 2, - "fillStyle": "diagonalCross", - "stroke": { - "color": "rgba(128,0,0,1)", - "lineStyle": "dot" - } - }, - "defaultVisible": true, + "type": "uniqueValue", "fields": ["Province"], - "uniqueValueStyleInfo": [ + "hasDefault": true, + "info": [ { "label": "Quebec", + "visible": true, + "values": ["Quebec"], "settings": { "type": "filledPolygon", "color": "rgba(0,128,128,0.5)", @@ -47,12 +36,12 @@ "color": "rgba(128,128,0,1)", "lineStyle": "dot" } - }, - "values": ["Quebec"], - "visible": true + } }, { "label": "Alberta", + "visible": false, + "values": ["Alberta"], "settings": { "type": "filledPolygon", "color": "rgba(255,0,255,0.5)", @@ -63,9 +52,23 @@ "color": "rgba(128,0,128,1)", "lineStyle": "dot" } - }, - "values": ["Alberta"], - "visible": false + } + }, + { + "label": "Other provinces", + "visible": true, + "values": [], + "settings": { + "type": "filledPolygon", + "color": "rgba(0,0,255,0.5)", + "paternSize": 10, + "paternWidth": 2, + "fillStyle": "diagonalCross", + "stroke": { + "color": "rgba(128,0,0,1)", + "lineStyle": "dot" + } + } } ] } @@ -84,24 +87,29 @@ ] } }, - "style": { + "layerStyle": { "MultiPolygon": { - "styleId": "uniqueValueId", - "defaultLabel": "Multiple provinces", - "styleType": "uniqueValue", - "defaultSettings": { - "type": "filledPolygon", - "color": "rgba(0,0,255,0.5)", - "paternSize": 10, - "paternWidth": 2, - "fillStyle": "diagonalCross", - "stroke": { - "color": "rgba(128,0,0,1)", - "lineStyle": "dot" + "type": "uniqueValue", + "fields": ["Province"], + "hasDefault": true, + "info": [ + { + "label": "Multiple provinces", + "visible": true, + "values": [], + "settings": { + "type": "filledPolygon", + "color": "rgba(0,0,255,0.5)", + "paternSize": 10, + "paternWidth": 2, + "fillStyle": "diagonalCross", + "stroke": { + "color": "rgba(128,0,0,1)", + "lineStyle": "dot" + } + } } - }, - "defaultVisible": true, - "fields": ["Province"] + ] } } }, @@ -119,16 +127,25 @@ ] } }, - "style": { + "layerStyle": { "LineString": { - "styleType": "simple", - "label": "LineString label", - "settings": { - "type": "lineString", - "stroke": { - "lineStyle": "shortDash-dot-dot" + "type": "simple", + "hasDefault": true, + "fields": [], + "info": [ + { + "label": "LineString label", + "visible": true, + "values": [], + "settings": { + "type": "lineString", + "stroke": { + "lineStyle": "shortDash-dot-dot", + "color": "rgba(128,0,0,1)" + } + } } - } + ] } } }, @@ -146,16 +163,24 @@ ] } }, - "style": { + "layerStyle": { "Point": { - "styleType": "simple", - "label": "Icon point label", - "settings": { - "type": "iconSymbol", - "mimeType": "image/png", - "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=", - "opacity": 0.5 - } + "type": "simple", + "hasDefault": false, + "fields": [], + "info": [ + { + "label": "Icon point label", + "visible": true, + "values": [], + "settings": { + "type": "iconSymbol", + "mimeType": "image/png", + "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=", + "opacity": 0.5 + } + } + ] } } }, @@ -176,14 +201,22 @@ ] } }, - "style": { + "layerStyle": { "Point": { - "styleType": "simple", - "label": "Point label", - "settings": { - "type": "simpleSymbol", - "symbol": "star" - } + "type": "simple", + "hasDefault": false, + "fields": [], + "info": [ + { + "label": "Icon point label", + "visible": true, + "values": [], + "settings": { + "type": "simpleSymbol", + "symbol": "star" + } + } + ] } } }, @@ -204,14 +237,22 @@ ] } }, - "style": { + "layerStyle": { "Point": { - "styleType": "simple", - "label": "Point label", - "settings": { - "type": "simpleSymbol", - "symbol": "star" - } + "type": "simple", + "hasDefault": false, + "fields": [], + "info": [ + { + "label": "Point label", + "visible": true, + "values": [], + "settings": { + "type": "simpleSymbol", + "symbol": "star" + } + } + ] } } }, @@ -232,14 +273,22 @@ ] } }, - "style": { + "layerStyle": { "Point": { - "styleType": "simple", - "label": "Point label", - "settings": { - "type": "simpleSymbol", - "symbol": "star" - } + "type": "simple", + "hasDefault": false, + "fields": [], + "info": [ + { + "label": "Point label", + "visible": true, + "values": [], + "settings": { + "type": "simpleSymbol", + "symbol": "star" + } + } + ] } } }, @@ -260,14 +309,22 @@ ] } }, - "style": { + "layerStyle": { "Point": { - "styleType": "simple", - "label": "Point label", - "settings": { - "type": "simpleSymbol", - "symbol": "star" - } + "type": "simple", + "hasDefault": false, + "fields": [], + "info": [ + { + "label": "Point label", + "visible": true, + "values": [], + "settings": { + "type": "simpleSymbol", + "symbol": "star" + } + } + ] } } } diff --git a/packages/geoview-core/public/datasets/geojson/metadata.meta b/packages/geoview-core/public/datasets/geojson/metadata.meta index c8ec2dba1ea..61de0d4aed9 100644 --- a/packages/geoview-core/public/datasets/geojson/metadata.meta +++ b/packages/geoview-core/public/datasets/geojson/metadata.meta @@ -16,27 +16,16 @@ ] } }, - "style": { + "layerStyle": { "Polygon": { - "styleId": "uniqueValueId", - "defaultLabel": "Other provinces", - "styleType": "uniqueValue", - "defaultSettings": { - "type": "filledPolygon", - "color": "rgba(0,0,255,0.5)", - "paternSize": 10, - "paternWidth": 2, - "fillStyle": "diagonalCross", - "stroke": { - "color": "rgba(128,0,0,1)", - "lineStyle": "dot" - } - }, - "defaultVisible": true, + "type": "uniqueValue", "fields": ["Province"], - "uniqueValueStyleInfo": [ + "hasDefault": true, + "info": [ { "label": "Quebec", + "visible": true, + "values": ["Quebec"], "settings": { "type": "filledPolygon", "color": "rgba(0,128,128,0.5)", @@ -47,12 +36,12 @@ "color": "rgba(128,128,0,1)", "lineStyle": "dot" } - }, - "values": ["Quebec"], - "visible": true + } }, { "label": "Alberta", + "visible": false, + "values": ["Alberta"], "settings": { "type": "filledPolygon", "color": "rgba(255,0,255,0.5)", @@ -63,9 +52,23 @@ "color": "rgba(128,0,128,1)", "lineStyle": "dot" } - }, - "values": ["Alberta"], - "visible": false + } + }, + { + "label": "Other provinces", + "visible": true, + "values": [], + "settings": { + "type": "filledPolygon", + "color": "rgba(0,0,255,0.5)", + "paternSize": 10, + "paternWidth": 2, + "fillStyle": "diagonalCross", + "stroke": { + "color": "rgba(128,0,0,1)", + "lineStyle": "dot" + } + } } ] } @@ -84,24 +87,29 @@ ] } }, - "style": { + "layerStyle": { "MultiPolygon": { - "styleId": "uniqueValueId", - "defaultLabel": "Multiple provinces", - "styleType": "uniqueValue", - "defaultSettings": { - "type": "filledPolygon", - "color": "rgba(0,0,255,0.5)", - "paternSize": 10, - "paternWidth": 2, - "fillStyle": "diagonalCross", - "stroke": { - "color": "rgba(128,0,0,1)", - "lineStyle": "dot" + "type": "uniqueValue", + "fields": ["Province"], + "hasDefault": true, + "info": [ + { + "label": "Multiple provinces", + "visible": true, + "values": [], + "settings": { + "type": "filledPolygon", + "color": "rgba(0,0,255,0.5)", + "paternSize": 10, + "paternWidth": 2, + "fillStyle": "diagonalCross", + "stroke": { + "color": "rgba(0,0,128,1)", + "lineStyle": "dot" + } + } } - }, - "defaultVisible": true, - "fields": ["Province"] + ] } } }, @@ -119,157 +127,493 @@ ] } }, - "style": { + "layerStyle": { "LineString": { - "styleType": "simple", - "label": "LineString label", - "settings": { - "type": "lineString", - "stroke": { - "lineStyle": "shortDash-dot-dot" + "type": "simple", + "fields": [], + "hasDefault": false, + "info": [ + { + "visible": true, + "label": "LineString label", + "values": [], + "settings": { + "type": "lineString", + "stroke": { + "lineStyle": "shortDash-dot-dot", + "color": "rgba(128,0,0,1)" + } + } } - } - } - } - }, - { - "layerId": "icon_points.json", - "layerName": "Icons", - "source": { - "featureInfo": { - "queryable": true, - "nameField": "data", - "outfields": [ - { "name": "data", "alias": "data", "type": "string", "domain": null }, - { "name": "label", "alias": "label", "type": "string", "domain": null }, - { "name": "creationDate", "alias": "Creation Date", "type": "number", "domain": null } ] } - }, - "style": { - "Point": { - "styleType": "simple", - "label": "Icon point label", - "settings": { - "type": "iconSymbol", - "mimeType": "image/png", - "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=", - "opacity": 0.5 - } - } } }, { - "layerId": "points.json", - "layerName": "Points", - "source": { - "featureInfo": { - "queryable": false, - "nameField": "Red", - "outfields": [ - { "name": "Red", "alias": "Red", "type": "number", "domain": null }, - { "name": "Green", "alias": "Green", "type": "number", "domain": null }, - { "name": "Blue", "alias": "Blue", "type": "number", "domain": null }, - { "name": "Yellow", "alias": "Yellow", "type": "number", "domain": null }, - { "name": "Orange", "alias": "Orange", "type": "number", "domain": null }, - { "name": "creationDate", "alias": "Creation Date", "type": "date", "domain": null } - ] - } - }, - "style": { - "Point": { - "styleType": "simple", - "label": "Point label", - "settings": { - "type": "simpleSymbol", - "symbol": "star" + "layerId": "pointGroup1", + "layerName": "Point Group 1", + "bounds": [77, 47, 66, 55], + "isLayerGroup": true, + "listOfLayerEntryConfig": [ + { + "layerId": "icon_points.json", + "layerName": "Icons", + "source": { + "featureInfo": { + "queryable": true, + "nameField": "data", + "outfields": [ + { + "name": "data", + "alias": "data", + "type": "string", + "domain": null + }, + { + "name": "label", + "alias": "label", + "type": "string", + "domain": null + }, + { + "name": "creationDate", + "alias": "Creation Date", + "type": "date", + "domain": null + } + ] + } + }, + "layerStyle": { + "Point": { + "type": "simple", + "fields": [], + "hasDefault": false, + "info": [ + { + "visible": true, + "label": "Icon point label", + "values": [], + "settings": { + "type": "iconSymbol", + "mimeType": "image/png", + "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=", + "opacity": 0.5 + } + } + ] + } } - } - } - }, - { - "layerId": "points_1.json", - "layerName": "Points_1", - "source": { - "featureInfo": { - "queryable": true, - "nameField": "Red", - "outfields": [ - { "name": "Red", "alias": "Red", "type": "number", "domain": null }, - { "name": "Green", "alias": "Green", "type": "number", "domain": null }, - { "name": "Blue", "alias": "Blue", "type": "number", "domain": null }, - { "name": "Yellow", "alias": "Yellow", "type": "number", "domain": null }, - { "name": "Orange", "alias": "Orange", "type": "number", "domain": null }, - { "name": "creationDate", "alias": "Creation Date", "type": "date", "domain": null } - ] - } - }, - "style": { - "Point": { - "styleType": "simple", - "label": "Point label", - "settings": { - "type": "simpleSymbol", - "symbol": "star" + }, + { + "layerId": "points.json", + "layerName": "Points", + "source": { + "featureInfo": { + "queryable": false, + "nameField": "Red", + "outfields": [ + { + "name": "Red", + "alias": "Red", + "type": "number", + "domain": null + }, + { + "name": "Green", + "alias": "Green", + "type": "number", + "domain": null + }, + { + "name": "Blue", + "alias": "Blue", + "type": "number", + "domain": null + }, + { + "name": "Yellow", + "alias": "Yellow", + "type": "number", + "domain": null + }, + { + "name": "Orange", + "alias": "Orange", + "type": "number", + "domain": null + }, + { + "name": "creationDate", + "alias": "Creation Date", + "type": "date", + "domain": null + } + ] + } + }, + "layerStyle": { + "Point": { + "type": "simple", + "fields": [], + "hasDefault": false, + "info": [ + { + "visible": true, + "label": "Point label", + "values": [], + "settings": { + "type": "simpleSymbol", + "symbol": "star" + } + } + ] + } } - } - } - }, - { - "layerId": "points_2.json", - "layerName": "Points_1", - "source": { - "featureInfo": { - "queryable": true, - "nameField": "Red", - "outfields": [ - { "name": "Red", "alias": "Red", "type": "number", "domain": null }, - { "name": "Green", "alias": "Green", "type": "number", "domain": null }, - { "name": "Blue", "alias": "Blue", "type": "number", "domain": null }, - { "name": "Yellow", "alias": "Yellow", "type": "number", "domain": null }, - { "name": "Orange", "alias": "Orange", "type": "number", "domain": null }, - { "name": "creationDate", "alias": "Creation Date", "type": "date", "domain": null } + }, + { + "layerId": "pointGroup2", + "layerName": "Point Group 2", + "isLayerGroup": true, + "listOfLayerEntryConfig": [ + { + "layerId": "points_1.json", + "layerName": "Points 1", + "source": { + "featureInfo": { + "queryable": false, + "nameField": "Red", + "outfields": [ + { + "name": "Red", + "alias": "Red", + "type": "number", + "domain": null + }, + { + "name": "Green", + "alias": "Green", + "type": "number", + "domain": null + }, + { + "name": "Blue", + "alias": "Blue", + "type": "number", + "domain": null + }, + { + "name": "Yellow", + "alias": "Yellow", + "type": "number", + "domain": null + }, + { + "name": "Orange", + "alias": "Orange", + "type": "number", + "domain": null + }, + { + "name": "creationDate", + "alias": "Creation Date", + "type": "date", + "domain": null + } + ] + } + }, + "layerStyle": { + "Point": { + "type": "simple", + "fields": [], + "hasDefault": false, + "info": [ + { + "visible": true, + "label": "Point label 1", + "values": [], + "settings": { + "type": "simpleSymbol", + "symbol": "star" + } + } + ] + } + } + }, + { + "layerId": "points_2.json", + "layerName": "Points 2", + "source": { + "featureInfo": { + "queryable": false, + "nameField": "Red", + "outfields": [ + { + "name": "Red", + "alias": "Red", + "type": "number", + "domain": null + }, + { + "name": "Green", + "alias": "Green", + "type": "number", + "domain": null + }, + { + "name": "Blue", + "alias": "Blue", + "type": "number", + "domain": null + }, + { + "name": "Yellow", + "alias": "Yellow", + "type": "number", + "domain": null + }, + { + "name": "Orange", + "alias": "Orange", + "type": "number", + "domain": null + }, + { + "name": "creationDate", + "alias": "Creation Date", + "type": "date", + "domain": null + } + ] + } + }, + "layerStyle": { + "Point": { + "type": "simple", + "fields": [], + "hasDefault": false, + "info": [ + { + "visible": true, + "label": "Point label 2", + "values": [], + "settings": { + "type": "simpleSymbol", + "symbol": "star" + } + } + ] + } + } + }, + { + "layerId": "points_3.json", + "layerName": "Points 3", + "source": { + "featureInfo": { + "queryable": false, + "nameField": "Red", + "outfields": [ + { + "name": "Red", + "alias": "Red", + "type": "number", + "domain": null + }, + { + "name": "Green", + "alias": "Green", + "type": "number", + "domain": null + }, + { + "name": "Blue", + "alias": "Blue", + "type": "number", + "domain": null + }, + { + "name": "Yellow", + "alias": "Yellow", + "type": "number", + "domain": null + }, + { + "name": "Orange", + "alias": "Orange", + "type": "number", + "domain": null + }, + { + "name": "creationDate", + "alias": "Creation Date", + "type": "date", + "domain": null + } + ] + } + }, + "layerStyle": { + "Point": { + "type": "simple", + "fields": [], + "hasDefault": false, + "info": [ + { + "visible": true, + "label": "Point label 3", + "values": [], + "settings": { + "type": "simpleSymbol", + "symbol": "star" + } + } + ] + } + } + } ] - } - }, - "style": { - "Point": { - "styleType": "simple", - "label": "Point label", - "settings": { - "type": "simpleSymbol", - "symbol": "star" + }, + { + "layerId": "points.json", + "layerName": "Points", + "source": { + "featureInfo": { + "queryable": false, + "nameField": "Red", + "outfields": [ + { "name": "Red", "alias": "Red", "type": "number", "domain": null }, + { "name": "Green", "alias": "Green", "type": "number", "domain": null }, + { "name": "Blue", "alias": "Blue", "type": "number", "domain": null }, + { "name": "Yellow", "alias": "Yellow", "type": "number", "domain": null }, + { "name": "Orange", "alias": "Orange", "type": "number", "domain": null }, + { "name": "creationDate", "alias": "Creation Date", "type": "date", "domain": null } + ] + } + }, + "style": { + "Point": { + "type": "simple", + "hasDefault": false, + "fields": [], + "info": { + "type": "simple", + "fields": [], + "label": "Point label", + "settings": { + "type": "simpleSymbol", + "symbol": "star" + } + } + } } - } - } - }, - { - "layerId": "points_3.json", - "layerName": "Points_1", - "source": { - "featureInfo": { - "queryable": false, - "nameField": "Red", - "outfields": [ - { "name": "Red", "alias": "Red", "type": "number", "domain": null }, - { "name": "Green", "alias": "Green", "type": "number", "domain": null }, - { "name": "Blue", "alias": "Blue", "type": "number", "domain": null }, - { "name": "Yellow", "alias": "Yellow", "type": "number", "domain": null }, - { "name": "Orange", "alias": "Orange", "type": "number", "domain": null }, - { "name": "creationDate", "alias": "Creation Date", "type": "date", "domain": null } - ] - } - }, - "style": { - "Point": { - "styleType": "simple", - "label": "Point label", - "settings": { - "type": "simpleSymbol", - "symbol": "star" + }, + { + "layerId": "points_1.json", + "layerName": "Points_1", + "source": { + "featureInfo": { + "queryable": true, + "nameField": "Red", + "outfields": [ + { "name": "Red", "alias": "Red", "type": "number", "domain": null }, + { "name": "Green", "alias": "Green", "type": "number", "domain": null }, + { "name": "Blue", "alias": "Blue", "type": "number", "domain": null }, + { "name": "Yellow", "alias": "Yellow", "type": "number", "domain": null }, + { "name": "Orange", "alias": "Orange", "type": "number", "domain": null }, + { "name": "creationDate", "alias": "Creation Date", "type": "date", "domain": null } + ] + } + }, + "style": { + "Point": { + "type": "simple", + "hasDefault": false, + "fields": [], + "info": { + "type": "simple", + "fields": [], + "label": "Point label", + "settings": { + "type": "simpleSymbol", + "symbol": "star" + } + } + } + } + }, + { + "layerId": "points_2.json", + "layerName": "Points_1", + "source": { + "featureInfo": { + "queryable": true, + "nameField": "Red", + "outfields": [ + { "name": "Red", "alias": "Red", "type": "number", "domain": null }, + { "name": "Green", "alias": "Green", "type": "number", "domain": null }, + { "name": "Blue", "alias": "Blue", "type": "number", "domain": null }, + { "name": "Yellow", "alias": "Yellow", "type": "number", "domain": null }, + { "name": "Orange", "alias": "Orange", "type": "number", "domain": null }, + { "name": "creationDate", "alias": "Creation Date", "type": "date", "domain": null } + ] + } + }, + "style": { + "Point": { + "type": "simple", + "hasDefault": false, + "fields": [], + "info": { + "type": "simple", + "fields": [], + "label": "Point label", + "settings": { + "type": "simpleSymbol", + "symbol": "star" + } + } + } + } + }, + { + "layerId": "points_3.json", + "layerName": "Points_1", + "source": { + "featureInfo": { + "queryable": false, + "nameField": "Red", + "outfields": [ + { "name": "Red", "alias": "Red", "type": "number", "domain": null }, + { "name": "Green", "alias": "Green", "type": "number", "domain": null }, + { "name": "Blue", "alias": "Blue", "type": "number", "domain": null }, + { "name": "Yellow", "alias": "Yellow", "type": "number", "domain": null }, + { "name": "Orange", "alias": "Orange", "type": "number", "domain": null }, + { "name": "creationDate", "alias": "Creation Date", "type": "date", "domain": null } + ] + } + }, + "style": { + "Point": { + "type": "simple", + "hasDefault": false, + "fields": [], + "info": { + "type": "simple", + "fields": [], + "label": "Point label", + "settings": { + "type": "simpleSymbol", + "symbol": "star" + } + } + } } } - } + ] } ] } + diff --git a/packages/geoview-core/public/datasets/geojson/metadata1.meta b/packages/geoview-core/public/datasets/geojson/metadata1.meta index a4d1b17aeeb..6d296257d9b 100644 --- a/packages/geoview-core/public/datasets/geojson/metadata1.meta +++ b/packages/geoview-core/public/datasets/geojson/metadata1.meta @@ -20,19 +20,15 @@ ] } }, - "style": { + "layerStyle": { "Point": { - "styleType": "uniqueValue", + "type": "uniqueValue", "fields": ["Program"], - "defaultLabel": "Other point projects", - "defaultSettings": { - "type": "simpleSymbol", - "color": "rgba(0,0,255,0.10)", - "symbol": "X" - }, - "uniqueValueStyleInfo": [ + "hasDefault": true, + "info": [ { "label": "EGP", + "visible": true, "settings": { "type": "simpleSymbol", "color": "rgba(0,255,0,0.10)", @@ -42,33 +38,31 @@ }, { "label": "TGI", + "visible": true, "settings": { "type": "simpleSymbol", "color": "rgba(0,128,128,0.10)", "symbol": "star" }, "values": ["TGI"] + }, + { + "label": "Other point projects", + "visible": true, + "settings": { + "type": "simpleSymbol", + "color": "rgba(0,0,255,0.10)", + "symbol": "X" + }, + "values": ["TGI"] } ] }, "Polygon": { - "styleId": "uniqueValueId", - "defaultLabel": "Other projects", - "styleType": "uniqueValue", - "defaultSettings": { - "type": "filledPolygon", - "color": "rgba(0,0,255,0.10)", - "paternSize": 10, - "paternWidth": 2, - "fillStyle": "diagonalCross", - "stroke": { - "color": "rgba(0,0,255,1)", - "lineStyle": "dot" - } - }, - "defaultVisible": true, + "type": "uniqueValue", + "hasDefault": true, "fields": ["Program"], - "uniqueValueStyleInfo": [ + "info": [ { "label": "EGP", "settings": { @@ -116,6 +110,22 @@ }, "values": ["GGN"], "visible": true + }, + { + "label": "Other projects", + "settings": { + "type": "filledPolygon", + "color": "rgba(0,0,255,0.10)", + "paternSize": 10, + "paternWidth": 2, + "fillStyle": "diagonalCross", + "stroke": { + "color": "rgba(0,0,255,1)", + "lineStyle": "dot" + } + }, + "values": [], + "visible": true } ] } diff --git a/packages/geoview-core/public/datasets/geojson/processes-metadata.meta b/packages/geoview-core/public/datasets/geojson/processes-metadata.meta index 4d2af06d505..952a1630f62 100644 --- a/packages/geoview-core/public/datasets/geojson/processes-metadata.meta +++ b/packages/geoview-core/public/datasets/geojson/processes-metadata.meta @@ -40,19 +40,27 @@ ] } }, - "style": { + "layerStyle": { "Point": { - "styleType": "simple", - "label": "Raster Drill process", - "settings": { - "color": "rgba(128,0,0,0.25)", - "type": "simpleSymbol", - "symbol": "star", - "stroke": { - "color": "rgba(128,0,0,1)", - "lineStyle": "solid" + "type": "simple", + "hasDefault": false, + "fields": [], + "info": [ + { + "visible": true, + "label": "Raster Drill process", + "values": [], + "settings": { + "color": "rgba(128,0,0,0.25)", + "type": "simpleSymbol", + "symbol": "star", + "stroke": { + "color": "rgba(128,0,0,1)", + "lineStyle": "solid" + } + } } - } + ] } } } diff --git a/packages/geoview-core/public/templates/layers/esri-dynamic.html b/packages/geoview-core/public/templates/layers/esri-dynamic.html index 997d035c80e..cf3fc087c01 100644 --- a/packages/geoview-core/public/templates/layers/esri-dynamic.html +++ b/packages/geoview-core/public/templates/layers/esri-dynamic.html @@ -84,24 +84,16 @@

1. Many ESRI Dynamic Layers with legend settings in the config1. Many ESRI Dynamic Layers with legend settings in the config1. Many ESRI Dynamic Layers with legend settings in the config1. Many ESRI Dynamic Layers with legend settings in the config1. Many ESRI Dynamic Layers with legend settings in the config1. Many ESRI Dynamic Layers with legend settings in the config1. Many ESRI Dynamic Layers with legend settings in the config1. Many ESRI Dynamic Layers with legend settings in the config1. Many ESRI Dynamic Layers with legend settings in the config1. Many ESRI Dynamic Layers with legend settings in the config1. Many ESRI Dynamic Layers with legend settings in the config1. Many ESRI Dynamic Layers with legend settings in the config1. Many ESRI Dynamic Layers with legend settings in the config 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', + 'fields': ['Total_CSO_Volume'], + 'hasDefault': true, + 'info': [ { - 'label': '0 m3', - 'minValue': 0, - 'maxValue': 0, 'visible': true, + 'label': '0 m3', + 'values': [0, 0], 'settings': { 'symbol': 'circle', 'type': 'simpleSymbol', @@ -310,10 +297,9 @@

1. Many ESRI Dynamic Layers with legend settings in the config1. Many ESRI Dynamic Layers with legend settings in the config 5,000,000 - ≤ 10,000,000 m3', - 'minValue': 5000000, - 'maxValue': 10000000, 'visible': true, + 'label': '> 5,000,000 - ≤ 10,000,000 m3', + 'values': [5000000, 10000000], 'settings': { 'symbol': 'circle', 'type': 'simpleSymbol', @@ -348,10 +333,9 @@

1. Many ESRI Dynamic Layers with legend settings in the config 10,000,000 - ≤ 15,000,000 m3', - 'minValue': 10000000, - 'maxValue': 15000000, 'visible': true, + 'label': '> 10,000,000 - ≤ 15,000,000 m3', + 'values': [10000000, 15000000], 'settings': { 'symbol': 'circle', 'type': 'simpleSymbol', @@ -367,10 +351,9 @@

1. Many ESRI Dynamic Layers with legend settings in the config 15,000,000 - ≤ 20,000,000 m3', - 'minValue': 15000000, - 'maxValue': 20000000, 'visible': true, + 'label': '> 15,000,000 - ≤ 20,000,000 m3', + 'values': [15000000, 20000000], 'settings': { 'symbol': 'circle', 'type': 'simpleSymbol', @@ -386,10 +369,9 @@

1. Many ESRI Dynamic Layers with legend settings in the config 20,000,000 - ≤ 25,000,000 m3', - 'minValue': 20000000, - 'maxValue': 25000000, 'visible': true, + 'label': '> 20,000,000 - ≤ 25,000,000 m3', + 'values': [20000000, 25000000], 'settings': { 'symbol': 'circle', 'type': 'simpleSymbol', @@ -405,10 +387,9 @@

1. Many ESRI Dynamic Layers with legend settings in the config 25,000,000 - ≤ 30,000,000 m3', - 'minValue': 25000000, - 'maxValue': 30000000, 'visible': true, + 'label': '> 25,000,000 - ≤ 30,000,000 m3', + 'values': [25000000, 30000000], 'settings': { 'symbol': 'circle', 'type': 'simpleSymbol', @@ -424,10 +405,9 @@

1. Many ESRI Dynamic Layers with legend settings in the config 30,000,000 - ≤ 35,000,000 m3', - 'minValue': 30000000, - 'maxValue': 35000000, 'visible': true, + 'label': '> 30,000,000 - ≤ 35,000,000 m3', + 'values': [30000000, 35000000], 'settings': { 'symbol': 'circle', 'type': 'simpleSymbol', @@ -443,10 +423,9 @@

1. Many ESRI Dynamic Layers with legend settings in the config 35,000,000 m3', - 'minValue': 35000000, - 'maxValue': 999000000, 'visible': true, + 'label': '> 35,000,000 m3', + 'values': [35000000, 999000000], 'settings': { 'symbol': 'circle', 'type': 'simpleSymbol', @@ -460,6 +439,24 @@

1. Many ESRI Dynamic Layers with legend settings in the config { cgpv.api.maps[mapId].layer.getLayerEntryConfigIds().forEach((layerPath) => { if (layerPath.startsWith(geoviewLayer.getGeoviewLayerId())) { const layerConfig = cgpv.api.maps[mapId].layer.getLayerEntryConfig(layerPath); - cgpv.api.utilities.geo.getLegendStylesFromConfig(layerConfig.style).then((legendStyle) => { + cgpv.api.utilities.geo.getLegendStylesFromConfig(layerConfig.layerStyle).then((legendStyle) => { mapButtonsDiv = document.createElement('td'); // mapButtonsDiv.style.width = '16.66%'; mapButtonsDiv.border = '1px solid black'; @@ -234,43 +234,18 @@ const createTableOfFilter = (mapId) => { }); layerConfigH2.appendChild(toggleLayerVisibility); - if (layerConfig.style) { - Object.keys(layerConfig.style).forEach((geometry) => { + if (layerConfig.layerStyle) { + Object.keys(layerConfig.layerStyle).forEach((geometry) => { const geometryText = document.createElement('p'); geometryText.innerText = `Geometry = ${geometry}`; geometryText.style.height = '15px'; mapButtonsDiv.appendChild(geometryText); - if (layerConfig.style[geometry].styleType === 'uniqueValue') { - if (layerConfig.style[geometry].defaultSettings) { - const toggleUniqueValueDefault = document.createElement('button'); - if (layerConfig.style[geometry].defaultVisible === true) - toggleUniqueValueDefault.innerText = `Hide ${layerConfig.style[geometry].defaultLabel}`; - else if (layerConfig.style[geometry].defaultVisible === false) - toggleUniqueValueDefault.innerText = `Show ${layerConfig.style[geometry].defaultLabel}`; - toggleUniqueValueDefault.addEventListener('click', (e) => { - if (layerConfig.style[geometry].defaultVisible === true) { - layerConfig.style[geometry].defaultVisible = false; - toggleUniqueValueDefault.innerText = `Show ${layerConfig.style[geometry].defaultLabel}`; - } else if (layerConfig.style[geometry].defaultVisible === false) { - layerConfig.style[geometry].defaultVisible = true; - toggleUniqueValueDefault.innerText = `Hide ${layerConfig.style[geometry].defaultLabel}`; - } - const checkbox = document.getElementById(`checkbox-${mapId}-${geoviewLayer.getGeoviewLayerId()}`); - const filterInput = document.getElementById(`filter-input-${mapId}-${geoviewLayer.getGeoviewLayerId()}`); - const filter = checkbox.value === 'true' ? filterInput.value : geoviewLayer.getLayerFilter(layerPath); - geoviewLayer.applyViewFilter(layerPath, filter, checkbox.value !== 'true'); - }); - mapButtonsDiv.appendChild(toggleUniqueValueDefault); - mapButtonsDiv.appendChild(legendStyle[geometry].defaultCanvas); - const br = document.createElement('br'); - br.style.height = '1px'; - mapButtonsDiv.appendChild(br); - } - for (let i = 0; i < layerConfig.style[geometry].uniqueValueStyleInfo.length; i++) { + if (layerConfig.layerStyle[geometry].type === 'uniqueValue') { + for (let i = 0; i < layerConfig.layerStyle[geometry].uniqueValueStyleInfo.length; i++) { const toggleUniqueValueFeature = document.createElement('button'); - if (layerConfig.style[geometry].uniqueValueStyleInfo[i].visible === true) + if (layerConfig.layerStyle[geometry].uniqueValueStyleInfo[i].visible === true) toggleUniqueValueFeature.innerText = `Hide ${layerConfig.style[geometry].uniqueValueStyleInfo[i].label}`; - else if (layerConfig.style[geometry].uniqueValueStyleInfo[i].visible === false) + else if (layerConfig.layerStyle[geometry].uniqueValueStyleInfo[i].visible === false) toggleUniqueValueFeature.innerText = `Show ${layerConfig.style[geometry].uniqueValueStyleInfo[i].label}`; toggleUniqueValueFeature.addEventListener('click', (e) => { const uniqueValueStyleInfoEntry = layerConfig.style[geometry].uniqueValueStyleInfo[i]; @@ -293,31 +268,7 @@ const createTableOfFilter = (mapId) => { br.style.height = '1px'; mapButtonsDiv.appendChild(br); } - } else if (layerConfig.style[geometry].styleType === 'classBreaks') { - if (layerConfig.style[geometry].defaultSettings) { - const toggleClassBreakDefault = document.createElement('button'); - if (layerConfig.style[geometry].defaultVisible === true) - toggleClassBreakDefault.innerText = `Hide ${layerConfig.style[geometry].defaultLabel}`; - else if (layerConfig.style[geometry].defaultVisible === false) - toggleClassBreakDefault.innerText = `Show ${layerConfig.style[geometry].defaultLabel}`; - toggleClassBreakDefault.addEventListener('click', (e) => { - if (layerConfig.style[geometry].defaultVisible === true) { - layerConfig.style[geometry].defaultVisible = false; - toggleClassBreakDefault.innerText = `Show ${layerConfig.style[geometry].defaultLabel}`; - } else if (layerConfig.style[geometry].defaultVisible === false) { - layerConfig.style[geometry].defaultVisible = true; - toggleClassBreakDefault.innerText = `Hide ${layerConfig.style[geometry].defaultLabel}`; - } - const checkbox = document.getElementById(`checkbox-${mapId}-${geoviewLayer.getGeoviewLayerId()}`); - const filterInput = document.getElementById(`filter-input-${mapId}-${geoviewLayer.getGeoviewLayerId()}`); - const filter = checkbox.value === 'true' ? filterInput.value : geoviewLayer.getLayerFilter(layerPath); - geoviewLayer.applyViewFilter(layerPath, filter, checkbox.value !== 'true'); - }); - mapButtonsDiv.appendChild(toggleClassBreakDefault); - const br = document.createElement('br'); - br.style.height = '1px'; - mapButtonsDiv.appendChild(br); - } + } else if (layerConfig.layerStyle[geometry].styleType === 'classBreaks') { for (let i = 0; i < layerConfig.style[geometry].classBreakStyleInfo.length; i++) { const toggleClassBreakFeature = document.createElement('button'); if (layerConfig.style[geometry].classBreakStyleInfo[i].visible === true) diff --git a/packages/geoview-core/public/templates/test.html b/packages/geoview-core/public/templates/test.html index 5e02fbb93eb..276f06d3a32 100644 --- a/packages/geoview-core/public/templates/test.html +++ b/packages/geoview-core/public/templates/test.html @@ -81,24 +81,16 @@

1. Many ESRI Dynamic Layers with legend settings in the config1. Many ESRI Dynamic Layers with legend settings in the config1. Many ESRI Dynamic Layers with legend settings in the config1. Many ESRI Dynamic Layers with legend settings in the config1. Many ESRI Dynamic Layers with legend settings in the config1. Many ESRI Dynamic Layers with legend settings in the config1. Many ESRI Dynamic Layers with legend settings in the config1. Many ESRI Dynamic Layers with legend settings in the config1. Many ESRI Dynamic Layers with legend settings in the config1. Many ESRI Dynamic Layers with legend settings in the config1. Many ESRI Dynamic Layers with legend settings in the config1. Many ESRI Dynamic Layers with legend settings in the config 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', + 'fields': ['Total_CSO_Volume'], + 'hasDefault': true, + 'info': [ { - 'label': '0 m3', - 'minValue': 0, - 'maxValue': 0, 'visible': true, + 'label': 'Pas de données de volume / No volume data', + 'values': [], + 'settings': { + '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 + } + } + }, + { + 'visible': true, + 'label': '0 m3', + 'values': [0, 0], 'settings': { 'symbol': 'circle', 'type': 'simpleSymbol', @@ -307,10 +312,9 @@

1. Many ESRI Dynamic Layers with legend settings in the config1. Many ESRI Dynamic Layers with legend settings in the config 5,000,000 - ≤ 10,000,000 m3', - 'minValue': 5000000, - 'maxValue': 10000000, 'visible': true, + 'label': '> 5,000,000 - ≤ 10,000,000 m3', + 'values': [5000000, 10000000], 'settings': { 'symbol': 'circle', 'type': 'simpleSymbol', @@ -345,10 +348,9 @@

1. Many ESRI Dynamic Layers with legend settings in the config 10,000,000 - ≤ 15,000,000 m3', - 'minValue': 10000000, - 'maxValue': 15000000, 'visible': true, + 'label': '> 10,000,000 - ≤ 15,000,000 m3', + 'values': [10000000, 15000000], 'settings': { 'symbol': 'circle', 'type': 'simpleSymbol', @@ -364,10 +366,9 @@

1. Many ESRI Dynamic Layers with legend settings in the config 15,000,000 - ≤ 20,000,000 m3', - 'minValue': 15000000, - 'maxValue': 20000000, 'visible': true, + 'label': '> 15,000,000 - ≤ 20,000,000 m3', + 'values': [15000000, 20000000], 'settings': { 'symbol': 'circle', 'type': 'simpleSymbol', @@ -383,10 +384,9 @@

1. Many ESRI Dynamic Layers with legend settings in the config 20,000,000 - ≤ 25,000,000 m3', - 'minValue': 20000000, - 'maxValue': 25000000, 'visible': true, + 'label': '> 20,000,000 - ≤ 25,000,000 m3', + 'values': [20000000, 25000000], 'settings': { 'symbol': 'circle', 'type': 'simpleSymbol', @@ -402,10 +402,9 @@

1. Many ESRI Dynamic Layers with legend settings in the config 25,000,000 - ≤ 30,000,000 m3', - 'minValue': 25000000, - 'maxValue': 30000000, 'visible': true, + 'label': '> 25,000,000 - ≤ 30,000,000 m3', + 'values': [25000000, 30000000], 'settings': { 'symbol': 'circle', 'type': 'simpleSymbol', @@ -421,10 +420,9 @@

1. Many ESRI Dynamic Layers with legend settings in the config 30,000,000 - ≤ 35,000,000 m3', - 'minValue': 30000000, - 'maxValue': 35000000, 'visible': true, + 'label': '> 30,000,000 - ≤ 35,000,000 m3', + 'values': [30000000, 35000000], 'settings': { 'symbol': 'circle', 'type': 'simpleSymbol', @@ -440,10 +438,9 @@

1. Many ESRI Dynamic Layers with legend settings in the config 35,000,000 m3', - 'minValue': 35000000, - 'maxValue': 999000000, 'visible': true, + 'label': '> 35,000,000 m3', + 'values': [35000000, 999000000], 'settings': { 'symbol': 'circle', 'type': 'simpleSymbol', diff --git a/packages/geoview-core/schema.json b/packages/geoview-core/schema.json index c839cce2494..64239747632 100644 --- a/packages/geoview-core/schema.json +++ b/packages/geoview-core/schema.json @@ -75,6 +75,20 @@ }, "required": ["queryable"] }, + "TypeBaseVectorGeometryConfig": { + "description": "Base type for the vector geometry types.", + "type": "object", + "properties": { + "type": { + "description": "Type of vector config.", + "$ref": "#/definitions/TypeBaseVectorType" + } + } + }, + "TypeBaseVectorType": { + "description": "Valid values for the type property of the base vector settings.", + "enum": ["lineString", "filledPolygon", "simpleSymbol", "iconSymbol"] + }, "TypeStrokeSymbolConfig": { "minProperties": 1, "additionalProperties": false, @@ -85,291 +99,274 @@ "type": "string" }, "lineStyle": { - "enum": [ - "dash", - "dash-dot", - "dash-dot-dot", - "dot", - "longDash", - "longDash-dot", - "null", - "shortDash", - "shortDash-dot", - "shortDash-dot-dot", - "solid" - ] + "$ref": "#/definitions/TypeLineStyle" }, "width": { "type": "number" } } }, + "TypeLineStyle": { + "description": "Line style to use for the feature.", + "enum": [ + "dash", + "dash-dot", + "dash-dot-dot", + "dot", + "longDash", + "longDash-dot", + "null", + "shortDash", + "shortDash-dot", + "shortDash-dot-dot", + "solid" + ] + }, "TypeLineStringVectorConfig": { "additionalProperties": false, "type": "object", - "properties": { - "type": { - "enum": ["lineString"] + "allOf": [ + { + "$ref": "#/definitions/TypeBaseVectorGeometryConfig" }, - "stroke": { - "$ref": "#/definitions/TypeStrokeSymbolConfig" + { + "type": "object", + "properties": { + "type": { + "enum": ["lineString"] + }, + "stroke": { + "$ref": "#/definitions/TypeStrokeSymbolConfig" + } + } } - }, - "required": ["type", "stroke"] + ] }, "TypePolygonVectorConfig": { - "additionalProperties": false, "type": "object", - "properties": { - "type": { - "enum": ["filledPolygon"] - }, - "color": { - "type": "string" - }, - "stroke": { - "$ref": "#/definitions/TypeStrokeSymbolConfig" - }, - "paternSize": { - "type": "number", - "description": "Distance between patern lines. Default = 8" - }, - "paternWidth": { - "type": "number", - "description": "Patern line width.default = 1." + "allOf": [ + { + "$ref": "#/definitions/TypeBaseVectorGeometryConfig" }, - "fillStyle": { - "enum": ["solid", "backwardDiagonal", "cross", "diagonalCross", "forwardDiagonal", "horizontal", "null", "vertical"], - "description": "Kind of filling for vector features. Default = solid. " + { + "type": "object", + "properties": { + "type": { + "enum": ["filledPolygon"] + }, + "color": { + "type": "string" + }, + "stroke": { + "$ref": "#/definitions/TypeStrokeSymbolConfig" + }, + "paternSize": { + "description": "Distance between patern lines.", + "type": "number", + "default": 8 + }, + "paternWidth": { + "description": "Patern line width.", + "type": "number", + "default": 1 + }, + "fillStyle": { + "description": "Kind of filling for vector features.", + "$ref": "#/definitions/TypeFillStyle", + "default": "solid" + } + } } - }, - "required": ["type", "stroke"] + ] + }, + "TypeFillStyle": { + "description": "Valid values to specify fill styles.", + "enum": ["null", "solid", "backwardDiagonal", "cross", "diagonalCross", "forwardDiagonal", "horizontal", "vertical"] }, "TypeSimpleSymbolVectorConfig": { - "additionalProperties": false, + "description": " Definition of the simple symbol vector settings type.", "type": "object", - "properties": { - "type": { - "enum": ["simpleSymbol"] - }, - "rotation": { - "type": "number", - "description": "Symbol rotation in radians." - }, - "color": { - "type": "string" - }, - "stroke": { - "$ref": "#/definitions/TypeStrokeSymbolConfig" - }, - "size": { - "type": "number" - }, - "offset": { - "type": "array", - "items": { - "type": "number" - }, - "minItems": 2, - "maxItems": 2 + "allOf": [ + { + "$ref": "#/definitions/TypeBaseVectorGeometryConfig" }, - "symbol": { - "enum": ["circle", "+", "diamond", "square", "triangle", "X", "star"] + { + "type": "object", + "properties": { + "type": { + "enum": ["simpleSymbol"] + }, + "rotation": { + "description": "Symbol rotation in radians.", + "type": "number" + }, + "color": { + "type": "string" + }, + "stroke": { + "$ref": "#/definitions/TypeStrokeSymbolConfig" + }, + "size": { + "type": "number" + }, + "offset": { + "type": "array", + "items": { + "type": "number" + }, + "minItems": 2, + "maxItems": 2 + }, + "symbol": { + "$ref": "#/definitions/TypeSymbol" + } + } } - }, - "required": ["type", "symbol"] + ] + }, + "TypeSymbol": { + "description": "Valid values to specify symbol shapes.", + "enum": ["circle", "+", "diamond", "square", "triangle", "X", "star"] }, "TypeIconSymbolVectorConfig": { - "additionalProperties": false, "type": "object", - "properties": { - "type": { - "enum": ["iconSymbol"] - }, - "mimeType": { - "type": "string" - }, - "src": { - "type": "string" - }, - "width": { - "type": "integer", - "description": "Icon width in pixel." - }, - "height": { - "type": "integer", - "description": "Icon height in pixel." + "allOf": [ + { + "$ref": "#/definitions/TypeBaseVectorGeometryConfig" }, - "rotation": { - "type": "number", - "description": "Icon rotation in radians." + { + "type": "object", + "properties": { + "type": { + "enum": ["iconSymbol"] + }, + "mimeType": { + "type": "string" + }, + "src": { + "type": "string" + }, + "width": { + "description": "Icon width in pixel.", + "type": "integer" + }, + "height": { + "description": "Icon height in pixel.", + "type": "integer" + }, + "rotation": { + "description": "Icon rotation in radians.", + "type": "number" + }, + "opacity": { + "type": "number", + "minimum": 0, + "maximum": 1, + "default": 1 + }, + "offset": { + "type": "array", + "items": { + "type": "number" + }, + "minItems": 2, + "maxItems": 2 + }, + "crossOrigin": { + "description": "The crossOrigin attribute for loaded images. Note that you must provide a crossOrigin value if you want to access pixel data with the Canvas renderer.", + "type": "string", + "default": "Anonymous" + } + } + } + ] + }, + "TypeKindOfVectorSettings": { + "oneOf": [ + { + "$ref": "#/definitions/TypeLineStringVectorConfig" }, - "opacity": { - "type": "number", - "minimum": 0, - "maximum": 1, - "default": 1 + { + "$ref": "#/definitions/TypePolygonVectorConfig" }, - "offset": { - "type": "array", - "items": { - "type": "number" - }, - "minItems": 2, - "maxItems": 2 + { + "$ref": "#/definitions/TypeSimpleSymbolVectorConfig" }, - "crossOrigin": { - "type": "string", - "description": "The crossOrigin attribute for loaded images. Note that you must provide a crossOrigin value if you want to access pixel data with the Canvas renderer." + { + "$ref": "#/definitions/TypeIconSymbolVectorConfig" } - }, - "required": ["type", "mimeType", "src"] + ] }, - "TypeSimpleStyleConfig": { + "TypeLayerStyleConfig": { "additionalProperties": false, + "minProperties": 1, "type": "object", "properties": { - "styleId": { - "type": "string" + "Point": { + "$ref": "#/definitions/TypeLayerStyleSettings" }, - "styleType": { - "enum": ["simple"] + "MultiPoint": { + "$ref": "#/definitions/TypeLayerStyleSettings" }, - "label": { - "type": "string" + "LineString": { + "$ref": "#/definitions/TypeLayerStyleSettings" }, - "settings": { - "$ref": "#/definitions/TypeKindOfVectorSettings" + "MultiLineString": { + "$ref": "#/definitions/TypeLayerStyleSettings" + }, + "Polygon": { + "$ref": "#/definitions/TypeLayerStyleSettings" + }, + "MultiPolygon": { + "$ref": "#/definitions/TypeLayerStyleSettings" } - }, - "required": ["styleType", "label", "settings"] + } }, - "TypeUniqueValueStyleConfig": { - "additionalProperties": false, + "TypeLayerStyleSettings": { "type": "object", "properties": { - "styleId": { - "type": "string" - }, - "styleType": { - "enum": ["uniqueValue"] - }, - "defaultLabel": { - "type": "string", - "description": "Label used if field/value association is not found." - }, - "defaultVisible": { - "type": "boolean", - "description": "Flag used to show/hide features associated to the default label (default: true)." - }, - "defaultSettings": { - "$ref": "#/definitions/TypeKindOfVectorSettings", - "description": "Settings used if field/value association is not found." + "type": { + "description": "The type of style used by the layer.", + "$ref": "#/definitions/TypeLayerStyleConfigType" }, "fields": { "type": "array", "items": { "type": "string" - }, - "minItems": 1 + } }, - "uniqueValueStyleInfo": { - "$ref": "#/definitions/TypeUniqueValueStyleInfo" - } - }, - "required": ["styleType", "fields", "uniqueValueStyleInfo"] - }, - "TypeUniqueValueStyleInfo": { - "type": "array", - "items": { - "additionalProperties": false, - "type": "object", - "properties": { - "label": { - "type": "string" - }, - "visible": { - "type": "boolean", - "description": "Flag used to show/hide features associated to the label (default: true)." - }, - "values": { - "type": "array", - "items": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "number" - } - ] - }, - "minItems": 1 - }, - "settings": { - "$ref": "#/definitions/TypeKindOfVectorSettings" + "hasDefault": { + "description": "Flag used to indicate that the symbology has a default value.", + "type": "boolean" + }, + "info": { + "description": "Array of style information.", + "type": "array", + "items": { + "$ref": "#/definitions/TypeLayerStyleConfigInfo" } } - }, - "minItems": 1, - "required": ["label", "values", "options"] + } }, - "TypeClassBreakStyleConfig": { - "additionalProperties": false, + "TypeLayerStyleConfigType": { + "description": "Valid keys for the type property of style configurations.", + "enum": ["simple", "uniqueValue", "classBreaks"] + }, + "TypeLayerStyleConfigInfo": { "type": "object", "properties": { - "styleId": { - "type": "string" - }, - "styleType": { - "enum": ["classBreaks"] - }, - "defaultLabel": { - "type": "string", - "description": "Label used if field/value association is not found." - }, - "defaultVisible": { + "visible": { + "description": "Flag used to show/hide features associated to the label.", "type": "boolean", - "description": "Flag used to show/hide features associated to the default label (default: true)." - }, - "defaultSettings": { - "$ref": "#/definitions/TypeKindOfVectorSettings", - "description": "Settings used if field/value association is not found." + "default": true }, - "field": { + "label": { "type": "string" }, - "classBreakStyleInfo": { - "$ref": "#/definitions/TypeClassBreakStyleInfo" - } - }, - "required": ["styleType", "field", "classBreakStyleInfo"] - }, - "TypeClassBreakStyleInfo": { - "additionalProperties": false, - "type": "array", - "items": { - "additionalProperties": false, - "type": "object", - "properties": { - "label": { - "type": "string" - }, - "visible": { - "type": "boolean", - "description": "Flag used to show/hide features associated to the label (default: true)." - }, - "minValue": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "number" - } - ] - }, - "maxValue": { + "values": { + "description": "Simple type has an empty array; uniqueValue type has many entries (up to 3 for ESRI) and classBreaks type has two entries (index 0 for min and index 1 for max).", + "type": "array", + "items": { "oneOf": [ { "type": "string" @@ -378,57 +375,10 @@ "type": "number" } ] - }, - "settings": { - "$ref": "#/definitions/TypeKindOfVectorSettings" } - } - }, - "minItems": 1, - "required": ["label", "minValue", "maxValue", "settings"] - }, - "TypeKindOfVectorSettings": { - "oneOf": [ - { - "$ref": "#/definitions/TypeLineStringVectorConfig" - }, - { - "$ref": "#/definitions/TypePolygonVectorConfig" }, - { - "$ref": "#/definitions/TypeSimpleSymbolVectorConfig" - }, - { - "$ref": "#/definitions/TypeIconSymbolVectorConfig" - } - ] - }, - "TypeStyleSettings": { - "oneOf": [ - { - "$ref": "#/definitions/TypeSimpleStyleConfig" - }, - { - "$ref": "#/definitions/TypeUniqueValueStyleConfig" - }, - { - "$ref": "#/definitions/TypeClassBreakStyleConfig" - } - ] - }, - "TypeStyleConfig": { - "additionalProperties": false, - "minProperties": 1, - "type": "object", - "properties": { - "Point": { - "$ref": "#/definitions/TypeStyleSettings" - }, - "LineString": { - "$ref": "#/definitions/TypeStyleSettings" - }, - "Polygon": { - "$ref": "#/definitions/TypeStyleSettings" + "settings": { + "$ref": "#/definitions/TypeKindOfVectorSettings" } } }, @@ -617,7 +567,7 @@ "$ref": "#/definitions/TypeOfServer", "description": "The type of the remote WMS server. The default value is mapserver." }, - "style": { + "wmsStyle": { "oneOf": [ { "type": "string", @@ -803,8 +753,8 @@ "source": { "$ref": "#/definitions/TypeVectorSourceInitialConfig" }, - "style": { - "$ref": "#/definitions/TypeStyleConfig" + "layerStyle": { + "$ref": "#/definitions/TypeLayerStyleConfig" }, "not": { "listOfLayerEntryConfig": { @@ -850,8 +800,8 @@ "$ref": "#/definitions/TypeVectorTileSourceInitialConfig", "description": "Information used to configure the source of a vector tile layer." }, - "style": { - "$ref": "#/definitions/TypeStyleConfig" + "layerStyle": { + "$ref": "#/definitions/TypeLayerStyleConfig" }, "not": { "listOfLayerEntryConfig": { @@ -920,8 +870,8 @@ "source": { "$ref": "#/definitions/TypeSourceImageWmsInitialConfig" }, - "style": { - "$ref": "#/definitions/TypeStyleConfig" + "layerStyle": { + "$ref": "#/definitions/TypeLayerStyleConfig" }, "not": { "listOfLayerEntryConfig": { @@ -965,8 +915,8 @@ "source": { "$ref": "#/definitions/TypeSourceImageEsriInitialConfig" }, - "style": { - "$ref": "#/definitions/TypeStyleConfig" + "layerStyle": { + "$ref": "#/definitions/TypeLayerStyleConfig" }, "not": { "listOfLayerEntryConfig": { @@ -1010,8 +960,8 @@ "source": { "$ref": "#/definitions/TypeSourceImageEsriInitialConfig" }, - "style": { - "$ref": "#/definitions/TypeStyleConfig" + "layerStyle": { + "$ref": "#/definitions/TypeLayerStyleConfig" }, "not": { "listOfLayerEntryConfig": { diff --git a/packages/geoview-core/src/api/config/esri-renderer-parser.ts b/packages/geoview-core/src/api/config/esri-renderer-parser.ts index 94522b50584..2c3806a963e 100644 --- a/packages/geoview-core/src/api/config/esri-renderer-parser.ts +++ b/packages/geoview-core/src/api/config/esri-renderer-parser.ts @@ -8,10 +8,11 @@ import { TypeLineStyle, TypeLineStringVectorConfig, TypeSimpleSymbolVectorConfig, - TypeStyleConfig, TypeStyleGeometry, TypeSymbol, - TypeStyleConfigInfo, + TypeLayerStyleConfigInfo, + TypeLayerStyleSettings, + TypeLayerStyleConfig, } from '@config/types/map-schema-types'; import { @@ -437,9 +438,9 @@ function convertSymbol(symbol: EsriSymbol): TypeKindOfVectorSettings | undefined * @returns {TypeStyleGeometry | undefined} The Geoview style key or undefined if it can not be determined. */ function getStyleGeometry(settings: TypeKindOfVectorSettings): TypeStyleGeometry | undefined { - if (isIconSymbolVectorConfig(settings) || isSimpleSymbolVectorConfig(settings)) return 'point'; - if (isFilledPolygonVectorConfig(settings)) return 'polygon'; - if (isLineStringVectorConfig(settings)) return 'linestring'; + if (isIconSymbolVectorConfig(settings) || isSimpleSymbolVectorConfig(settings)) return 'Point'; + if (isFilledPolygonVectorConfig(settings)) return 'Polygon'; + if (isLineStringVectorConfig(settings)) return 'LineString'; return undefined; } @@ -448,14 +449,15 @@ function getStyleGeometry(settings: TypeKindOfVectorSettings): TypeStyleGeometry * * @param {EsriUniqueValueRenderer} renderer - ESRI renderer to convert. * - * @returns {TypeStyleConfig | undefined} The Geoview style or undefined if it can not be created. + * @returns {TypeLayerStyleConfig | undefined} The Geoview style or undefined if it can not be created. */ -function processUniqueValueRenderer(renderer: EsriUniqueValueRenderer): TypeStyleConfig | undefined { +function processUniqueValueRenderer(renderer: EsriUniqueValueRenderer): TypeLayerStyleConfig | undefined { const styleType = 'uniqueValue'; + const style: TypeLayerStyleConfig = {}; const fields = [renderer.field1]; if (renderer.field2) fields.push(renderer.field2); if (renderer.field3) fields.push(renderer.field3); - const uniqueValueStyleInfo: TypeStyleConfigInfo[] = []; + const uniqueValueStyleInfo: TypeLayerStyleConfigInfo[] = []; renderer.uniqueValueInfos.forEach((symbolInfo) => { const settings = convertSymbol(symbolInfo.symbol); if (settings) { @@ -487,15 +489,18 @@ function processUniqueValueRenderer(renderer: EsriUniqueValueRenderer): TypeStyl } const styleGeometry = getStyleGeometry(uniqueValueStyleInfo[0].settings); + const styleSettings: TypeLayerStyleSettings = { + type: styleType, + fields, + hasDefault, + info: uniqueValueStyleInfo, + }; + if (styleGeometry) { - const style: TypeStyleConfig = { - type: styleType, - fields, - hasDefault, - info: uniqueValueStyleInfo, - }; + style[styleGeometry] = styleSettings; return style; } + return undefined; } @@ -504,26 +509,29 @@ function processUniqueValueRenderer(renderer: EsriUniqueValueRenderer): TypeStyl * * @param {EsriSimpleRenderer} renderer - ESRI renderer to convert. * - * @returns {TypeStyleConfig | undefined} The Geoview style or undefined if it can not be created. + * @returns {TypeLayerStyleConfig | undefined} The Geoview style or undefined if it can not be created. */ -function processSimpleRenderer(renderer: EsriSimpleRenderer): TypeStyleConfig | undefined { +function processSimpleRenderer(renderer: EsriSimpleRenderer): TypeLayerStyleConfig | undefined { const { label } = renderer; + const style: TypeLayerStyleConfig = {}; const settings = convertSymbol(renderer.symbol); if (settings) { if (renderer.rotationType === 'geographic' && (isIconSymbolVectorConfig(settings) || isSimpleSymbolVectorConfig(settings))) settings.rotation = Math.PI / 2 - settings.rotation!; const styleGeometry = getStyleGeometry(settings); - const styleSettings: TypeStyleConfigInfo = { visible: true, label, values: [], settings }; + const styleInfo: TypeLayerStyleConfigInfo = { visible: true, label, values: [], settings }; if (styleGeometry) { - const style: TypeStyleConfig = { + const styleSettings: TypeLayerStyleSettings = { type: 'simple', fields: [], hasDefault: false, - info: [styleSettings], + info: [styleInfo], }; + style[styleGeometry] = styleSettings; return style; } } + return undefined; } @@ -532,18 +540,18 @@ function processSimpleRenderer(renderer: EsriSimpleRenderer): TypeStyleConfig | * * @param {EsriClassBreakRenderer} EsriRenderer - ESRI renderer to convert. * - * @returns {TypeStyleConfig | undefined} The Geoview style or undefined if it can not be created. + * @returns {TypeLayerStyleConfig | undefined} The Geoview style or undefined if it can not be created. */ -function processClassBreakRenderer(EsriRenderer: EsriClassBreakRenderer): TypeStyleConfig | undefined { - const styleType = 'classBreaks'; +function processClassBreakRenderer(EsriRenderer: EsriClassBreakRenderer): TypeLayerStyleConfig | undefined { const { field } = EsriRenderer; - const classBreakStyleInfo: TypeStyleConfigInfo[] = []; + const style: TypeLayerStyleConfig = {}; + const classBreakStyleInfo: TypeLayerStyleConfigInfo[] = []; for (let i = 0; i < EsriRenderer.classBreakInfos.length; i++) { const settings = convertSymbol(EsriRenderer.classBreakInfos[i].symbol); if (settings) { if (EsriRenderer.rotationType === 'geographic' && (isIconSymbolVectorConfig(settings) || isSimpleSymbolVectorConfig(settings))) settings.rotation = Math.PI / 2 - settings.rotation!; - const geoviewClassBreakInfo: TypeStyleConfigInfo = { + const geoviewClassBreakInfo: TypeLayerStyleConfigInfo = { label: EsriRenderer.classBreakInfos[i].label, visible: true, values: [EsriRenderer.classBreakInfos[i].classMinValue as number, EsriRenderer.classBreakInfos[i].classMaxValue], @@ -575,12 +583,14 @@ function processClassBreakRenderer(EsriRenderer: EsriClassBreakRenderer): TypeSt const styleGeometry = getStyleGeometry(classBreakStyleInfo[0].settings); if (styleGeometry) { - const style: TypeStyleConfig = { - type: styleType, + const styleSettings: TypeLayerStyleSettings = { + type: 'classBreaks', fields: [field], hasDefault, info: classBreakStyleInfo, }; + + style[styleGeometry] = styleSettings; return style; } return undefined; @@ -591,9 +601,9 @@ function processClassBreakRenderer(EsriRenderer: EsriClassBreakRenderer): TypeSt * * @param {EsriBaseRenderer} renderer - ESRI renderer to convert. * - * @returns {TypeStyleConfig | undefined} The Geoview style or undefined if it can not be created. + * @returns {TypeLayerStyleSettings | undefined} The Geoview style or undefined if it can not be created. */ -export function createStyleUsingEsriRenderer(renderer: EsriBaseRenderer): TypeStyleConfig | undefined { +export function createStyleUsingEsriRenderer(renderer: EsriBaseRenderer): TypeLayerStyleConfig | undefined { if (esriRendererIsUniqueValue(renderer)) return processUniqueValueRenderer(renderer); if (esriRendererIsSimple(renderer)) return processSimpleRenderer(renderer); if (esriRendererIsClassBreaks(renderer)) return processClassBreakRenderer(renderer); diff --git a/packages/geoview-core/src/api/config/types/classes/geoview-config/abstract-geoview-esri-layer-config.ts b/packages/geoview-core/src/api/config/types/classes/geoview-config/abstract-geoview-esri-layer-config.ts index 3bb43ba7faa..3ccf7deb94a 100644 --- a/packages/geoview-core/src/api/config/types/classes/geoview-config/abstract-geoview-esri-layer-config.ts +++ b/packages/geoview-core/src/api/config/types/classes/geoview-config/abstract-geoview-esri-layer-config.ts @@ -248,17 +248,18 @@ export abstract class AbstractGeoviewEsriLayerConfig extends AbstractGeoviewLaye */ static convertEsriGeometryTypeToOLGeometryType(esriGeometryType: string): TypeStyleGeometry { // TODO: Update with style refactor PR (function esriConvertEsriGeometryTypeToOLGeometryType gv-layer/util). Use only one function! + // TODO: Update to support all esri geometry types switch (esriGeometryType) { case 'esriGeometryPoint': case 'esriGeometryMultipoint': - return 'point'; + return 'Point'; case 'esriGeometryPolyline': - return 'linestring'; + return 'LineString'; case 'esriGeometryPolygon': case 'esriGeometryMultiPolygon': - return 'polygon'; + return 'Polygon'; default: throw new Error(`Unsupported geometry type: ${esriGeometryType}`); diff --git a/packages/geoview-core/src/api/config/types/classes/geoview-config/vector-config/geojson-config.ts b/packages/geoview-core/src/api/config/types/classes/geoview-config/vector-config/geojson-config.ts index b8a7043e48c..97a41ab7a04 100644 --- a/packages/geoview-core/src/api/config/types/classes/geoview-config/vector-config/geojson-config.ts +++ b/packages/geoview-core/src/api/config/types/classes/geoview-config/vector-config/geojson-config.ts @@ -44,20 +44,22 @@ export class GeoJsonLayerConfig extends AbstractGeoviewLayerConfig { */ constructor(geoviewLayerConfig: TypeJsonObject, language: TypeDisplayLanguage) { super(geoviewLayerConfig, language); - const metadataAccessPathItems = this.metadataAccessPath.split('/'); - const pathItemLength = metadataAccessPathItems.length; - const lastPathItem = metadataAccessPathItems[pathItemLength - 1]; - if (lastPathItem.toLowerCase().endsWith('.json') || lastPathItem.toLowerCase().endsWith('.geojson')) { - // The metadataAccessPath ends with a layer reference. It is therefore a path to a data layer rather than a path to service metadata. - // We therefore need to correct the configuration by separating the layer index and the path to the service metadata. - this.metadataAccessPath = metadataAccessPathItems.slice(0, -1).join('/'); - if (this.listOfLayerEntryConfig.length) { - this.setErrorDetectedFlag(); - logger.logError('When a GeoJson metadataAccessPath ends with a layer file name, the listOfLayerEntryConfig must be empty.'); + if (this.metadataAccessPath) { + const metadataAccessPathItems = this.metadataAccessPath.split('/'); + const pathItemLength = metadataAccessPathItems.length; + const lastPathItem = metadataAccessPathItems[pathItemLength - 1]; + if (lastPathItem.toLowerCase().endsWith('.json') || lastPathItem.toLowerCase().endsWith('.geojson')) { + // The metadataAccessPath ends with a layer reference. It is therefore a path to a data layer rather than a path to service metadata. + // We therefore need to correct the configuration by separating the layer index and the path to the service metadata. + this.metadataAccessPath = metadataAccessPathItems.slice(0, -1).join('/'); + if (this.listOfLayerEntryConfig.length) { + this.setErrorDetectedFlag(); + logger.logError('When a GeoJson metadataAccessPath ends with a layer file name, the listOfLayerEntryConfig must be empty.'); + } + this.listOfLayerEntryConfig = [ + this.createLeafNode(toJsonObject({ layerId: lastPathItem, layerName: lastPathItem }), language, this)!, + ]; } - this.listOfLayerEntryConfig = [ - this.createLeafNode(toJsonObject({ layerId: lastPathItem, layerName: lastPathItem }), language, this)!, - ]; } } // #endregion CONSTRUCTOR diff --git a/packages/geoview-core/src/api/config/types/classes/sub-layer-config/leaf/raster/esri-dynamic-layer-entry-config.ts b/packages/geoview-core/src/api/config/types/classes/sub-layer-config/leaf/raster/esri-dynamic-layer-entry-config.ts index 38dcc54390e..9e4ad223f4f 100644 --- a/packages/geoview-core/src/api/config/types/classes/sub-layer-config/leaf/raster/esri-dynamic-layer-entry-config.ts +++ b/packages/geoview-core/src/api/config/types/classes/sub-layer-config/leaf/raster/esri-dynamic-layer-entry-config.ts @@ -1,7 +1,7 @@ import { CV_CONST_SUB_LAYER_TYPES, CV_CONST_LEAF_LAYER_SCHEMA_PATH } from '@config/types/config-constants'; import { Cast } from '@config/types/config-types'; import { - TypeStyleConfig, + TypeLayerStyleConfig, TypeLayerEntryType, TypeSourceEsriDynamicInitialConfig, TypeEsriFormatParameter, @@ -23,7 +23,7 @@ export class EsriDynamicLayerEntryConfig extends AbstractBaseEsriLayerEntryConfi declare source: TypeSourceEsriDynamicInitialConfig; /** Style to apply to the raster layer. */ - style?: TypeStyleConfig; + layerStyle?: TypeLayerStyleConfig; // #endregion PROPERTIES // =============== @@ -74,7 +74,7 @@ export class EsriDynamicLayerEntryConfig extends AbstractBaseEsriLayerEntryConfi }; const renderer = Cast(layerMetadata.drawingInfo?.renderer); - if (renderer) this.style = createStyleUsingEsriRenderer(renderer); + if (renderer) this.layerStyle = createStyleUsingEsriRenderer(renderer); this.processTemporalDimension(layerMetadata.timeInfo); } diff --git a/packages/geoview-core/src/api/config/types/classes/sub-layer-config/leaf/raster/wms-layer-entry-config.ts b/packages/geoview-core/src/api/config/types/classes/sub-layer-config/leaf/raster/wms-layer-entry-config.ts index 8ce767101bb..a92e221fa7e 100644 --- a/packages/geoview-core/src/api/config/types/classes/sub-layer-config/leaf/raster/wms-layer-entry-config.ts +++ b/packages/geoview-core/src/api/config/types/classes/sub-layer-config/leaf/raster/wms-layer-entry-config.ts @@ -1,6 +1,12 @@ import { CV_CONST_SUB_LAYER_TYPES, CV_CONST_LEAF_LAYER_SCHEMA_PATH } from '@config/types/config-constants'; import { TypeJsonArray, TypeJsonObject } from '@config/types/config-types'; -import { TypeStyleConfig, TypeLayerEntryType, TypeSourceWmsInitialConfig, Extent, WmsLayerConfig } from '@config/types/map-schema-types'; +import { + TypeLayerStyleConfig, + TypeLayerEntryType, + TypeSourceWmsInitialConfig, + Extent, + WmsLayerConfig, +} from '@config/types/map-schema-types'; import { AbstractBaseLayerEntryConfig } from '@config/types/classes/sub-layer-config/leaf/abstract-base-layer-entry-config'; import { isvalidComparedToInternalSchema } from '@config/utils'; import { GeoviewLayerConfigError } from '@config/types/classes/config-exceptions'; @@ -21,7 +27,7 @@ export class WmsLayerEntryConfig extends AbstractBaseLayerEntryConfig { declare source: TypeSourceWmsInitialConfig; /** Style to apply to the raster layer. */ - style?: TypeStyleConfig; + layerStyle?: TypeLayerStyleConfig; // #endregion PROPERTIES // =============== diff --git a/packages/geoview-core/src/api/config/types/classes/sub-layer-config/leaf/vector/esri-feature-layer-entry-config.ts b/packages/geoview-core/src/api/config/types/classes/sub-layer-config/leaf/vector/esri-feature-layer-entry-config.ts index 85eafd55bf6..93d54b49cd4 100644 --- a/packages/geoview-core/src/api/config/types/classes/sub-layer-config/leaf/vector/esri-feature-layer-entry-config.ts +++ b/packages/geoview-core/src/api/config/types/classes/sub-layer-config/leaf/vector/esri-feature-layer-entry-config.ts @@ -2,7 +2,7 @@ import { CV_CONST_SUB_LAYER_TYPES, CV_CONST_LEAF_LAYER_SCHEMA_PATH } from '@conf import { Cast } from '@config/types/config-types'; import { AbstractBaseEsriLayerEntryConfig } from '@config/types/classes/sub-layer-config/leaf/abstract-base-esri-layer-entry-config'; import { - TypeStyleConfig, + TypeLayerStyleConfig, TypeLayerEntryType, TypeSourceEsriFeatureInitialConfig, TypeVectorSourceFormats, @@ -22,7 +22,7 @@ export class EsriFeatureLayerEntryConfig extends AbstractBaseEsriLayerEntryConfi declare source: TypeSourceEsriFeatureInitialConfig; /** Style to apply to the feature layer. */ - style?: TypeStyleConfig; + layerStyle?: TypeLayerStyleConfig; // #endregion PUBLIC PROPERTIES // =============== @@ -73,7 +73,7 @@ export class EsriFeatureLayerEntryConfig extends AbstractBaseEsriLayerEntryConfi }; const renderer = Cast(layerMetadata.drawingInfo?.renderer); - if (renderer) this.style = createStyleUsingEsriRenderer(renderer); + if (renderer) this.layerStyle = createStyleUsingEsriRenderer(renderer); this.processTemporalDimension(layerMetadata.timeInfo); } diff --git a/packages/geoview-core/src/api/config/types/classes/sub-layer-config/leaf/vector/geojson-layer-entry-config.ts b/packages/geoview-core/src/api/config/types/classes/sub-layer-config/leaf/vector/geojson-layer-entry-config.ts index 1b27088491c..071d2d13e90 100644 --- a/packages/geoview-core/src/api/config/types/classes/sub-layer-config/leaf/vector/geojson-layer-entry-config.ts +++ b/packages/geoview-core/src/api/config/types/classes/sub-layer-config/leaf/vector/geojson-layer-entry-config.ts @@ -1,7 +1,7 @@ import { CV_CONST_SUB_LAYER_TYPES, CV_CONST_LEAF_LAYER_SCHEMA_PATH } from '@config/types/config-constants'; import { Cast } from '@config/types/config-types'; import { - TypeStyleConfig, + TypeLayerStyleConfig, TypeLayerEntryType, TypeSourceGeoJsonInitialConfig, TypeFeatureInfoLayerConfig, @@ -32,7 +32,7 @@ export class GeoJsonLayerEntryConfig extends AbstractBaseLayerEntryConfig { declare source: TypeSourceGeoJsonInitialConfig; /** Style to apply to the raster layer. */ - style?: TypeStyleConfig; + layerStyle?: TypeLayerStyleConfig; // #endregion PROPERTIES // =============== @@ -149,7 +149,7 @@ export class GeoJsonLayerEntryConfig extends AbstractBaseLayerEntryConfig { this.initialSettings = Cast(merge(this.initialSettings, layerMetadata.initialSettings)); this.source.featureInfo = Cast(merge(this.source.featureInfo, layerMetadata.source.featureInfo)); - this.style = Cast(merge(this.style, layerMetadata.style)); + this.layerStyle = Cast(merge(this.layerStyle, layerMetadata.style)); this.temporalDimension = Cast(merge(this.temporalDimension, layerMetadata.temporalDimension)); if (layerMetadata?.initialSettings?.extent) { diff --git a/packages/geoview-core/src/api/config/types/classes/sub-layer-config/leaf/vector/wfs-layer-entry-config.ts b/packages/geoview-core/src/api/config/types/classes/sub-layer-config/leaf/vector/wfs-layer-entry-config.ts index 3f82b3f8383..35c04eca0cc 100644 --- a/packages/geoview-core/src/api/config/types/classes/sub-layer-config/leaf/vector/wfs-layer-entry-config.ts +++ b/packages/geoview-core/src/api/config/types/classes/sub-layer-config/leaf/vector/wfs-layer-entry-config.ts @@ -1,7 +1,7 @@ import { CV_CONST_SUB_LAYER_TYPES, CV_CONST_LEAF_LAYER_SCHEMA_PATH } from '@config/types/config-constants'; import { Cast, TypeJsonArray, TypeJsonObject } from '@config/types/config-types'; import { - TypeStyleConfig, + TypeLayerStyleConfig, TypeLayerEntryType, TypeSourceWfsInitialConfig, Extent, @@ -30,7 +30,7 @@ export class WfsLayerEntryConfig extends AbstractBaseLayerEntryConfig { declare source: TypeSourceWfsInitialConfig; /** Style to apply to the raster layer. */ - style?: TypeStyleConfig; + layerStyle?: TypeLayerStyleConfig; // #endregion PROPERTIES // =============== diff --git a/packages/geoview-core/src/api/config/types/config-validation-schema.json b/packages/geoview-core/src/api/config/types/config-validation-schema.json index a4f092cb0da..04391f35627 100644 --- a/packages/geoview-core/src/api/config/types/config-validation-schema.json +++ b/packages/geoview-core/src/api/config/types/config-validation-schema.json @@ -435,7 +435,7 @@ } } }, - "required": ["geoviewLayerType", "metadataAccessPath", "listOfLayerEntryConfig"] + "required": ["geoviewLayerType", "listOfLayerEntryConfig"] }, "TypeListOfLayerEntryConfig": { "description": "The list of layer configurations. The AbstractGeoviewLayerConfig validation ends here. The only thing we need to verify for the moment is it must be an array of at least one element.", @@ -1032,8 +1032,8 @@ "source": { "$ref": "#/definitions/TypeSourceEsriDynamicInitialConfig" }, - "style": { - "$ref": "#/definitions/TypeStyleConfig" + "layerStyle": { + "$ref": "#/definitions/TypeLayerStyleConfig" } } } @@ -1056,8 +1056,8 @@ "source": { "$ref": "#/definitions/TypeSourceEsriImageInitialConfig" }, - "style": { - "$ref": "#/definitions/TypeStyleConfig" + "layerStyle": { + "$ref": "#/definitions/TypeLayerStyleConfig" } } } @@ -1084,8 +1084,8 @@ "source": { "$ref": "#/definitions/TypeSourceEsriFeatureInitialConfig" }, - "style": { - "$ref": "#/definitions/TypeStyleConfig" + "layerStyle": { + "$ref": "#/definitions/TypeLayerStyleConfig" } } } @@ -1105,8 +1105,8 @@ "source": { "$ref": "#/definitions/TypeBaseVectorSourceInitialConfig" }, - "style": { - "$ref": "#/definitions/TypeStyleConfig" + "layerStyle": { + "$ref": "#/definitions/TypeLayerStyleConfig" } } } @@ -1126,8 +1126,8 @@ "source": { "$ref": "#/definitions/TypeSourceWmsInitialConfig" }, - "style": { - "$ref": "#/definitions/TypeStyleConfig" + "layerStyle": { + "$ref": "#/definitions/TypeLayerStyleConfig" } } } @@ -1147,8 +1147,8 @@ "source": { "$ref": "#/definitions/TypeSourceWfsInitialConfig" }, - "style": { - "$ref": "#/definitions/TypeStyleConfig" + "layerStyle": { + "$ref": "#/definitions/TypeLayerStyleConfig" } } } @@ -1156,7 +1156,7 @@ }, "TypeStyleGeometry": { "description": "Valid keys for the geometryType property.", - "enum": ["point", "linestring", "polygon"] + "enum": ["Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon"] }, "TypeBaseSourceInitialConfig": { "description": "Base type from which we derive the source properties for all the leaf nodes in the layer tree.", @@ -1614,12 +1614,37 @@ } } }, - "TypeStyleConfig": { + "TypeLayerStyleConfig": { + "additionalProperties": false, + "minProperties": 1, + "type": "object", + "properties": { + "Point": { + "$ref": "#/definitions/TypeLayerStyleSettings" + }, + "MultiPoint": { + "$ref": "#/definitions/TypeLayerStyleSettings" + }, + "LineString": { + "$ref": "#/definitions/TypeLayerStyleSettings" + }, + "MultiLineString": { + "$ref": "#/definitions/TypeLayerStyleSettings" + }, + "Polygon": { + "$ref": "#/definitions/TypeLayerStyleSettings" + }, + "MultiPolygon": { + "$ref": "#/definitions/TypeLayerStyleSettings" + } + } + }, + "TypeLayerStyleSettings": { "type": "object", "properties": { "type": { "description": "The type of style used by the layer.", - "$ref": "#/definitions/TypeStyleConfigType" + "$ref": "#/definitions/TypeLayerStyleConfigType" }, "fields": { "type": "array", @@ -1635,16 +1660,16 @@ "description": "Array of style information.", "type": "array", "items": { - "$ref": "#/definitions/TypeStyleConfigInfo" + "$ref": "#/definitions/TypeLayerStyleConfigInfo" } } } }, - "TypeStyleConfigType": { + "TypeLayerStyleConfigType": { "description": "Valid keys for the type property of style configurations.", "enum": ["simple", "uniqueValue", "classBreaks"] }, - "TypeStyleConfigInfo": { + "TypeLayerStyleConfigInfo": { "type": "object", "properties": { "visible": { diff --git a/packages/geoview-core/src/api/config/types/map-schema-types.ts b/packages/geoview-core/src/api/config/types/map-schema-types.ts index aff590bc068..e06deba08b9 100644 --- a/packages/geoview-core/src/api/config/types/map-schema-types.ts +++ b/packages/geoview-core/src/api/config/types/map-schema-types.ts @@ -340,9 +340,7 @@ export { WfsLayerEntryConfig } from '@config/types/classes/sub-layer-config/leaf export { GeoJsonLayerEntryConfig } from '@config/types/classes/sub-layer-config/leaf/vector/geojson-layer-entry-config'; /** Valid keys for the geometryType property. */ -// TODO: Refactor - Layers/Config refactoring. The values here have been renamed to lower case, make sure to lower here and adjust everywhere as part of config migration. -// TODO.CONT: What is the fastest option... change config or all code, see what is the fastest -export type TypeStyleGeometry = 'point' | 'linestring' | 'multilinestring' | 'polygon' | 'multipolygon'; +export type TypeStyleGeometry = 'Point' | 'MultiPoint' | 'LineString' | 'MultiLineString' | 'Polygon' | 'MultiPolygon'; /** Type of Style to apply to the GeoView vector layer source at creation time. */ export type TypeLayerEntryType = 'vector' | 'vector-tile' | 'raster-tile' | 'raster-image' | 'group'; @@ -521,16 +519,20 @@ export type codeValueEntryType = { code: unknown; }; -/** Type of Style to apply to the GeoView vector layer based on geometry types. */ -export type TypeStyleConfig = { - type: TypeStyleConfigType; +/** Styles to apply to the GeoView vector layer by geometry types. */ +export type TypeLayerStyleConfig = Partial>; + +/** Style settings to apply to the GeoView vector layer. */ +export type TypeLayerStyleSettings = { + type: TypeLayerStyleConfigType; fields: string[]; + // If true, last style info from info array is default style. hasDefault: boolean; - info: TypeStyleConfigInfo[]; + info: TypeLayerStyleConfigInfo[]; }; /** Information needed to render the feature. */ -export type TypeStyleConfigInfo = { +export type TypeLayerStyleConfigInfo = { /** Flag used to show/hide features associated to the label (default: true). */ visible: boolean; /** The label to display for the field. */ @@ -545,7 +547,7 @@ export type TypeStyleConfigInfo = { }; /** Valid keys for the type property of style configurations. */ -export type TypeStyleConfigType = 'simple' | 'uniqueValue' | 'classBreaks'; +export type TypeLayerStyleConfigType = 'simple' | 'uniqueValue' | 'classBreaks'; /** Definition of the line symbol vector settings type. */ export type TypeBaseVectorGeometryConfig = { 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 2428d6568b2..21e16b3aaca 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 @@ -12,18 +12,7 @@ import { ConfigBaseClass } from '@/core/utils/config/validation-classes/config-b import { ILayerState, TypeLegend, TypeLegendResultSetEntry } from '@/core/stores/store-interface-and-intial-values/layer-state'; import { AbstractEventProcessor } from '@/api/event-processors/abstract-event-processor'; import { AbstractBaseLayerEntryConfig } from '@/core/utils/config/validation-classes/abstract-base-layer-entry-config'; -import { - TypeClassBreakStyleConfig, - TypeClassBreakStyleInfo, - TypeFeatureInfoEntry, - TypeStyleGeometry, - TypeUniqueValueStyleConfig, - TypeUniqueValueStyleInfo, - isClassBreakStyleConfig, - isSimpleStyleConfig, - isUniqueValueStyleConfig, - layerEntryIsGroupLayer, -} from '@/geo/map/map-schema-types'; +import { TypeLayerStyleSettings, TypeFeatureInfoEntry, TypeStyleGeometry, layerEntryIsGroupLayer } from '@/geo/map/map-schema-types'; import { MapEventProcessor } from './map-event-processor'; // GV Important: See notes in header of MapEventProcessor file for information on the paradigm to apply when working with UIEventProcessor vs UIState @@ -163,10 +152,10 @@ export class LegendEventProcessor extends AbstractEventProcessor { const iconDetailsEntry: TypeLegendLayerItem = {}; iconDetailsEntry.geometryType = geometryType; - if (isSimpleStyleConfig(styleSettings)) { + if (styleSettings.type === 'simple') { iconDetailsEntry.iconType = 'simple'; iconDetailsEntry.iconImage = (styleRepresentation.defaultCanvas as HTMLCanvasElement).toDataURL(); - iconDetailsEntry.name = styleSettings.label; + iconDetailsEntry.name = styleSettings.info[0].label; // TODO Adding icons list, to be verified by backend devs const legendLayerListItem: TypeLegendItem = { @@ -179,44 +168,23 @@ export class LegendEventProcessor extends AbstractEventProcessor { iconDetails.push(iconDetailsEntry); } else { iconDetailsEntry.iconType = 'list'; - if (isClassBreakStyleConfig(styleSettings)) { - iconDetailsEntry.iconList = styleRepresentation.arrayOfCanvas!.map((canvas, i) => { - const legendLayerListItem: TypeLegendItem = { - geometryType, - icon: canvas ? canvas.toDataURL() : null, - name: styleSettings.classBreakStyleInfo[i].label, - isVisible: styleSettings.classBreakStyleInfo[i].visible!, - }; - return legendLayerListItem; - }); - if (styleRepresentation.defaultCanvas) { - const legendLayerListItem: TypeLegendItem = { - geometryType, - icon: styleRepresentation.defaultCanvas.toDataURL(), - name: styleSettings.defaultLabel!, - isVisible: styleSettings.defaultVisible!, - }; - iconDetailsEntry.iconList.push(legendLayerListItem); - } - } else if (isUniqueValueStyleConfig(styleSettings)) { - iconDetailsEntry.iconList = styleRepresentation.arrayOfCanvas!.map((canvas, i) => { - const legendLayerListItem: TypeLegendItem = { - geometryType, - icon: canvas ? canvas.toDataURL() : null, - name: styleSettings.uniqueValueStyleInfo[i].label, - isVisible: styleSettings.uniqueValueStyleInfo[i].visible !== false, - }; - return legendLayerListItem; - }); - if (styleRepresentation.defaultCanvas) { - const legendLayerListItem: TypeLegendItem = { - geometryType, - icon: styleRepresentation.defaultCanvas.toDataURL(), - name: styleSettings.defaultLabel!, - isVisible: styleSettings.defaultVisible!, - }; - iconDetailsEntry.iconList.push(legendLayerListItem); - } + 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; + }); + if (styleRepresentation.defaultCanvas) { + const legendLayerListItem: TypeLegendItem = { + geometryType, + icon: styleRepresentation.defaultCanvas.toDataURL(), + name: styleSettings.info[styleSettings.info.length - 1].label, + isVisible: styleSettings.info[styleSettings.info.length - 1].visible !== false, + }; + iconDetailsEntry.iconList.push(legendLayerListItem); } if (iconDetailsEntry.iconList?.length) iconDetailsEntry.iconImage = iconDetailsEntry.iconList[0].icon; if (iconDetailsEntry.iconList && iconDetailsEntry.iconList.length > 1) @@ -617,12 +585,12 @@ export class LegendEventProcessor extends AbstractEventProcessor { const [geometryType] = layerConfig.getTypeGeometries(); // Get the style - const layerStyle = layerConfig.style?.[geometryType]; + const layerStyle = layerConfig.layerStyle?.[geometryType]; let filteredFeatures = features; - if (layerStyle !== undefined && layerStyle!.styleType === 'uniqueValue') { - filteredFeatures = this.#processClassVisibilityUniqueValue(layerStyle as TypeUniqueValueStyleConfig, features); - } else if (layerStyle !== undefined && layerStyle!.styleType === 'classBreaks') { - filteredFeatures = this.#processClassVisibilityClassBreak(layerStyle as TypeClassBreakStyleConfig, features); + if (layerStyle !== undefined && layerStyle!.type === 'uniqueValue') { + filteredFeatures = this.#processClassVisibilityUniqueValue(layerStyle, features); + } else if (layerStyle !== undefined && layerStyle!.type === 'classBreaks') { + filteredFeatures = this.#processClassVisibilityClassBreak(layerStyle, features); } return filteredFeatures!; @@ -647,10 +615,10 @@ export class LegendEventProcessor extends AbstractEventProcessor { * @private */ static #processClassVisibilityUniqueValue( - uniqueValueStyle: TypeUniqueValueStyleConfig, + uniqueValueStyle: TypeLayerStyleSettings, features: TypeFeatureInfoEntry[] ): TypeFeatureInfoEntry[] { - const styleUnique = uniqueValueStyle.uniqueValueStyleInfo as TypeUniqueValueStyleInfo[]; + const styleUnique = uniqueValueStyle.info; // Create sets for visible and invisible values for faster lookup const visibleValues = new Set(styleUnique.filter((style) => style.visible).map((style) => style.values.join(';'))); @@ -660,7 +628,10 @@ export class LegendEventProcessor extends AbstractEventProcessor { return features.filter((feature) => { const fieldValues = uniqueValueStyle.fields.map((field) => feature.fieldInfo[field]!.value).join(';'); - return visibleValues.has(fieldValues.toString()) || (uniqueValueStyle.defaultVisible && !unvisibleValues.has(fieldValues.toString())); + return ( + visibleValues.has(fieldValues.toString()) || + (uniqueValueStyle.info[uniqueValueStyle.info.length - 1].visible && !unvisibleValues.has(fieldValues.toString())) + ); }); } @@ -687,15 +658,15 @@ export class LegendEventProcessor extends AbstractEventProcessor { * @private */ static #processClassVisibilityClassBreak( - classBreakStyle: TypeClassBreakStyleConfig, + classBreakStyle: TypeLayerStyleSettings, features: TypeFeatureInfoEntry[] ): TypeFeatureInfoEntry[] { - const classBreaks = classBreakStyle.classBreakStyleInfo as TypeClassBreakStyleInfo[]; + const classBreaks = classBreakStyle.info; // Sort class breaks by minValue for binary search // GV: Values can be number, date, string, null or undefined. Should it be only Date or Number // GV: undefined or null should not be allowed in class break style - const sortedBreaks = [...classBreaks].sort((a, b) => (a.minValue as number) - (b.minValue as number)); + const sortedBreaks = [...classBreaks].sort((a, b) => (a.values[0] as number) - (b.values[0] as number)); // Create an optimized lookup structure interface ClassBreakPoint { @@ -705,8 +676,8 @@ export class LegendEventProcessor extends AbstractEventProcessor { } const breakPoints = sortedBreaks.map( (brk): ClassBreakPoint => ({ - minValue: brk.minValue as number, - maxValue: brk.maxValue as number, + minValue: brk.values[0] as number, + maxValue: brk.values[1] as number, visible: brk.visible as boolean, }) ); @@ -744,16 +715,16 @@ export class LegendEventProcessor extends AbstractEventProcessor { // Filter features using binary search return features.filter((feature) => { - const val = feature.fieldInfo[String(classBreakStyle.field)]?.value; + const val = feature.fieldInfo[String(classBreakStyle.fields[0])]?.value; const fieldValue = val != null ? parseFloat(String(val)) : 0; // eslint-disable-next-line no-restricted-globals if (isNaN(fieldValue)) { - return classBreakStyle.defaultVisible; + return classBreakStyle.info[classBreakStyle.info.length - 1].visible; } const matchingBreak = findClassBreak(fieldValue); - return matchingBreak ? matchingBreak.visible : classBreakStyle.defaultVisible; + return matchingBreak ? matchingBreak.visible : classBreakStyle.info[classBreakStyle.info.length - 1].visible; }); } } diff --git a/packages/geoview-core/src/api/event-processors/event-processor-children/map-event-processor.ts b/packages/geoview-core/src/api/event-processors/event-processor-children/map-event-processor.ts index aba266e52b5..c2801a1cdfa 100644 --- a/packages/geoview-core/src/api/event-processors/event-processor-children/map-event-processor.ts +++ b/packages/geoview-core/src/api/event-processors/event-processor-children/map-event-processor.ts @@ -1089,7 +1089,7 @@ export class MapEventProcessor extends AbstractEventProcessor { ? (configLayerEntryConfig as VectorLayerEntryConfig).layerFilter : undefined, initialSettings, - style: legendLayerInfo!.styleConfig ? legendLayerInfo!.styleConfig : undefined, + layerStyle: legendLayerInfo!.styleConfig ? legendLayerInfo!.styleConfig : undefined, source: (layerEntryConfig! as VectorLayerEntryConfig).source ? cloneDeep((layerEntryConfig! as VectorLayerEntryConfig).source) : undefined, diff --git a/packages/geoview-core/src/core/components/common/layer-list.tsx b/packages/geoview-core/src/core/components/common/layer-list.tsx index c83a6036506..52002143eb1 100644 --- a/packages/geoview-core/src/core/components/common/layer-list.tsx +++ b/packages/geoview-core/src/core/components/common/layer-list.tsx @@ -123,7 +123,7 @@ const LayerListItem = memo(function LayerListItem({ id, isSelected, layer, onLis e.preventDefault(); } }, - [isDisabled, onListItemClick], + [isDisabled, onListItemClick] ); const AnimatedPaper = animated(Paper); diff --git a/packages/geoview-core/src/core/components/common/layout.tsx b/packages/geoview-core/src/core/components/common/layout.tsx index 9726eda4a5b..1fe7e821e62 100644 --- a/packages/geoview-core/src/core/components/common/layout.tsx +++ b/packages/geoview-core/src/core/components/common/layout.tsx @@ -49,7 +49,7 @@ export function Layout({ // set the focus item when layer item clicked. setSelectedFooterLayerListItemId(`${layer.layerUniqueId}`); }, - [onLayerListClicked, setSelectedFooterLayerListItemId], + [onLayerListClicked, setSelectedFooterLayerListItemId] ); /** diff --git a/packages/geoview-core/src/core/components/common/responsive-grid-layout.tsx b/packages/geoview-core/src/core/components/common/responsive-grid-layout.tsx index ae667ff57ae..152c0889c54 100644 --- a/packages/geoview-core/src/core/components/common/responsive-grid-layout.tsx +++ b/packages/geoview-core/src/core/components/common/responsive-grid-layout.tsx @@ -47,7 +47,7 @@ const ResponsiveGridLayout = forwardRef( hideEnlargeBtn = false, containerType, }: ResponsiveGridLayoutProps, - ref: Ref, + ref: Ref ) => { const theme = useTheme(); const sxClasses = getSxClasses(theme); @@ -108,7 +108,7 @@ const ResponsiveGridLayout = forwardRef( const handleKeyDown = useCallback( (event: KeyboardEvent): void => handleEscapeKey(event.key, selectedFooterLayerListItemId, true, handleEscapeKeyCallback), - [handleEscapeKeyCallback, selectedFooterLayerListItemId], + [handleEscapeKeyCallback, selectedFooterLayerListItemId] ); // return back the focus to layeritem for which right panel was opened. @@ -137,7 +137,7 @@ const ResponsiveGridLayout = forwardRef( // Callback onIsEnlargeClicked?.(isEnlarge); }, - [onIsEnlargeClicked], + [onIsEnlargeClicked] ); const handleOpenGuide = useCallback((): void => { @@ -373,7 +373,7 @@ const ResponsiveGridLayout = forwardRef( ); - }, + } ); ResponsiveGridLayout.displayName = 'ResponsiveGridLayout'; diff --git a/packages/geoview-core/src/core/components/common/responsive-grid.tsx b/packages/geoview-core/src/core/components/common/responsive-grid.tsx index 93abe9875a2..b79b31f46f6 100644 --- a/packages/geoview-core/src/core/components/common/responsive-grid.tsx +++ b/packages/geoview-core/src/core/components/common/responsive-grid.tsx @@ -65,7 +65,7 @@ const ResponsiveGridLeftPanel = forwardRef( fullWidth = false, ...rest }: ResponsiveGridPanelProps, - ref, + ref ) => { const theme = useTheme(); return ( @@ -84,7 +84,7 @@ const ResponsiveGridLeftPanel = forwardRef( {children} ); - }, + } ); ResponsiveGridLeftPanel.displayName = 'ResponsiveGridLeftPanel'; @@ -127,7 +127,7 @@ const ResponsiveGridRightPanel = forwardRef( fullWidth = false, ...rest }: ResponsiveGridPanelProps, - ref, + ref ) => { const theme = useTheme(); return ( @@ -148,7 +148,7 @@ const ResponsiveGridRightPanel = forwardRef( {children} ); - }, + } ); ResponsiveGridRightPanel.displayName = 'ResponsiveGridRightPanel'; diff --git a/packages/geoview-core/src/core/components/layers/right-panel/layer-details.tsx b/packages/geoview-core/src/core/components/layers/right-panel/layer-details.tsx index 3f7007f3746..0603688d65d 100644 --- a/packages/geoview-core/src/core/components/layers/right-panel/layer-details.tsx +++ b/packages/geoview-core/src/core/components/layers/right-panel/layer-details.tsx @@ -125,9 +125,12 @@ export function LayerDetails(props: LayerDetailsProps): JSX.Element { function renderItemCheckbox(item: TypeLegendItem): JSX.Element | null { // no checkbox for simple style layers if ( - layerDetails.styleConfig?.LineString?.styleType === 'simple' || - layerDetails.styleConfig?.Point?.styleType === 'simple' || - layerDetails.styleConfig?.Polygon?.styleType === 'simple' + layerDetails.styleConfig?.LineString?.type === 'simple' || + layerDetails.styleConfig?.MultiLineString?.type === 'simple' || + layerDetails.styleConfig?.Point?.type === 'simple' || + layerDetails.styleConfig?.MultiPoint?.type === 'simple' || + layerDetails.styleConfig?.Polygon?.type === 'simple' || + layerDetails.styleConfig?.MultiPolygon?.type === 'simple' ) { return null; } diff --git a/packages/geoview-core/src/core/components/layers/types.ts b/packages/geoview-core/src/core/components/layers/types.ts index 72086a630f7..56aac77ecd8 100644 --- a/packages/geoview-core/src/core/components/layers/types.ts +++ b/packages/geoview-core/src/core/components/layers/types.ts @@ -1,6 +1,6 @@ import { Extent } from 'ol/extent'; import { TypeLayerControls } from '@config/types/map-schema-types'; -import { TypeLayerStatus, TypeStyleConfig, TypeStyleGeometry } from '@/geo/map/map-schema-types'; +import { TypeLayerStatus, TypeLayerStyleConfig, TypeStyleGeometry } from '@/geo/map/map-schema-types'; import { TypeGeoviewLayerType } from '@/geo/layer/geoview-layers/abstract-geoview-layers'; export type TypeLayersViewDisplayState = 'remove' | 'add' | 'order' | 'view'; @@ -30,7 +30,7 @@ export interface TypeLegendLayer { layerName: string; legendQueryStatus: string; type?: TypeGeoviewLayerType; - styleConfig?: TypeStyleConfig | null; + styleConfig?: TypeLayerStyleConfig | null; layerStatus?: TypeLayerStatus; querySent?: boolean; canToggle?: boolean; // can sublayer visibility be toggled diff --git a/packages/geoview-core/src/core/stores/store-interface-and-intial-values/layer-state.ts b/packages/geoview-core/src/core/stores/store-interface-and-intial-values/layer-state.ts index 98551ba7a1c..f83f439bdca 100644 --- a/packages/geoview-core/src/core/stores/store-interface-and-intial-values/layer-state.ts +++ b/packages/geoview-core/src/core/stores/store-interface-and-intial-values/layer-state.ts @@ -11,9 +11,9 @@ import { TypeGetStore, TypeSetStore } from '@/core/stores/geoview-store'; import { layerEntryIsEsriDynamic, TypeFeatureInfoEntryPartial, + TypeLayerStyleConfig, TypeResultSet, TypeResultSetEntry, - TypeStyleConfig, } from '@/geo/map/map-schema-types'; import { OL_ZOOM_DURATION, OL_ZOOM_PADDING } from '@/core/utils/constant'; import { AbstractBaseLayerEntryConfig } from '@/core/utils/config/validation-classes/abstract-base-layer-entry-config'; @@ -345,7 +345,7 @@ export type LegendQueryStatus = 'init' | 'querying' | 'queried'; export type TypeLegend = { type: TypeGeoviewLayerType; - styleConfig?: TypeStyleConfig | null; + styleConfig?: TypeLayerStyleConfig | null; // Layers other than vector layers use the HTMLCanvasElement type for their legend. legend: TypeVectorLayerStyles | HTMLCanvasElement | null; }; diff --git a/packages/geoview-core/src/core/utils/config/validation-classes/abstract-base-layer-entry-config.ts b/packages/geoview-core/src/core/utils/config/validation-classes/abstract-base-layer-entry-config.ts index 9f42553dd63..9b7dae6c99b 100644 --- a/packages/geoview-core/src/core/utils/config/validation-classes/abstract-base-layer-entry-config.ts +++ b/packages/geoview-core/src/core/utils/config/validation-classes/abstract-base-layer-entry-config.ts @@ -7,9 +7,9 @@ import { TypeSourceImageStaticInitialConfig, TypeSourceImageWmsInitialConfig, TypeSourceTileInitialConfig, - TypeStyleConfig, + TypeLayerStyleConfig, TypeStyleGeometry, - TypeStyleSettings, + TypeLayerStyleSettings, TypeVectorSourceInitialConfig, TypeVectorTileSourceInitialConfig, } from '@/geo/map/map-schema-types'; @@ -48,7 +48,7 @@ export abstract class AbstractBaseLayerEntryConfig extends ConfigBaseClass { | TypeSourceImageStaticInitialConfig; /** Style to apply to the vector layer. */ - style?: TypeStyleConfig; + layerStyle?: TypeLayerStyleConfig; /** The listOfLayerEntryConfig attribute is not used by child of AbstractBaseLayerEntryConfig. */ declare listOfLayerEntryConfig: never; @@ -59,8 +59,8 @@ export abstract class AbstractBaseLayerEntryConfig extends ConfigBaseClass { */ protected constructor(layerConfig: AbstractBaseLayerEntryConfig) { super(layerConfig); - // Attribute 'style' must exist in layerConfig even if it is undefined - if (!('style' in this)) this.style = undefined; + // Attribute 'layerStyle' must exist in layerConfig even if it is undefined + if (!('layerStyle' in this)) this.layerStyle = undefined; Object.assign(this, layerConfig); } @@ -103,20 +103,20 @@ export abstract class AbstractBaseLayerEntryConfig extends ConfigBaseClass { * @returns {TypeStyleGeometry[]} The array of TypeStyleGeometry */ getTypeGeometries(): TypeStyleGeometry[] { - return Object.keys(this.style || {}) as TypeStyleGeometry[]; + return Object.keys(this.layerStyle || {}) as TypeStyleGeometry[]; } /** * The first TypeStyleSetting associated with the TypeStyleGeometry associated with the style as could be read from the layer config metadata. * @returns {TypeStyleSettings[]} The array of TypeStyleSettings */ - getFirstStyleSettings(): TypeStyleSettings | undefined { + getFirstStyleSettings(): TypeLayerStyleSettings | undefined { // Get the type geometries const styles = this.getTypeGeometries(); // If at least one, get the first one if (styles.length > 0) { - return this.style![styles[0]]; + return this.layerStyle![styles[0]]; } // None diff --git a/packages/geoview-core/src/geo/layer/geometry/geometry.ts b/packages/geoview-core/src/geo/layer/geometry/geometry.ts index a99a8496b23..92af8974dc8 100644 --- a/packages/geoview-core/src/geo/layer/geometry/geometry.ts +++ b/packages/geoview-core/src/geo/layer/geometry/geometry.ts @@ -672,6 +672,7 @@ export class GeometryApi { } // Create a Point geometry return new Point(coordinates as Coordinate); + case 'MultiPoint': // Create a MultiPoint geometry return new MultiPoint(coordinates as Coordinate[]); diff --git a/packages/geoview-core/src/geo/layer/geoview-layers/abstract-geoview-layers.ts b/packages/geoview-core/src/geo/layer/geoview-layers/abstract-geoview-layers.ts index 8e0afbf5c39..57f3161654d 100644 --- a/packages/geoview-core/src/geo/layer/geoview-layers/abstract-geoview-layers.ts +++ b/packages/geoview-core/src/geo/layer/geoview-layers/abstract-geoview-layers.ts @@ -28,7 +28,7 @@ import { TypeGeoviewLayerConfig, TypeLayerEntryConfig, layerEntryIsGroupLayer, - TypeStyleConfig, + TypeLayerStyleConfig, TypeLayerInitialSettings, TypeLayerStatus, TypeStyleGeometry, @@ -39,8 +39,6 @@ import { rangeDomainType, TypeLocation, QueryType, - TypeUniqueValueStyleConfig, - TypeClassBreakStyleConfig, } from '@/geo/map/map-schema-types'; import { GeoViewLayerCreatedTwiceError } from '@/geo/layer/exceptions/layer-exceptions'; import { getLegendStyles, getFeatureCanvas } from '@/geo/utils/renderer/geoview-renderer'; @@ -126,7 +124,7 @@ export abstract class AbstractGeoViewLayer { #layerTemporalDimension: Record = {}; /** Style to apply to the layer. */ - #style: Record = {}; + #layerStyle: Record = {}; /** Attribution used in the OpenLayer source. */ #attributions: string[] = []; @@ -307,16 +305,16 @@ export abstract class AbstractGeoViewLayer { * Gets the layer style * @returns The layer style */ - getStyle(layerPath: string): TypeStyleConfig | undefined { - return this.#style[layerPath]; + getStyle(layerPath: string): TypeLayerStyleConfig | undefined { + return this.#layerStyle[layerPath]; } /** * Sets the layer style - * @param {TypeStyleConfig | undefined} style - The layer style + * @param {TypeLayerStyleConfig | undefined} style - The layer style */ - setStyle(layerPath: string, style: TypeStyleConfig): void { - this.#style[layerPath] = style; + setStyle(layerPath: string, style: TypeLayerStyleConfig): void { + this.#layerStyle[layerPath] = style; this.#emitLayerStyleChanged({ style, layerPath }); } @@ -545,7 +543,7 @@ export abstract class AbstractGeoViewLayer { // TO.DOCONT: After this point(?) the layerConfig should be full static and the system should rely on the Layer class to do stuff. // // Save the style in the layer as we're done processing style found in metadata - if (layerConfig instanceof AbstractBaseLayerEntryConfig) this.setStyle(layerConfig.layerPath, layerConfig.style!); + if (layerConfig instanceof AbstractBaseLayerEntryConfig) this.setStyle(layerConfig.layerPath, layerConfig.layerStyle!); // We need to signal to the layer sets that the 'processed' phase is done. // GV TODO: For the moment, be aware that the layerStatus setter is doing a lot of things behind the scene. @@ -948,13 +946,11 @@ export abstract class AbstractGeoViewLayer { Object.keys(legend.styleConfig).forEach((geometry) => { if ( legend.styleConfig && - (legend.styleConfig[geometry as TypeStyleGeometry]?.styleType === 'uniqueValue' || - legend.styleConfig[geometry as TypeStyleGeometry]?.styleType === 'classBreaks') + (legend.styleConfig[geometry as TypeStyleGeometry]?.type === 'uniqueValue' || + legend.styleConfig[geometry as TypeStyleGeometry]?.type === 'classBreaks') ) { - if ((legend.styleConfig[geometry as TypeStyleGeometry] as TypeUniqueValueStyleConfig)!.uniqueValueStyleInfo?.length) - styleCount += (legend.styleConfig[geometry as TypeStyleGeometry] as TypeUniqueValueStyleConfig)!.uniqueValueStyleInfo.length; - if ((legend.styleConfig[geometry as TypeStyleGeometry] as TypeClassBreakStyleConfig)!.classBreakStyleInfo?.length) - styleCount += (legend.styleConfig[geometry as TypeStyleGeometry] as TypeClassBreakStyleConfig)!.classBreakStyleInfo.length; + if (legend.styleConfig[geometry as TypeStyleGeometry]!.info.length) + styleCount += legend.styleConfig[geometry as TypeStyleGeometry]!.info.length; } }); // Set the openlayers icon image cache @@ -1997,7 +1993,7 @@ type LayerStyleChangedDelegate = EventDelegateBase(data.drawingInfo?.renderer); - if (renderer) EsriLayerConfig.style = getStyleFromEsriRenderer(renderer); + if (renderer) EsriLayerConfig.layerStyle = getStyleFromEsriRenderer(renderer); } layer.processFeatureInfoConfig( layerConfig as EsriDynamicLayerEntryConfig & EsriFeatureLayerEntryConfig & EsriImageLayerEntryConfig diff --git a/packages/geoview-core/src/geo/layer/geoview-layers/raster/esri-dynamic.ts b/packages/geoview-core/src/geo/layer/geoview-layers/raster/esri-dynamic.ts index c2e1244c08e..fd2c669396c 100644 --- a/packages/geoview-core/src/geo/layer/geoview-layers/raster/esri-dynamic.ts +++ b/packages/geoview-core/src/geo/layer/geoview-layers/raster/esri-dynamic.ts @@ -23,11 +23,7 @@ import { EsriDynamicLayerEntryConfig } from '@/core/utils/config/validation-clas import { TypeLayerEntryConfig, TypeGeoviewLayerConfig, - isUniqueValueStyleConfig, - isClassBreakStyleConfig, - TypeUniqueValueStyleConfig, - TypeClassBreakStyleConfig, - isSimpleStyleConfig, + TypeLayerStyleSettings, TypeFeatureInfoLayerConfig, codedValueType, rangeDomainType, @@ -532,7 +528,7 @@ export class EsriDynamic extends AbstractGeoViewRaster { * Count 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 {TypeUniqueValueStyleConfig} styleSettings The unique value style settings to evaluate. + * @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 * index in the style settings and the second one to the number of different values the field may have based on visibility of @@ -540,13 +536,10 @@ export class EsriDynamic extends AbstractGeoViewRaster { * @private */ // GV Layers Refactoring - Obsolete (in layers) - static #countFieldOfTheSameValue(styleSettings: TypeUniqueValueStyleConfig): TypeFieldOfTheSameValue[][] { - return styleSettings.uniqueValueStyleInfo.reduce( + static #countFieldOfTheSameValue(styleSettings: TypeLayerStyleSettings): TypeFieldOfTheSameValue[][] { + return styleSettings.info.reduce( (counter, styleEntry): TypeFieldOfTheSameValue[][] => { - if ( - (styleEntry.visible === false && styleSettings.defaultVisible !== false) || - (styleEntry.visible !== false && styleSettings.defaultVisible === false) - ) { + if (styleEntry.visible !== false) { styleEntry.values.forEach((styleValue, i) => { const valueExist = counter[i].find((counterEntry) => counterEntry.value === styleValue); if (valueExist) valueExist.nbOccurence++; @@ -564,7 +557,7 @@ export class EsriDynamic extends AbstractGeoViewRaster { * visibility of the default value, we count the visible or invisible parameters. The order goes from the highest number of * occurrences to the lowest number of occurrences. * - * @param {TypeUniqueValueStyleConfig} styleSettings The unique value style settings to evaluate. + * @param {TypeLayerStyleSettings} styleSettings The unique value style settings to evaluate. * @param {TypeFieldOfTheSameValue[][]} fieldOfTheSameValue The count information that contains the number of occurrences * of a value. * @@ -572,7 +565,7 @@ export class EsriDynamic extends AbstractGeoViewRaster { * @private */ // GV Layers Refactoring - Obsolete (in layers) - static #sortFieldOfTheSameValue(styleSettings: TypeUniqueValueStyleConfig, fieldOfTheSameValue: TypeFieldOfTheSameValue[][]): number[] { + static #sortFieldOfTheSameValue(styleSettings: TypeLayerStyleSettings, fieldOfTheSameValue: TypeFieldOfTheSameValue[][]): number[] { const fieldNotUsed = styleSettings.fields.map(() => true); const fieldOrder: number[] = []; for (let entrySelected = 0; entrySelected !== -1; entrySelected = fieldNotUsed.findIndex((flag) => flag)) { @@ -611,7 +604,7 @@ export class EsriDynamic extends AbstractGeoViewRaster { * * f1 = v11 and f2 = v21 and f3 = v31 or f1 = v11 and f2 = v21 and f3 = v32 or f1 = v11 and f2 = v22 and f3 = v31 ... * - * @param {TypeUniqueValueStyleConfig} styleSettings The unique value style settings to evaluate. + * @param {TypeLayerStyleSettings} styleSettings The unique value style settings to evaluate. * @param {TypeFieldOfTheSameValue[][]} fieldOfTheSameValue The count information that contains the number of occurrences * of a value. * @param {number[]} fieldOrder The field order to use when building the tree. @@ -621,16 +614,13 @@ export class EsriDynamic extends AbstractGeoViewRaster { */ // GV Layers Refactoring - Obsolete (in layers) static #getQueryTree( - styleSettings: TypeUniqueValueStyleConfig, + styleSettings: TypeLayerStyleSettings, fieldOfTheSameValue: TypeFieldOfTheSameValue[][], fieldOrder: number[] ): TypeQueryTree { const queryTree: TypeQueryTree = []; - styleSettings.uniqueValueStyleInfo.forEach((styleEntry) => { - if ( - (styleEntry.visible === false && styleSettings.defaultVisible !== false) || - (styleEntry.visible !== false && styleSettings.defaultVisible === false) - ) { + styleSettings.info.forEach((styleEntry) => { + 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]])) { @@ -677,7 +667,7 @@ export class EsriDynamic extends AbstractGeoViewRaster { * @param {TypeQueryTree} queryTree The query tree to use. * @param {number} level The level to use for solving the tree. * @param {number[]} fieldOrder The field order to use for solving the tree. - * @param {TypeUniqueValueStyleConfig} styleSettings The unique value style settings to evaluate. + * @param {TypeLayerStyleSettings} styleSettings The unique value style settings to evaluate. * @param {TypeFeatureInfoLayerConfig} sourceFeatureInfo The source feature information that knows the field type. * * @returns {string} The resulting query. @@ -688,10 +678,10 @@ export class EsriDynamic extends AbstractGeoViewRaster { queryTree: TypeQueryTree, level: number, fieldOrder: number[], - styleSettings: TypeUniqueValueStyleConfig, + styleSettings: TypeLayerStyleSettings, sourceFeatureInfo: TypeFeatureInfoLayerConfig ): string { - let queryString = styleSettings.defaultVisible !== false && !level ? 'not (' : '('; + let queryString = styleSettings.info[styleSettings.info.length - 1].visible !== false && !level ? 'not (' : '('; for (let i = 0; i < queryTree.length; i++) { const value = EsriDynamic.#formatFieldValue(styleSettings.fields[fieldOrder[level]], queryTree[i].fieldValue, sourceFeatureInfo); // The nextField array is not empty, then it is is not the last field @@ -733,30 +723,24 @@ export class EsriDynamic extends AbstractGeoViewRaster { const style = this.getStyle(layerConfig.layerPath); if (style) { - const setAllUndefinedVisibilityFlagsToYes = (styleConfig: TypeUniqueValueStyleConfig | TypeClassBreakStyleConfig): void => { - // default value is true for all undefined visibility flags - if (styleConfig.defaultVisible === undefined) styleConfig.defaultVisible = true; - const settings = isUniqueValueStyleConfig(styleConfig) ? styleConfig.uniqueValueStyleInfo : styleConfig.classBreakStyleInfo; + const setAllUndefinedVisibilityFlagsToYes = (styleConfig: TypeLayerStyleSettings): void => { + const settings = styleConfig.info; for (let i = 0; i < settings.length; i++) if (settings[i].visible === undefined) settings[i].visible = true; }; - const featuresAreAllVisible = (defaultVisibility: boolean, settings: { visible: boolean }[]): boolean => { - let allVisible = defaultVisibility !== false; - for (let i = 0; i < settings.length; i++) { - allVisible &&= settings[i].visible !== false; - } - return allVisible; + const featuresAreAllVisible = (settings: { visible: boolean }[]): boolean => { + return settings.every((setting) => setting.visible !== false); }; // Get the first style settings const styleSettings = layerConfig.getFirstStyleSettings()!; - if (isSimpleStyleConfig(styleSettings)) { + if (styleSettings.type === 'simple') { return layerFilter || '(1=1)'; } - if (isUniqueValueStyleConfig(styleSettings)) { + if (styleSettings.type === 'uniqueValue') { setAllUndefinedVisibilityFlagsToYes(styleSettings); - if (featuresAreAllVisible(styleSettings.defaultVisible!, styleSettings.uniqueValueStyleInfo as { visible: boolean }[])) + if (featuresAreAllVisible(styleSettings.info as { visible: boolean }[])) return `(1=1)${layerFilter ? ` and (${layerFilter})` : ''}`; // This section of code optimize the query to reduce it at it shortest expression. @@ -768,83 +752,83 @@ export class EsriDynamic extends AbstractGeoViewRaster { return `${query}${layerFilter ? ` and (${layerFilter})` : ''}`; } - if (isClassBreakStyleConfig(styleSettings)) { + if (styleSettings.type === 'classBreaks') { setAllUndefinedVisibilityFlagsToYes(styleSettings); - if (featuresAreAllVisible(styleSettings.defaultVisible!, styleSettings.classBreakStyleInfo as { visible: boolean }[])) + if (featuresAreAllVisible(styleSettings.info as { visible: boolean }[])) return `(1=1)${layerFilter ? ` and (${layerFilter})` : ''}`; const filterArray: string[] = []; let visibleWhenGreatherThisIndex = -1; - for (let i = 0; i < styleSettings.classBreakStyleInfo.length; i++) { + for (let i = 0; i < styleSettings.info.length; i++) { if (filterArray.length % 2 === 0) { if (i === 0) { - if (styleSettings.classBreakStyleInfo[0].visible !== false && styleSettings.defaultVisible === false) + if (styleSettings.info[0].visible !== false && styleSettings.info[styleSettings.info.length - 1].visible === false) filterArray.push( - `${styleSettings.field} >= ${EsriDynamic.#formatFieldValue( - styleSettings.field, - styleSettings.classBreakStyleInfo[0].minValue!, + `${styleSettings.fields[0]} >= ${EsriDynamic.#formatFieldValue( + styleSettings.fields[0], + styleSettings.info[0].values[0]!, layerConfig.source.featureInfo! )}` ); - else if (styleSettings.classBreakStyleInfo[0].visible === false && styleSettings.defaultVisible !== false) { + else if (styleSettings.info[0].visible === false && styleSettings.info[styleSettings.info.length - 1].visible !== false) { filterArray.push( - `${styleSettings.field} < ${EsriDynamic.#formatFieldValue( - styleSettings.field, - styleSettings.classBreakStyleInfo[0].minValue!, + `${styleSettings.fields[0]} < ${EsriDynamic.#formatFieldValue( + styleSettings.fields[0], + styleSettings.info[0].values[0], layerConfig.source.featureInfo! )}` ); visibleWhenGreatherThisIndex = i; } - } else if (styleSettings.classBreakStyleInfo[i].visible !== false && styleSettings.defaultVisible === false) { + } else if (styleSettings.info[i].visible !== false && styleSettings.info[styleSettings.info.length - 1].visible === false) { filterArray.push( - `${styleSettings.field} > ${EsriDynamic.#formatFieldValue( - styleSettings.field, - styleSettings.classBreakStyleInfo[i].minValue!, + `${styleSettings.fields[0]} > ${EsriDynamic.#formatFieldValue( + styleSettings.fields[0], + styleSettings.info[i].values[0], layerConfig.source.featureInfo! )}` ); - if (i + 1 === styleSettings.classBreakStyleInfo.length) + if (i + 1 === styleSettings.info.length) filterArray.push( - `${styleSettings.field} <= ${EsriDynamic.#formatFieldValue( - styleSettings.field, - styleSettings.classBreakStyleInfo[i].maxValue!, + `${styleSettings.fields[0]} <= ${EsriDynamic.#formatFieldValue( + styleSettings.fields[0], + styleSettings.info[i].values[1], layerConfig.source.featureInfo! )}` ); - } else if (styleSettings.classBreakStyleInfo[i].visible === false && styleSettings.defaultVisible !== false) { + } else if (styleSettings.info[i].visible === false && styleSettings.info[styleSettings.info.length - 1].visible !== false) { filterArray.push( - `${styleSettings.field} <= ${EsriDynamic.#formatFieldValue( - styleSettings.field, - styleSettings.classBreakStyleInfo[i].minValue!, + `${styleSettings.fields[0]} <= ${EsriDynamic.#formatFieldValue( + styleSettings.fields[0], + styleSettings.info[i].values[0], layerConfig.source.featureInfo! )}` ); visibleWhenGreatherThisIndex = i; } - } else if (styleSettings.defaultVisible === false) { - if (styleSettings.classBreakStyleInfo[i].visible === false) { + } else if (styleSettings.info[styleSettings.info.length - 1].visible === false) { + if (styleSettings.info[i].visible === false) { filterArray.push( - `${styleSettings.field} <= ${EsriDynamic.#formatFieldValue( - styleSettings.field, - styleSettings.classBreakStyleInfo[i - 1].maxValue!, + `${styleSettings.fields[0]} <= ${EsriDynamic.#formatFieldValue( + styleSettings.fields[0], + styleSettings.info[i - 1].values[1], layerConfig.source.featureInfo! )}` ); - } else if (i + 1 === styleSettings.classBreakStyleInfo.length) { + } else if (i + 1 === styleSettings.info.length) { filterArray.push( - `${styleSettings.field} <= ${EsriDynamic.#formatFieldValue( - styleSettings.field, - styleSettings.classBreakStyleInfo[i].maxValue!, + `${styleSettings.fields[0]} <= ${EsriDynamic.#formatFieldValue( + styleSettings.fields[0], + styleSettings.info[i].values[1], layerConfig.source.featureInfo! )}` ); } - } else if (styleSettings.classBreakStyleInfo[i].visible !== false) { + } else if (styleSettings.info[i].visible !== false) { filterArray.push( - `${styleSettings.field} > ${EsriDynamic.#formatFieldValue( - styleSettings.field, - styleSettings.classBreakStyleInfo[i - 1].maxValue!, + `${styleSettings.fields[0]} > ${EsriDynamic.#formatFieldValue( + styleSettings.fields[0], + styleSettings.info[i - 1].values[1], layerConfig.source.featureInfo! )}` ); @@ -855,14 +839,14 @@ export class EsriDynamic extends AbstractGeoViewRaster { } if (visibleWhenGreatherThisIndex !== -1) filterArray.push( - `${styleSettings.field} > ${EsriDynamic.#formatFieldValue( - styleSettings.field, - styleSettings.classBreakStyleInfo[visibleWhenGreatherThisIndex].maxValue!, + `${styleSettings.fields[0]} > ${EsriDynamic.#formatFieldValue( + styleSettings.fields[0], + styleSettings.info[visibleWhenGreatherThisIndex].values[1], layerConfig.source.featureInfo! )}` ); - if (styleSettings.defaultVisible !== false) { + if (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 `; diff --git a/packages/geoview-core/src/geo/layer/geoview-layers/raster/esri-image.ts b/packages/geoview-core/src/geo/layer/geoview-layers/raster/esri-image.ts index 62152c4f87c..e022499e394 100644 --- a/packages/geoview-core/src/geo/layer/geoview-layers/raster/esri-image.ts +++ b/packages/geoview-core/src/geo/layer/geoview-layers/raster/esri-image.ts @@ -15,12 +15,12 @@ import { AbstractGeoViewRaster } from '@/geo/layer/geoview-layers/raster/abstrac import { TypeLayerEntryConfig, TypeGeoviewLayerConfig, - TypeUniqueValueStyleConfig, - TypeUniqueValueStyleInfo, - TypeStyleConfig, + TypeLayerStyleSettings, + TypeLayerStyleConfig, layerEntryIsGroupLayer, codedValueType, rangeDomainType, + TypeLayerStyleConfigInfo, } from '@/geo/map/map-schema-types'; import { @@ -154,10 +154,11 @@ export class EsriImage extends AbstractGeoViewRaster { }; return legend; } - const uniqueValueStyleInfo: TypeUniqueValueStyleInfo[] = []; + const uniqueValueStyleInfo: TypeLayerStyleConfigInfo[] = []; legendInfo.forEach((info) => { - const styleInfo: TypeUniqueValueStyleInfo = { + const styleInfo: TypeLayerStyleConfigInfo = { label: info.label, + visible: layerConfig.initialSettings.states?.visible || true, values: info.label.split(','), settings: { type: 'iconSymbol', @@ -169,12 +170,13 @@ export class EsriImage extends AbstractGeoViewRaster { }; uniqueValueStyleInfo.push(styleInfo); }); - const styleSettings: TypeUniqueValueStyleConfig = { - styleType: 'uniqueValue', + const styleSettings: TypeLayerStyleSettings = { + type: 'uniqueValue', fields: ['default'], - uniqueValueStyleInfo, + hasDefault: true, + info: uniqueValueStyleInfo, }; - const styleConfig: TypeStyleConfig = { + const styleConfig: TypeLayerStyleConfig = { Point: styleSettings, }; diff --git a/packages/geoview-core/src/geo/layer/geoview-layers/raster/wms.ts b/packages/geoview-core/src/geo/layer/geoview-layers/raster/wms.ts index d53fd53bba1..00cb4f736d1 100644 --- a/packages/geoview-core/src/geo/layer/geoview-layers/raster/wms.ts +++ b/packages/geoview-core/src/geo/layer/geoview-layers/raster/wms.ts @@ -510,16 +510,16 @@ export class WMS extends AbstractGeoViewRaster { const dataAccessPath = layerConfig.source.dataAccessPath!; let styleToUse = ''; - if (Array.isArray(layerConfig.source?.style) && layerConfig.source?.style) { - styleToUse = layerConfig.source?.style[0]; - } else if (layerConfig.source.style) { - styleToUse = layerConfig.source?.style as string; + if (Array.isArray(layerConfig.source?.wmsStyle) && layerConfig.source?.wmsStyle) { + styleToUse = layerConfig.source?.wmsStyle[0]; + } else if (layerConfig.source.wmsStyle) { + styleToUse = layerConfig.source?.wmsStyle as string; } else if (layerCapabilities.Style) { styleToUse = layerCapabilities.Style[0].Name as string; } - if (Array.isArray(layerConfig.source?.style)) { - this.WMSStyles = layerConfig.source.style; + if (Array.isArray(layerConfig.source?.wmsStyle)) { + this.WMSStyles = layerConfig.source.wmsStyle; } else if (layerCapabilities.Style && (layerCapabilities.Style.length as number) > 1) { this.WMSStyles = []; for (let i = 0; i < (layerCapabilities.Style.length as number); i++) { @@ -800,7 +800,8 @@ export class WMS extends AbstractGeoViewRaster { }); } else { legendStyle = layerCapabilities?.Style.find((style) => { - if (layerConfig?.source?.style && !Array.isArray(layerConfig?.source?.style)) return layerConfig.source.style === style.Name; + if (layerConfig?.source?.wmsStyle && !Array.isArray(layerConfig?.source?.wmsStyle)) + return layerConfig.source.wmsStyle === style.Name; // no style found, if default apply, if not use the available style return isDefaultStyle ? style.Name === 'default' : style.Name; diff --git a/packages/geoview-core/src/geo/layer/geoview-layers/vector/geojson.ts b/packages/geoview-core/src/geo/layer/geoview-layers/vector/geojson.ts index af18328f163..7a8811f094f 100644 --- a/packages/geoview-core/src/geo/layer/geoview-layers/vector/geojson.ts +++ b/packages/geoview-core/src/geo/layer/geoview-layers/vector/geojson.ts @@ -192,7 +192,7 @@ export class GeoJSON extends AbstractGeoViewVector { layerConfig.layerName = layerConfig.layerName || layerMetadataFound.layerName; layerConfig.source = defaultsDeep(layerConfig.source, layerMetadataFound.source); layerConfig.initialSettings = defaultsDeep(layerConfig.initialSettings, layerMetadataFound.initialSettings); - layerConfig.style = defaultsDeep(layerConfig.style, layerMetadataFound.style); + layerConfig.layerStyle = defaultsDeep(layerConfig.layerStyle, layerMetadataFound.layerStyle); // When the dataAccessPath stored in the layerConfig.source object is equal to the root of the metadataAccessPath with a // layerId ending, chances are that it was set by the config-validation because of an empty dataAcessPath value in the config. // This situation means that we want to use the dataAccessPath found in the metadata if it is set, otherwise we will keep the diff --git a/packages/geoview-core/src/geo/layer/geoview-layers/vector/geopackage.ts b/packages/geoview-core/src/geo/layer/geoview-layers/vector/geopackage.ts index 0ec4062c848..47da998283f 100644 --- a/packages/geoview-core/src/geo/layer/geoview-layers/vector/geopackage.ts +++ b/packages/geoview-core/src/geo/layer/geoview-layers/vector/geopackage.ts @@ -396,12 +396,12 @@ export class GeoPackage extends AbstractGeoViewVector { protected static processGeopackageStyle(layerConfig: AbstractBaseLayerEntryConfig, sld: string | number | Uint8Array): void { // Extract layer styles if they exist const { rules } = SLDReader.Reader(sld).layers[0].styles[0].featuretypestyles[0]; - if ((layerConfig as VectorLayerEntryConfig).style === undefined) (layerConfig as VectorLayerEntryConfig).style = {}; + if ((layerConfig as VectorLayerEntryConfig).layerStyle === undefined) (layerConfig as VectorLayerEntryConfig).layerStyle = {}; for (let i = 0; i < rules.length; i++) { Object.keys(rules[i]).forEach((key) => { // Polygon style - if (key.toLowerCase() === 'polygonsymbolizer' && !(layerConfig as VectorLayerEntryConfig).style!.Polygon) { + if (key.toLowerCase() === 'polygonsymbolizer' && !(layerConfig as VectorLayerEntryConfig).layerStyle!.Polygon) { const polyStyles = rules[i].polygonsymbolizer[0]; let color: string | undefined; let graphicSize: number | undefined; @@ -465,9 +465,14 @@ export class GeoPackage extends AbstractGeoViewVector { paternWidth: patternWidth || 1, fillStyle: fillStyle || 'solid', }; - (layerConfig as VectorLayerEntryConfig).style!.Polygon = { styleType: 'simple', settings: styles }; + layerConfig.layerStyle!.Polygon = { + type: 'simple', + fields: [], + hasDefault: false, + info: [{ visible: true, label: '', values: [], settings: styles }], + }; // LineString style - } else if (key.toLowerCase() === 'linesymbolizer' && !(layerConfig as VectorLayerEntryConfig).style!.LineString) { + } else if (key.toLowerCase() === 'linesymbolizer' && !(layerConfig as VectorLayerEntryConfig).layerStyle!.LineString) { const lineStyles = rules[i].linesymbolizer[0]; const stroke: TypeStrokeSymbolConfig = {}; @@ -477,9 +482,14 @@ export class GeoPackage extends AbstractGeoViewVector { } const styles: TypeLineStringVectorConfig = { type: 'lineString', stroke }; - (layerConfig as VectorLayerEntryConfig).style!.LineString = { styleType: 'simple', settings: styles }; + (layerConfig as VectorLayerEntryConfig).layerStyle!.LineString = { + type: 'simple', + fields: [], + hasDefault: false, + info: [{ visible: true, label: '', values: [], settings: styles }], + }; // Point style - } else if (key.toLowerCase() === 'pointsymbolizer' && !(layerConfig as VectorLayerEntryConfig).style!.Point) { + } else if (key.toLowerCase() === 'pointsymbolizer' && !(layerConfig as VectorLayerEntryConfig).layerStyle!.Point) { const { graphic } = rules[i].pointsymbolizer[0]; let offset: [number, number] | null = null; @@ -517,7 +527,12 @@ export class GeoPackage extends AbstractGeoViewVector { if (graphic.mark.stroke.styling?.strokeWidth) stroke.width = graphic.mark.stroke.styling.strokeWidth; } - (layerConfig as VectorLayerEntryConfig).style!.Point = { styleType: 'simple', settings: styles }; + (layerConfig as VectorLayerEntryConfig).layerStyle!.Point = { + type: 'simple', + fields: [], + hasDefault: false, + info: [{ visible: true, label: '', values: [], settings: styles }], + }; } } } diff --git a/packages/geoview-core/src/geo/layer/gv-layers/abstract-gv-layer.ts b/packages/geoview-core/src/geo/layer/gv-layers/abstract-gv-layer.ts index a333c84c509..734c5035184 100644 --- a/packages/geoview-core/src/geo/layer/gv-layers/abstract-gv-layer.ts +++ b/packages/geoview-core/src/geo/layer/gv-layers/abstract-gv-layer.ts @@ -15,14 +15,12 @@ import { VectorLayerEntryConfig } from '@/core/utils/config/validation-classes/v import { AbstractBaseLayerEntryConfig } from '@/core/utils/config/validation-classes/abstract-base-layer-entry-config'; import EventHelper, { EventDelegateBase } from '@/api/events/event-helper'; import { - TypeStyleConfig, + TypeLayerStyleConfig, TypeFeatureInfoEntry, codedValueType, rangeDomainType, TypeLocation, QueryType, - TypeClassBreakStyleConfig, - TypeUniqueValueStyleConfig, TypeStyleGeometry, } from '@/geo/map/map-schema-types'; import { getLegendStyles, getFeatureCanvas } from '@/geo/utils/renderer/geoview-renderer'; @@ -46,7 +44,7 @@ export abstract class AbstractGVLayer extends AbstractBaseLayer { #olSource: Source; /** Style to apply to the vector layer. */ - #style?: TypeStyleConfig; + #layerStyle?: TypeLayerStyleConfig; /** Layer temporal dimension */ #layerTemporalDimension?: TimeDimension; @@ -154,18 +152,18 @@ export abstract class AbstractGVLayer extends AbstractBaseLayer { * @returns The layer style */ // eslint-disable-next-line @typescript-eslint/no-unused-vars - getStyle(layerPath: string): TypeStyleConfig | undefined { + getStyle(layerPath: string): TypeLayerStyleConfig | undefined { // TODO: Refactor - After layers refactoring, remove the layerPath parameter here (gotta keep it in the signature for now for the layers-set active switch) - return this.#style; + return this.#layerStyle; } /** * Sets the layer style * @param {TypeStyleConfig | undefined} style - The layer style */ - setStyle(layerPath: string, style: TypeStyleConfig): void { + setStyle(layerPath: string, style: TypeLayerStyleConfig): void { // TODO: Refactor - After layers refactoring, remove the layerPath parameter here (gotta keep it in the signature for now for the layers-set active switch) - this.#style = style; + this.#layerStyle = style; this.#emitLayerStyleChanged({ style, layerPath }); } @@ -438,13 +436,11 @@ export abstract class AbstractGVLayer extends AbstractBaseLayer { Object.keys(legend.styleConfig).forEach((geometry) => { if ( legend.styleConfig && - (legend.styleConfig[geometry as TypeStyleGeometry]?.styleType === 'uniqueValue' || - legend.styleConfig[geometry as TypeStyleGeometry]?.styleType === 'classBreaks') + (legend.styleConfig[geometry as TypeStyleGeometry]?.type === 'uniqueValue' || + legend.styleConfig[geometry as TypeStyleGeometry]?.type === 'classBreaks') ) { - if ((legend.styleConfig[geometry as TypeStyleGeometry] as TypeUniqueValueStyleConfig)!.uniqueValueStyleInfo?.length) - styleCount += (legend.styleConfig[geometry as TypeStyleGeometry] as TypeUniqueValueStyleConfig)!.uniqueValueStyleInfo.length; - if ((legend.styleConfig[geometry as TypeStyleGeometry] as TypeClassBreakStyleConfig)!.classBreakStyleInfo?.length) - styleCount += (legend.styleConfig[geometry as TypeStyleGeometry] as TypeClassBreakStyleConfig)!.classBreakStyleInfo.length; + if (legend.styleConfig[geometry as TypeStyleGeometry]!.info?.length) + styleCount += legend.styleConfig[geometry as TypeStyleGeometry]!.info.length; } }); // Set the openlayers icon image cache @@ -801,7 +797,7 @@ type LayerStyleChangedDelegate = EventDelegateBase( + static #countFieldOfTheSameValue(styleSettings: TypeLayerStyleSettings): TypeFieldOfTheSameValue[][] { + return styleSettings.info.reduce( (counter, styleEntry): TypeFieldOfTheSameValue[][] => { if ( - (styleEntry.visible === false && styleSettings.defaultVisible !== false) || - (styleEntry.visible !== false && styleSettings.defaultVisible === false) + (styleEntry.visible === false && styleSettings.info[styleSettings.info.length - 1].visible !== false) || + (styleEntry.visible !== false && styleSettings.info[styleSettings.info.length - 1].visible === false) ) { styleEntry.values.forEach((styleValue, i) => { const valueExist = counter[i].find((counterEntry) => counterEntry.value === styleValue); @@ -340,31 +336,25 @@ export class GVEsriDynamic extends AbstractGVRaster { const style = this.getStyle(layerConfig.layerPath); if (style) { - const setAllUndefinedVisibilityFlagsToYes = (styleConfig: TypeUniqueValueStyleConfig | TypeClassBreakStyleConfig): void => { + const setAllUndefinedVisibilityFlagsToYes = (styleConfig: TypeLayerStyleSettings): void => { // default value is true for all undefined visibility flags - // eslint-disable-next-line no-param-reassign - if (styleConfig.defaultVisible === undefined) styleConfig.defaultVisible = true; - const settings = isUniqueValueStyleConfig(styleConfig) ? styleConfig.uniqueValueStyleInfo : styleConfig.classBreakStyleInfo; + const settings = styleConfig.info; for (let i = 0; i < settings.length; i++) if (settings[i].visible === undefined) settings[i].visible = true; }; - const featuresAreAllVisible = (defaultVisibility: boolean, settings: { visible: boolean }[]): boolean => { - let allVisible = defaultVisibility !== false; - for (let i = 0; i < settings.length; i++) { - allVisible &&= settings[i].visible !== false; - } - return allVisible; + const featuresAreAllVisible = (settings: { visible: boolean }[]): boolean => { + return settings.every((setting) => setting.visible !== false); }; // Get the first style settings. const styleSettings = layerConfig.getFirstStyleSettings()!; - if (isSimpleStyleConfig(styleSettings)) { + if (styleSettings.type === 'simple') { return layerFilter || '(1=1)'; } - if (isUniqueValueStyleConfig(styleSettings)) { + if (styleSettings.type === 'uniqueValue') { setAllUndefinedVisibilityFlagsToYes(styleSettings); - if (featuresAreAllVisible(styleSettings.defaultVisible!, styleSettings.uniqueValueStyleInfo as { visible: boolean }[])) + if (featuresAreAllVisible(styleSettings.info as { visible: boolean }[])) return `(1=1)${layerFilter ? ` and (${layerFilter})` : ''}`; // This section of code optimize the query to reduce it at it shortest expression. @@ -376,83 +366,83 @@ export class GVEsriDynamic extends AbstractGVRaster { return `${query}${layerFilter ? ` and (${layerFilter})` : ''}`; } - if (isClassBreakStyleConfig(styleSettings)) { + if (styleSettings.type === 'classBreaks') { setAllUndefinedVisibilityFlagsToYes(styleSettings); - if (featuresAreAllVisible(styleSettings.defaultVisible!, styleSettings.classBreakStyleInfo as { visible: boolean }[])) + if (featuresAreAllVisible(styleSettings.info as { visible: boolean }[])) return `(1=1)${layerFilter ? ` and (${layerFilter})` : ''}`; const filterArray: string[] = []; let visibleWhenGreatherThisIndex = -1; - for (let i = 0; i < styleSettings.classBreakStyleInfo.length; i++) { + for (let i = 0; i < styleSettings.info.length; i++) { if (filterArray.length % 2 === 0) { if (i === 0) { - if (styleSettings.classBreakStyleInfo[0].visible !== false && styleSettings.defaultVisible === false) + if (styleSettings.info[0].visible !== false && styleSettings.info[styleSettings.info.length - 1].visible === false) filterArray.push( - `${styleSettings.field} >= ${GVEsriDynamic.#formatFieldValue( - styleSettings.field, - styleSettings.classBreakStyleInfo[0].minValue!, + `${styleSettings.fields[0]} >= ${GVEsriDynamic.#formatFieldValue( + styleSettings.fields[0], + styleSettings.info[0].values[0]!, layerConfig.source.featureInfo! )}` ); - else if (styleSettings.classBreakStyleInfo[0].visible === false && styleSettings.defaultVisible !== false) { + else if (styleSettings.info[0].visible === false && styleSettings.info[styleSettings.info.length - 1].visible !== false) { filterArray.push( - `${styleSettings.field} < ${GVEsriDynamic.#formatFieldValue( - styleSettings.field, - styleSettings.classBreakStyleInfo[0].minValue!, + `${styleSettings.fields[0]} < ${GVEsriDynamic.#formatFieldValue( + styleSettings.fields[0], + styleSettings.info[0].values[0], layerConfig.source.featureInfo! )}` ); visibleWhenGreatherThisIndex = i; } - } else if (styleSettings.classBreakStyleInfo[i].visible !== false && styleSettings.defaultVisible === false) { + } else if (styleSettings.info[i].visible !== false && styleSettings.info[styleSettings.info.length - 1].visible === false) { filterArray.push( - `${styleSettings.field} > ${GVEsriDynamic.#formatFieldValue( - styleSettings.field, - styleSettings.classBreakStyleInfo[i].minValue!, + `${styleSettings.fields[0]} > ${GVEsriDynamic.#formatFieldValue( + styleSettings.fields[0], + styleSettings.info[i].values[0], layerConfig.source.featureInfo! )}` ); - if (i + 1 === styleSettings.classBreakStyleInfo.length) + if (i + 1 === styleSettings.info.length) filterArray.push( - `${styleSettings.field} <= ${GVEsriDynamic.#formatFieldValue( - styleSettings.field, - styleSettings.classBreakStyleInfo[i].maxValue!, + `${styleSettings.fields[0]} <= ${GVEsriDynamic.#formatFieldValue( + styleSettings.fields[0], + styleSettings.info[i].values[1], layerConfig.source.featureInfo! )}` ); - } else if (styleSettings.classBreakStyleInfo[i].visible === false && styleSettings.defaultVisible !== false) { + } else if (styleSettings.info[i].visible === false && styleSettings.info[styleSettings.info.length - 1].visible !== false) { filterArray.push( - `${styleSettings.field} <= ${GVEsriDynamic.#formatFieldValue( - styleSettings.field, - styleSettings.classBreakStyleInfo[i].minValue!, + `${styleSettings.fields[0]} <= ${GVEsriDynamic.#formatFieldValue( + styleSettings.fields[0], + styleSettings.info[i].values[0], layerConfig.source.featureInfo! )}` ); visibleWhenGreatherThisIndex = i; } - } else if (styleSettings.defaultVisible === false) { - if (styleSettings.classBreakStyleInfo[i].visible === false) { + } else if (styleSettings.info[styleSettings.info.length - 1].visible === false) { + if (styleSettings.info[i].visible === false) { filterArray.push( - `${styleSettings.field} <= ${GVEsriDynamic.#formatFieldValue( - styleSettings.field, - styleSettings.classBreakStyleInfo[i - 1].maxValue!, + `${styleSettings.fields[0]} <= ${GVEsriDynamic.#formatFieldValue( + styleSettings.fields[0], + styleSettings.info[i - 1].values[1], layerConfig.source.featureInfo! )}` ); - } else if (i + 1 === styleSettings.classBreakStyleInfo.length) { + } else if (i + 1 === styleSettings.info.length) { filterArray.push( - `${styleSettings.field} <= ${GVEsriDynamic.#formatFieldValue( - styleSettings.field, - styleSettings.classBreakStyleInfo[i].maxValue!, + `${styleSettings.fields[0]} <= ${GVEsriDynamic.#formatFieldValue( + styleSettings.fields[0], + styleSettings.info[i].values[1], layerConfig.source.featureInfo! )}` ); } - } else if (styleSettings.classBreakStyleInfo[i].visible !== false) { + } else if (styleSettings.info[i].visible !== false) { filterArray.push( - `${styleSettings.field} > ${GVEsriDynamic.#formatFieldValue( - styleSettings.field, - styleSettings.classBreakStyleInfo[i - 1].maxValue!, + `${styleSettings.fields[0]} > ${GVEsriDynamic.#formatFieldValue( + styleSettings.fields[0], + styleSettings.info[i - 1].values[1], layerConfig.source.featureInfo! )}` ); @@ -463,14 +453,14 @@ export class GVEsriDynamic extends AbstractGVRaster { } if (visibleWhenGreatherThisIndex !== -1) filterArray.push( - `${styleSettings.field} > ${GVEsriDynamic.#formatFieldValue( - styleSettings.field, - styleSettings.classBreakStyleInfo[visibleWhenGreatherThisIndex].maxValue!, + `${styleSettings.fields[0]} > ${GVEsriDynamic.#formatFieldValue( + styleSettings.fields[0], + styleSettings.info[visibleWhenGreatherThisIndex].values[1], layerConfig.source.featureInfo! )}` ); - if (styleSettings.defaultVisible !== false) { + if (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 `; @@ -497,13 +487,13 @@ export class GVEsriDynamic extends AbstractGVRaster { * Sorts 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 value, we count the visible or invisible parameters. The order goes from the highest number of * occurrences to the lowest number of occurrences. - * @param {TypeUniqueValueStyleConfig} styleSettings - The unique value style settings to evaluate. + * @param {TypeLayerStyleSettings} styleSettings - The unique value style settings to evaluate. * @param {TypeFieldOfTheSameValue[][]} fieldOfTheSameValue - The count information that contains the number of occurrences * of a value. * @returns {number[]} An array that gives the field order to use to build the query tree. * @private */ - static #sortFieldOfTheSameValue(styleSettings: TypeUniqueValueStyleConfig, fieldOfTheSameValue: TypeFieldOfTheSameValue[][]): number[] { + static #sortFieldOfTheSameValue(styleSettings: TypeLayerStyleSettings, fieldOfTheSameValue: TypeFieldOfTheSameValue[][]): number[] { const fieldNotUsed = styleSettings.fields.map(() => true); const fieldOrder: number[] = []; for (let entrySelected = 0; entrySelected !== -1; entrySelected = fieldNotUsed.findIndex((flag) => flag)) { @@ -541,7 +531,7 @@ export class GVEsriDynamic extends AbstractGVRaster { * which is equivalent to: * f1 = v11 and f2 = v21 and f3 = v31 or f1 = v11 and f2 = v21 and f3 = v32 or f1 = v11 and f2 = v22 and f3 = v31 ... * - * @param {TypeUniqueValueStyleConfig} styleSettings - The unique value style settings to evaluate. + * @param {TypeLayerStyleSettings} styleSettings - The unique value style settings to evaluate. * @param {TypeFieldOfTheSameValue[][]} fieldOfTheSameValue - The count information that contains the number of occurrences * of a value. * @param {number[]} fieldOrder - The field order to use when building the tree. @@ -549,15 +539,15 @@ export class GVEsriDynamic extends AbstractGVRaster { * @private */ static #getQueryTree( - styleSettings: TypeUniqueValueStyleConfig, + styleSettings: TypeLayerStyleSettings, fieldOfTheSameValue: TypeFieldOfTheSameValue[][], fieldOrder: number[] ): TypeQueryTree { const queryTree: TypeQueryTree = []; - styleSettings.uniqueValueStyleInfo.forEach((styleEntry) => { + styleSettings.info.forEach((styleEntry) => { if ( - (styleEntry.visible === false && styleSettings.defaultVisible !== false) || - (styleEntry.visible !== false && styleSettings.defaultVisible === false) + (styleEntry.visible === false && styleSettings.info[styleSettings.info.length - 1].visible !== false) || + (styleEntry.visible !== false && styleSettings.info[styleSettings.info.length - 1].visible === false) ) { let levelToSearch = queryTree; for (let i = 0; i < fieldOrder.length; i++) { @@ -579,7 +569,7 @@ export class GVEsriDynamic extends AbstractGVRaster { * @param {TypeQueryTree} queryTree - The query tree to use. * @param {number} level - The level to use for solving the tree. * @param {number[]} fieldOrder - The field order to use for solving the tree. - * @param {TypeUniqueValueStyleConfig} styleSettings - The unique value style settings to evaluate. + * @param {TypeLayerStyleSettings} styleSettings - The unique value style settings to evaluate. * @param {TypeFeatureInfoLayerConfig} sourceFeatureInfo - The source feature information that knows the field type. * @returns {string} The resulting query. * @private @@ -588,10 +578,10 @@ export class GVEsriDynamic extends AbstractGVRaster { queryTree: TypeQueryTree, level: number, fieldOrder: number[], - styleSettings: TypeUniqueValueStyleConfig, + styleSettings: TypeLayerStyleSettings, sourceFeatureInfo: TypeFeatureInfoLayerConfig ): string { - let queryString = styleSettings.defaultVisible !== false && !level ? 'not (' : '('; + let queryString = styleSettings.info[styleSettings.info.length - 1].visible !== false && !level ? 'not (' : '('; for (let i = 0; i < queryTree.length; i++) { const value = GVEsriDynamic.#formatFieldValue(styleSettings.fields[fieldOrder[level]], queryTree[i].fieldValue, sourceFeatureInfo); // The nextField array is not empty, then it is is not the last field diff --git a/packages/geoview-core/src/geo/layer/gv-layers/raster/gv-esri-image.ts b/packages/geoview-core/src/geo/layer/gv-layers/raster/gv-esri-image.ts index a7c00b9007d..736db7a61fa 100644 --- a/packages/geoview-core/src/geo/layer/gv-layers/raster/gv-esri-image.ts +++ b/packages/geoview-core/src/geo/layer/gv-layers/raster/gv-esri-image.ts @@ -8,11 +8,11 @@ import { logger } from '@/core/utils/logger'; import { EsriImageLayerEntryConfig } from '@/core/utils/config/validation-classes/raster-validation-classes/esri-image-layer-entry-config'; import { CONST_LAYER_TYPES } from '@/geo/layer/geoview-layers/abstract-geoview-layers'; import { - TypeUniqueValueStyleConfig, - TypeUniqueValueStyleInfo, - TypeStyleConfig, + TypeLayerStyleConfig, + TypeLayerStyleConfigInfo, codedValueType, rangeDomainType, + TypeLayerStyleSettings, } from '@/geo/map/map-schema-types'; import { esriGetFieldType, esriGetFieldDomain } from '../utils'; import { validateExtent } from '@/geo/utils/utilities'; @@ -124,10 +124,11 @@ export class GVEsriImage extends AbstractGVRaster { }; return legend; } - const uniqueValueStyleInfo: TypeUniqueValueStyleInfo[] = []; + const uniqueValueStyleInfo: TypeLayerStyleConfigInfo[] = []; legendInfo.forEach((info) => { - const styleInfo: TypeUniqueValueStyleInfo = { + const styleInfo: TypeLayerStyleConfigInfo = { label: info.label, + visible: layerConfig.initialSettings.states?.visible || true, values: info.label.split(','), settings: { type: 'iconSymbol', @@ -139,12 +140,13 @@ export class GVEsriImage extends AbstractGVRaster { }; uniqueValueStyleInfo.push(styleInfo); }); - const styleSettings: TypeUniqueValueStyleConfig = { - styleType: 'uniqueValue', + const styleSettings: TypeLayerStyleSettings = { + type: 'uniqueValue', fields: ['default'], - uniqueValueStyleInfo, + hasDefault: false, + info: uniqueValueStyleInfo, }; - const styleConfig: TypeStyleConfig = { + const styleConfig: TypeLayerStyleConfig = { Point: styleSettings, }; diff --git a/packages/geoview-core/src/geo/layer/gv-layers/raster/gv-wms.ts b/packages/geoview-core/src/geo/layer/gv-layers/raster/gv-wms.ts index 4f9656a290e..694e6e227bb 100644 --- a/packages/geoview-core/src/geo/layer/gv-layers/raster/gv-wms.ts +++ b/packages/geoview-core/src/geo/layer/gv-layers/raster/gv-wms.ts @@ -261,7 +261,8 @@ export class GVWMS extends AbstractGVRaster { }); } else { legendStyle = layerCapabilities?.Style.find((style) => { - if (layerConfig?.source?.style && !Array.isArray(layerConfig?.source?.style)) return layerConfig.source.style === style.Name; + if (layerConfig?.source?.wmsStyle && !Array.isArray(layerConfig?.source?.wmsStyle)) + return layerConfig.source.wmsStyle === style.Name; // no style found, if default apply, if not use the available style return isDefaultStyle ? style.Name === 'default' : style.Name; diff --git a/packages/geoview-core/src/geo/layer/gv-layers/vector/abstract-gv-vector.ts b/packages/geoview-core/src/geo/layer/gv-layers/vector/abstract-gv-vector.ts index 93aae8d9437..0903b3cf620 100644 --- a/packages/geoview-core/src/geo/layer/gv-layers/vector/abstract-gv-vector.ts +++ b/packages/geoview-core/src/geo/layer/gv-layers/vector/abstract-gv-vector.ts @@ -331,7 +331,10 @@ export abstract class AbstractGVVector extends AbstractGVLayer { // A new style has been created logger.logDebug('A new style has been created on-the-fly', geometryType, layer); // Update the layer style - layer.setStyle(layerPath, { ...style, ...{ [geometryType]: theStyle } }); + layer.setStyle(layerPath, { + ...style, + ...{ [geometryType]: { type: 'simple', hasDefault: false, fields: [], info: [theStyle] } }, + }); }); } } diff --git a/packages/geoview-core/src/geo/layer/layer-mockup.ts b/packages/geoview-core/src/geo/layer/layer-mockup.ts index c95a39990e6..0835d4f3d4e 100644 --- a/packages/geoview-core/src/geo/layer/layer-mockup.ts +++ b/packages/geoview-core/src/geo/layer/layer-mockup.ts @@ -3,7 +3,7 @@ import { TypeGeoviewLayerConfig, TypeLayerEntryConfig, TypeLayerEntryType, - TypeStyleConfig, + TypeLayerStyleConfig, TypeVectorSourceFormats, } from '../map/map-schema-types'; import { TimeDimension } from '@/core/utils/date-mgt'; @@ -336,19 +336,27 @@ export abstract class LayerMockup { } as unknown as TypeJsonObject; } - static configTop100Style(): TypeStyleConfig { + static configTop100Style(): TypeLayerStyleConfig { return { Point: { - styleType: 'simple', - label: '', - settings: { - type: 'iconSymbol', - mimeType: 'image/png', - src: 'iVBORw0KGgoAAAANSUhEUgAAABYAAAAWCAYAAADEtGw7AAAAAXNSR0IB2cksfwAAAAlwSFlzAAAOxAAADsQBlSsOGwAAAstJREFUOI2101tIFFEYB/D/mV13z657cU3LFWLTHhQMQ7zkBYroJhU9VEQPgRQkpFFLVBgSUgZJSVCZRm+WJUhhdqGwfLGiCO1KlOmDlLGQ1111Z2bXna+XUkd3ZVT64Lycy2++Oef79PhPodeySZJ8K6GwJDA4wKhfUajLbLZ7FgQTDRtlSV9KQLEi+lMU7whIkiCYoyHELiFJGu0gosucW+8wxkgTLIq+dFlizcHenmTpaTOC7TXAxNDkOrNlMkPhgWy+YVuD7GCH/X7fbrPZ9mtOWBRH8xGaaB1vboyWm0rC/42vE3JTJwL3z8Hsrs81ZuW9laSxAs4tvWFhv9+bAKJ74w3XowOPT0W6pakPBDwYv7AZ5H6UyPPXPfT5fDk2m02cBQuCUCm9bk/QgqoSurIL+hXvV0UlLncDOK+C/X5vgiJL+8X6qnmhAABFhnj3JqxHyk8QeaoZcwYnYYEJO+TurzoafKE6Y7/WM8sJDfzGWEW+ai74sgqhohKHjNj1AFqnroIhe6Ln+yxEF79Mc+ITP3sh2B1ZapiQQEP9mpFwQT4vGMgJTH88BgkGTY0YOfRRIGBGVRD6hLjERbmCIxaMoU8FE9AWlZLmlhaIMu6C3pUEImpTwYGA8tzoSurXrS6OD328MXlgaI9VE2zYWQ7BwD9xk/WLCrbb7ZIojp4x7yutGf1cDyiy5mwF5xaYNm0Hgcr+zalei3NLnexK3m4+1lLory7UhDJbJiwnL0GIttZyk/VJWJgxpojiyF6eU/BAOPtm7XjdaZDnWURUl3EIloPHoYtbetvILUenr82qL5Mpxkvk2UipaZUxFxvd8ocOY7DzFULd70CDXWDODOjT82DIyEVUatowE1gF59arM52whcuYMwigTBTHavmagiKeU7AVQDKAGAADAL6BUQtAtzi3DYcz5uwIk8nyA0Dl3zGvWGSrRY4/rRIKxL8NeuEAAAAASUVORK5CYII=', - rotation: 0, - opacity: 1, - offset: [0, 0], - }, + type: 'simple', + fields: [], + hasDefault: false, + info: [ + { + label: '', + visible: true, + settings: { + type: 'iconSymbol', + mimeType: 'image/png', + src: 'iVBORw0KGgoAAAANSUhEUgAAABYAAAAWCAYAAADEtGw7AAAAAXNSR0IB2cksfwAAAAlwSFlzAAAOxAAADsQBlSsOGwAAAstJREFUOI2101tIFFEYB/D/mV13z657cU3LFWLTHhQMQ7zkBYroJhU9VEQPgRQkpFFLVBgSUgZJSVCZRm+WJUhhdqGwfLGiCO1KlOmDlLGQ1111Z2bXna+XUkd3ZVT64Lycy2++Oef79PhPodeySZJ8K6GwJDA4wKhfUajLbLZ7FgQTDRtlSV9KQLEi+lMU7whIkiCYoyHELiFJGu0gosucW+8wxkgTLIq+dFlizcHenmTpaTOC7TXAxNDkOrNlMkPhgWy+YVuD7GCH/X7fbrPZ9mtOWBRH8xGaaB1vboyWm0rC/42vE3JTJwL3z8Hsrs81ZuW9laSxAs4tvWFhv9+bAKJ74w3XowOPT0W6pakPBDwYv7AZ5H6UyPPXPfT5fDk2m02cBQuCUCm9bk/QgqoSurIL+hXvV0UlLncDOK+C/X5vgiJL+8X6qnmhAABFhnj3JqxHyk8QeaoZcwYnYYEJO+TurzoafKE6Y7/WM8sJDfzGWEW+ai74sgqhohKHjNj1AFqnroIhe6Ln+yxEF79Mc+ITP3sh2B1ZapiQQEP9mpFwQT4vGMgJTH88BgkGTY0YOfRRIGBGVRD6hLjERbmCIxaMoU8FE9AWlZLmlhaIMu6C3pUEImpTwYGA8tzoSurXrS6OD328MXlgaI9VE2zYWQ7BwD9xk/WLCrbb7ZIojp4x7yutGf1cDyiy5mwF5xaYNm0Hgcr+zalei3NLnexK3m4+1lLory7UhDJbJiwnL0GIttZyk/VJWJgxpojiyF6eU/BAOPtm7XjdaZDnWURUl3EIloPHoYtbetvILUenr82qL5Mpxkvk2UipaZUxFxvd8ocOY7DzFULd70CDXWDODOjT82DIyEVUatowE1gF59arM52whcuYMwigTBTHavmagiKeU7AVQDKAGAADAL6BUQtAtzi3DYcz5uwIk8nyA0Dl3zGvWGSrRY4/rRIKxL8NeuEAAAAASUVORK5CYII=', + rotation: 0, + opacity: 1, + offset: [0, 0], + }, + values: [], + }, + ], }, }; } @@ -1006,25 +1014,12 @@ export abstract class LayerMockup { ], }, }, - style: { + layerStyle: { Polygon: { - styleId: 'uniqueValueId', - defaultLabel: 'Other provinces', styleType: 'uniqueValue', - defaultSettings: { - type: 'filledPolygon', - color: 'rgba(0,0,255,0.5)', - paternSize: 10, - paternWidth: 2, - fillStyle: 'diagonalCross', - stroke: { - color: 'rgba(128,0,0,1)', - lineStyle: 'dot', - }, - }, - defaultVisible: true, + hasDefault: true, fields: ['Province'], - uniqueValueStyleInfo: [ + info: [ { label: 'Quebec', settings: { @@ -1057,6 +1052,22 @@ export abstract class LayerMockup { values: ['Alberta'], visible: false, }, + { + label: 'Other provinces', + settings: { + type: 'filledPolygon', + color: 'rgba(255,0,255,0.5)', + paternSize: 10, + paternWidth: 2, + fillStyle: 'diagonalCross', + stroke: { + color: 'rgba(128,0,128,1)', + lineStyle: 'dot', + }, + }, + values: [], + visible: true, + }, ], }, }, @@ -1095,14 +1106,22 @@ export abstract class LayerMockup { }, style: { LineString: { - styleType: 'simple', - label: 'LineString label', - settings: { - type: 'lineString', - stroke: { - lineStyle: 'shortDash-dot-dot', + type: 'simple', + hasDefault: false, + fields: [], + info: [ + { + label: 'LineString label', + visible: true, + values: [], + settings: { + type: 'lineString', + stroke: { + lineStyle: 'shortDash-dot-dot', + }, + }, }, - }, + ], }, }, } as unknown as TypeJsonObject; @@ -1139,15 +1158,23 @@ export abstract class LayerMockup { }, }, style: { - Point: { - styleType: 'simple', - label: 'Icon point label', - settings: { - type: 'iconSymbol', - mimeType: 'image/png', - 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=', - opacity: 0.5, - }, + point: { + type: 'simple', + hasDefault: false, + fields: [], + info: [ + { + label: 'Icon point label', + visible: true, + settings: { + type: 'iconSymbol', + mimeType: 'image/png', + 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=', + opacity: 0.5, + }, + values: [], + }, + ], }, }, } as unknown as TypeJsonObject; @@ -1203,12 +1230,20 @@ export abstract class LayerMockup { }, style: { Point: { - styleType: 'simple', - label: 'Point label', - settings: { - type: 'simpleSymbol', - symbol: 'star', - }, + type: 'simple', + fields: [], + hasDefault: false, + info: [ + { + visible: true, + label: 'Point label', + settings: { + type: 'simpleSymbol', + symbol: 'star', + }, + values: [], + }, + ], }, }, } as unknown as TypeJsonObject; diff --git a/packages/geoview-core/src/geo/layer/layer.ts b/packages/geoview-core/src/geo/layer/layer.ts index 5d531809d6f..358071f6c3b 100644 --- a/packages/geoview-core/src/geo/layer/layer.ts +++ b/packages/geoview-core/src/geo/layer/layer.ts @@ -24,8 +24,6 @@ import { mapConfigLayerEntryIsGeoCore, layerEntryIsGroupLayer, TypeLayerStatus, - TypeClassBreakStyleConfig, - TypeUniqueValueStyleConfig, } from '@/geo/map/map-schema-types'; import { GeoJSON, layerConfigIsGeoJSON } from '@/geo/layer/geoview-layers/vector/geojson'; import { GeoPackage, layerConfigIsGeoPackage } from '@/geo/layer/geoview-layers/vector/geopackage'; @@ -1409,17 +1407,9 @@ export class LayerApi { if (layer instanceof AbstractGeoViewLayer || layer instanceof AbstractGVLayer) { // 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.... - if (layer?.getStyle(layerPath)?.[item.geometryType]?.styleType === 'classBreaks') { - const geometryStyleConfig = layer.getStyle(layerPath)![item.geometryType] as TypeClassBreakStyleConfig; - const classBreakStyleInfo = geometryStyleConfig.classBreakStyleInfo.find((styleInfo) => styleInfo.label === item.name); - if (classBreakStyleInfo) classBreakStyleInfo.visible = visibility; - else geometryStyleConfig.defaultVisible = visibility; - } else if (layer?.getStyle(layerPath)?.[item.geometryType]?.styleType === 'uniqueValue') { - const geometryStyleConfig = layer.getStyle(layerPath)![item.geometryType] as TypeUniqueValueStyleConfig; - const uniqueStyleInfo = geometryStyleConfig.uniqueValueStyleInfo.find((styleInfo) => styleInfo.label === item.name); - if (uniqueStyleInfo) uniqueStyleInfo.visible = visibility; - else geometryStyleConfig.defaultVisible = visibility; - } + const geometryStyleConfig = layer.getStyle(layerPath)![item.geometryType]; + const toggledStyleInfo = geometryStyleConfig?.info.find((styleInfo) => styleInfo.label === item.name); + if (toggledStyleInfo) toggledStyleInfo.visible = visibility; } // Update the legend layers if necessary diff --git a/packages/geoview-core/src/geo/map/map-schema-types.ts b/packages/geoview-core/src/geo/map/map-schema-types.ts index 7145d81812f..435b1c2fa4c 100644 --- a/packages/geoview-core/src/geo/map/map-schema-types.ts +++ b/packages/geoview-core/src/geo/map/map-schema-types.ts @@ -102,13 +102,6 @@ export interface TypeVectorSourceInitialConfig extends TypeBaseSourceVectorIniti separator?: string; } -export type TypeKindOfVectorSettings = - | TypeBaseVectorConfig - | TypeLineStringVectorConfig - | TypePolygonVectorConfig - | TypeSimpleSymbolVectorConfig - | TypeIconSymbolVectorConfig; - export type TypeBaseVectorConfig = { /** Type of vector config */ type: 'lineString' | 'filledPolygon' | 'simpleSymbol' | 'iconSymbol'; @@ -303,7 +296,7 @@ export interface TypeSourceImageWmsInitialConfig extends TypeBaseSourceImageInit /** The type of the remote WMS server. The default value is mapserver. */ serverType?: TypeOfServer; /** Style to apply. Default = '' */ - style?: string | string[]; + wmsStyle?: string | string[]; } export interface TypeSourceImageStaticInitialConfig extends Omit { @@ -557,24 +550,70 @@ export const isIconSymbolVectorConfig = (verifyIfConfig: TypeBaseVectorConfig): }; /** ****************************************************************************************************************************** - * Valid values to specify line styles. + * Base style configuration. */ -export type TypeLineStyle = - | 'dash' - | 'dash-dot' - | 'dash-dot-dot' - | 'dot' - | 'longDash' - | 'longDash-dot' - | 'null' - | 'shortDash' - | 'shortDash-dot' - | 'shortDash-dot-dot' - | 'solid'; +export type TypeBaseStyleType = 'simple' | 'uniqueValue' | 'classBreaks'; /** ****************************************************************************************************************************** - * Stroke style for vector features. + * Valid keys for the TypeStyleConfig object. */ +export type TypeStyleGeometry = 'Point' | 'MultiPoint' | 'LineString' | 'MultiLineString' | 'Polygon' | 'MultiPolygon'; + +/** Styles to apply to the GeoView vector layer by geometry types. */ +export type TypeLayerStyleConfig = Partial>; + +/** Style settings to apply to the GeoView vector layer. */ +export type TypeLayerStyleSettings = { + type: TypeLayerStyleConfigType; + fields: string[]; + hasDefault: boolean; + info: TypeLayerStyleConfigInfo[]; +}; + +/** Information needed to render the feature. */ +export type TypeLayerStyleConfigInfo = { + /** Flag used to show/hide features associated to the label (default: true). */ + visible: boolean; + /** The label to display for the field. */ + label: string; + /** + * Simple type has a single value at index 0; uniqueValue type has many entries (up to 3 for ESRI) and classBreaks + * type has two entries (index 0 for min and index 1 for max). + */ + values: (string | number)[]; + /** The geometry settings. */ + settings: TypeKindOfVectorSettings; +}; + +/** Valid keys for the type property of style configurations. */ +export type TypeLayerStyleConfigType = 'simple' | 'uniqueValue' | 'classBreaks'; + +/** Definition of the line symbol vector settings type. */ +export type TypeBaseVectorGeometryConfig = { + /** Type of vector config. */ + type: TypeBaseVectorType; +}; + +/** Valid values for the type property of the base vector settingd. */ +export type TypeBaseVectorType = 'lineString' | 'filledPolygon' | 'simpleSymbol' | 'iconSymbol'; + +/** Kind of symbol vector settings. */ +export type TypeKindOfVectorSettings = + | TypeBaseVectorGeometryConfig + | TypeLineStringVectorConfig + | TypePolygonVectorConfig + | TypeSimpleSymbolVectorConfig + | TypeIconSymbolVectorConfig; + +/** Definition of the line symbol vector settings type. */ +export interface TypeLineStringVectorConfig extends TypeBaseVectorGeometryConfig { + /** Type of vector config */ + type: 'lineString'; + /** Line stroke symbology */ + stroke: TypeStrokeSymbolConfig; +} + +/** Stroke style for vector features. */ export type TypeStrokeSymbolConfig = { /** Color to use for vector features. */ color?: string; @@ -584,33 +623,22 @@ export type TypeStrokeSymbolConfig = { width?: number; }; -/** ****************************************************************************************************************************** - * Definition of the line symbol vector settings type. - */ -export interface TypeLineStringVectorConfig extends TypeBaseVectorConfig { - /** Type of vector config */ - type: 'lineString'; - /** Line stroke symbology */ - stroke: TypeStrokeSymbolConfig; -} - -/** ****************************************************************************************************************************** - * Valid values to specify fill styles. - */ -export type TypeFillStyle = +/** Valid values to specify line styles. */ +export type TypeLineStyle = + | 'dash' + | 'dash-dot' + | 'dash-dot-dot' + | 'dot' + | 'longDash' + | 'longDash-dot' | 'null' - | 'solid' - | 'backwardDiagonal' - | 'cross' - | 'diagonalCross' - | 'forwardDiagonal' - | 'horizontal' - | 'vertical'; + | 'shortDash' + | 'shortDash-dot' + | 'shortDash-dot-dot' + | 'solid'; -/** ****************************************************************************************************************************** - * Definition of the line symbol vector settings type. - */ -export interface TypePolygonVectorConfig extends TypeBaseVectorConfig { +/** Definition of the polygon symbol vector settings type. */ +export interface TypePolygonVectorConfig extends TypeBaseVectorGeometryConfig { /** Type of vector config */ type: 'filledPolygon'; /** Fill color for vector features. */ @@ -625,15 +653,19 @@ export interface TypePolygonVectorConfig extends TypeBaseVectorConfig { fillStyle: TypeFillStyle; } -/** ****************************************************************************************************************************** - * Valid values to specify symbol shapes. - */ -export type TypeSymbol = 'circle' | '+' | 'diamond' | 'square' | 'triangle' | 'X' | 'star'; +/** Valid values to specify fill styles. */ +export type TypeFillStyle = + | 'null' + | 'solid' + | 'backwardDiagonal' + | 'cross' + | 'diagonalCross' + | 'forwardDiagonal' + | 'horizontal' + | 'vertical'; -/** ****************************************************************************************************************************** - * Definition of the circle symbol vector settings type. - */ -export interface TypeSimpleSymbolVectorConfig extends TypeBaseVectorConfig { +/** Definition of the circle symbol vector settings type. */ +export interface TypeSimpleSymbolVectorConfig extends TypeBaseVectorGeometryConfig { /** Type of vector config */ type: 'simpleSymbol'; /** Symbol rotation in radians. */ @@ -650,10 +682,11 @@ export interface TypeSimpleSymbolVectorConfig extends TypeBaseVectorConfig { symbol: TypeSymbol; } -/** ****************************************************************************************************************************** - * Definition of the icon symbol vector settings type. - */ -export interface TypeIconSymbolVectorConfig extends TypeBaseVectorConfig { +/** Valid values to specify symbol shapes. */ +export type TypeSymbol = 'circle' | '+' | 'diamond' | 'square' | 'triangle' | 'X' | 'star'; + +/** Definition of the icon symbol vector settings type. */ +export interface TypeIconSymbolVectorConfig extends TypeBaseVectorGeometryConfig { /** Type of vector config */ type: 'iconSymbol'; /** Mime type of the icon. */ @@ -676,160 +709,3 @@ export interface TypeIconSymbolVectorConfig extends TypeBaseVectorConfig { */ crossOrigin?: string; } - -/** ****************************************************************************************************************************** - * Base style configuration. - */ -export type TypeBaseStyleType = 'simple' | 'uniqueValue' | 'classBreaks'; - -/** ****************************************************************************************************************************** - * Base style configuration. - */ -export type TypeBaseStyleConfig = { - /** Type of style. */ - styleType: TypeBaseStyleType; -}; - -/** ****************************************************************************************************************************** - * type guard function that redefines a TypeBaseStyleConfig as a TypeSimpleStyleConfig if the type attribute of the - * verifyIfConfig parameter is 'simple'. The type ascention applies only to the true block of the if clause that use - * this function. - * - * @param {TypeStyleSettings | TypeKindOfVectorSettings} verifyIfConfig Polymorphic object to test in order to determine if - * the type ascention is valid. - * - * @returns {boolean} true if the type ascention is valid. - */ -export const isSimpleStyleConfig = ( - verifyIfConfig: TypeStyleSettings | TypeKindOfVectorSettings -): verifyIfConfig is TypeSimpleStyleConfig => { - return (verifyIfConfig as TypeStyleSettings)?.styleType === 'simple'; -}; - -/** ****************************************************************************************************************************** - * Simple style configuration. - */ -export interface TypeSimpleStyleConfig extends TypeBaseStyleConfig { - /** Type of style. */ - styleType: 'simple'; - /** Label associated to the style */ - label: string; - /** options associated to the style. */ - settings: TypeKindOfVectorSettings; -} - -/** ****************************************************************************************************************************** - * Unique value style information configuration. - */ -export type TypeUniqueValueStyleInfo = { - /** Label used by the style. */ - label: string; - /** Values associated to the style. */ - values: (string | number | Date)[]; - /** Flag used to show/hide features associated to the label (default: yes). */ - visible?: boolean; - /** options associated to the style. */ - settings: TypeKindOfVectorSettings; -}; - -/** ****************************************************************************************************************************** - * type guard function that redefines a TypeStyleSettings | TypeKindOfVectorSettings as a TypeUniqueValueStyleConfig if the - * styleType attribute of the verifyIfConfig parameter is 'uniqueValue'. The type ascention applies only to the true block of the - * if clause that use this function. - * - * @param {TypeStyleSettings | TypeKindOfVectorSettings} verifyIfConfig Polymorphic object to test in order to determine if the - * type ascention is valid. - * - * @returns {boolean} true if the type ascention is valid. - */ -export const isUniqueValueStyleConfig = ( - verifyIfConfig: TypeStyleSettings | TypeKindOfVectorSettings -): verifyIfConfig is TypeUniqueValueStyleConfig => { - return (verifyIfConfig as TypeStyleSettings)?.styleType === 'uniqueValue'; -}; - -/** ****************************************************************************************************************************** - * Unique value style configuration. - */ -export interface TypeUniqueValueStyleConfig extends TypeBaseStyleConfig { - /** Type of style. */ - styleType: 'uniqueValue'; - /** Label used if field/value association is not found. */ - defaultLabel?: string; - /** Options used if field/value association is not found. */ - defaultSettings?: TypeKindOfVectorSettings; - /** Flag used to show/hide features associated to the default label - * (default: no if ESRI renderer in the metadata has no default symbol defined). */ - defaultVisible?: boolean; - /** Fields used by the style. */ - fields: string[]; - /** Unique value style information configuration. */ - uniqueValueStyleInfo: TypeUniqueValueStyleInfo[]; -} - -/** ****************************************************************************************************************************** - * Class break style information configuration. - */ -export type TypeClassBreakStyleInfo = { - /** Label used by the style. */ - label: string; - /** Minimum values associated to the style. */ - minValue: number | string | Date | undefined | null; - /** Flag used to show/hide features associated to the label (default: yes). */ - visible?: boolean; - /** Maximum values associated to the style. */ - maxValue: number | string | Date; - /** options associated to the style. */ - settings: TypeKindOfVectorSettings; -}; - -/** ****************************************************************************************************************************** - * type guard function that redefines a TypeStyleSettings | TypeKindOfVectorSettings as a TypeClassBreakStyleConfig if the - * styleType attribute of the verifyIfConfig parameter is 'classBreaks'. The type ascention applies only to the true block of the - * if clause that use this function. - * - * @param {TypeStyleSettings | TypeKindOfVectorSettings} verifyIfConfig Polymorphic object to test in order to determine if the - * type ascention is valid. - * - * @returns {boolean} true if the type ascention is valid. - */ -export const isClassBreakStyleConfig = ( - verifyIfConfig: TypeStyleSettings | TypeKindOfVectorSettings -): verifyIfConfig is TypeClassBreakStyleConfig => { - return (verifyIfConfig as TypeStyleSettings)?.styleType === 'classBreaks'; -}; - -/** ****************************************************************************************************************************** - * Class break style configuration. - */ -export interface TypeClassBreakStyleConfig extends TypeBaseStyleConfig { - /** Type of style. */ - styleType: 'classBreaks'; - /** Label used if field/value association is not found. */ - defaultLabel?: string; - /** Options used if field/value association is not found. */ - defaultVisible?: boolean; - /** Flag used to show/hide features associated to the default label (default: yes). */ - defaultSettings?: TypeKindOfVectorSettings; - /** Field used by the style. */ - field: string; - /** Class break style information configuration. */ - classBreakStyleInfo: TypeClassBreakStyleInfo[]; -} - -/** ****************************************************************************************************************************** - * Type of Style to apply to the GeoView vector layer source at creation time. - */ -export type TypeStyleSettings = TypeBaseStyleConfig | TypeSimpleStyleConfig | TypeUniqueValueStyleConfig | TypeClassBreakStyleConfig; - -/** ****************************************************************************************************************************** - * Valid keys for the TypeStyleConfig object. - */ -// TODO: Refactor - Layers/Config refactoring. The values here have been renamed to lower case, make sure to lower here and adjust everywhere as part of config migration. -export type TypeStyleGeometry = 'Point' | 'MultiPoint' | 'LineString' | 'MultiLineString' | 'Polygon' | 'MultiPolygon'; - -/** ****************************************************************************************************************************** - * Type of Style to apply to the GeoView vector layer based on geometry types. - */ -export type TypeStyleConfig = Partial>; -// #endregion STYLES TYPES 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 0df44ba548a..d85e0f59c3d 100644 --- a/packages/geoview-core/src/geo/utils/renderer/esri-renderer.ts +++ b/packages/geoview-core/src/geo/utils/renderer/esri-renderer.ts @@ -7,20 +7,17 @@ import { isIconSymbolVectorConfig, isLineStringVectorConfig, isSimpleSymbolVectorConfig, - TypeClassBreakStyleConfig, - TypeClassBreakStyleInfo, TypeFillStyle, TypePolygonVectorConfig, TypeIconSymbolVectorConfig, TypeLineStyle, TypeLineStringVectorConfig, - TypeSimpleStyleConfig, TypeSimpleSymbolVectorConfig, - TypeStyleConfig, + TypeLayerStyleConfig, + TypeLayerStyleConfigInfo, + TypeLayerStyleSettings, TypeStyleGeometry, TypeSymbol, - TypeUniqueValueStyleConfig, - TypeUniqueValueStyleInfo, } from '@/geo/map/map-schema-types'; import { logger } from '@/core/utils/logger'; @@ -323,18 +320,14 @@ function getStyleGeometry(settings: TypeKindOfVectorSettings): TypeStyleGeometry * * @param {EsriUniqueValueRenderer} renderer - ESRI renderer to convert. * - * @returns {TypeStyleConfig | undefined} The Geoview style or undefined if it can not be created. + * @returns {TypeLayerStyleConfig | undefined} The Geoview style or undefined if it can not be created. */ -function processUniqueValueRenderer(renderer: EsriUniqueValueRenderer): TypeStyleConfig | undefined { - const style: TypeStyleConfig = {}; - const styleType = 'uniqueValue'; - const defaultLabel = renderer.defaultLabel === null ? undefined : renderer.defaultLabel; - const defaultVisible = !!renderer.defaultSymbol; - const defaultSettings = convertSymbol(renderer.defaultSymbol); +function processUniqueValueRenderer(renderer: EsriUniqueValueRenderer): TypeLayerStyleConfig | undefined { + const style: TypeLayerStyleConfig = {}; const fields = [renderer.field1]; if (renderer.field2) fields.push(renderer.field2); if (renderer.field3) fields.push(renderer.field3); - const uniqueValueStyleInfo: TypeUniqueValueStyleInfo[] = []; + const uniqueValueStyleInfo: TypeLayerStyleConfigInfo[] = []; renderer.uniqueValueInfos.forEach((symbolInfo) => { const settings = convertSymbol(symbolInfo.symbol); if (settings) { @@ -349,13 +342,11 @@ function processUniqueValueRenderer(renderer: EsriUniqueValueRenderer): TypeStyl } }); const styleGeometry = getStyleGeometry(uniqueValueStyleInfo[0].settings); - const styleSettings: TypeUniqueValueStyleConfig = { - styleType, - defaultLabel, - defaultVisible, - defaultSettings, + const styleSettings: TypeLayerStyleSettings = { + type: 'uniqueValue', + hasDefault: false, fields, - uniqueValueStyleInfo, + info: uniqueValueStyleInfo, }; if (styleGeometry) { style[styleGeometry] = styleSettings; @@ -369,17 +360,23 @@ function processUniqueValueRenderer(renderer: EsriUniqueValueRenderer): TypeStyl * * @param {EsriSimpleRenderer} renderer - ESRI renderer to convert. * - * @returns {TypeStyleConfig | undefined} The Geoview style or undefined if it can not be created. + * @returns {TypeLayerStyleConfig | undefined} The Geoview style or undefined if it can not be created. */ -function processSimpleRenderer(renderer: EsriSimpleRenderer): TypeStyleConfig | undefined { - const style: TypeStyleConfig = {}; +function processSimpleRenderer(renderer: EsriSimpleRenderer): TypeLayerStyleConfig | undefined { + const style: TypeLayerStyleConfig = {}; const { label } = renderer; const settings = convertSymbol(renderer.symbol); if (settings) { if (renderer.rotationType === 'geographic' && (isIconSymbolVectorConfig(settings) || isSimpleSymbolVectorConfig(settings))) settings.rotation = Math.PI / 2 - settings.rotation!; + const styleInfo: TypeLayerStyleConfigInfo = { visible: true, label, values: [], settings }; const styleGeometry = getStyleGeometry(settings); - const styleSettings: TypeSimpleStyleConfig = { styleType: 'simple', label, settings }; + const styleSettings: TypeLayerStyleSettings = { + type: 'simple', + fields: [], + hasDefault: false, + info: [styleInfo], + }; if (styleGeometry) { style[styleGeometry] = styleSettings; return style; @@ -393,46 +390,56 @@ function processSimpleRenderer(renderer: EsriSimpleRenderer): TypeStyleConfig | * * @param {EsriClassBreakRenderer} EsriRenderer - ESRI renderer to convert. * - * @returns {TypeStyleConfig | undefined} The Geoview style or undefined if it can not be created. + * @returns {TypeLayerStyleConfig | undefined} The Geoview style or undefined if it can not be created. */ -function processClassBreakRenderer(EsriRenderer: EsriClassBreakRenderer): TypeStyleConfig | undefined { - const style: TypeStyleConfig = {}; - const styleType = 'classBreaks'; - const defaultLabel = EsriRenderer.defaultLabel === null ? undefined : EsriRenderer.defaultLabel; - const defaultSettings = convertSymbol(EsriRenderer.defaultSymbol); - const defaultVisible = !!EsriRenderer.defaultLabel; +function processClassBreakRenderer(EsriRenderer: EsriClassBreakRenderer): TypeLayerStyleConfig | undefined { const { field } = EsriRenderer; - const classBreakStyleInfo: TypeClassBreakStyleInfo[] = []; + const style: TypeLayerStyleConfig = {}; + const classBreakStyleInfo: TypeLayerStyleConfigInfo[] = []; for (let i = 0; i < EsriRenderer.classBreakInfos.length; i++) { const settings = convertSymbol(EsriRenderer.classBreakInfos[i].symbol); if (settings) { if (EsriRenderer.rotationType === 'geographic' && (isIconSymbolVectorConfig(settings) || isSimpleSymbolVectorConfig(settings))) settings.rotation = Math.PI / 2 - settings.rotation!; - const geoviewClassBreakInfo: TypeClassBreakStyleInfo = { + const geoviewClassBreakInfo: TypeLayerStyleConfigInfo = { label: EsriRenderer.classBreakInfos[i].label, visible: true, - minValue: EsriRenderer.classBreakInfos[i].classMinValue, - maxValue: EsriRenderer.classBreakInfos[i].classMaxValue, + values: [EsriRenderer.classBreakInfos[i].classMinValue as number, EsriRenderer.classBreakInfos[i].classMaxValue], settings, }; classBreakStyleInfo.push(geoviewClassBreakInfo); if (EsriRenderer.classBreakInfos[i].classMinValue || EsriRenderer.classBreakInfos[i].classMinValue === 0) - classBreakStyleInfo[i].minValue = EsriRenderer.classBreakInfos[i].classMinValue; - else if (i === 0) classBreakStyleInfo[i].minValue = EsriRenderer.minValue; - else classBreakStyleInfo[i].minValue = EsriRenderer.classBreakInfos[i - 1].classMaxValue; + classBreakStyleInfo[i].values[0] = EsriRenderer.classBreakInfos[i].classMinValue as number; + else if (i === 0) classBreakStyleInfo[i].values[0] = EsriRenderer.minValue; + else classBreakStyleInfo[i].values[0] = EsriRenderer.classBreakInfos[i - 1].classMaxValue; } } + const defaultSettings = convertSymbol(EsriRenderer.defaultSymbol); + const hasDefault = !!defaultSettings; + if (hasDefault) { + if ( + EsriRenderer.rotationType === 'geographic' && + (isIconSymbolVectorConfig(defaultSettings) || isSimpleSymbolVectorConfig(defaultSettings)) + ) + defaultSettings.rotation = Math.PI / 2 - defaultSettings.rotation!; + classBreakStyleInfo.push({ + label: EsriRenderer.defaultLabel, + visible: true, + values: [], + settings: defaultSettings, + }); + } + const styleGeometry = getStyleGeometry(classBreakStyleInfo[0].settings); - const styleSettings: TypeClassBreakStyleConfig = { - styleType, - defaultVisible, - defaultLabel, - defaultSettings, - field, - classBreakStyleInfo, - }; if (styleGeometry) { + const styleSettings: TypeLayerStyleSettings = { + type: 'classBreaks', + fields: [field], + hasDefault, + info: classBreakStyleInfo, + }; + style[styleGeometry] = styleSettings; return style; } @@ -446,7 +453,7 @@ function processClassBreakRenderer(EsriRenderer: EsriClassBreakRenderer): TypeSt * * @returns {TypeStyleConfig | undefined} The Geoview style or undefined if it can not be created. */ -export function getStyleFromEsriRenderer(renderer: EsriBaseRenderer): TypeStyleConfig | undefined { +export function getStyleFromEsriRenderer(renderer: EsriBaseRenderer): TypeLayerStyleConfig | undefined { if (esriRendererIsUniqueValue(renderer)) return processUniqueValueRenderer(renderer); if (esriRendererIsSimple(renderer)) return processSimpleRenderer(renderer); if (esriRendererIsClassBreaks(renderer)) return processClassBreakRenderer(renderer); diff --git a/packages/geoview-core/src/geo/utils/renderer/geoview-renderer.ts b/packages/geoview-core/src/geo/utils/renderer/geoview-renderer.ts index 49802d738de..e0416d18d60 100644 --- a/packages/geoview-core/src/geo/utils/renderer/geoview-renderer.ts +++ b/packages/geoview-core/src/geo/utils/renderer/geoview-renderer.ts @@ -18,26 +18,18 @@ import { isLineStringVectorConfig, isSimpleSymbolVectorConfig, TypeBaseStyleType, - TypeClassBreakStyleInfo, TypeFillStyle, TypePolygonVectorConfig, TypeIconSymbolVectorConfig, TypeLineStyle, TypeLineStringVectorConfig, - TypeSimpleStyleConfig, TypeSimpleSymbolVectorConfig, - TypeStyleGeometry, - TypeStyleSettings, TypeSymbol, - TypeUniqueValueStyleInfo, - TypeStyleConfig, TypeKindOfVectorSettings, - isSimpleStyleConfig, - isUniqueValueStyleConfig, - isClassBreakStyleConfig, - TypeUniqueValueStyleConfig, - TypeClassBreakStyleConfig, - TypeBaseStyleConfig, + TypeStyleGeometry, + TypeLayerStyleSettings, + TypeLayerStyleConfig, + TypeLayerStyleConfigInfo, } from '@/geo/map/map-schema-types'; import { binaryKeywors, @@ -55,7 +47,7 @@ import { TypeVectorLayerStyles } from '@/geo/layer/geoview-layers/abstract-geovi import { logger } from '@/core/utils/logger'; type TypeStyleProcessor = ( - styleSettings: TypeStyleSettings | TypeKindOfVectorSettings, + styleSettings: TypeLayerStyleSettings | TypeKindOfVectorSettings, feature?: Feature, filterEquation?: FilterNodeArrayType, legendFilterIsOff?: boolean @@ -71,7 +63,7 @@ let colorCount = 0; * * @returns {string} The current default color string. */ -// TODO: create a mechanisim to have one counter by map if needed with a small class who reuse the static function +// TODO: create a mechanism to have one counter by map if needed with a small class who reuse the static function function getDefaultColor(alpha: number, increment = false): string { // get color then increment if needed const color = asString(setAlphaColor(asArray(defaultColor[colorCount]), alpha)); @@ -794,21 +786,21 @@ const processSymbol: Record) => void} resolve - Function that will resolve the promise * of the calling methode. * @@ -1055,7 +1046,7 @@ function processSimplePolygon( */ async function processArrayOfPointStyleConfig( layerStyles: TypeVectorLayerStyles, - arrayOfPointStyleConfig: TypeUniqueValueStyleInfo[] | TypeClassBreakStyleInfo[] + arrayOfPointStyleConfig: TypeLayerStyleConfigInfo[] ): Promise { try { // UniqueValue or ClassBreak point style configuration ============================================================ @@ -1090,7 +1081,7 @@ async function processArrayOfPointStyleConfig( * * @param {TypeKindOfVectorSettings | undefined} defaultSettings - Settings associated to simple styles or default style of * unique value and class break styles. When this parameter is undefined, no defaultCanvas is created. - * @param {TypeUniqueValueStyleInfo[] | TypeClassBreakStyleInfo[] | undefined} arrayOfPointStyleConfig - Array of point style + * @param {TypeLayerStyleConfigInfo[] | undefined} arrayOfPointStyleConfig - Array of point style * configuration associated to unique value and class break styles. When this parameter is undefined, no arrayOfCanvas is * created. * @@ -1098,7 +1089,7 @@ async function processArrayOfPointStyleConfig( */ async function getPointStyleSubRoutine( defaultSettings?: TypeKindOfVectorSettings, - arrayOfPointStyleConfig?: TypeUniqueValueStyleInfo[] | TypeClassBreakStyleInfo[] + arrayOfPointStyleConfig?: TypeLayerStyleConfigInfo[] ): Promise { try { const layerStyles: TypeVectorLayerStyles = { Point: {} }; @@ -1109,7 +1100,9 @@ async function getPointStyleSubRoutine( layerStyles.Point!.defaultCanvas = canvas; if (arrayOfPointStyleConfig) { layerStyles.Point!.arrayOfCanvas = []; - return await processArrayOfPointStyleConfig(layerStyles, arrayOfPointStyleConfig); + const processedStyles = await processArrayOfPointStyleConfig(layerStyles, arrayOfPointStyleConfig); + processedStyles.Point?.arrayOfCanvas?.pop(); + return processedStyles; } return layerStyles; } @@ -1118,7 +1111,9 @@ async function getPointStyleSubRoutine( layerStyles.Point!.defaultCanvas = createPointCanvas(processSimplePoint(defaultSettings)); if (arrayOfPointStyleConfig) { layerStyles.Point!.arrayOfCanvas = []; - return await processArrayOfPointStyleConfig(layerStyles, arrayOfPointStyleConfig); + const processedStyles = await processArrayOfPointStyleConfig(layerStyles, arrayOfPointStyleConfig); + processedStyles.Point?.arrayOfCanvas?.pop(); + return processedStyles; } return layerStyles; } @@ -1138,7 +1133,7 @@ async function getPointStyleSubRoutine( * * @returns {Promise} A promise that the layer styles are processed. */ -export async function getLegendStyles(styleConfig: TypeStyleConfig | undefined): Promise { +export async function getLegendStyles(styleConfig: TypeLayerStyleConfig | undefined): Promise { try { if (!styleConfig) return {}; @@ -1146,24 +1141,14 @@ export async function getLegendStyles(styleConfig: TypeStyleConfig | undefined): if (styleConfig.Point) { // ====================================================================================================================== // Point style configuration ============================================================================================ - if (isSimpleStyleConfig(styleConfig.Point)) { - const layerStyles = await getPointStyleSubRoutine(styleConfig.Point.settings); - legendStyles.Point = layerStyles.Point; - } - - if (isUniqueValueStyleConfig(styleConfig.Point)) { - const layerStyles = await getPointStyleSubRoutine( - styleConfig.Point.defaultSettings, - (styleConfig.Point as TypeUniqueValueStyleConfig).uniqueValueStyleInfo - ); + if (styleConfig.Point.type === 'simple') { + const layerStyles = await getPointStyleSubRoutine(styleConfig.Point.info[0].settings); legendStyles.Point = layerStyles.Point; - } - - if (isClassBreakStyleConfig(styleConfig.Point)) { - const layerStyles = await getPointStyleSubRoutine( - styleConfig.Point.defaultSettings, - (styleConfig.Point as TypeClassBreakStyleConfig).classBreakStyleInfo - ); + } else { + const defaultSettings = styleConfig.Point.hasDefault + ? styleConfig.Point.info[styleConfig.Point.info.length - 1].settings + : undefined; + const layerStyles = await getPointStyleSubRoutine(defaultSettings, styleConfig.Point.info); legendStyles.Point = layerStyles.Point; } } @@ -1172,23 +1157,18 @@ export async function getLegendStyles(styleConfig: TypeStyleConfig | undefined): // ====================================================================================================================== // LineString style configuration ======================================================================================= const layerStyles: TypeVectorLayerStyles = { LineString: {} }; - if (isSimpleStyleConfig(styleConfig.LineString)) { + if (styleConfig.LineString.type === 'simple') { layerStyles.LineString!.defaultCanvas = createLineStringCanvas(processSimpleLineString(styleConfig.LineString)); - } else if (isUniqueValueStyleConfig(styleConfig.LineString)) { - if (styleConfig.LineString.defaultSettings) - layerStyles.LineString!.defaultCanvas = createLineStringCanvas(processSimpleLineString(styleConfig.LineString.defaultSettings)); - const styleArray: HTMLCanvasElement[] = []; - styleConfig.LineString.uniqueValueStyleInfo.forEach((styleInfo) => { - styleArray.push(createLineStringCanvas(processSimpleLineString(styleInfo.settings))); - }); - layerStyles.LineString!.arrayOfCanvas = styleArray; - } else if (isClassBreakStyleConfig(styleConfig.LineString)) { - if (styleConfig.LineString.defaultSettings) - layerStyles.LineString!.defaultCanvas = createLineStringCanvas(processSimpleLineString(styleConfig.LineString.defaultSettings)); + } else { + if (styleConfig.LineString.hasDefault) + layerStyles.LineString!.defaultCanvas = createLineStringCanvas( + processSimpleLineString(styleConfig.LineString.info[styleConfig.LineString.info.length - 1].settings) + ); const styleArray: HTMLCanvasElement[] = []; - styleConfig.LineString.classBreakStyleInfo.forEach((styleInfo) => { + styleConfig.LineString.info.forEach((styleInfo) => { styleArray.push(createLineStringCanvas(processSimpleLineString(styleInfo.settings))); }); + if (styleConfig.LineString.hasDefault) styleArray.pop(); layerStyles.LineString!.arrayOfCanvas = styleArray; } legendStyles.LineString = layerStyles.LineString; @@ -1198,25 +1178,22 @@ export async function getLegendStyles(styleConfig: TypeStyleConfig | undefined): // ====================================================================================================================== // Polygon style configuration ========================================================================================== const layerStyles: TypeVectorLayerStyles = { Polygon: {} }; - if (isSimpleStyleConfig(styleConfig.Polygon)) { - layerStyles.Polygon!.defaultCanvas = createPolygonCanvas(processSimplePolygon(styleConfig.Polygon)); - } else if (isUniqueValueStyleConfig(styleConfig.Polygon)) { - if (styleConfig.Polygon.defaultSettings) - layerStyles.Polygon!.defaultCanvas = createPolygonCanvas(processSimplePolygon(styleConfig.Polygon.defaultSettings)); - const styleArray: HTMLCanvasElement[] = []; - styleConfig.Polygon.uniqueValueStyleInfo.forEach((styleInfo) => { - styleArray.push(createPolygonCanvas(processSimplePolygon(styleInfo.settings))); - }); - layerStyles.Polygon!.arrayOfCanvas = styleArray; - } else if (isClassBreakStyleConfig(styleConfig.Polygon)) { - if (styleConfig.Polygon.defaultSettings) - layerStyles.Polygon!.defaultCanvas = createPolygonCanvas(processSimplePolygon(styleConfig.Polygon.defaultSettings)); + if (styleConfig.Polygon.type === 'simple') { + layerStyles.Polygon!.defaultCanvas = createPolygonCanvas(processSimplePolygon(styleConfig.Polygon.info[0].settings)); + } else { + if (styleConfig.Polygon.hasDefault) + layerStyles.Polygon!.defaultCanvas = createPolygonCanvas( + processSimplePolygon(styleConfig.Polygon.info[styleConfig.Polygon.info.length - 1].settings) + ); + const styleArray: HTMLCanvasElement[] = []; - styleConfig.Polygon.classBreakStyleInfo.forEach((styleInfo) => { + styleConfig.Polygon.info.forEach((styleInfo) => { styleArray.push(createPolygonCanvas(processSimplePolygon(styleInfo.settings))); }); + if (styleConfig.Polygon.hasDefault) styleArray.pop(); layerStyles.Polygon!.arrayOfCanvas = styleArray; } + legendStyles.Polygon = layerStyles.Polygon; } return legendStyles; @@ -1230,11 +1207,11 @@ export async function getLegendStyles(styleConfig: TypeStyleConfig | undefined): * Create a default style to use with a vector feature that has no style configuration. * * @param {TypeStyleGeometry} geometryType - Type of geometry (Point, LineString, Polygon). - * @param {TypeDisplayLanguage} language - Language for the style + * @param {string} label - Label for the style. * - * @returns {TypeSimpleStyleConfig | undefined} The Style configuration created. Undefined if unable to create it. + * @returns {TypeLayerStyleConfigInfo | undefined} The Style configuration created. Undefined if unable to create it. */ -function createDefaultStyle(geometryType: TypeStyleGeometry, label: string): TypeSimpleStyleConfig | undefined { +function createDefaultStyle(geometryType: TypeStyleGeometry, label: string): TypeLayerStyleSettings | undefined { if (geometryType === 'Point') { const settings: TypeSimpleSymbolVectorConfig = { type: 'simpleSymbol', @@ -1246,14 +1223,14 @@ function createDefaultStyle(geometryType: TypeStyleGeometry, label: string): Typ }, symbol: 'circle', }; - return { styleType: 'simple', label, settings }; + return { type: 'simple', hasDefault: false, fields: [], info: [{ visible: true, label, settings, values: [] }] }; } if (geometryType === 'LineString') { const settings: TypeLineStringVectorConfig = { type: 'lineString', stroke: { color: getDefaultColor(1, true) }, }; - return { styleType: 'simple', label, settings }; + return { type: 'simple', hasDefault: false, fields: [], info: [{ visible: true, label, settings, values: [] }] }; } if (geometryType === 'Polygon') { const settings: TypePolygonVectorConfig = { @@ -1262,7 +1239,7 @@ function createDefaultStyle(geometryType: TypeStyleGeometry, label: string): Typ stroke: { color: getDefaultColor(1, true) }, fillStyle: 'solid', }; - return { styleType: 'simple', label, settings }; + return { type: 'simple', hasDefault: false, fields: [], info: [{ visible: true, label, settings, values: [] }] }; } logger.logError(`Geometry type ${geometryType} is not supported by the GeoView viewer.`); return undefined; @@ -1272,12 +1249,12 @@ function createDefaultStyle(geometryType: TypeStyleGeometry, label: string): Typ * Search the unique value entry using the field values stored in the feature. * * @param {string[]} fields - Fields involved in the unique value definition. - * @param {TypeUniqueValueStyleInfo[]} uniqueValueStyleInfo - Unique value configuration. + * @param {TypeLayerStyleConfigInfo[]} uniqueValueStyleInfo - Unique value configuration. * @param {Feature} feature - Feature used to test the unique value conditions. * * @returns {Style | undefined} The Style created. Undefined if unable to create it. */ -function searchUniqueValueEntry(fields: string[], uniqueValueStyleInfo: TypeUniqueValueStyleInfo[], feature: Feature): number | undefined { +function searchUniqueValueEntry(fields: string[], uniqueValueStyleInfo: TypeLayerStyleConfigInfo[], feature: Feature): number | undefined { for (let i = 0; i < uniqueValueStyleInfo.length; i++) { for (let j = 0, isEqual = true; j < fields.length && isEqual; j++) { // For obscure reasons, it seems that sometimes the field names in the feature do not have the same case as those in the @@ -1307,7 +1284,7 @@ function searchUniqueValueEntry(fields: string[], uniqueValueStyleInfo: TypeUniq * @returns {Style | undefined} The Style created. Undefined if unable to create it. */ function processUniqueValuePoint( - styleSettings: TypeStyleSettings | TypeKindOfVectorSettings, + styleSettings: TypeLayerStyleSettings | TypeKindOfVectorSettings, feature?: Feature, filterEquation?: FilterNodeArrayType, legendFilterIsOff?: boolean @@ -1315,13 +1292,12 @@ function processUniqueValuePoint( if (filterEquation !== undefined && filterEquation.length !== 0 && feature) if (featureIsNotVisible(feature, filterEquation!)) return undefined; - if (isUniqueValueStyleConfig(styleSettings)) { - const { defaultSettings, fields, uniqueValueStyleInfo } = styleSettings; - const i = searchUniqueValueEntry(fields, uniqueValueStyleInfo, feature!); - if (i !== undefined && (legendFilterIsOff || uniqueValueStyleInfo[i].visible !== false)) - return processSimplePoint(uniqueValueStyleInfo[i].settings); - if (i === undefined && defaultSettings !== undefined && (legendFilterIsOff || styleSettings.defaultVisible !== false)) - return processSimplePoint(defaultSettings); + if (styleSettings.type === 'uniqueValue') { + const { hasDefault, fields, info } = styleSettings; + const i = searchUniqueValueEntry(fields, info, feature!); + if (i !== undefined && (legendFilterIsOff || info[i].visible !== false)) return processSimplePoint(info[i].settings); + if (i === undefined && hasDefault && (legendFilterIsOff || styleSettings.info[styleSettings.info.length - 1].visible !== false)) + return processSimplePoint(styleSettings.info[styleSettings.info.length - 1].settings); } return undefined; } @@ -1329,7 +1305,7 @@ function processUniqueValuePoint( /** *************************************************************************************************************************** * Process the unique value settings using a lineString feature to get its Style. * - * @param {TypeStyleSettings | TypeKindOfVectorSettings} styleSettings - Style settings to use. + * @param {TypeLayerStyleSettings | TypeKindOfVectorSettings} styleSettings - Style settings to use. * @param {Feature} feature - Feature used to test the unique value conditions. * @param {FilterNodeArrayType} filterEquation - Filter equation associated to the layer. * @param {boolean} legendFilterIsOff - When true, do not apply legend filter. @@ -1337,7 +1313,7 @@ function processUniqueValuePoint( * @returns {Style | undefined} The Style created. Undefined if unable to create it. */ function processUniqueLineString( - styleSettings: TypeStyleSettings | TypeKindOfVectorSettings, + styleSettings: TypeLayerStyleSettings | TypeKindOfVectorSettings, feature?: Feature, filterEquation?: FilterNodeArrayType, legendFilterIsOff?: boolean @@ -1345,13 +1321,12 @@ function processUniqueLineString( if (filterEquation !== undefined && filterEquation.length !== 0 && feature) if (featureIsNotVisible(feature, filterEquation!)) return undefined; - if (isUniqueValueStyleConfig(styleSettings)) { - const { defaultSettings, fields, uniqueValueStyleInfo } = styleSettings; - const i = searchUniqueValueEntry(fields, uniqueValueStyleInfo, feature!); - if (i !== undefined && (legendFilterIsOff || uniqueValueStyleInfo[i].visible !== false)) - return processSimpleLineString(uniqueValueStyleInfo[i].settings, feature); - if (i === undefined && defaultSettings !== undefined && (legendFilterIsOff || styleSettings.defaultVisible !== false)) - return processSimpleLineString(defaultSettings, feature); + if (styleSettings.type === 'uniqueValue') { + const { hasDefault, fields, info } = styleSettings; + const i = searchUniqueValueEntry(fields, info, feature!); + if (i !== undefined && (legendFilterIsOff || info[i].visible !== false)) return processSimpleLineString(info[i].settings, feature); + if (i === undefined && hasDefault && (legendFilterIsOff || info[info.length - 1].visible !== false)) + return processSimpleLineString(info[info.length - 1].settings, feature); } return undefined; } @@ -1359,7 +1334,7 @@ function processUniqueLineString( /** *************************************************************************************************************************** * Process the unique value settings using a polygon feature to get its Style. * - * @param {TypeStyleSettings | TypeKindOfVectorSettings} styleSettings - Style settings to use. + * @param {TypeLayerStyleSettings | TypeKindOfVectorSettings} styleSettings - Style settings to use. * @param {Feature} feature - Feature used to test the unique value conditions. * @param {FilterNodeArrayType} filterEquation - Filter equation associated to the layer. * @param {boolean} legendFilterIsOff - When true, do not apply legend filter. @@ -1367,7 +1342,7 @@ function processUniqueLineString( * @returns {Style | undefined} The Style created. Undefined if unable to create it. */ function processUniquePolygon( - styleSettings: TypeStyleSettings | TypeKindOfVectorSettings, + styleSettings: TypeLayerStyleSettings | TypeKindOfVectorSettings, feature?: Feature, filterEquation?: FilterNodeArrayType, legendFilterIsOff?: boolean @@ -1375,13 +1350,12 @@ function processUniquePolygon( if (filterEquation !== undefined && filterEquation.length !== 0 && feature) if (featureIsNotVisible(feature, filterEquation!)) return undefined; - if (isUniqueValueStyleConfig(styleSettings)) { - const { defaultSettings, fields, uniqueValueStyleInfo } = styleSettings; - const i = searchUniqueValueEntry(fields, uniqueValueStyleInfo, feature!); - if (i !== undefined && (legendFilterIsOff || uniqueValueStyleInfo[i].visible !== false)) - return processSimplePolygon(uniqueValueStyleInfo[i].settings, feature); - if (i === undefined && defaultSettings !== undefined && (legendFilterIsOff || styleSettings.defaultVisible !== false)) - return processSimplePolygon(defaultSettings, feature); + if (styleSettings.type === 'uniqueValue') { + const { hasDefault, fields, info } = styleSettings; + const i = searchUniqueValueEntry(fields, info, feature!); + if (i !== undefined && (legendFilterIsOff || info[i].visible !== false)) return processSimplePolygon(info[i].settings, feature); + if (i === undefined && hasDefault !== undefined && (legendFilterIsOff || info[info.length - 1].visible !== false)) + return processSimplePolygon(info[info.length - 1].settings, feature); } return undefined; } @@ -1389,13 +1363,13 @@ function processUniquePolygon( /** *************************************************************************************************************************** * Search the class breakentry using the field value stored in the feature. * - * @param {string[]} field - Field involved in the class break definition. - * @param {TypeClassBreakStyleInfo[]} classBreakStyleInfo - Class break configuration. + * @param {string} field - Field involved in the class break definition. + * @param {TypeLayerStyleConfigInfo[]} classBreakStyleInfo - Class break configuration. * @param {Feature} feature - Feature used to test the class break conditions. * - * @returns {Style | undefined} The Style created. Undefined if unable to create it. + * @returns {number | undefined} The index of the entry. Undefined if unable to find it. */ -function searchClassBreakEntry(field: string, classBreakStyleInfo: TypeClassBreakStyleInfo[], feature: Feature): number | undefined { +function searchClassBreakEntry(field: string, classBreakStyleInfo: TypeLayerStyleConfigInfo[], feature: Feature): number | undefined { // For obscure reasons, it seems that sometimes the field names in the feature do not have the same case as those in the // class break definition. const featureKey = (feature as Feature).getKeys().filter((key) => { @@ -1405,10 +1379,10 @@ function searchClassBreakEntry(field: string, classBreakStyleInfo: TypeClassBrea const fieldValue = feature.get(featureKey[0]) as number | string; - if (fieldValue >= classBreakStyleInfo[0].minValue! && fieldValue <= classBreakStyleInfo[0].maxValue) return 0; + if (fieldValue >= classBreakStyleInfo[0].values[0] && fieldValue <= classBreakStyleInfo[0].values[1]) return 0; for (let i = 1; i < classBreakStyleInfo.length; i++) { - if (fieldValue > classBreakStyleInfo[i].minValue! && fieldValue <= classBreakStyleInfo[i].maxValue) return i; + if (fieldValue > classBreakStyleInfo[i].values[0] && fieldValue <= classBreakStyleInfo[i].values[1]) return i; } return undefined; } @@ -1416,7 +1390,7 @@ function searchClassBreakEntry(field: string, classBreakStyleInfo: TypeClassBrea /** *************************************************************************************************************************** * Process the class break settings using a Point feature to get its Style. * - * @param {TypeStyleSettings | TypeKindOfVectorSettings} styleSettings - Style settings to use. + * @param {TypeLayerStyleSettings | TypeKindOfVectorSettings} styleSettings - Style settings to use. * @param {Feature} feature - Feature used to test the unique value conditions. * @param {FilterNodeArrayType} filterEquation - Filter equation associated to the layer. * @param {boolean} legendFilterIsOff - When true, do not apply legend filter. @@ -1424,7 +1398,7 @@ function searchClassBreakEntry(field: string, classBreakStyleInfo: TypeClassBrea * @returns {Style | undefined} The Style created. Undefined if unable to create it. */ function processClassBreaksPoint( - styleSettings: TypeStyleSettings | TypeKindOfVectorSettings, + styleSettings: TypeLayerStyleSettings | TypeKindOfVectorSettings, feature?: Feature, filterEquation?: FilterNodeArrayType, legendFilterIsOff?: boolean @@ -1432,13 +1406,12 @@ function processClassBreaksPoint( if (filterEquation !== undefined && filterEquation.length !== 0 && feature) if (featureIsNotVisible(feature, filterEquation!)) return undefined; - if (isClassBreakStyleConfig(styleSettings)) { - const { defaultSettings, field, classBreakStyleInfo } = styleSettings; - const i = searchClassBreakEntry(field, classBreakStyleInfo, feature!); - if (i !== undefined && (legendFilterIsOff || classBreakStyleInfo[i].visible !== false)) - return processSimplePoint(classBreakStyleInfo[i].settings); - if (i === undefined && defaultSettings !== undefined && (legendFilterIsOff || styleSettings.defaultVisible !== false)) - return processSimplePoint(defaultSettings); + if (styleSettings.type === 'classBreaks') { + const { hasDefault, fields, info } = styleSettings; + const i = searchClassBreakEntry(fields[0], info, feature!); + if (i !== undefined && (legendFilterIsOff || info[i].visible !== false)) return processSimplePoint(info[i].settings); + if (i === undefined && hasDefault && (legendFilterIsOff || info[info.length - 1].visible !== false)) + return processSimplePoint(info[info.length - 1].settings); } return undefined; } @@ -1454,7 +1427,7 @@ function processClassBreaksPoint( * @returns {Style | undefined} The Style created. Undefined if unable to create it. */ function processClassBreaksLineString( - styleSettings: TypeStyleSettings | TypeKindOfVectorSettings, + styleSettings: TypeLayerStyleSettings | TypeKindOfVectorSettings, feature?: Feature, filterEquation?: FilterNodeArrayType, legendFilterIsOff?: boolean @@ -1462,13 +1435,12 @@ function processClassBreaksLineString( if (filterEquation !== undefined && filterEquation.length !== 0 && feature) if (featureIsNotVisible(feature, filterEquation!)) return undefined; - if (isClassBreakStyleConfig(styleSettings)) { - const { defaultSettings, field, classBreakStyleInfo } = styleSettings; - const i = searchClassBreakEntry(field, classBreakStyleInfo, feature!); - if (i !== undefined && (legendFilterIsOff || classBreakStyleInfo[i].visible !== false)) - return processSimpleLineString(classBreakStyleInfo[i].settings, feature); - if (i === undefined && defaultSettings !== undefined && (legendFilterIsOff || styleSettings.defaultVisible !== false)) - return processSimpleLineString(defaultSettings, feature); + if (styleSettings.type === 'classBreaks') { + const { hasDefault, fields, info } = styleSettings; + const i = searchClassBreakEntry(fields[0], info, feature!); + if (i !== undefined && (legendFilterIsOff || info[i].visible !== false)) return processSimpleLineString(info[i].settings, feature); + if (i === undefined && hasDefault && (legendFilterIsOff || info[info.length - 1].visible !== false)) + return processSimpleLineString(info[info.length - 1].settings, feature); } return undefined; } @@ -1476,7 +1448,7 @@ function processClassBreaksLineString( /** *************************************************************************************************************************** * Process the class break settings using a Polygon feature to get its Style. * - * @param {TypeStyleSettings | TypeKindOfVectorSettings} styleSettings - Style settings to use. + * @param {TypeLayerStyleSettings | TypeKindOfVectorSettings} styleSettings - Style settings to use. * @param {Feature} feature - Feature used to test the unique value conditions. * @param {FilterNodeArrayType} filterEquation - Filter equation associated to the layer. * @param {boolean} legendFilterIsOff - When true, do not apply legend filter. @@ -1484,7 +1456,7 @@ function processClassBreaksLineString( * @returns {Style | undefined} The Style created. Undefined if unable to create it. */ function processClassBreaksPolygon( - styleSettings: TypeStyleSettings | TypeKindOfVectorSettings, + styleSettings: TypeLayerStyleSettings | TypeKindOfVectorSettings, feature?: Feature, filterEquation?: FilterNodeArrayType, legendFilterIsOff?: boolean @@ -1492,13 +1464,12 @@ function processClassBreaksPolygon( if (filterEquation !== undefined && filterEquation.length !== 0 && feature) if (featureIsNotVisible(feature, filterEquation!)) return undefined; - if (isClassBreakStyleConfig(styleSettings)) { - const { defaultSettings, field, classBreakStyleInfo } = styleSettings; - const i = searchClassBreakEntry(field, classBreakStyleInfo, feature!); - if (i !== undefined && (legendFilterIsOff || classBreakStyleInfo[i].visible !== false)) - return processSimplePolygon(classBreakStyleInfo[i].settings, feature); - if (i === undefined && defaultSettings !== undefined && (legendFilterIsOff || styleSettings.defaultVisible !== false)) - return processSimplePolygon(defaultSettings, feature); + if (styleSettings.type === 'classBreaks') { + const { hasDefault, fields, info } = styleSettings; + const i = searchClassBreakEntry(fields[0], info, feature!); + if (i !== undefined && (legendFilterIsOff || info[i].visible !== false)) return processSimplePolygon(info[i].settings, feature); + if (i === undefined && hasDefault && (legendFilterIsOff || info[info.length - 1].visible !== false)) + return processSimplePolygon(info[info.length - 1].settings, feature); } return undefined; } @@ -1544,11 +1515,11 @@ const processStyle: Record void + callbackWhenCreatingStyle?: (geometryType: TypeStyleGeometry, style: TypeLayerStyleConfigInfo) => void ): Style | undefined { // Get the geometry type const geometryType = getGeometryType(feature); @@ -1565,16 +1536,16 @@ export function getAndCreateFeatureStyle( if (styleConfig) { if (style) styleWorkOn[geometryType] = styleConfig; else styleWorkOn = { [geometryType]: styleConfig }; - callbackWhenCreatingStyle?.(geometryType, styleConfig); + callbackWhenCreatingStyle?.(geometryType, styleConfig.info[0]); } } // Get the style accordingly to its type and geometry. if (styleWorkOn![geometryType]) { const styleSettings = style![geometryType]!; - const { styleType } = styleSettings; + const { type } = styleSettings; // TODO: Refactor - Rewrite this to use explicit function calls instead, for clarity and references finding - return processStyle[styleType][geometryType].call('', styleSettings, feature as Feature, filterEquation, legendFilterIsOff); + return processStyle[type][geometryType].call('', styleSettings, feature as Feature, filterEquation, legendFilterIsOff); } return undefined; } @@ -1592,7 +1563,7 @@ const CANVAS_RECYCLING: { [styleAsJsonString: string]: HTMLCanvasElement } = {}; */ export async function getFeatureCanvas( feature: Feature, - style: TypeStyleConfig, + style: TypeLayerStyleConfig, filterEquation?: FilterNodeArrayType, legendFilterIsOff?: boolean, useRecycling?: boolean @@ -1609,16 +1580,14 @@ export async function getFeatureCanvas( // Get the style accordingly to its type and geometry. if (style[geometryType]) { const styleSettings = style[geometryType]!; - const { styleType } = styleSettings; - const featureStyle = processStyle[styleType][geometryType](styleSettings, feature, filterEquation, legendFilterIsOff); + const { type } = styleSettings; + const featureStyle = processStyle[type][geometryType](styleSettings, feature, filterEquation, legendFilterIsOff); if (featureStyle) { if (geometryType === 'Point') { if ( - (isSimpleStyleConfig(styleSettings) && isSimpleSymbolVectorConfig((styleSettings as TypeSimpleStyleConfig).settings)) || - (isUniqueValueStyleConfig(styleSettings) && - isSimpleSymbolVectorConfig((styleSettings as TypeUniqueValueStyleConfig).uniqueValueStyleInfo[0].settings)) || - (isClassBreakStyleConfig(styleSettings) && - isSimpleSymbolVectorConfig((styleSettings as TypeClassBreakStyleConfig).classBreakStyleInfo[0].settings)) + (styleSettings.type === 'simple' && styleSettings.info[0].settings.type === 'simpleSymbol') || + (styleSettings.type === 'uniqueValue' && styleSettings.info[0].settings.type === 'simpleSymbol') || + (styleSettings.type === 'classBreaks' && isSimpleSymbolVectorConfig(styleSettings.info[0].settings)) ) { canvas = createPointCanvas(featureStyle); } else { diff --git a/packages/geoview-core/src/geo/utils/utilities.ts b/packages/geoview-core/src/geo/utils/utilities.ts index 4ed6c6070c0..a86d26610f2 100644 --- a/packages/geoview-core/src/geo/utils/utilities.ts +++ b/packages/geoview-core/src/geo/utils/utilities.ts @@ -19,7 +19,7 @@ import { Projection } from '@/geo/utils/projection'; import { CONST_LAYER_TYPES, TypeVectorLayerStyles } from '@/geo/layer/geoview-layers/abstract-geoview-layers'; import { getLegendStyles } from '@/geo/utils/renderer/geoview-renderer'; -import { TypeStyleConfig } from '@/geo/map/map-schema-types'; +import { TypeLayerStyleConfig } from '@/geo/map/map-schema-types'; import { TypeBasemapLayer } from '../layer/basemap/basemap-types'; @@ -226,11 +226,11 @@ export function createEmptyBasemap(): TileLayer { /** *************************************************************************************************************************** * This method gets the legend styles used by the the layer as specified by the style configuration. * - * @param {TypeStyleConfig} styleConfig - Layer style configuration. + * @param {TypeLayerStyleConfig} styleConfig - Layer style configuration. * * @returns {Promise} A promise that the layer styles are processed. */ -export function getLegendStylesFromConfig(styleConfig: TypeStyleConfig): Promise { +export function getLegendStylesFromConfig(styleConfig: TypeLayerStyleConfig): Promise { return getLegendStyles(styleConfig); } diff --git a/packages/geoview-core/src/schemaESRIFeature.txt b/packages/geoview-core/src/schemaESRIFeature.txt index 831c87d6cf8..0589e8d7c0c 100644 --- a/packages/geoview-core/src/schemaESRIFeature.txt +++ b/packages/geoview-core/src/schemaESRIFeature.txt @@ -86,25 +86,27 @@ ] } }, - "style": { - "type": "uniqueValue", // uniqueValue, classBreak, simple ... they share the same structure. No more style by geometry - one layer = one geometry - "fields": ["flood_cause"], // list of field to use to symbolize - "hasDefault": true, - "info" [ // always an array and last item is always default if true (for simple one item is default???) - { - "label": "freshet", - "value": ["freshet"], - "visible": true, - "settings": { - "type": "image/png", - "offset": [0, 0], // x, y - "size": [9 , 15], // width height - "rotation": 0, - "opacity": 1, - "image": "KGgoAAAANSUhEUgAAAAwAAAAUC..." - } - } ... - ] + "layerStyle": { + "Point": { + "type": "uniqueValue", // uniqueValue, classBreak, simple ... they share the same structure. + "fields": ["flood_cause"], // list of field to use to symbolize + "hasDefault": true, + "info" [ // always an array and last item is always default if true (for simple one item is default???) + { + "label": "freshet", + "value": ["freshet"], + "visible": true, + "settings": { + "type": "image/png", + "offset": [0, 0], // x, y + "size": [9 , 15], // width height + "rotation": 0, + "opacity": 1, + "image": "KGgoAAAANSUhEUgAAAAwAAAAUC..." + } + } ... + ] + } } } ] @@ -344,25 +346,27 @@ ] } }, - "style": { - "type": "simple", - "fields": [], - "hasDefault": false, - "info" [ - { - "label": "", - "value": [], - "visible": true, - "settings": { - "type": "image/png", - "offset": [0, 0], // x, y - "size": [9 , 15], // width height - "rotation": 0, - "opacity": 1, - "image": "iVBORw0KGgoAAAANSUhEUgAAABYAAAAWCAYAAADEtGw7AAAAAXNSR0IB2cksfwAAAAlwSFlzAAAOxAAADsQBlSsOGwAAAstJREFUOI2101tIFFEYB/D/mV13z657cU3LFWLTHhQMQ7zkBYroJhU9VEQPgRQkpFFLVBgSUgZJSVCZRm+WJUhhdqGwfLGiCO1KlOmDlLGQ1111Z2bXna+XUkd3ZVT64Lycy2++Oef79PhPodeySZJ8K6GwJDA4wKhfUajLbLZ7FgQTDRtlSV9KQLEi+lMU7whIkiCYoyHELiFJGu0gosucW+8wxkgTLIq+dFlizcHenmTpaTOC7TXAxNDkOrNlMkPhgWy+YVuD7GCH/X7fbrPZ9mtOWBRH8xGaaB1vboyWm0rC/42vE3JTJwL3z8Hsrs81ZuW9laSxAs4tvWFhv9+bAKJ74w3XowOPT0W6pakPBDwYv7AZ5H6UyPPXPfT5fDk2m02cBQuCUCm9bk/QgqoSurIL+hXvV0UlLncDOK+C/X5vgiJL+8X6qnmhAABFhnj3JqxHyk8QeaoZcwYnYYEJO+TurzoafKE6Y7/WM8sJDfzGWEW+ai74sgqhohKHjNj1AFqnroIhe6Ln+yxEF79Mc+ITP3sh2B1ZapiQQEP9mpFwQT4vGMgJTH88BgkGTY0YOfRRIGBGVRD6hLjERbmCIxaMoU8FE9AWlZLmlhaIMu6C3pUEImpTwYGA8tzoSurXrS6OD328MXlgaI9VE2zYWQ7BwD9xk/WLCrbb7ZIojp4x7yutGf1cDyiy5mwF5xaYNm0Hgcr+zalei3NLnexK3m4+1lLory7UhDJbJiwnL0GIttZyk/VJWJgxpojiyF6eU/BAOPtm7XjdaZDnWURUl3EIloPHoYtbetvILUenr82qL5Mpxkvk2UipaZUxFxvd8ocOY7DzFULd70CDXWDODOjT82DIyEVUatowE1gF59arM52whcuYMwigTBTHavmagiKeU7AVQDKAGAADAL6BUQtAtzi3DYcz5uwIk8nyA0Dl3zGvWGSrRY4/rRIKxL8NeuEAAAAASUVORK5CYII=" + "layerStyle": { + "Point": { + "type": "simple", + "fields": [], + "hasDefault": false, + "info" [ + { + "label": "", + "value": [], + "visible": true, + "settings": { + "type": "image/png", + "offset": [0, 0], // x, y + "size": [9 , 15], // width height + "rotation": 0, + "opacity": 1, + "image": "iVBORw0KGgoAAAANSUhEUgAAABYAAAAWCAYAAADEtGw7AAAAAXNSR0IB2cksfwAAAAlwSFlzAAAOxAAADsQBlSsOGwAAAstJREFUOI2101tIFFEYB/D/mV13z657cU3LFWLTHhQMQ7zkBYroJhU9VEQPgRQkpFFLVBgSUgZJSVCZRm+WJUhhdqGwfLGiCO1KlOmDlLGQ1111Z2bXna+XUkd3ZVT64Lycy2++Oef79PhPodeySZJ8K6GwJDA4wKhfUajLbLZ7FgQTDRtlSV9KQLEi+lMU7whIkiCYoyHELiFJGu0gosucW+8wxkgTLIq+dFlizcHenmTpaTOC7TXAxNDkOrNlMkPhgWy+YVuD7GCH/X7fbrPZ9mtOWBRH8xGaaB1vboyWm0rC/42vE3JTJwL3z8Hsrs81ZuW9laSxAs4tvWFhv9+bAKJ74w3XowOPT0W6pakPBDwYv7AZ5H6UyPPXPfT5fDk2m02cBQuCUCm9bk/QgqoSurIL+hXvV0UlLncDOK+C/X5vgiJL+8X6qnmhAABFhnj3JqxHyk8QeaoZcwYnYYEJO+TurzoafKE6Y7/WM8sJDfzGWEW+ai74sgqhohKHjNj1AFqnroIhe6Ln+yxEF79Mc+ITP3sh2B1ZapiQQEP9mpFwQT4vGMgJTH88BgkGTY0YOfRRIGBGVRD6hLjERbmCIxaMoU8FE9AWlZLmlhaIMu6C3pUEImpTwYGA8tzoSurXrS6OD328MXlgaI9VE2zYWQ7BwD9xk/WLCrbb7ZIojp4x7yutGf1cDyiy5mwF5xaYNm0Hgcr+zalei3NLnexK3m4+1lLory7UhDJbJiwnL0GIttZyk/VJWJgxpojiyF6eU/BAOPtm7XjdaZDnWURUl3EIloPHoYtbetvILUenr82qL5Mpxkvk2UipaZUxFxvd8ocOY7DzFULd70CDXWDODOjT82DIyEVUatowE1gF59arM52whcuYMwigTBTHavmagiKeU7AVQDKAGAADAL6BUQtAtzi3DYcz5uwIk8nyA0Dl3zGvWGSrRY4/rRIKxL8NeuEAAAAASUVORK5CYII=" + } } - } - ] + ] + } } } ] @@ -614,25 +618,27 @@ ] } }, - "style": { - "type": "simple", - "fields": [], - "hasDefault": false, - "info" [ - { - "label": "", - "value": "", - "visible": true, - "settings": { - "type": "image/png", - "offset": [0, 0], // x, y - "size": [9 , 15], // width height - "rotation": 0, - "opacity": 1, - "image": "iVBORw0KGgoAAAANSUhEUgAAABYAAAAWCAYAAADEtGw7AAAAAXNSR0IB2cksfwAAAAlwSFlzAAAOxAAADsQBlSsOGwAAAstJREFUOI2101tIFFEYB/D/mV13z657cU3LFWLTHhQMQ7zkBYroJhU9VEQPgRQkpFFLVBgSUgZJSVCZRm+WJUhhdqGwfLGiCO1KlOmDlLGQ1111Z2bXna+XUkd3ZVT64Lycy2++Oef79PhPodeySZJ8K6GwJDA4wKhfUajLbLZ7FgQTDRtlSV9KQLEi+lMU7whIkiCYoyHELiFJGu0gosucW+8wxkgTLIq+dFlizcHenmTpaTOC7TXAxNDkOrNlMkPhgWy+YVuD7GCH/X7fbrPZ9mtOWBRH8xGaaB1vboyWm0rC/42vE3JTJwL3z8Hsrs81ZuW9laSxAs4tvWFhv9+bAKJ74w3XowOPT0W6pakPBDwYv7AZ5H6UyPPXPfT5fDk2m02cBQuCUCm9bk/QgqoSurIL+hXvV0UlLncDOK+C/X5vgiJL+8X6qnmhAABFhnj3JqxHyk8QeaoZcwYnYYEJO+TurzoafKE6Y7/WM8sJDfzGWEW+ai74sgqhohKHjNj1AFqnroIhe6Ln+yxEF79Mc+ITP3sh2B1ZapiQQEP9mpFwQT4vGMgJTH88BgkGTY0YOfRRIGBGVRD6hLjERbmCIxaMoU8FE9AWlZLmlhaIMu6C3pUEImpTwYGA8tzoSurXrS6OD328MXlgaI9VE2zYWQ7BwD9xk/WLCrbb7ZIojp4x7yutGf1cDyiy5mwF5xaYNm0Hgcr+zalei3NLnexK3m4+1lLory7UhDJbJiwnL0GIttZyk/VJWJgxpojiyF6eU/BAOPtm7XjdaZDnWURUl3EIloPHoYtbetvILUenr82qL5Mpxkvk2UipaZUxFxvd8ocOY7DzFULd70CDXWDODOjT82DIyEVUatowE1gF59arM52whcuYMwigTBTHavmagiKeU7AVQDKAGAADAL6BUQtAtzi3DYcz5uwIk8nyA0Dl3zGvWGSrRY4/rRIKxL8NeuEAAAAASUVORK5CYII=" + "layerStyle": { + "Point": { + "type": "simple", + "fields": [], + "hasDefault": false, + "info" [ + { + "label": "", + "value": "", + "visible": true, + "settings": { + "type": "image/png", + "offset": [0, 0], // x, y + "size": [9 , 15], // width height + "rotation": 0, + "opacity": 1, + "image": "iVBORw0KGgoAAAANSUhEUgAAABYAAAAWCAYAAADEtGw7AAAAAXNSR0IB2cksfwAAAAlwSFlzAAAOxAAADsQBlSsOGwAAAstJREFUOI2101tIFFEYB/D/mV13z657cU3LFWLTHhQMQ7zkBYroJhU9VEQPgRQkpFFLVBgSUgZJSVCZRm+WJUhhdqGwfLGiCO1KlOmDlLGQ1111Z2bXna+XUkd3ZVT64Lycy2++Oef79PhPodeySZJ8K6GwJDA4wKhfUajLbLZ7FgQTDRtlSV9KQLEi+lMU7whIkiCYoyHELiFJGu0gosucW+8wxkgTLIq+dFlizcHenmTpaTOC7TXAxNDkOrNlMkPhgWy+YVuD7GCH/X7fbrPZ9mtOWBRH8xGaaB1vboyWm0rC/42vE3JTJwL3z8Hsrs81ZuW9laSxAs4tvWFhv9+bAKJ74w3XowOPT0W6pakPBDwYv7AZ5H6UyPPXPfT5fDk2m02cBQuCUCm9bk/QgqoSurIL+hXvV0UlLncDOK+C/X5vgiJL+8X6qnmhAABFhnj3JqxHyk8QeaoZcwYnYYEJO+TurzoafKE6Y7/WM8sJDfzGWEW+ai74sgqhohKHjNj1AFqnroIhe6Ln+yxEF79Mc+ITP3sh2B1ZapiQQEP9mpFwQT4vGMgJTH88BgkGTY0YOfRRIGBGVRD6hLjERbmCIxaMoU8FE9AWlZLmlhaIMu6C3pUEImpTwYGA8tzoSurXrS6OD328MXlgaI9VE2zYWQ7BwD9xk/WLCrbb7ZIojp4x7yutGf1cDyiy5mwF5xaYNm0Hgcr+zalei3NLnexK3m4+1lLory7UhDJbJiwnL0GIttZyk/VJWJgxpojiyF6eU/BAOPtm7XjdaZDnWURUl3EIloPHoYtbetvILUenr82qL5Mpxkvk2UipaZUxFxvd8ocOY7DzFULd70CDXWDODOjT82DIyEVUatowE1gF59arM52whcuYMwigTBTHavmagiKeU7AVQDKAGAADAL6BUQtAtzi3DYcz5uwIk8nyA0Dl3zGvWGSrRY4/rRIKxL8NeuEAAAAASUVORK5CYII=" + } } - } - ] + ] + } } }, { @@ -875,38 +881,40 @@ ] } }, - "style": { - "type": "uniqueValue", - "fields": ["commodity_group_en_spelt"], - "hasDefault": false, - "info" [ - { - "label": "Industrial minerals", - "value": ["Industrial minerals"], - "visible": true, - "settings": { - "type": "image/png", - "offset": [0, 0], - "size": [15 , 15], - "rotation": 0, - "opacity": 1, - "image": "iVBORw0KGgoAAAANSUhEUgAAABoAAAAaCAYAAACpSkzOAAAAAXNSR0IB2cksfwAAAAlwSFlzAAAOxAAADsQBlSsOGwAAA8dJREFUSInN1ktMXFUYwPH/uVxmzoV5tBWGBe+SGqn4imIs1ADqwsRE48a4tEQaH7Q+6sKkCopuXOiqSbVAfaxNunDTNrQDtqlFEhMtFI2VaXm0PGZoywxzDwNzj4uhIB0YoDbGb3dzvvv9zj3fOSfX5D8K838BKTVTAeIztM48ISF+kdLbdkeQUrPlaCcIFIPI6KB5QdnRrdLyvrMpSKlY2S1kvP84kd+/W9PIcgcoqzuI9OW/reyoIS3vWxuCbDtWgtZBoHR84ASRwY6MH2NaAULdbZTXf4j0BfYrOyqk5d2fEbLtaLFAB4Gy8YsniFxsTw0IA7STrggXRY83oZPzjPYdpai6EekL7FP2jJCWb9+qUDw+UyggCGyfGOwiMpBCdjzXQbblYy4aYeLCMWJXTy6/rRMMnXqfsro2ynY3c+XsIQof24P0FzQvYs0rIK2vZc8pEQQqJgZPEe7/cqlWtuVDCAPpy6ek5lUmB8sIDxxZtpI2yfk4hhmgsLqRUPenlNcdRPoL3lR2dFpa3pYlyLb9bkMkd8Qmhwj3H16xOnMzU0h/QWqlhMGCfXN55QxJUW0LptvDHz80s+3el/AV1RHq+YTK5w8B+sFVe5RMJtLaMH7hGKW1exHCQGuH5Ly9hBTvbiHb2kIo+BHOfITwwGE8hc/iJKbT6qx7M8xe62JioJRkIo5OJiiqfpkRZ4FtFU+mkO6PcRKTS/mxseMgXJuHACKDncsPwqC0Zg9zsWmGTrfizI1vpMTm7jphSPwljzI3e50sl8Tt2449dbch4Ur1xO1hqOsDcvIepnhXE8PnHFT4/F2ChElxbSum27vY+DCxqycZ+3mBkl17GT6nUZHefwkJk6KaVrKll8vdqd11K2bHTzPau0DxE02M/OSgpvsyQ47jOEYWTu49JYZry0Mkbvy6lCC3PoLpsgj1tKLnr6cViE/+yEhvgvz7X2TkTArK2/nK4iTF/ArI4/HElYo2mq6co+V17xqhni+WMDXdx+Xg2jMFUOHzjJxJ9Smv6jUKKp8BdAiM91ZAAFJ6v1UqKkxXbmcK+5zEjd8yArdHXtXrFFQ+DTCkMRos6RlOgxaxb5axA2IzWH7VGwQqnwL4S0ODZXlG/jmethmk9H6t7KhhunLbN4rlP9BM4L56gEspxDt6e86qu05a3k5lzwjTlXukvO6AmJ26siaSle3GE6gAuORoXZ+T4xtbLW/N7S0tX8ci9pW/cOc6Pw386WjdsBaSEVrE2pW6+b0QWVmZ8pRKxvx+v8qUs+6BldKffnjuIP4GhRKFGHM5YJsAAAAASUVORK5CYII=" - } - }, - { - "label": "Diamonds", - "value": ["Diamonds"], - "visible": true, - "settings": { - "type": "image/png", - "offset": [0, 0], - "size": [15 , 15], - "rotation": 0, - "opacity": 1, - "image": "iVBORw0KGgoAAAANSUhEUgAAABoAAAAaCAYAAACpSkzOAAAAAXNSR0IB2cksfwAAAAlwSFlzAAAOxAAADsQBlSsOGwAAA+xJREFUSInN1m9MVWUcwPHvc4B7z7ncc/+4Cm5NMeDiehEgodBaS6ZOHLpe0CrL1rKlbfknldlamyu3aK3NzY221OzPqvVGh3pxc0mDrYVcEcStF/JHXGWCoKgc4DzIvef0gttVunC5lms9b3+/8/uc5/ye57eTzn+00v8XkJQjeSA+xraTv5AQHaqq7/lHkJRjj2JbTcB8EEkdbJ6VpuFXNX37PUFSji78C6lv72JHx8VZjRKXg0+rysj26W9L01BUTd+WEmSaowuw7SYg52hHF+vO9ibdTI7LyaZQmP1ry8j26VulaQhV07cmhUzTmC+wm4CFxzq6eLFtCnEKwYRtJyABRbCrophI1OKT5vPULCsi4NO3SHNEqJpny4zQ+PjIIwKagNyGc928EEOurK/A59IYvDXKd20XeK9vMP5wv2VTXd/C92vL+KByCe+fPMvOZx4n4PdsjmGbp0G23Z8xIUUTkHeis4fnzvTEi/lcGooQZPt0tq8oJdjZw/N3xa9EoozdniSQobNzWSFvhsJ8tmYpAb/nLWkaw6qm745Dpul1KiIa7O6/RnW4e9rnuXrTIOD3AKAIwfCYvNOfNEH96lI8qoNV3zayozCX6twsNjaECb2yErALZ+zRRCSa0Idv2i5Qs3IJihBYts3oZGQa4s/UeO34aVpkhJYz3XyUn8UvcjKhzpyTYfelIYIdXRhykgnLYuPTRUQsm1WPLcDvUnkj1Eqzeafwu71XCSiJ9y6lEbTu7J17pADblpdwbWSMDcdOc2r8diol7m3W5aQJnsp7mOvGOC6ng2K/m1Pjw/cXCiixxmtO1tf/zMqAn10rSoj+0M7e/hv3B5onBA2Vpfg0J68eb+UnOUlz3yAT0fNTWGM7+/pv/jtonhCcrHwCr8vB+lArLTISj+35dYhIUyfvLF9MtPEcdQOzY+kAlmVZShpW7kN+ZdODOvuHjHjCS1leMp0ZvBwKE56IJBSovXwd+WMnG0qD1DW0AbCvNH8qKET8OKYDuN3ucSmNDZlOxxe1VeUKJ1rjWN3ATeqOnk666739N9gbQw4vDbJmcQFgXwKlZhoEoKr611IaItPpOPRhVblin2jlwF07S2UdKSugqjgI0GejVGiq+7cEKIZ9JaUh3E7HodqqcsE9YPXli1hdlA9w0YYKTXP/fnc84TCoqv6lNA3F7XQcTBU7+uQiKgvzAXqnEP3y33NmPHWqph+S5ohwOx0HaqvKxesD12dFNEcGBYEHAHot217mcnn+mClv1uOtap7PY9j+opzAHD8N9Fi2XTEbkhSKYQelvHVYiLS0ZHlSRke9Xq9MljPnhVVV79zzJYX1J6OwghYLe2y4AAAAAElFTkSuQmCC" + "layerStyle": { + "Point": { + "type": "uniqueValue", + "fields": ["commodity_group_en_spelt"], + "hasDefault": false, + "info" [ + { + "label": "Industrial minerals", + "value": ["Industrial minerals"], + "visible": true, + "settings": { + "type": "image/png", + "offset": [0, 0], + "size": [15 , 15], + "rotation": 0, + "opacity": 1, + "image": "iVBORw0KGgoAAAANSUhEUgAAABoAAAAaCAYAAACpSkzOAAAAAXNSR0IB2cksfwAAAAlwSFlzAAAOxAAADsQBlSsOGwAAA8dJREFUSInN1ktMXFUYwPH/uVxmzoV5tBWGBe+SGqn4imIs1ADqwsRE48a4tEQaH7Q+6sKkCopuXOiqSbVAfaxNunDTNrQDtqlFEhMtFI2VaXm0PGZoywxzDwNzj4uhIB0YoDbGb3dzvvv9zj3fOSfX5D8K838BKTVTAeIztM48ISF+kdLbdkeQUrPlaCcIFIPI6KB5QdnRrdLyvrMpSKlY2S1kvP84kd+/W9PIcgcoqzuI9OW/reyoIS3vWxuCbDtWgtZBoHR84ASRwY6MH2NaAULdbZTXf4j0BfYrOyqk5d2fEbLtaLFAB4Gy8YsniFxsTw0IA7STrggXRY83oZPzjPYdpai6EekL7FP2jJCWb9+qUDw+UyggCGyfGOwiMpBCdjzXQbblYy4aYeLCMWJXTy6/rRMMnXqfsro2ynY3c+XsIQof24P0FzQvYs0rIK2vZc8pEQQqJgZPEe7/cqlWtuVDCAPpy6ek5lUmB8sIDxxZtpI2yfk4hhmgsLqRUPenlNcdRPoL3lR2dFpa3pYlyLb9bkMkd8Qmhwj3H16xOnMzU0h/QWqlhMGCfXN55QxJUW0LptvDHz80s+3el/AV1RHq+YTK5w8B+sFVe5RMJtLaMH7hGKW1exHCQGuH5Ly9hBTvbiHb2kIo+BHOfITwwGE8hc/iJKbT6qx7M8xe62JioJRkIo5OJiiqfpkRZ4FtFU+mkO6PcRKTS/mxseMgXJuHACKDncsPwqC0Zg9zsWmGTrfizI1vpMTm7jphSPwljzI3e50sl8Tt2449dbch4Ur1xO1hqOsDcvIepnhXE8PnHFT4/F2ChElxbSum27vY+DCxqycZ+3mBkl17GT6nUZHefwkJk6KaVrKll8vdqd11K2bHTzPau0DxE02M/OSgpvsyQ47jOEYWTu49JYZry0Mkbvy6lCC3PoLpsgj1tKLnr6cViE/+yEhvgvz7X2TkTArK2/nK4iTF/ArI4/HElYo2mq6co+V17xqhni+WMDXdx+Xg2jMFUOHzjJxJ9Smv6jUKKp8BdAiM91ZAAFJ6v1UqKkxXbmcK+5zEjd8yArdHXtXrFFQ+DTCkMRos6RlOgxaxb5axA2IzWH7VGwQqnwL4S0ODZXlG/jmethmk9H6t7KhhunLbN4rlP9BM4L56gEspxDt6e86qu05a3k5lzwjTlXukvO6AmJ26siaSle3GE6gAuORoXZ+T4xtbLW/N7S0tX8ci9pW/cOc6Pw386WjdsBaSEVrE2pW6+b0QWVmZ8pRKxvx+v8qUs+6BldKffnjuIP4GhRKFGHM5YJsAAAAASUVORK5CYII=" + } + }, + { + "label": "Diamonds", + "value": ["Diamonds"], + "visible": true, + "settings": { + "type": "image/png", + "offset": [0, 0], + "size": [15 , 15], + "rotation": 0, + "opacity": 1, + "image": "iVBORw0KGgoAAAANSUhEUgAAABoAAAAaCAYAAACpSkzOAAAAAXNSR0IB2cksfwAAAAlwSFlzAAAOxAAADsQBlSsOGwAAA+xJREFUSInN1m9MVWUcwPHvc4B7z7ncc/+4Cm5NMeDiehEgodBaS6ZOHLpe0CrL1rKlbfknldlamyu3aK3NzY221OzPqvVGh3pxc0mDrYVcEcStF/JHXGWCoKgc4DzIvef0gttVunC5lms9b3+/8/uc5/ye57eTzn+00v8XkJQjeSA+xraTv5AQHaqq7/lHkJRjj2JbTcB8EEkdbJ6VpuFXNX37PUFSji78C6lv72JHx8VZjRKXg0+rysj26W9L01BUTd+WEmSaowuw7SYg52hHF+vO9ibdTI7LyaZQmP1ry8j26VulaQhV07cmhUzTmC+wm4CFxzq6eLFtCnEKwYRtJyABRbCrophI1OKT5vPULCsi4NO3SHNEqJpny4zQ+PjIIwKagNyGc928EEOurK/A59IYvDXKd20XeK9vMP5wv2VTXd/C92vL+KByCe+fPMvOZx4n4PdsjmGbp0G23Z8xIUUTkHeis4fnzvTEi/lcGooQZPt0tq8oJdjZw/N3xa9EoozdniSQobNzWSFvhsJ8tmYpAb/nLWkaw6qm745Dpul1KiIa7O6/RnW4e9rnuXrTIOD3AKAIwfCYvNOfNEH96lI8qoNV3zayozCX6twsNjaECb2yErALZ+zRRCSa0Idv2i5Qs3IJihBYts3oZGQa4s/UeO34aVpkhJYz3XyUn8UvcjKhzpyTYfelIYIdXRhykgnLYuPTRUQsm1WPLcDvUnkj1Eqzeafwu71XCSiJ9y6lEbTu7J17pADblpdwbWSMDcdOc2r8diol7m3W5aQJnsp7mOvGOC6ng2K/m1Pjw/cXCiixxmtO1tf/zMqAn10rSoj+0M7e/hv3B5onBA2Vpfg0J68eb+UnOUlz3yAT0fNTWGM7+/pv/jtonhCcrHwCr8vB+lArLTISj+35dYhIUyfvLF9MtPEcdQOzY+kAlmVZShpW7kN+ZdODOvuHjHjCS1leMp0ZvBwKE56IJBSovXwd+WMnG0qD1DW0AbCvNH8qKET8OKYDuN3ucSmNDZlOxxe1VeUKJ1rjWN3ATeqOnk666739N9gbQw4vDbJmcQFgXwKlZhoEoKr611IaItPpOPRhVblin2jlwF07S2UdKSugqjgI0GejVGiq+7cEKIZ9JaUh3E7HodqqcsE9YPXli1hdlA9w0YYKTXP/fnc84TCoqv6lNA3F7XQcTBU7+uQiKgvzAXqnEP3y33NmPHWqph+S5ohwOx0HaqvKxesD12dFNEcGBYEHAHot217mcnn+mClv1uOtap7PY9j+opzAHD8N9Fi2XTEbkhSKYQelvHVYiLS0ZHlSRke9Xq9MljPnhVVV79zzJYX1J6OwghYLe2y4AAAAAElFTkSuQmCC" + } } - } - ] + ] + } } } ]