Skip to content

Commit

Permalink
fix(style): ESRI Dynamic handles multiple styles with same label
Browse files Browse the repository at this point in the history
Closes #2597
  • Loading branch information
DamonU2 committed Dec 18, 2024
1 parent a4ec6f3 commit 95846ef
Show file tree
Hide file tree
Showing 6 changed files with 403 additions and 151 deletions.
282 changes: 210 additions & 72 deletions packages/geoview-core/public/configs/navigator/16-esri-dynamic.json

Large diffs are not rendered by default.

161 changes: 111 additions & 50 deletions packages/geoview-core/public/configs/navigator/17-esri-feature.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,37 +53,29 @@
{
"layerId": "8",
"layerFilter": "Total_CSO_Volume > 5000000",
"style": {
"layerStyle": {
"Point": {
"styleId": "classBreaksId",
"styleType": "classBreaks",
"defaultLabel": "Pas de données de volume / No volume data",
"defaultSettings": {
"symbol": "square",
"type": "simpleSymbol",
"color": "rgba(255,127,127,1)",
"offset": [0, 0],
"rotation": 0,
"size": 2.0010000000000003,
"stroke": {
"color": "rgba(0,0,0,1)",
"lineStyle": "solid",
"width": 0.5
}
},
"defaultVisible": true,
"field": "Total_CSO_Volume",
"classBreakStyleInfo": [
"type": "classBreaks",
"hasDefault": true,
"fields": [
"Total_CSO_Volume"
],
"info": [
{
"label": "0 m3",
"minValue": 0,
"maxValue": 0,
"values": [
0,
0
],
"visible": true,
"settings": {
"symbol": "circle",
"type": "simpleSymbol",
"color": "rgba(76,230,0,1)",
"offset": [0, 0],
"offset": [
0,
0
],
"rotation": 0,
"size": 2.6679999999999997,
"stroke": {
Expand All @@ -95,14 +87,19 @@
},
{
"label": "0.0001 - ≤ 5,000,000 m3",
"minValue": 0,
"maxValue": 5000000,
"values": [
0.0001,
5000000
],
"visible": true,
"settings": {
"symbol": "circle",
"type": "simpleSymbol",
"color": "rgba(196,97,255,1)",
"offset": [0, 0],
"offset": [
0,
0
],
"rotation": 0,
"size": 5.114407777777778,
"stroke": {
Expand All @@ -114,14 +111,19 @@
},
{
"label": "> 5,000,000 - ≤ 10,000,000 m3",
"minValue": 5000000,
"maxValue": 10000000,
"values": [
5000000,
10000000
],
"visible": true,
"settings": {
"symbol": "circle",
"type": "simpleSymbol",
"color": "rgba(196,97,255,1)",
"offset": [0, 0],
"offset": [
0,
0
],
"rotation": 0,
"size": 7.560815555555555,
"stroke": {
Expand All @@ -133,14 +135,19 @@
},
{
"label": "> 10,000,000 - ≤ 15,000,000 m3",
"minValue": 10000000,
"maxValue": 15000000,
"values": [
10000000,
15000000
],
"visible": true,
"settings": {
"symbol": "circle",
"type": "simpleSymbol",
"color": "rgba(196,97,255,1)",
"offset": [0, 0],
"offset": [
0,
0
],
"rotation": 0,
"size": 10.007223333333332,
"stroke": {
Expand All @@ -152,14 +159,19 @@
},
{
"label": "> 15,000,000 - ≤ 20,000,000 m3",
"minValue": 15000000,
"maxValue": 20000000,
"values": [
15000000,
20000000
],
"visible": true,
"settings": {
"symbol": "circle",
"type": "simpleSymbol",
"color": "rgba(196,97,255,1)",
"offset": [0, 0],
"offset": [
0,
0
],
"rotation": 0,
"size": 12.453631111111111,
"stroke": {
Expand All @@ -171,14 +183,19 @@
},
{
"label": "> 20,000,000 - ≤ 25,000,000 m3",
"minValue": 20000000,
"maxValue": 25000000,
"values": [
20000000,
25000000
],
"visible": true,
"settings": {
"symbol": "circle",
"type": "simpleSymbol",
"color": "rgba(196,97,255,1)",
"offset": [0, 0],
"offset": [
0,
0
],
"rotation": 0,
"size": 14.90003888888889,
"stroke": {
Expand All @@ -190,14 +207,19 @@
},
{
"label": "> 25,000,000 - ≤ 30,000,000 m3",
"minValue": 25000000,
"maxValue": 30000000,
"values": [
25000000,
30000000
],
"visible": true,
"settings": {
"symbol": "circle",
"type": "simpleSymbol",
"color": "rgba(196,97,255,1)",
"offset": [0, 0],
"offset": [
0,
0
],
"rotation": 0,
"size": 17.346446666666665,
"stroke": {
Expand All @@ -209,14 +231,19 @@
},
{
"label": "> 30,000,000 - ≤ 35,000,000 m3",
"minValue": 30000000,
"maxValue": 35000000,
"values": [
30000000,
35000000
],
"visible": true,
"settings": {
"symbol": "circle",
"type": "simpleSymbol",
"color": "rgba(196,97,255,1)",
"offset": [0, 0],
"offset": [
0,
0
],
"rotation": 0,
"size": 19.792854444444444,
"stroke": {
Expand All @@ -228,14 +255,19 @@
},
{
"label": "> 35,000,000 m3",
"minValue": 35000000,
"maxValue": 999000000,
"values": [
35000000,
999000000
],
"visible": true,
"settings": {
"symbol": "circle",
"type": "simpleSymbol",
"color": "rgba(196,97,255,1)",
"offset": [0, 0],
"offset": [
0,
0
],
"rotation": 0,
"size": 22.239262222222223,
"stroke": {
Expand All @@ -244,6 +276,27 @@
"width": 0.5
}
}
},
{
"label": "Pas de données de volume / No volume data",
"values": [],
"visible": true,
"settings": {
"symbol": "circle",
"type": "simpleSymbol",
"color": "rgba(255,127,127,1)",
"offset": [
0,
0
],
"rotation": 0,
"size": 2.0010000000000003,
"stroke": {
"color": "rgba(0,0,0,1)",
"lineStyle": "solid",
"width": 0.5
}
}
}
]
}
Expand All @@ -253,12 +306,20 @@
}
]
},
"components": ["overview-map", "north-arrow"],
"components": [
"overview-map",
"north-arrow"
],
"footerBar": {
"tabs": {
"core": ["legend", "layers", "details", "data-table"]
"core": [
"legend",
"layers",
"details",
"data-table"
]
}
},
"corePackages": [],
"theme": "geo.ca"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -176,14 +176,18 @@ export class LegendEventProcessor extends AbstractEventProcessor {
iconDetails.push(iconDetailsEntry);
} else {
iconDetailsEntry.iconType = 'list';
iconDetailsEntry.iconList = styleRepresentation.arrayOfCanvas!.map((canvas, i) => {
const legendLayerListItem: TypeLegendItem = {
geometryType,
icon: canvas ? canvas.toDataURL() : null,
name: styleSettings.info[i].label,
isVisible: styleSettings.info[i].visible !== false,
};
return legendLayerListItem;
iconDetailsEntry.iconList = [];
styleRepresentation.arrayOfCanvas!.forEach((canvas, i) => {
// Check if there is already an entry for this label before adding it.
if (!iconDetailsEntry.iconList?.find((listItem) => listItem.name === styleSettings.info[i].label)) {
const legendLayerListItem: TypeLegendItem = {
geometryType,
icon: canvas ? canvas.toDataURL() : null,
name: styleSettings.info[i].label,
isVisible: styleSettings.info[i].visible !== false,
};
iconDetailsEntry.iconList?.push(legendLayerListItem);
}
});
if (styleRepresentation.defaultCanvas) {
const legendLayerListItem: TypeLegendItem = {
Expand Down
Loading

0 comments on commit 95846ef

Please sign in to comment.