Skip to content

Commit 101d218

Browse files
committed
规范leaflet和openlayers服务的url和options参数的内部用法
1 parent 9235e4e commit 101d218

39 files changed

+416
-444
lines changed

dist/iclient9-leaflet.js

Lines changed: 195 additions & 224 deletions
Large diffs are not rendered by default.

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: 70 additions & 69 deletions
Large diffs are not rendered by default.

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/leaflet/mapping/TiledMapLayer.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ var SuperMap = require("../../common/SuperMap");
1111
var TiledMapLayer = L.TileLayer.extend({
1212

1313
options: {
14-
url: null,
1514
//如果有layersID,则是在使用专题图
1615
layersID: null,
1716
//如果为 true,则将请求重定向到图片的真实地址;如果为 false,则响应体中是图片的字节流

src/leaflet/overlay/TileVectorLayer.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ var SuperMap = require('../../common/SuperMap');
1313
var TileVectorLayer = L.VectorGrid.extend({
1414

1515
options: {
16-
url: null,
1716
//服务器类型<SuperMap.ServerType>iServer|iPortal|Online
1817
serverType: null,
1918
crs: null,
@@ -55,14 +54,14 @@ var TileVectorLayer = L.VectorGrid.extend({
5554
return this;
5655
}
5756

58-
me.options.url = url;
57+
me.url = url;
5958
if (url && url.indexOf("/") === (url.length - 1)) {
6059
url = url.substr(0, url.length - 1);
61-
me.options.url = url;
60+
me.url = url;
6261
}
6362
me._initLayerUrl();
6463
me.initLayersInfo();
65-
CartoCSSToLeaflet.mapUrl = me.options.url;
64+
CartoCSSToLeaflet.mapUrl = me.url;
6665
if (!me.options.serverCartoCSSStyle && me.options) {
6766
me.setClientCartoCSS(me.options.cartoCSS);
6867
}
@@ -79,7 +78,7 @@ var TileVectorLayer = L.VectorGrid.extend({
7978
//获取服务器layers资源下的风格信息(当CartoCSS中不存在相应图层渲染信息时使用)
8079
initLayersInfo: function () {
8180
var me = this;
82-
var layersUrl = me.options.url + "/layers.json";
81+
var layersUrl = me.url + "/layers.json";
8382
SuperMap.Request.get(layersUrl, null, {
8483
timeout: me.options.timeout
8584
}).then(function (response) {
@@ -149,7 +148,7 @@ var TileVectorLayer = L.VectorGrid.extend({
149148
//等待服务器的carto返回之后拼接本地配置的cartoCSS,并调用onAdd出图
150149
getVectorStylesFromServer: function () {
151150
var me = this;
152-
var vectorStyleUrl = me.options.url + "/tileFeature/vectorstyles.json";
151+
var vectorStyleUrl = me.url + "/tileFeature/vectorstyles.json";
153152
SuperMap.Request.get(vectorStyleUrl, null, {
154153
timeout: me.options.timeout
155154
}).then(function (response) {
@@ -312,13 +311,14 @@ var TileVectorLayer = L.VectorGrid.extend({
312311
},
313312

314313
_initLayerUrl: function () {
315-
var options = this.options;
316-
if (!options.url) {
314+
var me = this;
315+
var options = me.options;
316+
if (!me.url) {
317317
return;
318318
}
319319
var format = options.format.toString().toLowerCase();
320-
this._tileUrl = options.url + "/tileFeature." + format + "?";
321-
this._tileUrl += this._createURLParam(options);
320+
me._tileUrl = me.url + "/tileFeature." + format + "?";
321+
me._tileUrl += me._createURLParam(options);
322322
},
323323

324324
_createURLParam: function (options) {

src/leaflet/services/AddressService.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ var AddressService = ServiceBase.extend({
2727
code: function (params, callback, resultFormat) {
2828
var me = this,
2929
format = me._processFormat(resultFormat);
30-
var addressService = new CommonAddressService(me.options.url, {
30+
var addressService = new CommonAddressService(me.url, {
3131
serverType: me.options.serverType,
3232
eventListeners: {
3333
scope: me,
@@ -36,7 +36,7 @@ var AddressService = ServiceBase.extend({
3636
},
3737
format: format
3838
});
39-
addressService.code(me.options.url + '/geocoding', params);
39+
addressService.code(me.url + '/geocoding', params);
4040
return me;
4141
},
4242

@@ -49,7 +49,7 @@ var AddressService = ServiceBase.extend({
4949
decode: function (params, callback, resultFormat) {
5050
var me = this,
5151
format = me._processFormat(resultFormat);
52-
var addressService = new CommonAddressService(me.options.url, {
52+
var addressService = new CommonAddressService(me.url, {
5353
serverType: me.options.serverType,
5454
eventListeners: {
5555
scope: me,
@@ -58,7 +58,7 @@ var AddressService = ServiceBase.extend({
5858
},
5959
format: format
6060
});
61-
addressService.decode(me.options.url + '/geodecoding', params);
61+
addressService.decode(me.url + '/geodecoding', params);
6262
return me;
6363
},
6464

src/leaflet/services/ChartService.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ var ChartService = ServiceBase.extend({
2929
var me = this,
3030
param = me._processParams(params),
3131
format = me._processFormat(resultFormat);
32-
var chartQueryService = new ChartQueryService(me.options.url, {
32+
var chartQueryService = new ChartQueryService(me.url, {
3333
serverType: me.options.serverType,
3434
eventListeners: {
3535
scope: me,
@@ -47,7 +47,7 @@ var ChartService = ServiceBase.extend({
4747
* 海图物标信息服务
4848
*/
4949
getChartFeatureInfo: function (callback) {
50-
var me = this, url = me.options.url.concat();
50+
var me = this, url = me.url.concat();
5151
url += "/chartFeatureInfoSpecs";
5252
var chartFeatureInfoSpecsService = new ChartFeatureInfoSpecsService(url, {
5353
serverType: me.options.serverType,

src/leaflet/services/FeatureService.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ var FeatureService = ServiceBase.extend({
3535
*/
3636
getFeaturesByIDs: function (params, callback, resultFormat) {
3737
var me = this;
38-
var getFeaturesByIDsService = new GetFeaturesByIDsService(me.options.url, {
38+
var getFeaturesByIDsService = new GetFeaturesByIDsService(me.url, {
3939
serverType: me.options.serverType,
4040
eventListeners: {
4141
processCompleted: callback,
@@ -57,7 +57,7 @@ var FeatureService = ServiceBase.extend({
5757
*/
5858
getFeaturesByBounds: function (params, callback, resultFormat) {
5959
var me = this;
60-
var getFeaturesByBoundsService = new GetFeaturesByBoundsService(me.options.url, {
60+
var getFeaturesByBoundsService = new GetFeaturesByBoundsService(me.url, {
6161
serverType: me.options.serverType,
6262
eventListeners: {
6363
processCompleted: callback,
@@ -78,7 +78,7 @@ var FeatureService = ServiceBase.extend({
7878
*/
7979
getFeaturesByBuffer: function (params, callback, resultFormat) {
8080
var me = this;
81-
var getFeatureService = new GetFeaturesByBufferService(me.options.url, {
81+
var getFeatureService = new GetFeaturesByBufferService(me.url, {
8282
serverType: me.options.serverType,
8383
eventListeners: {
8484
processCompleted: callback,
@@ -99,7 +99,7 @@ var FeatureService = ServiceBase.extend({
9999
*/
100100
getFeaturesBySQL: function (params, callback, resultFormat) {
101101
var me = this;
102-
var getFeatureBySQLService = new GetFeaturesBySQLService(me.options.url, {
102+
var getFeatureBySQLService = new GetFeaturesBySQLService(me.url, {
103103
serverType: me.options.serverType,
104104
eventListeners: {
105105
processCompleted: callback,
@@ -120,7 +120,7 @@ var FeatureService = ServiceBase.extend({
120120
*/
121121
getFeaturesByGeometry: function (params, callback, resultFormat) {
122122
var me = this;
123-
var getFeaturesByGeometryService = new GetFeaturesByGeometryService(me.options.url, {
123+
var getFeaturesByGeometryService = new GetFeaturesByGeometryService(me.url, {
124124
serverType: me.options.serverType,
125125
eventListeners: {
126126
processCompleted: callback,
@@ -146,7 +146,7 @@ var FeatureService = ServiceBase.extend({
146146
}
147147

148148
var me = this,
149-
url = me.options.url,
149+
url = me.url,
150150
dataSourceName = params.dataSourceName,
151151
dataSetName = params.dataSetName;
152152

src/leaflet/services/FieldService.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ var FieldService = ServiceBase.extend({
3030
*/
3131
getFields: function (callback) {
3232
var me = this;
33-
var getFieldsService = new GetFieldsService(me.options.url, {
33+
var getFieldsService = new GetFieldsService(me.url, {
3434
serverType: me.options.serverType,
3535
eventListeners: {
3636
scope: me,
@@ -70,7 +70,7 @@ var FieldService = ServiceBase.extend({
7070

7171
_fieldStatisticRequest: function (fieldName, statisticMode) {
7272
var me = this;
73-
var statisticService = new FieldStatisticService(me.options.url, {
73+
var statisticService = new FieldStatisticService(me.url, {
7474
eventListeners: {
7575
scope: me,
7676
processCompleted: me._processCompleted,

0 commit comments

Comments
 (0)