Skip to content

Commit 772042a

Browse files
authored
Merge pull request #49 from zzhf/dc-leaflet
tiledMapLayer新增支持subdomains
2 parents e5c4a8e + adf3e00 commit 772042a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/leaflet/mapping/TiledMapLayer.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ import Attributions from '../core/Attributions'
4040
* @param {(number|L.Point)} [options.tileSize=256] - 瓦片大小。
4141
* @param {(SuperMap.NDVIParameter|SuperMap.HillshadeParameter)} [options.rasterfunction] - 栅格分析参数。
4242
* @param {string} [options.attribution='Map Data <span>© <a href='http://support.supermap.com.cn/product/iServer.aspx' title='SuperMap iServer' target='_blank'>SuperMap iServer</a></span>'] - 版权信息。
43+
* @param {Array.<number>} [options.subdomains] - 子域名数组。
4344
* @fires L.supermap.tiledMapLayer#tilesetsinfoloaded
4445
* @fires L.supermap.tiledMapLayer#tileversionschanged
4546
*/
@@ -68,7 +69,8 @@ export var TiledMapLayer = L.TileLayer.extend({
6869
format: 'png',
6970
//启用托管地址。
7071
tileProxy:null,
71-
attribution: Attributions.Common.attribution
72+
attribution: Attributions.Common.attribution,
73+
subdomains: null
7274
},
7375

7476
initialize: function (url, options) {
@@ -110,6 +112,9 @@ export var TiledMapLayer = L.TileLayer.extend({
110112
if (!this.options.cacheEnabled) {
111113
tileUrl += "&_t=" + new Date().getTime();
112114
}
115+
if (this.options.subdomains) {
116+
tileUrl = L.Util.template(tileUrl, {s: this._getSubdomain(coords)});
117+
}
113118
return tileUrl;
114119
},
115120

0 commit comments

Comments
 (0)