diff --git a/assets/src/components/Treeview.js b/assets/src/components/Treeview.js index 108c012a92..eeda157172 100644 --- a/assets/src/components/Treeview.js +++ b/assets/src/components/Treeview.js @@ -66,7 +66,7 @@ export default class Treeview extends HTMLElement { this._symbolTemplate = symbol => html` -
  • +
  • ${(symbol.childrenCount) ? html` ` diff --git a/assets/src/modules/state/Layer.js b/assets/src/modules/state/Layer.js index a01db65fc1..8091623c40 100644 --- a/assets/src/modules/state/Layer.js +++ b/assets/src/modules/state/Layer.js @@ -364,11 +364,22 @@ export class LayerItemState extends EventDispatcher { type: 'layer.symbol.expanded.changed', name: self.name, title: evt.title, - ruleKey: evt.ruleKey, + symbolType: evt.symbolType, expanded: evt.expanded, }); }, 'symbol.expanded.changed'); } + } else if (this.symbology instanceof LayerGroupSymbology) { + const self = this; + this.symbology.addListener(evt => { + self.dispatch({ + type: 'layer.symbol.expanded.changed', + name: self.name, + title: evt.title, + symbolType: evt.symbolType, + expanded: evt.expanded, + }); + }, 'symbol.expanded.changed'); } this.dispatch({ type: this.mapType + '.symbology.changed', diff --git a/assets/src/modules/state/MapLayer.js b/assets/src/modules/state/MapLayer.js index db07a2c244..30c9d09e30 100644 --- a/assets/src/modules/state/MapLayer.js +++ b/assets/src/modules/state/MapLayer.js @@ -67,6 +67,7 @@ export class MapItemState extends EventDispatcher { this.dispatch.bind(this), layerItemState.mapType + '.opacity.changed' ); + layerItemState.addListener(this.dispatch.bind(this), 'layer.symbol.expanded.changed'); } else { layerItemState.addListener(this.dispatch.bind(this), 'layer.visibility.changed'); layerItemState.addListener(this.dispatch.bind(this), 'layer.symbology.changed'); diff --git a/assets/src/modules/state/Symbology.js b/assets/src/modules/state/Symbology.js index 3f7daeb54c..0bd6a284b0 100644 --- a/assets/src/modules/state/Symbology.js +++ b/assets/src/modules/state/Symbology.js @@ -89,13 +89,20 @@ export class BaseObjectSymbology extends EventDispatcher { /** * Create a base symbology instance based on a node object provided by QGIS Server - * @param {object} node - the QGIS node symbology - * @param {string} node.title - the node title + * @param {object} node - the QGIS node symbology + * @param {string} node.title - the node title + * @param {string} [node.type] - the node type * @param {object} [requiredProperties] - the required properties definition - * @param {object} [optionalProperties] - the optional properties definition + * @param {object} [optionalProperties] - the optional properties definition */ - constructor(node, requiredProperties = { 'title': { type: 'string' } }, optionalProperties = {}) { - + constructor(node, requiredProperties = { 'title': { type: 'string' } }, optionalProperties = { 'type': { type: 'string' } }) + { + if (!node.hasOwnProperty('type')) { + node.type = 'icon'; + } + if (!optionalProperties.hasOwnProperty('type')) { + optionalProperties['type'] = { type: 'string' }; + } if (!requiredProperties.hasOwnProperty('title')) { requiredProperties['title'] = { type: 'string' }; } @@ -104,6 +111,14 @@ export class BaseObjectSymbology extends EventDispatcher { applyConfig(this, node, requiredProperties, optionalProperties) } + /** + * The symbology type + * @type {string} + */ + get type() { + return this._type; + } + /** * The symbology title * @type {string} @@ -121,16 +136,20 @@ export class BaseObjectSymbology extends EventDispatcher { export class BaseIconSymbology extends BaseObjectSymbology { /** * Create a base icon symbology instance based on a node object provided by QGIS Server - * @param {object} node - the QGIS node symbology - * @param {string} node.icon - the png image in base64 - * @param {string} node.title - the node title + * @param {object} node - the QGIS node symbology + * @param {string} node.title - the node title + * @param {string} [node.icon] - the png image in base64 + * @param {string} [node.type] - the node type * @param {object} [requiredProperties] - the required properties definition * @param {object} [optionalProperties] - the optional properties definition */ - constructor(node, requiredProperties={}, optionalProperties = {}) { - - if (!requiredProperties.hasOwnProperty('icon')) { - requiredProperties['icon'] = { type: 'string' }; + constructor(node, requiredProperties = { 'title': { type: 'string' } }, optionalProperties = { 'icon': { type: 'string' } }) + { + if (!optionalProperties.hasOwnProperty('icon')) { + optionalProperties['icon'] = { type: 'string' }; + } + if (!requiredProperties.hasOwnProperty('title')) { + requiredProperties['title'] = { type: 'string' }; } // In case of RuleBasedRenderer the icon could be empty if (!node.hasOwnProperty('icon')) { @@ -211,6 +230,9 @@ export class SymbolIconSymbology extends BaseIconSymbology { * @param {boolean} node.checked - the node is checked by default */ constructor(node) { + if (!node.hasOwnProperty('type')) { + node.type = 'icon'; + } super(node, symbolIconProperties, symbolIconOptionalProperties) this._childrenRules = [] } @@ -280,6 +302,9 @@ const symbolRuleOptionalProperties = Object.assign( */ export class SymbolRuleSymbology extends SymbolIconSymbology { constructor(node) { + if (!node.hasOwnProperty('type')) { + node.type = 'rule'; + } super(node, symbolRuleProperties, symbolRuleOptionalProperties) this._parentRule = null; this._childrenRules = []; @@ -421,6 +446,36 @@ export class BaseSymbolsSymbology extends BaseObjectSymbology { for(const symbol of this._symbols) { this._icons.push(new iconClass(symbol)); } + + this._expanded = false; + } + + /** + * Symbol item is expanded + * @type {boolean} + */ + get expanded() { + return this._expanded; + } + + /** + * Set symbol item is expanded + * @type {boolean} + */ + set expanded(val) { + const newVal = convertBoolean(val); + if (this._expanded === newVal) { + return; + } + + this._expanded = newVal; + + this.dispatch({ + type: 'symbol.expanded.changed', + title: this.title, + symbolType: this.type, + expanded: this.expanded + }); } /** @@ -621,7 +676,9 @@ export class LayerGroupSymbology extends BaseObjectSymbology { this._symbologyNodes = []; for(const node of this._nodes) { if (node.hasOwnProperty('symbols')) { - this._symbologyNodes.push(new BaseSymbolsSymbology(node)); + const symbol = new BaseSymbolsSymbology(node); + symbol.addListener(this.dispatch.bind(this), 'symbol.expanded.changed'); + this._symbologyNodes.push(symbol); } else if (node.hasOwnProperty('icon')) { this._symbologyNodes.push(new BaseIconSymbology(node)); } diff --git a/tests/js-units/data/cadastre-caen-fond-legend.json b/tests/js-units/data/cadastre-caen-fond-legend.json new file mode 100644 index 0000000000..b60ec75891 --- /dev/null +++ b/tests/js-units/data/cadastre-caen-fond-legend.json @@ -0,0 +1,364 @@ +{ + "nodes": [ + { + "symbols": [ + { + "icon": "iVBORw0KGgoAAAANSUhEUgAAABAAAAASCAYAAABSO15qAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAAG0lEQVQ4jWNgGAWjgAqAsY57SfxAO2IUDH0AAIv4AY4rqllwAAAAAElFTkSuQmCC", + "title": "texture transparente" + }, + { + "icon": "iVBORw0KGgoAAAANSUhEUgAAABAAAAASCAYAAABSO15qAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAAH0lEQVQ4jWNgGAXDADAyMDD8p8QAJkpdMPAGjIJhAQDZagEHwzuUIgAAAABJRU5ErkJggg==", + "title": "symbole d'église" + }, + { + "icon": "iVBORw0KGgoAAAANSUhEUgAAABAAAAASCAYAAABSO15qAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAAH0lEQVQ4jWNgGAXDADAyMDD8p8QAJkpdMPAGjIJhAQDZagEHwzuUIgAAAABJRU5ErkJggg==", + "title": "symbole de mosquée" + }, + { + "icon": "iVBORw0KGgoAAAANSUhEUgAAABAAAAASCAYAAABSO15qAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAAH0lEQVQ4jWNgGAXDADAyMDD8p8QAJkpdMPAGjIJhAQDZagEHwzuUIgAAAABJRU5ErkJggg==", + "title": "symbole de synagogue" + }, + { + "icon": "iVBORw0KGgoAAAANSUhEUgAAABAAAAASCAYAAABSO15qAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAAIUlEQVQ4jWNgGAUUA8YXc2X/U2IAE6UuGDVgMBgwCqgAAM9NArF/PtKCAAAAAElFTkSuQmCC", + "title": "limite d'Etat" + }, + { + "icon": "iVBORw0KGgoAAAANSUhEUgAAABAAAAASCAYAAABSO15qAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAAH0lEQVQ4jWNgGAUDDxh3ZDv9p8QAJkpdMGrAKBgcAABhQQJw+75YFwAAAABJRU5ErkJggg==", + "title": "limite de département" + }, + { + "icon": "iVBORw0KGgoAAAANSUhEUgAAABAAAAASCAYAAABSO15qAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAAIElEQVQ4jWNgGAXDADD+T2X8T4kBTJS6YOANGAXDAgAAvPECbI7qDmMAAAAASUVORK5CYII=", + "title": "amorce de limite de commune" + }, + { + "icon": "iVBORw0KGgoAAAANSUhEUgAAABAAAAASCAYAAABSO15qAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAAIUlEQVQ4jWNgGAWjgAqAsa2tLZ5YxVVVVQtp6ZhRMHQBAMa/BAJfvSe9AAAAAElFTkSuQmCC", + "title": "chemin" + }, + { + "icon": "iVBORw0KGgoAAAANSUhEUgAAABAAAAASCAYAAABSO15qAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAAG0lEQVQ4jWNgGAWjgAqAsaysLH6gHTEKhj4AAATgAcMghRBPAAAAAElFTkSuQmCC", + "title": "amorce de voie" + }, + { + "icon": "iVBORw0KGgoAAAANSUhEUgAAABAAAAASCAYAAABSO15qAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAAIUlEQVQ4jWNgGAWjgAqAMTMzM55YxdOnT19IS8eMgqELALfLBAJzupN2AAAAAElFTkSuQmCC", + "title": "trottoirs et sentiers" + }, + { + "icon": "iVBORw0KGgoAAAANSUhEUgAAABAAAAASCAYAAABSO15qAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAAI0lEQVQ4jWNgGAXDCPwfMM0sULqGSPUtaHy4PopcMQqGPAAAeL8EflrblxcAAAAASUVORK5CYII=", + "title": "gazoduc ou oléoduc" + }, + { + "icon": "iVBORw0KGgoAAAANSUhEUgAAABAAAAASCAYAAABSO15qAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAALUlEQVQ4jWNgGAXDBPyHYrIA0///ZOtlYGBgYGBBYu8mQ78rAwMFzh8FwwYAAFmfBwF8qFaWAAAAAElFTkSuQmCC", + "title": "téléphérique" + }, + { + "icon": "iVBORw0KGgoAAAANSUhEUgAAABAAAAASCAYAAABSO15qAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAAJUlEQVQ4jWNgGAWjgAqAkYGB4T8DA0Mtkepb0Pg11HXOKBiqAAB03gJ+MukxYAAAAABJRU5ErkJggg==", + "title": "ligne de transport de force" + }, + { + "icon": "iVBORw0KGgoAAAANSUhEUgAAABAAAAASCAYAAABSO15qAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAAG0lEQVQ4jWNgGAWjgAqAkYGB4cBAO2IUDH0AALqqAMIFZN+JAAAAAElFTkSuQmCC", + "title": "rail de chemin de fer" + }, + { + "icon": "iVBORw0KGgoAAAANSUhEUgAAABAAAAASCAYAAABSO15qAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAAG0lEQVQ4jWNgGAWjgAqAMTMzM36gHTEKhj4AAKwAAZwam+YrAAAAAElFTkSuQmCC", + "title": "*flèche de rattachement d'un numéro de\nparcelle ou de la référence d'un bâtiment\nsur le domaine non cadastré" + }, + { + "icon": "iVBORw0KGgoAAAANSUhEUgAAABAAAAASCAYAAABSO15qAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAAHklEQVQ4jWNgGAWjgAqAkYGBIZ4C/Qup5ZBRMLQBACY9AQK2RnO1AAAAAElFTkSuQmCC", + "title": "terrain de sports, petits ruisseaux" + }, + { + "icon": "iVBORw0KGgoAAAANSUhEUgAAABAAAAASCAYAAABSO15qAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAAI0lEQVQ4jWNgGAWjgAqAsa6uLh6fgqampoW45AjpHQUjBwAAokQF29B3zKUAAAAASUVORK5CYII=", + "title": "parking, terrasse, surplomb" + }, + { + "icon": "iVBORw0KGgoAAAANSUhEUgAAABAAAAASCAYAAABSO15qAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAAG0lEQVQ4jWNgGAWjgAqAMTMzM36gHTEKhj4AAKwAAZwam+YrAAAAAElFTkSuQmCC", + "title": "*objet linéaire divers" + }, + { + "icon": "iVBORw0KGgoAAAANSUhEUgAAABAAAAASCAYAAABSO15qAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAAG0lEQVQ4jWNgGAWjgAqAsTJ74q+BdsQoGPoAAI/jAnEC4tAlAAAAAElFTkSuQmCC", + "title": "" + } + ], + "title": "Objets linéaires", + "type": "layer" + }, + { + "symbols": [ + { + "icon": "iVBORw0KGgoAAAANSUhEUgAAACIAAAAkCAYAAADsHujfAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAAYUlEQVRYhe3RsQmDYBSF0YNiE2L793b22c4Z0mWMNK4j7mGdJhs8QYR7Bvi4cImIiIi4txkfvPGohPrikA4rJjRsxV5JwxfPK0fAglc1Ur0GBuw4KpHuhCHjf0xERETcyg+nugZ+/UYCVAAAAABJRU5ErkJggg==", + "title": "" + }, + { + "icon": "iVBORw0KGgoAAAANSUhEUgAAACIAAAAiCAYAAAA6RwvCAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAAW0lEQVRYhe3RMQqAQAwF0VHBam09hZWV3v9C1lYWm8pOIyzCPAikSfgkIEmS/qcAU3ZJ/0GQJSplSMwWYI0QMzACB3C+WZa5SBd175vZgL11CKgvKq1DSJKkpy4D6AN29U4HZgAAAABJRU5ErkJggg==", + "title": "calvaire" + }, + { + "icon": "iVBORw0KGgoAAAANSUhEUgAAACIAAAAiCAYAAAA6RwvCAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAAdElEQVRYhe3PMQrCQBAF0KfmBGksbLyDvb2QG3gyj2ihiAiBkCJNQLHLRtL4X7UzsDN/iIiIiD+1Kfy3R4/uo9egxbNk4KowCJzxwnWsKxxxwW3qsGpGkDse3sesx/ec4yY7YPvVO2G3ZAiol14YERERvzYAG9gK9zsktVEAAAAASUVORK5CYII=", + "title": "flèche de cours d'eau" + }, + { + "icon": "iVBORw0KGgoAAAANSUhEUgAAACQAAAAiCAYAAAA3WXuFAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAAo0lEQVRYhe3TsQqBURgG4IcwmBhspAxEUu7M7Drchs2kbLK6CJPFoCiDGP5fsf7nn/Q9dTrT9/bW+Q4hhBBCKFUlYXaa33UcS+gCagmzPXRwxxN9zHDBCZsiodWEQjUM0MISI5wxwbxoaEqhBw5o5kUaaGOPW9HQlCfb4ZWXGKMr28khVgm5ydayYt9nUTQs5Zd9DPzuTAVbXEvIDiGEEMLfeQPg8haJ47+WgAAAAABJRU5ErkJggg==", + "title": "halte" + }, + { + "icon": "iVBORw0KGgoAAAANSUhEUgAAACIAAAAiCAYAAAA6RwvCAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAAs0lEQVRYhe3SO2qCQRQG0OMjPsBSksbGbCUgFnaWLiKQBbiE7CObyAZSmaxBUkg6G0H4LZxCRBRvrOSebmDm4+PeIaWUUkpn1fCIejk//DewEXzXxxwVRphigBme8H1tYP3ylZNe0CoFuvjBGBssI4HRIj28lxILrPGJP6wigbVgkSa29lOp8IZntEvBq1dzCx18lUIVXiMh0dUcO/z0oSlHV3NsgqF9oQ/83ig3pZRSuj87mRQVlMQS/akAAAAASUVORK5CYII=", + "title": "arrêt" + }, + { + "icon": "iVBORw0KGgoAAAANSUhEUgAAACIAAAAiCAYAAAA6RwvCAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAARUlEQVRYhe3OsQkAIRBE0S+INdmd2J01GdyZGMklmsjBfzDJwC4DkiRJd4XDuwwUoC99AirQdh/GwyEP8M589ZIkSb8zADgpB/+f2CbDAAAAAElFTkSuQmCC", + "title": "station" + }, + { + "icon": "iVBORw0KGgoAAAANSUhEUgAAACIAAAAiCAYAAAA6RwvCAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAA0ElEQVRYhe3TsQ6CMBCA4dNuusMLkLI4m7gQtj6EvgxvwOTMIDR06WOY8AysEiBlYSuE1J3NQjDG+8ZL7vIvB4AQQgj9id2SZc/zLo7j3AAA2rZ9lGX5XCfrA4yxiHOutNZGa20454oxFm0aQSk9CyGUmcnzXFFKz5uFBEEQj+M47zDDMJgwDGObm/u1I21ZhdR1nUkpu/lcSqmqqspsbhKbpa7rXn3fHwkhJ9/3D9M0gRBCJUlyL4oitbm5+H1d170CADRNk37lfRFCCKFf8wZxVnEIU6LmRgAAAABJRU5ErkJggg==", + "title": "pylône" + }, + { + "icon": "iVBORw0KGgoAAAANSUhEUgAAACQAAAAiCAYAAAA3WXuFAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAA7klEQVRYhe3TL26EQBSA8Y9iaJqtYRP+OHRNR7bpLQiyvUDPsYYLVBCSzQoMQfcCbSrmCmgwC4KkGcfU1FQuICreTz315eVlBoQQQgixKWeDxg3w8Dt/Ad9rYqsWiqLoyff9U5Zle4C6rs/DMLz0ff+xtHm1Yh8vDMOj1joJgmAXx/FOa52EYXgEvKXRNRd6zPP8vW3bWwBrLa7rMk2TqarqAByWRNdciHmecRwHa+2fGbgDXoHrNf1LeUqp1hhji6KwZVlaY4xVSrVAArwB95dGN3nUaZruAZqmOY/j+Nx13efS5r/79kIIIYTY2A/uaVBqxZuu4AAAAABJRU5ErkJggg==", + "title": "puits" + }, + { + "icon": "iVBORw0KGgoAAAANSUhEUgAAACIAAAAiCAYAAAA6RwvCAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAAW0lEQVRYhe3RMQqAQAwF0VHBam09hZWV3v9C1lYWm8pOIyzCPAikSfgkIEmS/qcAU3ZJ/0GQJSplSMwWYI0QMzACB3C+WZa5SBd175vZgL11CKgvKq1DSJKkpy4D6AN29U4HZgAAAABJRU5ErkJggg==", + "title": "objet ponctuel divers" + } + ], + "title": "Objets ponctuels", + "type": "layer" + }, + { + "symbols": [ + { + "icon": "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAAM0lEQVQ4jWNsbm5+w4AGamtrRRgYGBjQ5bCKYzOAFMBEiWaqGDAIwNAPxNFYGAyBSLEBAGUAEeYttsLRAAAAAElFTkSuQmCC", + "title": "limite surfacique ne format pas parcelle" + }, + { + "icon": "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAANklEQVQ4jWNgYGB4A8UwQCobAg4ePPifEj5FANM5AwIoCYNB4gVKwBsGhgFOBxQD6sTC0M0LAB2GPkXmnPFZAAAAAElFTkSuQmCC", + "title": "parapet de pont" + }, + { + "icon": "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAAHUlEQVQ4jWOUqlxTx0ABYKJE86gBowaMGjCYDAAAUEEB3bOVFq0AAAAASUVORK5CYII=", + "title": "étang, lac, mare" + }, + { + "icon": "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAAKElEQVQ4jWMsLCysYqAAsDAwMDD09fVdINcAJkpsHzVg1IBRA6hoAAD4CgRpR/Xo3gAAAABJRU5ErkJggg==", + "title": "tunnel" + }, + { + "icon": "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAASUlEQVQ4jWNkYGD4xUAhoMSAX0yU2j5qwLAwgAWPXBIDA0MdIf34DOBlYGCQJ+QCRgZIUmbDIqfEwMCgQ0D/OgaGgc4LMC+QDQAWXwkGz+kHiwAAAABJRU5ErkJggg==", + "title": "cimetière chrétien" + }, + { + "icon": "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAAOUlEQVQ4jWNkYGD4xUAhoMSAX0yU2j5qwKgBw9SAIAYGhj0MDAyaxBrAyICaG5mhhv5nYGD4Q4wBAG+JBzw05oUxAAAAAElFTkSuQmCC", + "title": "cimetière israélite" + }, + { + "icon": "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAAgklEQVQ4jdXSvQ3CQAyG4edSAUOwABVSRmQmKnagTBEKVqCLLhKhyCFQKi6usGTJkuXXn38SsqBFALmJdv8/QFrW1AAaXHHD7jvx6xU2mIof3rU1CgbcS3xcowBORUFvHiPXArboCuSMsRYALR4++1j1yntcIgDms46RT3xiSgEF4AXegh+rzPDoFwAAAABJRU5ErkJggg==", + "title": "cimetière musulman" + }, + { + "icon": "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAAHUlEQVQ4jWOcdfjODAYKABMlmkcNGDVg1IDBZAAAr7EC8a9h4EkAAAAASUVORK5CYII=", + "title": "piscine" + } + ], + "title": "Surfaces", + "type": "layer" + }, + { + "icon": "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAAHUlEQVQ4jWOUqlxTx0ABYKJE86gBowaMGjCYDAAAUEEB3bOVFq0AAAAASUVORK5CYII=", + "title": "Cours d'eau", + "type": "layer" + }, + { + "symbols": [ + { + "icon": "iVBORw0KGgoAAAANSUhEUgAAACIAAAAiCAYAAAA6RwvCAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAALElEQVRYhe3OsQ0AMAjAMNT/f6Y7G4IN+4AoEQBAS04Db+Nig5HKSGUEAM76fEABDjbxuhkAAAAASUVORK5CYII=", + "title": "" + }, + { + "icon": "iVBORw0KGgoAAAANSUhEUgAAACIAAAAiCAYAAAA6RwvCAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAAWklEQVRYhe3SIQ6AMBBE0U+CrkHiwHP/e9RWoknKCfAkK7qi6j872cmIBUmSNNeSvNuAEmQdeEYL1+SQHTiCrGWG6C/7IxdwBlkD6mhh9kdu4A2ynuyUJElTfTahCNndElv3AAAAAElFTkSuQmCC", + "title": "mur mitoyen" + }, + { + "icon": "iVBORw0KGgoAAAANSUhEUgAAACIAAAAeCAYAAABJ/8wUAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAAQElEQVRYhe3OsQkAIBQD0ROsbSzt3H8kZxDcwAks/CA299qQEJAk6a0U7FWgHLIFzNvBHDzSgH7IRuSIJEnSbxulqwQNvxQxygAAAABJRU5ErkJggg==", + "title": "mur non mitoyen" + }, + { + "icon": "iVBORw0KGgoAAAANSUhEUgAAACIAAAAiCAYAAAA6RwvCAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAAe0lEQVRYhe3SqwoCYRAF4A8v2WARBYPYBLfbjL5/9QFEcTV4xaDBxe4fNp0vTZkzEw4RERHRrm7h3hAj3DDGAE9M0cH938Be4SMTzHDCAm9cUGGLujA3fko7ssQKO6wxxxEb9LFv65GXbz9qXJvD52Y+4FGYGxEREa35ABxIFQR5q/FKAAAAAElFTkSuQmCC", + "title": "fossé mitoyen" + }, + { + "icon": "iVBORw0KGgoAAAANSUhEUgAAACIAAAAeCAYAAABJ/8wUAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAAUUlEQVRYhe3OIQqEYACE0cdq32ARBYN1g/e/i2fQIopJz7A/iGVen48hIiLiWVXhrkGLHR2+ODHgg+PfYF14pMeIFT9c2DBhxlLYjYiIiHjNDfQyCKUP77cIAAAAAElFTkSuQmCC", + "title": "fossé non mitoyen" + }, + { + "icon": "iVBORw0KGgoAAAANSUhEUgAAACIAAAAiCAYAAAA6RwvCAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAAPElEQVRYhe3RwQkAIBADwcVCtP/Ptaifq0AFT9iBfEMgIEmStGUAkekvhwQwM3FS1K7MKaBT5BpJkvStBYsTBo42wpbRAAAAAElFTkSuQmCC", + "title": "clôture mitoyenne" + }, + { + "icon": "iVBORw0KGgoAAAANSUhEUgAAACIAAAAgCAYAAAB3j6rJAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAAMUlEQVRYhe3OsQ0AIAwEsZ8E9m+yIjTZgCJCsqXrLwEA/rKTVLcmRyrJ6WpyBADg1QWa5AT0ibnrXwAAAABJRU5ErkJggg==", + "title": "clôture non mitoyenne" + }, + { + "icon": "iVBORw0KGgoAAAANSUhEUgAAACIAAAAiCAYAAAA6RwvCAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAARElEQVRYhe3QMQrAIAxA0W8vqfYU4v0Rh3ZwtoUg/LckU/gEJEmSttzvTECODAHoQPt65PohZPB8JFRd9hJWIUmSTjYB0fQDR9wR6VsAAAAASUVORK5CYII=", + "title": "haie mitoyenne" + }, + { + "icon": "iVBORw0KGgoAAAANSUhEUgAAACIAAAAeCAYAAABJ/8wUAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAAVklEQVRYhe3QsQ2AMAwF0QMxQVLAQsDITIWYACkFDQUUxEhp7lW/sk4GSZIeLS/7sy4YkoEZ6IENOGoPDcGQHUjAGYn4wwqMwMT1mWbSbedmFZIkqUIBQMUGXfdHqmkAAAAASUVORK5CYII=", + "title": "haie non mitoyenne" + } + ], + "title": "Murs, fossés, clotûres", + "type": "layer" + }, + { + "symbols": [ + { + "icon": "iVBORw0KGgoAAAANSUhEUgAAACIAAAAkCAYAAADsHujfAAAACXBIWXMAAA9hAAAPYQGoP6dpAAABAElEQVRYhe3TrW6EQBQF4NOFEBKC5zdBE3AXFKo1ZLtV8yLNbvtmFU14giKKQxQNCsxgENu0okldxc6obu7nz8m9dzIAY4wxxv6ZoigeyrI86PaYunkiegSAtm1fAZxVi3Y6UxDRPoqiKo7jioj2Ol06g5hZlp1837c8z7OyLDtB48KGarAoivuqqo7TNBnLsiAIAn9d1/dxHD9U+lQvYuZ5/iSltIQQEEJASmmlafoMxeWUQkR0qOv66DiO0TQNuq5DkiQIw9Cf57mbpuniq6i86c513bthGN62bfvN930P27bPruveAngB8HVJ6Y3CIMDPAn9d8xMa35gxxhi7et94OkKZYB69pQAAAABJRU5ErkJggg==", + "title": "Point géodésique borné" + }, + { + "icon": "iVBORw0KGgoAAAANSUhEUgAAACIAAAAkCAYAAADsHujfAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAA/ElEQVRYhe3ToW6EQBQF0NuFEMyIcRAYT8jgZlCrwJDt9l+a3e2fVfQXimgTJGhQCEBBsk0rqioqdka1ecffm/feZABCCCGE/DFa64c8z4+2Pa5tXin1CAB1Xb8AuJoW7WymUEod4jjeCyH2SqmDTZfNIK6U8hyGoRcEgSelPMPiwo5pUGt9X5blqSgKRwiBZVnCaZre+r5vTfpML+JmWXbhnHtJkiBJEnDOvTRNn2C4nFFIKXWsquq0bZvTti2apsE8z4iiKBzH8X0YhpuvYvKmO8ZY2XXd67quP/K+718ZYwWAZwCft5TeGQwCfC/w2zU/YPGNCSGEkH/vC54LPaqIaBVeAAAAAElFTkSuQmCC", + "title": "Point géodésique non borné" + }, + { + "icon": "iVBORw0KGgoAAAANSUhEUgAAACIAAAAkCAYAAADsHujfAAAACXBIWXMAAA9hAAAPYQGoP6dpAAABAElEQVRYhe3TMUrEQBQG4N81KVJM4QlkiI1ryjdp0mm36EJIIXiDkMZE7yOeIRaeIEPiBXKBdBnsVljUsVBLi50pZOF95cD7+WeGBzDGGGNszyilrtI0vfTNCXzniegWAIZheAbw7lvICRGttdYbrfWGiNY+WYceswERPUZRdDxNU2iMORnH8QHAp0+hnS2Xy5uqqrb2R1mW2yRJrl3zFo5zgZTyriiK8Pcgz/NQSnkPx1d2KkJEq6ZpTruug7UW1lr0fY+6rs+UUiuXTJetWQghLtq2fZnnOcqy7AgA4jh+Nca8CSHOATwBsLuEHjgUAb4v8NcXfOC/1pgxxhjbB18ugEv/EBBKigAAAABJRU5ErkJggg==", + "title": "Point de canevas d'ensemble borné" + }, + { + "icon": "iVBORw0KGgoAAAANSUhEUgAAACIAAAAkCAYAAADsHujfAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAAtklEQVRYhe3TOw7CMBAE0AHS+ja7OQC0JPew0nAsH4CCJvVG4T6uQKHgowhEERsRRZrXWl6NxzZAREREC6OqVVmW+9w5Re5+ETkAQN/3JwCX3EBJRKQ2s2hmUUTqWUIAKLz37fDgvW+R3/B0qlp1XRefQcws/uKtTFU0TfNq462Vzd9SiEg9bmPciqpWKTNT7nTtnNuFEM4hhI9F59wWwBHAMGXoKiEIcD/Atyu4Yq5vTEREtAQ3n3hhWn7S1g4AAAAASUVORK5CYII=", + "title": "Point de canevas d'ensemble non borné" + }, + { + "icon": "iVBORw0KGgoAAAANSUhEUgAAACIAAAAiCAYAAAA6RwvCAAAACXBIWXMAAA9hAAAPYQGoP6dpAAABBklEQVRYhe3SsW2FMBAG4N8QQWt2YBEk0qTEYgojlCFoaViCCrLAE91jBRqEDIIWWmjsFIlS50GUIrmvPOt+nU8HEEIIIf8Eu9BrRVGUcs5Dxhi2bbvVdV0A0D813LeGSJLkbZ5nfb/fTdM0ZhxHnSRJhWufe0wURa/Lsug8z03TNKZtW5NlmVFKaSFEeibz6UwT5zzc9535vo8gCAAAtm1DKcU8z3sGUDyaaZ0ZhDEGx3FwHMdXbd93uK57Jg7AyY1s23YD8LKuKyvLEq7rYhgGxHFsPt9+jSWlrKdp0n3fm67rjFJKSylrnDzWKxfOhBCp53kh8LGlqqoKAOZCJiGEEPL3vQPVumrZjIVafQAAAABJRU5ErkJggg==", + "title": "Point de polygonation borné" + }, + { + "icon": "iVBORw0KGgoAAAANSUhEUgAAACIAAAAiCAYAAAA6RwvCAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAAaklEQVRYhe3SMQ6AIAyF4R/j4O6iG8fQ+5/EicULuDHI4MCAligm70s6QMJL0wIiIiJSzKcy6cxtwATMLTRShXv4znNOYgeOdDcAIxCA7W6gZSLuUrnz6xZgtYY080f6ChmBD9chIiLyOxEMkwXeUq8bbgAAAABJRU5ErkJggg==", + "title": "Point de polygonation non borné" + }, + { + "icon": "iVBORw0KGgoAAAANSUhEUgAAACIAAAAeCAYAAABJ/8wUAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAAhklEQVRYhe3SsQlCMRQF0CMKggiWWgjaiSN8nECcwZ3cwDGsbN1DOxewsNHCFGJnPljIPVUSeDeXECIi4k91Ws43mJf1GafaoF6LEmtMsCj7PkY41IR1K0usMMUdOxyxxLCUuXwbWPsiM2xxxebtfIx9TWDtHxmUSz/nH17lbpW5ERER8TNP7bUMjREyw7AAAAAASUVORK5CYII=", + "title": "Repère NGF" + }, + { + "icon": "iVBORw0KGgoAAAANSUhEUgAAACIAAAAiCAYAAAA6RwvCAAAACXBIWXMAAA9hAAAPYQGoP6dpAAABBklEQVRYhe3SsW2FMBAG4N8QQWt2YBEk0qTEYgojlCFoaViCCrLAE91jBRqEDIIWWmjsFIlS50GUIrmvPOt+nU8HEEIIIf8Eu9BrRVGUcs5Dxhi2bbvVdV0A0D813LeGSJLkbZ5nfb/fTdM0ZhxHnSRJhWufe0wURa/Lsug8z03TNKZtW5NlmVFKaSFEeibz6UwT5zzc9535vo8gCAAAtm1DKcU8z3sGUDyaaZ0ZhDEGx3FwHMdXbd93uK57Jg7AyY1s23YD8LKuKyvLEq7rYhgGxHFsPt9+jSWlrKdp0n3fm67rjFJKSylrnDzWKxfOhBCp53kh8LGlqqoKAOZCJiGEEPL3vQPVumrZjIVafQAAAABJRU5ErkJggg==", + "title": "Borne NGF" + }, + { + "icon": "iVBORw0KGgoAAAANSUhEUgAAACIAAAAeCAYAAABJ/8wUAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAAo0lEQVRYhe3SMQqCIRQH8Gc0NefkEXQKPEFEUycRPEFDd2pqaVNEcBDEKxjR8oW02hpBUBbfEO83vsf/zxseAEIIoT9FvgkLIVZCiCUhhOScjzHGw68Oe5tSamuMGUoprZTSrLWD1no36hGc87X3/tqehBCqlHLT0zntCTHGpHPunFI6Pc5rrRNK6QIA9p929v7IDADmL3YXALh19iKEEEJoNHecVD72egC1OwAAAABJRU5ErkJggg==", + "title": "Nivellement MRL" + }, + { + "icon": "iVBORw0KGgoAAAANSUhEUgAAAB4AAAAiCAYAAABIiGl0AAAACXBIWXMAAA9hAAAPYQGoP6dpAAAAqElEQVRYhe3TsQrCMBCA4aCuBSHD4Z6lYMicpQ8gWX2l0lEfwskn6HB7nkIRshRSzBBwEc7NPUS6eN98uZ8bIgRjjDH2S8YYp5S6LBp1zp0QMfd9f18s2rZtN47jk4hoGIZbza5VyTAAHJum2XrvxTzPm5pw8WMiqul9FV08TdM155ystUJK+a4Jr0uGY4yPlNIOAPYhhBcinmvixbTWh8W/E2OMsf/xAUeHNJrE2gurAAAAAElFTkSuQmCC", + "title": "Autre repère de nivellement" + }, + { + "icon": "iVBORw0KGgoAAAANSUhEUgAAACIAAAAiCAYAAAA6RwvCAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAA0ElEQVRYhe3TsQ6CMBCA4dNuusMLkLI4m7gQtj6EvgxvwOTMIDR06WOY8AysEiBlYSuE1J3NQjDG+8ZL7vIvB4AQQgj9id2SZc/zLo7j3AAA2rZ9lGX5XCfrA4yxiHOutNZGa20454oxFm0aQSk9CyGUmcnzXFFKz5uFBEEQj+M47zDDMJgwDGObm/u1I21ZhdR1nUkpu/lcSqmqqspsbhKbpa7rXn3fHwkhJ9/3D9M0gRBCJUlyL4oitbm5+H1d170CADRNk37lfRFCCKFf8wZxVnEIU6LmRgAAAABJRU5ErkJggg==", + "title": "Borne limite de commune" + }, + { + "icon": "iVBORw0KGgoAAAANSUhEUgAAACIAAAAkCAYAAADsHujfAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAA/ElEQVRYhe3ToW6EQBQF0NuFEMyIcRAYT8jgZlCrwJDt9l+a3e2fVfQXimgTJGhQCEBBsk0rqioqdka1ecffm/feZABCCCGE/DFa64c8z4+2Pa5tXin1CAB1Xb8AuJoW7WymUEod4jjeCyH2SqmDTZfNIK6U8hyGoRcEgSelPMPiwo5pUGt9X5blqSgKRwiBZVnCaZre+r5vTfpML+JmWXbhnHtJkiBJEnDOvTRNn2C4nFFIKXWsquq0bZvTti2apsE8z4iiKBzH8X0YhpuvYvKmO8ZY2XXd67quP/K+718ZYwWAZwCft5TeGQwCfC/w2zU/YPGNCSGEkH/vC54LPaqIaBVeAAAAAElFTkSuQmCC", + "title": "Point géodésique borné" + }, + { + "icon": "iVBORw0KGgoAAAANSUhEUgAAACIAAAAkCAYAAADsHujfAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAA/ElEQVRYhe3ToW6EQBQF0NuFEMyIcRAYT8jgZlCrwJDt9l+a3e2fVfQXimgTJGhQCEBBsk0rqioqdka1ecffm/feZABCCCGE/DFa64c8z4+2Pa5tXin1CAB1Xb8AuJoW7WymUEod4jjeCyH2SqmDTZfNIK6U8hyGoRcEgSelPMPiwo5pUGt9X5blqSgKRwiBZVnCaZre+r5vTfpML+JmWXbhnHtJkiBJEnDOvTRNn2C4nFFIKXWsquq0bZvTti2apsE8z4iiKBzH8X0YhpuvYvKmO8ZY2XXd67quP/K+718ZYwWAZwCft5TeGQwCfC/w2zU/YPGNCSGEkH/vC54LPaqIaBVeAAAAAElFTkSuQmCC", + "title": "Point géodésique non borné" + }, + { + "icon": "iVBORw0KGgoAAAANSUhEUgAAACIAAAAkCAYAAADsHujfAAAACXBIWXMAAA9hAAAPYQGoP6dpAAABAElEQVRYhe3TrW6EQBQF4NOFEBKC5zdBE3AXFKo1ZLtV8yLNbvtmFU14giKKQxQNCsxgENu0okldxc6obu7nz8m9dzIAY4wxxv6ZoigeyrI86PaYunkiegSAtm1fAZxVi3Y6UxDRPoqiKo7jioj2Ol06g5hZlp1837c8z7OyLDtB48KGarAoivuqqo7TNBnLsiAIAn9d1/dxHD9U+lQvYuZ5/iSltIQQEEJASmmlafoMxeWUQkR0qOv66DiO0TQNuq5DkiQIw9Cf57mbpuniq6i86c513bthGN62bfvN930P27bPruveAngB8HVJ6Y3CIMDPAn9d8xMa35gxxhi7et94OkKZYB69pQAAAABJRU5ErkJggg==", + "title": "Point borné de canevas cadastral\nordinaire ou préalable à AFAF ou\nd'appui d'une prise de vues\npermettant la confection d'un plan\nde classe de précision [20 cm]" + }, + { + "icon": "iVBORw0KGgoAAAANSUhEUgAAACIAAAAkCAYAAADsHujfAAAACXBIWXMAAA9hAAAPYQGoP6dpAAABAElEQVRYhe3TrW6EQBQF4NOFEBKC5zdBE3AXFKo1ZLtV8yLNbvtmFU14giKKQxQNCsxgENu0okldxc6obu7nz8m9dzIAY4wxxv6ZoigeyrI86PaYunkiegSAtm1fAZxVi3Y6UxDRPoqiKo7jioj2Ol06g5hZlp1837c8z7OyLDtB48KGarAoivuqqo7TNBnLsiAIAn9d1/dxHD9U+lQvYuZ5/iSltIQQEEJASmmlafoMxeWUQkR0qOv66DiO0TQNuq5DkiQIw9Cf57mbpuniq6i86c513bthGN62bfvN930P27bPruveAngB8HVJ6Y3CIMDPAn9d8xMa35gxxhi7et94OkKZYB69pQAAAABJRU5ErkJggg==", + "title": "Point borné de canevas pérenne ou\ncadastral de précision" + }, + { + "icon": "iVBORw0KGgoAAAANSUhEUgAAACIAAAAkCAYAAADsHujfAAAACXBIWXMAAA9hAAAPYQGoP6dpAAABAElEQVRYhe3TrW6EQBQF4NOFEBKC5zdBE3AXFKo1ZLtV8yLNbvtmFU14giKKQxQNCsxgENu0okldxc6obu7nz8m9dzIAY4wxxv6ZoigeyrI86PaYunkiegSAtm1fAZxVi3Y6UxDRPoqiKo7jioj2Ol06g5hZlp1837c8z7OyLDtB48KGarAoivuqqo7TNBnLsiAIAn9d1/dxHD9U+lQvYuZ5/iSltIQQEEJASmmlafoMxeWUQkR0qOv66DiO0TQNuq5DkiQIw9Cf57mbpuniq6i86c513bthGN62bfvN930P27bPruveAngB8HVJ6Y3CIMDPAn9d8xMa35gxxhi7et94OkKZYB69pQAAAABJRU5ErkJggg==", + "title": "Point borné de canevas d'appui\nd'une prise de vues permettant la\nconfection d'un plan de classe de\nprécision [10 cm]" + }, + { + "icon": "iVBORw0KGgoAAAANSUhEUgAAACIAAAAkCAYAAADsHujfAAAACXBIWXMAAA9hAAAPYQGoP6dpAAABAElEQVRYhe3TrW6EQBQF4NOFEBKC5zdBE3AXFKo1ZLtV8yLNbvtmFU14giKKQxQNCsxgENu0okldxc6obu7nz8m9dzIAY4wxxv6ZoigeyrI86PaYunkiegSAtm1fAZxVi3Y6UxDRPoqiKo7jioj2Ol06g5hZlp1837c8z7OyLDtB48KGarAoivuqqo7TNBnLsiAIAn9d1/dxHD9U+lQvYuZ5/iSltIQQEEJASmmlafoMxeWUQkR0qOv66DiO0TQNuq5DkiQIw9Cf57mbpuniq6i86c513bthGN62bfvN930P27bPruveAngB8HVJ6Y3CIMDPAn9d8xMa35gxxhi7et94OkKZYB69pQAAAABJRU5ErkJggg==", + "title": "Point borné d'appui de\ngéoréférencement" + }, + { + "icon": "iVBORw0KGgoAAAANSUhEUgAAACIAAAAeCAYAAABJ/8wUAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAAhklEQVRYhe3SsQlCMRQF0CMKggiWWgjaiSN8nECcwZ3cwDGsbN1DOxewsNHCFGJnPljIPVUSeDeXECIi4k91Ws43mJf1GafaoF6LEmtMsCj7PkY41IR1K0usMMUdOxyxxLCUuXwbWPsiM2xxxebtfIx9TWDtHxmUSz/nH17lbpW5ERER8TNP7bUMjREyw7AAAAAASUVORK5CYII=", + "title": "Repère NGF" + }, + { + "icon": "iVBORw0KGgoAAAANSUhEUgAAACIAAAAeCAYAAABJ/8wUAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAAhklEQVRYhe3SsQlCMRQF0CMKggiWWgjaiSN8nECcwZ3cwDGsbN1DOxewsNHCFGJnPljIPVUSeDeXECIi4k91Ws43mJf1GafaoF6LEmtMsCj7PkY41IR1K0usMMUdOxyxxLCUuXwbWPsiM2xxxebtfIx9TWDtHxmUSz/nH17lbpW5ERER8TNP7bUMjREyw7AAAAAASUVORK5CYII=", + "title": "Borne du NGF" + }, + { + "icon": "iVBORw0KGgoAAAANSUhEUgAAACIAAAAeCAYAAABJ/8wUAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAAo0lEQVRYhe3SMQqCIRQH8Gc0NefkEXQKPEFEUycRPEFDd2pqaVNEcBDEKxjR8oW02hpBUBbfEO83vsf/zxseAEIIoT9FvgkLIVZCiCUhhOScjzHGw68Oe5tSamuMGUoprZTSrLWD1no36hGc87X3/tqehBCqlHLT0zntCTHGpHPunFI6Pc5rrRNK6QIA9p929v7IDADmL3YXALh19iKEEEJoNHecVD72egC1OwAAAABJRU5ErkJggg==", + "title": "Nivellement MRL" + }, + { + "icon": "iVBORw0KGgoAAAANSUhEUgAAACIAAAAeCAYAAABJ/8wUAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAAo0lEQVRYhe3SMQqCIRQH8Gc0NefkEXQKPEFEUycRPEFDd2pqaVNEcBDEKxjR8oW02hpBUBbfEO83vsf/zxseAEIIoT9FvgkLIVZCiCUhhOScjzHGw68Oe5tSamuMGUoprZTSrLWD1no36hGc87X3/tqehBCqlHLT0zntCTHGpHPunFI6Pc5rrRNK6QIA9p929v7IDADmL3YXALh19iKEEEJoNHecVD72egC1OwAAAABJRU5ErkJggg==", + "title": "Autre repère de nivellement" + }, + { + "icon": "iVBORw0KGgoAAAANSUhEUgAAACIAAAAiCAYAAAA6RwvCAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAA0ElEQVRYhe3TsQ6CMBCA4dNuusMLkLI4m7gQtj6EvgxvwOTMIDR06WOY8AysEiBlYSuE1J3NQjDG+8ZL7vIvB4AQQgj9id2SZc/zLo7j3AAA2rZ9lGX5XCfrA4yxiHOutNZGa20454oxFm0aQSk9CyGUmcnzXFFKz5uFBEEQj+M47zDDMJgwDGObm/u1I21ZhdR1nUkpu/lcSqmqqspsbhKbpa7rXn3fHwkhJ9/3D9M0gRBCJUlyL4oitbm5+H1d170CADRNk37lfRFCCKFf8wZxVnEIU6LmRgAAAABJRU5ErkJggg==", + "title": "Borne limite de commune" + }, + { + "icon": "iVBORw0KGgoAAAANSUhEUgAAACIAAAAiCAYAAAA6RwvCAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAAW0lEQVRYhe3UQQqAMBBD0Yz3v3NcqoMrM4LY/3aFMoQ2rQQAwCJqYIYn5iVBLEn2kaOqHs/cgiCXEKe1bze/FMQ9RCo6kUmfCRKVtV9PUtb0+faiTHwHAAD82w4ktxUCxfepJQAAAABJRU5ErkJggg==", + "title": "Inconnu" + } + ], + "title": "Repères géodésiques", + "type": "layer" + }, + { + "icon": "iVBORw0KGgoAAAANSUhEUgAAACIAAAAiCAYAAAA6RwvCAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAAU0lEQVRYhe3VMQ6AIBBE0Rnvf+YdW4OGxAhI8V9JWPIpCBIAAF31d4AkyXa+nnGMCBmBkNY2IX65v2zfZpLoYVlVFdvrLsurmYGQKZLs8dcAAC5OLpMPD6nC7eoAAAAASUVORK5CYII=", + "title": "Croix", + "type": "layer" + }, + { + "icon": "iVBORw0KGgoAAAANSUhEUgAAACIAAAAiCAYAAAA6RwvCAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAAU0lEQVRYhe3RsQmAQAAEwVUfrcdaDAys0YqsREQw8Cv4C38nP1g4kCRJnZrC/QwcwApcwBMXNdprzFiDmpUw5AWWGhIZwn0BNv6LT+BOgyRJUnc+gyEGMfbcmZsAAAAASUVORK5CYII=", + "title": "Bornes", + "type": "layer" + }, + { + "icon": "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAAM0lEQVQ4jWM82n3iPwMFgIWBgYHButSCkVSNMIuZKLF91IBRA4aRAYyU5kaKXGBdasEIAOCgCzh+yuKpAAAAAElFTkSuQmCC", + "title": "Lieux-dits", + "type": "layer" + }, + { + "symbols": [ + { + "icon": "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAAHUlEQVQ4jWP8f9ZoIwMFgIkSzaMGjBowasBgMgAAJrICz5VwIUoAAAAASUVORK5CYII=", + "title": "bâti dur" + }, + { + "icon": "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAAHUlEQVQ4jWP8/3TWBgYKABMlmkcNGDVg1IDBZAAAKVwDTr6O+6sAAAAASUVORK5CYII=", + "title": "bâti léger" + } + ], + "title": "Bâti", + "type": "layer" + }, + { + "icon": "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAAQklEQVQ4jWM8f/58GQOZwNDQsIuBEgMYGBgYmCjRPPAGnD9/voxiF1AEqOKCQWDACE9IVDGAkZhANDQ07ELmI+sBAC4EFoqfs1R/AAAAAElFTkSuQmCC", + "title": "Subdivisions fiscales", + "type": "layer" + }, + { + "icon": "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAAV0lEQVQ4jWOsspX7z4AHtB1+xAhjV9nK/YfxYfpY0BURaxgMMBGjER8gymZsAOYFil3ARCgQCRpAsQsG3ACGAQ8DFnI1Ui0dUBwGWHMasQa3HX7ESLEXACvWH25Qu6JtAAAAAElFTkSuQmCC", + "title": "Secteurs", + "type": "layer" + }, + { + "icon": "iVBORw0KGgoAAAANSUhEUgAAABAAAAASCAYAAABSO15qAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAAKElEQVQ4jWNgGAWjgAqA8c2bN7+QBURERNgYGBgYiBUfBaOAgYGBAQCkMAvAYlSfIwAAAABJRU5ErkJggg==", + "title": "Voies, routes et chemins", + "type": "layer" + }, + { + "icon": "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAAJ0lEQVQ4jWM8ePDgfwYKAAsDAwODpqYm2QYwUWL7qAGjBowaQEUDAFLAA9/UChwEAAAAAElFTkSuQmCC", + "title": "Tronçons de route", + "type": "layer" + } + ], + "type": "group", + "name": "Fond", + "title": "Fond", + "layerName": "Fond" +} diff --git a/tests/js-units/node/state/layer.test.js b/tests/js-units/node/state/layer.test.js index 38dbff91a7..2a448cca99 100644 --- a/tests/js-units/node/state/layer.test.js +++ b/tests/js-units/node/state/layer.test.js @@ -5,7 +5,7 @@ import { readFileSync } from 'fs'; import { ValidationError, ConversionError } from '../../../../assets/src/modules/Errors.js'; import { LayersConfig } from '../../../../assets/src/modules/config/Layer.js'; import { LayerGeographicBoundingBoxConfig, LayerBoundingBoxConfig, LayerTreeGroupConfig, buildLayerTreeConfig } from '../../../../assets/src/modules/config/LayerTree.js'; -import { LayerIconSymbology, LayerSymbolsSymbology, SymbolIconSymbology } from '../../../../assets/src/modules/state/Symbology.js'; +import { BaseSymbolsSymbology, LayerIconSymbology, LayerSymbolsSymbology, SymbolIconSymbology, LayerGroupSymbology } from '../../../../assets/src/modules/state/Symbology.js'; import { buildLayersOrder } from '../../../../assets/src/modules/config/LayersOrder.js'; import { Extent } from '../../../../assets/src/modules/utils/Extent.js'; @@ -957,6 +957,64 @@ describe('LayerGroupState', function () { expect(group_as_layer.layerConfig.toggled).to.be.true expect(group_as_layer.checked).to.be.true }) + + it('Group as layer symbology', function () { + const root = getRootLayerGroupState('cadastre-caen'); + expect(root.childrenCount).to.be.eq(1) + + const group = root.children[0] + expect(group).to.be.instanceOf(LayerGroupState) + expect(group.groupAsLayer).to.be.false + expect(group.type) + .to.be.eq('group') + .that.be.eq(group.mapType) + expect(group.childrenCount).to.be.eq(4) + + const fond = group.children[3] + expect(fond).to.be.instanceOf(LayerGroupState) + expect(fond.groupAsLayer).to.be.true + expect(fond.type) + .to.be.eq('group') + .that.not.be.eq(fond.mapType) + expect(fond.mapType).to.be.eq('layer') + /*const collection = getLayersAndGroupsCollection('cadastre-caen'); + + const fond = collection.getLayerByName('Fond')*/ + + expect(fond.symbology).to.be.undefined + + let fondSymbologyChangedEvt = null; + + fond.addListener(evt => { + fondSymbologyChangedEvt = evt + }, 'layer.symbology.changed'); + + const legend = JSON.parse(readFileSync('./data/cadastre-caen-fond-legend.json', 'utf8')); + expect(legend).to.not.be.undefined + + // Set symbology + fond.symbology = legend + expect(fond.symbology).to.be.instanceOf(LayerGroupSymbology) + + // Event dispatched + expect(fondSymbologyChangedEvt).to.not.be.null + expect(fondSymbologyChangedEvt.name).to.be.eq('Fond') + + + let expandedChangedEvt = null; + fond.addListener(evt => { + expandedChangedEvt = evt + }, 'layer.symbol.expanded.changed'); + const symbologyChildren = fond.symbology.children + expect(symbologyChildren[1]).to.be.instanceOf(BaseSymbolsSymbology) + expect(symbologyChildren[1].expanded).to.be.false + symbologyChildren[1].expanded = true; + + expect(expandedChangedEvt).to.not.be.null + expect(expandedChangedEvt.title).to.be.eq('Objets ponctuels') + expect(expandedChangedEvt.symbolType).to.be.eq('layer') + expect(expandedChangedEvt.expanded).to.be.true + }) }) describe('LayersAndGroupsCollection', function () { diff --git a/tests/js-units/node/state/symbology.test.js b/tests/js-units/node/state/symbology.test.js index d45acc23a7..6e4d660706 100644 --- a/tests/js-units/node/state/symbology.test.js +++ b/tests/js-units/node/state/symbology.test.js @@ -14,6 +14,7 @@ describe('BaseIconSymbology', function () { expect(icon).to.be.instanceOf(BaseIconSymbology) expect(icon.icon).to.have.string(base64png) expect(icon.title).to.be.eq('category 1') + expect(icon.type).to.be.eq('icon') }) it('Null data icon', function () { @@ -25,6 +26,7 @@ describe('BaseIconSymbology', function () { expect(icon.icon).to.have.string(base64pngNullData) expect(icon.icon).to.be.eq(base64png+base64pngNullData) expect(icon.title).to.be.eq('Null data') + expect(icon.type).to.be.eq('icon') }) it('ValidationError', function () { @@ -34,7 +36,7 @@ describe('BaseIconSymbology', function () { }) } catch(error) { expect(error.name).to.be.eq('ValidationError') - expect(error.message).to.be.eq('The cfg object has not enough properties compared to required!\n- The cfg properties: icon\n- The required properties: icon,title') + expect(error.message).to.be.eq('The properties: `title` are required in the cfg object!') expect(error).to.be.instanceOf(ValidationError) } }) @@ -53,6 +55,7 @@ describe('LayerIconSymbology', function () { expect(icon.icon).to.have.string(base64png) expect(icon.title).to.be.eq('layer_legend_single_symbol') expect(icon.name).to.be.eq('layer_legend_single_symbol') + expect(icon.type).to.be.eq('layer') }) it('Failing type', function () { @@ -96,6 +99,7 @@ describe('SymbolIconSymbology', function () { .that.be.instanceOf(SymbolIconSymbology) expect(icon.icon).to.have.string(base64png) expect(icon.title).to.be.eq('category 1') + expect(icon.type).to.be.eq('icon') expect(icon.ruleKey).to.be.eq('0') expect(icon.checked).to.be.true }) @@ -113,28 +117,29 @@ describe('SymbolIconSymbology', function () { expect(icon.icon).to.have.string(base64png) expect(icon.icon).to.have.string(base64pngNullData) expect(icon.title).to.be.eq('1:25000') + expect(icon.type).to.be.eq('icon') expect(icon.ruleKey).to.be.eq('{1a0c9345-0ffd-4743-bf78-82ca39f64d40}') expect(icon.checked).to.be.true }) it('Event', function () { - it('Valid', function () { - const icon = new SymbolIconSymbology({ - "icon":"iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAAU0lEQVQ4jWNgGAV0A4z4JJWVlf8j8+\/evYtTPQs+Q9YelkMRC7Zl+I\/LMKyC2AxBGPYIq8uYcLmIVDBEDLp79y5jsO0jkgwiKfphlpBkwyigPgAATTcaN5pMVDUAAAAASUVORK5CYII=", - "title":"category 1", - "ruleKey":"0", - "checked":true - }) - expect(icon).to.be.instanceOf(SymbolIconSymbology) - let symbologyChangedEvt = null; - icon.addListener(evt => { - symbologyChangedEvt = evt - }, 'symbol.checked.changed'); - expect(symbologyChangedEvt).to.not.be.null - expect(symbologyChangedEvt.title).to.be.eq('category 1') - expect(symbologyChangedEvt.ruleKey).to.be.eq('0') - expect(symbologyChangedEvt.checked).to.be.true + const icon = new SymbolIconSymbology({ + "icon":"iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAAU0lEQVQ4jWNgGAV0A4z4JJWVlf8j8+\/evYtTPQs+Q9YelkMRC7Zl+I\/LMKyC2AxBGPYIq8uYcLmIVDBEDLp79y5jsO0jkgwiKfphlpBkwyigPgAATTcaN5pMVDUAAAAASUVORK5CYII=", + "title":"category 1", + "ruleKey":"0", + "checked":true }) + expect(icon).to.be.instanceOf(SymbolIconSymbology) + expect(icon.checked).to.be.true + let symbologyChangedEvt = null; + icon.addListener(evt => { + symbologyChangedEvt = evt + }, 'symbol.checked.changed'); + icon.checked = false + expect(symbologyChangedEvt).to.not.be.null + expect(symbologyChangedEvt.title).to.be.eq('category 1') + expect(symbologyChangedEvt.ruleKey).to.be.eq('0') + expect(symbologyChangedEvt.checked).to.be.false }) it('Failing required properties', function () { @@ -165,6 +170,7 @@ describe('SymbolRuleSymbology', function () { .that.be.instanceOf(SymbolRuleSymbology) expect(icon.icon).to.have.string(base64png) expect(icon.title).to.be.eq('category 1') + expect(icon.type).to.be.eq('rule') expect(icon.ruleKey).to.be.eq('0') expect(icon.checked).to.be.true expect(icon.minScaleDenominator).to.be.eq(-1) @@ -187,6 +193,7 @@ describe('SymbolRuleSymbology', function () { .to.have.string(base64png) .that.have.string(base64pngNullData) expect(icon.title).to.be.eq('1:25000') + expect(icon.type).to.be.eq('rule') expect(icon.ruleKey).to.be.eq('{1a0c9345-0ffd-4743-bf78-82ca39f64d40}') expect(icon.checked).to.be.true expect(icon.minScaleDenominator).to.be.eq(-1) @@ -243,6 +250,8 @@ describe('BaseSymbolsSymbology', function () { }) expect(symbols).to.be.instanceOf(BaseSymbolsSymbology) expect(symbols.title).to.be.eq('hide_at_startup') + expect(symbols.type).to.be.eq('layer') + expect(symbols.expanded).to.be.false expect(symbols.childrenCount).to.be.eq(2) expect(symbols.children).to.be.an('array').that.have.lengthOf(2) @@ -255,6 +264,33 @@ describe('BaseSymbolsSymbology', function () { expect(symbolsGetChildren.next().value).to.be.instanceOf(BaseIconSymbology).that.be.eq(symbolsChildren[1]) }) + it('Event', function () { + const symbols = new BaseSymbolsSymbology({ + "symbols":[{ + "icon":"iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAAU0lEQVQ4jWNgGAV0A4z4JJWVlf8j8+\/evYtTPQs+Q9YelkMRC7Zl+I\/LMKyC2AxBGPYIq8uYcLmIVDBEDLp79y5jsO0jkgwiKfphlpBkwyigPgAATTcaN5pMVDUAAAAASUVORK5CYII=", + "title":"category 1" + },{ + "icon":"iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAAU0lEQVQ4jWNgGAV0A4z4JJWVlf8j8+\/evYtTPQs+Q4Q2HkUV9Lf+j8swrIJYDYGCd\/7WWF3GhMtFpIIhYtDdu3cZ3\/lbk2QQSdEPs4QkG0YB9QEAMC8aMZ0a06cAAAAASUVORK5CYII=", + "title":"category 2" + }], + "title":"hide_at_startup", + "type":"layer" + }) + expect(symbols).to.be.instanceOf(BaseSymbolsSymbology) + expect(symbols.expanded).to.be.false + + let expandedChangedEvt = null; + symbols.addListener(evt => { + expandedChangedEvt = evt + }, 'symbol.expanded.changed'); + symbols.expanded = true; + + expect(expandedChangedEvt).to.not.be.null + expect(expandedChangedEvt.title).to.be.eq('hide_at_startup') + expect(expandedChangedEvt.symbolType).to.be.eq('layer') + expect(expandedChangedEvt.expanded).to.be.true + }) + it('Failing required properties', function () { try { new BaseSymbolsSymbology({ @@ -292,6 +328,8 @@ describe('LayerSymbolsSymbology', function () { expect(symbology).to.be.instanceOf(LayerSymbolsSymbology) expect(symbology.title).to.be.eq('layer_legend_categorized') expect(symbology.name).to.be.eq('layer_legend_categorized') + expect(symbology.type).to.be.eq('layer') + expect(symbology.expanded).to.be.false expect(symbology.legendOn).to.be.true expect(symbology.childrenCount).to.be.eq(2) expect(symbology.children).to.be.an('array').that.have.lengthOf(2) @@ -345,6 +383,8 @@ describe('LayerSymbolsSymbology', function () { expect(symbology).to.be.instanceOf(LayerSymbolsSymbology) expect(symbology.title).to.be.eq('road') expect(symbology.name).to.be.eq('road') + expect(symbology.type).to.be.eq('layer') + expect(symbology.expanded).to.be.false expect(symbology.legendOn).to.be.true expect(symbology.childrenCount).to.be.eq(3) expect(symbology.children).to.be.an('array').that.have.length(3) @@ -355,10 +395,12 @@ describe('LayerSymbolsSymbology', function () { .that.be.instanceOf(SymbolIconSymbology) .that.be.instanceOf(SymbolRuleSymbology) expect(symbologyChildren[0].title).to.be.eq('1:25000') + expect(symbologyChildren[0].type).to.be.eq('rule') expect(symbologyChildren[0].minScaleDenominator).to.be.eq(1) expect(symbologyChildren[0].maxScaleDenominator).to.be.eq(25000) expect(symbologyChildren[0].checked).to.be.true expect(symbologyChildren[0].legendOn).to.be.true + expect(symbologyChildren[0].expanded).to.be.false expect(symbologyChildren[0].childrenCount).to.be.eq(10) expect(symbologyChildren[0].children).to.be.an('array').that.have.length(10) const symbologyChildrenFirstChildren = symbologyChildren[0].children @@ -367,12 +409,14 @@ describe('LayerSymbolsSymbology', function () { .that.be.instanceOf(SymbolIconSymbology) .that.be.instanceOf(SymbolRuleSymbology) expect(symbologyChildrenFirstChildren[0].title).to.be.eq('Motorway Link') + expect(symbologyChildrenFirstChildren[0].type).to.be.eq('rule') expect(symbologyChildrenFirstChildren[0].minScaleDenominator).to.be.eq(-1) expect(symbologyChildrenFirstChildren[0].maxScaleDenominator).to.be.eq(-1) expect(symbologyChildrenFirstChildren[0].checked).to.be.true expect(symbologyChildrenFirstChildren[0].parentRule).to.not.be.null expect(symbologyChildrenFirstChildren[0].parentRule.legendOn).to.be.true expect(symbologyChildrenFirstChildren[0].legendOn).to.be.true + expect(symbologyChildrenFirstChildren[0].expanded).to.be.false expect(symbologyChildrenFirstChildren[0].childrenCount).to.be.eq(0) expect(symbologyChildrenFirstChildren[0].children).to.be.an('array').that.have.length(0) expect(symbologyChildren[1]) @@ -380,10 +424,12 @@ describe('LayerSymbolsSymbology', function () { .that.be.instanceOf(SymbolIconSymbology) .that.be.instanceOf(SymbolRuleSymbology) expect(symbologyChildren[1].title).to.be.eq('25k to 50k') + expect(symbologyChildren[1].type).to.be.eq('rule') expect(symbologyChildren[1].minScaleDenominator).to.be.eq(25001) expect(symbologyChildren[1].maxScaleDenominator).to.be.eq(50000) expect(symbologyChildren[1].checked).to.be.true expect(symbologyChildren[1].legendOn).to.be.true + expect(symbologyChildren[1].expanded).to.be.false expect(symbologyChildren[1].childrenCount).to.be.eq(1) expect(symbologyChildren[1].children).to.be.an('array').that.have.length(1) expect(symbologyChildren[2]) @@ -391,10 +437,12 @@ describe('LayerSymbolsSymbology', function () { .that.be.instanceOf(SymbolIconSymbology) .that.be.instanceOf(SymbolRuleSymbology) expect(symbologyChildren[2].title).to.be.eq('50k +') + expect(symbologyChildren[2].type).to.be.eq('rule') expect(symbologyChildren[2].minScaleDenominator).to.be.eq(50001) expect(symbologyChildren[2].maxScaleDenominator).to.be.eq(10000000) expect(symbologyChildren[2].checked).to.be.true expect(symbologyChildren[2].legendOn).to.be.true + expect(symbologyChildren[2].expanded).to.be.false expect(symbologyChildren[2].childrenCount).to.be.eq(3) expect(symbologyChildren[2].children).to.be.an('array').that.have.length(3) @@ -601,6 +649,7 @@ describe('LayerGroupSymbology', function () { expect(symbology).to.be.instanceOf(LayerGroupSymbology) expect(symbology.title).to.be.eq('legend_option_test') expect(symbology.name).to.be.eq('legend_option_test') + expect(symbology.type).to.be.eq('group') expect(symbology.childrenCount).to.be.eq(3) expect(symbology.children).to.be.an('array').that.have.lengthOf(3) @@ -615,6 +664,62 @@ describe('LayerGroupSymbology', function () { expect(symbologyGetChildren.next().value).to.be.instanceOf(BaseSymbolsSymbology).that.be.eq(symbologyChildren[2]) }) + it('Event', function () { + const symbology = new LayerGroupSymbology({ + "nodes":[{ + "symbols":[{ + "icon":"iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAAU0lEQVQ4jWNgGAV0A4z4JJWVlf8j8+\/evYtTPQs+Q9YelkMRC7Zl+I\/LMKyC2AxBGPYIq8uYcLmIVDBEDLp79y5jsO0jkgwiKfphlpBkwyigPgAATTcaN5pMVDUAAAAASUVORK5CYII=", + "title":"category 1" + },{ + "icon":"iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAAU0lEQVQ4jWNgGAV0A4z4JJWVlf8j8+\/evYtTPQs+Q4Q2HkUV9Lf+j8swrIJYDYGCd\/7WWF3GhMtFpIIhYtDdu3cZ3\/lbk2QQSdEPs4QkG0YB9QEAMC8aMZ0a06cAAAAASUVORK5CYII=", + "title":"category 2" + }], + "title":"expand_at_startup", + "type":"layer" + },{ + "symbols":[{ + "icon":"iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAAU0lEQVQ4jWNgGAV0A4z4JJWVlf8j8+\/evYtTPQs+Q9YelkMRC7Zl+I\/LMKyC2AxBGPYIq8uYcLmIVDBEDLp79y5jsO0jkgwiKfphlpBkwyigPgAATTcaN5pMVDUAAAAASUVORK5CYII=", + "title":"category 1" + },{ + "icon":"iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAAU0lEQVQ4jWNgGAV0A4z4JJWVlf8j8+\/evYtTPQs+Q4Q2HkUV9Lf+j8swrIJYDYGCd\/7WWF3GhMtFpIIhYtDdu3cZ3\/lbk2QQSdEPs4QkG0YB9QEAMC8aMZ0a06cAAAAASUVORK5CYII=", + "title":"category 2" + }], + "title":"disabled", + "type":"layer" + },{ + "symbols":[{ + "icon":"iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAAU0lEQVQ4jWNgGAV0A4z4JJWVlf8j8+\/evYtTPQs+Q9YelkMRC7Zl+I\/LMKyC2AxBGPYIq8uYcLmIVDBEDLp79y5jsO0jkgwiKfphlpBkwyigPgAATTcaN5pMVDUAAAAASUVORK5CYII=", + "title":"category 1" + },{ + "icon":"iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAAU0lEQVQ4jWNgGAV0A4z4JJWVlf8j8+\/evYtTPQs+Q4Q2HkUV9Lf+j8swrIJYDYGCd\/7WWF3GhMtFpIIhYtDdu3cZ3\/lbk2QQSdEPs4QkG0YB9QEAMC8aMZ0a06cAAAAASUVORK5CYII=", + "title":"category 2" + }], + "title":"hide_at_startup", + "type":"layer" + }], + "type":"group", + "name":"legend_option_test", + "title":"legend_option_test" + }) + expect(symbology).to.be.instanceOf(LayerGroupSymbology) + expect(symbology.childrenCount).to.be.eq(3) + + let expandedChangedEvt = null; + symbology.addListener(evt => { + expandedChangedEvt = evt + }, 'symbol.expanded.changed'); + + const symbologyChildren = symbology.children + expect(symbologyChildren[1].expanded).to.be.false + symbologyChildren[1].expanded = true; + + expect(expandedChangedEvt).to.not.be.null + expect(expandedChangedEvt.title).to.be.eq('disabled') + expect(expandedChangedEvt.symbolType).to.be.eq('layer') + expect(expandedChangedEvt.expanded).to.be.true + }) + + it('Failing type', function () { try { new LayerGroupSymbology({ @@ -679,6 +784,7 @@ describe('buildLayerSymbology', function () { expect(icon.icon).to.have.string(base64png) expect(icon.title).to.be.eq('layer_legend_single_symbol') expect(icon.name).to.be.eq('layer_legend_single_symbol') + expect(icon.type).to.be.eq('layer') }) it('LayerSymbolsSymbology', function () { @@ -702,6 +808,8 @@ describe('buildLayerSymbology', function () { expect(symbology).to.be.instanceOf(LayerSymbolsSymbology) expect(symbology.title).to.be.eq('layer_legend_categorized') expect(symbology.name).to.be.eq('layer_legend_categorized') + expect(symbology.type).to.be.eq('layer') + expect(symbology.expanded).to.be.false expect(symbology.childrenCount).to.be.eq(2) expect(symbology.children).to.be.an('array').that.have.lengthOf(2) @@ -754,6 +862,7 @@ describe('buildLayerSymbology', function () { expect(symbology).to.be.instanceOf(LayerGroupSymbology) expect(symbology.title).to.be.eq('legend_option_test') expect(symbology.name).to.be.eq('legend_option_test') + expect(symbology.type).to.be.eq('group') expect(symbology.childrenCount).to.be.eq(3) expect(symbology.children).to.be.an('array').that.have.lengthOf(3)