Skip to content

Commit 5932dc2

Browse files
committed
fix MVT不出图问题
1 parent becae28 commit 5932dc2

File tree

5 files changed

+38
-11
lines changed

5 files changed

+38
-11
lines changed

dist/iclient9-leaflet.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3071,13 +3071,13 @@ SuperMap.Request = {
30713071
url = this._processUrl(url);
30723072
url = SuperMap.Util.urlAppend(url, this._getParameterString(params || {}));
30733073
if (url.length <= 2000) {
3074+
if (SuperMap.Util.isInTheSameDomain(url) || (SuperMap.Support.cors && this._isMVTRequest(url))) {
3075+
return this._fetch(url, params, options, type);
3076+
}
30743077
if (!SuperMap.Util.isInTheSameDomain(url)) {
30753078
url = url.replace('.json', '.jsonp');
30763079
return this._fetchJsonp(url, options);
30773080
}
3078-
if (SuperMap.Support.cors) {
3079-
return this._fetch(url, params, options, type);
3080-
}
30813081
}
30823082
return this._postSimulatie(type, url.substring(0, url.indexOf('?') - 1), params, options);
30833083
},
@@ -3107,6 +3107,10 @@ SuperMap.Request = {
31073107
},
31083108

31093109
_processUrl: function (url) {
3110+
if (this._isMVTRequest(url)) {
3111+
return url;
3112+
}
3113+
31103114
if (url.indexOf('.json') === -1) {
31113115
if (url.indexOf("?") < 0) {
31123116
url += '.json'
@@ -3188,8 +3192,13 @@ SuperMap.Request = {
31883192
}
31893193
}
31903194
return paramsArray.join("&");
3195+
},
3196+
3197+
_isMVTRequest: function (url) {
3198+
return (url.indexOf('.mvt') > -1 || url.indexOf('.pbf') > -1);
31913199
}
31923200

3201+
31933202
};
31943203
module.exports = SuperMap.Request;
31953204

dist/iclient9-leaflet.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/iclient9-openlayers.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3003,13 +3003,13 @@ SuperMap.Request = {
30033003
url = this._processUrl(url);
30043004
url = SuperMap.Util.urlAppend(url, this._getParameterString(params || {}));
30053005
if (url.length <= 2000) {
3006+
if (SuperMap.Util.isInTheSameDomain(url) || (SuperMap.Support.cors && this._isMVTRequest(url))) {
3007+
return this._fetch(url, params, options, type);
3008+
}
30063009
if (!SuperMap.Util.isInTheSameDomain(url)) {
30073010
url = url.replace('.json', '.jsonp');
30083011
return this._fetchJsonp(url, options);
30093012
}
3010-
if (SuperMap.Support.cors) {
3011-
return this._fetch(url, params, options, type);
3012-
}
30133013
}
30143014
return this._postSimulatie(type, url.substring(0, url.indexOf('?') - 1), params, options);
30153015
},
@@ -3039,6 +3039,10 @@ SuperMap.Request = {
30393039
},
30403040

30413041
_processUrl: function (url) {
3042+
if (this._isMVTRequest(url)) {
3043+
return url;
3044+
}
3045+
30423046
if (url.indexOf('.json') === -1) {
30433047
if (url.indexOf("?") < 0) {
30443048
url += '.json'
@@ -3120,8 +3124,13 @@ SuperMap.Request = {
31203124
}
31213125
}
31223126
return paramsArray.join("&");
3127+
},
3128+
3129+
_isMVTRequest: function (url) {
3130+
return (url.indexOf('.mvt') > -1 || url.indexOf('.pbf') > -1);
31233131
}
31243132

3133+
31253134
};
31263135
module.exports = SuperMap.Request;
31273136

dist/iclient9-openlayers.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/common/util/Request.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@ SuperMap.Request = {
2929
url = this._processUrl(url);
3030
url = SuperMap.Util.urlAppend(url, this._getParameterString(params || {}));
3131
if (url.length <= 2000) {
32+
if (SuperMap.Util.isInTheSameDomain(url) || (SuperMap.Support.cors && this._isMVTRequest(url))) {
33+
return this._fetch(url, params, options, type);
34+
}
3235
if (!SuperMap.Util.isInTheSameDomain(url)) {
3336
url = url.replace('.json', '.jsonp');
3437
return this._fetchJsonp(url, options);
3538
}
36-
if (SuperMap.Support.cors) {
37-
return this._fetch(url, params, options, type);
38-
}
3939
}
4040
return this._postSimulatie(type, url.substring(0, url.indexOf('?') - 1), params, options);
4141
},
@@ -65,6 +65,10 @@ SuperMap.Request = {
6565
},
6666

6767
_processUrl: function (url) {
68+
if (this._isMVTRequest(url)) {
69+
return url;
70+
}
71+
6872
if (url.indexOf('.json') === -1) {
6973
if (url.indexOf("?") < 0) {
7074
url += '.json'
@@ -146,7 +150,12 @@ SuperMap.Request = {
146150
}
147151
}
148152
return paramsArray.join("&");
153+
},
154+
155+
_isMVTRequest: function (url) {
156+
return (url.indexOf('.mvt') > -1 || url.indexOf('.pbf') > -1);
149157
}
150158

159+
151160
};
152161
module.exports = SuperMap.Request;

0 commit comments

Comments
 (0)