* @private * @function WebMap.prototype.getStyleResolutions * @description 创建图层分辨率。 * @param {Object} bounds 图层上下左右范围。 * @returns {Array} styleResolutions 样式分辨率。
(bounds, minZoom = 0, maxZoom = 22)
| 5190 | * @returns {Array} styleResolutions 样式分辨率。 |
| 5191 | */ |
| 5192 | getStyleResolutions(bounds, minZoom = 0, maxZoom = 22) { |
| 5193 | let styleResolutions = []; |
| 5194 | const TILE_SIZE = 512; |
| 5195 | let temp = Math.abs(bounds.left - bounds.right) / TILE_SIZE; |
| 5196 | for (let i = minZoom; i <= maxZoom; i++) { |
| 5197 | if (i === 0) { |
| 5198 | styleResolutions[i] = temp; |
| 5199 | continue; |
| 5200 | } |
| 5201 | temp = temp / 2; |
| 5202 | styleResolutions[i] = temp; |
| 5203 | } |
| 5204 | return styleResolutions; |
| 5205 | } |
| 5206 | |
| 5207 | /** |
| 5208 | * @private |
no outgoing calls
no test coverage detected