Skip to content

Commit 64f3dae

Browse files
committed
【fix】简单修复ie下运行失败的问题 review by xiongjj
1 parent b78b0cc commit 64f3dae

File tree

7 files changed

+20
-20
lines changed

7 files changed

+20
-20
lines changed

src/common/commontypes/Util.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ SuperMap.Util.getParameterString = function (params) {
300300
SuperMap.Util.urlAppend = function (url, paramStr) {
301301
var newUrl = url;
302302
if (paramStr) {
303-
if(paramStr.startsWith('?')){
303+
if(paramStr.indexOf('?') === 0){
304304
paramStr = paramStr.substring(1);
305305
}
306306
var parts = (url + " ").split(/[?&]/);
@@ -322,11 +322,11 @@ SuperMap.Util.urlPathAppend = function (url, pathStr) {
322322
if (!pathStr) {
323323
return newUrl;
324324
}
325-
if (pathStr.startsWith('/')) {
325+
if (pathStr.indexOf('/') === 0) {
326326
pathStr = pathStr.substring(1);
327327
}
328328
const parts = url.split('?');
329-
if(!parts[0].endsWith('/')){
329+
if(!parts[0].indexOf('/', this.length - 1) !== -1){
330330
parts[0] += '/'
331331
}
332332
newUrl = `${parts[0]}${pathStr}${parts.length > 1 ? `?${parts[1]}` : ''}`;

src/common/format/Format.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,4 +63,4 @@ export class Format {
6363
}
6464
}
6565

66-
SuperMap.Format = Format;
66+
SuperMap.Format = SuperMap.Format || Format;

src/mapboxgl/mapping/WebMap.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ export class WebMap extends mapboxgl.Evented {
452452
tileMatrixSet[i]['ows:Identifier'] &&
453453
tileMatrixSet[i]['ows:Identifier']['_text'] === mapInfo.tileMatrixSet
454454
) {
455-
if (DEFAULT_WELLKNOWNSCALESET.includes(tileMatrixSet[i]['WellKnownScaleSet']['_text'])) {
455+
if (DEFAULT_WELLKNOWNSCALESET.indexOf(tileMatrixSet[i]['WellKnownScaleSet']['_text']) > -1) {
456456
isMatched = true;
457457
} else if (
458458
tileMatrixSet[i]['WellKnownScaleSet'] &&

src/openlayers/mapping/BaiduMap.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export class BaiduMap extends TileImage {
5353
var tempUrl = url.replace("{z}", tileCoord[0].toString())
5454
.replace("{x}", tileCoord[1].toString())
5555
.replace("{y}", function () {
56-
var y = ['4', '5'].includes(Util.getOlVersion()) ? tileCoord[2] : - tileCoord[2] - 1;
56+
var y = ['4', '5'].indexOf(Util.getOlVersion()) > -1 ? tileCoord[2] : - tileCoord[2] - 1;
5757
return y.toString();
5858
})
5959
.replace("{-y}", function () {

src/openlayers/mapping/TileSuperMapRest.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ export class TileSuperMapRest extends TileImage {
219219
me.origin = me.tileGrid.getOrigin(0);
220220
var z = tileCoord[0];
221221
var x = tileCoord[1];
222-
var y = ['4', '5'].includes(Util.getOlVersion()) ? - tileCoord[2] - 1 : tileCoord[2];
222+
var y = ['4', '5'].indexOf(Util.getOlVersion()) > -1 ? - tileCoord[2] - 1 : tileCoord[2];
223223
var resolution = me.tileGrid.getResolution(z);
224224
var dpi = 96;
225225
var unit = projection.getUnits() || Unit.DEGREE;

src/openlayers/mapping/WebMap.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,7 @@ export class WebMap extends Observable {
428428
zoom: 0,
429429
projection: proj
430430
}
431-
if(!['4', '5'].includes(Util.getOlVersion())) { // 兼容 ol 4,5,6
431+
if(['4', '5'].indexOf(Util.getOlVersion()) < 0) { // 兼容 ol 4,5,6
432432
viewOptions.multiWorld = true;
433433
}
434434
let view = new View(viewOptions);
@@ -645,7 +645,7 @@ export class WebMap extends Observable {
645645
if((baseLayer.visibleScales && baseLayer.visibleScales.length > 0) || (baseLayer.scales && baseLayer.scales.length >0)) {
646646
//底图有固定比例尺,就直接获取。不用view计算
647647
this.getScales(baseLayer);
648-
} else if(options.baseLayer && ['TILE', 'VECTOR_TILE'].includes(options.baseLayer.layerType) && extent && extent.length === 4){
648+
} else if(options.baseLayer && ['TILE', 'VECTOR_TILE'].indexOf(options.baseLayer.layerType) > -1 && extent && extent.length === 4){
649649
let width = extent[2] - extent[0];
650650
let height = extent[3] - extent[1];
651651
let maxResolution1 = width / 512;
@@ -673,7 +673,7 @@ export class WebMap extends Observable {
673673
this.getScales(baseLayer);
674674
}
675675
}
676-
if(!['4', '5'].includes(Util.getOlVersion())){ // 兼容 ol 4,5,6
676+
if(['4', '5'].indexOf(Util.getOlVersion()) < 0){ // 兼容 ol 4,5,6
677677
viewOptions.multiWorld = true;
678678
viewOptions.showFullExtent = true;
679679
viewOptions.enableRotation = false;
@@ -1272,7 +1272,7 @@ export class WebMap extends Observable {
12721272
}
12731273
//bug wmts出图需要加上origin,否则会出现出图不正确的情况。偏移或者瓦片出不了
12741274
let origin = tileMatrixSet[i].TileMatrix[0].TopLeftCorner;
1275-
layerInfo.origin = ["EPSG:4326", "EPSG:4490"].includes(wmtsLayerEpsg) ? [origin[1], origin[0]] : origin;
1275+
layerInfo.origin = ["EPSG:4326", "EPSG:4490"].indexOf(wmtsLayerEpsg) > -1 ? [origin[1], origin[0]] : origin;
12761276
break;
12771277
}
12781278
}
@@ -1961,7 +1961,7 @@ export class WebMap extends Observable {
19611961
let field = colTitles[j];
19621962
if (field === undefined || field === null) {continue;}
19631963
field = field.trim();
1964-
if(Object.keys(attributes).includes(field)) {
1964+
if(Object.keys(attributes).indexOf(field) > -1) {
19651965
//说明前面有个一模一样的字段
19661966
const newField = field + '_1';
19671967
attributes[newField] = rowDatas[j];
@@ -2402,10 +2402,10 @@ export class WebMap extends Observable {
24022402
lineDash: 'solid',
24032403
type: "BASIC_POINT"
24042404
};
2405-
if(["LINE", "LINESTRING", "MULTILINESTRING"].includes(featureType)){
2405+
if(["LINE", "LINESTRING", "MULTILINESTRING"].indexOf(featureType) > -1){
24062406
styleParameters.strokeColor = '#4CC8A3';
24072407
styleParameters.strokeWidth = 2;
2408-
}else if(["REGION", "POLYGON", "MULTIPOLYGON"].includes(featureType)){
2408+
}else if(["REGION", "POLYGON", "MULTIPOLYGON"].indexOf(featureType) > -1){
24092409
styleParameters.fillColor = '#826DBA';
24102410
}
24112411
return styleParameters;

src/openlayers/overlay/VectorTileSuperMapRest.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export class VectorTileSuperMapRest extends VectorTile {
4848
options.attributions =
4949
options.attributions ||
5050
"Tile Data <span>© <a href='http://support.supermap.com.cn/product/iServer.aspx' target='_blank'>SuperMap iServer</a></span> with <span>© <a href='https://iclient.supermap.io' target='_blank'>SuperMap iClient</a></span>";
51-
if (!['4', '5'].includes(Util.getOlVersion())) {
51+
if (['4', '5'].indexOf(Util.getOlVersion()) < 0) {
5252
options.tileSize = options.format instanceof MVT && options.style ? 512 : 256;
5353
}
5454
super({
@@ -73,7 +73,7 @@ export class VectorTileSuperMapRest extends VectorTile {
7373
urls: options.urls,
7474
wrapX: options.wrapX !== undefined ? options.wrapX : false,
7575
tileSize: options.tileSize || null,
76-
zDirection: ['4', '5'].includes(Util.getOlVersion()) ? null : 0
76+
zDirection: ['4', '5'].indexOf(Util.getOlVersion()) > -1 ? null : 0
7777
});
7878
var me = this;
7979
me.withCredentials = options.withCredentials;
@@ -102,7 +102,7 @@ export class VectorTileSuperMapRest extends VectorTile {
102102
var params = '';
103103
var z = tileCoord[0];
104104
var x = tileCoord[1];
105-
var y = ['4', '5'].includes(Util.getOlVersion()) ? -tileCoord[2] - 1 : tileCoord[2];
105+
var y = ['4', '5'].indexOf(Util.getOlVersion()) > -1 ? -tileCoord[2] - 1 : tileCoord[2];
106106
if (me.tileType === 'ZXY') {
107107
params = '&width=' + tileSize[0] + '&height=' + tileSize[1] + '&x=' + x + '&y=' + y + '&z=' + z;
108108
} else if (me.tileType === 'ViewBounds') {
@@ -161,7 +161,7 @@ export class VectorTileSuperMapRest extends VectorTile {
161161
.replace(zRegEx, tileCoord[0].toString())
162162
.replace(xRegEx, tileCoord[1].toString())
163163
.replace(yRegEx, function () {
164-
var y = ['4', '5'].includes(Util.getOlVersion()) ? -tileCoord[2] - 1 : tileCoord[2];
164+
var y = ['4', '5'].indexOf(Util.getOlVersion()) > -1 ? -tileCoord[2] - 1 : tileCoord[2];
165165
return y.toString();
166166
})
167167
.replace(dashYRegEx, function () {
@@ -232,7 +232,7 @@ export class VectorTileSuperMapRest extends VectorTile {
232232
units: 'tile-pixels'
233233
});
234234

235-
if (['4', '5'].includes(Util.getOlVersion())) {
235+
if (['4', '5'].indexOf(Util.getOlVersion()) > -1) {
236236
tile.setExtent([0, 0, width, height]);
237237
tile.setProjection(dataProjection);
238238
features = tile.getFormat().readFeatures(Util.toGeoJSON(features));
@@ -285,7 +285,7 @@ export class VectorTileSuperMapRest extends VectorTile {
285285
source = xhr.response;
286286
}
287287
if (source) {
288-
if (['4', '5'].includes(Util.getOlVersion())) {
288+
if (['4', '5'].indexOf(Util.getOlVersion()) > -1) {
289289
success.call(
290290
this,
291291
format.readFeatures(source, { featureProjection: projection }),

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy