@@ -1479,9 +1479,10 @@ export class WebMap extends Observable {
1479
1479
dataSource = layer . dataSource ,
1480
1480
isSampleData = dataSource && dataSource . type === "SAMPLE_DATA" && ! ! dataSource . name ; //SAMPLE_DATA是本地示例数据
1481
1481
if ( layer . layerType === "MAPBOXSTYLE" ) {
1482
- that . addMVTMapLayer ( mapInfo , layer , layerIndex ) ;
1483
- that . layerAdded ++ ;
1484
- that . sendMapToUser ( len ) ;
1482
+ that . addMVTMapLayer ( mapInfo , layer , layerIndex ) . then ( result => {
1483
+ that . layerAdded ++ ;
1484
+ that . sendMapToUser ( len ) ;
1485
+ } ) ;
1485
1486
} else if ( ( dataSource && dataSource . serverId ) || layer . layerType === "MARKER" || layer . layerType === 'HOSTED_TILE' || isSampleData ) {
1486
1487
//数据存储到iportal上了
1487
1488
let dataSource = layer . dataSource ,
@@ -1523,8 +1524,8 @@ export class WebMap extends Observable {
1523
1524
features = await that . excelData2Feature ( data . content , layer ) ;
1524
1525
}
1525
1526
} else if ( data . type === 'SHP' ) {
1526
- let content = JSON . parse ( data . content ) ;
1527
- data . content = content . layers [ 0 ] ;
1527
+ let content = JSON . parse ( data . content ) ;
1528
+ data . content = content . layers [ 0 ] ;
1528
1529
features = that . geojsonToFeature ( data . content , layer ) ;
1529
1530
}
1530
1531
that . addLayer ( layer , features , layerIndex ) ;
@@ -1585,14 +1586,16 @@ export class WebMap extends Observable {
1585
1586
if ( layer . layerType === "WMTS" ) {
1586
1587
that . getWmtsInfo ( layer , function ( layerInfo ) {
1587
1588
that . map . addLayer ( that . createBaseLayer ( layerInfo , layerIndex ) ) ;
1589
+ that . layerAdded ++ ;
1590
+ that . sendMapToUser ( len ) ;
1588
1591
} )
1589
1592
} else {
1590
1593
that . getLayerExtent ( layer , function ( layerInfo ) {
1591
1594
that . map . addLayer ( that . createBaseLayer ( layerInfo , layerIndex ) ) ;
1595
+ that . layerAdded ++ ;
1596
+ that . sendMapToUser ( len ) ;
1592
1597
} ) ;
1593
1598
}
1594
- that . layerAdded ++ ;
1595
- that . sendMapToUser ( len ) ;
1596
1599
} else if ( dataSource && dataSource . type === "REST_DATA" ) {
1597
1600
//从restData获取数据
1598
1601
that . getFeaturesFromRestData ( layer , layerIndex , len ) ;
@@ -1928,7 +1931,7 @@ export class WebMap extends Observable {
1928
1931
} else {
1929
1932
xIdx = dataMetaInfo . xIndex ;
1930
1933
yIdx = dataMetaInfo . yIndex ;
1931
- }
1934
+ }
1932
1935
} else if ( dataSource . type === 'SAMPLE_DATA' ) {
1933
1936
// 示例数据从本地拿xyField
1934
1937
const sampleData = SampleDataInfo . find ( item => item . id === dataSource . name ) || { } ;
@@ -1968,7 +1971,7 @@ export class WebMap extends Observable {
1968
1971
} else {
1969
1972
attributes [ field ] = rowDatas [ j ] ;
1970
1973
}
1971
-
1974
+
1972
1975
}
1973
1976
let feature = new Feature ( {
1974
1977
geometry : olGeom ,
@@ -2650,7 +2653,7 @@ export class WebMap extends Observable {
2650
2653
let newStyle ;
2651
2654
if ( featureType === 'LINE' && Util . isArray ( style ) ) {
2652
2655
const [ outlineStyle , strokeStyle ] = style ;
2653
- newStyle = strokeStyle . lineDash === 'solid' ? StyleUtils . getRoadPath ( strokeStyle , outlineStyle )
2656
+ newStyle = strokeStyle . lineDash === 'solid' ? StyleUtils . getRoadPath ( strokeStyle , outlineStyle )
2654
2657
: StyleUtils . getPathway ( strokeStyle , outlineStyle ) ;
2655
2658
} else {
2656
2659
newStyle = StyleUtils . toOpenLayersStyle ( layerInfo . style , layerInfo . featureType ) ;
@@ -3597,7 +3600,7 @@ export class WebMap extends Observable {
3597
3600
//有token之类的配置项
3598
3601
url = url . indexOf ( "?" ) === - 1 ? `${ url } ?${ this . credentialKey } =${ this . credentialValue } ` :
3599
3602
`${ url } &${ this . credentialKey } =${ this . credentialValue } ` ;
3600
- }
3603
+ }
3601
3604
return url ;
3602
3605
}
3603
3606
@@ -4291,17 +4294,17 @@ export class WebMap extends Observable {
4291
4294
isSupportWebp ( url , token ) {
4292
4295
// 还需要判断浏览器
4293
4296
let isIE = this . isIE ( ) ;
4294
- if ( isIE || ( this . isFirefox ( ) && this . getFirefoxVersion ( ) < 65 ) ||
4297
+ if ( isIE || ( this . isFirefox ( ) && this . getFirefoxVersion ( ) < 65 ) ||
4295
4298
( this . isChrome ( ) && this . getChromeVersion ( ) < 32 ) ) {
4296
4299
return false ;
4297
- }
4300
+ }
4298
4301
url = token ? `${ url } /tileImage.webp?token=${ token } ` : `${ url } /tileImage.webp` ;
4299
4302
url = this . getRequestUrl ( url ) ;
4300
4303
return FetchRequest . get ( url , null , {
4301
4304
withCredentials : this . withCredentials
4302
4305
} ) . then ( function ( response ) {
4303
4306
if ( response . status !== 200 ) {
4304
- throw response . status ;
4307
+ throw response . status ;
4305
4308
}
4306
4309
return response ;
4307
4310
} ) . then ( ( ) => {
0 commit comments