@@ -1232,10 +1232,11 @@ export class WebMap extends Observable {
1232
1232
layerInfo . visibleScales = result . visibleScales ;
1233
1233
layerInfo . extent = [ result . bounds . left , result . bounds . bottom , result . bounds . right , result . bounds . top ] ;
1234
1234
layerInfo . projection = `EPSG:${ result . prjCoordSys . epsgCode } ` ;
1235
- let token = layerInfo . credential ? layerInfo . credential . token : undefined ;
1236
- let isSupprtWebp = await that . isSupportWebp ( layerInfo . url , token ) ;
1235
+ // let token = layerInfo.credential ? layerInfo.credential.token : undefined;
1236
+ // let isSupprtWebp = await that.isSupportWebp(layerInfo.url, token);
1237
1237
// eslint-disable-next-line require-atomic-updates
1238
- layerInfo . format = isSupprtWebp ? 'webp' : 'png' ;
1238
+ // layerInfo.format = isSupprtWebp ? 'webp' : 'png';
1239
+ layerInfo . format = 'png' ;
1239
1240
callback ( layerInfo ) ;
1240
1241
} else {
1241
1242
layerInfo . projection = that . baseProjection ;
@@ -1276,10 +1277,11 @@ export class WebMap extends Observable {
1276
1277
}
1277
1278
layerInfo . maxZoom = result . maxZoom ;
1278
1279
layerInfo . maxZoom = result . minZoom ;
1279
- let token = layerInfo . credential ? layerInfo . credential . token : undefined ;
1280
- let isSupprtWebp = await that . isSupportWebp ( layerInfo . url , token ) ;
1280
+ // let token = layerInfo.credential ? layerInfo.credential.token : undefined;
1281
+ // let isSupprtWebp = await that.isSupportWebp(layerInfo.url, token);
1281
1282
// eslint-disable-next-line require-atomic-updates
1282
- layerInfo . format = isSupprtWebp ? 'webp' : 'png' ;
1283
+ // layerInfo.format = isSupprtWebp ? 'webp' : 'png';
1284
+ layerInfo . format = 'png' ;
1283
1285
// 请求结果完成 继续添加图层
1284
1286
if ( mapInfo ) {
1285
1287
//todo 这个貌似没有用到,下次优化
@@ -4520,36 +4522,36 @@ export class WebMap extends Observable {
4520
4522
* @param {* } token 服务token
4521
4523
* @returns {boolean }
4522
4524
*/
4523
- isSupportWebp ( url , token ) {
4524
- // 还需要判断浏览器
4525
- let isIE = this . isIE ( ) ;
4526
- if ( isIE || ( this . isFirefox ( ) && this . getFirefoxVersion ( ) < 65 ) ||
4527
- ( this . isChrome ( ) && this . getChromeVersion ( ) < 32 ) ) {
4528
- return false ;
4529
- }
4530
- url = token ? `${ url } /tileImage.webp?token=${ token } ` : `${ url } /tileImage.webp` ;
4531
- let isSameDomain = CommonUtil . isInTheSameDomain ( url ) , excledeCreditial ;
4532
- if ( isSameDomain && ! token ) {
4533
- // online上服务域名一直,要用token值
4534
- excledeCreditial = false ;
4535
- } else {
4536
- excledeCreditial = true ;
4537
- }
4538
- url = this . getRequestUrl ( url , excledeCreditial ) ;
4539
- return FetchRequest . get ( url , null , {
4540
- withCredentials : this . withCredentials ,
4541
- withoutFormatSuffix : true
4542
- } ) . then ( function ( response ) {
4543
- if ( response . status !== 200 ) {
4544
- throw response . status ;
4545
- }
4546
- return response ;
4547
- } ) . then ( ( ) => {
4548
- return true ;
4549
- } ) . catch ( ( ) => {
4550
- return false ;
4551
- } )
4552
- }
4525
+ // isSupportWebp(url, token) {
4526
+ // // 还需要判断浏览器
4527
+ // let isIE = this.isIE();
4528
+ // if (isIE || (this.isFirefox() && this.getFirefoxVersion() < 65) ||
4529
+ // (this.isChrome() && this.getChromeVersion() < 32)) {
4530
+ // return false;
4531
+ // }
4532
+ // url = token ? `${url}/tileImage.webp?token=${token}` : `${url}/tileImage.webp`;
4533
+ // let isSameDomain = CommonUtil.isInTheSameDomain(url), excledeCreditial;
4534
+ // if (isSameDomain && !token) {
4535
+ // // online上服务域名一直,要用token值
4536
+ // excledeCreditial = false;
4537
+ // } else {
4538
+ // excledeCreditial = true;
4539
+ // }
4540
+ // url = this.getRequestUrl(url, excledeCreditial);
4541
+ // return FetchRequest.get(url, null, {
4542
+ // withCredentials: this.withCredentials,
4543
+ // withoutFormatSuffix: true
4544
+ // }).then(function (response) {
4545
+ // if (response.status !== 200) {
4546
+ // throw response.status;
4547
+ // }
4548
+ // return response;
4549
+ // }).then(() => {
4550
+ // return true;
4551
+ // }).catch(() => {
4552
+ // return false;
4553
+ // })
4554
+ // }
4553
4555
/**
4554
4556
* @private
4555
4557
* @function ol.supermap.WebMap.prototype.isIE
0 commit comments