egovamap 0.35.5 → 0.35.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1308,12 +1308,12 @@ var EGovaGISMap = function (
1308
1308
  });
1309
1309
  }
1310
1310
  /*if (context.sysConfig['PATROL_POS_WRITE_TO_FILE']) {
1311
- if (queryCondition) {
1312
- queryCondition = $.extend({}, queryCondition, { 'resourcetype': 2 });
1313
- } else {
1314
- queryCondition = { 'resourcetype': 2 };
1315
- }
1316
- }*/
1311
+ if (queryCondition) {
1312
+ queryCondition = $.extend({}, queryCondition, { 'resourcetype': 2 });
1313
+ } else {
1314
+ queryCondition = { 'resourcetype': 2 };
1315
+ }
1316
+ }*/
1317
1317
  scene.fire(
1318
1318
  msgPrefix + ":showObjectTrace",
1319
1319
  {
@@ -2173,7 +2173,8 @@ var EGovaGISMap = function (
2173
2173
  usePage,
2174
2174
  currentPage,
2175
2175
  numPerPage,
2176
- params
2176
+ params,
2177
+ cacheKey
2177
2178
  ) {
2178
2179
  var queryParam = {
2179
2180
  tableName: tableName,
@@ -2194,6 +2195,7 @@ var EGovaGISMap = function (
2194
2195
  usePage,
2195
2196
  currentPage,
2196
2197
  numPerPage,
2198
+ cacheKey,
2197
2199
  ],
2198
2200
  },
2199
2201
  parentScene,
@@ -2306,7 +2306,8 @@ var EGovaGISMap = function (
2306
2306
  usePage,
2307
2307
  currentPage,
2308
2308
  numPerPage,
2309
- params
2309
+ params,
2310
+ cacheKey
2310
2311
  ) {
2311
2312
  var queryParam = {
2312
2313
  tableName: tableName,
@@ -2328,7 +2329,8 @@ var EGovaGISMap = function (
2328
2329
  usePage,
2329
2330
  currentPage,
2330
2331
  numPerPage,
2331
- cb
2332
+ cb,
2333
+ cacheKey
2332
2334
  );
2333
2335
  };
2334
2336
 
@@ -1422,23 +1422,23 @@ var EGovaMap = function (
1422
1422
  return RGBA;
1423
1423
  }
1424
1424
  /**
1425
- * colorParse
1426
- * @desc 颜色字符串格式化
1427
- * "rgba(), rgb()格式的字符串输入,返回对象"
1428
- *
1429
- * @param {String} colorString 描述颜色的字符串,支持rgb和rgba格式
1430
- * @return {Object} result 如果输入格式正确,返回对象,否则返回false
1431
- * @example
1432
- {
1433
- red: 0.39215686274509803,
1434
- green: 0.49019607843137253,
1435
- blue: 0.8313725490196079,
1436
- alpha: 0.9
1437
- }
1438
- *
1439
- * @author: hth
1440
- * @date: 2021/2/24
1441
- * */
1425
+ * colorParse
1426
+ * @desc 颜色字符串格式化
1427
+ * "rgba(), rgb()格式的字符串输入,返回对象"
1428
+ *
1429
+ * @param {String} colorString 描述颜色的字符串,支持rgb和rgba格式
1430
+ * @return {Object} result 如果输入格式正确,返回对象,否则返回false
1431
+ * @example
1432
+ {
1433
+ red: 0.39215686274509803,
1434
+ green: 0.49019607843137253,
1435
+ blue: 0.8313725490196079,
1436
+ alpha: 0.9
1437
+ }
1438
+ *
1439
+ * @author: hth
1440
+ * @date: 2021/2/24
1441
+ * */
1442
1442
  function colorParse(colorString) {
1443
1443
  var result = {};
1444
1444
  // Remove all whitespaces from the color string
@@ -1647,7 +1647,7 @@ var EGovaMap = function (
1647
1647
  // By hth 2021/5/11: 如果颜色大于50,考虑到性能和可能卡死的问题,则直接采用随机颜色赋值且不考虑随机到重复色的情况
1648
1648
  var extraColor = getRandomColorArray(
1649
1649
  keyValueArray.length -
1650
- tempValue.length,
1650
+ tempValue.length,
1651
1651
  tempValue[0]
1652
1652
  );
1653
1653
  tempValue =
@@ -1684,10 +1684,10 @@ var EGovaMap = function (
1684
1684
  obj[key] =
1685
1685
  obj[key] ||
1686
1686
  tempValue[
1687
- Math.round(
1688
- Math.random() *
1689
- (colorLength - 1)
1690
- )
1687
+ Math.round(
1688
+ Math.random() *
1689
+ (colorLength - 1)
1690
+ )
1691
1691
  ];
1692
1692
  } else {
1693
1693
  obj[key] = obj[key] || tempValue[index];
@@ -2540,7 +2540,7 @@ var EGovaMap = function (
2540
2540
  };
2541
2541
 
2542
2542
  /* 二维轨迹设置轨迹参数 */
2543
- that.setTraceLayerOptions = function(options){
2543
+ that.setTraceLayerOptions = function (options) {
2544
2544
  if (scene == null) return;
2545
2545
  if (gisMap != null) {
2546
2546
  gisMap.setTraceLayerOptions(options);
@@ -2548,7 +2548,7 @@ var EGovaMap = function (
2548
2548
  }
2549
2549
 
2550
2550
  /* 二维轨迹获取轨迹播放状态 */
2551
- that.getTracePlayStatus = function(){
2551
+ that.getTracePlayStatus = function () {
2552
2552
  if (scene == null) return;
2553
2553
  if (gisMap != null) {
2554
2554
  return gisMap.getTracePlayStatus();
@@ -3011,7 +3011,8 @@ var EGovaMap = function (
3011
3011
  usePage,
3012
3012
  currentPage,
3013
3013
  numPerPage,
3014
- params
3014
+ params,
3015
+ cacheKey
3015
3016
  ) {
3016
3017
  if (!scene) return;
3017
3018
  if (gisMap) gisMap.queryObjectInfo.apply(this, arguments);
@@ -107,7 +107,11 @@ var egovamapMEx = function (gisMobileMap) {
107
107
  'showTraceHisGradientLayer',
108
108
  'setTraceHisGradientStatus',
109
109
  'countLength',
110
- 'xkRealTimeTrace'
110
+ 'xkRealTimeTrace',
111
+ 'closexkRealTimeTrace',
112
+ "initxkTrace",
113
+ "xkMoveTraceByTime",
114
+ "xkSetTraceStatus"
111
115
  ];
112
116
  methodEx = methodEx.concat(methodBusEx);
113
117
  for (let index = 0; index < methodEx.length; index++) {
@@ -1,317 +1,441 @@
1
- import MapUtils from './mapUtils';
1
+ import MapUtils from "./mapUtils";
2
2
 
3
3
  var scene = null;
4
4
  var _egovagismobileUrl = "";
5
5
  function getCookie(name) {
6
- var strCookie = window.document.cookie;
7
- var arrCookie = strCookie.split("; ");
8
- for (var i = 0; i < arrCookie.length; i++) {
9
- var arr = arrCookie[i].split("=");
10
- if (arr[0] == name)
11
- return arr[1];
12
- }
13
- return null;
14
- };
6
+ var strCookie = window.document.cookie;
7
+ var arrCookie = strCookie.split("; ");
8
+ for (var i = 0; i < arrCookie.length; i++) {
9
+ var arr = arrCookie[i].split("=");
10
+ if (arr[0] == name) return arr[1];
11
+ }
12
+ return null;
13
+ }
15
14
  function setCookie(name, value) {
16
- window.document.cookie = name + "=" + value;
15
+ window.document.cookie = name + "=" + value;
17
16
  }
18
17
 
19
18
  function checkGisServerURL(url, callback) {
20
- if(!url) return;
19
+ if (!url) return;
21
20
 
22
- var cookieUrl = getCookie("gisUrl");
23
- var gisProxyList = url.split(";");
24
- cookieUrl && gisProxyList.push(cookieUrl);
25
- if (gisProxyList.length <= 1) {
26
- if (url.indexOf("http") != 0) {
27
- url = window.location.origin + url;
28
- }
29
- callback(url);
30
- return;
21
+ var cookieUrl = getCookie("gisUrl");
22
+ var gisProxyList = url.split(";");
23
+ cookieUrl && gisProxyList.push(cookieUrl);
24
+ if (gisProxyList.length <= 1) {
25
+ if (url.indexOf("http") != 0) {
26
+ url = window.location.origin + url;
31
27
  }
32
- var params = {
33
- isLoad: false
34
- };
35
- for (var i in gisProxyList) {
36
- if (gisProxyList.hasOwnProperty(i)) {
37
- if (gisProxyList[i].indexOf("http") != 0) {
38
- gisProxyList[i] = window.location.origin + url;
39
- }
40
- checkGISProxy(gisProxyList[i], params, callback);
41
- }
28
+ callback(url);
29
+ return;
30
+ }
31
+ var params = {
32
+ isLoad: false,
33
+ };
34
+ for (var i in gisProxyList) {
35
+ if (gisProxyList.hasOwnProperty(i)) {
36
+ if (gisProxyList[i].indexOf("http") != 0) {
37
+ gisProxyList[i] = window.location.origin + url;
38
+ }
39
+ checkGISProxy(gisProxyList[i], params, callback);
42
40
  }
41
+ }
43
42
  }
44
43
 
45
44
  function trimEnd(str, c) {
46
- var rg = new RegExp(c);
47
- var i = str.length;
48
- while (rg.test(str.charAt(--i)));
49
- return str.slice(0, i + 1);
45
+ var rg = new RegExp(c);
46
+ var i = str.length;
47
+ while (rg.test(str.charAt(--i)));
48
+ return str.slice(0, i + 1);
50
49
  }
51
50
 
52
51
  function checkGISProxy(proxyUrl, params, callback) {
53
- var img = new Image();
54
- if (proxyUrl.indexOf("http") != 0) {
55
- proxyUrl = window.location.origin + "/" + proxyUrl;
52
+ var img = new Image();
53
+ if (proxyUrl.indexOf("http") != 0) {
54
+ proxyUrl = window.location.origin + "/" + proxyUrl;
55
+ }
56
+ img.src = trimEnd(proxyUrl, "/") + "/symbol/default.png";
57
+ img.onload = function (e1) {
58
+ if (!params.isLoad) {
59
+ params.isLoad = true;
60
+ setCookie("gisUrl", proxyUrl);
61
+ callback(proxyUrl);
56
62
  }
57
- img.src = trimEnd(proxyUrl, "/") + '/symbol/default.png';
58
- img.onload = function (e1) {
59
- if (!params.isLoad) {
60
- params.isLoad = true;
61
- setCookie("gisUrl", proxyUrl);
62
- callback(proxyUrl);
63
- }
64
- img = null;
65
- };
63
+ img = null;
64
+ };
66
65
  }
67
66
 
68
67
  function getLocalStorageItem(name) {
69
- if (localStorage) {
70
- return localStorage.getItem(name);
71
- } else {
72
- return null;
73
- }
68
+ if (localStorage) {
69
+ return localStorage.getItem(name);
70
+ } else {
71
+ return null;
72
+ }
74
73
  }
75
74
 
76
- var EGovaMobileMap = function ($container, pScene, prefix, gisParams, mapConfig, context, callback) {
77
- var that = this;
78
- scene = pScene;
79
- var parentScene = pScene.pageId || "parentScene";
80
- var msgPrefix = prefix || "mobilemappage";
81
- that.gisVisible = false;
82
- that.gisLoaded = false;
83
- that.isLoading = false;
75
+ var EGovaMobileMap = function (
76
+ $container,
77
+ pScene,
78
+ prefix,
79
+ gisParams,
80
+ mapConfig,
81
+ context,
82
+ callback
83
+ ) {
84
+ var that = this;
85
+ scene = pScene;
86
+ var parentScene = pScene.pageId || "parentScene";
87
+ var msgPrefix = prefix || "mobilemappage";
88
+ that.gisVisible = false;
89
+ that.gisLoaded = false;
90
+ that.isLoading = false;
84
91
 
85
- //that.$gisMapFrame = null;
86
- that.gisMapContainer = null;
87
- that.globeMapContainer = null;
88
- that.useMask = false;
89
- // if (context.mapCenterFlag == '2' && context.humanLayerUsageID && context.regionCode) {
90
- // that.useMask = true;
91
- // }
92
+ //that.$gisMapFrame = null;
93
+ that.gisMapContainer = null;
94
+ that.globeMapContainer = null;
95
+ that.useMask = false;
96
+ // if (context.mapCenterFlag == '2' && context.humanLayerUsageID && context.regionCode) {
97
+ // that.useMask = true;
98
+ // }
92
99
 
93
- that.id = msgPrefix ? msgPrefix + "_emap" : 'emap';
94
- that.gisDebug = (getLocalStorageItem('gisDebug')=='true');
95
- that.gisMapContainer = document.getElementById(that.id);
96
- if (!that.gisMapContainer) {
97
- var emapContainer = $container.getElementsByClassName('emap-container')[0];
98
- emapContainer && (emapContainer.style.display = 'none');
100
+ that.id = msgPrefix ? msgPrefix + "_emap" : "emap";
101
+ that.gisDebug = getLocalStorageItem("gisDebug") == "true";
102
+ that.gisMapContainer = document.getElementById(that.id);
103
+ if (!that.gisMapContainer) {
104
+ var emapContainer = $container.getElementsByClassName("emap-container")[0];
105
+ emapContainer && (emapContainer.style.display = "none");
99
106
 
100
- var emapIframe = $container.getElementsByClassName('emap-iframe')[0];
101
- emapIframe && (emapIframe.style.display = 'none');
107
+ var emapIframe = $container.getElementsByClassName("emap-iframe")[0];
108
+ emapIframe && (emapIframe.style.display = "none");
102
109
 
103
- var element = document.createElement("div");
104
- element.classList.add(that.id);
105
- element.id = that.id;
106
- $container.append(element);
107
- that.gisMapContainer = element;
108
- }
110
+ var element = document.createElement("div");
111
+ element.classList.add(that.id);
112
+ element.id = that.id;
113
+ $container.append(element);
114
+ that.gisMapContainer = element;
115
+ }
109
116
 
110
- that.onMapLoaded = function () {
111
- that.isLoading = false;
112
- that.gisLoaded = true;
113
- if (context.mapCenterFlag) {
114
- if (context.mapCenterFlag == '1') {
115
- if (context.coordinateX && context.coordinateY) {
116
- that.zoomToCenter(context.coordinateX, context.coordinateY, 4);
117
- }
118
- } else if (context.mapCenterFlag == '2') {
119
- //H5端遮罩未实现
120
- } else if (context.mapCenterFlag == '3') {
121
- //H5端遮罩未实现
122
- }
117
+ that.onMapLoaded = function () {
118
+ that.isLoading = false;
119
+ that.gisLoaded = true;
120
+ if (context.mapCenterFlag) {
121
+ if (context.mapCenterFlag == "1") {
122
+ if (context.coordinateX && context.coordinateY) {
123
+ that.zoomToCenter(context.coordinateX, context.coordinateY, 4);
123
124
  }
124
- callback && callback();
125
+ } else if (context.mapCenterFlag == "2") {
126
+ //H5端遮罩未实现
127
+ } else if (context.mapCenterFlag == "3") {
128
+ //H5端遮罩未实现
129
+ }
125
130
  }
131
+ callback && callback();
132
+ };
126
133
 
127
- that.init = function () {
128
- if (!that.gisLoaded && !that.isLoading) {
129
- that.isLoading = true;
130
- checkGisServerURL(context.gisServerURL, function (gisurl) {
131
- var gisServerURL = context.gisServerURL = gisurl;
132
- that.loadGISLibrary(gisServerURL);
133
- });
134
- }
134
+ that.init = function () {
135
+ if (!that.gisLoaded && !that.isLoading) {
136
+ that.isLoading = true;
137
+ checkGisServerURL(context.gisServerURL, function (gisurl) {
138
+ var gisServerURL = (context.gisServerURL = gisurl);
139
+ that.loadGISLibrary(gisServerURL);
140
+ });
135
141
  }
136
- /**
137
- * 地图显示
138
- *
139
- * @param res
140
- */
141
- that.openMap = function (evt) {
142
- if (!that.gisVisible) { // 初次定位时调整布局
143
- if (!that.gisLoaded && !that.isLoading) {
144
- that.isLoading = true;
145
- }
146
- if (that.gisMapContainer) {
147
- that.gisMapContainer.style.display = 'block';
148
- that.gisMapContainer.style.height = '100%';
149
- }
150
- that.gisVisible = true;
151
- }
142
+ };
143
+ /**
144
+ * 地图显示
145
+ *
146
+ * @param res
147
+ */
148
+ that.openMap = function (evt) {
149
+ if (!that.gisVisible) {
150
+ // 初次定位时调整布局
151
+ if (!that.gisLoaded && !that.isLoading) {
152
+ that.isLoading = true;
153
+ }
154
+ if (that.gisMapContainer) {
155
+ that.gisMapContainer.style.display = "block";
156
+ that.gisMapContainer.style.height = "100%";
157
+ }
158
+ that.gisVisible = true;
152
159
  }
160
+ };
153
161
 
154
- /**
155
- * 二维地图关闭
156
- */
157
- that.closeMap = function (evt) {
158
- if (that.gisMapContainer) {
159
- that.gisMapContainer.style.display = 'none';
160
- }
161
- that.gisVisible = false;
162
+ /**
163
+ * 二维地图关闭
164
+ */
165
+ that.closeMap = function (evt) {
166
+ if (that.gisMapContainer) {
167
+ that.gisMapContainer.style.display = "none";
162
168
  }
169
+ that.gisVisible = false;
170
+ };
163
171
 
164
- that.loadGISLibrary = function (gisServerURL) {
165
- var t = (new Date()).getTime();
166
- if(gisServerURL !== _egovagismobileUrl && _egovagismobileUrl){
167
- //如果第二次的GIS地址与上次不一致则删除上一次的,不考虑同一页面多个地图,地图GIS地址不一致的情况。(页面中始终只存在一个引用egovagis.js)
168
- var curScript = document.querySelector('script[egovagismobile="' + _egovagismobileUrl +'"]');
169
- var curLink = document.querySelector('link[egovagismobile="' + _egovagismobileUrl +'"]');
170
- if(curScript && curLink) {
171
- curScript.remove();
172
- curLink.remove();
173
- }
174
- }
175
- if(gisServerURL === _egovagismobileUrl){
176
- that.createMap();
177
- return;
178
- };
179
- _egovagismobileUrl = gisServerURL;
180
- // 如果是ie,加上polyfill
181
- if (document.documentMode) {
182
- var polyfill = document.createElement("script");
183
- polyfill.setAttribute("type", "text/javascript");
184
- polyfill.setAttribute("src", root + '/library/egovagismobile/build/dist/polyfill.js');
185
- document.body.appendChild(polyfill);
186
- }
187
- var mainScript = document.createElement('script');
188
- mainScript.setAttribute('type', 'text/javascript');
189
- var distOrSource = that.gisDebug ? 'source' : 'dist';
190
- var url = gisServerURL + '/library/egovagismobile/build/' + distOrSource + '/egovagis.js?t=' + t;
191
- var t = (new Date()).getTime();
192
- var mainScript = document.createElement('script');
193
- mainScript.setAttribute('egovagismobile', gisServerURL);
194
- mainScript.setAttribute('type', 'text/javascript');
195
- mainScript.setAttribute('src', url);
196
- mainScript.onload = that.createMap.bind(that);
197
- document.getElementsByTagName('head').item(0).appendChild(mainScript);
172
+ that.loadGISLibrary = function (gisServerURL) {
173
+ var t = new Date().getTime();
174
+ if (gisServerURL !== _egovagismobileUrl && _egovagismobileUrl) {
175
+ //如果第二次的GIS地址与上次不一致则删除上一次的,不考虑同一页面多个地图,地图GIS地址不一致的情况。(页面中始终只存在一个引用egovagis.js)
176
+ var curScript = document.querySelector(
177
+ 'script[egovagismobile="' + _egovagismobileUrl + '"]'
178
+ );
179
+ var curLink = document.querySelector(
180
+ 'link[egovagismobile="' + _egovagismobileUrl + '"]'
181
+ );
182
+ if (curScript && curLink) {
183
+ curScript.remove();
184
+ curLink.remove();
185
+ }
198
186
  }
199
- /**
200
- * enableScaleline、debugTile、useCache、humanID、useMask、token、closeDefaultTool(关闭自带工具)
201
- */
202
- that.createMap = function(){
203
- var params = {
204
- ...context,
205
- contain: that.id,
206
- serverURL: context.gisServerURL,
207
- configName: mapConfig.config,
208
- }
209
- var contextOptions = context.options;
210
- if(contextOptions && typeof contextOptions === "object") {
211
- for (var key in contextOptions) {
212
- params[key] = contextOptions[key];
213
- }
214
- }
215
- if (!window.eMapList) {
216
- window.eMapList = {};
217
- }
218
-
219
- if (typeof eMap === 'undefined') {
220
- console.error('eMap未初始化');
221
- return;
222
- }
223
-
224
- window.eMapList[that.id] = new eMap(
225
- params,
226
- that.onMapLoaded.bind(that));
187
+ if (gisServerURL === _egovagismobileUrl) {
188
+ that.createMap();
189
+ return;
190
+ }
191
+ _egovagismobileUrl = gisServerURL;
192
+ // 如果是ie,加上polyfill
193
+ if (document.documentMode) {
194
+ var polyfill = document.createElement("script");
195
+ polyfill.setAttribute("type", "text/javascript");
196
+ polyfill.setAttribute(
197
+ "src",
198
+ root + "/library/egovagismobile/build/dist/polyfill.js"
199
+ );
200
+ document.body.appendChild(polyfill);
201
+ }
202
+ var mainScript = document.createElement("script");
203
+ mainScript.setAttribute("type", "text/javascript");
204
+ var distOrSource = that.gisDebug ? "source" : "dist";
205
+ var url =
206
+ gisServerURL +
207
+ "/library/egovagismobile/build/" +
208
+ distOrSource +
209
+ "/egovagis.js?t=" +
210
+ t;
211
+ var t = new Date().getTime();
212
+ var mainScript = document.createElement("script");
213
+ mainScript.setAttribute("egovagismobile", gisServerURL);
214
+ mainScript.setAttribute("type", "text/javascript");
215
+ mainScript.setAttribute("src", url);
216
+ mainScript.onload = that.createMap.bind(that);
217
+ document.getElementsByTagName("head").item(0).appendChild(mainScript);
218
+ };
219
+ /**
220
+ * enableScaleline、debugTile、useCache、humanID、useMask、token、closeDefaultTool(关闭自带工具)
221
+ */
222
+ that.createMap = function () {
223
+ var params = {
224
+ ...context,
225
+ contain: that.id,
226
+ serverURL: context.gisServerURL,
227
+ configName: mapConfig.config,
228
+ };
229
+ var contextOptions = context.options;
230
+ if (contextOptions && typeof contextOptions === "object") {
231
+ for (var key in contextOptions) {
232
+ params[key] = contextOptions[key];
233
+ }
234
+ }
235
+ if (!window.eMapList) {
236
+ window.eMapList = {};
227
237
  }
228
238
 
229
- that.callMap = function () {
230
- if (!window.eMapList) return;
231
-
232
- var funcName = arguments[0],
233
- eMap = window.eMapList[that.id];
234
- if (eMap && eMap[funcName]) {
235
- var args = [];
236
- var curArgs = arguments[1];
237
- for (var i = 0, ilen = curArgs.length; i < ilen; i++) {
238
- if (context[curArgs[i]]) {
239
- args.push(proxy(context[curArgs[i]], context));
240
- } else if (typeof curArgs[i] == 'string') {
241
- args.push(convertJSON(curArgs[i]))
242
- } else {
243
- args.push(curArgs[i]);
244
- }
245
- }
246
- that.gisDebug && console.log(funcName);
247
- return eMap[funcName].apply(eMap, args);
248
- }
239
+ if (typeof eMap === "undefined") {
240
+ console.error("eMap未初始化");
241
+ return;
249
242
  }
250
243
 
251
- function convertJSON(str) {
252
- if (typeof str == 'string') {
253
- try {
254
- var obj = JSON.parse(str);
255
- if (typeof obj == 'object' && obj) {
256
- if (Object.prototype.toString.call(obj) === '[object Object]')
257
- obj = convertStyle(obj);
258
- return obj;
259
- } else {
260
- return str;
261
- }
244
+ window.eMapList[that.id] = new eMap(params, that.onMapLoaded.bind(that));
245
+ };
262
246
 
263
- } catch (e) {
264
- return str;
265
- }
247
+ that.callMap = function () {
248
+ if (!window.eMapList) return;
249
+
250
+ var funcName = arguments[0],
251
+ eMap = window.eMapList[that.id];
252
+ if (eMap && eMap[funcName]) {
253
+ var args = [];
254
+ var curArgs = arguments[1];
255
+ for (var i = 0, ilen = curArgs.length; i < ilen; i++) {
256
+ if (context[curArgs[i]]) {
257
+ args.push(proxy(context[curArgs[i]], context));
258
+ } else if (typeof curArgs[i] == "string") {
259
+ args.push(convertJSON(curArgs[i]));
260
+ } else {
261
+ args.push(curArgs[i]);
266
262
  }
263
+ }
264
+ that.gisDebug && console.log(funcName);
265
+ return eMap[funcName].apply(eMap, args);
267
266
  }
267
+ };
268
268
 
269
- function proxy(func, context) {
270
- return function () {
271
- var args = [];
272
- for (var i = 0; i < arguments.length; i++) {
273
- var arg = arguments[i];
274
- var type = Array.isArray(arg) ? 'array' : (typeof arg);
275
- if (arg && (type == 'object' || type == 'array')) {
276
- args.push(JSON.stringify(arg));
277
- } else {
278
- args.push(arg);
279
- }
280
- }
281
- var retVal = func.apply(context, args);
282
- if (typeof retVal == 'string') {
283
- retVal = convertJSON(retVal);
284
- }
285
- return retVal;
269
+ function convertJSON(str) {
270
+ if (typeof str == "string") {
271
+ try {
272
+ var obj = JSON.parse(str);
273
+ if (typeof obj == "object" && obj) {
274
+ if (Object.prototype.toString.call(obj) === "[object Object]")
275
+ obj = convertStyle(obj);
276
+ return obj;
277
+ } else {
278
+ return str;
286
279
  }
280
+ } catch (e) {
281
+ return str;
282
+ }
287
283
  }
284
+ }
288
285
 
286
+ function proxy(func, context) {
287
+ return function () {
288
+ var args = [];
289
+ for (var i = 0; i < arguments.length; i++) {
290
+ var arg = arguments[i];
291
+ var type = Array.isArray(arg) ? "array" : typeof arg;
292
+ if (arg && (type == "object" || type == "array")) {
293
+ args.push(JSON.stringify(arg));
294
+ } else {
295
+ args.push(arg);
296
+ }
297
+ }
298
+ var retVal = func.apply(context, args);
299
+ if (typeof retVal == "string") {
300
+ retVal = convertJSON(retVal);
301
+ }
302
+ return retVal;
303
+ };
304
+ }
289
305
 
290
- //方法挂载
291
- //地图接口
292
- var methodEx = ['animateMap','locateFeatureByCoords', 'clearGraphic', 'setGraphicStyle', 'removeMapLayer', 'drawGeometry', 'showRoute', 'clearSelectFeature', 'showWFSLayer', 'showWMSLayer', 'showWMSLayerV22', 'showGridVectorLayer', 'switchBaseLayer', 'clearControl', 'pointSelect', 'queryFeature', 'addPopup', 'setOverlaysVisible', 'removePopup', 'getMapCenter', 'getMapExtent', 'getFullExtent', 'measureArea', 'measureLength', 'clearMap', 'zoomIn', 'zoomOut', 'zoomToExtent', 'zoomToCenter', 'fullExtent', 'getUsageKeyField', 'getPartKeyField', 'buffer', 'setControlOption', 'getAddressList', 'getAddressByXY', 'convertCoords', 'getCenterPoints', 'registerGlobleEvent', 'removeGlobleEvent', 'getExtentByGeoms', 'addMaskLayer', 'getLayerGroupConfig', 'initVectorTile', 'mapDraw', 'setMapDrag', 'setLayerProperty','rotateRrecovery','rotationChangeBack','agsToWKT','getZoomInfo','bindMapEvent','removeMapEvent','getArea','getLength','getAllRegionByXY','pointInPolygon','addWMSLayer'];
293
- //业务接口
294
- var methodBusEx = ['markMap','getCellFieldByXY','getPhyFieldByXY','showMultiObjectCurrentPosition','highLightMultiObjectCurrentPosition','changeMultiObjectCurrentPositionAngle','showMultiObjectCurrentPositionCluster','highLightMultiObjectCurrentPositionCluster', 'addHeatMap', 'showGeoLocation', 'showTraceHisLayer', 'clearTraceHisLayer', 'showTraceMultiHisLayer','setTraceMultiState', 'getTraceMultiState', 'traceMultiSelectbyID', 'multiPointsSelectbyID', 'setTraceMultiOptions', 'updateTraceMultiPosition', 'showTraceHisData', 'setTraceState', 'getTraceState', 'setTraceOptions', 'updateTracePosition', 'showTraceSingleLayer', 'traceSingleAppendData', 'hideTraceSingle','setMultiPatrolDynamicPositionOption','showMultiPatrolDynamicPosition','startRealtimeTrace','stopRealtimeTrace','realtimeRrace','stopRealtime','removeRealtimeLayer','getTraceDataInteval', 'queryObjectInfo', 'queryPhylayerFields', 'addControl', 'addMapvLayer', 'removeMapvLayer', 'showTraceHisGradientLayer', 'setTraceHisGradientStatus', 'countLength', 'xkRealTimeTrace']
295
- methodEx = methodEx.concat(methodBusEx);
296
- for (let index = 0; index < methodEx.length; index++) {
297
- var funcName = methodEx[index];
298
- that[funcName] = function(method){
299
- return function (){
300
- return that.callMap(method,arguments);
301
- }
302
- }(funcName);
303
- }
306
+ //方法挂载
307
+ //地图接口
308
+ var methodEx = [
309
+ "animateMap",
310
+ "locateFeatureByCoords",
311
+ "clearGraphic",
312
+ "setGraphicStyle",
313
+ "removeMapLayer",
314
+ "drawGeometry",
315
+ "showRoute",
316
+ "clearSelectFeature",
317
+ "showWFSLayer",
318
+ "showWMSLayer",
319
+ "showWMSLayerV22",
320
+ "showGridVectorLayer",
321
+ "switchBaseLayer",
322
+ "clearControl",
323
+ "pointSelect",
324
+ "queryFeature",
325
+ "addPopup",
326
+ "setOverlaysVisible",
327
+ "removePopup",
328
+ "getMapCenter",
329
+ "getMapExtent",
330
+ "getFullExtent",
331
+ "measureArea",
332
+ "measureLength",
333
+ "clearMap",
334
+ "zoomIn",
335
+ "zoomOut",
336
+ "zoomToExtent",
337
+ "zoomToCenter",
338
+ "fullExtent",
339
+ "getUsageKeyField",
340
+ "getPartKeyField",
341
+ "buffer",
342
+ "setControlOption",
343
+ "getAddressList",
344
+ "getAddressByXY",
345
+ "convertCoords",
346
+ "getCenterPoints",
347
+ "registerGlobleEvent",
348
+ "removeGlobleEvent",
349
+ "getExtentByGeoms",
350
+ "addMaskLayer",
351
+ "getLayerGroupConfig",
352
+ "initVectorTile",
353
+ "mapDraw",
354
+ "setMapDrag",
355
+ "setLayerProperty",
356
+ "rotateRrecovery",
357
+ "rotationChangeBack",
358
+ "agsToWKT",
359
+ "getZoomInfo",
360
+ "bindMapEvent",
361
+ "removeMapEvent",
362
+ "getArea",
363
+ "getLength",
364
+ "getAllRegionByXY",
365
+ "pointInPolygon",
366
+ "addWMSLayer",
367
+ ];
368
+ //业务接口
369
+ var methodBusEx = [
370
+ "markMap",
371
+ "getCellFieldByXY",
372
+ "getPhyFieldByXY",
373
+ "showMultiObjectCurrentPosition",
374
+ "highLightMultiObjectCurrentPosition",
375
+ "changeMultiObjectCurrentPositionAngle",
376
+ "showMultiObjectCurrentPositionCluster",
377
+ "highLightMultiObjectCurrentPositionCluster",
378
+ "addHeatMap",
379
+ "showGeoLocation",
380
+ "showTraceHisLayer",
381
+ "clearTraceHisLayer",
382
+ "showTraceMultiHisLayer",
383
+ "setTraceMultiState",
384
+ "getTraceMultiState",
385
+ "traceMultiSelectbyID",
386
+ "multiPointsSelectbyID",
387
+ "setTraceMultiOptions",
388
+ "updateTraceMultiPosition",
389
+ "showTraceHisData",
390
+ "setTraceState",
391
+ "getTraceState",
392
+ "setTraceOptions",
393
+ "updateTracePosition",
394
+ "showTraceSingleLayer",
395
+ "traceSingleAppendData",
396
+ "hideTraceSingle",
397
+ "setMultiPatrolDynamicPositionOption",
398
+ "showMultiPatrolDynamicPosition",
399
+ "startRealtimeTrace",
400
+ "stopRealtimeTrace",
401
+ "realtimeRrace",
402
+ "stopRealtime",
403
+ "removeRealtimeLayer",
404
+ "getTraceDataInteval",
405
+ "queryObjectInfo",
406
+ "queryPhylayerFields",
407
+ "addControl",
408
+ "addMapvLayer",
409
+ "removeMapvLayer",
410
+ "showTraceHisGradientLayer",
411
+ "setTraceHisGradientStatus",
412
+ "countLength",
413
+ "xkRealTimeTrace",
414
+ "closexkRealTimeTrace",
415
+ "initxkTrace",
416
+ "xkMoveTraceByTime",
417
+ "xkSetTraceStatus"
418
+ ];
419
+ methodEx = methodEx.concat(methodBusEx);
420
+ for (let index = 0; index < methodEx.length; index++) {
421
+ var funcName = methodEx[index];
422
+ that[funcName] = (function (method) {
423
+ return function () {
424
+ return that.callMap(method, arguments);
425
+ };
426
+ })(funcName);
427
+ }
304
428
 
305
- /**
306
- * 获取移动端原始地图对象(主要为了调用原始ol方法)
307
- * @returns
308
- */
309
- that.getOriginalMap = function (){
310
- if (!window.eMapList) return;
311
- return window.eMapList[that.id];
312
- }
429
+ /**
430
+ * 获取移动端原始地图对象(主要为了调用原始ol方法)
431
+ * @returns
432
+ */
433
+ that.getOriginalMap = function () {
434
+ if (!window.eMapList) return;
435
+ return window.eMapList[that.id];
436
+ };
313
437
 
314
- that.init();
315
- }
438
+ that.init();
439
+ };
316
440
 
317
- export default EGovaMobileMap;
441
+ export default EGovaMobileMap;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "egovamap",
3
- "version": "0.35.5",
3
+ "version": "0.35.7",
4
4
  "description": "eUrbanGIS SDK",
5
5
  "main": "index.js",
6
6
  "scripts": {