egovamap 0.20.0 → 0.21.0

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.
@@ -647,14 +647,14 @@ var egovaBI = function(globeMap, gisMap, mapType){
647
647
  * @author: Hetianhong
648
648
  * @date: 2021-10-19 17:27:02
649
649
  */
650
- this.regionOperation = function (options, data, callback) {
650
+ this.regionOperation = function (options, data, callback,dataLoadCb) {
651
651
 
652
652
  function execOperation(data) {
653
653
  if (globeMap) {
654
654
  globeMap.regionOperation(options, data);
655
655
  callback && callback();
656
656
  } else if (gisMap) {
657
- gridPolygon2dOperation(options, data, callback);
657
+ gridPolygon2dOperation(options, data, callback,dataLoadCb);
658
658
  }
659
659
  }
660
660
 
@@ -848,7 +848,7 @@ var egovaBI = function(globeMap, gisMap, mapType){
848
848
  * @param {Array} filter.values 过滤值内容数组
849
849
  *
850
850
  * @return {返回值类型} 返回值说明
851
- *
851
+ *dataLoadCb:加载状态函数
852
852
  * @author: Hetianhong
853
853
  * @date: 2021-11-26 09:49:16
854
854
  */
@@ -861,7 +861,7 @@ var egovaBI = function(globeMap, gisMap, mapType){
861
861
  }
862
862
  }
863
863
 
864
- function gridPolygon2dOperation(options, data, callback) {
864
+ function gridPolygon2dOperation(options, data, callback,dataLoadCb) {
865
865
  var storeName = `usage2D_${options.idbSetting.usageID}`;
866
866
  function showGrid(realData) {
867
867
  // 转换一下
@@ -906,6 +906,18 @@ var egovaBI = function(globeMap, gisMap, mapType){
906
906
  geometries = colorConfig.data;
907
907
  color = colorConfig.color;
908
908
  }
909
+ var lfcOpt = {
910
+ minZoom: options.visiblitySetting.beginLevel,
911
+ maxZoom: options.visiblitySetting.endLevel,
912
+ layerId: options.layerName,
913
+ comCallbak: callback,
914
+ order: options.order
915
+ // hLabelStyle: options.hLabelStyle, // 选中文字时效果,没用
916
+ };
917
+ if (options.labelSetting.labelZoomEnabled == 'show') {
918
+ lfcOpt.labelMinZoom = options.labelSetting.labelMinZoom;
919
+ lfcOpt.labelMaxZoom = options.labelSetting.labelMaxZoom;
920
+ }
909
921
  gisMap.locateFeatureByCoords(geometries, 'polygon',
910
922
  options.layerName, // id,如果已经有attributes就没用了
911
923
  options.style, // style
@@ -917,18 +929,23 @@ var egovaBI = function(globeMap, gisMap, mapType){
917
929
  color,
918
930
  false, // renderCanvas
919
931
  true, // singleSelect
920
- {
932
+ lfcOpt,
933
+ options.layerName, // layerTag
934
+ options.eventSetting.clickCallback,
935
+ options.eventSetting.mouseMoveCallback
936
+ );
937
+ if (extraGeometries.length) {
938
+ var lfceOpt = {
921
939
  minZoom: options.visiblitySetting.beginLevel,
922
940
  maxZoom: options.visiblitySetting.endLevel,
923
941
  layerId: options.layerName,
924
- comCallbak: callback,
925
942
  order: options.order
926
943
  // hLabelStyle: options.hLabelStyle, // 选中文字时效果,没用
927
- },
928
- options.layerName, // layerTag
929
- options.eventSetting.clickCallback
930
- );
931
- if (extraGeometries.length) {
944
+ };
945
+ if (options.labelSetting.labelZoomEnabled == 'show') {
946
+ lfceOpt.labelMinZoom = options.labelSetting.labelMinZoom;
947
+ lfceOpt.labelMaxZoom = options.labelSetting.labelMaxZoom;
948
+ }
932
949
  gisMap.locateFeatureByCoords(extraGeometries, 'polygon',
933
950
  options.layerName, // id,如果已经有attributes就没用了
934
951
  options.specialAreaStyle, // style
@@ -940,18 +957,25 @@ var egovaBI = function(globeMap, gisMap, mapType){
940
957
  false, // randomColor
941
958
  false, // renderCanvas
942
959
  true, // singleSelect
943
- {
944
- minZoom: options.visiblitySetting.beginLevel,
945
- maxZoom: options.visiblitySetting.endLevel,
946
- layerId: options.layerName,
947
- order: options.order
948
- // hLabelStyle: options.hLabelStyle, // 选中文字时效果,没用
949
- },
960
+ lfceOpt,
950
961
  options.layerName, // layerTag
951
- options.eventSetting.clickCallback
962
+ options.eventSetting.clickCallback,
963
+ options.eventSetting.mouseMoveCallback
952
964
  );
953
965
  }
954
- if(specialAreaS&&specialAreaS.length>0){
966
+ if (specialAreaS && specialAreaS.length > 0) {
967
+ var lfcsOpt = {
968
+ minZoom: options.visiblitySetting.beginLevel,
969
+ maxZoom: options.visiblitySetting.endLevel,
970
+ layerId: options.layerName,
971
+ comCallbak: callback,
972
+ order: options.order
973
+ // hLabelStyle: options.hLabelStyle, // 选中文字时效果,没用
974
+ };
975
+ if (options.labelSetting.labelZoomEnabled == 'show') {
976
+ lfcsOpt.labelMinZoom = options.labelSetting.labelMinZoom;
977
+ lfcsOpt.labelMaxZoom = options.labelSetting.labelMaxZoom;
978
+ }
955
979
  for (var j = 0; j < specialAreaS.length; j++) {
956
980
  var specialArea=specialAreaS[j];
957
981
  if(specialArea.geometries.length>0){
@@ -966,21 +990,18 @@ var egovaBI = function(globeMap, gisMap, mapType){
966
990
  false,// randomColor
967
991
  false, // renderCanvas
968
992
  true, // singleSelect
969
- {
970
- minZoom: options.visiblitySetting.beginLevel,
971
- maxZoom: options.visiblitySetting.endLevel,
972
- layerId: options.layerName,
973
- comCallbak: callback,
974
- order: options.order
975
- // hLabelStyle: options.hLabelStyle, // 选中文字时效果,没用
976
- },
993
+ lfcsOpt,
977
994
  options.layerName, // layerTag
978
- options.eventSetting.clickCallback
995
+ options.eventSetting.clickCallback,
996
+ options.eventSetting.mouseMoveCallback
979
997
  );
980
998
  }
981
999
 
982
1000
  }
983
1001
  }
1002
+ if(dataLoadCb){
1003
+ dataLoadCb(true)
1004
+ }
984
1005
  }
985
1006
 
986
1007
  if (!data) {
@@ -996,6 +1017,12 @@ var egovaBI = function(globeMap, gisMap, mapType){
996
1017
  }
997
1018
  }
998
1019
  } else {
1020
+ if(data.length==0){
1021
+ if(dataLoadCb){
1022
+ dataLoadCb(false)
1023
+ }
1024
+ return;
1025
+ }
999
1026
  var _data = JSON.parse(JSON.stringify(data[0]));
1000
1027
  var newData = data[0];
1001
1028
  if (newData && newData.geometry) {
@@ -1115,6 +1142,16 @@ var egovaBI = function(globeMap, gisMap, mapType){
1115
1142
  }
1116
1143
 
1117
1144
  }
1145
+ this.enableMapEvents = function (enablePan, enableZoom,callbackArray) {
1146
+ if (gisMap != null && mapType == "map") {
1147
+ gisMap.enableMapEvents(enablePan, enableZoom,callbackArray);
1148
+ }
1149
+ }
1150
+ this.setMapOpacity = function (opacity) {
1151
+ if (gisMap != null && mapType == "map") {
1152
+ gisMap.setMapOpacity(opacity);
1153
+ }
1154
+ }
1118
1155
  }
1119
1156
 
1120
1157
 
@@ -310,6 +310,14 @@ var EGovaGISMap = function ($container, pScene, prefix, gisParams, mapConfig,con
310
310
  scene.fire(msgPrefix + ":removeWMSLayer", { args : [ serviceID ] }, parentScene, false);
311
311
  }
312
312
 
313
+ /*添加自定义WMS服务图层*/
314
+ that.addCustomWMSLayer = function(layerID, style, hStyle,where,outFields,visibleLevel,colorseparField,colorseparoptions) {
315
+ if (scene == null)
316
+ return;
317
+ scene.fire(msgPrefix + ":addCustomWMSLayer", { args : [ layerID, style, hStyle,where,outFields,visibleLevel,colorseparField,colorseparoptions ] }, parentScene, false);
318
+ }
319
+
320
+
313
321
 
314
322
  /*根据要素坐标定位显示要素*/
315
323
  that.locateFeatureByCoords=function(geometries, type, ID, style, hStyle, zoom, keyFiled, labelField, labelStyle, randomColor, renderCanvas, singleSelected, options, layerTag){
@@ -700,10 +708,10 @@ var EGovaGISMap = function ($container, pScene, prefix, gisParams, mapConfig,con
700
708
  scene.fire(msgPrefix + ":eventLocate", { args : [ eventID, defaultMapRange ] }, parentScene, false);
701
709
  }
702
710
  /* 显示特定图层 */
703
- that.showMapLayers = function(layerTag, showLevel, mode, styles) {
711
+ that.showMapLayers = function(layerTag, showLevel, mode, styles,layerDefs) {
704
712
  if (scene == null)
705
713
  return;
706
- scene.fire(msgPrefix + ":showMapLayers", { args : [ layerTag, showLevel, mode, styles] }, parentScene, false);
714
+ scene.fire(msgPrefix + ":showMapLayers", { args : [ layerTag, showLevel, mode, styles,layerDefs] }, parentScene, false);
707
715
  }
708
716
  /* 显示车辆人员轨迹 */
709
717
  that.showObjectTrace = function (objectID, symbolType, dateTime, queryCondition, hideControlPanel, symbolPic, optimizeParams, infoCallback, updatePositionCallback, closeCallback, traceDigCallback) {
@@ -883,7 +891,7 @@ var EGovaGISMap = function ($container, pScene, prefix, gisParams, mapConfig,con
883
891
  scene.fire(msgPrefix + ":showObjectTrace", { args : [ objectID, symbolType, dataTime, queryCondition ]}, parentScene);
884
892
  }
885
893
  /* 绘制巡更路线 */
886
- that.showPatrolRoute = function(routeList, type, bClear, editable) {
894
+ that.showPatrolRoute = function(routeList, type, bClear, editable, zoom, options) {
887
895
  if (scene == null)
888
896
  return;
889
897
  if (!(routeList instanceof Array))
@@ -906,14 +914,21 @@ var EGovaGISMap = function ($container, pScene, prefix, gisParams, mapConfig,con
906
914
  }
907
915
  graphics.push(graphic);
908
916
  }
909
- var style = { color : [ 255, 0, 0, 150 ], width : 2 };
917
+ var lineStyle = options.lineStyle || {};
918
+ var arrowStyle = options.arrowStyle || {};
919
+ var style = { color : [ 255, 0, 0, 150 ], width : 6 };
910
920
  if (type == "dutyGridRoute") {
911
921
  style.color = [ 0, 0, 255, 150 ]
912
922
  }
913
923
  if (type == "patrolRoute") {
914
924
  style.color = [ 0, 255, 0, 150 ]
915
925
  }
916
- scene.fire(msgPrefix + ":showPatrolRoute", { args : [ graphics, bClear, style, editable ] }, parentScene);
926
+ var lineSymbol = Object.assign(style, lineStyle);
927
+ var arrowSymbol = Object.assign({size: 6}, arrowStyle);
928
+ var option = {};
929
+ option.arrowStyle = arrowSymbol;
930
+ option.visible = options.visible == null || options.visible == "undefined" ? true:options.visible;
931
+ scene.fire(msgPrefix + ":showPatrolRoute", { args : [ graphics, bClear, lineSymbol, editable, zoom, option ] }, parentScene);
917
932
  }
918
933
  /* 添加巡更路线 */
919
934
  that.addPatrolRoute = function(addCallback, editCallback) {
@@ -558,12 +558,16 @@ var EGovaGISMap = function ($container, pScene, prefix, gisParams, mapConfig, co
558
558
  }
559
559
  }
560
560
  /*根据要素坐标定位显示要素*/
561
- that.locateFeatureByCoords = function (geometries, type, ID, style, hStyle, zoom, keyFiled, labelField, labelStyle, randomColor, renderCanvas, singleSelected, options, layerTag, callback) {
561
+ that.locateFeatureByCoords = function (geometries, type, ID, style, hStyle, zoom, keyFiled, labelField, labelStyle, randomColor, renderCanvas, singleSelected, options, layerTag, callback,mouseMoveCallback) {
562
562
  if (scene == null)
563
563
  return;
564
564
  var cb = function (type, data) {
565
- if (callback && type == 'locateFeatureByIDsCallback')
565
+ if (callback && type == 'locateFeatureByIDsCallback'){
566
566
  callback(data);
567
+ }
568
+ if (mouseMoveCallback && type != 'locateFeatureByIDsCallback'){
569
+ mouseMoveCallback(type, data);
570
+ }
567
571
  };
568
572
  that.callMap('locateFeatureByCoords', geometries, type, ID, style, hStyle, zoom, keyFiled, labelField, labelStyle, randomColor, renderCanvas, singleSelected, options, layerTag, cb);
569
573
  }
@@ -968,10 +972,10 @@ var EGovaGISMap = function ($container, pScene, prefix, gisParams, mapConfig, co
968
972
 
969
973
  }
970
974
  /* 显示特定图层 */
971
- that.showMapLayers = function (layerTag, showLevel, mode, styles) {
975
+ that.showMapLayers = function (layerTag, showLevel, mode, styles,layerDefs) {
972
976
  if (scene == null)
973
977
  return;
974
- that.callMap('showMapLayers', layerTag, showLevel, mode, styles);
978
+ that.callMap('showMapLayers', layerTag, showLevel, mode, styles,layerDefs);
975
979
  }
976
980
  that.showWMSLayer = function (layerUsageID, IDs, keyField, geometry, where, layerName, options) {
977
981
  if (scene == null)
@@ -983,6 +987,11 @@ var EGovaGISMap = function ($container, pScene, prefix, gisParams, mapConfig, co
983
987
  return;
984
988
  that.callMap('removeWMSLayerId', layerId, options);
985
989
  }
990
+ that.addCustomWMSLayer = function (layerID, style, hStyle,where,outFields,visibleLevel,colorseparField,colorseparoptions) {
991
+ if (scene == null)
992
+ return;
993
+ that.callMap('addCustomWMSLayer', layerID, style, hStyle,where,outFields,visibleLevel,colorseparField,colorseparoptions);
994
+ }
986
995
 
987
996
  /* 刷新图层目录树中图层 */
988
997
  that.refreshMapLayers = function () {
@@ -1103,7 +1112,7 @@ var EGovaGISMap = function ($container, pScene, prefix, gisParams, mapConfig, co
1103
1112
  that.callMap('showObjectTrace', objectID, symbolType, dataTime, queryCondition, hidePanel, symbolPic, optimizeParams, cb);
1104
1113
  }
1105
1114
  /* 绘制巡更路线 */
1106
- that.showPatrolRoute = function (routeList, type, bClear, editable, zoom, callback) {
1115
+ that.showPatrolRoute = function (routeList, type, bClear, editable, zoom, callback, options) {
1107
1116
  if (scene == null)
1108
1117
  return;
1109
1118
  if (!(routeList instanceof Array))
@@ -1141,16 +1150,20 @@ var EGovaGISMap = function ($container, pScene, prefix, gisParams, mapConfig, co
1141
1150
  graphic.label = route.label;
1142
1151
  graphics.push(graphic);
1143
1152
  }
1144
- var style = {
1145
- color: [255, 0, 0, 150],
1146
- width: 2
1147
- };
1148
- if (type == "dutyGridRoute") {
1149
- style.color = [0, 0, 255, 150]
1150
- }
1151
- if (type == "patrolRoute") {
1152
- style.color = [0, 255, 0, 150]
1153
- }
1153
+ var lineStyle = options.lineStyle || {};
1154
+ var arrowStyle = options.arrowStyle || {};
1155
+ var style = { color : [ 255, 0, 0, 150 ], width : 2 };
1156
+ if (type == "dutyGridRoute") {
1157
+ style.color = [ 0, 0, 255, 150 ]
1158
+ }
1159
+ if (type == "patrolRoute") {
1160
+ style.color = [ 0, 255, 0, 150 ]
1161
+ }
1162
+ var lineSymbol = Object.assign(style, lineStyle);
1163
+ var arrowSymbol = Object.assign({}, arrowStyle);
1164
+ var option = {};
1165
+ option.arrowStyle = arrowSymbol;
1166
+ option.visible = options.visible || true;
1154
1167
  var cb = function (type, data) {
1155
1168
  if (callback && type == 'drawPatrolRouteEditCallback') {
1156
1169
  callback(data);
@@ -1158,7 +1171,7 @@ var EGovaGISMap = function ($container, pScene, prefix, gisParams, mapConfig, co
1158
1171
  that.fireCallback(type, data);
1159
1172
  }
1160
1173
  };
1161
- that.callMap('showPatrolRoute', graphics, bClear, style, editable, zoom, cb);
1174
+ that.callMap('showPatrolRoute', graphics, bClear, lineSymbol, editable, zoom, cb, option);
1162
1175
  }
1163
1176
  /* 添加巡更路线 */
1164
1177
  that.addPatrolRoute = function (addCallback, editCallback) {
@@ -1762,8 +1775,8 @@ var EGovaGISMap = function ($container, pScene, prefix, gisParams, mapConfig, co
1762
1775
  that.startQueryWMSFeature = function (layerUsageID, IDs, keyField, geometry, where, hideInfoWindow) {
1763
1776
  that.callMap('startQueryWMSFeature', layerUsageID, IDs, keyField, geometry, where, hideInfoWindow);
1764
1777
  }
1765
- that.enableMapEvents = function (enablePan, enableZoom) {
1766
- that.callMap('enableMapEvents', enablePan, enableZoom);
1778
+ that.enableMapEvents = function (enablePan, enableZoom,callbackArray) {
1779
+ that.callMap('enableMapEvents', enablePan, enableZoom,callbackArray);
1767
1780
  }
1768
1781
 
1769
1782
  /* 获取坐标和层级 */
@@ -1868,9 +1881,15 @@ var EGovaGISMap = function ($container, pScene, prefix, gisParams, mapConfig, co
1868
1881
  }
1869
1882
 
1870
1883
  that.addRadar = function(options){
1871
- that.callMap('addRadar', options.x, options.y, options.radius, options.symbolUrl);
1884
+ that.callMap('addRadar', options.x, options.y, options.radius, options.symbolUrl, options.speed);
1885
+ }
1886
+ /**
1887
+ * 设置基础图层透明度
1888
+ * @param {*} opacity 0.01-1
1889
+ */
1890
+ that.setMapOpacity = function (opacity) {
1891
+ that.callMap('setMapOpacity', opacity);
1872
1892
  }
1873
-
1874
1893
  that.init();
1875
1894
  }
1876
1895
 
@@ -1935,7 +1935,7 @@ var EGovaMap = function (containerID, callback, mapConfig, mapType, mapParam, co
1935
1935
  }
1936
1936
 
1937
1937
  /* 显示特定图层 */
1938
- that.showMapLayers = function (layerTag, showLevel, mode, styles) {
1938
+ that.showMapLayers = function (layerTag, showLevel, mode, styles,layerDefs) {
1939
1939
  if (scene == null)
1940
1940
  return;
1941
1941
  if (gisMap != null) {
@@ -2103,7 +2103,7 @@ var EGovaMap = function (containerID, callback, mapConfig, mapType, mapParam, co
2103
2103
  }
2104
2104
 
2105
2105
  /* 绘制巡更路线 */
2106
- that.showPatrolRoute = function (routeList, type, bClear, editable) {
2106
+ that.showPatrolRoute = function (routeList, type, bClear, editable, zoom, options) {
2107
2107
  if (scene == null)
2108
2108
  return;
2109
2109
  if (gisMap != null) {
@@ -3460,6 +3460,15 @@ var EGovaMap = function (containerID, callback, mapConfig, mapType, mapParam, co
3460
3460
  gisMap.addWMSLayer(id, url, options);
3461
3461
  }
3462
3462
  }
3463
+
3464
+ //添加自定义WMS图层
3465
+ that.addCustomWMSLayer = function (layerID, style, hStyle,where,outFields,visibleLevel,colorseparField,colorseparoptions) {
3466
+ if (scene == null)
3467
+ return;
3468
+ if (gisMap != null) {
3469
+ gisMap.addCustomWMSLayer(layerID, style, hStyle,where,outFields,visibleLevel,colorseparField,colorseparoptions);
3470
+ }
3471
+ }
3463
3472
  /**
3464
3473
  * 添加WMTS图层
3465
3474
  * @param {String} id 图层id
@@ -1,5 +1,6 @@
1
1
  import CoordConvConfig from './coordconvert/CoordConvConfig';
2
- var coordConvert=require('egovacoordconvert/index');
2
+ import * as coordConvert from 'egovacoordconvert/build/dist/coordconvert';
3
+
3
4
  var MapUtils = {
4
5
  type: function (obj) {
5
6
  var result = Array.isArray(obj) ? 'array' : (typeof obj);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "egovamap",
3
- "version": "0.20.0",
3
+ "version": "0.21.0",
4
4
  "description": "eUrbanGIS SDK",
5
5
  "main": "index.js",
6
6
  "scripts": {