(layerInfo, addedCallback)
| 810 | } |
| 811 | |
| 812 | _createZXYLayer(layerInfo, addedCallback) { |
| 813 | const { url, subdomains, layerID, name, visible, tileSize, resolutions, origin, minZoom: minzoom, maxZoom: maxzoom, mapBounds } = layerInfo; |
| 814 | const urls = (subdomains && subdomains.length) ? subdomains.map(item => url.replace('{s}', item)) : [url]; |
| 815 | const layerId = layerID || name; |
| 816 | const isSupport = this._isSupportZXYTileLayer({ resolutions, tileSize, origin }); |
| 817 | if (isSupport) { |
| 818 | const bounds = this._getSourceBounds(mapBounds); |
| 819 | this._addBaselayer({ url: urls, layerID: layerId, visibility: visible, minzoom, maxzoom, bounds, isIserver: false, tileSize }); |
| 820 | } else { |
| 821 | this.fire('xyztilelayernotsupport', { error: `The resolutions or origin of layer ${name} on XYZ Tile does not match the map`, error_code: 'XYZ_TILE_LAYER_NOT_SUPPORTED', layer: layerInfo}); |
| 822 | } |
| 823 | addedCallback && addedCallback(); |
| 824 | } |
| 825 | _getSourceBounds(mapBounds) { |
| 826 | if(!mapBounds) { |
| 827 | return; |
no test coverage detected