Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create Custom Legend Schema #2363

Open
jolevesq opened this issue Jul 11, 2024 · 0 comments
Open

Create Custom Legend Schema #2363

jolevesq opened this issue Jul 11, 2024 · 0 comments
Assignees

Comments

@jolevesq
Copy link
Member

jolevesq commented Jul 11, 2024

Create a schema for custom legend. We can start by looking what we had in RAMP

In action with help, go see this link on legend tab: https://viewer-visualiseur.services.geo.ca/fgpv-vpgf/author-auteur/index-en.html

"legendStructured": {
            "type": "object",
            "properties": {
                "type": {
                    "type": "string",
                    "enum": ["structured"]
                },
                "root": {
                    "$ref": "#/definitions/entryGroup"
                }
            },
            "required": ["type", "root"],
            "additionalProperties": false
        },
"entryGroup": {
            "type": "object",
            "properties": {
                "name": {
                    "type": "string",
                    "description": "Title of the group"
                },
                "hidden": {
                    "type": "boolean",
                    "default": false,
                    "description": "Indicates that the legend group will be hidden from the UI and all its controls will be inaccessible to the user."
                },
                "expanded": {
                    "type": "boolean",
                    "default": true
                },
                "children": {
                    "type": "array",
                    "items": {
                        "oneOf": [
                            {
                                "$ref": "#/definitions/entryGroup"
                            },
                            {
                                "$ref": "#/definitions/visibilitySet"
                            },
                            {
                                "$ref": "#/definitions/entry"
                            },
                            {
                                "$ref": "#/definitions/infoSection"
                            }
                        ]
                    },
                    "minItems": 1
                },
                "controls": {
                    "$ref": "#/definitions/legendGroupControls"
                },
                "disabledControls": {
                    "$ref": "#/definitions/legendGroupControls"
                }
            },
            "required": ["name", "children"],
            "additionalProperties": false
        },
        "visibilitySet": {
            "type": "object",
            "properties": {
                "collapse": {
                    "type": "boolean",
                    "default": false,
                    "description": "Renders a visiblity set as a single (currently selected) legend entry. The selection cannot be directly changed by the user, but can be modified through the API or other legend entries linked to the same layers."
                },
                "exclusiveVisibility": {
                    "type": "array",
                    "items": {
                        "oneOf": [
                            {
                                "$ref": "#/definitions/entryGroup"
                            },
                            {
                                "$ref": "#/definitions/entry"
                            }
                        ]
                    },
                    "minItems": 1
                }
            },
            "required": ["exclusiveVisibility"],
            "additionalProperties": false
        },
        "symbologyStack": {
            "type": "array",
            "items": {
                "type": "object",
                "properties": {
                    "image": {
                        "type": "string",
                        "description": "Either a data URI or a URL to a source that supports CORS headers."
                    },
                    "text": {
                        "type": "string"
                    },
                    "sqlQuery": {
                        "type": "string",
                        "description": "An SQL where clause by which the map and datatable attributes can be filtered. All the query results for the symbologyStack should cover all attributes for that layer."
                    }
                },
                "required": ["image", "text"],
                "additionalProperties": false
            },
            "minItems": 1
        },
        "entry": {
            "type": "object",
            "description": "",
            "properties": {
                "layerId": {
                    "type": "string",
                    "description": "Link to a layer defined in the layers section"
                },
                "hidden": {
                    "type": "boolean",
                    "default": false,
                    "description": "Indicates that the legend block will be hidden from the UI and all its controls will be inaccessible to the user."
                },
                "controlledIds": {
                    "type": "array",
                    "items": {
                        "type": "string",
                        "description": "Additional layer ids which are controlled by this layer. Controlled layers cannot have enabled `boundingBox` and `query` states."
                    },
                    "default": []
                },
                "entryIndex": {
                    "type": "integer",
                    "description": "Index of the 'sublayer' in the case of an ESRI dynamic layer.  This cannot point to an entry with stateOnly:true ."
                },
                "entryId": {
                    "type": "string",
                    "description": "Id of the 'sublayer' in the case of an OGC WMS layer"
                },
                "coverIcon": {
                    "type": "string",
                    "description": "An optional icon, if present it will be used to primarily represent the layer"
                },
                "description": {
                    "type": "string",
                    "default": "",
                    "description": "Optional description displayed above the symbology stack."
                },
                "symbologyStack": {
                    "$ref": "#/definitions/symbologyStack"
                },
                "symbologyRenderStyle": {
                    "type": "string",
                    "enum": ["icons", "images"],
                    "description": "An optional style, describes how the symbology stack should be rendered"
                },
                "symbologyExpanded": {
                    "type": "boolean",
                    "default": false,
                    "description": "Indicates if symbology stack is expand by default"
                }
            },
            "required": ["layerId"],
            "additionalProperties": false
        },
        "infoSection": {
            "oneOf": [
                {
                    "type": "object",
                    "properties": {
                        "infoType": {
                            "type": "string",
                            "enum": ["title"]
                        },
                        "content": {
                            "type": "string"
                        },
                        "export": {
                            "type": "boolean",
                            "default": true,
                            "description": "Indicates if the legend item should show up in the export legend."
                        }
                    },
                    "additionalProperties": false
                },
                {
                    "type": "object",
                    "properties": {
                        "infoType": {
                            "type": "string",
                            "enum": ["image"]
                        },
                        "content": {
                            "type": "string"
                        },
                        "export": {
                            "type": "boolean",
                            "default": true,
                            "description": "Indicates if the legend item should show up in the export legend."
                        }
                    },
                    "additionalProperties": false
                },
                {
                    "type": "object",
                    "properties": {
                        "infoType": {
                            "type": "string",
                            "enum": ["unboundLayer"]
                        },
                        "content": {
                            "type": "string",
                            "description": "Name to display in legend"
                        },
                        "layerName": {
                            "type": "string",
                            "description": "[deprecated] Name to display in legend. Use `content` instead."
                        },
                        "coverIcon": {
                            "type": "string",
                            "description": "An optional icon, if present it will be used to primarily represent the unbound layer"
                        },
                        "description": {
                            "type": "string",
                            "default": "",
                            "description": "Optional description displayed above the symbology stack."
                        },
                        "symbologyStack": {
                            "$ref": "#/definitions/symbologyStack"
                        },
                        "symbologyRenderStyle": {
                            "type": "string",
                            "enum": ["icons", "images"],
                            "description": "An optional style, describes how the symbology stack should be rendered"
                        },
                        "symbologyExpanded": {
                            "type": "boolean",
                            "default": false,
                            "description": "Indicates if symbology stack is expand by default"
                        },
                        "export": {
                            "type": "boolean",
                            "default": true,
                            "description": "Indicates if the legend item should show up in the export legend."
                        }
                    },
                    "additionalProperties": false
                },
                {
                    "type": "object",
                    "properties": {
                        "infoType": {
                            "type": "string",
                            "enum": ["text"]
                        },
                        "content": {
                            "type": "string"
                        },
                        "export": {
                            "type": "boolean",
                            "default": true,
                            "description": "Indicates if the legend item should show up in the export legend."
                        }
                    },
                    "additionalProperties": false
                }
            ],
            "required": ["infoType", "content"]
        },
"legendGroupControls": {
            "type": "array",
            "items": {
                "type": "string",
                "enum": ["opacity", "visibility", "symbology", "query", "reload", "remove", "settings"]
            },
            "uniqueItems": true,
            "description": "A list of all controls to be enabled on the specified group"
        },
        "legendEntryControls": {
            "type": "array",
            "items": {
                "type": "string",
                "enum": [
                    "opacity",
                    "visibility",
                    "boundingBox",
                    "query",
                    "snapshot",
                    "metadata",
                    "boundaryZoom",
                    "refresh",
                    "reload",
                    "remove",
                    "settings",
                    "data",
                    "styles"
                ]
            },
            "uniqueItems": true,
            "description": "A list of all controls to be enabled on the specified layer"
        },
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants